Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Nuke: write node colorspace ignore default() label #1199

Merged
merged 1 commit into from
Mar 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pype/plugins/nuke/publish/collect_writes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import nuke
import pyblish.api

import re

@pyblish.api.log
class CollectNukeWrites(pyblish.api.InstancePlugin):
Expand Down Expand Up @@ -113,9 +113,16 @@ def process(self, instance):
instance.data["representations"].append(representation)
self.log.debug("couldn't collect frames: {}".format(label))

colorspace = node["colorspace"].value()

# remove default part of the string
if "default (" in colorspace:
colorspace = re.sub(r"default.\(|\)", "", colorspace)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With such a specific string to replace you can just colorspace.replace("default (", ""). If it doesnt find it, it wont replace it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you are right except there is also the closing bracket to remove but only in case of default ( in name. But yeah it could be written differently.

self.log.debug("colorspace: `{}`".format(colorspace))

# Add version data to instance
version_data = {
"colorspace": node["colorspace"].value(),
"colorspace": colorspace,
}

group_node = [x for x in instance if x.Class() == "Group"][0]
Expand All @@ -141,7 +148,7 @@ def process(self, instance):
"frameEndHandle": last_frame,
"outputType": output_type,
"families": families,
"colorspace": node["colorspace"].value(),
"colorspace": colorspace,
"deadlineChunkSize": deadlineChunkSize,
"deadlinePriority": deadlinePriority
})
Expand Down