From 6b9a1b2449cf4bb8363262a7a61f2cc2a8aefb61 Mon Sep 17 00:00:00 2001 From: aardschok Date: Wed, 6 Dec 2017 16:46:47 +0100 Subject: [PATCH 1/7] force connections to time node --- colorbleed/plugins/maya/load/load_yeti_cache.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/colorbleed/plugins/maya/load/load_yeti_cache.py b/colorbleed/plugins/maya/load/load_yeti_cache.py index aa9275e258..8f3f9aeb26 100644 --- a/colorbleed/plugins/maya/load/load_yeti_cache.py +++ b/colorbleed/plugins/maya/load/load_yeti_cache.py @@ -194,6 +194,9 @@ class YetiCacheLoader(api.Loader): # Enable the cache by setting the file mode cmds.setAttr("%s.fileMode" % yeti_node, 1) + # Connect to the time node + cmds.connectAttr("time1.timeOut", "%s.currentTime" % yeti_node) + nodes.append(yeti_node) nodes.append(transform_node) From 2652bfc7ec4163c861d8cbf066f8a11fdb753ef2 Mon Sep 17 00:00:00 2001 From: aardschok Date: Wed, 6 Dec 2017 16:47:45 +0100 Subject: [PATCH 2/7] collect all members, removed redundant line, renamed variable --- .../plugins/maya/publish/extract_yeti_rig.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/colorbleed/plugins/maya/publish/extract_yeti_rig.py b/colorbleed/plugins/maya/publish/extract_yeti_rig.py index 6a13a0343b..e3a273fdbf 100644 --- a/colorbleed/plugins/maya/publish/extract_yeti_rig.py +++ b/colorbleed/plugins/maya/publish/extract_yeti_rig.py @@ -13,7 +13,7 @@ from cb.utils.maya import context def disconnected_attributes(settings, members): members = cmds.ls(members, long=True) - original_connection = [] + original_connections = [] try: for input in settings["inputs"]: @@ -40,14 +40,13 @@ def disconnected_attributes(settings, members): continue cmds.disconnectAttr(src_attribute, dst_attribute) - original_connection.append([src_attribute, dst_attribute]) + original_connections.append([src_attribute, dst_attribute]) yield finally: # restore connections - for connection in original_connection: - src, dest = connection + for connection in original_connections: try: - cmds.connectAttr(dest, src) + cmds.connectAttr(connection[0], connection[1]) except Exception as e: print e, continue @@ -102,9 +101,10 @@ class ExtractYetiRig(colorbleed.api.Extractor): # Get input_SET members input_set = [i for i in instance if i == "input_SET"] - members = cmds.sets(input_set[0], query=True) # Get all items - members = cmds.listRelatives(members, ad=True, fullPath=True) + set_members = cmds.sets(input_set[0], query=True) + members = cmds.listRelatives(set_members, ad=True, fullPath=True) + members += cmds.ls(set_members, long=True) nodes = instance.data["setMembers"] with disconnected_attributes(settings, members): From 0f178ede9ae7e0f1b8a471cd3cd99513b03605c6 Mon Sep 17 00:00:00 2001 From: aardschok Date: Wed, 6 Dec 2017 16:54:39 +0100 Subject: [PATCH 3/7] corrected attribute name --- colorbleed/plugins/maya/load/load_yeti_cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorbleed/plugins/maya/load/load_yeti_cache.py b/colorbleed/plugins/maya/load/load_yeti_cache.py index 8f3f9aeb26..ce825a6edf 100644 --- a/colorbleed/plugins/maya/load/load_yeti_cache.py +++ b/colorbleed/plugins/maya/load/load_yeti_cache.py @@ -195,7 +195,7 @@ class YetiCacheLoader(api.Loader): cmds.setAttr("%s.fileMode" % yeti_node, 1) # Connect to the time node - cmds.connectAttr("time1.timeOut", "%s.currentTime" % yeti_node) + cmds.connectAttr("time1.outTime", "%s.currentTime" % yeti_node) nodes.append(yeti_node) nodes.append(transform_node) From 3ee2b2a38d815920a5ad01f13a94779232d5495b Mon Sep 17 00:00:00 2001 From: aardschok Date: Wed, 6 Dec 2017 17:20:18 +0100 Subject: [PATCH 4/7] removed debug print --- colorbleed/plugins/maya/load/load_yeti_cache.py | 15 +++++++++++++-- .../plugins/maya/publish/collect_yeti_rig.py | 1 - 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/colorbleed/plugins/maya/load/load_yeti_cache.py b/colorbleed/plugins/maya/load/load_yeti_cache.py index ce825a6edf..cfc9234df9 100644 --- a/colorbleed/plugins/maya/load/load_yeti_cache.py +++ b/colorbleed/plugins/maya/load/load_yeti_cache.py @@ -84,15 +84,26 @@ class YetiCacheLoader(api.Loader): def update(self, container, representation): path = api.get_representation_path(representation) + namespace = "{}:".format(container["namespace"]) members = cmds.sets(container['objectName'], query=True) - yeti_node = cmds.ls(members, type="pgYetiMaya", long=True) + yeti_node = cmds.ls(members, type="pgYetiMaya") + + # TODO: Count the amount of nodes cached + # To ensure new nodes get created or old nodes get destroyed for node in yeti_node: - node_name = node.split(":")[-1] + # Remove local given namespace + node_name = node.split(namespace, 1)[-1] + node_name = node_name.replace(":", "_") + + # Check if the node has a cache tmp_cache = os.path.join(path, "{}.%04d.fur".format(node_name)) fpath = self.validate_cache(os.path.normpath(tmp_cache)) + + # Update the attribute cmds.setAttr("{}.cacheFileName".format(node), fpath, type="string") + # Update the container cmds.setAttr("{}.representation".format(container["objectName"]), str(representation["_id"]), type="string") diff --git a/colorbleed/plugins/maya/publish/collect_yeti_rig.py b/colorbleed/plugins/maya/publish/collect_yeti_rig.py index ed0d84907d..9d26e0b4b5 100644 --- a/colorbleed/plugins/maya/publish/collect_yeti_rig.py +++ b/colorbleed/plugins/maya/publish/collect_yeti_rig.py @@ -40,7 +40,6 @@ class CollectYetiRig(pyblish.api.InstancePlugin): input_shapes = cmds.ls(input_nodes, long=True, noIntermediate=True) # Store all connections - print "input shape:", input_shapes connections = cmds.listConnections(input_shapes, source=True, destination=False, From 63c82f0639aa143882de7a300917ddcf00f54715 Mon Sep 17 00:00:00 2001 From: aardschok Date: Wed, 6 Dec 2017 17:20:40 +0100 Subject: [PATCH 5/7] removed unused import --- colorbleed/plugins/maya/publish/validate_model_content.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/colorbleed/plugins/maya/publish/validate_model_content.py b/colorbleed/plugins/maya/publish/validate_model_content.py index 75959f66b0..06b29da68d 100644 --- a/colorbleed/plugins/maya/publish/validate_model_content.py +++ b/colorbleed/plugins/maya/publish/validate_model_content.py @@ -1,5 +1,3 @@ -import pprint - from maya import cmds import pyblish.api From 8e321aa1e8bcc10749d90c2c34cfc9a017c27ae3 Mon Sep 17 00:00:00 2001 From: aardschok Date: Thu, 7 Dec 2017 16:26:19 +0100 Subject: [PATCH 6/7] catch None as list in case no relatives are there --- colorbleed/plugins/maya/publish/extract_yeti_rig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorbleed/plugins/maya/publish/extract_yeti_rig.py b/colorbleed/plugins/maya/publish/extract_yeti_rig.py index e3a273fdbf..a086accfe8 100644 --- a/colorbleed/plugins/maya/publish/extract_yeti_rig.py +++ b/colorbleed/plugins/maya/publish/extract_yeti_rig.py @@ -103,7 +103,7 @@ class ExtractYetiRig(colorbleed.api.Extractor): input_set = [i for i in instance if i == "input_SET"] # Get all items set_members = cmds.sets(input_set[0], query=True) - members = cmds.listRelatives(set_members, ad=True, fullPath=True) + members = cmds.listRelatives(set_members, ad=True, fullPath=True) or [] members += cmds.ls(set_members, long=True) nodes = instance.data["setMembers"] From ff93354068361270087a871d880ed1c91d0fe27a Mon Sep 17 00:00:00 2001 From: aardschok Date: Thu, 7 Dec 2017 16:40:05 +0100 Subject: [PATCH 7/7] cosmetics --- colorbleed/plugins/maya/load/load_yeti_cache.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/colorbleed/plugins/maya/load/load_yeti_cache.py b/colorbleed/plugins/maya/load/load_yeti_cache.py index cfc9234df9..0544868340 100644 --- a/colorbleed/plugins/maya/load/load_yeti_cache.py +++ b/colorbleed/plugins/maya/load/load_yeti_cache.py @@ -46,7 +46,7 @@ class YetiCacheLoader(api.Loader): node_data = fursettings["nodes"] nodes = self.create_nodes(namespace, node_data) - group_name = "{}:{}".format(namespace, asset["name"]) + group_name = "{}:{}".format(namespace, name) group_node = cmds.group(nodes, name=group_name) nodes.append(group_node) @@ -94,10 +94,10 @@ class YetiCacheLoader(api.Loader): for node in yeti_node: # Remove local given namespace node_name = node.split(namespace, 1)[-1] - node_name = node_name.replace(":", "_") + file_name = node_name.replace(":", "_") # Check if the node has a cache - tmp_cache = os.path.join(path, "{}.%04d.fur".format(node_name)) + tmp_cache = os.path.join(path, "{}.%04d.fur".format(file_name)) fpath = self.validate_cache(os.path.normpath(tmp_cache)) # Update the attribute