From 55c3bdbd06f0baa06550654342ea7a66bd31c6e4 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 21 Dec 2023 17:30:37 +0800 Subject: [PATCH 01/23] add the contextmanager functions for 'reverting lock attributes' --- openpype/hosts/maya/api/lib.py | 139 +++++++++++++++++++-------------- 1 file changed, 79 insertions(+), 60 deletions(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index af726409d4..64cd5b6b6d 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -2565,6 +2565,66 @@ def bake_to_world_space(nodes, list: The newly created and baked node names. """ + @contextlib.contextmanager + def _revert_lock_attributes(node, new_node): + # Connect all attributes on the node except for transform + # attributes + attrs = _get_attrs(node) + attrs = set(attrs) - transform_attrs if attrs else [] + original_attrs_lock = {} + try: + for attr in attrs: + orig_node_attr = '{0}.{1}'.format(node, attr) + new_node_attr = '{0}.{1}'.format(new_node, attr) + original_attrs_lock[new_node_attr] = ( + cmds.getAttr(new_node_attr, lock=True) + ) + + # unlock to avoid connection errors + cmds.setAttr(new_node_attr, lock=False) + + cmds.connectAttr(orig_node_attr, + new_node_attr, + force=True) + yield + finally: + for attr, lock_state in original_attrs_lock.items(): + cmds.setAttr(attr, lock=lock_state) + + @contextlib.contextmanager + def _revert_lock_shape_attributes(node, new_node, shape): + # If shapes are also baked then connect those keyable attributes + if shape: + children_shapes = cmds.listRelatives(new_node, + children=True, + fullPath=True, + shapes=True) + if children_shapes: + orig_children_shapes = cmds.listRelatives(node, + children=True, + fullPath=True, + shapes=True) + original_shape_lock_attrs = {} + try: + for orig_shape, new_shape in zip(orig_children_shapes, + children_shapes): + attrs = _get_attrs(orig_shape) + for attr in attrs: + orig_node_attr = '{0}.{1}'.format(orig_shape, attr) + new_node_attr = '{0}.{1}'.format(new_shape, attr) + original_shape_lock_attrs[new_node_attr] = ( + cmds.getAttr(new_node_attr, lock=True) + ) + # unlock to avoid connection errors + cmds.setAttr(new_node_attr, lock=False) + + cmds.connectAttr(orig_node_attr, + new_node_attr, + force=True) + yield + finally: + for attr, lock_state in original_shape_lock_attrs.items(): + cmds.setAttr(attr, lock=lock_state) def _get_attrs(node): """Workaround for buggy shape attribute listing with listAttr""" @@ -2599,7 +2659,6 @@ def bake_to_world_space(nodes, world_space_nodes = [] with delete_after() as delete_bin: - # Create the duplicate nodes that are in world-space connected to # the originals for node in nodes: @@ -2610,69 +2669,29 @@ def bake_to_world_space(nodes, new_node = cmds.duplicate(node, name=new_name, renameChildren=True)[0] # noqa + with _revert_lock_attributes(node, new_node): + with _revert_lock_shape_attributes(node, new_node): + # Parent to world + if cmds.listRelatives(new_node, parent=True): + new_node = cmds.parent(new_node, world=True)[0] - # Connect all attributes on the node except for transform - # attributes - attrs = _get_attrs(node) - attrs = set(attrs) - transform_attrs if attrs else [] + # Unlock transform attributes so constraint can be created + for attr in transform_attrs: + cmds.setAttr('{0}.{1}'.format(new_node, attr), lock=False) - for attr in attrs: - orig_node_attr = '{0}.{1}'.format(node, attr) - new_node_attr = '{0}.{1}'.format(new_node, attr) + # Constraints + delete_bin.extend(cmds.parentConstraint(node, new_node, mo=False)) + delete_bin.extend(cmds.scaleConstraint(node, new_node, mo=False)) - # unlock to avoid connection errors - cmds.setAttr(new_node_attr, lock=False) + world_space_nodes.append(new_node) - cmds.connectAttr(orig_node_attr, - new_node_attr, - force=True) - - # If shapes are also baked then connect those keyable attributes - if shape: - children_shapes = cmds.listRelatives(new_node, - children=True, - fullPath=True, - shapes=True) - if children_shapes: - orig_children_shapes = cmds.listRelatives(node, - children=True, - fullPath=True, - shapes=True) - for orig_shape, new_shape in zip(orig_children_shapes, - children_shapes): - attrs = _get_attrs(orig_shape) - for attr in attrs: - orig_node_attr = '{0}.{1}'.format(orig_shape, attr) - new_node_attr = '{0}.{1}'.format(new_shape, attr) - - # unlock to avoid connection errors - cmds.setAttr(new_node_attr, lock=False) - - cmds.connectAttr(orig_node_attr, - new_node_attr, - force=True) - - # Parent to world - if cmds.listRelatives(new_node, parent=True): - new_node = cmds.parent(new_node, world=True)[0] - - # Unlock transform attributes so constraint can be created - for attr in transform_attrs: - cmds.setAttr('{0}.{1}'.format(new_node, attr), lock=False) - - # Constraints - delete_bin.extend(cmds.parentConstraint(node, new_node, mo=False)) - delete_bin.extend(cmds.scaleConstraint(node, new_node, mo=False)) - - world_space_nodes.append(new_node) - - bake(world_space_nodes, - frame_range=frame_range, - step=step, - simulation=simulation, - preserve_outside_keys=preserve_outside_keys, - disable_implicit_control=disable_implicit_control, - shape=shape) + bake(world_space_nodes, + frame_range=frame_range, + step=step, + simulation=simulation, + preserve_outside_keys=preserve_outside_keys, + disable_implicit_control=disable_implicit_control, + shape=shape) return world_space_nodes From ac7b2963dd928f04cce701e8d6ef3b74b26a02ed Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 21 Dec 2023 17:34:07 +0800 Subject: [PATCH 02/23] hound --- openpype/hosts/maya/api/lib.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index 64cd5b6b6d..959a615ef9 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -2584,8 +2584,8 @@ def bake_to_world_space(nodes, cmds.setAttr(new_node_attr, lock=False) cmds.connectAttr(orig_node_attr, - new_node_attr, - force=True) + new_node_attr, + force=True) yield finally: for attr, lock_state in original_attrs_lock.items(): @@ -2596,18 +2596,18 @@ def bake_to_world_space(nodes, # If shapes are also baked then connect those keyable attributes if shape: children_shapes = cmds.listRelatives(new_node, - children=True, - fullPath=True, - shapes=True) + children=True, + fullPath=True, + shapes=True) if children_shapes: orig_children_shapes = cmds.listRelatives(node, - children=True, - fullPath=True, - shapes=True) + children=True, + fullPath=True, + shapes=True) original_shape_lock_attrs = {} try: for orig_shape, new_shape in zip(orig_children_shapes, - children_shapes): + children_shapes): attrs = _get_attrs(orig_shape) for attr in attrs: orig_node_attr = '{0}.{1}'.format(orig_shape, attr) @@ -2619,8 +2619,8 @@ def bake_to_world_space(nodes, cmds.setAttr(new_node_attr, lock=False) cmds.connectAttr(orig_node_attr, - new_node_attr, - force=True) + new_node_attr, + force=True) yield finally: for attr, lock_state in original_shape_lock_attrs.items(): From a75ff0f71aab21daa86ffd40ce45ff0e8b9aee20 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 21 Dec 2023 17:36:35 +0800 Subject: [PATCH 03/23] hound --- openpype/hosts/maya/api/lib.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index 959a615ef9..3bc8b67a81 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -2671,27 +2671,30 @@ def bake_to_world_space(nodes, renameChildren=True)[0] # noqa with _revert_lock_attributes(node, new_node): with _revert_lock_shape_attributes(node, new_node): - # Parent to world + # Parent to world if cmds.listRelatives(new_node, parent=True): new_node = cmds.parent(new_node, world=True)[0] # Unlock transform attributes so constraint can be created for attr in transform_attrs: - cmds.setAttr('{0}.{1}'.format(new_node, attr), lock=False) + cmds.setAttr( + '{0}.{1}'.format(new_node, attr), lock=False) # Constraints - delete_bin.extend(cmds.parentConstraint(node, new_node, mo=False)) - delete_bin.extend(cmds.scaleConstraint(node, new_node, mo=False)) + delete_bin.extend( + cmds.parentConstraint(node, new_node, mo=False)) + delete_bin.extend( + cmds.scaleConstraint(node, new_node, mo=False)) world_space_nodes.append(new_node) bake(world_space_nodes, - frame_range=frame_range, - step=step, - simulation=simulation, - preserve_outside_keys=preserve_outside_keys, - disable_implicit_control=disable_implicit_control, - shape=shape) + frame_range=frame_range, + step=step, + simulation=simulation, + preserve_outside_keys=preserve_outside_keys, + disable_implicit_control=disable_implicit_control, + shape=shape) return world_space_nodes From 1a39a5cc99ca18fcd2354a5e5d8e928ce67bc4df Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Fri, 22 Dec 2023 11:09:46 +0100 Subject: [PATCH 04/23] Unlock attributes only during the bake context, make sure attributes are relocked after to preserve the lock state of the original node being baked --- openpype/hosts/maya/api/lib.py | 171 +++++++++++++++++---------------- 1 file changed, 87 insertions(+), 84 deletions(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index 3bc8b67a81..63f0812785 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -2566,68 +2566,36 @@ def bake_to_world_space(nodes, """ @contextlib.contextmanager - def _revert_lock_attributes(node, new_node): - # Connect all attributes on the node except for transform - # attributes - attrs = _get_attrs(node) - attrs = set(attrs) - transform_attrs if attrs else [] - original_attrs_lock = {} + def _unlock_attr(attr): + """Unlock attribute during context if it is locked""" + if not cmds.getAttr(attr, lock=True): + # If not locked, do nothing + yield + return try: - for attr in attrs: - orig_node_attr = '{0}.{1}'.format(node, attr) - new_node_attr = '{0}.{1}'.format(new_node, attr) - original_attrs_lock[new_node_attr] = ( - cmds.getAttr(new_node_attr, lock=True) - ) - - # unlock to avoid connection errors - cmds.setAttr(new_node_attr, lock=False) - - cmds.connectAttr(orig_node_attr, - new_node_attr, - force=True) + cmds.setAttr(attr, lock=False) yield finally: - for attr, lock_state in original_attrs_lock.items(): - cmds.setAttr(attr, lock=lock_state) - - @contextlib.contextmanager - def _revert_lock_shape_attributes(node, new_node, shape): - # If shapes are also baked then connect those keyable attributes - if shape: - children_shapes = cmds.listRelatives(new_node, - children=True, - fullPath=True, - shapes=True) - if children_shapes: - orig_children_shapes = cmds.listRelatives(node, - children=True, - fullPath=True, - shapes=True) - original_shape_lock_attrs = {} - try: - for orig_shape, new_shape in zip(orig_children_shapes, - children_shapes): - attrs = _get_attrs(orig_shape) - for attr in attrs: - orig_node_attr = '{0}.{1}'.format(orig_shape, attr) - new_node_attr = '{0}.{1}'.format(new_shape, attr) - original_shape_lock_attrs[new_node_attr] = ( - cmds.getAttr(new_node_attr, lock=True) - ) - # unlock to avoid connection errors - cmds.setAttr(new_node_attr, lock=False) - - cmds.connectAttr(orig_node_attr, - new_node_attr, - force=True) - yield - finally: - for attr, lock_state in original_shape_lock_attrs.items(): - cmds.setAttr(attr, lock=lock_state) + cmds.setAttr(attr, lock=True) def _get_attrs(node): - """Workaround for buggy shape attribute listing with listAttr""" + """Workaround for buggy shape attribute listing with listAttr + + This will only return keyable settable attributes that have an + incoming connections (those that have a reason to be baked). + + Technically this *may* fail to return attributes driven by complex + expressions for which maya makes no connections, e.g. doing actual + `setAttr` calls in expressions. + + Arguments: + node (str): The node to list attributes for. + + Returns: + list: Keyable attributes with incoming connections. + The attribute may be locked. + + """ attrs = cmds.listAttr(node, write=True, scalar=True, @@ -2652,13 +2620,14 @@ def bake_to_world_space(nodes, return valid_attrs - transform_attrs = set(["t", "r", "s", - "tx", "ty", "tz", - "rx", "ry", "rz", - "sx", "sy", "sz"]) + transform_attrs = {"t", "r", "s", + "tx", "ty", "tz", + "rx", "ry", "rz", + "sx", "sy", "sz"} world_space_nodes = [] - with delete_after() as delete_bin: + with contextlib.ExitStack() as stack: + delete_bin = stack.enter_context(delete_after()) # Create the duplicate nodes that are in world-space connected to # the originals for node in nodes: @@ -2669,32 +2638,66 @@ def bake_to_world_space(nodes, new_node = cmds.duplicate(node, name=new_name, renameChildren=True)[0] # noqa - with _revert_lock_attributes(node, new_node): - with _revert_lock_shape_attributes(node, new_node): - # Parent to world - if cmds.listRelatives(new_node, parent=True): - new_node = cmds.parent(new_node, world=True)[0] - # Unlock transform attributes so constraint can be created - for attr in transform_attrs: - cmds.setAttr( - '{0}.{1}'.format(new_node, attr), lock=False) + # Parent new node to world + if cmds.listRelatives(new_node, parent=True): + new_node = cmds.parent(new_node, world=True)[0] - # Constraints - delete_bin.extend( - cmds.parentConstraint(node, new_node, mo=False)) - delete_bin.extend( - cmds.scaleConstraint(node, new_node, mo=False)) + # Temporarily unlock and passthrough connect all attributes + # so we can bake them over time + # Skip transform attributes because we will constrain them later + attrs = set(_get_attrs(node)) - transform_attrs + for attr in attrs: + orig_node_attr = "{}.{}".format(node, attr) + new_node_attr = "{}.{}".format(new_node, attr) - world_space_nodes.append(new_node) + # unlock during context to avoid connection errors + stack.enter_context(_unlock_attr(new_node_attr)) + cmds.connectAttr(orig_node_attr, + new_node_attr, + force=True) - bake(world_space_nodes, - frame_range=frame_range, - step=step, - simulation=simulation, - preserve_outside_keys=preserve_outside_keys, - disable_implicit_control=disable_implicit_control, - shape=shape) + # If shapes are also baked then also temporarily unlock and + # passthrough connect all shape attributes for baking + if shape: + children_shapes = cmds.listRelatives(new_node, + children=True, + fullPath=True, + shapes=True) + if children_shapes: + orig_children_shapes = cmds.listRelatives(node, + children=True, + fullPath=True, + shapes=True) + for orig_shape, new_shape in zip(orig_children_shapes, + children_shapes): + attrs = _get_attrs(orig_shape) + for attr in attrs: + orig_node_attr = "{}.{}".format(orig_shape, attr) + new_node_attr = "{}.{}".format(new_shape, attr) + + # unlock during context to avoid connection errors + stack.enter_context(_unlock_attr(new_node_attr)) + cmds.connectAttr(orig_node_attr, + new_node_attr, + force=True) + + # Constraint transforms + for attr in transform_attrs: + transform_attr = "{}.{}".format(new_node, attr) + stack.enter_context(_unlock_attr(transform_attr)) + delete_bin.extend(cmds.parentConstraint(node, new_node, mo=False)) + delete_bin.extend(cmds.scaleConstraint(node, new_node, mo=False)) + + world_space_nodes.append(new_node) + + bake(world_space_nodes, + frame_range=frame_range, + step=step, + simulation=simulation, + preserve_outside_keys=preserve_outside_keys, + disable_implicit_control=disable_implicit_control, + shape=shape) return world_space_nodes From eaa0a8f60eeac2e3441d2bf83aa395dca4222326 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Fri, 22 Dec 2023 22:21:47 +0800 Subject: [PATCH 05/23] make sure not overindented when calling bake function --- openpype/hosts/maya/api/lib.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index 63f0812785..06cefbf793 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -2691,13 +2691,13 @@ def bake_to_world_space(nodes, world_space_nodes.append(new_node) - bake(world_space_nodes, - frame_range=frame_range, - step=step, - simulation=simulation, - preserve_outside_keys=preserve_outside_keys, - disable_implicit_control=disable_implicit_control, - shape=shape) + bake(world_space_nodes, + frame_range=frame_range, + step=step, + simulation=simulation, + preserve_outside_keys=preserve_outside_keys, + disable_implicit_control=disable_implicit_control, + shape=shape) return world_space_nodes From 9be69c3f304428792a454f1831a6d090ddf86231 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 4 Jan 2024 00:25:34 +0800 Subject: [PATCH 06/23] implement exitstack functions from exitstack.py --- openpype/hosts/maya/api/lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index eb83a44cde..da34896c3f 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -2839,7 +2839,7 @@ def bake_to_world_space(nodes, "sx", "sy", "sz"} world_space_nodes = [] - with contextlib.ExitStack() as stack: + with ExitStack() as stack: delete_bin = stack.enter_context(delete_after()) # Create the duplicate nodes that are in world-space connected to # the originals From 190840fe052d0ee35ad9585d18ebc06eec916808 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Mon, 15 Jan 2024 12:16:50 +0000 Subject: [PATCH 07/23] Missing nuke family Windows arguments --- .../applications/server/applications.json | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/server_addon/applications/server/applications.json b/server_addon/applications/server/applications.json index 35f1b4cfbb..d2e2d942c6 100644 --- a/server_addon/applications/server/applications.json +++ b/server_addon/applications/server/applications.json @@ -307,7 +307,7 @@ ] }, "arguments": { - "windows": [], + "windows": ["--nukeassist"], "darwin": [], "linux": [] }, @@ -329,7 +329,7 @@ ] }, "arguments": { - "windows": [], + "windows": ["--nukeassist"], "darwin": [], "linux": [] }, @@ -351,7 +351,7 @@ ] }, "arguments": { - "windows": [], + "windows": ["--nukeassist"], "darwin": [], "linux": [] }, @@ -382,7 +382,7 @@ ] }, "arguments": { - "windows": [], + "windows": ["--nukex"], "darwin": [], "linux": [] }, @@ -404,7 +404,7 @@ ] }, "arguments": { - "windows": [], + "windows": ["--nukex"], "darwin": [], "linux": [] }, @@ -426,7 +426,7 @@ ] }, "arguments": { - "windows": [], + "windows": ["--nukex"], "darwin": [], "linux": [] }, @@ -457,7 +457,7 @@ ] }, "arguments": { - "windows": [], + "windows": ["--studio"], "darwin": [], "linux": [] }, @@ -479,7 +479,7 @@ ] }, "arguments": { - "windows": [], + "windows": ["--studio"], "darwin": [], "linux": [] }, @@ -501,7 +501,7 @@ ] }, "arguments": { - "windows": [], + "windows": ["--studio"], "darwin": [], "linux": [] }, @@ -532,7 +532,7 @@ ] }, "arguments": { - "windows": [], + "windows": ["--hiero"], "darwin": [], "linux": [] }, @@ -554,7 +554,7 @@ ] }, "arguments": { - "windows": [], + "windows": ["--hiero"], "darwin": [], "linux": [] }, @@ -576,7 +576,7 @@ ] }, "arguments": { - "windows": [], + "windows": ["--hiero"], "darwin": [], "linux": [] }, From e9be330393cb5a50fcbc257ecf4ed0c8eb335804 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Mon, 15 Jan 2024 14:56:29 +0000 Subject: [PATCH 08/23] Add Linux arguments. --- .../applications/server/applications.json | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/server_addon/applications/server/applications.json b/server_addon/applications/server/applications.json index d2e2d942c6..b0b12b2003 100644 --- a/server_addon/applications/server/applications.json +++ b/server_addon/applications/server/applications.json @@ -309,7 +309,7 @@ "arguments": { "windows": ["--nukeassist"], "darwin": [], - "linux": [] + "linux": ["--nukeassist"] }, "environment": "{}", "use_python_2": false @@ -331,7 +331,7 @@ "arguments": { "windows": ["--nukeassist"], "darwin": [], - "linux": [] + "linux": ["--nukeassist"] }, "environment": "{}", "use_python_2": false @@ -353,7 +353,7 @@ "arguments": { "windows": ["--nukeassist"], "darwin": [], - "linux": [] + "linux": ["--nukeassist"] }, "environment": "{}", "use_python_2": false @@ -384,7 +384,7 @@ "arguments": { "windows": ["--nukex"], "darwin": [], - "linux": [] + "linux": ["--nukex"] }, "environment": "{}", "use_python_2": false @@ -406,7 +406,7 @@ "arguments": { "windows": ["--nukex"], "darwin": [], - "linux": [] + "linux": ["--nukex"] }, "environment": "{}", "use_python_2": false @@ -428,7 +428,7 @@ "arguments": { "windows": ["--nukex"], "darwin": [], - "linux": [] + "linux": ["--nukex"] }, "environment": "{}", "use_python_2": false @@ -459,7 +459,7 @@ "arguments": { "windows": ["--studio"], "darwin": [], - "linux": [] + "linux": ["--studio"] }, "environment": "{}", "use_python_2": false @@ -481,7 +481,7 @@ "arguments": { "windows": ["--studio"], "darwin": [], - "linux": [] + "linux": ["--studio"] }, "environment": "{}", "use_python_2": false @@ -503,7 +503,7 @@ "arguments": { "windows": ["--studio"], "darwin": [], - "linux": [] + "linux": ["--studio"] }, "environment": "{}", "use_python_2": false @@ -534,7 +534,7 @@ "arguments": { "windows": ["--hiero"], "darwin": [], - "linux": [] + "linux": ["--hiero"] }, "environment": "{}", "use_python_2": false @@ -556,7 +556,7 @@ "arguments": { "windows": ["--hiero"], "darwin": [], - "linux": [] + "linux": ["--hiero"] }, "environment": "{}", "use_python_2": false @@ -578,7 +578,7 @@ "arguments": { "windows": ["--hiero"], "darwin": [], - "linux": [] + "linux": ["--hiero"] }, "environment": "{}", "use_python_2": false From b0a2c9689b3e3aec26e061663255c9c397380551 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Tue, 16 Jan 2024 10:53:40 +0100 Subject: [PATCH 09/23] make sure style object is not garbage collected --- openpype/tools/utils/lib.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openpype/tools/utils/lib.py b/openpype/tools/utils/lib.py index 723e71e7aa..365caaafd9 100644 --- a/openpype/tools/utils/lib.py +++ b/openpype/tools/utils/lib.py @@ -91,7 +91,8 @@ def set_style_property(widget, property_name, property_value): if cur_value == property_value: return widget.setProperty(property_name, property_value) - widget.style().polish(widget) + style = widget.style() + style.polish(widget) def paint_image_with_color(image, color): From a6cc0b511e4468be960e14f47aa2300a865e9035 Mon Sep 17 00:00:00 2001 From: Toke Jepsen Date: Tue, 16 Jan 2024 10:15:48 +0000 Subject: [PATCH 10/23] Maya: Account and ignore free image planes. (#5993) * Account and ignore for free image planes. * Incorporating BigRoy changes --------- Co-authored-by: Petr Kalis --- .../maya/plugins/publish/extract_camera_mayaScene.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/openpype/hosts/maya/plugins/publish/extract_camera_mayaScene.py b/openpype/hosts/maya/plugins/publish/extract_camera_mayaScene.py index 38cf00bbdd..f67e9db14f 100644 --- a/openpype/hosts/maya/plugins/publish/extract_camera_mayaScene.py +++ b/openpype/hosts/maya/plugins/publish/extract_camera_mayaScene.py @@ -265,13 +265,16 @@ def transfer_image_planes(source_cameras, target_cameras, try: for source_camera, target_camera in zip(source_cameras, target_cameras): - image_planes = cmds.listConnections(source_camera, + image_plane_plug = "{}.imagePlane".format(source_camera) + image_planes = cmds.listConnections(image_plane_plug, + source=True, + destination=False, type="imagePlane") or [] # Split of the parent path they are attached - we want - # the image plane node name. + # the image plane node name if attached to a camera. # TODO: Does this still mean the image plane name is unique? - image_planes = [x.split("->", 1)[1] for x in image_planes] + image_planes = [x.split("->", 1)[-1] for x in image_planes] if not image_planes: continue @@ -282,7 +285,7 @@ def transfer_image_planes(source_cameras, target_cameras, if source_camera == target_camera: continue _attach_image_plane(target_camera, image_plane) - else: # explicitly dettaching image planes + else: # explicitly detach image planes cmds.imagePlane(image_plane, edit=True, detach=True) originals[source_camera].append(image_plane) yield From 9d5736aca78dcf9ca449f0bc5b9c73aedf96089c Mon Sep 17 00:00:00 2001 From: Ynbot Date: Tue, 16 Jan 2024 13:07:31 +0000 Subject: [PATCH 11/23] [Automated] Release --- CHANGELOG.md | 145 ++++++++++++++++++++++++++++++++++++++++++++ openpype/version.py | 2 +- pyproject.toml | 2 +- 3 files changed, 147 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b51fade6f..546b2c12ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,151 @@ # Changelog +## [3.18.4](https://github.com/ynput/OpenPype/tree/3.18.4) + + +[Full Changelog](https://github.com/ynput/OpenPype/compare/3.18.3...3.18.4) + +### **🚀 Enhancements** + + +
+multiple render camera supports for 3dsmax #5124 + +Supports for rendering with multiple cameras in 3dsmax +- [x] Add Batch Render Layers functions +- [x] Rewrite lib.rendersetting and lib.renderproduct +- [x] Add multi-camera options in creator. +- [x] Collector with batch render-layer when multi-camera enabled. +- [x] Add instance plugin for saving scene files with different cameras respectively by using subprocess +- [x] Refactor submit_max_deadline +- [x] Check with metadata.json in submit publish job + + +___ + +
+ + +
+Fusion: new creator for image product type #6057 + +In many DCC `render` product type is expected to be sequence of files. This PR adds new explicit creator for `image` product type which is focused on single frame image. Workflows for both product types might be a bit different, this gives artists more granularity to choose better workflow. + + +___ + +
+ +### **🐛 Bug fixes** + + +
+Maya: Account and ignore free image planes. #5993 + +Free image planes do not have the `->` path separator, so we need to account for that. + + +___ + +
+ + +
+Blender: Fix long names for instances #6070 + +Changed naming for instances to use only final part of the `folderPath`. + + +___ + +
+ + +
+Traypublisher & Chore: Instance version on follow workfile version #6117 + +If `follow_workfile_version` is enabled but context does not have filled workfile version, a version on instance is used instead. + + +___ + +
+ + +
+Substance Painter: Thumbnail errors with PBR Texture Set #6127 + +When publishing with PBR Metallic Roughness as Output Template, Emissive Map errors out because of the missing channel in the material and the map can't be generated in Substance Painter. This PR is to make sure `imagestance.data["publish"] = False` so that the related "empty" texture instance would be skipped to generate the output. + + +___ + +
+ + +
+Transcoding: Fix reading image sequences through oiiotool #6129 + +When transcoding image sequences, the second image onwards includes the invalid xml line of `Reading path/to/file.exr` of the oiiotool output.This is most likely not the best solution, but it fixes the issue and illustrates the problem.Error: +``` +ERROR:pyblish.plugin:Traceback (most recent call last): + File "C:\Users\tokejepsen\AppData\Local\Ynput\AYON\dependency_packages\ayon_2310271602_windows.zip\dependencies\pyblish\plugin.py", line 527, in __explicit_process + runner(*args) + File "C:\Users\tokejepsen\OpenPype\openpype\plugins\publish\extract_color_transcode.py", line 152, in process + File "C:\Users\tokejepsen\OpenPype\openpype\lib\transcoding.py", line 1136, in convert_colorspace + input_info = get_oiio_info_for_input(input_path, logger=logger) + File "C:\Users\tokejepsen\OpenPype\openpype\lib\transcoding.py", line 124, in get_oiio_info_for_input + output.append(parse_oiio_xml_output(xml_text, logger=logger)) + File "C:\Users\tokejepsen\OpenPype\openpype\lib\transcoding.py", line 276, in parse_oiio_xml_output + tree = xml.etree.ElementTree.fromstring(xml_string) + File "xml\etree\ElementTree.py", line 1347, in XML +xml.etree.ElementTree.ParseError: syntax error: line 1, column 0 +Traceback (most recent call last): + File "C:\Users\tokejepsen\AppData\Local\Ynput\AYON\dependency_packages\ayon_2310271602_windows.zip\dependencies\pyblish\plugin.py", line 527, in __explicit_process + runner(*args) + File "", line 152, in process + File "C:\Users\tokejepsen\OpenPype\openpype\lib\transcoding.py", line 1136, in convert_colorspace + input_info = get_oiio_info_for_input(input_path, logger=logger) + File "C:\Users\tokejepsen\OpenPype\openpype\lib\transcoding.py", line 124, in get_oiio_info_for_input + output.append(parse_oiio_xml_output(xml_text, logger=logger)) + File "C:\Users\tokejepsen\OpenPype\openpype\lib\transcoding.py", line 276, in parse_oiio_xml_output + tree = xml.etree.ElementTree.fromstring(xml_string) + File "xml\etree\ElementTree.py", line 1347, in XML +xml.etree.ElementTree.ParseError: syntax error: line 1, column 0 +``` + + + +___ + +
+ + +
+AYON: Remove 'IntegrateHeroVersion' conversion #6130 + +Remove settings conversion for `IntegrateHeroVersion`. + + +___ + +
+ + +
+Chore tools: Make sure style object is not garbage collected #6136 + +Minor fix in tool utils to make sure style C++ object is not garbage collected when not stored into variable. + + +___ + +
+ + + + ## [3.18.3](https://github.com/ynput/OpenPype/tree/3.18.3) diff --git a/openpype/version.py b/openpype/version.py index 5981cb657a..0b6584dbff 100644 --- a/openpype/version.py +++ b/openpype/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring Pype version.""" -__version__ = "3.18.4-nightly.1" +__version__ = "3.18.4" diff --git a/pyproject.toml b/pyproject.toml index bad481c889..f9d5381a15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "OpenPype" -version = "3.18.3" # OpenPype +version = "3.18.4" # OpenPype description = "Open VFX and Animation pipeline with support." authors = ["OpenPype Team "] license = "MIT License" From 4c9b19ed9974559bd63f6eeb593570f010983b85 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 16 Jan 2024 13:08:30 +0000 Subject: [PATCH 12/23] chore(): update bug report / version --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index e9b68a54f1..8df948a7c1 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -35,6 +35,7 @@ body: label: Version description: What version are you running? Look to OpenPype Tray options: + - 3.18.4 - 3.18.4-nightly.1 - 3.18.3 - 3.18.3-nightly.2 @@ -134,7 +135,6 @@ body: - 3.15.7-nightly.3 - 3.15.7-nightly.2 - 3.15.7-nightly.1 - - 3.15.6 validations: required: true - type: dropdown From 5bdad2b37c89272ff29885bc03eabadce907c0be Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Tue, 16 Jan 2024 21:36:04 +0800 Subject: [PATCH 13/23] bug fix the limit groups from maya deadline settings unabled to be set by the username and error out --- server_addon/deadline/server/settings/publish_plugins.py | 2 +- server_addon/deadline/server/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server_addon/deadline/server/settings/publish_plugins.py b/server_addon/deadline/server/settings/publish_plugins.py index a989f3ad9d..dfb30f9b41 100644 --- a/server_addon/deadline/server/settings/publish_plugins.py +++ b/server_addon/deadline/server/settings/publish_plugins.py @@ -87,7 +87,7 @@ class MayaSubmitDeadlineModel(BaseSettingsModel): title="Disable Strict Error Check profiles" ) - @validator("limit", "scene_patches") + @validator("scene_patches") def validate_unique_names(cls, value): ensure_unique_names(value) return value diff --git a/server_addon/deadline/server/version.py b/server_addon/deadline/server/version.py index 0a8da88258..f1380eede2 100644 --- a/server_addon/deadline/server/version.py +++ b/server_addon/deadline/server/version.py @@ -1 +1 @@ -__version__ = "0.1.6" +__version__ = "0.1.7" From b29dee59fadbaa59876d0684eb0c30df5bba0681 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Tue, 16 Jan 2024 16:48:35 +0100 Subject: [PATCH 14/23] add addons dir only if exists --- openpype/modules/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openpype/modules/base.py b/openpype/modules/base.py index 1a2513b4b4..41be2998f9 100644 --- a/openpype/modules/base.py +++ b/openpype/modules/base.py @@ -542,7 +542,8 @@ def _load_modules(): module_dirs.insert(0, current_dir) addons_dir = os.path.join(os.path.dirname(current_dir), "addons") - module_dirs.append(addons_dir) + if os.path.exists(addons_dir): + module_dirs.append(addons_dir) ignored_host_names = set(IGNORED_HOSTS_IN_AYON) ignored_current_dir_filenames = set(IGNORED_DEFAULT_FILENAMES) From 25b33c60f0e86f7b3303bfdff92b563bc13180b6 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Tue, 16 Jan 2024 16:49:31 +0100 Subject: [PATCH 15/23] add missing '.tif' extension --- openpype/lib/transcoding.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/openpype/lib/transcoding.py b/openpype/lib/transcoding.py index 03fd91bec2..c8ddbde061 100644 --- a/openpype/lib/transcoding.py +++ b/openpype/lib/transcoding.py @@ -44,17 +44,17 @@ XML_CHAR_REF_REGEX_HEX = re.compile(r"&#x?[0-9a-fA-F]+;") ARRAY_TYPE_REGEX = re.compile(r"^(int|float|string)\[\d+\]$") IMAGE_EXTENSIONS = { - ".ani", ".anim", ".apng", ".art", ".bmp", ".bpg", ".bsave", ".cal", - ".cin", ".cpc", ".cpt", ".dds", ".dpx", ".ecw", ".exr", ".fits", - ".flic", ".flif", ".fpx", ".gif", ".hdri", ".hevc", ".icer", - ".icns", ".ico", ".cur", ".ics", ".ilbm", ".jbig", ".jbig2", - ".jng", ".jpeg", ".jpeg-ls", ".jpeg", ".2000", ".jpg", ".xr", - ".jpeg", ".xt", ".jpeg-hdr", ".kra", ".mng", ".miff", ".nrrd", - ".ora", ".pam", ".pbm", ".pgm", ".ppm", ".pnm", ".pcx", ".pgf", - ".pictor", ".png", ".psd", ".psb", ".psp", ".qtvr", ".ras", - ".rgbe", ".logluv", ".tiff", ".sgi", ".tga", ".tiff", ".tiff/ep", - ".tiff/it", ".ufo", ".ufp", ".wbmp", ".webp", ".xbm", ".xcf", - ".xpm", ".xwd" + ".ani", ".anim", ".apng", ".art", ".bmp", ".bpg", ".bsave", + ".cal", ".cin", ".cpc", ".cpt", ".dds", ".dpx", ".ecw", ".exr", + ".fits", ".flic", ".flif", ".fpx", ".gif", ".hdri", ".hevc", + ".icer", ".icns", ".ico", ".cur", ".ics", ".ilbm", ".jbig", ".jbig2", + ".jng", ".jpeg", ".jpeg-ls", ".jpeg-hdr", ".2000", ".jpg", + ".kra", ".logluv", ".mng", ".miff", ".nrrd", ".ora", + ".pam", ".pbm", ".pgm", ".ppm", ".pnm", ".pcx", ".pgf", + ".pictor", ".png", ".psd", ".psb", ".psp", ".qtvr", + ".ras", ".rgbe", ".sgi", ".tga", + ".tif", ".tiff", ".tiff/ep", ".tiff/it", ".ufo", ".ufp", + ".wbmp", ".webp", ".xr", ".xt", ".xbm", ".xcf", ".xpm", ".xwd" } VIDEO_EXTENSIONS = { From 6857082f1e0e9cab399ccb85fe1ec5a41cfc010f Mon Sep 17 00:00:00 2001 From: Ynbot Date: Wed, 17 Jan 2024 03:26:10 +0000 Subject: [PATCH 16/23] [Automated] Bump version --- openpype/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/version.py b/openpype/version.py index 0b6584dbff..043b6fbebb 100644 --- a/openpype/version.py +++ b/openpype/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring Pype version.""" -__version__ = "3.18.4" +__version__ = "3.18.5-nightly.1" From 4cf6ddfea215c5d747fef01ba00ffe18da2b2fb2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 17 Jan 2024 03:26:46 +0000 Subject: [PATCH 17/23] chore(): update bug report / version --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 8df948a7c1..1177b9e4fe 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -35,6 +35,7 @@ body: label: Version description: What version are you running? Look to OpenPype Tray options: + - 3.18.5-nightly.1 - 3.18.4 - 3.18.4-nightly.1 - 3.18.3 @@ -134,7 +135,6 @@ body: - 3.15.7 - 3.15.7-nightly.3 - 3.15.7-nightly.2 - - 3.15.7-nightly.1 validations: required: true - type: dropdown From b7557c754385a8a966c1b7fcce804cbcfa9e8dcf Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Wed, 17 Jan 2024 09:12:14 +0000 Subject: [PATCH 18/23] Increment version --- server_addon/applications/server/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server_addon/applications/server/version.py b/server_addon/applications/server/version.py index ae7362549b..bbab0242f6 100644 --- a/server_addon/applications/server/version.py +++ b/server_addon/applications/server/version.py @@ -1 +1 @@ -__version__ = "0.1.3" +__version__ = "0.1.4" From 1d7f23ab72b83b94fd951426c392035a877fbbce Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Fri, 19 Jan 2024 09:47:17 +0200 Subject: [PATCH 19/23] include model product type --- openpype/hosts/houdini/plugins/load/load_fbx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/houdini/plugins/load/load_fbx.py b/openpype/hosts/houdini/plugins/load/load_fbx.py index cac22d62d4..649c2e9995 100644 --- a/openpype/hosts/houdini/plugins/load/load_fbx.py +++ b/openpype/hosts/houdini/plugins/load/load_fbx.py @@ -16,7 +16,7 @@ class FbxLoader(load.LoaderPlugin): order = -10 - families = ["staticMesh", "fbx"] + families = ["model", "staticMesh", "fbx"] representations = ["fbx"] def load(self, context, name=None, namespace=None, data=None): From 04c072947c7c7e5f93dc21ad2afd9434c44f2b95 Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Fri, 19 Jan 2024 10:47:37 +0200 Subject: [PATCH 20/23] BigRoy's Comment - Make it able to load any FBX file --- openpype/hosts/houdini/plugins/load/load_fbx.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/houdini/plugins/load/load_fbx.py b/openpype/hosts/houdini/plugins/load/load_fbx.py index 649c2e9995..894ac62b3e 100644 --- a/openpype/hosts/houdini/plugins/load/load_fbx.py +++ b/openpype/hosts/houdini/plugins/load/load_fbx.py @@ -16,8 +16,9 @@ class FbxLoader(load.LoaderPlugin): order = -10 - families = ["model", "staticMesh", "fbx"] - representations = ["fbx"] + families = ["*"] + representations = ["*"] + extensions = {"fbx"} def load(self, context, name=None, namespace=None, data=None): From 5a524b7fd99a7226e450eac2d7a12c2e239cf900 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Fri, 19 Jan 2024 16:27:33 +0000 Subject: [PATCH 21/23] Restore actions to objects after update --- .../hosts/blender/plugins/load/load_blend.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/blender/plugins/load/load_blend.py b/openpype/hosts/blender/plugins/load/load_blend.py index 2d5ac18149..4abe4a6afb 100644 --- a/openpype/hosts/blender/plugins/load/load_blend.py +++ b/openpype/hosts/blender/plugins/load/load_blend.py @@ -102,7 +102,6 @@ class BlendLoader(plugin.AssetLoader): # Link all the container children to the collection for obj in container.children_recursive: - print(obj) bpy.context.scene.collection.objects.link(obj) # Remove the library from the blend file @@ -194,8 +193,20 @@ class BlendLoader(plugin.AssetLoader): transform = asset_group.matrix_basis.copy() old_data = dict(asset_group.get(AVALON_PROPERTY)) + old_members = old_data.get("members", []) parent = asset_group.parent + actions = {} + objects_with_anim = [ + obj for obj in asset_group.children_recursive + if obj.animation_data] + for obj in objects_with_anim: + # Check if the object has an action and, if so, add it to a dict + # so we can restore it later. Save and restore the action only + # if it wasn't originally loaded from the current asset. + if obj.animation_data.action not in old_members: + actions[obj.name] = obj.animation_data.action + self.exec_remove(container) asset_group, members = self._process_data(libpath, group_name) @@ -206,6 +217,11 @@ class BlendLoader(plugin.AssetLoader): asset_group.matrix_basis = transform asset_group.parent = parent + # Restore the actions + for obj in asset_group.children_recursive: + if obj.name in actions: + obj.animation_data.action = actions[obj.name] + # Restore the old data, but reset memebers, as they don't exist anymore # This avoids a crash, because the memory addresses of those members # are not valid anymore From e0f6497f95006f1190c4a619b566f54386dabf54 Mon Sep 17 00:00:00 2001 From: Ynbot Date: Sat, 20 Jan 2024 03:25:30 +0000 Subject: [PATCH 22/23] [Automated] Bump version --- openpype/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/version.py b/openpype/version.py index 043b6fbebb..5bb4b4fb0a 100644 --- a/openpype/version.py +++ b/openpype/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring Pype version.""" -__version__ = "3.18.5-nightly.1" +__version__ = "3.18.5-nightly.2" From c3af397348029bf3337262d1fb9f5a469292eb35 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 20 Jan 2024 03:26:05 +0000 Subject: [PATCH 23/23] chore(): update bug report / version --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 1177b9e4fe..e831bf3dc1 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -35,6 +35,7 @@ body: label: Version description: What version are you running? Look to OpenPype Tray options: + - 3.18.5-nightly.2 - 3.18.5-nightly.1 - 3.18.4 - 3.18.4-nightly.1 @@ -134,7 +135,6 @@ body: - 3.15.8-nightly.1 - 3.15.7 - 3.15.7-nightly.3 - - 3.15.7-nightly.2 validations: required: true - type: dropdown