updated keys of rigsettings to meet Maya logic

This commit is contained in:
aardschok 2017-12-04 16:27:44 +01:00
parent c61b8ab636
commit f1c623bd3b
2 changed files with 24 additions and 24 deletions

View file

@ -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 = []

View file

@ -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: