Esempio n. 1
0
 def registerAttribute(self, attrName):
     """
         Creates array of attribute names that will store data on module
     """
     if cmds.objExists((self.container + ".regAttribute")) == False:
         Util.addStringArrayAttribute(self.container,"regAttribute",[attrName])
     else:
         data = cmds.getAttr((self.container + ".regAttribute"))
         data.append(attrName)
         Util.setStringArrayData(self.container,"regAttribute",data)
         self.registeredAttributes.append(attrName)
Esempio n. 2
0
 def createInputOutputAttr(self, object, key, inputOutput):
     """
         Will store message attribute on container connected to object with key in attr name
     """
     connectAttr = ""
     if inputOutput == "input":
         connectAttr = ("input_" + key)
     elif inputOutput == "output":
         connectAttr = ("output_" + key)
     else:
         cmds.error( "Input or output type not specified" )
     
     # Old code only hands transforms
     """if cmds.objExists( (self.container + "." + connectAttr) ) == False:
         cmds.addAttr(self.container, ln = connectAttr, at= "message")
         Util.addAttr(object, connectAttr, "message" )
         cmds.connectAttr((self.container + "." + connectAttr), (object + "." + connectAttr) )
         command = ("self." + inputOutput + "s[key] = object")
         exec command
     else:
         cmds.error( "Input / output value :" + (self.container + "." + connectAttr) + " already exists" )"""
     
     type = "trans"
     attrName = ""
     
     # Check if object is attribute
     if len( object.split(".") ) > 1:
         type = "attr"
         object = object.split(".")[0]
         attrName = object.split(".")[1:]
     
     if cmds.objExists( (self.container + "." + connectAttr) ) == False:
         # Mesasage array to link nodes
         Util.addAttr(self.container, connectAttr, "message" )
         Util.addAttr(object, connectAttr, "message" )
         cmds.connectAttr((self.container + "." + connectAttr), (object + "." + connectAttr) )
         # Store connection Data
         connectionDataAttr = (connectAttr + "_data")
         connectionData = ["type",type, "attr",attrName  ] 
         Util.addStringArrayAttribute(self.container , connectionDataAttr,connectionData )
         # Store connection in dict
         command = ("self." + inputOutput + "s[key] = object")
         exec command
     else:
         cmds.error( "Input / output value :" + (self.container + "." + connectAttr) + " already exists" )
     return  connectAttr
Esempio n. 3
0
 def storeConnection(self, connectionKey, inputPlug, outputPlug , type, attrName= "None"):
     """
         Store connection data between output to input on current module
     """
     
     connectAttr = ("connection_" + connectionKey)
     connectDataAttr = ("connection_" + connectionKey + "_data")
     connectInputAttr = ("connection_" + connectionKey + "_input")
     connectOutputAttr = ("connection_" + connectionKey + "_output")
     
     if cmds.objExists( (self.container + "." + connectAttr) ) == False:
         Util.addAttr(self.container, connectAttr, "message")
         # Store connection Data
         connectionData = ["type:",type, "attr:",attrName ,"input:",inputPlug ,"output:",outputPlug, "connectionKey:",connectionKey ] 
         Util.addStringArrayAttribute(self.container , connectDataAttr, connectionData )
         self.connections[connectionKey] = {"input":inputPlug,"output":outputPlug, "connectAttr":connectAttr}
         self.registerAttribute( connectDataAttr )
     else:
         cmds.warning( "Connection value :" + (self.container + "." + connectAttr) + " already exists" )