From f1c623bd3bf2fbae04a81480b42000dda55cc36c Mon Sep 17 00:00:00 2001 From: aardschok Date: Mon, 4 Dec 2017 16:27:44 +0100 Subject: [PATCH] updated keys of rigsettings to meet Maya logic --- .../plugins/maya/publish/collect_yeti_rig.py | 18 ++++++----- .../plugins/maya/publish/extract_yeti_rig.py | 30 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/colorbleed/plugins/maya/publish/collect_yeti_rig.py b/colorbleed/plugins/maya/publish/collect_yeti_rig.py index b29ce1cb95..ed0d84907d 100644 --- a/colorbleed/plugins/maya/publish/collect_yeti_rig.py +++ b/colorbleed/plugins/maya/publish/collect_yeti_rig.py @@ -37,28 +37,30 @@ class CollectYetiRig(pyblish.api.InstancePlugin): fullPath=True) or input_content # Get all the shapes - input_shapes = cmds.ls(input_nodes, long=True) + 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, connections=True, plugs=True) or [] - # Group per source, destination pair - grouped = [(item, connections[i+1]) for i, item in + # Group per source, destination pair. We need to reverse the connection + # list as it comes in with the shape used to query first while that + # shape is the destination of the connection + grouped = [(connections[i+1], item) for i, item in enumerate(connections) if i % 2 == 0] inputs = [] for src, dest in grouped: - src_node, src_attr = src.split(".", 1) + source_node, source_attr = src.split(".", 1) dest_node, dest_attr = dest.split(".", 1) - # The plug must go in the socket, remember this for the loader - inputs.append({"connections": [src_attr, dest_attr], - "destinationID": lib.get_id(dest_node), - "sourceID": lib.get_id(src_node)}) + inputs.append({"connections": [source_attr, dest_attr], + "sourceID": lib.get_id(source_node), + "destinationID": lib.get_id(dest_node)}) # Collect any textures if used yeti_resources = [] diff --git a/colorbleed/plugins/maya/publish/extract_yeti_rig.py b/colorbleed/plugins/maya/publish/extract_yeti_rig.py index a78c736282..6a13a0343b 100644 --- a/colorbleed/plugins/maya/publish/extract_yeti_rig.py +++ b/colorbleed/plugins/maya/publish/extract_yeti_rig.py @@ -17,31 +17,29 @@ def disconnected_attributes(settings, members): try: for input in settings["inputs"]: - # get source - socket_id = input["sourceId"] - sources = lib.lsattr("cbId", socket_id) - sources = [i for i in sources if + # Get source shapes + source_nodes = lib.lsattr("cbId", input["sourceID"]) + sources = [i for i in source_nodes if not cmds.referenceQuery(i, isNodeReferenced=True) and i in members] - src = sources[0] + source = sources[0] - # get destination - plug_id = input["destinationID"] - plugs = lib.lsattr("cbId", plug_id) - destinations = [i for i in plugs if i not in members and - i not in sources] - dst = destinations[0] + # Get destination shapes (the shapes used as hook up) + destination_nodes = lib.lsattr("cbId", input["destinationID"]) + destinations = [i for i in destination_nodes if i not in members + and i not in sources] + destination = destinations[0] - # break connection + # Break connection connections = input["connections"] - src_attribute = "%s.%s" % (src, connections[0]) - dst_attribute = "%s.%s" % (dst, connections[1]) + src_attribute = "%s.%s" % (source, connections[0]) + dst_attribute = "%s.%s" % (destination, connections[1]) # store connection pair - if not cmds.isConnected(dst_attribute, src_attribute): + if not cmds.isConnected(src_attribute, dst_attribute): continue - cmds.disconnectAttr(dst_attribute, src_attribute) + cmds.disconnectAttr(src_attribute, dst_attribute) original_connection.append([src_attribute, dst_attribute]) yield finally: