本文整理汇总了Python中maya.cmds.createNode函数的典型用法代码示例。如果您正苦于以下问题:Python createNode函数的具体用法?Python createNode怎么用?Python createNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createNode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: aimObjectConnect
def aimObjectConnect( targets ):
for i in range( len( targets ) -1 ):
first = targets[i]
second = targets[i+1]
grp = cmds.createNode( 'transform', n=second+'_aimObj_GRP' )
trg = cmds.createNode( 'transform', n=second+'_aimObj' )
cmds.parent( trg, grp )
constraint( first, grp )
localMtx = cmds.createNode( 'multMatrixDecompose', n=second+'_localMtx' )
fbfMtx = cmds.createNode( 'fourByFourMatrix', n=second+'_fbfMtx' )
shdOrt = cmds.createNode( 'shoulderOrient', n=second+'_shdOrt' )
cmds.connectAttr( second+'.wm', localMtx+'.i[0]' )
cmds.connectAttr( first+'.wim', localMtx+'.i[1]' )
cmds.connectAttr( localMtx+'.otx', fbfMtx+'.i00' )
cmds.connectAttr( localMtx+'.oty', fbfMtx+'.i01' )
cmds.connectAttr( localMtx+'.otz', fbfMtx+'.i02' )
cmds.connectAttr( fbfMtx+'.output', shdOrt+'.inputMatrix' )
cmds.connectAttr( shdOrt+'.outAngleX', trg+'.rx' )
cmds.connectAttr( shdOrt+'.outAngleY', trg+'.ry' )
cmds.connectAttr( shdOrt+'.outAngleZ', trg+'.rz' )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:25,代码来源:cmdModel.py
示例2: createSplineCurveInfo
def createSplineCurveInfo( curve, number, **options ):
crvShape = cmds.listRelatives( curve, s=1 )
if not crvShape: return None
crvShape = crvShape[0]
splineNode = cmds.createNode( 'splineCurveInfo', n=curve+'_spline' )
cmds.connectAttr( crvShape+'.local', splineNode+'.inputCurve' )
if number <= 1:
return None
elif number > 1:
eachRate = 1.0/(number-1)
for i in range( number ):
cmds.setAttr( splineNode+'.parameter[%d]' % i, eachRate*i+0.001 )
for i in range( number-1 ):
trNode = cmds.createNode( 'transform' )
cmds.connectAttr( splineNode+'.output[%d].position' % i, trNode+'.t' )
cmds.connectAttr( splineNode+'.output[%d].rotate' % i, trNode+'.r' )
cmds.parent( trNode, curve )
cmds.setAttr( trNode+'.dh', 1 )
cmds.setAttr( trNode+'.dla', 1 )
return splineNode
开发者ID:jonntd,项目名称:mayadev-1,代码行数:25,代码来源:sgRigSpline.py
示例3: create_line_from_2_obj
def create_line_from_2_obj(self, obja, objb, crv_name='_curve_CRV'):
'''
Desc:
Make a line between 2 objects
Parameter:
crv_name = name of curve
pta = first object
ptb = second object
Return: Curve name
'''
# Define generic curve
curve=cmds.curve(d=1, p=[(0,0,0),(0,0,0)], k=[0,1], n=crv_name)
cmds.setAttr(curve+'.overrideEnabled',1)
cmds.setAttr(curve+'.overrideColor', 13)
# Making connection in worldSpace using decomposeMatrix
dMa=cmds.createNode('decomposeMatrix', n='_DMAT')
dMb=cmds.createNode('decomposeMatrix', n='_DMAT')
# Connect control worldMatrix to decomposeMatrix.inputMatrix
KstMaya.node_op(obja+'.worldMatrix','>>', dMa+'.inputMatrix')
KstMaya.node_op(dMa+'.outputTranslate','>>',curve+'.controlPoints[0]')
KstMaya.node_op(objb+'.worldMatrix','>>', dMb+'.inputMatrix')
KstMaya.node_op(dMb+'.outputTranslate','>>',curve+'.controlPoints[1]')
return curve
开发者ID:Leopardob,项目名称:Kistie,代码行数:28,代码来源:KstRig.py
示例4: neckMiddleCtlSet
def neckMiddleCtlSet(self):
self.neckMiddleCtl = rigbase.Controler( n='NeckMiddle_CTL' )
self.neckMiddleCtl.setShape( normal=[0,1,0], radius = .5 )
self.neckMiddleCtl.setColor( 29 )
self.middlePoint1 = rigbase.Transform( n='NeckMiddle_spline_Point1' )
self.middlePoint2 = rigbase.Transform( n='NeckMiddle_spline_Point2' )
self.middlePoint1.setParent( self.neckMiddleCtl )
self.middlePoint2.setParent( self.neckMiddleCtl )
rigbase.transformDefault( self.middlePoint1, self.middlePoint2 )
midPnt1Dist= cmds.createNode( 'distanceBetween', n='NeckMiddle_spPnt1_dist' )
midPnt2Dist = cmds.createNode( 'distanceBetween', n='NeckMiddle_spPnt2_dist' )
midMult1Dist = cmds.createNode( 'multDoubleLinear', n='NeckMiddle_md1' )
midMult2Dist = cmds.createNode( 'multDoubleLinear', n='NeckMiddle_md2' )
cmds.setAttr( midMult1Dist+'.input2', -.4 )
cmds.setAttr( midMult2Dist+'.input2', .4 )
cmds.connectAttr( self.neckMiddleInit+'.m', midPnt1Dist+'.inMatrix1' )
cmds.connectAttr( self.headInit+'.m', midPnt2Dist+'.inMatrix2' )
cmds.connectAttr( midPnt1Dist+'.distance', midMult1Dist+'.input1' )
cmds.connectAttr( midPnt2Dist+'.distance', midMult2Dist+'.input1' )
cmds.connectAttr( midMult1Dist+'.output', self.middlePoint1+'.ty' )
cmds.connectAttr( midMult2Dist+'.output', self.middlePoint2+'.ty' )
attrEdit = rigbase.AttrEdit( self.neckMiddleCtl.name )
attrEdit.lockAndHideAttrs( 'sx','sy','sz','v' )
self.rigInstance.neckMiddleCtl = self.neckMiddleCtl.name
开发者ID:jonntd,项目名称:mayadev-1,代码行数:31,代码来源:headrigset.py
示例5: perform
def perform(**kwargs):
sel = cmds.ls(sl=True)
sel3=[]
for s in sel:
sel3+=cmds.xform(s,q=True, ws=True, t=True)
pointset=[]
for i in xrange(len(sel3)/3):
pointset+=[Vector(sel3[i*3],sel3[i*3+1],sel3[i*3+2])]
bbox = BBox()
bbox.obbFromPointSet(pointset)
t = Transform(bbox.axis[0],bbox.axis[1],bbox.axis[2])
t = t.transpose()
z = t.getEuler()
cube = cmds.createNode("polyCube")
cubeShape = cmds.createNode("mesh")
cubeTrans = cmds.listRelatives(cubeShape,p=True)[0]
cmds.connectAttr(cube+".output",cubeShape+".inMesh")
cmds.setAttr(cubeTrans+".tx",bbox.center[0])
cmds.setAttr(cubeTrans+".ty",bbox.center[1])
cmds.setAttr(cubeTrans+".tz",bbox.center[2])
cmds.setAttr(cubeTrans+".rz",degrees(z[2]))
cmds.setAttr(cubeTrans+".ry",degrees(z[1]))
cmds.setAttr(cubeTrans+".rx",degrees(z[0]))
cmds.setAttr(cube+".width",bbox.max[0]-bbox.min[0])
cmds.setAttr(cube+".height",bbox.max[1]-bbox.min[1])
cmds.setAttr(cube+".depth",bbox.max[2]-bbox.min[2])
cmds.sets(e=True,forceElement="initialShadingGroup")
cmds.select(sel)
开发者ID:ainaerco,项目名称:meshTools,代码行数:28,代码来源:obb.py
示例6: getRetargetNode_for
def getRetargetNode_for( self, target ):
retargetBlenderCons = cmds.listConnections( target, s=1, d=0, type='retargetBlender' )
if not retargetBlenderCons:
retargetBlender = cmds.createNode( 'retargetBlender', n= target+'_retargetBlender' )
sourceName = target.replace( self._targetNS, self._sourceNS )
retargetNode = cmds.createNode( 'retargetTransNode', n= sourceName+'_RTTrans' )
self.blenderToControl( retargetBlender, target )
if cmds.nodeType( target ) == 'joint':
fnc.tryConnect( target+'.jo', retargetBlender+'.orient' )
cmds.connectAttr( retargetNode+'.transMatrix', retargetBlender+'.input[0].transMatrix' )
else:
retargetBlender = retargetBlenderCons[0]
fnc.clearArrayElement( retargetBlender+'.input' )
cuIndex = fnc.getLastIndex( retargetBlender+'.input' )
if cuIndex == -1: cuIndex = 0
retargetTransCons = cmds.listConnections( retargetBlender+'.input[%d].transMatrix ' % cuIndex )
if retargetTransCons: cuIndex += 1
sourceName = target.replace( self._targetNS, self._sourceNS )
retargetNode = cmds.createNode( 'retargetTransNode', n= sourceName+'_RTTrans' )
cmds.connectAttr( retargetNode+'.transMatrix', retargetBlender+'.input[%d].transMatrix' % cuIndex )
return retargetNode
开发者ID:jonntd,项目名称:mayadev-1,代码行数:33,代码来源:getItems.py
示例7: ik_stretch
def ik_stretch(ikhnd):
'''
'''
jts = cmds.ikHandle(ikhnd, q=True, jl=True)
cu_s = cmds.ikHandle(ikhnd, q=True, c=True)
cu = cmds.listRelatives(cu_s, p=1)[0]
cmds.addAttr(ikhnd, longName='ik_stretch', k=1, defaultValue=1.0, minValue=0.0, maxValue=1.)
dcu = cmds.duplicate(cu, n=cu + '_base_scale')[0]
dcu_s = cmds.listRelatives(dcu, c=1)[0]
cf = cmds.createNode('curveInfo')
dcf = cmds.createNode('curveInfo')
bl = cmds.createNode('blendTwoAttr')
md = cmds.createNode('multiplyDivide')
cmds.connectAttr(cu_s + '.worldSpace', cf + '.inputCurve')
cmds.connectAttr(dcu_s + '.worldSpace', dcf + '.inputCurve')
cmds.connectAttr(dcf + '.arcLength', bl + '.input[0]')
cmds.connectAttr(cf + '.arcLength', bl + '.input[1]')
cmds.connectAttr(ikhnd + '.ik_stretch', bl + '.attributesBlender')
cmds.connectAttr(bl + '.output', md + '.input1X')
cmds.setAttr(md + '.input2X', cmds.getAttr(cf + '.arcLength'), l=1)
cmds.setAttr(md + '.operation', 2)
cmds.setAttr(dcu + '.v', 0)
for j in jts:
cmds.connectAttr(md + '.outputX', j + '.sx')
return dcu
开发者ID:Italic-,项目名称:maya-prefs,代码行数:32,代码来源:variableKinematics.py
示例8: addAngleDriverAttribute
def addAngleDriverAttribute( sel ):
import sgBFunction_attribute
sgBFunction_attribute.addAttr( sel, ln='angleRate0', cb=1 )
sgBFunction_attribute.addAttr( sel, ln='angleRate1', cb=1 )
sgBFunction_attribute.addAttr( sel, ln='angleRate2', cb=1 )
if cmds.listConnections( sel, s=1, d=0, type='angleDriver' ): return None
selP = cmds.listRelatives( sel, p=1, f=1 )[0]
selName = sel.split( '|' )[-1]
targetDriver = cmds.createNode( 'angleDriver', n= 'angleDriver_' + selName )
mm = cmds.createNode( 'multMatrix', n='mm_' + selName )
base = cmds.createNode( 'transform', n= 'angleBase_' + selName )
base = cmds.parent( base, selP )[0]
cmds.xform( base, ws=1, matrix= cmds.getAttr( sel+'.wm' ) )
cmds.connectAttr( sel+'.wm', mm+'.i[0]' )
cmds.connectAttr( base+'.wim', mm+'.i[1]' )
cmds.connectAttr( mm+'.matrixSum', targetDriver+'.angleMatrix' )
sgBFunction_attribute.addAttr( sel, ln='angleRate0', cb=1 )
sgBFunction_attribute.addAttr( sel, ln='angleRate1', cb=1 )
sgBFunction_attribute.addAttr( sel, ln='angleRate2', cb=1 )
if not cmds.isConnected( targetDriver+'.outDriver0', sel+'.angleRate0' ):
cmds.connectAttr( targetDriver+'.outDriver0', sel+'.angleRate0' )
if not cmds.isConnected( targetDriver+'.outDriver1', sel+'.angleRate1' ):
cmds.connectAttr( targetDriver+'.outDriver1', sel+'.angleRate1' )
if not cmds.isConnected( targetDriver+'.outDriver2', sel+'.angleRate2' ):
cmds.connectAttr( targetDriver+'.outDriver2', sel+'.angleRate2' )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:34,代码来源:sgBFunction_rigObject.py
示例9: addModification
def addModification( meshObjs ):
import sgBFunction_attribute
import sgBFunction_dag
meshObjs = sgBFunction_dag.getChildrenMeshExists( meshObjs )
softMod = cmds.deformer( meshObjs, type='softMod' )[0]
ctlGrp = cmds.createNode( 'transform' )
cmds.setAttr( ctlGrp+'.dh', 1 )
dcmp = cmds.createNode( 'decomposeMatrix' )
ctl = cmds.sphere()[0]
ctl = cmds.parent( ctl, ctlGrp )[0]
sgBFunction_attribute.addAttr( ctl, ln='__________', at='enum', enumName = ':Modify Attr', cb=1 )
sgBFunction_attribute.addAttr( ctl, ln='falloffRadius', min=0, dv=1, k=1 )
sgBFunction_attribute.addAttr( ctl, ln='envelope', min=0, max=1, dv=1, k=1 )
cmds.connectAttr( ctlGrp+'.wim', softMod+'.bindPreMatrix' )
cmds.connectAttr( ctlGrp+'.wm', softMod+'.preMatrix' )
cmds.connectAttr( ctl+'.wm', softMod+'.matrix' )
cmds.connectAttr( ctl+'.m', softMod+'.weightedMatrix' )
cmds.connectAttr( ctlGrp+'.wm', dcmp+'.imat' )
cmds.connectAttr( dcmp+'.ot', softMod+'.falloffCenter' )
for i in range( len( meshObjs ) ):
cmds.connectAttr( meshObjs[i]+'.wm', softMod+'.geomMatrix[%d]' % i )
cmds.connectAttr( ctl+'.envelope', softMod+'.envelope' )
cmds.connectAttr( ctl+'.falloffRadius', softMod+'.falloffRadius' )
cmds.xform( ctlGrp, ws=1, t=cmds.getAttr( meshObjs[0]+'.wm' )[-4:-1] )
cmds.select( ctlGrp )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:33,代码来源:sgBFunction_rigObject.py
示例10: createAimObjectCmd
def createAimObjectCmd( first, second, third, worldPosition=False ):
aimObjectMatrix = cmds.createNode( 'aimObjectMatrix' )
cmds.connectAttr( first+'.wm', aimObjectMatrix+'.targetMatrix' )
cmds.connectAttr( second+'.wm', aimObjectMatrix+'.baseMatrix' )
if third:
aimObject = third
else:
aimObject = cmds.createNode( 'transform' )
if cmds.nodeType( aimObject ) == 'joint':
try: cmds.setAttr( aimObject+'.jo', 0,0,0 )
except:pass
cmds.connectAttr( aimObjectMatrix+'.outRotate', aimObject+'.r' )
if not third: cmds.parent( aimObject, second )
cmds.setAttr( aimObject+'.t', 0,0,0 )
if worldPosition:
cmds.setAttr( aimObjectMatrix+'.worldSpaceOutput', 1 )
cmds.connectAttr( aimObject+'.pim', aimObjectMatrix+'.parentInverseMatrix' )
cmds.connectAttr( aimObjectMatrix+'.outTranslate', aimObject+'.t' )
cmds.parent( aimObject, w=1 )
return aimObject, aimObjectMatrix
开发者ID:jonntd,项目名称:mayadev-1,代码行数:26,代码来源:sgBFunction_rigObject.py
示例11: getWristAngleNode
def getWristAngleNode( target, targetBase=None ):
wristAngleCons = cmds.listConnections( target+'.m', s=0, d=1, type='wristAngle' )
wristAngleNode = ''
if not wristAngleCons:
mmCons = cmds.listConnections( target+'.wm', s=0, d=1, type='multMatrix' )
if mmCons:
wristAngleCons = cmds.listConnections( mmCons[0]+'.o', s=0, d=1, type='wristAngle' )
if wristAngleCons: wristAngleNode = wristAngleCons[0]
else:
wristAngleNode = wristAngleCons[0]
if wristAngleNode: return wristAngleNode
wa = cmds.createNode( 'wristAngle' )
if not targetBase:
targetBase = cmds.listRelatives( target, p=1, f=1 )[0]
cmds.connectAttr( target+'.m', wa+'.inputMatrix' )
else:
mm = cmds.createNode( 'multMatrix' )
cmds.connectAttr( target+'.wm', mm+'.i[0]' )
cmds.connectAttr( targetBase+'.wim', mm+'.i[1]' )
cmds.connectAttr( mm+'.o', wa+'.inputMatrix' )
cmds.select( wa )
return wa
开发者ID:jonntd,项目名称:mayadev-1,代码行数:26,代码来源:sgBFunction_rigObject.py
示例12: followMatrixConnection
def followMatrixConnection( ctl, others ):
import sgBFunction_attribute
ctlP = cmds.listRelatives( ctl, p=1 )[0]
followMatrix = cmds.createNode( 'followMatrix' )
mmdc = cmds.createNode( 'multMatrixDecompose' )
cmds.connectAttr( others[0]+'.wm', followMatrix+'.originalMatrix' )
sgBFunction_attribute.addAttr( ctl, ln='_______', at='enum', en='Parent:', cb=1 )
for other in others[1:]:
i = others.index( other ) - 1
cmds.connectAttr( other+'.wm', followMatrix+'.inputMatrix[%d]' % i )
attrName = 'parent' + other.split( '_' )[-1]
print other, attrName
sgBFunction_attribute.addAttr( ctl, ln= attrName, min=0, max=10, k=1 )
cmds.connectAttr( ctl+'.'+attrName, followMatrix+'.inputWeight[%d]' % i )
cmds.connectAttr( followMatrix+'.outputMatrix', mmdc+'.i[0]' )
cmds.connectAttr( ctlP+'.pim', mmdc+'.i[1]' )
cmds.connectAttr( mmdc+'.ot', ctlP+'.t' )
cmds.connectAttr( mmdc+'.or', ctlP+'.r' )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:25,代码来源:sgBFunction_rigObject.py
示例13: createWorldBlendTwoMatrixObject
def createWorldBlendTwoMatrixObject( first, second, target = None ):
import sgBFunction_attribute
blMtx = cmds.createNode( 'blendTwoMatrix' )
mmdc = cmds.createNode( 'multMatrixDecompose' )
cmds.connectAttr( first+'.wm', blMtx+'.inMatrix1' )
cmds.connectAttr( second+'.wm', blMtx+'.inMatrix2' )
cmds.connectAttr( blMtx+'.outMatrix', mmdc+'.i[0]' )
if not target: target = cmds.createNode( 'transform' )
cmds.connectAttr( target+'.pim', mmdc+'.i[1]' )
sgBFunction_attribute.addAttr( target, ln='blend', min=0, max=1, dv=0.5, k=1 )
cmds.connectAttr( target+'.blend', blMtx+'.attributeBlender' )
if not cmds.isConnected( mmdc+'.ot', target+'.t' ):
cmds.connectAttr( mmdc+'.ot', target+'.t', f=1 )
if not cmds.isConnected( mmdc+'.or', target+'.r' ):
cmds.connectAttr( mmdc+'.or', target+'.r', f=1 )
if not cmds.isConnected( mmdc+'.os', target+'.s' ):
cmds.connectAttr( mmdc+'.os', target+'.s', f=1 )
if not cmds.isConnected( mmdc+'.osh', target+'.sh' ):
cmds.connectAttr( mmdc+'.osh', target+'.sh', f=1 )
cmds.select( blMtx, target )
return blMtx, target
开发者ID:jonntd,项目名称:mayadev-1,代码行数:27,代码来源:sgBFunction_rigObject.py
示例14: chimaAddWingBsh
def chimaAddWingBsh() :
# Add wing blend shapes to bird character
cmd = 'file -import -type "mayaAscii" -rpr "geo_1" -options "v=0" -pr -loadReferenceDepth "all" "Y:/USERS/Peck/projs/chimaWingFold/geo_1.ma";'
mm.eval( cmd )
mc.select( 'wingFoldLFT_bsh' , r=True )
mc.select( 'wingFoldLFT_bsh' , add=True )
cmd = 'blendShape -e -t Eggbert_wings_geo 2 wingFoldLFT_bsh 1 -t Eggbert_wings_geo 3 wingFoldRGT_bsh 1 wings_bls;'
mm.eval( cmd )
rootCtrl = 'Pelvis_Ctrl'
mc.addAttr( rootCtrl , ln='L_wingFoldB' , k=True , min=0 , max=10 )
mc.addAttr( rootCtrl , ln='R_wingFoldB' , k=True , min=0 , max=10 )
lMdv = mc.createNode( 'multDoubleLinear' , n='wingFoldBBshLFT_mdv' )
mc.connectAttr( '%s.L_wingFoldB' % rootCtrl , '%s.i1' % lMdv )
mc.setAttr( '%s.i2' % lMdv , 0.1 )
mc.connectAttr( '%s.o' % lMdv , 'wings_bls.wingFoldLFT_bsh' )
rMdv = mc.createNode( 'multDoubleLinear' , n='wingFoldBBshRGT_mdv' )
mc.connectAttr( '%s.R_wingFoldB' % rootCtrl , '%s.i1' % rMdv )
mc.setAttr( '%s.i2' % rMdv , 0.1 )
mc.connectAttr( '%s.o' % rMdv , 'wings_bls.wingFoldRGT_bsh' )
mc.delete( 'wingFold_bsh' )
mc.delete( 'wingOrig_bsh' )
mc.delete( 'wingFoldLFT_bsh' )
mc.delete( 'wingFoldRGT_bsh' )
开发者ID:myCodeTD,项目名称:pkmel,代码行数:32,代码来源:pkTools.py
示例15: pfxHairScaleConnect
def pfxHairScaleConnect( ctl, hairSystemGrp ):
hairSystems = cmds.listRelatives( hairSystemGrp, c=1, ad=1, type='hairSystem' )
def getMultDoubleLinear( attr ):
multNodes = cmds.listConnections( attr, type='multDoubleLinear', s=1, d=0 )
if not multNodes:
multNode = cmds.createNode( 'multDoubleLinear' )
sgRigAttribute.addAttr( multNode, ln='clumpWidthMult', at='message' )
attrValue = cmds.getAttr( attr )
cmds.setAttr( multNode+'.input1', attrValue )
cmds.connectAttr( multNode+'.output', attr )
return multNode
else:
if not cmds.attributeQuery( 'clumpWidthMult', node=multNodes[0], ex=1 ):
multNode = cmds.createNode( 'multDoubleLinear' )
sgRigAttribute.addAttr( multNode, ln='clumpWidthMult', at='message' )
attrValue = cmds.getAttr( attr )
cmds.setAttr( multNode+'.input1', attrValue )
cmds.connectAttr( multNode+'.output', attr )
return multNode
else:
return multNodes[0]
for hairSystem in hairSystems:
dcmp = cmds.createNode( 'decomposeMatrix' )
multNode = cmds.createNode( 'multDoubleLinear' )
cmds.connectAttr( ctl+'.wm', dcmp+'.imat' )
cmds.connectAttr( dcmp+'.osx', multNode+'.input1' )
cmds.setAttr( multNode+'.input2', cmds.getAttr( hairSystem+'.clumpWidth' ) )
cmds.connectAttr( multNode+'.output', hairSystem+'.clumpWidth' )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:32,代码来源:p2014_06_jinro.py
示例16: createWristAngleJoints
def createWristAngleJoints( orientObject ):
import sgBFunction_dag
orientObjP = sgBFunction_dag.getParent( orientObject )
orientObjectName = orientObject.split( '|' )[-1]
if cmds.nodeType( orientObject ) == 'joint':
baseJointRad = cmds.getAttr( orientObject+'.radius' )
else:
baseJointRad = 1
cmds.select( orientObjP )
zJoint = cmds.joint( n = orientObjectName+'_waZ', radius = baseJointRad * 1.5 )
yJoint = cmds.joint( n = orientObjectName+'_waY', radius = baseJointRad * 2.0 )
xJoint = cmds.joint( n = orientObjectName+'_waX', radius = baseJointRad * 2.5 )
waz = cmds.createNode( 'wristAngle', n='WA_Z_' + orientObjectName )
way = cmds.createNode( 'wristAngle', n='WA_Y_' + orientObjectName )
wax = cmds.createNode( 'wristAngle', n='WA_X_' + orientObjectName )
cmds.connectAttr( orientObject+'.m', waz+'.inputMatrix' )
cmds.setAttr( waz+'.axis', 2 )
cmds.connectAttr( waz+'.outAngle', zJoint+'.rotateZ' )
mm = getMultMatrixAsParenting( orientObject, zJoint )
cmds.connectAttr( mm+'.o', way+'.inputMatrix' )
cmds.setAttr( way+'.axis', 1 )
cmds.connectAttr( way+'.outAngle', yJoint+'.rotateY' )
mm = getMultMatrixAsParenting( orientObject, yJoint )
cmds.connectAttr( mm+'.o', wax+'.inputMatrix' )
cmds.setAttr( wax+'.axis', 0 )
cmds.connectAttr( wax+'.outAngle', xJoint+'.rotateX' )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:34,代码来源:sgBFunction_rigObject.py
示例17: __init__
def __init__(self):
TopInfo.__init__(self)
node = self.getRetargetNode_for( self._target )
self.originRate = node+'.originalRate'
self.source = node+'.sourceMatrix'
self.sourceOrig = node+'.sourceOrigMatrix'
self.sourceParent = node+'.sourceParentMatrix'
self.targetOrig = node+'.targetOrigMatrix'
self.targetParent = node+'.targetParentMatrix'
self.distRate = node+'.distanceRate'
self.localData = [ node+'.localData[0].localMatrix', node+'.localData[0].localOffset' ]
if self._transDirect:
transDirect = cmds.createNode( "multMatrixDecompose", n= self._target+'_transDirect' )
invNode = cmds.createNode( 'inverseMatrix', n= self._target+'_transDirect_origInv' )
multNode = cmds.createNode( 'multiplyDivide', n=self._target+'_transDirect_mult' )
cmds.connectAttr( self.source, transDirect+'.i[0]' )
cmds.connectAttr( self.sourceOrig, invNode+'.inputMatrix' )
cmds.connectAttr( invNode+'.outputMatrix', transDirect+'.i[1]' )
cmds.connectAttr( transDirect+'.ot', multNode+'.input1' )
cmds.connectAttr( self.distRate, multNode+'.input2X' )
cmds.connectAttr( self.distRate, multNode+'.input2Y' )
cmds.connectAttr( self.distRate, multNode+'.input2Z' )
cmds.connectAttr( multNode+'.outputX', self._target+'.tx', f=1 )
cmds.connectAttr( multNode+'.outputY', self._target+'.ty', f=1 )
cmds.connectAttr( multNode+'.outputZ', self._target+'.tz', f=1 )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:30,代码来源:getItems.py
示例18: createLocalBlendTwoMatrixObject
def createLocalBlendTwoMatrixObject( first, second, target = None ):
import sgBFunction_attribute
blMtx = cmds.createNode( 'blendTwoMatrixDecompose' )
cmds.connectAttr( first+'.m', blMtx+'.inMatrix1' )
cmds.connectAttr( second+'.m', blMtx+'.inMatrix2' )
if not target: target = cmds.createNode( 'transform' )
sgBFunction_attribute.addAttr( target, ln='blend', min=0, max=1, dv=0.5, k=1 )
cmds.connectAttr( target+'.blend', blMtx+'.attributeBlender' )
if cmds.nodeType( target ) == 'joint':
try:cmds.setAttr( target+'.jo', 0,0,0 )
except:pass
if not cmds.isConnected( blMtx+'.ot', target+'.t' ):
cmds.connectAttr( blMtx+'.ot', target+'.t', f=1 )
if not cmds.isConnected( blMtx+'.or', target+'.r' ):
cmds.connectAttr( blMtx+'.or', target+'.r', f=1 )
if not cmds.isConnected( blMtx+'.os', target+'.s' ):
cmds.connectAttr( blMtx+'.os', target+'.s', f=1 )
if not cmds.isConnected( blMtx+'.osh', target+'.sh' ):
cmds.connectAttr( blMtx+'.osh', target+'.sh', f=1 )
cmds.select( blMtx, target )
return blMtx, target
开发者ID:jonntd,项目名称:mayadev-1,代码行数:28,代码来源:sgBFunction_rigObject.py
示例19: connection
def connection(vks, jt, jgroup):
"""
Establishes a connection between the vks control and one of the joints in the chain
"""
ucn_p = setup.onetenthNode(vks, 'position')
linstepA = cmds.createNode('setRange', n='setRangeA_%s' % jt)
cmds.setAttr('%s.minX' % linstepA, 1)
cmds.connectAttr('%s.parameter' % jt, '%s.valueX' % linstepA)
cmds.connectAttr('%s.maxPos' % vks, '%s.oldMaxX' % linstepA)
cmds.connectAttr('%s.output' % ucn_p, '%s.oldMinX' % linstepA)
linstepB = cmds.createNode('setRange', n='setRangeB_%s' % jt)
cmds.setAttr('%s.maxX' % linstepB, 1)
cmds.connectAttr('%s.parameter' % jt, '%s.valueX' % linstepB)
cmds.connectAttr('%s.minPos' % vks, '%s.oldMinX' % linstepB)
cmds.connectAttr('%s.output' % ucn_p, '%s.oldMaxX' % linstepB)
cond = cmds.createNode('condition', n='condition_%s' % jt)
cmds.setAttr('%s.operation' % cond, 2)
cmds.connectAttr('%s.parameter' % jt, '%s.firstTerm' % cond)
cmds.connectAttr('%s.output' % ucn_p, '%s.secondTerm' % cond)
cmds.connectAttr('%s.outValueX' % linstepA, '%s.colorIfTrueR' % cond)
cmds.connectAttr('%s.outValueX' % linstepB, '%s.colorIfFalseR' % cond)
mtp_r = cmds.createNode('multiplyDivide', n='multiplyRotate_%s' % jt)
cmds.connectAttr('%s.rotate' % vks, '%s.input1' % mtp_r)
cmds.connectAttr('%s.outColorR' % cond, '%s.input2X' % mtp_r)
cmds.connectAttr('%s.outColorR' % cond, '%s.input2Y' % mtp_r)
cmds.connectAttr('%s.outColorR' % cond, '%s.input2Z' % mtp_r)
cmds.connectAttr('%s.output' % mtp_r, '%s.rotate' % jgroup)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:31,代码来源:variableKinematics.py
示例20:
def postProcessControl ( _control, _function, _controlled ): # <<< string, string, list
lockHideAttributes ( _control )
if (cmds.objExists('anim_control_set') == False): cmds.createNode('objectSet',name='anim_control_set',skipSelect=True)
cmds.sets ( _control, addElement = 'anim_control_set' )
cmds.toggle ( localAxis = 1 )
if len ( _controlled ) == 0:
_control = cmds.rename ( '_' + _function + '_control' )
_control = cmds.group ( world = 1, name = '_' + _function + '_control_offSet' )
cmds.move ( 0, 0, 0, _control + '.rotatePivot', _control + '.scalePivot' )
lockHideAttributes ( _control )
else:
_k = _controlled[0].rfind ( '|' )
_control = _controlled[0][_k+1:]
cmds.rename ( _control + '_' + _function + '_control' )
_control = cmds.group ( world = 1, name = _control + '_' + _function + '_control_offSet' )
cmds.move ( 0, 0, 0, _control + '.rotatePivot', _control + '.scalePivot' )
lockHideAttributes ( _control )
cmds.select ( _controlled[0], toggle = True )
cmds.parent ()
cmds.xform ( translation = ( 0, 0, 0 ), rotation = ( 0, 0, 0 ) )
cmds.parent ( world = 1 )
cmds.pickWalk ( direction = "down" )
开发者ID:danielforgacs,项目名称:code-dump,代码行数:30,代码来源:ford_riggingAid.py
注:本文中的maya.cmds.createNode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论