def rigArm(self, *args): basicFilter = "*.json" fileName = cmds.fileDialog2(fileFilter=basicFilter, dialogStyle=2, fm=1, okc='Load') # Read the Json file # Call on the json_utils readJson method. data = json_utils.readJson(fileName) info = json.loads( data ) self.Rig_Info['fkJoints'] = rig_utils.createJointChain(info, 'fkj') self.Rig_Info['ikJoints'] = rig_utils.createJointChain(info, 'ikj') self.Rig_Info['rigJoints'] = rig_utils.createJointChain(info, 'rigj') # Setup the ik rig ctrlFile = 'C:/Users/Griffy/Documents/GitHub/Python101/rigging/controls/HandControl.ma' rig_utils.importControlObject(ctrlFile) self.Rig_Info['ikInfo'] = rig_utils.createIk(self.Rig_Info['ikJoints']) # Align the control to the last ik joint tmpConstraint = cmds.parentConstraint(self.Rig_Info['ikJoints'][2], 'grp_control', mo=False) cmds.delete(tmpConstraint) # Rename the control cmds.rename('grp_control', 'grp_ikArmCtrl') cmds.rename('control', 'ikArmCtrl') # Constrain the ikHandle to the control cmds.pointConstraint('ikArmCtrl', self.Rig_Info['ikInfo'][0]) # Make the fk controls # Connect the fk, ik, and rig ikJoints for i in range(len(self.Rig_Info['rigJoints'])): switchPCon = cmds.parentConstraint(self.Rig_Info['ikJoints'][i], self.Rig_Info['rigJoints'][i], mo=True) cmds.parentConstraint(self.Rig_Info['fkJoints'][i], self.Rig_Info['rigJoints'][i], mo=True) print switchPCon
def rigLeg(self, *args): basicFilter = "*.json" fileName = cmds.fileDialog2(fileFilter=basicFilter, dialogStyle=2, fm=1, okc='Load') # Read the Json file # Call on the json_utils readJson method. data = json_utils.readJson(fileName) info = json.loads(data) # Use the generic createJointChain method from rigUtils # Notice that I am passing the arguments info and a custom string. # I am also storing the returned data to the Rig_Info dictionary. self.Rig_Info['fkJoints'] = rig_utils.createJointChain(info, 'fkj') self.Rig_Info['ikJoints'] = rig_utils.createJointChain(info, 'ikj') self.Rig_Info['rigJoints'] = rig_utils.createJointChain(info, 'rigj') # Connect the fk, ik, and rig ikJoints for i in range(len(self.Rig_Info['rigJoints'])): switchPCon = cmds.parentConstraint(self.Rig_Info['ikJoints'][i], self.Rig_Info['rigJoints'][i], mo=True) cmds.parentConstraint(self.Rig_Info['fkJoints'][i], self.Rig_Info['rigJoints'][i], mo=True) print switchPCon
def createLayout(self, *args): basicFilter = "*.json" fileName = cmds.fileDialog2(fileFilter=basicFilter, dialogStyle=2, fm=1, okc='Load') # Read the Json file data = json_utils.readJson(fileName) info = json.loads( data ) # Lets use a loop to build locators for i in range(len(info['names'])): lctr = cmds.spaceLocator(name=info['names'][i]) # The position flag won't yield the desired # results, so we position the locators after we # make them. cmds.xform(lctr, ws=True, t=info['positions'][i])
def rigLeg(self, *args): basicFilter = "*.json" fileName = cmds.fileDialog2(fileFilter=basicFilter, dialogStyle=2, fm=1, okc='Load') # Read the Json file # Call on the json_utils readJson method. data = json_utils.readJson(fileName) info = json.loads( data ) # Use the generic createJointChain method from rigUtils # Notice that I am passing the arguments info and a custom string. # I am also storing the returned data to the Rig_Info dictionary. self.Rig_Info['fkJoints'] = rig_utils.createJointChain(info, 'fkj') self.Rig_Info['ikJoints'] = rig_utils.createJointChain(info, 'ikj') self.Rig_Info['rigJoints'] = rig_utils.createJointChain(info, 'rigj') # Connect the fk, ik, and rig ikJoints for i in range(len(self.Rig_Info['rigJoints'])): switchPCon = cmds.parentConstraint(self.Rig_Info['ikJoints'][i], self.Rig_Info['rigJoints'][i], mo=True) cmds.parentConstraint(self.Rig_Info['fkJoints'][i], self.Rig_Info['rigJoints'][i], mo=True) print switchPCon