本文整理汇总了Python中maya.cmds.transformLimits函数的典型用法代码示例。如果您正苦于以下问题:Python transformLimits函数的具体用法?Python transformLimits怎么用?Python transformLimits使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了transformLimits函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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]
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:33,代码来源:dpControls.py
示例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")
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:32,代码来源:dpSingle.py
示例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)
开发者ID:Bumpybox,项目名称:Tapp,代码行数:33,代码来源:utils.py
示例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
开发者ID:darkuress,项目名称:arFace,代码行数:31,代码来源:Func.py
示例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)
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:7,代码来源:hacks.py
示例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] )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:54,代码来源:initrigset.py
示例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] )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:54,代码来源:initrigset.py
示例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)
开发者ID:darkuress,项目名称:arFace,代码行数:15,代码来源:Joints.py
示例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
开发者ID:tccoleman,项目名称:tcTools,代码行数:46,代码来源:utils.py
示例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 )
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:18,代码来源:connectControlToBlendshape.py
示例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()
开发者ID:wangqinghuaTudou,项目名称:test,代码行数:44,代码来源:replaceEyeball.py
示例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)
开发者ID:SqueezeStudioAnimation,项目名称:dpAutoRigSystem,代码行数:19,代码来源:dpSpine.py
示例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
开发者ID:jonntd,项目名称:mayadev-1,代码行数:41,代码来源:initrigset.py
示例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)
开发者ID:renaudll,项目名称:dpAutoRigSystem,代码行数:40,代码来源:dpFinger.py
示例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)
开发者ID:jonntd,项目名称:Public,代码行数:38,代码来源:puppet.py
示例16: setTranslateLimits
def setTranslateLimits(ctrl, tx=True, ty=True, tz=True):
"""
"""
if tx:
mc.transformLimits(ctrl, tx=(-1.0, 1.0), etx=(1, 1))
if ty:
mc.transformLimits(ctrl, ty=(-1.0, 1.0), ety=(1, 1))
if tz:
mc.transformLimits(ctrl, tz=(-1.0, 1.0), etz=(1, 1))
开发者ID:auqeyjf,项目名称:glTools,代码行数:9,代码来源:transformDrivenBlend.py
示例17: locadCtl
def locadCtl(self, *args):
"""
"""
ctls = cmds.ls(sl=True, fl =1, type = 'transform')
tx = cmds.transformLimits(ctls[-1], tx = True, q = True)
ty = cmds.transformLimits(ctls[-1], ty = True, q = True)
tz = cmds.transformLimits(ctls[-1], tz = True, q = True)
rx = cmds.transformLimits(ctls[-1], rx = True, q = True)
ry = cmds.transformLimits(ctls[-1], ry = True, q = True)
rz = cmds.transformLimits(ctls[-1], rz = True, q = True)
cmds.floatField(self.txMinFloatField, e = True, v = tx[0])
cmds.floatField(self.txMaxFloatField, e = True, v = tx[1])
cmds.floatField(self.tyMinFloatField, e = True, v = ty[0])
cmds.floatField(self.tyMaxFloatField, e = True, v = ty[1])
cmds.floatField(self.tzMinFloatField, e = True, v = tz[0])
cmds.floatField(self.tzMaxFloatField, e = True, v = tz[1])
cmds.floatField(self.rxMinFloatField, e = True, v = rx[0])
cmds.floatField(self.rxMaxFloatField, e = True, v = rx[1])
cmds.floatField(self.ryMinFloatField, e = True, v = ry[0])
cmds.floatField(self.ryMaxFloatField, e = True, v = ry[1])
cmds.floatField(self.rzMinFloatField, e = True, v = rz[0])
cmds.floatField(self.rzMaxFloatField, e = True, v = rz[1])
开发者ID:darkuress,项目名称:arFace,代码行数:24,代码来源:RangeToolUI.py
示例18: mirrorControlShape
def mirrorControlShape(typ, source, targent, flipAxis):
if len(typ) == 0:return
if source not in 'LR':return
if source == targent:return
#- get source side controls
all_controls = ' '.join(mc.listRelatives(mc.ls(type='nurbsCurve'), p=True, path=True))
matched_controls = re.findall('\S*%s_\w+_%s_\d+'%(source, typ), all_controls)
for ctl in matched_controls:
#- get targent control
targentControl = re.sub('%s_'%source, '%s_'%targent, ctl)
if not mc.objExists(targentControl):continue
#- duplicate shape
tempx = mc.duplicate(ctl, po=True)
mc.parent(mc.listRelatives(ctl, s=True, path=True), tempx, s=True, add=True)
#- make Temp
Temp = pymel.core.PyNode(mc.duplicate(tempx, rc=True)[0])
for a in 'trs':
for b in 'xyz':
attr = a + b
mc.setAttr('%s.%s'%(Temp, attr), l=False, k=True, cb=False)
#- close max min value controler
mc.transformLimits(Temp.name(), etx=(0, 0),ety=(0, 0),etz=(0, 0),erx=(0, 0),ery=(0, 0),erz=(0, 0))
mc.parent(Temp.name(), w=True)
#- filp
grp = mc.createNode('transform')
sourcePosi = mc.xform(ctl, q=True, ws=True, rp=True)
targenPosi = mc.xform(targentControl, q=True, ws=True, rp=True)
midPoint = [(sourcePosi[0] + targenPosi[0]) / 2,
(sourcePosi[0] + targenPosi[0]) / 2,
(sourcePosi[0] + targenPosi[0]) / 2]
mc.move(midPoint[0], midPoint[1], midPoint[2], grp, a=True)
mc.parent(Temp.name(), grp)
mc.setAttr('%s.s%s'%(grp, flipAxis.lower()), -1)
#- freeze transformations
mc.parent(Temp.name(), targentControl)
mc.makeIdentity(Temp.name(), apply=True, t=True, r=True, s=True)
#- get original shapes
originalShapes = mc.listRelatives(targentControl, s=True, path=True, type='nurbsCurve')
#- parent new shapes
shapes = mc.listRelatives(Temp.name(), s=True, path=True, type='nurbsCurve')
for shp in shapes:
mc.setAttr('%s.ovc'%shp, mc.getAttr('%s.ovc'%originalShapes[0]))
mc.delete(originalShapes)
mc.parent(shapes, targentControl, s=True, r=True)
for shp in shapes:
mc.rename(shp, '%sShape'%targentControl)
#- delete temp
mc.delete(tempx, Temp.name(), grp)
开发者ID:zclongpop123,项目名称:MPToolkit,代码行数:63,代码来源:mirrorCtlShp.py
示例19: build
def build(self):
FKIKCtl = '%s_legFrontFkIk_ctl_%s' % (self.locus,self.count)
IKCtl = '%s_legFrontIk_ctl_%s' % (self.locus,self.count)
footBallPivot = '%s_footPivotBallLegFrontIk_org_%s' % (self.locus,self.count)
footRoll = '%s_footRollLegFrontIk_org_%s' % (self.locus,self.count)
ballIkCtl = '%s_legFrontBallIk_ctl_%s' % (self.locus,self.count)
# add attrs
cmds.addAttr(FKIKCtl,ln='feetControls',at='double',min=0,max=1,dv=1)
cmds.setAttr('%s.feetControls' % FKIKCtl,e=True,k=True)
cmds.addAttr(FKIKCtl,ln='swivel',at='double',dv=0)
cmds.setAttr('%s.swivel' % FKIKCtl,e=True,k=True)
cmds.addAttr(FKIKCtl,ln='toeRoll',at='double',dv=0)
cmds.setAttr('%s.toeRoll' % FKIKCtl,e=True,k=True)
cmds.addAttr(FKIKCtl,ln='toeSwivel',at='double',dv=0)
cmds.setAttr('%s.toeSwivel' % FKIKCtl,e=True,k=True)
cmds.addAttr(FKIKCtl,ln='toeTwist',at='double',dv=0)
cmds.setAttr('%s.toeTwist' % FKIKCtl,e=True,k=True)
cmds.addAttr(FKIKCtl,ln='heelBank',at='double',dv=0)
cmds.setAttr('%s.heelBank' % FKIKCtl,e=True,k=True)
cmds.addAttr(FKIKCtl,ln='heelSwivel',at='double',dv=0)
cmds.setAttr('%s.heelSwivel' % FKIKCtl,e=True,k=True)
negate = 1
if self.locus == 'L':
negate = -1
elif self.locus == 'C':
# fix the outer and inner foot bind joints if the foot is centered
cmds.rename('L_%sInnerfoot_bnd_%s' % (self.namespace,self.count),'C_%sInnerfoot_bnd_%s' % (self.namespace,self.count))
cmds.rename('R_%sOuterfoot_bnd_%s' % (self.namespace,self.count),'C_%sOuterfoot_bnd_%s' % (self.namespace,self.count))
# constrain to the rig
cmds.connectAttr('C_main_loc_0Shape.worldPosition','%s_%s_mod_%s.translate' % (self.locus,self.namespace,self.count))
cmds.orientConstraint('C_main_loc_0','%s_%s_mod_%s' % (self.locus,self.namespace,self.count),mo=True)
cmds.parentConstraint('%s_%sFoot_bnd_%s' % (self.locus,self.namespace,self.count),'%s_%sFKIK_org_%s' % (self.locus,self.namespace,self.count),mo=True)
cmds.parentConstraint('C_chest_bnd_0','%s_%sCtl_org_%s' % (self.locus,self.namespace,self.count),mo=True)
# connect fkikctl attrs to ik foot ctl attrs
cmds.connectAttr('%s.swivel' % FKIKCtl,'%s.swivel' % IKCtl)
cmds.setAttr('%s.swivel' % IKCtl,l=True,k=False)
cmds.setAttr('%s.toe' % IKCtl,l=True,k=False)
cmds.setAttr('%s.rollAngle' % IKCtl,l=True,k=False)
# add control to IK feet controls to hide other controls
cmds.connectAttr('%s.feetControls' % FKIKCtl,'%s_legFrontToeIk_ctl_%sShape.v' % (self.locus,self.count))
cmds.connectAttr('%s.feetControls' % FKIKCtl,'%s_legFrontHeelIk_ctl_%sShape.v' % (self.locus,self.count))
# add follow to ik feet controls
cmds.addAttr(IKCtl,ln='follow',at='double',min=0,max=1,dv=0)
cmds.setAttr('%s.follow' % IKCtl,e=True,k=True)
pConst = cmds.parentConstraint('%s_%sIK_org_%s' % (self.locus,self.namespace,self.count),'C_root_bnd_0','%s_legFrontIk_org_%s' % (self.locus,self.count),mo=True)[0]
rev = cmds.createNode('reverse')
cmds.connectAttr('%s.follow' % IKCtl,'%s.C_root_bnd_0W1' % pConst)
cmds.connectAttr('%s.follow' % IKCtl,'%s.inputX' % rev)
cmds.connectAttr('%s.outputX' % rev,'%s.%s_%sIK_org_%sW0' % (pConst,self.locus,self.namespace,self.count))
cmds.setAttr('%s.interpType' % pConst, 2)
# reconnect foot roll
cmds.parent(footBallPivot, '%s_legFrontBallIk_cth_%s' % (self.locus,self.count))
cmds.setAttr('%s.roll' % IKCtl,l=True,cb=False,k=False)
cmds.connectAttr('%s.swivel' % IKCtl,'%s_legFrontToeIk_cth_%s.ry' % (self.locus,self.count))
# add foot bank
off = cmds.group(em=True,n='%s_%sFootBankInIk_off_%s' % (self.locus,self.namespace,self.count))
inn = cmds.group(em=True,n='%s_%sFootBankInIk_org_%s' % (self.locus,self.namespace,self.count))
cmds.delete(cmds.parentConstraint('%s_%sInnerfoot_bnd_%s' % (self.locus,self.namespace,self.count),inn,mo=False))
cmds.delete(cmds.parentConstraint('%s_%sInnerfoot_bnd_%s' % (self.locus,self.namespace,self.count),off,mo=False))
out = cmds.group(em=True,n='%s_%sFootBankOutIk_org_%s' % (self.locus,self.namespace,self.count))
cmds.delete(cmds.parentConstraint('%s_%sOuterfoot_bnd_%s' % (self.locus,self.namespace,self.count),out,mo=False))
cmds.parent(off,IKCtl)
cmds.parent(inn,off)
cmds.parent(out,inn)
cmds.parent(footRoll,out)
cmds.setAttr('%s.rz' % ballIkCtl,l=False,k=True)
cmds.transformLimits(ballIkCtl,erz=[0,0])
cond = cmds.createNode('condition')
mult = cmds.createNode('multiplyDivide')
cmds.connectAttr('%s.rz' % ballIkCtl,'%s.firstTerm' % cond)
cmds.connectAttr('%s.rz' % ballIkCtl,'%s.colorIfTrueR' % cond)
if self.locus == 'R': cmds.setAttr('%s.operation' % cond,2)
else: cmds.setAttr('%s.operation' % cond,4)
cmds.setAttr('%s.colorIfFalseR' % cond,0)
cmds.setAttr('%s.input2X' % mult,negate)
cmds.connectAttr('%s.outColorR' % cond,'%s.input1X' % mult)
cmds.connectAttr('%s.outputX' % mult,'%s.rx' % out)
cond = cmds.createNode('condition')
mult = cmds.createNode('multiplyDivide')
cmds.connectAttr('%s.rz' % ballIkCtl,'%s.firstTerm' % cond)
cmds.connectAttr('%s.rz' % ballIkCtl,'%s.colorIfTrueR' % cond)
if self.locus == 'R': cmds.setAttr('%s.operation' % cond,4)
else: cmds.setAttr('%s.operation' % cond,2)
cmds.setAttr('%s.colorIfFalseR' % cond,0)
#.........这里部分代码省略.........
开发者ID:timm-gitHub,项目名称:fbRepo,代码行数:101,代码来源:foreleg_postbuild_v001.py
示例20: setTranslateLimits
def setTranslateLimits(ctrl,tx=[],ty=[],tz=[]):
'''
'''
if(tx): mc.transformLimits(ctrl,tx=(tx[0],tx[1]),etx=(1,1))
if(ty): mc.transformLimits(ctrl,ty=(ty[0],ty[1]),ety=(1,1))
if(tz): mc.transformLimits(ctrl,tz=(tz[0],tz[1]),etz=(1,1))
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:6,代码来源:control.py
注:本文中的maya.cmds.transformLimits函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论