本文整理汇总了Python中maya.cmds.transformLimits函数的典型用法代码示例。如果您正苦于以下问题:Python transformLimits函数的具体用法?Python transformLimits怎么用?Python transformLimits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了transformLimits函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cvBaseGuide
def cvBaseGuide(ctrlName, r=1):
"""Create a control to be used as a Base Guide control.
Returns the main control (circle) and the radius control in a list.
"""
# get radius by checking linear unit
r = dpCheckLinearUnit(r)
# create a simple circle curve:
circle = cmds.circle(n=ctrlName, ch=True, o=True, nr=(0, 0, 1), d=3, s=8, radius=r)[0]
radiusCtrl = cmds.circle(n=ctrlName+"_RadiusCtrl", ch=True, o=True, nr=(0, 1, 0), d=3, s=8, radius=(r/4.0))[0]
# rename curveShape:
renameShape([circle, radiusCtrl])
# configure system of limits and radius:
cmds.setAttr(radiusCtrl+".translateX", r)
cmds.parent(radiusCtrl, circle, relative=True)
cmds.transformLimits(radiusCtrl, tx=(0.01, 1), etx=(True, False))
setLockHide([radiusCtrl], ['ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
# find makeNurbCircle history of the circles:
historyList = findHistory([circle, radiusCtrl], 'makeNurbCircle')
circleHistory = historyList[0]
radiusCtrlHistory = historyList[1]
# rename and make a connection for circle:
circleHistory = cmds.rename(circleHistory, circle+"_makeNurbCircle")
cmds.connectAttr(radiusCtrl+".tx", circleHistory+".radius", force=True)
radiusCtrlHistory = cmds.rename(radiusCtrlHistory, radiusCtrl+"_makeNurbCircle")
# create a mutiplyDivide in order to automatisation the radius of the radiusCtrl:
radiusCtrlMD = cmds.createNode('multiplyDivide', name=radiusCtrl+'_MD')
cmds.connectAttr(radiusCtrl+'.translateX', radiusCtrlMD+'.input1X', force=True)
cmds.setAttr(radiusCtrlMD+'.input2X', 0.15)
cmds.connectAttr(radiusCtrlMD+".outputX", radiusCtrlHistory+".radius", force=True)
# colorize curveShapes:
colorShape([circle, radiusCtrl], 'yellow')
cmds.select(clear=True)
return [circle, radiusCtrl]
示例2: createGuide
def createGuide(self, *args):
Base.StartClass.createGuide(self)
# Custom GUIDE:
cmds.addAttr(self.moduleGrp, longName="flip", attributeType='bool')
cmds.setAttr(self.moduleGrp+".flip", 0)
cmds.addAttr(self.moduleGrp, longName="indirectSkin", attributeType='bool')
cmds.setAttr(self.moduleGrp+".indirectSkin", 0)
cmds.setAttr(self.moduleGrp+".moduleNamespace", self.moduleGrp[:self.moduleGrp.rfind(":")], type='string')
self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc(ctrlName=self.guideName+"_JointLoc1", r=0.3)
self.connectShapeSize(shapeSizeCH)
self.jGuide1 = cmds.joint(name=self.guideName+"_JGuide1", radius=0.001)
cmds.setAttr(self.jGuide1+".template", 1)
cmds.parent(self.jGuide1, self.moduleGrp, relative=True)
self.cvEndJoint, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName+"_JointEnd", r=0.1)
self.connectShapeSize(shapeSizeCH)
cmds.parent(self.cvEndJoint, self.cvJointLoc)
cmds.setAttr(self.cvEndJoint+".tz", 1.3)
self.jGuideEnd = cmds.joint(name=self.guideName+"_JGuideEnd", radius=0.001)
cmds.setAttr(self.jGuideEnd+".template", 1)
cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
ctrls.setLockHide([self.cvEndJoint], ['tx', 'ty', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
cmds.parent(self.cvJointLoc, self.moduleGrp)
cmds.parent(self.jGuideEnd, self.jGuide1)
cmds.parentConstraint(self.cvJointLoc, self.jGuide1, maintainOffset=False, name=self.jGuide1+"_ParentConstraint")
cmds.parentConstraint(self.cvEndJoint, self.jGuideEnd, maintainOffset=False, name=self.jGuideEnd+"_ParentConstraint")
cmds.scaleConstraint(self.cvJointLoc, self.jGuide1, maintainOffset=False, name=self.jGuide1+"_ScaleConstraint")
cmds.scaleConstraint(self.cvEndJoint, self.jGuideEnd, maintainOffset=False, name=self.jGuideEnd+"_ScaleConstraint")
示例3: sliderA
def sliderA(prefix):
cmds.undoInfo(openChunk=True)
#create nodes
grp=cmds.group(empty=True,n=(prefix+'_grp'))
cnt=cmds.circle(r=0.1,ch=False,n=(prefix+'_cnt'))
shp=cmds.circle(o=True,r=1,ch=False,d=1,s=4,n=(prefix+'_shp'))
#setup shp
cmds.move(-1,0,0,'%s.cv[0]' % shp[0],r=True,os=True)
cmds.move(-1,0,0,'%s.cv[4]' % shp[0],r=True,os=True)
cmds.move(0,-1,0,'%s.cv[1]' % shp[0],r=True,os=True)
cmds.move(1,0,0,'%s.cv[2]' % shp[0],r=True,os=True)
cmds.move(0,1,0,'%s.cv[3]' % shp[0],r=True,os=True)
cmds.parent(shp,grp)
cmds.setAttr('%s.overrideEnabled' % shp[0],1)
cmds.setAttr('%s.overrideDisplayType' % shp[0],2)
#setup cnt
cmds.parent(cnt,shp)
cmds.setAttr('%s.overrideEnabled' % cnt[0],1)
cmds.transformLimits(cnt,tx=(-1,1),etx=(1,1))
cmds.transformLimits(cnt,ty=(-1,1),ety=(1,1))
setupAttrs(prefix,cnt[0])
return grp
cmds.undoInfo(closeChunk=True)
示例4: createBrowCtl
def createBrowCtl(self, jntNum, orderJnts):
"""
create extra controllor for the panel
"""
ctlP = "browDetailCtrl0"
kids = cmds.listRelatives (ctlP, ad=True, type ='transform')
if kids:
cmds.delete (kids)
attTemp = ['scaleX','scaleY','scaleZ', 'rotateX','rotateY', 'tz', 'visibility' ]
index = 0
for jnt in orderJnts:
detailCtl = cmds.circle ( n = 'browDetail' + str(index+1).zfill(2), ch=False, o =True, nr = ( 0, 0, 1), r = 0.2 )
detailPlane = cmds.nurbsPlane ( ax = ( 0, 0, 1 ), w = 0.1, lengthRatio = 10, degree = 3, ch=False, n = 'browDetail'+ str(index+1).zfill(2) + 'P' )
increment = 2.0/(jntNum-1)
cmds.parent (detailCtl[0], detailPlane[0], relative=True )
cmds.parent (detailPlane[0], ctlP, relative=True )
cmds.setAttr (detailPlane[0] + '.tx', -2 + increment*index*2 )
cmds.xform ( detailCtl[0], r =True, s = (0.2, 0.2, 0.2))
cmds.setAttr (detailCtl[0] +".overrideEnabled", 1)
cmds.setAttr (detailCtl[0] +"Shape.overrideEnabled", 1)
cmds.setAttr( detailCtl[0]+"Shape.overrideColor", 20)
cmds.transformLimits ( detailCtl[0] , tx = ( -.4, .4), etx=( True, True) )
cmds.transformLimits ( detailCtl[0], ty = ( -.8, .8), ety=( True, True) )
for att in attTemp:
cmds.setAttr (detailCtl[0] +"."+ att, lock = True, keyable = False, channelBox =False)
index = index + 1
示例5: setLimitsOnAttrs
def setLimitsOnAttrs(limitsTbl, objs):
for eachObj in objs:
for attr, limits in limitsTbl.items():
kw={}
kw['e%s'%attr] = (1, 1)
kw[attr] = limits
mc.transformLimits(eachObj, **kw)
示例6: rigSide
def rigSide(self, side ):
inverseAim = False
inverseUp = False
globalMult = 1
if side.find( 'R' ) != -1:
inverseAim = True
inverseUp = True
globalMult = -1
shoulder, elbow, wrist, poleV = self.armInitCtlData.getSortList( side )
upperArm, lowerArm = self.armInitCtlAdd.getSortList( side )
aimObjectOptions = { 'axis':0, 'upAxis':2, 'inverseAim':inverseAim, 'inverseUp':inverseUp, 'upType':'object', 'upObject':poleV, 'replaceTarget':'InitCTL', 'replace':'InitCtl' }
aimObject, wristPoseMltDcmp = rigbase.makeAimObject( wrist, shoulder, **aimObjectOptions )
aimObject = cmds.rename( aimObject, aimObject.replace( 'AimObj', 'AimGrp' ) )
rigbase.betweenRigInAimObject( elbow, aimObject, dcmp = wristPoseMltDcmp, replaceTarget='InitCTL', replace='InitCtl', globalMult = globalMult )
rigbase.AttrEdit( elbow ).lockAttrs( 'ty' )
aimObjectElbow = rigbase.makeAimObject( wrist, elbow, **aimObjectOptions )[0]
aimObjectShoulder = rigbase.makeAimObject( elbow, shoulder, **aimObjectOptions )[0]
cmds.parent( upperArm, aimObjectShoulder )
cmds.parent( lowerArm, aimObjectElbow )
upperArmGrp = rigbase.addParent( upperArm )
lowerArmGrp = rigbase.addParent( lowerArm )
upperMtxDcmp = rigbase.getChildMtxDcmp( elbow, aimObjectShoulder )
lowerMtxDcmp = rigbase.getChildMtxDcmp( wrist, aimObjectElbow )
upperMultMiddle = cmds.createNode( 'multiplyDivide', n=upperArm.replace( 'InitCTL', 'InitCtlMiddleMult' ) )
lowerMultMiddle = cmds.createNode( 'multiplyDivide', n=lowerArm.replace( 'InitCTL', 'InitCtlMiddleMult' ) )
cmds.connectAttr( upperMtxDcmp+'.ot', upperMultMiddle+'.input1' )
cmds.connectAttr( lowerMtxDcmp+'.ot', lowerMultMiddle+'.input1' )
cmds.setAttr( upperMultMiddle+'.input2', .5,.5,.5 )
cmds.setAttr( lowerMultMiddle+'.input2', .5,.5,.5 )
cmds.connectAttr( upperMultMiddle+'.output', upperArmGrp+'.t' )
cmds.connectAttr( lowerMultMiddle+'.output', lowerArmGrp+'.t' )
cmds.setAttr( upperArmGrp+'.r', 0,0,0 )
cmds.setAttr( lowerArmGrp+'.r', 0,0,0 )
if side.find( 'L' ) != -1:
self.outputTransformL = [ aimObjectShoulder, aimObjectElbow, wrist, poleV ]
self.outputAddTrL = [ upperArm, lowerArm ]
cmds.transformLimits( elbow, tz= [-1,0.01], etz=[False, True] )
else:
self.outputTransformR = [ aimObjectShoulder, aimObjectElbow, wrist, poleV ]
self.outputAddTrR = [ upperArm, lowerArm ]
cmds.transformLimits( elbow, tz= [0.01,1], etz=[True, False] )
示例7: rigLegPart
def rigLegPart(self, side ):
inverseAim = False
inverseUp = True
globalMult = 1
if side.find( 'R' ) != -1:
inverseAim= True
inverseUp = False
globalMult = -1
hip, knee, ankle, poleV = self.legInitCtlData.getSortList( side )[:4]
upperLeg, lowerLeg = self.legInitCtlAdd.getSortList( side )
aimObjectOptions = { 'axis':0, 'upAxis':2, 'inverseAim':inverseAim, 'inverseUp':inverseUp, 'upType':'object', 'upObject':poleV, 'replaceTarget':'InitCTL', 'replace':'InitCtl' }
aimObject, anklePoseMltDcmp = rigbase.makeAimObject( ankle, hip, **aimObjectOptions )
aimObject = cmds.rename( aimObject, aimObject.replace( 'AimObj', 'AimGrp' ) )
rigbase.betweenRigInAimObject( knee, aimObject, dcmp = anklePoseMltDcmp, replaceTarget='InitCTL', replace='InitCtl', globalMult = globalMult )
rigbase.AttrEdit( knee ).lockAttrs( 'ty' )
aimObjectKnee = rigbase.makeAimObject( ankle, knee, **aimObjectOptions )[0]
aimObjectHip = rigbase.makeAimObject( knee, hip, **aimObjectOptions )[0]
cmds.parent( upperLeg, aimObjectHip )
cmds.parent( lowerLeg, aimObjectKnee )
upperLegGrp = rigbase.addParent( upperLeg )
lowerLegGrp = rigbase.addParent( lowerLeg )
upperMtxDcmp = rigbase.getChildMtxDcmp( knee, aimObjectHip )
lowerMtxDcmp = rigbase.getChildMtxDcmp( ankle, aimObjectKnee )
upperMultMiddle = cmds.createNode( 'multiplyDivide', n=upperLeg.replace( 'InitCTL', 'InitCtlMiddleMult' ) )
lowerMultMiddle = cmds.createNode( 'multiplyDivide', n=lowerLeg.replace( 'InitCTL', 'InitCtlMiddleMult' ) )
cmds.connectAttr( upperMtxDcmp+'.ot', upperMultMiddle+'.input1' )
cmds.connectAttr( lowerMtxDcmp+'.ot', lowerMultMiddle+'.input1' )
cmds.setAttr( upperMultMiddle+'.input2', .5,.5,.5 )
cmds.setAttr( lowerMultMiddle+'.input2', .5,.5,.5 )
cmds.connectAttr( upperMultMiddle+'.output', upperLegGrp+'.t' )
cmds.connectAttr( lowerMultMiddle+'.output', lowerLegGrp+'.t' )
cmds.setAttr( upperLegGrp+'.r', 0,0,0 )
cmds.setAttr( lowerLegGrp+'.r', 0,0,0 )
if side.find( 'L' ) != -1:
self.outputTransformL = [ aimObjectHip, aimObjectKnee, ankle, poleV ]
self.outputAddTrL = [ upperLeg, lowerLeg ]
cmds.transformLimits( knee, tz= [0.01,1], etz=[True, False] )
else:
self.outputTransformR = [ aimObjectHip, aimObjectKnee, ankle, poleV ]
self.outputAddTrR = [ upperLeg, lowerLeg ]
cmds.transformLimits( knee, tz= [-1,0.01], etz=[False, True] )
示例8: createDetailCtl
def createDetailCtl(self, updn, i):
"""
draw detail control
"""
detailCtlP = cmds.group(em =True, n = updn + 'LipDetailP'+ str(i))
detailCtl = cmds.circle(n = updn + 'LipDetail' + str(i), ch=False, o =True, nr =(0, 0, 1), r = 0.05 )
cmds.parent(detailCtl[0], detailCtlP)
cmds.setAttr(detailCtl[0]+"Shape.overrideEnabled", 1)
cmds.setAttr(detailCtl[0]+"Shape.overrideColor", 20)
cmds.setAttr(detailCtl[0]+'.translate', 0,0,0)
cmds.transformLimits(detailCtl[0], tx =(-.5, .5), etx=(True, True))
cmds.transformLimits(detailCtl[0], ty =(-.5, .5), ety=(True, True))
attTemp = ['scaleX','scaleY','scaleZ', 'rotateX','rotateY','rotateZ', 'tz', 'visibility' ]
for y in attTemp:
cmds.setAttr(detailCtl[0] +"."+ y, lock = True, keyable = False, channelBox =False)
示例9: createNodeUntwist
def createNodeUntwist(node, twistNodeName, boneAxis=1):
'''
createNodeUnTwist('joint1', 'joint1_untwist')
'''
# Set Bone Vector
boneVec = [0,0,0]
boneVec[boneAxis] = 1;
# Create untwist joint
if not MC.objExists(twistNodeName):
unTwistJnt = MC.duplicate(node)[0]
unTwistJnt = MC.rename(unTwistJnt, twistNodeName)
if MC.attributeQuery('radius', node=twistNodeName, exists=True):
MC.setAttr('%s.radius' % twistNodeName, 2)
MC.delete(MC.listRelatives(unTwistJnt, f=True, children=True))
else:
raise Exception,'%s node exists, please specify a unique untwist node name' % twistNodeName
# Remove any transform limits on the twist joint
MC.transformLimits(twistNodeName, remove=True)
# Set joint's rotateOrder to xyz because the angleBetween node only outputs in xyz order
MC.setAttr('%s.rotateOrder' % twistNodeName, 0)
# joint orient is included in matrix, so we need another xform to break it out
rotMat = MC.createNode('transform', name='%s_xf' % twistNodeName, parent=twistNodeName)
for attr in ['rotateX','rotateY','rotateZ', 'rotateOrder']:
MC.connectAttr('%s.%s' % (node, attr), '%s.%s' % (rotMat, attr))
rotPt = MC.createNode('pointMatrixMult', name='%s_pmm' % twistNodeName)
MC.connectAttr('%s.matrix' % rotMat, '%s.inMatrix' % rotPt)
MC.setAttr('%s.inPoint' % rotPt, boneVec[0], boneVec[1], boneVec[2])
MC.setAttr('%s.vectorMultiply' % rotPt, True)
calcRot = MC.createNode('angleBetween', name='%s_angbt' % rotPt)
MC.setAttr('%s.vector1' % calcRot, boneVec[0], boneVec[1], boneVec[2])
MC.connectAttr('%s.output' % rotPt, '%s.vector2' % calcRot)
# Get euler rotations and plug back into our untwist node
for attr in ['X','Y','Z']:
MC.connectAttr('%s.euler%s' % (calcRot, attr), '%s.rotate%s' % (twistNodeName, attr) )
MC.connectAttr('%s.scale%s' % (node, attr), '%s.scale%s' % (twistNodeName, attr) )
return twistNodeName
示例10: ConnectControlToBlendshape
def ConnectControlToBlendshape(controller, blendAttr, clampValue, multiplyer):
cmds.transformLimits(controller.split(".")[0], tx=(-1,1), etx=(True,True))
clampNode = cmds.createNode("clamp", n=blendAttr.replace(".","_")+"_clm")
if (clampValue>0):
cmds.setAttr( clampNode+".maxR", clampValue );
else:
cmds.setAttr( clampNode+".minR", clampValue );
multNode = cmds.createNode("multiplyDivide", n=blendAttr.replace(".","_")+"_mdn")
cmds.setAttr( multNode+".input2X", multiplyer );
cmds.connectAttr(controller, clampNode+".inputR" )
cmds.connectAttr(clampNode+".outputR", multNode+".input1X" )
cmds.connectAttr(multNode+".outputX", blendAttr )
示例11: connectIrisPupil
def connectIrisPupil():
#连接 Iris Pupil连个属性并删除形状节点 使用方法选择两个眼睛控制器 然后执行命令
sls = mc.ls(sl=True)
size = len(sls)
if size==0:
print "No ctrl selected!"
return
for idx,tCtl in enumerate(sls):
lr = "L" if re.search("L$",tCtl)!=None else "R"
sCtl = lr+"_eyeBall_ctrl"
sAtrs = ["iris","pupil"]
tAtrs = ["IrisControl","PupilControl"]
for n,atr in enumerate(sAtrs):
sAtr = sCtl+"."+atr
tAtr = tCtl+"."+tAtrs[n]
sValue = mc.getAttr( sAtr )
tValue = mc.getAttr( tAtr )
pmaNode = mc.createNode("plusMinusAverage",name=tCtl+atr+"_pma")
mc.connectAttr(sAtr,pmaNode+".input1D[0]")
mc.setAttr(".input1D[1]",tValue-sValue)
mc.connectAttr(".output1D",tAtr)
sAtrs = ["sx","sy"]
tAtrs = ["iris_scalX","iris_scalY"]
for n,atr in enumerate(sAtrs):
sAtr = sCtl+"."+atr
tAtr = tCtl+"."+tAtrs[n]
if mc.objExists(tAtr):
attributesCls.setDrivenKey(tAtr,dv=[1,0],v=[0,-10],cd=sAtr,itt="linear",ott="linear",ift=["constant","constant"])
mc.transformLimits(sCtl,sx=[-1,1],esx=[0,1])
mc.transformLimits(sCtl,sy=[-1,1],esy=[0,1])
#Delete shapes
sps = mc.listRelatives(tCtl,s=True)
if sps!=None and sps!=[]:
for shp in sps:
mc.setAttr("%s.intermediateObject"%shp,1)
#mc.delete( sps )
eyeballJnt = lr+"_eyeBall_jnt"
mc.delete( mc.pointConstraint(eyeballJnt,tCtl) )
#mc.parent(tCtl,eyeballJnt)
#import rig_ch.facialSystem.replaceEyeball as rpe
#reload(rpe)
#rpe.eyebalRder("Anim")
#rpe.eyebalRder("Render")
#rpe.connectIrisPupil()
示例12: createGuide
def createGuide(self, *args):
Base.StartClass.createGuide(self)
# Custom GUIDE:
cmds.setAttr(self.moduleGrp + ".moduleNamespace", self.moduleGrp[:self.moduleGrp.rfind(":")], type='string')
cmds.addAttr(self.moduleGrp, longName="nJoints", attributeType='long')
cmds.setAttr(self.moduleGrp + ".nJoints", 1)
self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc(ctrlName=self.guideName + "_JointLoc1", r=0.5)
self.connectShapeSize(shapeSizeCH)
self.cvEndJoint, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName + "_JointEnd", r=0.1)
self.connectShapeSize(shapeSizeCH)
cmds.parent(self.cvEndJoint, self.cvJointLoc)
cmds.setAttr(self.cvEndJoint + ".tz", 1.3)
cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
ctrls.setLockHide([self.cvEndJoint], ['tx', 'ty', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
cmds.parent(self.cvJointLoc, self.moduleGrp)
# Edit GUIDE:
cmds.setAttr(self.moduleGrp + ".rx", -90)
cmds.setAttr(self.moduleGrp + ".ry", -90)
cmds.setAttr(self.moduleGrp + "_RadiusCtrl.tx", 4)
示例13: rigEachPart
def rigEachPart( self, index, side ):
outputTransform = []
inverseAim = False
globalMult = 1
if side.find( 'R' ) != -1:
inverseAim = True
globalMult = -1
aimObjectOptions = { 'axis':0, 'inverseAim':inverseAim, 'replaceTarget':'InitCTL', 'replace':'InitCtl' }
fingerInitCtlNameList = self.fingerInitCtlData.getEachFingerList( index, side )
firstFingerInitCtl = fingerInitCtlNameList[0]
secondFingerInitCtl = fingerInitCtlNameList[1]
betweenFingerInitCtls = fingerInitCtlNameList[2:-1]
endFingerInitCtl = fingerInitCtlNameList[-1]
aimObject0= rigbase.makeAimObject( secondFingerInitCtl, firstFingerInitCtl, **aimObjectOptions )[0]
outputTransform.append( aimObject0 )
aimObject1 = rigbase.makeAimObject( endFingerInitCtl, secondFingerInitCtl, **aimObjectOptions )[0]
aimObject1 = cmds.rename( aimObject1, aimObject1.replace( 'AimObj', 'AimGrp' ) )
rigbase.betweenRigInAimObject( betweenFingerInitCtls, aimObject1, replaceTarget='InitCTL', replace='InitCtl', globalMult = globalMult )
for fingerInitCtl in betweenFingerInitCtls:
rigbase.AttrEdit( fingerInitCtl ).lockAttrs( 'tz' )
if side.find( 'L' ) != -1:
cmds.transformLimits( fingerInitCtl, ty= [0.01,1], ety=[True, False] )
else:
cmds.transformLimits( fingerInitCtl, ty= [-1,0.01], ety=[False, True] )
betweenFingerInitCtls.append( endFingerInitCtl )
aimObjectParent = secondFingerInitCtl
for fingerInitCtl in betweenFingerInitCtls:
aimObject = rigbase.makeAimObject( fingerInitCtl, aimObjectParent, **aimObjectOptions )[0]
aimObjectParent = fingerInitCtl
outputTransform.append( aimObject )
outputTransform.append( endFingerInitCtl )
return outputTransform
示例14: createGuide
def createGuide(self, *args):
Base.StartClass.createGuide(self)
# Custom GUIDE:
cmds.addAttr(self.moduleGrp, longName="nJoints", attributeType='long')
cmds.setAttr(self.moduleGrp+".nJoints", 1)
cmds.setAttr(self.moduleGrp+".moduleNamespace", self.moduleGrp[:self.moduleGrp.rfind(":")], type='string')
self.cvJointLoc, shapeSizeCH = ctrls.cvJointLoc(ctrlName=self.guideName+"_JointLoc1", r=0.3)
self.connectShapeSize(shapeSizeCH)
self.jGuide1 = cmds.joint(name=self.guideName+"_JGuide1", radius=0.001)
cmds.setAttr(self.jGuide1+".template", 1)
cmds.parent(self.jGuide1, self.moduleGrp, relative=True)
self.cvEndJoint, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName+"_JointEnd", r=0.2)
self.connectShapeSize(shapeSizeCH)
cmds.parent(self.cvEndJoint, self.cvJointLoc)
cmds.setAttr(self.cvEndJoint+".tz", 1.3)
self.jGuideEnd = cmds.joint(name=self.guideName+"_JGuideEnd", radius=0.001)
cmds.setAttr(self.jGuideEnd+".template", 1)
cmds.transformLimits(self.cvEndJoint, tz=(0.01, 1), etz=(True, False))
ctrls.setLockHide([self.cvEndJoint], ['rx', 'ry', 'rz', 'sx', 'sy', 'sz'])
cmds.parent(self.cvJointLoc, self.moduleGrp)
cmds.parent(self.jGuideEnd, self.jGuide1)
ctrls.directConnect(self.cvJointLoc, self.jGuide1, ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'])
ctrls.directConnect(self.cvEndJoint, self.jGuideEnd, ['tx', 'ty', 'tz', 'rx', 'ry', 'rz'])
# change the number of falanges to 3:
self.changeJointNumber(3)
# create a base cvLoc to start the finger joints:
self.cvBaseJoint, shapeSizeCH = ctrls.cvLocator(ctrlName=self.guideName+"_JointLoc0", r=0.2)
self.connectShapeSize(shapeSizeCH)
cmds.setAttr(self.cvBaseJoint+".translateZ", -1)
cmds.parent(self.cvBaseJoint, self.moduleGrp)
# transform cvLocs in order to put as a good finger guide:
cmds.setAttr(self.moduleGrp+".rotateX", 90)
cmds.setAttr(self.moduleGrp+".rotateZ", 90)
示例15: __setup_main_control
def __setup_main_control(self):
#--- this method setups the main control
if not cmds.objExists(self.main_ctl + '.globalScale'):
attr = attribute.Attribute()
attr.addAttr(node= self.main_ctl,
attrName = 'globalScale',
attrType = 'double',
min = 0,
default = 1)
#--- connect the scale attributes of the main control with the gs
for axis in 'xyz':
attr.connectAttr(node = [self.main_ctl, self.main_ctl],
attribute = ['globalScale', 's' + axis])
#--- limit the scale minimum to 0.01
cmds.transformLimits(self.main_ctl,
scaleX = (0.01,1),
scaleY = (0.01,1),
scaleZ = (0.01,1),
enableScaleX = (1,0),
enableScaleY = (1,0),
enableScaleZ = (1,0))
#--- lock the scale attributes of the main control
attr.lockAttr(node = self.main_ctl,
attribute = ['s'])
if not cmds.objExists(self.main_ctl + '.displayType'):
attr = attribute.Attribute()
attr.addAttr(node= self.main_ctl,
attrName = 'displayType',
attrType = 'enum',
enum = ['normal', 'template', 'reference'])
#--- connect the meshes
for i in cmds.ls(type='mesh'):
if cmds.objExists(i):
attr.setAttr(node=i, attribute=['overrideEnabled'], value=1, lock=True)
attr.connectAttr(node=[self.main_ctl, i],
attribute=['displayType',
'drawOverride.overrideDisplayType'])
attr.setAttr(node=self.main_ctl, attribute=['displayType'], value=2)