Merge branch 'develop' into bugfix/OP-6354_colorspace-submit-to-deadline-with-OCIO-env-var-new

This commit is contained in:
Jakub Ježek 2023-08-04 15:07:19 +02:00 committed by GitHub
commit 1f55b44d0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
85 changed files with 1132 additions and 438 deletions

View file

@ -1699,7 +1699,7 @@ def create_write_node_legacy(
knob_value = float(knob_value)
if knob_type == "bool":
knob_value = bool(knob_value)
if knob_type in ["2d_vector", "3d_vector"]:
if knob_type in ["2d_vector", "3d_vector", "color", "box"]:
knob_value = list(knob_value)
GN[knob_name].setValue(knob_value)
@ -1715,7 +1715,7 @@ def set_node_knobs_from_settings(node, knob_settings, **kwargs):
Args:
node (nuke.Node): nuke node
knob_settings (list): list of dict. Keys are `type`, `name`, `value`
kwargs (dict)[optional]: keys for formatable knob settings
kwargs (dict)[optional]: keys for formattable knob settings
"""
for knob in knob_settings:
log.debug("__ knob: {}".format(pformat(knob)))
@ -1732,7 +1732,7 @@ def set_node_knobs_from_settings(node, knob_settings, **kwargs):
)
continue
# first deal with formatable knob settings
# first deal with formattable knob settings
if knob_type == "formatable":
template = knob["template"]
to_type = knob["to_type"]
@ -1741,8 +1741,8 @@ def set_node_knobs_from_settings(node, knob_settings, **kwargs):
**kwargs
)
except KeyError as msg:
log.warning("__ msg: {}".format(msg))
raise KeyError(msg)
raise KeyError(
"Not able to format expression: {}".format(msg))
# convert value to correct type
if to_type == "2d_vector":
@ -1781,8 +1781,8 @@ def convert_knob_value_to_correct_type(knob_type, knob_value):
knob_value = knob_value
elif knob_type == "color_gui":
knob_value = color_gui_to_int(knob_value)
elif knob_type in ["2d_vector", "3d_vector", "color"]:
knob_value = [float(v) for v in knob_value]
elif knob_type in ["2d_vector", "3d_vector", "color", "box"]:
knob_value = [float(val_) for val_ in knob_value]
return knob_value

View file

@ -539,6 +539,8 @@ def list_instances(creator_id=None):
"""
instances_by_order = defaultdict(list)
subset_instances = []
instance_ids = set()
for node in nuke.allNodes(recurseGroups=True):
if node.Class() in ["Viewer", "Dot"]:
@ -564,6 +566,14 @@ def list_instances(creator_id=None):
if creator_id and instance_data["creator_identifier"] != creator_id:
continue
if instance_data["instance_id"] in instance_ids:
instance_data.pop("instance_id")
else:
instance_ids.add(instance_data["instance_id"])
# node name could change, so update subset name data
_update_subset_name_data(instance_data, node)
if "render_order" not in node.knobs():
subset_instances.append((node, instance_data))
continue
@ -572,23 +582,43 @@ def list_instances(creator_id=None):
instances_by_order[order].append((node, instance_data))
# Sort instances based on order attribute or subset name.
# TODO: remove in future Publisher enhanced with sorting
ordered_instances = []
for key in sorted(instances_by_order.keys()):
instances_by_subset = {}
for node, data in instances_by_order[key]:
instances_by_subset[data["subset"]] = (node, data)
instances_by_subset = defaultdict(list)
for node, data_ in instances_by_order[key]:
instances_by_subset[data_["subset"]].append((node, data_))
for subkey in sorted(instances_by_subset.keys()):
ordered_instances.append(instances_by_subset[subkey])
ordered_instances.extend(instances_by_subset[subkey])
instances_by_subset = {}
for node, data in subset_instances:
instances_by_subset[data["subset"]] = (node, data)
instances_by_subset = defaultdict(list)
for node, data_ in subset_instances:
instances_by_subset[data_["subset"]].append((node, data_))
for key in sorted(instances_by_subset.keys()):
ordered_instances.append(instances_by_subset[key])
ordered_instances.extend(instances_by_subset[key])
return ordered_instances
def _update_subset_name_data(instance_data, node):
"""Update subset name data in instance data.
Args:
instance_data (dict): instance creator data
node (nuke.Node): nuke node
"""
# make sure node name is subset name
old_subset_name = instance_data["subset"]
old_variant = instance_data["variant"]
subset_name_root = old_subset_name.replace(old_variant, "")
new_subset_name = node.name()
new_variant = new_subset_name.replace(subset_name_root, "")
instance_data["subset"] = new_subset_name
instance_data["variant"] = new_variant
def remove_instance(instance):
"""Remove instance from current workfile metadata.

View file

@ -212,9 +212,15 @@ class NukeCreator(NewCreator):
created_instance["creator_attributes"].pop(key)
def update_instances(self, update_list):
for created_inst, _changes in update_list:
for created_inst, changes in update_list:
instance_node = created_inst.transient_data["node"]
# update instance node name if subset name changed
if "subset" in changes.changed_keys:
instance_node["name"].setValue(
changes["subset"].new_value
)
# in case node is not existing anymore (user erased it manually)
try:
instance_node.fullName()
@ -256,6 +262,17 @@ class NukeWriteCreator(NukeCreator):
family = "write"
icon = "sign-out"
def get_linked_knobs(self):
linked_knobs = []
if "channels" in self.instance_attributes:
linked_knobs.append("channels")
if "ordered" in self.instance_attributes:
linked_knobs.append("render_order")
if "use_range_limit" in self.instance_attributes:
linked_knobs.extend(["___", "first", "last", "use_limit"])
return linked_knobs
def integrate_links(self, node, outputs=True):
# skip if no selection
if not self.selected_node:
@ -921,7 +938,11 @@ class ExporterReviewMov(ExporterReview):
except Exception:
self.log.info("`mov64_codec` knob was not found")
write_node["mov64_write_timecode"].setValue(1)
try:
write_node["mov64_write_timecode"].setValue(1)
except Exception:
self.log.info("`mov64_write_timecode` knob was not found")
write_node["raw"].setValue(1)
# connect
write_node.setInput(0, self.previous_node)

View file

@ -1,11 +1,12 @@
from openpype.lib import PreLaunchHook
from openpype.lib.applications import PreLaunchHook
class PrelaunchNukeAssistHook(PreLaunchHook):
"""
Adding flag when nukeassist
"""
app_groups = ["nukeassist"]
app_groups = {"nukeassist"}
launch_types = set()
def execute(self):
self.launch_context.env["NUKEASSIST"] = "1"

View file

@ -64,9 +64,6 @@ class CreateWriteImage(napi.NukeWriteCreator):
)
def create_instance_node(self, subset_name, instance_data):
linked_knobs_ = []
if "use_range_limit" in self.instance_attributes:
linked_knobs_ = ["channels", "___", "first", "last", "use_limit"]
# add fpath_template
write_data = {
@ -81,7 +78,7 @@ class CreateWriteImage(napi.NukeWriteCreator):
write_data,
input=self.selected_node,
prenodes=self.prenodes,
linked_knobs=linked_knobs_,
linked_knobs=self.get_linked_knobs(),
**{
"frame": nuke.frame()
}

View file

@ -45,12 +45,6 @@ class CreateWritePrerender(napi.NukeWriteCreator):
return attr_defs
def create_instance_node(self, subset_name, instance_data):
linked_knobs_ = []
if "use_range_limit" in self.instance_attributes:
linked_knobs_ = ["channels", "___", "first", "last", "use_limit"]
linked_knobs_.append("render_order")
# add fpath_template
write_data = {
"creator": self.__class__.__name__,
@ -73,7 +67,7 @@ class CreateWritePrerender(napi.NukeWriteCreator):
write_data,
input=self.selected_node,
prenodes=self.prenodes,
linked_knobs=linked_knobs_,
linked_knobs=self.get_linked_knobs(),
**{
"width": width,
"height": height

View file

@ -39,10 +39,6 @@ class CreateWriteRender(napi.NukeWriteCreator):
return attr_defs
def create_instance_node(self, subset_name, instance_data):
linked_knobs_ = [
"channels", "___", "first", "last", "use_limit", "render_order"
]
# add fpath_template
write_data = {
"creator": self.__class__.__name__,
@ -60,12 +56,15 @@ class CreateWriteRender(napi.NukeWriteCreator):
actual_format = nuke.root().knob('format').value()
width, height = (actual_format.width(), actual_format.height())
self.log.debug(">>>>>>> : {}".format(self.instance_attributes))
self.log.debug(">>>>>>> : {}".format(self.get_linked_knobs()))
created_node = napi.create_write_node(
subset_name,
write_data,
input=self.selected_node,
prenodes=self.prenodes,
linked_knobs=linked_knobs_,
linked_knobs=self.get_linked_knobs(),
**{
"width": width,
"height": height

View file

@ -91,14 +91,14 @@ class LoadClip(plugin.NukeLoader):
# reset container id so it is always unique for each instance
self.reset_container_id()
self.log.warning(self.extensions)
is_sequence = len(representation["files"]) > 1
if is_sequence:
representation = self._representation_with_hash_in_frame(
representation
context["representation"] = \
self._representation_with_hash_in_frame(
representation
)
filepath = self.filepath_from_context(context)
filepath = filepath.replace("\\", "/")
self.log.debug("_ filepath: {}".format(filepath))
@ -260,6 +260,7 @@ class LoadClip(plugin.NukeLoader):
representation = self._representation_with_hash_in_frame(
representation
)
filepath = get_representation_path(representation).replace("\\", "/")
self.log.debug("_ filepath: {}".format(filepath))