Exemplo n.º 1
0
 def blueprint(self,**kwargs):
         'Creates a hinge joint can be used for arms or legs'
         # create registries
         self.createRegistry("regBlueprintTransform")
         self.createRegistry("regBlueprintShape")
         
         # create Base Groups
         rootGrp = cmds.group( n = (self.name + "Blueprint_GRP"), em = True )
         jointGrp = cmds.group( n = (self.name + "BlueprintJoint_GRP"), em = True, p = rootGrp )
         
         # create blueprinters
         baseData = Util.createBlueprinter((self.name + "BaseBlueprinter"), {"shape":"sphere", "size": 0.5})
         middleData = Util.createBlueprinter((self.name + "MiddleBlueprinter"), {})
         endData  = Util.createBlueprinter((self.name + "EndBlueprinter"), {"shape":"sphere", "size": 0.5})
         
         base = baseData["sctl"]
         middle = middleData["sctl"]
         end = endData["sctl"]
         
         # manage blueprinter joints
         cmds.parent(endData["jnt"], middleData["jnt"])
         cmds.parent(middleData["jnt"], baseData["jnt"])
         cmds.parent(baseData["jnt"], jointGrp)
         
         joints = [baseData["jnt"],middleData["jnt"], endData["jnt"]]
         
         # create arrow ctls
         args = {"shape":"arrow", "size":0.5}
         blueprinterArrowData = Util.createBlueprinter( (self.name + "Direction"), args )
         blueprinterArrow = blueprinterArrowData["sctl"]
         cmds.rotate( 0, 90, 0 , blueprinterArrow[1])
         args = {"shape":"arrow", "size":0.5}
         
         # create axis control
         axisCtlData = Util.createAxisContols((self.name + "axisCtl"), args )
         axisCtlGrp = axisCtlData["grp"]
         
         # create constraints   
         baseEndConst = Util.constrain(end[0], base[0], axisCtlGrp[0], args={ "t":1, "name":(self.name + "BaseEndConst" )} )
         baseEndAimConst = cmds.aimConstraint(base[0], axisCtlGrp[0], n = (self.name + "BaseEndConst" + "_AIM") )
         arrowEndConst = Util.constrain(base[0], blueprinterArrow[1], args={ "t":1, "name":(self.name + "ArrowConst")} )
         arrowAimConst = cmds.aimConstraint(end[0], blueprinterArrow[1], n = (self.name + "ArrowConst" + "_AIM") )
         
         Util.lockHide(base[0], {"s":1,"v":1, "l":1, "h":1})
         Util.lockHide(middle[0], {"r":1,"s":1,"v":1, "l":1, "h":1})
         Util.lockHide(end[0], {"r":1,"s":1,"v":1, "l":1, "h":1})
         
         cmds.parent(end[1], base[0])
         cmds.parent(middle[1], axisCtlGrp[1] )
         cmds.parent(axisCtlGrp[0],base[0] )
         cmds.parent(base[1], rootGrp,)
         cmds.parent(blueprinterArrow[1], rootGrp)
         #cmds.parent(jointGrp, rootGrp)
         
         cmds.move(0, 0, 0, base[1])
         cmds.move(0, 0, 2, end[1])
         
         cmds.parent(rootGrp, self.rootGrp)
         
         # store joints and controls
         self.storeBlueprinterJoints( joints )
         self.storeBlueprinterControls( [base[0],middle[0],end[0]] )
         
         # register Blueprinters
         self.registerObjects((base + middle + end + axisCtlData["xctl"] +
         		      axisCtlData["yctl"] + axisCtlData["zctl"]), 
         	 	      "regBlueprintTransform")