def doGuide(self): if pm.objExists('facial_guides_grp'): moveall_grp = 'facial_guides_grp' else: moveall_grp = pm.group(n='facial_guides_grp', em=True) self.guideMoveall = self.createCntrl('moveallGuide') self.lcornerGuide = self.createCntrl('lcornerGuide') self.rcornerGuide = self.createCntrl('rcornerGuide') pm.parent (self.lcornerGuide, self.rcornerGuide, self.guideMoveall) self.setCntrl (self.guideMoveall, 'moveall') self.setCntrl(self.lcornerGuide, 'lcorner') self.setCntrl(self.rcornerGuide, 'rcorner') self.mirror_mdn = pm.createNode('multiplyDivide') self.mirror_mdn.input2X.set(-1) self.lcornerGuide.translate >> self.mirror_mdn.input1 self.mirror_mdn.output >> self.rcornerGuide.translate pm.parent(self.guideMoveall, moveall_grp) pm.toggle(self.lcornerGuide, selectHandle=True) pm.addAttr(self.guideMoveall, ln='mouthBlendDict', dt='string') self.guideMoveall.mouthBlendDict.set(json.dumps(self.exportDict()))
def toggleLocalAxis(state=1): ''' Function: takes a source and matches its position to the args Args = state=boolean State: state=1: turn off all, state=0: swap current state of each object Returns: None ''' args = pm.ls(sl=1) for arg in args: if state==1: if pm.toggle(arg, query=True, localAxis=True): print "Turning off local axis on object %s" % arg arg.displayLocalAxis.set(False) else: arg.displayLocalAxis.set(not pm.toggle(arg,q=True,localAxis=True))
def selImgPln(): #comfirmDialog for checking if ImgPln in the scene allTransNd = pm.ls(type='transform',fl=True) isImgPln = [] for trans in allTransNd: if trans == 'ImagePlane_Parent_Loc': isImgPln.append(trans) if len(isImgPln) == 0: cfmAnswer = pm.confirmDialog( title='Confirm', message='Create New Image Plane?', button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' ) if cfmAnswer == 'Yes': createImgPln() elif len(isImgPln) >= 1: pm.select(ImgPln[0],r=True) if(pm.getAttr(ImgPln[0]+'.t',lock=True)): pm.setAttr(ImgPln[0]+'.t',lock=False) pm.setAttr(ImgPln[0]+'.r',lock=False) pm.setAttr(ImgPln[0]+'.s',lock=False) pm.toggle(ImgPln[0],state=False,template=True)
def bdToggleAxis(): ''' Category: Joint ''' selection = pm.ls(sl=1) if selection: for jnt in selection: pm.select(cl=1) try: pm.select(jnt) state = pm.toggle(q=True, localAxis=True) if state == 1: pm.toggle(state=False, localAxis=True) elif state == 0: pm.toggle(state=True, localAxis=True) except: pm.warning("%s is not a joint" % jnt.name()) pm.select(selection)
def doRig(self): anchorList = [] cntrlList = [] locList = [] dummyCrv = self.ribbonDict['moveallSetup']['nameTempl'] + '_dummy_crv' pm.hide(pm.polyCube(n=dummyCrv)) if pm.objExists(self.ribbonDict['noMoveSetup']['nameTempl']): pm.delete(self.ribbonDict['noMoveSetup']['nameTempl']) if pm.objExists(self.ribbonDict['moveallSetup']['nameTempl']): pm.delete(self.ribbonDict['moveallSetup']['nameTempl']) logger ###Estrutura que nao deve ter transformacao noMoveSpace = pm.group(empty=True, n=self.ribbonDict['noMoveSetup']['nameTempl']) if not pm.objExists('NOMOVE'): pm.group(self.ribbonDict['noMoveSetup']['nameTempl'], n='NOMOVE') else: pm.parent(self.ribbonDict['noMoveSetup']['nameTempl'], 'NOMOVE') pm.parent(self.ribbonDict['moveallSetup']['nameTempl'] + '_dummy_crv', noMoveSpace) noMoveSpace.visibility.set(0) noMoveBend1 = pm.nurbsPlane(p=(self.size * 0.5, 0, 0), ax=(0, 0, 1), w=self.size, lr=0.1, d=3, u=5, v=1) # noMoveCrvJnt = pm.curve ( bezier=True, d=3, p=[(self.size*-0.5,0,0),(self.size*-0.4,0,0),(self.size*-0.1,0,0),(0,0,0),(self.size*0.1,0,0),(self.size*0.4,0,0),(self.size*0.5,0,0)], k=[0,0,0,1,1,1,2,2,2]) noMoveCrvJnt = pm.curve( bezier=True, d=3, p=[(self.size * -0.50, 0, 0), (self.size * -0.499, 0, 0), (self.size * -0.496, 0, 0), (self.size * -0.495, 0, 0), (self.size * -0.395, 0, 0), (self.size * -0.10, 0, 0), (0, 0, 0), (self.size * 0.10, 0, 0), (self.size * 0.395, 0, 0), (self.size * 0.495, 0, 0), (self.size * 0.496, 0, 0), (self.size * 0.499, 0, 0), (self.size * 0.50, 0, 0)], k=[0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10]) noMoveCrvJnt.translate.set(self.size * 0.5, 0, 0) # Deformers das superficies noMove twist1 = pm.nonLinear(noMoveBend1[0], type='twist') # twist das superficies noMove twist1[1].rotateZ.set(90) # IMPLEMENTAR O TWIST DO MEIO twist2 = pm.nonLinear(noMoveBend1[0].name() + '.cv[0:3][0:3]', type='twist') # twist das superficies noMove twist2[1].rotateZ.set(90) twist3 = pm.nonLinear(noMoveBend1[0].name() + '.cv[4:7][0:3]', type='twist') # twist das superficies noMove twist3[1].rotateZ.set(90) wireDef = pm.wire(noMoveBend1[0], w=noMoveCrvJnt, dds=[(0, 50)]) # Wire das superficies noMove wireDef[0].rotation.set(1) # seta rotacao pra acontecer baseWire = [ x for x in wireDef[0].connections() if 'BaseWire' in x.name() ] pm.group(baseWire, noMoveCrvJnt, noMoveBend1[0], p=noMoveSpace, n=self.name + 'Deforms_grp') pm.parent(twist1[1], twist2[1], twist3[1], noMoveSpace) ###Estrutura que pode ser movida cntrlsSpace = pm.group(empty=True, n=self.ribbonDict['moveallSetup']['nameTempl']) bendSurf1 = pm.nurbsPlane(p=(self.size * -0.5, 0, 0), ax=(0, 0, 1), w=self.size * 0.5, lr=.1, d=3, u=5, v=1) blend1 = pm.blendShape(noMoveBend1[0], bendSurf1[0]) pm.blendShape(blend1, e=True, w=[(0, 1)]) pm.parent(bendSurf1[0], cntrlsSpace) ##Cntrls for i in range(0, 7): anchor = pm.cluster(noMoveCrvJnt.name() + '.cv[' + str(i + 3) + ']') pm.cluster(anchor[1], e=True, g=dummyCrv) clsHandle = anchor[1] anchorGrp = pm.group(em=True, n='clusterGrp' + str(i)) anchorDrn = pm.group(em=True, n='clusterDrn' + str(i), p=anchorGrp) pos = pm.xform(anchor, q=True, ws=True, rp=True) pm.xform(anchorGrp, t=pos, ws=True) pm.parent(anchor[1], anchorDrn) anchorList.append(anchor[1]) if i == 0 or i == 6: displaySetup = self.ribbonDict['cntrlSetup'].copy() cntrlName = displaySetup['nameTempl'] + str(i) cntrl = controlTools.cntrlCrv(name=cntrlName, obj=anchor[1], **displaySetup) elif i == 3: displaySetup = self.ribbonDict['midCntrlSetup'].copy() cntrlName = displaySetup['nameTempl'] + str(i) cntrl = controlTools.cntrlCrv(name=cntrlName, obj=anchor[1], **displaySetup) else: displaySetup = self.ribbonDict['cntrlTangSetup'].copy() cntrlName = displaySetup['nameTempl'] + str(i) cntrl = controlTools.cntrlCrv(name=cntrlName, obj=anchor[1], **displaySetup) # Nao pode fazer conexao na criacao do controle, pois tera conexao direta pm.xform(cntrl.getParent(), t=pos, ws=True) # estrutura de buffers para conexao direta auxLocGrp = pm.group(em=True, n=self.name + 'auxLoc_grp') auxLoc = pm.group(em=True, p=auxLocGrp, n=self.name + 'aux_loc') pm.xform(auxLocGrp, t=pos, ws=True) loc = pm.PyNode(auxLoc) if i == 1 or i == 4: pm.xform(anchorGrp, s=(-1, 1, 1), r=True) pm.xform(cntrl.getParent(), s=(-1, 1, 1), r=True) pm.xform(loc.getParent(), s=(-1, 1, 1), r=True) # Conexoes dos buffers cm os clusters e com os controles pm.parentConstraint(cntrl, loc) loc.translate >> anchorDrn.translate loc.rotate >> anchorDrn.rotate cntrlList.append(cntrl) locList.append(loc) startCls = pm.cluster(noMoveCrvJnt.name() + '.cv[0:2]') endCls = pm.cluster(noMoveCrvJnt.name() + '.cv[10:14]') pm.cluster(startCls[1], e=True, g=dummyCrv) pm.cluster(endCls[1], e=True, g=dummyCrv) pm.parent(startCls, anchorList[0]) pm.parent(endCls, anchorList[6]) cntrlsSpace.addAttr('cntrlsVis', at='double', dv=1, k=True, h=False) cntrlsSpace.addAttr('extraCntrlsVis', at='double', dv=0, k=True, h=False) cntrlList[0].addAttr('twist', at='double', dv=0, k=True) cntrlList[0].addAttr('stretchDist', at='double', dv=0, k=True) cntrlList[0].addAttr('autoVolumStregth', at='double', dv=0, k=True) cntrlList[3].addAttr('twist', at='double', dv=0, k=True) cntrlList[3].addAttr('autoVolume', at='double', dv=0, k=True) cntrlList[6].addAttr('twist', at='double', dv=0, k=True) cntrlList[6].addAttr('stretchDist', at='double', dv=0, k=True) cntrlList[6].addAttr('autoVolumStregth', at='double', dv=0, k=True) cntrlList[0].twist >> twist1[0].endAngle cntrlList[3].twist >> twist2[0].startAngle cntrlList[3].twist >> twist3[0].endAngle cntrlList[6].twist >> twist1[0].startAngle # hierarquia pm.parent(anchorList[1].getParent(2), anchorList[0]) pm.parent(anchorList[5].getParent(2), anchorList[6]) pm.parent(anchorList[2].getParent(2), anchorList[4].getParent(2), anchorList[3]) pm.parent(cntrlList[1].getParent(), cntrlList[0]) pm.parent(cntrlList[5].getParent(), cntrlList[6]) pm.parent(cntrlList[2].getParent(), cntrlList[4].getParent(), cntrlList[3]) pm.parent(cntrlList[3].getParent(), cntrlList[0].getParent(), cntrlList[6].getParent(), cntrlsSpace) pm.parent(locList[1].getParent(), locList[0]) pm.parent(locList[5].getParent(), locList[6]) pm.parent(locList[2].getParent(), locList[4].getParent(), locList[3]) pm.parent(locList[3].getParent(), locList[0].getParent(), locList[6].getParent(), cntrlsSpace) pm.parent(anchorList[3].getParent(2), anchorList[0].getParent(2), anchorList[6].getParent(2), noMoveSpace) # Skin joints do ribbon skinJntsGrp = pm.group(em=True, n=self.name + 'SkinJnts_grp') follGrp = pm.group(em=True, n=self.name + 'Foll_grp') # cria ramps para controlar o perfil de squash e stretch ramp1 = pm.createNode('ramp', n=self.name + 'SquashRamp1') ramp1.attr('type').set(1) # ramp2 = pm.createNode ('ramp') # ramp2.attr('type').set(1) expre1 = "float $dummy = " + ramp1.name( ) + ".outAlpha;float $output[];float $color[];" # expre2 = "float $dummy = "+ramp2.name()+".outAlpha;float $output[];float $color[];" extraCntrlsGrp = pm.group(em=True, r=True, p=cntrlsSpace, n=self.name + 'extraCntrls_grp') # loop pra fazer os colocar o numero escolhido de joints ao longo do ribbon. # cria tmb node tree pro squash/stretch # e controles extras vIncrement = float( (1.0 - (self.offsetStart + self.offsetEnd)) / (self.numJnts - 1)) for i in range(1, self.numJnts + 1): # cria estrutura pra superficie 1 pm.select(cl=True) jntName = self.ribbonDict['jntSetup']['nameTempl'] + str( i) + self.jntSulfix jnt1 = pm.joint(p=(0, 0, 0), n=jntName) self.skinJoints.append(jnt1) displaySetup = self.ribbonDict['cntrlExtraSetup'].copy() cntrlName = displaySetup['nameTempl'] + 'A' + str(i) cntrl1 = controlTools.cntrlCrv(name=cntrlName, obj=jnt1, connType='parentConstraint', **displaySetup) # node tree blend1A = pm.createNode('blendTwoAttr', n=self.name + 'VolumeBlend1A') blend1B = pm.createNode('blendTwoAttr', n=self.name + 'VolumeBlend1B') gammaCorr1 = pm.createNode('gammaCorrect', n=self.name + 'VolumeGamma1') cntrlList[0].attr('autoVolumStregth') >> gammaCorr1.gammaX cntrlList[0].attr('stretchDist') >> gammaCorr1.value.valueX blend1A.input[0].set(1) gammaCorr1.outValueX >> blend1A.input[1] blend1B.input[0].set(1) blend1A.output >> blend1B.input[1] cntrlList[3].attr('autoVolume') >> blend1B.attributesBlender blend1B.output >> cntrl1.getParent().scaleY blend1B.output >> cntrl1.getParent().scaleZ # expressao que le a rampa para setar valores da escala de cada joint quando fizer squash/stretch expre1 = expre1 + "$color = `colorAtPoint -o RGB -u " + str( self.offsetStart + (i - 1) * vIncrement) + " -v 0.5 " + ramp1.name( ) + " `;$output[" + str(i) + "] = $color[0];" + blend1A.name( ) + ".attributesBlender=$output[" + str(i) + "];" # prende joints nas supeficies com follicules foll1 = self.attachObj(cntrl1.getParent(), bendSurf1[0], self.offsetStart + (i - 1) * vIncrement, 0.5, 4) pm.parent(cntrl1.getParent(), extraCntrlsGrp) pm.parent(jnt1, skinJntsGrp) pm.parent(foll1, follGrp) # seta expressoes para so serem avaliadas por demanda pm.expression(s=expre1, ae=False) pm.parent(skinJntsGrp, cntrlsSpace) pm.parent(follGrp, noMoveSpace) # hideCntrls pm.toggle(bendSurf1[0], g=True) bendSurf1[0].visibility.set(0) # skinJntsGrp.visibility.set(0) cntrlsSpace.extraCntrlsVis >> extraCntrlsGrp.visibility cntrlsSpace.cntrlsVis >> cntrlList[0].getParent().visibility cntrlsSpace.cntrlsVis >> cntrlList[3].getParent().visibility cntrlsSpace.cntrlsVis >> cntrlList[6].getParent().visibility # povoa ribbon Dict self.ribbonDict['name'] = 'bezierRibbon' self.ribbonDict['ribbonMoveAll'] = cntrlsSpace for i in range(0, 7): self.ribbonDict['cntrl' + str(i)] = cntrlList[i] self.startCntrl = cntrlList[0] self.midCntrl = cntrlList[3] self.endCntrl = cntrlList[6] self.moveall = cntrlsSpace
def doRig(self): p1 = pm.xform(self.guide1, q=1, t=1) p2 = pm.xform(self.guide2, q=1, t=1) p3 = pm.xform(self.guide3, q=1, t=1) A = om.MVector(p1) B = om.MVector(p2) C = om.MVector(p3) AC = A - C nurbsLength = AC.length() # setup do nurbs plane e follicles nurbs = pm.nurbsPlane(w=nurbsLength / self.sections, lr=self.sections, v=self.sections)[0] nurbsShp = nurbs.getShape() pm.rebuildSurface(nurbs, ch=1, rpo=1, rt=0, end=1, kr=0, kcp=0, kc=0, su=1, du=1, dv=3, tol=0.01, fr=0, dir=0) pm.xform(nurbs, t=p1, ws=True) guide2Up = pm.duplicate(self.guide2, n=self.guide2 + '_up')[0] pm.delete(pm.pointConstraint(self.guide1, self.guide3, guide2Up)) pm.xform(guide2Up, r=True, t=(self.direction[0], self.direction[1], self.direction[2])) pm.delete( pm.aimConstraint(self.guide3, nurbs, w=1, o=(0, 0, 0), aim=(0, 1, 0), u=(-1, 0, 0), wut='object', wuo=guide2Up)) pm.delete(guide2Up) pm.delete(pm.pointConstraint(self.guide1, self.guide3, nurbs)) grpFol = pm.group(em=1, n=self.name + 'Foll_grp') grpScale = pm.group(em=1, n=self.name + 'Scale_grp') vValue = 0 vSections = 1.0 / self.sections vOffset = vSections / 2 id = 0 # medindo o comprimento do nurbs para o squash stretch arcLengthShp = pm.createNode('arcLengthDimension') arcLength = arcLengthShp.getParent() nurbsShp.worldSpace[0] >> arcLengthShp.nurbsGeometry arcLengthShp.vParamValue.set(1) arcLengthShp.uParamValue.set(0) arcLenValue = arcLengthShp.arcLengthInV.get() autoManualList = [] factorList = [] on_offList = [] skinJntsList = [] for follicle in range(self.sections): id += 1 # criando nodes para o stretch squash normalizeTo0 = pm.createNode('plusMinusAverage', n=self.name + 'RbbnNormalize0' + ` id ` + '_pma') scaleAux = pm.createNode('multiplyDivide', n=self.name + 'RbbnScaleAux0' + ` id ` + '_md') factor = pm.createNode('multiplyDivide', n=self.name + 'RbbnFactor0' + ` id ` + '_md') on_off = pm.createNode('multiplyDivide', n=self.name + 'RbbnOnOff0' + ` id ` + '_md') autoManual = pm.createNode('plusMinusAverage', n=self.name + 'RbbnAutoManual0' + ` id ` + '_pma') autoReverse = pm.createNode('reverse', n=self.name + 'RbbnReverse0' + ` id ` + '_rev') # ajustando valores dos nodes de stretch squash normalizeTo0.operation.set(2) scaleAux.input2.set((arcLenValue, arcLenValue, arcLenValue)) # conectando os nodes de stretch squash arcLength.arcLengthInV >> normalizeTo0.input3D[0].input3Dx arcLength.arcLengthInV >> normalizeTo0.input3D[0].input3Dy arcLength.arcLengthInV >> normalizeTo0.input3D[0].input3Dz scaleAux.output >> normalizeTo0.input3D[1] grpScale.scale >> scaleAux.input1 normalizeTo0.output3D >> factor.input2 factor.output >> on_off.input1 on_off.output >> autoReverse.input autoReverse.output >> autoManual.input3D[0] # criando nodes do rbbn folShp = pm.createNode('follicle') fol = folShp.getParent() # escondendo os follicles if self.visibility == 0: folShp.visibility.set(0) jnt = pm.joint(radius=nurbsLength * 0.2) skinJntsList.append(jnt) # conectando e ajustando nodes do rbbn autoManual.output3Dx >> jnt.scaleX autoManual.output3Dz >> jnt.scaleZ nurbsShp.local >> folShp.inputSurface nurbsShp.worldMatrix[0] >> folShp.inputWorldMatrix folShp.outRotate >> fol.rotate folShp.outTranslate >> fol.translate folShp.parameterU.set(0.5) vValue += vSections folShp.parameterV.set(vValue - vOffset) pm.parent(fol, grpFol) pm.scaleConstraint(grpScale, fol, mo=1) # listas para loops posteriores on_offList.append(on_off) factorList.append(factor) autoManualList.append(autoManual) # fk setup FKSIZE = (nurbsLength / 2) / self.sections topPosLoc = pm.spaceLocator() topAimLoc = pm.spaceLocator() topAimLoc.setParent(topPosLoc) topToSkin = pm.joint( radius=nurbsLength * 0.2, p=(0, 0, 0), ) pm.joint( radius=nurbsLength * 0.15, p=(0, -FKSIZE, 0), ) topUpLoc = pm.spaceLocator() topUpLoc.setParent(topPosLoc) pm.move(FKSIZE * 3 * self.upVector[0], FKSIZE * 3 * self.upVector[1], FKSIZE * 3 * self.upVector[2], topUpLoc) pm.delete(pm.pointConstraint(self.guide3, topPosLoc)) # pm.delete(pm.parentConstraint(guide3,topPosLoc)) midPosLoc = pm.spaceLocator() midAimLoc = pm.spaceLocator() midAimLoc.setParent(midPosLoc) midOffLoc = pm.spaceLocator() midOffLoc.setParent(midAimLoc) midToSkin = pm.joint(radius=nurbsLength * 0.2, p=(0, 0, 0)) midUpLoc = pm.spaceLocator() midUpLoc.setParent(midPosLoc) pm.move(FKSIZE * 3 * self.upVector[0], FKSIZE * 3 * self.upVector[1], FKSIZE * 3 * self.upVector[2], midUpLoc) lwrPosLoc = pm.spaceLocator() lwrAimLoc = pm.spaceLocator() lwrAimLoc.setParent(lwrPosLoc) lwrToSkin = pm.joint(radius=nurbsLength * 0.2, p=(0, 0, 0)) pm.joint(radius=nurbsLength * 0.15, p=(0, FKSIZE, 0)) lwrUpLoc = pm.spaceLocator() lwrUpLoc.setParent(lwrPosLoc) pm.move(FKSIZE * 3 * self.upVector[0], FKSIZE * 3 * self.upVector[1], FKSIZE * 3 * self.upVector[2], lwrUpLoc) pm.delete(pm.pointConstraint(self.guide1, lwrPosLoc)) topPosLocShp = topPosLoc.getShape() midPosLocShp = midPosLoc.getShape() lwrPosLocShp = lwrPosLoc.getShape() topAimLocShp = topAimLoc.getShape() midAimLocShp = midAimLoc.getShape() lwrAimLocShp = lwrAimLoc.getShape() topUpLocShp = topUpLoc.getShape() midUpLocShp = midUpLoc.getShape() lwrUpLocShp = lwrUpLoc.getShape() midOffLocShp = midOffLoc.getShape() topPosLocShp.localScale.set( (nurbsLength * 0.2, nurbsLength * 0.2, nurbsLength * 0.2)) topAimLocShp.localScale.set( (nurbsLength * 0.2, nurbsLength * 0.2, nurbsLength * 0.2)) topUpLocShp.localScale.set( (nurbsLength * 0.05, nurbsLength * 0.05, nurbsLength * 0.05)) midPosLocShp.localScale.set( (nurbsLength * 0.2, nurbsLength * 0.2, nurbsLength * 0.2)) midAimLocShp.localScale.set( (nurbsLength * 0.2, nurbsLength * 0.2, nurbsLength * 0.2)) midUpLocShp.localScale.set( (nurbsLength * 0.05, nurbsLength * 0.05, nurbsLength * 0.05)) midOffLocShp.localScale.set( (nurbsLength * 0.2, nurbsLength * 0.2, nurbsLength * 0.2)) lwrPosLocShp.localScale.set( (nurbsLength * 0.2, nurbsLength * 0.2, nurbsLength * 0.2)) lwrAimLocShp.localScale.set( (nurbsLength * 0.2, nurbsLength * 0.2, nurbsLength * 0.2)) lwrUpLocShp.localScale.set( (nurbsLength * 0.05, nurbsLength * 0.05, nurbsLength * 0.05)) pm.parent(topPosLoc, midPosLoc, lwrPosLoc, grpScale) # criando constraints para os locators do rbbn pm.aimConstraint(midToSkin, topAimLoc, aim=(0, -1, 0), u=(1, 0, 0), wut='object', wuo=topUpLoc) pm.aimConstraint(midToSkin, lwrAimLoc, aim=(0, 1, 0), u=(1, 0, 0), wut='object', wuo=lwrUpLoc) pm.aimConstraint(topPosLoc, midAimLoc, aim=(0, 1, 0), u=(1, 0, 0), wut='object', wuo=midUpLoc) pm.pointConstraint(topPosLoc, lwrPosLoc, midPosLoc) pm.pointConstraint(topUpLoc, lwrUpLoc, midUpLoc) # skin setup skin = pm.skinCluster(topToSkin, midToSkin, lwrToSkin, nurbs, tsb=1) if self.sections == 3: pm.skinPercent(skin, nurbs + '.cv[0:1][5]', tv=(topToSkin, 1)) pm.skinPercent(skin, nurbs + '.cv[0:1][4]', tv=[(topToSkin, 0.6), (midToSkin, 0.4)]) pm.skinPercent(skin, nurbs + '.cv[0:1][3]', tv=[(topToSkin, 0.2), (midToSkin, 0.8)]) pm.skinPercent(skin, nurbs + '.cv[0:1][2]', tv=[(topToSkin, 0.2), (midToSkin, 0.8)]) pm.skinPercent(skin, nurbs + '.cv[0:1][1]', tv=[(topToSkin, 0.6), (midToSkin, 0.4)]) pm.skinPercent(skin, nurbs + '.cv[0:1][0]', tv=(topToSkin, 1)) elif self.sections == 5: pm.skinPercent(skin, nurbs + '.cv[0:1][7]', tv=(topToSkin, 1)) pm.skinPercent(skin, nurbs + '.cv[0:1][6]', tv=[(topToSkin, 0.80), (midToSkin, 0.2)]) pm.skinPercent(skin, nurbs + '.cv[0:1][5]', tv=[(topToSkin, 0.5), (midToSkin, 0.5)]) pm.skinPercent(skin, nurbs + '.cv[0:1][4]', tv=[(topToSkin, 0.25), (midToSkin, 0.75)]) pm.skinPercent(skin, nurbs + '.cv[0:1][3]', tv=[(lwrToSkin, 0.25), (midToSkin, 0.75)]) pm.skinPercent(skin, nurbs + '.cv[0:1][2]', tv=[(lwrToSkin, 0.5), (midToSkin, 0.5)]) pm.skinPercent(skin, nurbs + '.cv[0:1][1]', tv=[(lwrToSkin, 0.8), (midToSkin, 0.2)]) pm.skinPercent(skin, nurbs + '.cv[0:1][0]', tv=(lwrToSkin, 1)) elif self.sections == 7: pm.skinPercent(skin, nurbs + '.cv[0:1][9]', tv=(topToSkin, 1)) pm.skinPercent(skin, nurbs + '.cv[0:1][8]', tv=[(topToSkin, 0.85), (midToSkin, 0.15)]) pm.skinPercent(skin, nurbs + '.cv[0:1][7]', tv=[(topToSkin, 0.6), (midToSkin, 0.4)]) pm.skinPercent(skin, nurbs + '.cv[0:1][6]', tv=[(topToSkin, 0.35), (midToSkin, 0.65)]) pm.skinPercent(skin, nurbs + '.cv[0:1][5]', tv=[(topToSkin, 0.25), (midToSkin, 0.75)]) pm.skinPercent(skin, nurbs + '.cv[0:1][4]', tv=[(lwrToSkin, 0.25), (midToSkin, 0.75)]) pm.skinPercent(skin, nurbs + '.cv[0:1][3]', tv=[(lwrToSkin, 0.35), (midToSkin, 0.65)]) pm.skinPercent(skin, nurbs + '.cv[0:1][2]', tv=[(lwrToSkin, 0.6), (midToSkin, 0.4)]) pm.skinPercent(skin, nurbs + '.cv[0:1][1]', tv=[(lwrToSkin, 0.85), (midToSkin, 0.15)]) pm.skinPercent(skin, nurbs + '.cv[0:1][0]', tv=(lwrToSkin, 1)) else: print "!!!There's skinning support for 3,5 and 7 sections only!!!" # posicionando o controle do meio pm.delete(pm.pointConstraint(self.guide2, midOffLoc)) # criando controles if self.createCtrls == 0: topCircle = pm.circle(r=nurbsLength * .2, nr=(self.ctrlNormal[0], self.ctrlNormal[1], self.ctrlNormal[2])) topCtrlGrp = pm.group() topCtrlGrp.setParent(grpScale) pm.delete(pm.parentConstraint(self.guide3, topCtrlGrp, mo=0)) pm.parentConstraint(topCircle[0], topPosLoc) midCircle = pm.circle(r=nurbsLength * .2, nr=(self.ctrlNormal[0], self.ctrlNormal[1], self.ctrlNormal[2])) midCtrlGrp = pm.group() midCtrlGrp.setParent(midOffLoc) pm.delete(pm.parentConstraint(midToSkin, midCtrlGrp)) midJointZerado = self.zeroOut(midToSkin, returnGrpName=1)[0] pm.parent(midJointZerado, grpScale) pm.parentConstraint(midCircle[0], midJointZerado, mo=1) lwrCircle = pm.circle(r=nurbsLength * .2, nr=(self.ctrlNormal[0], self.ctrlNormal[1], self.ctrlNormal[2])) lwrCtrlGrp = pm.parent(pm.group(), grpScale) pm.delete(pm.parentConstraint(self.guide1, lwrCtrlGrp, mo=0)) pm.parentConstraint(lwrCircle[0], lwrPosLoc) else: midCircle = pm.circle(r=nurbsLength * .2, nr=(self.ctrlNormal[0], self.ctrlNormal[1], self.ctrlNormal[2])) midCtrlGrp = pm.parent(pm.group(), midOffLoc) pm.delete(pm.parentConstraint(midToSkin, midCtrlGrp)) midJointZerado = self.zeroOut(midToSkin, returnGrpName=1)[0] pm.parent(midJointZerado, grpScale) pm.parentConstraint(midCircle[0], midJointZerado, mo=1) id = 0 midCircle[0].addAttr('autoSS', k=1, dv=0.0, at='double', min=0, max=1) midCircleShp = midCircle[0].getShape() if self.createCtrls: midCircleShp.v.set(0) for autoManualAuxNodes in autoManualList: id += 1 # criando e ajustando nodes para stretch squash manualNormalize = pm.createNode( 'plusMinusAverage', n=self.name + 'RbbnManualNormalize0' + str(id) + '_pma') manualFactor = pm.createNode('multiplyDivide', n=self.name + 'RbbnManualFactor0' + str(id) + '_md') ratioScale = pm.createNode('multiplyDivide', n=self.name + 'RbbnRatioScale0' + str(id) + 'md') zRatio = pm.createNode('multiplyDivide', n=self.name + 'RbbnSsManualZratio' + str(id) + '_md') manualFactor.output >> autoManualAuxNodes.input3D[1] midCircle[0].scale >> manualNormalize.input3D[0] manualNormalize.output3D >> manualFactor.input2 manualNormalize.operation.set(2) manualNormalize.input3D[1].input3D.set((1, 1, 1)) ratioScale.operation.set(2) # adicionando atributos de squash midCircleShp.addAttr('manualFactorX0' + str(id), k=1, at='float', dv=1) midCircleShp.addAttr('manualRatioZ0' + str(id), k=1, at='float') midCircleShp.addAttr('autoFactorX0' + str(id), k=1, at='float') midCircleShp.addAttr('autoRatioZ0' + str(id), k=1, at='float') # conectando os atributos acima midCircleShp.attr('manualRatioZ0' + str(id)) >> zRatio.input1Z midCircleShp.attr('autoRatioZ0' + str(id)) >> zRatio.input1X midCircle[0].autoSS >> on_offList[id - 1].input2X # on_off midCircle[0].autoSS >> on_offList[id - 1].input2Z # on_off midCircleShp.attr('manualFactorX0' + str(id)) >> manualFactor.input1X midCircleShp.attr('manualFactorX0' + str(id)) >> zRatio.input2Z ratioScale.outputX >> zRatio.input2X zRatio.outputZ >> manualFactor.input1Z ratioScale.outputX >> factorList[id - 1].input1X # factor zRatio.outputX >> factorList[id - 1].input1Z # factor grpScale.scale >> ratioScale.input2 midCircleShp.attr('autoFactorX0' + str(id)) >> ratioScale.input1X # ajustando os atributos midCircleShp.attr('manualRatioZ0' + str(id)).set(1) midCircleShp.attr('autoRatioZ0' + str(id)).set(1) # ajustando valores iniciais para os factores de squash if self.sections == 3: midCircleShp.autoFactorX02.set(0.08) elif self.sections == 5: midCircleShp.autoFactorX01.set(0.02) midCircleShp.autoFactorX02.set(0.25) midCircleShp.autoFactorX03.set(0.22) midCircleShp.autoFactorX04.set(0.25) midCircleShp.autoFactorX05.set(0.02) elif self.sections == 7: midCircleShp.autoFactorX01.set(0) midCircleShp.autoFactorX02.set(0.11) midCircleShp.autoFactorX03.set(0.1) midCircleShp.autoFactorX04.set(0.16) midCircleShp.autoFactorX05.set(0.1) midCircleShp.autoFactorX06.set(0.11) midCircleShp.autoFactorX07.set(0) # toggles displays if self.visibility == 0: pm.toggle(nurbs, g=1, te=1) pm.toggle(arcLength, te=1) arcLength.visibility.set(0) topPosLoc.visibility.set(0) midPosLocShp = midPosLoc.getShape() midPosLocShp.visibility.set(0) midAimLocShp = midAimLoc.getShape() midAimLocShp.visibility.set(0) midOffLocShp = midOffLoc.getShape() midOffLocShp.visibility.set(0) lwrPosLoc.visibility.set(0) midUpLoc.visibility.set(0) grpScale.visibility.set(0) grpFol.visibility.set(0) # agrupando tudo finalRbbnGrp = pm.group(em=1, n=self.name + 'finalRbbn_grp') pm.parent(nurbs, grpFol, grpScale, arcLength, finalRbbnGrp)
def build_matrix(aim_vector, up_vector, pos, invert_aim=False, invert_up=False, aim_axis=0, up_axis=2): # check that the axis map aim and up axis are valid if aim_axis == up_axis: print('The source aim axis can not be the same as the up axis') return # normalize the input vectors vec_aim_n = aim_vector.normal() vec_up_n = up_vector.normal() if invert_aim: vec_aim_n *= -1 if invert_up: vec_up_n *= -1 # note that we need to normalize the cross, since we could get a vec with a magnitude less than 1 vec_cross_n = (vec_up_n.cross(vec_aim_n)).normal() vec_up_orto_n = vec_aim_n.cross(vec_cross_n) length = 5 # aim, red viz_vec_3(start=pos, end=pos+vec_aim_n*length, color_index=13, name='aim') # up, yellow viz_vec_3(start=pos, end=pos+vec_up_n*9, color_index=17, name='up') # up (othogonalized) blue viz_vec_3(start=pos, end=pos+vec_up_orto_n*length, color_index=6, name='up_ortho') # cross, green viz_vec_3(start=pos, end=pos+vec_cross_n*length, color_index=14, name='cross') # x y z vx = False vy = False vz = False # aim vector --------------- # x aim if aim_axis is 0: vx = vec_aim_n # y aim elif aim_axis is 1: vy = vec_aim_n # z aim else: vz = vec_aim_n # up vector --------------- # x up if up_axis is 0: vx = vec_up_orto_n # y up elif up_axis is 1: vy = vec_up_orto_n # z up else: vz = vec_up_orto_n # cross vector --------------- if not vx: #vx = vec_cross_n vx = vy.cross(vz) if not vy: #vy = vec_cross_n vy = vz.cross(vx) if not vz: #vz = vec_cross_n vz = vx.cross(vy) tm = pm.datatypes.TransformationMatrix([vx, vy, vz, pos]) cube = pm.polyCube(name='helloCube')[0] # use a matrix #cube.setMatrix(tm) # use translation and rotation rot_rad = tm.getRotation() rot_deg = pm.datatypes.degrees(rot_rad) cube.translate.set(vec_c) cube.rotate.set(rot_deg) pm.toggle(cube, localAxis=True)
# Return a normalized vec return axis_list[axis].normal() pm.openFile('/Users/johan/Dev/maya/build_joint_hierarchy/jnt_ref_v02.mb', force=True) up_vec = get_vec_from_transform('jnt_grp', 0) info_list = build_joint_info_list('jnt_grp') ''' info_list = [ {'name':'one', 'pos':(0,0,0)}, {'name':'two', 'pos':(0,10,10)}, {'name':'three', 'pos':(0,20,10)} ] up_vec = (1,0,0) ''' jnt_list = build_joint_hierarchy(info_list=info_list, up_vector=up_vec, aim_axis=0, up_axis=2, invert_up=True, invert_aim=True) pm.toggle(jnt_list, localAxis=True)
def doRig(self): anchorList = [] cntrlList = [] locList = [] offCtrlLoc=[] offAuxLoc = [] dummyCrv = self.ribbonDict['moveallSetup']['nameTempl']+'_dummy_crv' pm.hide(pm.polyCube(n=dummyCrv)) if pm.objExists(self.ribbonDict['moveallSetup']['nameTempl']): pm.delete(self.ribbonDict['moveallSetup']['nameTempl']) if pm.objExists(self.ribbonDict['noMoveSetup']['nameTempl']): pm.delete(self.ribbonDict['noMoveSetup']['nameTempl']) ###Estrutura que nao deve ter transformacao noMoveSpace = pm.group(empty=True, n=self.ribbonDict['noMoveSetup']['nameTempl']) if not pm.objExists('NOMOVE'): pm.group(self.ribbonDict['noMoveSetup']['nameTempl'], n='NOMOVE') else: pm.parent(self.ribbonDict['noMoveSetup']['nameTempl'], 'NOMOVE') pm.parent(self.ribbonDict['moveallSetup']['nameTempl']+'_dummy_crv', noMoveSpace) noMoveSpace.visibility.set(0) noMoveSpace.translate.set(self.size * -0.5, 0, 0) noMoveBend1 = pm.nurbsPlane(p=(self.size * -0.25, 0, 0), ax=(0, 0, 1), w=self.size * 0.5, lr=.1, d=3, u=5, v=1) noMoveBend2 = pm.nurbsPlane(p=(self.size * 0.25, 0, 0), ax=(0, 0, 1), w=self.size * 0.5, lr=.1, d=3, u=5, v=1) noMoveCrvJnt = pm.curve(bezier=True, d=3, p=[(self.size * -0.50, 0, 0), (self.size * -0.499, 0, 0), (self.size * -0.496, 0, 0), (self.size * -0.495, 0, 0), (self.size * -0.395, 0, 0), (self.size * -0.10, 0, 0), (0, 0, 0), (self.size * 0.10, 0, 0), (self.size * 0.395, 0, 0), (self.size * 0.495, 0, 0), (self.size * 0.496, 0, 0), (self.size * 0.499, 0, 0), (self.size * 0.50, 0, 0)], k=[0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10]) noMoveCrvTweak1 = pm.curve(d=2, p=[(self.size * -0.5, 0, 0), (self.size * -0.25, 0, 0), (self.size * 0, 0, 0)], k=[0, 0, 1, 1]) noMoveCrvTweak2 = pm.curve(d=2, p=[(self.size * 0.0, 0, 0), (self.size * 0.25, 0, 0), (self.size * 0.50, 0, 0)], k=[0, 0, 1, 1]) # Deformers das superficies noMove twist1 = pm.nonLinear(noMoveBend1[0], type='twist') # twist das superficies noMove twist2 = pm.nonLinear(noMoveBend2[0], type='twist') twist1[1].rotateZ.set(90) twist2[1].rotateZ.set(90) wireTweak1 = pm.wire(noMoveBend1[0], w=noMoveCrvTweak1, dds=[(0, 50)]) wireTweak2 = pm.wire(noMoveBend2[0], w=noMoveCrvTweak2, dds=[(0, 50)]) wireDef = pm.wire(noMoveBend1[0], noMoveBend2[0], w=noMoveCrvJnt, dds=[(0, 50)]) # Wire das superficies noMove wireDef[0].rotation.set(1) # seta wire controlando rotacao baseWire = [x for x in wireDef[0].connections() if 'BaseWire' in x.name()] baseWireTweak1 = [x for x in wireTweak1[0].connections() if 'BaseWire' in x.name()] baseWireTweak2 = [x for x in wireTweak2[0].connections() if 'BaseWire' in x.name()] pm.group(baseWire, baseWireTweak1, baseWireTweak2, noMoveCrvJnt, noMoveCrvTweak1, noMoveCrvTweak2, noMoveBend1[0], noMoveBend2[0], p=noMoveSpace, n=self.name + 'Deforms') pm.parent(twist1[1], twist2[1], noMoveSpace) ###Estrutura que pode ser movida cntrlsSpace = pm.group(empty=True, n=self.ribbonDict['moveallSetup']['nameTempl']) cntrlsSpace.translate.set(self.size * -0.5, 0, 0) bendSurf1 = pm.nurbsPlane(p=(self.size * -0.25, 0, 0), ax=(0, 0, 1), w=self.size * 0.5, lr=.1, d=3, u=5, v=1) bendSurf2 = pm.nurbsPlane(p=(self.size * 0.25, 0, 0), ax=(0, 0, 1), w=self.size * 0.5, lr=.1, d=3, u=5, v=1) # blendShape transferindo as deformaacoes para a superficie move blend1 = pm.blendShape(noMoveBend1[0], bendSurf1[0]) blend2 = pm.blendShape(noMoveBend2[0], bendSurf2[0]) pm.blendShape(blend1, e=True, w=[(0, 1)]) pm.blendShape(blend2, e=True, w=[(0, 1)]) pm.parent(bendSurf1[0], bendSurf2[0], cntrlsSpace) ##Cntrls tweak1Cls = pm.cluster(noMoveCrvTweak1.name()+'.cv[1]') tweak2Cls = pm.cluster(noMoveCrvTweak2.name() + '.cv[1]') displaySetup = self.ribbonDict['ctrlTweakSetup'].copy() cntrlName = displaySetup['nameTempl'] + '1' cntrlTweak1 = controlTools.cntrlCrv(name=cntrlName, obj=tweak1Cls[1], connType='connection', align='pivot', offsets=1, **displaySetup) cntrlName = displaySetup['nameTempl'] + '2' cntrlTweak2 = controlTools.cntrlCrv(name=cntrlName, obj=tweak2Cls[1], connType='connection', align='pivot', offsets=1, **displaySetup) controlTools.addMultiply([cntrlTweak1.getParent(), cntrlTweak2.getParent()]) tweakFoll1 = self.attachObj(obj=cntrlTweak1.getParent(3), mesh=bendSurf1[0], u=0.5, v=0.5, mode=4) tweakFoll2 = self.attachObj(obj=cntrlTweak2.getParent(3), mesh=bendSurf2[0], u=0.5, v=0.5, mode=4) tweakGrp = pm.group(tweak1Cls[1], tweak2Cls[1], n=self.name+'TweakCls_grp') pm.parent(tweakGrp, noMoveSpace) pm.parent(cntrlTweak1.getParent(3), cntrlTweak2.getParent(3), cntrlsSpace) for i in range(0, 7): anchor = pm.cluster(noMoveCrvJnt.name() + '.cv[' + str(i + 3) + ']') pm.cluster(anchor[1], e=True, g=dummyCrv) clsHandle = anchor[1] anchorGrp = pm.group(em=True, n=self.name+'clusterGrp' + str(i)) anchorDrn = pm.group(em=True, n=self.name+'clusterDrn' + str(i), p=anchorGrp) pos = pm.xform(anchor[1], q=True, ws=True, rp=True) pm.xform(anchorGrp, t=pos, ws=True) pm.parent(anchor[1], anchorDrn) anchorList.append(anchor[1]) if i == 0 or i == 6: displaySetup = self.ribbonDict['cntrlSetup'].copy() cntrlName = displaySetup['nameTempl'] + str(i) cntrl = controlTools.cntrlCrv(name=cntrlName, obj=anchor[1], **displaySetup) elif i == 3: displaySetup = self.ribbonDict['midCntrlSetup'].copy() cntrlName = displaySetup['nameTempl'] + str(i) cntrl = controlTools.cntrlCrv(name=cntrlName, obj=anchor[1], **displaySetup) else: displaySetup = self.ribbonDict['cntrlTangSetup'].copy() cntrlName = displaySetup['nameTempl'] + str(i) cntrl = controlTools.cntrlCrv(name=cntrlName, obj=anchor[1], **displaySetup) offCtrlLoc.append(pm.spaceLocator(n=cntrlName+'off_loc')) offCtrlLoc[-1].localScale.set(0.2, 0.2, 0.2) pm.parent(offCtrlLoc[-1], cntrl, r=True) if i in [1, 2, 4, 5]: offCtrlLoc[-1].getShape().visibility.set(False) # Nao pode fazer conexao na criacao do controle, pois tera conexao direta pm.xform(cntrl.getParent(), t=pos, ws=True) # estrutura de buffers para conexao direta auxLocGrp = pm.group(em=True, n=self.name + 'Aux_grp') auxLoc = pm.group(em=True, p=auxLocGrp, n=self.name + str(i)+ 'Aux_loc') pm.xform(auxLocGrp, t=pos, ws=True) loc = pm.PyNode(auxLoc) if i==0 or i==3 or i==6: tmpOffAuxLoc = pm.group(em=True, n=self.name + str(i) + 'AuxOff_loc') offAuxLoc.append(tmpOffAuxLoc) pm.parent(tmpOffAuxLoc, auxLoc, r=True) offCtrlLoc[-1].translate >> offAuxLoc[-1].translate offCtrlLoc[-1].rotate >> offAuxLoc[-1].rotate if i == 1 or i == 4: pm.xform(anchorGrp, s=(-1, 1, 1), r=True) pm.xform(cntrl.getParent(), s=(-1, 1, 1), r=True) pm.xform(loc.getParent(), s=(-1, 1, 1), r=True) # Conexoes dos buffers cm os clusters e com os controles pm.parentConstraint(cntrl, loc, mo=True) loc.translate >> anchorDrn.translate loc.rotate >> anchorDrn.rotate cntrlList.append(cntrl) locList.append(loc) # workaround do flip do inicio do wire(adicao de mais pontos) startCls = pm.cluster(noMoveCrvJnt.name() + '.cv[0:2]') endCls = pm.cluster(noMoveCrvJnt.name() + '.cv[10:14]') pm.cluster(startCls[1], e=True, g=dummyCrv) pm.cluster(endCls[1], e=True, g=dummyCrv) pm.parent(startCls[1], anchorList[0]) pm.parent(endCls[1], anchorList[6]) cntrlsSpace.addAttr('midCtrlViz', at='double', dv=1, max=1, min=0, k=True, h=False) cntrlsSpace.addAttr('bezierCtrlViz', at='double', dv=1,max=1, min=0, k=True, h=False) cntrlsSpace.addAttr('bendExtraCtrlViz', at='double',max=1, min=0, dv=1, k=True, h=False) cntrlsSpace.addAttr('extraCtrlsVis', at='double', dv=0,max=1, min=0, k=True, h=False) cntrlList[0].addAttr('twist', at='double', dv=0, k=True) cntrlList[0].addAttr('stretchDist', at='double', dv=0, k=True) cntrlList[0].addAttr('autoVolumStregth', at='double', dv=0, k=True) cntrlList[3].addAttr('twist', at='double', dv=0, k=True) cntrlList[3].addAttr('autoVolume', at='double', dv=0, k=True) cntrlList[6].addAttr('twist', at='double', dv=0, k=True) cntrlList[6].addAttr('stretchDist', at='double', dv=0, k=True) cntrlList[6].addAttr('autoVolumStregth', at='double', dv=0, k=True) cntrlList[0].twist >> twist1[0].endAngle cntrlList[3].twist >> twist1[0].startAngle cntrlList[3].twist >> twist2[0].endAngle cntrlList[6].twist >> twist2[0].startAngle # cria sistema do tweak pra compensar twist da ribbon tweak1Twist1Multi = pm.createNode('multDoubleLinear', name='tweak1Twist1Multi') tweak1Twist2Multi = pm.createNode('multDoubleLinear', name='tweak1Twist1Multi') tweak1Add = pm.createNode('addDoubleLinear', name='tweak1Add') tweak2Twist1Multi = pm.createNode('multDoubleLinear', name='tweak1Twist1Multi') tweak2Twist2Multi = pm.createNode('multDoubleLinear', name='tweak1Twist1Multi') tweak2Add = pm.createNode('addDoubleLinear', name='tweak1Add') cntrlList[0].twist >> tweak1Twist1Multi.input1 tweak1Twist1Multi.input2.set(-0.5) cntrlList[3].twist >> tweak1Twist2Multi.input1 tweak1Twist2Multi.input2.set (-0.5) tweak1Twist1Multi.output >> tweak1Add.input1 tweak1Twist2Multi.output >> tweak1Add.input2 tweak1Add.output >> cntrlTweak1.getParent(2).rotate.rotateX cntrlList[6].twist >> tweak2Twist1Multi.input1 tweak2Twist1Multi.input2.set(-0.5) cntrlList[3].twist >> tweak2Twist2Multi.input1 tweak2Twist2Multi.input2.set(-0.5) tweak2Twist1Multi.output >> tweak2Add.input1 tweak2Twist2Multi.output >> tweak2Add.input2 tweak2Add.output >> cntrlTweak2.getParent(2).rotate.rotateX # hierarquia pm.parent(anchorList[1].getParent(2), anchorList[0]) pm.parent(anchorList[5].getParent(2), anchorList[6]) pm.parent(anchorList[2].getParent(2), anchorList[4].getParent(2), anchorList[3]) pm.parent(cntrlList[1].getParent(), offCtrlLoc[0]) pm.parent(cntrlList[5].getParent(), offCtrlLoc[6]) pm.parent(cntrlList[2].getParent(), cntrlList[4].getParent(), offCtrlLoc[3]) pm.parent(cntrlList[3].getParent(), cntrlList[0].getParent(), cntrlList[6].getParent(), cntrlsSpace) pm.parent(locList[1].getParent(), offAuxLoc[0]) pm.parent(locList[5].getParent(), offAuxLoc[2]) pm.parent(locList[2].getParent(), locList[4].getParent(), offAuxLoc[1]) pm.parent(locList[3].getParent(), locList[0].getParent(), locList[6].getParent(), cntrlsSpace) pm.parent(anchorList[3].getParent(2), anchorList[0].getParent(2), anchorList[6].getParent(2), noMoveSpace) for i, j in zip([1, 2, 4, 5], [0, 3, 3, 6]): crv = pm.curve(d=1, p=[(1, 0, 0), (-1, 0, 0)], k=[0, 1]) crv.inheritsTransform.set(False) crv.template.set(True) offCtrlLoc[i].worldPosition[0] >> crv.getShape().controlPoints[0] offCtrlLoc[j].worldPosition[0] >> crv.getShape().controlPoints[1] pm.parent(crv, offCtrlLoc[i], r=True) # Skin joints do ribbon skinJntsGrp = pm.group(em=True, n=self.name + 'SkinJnts') follGrp = pm.group(em=True, n=self.name + 'Foll_grp') pm.parent(tweakFoll1, tweakFoll2, follGrp) # cria ramps para controlar o perfil de squash e stretch ramp1 = pm.createNode('ramp', n=self.name+'SquashRamp1') ramp1.attr('type').set(1) ramp2 = pm.createNode('ramp', n=self.name+'SquashRamp2') ramp2.attr('type').set(1) expre1 = "float $dummy = " + ramp1.name() + ".outAlpha;float $output[];float $color[];" expre2 = "float $dummy = " + ramp2.name() + ".outAlpha;float $output[];float $color[];" extraCntrlsGrp = pm.group(em=True, r=True, p=cntrlsSpace, n=self.name + 'ExtraCntrls') # loop pra fazer os colocar o numero escolhido de joints ao longo do ribbon. # cria tmb node tree pro squash/stretch # e controles extras vIncrement = float((1.0 - (self.offsetStart + self.offsetEnd)) / ((self.numJnts - 2) / 2.0)) for i in range(1, (self.numJnts / 2) + 1): # cria estrutura pra superficie 1 pm.select(cl=True) jntName = self.ribbonDict['jntSetup']['nameTempl'] + 'A' + str(i) + self.jntSulfix jnt1 = pm.joint(p=(0, 0, 0), n=jntName) self.skinJoints.append(jnt1) displaySetup = self.ribbonDict['cntrlExtraSetup'].copy() cntrlName = displaySetup['nameTempl'] + 'A' + str(i) cntrl1 = controlTools.cntrlCrv(name=cntrlName, obj=jnt1, connType='constraint', **displaySetup) # node tree blend1A = pm.createNode('blendTwoAttr', n=self.name+'VolumeBlend1A') blend1B = pm.createNode('blendTwoAttr', n=self.name+'VolumeBlend1B') gammaCorr1 = pm.createNode('gammaCorrect', n=self.name+'VolumeGamma1') cntrlList[0].attr('autoVolumStregth') >> gammaCorr1.gammaX cntrlList[0].attr('stretchDist') >> gammaCorr1.value.valueX blend1A.input[0].set(1) gammaCorr1.outValueX >> blend1A.input[1] blend1B.input[0].set(1) blend1A.output >> blend1B.input[1] cntrlList[3].attr ('autoVolume') >> blend1B.attributesBlender blend1B.output >> cntrl1.getParent().scaleY blend1B.output >> cntrl1.getParent().scaleZ # expressao que le a rampa para setar valores da escala de cada joint quando fizer squash/stretch expre1 = expre1 + "$color = `colorAtPoint -o RGB -u " + str( self.offsetStart + (i - 1) * vIncrement) + " -v 0.5 " + ramp1.name() + " `;$output[" + str( i) + "] = $color[0];" + blend1A.name() + ".attributesBlender=$output[" + str(i) + "];" # cria estrutura pra superficie 2 pm.select(cl=True) jntName = self.ribbonDict['jntSetup']['nameTempl'] + 'B' + str(i) + self.jntSulfix jnt2 = pm.joint(p=(0, 0, 0), n=jntName) self.skinJoints.append(jnt2) displaySetup = self.ribbonDict['cntrlExtraSetup'].copy() cntrlName = displaySetup['nameTempl'] + 'B' + str(i) cntrl2 = controlTools.cntrlCrv(name=cntrlName, connType='constraint', obj=jnt2, **displaySetup) # node tree blend2A = pm.createNode('blendTwoAttr', n=self.name+'VolumeBlend2A') blend2B = pm.createNode('blendTwoAttr', n=self.name+'VolumeBlend2B') gammaCorr2 = pm.createNode('gammaCorrect', n=self.name+'VolumeGamma2') cntrlList[6].attr('autoVolumStregth') >> gammaCorr2.gammaX cntrlList[6].attr('stretchDist') >> gammaCorr2.value.valueX blend2A.input[0].set(1) gammaCorr2.outValueX >> blend2A.input[1] blend2B.input[0].set(1) blend2A.output >> blend2B.input[1] cntrlList[3].attr('autoVolume') >> blend2B.attributesBlender blend2B.output >> cntrl2.getParent().scaleY blend2B.output >> cntrl2.getParent().scaleZ # expressao que le a rampa para setar valores da escala de cada joint quando fizer squash/stretch expre2 = expre2 + "$color = `colorAtPoint -o RGB -u " + str( self.offsetStart + (i - 1) * vIncrement) + " -v 0.5 " + ramp2.name() + " `;$output[" + str( i) + "] = $color[0];" + blend2A.name() + ".attributesBlender=$output[" + str(i) + "];" # prende joints nas supeficies com follicules foll1 = self.attachObj(cntrl1.getParent(), bendSurf1[0], self.offsetStart + (i - 1) * vIncrement, 0.5, 4) foll2 = self.attachObj(cntrl2.getParent(), bendSurf2[0], self.offsetStart + (i - 1) * vIncrement, 0.5, 4) pm.parent(cntrl1.getParent(), cntrl2.getParent(), extraCntrlsGrp) pm.parent(jnt1, jnt2, skinJntsGrp) pm.parent(foll1, foll2, follGrp) pm.select (cl=True) jntName = self.ribbonDict['jntSetup']['nameTempl'] +'Elbow' + self.jntSulfix elbowJnt = pm.joint(p=(0, 0, 0), n=jntName) pm.parent(elbowJnt, skinJntsGrp) elbowAuxFoll1 = self.createFoll(bendSurf1[0], 0.999, 0.5) elbowAuxFoll2 = self.createFoll(bendSurf2[0], 0.001, 0.5) pm.parent(elbowAuxFoll1, elbowAuxFoll2, follGrp) orientConstraint = pm.PyNode(pm.orientConstraint(elbowAuxFoll1, elbowAuxFoll2, elbowJnt, mo=False)) orientConstraint.interpType.set(2) pm.pointConstraint(cntrlList[3], elbowJnt, mo=False) # seta expressoes para so serem avaliadas por demanda pm.expression(s=expre1, ae=False, n=self.name+'Expression1') pm.expression(s=expre2, ae=False, n=self.name+'Expression2') pm.parent(skinJntsGrp, cntrlsSpace) pm.parent(follGrp, noMoveSpace) # hideCntrls pm.toggle(bendSurf1[0], bendSurf2[0], g=True) bendSurf1[0].visibility.set(0) bendSurf2[0].visibility.set (0) # skinJntsGrp.visibility.set(0) cntrlsSpace.extraCtrlsVis >> extraCntrlsGrp.visibility cntrlsSpace.bezierCtrlViz >> cntrlList[0].getParent().visibility cntrlsSpace.midCtrlViz >> cntrlList[3].getParent().visibility cntrlsSpace.bezierCtrlViz >> cntrlList[4].getParent().visibility cntrlsSpace.bezierCtrlViz >> cntrlList[2].getParent().visibility cntrlsSpace.bezierCtrlViz >> cntrlList[6].getParent().visibility cntrlsSpace.bendExtraCtrlViz >> cntrlTweak1.getParent().visibility cntrlsSpace.bendExtraCtrlViz >> cntrlTweak2.getParent().visibility # povoa ribbon Dict self.ribbonDict['name'] = 'bezierRibbon' self.ribbonDict['ribbonMoveAll'] = cntrlsSpace for i in range(0, 7): self.ribbonDict['cntrl' + str(i)] = cntrlList[i]
def cntrlCrv(name='ctrl', cntrlSulfix='_ctrl', obj=None, connType=None, icone='cubo', color=None, cntrlSize=1, align='parent', hasZeroGrp=True, offsets=0, hasHandle=False, rotateOrder=0, localAxis=False, template=False, hideShape=False, lockChannels=[], returnParent=False, coords=None, posRot=None, parent=None, **kwargs): ''' create a control with a curve shape :param name: :param cntrlSulfix: :param obj: :param connType: :param icone: :param color: :param cntrlSize: :param align: :param hasZeroGrp: :param offsets: :param hasHandle: :param rotateOrder: :param localAxis: :param template: :param hideShape: :param lockChannels: :param returnParent: :param coords: :param posRot: :param parent: :param kwargs: :return: ''' if icone == "cubo": crv = pm.curve( n=name + cntrlSulfix, d=1, p=[(-0.5, 0.5, 0.5), (-0.5, 0.5, -0.5), (0.5, 0.5, -0.5), (0.5, 0.5, 0.5), (-0.5, 0.5, 0.5), (0.5, 0.5, 0.5), (0.5, -0.5, 0.5), (-0.5, -0.5, 0.5), (-0.5, 0.5, 0.5), (-0.5, -0.5, 0.5), (-0.5, -0.5, -0.5), (-0.5, 0.5, -0.5), (-0.5, -0.5, -0.5), (0.5, -0.5, -0.5), (0.5, 0.5, -0.5), (0.5, -0.5, -0.5), (0.5, -0.5, 0.5)], k=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'bola': crv = pm.circle(n=name + cntrlSulfix, c=(0, 0, 0), nr=(0, 1, 0), sw=360, r=0.5, d=3, ut=0, ch=0)[0] crv1 = pm.circle(n=name + "aux1", c=(0, 0, 0), nr=(1, 0, 0), sw=360, r=0.5, d=3, ut=0, ch=0)[0] crv2 = pm.circle(n=name + "aux2", c=(0, 0, 0), nr=(0, 0, 1), sw=360, r=0.5, d=3, ut=0, ch=0)[0] pm.parent([crv1.getShape(), crv2.getShape()], crv, shape=True, r=True) pm.delete(crv1, crv2) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == 'circuloY' or icone == 'circulo_Y': crv = pm.circle(n=name + cntrlSulfix, c=(0, 0, 0), nr=(0, 1, 0), sw=360, r=0.5, d=3, ut=0, ch=0)[0] crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'circuloX' or icone == 'circulo_X': crv = pm.circle(n=name + cntrlSulfix, c=(0, 0, 0), nr=(1, 0, 0), sw=360, r=0.5, d=3, ut=0, ch=0)[0] crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'circuloZ' or icone == 'circulo_Z': crv = pm.circle(n=name + cntrlSulfix, c=(0, 0, 0), nr=(0, 0, 1), sw=360, r=0.5, d=3, ut=0, ch=0)[0] crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'seta': crv = pm.curve(n=name + cntrlSulfix, d=1, p=((-1, 0, 0), (-1, 0, -3), (-2, 0, -3), (0, 0, -5), (2, 0, -3), (1, 0, -3), (1, 0, 0)), k=[0, 1, 2, 3, 4, 5, 6]) crv.scale.set(cntrlSize * 0.096, cntrlSize * 0.096, cntrlSize * 0.096) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'cog' or icone == 'cog_Y': crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(-4, 0, -4), (4, 0, -4), (4, 0, 3), (0, 0, 5), (-4, 0, 3), (-4, 0, -4)]) crv.scale.set(cntrlSize * 0.1253, cntrlSize * 0.1253, cntrlSize * 0.1253) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'cogX' or icone == 'cog_X': crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(-4, 0, -4), (4, 0, -4), (4, 0, 3), (0, 0, 5), (-4, 0, 3), (-4, 0, -4)]) crv.rotateZ.set(90) crv.scale.set(cntrlSize * 0.1253, cntrlSize * 0.1253, cntrlSize * 0.1253) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'cogZ' or icone == 'cog_Z': crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(-4, 0, -4), (4, 0, -4), (4, 0, 3), (0, 0, 5), (-4, 0, 3), (-4, 0, -4)]) crv.rotateX.set(90) crv.scale.set(cntrlSize * 0.1253, cntrlSize * 0.1253, cntrlSize * 0.1253) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == "ponteiroX" or icone == "ponteiro_X": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, 0), (1.691495, 1.691495, 0), (1.697056, 2.537859, 0), (2.545584, 2.545584, 0), (2.545584, 1.707095, 0), (1.691504, 1.692763, 0)], k=[0, 1, 2, 3, 4, 5]) crv.rotateZ.set(90) crv.scale.set(cntrlSize * .196, cntrlSize * .196, cntrlSize * .196) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "ponteiroY" or icone == "ponteiro_Y": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, 0), (1.691495, 1.691495, 0), (1.697056, 2.537859, 0), (2.545584, 2.545584, 0), (2.545584, 1.707095, 0), (1.691504, 1.692763, 0)], k=[0, 1, 2, 3, 4, 5]) crv.rotateY.set(90) crv.rotateX.set(90) crv.scale.set(cntrlSize * .196, cntrlSize * .196, cntrlSize * .196) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "ponteiroZ" or icone == "ponteiro_Z": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, 0), (1.691495, 1.691495, 0), (1.697056, 2.537859, 0), (2.545584, 2.545584, 0), (2.545584, 1.707095, 0), (1.691504, 1.692763, 0)], k=[0, 1, 2, 3, 4, 5]) crv.rotateY.set(-90) crv.scale.set(cntrlSize * .196, cntrlSize * .196, cntrlSize * .196) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "ponteiroMenosX": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, 0), (1.691495, 1.691495, 0), (1.697056, 2.537859, 0), (2.545584, 2.545584, 0), (2.545584, 1.707095, 0), (1.691504, 1.692763, 0)], k=[0, 1, 2, 3, 4, 5]) crv.rotateZ.set(-90) crv.scale.set(cntrlSize * .196, cntrlSize * .196, cntrlSize * .196) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "ponteiroMenosY": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, 0), (1.691495, 1.691495, 0), (1.697056, 2.537859, 0), (2.545584, 2.545584, 0), (2.545584, 1.707095, 0), (1.691504, 1.692763, 0)], k=[0, 1, 2, 3, 4, 5]) crv.rotateY.set(-90) crv.rotateX.set(-90) crv.scale.set(cntrlSize * .196, cntrlSize * .196, cntrlSize * .196) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "ponteiroMenosZ": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, 0), (1.691495, 1.691495, 0), (1.697056, 2.537859, 0), (2.545584, 2.545584, 0), (2.545584, 1.707095, 0), (1.691504, 1.692763, 0)], k=[0, 1, 2, 3, 4, 5]) crv.scale.set(cntrlSize * .196, cntrlSize * -.196, cntrlSize * -.196) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "ponteiroReto" or icone == "ponteiroReto_X": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, 0), (0, 6.414597, 0), (0.569164, 7, 0), (0, 7.569164, 0), (-0.569164, 7, 0), (0.00139909, 6.432235, 0)], k=[0, 1, 2, 3, 4, 5]) crv.rotateZ.set(-90) crv.scale.set(cntrlSize * .196, cntrlSize * .196, cntrlSize * .196) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "ponteiroReto_Y": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, 0), (0, 6.414597, 0), (0.569164, 7, 0), (0, 7.569164, 0), (-0.569164, 7, 0), (0.00139909, 6.432235, 0)], k=[0, 1, 2, 3, 4, 5]) crv.scale.set(cntrlSize * .196, cntrlSize * .196, cntrlSize * .196) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "ponteiroReto_Z": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, 0), (0, 6.414597, 0), (0.569164, 7, 0), (0, 7.569164, 0), (-0.569164, 7, 0), (0.00139909, 6.432235, 0)], k=[0, 1, 2, 3, 4, 5]) crv.rotateX.set(90) crv.scale.set(cntrlSize * .196, cntrlSize * .196, cntrlSize * .196) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == 'quadradoX' or icone == 'quadrado_X': crv = pm.curve(p=((.5, 0, -.5), (.5, 0, .5), (-.5, 0, .5), (-.5, 0, -.5), (.5, 0, -.5)), d=1, n=name + cntrlSulfix) crv.rotateZ.set(90) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'quadradoY' or icone == 'quadrado_Y': crv = pm.curve(p=((.5, 0, -.5), (.5, 0, .5), (-.5, 0, .5), (-.5, 0, -.5), (.5, 0, -.5)), d=1, n=name + cntrlSulfix) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'quadradoZ' or icone == 'quadrado_Z': crv = pm.curve(p=((.5, 0, -.5), (.5, 0, .5), (-.5, 0, .5), (-.5, 0, -.5), (.5, 0, -.5)), d=1, n=name + cntrlSulfix) crv.rotateX.set(90) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'retanguloZ' or icone == 'retangulo_Z': crv = pm.curve(p=((5, 0, -.2), (5, 0, .2), (-5, 0, .2), (-5, 0, -.2), (5, 0, -.2)), d=1, n=name + cntrlSulfix) crv.rotateX.set(90) crv.scale.set(cntrlSize * 0.101, cntrlSize * 0.227, cntrlSize * 0.101) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'retanguloX' or icone == 'retangulo_X': crv = pm.curve(p=((5, 0, -.2), (5, 0, .2), (-5, 0, .2), (-5, 0, -.2), (5, 0, -.2)), d=1, n=name + cntrlSulfix) crv.rotateX.set(90) crv.rotateY.set(90) crv.scale.set(cntrlSize * 0.101, cntrlSize * 0.227, cntrlSize * 0.101) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'retanguloY' or icone == 'retangulo_Y': crv = pm.curve(p=((5, 0, -.2), (5, 0, .2), (-5, 0, .2), (-5, 0, -.2), (5, 0, -.2)), d=1, n=name + cntrlSulfix) crv.scale.set(cntrlSize * 0.101, cntrlSize * 0.227, cntrlSize * 0.101) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'dropY' or icone == 'drop_Y': crv = pm.circle(nr=[1, 0, 0], ch=0, n=name + cntrlSulfix)[0] pm.move(0, 3, 0, crv, r=1) pm.makeIdentity(crv, apply=1, t=1) pm.move(0, -3, 0, crv.scalePivot, crv.rotatePivot, r=1) pm.move(0, -1.8, crv.cv[5], r=1) pm.scale([crv.cv[4], crv.cv[6]], [1, 1, 0.01], r=1) pm.move(0, 0.5, 0, crv.cv[1], r=1) pm.move(0, 0.6, 0, crv.cv[0], crv.cv[2], r=1) crv.scale.set(cntrlSize * 0.22, cntrlSize * 0.22, cntrlSize * 0.22) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'dropZ' or icone == 'drop_Z': crv = pm.circle(nr=[0, 1, 0], ch=0, n=name + cntrlSulfix)[0] pm.move(0, 0, -3, crv, r=1) pm.makeIdentity(crv, apply=1, t=1) pm.move(0, 0, 3, crv.scalePivot, crv.rotatePivot, r=1) pm.move(0, 0, 1.8, crv.cv[5], r=1) pm.scale([crv.cv[4], crv.cv[6]], [0.01, 1, 1], r=1) pm.move(0, 0, -0.5, crv.cv[1], r=1) pm.move(0, 0, -0.6, crv.cv[0], crv.cv[2], r=1) crv.scale.set(cntrlSize * 0.22, cntrlSize * 0.22, cntrlSize * 0.22) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'dropX' or icone == 'drop_X': crv = pm.circle(nr=[0, 0, 1], ch=0, n=name + cntrlSulfix)[0] pm.move(0, 0, -3, crv, r=1) pm.makeIdentity(crv, apply=1, t=1) pm.move(0, 0, 3, crv.scalePivot, crv.rotatePivot, r=1) pm.move(0, 0, 1.8, crv.cv[5], r=1) pm.scale([crv.cv[4], crv.cv[6]], [0.01, 1, 1], r=1) pm.move(0, 0, -0.5, crv.cv[1], r=1) pm.move(0, 0, -0.6, crv.cv[0], crv.cv[2], r=1) crv.scale.set(cntrlSize * 0.22, cntrlSize * 0.22, cntrlSize * 0.22) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'dropMenosY': crv = pm.circle(nr=[1, 0, 0], ch=0, n=name + cntrlSulfix)[0] pm.move(0, 3, 0, crv, r=1) pm.makeIdentity(crv, apply=1, t=1) pm.move(0, -3, 0, crv.scalePivot, crv.rotatePivot, r=1) pm.move(0, -1.8, crv.cv[5], r=1) pm.scale([crv.cv[4], crv.cv[6]], [1, 1, 0.01], r=1) pm.move(0, 0.5, 0, crv.cv[1], r=1) pm.move(0, 0.6, 0, crv.cv[0], crv.cv[2], r=1) crv.scale.set(cntrlSize * 0.22, cntrlSize * -0.22, cntrlSize * 0.22) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'dropMenosZ': crv = pm.circle(nr=[0, 1, 0], ch=0, n=name + cntrlSulfix)[0] pm.move(0, 0, -3, crv, r=1) pm.makeIdentity(crv, apply=1, t=1) pm.move(0, 0, 3, crv.scalePivot, crv.rotatePivot, r=1) pm.move(0, 0, 1.8, crv.cv[5], r=1) pm.scale([crv.cv[4], crv.cv[6]], [0.01, 1, 1], r=1) pm.move(0, 0, -0.5, crv.cv[1], r=1) pm.move(0, 0, -0.6, crv.cv[0], crv.cv[2], r=1) crv.scale.set(cntrlSize * 0.22, cntrlSize * 0.22, cntrlSize * -0.22) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'circuloPontaX' or icone == 'circuloPonta_X': tempCrv = pm.circle(n=name + "Aux", nr=[0, 1, 0], ch=0, s=6)[0] pm.scale([tempCrv.cv[3], tempCrv.cv[5]], [0.25, 1, 1]) pm.move(0, 0, -0.5, tempCrv.cv[0], tempCrv.cv[2], r=1, ls=1) pm.move(0, 0, 1.25, tempCrv.cv[0:5], r=1, ls=1) pm.move(0, 0, 0.5, tempCrv.cv[1], r=1, ls=1) pm.scale(tempCrv.cv[0:5], [0.1, 0.1, 0.1], r=1, p=(0, 0, 1.25)) crv = pm.circle(nr=[0, 1, 0], ch=0, n=name + cntrlSulfix)[0] pm.parent(tempCrv.getShape(), crv, r=1, s=1) pm.delete(tempCrv) crv.scale.set(cntrlSize * 0.4815, cntrlSize * 0.4815, cntrlSize * 0.4815) crv.rotateZ.set(90) crv.rotateY.set(180) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'circuloPontaY' or icone == 'circuloPonta_Y': tempCrv = pm.circle(n=name + "Aux", nr=[0, 1, 0], ch=0, s=6)[0] pm.scale([tempCrv.cv[3], tempCrv.cv[5]], [0.25, 1, 1]) pm.move(0, 0, -0.5, tempCrv.cv[0], tempCrv.cv[2], r=1, ls=1) pm.move(0, 0, 1.25, tempCrv.cv[0:5], r=1, ls=1) pm.move(0, 0, 0.5, tempCrv.cv[1], r=1, ls=1) pm.scale(tempCrv.cv[0:5], [0.1, 0.1, 0.1], r=1, p=(0, 0, 1.25)) crv = pm.circle(nr=[0, 1, 0], ch=0, n=name + cntrlSulfix)[0] pm.parent(tempCrv.getShape(), crv, r=1, s=1) pm.delete(tempCrv) crv.scale.set(cntrlSize * 0.4815, cntrlSize * 0.4815, cntrlSize * 0.4815) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'circuloPontaZ' or icone == 'circuloPonta_Z': tempCrv = pm.circle(n=name + "Aux", nr=[0, 1, 0], ch=0, s=6)[0] pm.scale([tempCrv.cv[3], tempCrv.cv[5]], [0.25, 1, 1]) pm.move(0, 0, -0.5, tempCrv.cv[0], tempCrv.cv[2], r=1, ls=1) pm.move(0, 0, 1.25, tempCrv.cv[0:5], r=1, ls=1) pm.move(0, 0, 0.5, tempCrv.cv[1], r=1, ls=1) pm.scale(tempCrv.cv[0:5], [0.1, 0.1, 0.1], r=1, p=(0, 0, 1.25)) crv = pm.circle(nr=[0, 1, 0], ch=0, n=name + cntrlSulfix)[0] pm.parent(tempCrv.getShape(), crv, r=1, s=1) pm.delete(tempCrv) crv.scale.set(cntrlSize * 0.4815, cntrlSize * 0.4815, cntrlSize * 0.4815) crv.rotateX.set(90) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'hexagonoX' or icone == 'hexagono_X': controlList = pm.circle(ch=1, n=name + cntrlSulfix, r=0.5) crv = controlList[0] history = controlList[1] history.degree.set(1) history.sections.set(6) history.normalZ.set(0) history.normalX.set(1) pm.delete(crv, ch=True) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'hexagonoY' or icone == 'hexagono_Y': controlList = pm.circle(ch=1, n=name + cntrlSulfix, r=0.5) crv = controlList[0] history = controlList[1] history.degree.set(1) history.sections.set(6) history.normalZ.set(0) history.normalY.set(1) pm.delete(crv, ch=True) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'hexagonoZ' or icone == 'hexagono_Z': controlList = pm.circle(ch=1, n=name + cntrlSulfix, r=0.5) crv = controlList[0] history = controlList[1] history.degree.set(1) history.sections.set(6) pm.delete(crv, ch=True) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'pentagonoX' or icone == 'pentagono_X': controlList = pm.circle(ch=1, n=name + cntrlSulfix, r=0.5) crv = controlList[0] history = controlList[1] history.degree.set(1) history.sections.set(5) history.normalZ.set(0) history.normalX.set(1) pm.delete(crv, ch=True) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'pentagonoY' or icone == 'pentagono_Y': controlList = pm.circle(ch=1, n=name + cntrlSulfix, r=0.5) crv = controlList[0] history = controlList[1] history.degree.set(1) history.sections.set(5) history.normalZ.set(0) history.normalY.set(1) pm.delete(crv, ch=True) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'pentagonoZ' or icone == 'pentagono_Z': controlList = pm.circle(ch=1, n=name + cntrlSulfix, r=0.5) crv = controlList[0] history = controlList[1] history.degree.set(1) history.sections.set(5) pm.delete(crv, ch=True) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'crossX' or icone == 'cross_X': crv = pm.curve(p=((1, 0, -1), (1, 0, -2), (-1, 0, -2), (-1, 0, -1), (-2, 0, -1), (-2, 0, 1), (-1, 0, 1), (-1, 0, 2), (1, 0, 2), (1, 0, 1), (2, 0, 1), (2, 0, -1), (1, 0, -1)), d=1, n=name + cntrlSulfix) crv.rotateZ.set(90) crv.scale.set(cntrlSize * 0.245, cntrlSize * 0.245, cntrlSize * 0.245) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'crossY' or icone == 'cross_Y': crv = pm.curve(p=((1, 0, -1), (1, 0, -2), (-1, 0, -2), (-1, 0, -1), (-2, 0, -1), (-2, 0, 1), (-1, 0, 1), (-1, 0, 2), (1, 0, 2), (1, 0, 1), (2, 0, 1), (2, 0, -1), (1, 0, -1)), d=1, n=name + cntrlSulfix) crv.scale.set(cntrlSize * 0.245, cntrlSize * 0.245, cntrlSize * 0.245) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'crossZ' or icone == 'cross_Z': crv = pm.curve(p=((1, 0, -1), (1, 0, -2), (-1, 0, -2), (-1, 0, -1), (-2, 0, -1), (-2, 0, 1), (-1, 0, 1), (-1, 0, 2), (1, 0, 2), (1, 0, 1), (2, 0, 1), (2, 0, -1), (1, 0, -1)), d=1, n=name + cntrlSulfix) crv.rotateX.set(90) crv.scale.set(cntrlSize * 0.245, cntrlSize * 0.245, cntrlSize * 0.245) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'fkShapeX' or icone == 'fkShape_X': crv = pm.curve(p=((0, 1, 1), (0, -1, 1), (2.903, -0.47, 0.522), (2.903, 0.573, 0.522), (0, 1, 1), (0, 1, -1), (0, -1, -1), (0, -1, 1), (0, 1, 1), (2.903, 0.573, 0.522), (2.903, 0.573, -0.522), (0, 1, -1), (0, -1, -1), (2.903, -0.47, -0.522), (2.903, -0.47, 0.522), (0, -1, 1), (0, -1, -1), (2.903, -0.47, -0.522), (2.903, 0.573, -0.522)), d=1, n=name + cntrlSulfix) crv.scale.set(cntrlSize * 0.327, cntrlSize * 0.327, cntrlSize * 0.327) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'fkShapeY' or icone == 'fkShape_Y': crv = pm.curve(p=((0, 1, 1), (0, -1, 1), (2.903, -0.47, 0.522), (2.903, 0.573, 0.522), (0, 1, 1), (0, 1, -1), (0, -1, -1), (0, -1, 1), (0, 1, 1), (2.903, 0.573, 0.522), (2.903, 0.573, -0.522), (0, 1, -1), (0, -1, -1), (2.903, -0.47, -0.522), (2.903, -0.47, 0.522), (0, -1, 1), (0, -1, -1), (2.903, -0.47, -0.522), (2.903, 0.573, -0.522)), d=1, n=name + cntrlSulfix) crv.rotateZ.set(90) crv.scale.set(cntrlSize * 0.327, cntrlSize * 0.327, cntrlSize * 0.327) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'fkShapeZ' or icone == 'fkShape_Z': crv = pm.curve(p=((0, 1, 1), (0, -1, 1), (2.903, -0.47, 0.522), (2.903, 0.573, 0.522), (0, 1, 1), (0, 1, -1), (0, -1, -1), (0, -1, 1), (0, 1, 1), (2.903, 0.573, 0.522), (2.903, 0.573, -0.522), (0, 1, -1), (0, -1, -1), (2.903, -0.47, -0.522), (2.903, -0.47, 0.522), (0, -1, 1), (0, -1, -1), (2.903, -0.47, -0.522), (2.903, 0.573, -0.522)), d=1, n=name + cntrlSulfix) crv.rotateY.set(-90) crv.scale.set(cntrlSize * 0.327, cntrlSize * 0.327, cntrlSize * 0.327) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'fkShapeMinusX': crv = pm.curve(p=((0, 1, 1), (0, -1, 1), (2.903, -0.47, 0.522), (2.903, 0.573, 0.522), (0, 1, 1), (0, 1, -1), (0, -1, -1), (0, -1, 1), (0, 1, 1), (2.903, 0.573, 0.522), (2.903, 0.573, -0.522), (0, 1, -1), (0, -1, -1), (2.903, -0.47, -0.522), (2.903, -0.47, 0.522), (0, -1, 1), (0, -1, -1), (2.903, -0.47, -0.522), (2.903, 0.573, -0.522)), d=1, n=name + cntrlSulfix) crv.scale.set(cntrlSize * 0.327, cntrlSize * 0.327, cntrlSize * 0.327) crv.rotateZ.set(180) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'fkShapeMinusY': crv = pm.curve(p=((0, 1, 1), (0, -1, 1), (2.903, -0.47, 0.522), (2.903, 0.573, 0.522), (0, 1, 1), (0, 1, -1), (0, -1, -1), (0, -1, 1), (0, 1, 1), (2.903, 0.573, 0.522), (2.903, 0.573, -0.522), (0, 1, -1), (0, -1, -1), (2.903, -0.47, -0.522), (2.903, -0.47, 0.522), (0, -1, 1), (0, -1, -1), (2.903, -0.47, -0.522), (2.903, 0.573, -0.522)), d=1, n=name + cntrlSulfix) crv.rotateZ.set(90) crv.scale.set(cntrlSize * 0.327, cntrlSize * 0.327, cntrlSize * 0.327) crv.rotateX.set(180) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'fkShapeMinusZ': crv = pm.curve(p=((0, 1, 1), (0, -1, 1), (2.903, -0.47, 0.522), (2.903, 0.573, 0.522), (0, 1, 1), (0, 1, -1), (0, -1, -1), (0, -1, 1), (0, 1, 1), (2.903, 0.573, 0.522), (2.903, 0.573, -0.522), (0, 1, -1), (0, -1, -1), (2.903, -0.47, -0.522), (2.903, -0.47, 0.522), (0, -1, 1), (0, -1, -1), (2.903, -0.47, -0.522), (2.903, 0.573, -0.522)), d=1, n=name + cntrlSulfix) crv.rotateY.set(-90) crv.scale.set(cntrlSize * 0.327, cntrlSize * 0.327, cntrlSize * 0.327) crv.rotateX.set(180) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'guideDirectionShapeX' or icone == 'guideDirectionShape_X': crv = pm.curve(p=((-1, -1, 1), (1, -1, 1), (1, -1, -1), (-1, -1, -1), (-1, -1, 1), (-1, 1, 1), (-1, 1, -1), (-1, -1, -1), (-1, -1, 1), (-1, 1, 1), (1, 1, 1), (1, -1, 1), (1, -1, -1), (1, 1, -1), (1, 1, 1), (-1, 1, 1), (-1, 1, -1), (1, 1, -1), (0, 2.5, 0), (1, 1, 1), (-1, 1, 1), (0, 2.5, 0), (-1, 1, -1)), d=1, n=name + cntrlSulfix) crv.rotateZ.set(-90) crv.scale.set(cntrlSize * 0.487, cntrlSize * 0.487, cntrlSize * 0.487) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'guideDirectionShapeY' or icone == 'guideDirectionShape_Y': crv = pm.curve(p=((-1, -1, 1), (1, -1, 1), (1, -1, -1), (-1, -1, -1), (-1, -1, 1), (-1, 1, 1), (-1, 1, -1), (-1, -1, -1), (-1, -1, 1), (-1, 1, 1), (1, 1, 1), (1, -1, 1), (1, -1, -1), (1, 1, -1), (1, 1, 1), (-1, 1, 1), (-1, 1, -1), (1, 1, -1), (0, 2.5, 0), (1, 1, 1), (-1, 1, 1), (0, 2.5, 0), (-1, 1, -1)), d=1, n=name + cntrlSulfix) crv.scale.set(cntrlSize * 0.487, cntrlSize * 0.487, cntrlSize * 0.487) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'guideDirectionShapeZ' or icone == 'guideDirectionShape_Z': crv = pm.curve(p=((-1, -1, 1), (1, -1, 1), (1, -1, -1), (-1, -1, -1), (-1, -1, 1), (-1, 1, 1), (-1, 1, -1), (-1, -1, -1), (-1, -1, 1), (-1, 1, 1), (1, 1, 1), (1, -1, 1), (1, -1, -1), (1, 1, -1), (1, 1, 1), (-1, 1, 1), (-1, 1, -1), (1, 1, -1), (0, 2.5, 0), (1, 1, 1), (-1, 1, 1), (0, 2.5, 0), (-1, 1, -1)), d=1, n=name + cntrlSulfix) crv.rotateX.set(90) crv.scale.set(cntrlSize * 0.487, cntrlSize * 0.487, cntrlSize * 0.487) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'arrowX' or icone == 'arrow_X': crv = pm.curve(p=((0, 4, 0), (-2, 2, 0), (-1, 2, 0), (-1, -2, 0), (1, -2, 0), (1, 2, 0), (2, 2, 0), (0, 4, 0)), d=1, n=name + cntrlSulfix) crv.rotateZ.set(-90) crv.scale.set(cntrlSize * 0.123, cntrlSize * 0.123, cntrlSize * 0.123) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'arrowY' or icone == 'arrow_Y': crv = pm.curve(p=((0, 4, 0), (-2, 2, 0), (-1, 2, 0), (-1, -2, 0), (1, -2, 0), (1, 2, 0), (2, 2, 0), (0, 4, 0)), d=1, n=name + cntrlSulfix) crv.scale.set(cntrlSize * 0.123, cntrlSize * 0.123, cntrlSize * 0.123) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == 'arrowZ' or icone == 'arrow_Z': crv = pm.curve(p=((0, 4, 0), (-2, 2, 0), (-1, 2, 0), (-1, -2, 0), (1, -2, 0), (1, 2, 0), (2, 2, 0), (0, 4, 0)), d=1, n=name + cntrlSulfix) crv.rotateX.set(90) crv.scale.set(cntrlSize * 0.123, cntrlSize * 0.123, cntrlSize * 0.123) pm.makeIdentity(crv, a=True, t=True, r=True, s=True, n=False) elif icone == "trianguloX" or icone == "triangulo_X": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, -0.471058), (-0.471058, 0, 0.471058), (0.471058, 0, 0.471058), (0, 0, -0.471058)], k=[0, 1, 2, 3]) crv.rotateX.set(90) crv.rotateY.set(90) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "trianguloY" or icone == "triangulo_Y": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, -0.471058), (-0.471058, 0, 0.471058), (0.471058, 0, 0.471058), (0, 0, -0.471058)], k=[0, 1, 2, 3]) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "trianguloZ" or icone == "triangulo_Z": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, -0.471058), (-0.471058, 0, 0.471058), (0.471058, 0, 0.471058), (0, 0, -0.471058)], k=[0, 1, 2, 3]) crv.rotateZ.set(90) crv.scale.set(cntrlSize, cntrlSize, cntrlSize) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "trianguloMinusZ": crv = pm.curve(n=name + cntrlSulfix, d=1, p=[(0, 0, -0.471058), (-0.471058, 0, 0.471058), (0.471058, 0, 0.471058), (0, 0, -0.471058)], k=[0, 1, 2, 3]) crv.rotateX.set(-90) crv.rotateZ.set(90) crv.scale.set(cntrlSize, -1 * cntrlSize, cntrlSize) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "jaw": crv = pm.circle(nr=[0, 0, 1], ch=0, name=name)[0] pm.move(0.78, -0.01, -0.3, crv + '.cv[0]') pm.move(0, -0.09, 0, crv + '.cv[1]') pm.move(-0.78, -0.01, -0.3, crv + '.cv[2]') pm.move(-1.108, -0, -0.55, crv + '.cv[3]') pm.move(-0.78, -0.78, -0.3, crv + '.cv[4]') pm.move(0, -1.108, 0, crv + '.cv[5]') pm.move(0.78, -0.78, -0.3, crv + '.cv[6]') pm.move(1.109, 0, -0.55, crv + '.cv[7]') crv.scale.set(cntrlSize * 0.501, 0.501 * cntrlSize, cntrlSize * 0.501) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "upTeeth": crv = pm.curve(name=name, d=3, p=[(-0.80380731394020355, -0.22720474003408064, 0), (-0.78833906954303412, -0.32153249588067823, 0), (-0.76088405517014568, -0.41013482375058707, 0), (-0.62735291342491006, -0.43040000647965293, 0), (-0.41534271707226456, -0.43191082347433429, 0), (-0.42495970029949337, -0.040047557704252057, 0), (-0.40579495988262604, -0.024586361881729246, 0), (-0.38693255181790942, -0.039628633322768891, 0), (-0.3964314271448357, -0.43358651947575311, 0), (-0.18695799902989041, -0.42411614361856564, 0), (0.028288611981836631, -0.43359457401211543, 0), (0.02464596629930238, -0.03959641334886399, 0), (0.031931321369774501, -0.024707184158323514, 0), (0.039216483222223708, -0.039596484482549599, 0), (0.035573866478620708, -0.43359428947729661, 0), (0.25081890272400198, -0.42411721050207163, 0), (0.46621969146686748, -0.43358253565918936, 0), (0.46280056649138057, -0.039643499755065648, 0), (0.46963982619053457, -0.02453087688648381, 0), (0.47646879021640753, -0.040254627919388497, 0), (0.47308055216016864, -0.43113802756945674, 0), (0.68669251473786996, -0.43328412048568588, 0), (0.84162660358193353, -0.39937116285575591, 0), (0.90911721139256318, -0.16732208539539606, 0), (0.92458015941006, 0.34843743085733081, 0), (0.027431509404153509, 0.43359457401211188, 0), (-0.92458015941005645, 0.31110756712332055, 0), (-0.82201559109450617, -0.086251710757503375, 0), (-0.80380731394038829, -0.22720474003434887, 0)]) crv.scale.set(cntrlSize * 0.519, 0.519 * cntrlSize, cntrlSize * 0.519) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == "dwTeeth": crv = pm.curve(name=name, d=3, p=[(-0.80380731394020355, 0.22720474003407709, 0), (-0.78833906954303412, 0.32153249588067467, 0), (-0.76088405517014568, 0.41013482375058352, 0), (-0.62735291342491006, 0.43040000647964938, 0), (-0.41534271707226456, 0.43191082347433074, 0), (-0.42495970029949337, 0.040047557704248504, 0), (-0.40579495988262604, 0.024586361881725693, 0), (-0.38693255181790942, 0.039628633322765339, 0), (-0.3964314271448357, 0.43358651947574955, 0), (-0.18695799902989041, 0.42411614361856209, 0), (0.028288611981836631, 0.43359457401211188, 0), (0.02464596629930238, 0.039596413348860438, 0), (0.031931321369774501, 0.024707184158319961, 0), (0.039216483222223708, 0.039596484482546046, 0), (0.035573866478620708, 0.43359428947729306, 0), (0.25081890272400198, 0.42411721050206808, 0), (0.46621969146686748, 0.43358253565918581, 0), (0.46280056649138057, 0.039643499755062095, 0), (0.46963982619053457, 0.024530876886480257, 0), (0.47646879021640753, 0.040254627919384944, 0), (0.47308055216016864, 0.43113802756945319, 0), (0.68669251473786996, 0.43328412048568232, 0), (0.84162660358193353, 0.39937116285575236, 0), (0.90911721139256318, 0.16732208539539251, 0), (0.92458015941006, -0.34843743085733436, 0), (0.027431509404153509, -0.43359457401211543, 0), (-0.92458015941005645, -0.3111075671233241, 0), (-0.82201559109450617, 0.086251710757499822, 0), (-0.80380731394038829, 0.22720474003434532, 0)]) crv.scale.set(cntrlSize * 0.519, 0.519 * cntrlSize, cntrlSize * 0.519) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == 'semiCirculoY' or icone == 'semiCirculo_Y': crv = pm.curve(name=name, per=True, p=[(0.784, 0.784, 0), (0, 1.108, 0), (-0.784, 0.784, 0), (-1.108, 0, 0), (-0.784, 0, 0), (0, 0, 0), (0.784, 0, 0), (1.108, 0, 0), (0.784, 0.784, 0), (0, 1.108, 0), (-0.784, 0.784, 0)], k=[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) crv.scale.set(cntrlSize * 0.491, cntrlSize * 0.491, cntrlSize * 0.491) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == 'semiCirculoMenosY': crv = pm.curve(name=name, per=True, p=[(0.784, 0.784, 0), (0, 1.108, 0), (-0.784, 0.784, 0), (-1.108, 0, 0), (-0.784, 0, 0), (0, 0, 0), (0.784, 0, 0), (1.108, 0, 0), (0.784, 0.784, 0), (0, 1.108, 0), (-0.784, 0.784, 0)], k=[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) crv.rotateZ.set(180) crv.scale.set(cntrlSize * 0.491, cntrlSize * 0.491, cntrlSize * 0.491) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == 'semiCirculoX' or icone == 'semiCirculo_X': crv = pm.curve(name=name, per=True, p=[(0.784, 0.784, 0), (0, 1.108, 0), (-0.784, 0.784, 0), (-1.108, 0, 0), (-0.784, 0, 0), (0, 0, 0), (0.784, 0, 0), (1.108, 0, 0), (0.784, 0.784, 0), (0, 1.108, 0), (-0.784, 0.784, 0)], k=[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) crv.scale.set(cntrlSize * 0.491, cntrlSize * 0.491, cntrlSize * 0.491) crv.rotateZ.set(-90) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == 'semiCirculoZ' or icone == 'semiCirculo_Z': crv = pm.curve(name=name, per=True, p=[(0.784, 0.784, 0), (0, 1.108, 0), (-0.784, 0.784, 0), (-1.108, 0, 0), (-0.784, 0, 0), (0, 0, 0), (0.784, 0, 0), (1.108, 0, 0), (0.784, 0.784, 0), (0, 1.108, 0), (-0.784, 0.784, 0)], k=[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) crv.scale.set(cntrlSize * 0.491, cntrlSize * 0.491, cntrlSize * 0.491) crv.rotateX.set(90) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == 'semiCirculoMenosX': crv = pm.curve(name=name, per=True, p=[(0.784, 0.784, 0), (0, 1.108, 0), (-0.784, 0.784, 0), (-1.108, 0, 0), (-0.784, 0, 0), (0, 0, 0), (0.784, 0, 0), (1.108, 0, 0), (0.784, 0.784, 0), (0, 1.108, 0), (-0.784, 0.784, 0)], k=[-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) crv.scale.set(cntrlSize * 0.491, cntrlSize * 0.491, cntrlSize * 0.491) crv.rotateZ.set(90) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == 'gota': crv = pm.circle(nr=[0, 0, 1], r=0.1, n=name, ch=0)[0] pm.move(0, .05, 0, crv + ".cv[5]", r=1, ls=1, wd=1) pm.move(-.05, 0, 0, crv + ".cv[0]", r=1, ls=1, wd=1) pm.move(.05, 0, 0, crv + ".cv[2]", r=1, ls=1, wd=1) crv.scale.set(cntrlSize * 4.849, cntrlSize * 4.849, cntrlSize * 4.849) pm.makeIdentity(crv, apply=True, t=1, r=1, s=1, n=0) elif icone == 'grp': crv = pm.group(n=name + cntrlSulfix, em=True) elif icone == 'null': crv = pm.spaceLocator(n=name + cntrlSulfix, p=(0, 0, 0)) crv.localScale.set(cntrlSize, cntrlSize, cntrlSize) else: logger.debug('shape nao reconhecido: %s' % icone) return #display settings if hasHandle: crv.displayHandle.set(1) if localAxis: pm.toggle(crv, localAxis=1) if template: pm.toggle(crv, template=1) if hideShape: shape = crv.getShape() shape.hide() if color: shList = crv.getShapes() if isinstance(color, int): for sh in shList: sh.overrideRGBColors.set(0) sh.overrideEnabled.set(1) sh.overrideColor.set(color) else: for sh in shList: sh.overrideEnabled.set(1) sh.overrideRGBColors.set(1) sh.overrideColorRGB.set(color) if lockChannels != []: for channel in lockChannels: pm.setAttr(crv + '.' + channel, l=1, k=0) #transform settings crv.rotateOrder.set(rotateOrder) if hasZeroGrp: grp = pm.group(n=name + "_grp", em=True) last = grp if offsets > 0: for i in range(1, offsets + 1): off = pm.group(n=name + "_off" + str(i), em=True) pm.parent(off, last) last = off pm.parent(crv, last) crv.rotateOrder.set(rotateOrder) pm.xform(grp, os=True, piv=[0, 0, 0]) else: grp = crv if coords: pm.xform(grp, t=coords[0], ro=coords[1], s=coords[2], ws=1) if parent: grp.setParent(parent) #connections settings if obj: if align == 'point': matrix = pm.xform(obj, q=True, ws=True, t=True) pm.xform(grp, ws=True, t=matrix) pm.makeIdentity(grp, a=False, t=False, r=False, s=True, n=False) ## garante q a escala nao fique negativa elif align == 'pivot': pos = pm.xform(obj, q=True, ws=True, rp=True) rot = pm.xform(obj, q=True, ws=True, ro=True) pm.xform(grp, ws=True, t=pos) pm.xform(grp, ws=True, ro=rot) pm.makeIdentity(grp, a=False, t=False, r=False, s=True, n=False) ## garante q a escala nao fique negativa else: matrix = pm.xform(obj, q=True, ws=True, m=True) pm.xform(grp, ws=True, m=matrix) pm.makeIdentity(grp, a=False, t=False, r=False, s=True, n=False) ## garante q a escala nao fique negativa if connType == 'parent': obj.setParent(crv) elif connType == 'parentConstraint': cnstr = pm.parentConstraint(crv, obj, mo=True) elif connType == 'orientConstraint': cnstr = pm.orientConstraint(crv, obj, mo=True) elif connType == 'constraint' or connType == 'parentScaleConstraint': cnstr = pm.parentConstraint(crv, obj, mo=1) scaleConst = pm.scaleConstraint(crv, obj, mo=1) elif connType == 'pointConstraint': cnstr = pm.pointConstraint(crv, obj, mo=1) elif connType == 'scaleConstraint': cnstr = pm.scaleConstraint(crv, obj, mo=1) elif connType == 'pointOrientConstraint': cnstr = pm.pointConstraint(crv, obj, mo=1) cnstr = pm.orientConstraint(crv, obj, mo=1) elif connType == 'pointScaleConstraint': cnstr = pm.pointConstraint(crv, obj, mo=1) cnstr = pm.scaleConstraint(crv, obj, mo=1) elif connType == 'orientScaleConstraint': cnstr = pm.orientConstraint(crv, obj, mo=1) cnstr = pm.scaleConstraint(crv, obj, mo=1) elif connType == 'connection' or connType == 'connectionTRS': crv.tx >> obj.tx crv.ty >> obj.ty crv.tz >> obj.tz crv.rx >> obj.rx crv.ry >> obj.ry crv.rz >> obj.rz crv.sx >> obj.sx crv.sy >> obj.sy crv.sz >> obj.sz elif connType == 'connectionT': crv.tx >> obj.tx crv.ty >> obj.ty crv.tz >> obj.tz elif connType == 'connectionR': crv.rx >> obj.rx crv.ry >> obj.ry crv.rz >> obj.rz elif connType == 'connectionS': crv.sx >> obj.sx crv.sy >> obj.sy crv.sz >> obj.sz elif connType == 'connectionTR': crv.tx >> obj.tx crv.ty >> obj.ty crv.tz >> obj.tz crv.rx >> obj.rx crv.ry >> obj.ry crv.rz >> obj.rz elif connType == 'connectionTS': crv.tx >> obj.tx crv.ty >> obj.ty crv.tz >> obj.tz crv.sx >> obj.sx crv.sy >> obj.sy crv.sz >> obj.sz elif connType == 'connectionRS': crv.rx >> obj.rx crv.ry >> obj.ry crv.rz >> obj.rz crv.sx >> obj.sx crv.sy >> obj.sy crv.sz >> obj.sz elif connType == 'none': pass else: if posRot: grp.setTranslation(posRot[0], space='object') grp.setRotation(posRot[1], space='object') if returnParent == True: returnObj = grp else: returnObj = crv return (returnObj)