def createComponentJNT_from_SRT(): ### Make joints from selected srts mySel = cmds.ls(sl=True) for eachCtrl in mySel: compName = '%s' % '_'.join(eachCtrl.split('_')[:2]) cmds.select(clear = True) joint = cmds.joint(name = eachCtrl.replace(compName, '%s_armature' % compName).replace('_srt', '_jnt'), p = [0,0,0]) data = {'name' : '%s_decompose_mtx' % joint, 'nodeType': "decomposeMatrix", 'destination': joint, 'sources': [eachCtrl], 'buildOffset' : False } nodes.createMatrix(data)
def createComponentSRT_from_CTRL(): ## Make srts for selected controls from a single component only cmds.undoInfo(openChunk = True) outputGrp = '%s_output' % '_'.join(cmds.ls(sl=True)[0].split('_')[:2]) mySel = cmds.ls(sl=True) for eachCtrl in mySel: loc = cmds.spaceLocator(name = eachCtrl.replace('_ctrl', '_srt').replace("_jnt", "_srt")) cmds.parent(loc, outputGrp) data = {'name' : '%s_decompose_mtx' % loc[0], 'nodeType': "decomposeMatrix", 'destination': loc[0], 'sources': [eachCtrl], 'buildOffset' : False } nodes.createMatrix(data) cmds.undoInfo(closeChunk = True)
def createReparents(name = '', side = '', mo = True, data = {}): cstData = {} for conn, connData in data.items(): connData['name'] = conn connData['buildOffset'] = mo connData['nodeType'] = 'AL_rig_reparentSingle' mtx = nodes.createMatrix(connData) cstData[conn] = {'reparent': mtx} #createDefaultMetaData(mtx, name, side, 'reparent') return cstData