From 55c3bdbd06f0baa06550654342ea7a66bd31c6e4 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 21 Dec 2023 17:30:37 +0800 Subject: [PATCH 01/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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 b29dee59fadbaa59876d0684eb0c30df5bba0681 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Tue, 16 Jan 2024 16:48:35 +0100 Subject: [PATCH 09/32] 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 10/32] 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 dcf8805cfe2aca6f2615de1a7c18988d0efedae6 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Tue, 16 Jan 2024 16:53:26 +0000 Subject: [PATCH 11/32] Add settings for effect categories --- .../hiero/server/settings/publish_plugins.py | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/server_addon/hiero/server/settings/publish_plugins.py b/server_addon/hiero/server/settings/publish_plugins.py index a85e62724b..07778b8ebe 100644 --- a/server_addon/hiero/server/settings/publish_plugins.py +++ b/server_addon/hiero/server/settings/publish_plugins.py @@ -1,5 +1,7 @@ -from pydantic import Field -from ayon_server.settings import BaseSettingsModel +from pydantic import Field, validator +from ayon_server.settings import ( + BaseSettingsModel, ensure_unique_names, normalize_name +) class CollectInstanceVersionModel(BaseSettingsModel): @@ -9,6 +11,30 @@ class CollectInstanceVersionModel(BaseSettingsModel): ) +class CollectClipEffectsDefModel(BaseSettingsModel): + _layout = "expanded" + name: str = Field("", title="Name") + effect_classes: list[str] = Field( + default_factory=list, title="Effect Classes" + ) + + @validator("name") + def validate_name(cls, value): + """Ensure name does not contain weird characters""" + return normalize_name(value) + + +class CollectClipEffectsModel(BaseSettingsModel): + effect_categories: list[CollectClipEffectsDefModel] = Field( + default_factory=list, title="Effect Categories" + ) + + @validator("effect_categories") + def validate_unique_outputs(cls, value): + ensure_unique_names(value) + return value + + class ExtractReviewCutUpVideoModel(BaseSettingsModel): enabled: bool = Field( True, @@ -25,6 +51,10 @@ class PublishPuginsModel(BaseSettingsModel): default_factory=CollectInstanceVersionModel, title="Collect Instance Version" ) + CollectClipEffects: CollectClipEffectsModel = Field( + default_factory=CollectClipEffectsModel, + title="Collect Clip Effects" + ) """# TODO: enhance settings with host api: Rename class name and plugin name to match title (it makes more sense) From 9c8a4a7b6cccc2fd112b6c41f1e4c10d7f94f6e4 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Tue, 16 Jan 2024 16:53:51 +0000 Subject: [PATCH 12/32] Categorize effects from settings. --- .../plugins/publish/collect_clip_effects.py | 71 ++++++++++++++----- 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py b/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py index fcb1ab27a0..89dc66d73c 100644 --- a/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py +++ b/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py @@ -70,29 +70,62 @@ class CollectClipEffects(pyblish.api.InstancePlugin): subset_split.insert(0, "effect") - name = "".join(subset_split) + effect_categories = { + x["name"]: x["effect_classes"] for x in self.effect_categories + } - # create new instance and inherit data - data = {} - for key, value in instance.data.items(): - if "clipEffectItems" in key: + category_by_effect = {} + for key, values in effect_categories.items(): + for cls in values: + category_by_effect[cls] = key + + effects_categorized = {k: {} for k in effect_categories.keys()} + for key, value in effects.items(): + if key == "assignTo": continue - data[key] = value - # change names - data["subset"] = name - data["family"] = family - data["families"] = [family] - data["name"] = data["subset"] + "_" + data["asset"] - data["label"] = "{} - {}".format( - data['asset'], data["subset"] - ) - data["effects"] = effects + # Some classes can have a number in them. Like Text2. + found_cls = None + for cls in category_by_effect.keys(): + if value["class"].startswith(cls): + found_cls = cls - # create new instance - _instance = instance.context.create_instance(**data) - self.log.info("Created instance `{}`".format(_instance)) - self.log.debug("instance.data `{}`".format(_instance.data)) + if found_cls is None: + continue + + effects_categorized[category_by_effect[found_cls]][key] = value + + if effects_categorized: + for key in effects_categorized.keys(): + effects_categorized[key]["assignTo"] = effects["assignTo"] + else: + effects_categorized[""] = effects + + for category, effects in effects_categorized.items(): + name = "".join(subset_split) + name += category.capitalize() + + # create new instance and inherit data + data = {} + for key, value in instance.data.items(): + if "clipEffectItems" in key: + continue + data[key] = value + + # change names + data["subset"] = name + data["family"] = family + data["families"] = [family] + data["name"] = data["subset"] + "_" + data["asset"] + data["label"] = "{} - {}".format( + data['asset'], data["subset"] + ) + data["effects"] = effects + + # create new instance + _instance = instance.context.create_instance(**data) + self.log.info("Created instance `{}`".format(_instance)) + self.log.debug("instance.data `{}`".format(_instance.data)) def test_overlap(self, effect_t_in, effect_t_out): covering_exp = bool( From b7557c754385a8a966c1b7fcce804cbcfa9e8dcf Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Wed, 17 Jan 2024 09:12:14 +0000 Subject: [PATCH 13/32] 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 883eb9f4f86c49bf6e387d38fac1dcc9042c93f3 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Wed, 17 Jan 2024 09:13:03 +0000 Subject: [PATCH 14/32] Increment version --- server_addon/hiero/server/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server_addon/hiero/server/version.py b/server_addon/hiero/server/version.py index 485f44ac21..3ced3581bb 100644 --- a/server_addon/hiero/server/version.py +++ b/server_addon/hiero/server/version.py @@ -1 +1 @@ -__version__ = "0.1.1" +__version__ = "0.2.1" From 7e3e567f002974436badeea5ff25bfa8db9461cf Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Wed, 17 Jan 2024 10:46:50 +0000 Subject: [PATCH 15/32] Use the new API for override context --- openpype/hosts/blender/api/capture.py | 11 +++--- .../hosts/blender/plugins/load/load_audio.py | 35 ++++++++++--------- .../plugins/publish/extract_abc_animation.py | 14 ++++---- .../plugins/publish/extract_camera_fbx.py | 26 +++++++------- .../blender/plugins/publish/extract_fbx.py | 18 +++++----- .../plugins/publish/extract_fbx_animation.py | 25 +++++++------ .../blender/plugins/publish/extract_layout.py | 23 ++++++------ 7 files changed, 81 insertions(+), 71 deletions(-) diff --git a/openpype/hosts/blender/api/capture.py b/openpype/hosts/blender/api/capture.py index bad6831143..9922140cea 100644 --- a/openpype/hosts/blender/api/capture.py +++ b/openpype/hosts/blender/api/capture.py @@ -127,8 +127,9 @@ def isolate_objects(window, objects): context = create_blender_context(selected=objects, window=window) - bpy.ops.view3d.view_axis(context, type="FRONT") - bpy.ops.view3d.localview(context) + with bpy.context.temp_override(**context): + bpy.ops.view3d.view_axis(type="FRONT") + bpy.ops.view3d.localview() deselect_all() @@ -270,10 +271,12 @@ def _independent_window(): """Create capture-window context.""" context = create_blender_context() current_windows = set(bpy.context.window_manager.windows) - bpy.ops.wm.window_new(context) + with bpy.context.temp_override(**context): + bpy.ops.wm.window_new() window = list(set(bpy.context.window_manager.windows) - current_windows)[0] context["window"] = window try: yield window finally: - bpy.ops.wm.window_close(context) + with bpy.context.temp_override(**context): + bpy.ops.wm.window_close() diff --git a/openpype/hosts/blender/plugins/load/load_audio.py b/openpype/hosts/blender/plugins/load/load_audio.py index 1e5bd39a32..367fff03f0 100644 --- a/openpype/hosts/blender/plugins/load/load_audio.py +++ b/openpype/hosts/blender/plugins/load/load_audio.py @@ -67,7 +67,8 @@ class AudioLoader(plugin.AssetLoader): oc = bpy.context.copy() oc["area"] = window_manager.windows[-1].screen.areas[0] - bpy.ops.sequencer.sound_strip_add(oc, filepath=libpath, frame_start=1) + with bpy.context.temp_override(**oc): + bpy.ops.sequencer.sound_strip_add(filepath=libpath, frame_start=1) window_manager.windows[-1].screen.areas[0].type = old_type @@ -156,17 +157,18 @@ class AudioLoader(plugin.AssetLoader): oc = bpy.context.copy() oc["area"] = window_manager.windows[-1].screen.areas[0] - # We deselect all sequencer strips, and then select the one we - # need to remove. - bpy.ops.sequencer.select_all(oc, action='DESELECT') - scene = bpy.context.scene - scene.sequence_editor.sequences_all[old_audio].select = True + with bpy.context.temp_override(**oc): + # We deselect all sequencer strips, and then select the one we + # need to remove. + bpy.ops.sequencer.select_all(action='DESELECT') + scene = bpy.context.scene + scene.sequence_editor.sequences_all[old_audio].select = True - bpy.ops.sequencer.delete(oc) - bpy.data.sounds.remove(bpy.data.sounds[old_audio]) + bpy.ops.sequencer.delete() + bpy.data.sounds.remove(bpy.data.sounds[old_audio]) - bpy.ops.sequencer.sound_strip_add( - oc, filepath=str(libpath), frame_start=1) + bpy.ops.sequencer.sound_strip_add( + filepath=str(libpath), frame_start=1) window_manager.windows[-1].screen.areas[0].type = old_type @@ -205,12 +207,13 @@ class AudioLoader(plugin.AssetLoader): oc = bpy.context.copy() oc["area"] = window_manager.windows[-1].screen.areas[0] - # We deselect all sequencer strips, and then select the one we - # need to remove. - bpy.ops.sequencer.select_all(oc, action='DESELECT') - bpy.context.scene.sequence_editor.sequences_all[audio].select = True - - bpy.ops.sequencer.delete(oc) + with bpy.context.temp_override(**oc): + # We deselect all sequencer strips, and then select the one we + # need to remove. + bpy.ops.sequencer.select_all(action='DESELECT') + scene = bpy.context.scene + scene.sequence_editor.sequences_all[audio].select = True + bpy.ops.sequencer.delete() window_manager.windows[-1].screen.areas[0].type = old_type diff --git a/openpype/hosts/blender/plugins/publish/extract_abc_animation.py b/openpype/hosts/blender/plugins/publish/extract_abc_animation.py index 6ef9b29693..2bf75aa05e 100644 --- a/openpype/hosts/blender/plugins/publish/extract_abc_animation.py +++ b/openpype/hosts/blender/plugins/publish/extract_abc_animation.py @@ -55,13 +55,13 @@ class ExtractAnimationABC( context = plugin.create_blender_context( active=asset_group, selected=selected) - # We export the abc - bpy.ops.wm.alembic_export( - context, - filepath=filepath, - selected=True, - flatten=False - ) + with bpy.context.temp_override(**context): + # We export the abc + bpy.ops.wm.alembic_export( + filepath=filepath, + selected=True, + flatten=False + ) plugin.deselect_all() diff --git a/openpype/hosts/blender/plugins/publish/extract_camera_fbx.py b/openpype/hosts/blender/plugins/publish/extract_camera_fbx.py index ee046b7d11..f904b79ddb 100644 --- a/openpype/hosts/blender/plugins/publish/extract_camera_fbx.py +++ b/openpype/hosts/blender/plugins/publish/extract_camera_fbx.py @@ -50,19 +50,19 @@ class ExtractCamera(publish.Extractor, publish.OptionalPyblishPluginMixin): scale_length = bpy.context.scene.unit_settings.scale_length bpy.context.scene.unit_settings.scale_length = 0.01 - # We export the fbx - bpy.ops.export_scene.fbx( - context, - filepath=filepath, - use_active_collection=False, - use_selection=True, - bake_anim_use_nla_strips=False, - bake_anim_use_all_actions=False, - add_leaf_bones=False, - armature_nodetype='ROOT', - object_types={'CAMERA'}, - bake_anim_simplify_factor=0.0 - ) + with bpy.context.temp_override(**context): + # We export the fbx + bpy.ops.export_scene.fbx( + filepath=filepath, + use_active_collection=False, + use_selection=True, + bake_anim_use_nla_strips=False, + bake_anim_use_all_actions=False, + add_leaf_bones=False, + armature_nodetype='ROOT', + object_types={'CAMERA'}, + bake_anim_simplify_factor=0.0 + ) bpy.context.scene.unit_settings.scale_length = scale_length diff --git a/openpype/hosts/blender/plugins/publish/extract_fbx.py b/openpype/hosts/blender/plugins/publish/extract_fbx.py index 4ae6501f7d..aed6df1d3d 100644 --- a/openpype/hosts/blender/plugins/publish/extract_fbx.py +++ b/openpype/hosts/blender/plugins/publish/extract_fbx.py @@ -57,15 +57,15 @@ class ExtractFBX(publish.Extractor, publish.OptionalPyblishPluginMixin): scale_length = bpy.context.scene.unit_settings.scale_length bpy.context.scene.unit_settings.scale_length = 0.01 - # We export the fbx - bpy.ops.export_scene.fbx( - context, - filepath=filepath, - use_active_collection=False, - use_selection=True, - mesh_smooth_type='FACE', - add_leaf_bones=False - ) + with bpy.context.temp_override(**context): + # We export the fbx + bpy.ops.export_scene.fbx( + filepath=filepath, + use_active_collection=False, + use_selection=True, + mesh_smooth_type='FACE', + add_leaf_bones=False + ) bpy.context.scene.unit_settings.scale_length = scale_length diff --git a/openpype/hosts/blender/plugins/publish/extract_fbx_animation.py b/openpype/hosts/blender/plugins/publish/extract_fbx_animation.py index 4fc8230a1b..1cb8dac0cf 100644 --- a/openpype/hosts/blender/plugins/publish/extract_fbx_animation.py +++ b/openpype/hosts/blender/plugins/publish/extract_fbx_animation.py @@ -153,17 +153,20 @@ class ExtractAnimationFBX( override = plugin.create_blender_context( active=root, selected=[root, armature]) - bpy.ops.export_scene.fbx( - override, - filepath=filepath, - use_active_collection=False, - use_selection=True, - bake_anim_use_nla_strips=False, - bake_anim_use_all_actions=False, - add_leaf_bones=False, - armature_nodetype='ROOT', - object_types={'EMPTY', 'ARMATURE'} - ) + + with bpy.context.temp_override(**override): + # We export the fbx + bpy.ops.export_scene.fbx( + filepath=filepath, + use_active_collection=False, + use_selection=True, + bake_anim_use_nla_strips=False, + bake_anim_use_all_actions=False, + add_leaf_bones=False, + armature_nodetype='ROOT', + object_types={'EMPTY', 'ARMATURE'} + ) + armature.name = armature_name asset_group.name = asset_group_name root.select_set(True) diff --git a/openpype/hosts/blender/plugins/publish/extract_layout.py b/openpype/hosts/blender/plugins/publish/extract_layout.py index 3e8978c8d3..383c3bdcc5 100644 --- a/openpype/hosts/blender/plugins/publish/extract_layout.py +++ b/openpype/hosts/blender/plugins/publish/extract_layout.py @@ -80,17 +80,18 @@ class ExtractLayout(publish.Extractor, publish.OptionalPyblishPluginMixin): override = plugin.create_blender_context( active=asset, selected=[asset, obj]) - bpy.ops.export_scene.fbx( - override, - filepath=filepath, - use_active_collection=False, - use_selection=True, - bake_anim_use_nla_strips=False, - bake_anim_use_all_actions=False, - add_leaf_bones=False, - armature_nodetype='ROOT', - object_types={'EMPTY', 'ARMATURE'} - ) + with bpy.context.temp_override(**override): + # We export the fbx + bpy.ops.export_scene.fbx( + filepath=filepath, + use_active_collection=False, + use_selection=True, + bake_anim_use_nla_strips=False, + bake_anim_use_all_actions=False, + add_leaf_bones=False, + armature_nodetype='ROOT', + object_types={'EMPTY', 'ARMATURE'} + ) obj.name = armature_name asset.name = asset_group_name asset.select_set(False) From 1d7f23ab72b83b94fd951426c392035a877fbbce Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Fri, 19 Jan 2024 09:47:17 +0200 Subject: [PATCH 16/32] 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 17/32] 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 18/32] 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 372c74b40674ad254f5665e2b9c0e62234101746 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 19 Jan 2024 18:00:44 +0100 Subject: [PATCH 19/32] use correct variable in queue loop --- openpype/plugins/publish/collect_anatomy_instance_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/plugins/publish/collect_anatomy_instance_data.py b/openpype/plugins/publish/collect_anatomy_instance_data.py index 34df49ea5b..8cc1d2b5e3 100644 --- a/openpype/plugins/publish/collect_anatomy_instance_data.py +++ b/openpype/plugins/publish/collect_anatomy_instance_data.py @@ -412,7 +412,7 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin): hierarchy_queue = collections.deque() hierarchy_queue.append(hierarchy_context) while hierarchy_queue: - item = hierarchy_context.popleft() + item = hierarchy_queue.popleft() if asset_name in item: return item[asset_name].get("tasks") or {} From 4d1907b94bcd01b916a7ddb70834232ff70af778 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 19 Jan 2024 18:00:59 +0100 Subject: [PATCH 20/32] create copy of hierarchy context before any manipulation --- openpype/plugins/publish/collect_anatomy_instance_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/plugins/publish/collect_anatomy_instance_data.py b/openpype/plugins/publish/collect_anatomy_instance_data.py index 8cc1d2b5e3..b1b7ecd138 100644 --- a/openpype/plugins/publish/collect_anatomy_instance_data.py +++ b/openpype/plugins/publish/collect_anatomy_instance_data.py @@ -410,7 +410,7 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin): """ hierarchy_queue = collections.deque() - hierarchy_queue.append(hierarchy_context) + hierarchy_queue.append(copy.deepcopy(hierarchy_context)) while hierarchy_queue: item = hierarchy_queue.popleft() if asset_name in item: From 9a6f518a51bd34ca99c747eb3795b858235a6ce5 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 19 Jan 2024 18:01:15 +0100 Subject: [PATCH 21/32] do not store 'hierarchyContext' to variable --- openpype/plugins/publish/extract_hierarchy_to_ayon.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openpype/plugins/publish/extract_hierarchy_to_ayon.py b/openpype/plugins/publish/extract_hierarchy_to_ayon.py index b601a3fc29..9e84daca30 100644 --- a/openpype/plugins/publish/extract_hierarchy_to_ayon.py +++ b/openpype/plugins/publish/extract_hierarchy_to_ayon.py @@ -30,8 +30,7 @@ class ExtractHierarchyToAYON(pyblish.api.ContextPlugin): if not AYON_SERVER_ENABLED: return - hierarchy_context = context.data.get("hierarchyContext") - if not hierarchy_context: + if not context.data.get("hierarchyContext"): self.log.debug("Skipping ExtractHierarchyToAYON") return From e0f6497f95006f1190c4a619b566f54386dabf54 Mon Sep 17 00:00:00 2001 From: Ynbot Date: Sat, 20 Jan 2024 03:25:30 +0000 Subject: [PATCH 22/32] [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/32] 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 From c2ea9303a3a30f491d1984b06f7b91b388f786c1 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Mon, 22 Jan 2024 11:03:02 +0000 Subject: [PATCH 24/32] Collect non-categorized effects as well --- .../plugins/publish/collect_clip_effects.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py b/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py index 89dc66d73c..9c147e88d6 100644 --- a/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py +++ b/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py @@ -74,32 +74,32 @@ class CollectClipEffects(pyblish.api.InstancePlugin): x["name"]: x["effect_classes"] for x in self.effect_categories } - category_by_effect = {} + category_by_effect = {"": ""} for key, values in effect_categories.items(): for cls in values: category_by_effect[cls] = key effects_categorized = {k: {} for k in effect_categories.keys()} + effects_categorized[""] = {} for key, value in effects.items(): if key == "assignTo": continue # Some classes can have a number in them. Like Text2. - found_cls = None + found_cls = "" for cls in category_by_effect.keys(): if value["class"].startswith(cls): found_cls = cls - if found_cls is None: - continue - effects_categorized[category_by_effect[found_cls]][key] = value - if effects_categorized: - for key in effects_categorized.keys(): - effects_categorized[key]["assignTo"] = effects["assignTo"] - else: - effects_categorized[""] = effects + categories = list(effects_categorized.keys()) + for category in categories: + if not effects_categorized[category]: + effects_categorized.pop(category) + continue + + effects_categorized[category]["assignTo"] = effects["assignTo"] for category, effects in effects_categorized.items(): name = "".join(subset_split) From bfdfa78e57e8c4f3f551569c109ffa5f4c5ed474 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Tue, 23 Jan 2024 10:48:20 +0000 Subject: [PATCH 25/32] Fix problem with independent window --- openpype/hosts/blender/api/capture.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/openpype/hosts/blender/api/capture.py b/openpype/hosts/blender/api/capture.py index 9922140cea..e16a865607 100644 --- a/openpype/hosts/blender/api/capture.py +++ b/openpype/hosts/blender/api/capture.py @@ -273,10 +273,9 @@ def _independent_window(): current_windows = set(bpy.context.window_manager.windows) with bpy.context.temp_override(**context): bpy.ops.wm.window_new() - window = list(set(bpy.context.window_manager.windows) - current_windows)[0] - context["window"] = window - try: - yield window - finally: - with bpy.context.temp_override(**context): + window = list(set(bpy.context.window_manager.windows) - current_windows)[0] + context["window"] = window + try: + yield window + finally: bpy.ops.wm.window_close() From a6556b4c2cb2c901b1df54460413e77ab278f888 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Tue, 23 Jan 2024 10:51:36 +0000 Subject: [PATCH 26/32] Hound fix --- openpype/hosts/blender/api/capture.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/blender/api/capture.py b/openpype/hosts/blender/api/capture.py index e16a865607..e5e6041563 100644 --- a/openpype/hosts/blender/api/capture.py +++ b/openpype/hosts/blender/api/capture.py @@ -273,7 +273,8 @@ def _independent_window(): current_windows = set(bpy.context.window_manager.windows) with bpy.context.temp_override(**context): bpy.ops.wm.window_new() - window = list(set(bpy.context.window_manager.windows) - current_windows)[0] + window = list( + set(bpy.context.window_manager.windows) - current_windows)[0] context["window"] = window try: yield window From 8b9def5b9a281d6f3522af0fb5fe30fad346611c Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Tue, 23 Jan 2024 11:41:26 +0000 Subject: [PATCH 27/32] Add default settings. --- server_addon/hiero/server/settings/publish_plugins.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server_addon/hiero/server/settings/publish_plugins.py b/server_addon/hiero/server/settings/publish_plugins.py index 07778b8ebe..f3d1e21fe4 100644 --- a/server_addon/hiero/server/settings/publish_plugins.py +++ b/server_addon/hiero/server/settings/publish_plugins.py @@ -74,5 +74,8 @@ DEFAULT_PUBLISH_PLUGIN_SETTINGS = { "tags_addition": [ "review" ] + }, + "CollectClipEffectsModel": { + "effect_categories": [] } } From 1d2f97052a527fb379c57518ecae22c6bfe12ca0 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Tue, 23 Jan 2024 12:04:59 +0000 Subject: [PATCH 28/32] Add class attribute --- openpype/hosts/hiero/plugins/publish/collect_clip_effects.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py b/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py index 9c147e88d6..6647459e8e 100644 --- a/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py +++ b/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py @@ -9,6 +9,8 @@ class CollectClipEffects(pyblish.api.InstancePlugin): label = "Collect Clip Effects Instances" families = ["clip"] + effect_categories = [] + def process(self, instance): family = "effect" effects = {} From d3276c70dfa8a59a2487e7a6d2feb16c58164652 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Tue, 23 Jan 2024 12:05:05 +0000 Subject: [PATCH 29/32] Fix version --- server_addon/hiero/server/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server_addon/hiero/server/version.py b/server_addon/hiero/server/version.py index 3ced3581bb..b3f4756216 100644 --- a/server_addon/hiero/server/version.py +++ b/server_addon/hiero/server/version.py @@ -1 +1 @@ -__version__ = "0.2.1" +__version__ = "0.1.2" From f69c63042f73bfaae4898fbd4ada583f648de5da Mon Sep 17 00:00:00 2001 From: Toke Jepsen Date: Tue, 23 Jan 2024 14:34:44 +0000 Subject: [PATCH 30/32] Update openpype/hosts/hiero/plugins/publish/collect_clip_effects.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jakub Ježek --- openpype/hosts/hiero/plugins/publish/collect_clip_effects.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py b/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py index 6647459e8e..d7f646ebc9 100644 --- a/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py +++ b/openpype/hosts/hiero/plugins/publish/collect_clip_effects.py @@ -90,7 +90,7 @@ class CollectClipEffects(pyblish.api.InstancePlugin): # Some classes can have a number in them. Like Text2. found_cls = "" for cls in category_by_effect.keys(): - if value["class"].startswith(cls): + if cls in value["class"]: found_cls = cls effects_categorized[category_by_effect[found_cls]][key] = value From 97c465c20f57aff7a87e3604ed30849a6feec09d Mon Sep 17 00:00:00 2001 From: Ynbot Date: Wed, 24 Jan 2024 03:25:59 +0000 Subject: [PATCH 31/32] [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 5bb4b4fb0a..674ea2cb8a 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.2" +__version__ = "3.18.5-nightly.3" From c8e00d4aa4cfc81d967c8d607bd409af9659b068 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 24 Jan 2024 03:26:36 +0000 Subject: [PATCH 32/32] 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 e831bf3dc1..1816ffe515 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.3 - 3.18.5-nightly.2 - 3.18.5-nightly.1 - 3.18.4 @@ -134,7 +135,6 @@ body: - 3.15.8-nightly.2 - 3.15.8-nightly.1 - 3.15.7 - - 3.15.7-nightly.3 validations: required: true - type: dropdown