def addToSet(_data, _set, _objects): assert isinstance(_data, sd.SceneData), "_data must be SceneData object" error.assertString(_set) actualSet = _data.getSet(_set) if actualSet: if type(_objects) == type([]): for obj in _objects: error.assertMayaObject(obj) cmds.sets(obj, add=actualSet) else: error.assertMayaObject(_objects) cmds.sets(_objects, add=actualSet)
def addToControlDict(_dict, _identifier, _control): error.assertStringDict(_dict) error.assertString(_identifier) error.assertString(_control) assert _identifier not in _dict, "%s is already in _dict" %(_identifier) # Check that _control is not already mapped notInDict = True for key, value in _dict.items(): if value == _control: inDict = False break assert notInDict, "%s is already in _dict" %(_control) # Actually add to _dict _dict[_identifier] = _control
def generateAutoClav(_name, _shoulderSDK, _wristIK): print "doing something" error.assertString(_name) error.assertMayaObject(_shoulderSDK) error.assertMayaObject(_wristIK) cmds.select(clear=True) # Create joints joint1 = cmds.joint(n="%s_IK_JNT" %(_name)) rc.copyTranslation(joint1, _shoulderSDK) joint2 = cmds.joint(n="%s_IKEND_JNT" %(_name)) rc.copyTranslation(joint2, _wristIK) #cmds.parent(joint2, joint1) # Create IK ikControl = cmds.ikHandle( n="%s_IK" %(_name), sol="ikRPsolver", sj= joint1, ee=joint2 )[0] # deselect so we don't get warnings cmds.select(d=1) # Create pole vec locator = cmds.spaceLocator(n="%s_up_LOC" %(_name))[0] rc.orientControl(locator, _wristIK) locGroup = rg.addGroup(locator, "%s_0" %(locator)) cmds.setAttr("%s.ty" %(locator), 2) cmds.poleVectorConstraint(locator, ikControl) # Connect up to rig cmds.pointConstraint(_wristIK, locGroup, mo=1) cmds.pointConstraint(_wristIK, ikControl, mo=1) cmds.orientConstraint(joint1, _shoulderSDK, mo=1)
def getSet(self, _identifier): error.assertString(_identifier) if _identifier in self.m_setDictionary: return self.m_setDictionary[_identifier] else: return ""
def addSet(self, _set, _identifier): error.assertMayaType(_set, "objectSet") error.assertString(_identifier) self.m_setDictionary[_identifier] = _set