def ctrlGrp(cls, ctrl): ''' Make control gorup hierarchy. ''' zeroGrp = tak_misc.doGroup(ctrl, '_zero') autoGrp = tak_misc.doGroup(ctrl, '_auto') extraGrp = tak_misc.doGroup(ctrl, '_extra') if not '_all_ctrl' in ctrl: chldRoPivotGrp = tak_misc.doGroup(ctrl, '_chldRoPivot') return zeroGrp, autoGrp, extraGrp, chldRoPivotGrp return zeroGrp, autoGrp, extraGrp
def reverseGrp(cls, srcObj): revGrp = tak_misc.doGroup(srcObj, '_rev') mulNode = cmds.createNode('multiplyDivide', n=srcObj + '_mul') inputList = ['input2X', 'input2Y', 'input2Z'] for input in inputList: cmds.setAttr('{0}.{1}'.format(mulNode, input), -1) cmds.connectAttr('{0}.translate'.format(srcObj), '{0}.input1'.format(mulNode), f=True) cmds.connectAttr('{0}.output'.format(mulNode), '{0}.translate'.format(revGrp), f=True)
def app(*args): # get target list trgList = cmds.textScrollList('mainTrgTexScrLis', q=True, allItems=True) # get suffix suffixOptState = cmds.optionMenu('suffixOptMenu', q=True, select=True) if suffixOptState == 1: suffix = '_zero' elif suffixOptState == 2: suffix = '_auto' elif suffixOptState == 3: suffix = '_extra' delTxt = cmds.textFieldGrp('delTxtFldGrp', q=True, text=True) rplc = cmds.textFieldGrp('rplcTxtFldGrp', q=True, text=True) ctrlGrpOpt = cmds.checkBox('ctrlGrpChkBox', q=True, value=True) for trg in trgList: if ctrlGrpOpt: tak_misc.doGroup(trg, '_zero') # tak_misc.doGroup(trg, '_cnst') tak_misc.doGroup(trg, '_auto') tak_misc.doGroup(trg, '_extra') # nodType = cmds.nodeType(trg) # if nodType == 'joint': # grpNode = cmds.createNode('transform', n = '%s%s' %(trg, suffix)) # constName = cmds.parentConstraint(trg, grpNode, mo = False, w = 1) # cmds.delete(constName) # prnt = cmds.listRelatives(trg, p = True) # cmds.parent(trg, grpNode) # if prnt: # cmds.parent(grpNode, prnt) elif suffix and delTxt: grpName = tak_misc.doGroup(trg, suffix) baseName = re.sub(delTxt, '', trg) cmds.rename(grpName, baseName + suffix) elif suffix: # cmds.select(trg, r = True) # grpNode = cmds.duplicate(n = '%s%s' %(trg, suffix), po=True) # cmds.parent(trg, grpNode) tak_misc.doGroup(trg, suffix)
# Normal eyelid selJnts = pm.selected() for jnt in selJnts: name = jnt.getChildren()[0].rsplit('_jnt')[0] ikh = pm.ikHandle(sj=jnt, ee=jnt.getChildren()[0], solver='ikSCsolver', n=name + '_ikh')[0] ikhWsPos = pm.xform(ikh, q=True, ws=True, t=True) loc = pm.spaceLocator(n=name + '_loc') loc.translate.set(ikhWsPos) ikh.setParent(loc) tak_misc.doGroup(loc.name(), '_zero') tak_misc.doGroup(loc.name(), '_auto') # Zipper Lip # import pymel.core as pm # Distribute constraint weight # selJnts = sorted(pm.ls(sl=True), reverse=True) segment = len(selJnts) - 1 fullWeight = 1.0 increment = fullWeight / len(selJnts) weight = 1 for jnt in selJnts: weight -= increment parentConstraintNode = jnt.getChildren()[0]
import tak_riggingToolkit import re import tak_misc search = '_jnt' replace = '_ctrl' shape = 'circleX' jnts = pm.selected() for jnt in jnts: ctrlName = re.sub(search, replace, jnt.name()) controller = tak_riggingToolkit.base.control.Controller(ctrlName, shape) controller.create() controller.parentShape(jnt) jnt.rename(ctrlName) tak_misc.doGroup(jnt.name(), '_zero') # Create rig groups import pymel.core as pm rigGrp = pm.group(n='rig', empty=True, p='root') GeometryGrp = pm.group(n='Geometry', empty=True, p=rigGrp) pm.group(n='lod02_GRP', empty=True, p=GeometryGrp) pm.group(n='lod01_GRP', empty=True, p=GeometryGrp) # Search pymel method, attributes import tak_lib tak_lib.searchMethods(selSets[0], 'member') tak_lib.searchAttributes(selSets[0], 'member')