本文整理汇总了Python中maya.cmds.joint函数的典型用法代码示例。如果您正苦于以下问题:Python joint函数的具体用法?Python joint怎么用?Python joint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了joint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _create_wrist
def _create_wrist(self):
"""Creates the special wrist setup for the 3 different rotation axes of
Dave's wrist.
@todo: change the constraining to the PLY GRP to something save
"""
hand = '%s_hand_result_%s' % (self.side, self.nc.joint)
hand_end = '%s_handEnd_result_%s' % (self.side, self.nc.joint)
fore_arm = '%s_foreArm_result_%s' % (self.side, self.nc.joint)
# joints
cmds.select(cl=True)
root_jnt = cmds.joint(n='%s_wristRoot_%s' % (self.side, self.nc.joint))
end_jnt = cmds.joint(n='%s_wristEnd_%s' % (self.side, self.nc.joint))
tmp_end_jnt = cmds.joint(n='%s_wristTmpEnd_%s' % (self.side, self.nc.joint))
self.c.snap_a_to_b(root_jnt, hand)
self.c.snap_a_to_b(end_jnt, hand_end)
self.c.snap_a_to_b(tmp_end_jnt, hand_end)
# orient joints properly
self.orient_joint(root_jnt)
cmds.delete(tmp_end_jnt)
cmds.parent(end_jnt, w=True)
# constrain joints
cmds.parentConstraint(hand, root_jnt, mo=True)
cmds.pointConstraint(root_jnt, end_jnt, mo=True)
cmds.orientConstraint(root_jnt, end_jnt, mo=True)
# constrain hand const group
cmds.parentConstraint('%s_wristRotZ_PLY_%s' % (self.side, self.nc.group),
'%s_hand_const_%s' % (self.side, self.nc.group), mo=True)
cmds.parent(root_jnt, end_jnt, '%s_hand_%s' % (self.side, self.nc.group))
开发者ID:jonntd,项目名称:Rigganator,代码行数:35,代码来源:robothand.py
示例2: confirmJoints
def confirmJoints(self):
"""
draw joints in locator position
"""
#- Getting Ball and Toe Location
self.leftHipPos = cmds.xform('l_hip_Adjust_ctl', q = True, ws = True, t = True)
self.leftKneePos = cmds.xform('l_knee_Adjust_ctl', q = True, ws = True, t = True)
self.leftAnklePos = cmds.xform('l_ankle_Adjust_ctl', q = True, ws = True, t = True)
self.leftBallPos = cmds.xform('l_ball_Adjust_ctl', q = True, ws = True, t = True)
self.leftToePos = cmds.xform('l_toe_Adjust_ctl', q = True, ws = True, t = True)
self.leftHeelPos = cmds.xform('l_heel_PivotPosition', q = True, ws = True, t = True)
self.leftSideInPos = cmds.xform('l_sidein_PivotPosition', q = True, ws = True, t = True)
self.leftSideOutPos = cmds.xform('l_sideout_PivotPosition', q = True, ws = True, t = True)
#duplicate pivots
cmds.duplicate('l_heel_PivotPosition', n = 'r_heel_PivotPosition', rr = True)
cmds.xform('r_heel_PivotPosition', t = [-self.leftHeelPos[0], self.leftHeelPos[1], self.leftHeelPos[2]])
cmds.duplicate('l_sidein_PivotPosition', n = 'r_sidein_PivotPosition', rr = True)
cmds.xform('r_sidein_PivotPosition', t = [-self.leftSideInPos[0], self.leftSideInPos[1], self.leftSideInPos[2]])
cmds.duplicate('l_sideout_PivotPosition', n = 'r_sideout_PivotPosition', rr = True)
cmds.xform('r_sideout_PivotPosition', t = [-self.leftSideOutPos[0], self.leftSideOutPos[1], self.leftSideOutPos[2]])
cmds.select(cl = True)
print 'leg Parts : ' , self.legParts
for elem in self.legElement :
jointPos = cmds.xform(self.left + elem + '_Adjust_ctl', t = True, q = True, ws = True)
cmds.joint(n = '%s%s_jnt' %(self.left, elem), p = jointPos)
#- orient joint
cmds.joint(self.lHipJnt, e = True, oj = 'xzy', secondaryAxisOrient = 'yup', ch = True, zso = True)
#- delete position locators
cmds.delete(self.legParts)
开发者ID:darkuress,项目名称:arNew,代码行数:34,代码来源:legSetup.py
示例3: build
def build(numBindJoints=6, numSpans=None, name='', numSkinJoints=3, width=None):
'''
builds a nurbs ribbon
If width is not specified, width will be set to numBindJoints
If numSpans is not specified, it will be set to numBindJoints
'''
if not width:
width = numBindJoints
if not numSpans:
numSpans = numBindJoints
main_grp = cmds.group(empty=1, name=(name + '_grp'))
plane = cmds.nurbsPlane(axis=(0, 1, 0), ch=0, lengthRatio=(1.0 / width), w=width, u=numSpans, name=(name + '_nurbsPlane'))[0]
cmds.parent(plane, main_grp)
# Creat Skin joints
skinJoints = []
skinJointPositions = common.pointsAlongVector( start=[width*.5, 0, 0], end=[width*-.5, 0, 0], divisions=(numSkinJoints-1) )
for index in range(len(skinJointPositions)):
cmds.select(main_grp)
j = cmds.joint(position = skinJointPositions[index], name=(name + '_' + str(index) + '_jnt'))
skinJoints.append(j)
# Add skinning to ribbon
cmds.skinCluster(skinJoints, plane, tsb=1, name=(plane + '_skinCluster'))
cmds.setAttr(plane+'.inheritsTransform', 0)
# Add follicles
for index in range(numBindJoints):
f = rivet.build( mesh=plane, paramU=(1.0 / (numBindJoints-1) * index), paramV=0.5, name=(name + '_' + str(index)))
cmds.parent(f, main_grp)
j = cmds.joint(name=(name + '_' + str(index) + '_bnd'))
开发者ID:duncanrudd,项目名称:rooftops,代码行数:33,代码来源:ribbon.py
示例4: 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
示例5: createJoints
def createJoints(prefix, lytObs, *args):
print "CreateJoints"
cmds.select(d=True)
ik_joints = []
for item in lytObs:
""" item[0] will be the joint
item[1] will be the position
item[2] will be the parent
"""
newJointName = item[0].replace("lyt_", prefix)
cmds.select(d=True)
if cmds.objExists(newJointName) == True:
cmds.delete(newJointName)
jnt = cmds.joint(p=item[1], n=newJointName )
ik_joints.append(jnt)
lytLen = len(lytObs)
for item in range(len(lytObs)):
if item != 0:
joint = lytObs[item][0].replace("lyt_", prefix)
jointParent = lytObs[item][2].replace("lyt_", prefix)
cmds.parent(joint, jointParent)
for jnt in ik_joints:
cmds.joint(jnt, e=True, oj='xyz', secondaryAxisOrient='yup', ch=True, zso=True)
return ik_joints
开发者ID:griffinanimator,项目名称:RG_TOOLS,代码行数:34,代码来源:Utils_Widget.py
示例6: createFromPointList
def createFromPointList(ptList, orient=False, side='cn', part='chain', suffix='jnt'):
"""
Create joint chain from a list of point positions
@param ptList: List of points to create joint chain from
@type ptList: list
@param orient: Orient joints
@type orient: bool
@param side: Joint side name prefix
@type side: str
@param part: Joint part name
@type part: str
@param suffix: Joint name suffix
@type suffix: str
"""
# Clear selection
cmds.select(cl=True)
# Create joint chain
jntList = []
for i in range(len(ptList)):
jnt = cmds.joint(p=ptList[i], n=side + '_' + part + str(i + 1) + '_' + suffix)
if i and orient: cmds.joint(jntList[-1], e=True, zso=True, oj='xyz', sao='yup')
jntList.append(jnt)
# Return result
return jntList
开发者ID:bennymuller,项目名称:glTools,代码行数:26,代码来源:joint.py
示例7: template_joints
def template_joints(joints=None, reorient_children=True, reset_orientation=True):
if joints is None:
joints = cmds.ls(sl=True, type='joint')
if not joints:
raise RuntimeError('No joint selected to orient.')
if reorient_children:
children = cmds.listRelatives(fullPath=True, allDescendents=True, type='joint')
joints.extend(children)
red, green, blue = create_shaders()
orient_group = cmds.createNode('transform', name=ORIENT_GROUP)
manips = []
for joint in joints:
if reset_orientation:
cmds.makeIdentity(joint, apply=True)
cmds.joint(joint, edit=True, orientJoint='xyz', secondaryAxisOrient='yup', children=False, zeroScaleOrient=True)
if not cmds.listRelatives(joint, children=True):
zero_orient([joint])
continue
group, manip = create_orient_manipulator(joint, blue)
manips.append(manip)
cmds.parent(group, orient_group)
cmds.parentConstraint(joint, group)
cmds.setAttr(joint + '.template', 1)
cmds.select(manips)
开发者ID:SplineO,项目名称:cmt,代码行数:27,代码来源:orientjoints.py
示例8: reorientJoints
def reorientJoints(_joints, _up=False, _upVec=(0, 0, 1), _aimVec=(1, 0, 0)):
for topJoint in _joints:
# Clean translations
cmds.joint(topJoint, edit=True, oj="xyz", sao="zup", ch=True, zso=True)
if _up:
# Clean rotations
reorientRecursive(topJoint, _up, _upVec, _aimVec)
开发者ID:jaredauty,项目名称:Rigging,代码行数:7,代码来源:RiggingControls.py
示例9: test_constrainLocators
def test_constrainLocators(self):
#--- Setup the scene
startJnt = cmds.joint(n='startJnt',p=(3, 0, 0))
endJnt = cmds.joint(n='endJnt',p=(3, 5, -2))
upObj = cmds.joint(n='upJnt',p=(4, 0, 0))
#--- Create the locators... tsk, tsk, external dependency, but why repo so much code here!?
result = self.rig._createLocators(name='test', start=startJnt, end=endJnt, startUpObj=upObj)
#--- Call method, get results
result = self.rig._constrainLocators(locators=result)
#--- Check Results
self.test.assertConstrained('test_btmLoc_pos','test_topLoc_aim',type='aim')
self.test.assertConstrained('test_topLoc_pos','test_btmLoc_aim',type='aim')
self.test.assertConstrained('test_topLoc_pos','test_midLoc_aim',type='aim')
self.test.assertConstrained('test_topLoc_pos','test_midLoc_pos',type='point')
self.test.assertConstrained('test_btmLoc_pos','test_midLoc_pos',type='point')
self.test.assertConstrained('test_topLoc_up','test_midLoc_up',type='point')
self.test.assertConstrained('test_btmLoc_up','test_midLoc_up',type='point')
btmPos = cmds.xform('test_btmLoc_up', q=1,ws=1, rp=1)
self.test.assertFloatListAlmostEqual(btmPos,[13,0,0])
# Twist the top
cmds.rotate(0,45,0,'test_topLoc_pos')
topPos = cmds.xform('test_topLoc_up', q=1,ws=1, rp=1)
midPos = cmds.xform('test_midLoc_up', q=1,ws=1, rp=1)
avgPos = [(topPos[0]+btmPos[0])/2.0, (topPos[1]+btmPos[1])/2.0, (topPos[2]+btmPos[2])/2.0]
self.test.assertListEqual(avgPos, midPos)
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:32,代码来源:test_RibbonRig.py
示例10: surfJnts
def surfJnts(name, pairL):
jntPairs = []
iks = []
j = 0
for pair in pairL:
jnts = []
i = 0
suff = ['_root', '_aim', '_up']
for point in pair:
cmds.select(point)
pos = cmds.xform(point, q=True, t=True, ws=True)
jnts.append(place.joint(0, name + str(j) + suff[i] + '_jnt', pad=2, rpQuery=False)[0])
i = i + 1
j = j + 1
# parent ik joints
cmds.parent(jnts[1], jnts[0])
# orient ik joints
cmds.joint(jnts[0], e=True, oj='zyx', secondaryAxisOrient='yup')
jnt.ZeroJointOrient(jnts[1])
# orient up vector jnt
cmds.parent(jnts[2], jnts[0])
jnt.ZeroJointOrient(jnts[2])
cmds.parent(jnts[2], w=True)
# append pairs to list
jntPairs.append(jnts)
# ik
ikhndl = cmds.ikHandle(sj=jnts[0], ee=jnts[1], sol='ikRPsolver', sticky='sticky')[0]
cmds.setAttr(ikhndl + '.visibility', False)
cmds.poleVectorConstraint(jnts[2], ikhndl)
iks.append(ikhndl)
# cleanup
place.cleanUp(jnts[0], SknJnts=True)
place.cleanUp(jnts[2], SknJnts=True)
place.cleanUp(ikhndl, World=True)
return jntPairs, iks
开发者ID:boochos,项目名称:work,代码行数:35,代码来源:atom_reindeer_lib.py
示例11: lock_joints
def lock_joints(self, moduleInfo):
## clear selection
cmds.select(clear=True )
joints = moduleInfo[0]
jointPositions = moduleInfo[1]
jointOrientations = moduleInfo[2]
jointRotationOrders = moduleInfo[3]
jointPreferredAngles = moduleInfo[4]
cmds.delete(self.containerName)
index = 0
## creating joints this way because when you select a joint and create joint, it corrects orientation
for joint in joints:
jointName = joint
jointPos = jointPositions[index]
parentJoint = ''
childJoint = ''
if index > 0:
parentJoint = self.moduleName + ":" + self.jointInfo[index-1][0]
cmds.select(parentJoint, replace = True)
newJoint = cmds.joint(name = self.moduleName + ":" + self.jointInfo[index][0], position = jointPositions[index])
if index > 0:
cmds.joint(parentJoint, edit = True, orientJoint = "xyz", secondaryAxisOrient = "yup")
cmds.joint(newJoint, edit = True, orientation = jointOrientations[index])
index += 1
开发者ID:jeffhong21,项目名称:scripts,代码行数:33,代码来源:blueprint.py
示例12: MakeJntAndIKs
def MakeJntAndIKs(side):
"""
选择两圈眼球上的线,生成骨骼和ik,side的值例如:R_In or R_Out
ps: 选择骨骼链的子物体,打组,centerPivot,在原点生成一个骨点,用组约束骨点,正确命名,然后将IK组分别放到对应骨点下边。
"""
lx_start=mc.xform('loc_eyeCenter01',q=1,ws=1,t=1)
lx_mouthPnt= mc.filterExpand(sm=31)
mc.select (cl=1)
lx_Jnts=[]
lx_IKs = []
for i in lx_mouthPnt :
lx_end=mc.xform(i,q=1,ws=1,t=1)
lx_stJnt=mc.joint (n=("Jnt_"+side+"_st"),p=(lx_start[0],lx_start[1],lx_start[2]),radius=0.1)
lx_edJnt=mc.joint (n=("Jnt_"+side+"_ed"),p=(lx_end[0],lx_end[1],lx_end[2]),radius=0.1)
lx_scik =mc.ikHandle (n=("scik_"+side+str(01)),sj=lx_stJnt,ee=lx_edJnt,sol="ikSCsolver")
#mc.setAttr((str(lx_scik[0]) +".visibility") ,0)
mc.select(cl=1)
lx_Jnts.append(lx_stJnt)
lx_IKs .append(lx_scik[0])
mc.select(lx_Jnts,r=1)
mc.group(n=("grp_Jnts"+side))
mc.select(lx_IKs,r=1)
mc.group(n=("grp_iks"+side))
mc.setAttr((str("grp_iks"+side) +".visibility") ,0)
#3.选择眼皮曲线,执行脚本,生成
def MakeEyeLidJnts(cuvs):
开发者ID:auqeyjf,项目名称:pubTool,代码行数:28,代码来源:j_MakeFacial.py
示例13: _iterate_
def _iterate_(self):
self.call2_func = self.test2_func
_first = mc.joint(n = "first")
#_first = mc.createNode('transform',n = "first")
for i in range(self.int_targetCount):
self.progressBar_set(status = ("Pass 1: Substantiating Call %i"%i), progress = i, maxValue = self.int_targetCount)
mc.select(cl=True)
string = mc.joint(n = "baseobj_{0}".format(i))
if i:
for ii in (range(i)):
string = mc.joint(n = "obj_{0}".format(i))
#mc.parent(string,world = True)
#string = mc.createNode('network',n = "obj_{0}".format(i))
#string = mc.createNode('transform',n = "obj_{0}".format(i))
#string = mc.createNode('transform',n = "sameName".format(i))
#_group = mc.group(n = "obj_{0}".format(i), em=True)
#string = mc.parent(string,_group)[0]
t1 = time.clock()
self.test1_func(_first)
t2 = time.clock()
self.l_times_1.append(t2-t1)
t1 = time.clock()
#self.l_roots_2.extend( [self.test2_func(self._toCall)] )
self.call2_func(string)
t2 = time.clock()
self.l_times_2.append(t2-t1)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:27,代码来源:mayaBeOdd_r9ONLY.py
示例14: create_joints
def create_joints():
'''Subelements: vertecies, faces, edges should be selected'''
# Get selected object name
selection_list = cmds.ls(selection=True)
for selection in selection_list:
selected_object = selection.split('.')[0]
break
old_loc_list = cmds.ls('*LOC*', flatten=True)
#Create locators constrained to subelements
HZrivet.UI.HZrivet_finalCC()
current_loc_list = cmds.ls('*LOC*', flatten=True)
#Filter created locators
new_loc_list = [loc for loc in current_loc_list if loc not in old_loc_list]
# Get list of locators names and apply it as a prefix to a joint name
loc_list = [loc for loc in new_loc_list if 'Shape' not in loc]
root_joint = 'root'
if not cmds.objExists(root_joint):
cmds.select(clear=True)
cmds.joint(name=root_joint)
root_p_constraint = cmds.pointConstraint(selected_object, root_joint)
root_o_constraint = cmds.orientConstraint(selected_object, root_joint)
cmds.delete(root_p_constraint, root_o_constraint)
for loc in loc_list:
joint_prefix = re.sub("\D", "", loc)
joint_name = 'JNT_' + joint_prefix
cmds.select(clear=True)
cmds.joint(name=joint_name)
cmds.pointConstraint(loc, joint_name)
cmds.orientConstraint(loc, joint_name)
cmds.parent(joint_name, 'root')
开发者ID:AndreySibiryakov,项目名称:coding,代码行数:30,代码来源:create_joints.py
示例15: j_BodyFix
def j_BodyFix():
# Get The Goal Joint position
position = dict()
dupJnt = ['ShoulderPart2_L','Elbow_L','ElbowPart1_L','HipPart2_L','Knee_L','KneePart1_L']
for jnt in dupJnt:
position[jnt] =mc.xform(jnt,ws=1,t=1,q=1)
# Create Joint And Ikhandle From position
newJnt = []
na =1;
for j in dupJnt:
if mc.objExists(('Fix'+j)):
mc.select(('Fix'+j),r=1)
break;
newJnt.append(mc.joint(n=('Fix'+j),p=position[j],radius=1.75))
if na%3==0:
# Create IKHandle With ikRPsolver , Then Mirror With IkHandle
mc.joint(newJnt[0],e=1,zso=1,oj='xyz',sao='yup')
mc.joint(newJnt[1],e=1,zso=1,oj='xyz',sao='yup')
mc.setAttr('%s.jointOrient'%newJnt[2],0,0,0)
ikhand = mc.ikHandle(name=('rpik_'+newJnt[1]+'01'),sj=newJnt[0],ee=newJnt[2],sol = 'ikSCsolver')
mc.setAttr('%s.v'%ikhand[0],0)
# mirrorJoint -mirrorYZ -mirrorBehavior -searchReplace "_L" "_R";
mc.mirrorJoint(newJnt[0],mirrorYZ =1,mirrorBehavior =1,searchReplace=('_L','_R'))
mc.parent(ikhand[0],j)
mc.parent((re.sub('_L',"_R",ikhand[0])),(re.sub('_L','_R',j)))
mc.parent(newJnt[0],dupJnt[na-3])
mc.parent((re.sub("_L","_R",newJnt[0])),(re.sub('_L','_R',dupJnt[na-3])))
newJnt = []
mc.select(clear=1)
na=na+1;
开发者ID:auqeyjf,项目名称:pubTool,代码行数:31,代码来源:j_FixBody.py
示例16: test_setupHeirarchy
def test_setupHeirarchy(self):
#--- Setup the scene
startJnt = cmds.joint(n='startJnt',p=(3, 0, 0))
endJnt = cmds.joint(n='endJnt',p=(3, 5, -2))
locs = []
locs.append(cmds.spaceLocator(n='test_topLoc_pos', p=(0, 0, 1))[0])
locs.append(cmds.spaceLocator(n='test_midLoc_pos',p=(1, 2, 2))[0])
locs.append(cmds.spaceLocator(n='test_btmLoc_pos',p=(2, 4, 3))[0])
locGrp = cmds.group(em=True)
fGrp = cmds.group(em=True)
plane = cmds.nurbsPlane( w=1, lengthRatio=5, d=3, u=1, v=6, ax=[0, 0, 1])[0]
for each in locs:
cmds.parent(each,locGrp)
#--- Call method, get results
result = self.rig._setupHeirarchy(name='test', startObj=startJnt, endObj=endJnt,
locGrp=locGrp, plane=plane, follicleGrp=fGrp)
#--- Check Results
expectedTopNode = 'test_rbbnTopNode'
self.assertEqual(result, expectedTopNode)
self.assertTrue(cmds.objExists(expectedTopNode))
self.assertEqual(cmds.listRelatives(fGrp,parent=True)[0], expectedTopNode)
self.assertEqual(cmds.listRelatives(plane,parent=True)[0], expectedTopNode)
self.test.assertConstrained(startJnt,locs[2],type='parent')
self.test.assertConstrained(endJnt,locs[0],type='parent')
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:28,代码来源:test_RibbonRig.py
示例17: mmInsertJoint
def mmInsertJoint( *args ):
def normalize(vector_value):
length = math.sqrt(vector_value[0]**2 + vector_value[1]**2 + vector_value[2]**2)
x = vector_value[0]/length
y = vector_value[1]/length
z = vector_value[2]/length
result = [x, y, z]
return result
num_joints =input(10)
num_joints = num_joints+1
joint_list = cmds.ls(sl=True)
for r in joint_list:
first_joint_trans = cmds.xform(r, q=True, ws=True, t=True)
first_joint_ori = cmds.xform(r, q=True, ws=True, ro=True)
end_joint = cmds.listRelatives(r, f=True, c=True)
end_joint_rename=cmds.rename(end_joint[0], "end_to_delete______yeah")
end_joint_trans = cmds.xform(end_joint_rename, q=True, ws=True, t=True)
end_joint_ori = cmds.xform(end_joint_rename, q=True, ws=True, ro=True)
between_vector = [-(first_joint_trans[0]-end_joint_trans[0]),-(first_joint_trans[1]-end_joint_trans[1]),-(first_joint_trans[2]-end_joint_trans[2])]
vector_length = mel.eval(("mag(<<"+str(between_vector[0])+","+str(between_vector[1])+","+str(between_vector[2])+">>)"))
vector_normalize = normalize(between_vector)
for i in range(num_joints):
vector_to_add = [(vector_normalize[0]*((vector_length/num_joints)*((num_joints-float(i))))),(vector_normalize[1]*((vector_length/num_joints)*((num_joints-float(i))))),(vector_normalize[2]*((vector_length/num_joints)*((num_joints-float(i)))))]
inset_joint = cmds.insertJoint(r)
cmds.joint(inset_joint, e=True, co=True, o=(0,0,0), p=((first_joint_trans[0]+vector_to_add[0]), (first_joint_trans[1]+vector_to_add[1]), (first_joint_trans[2]+vector_to_add[2])))
cmds.delete(end_joint_rename)
开发者ID:jonntd,项目名称:mayadev-1,代码行数:32,代码来源:cmdModel.py
示例18: lip_setup
def lip_setup(upperLipCurve, lowerLipCurve, upperLocators, lowerLocators, lipUp):
upperLipCtrlCurve = utils.rebuild_to_ctrlCurve(upperLipCurve, spans=5, name='upperLipRCtrlCurve')
lowerLipCtrlCurve = utils.rebuild_to_ctrlCurve(lowerLipCurve, spans=5, name='lowerLipRCtrlCurve')
upperWireNode, upperWire, upperWireBase = utils.wire_deformer(upperLipCtrlCurve, upperLipCurve)
lowerWireNode, lowerWire, lowerWireBase = utils.wire_deformer(lowerLipCtrlCurve, lowerLipCurve)
upperWireMaster = utils.create_wires_master([upperWire, upperWireBase], name='upperLipRWireMaster_DELETE')
lowerWireMaster = utils.create_wires_master([lowerWire, lowerWireBase], name='lowerLipRWireMaster_DELETE')
#upperLocators = utils.create_locators_on_cv(upperLipCurve)
for loc in upperLocators :
utils.revit_locator_to_curve(loc, upperLipCurve)
cmds.tangentConstraint(upperLipCurve, loc, aimVector=[1,0,0], upVector=[0,1,0], worldUpType='object', worldUpObject=lipUp)
cmds.select(clear=True)
j = cmds.joint()
g = cmds.group(j)
pm.parentConstraint(loc, g, mo=False)
#lowerLocators = utils.create_locators_on_cv(lowerLipCurve)
for loc in lowerLocators :
utils.revit_locator_to_curve(loc, lowerLipCurve)
cmds.tangentConstraint(lowerLipCurve, loc, aimVector=[1,0,0], upVector=[0,1,0], worldUpType='object', worldUpObject=lipUp)
cmds.select(clear=True)
j = cmds.joint()
g = cmds.group(j)
pm.parentConstraint(loc, g, mo=False)
return upperLipCurve, lowerLipCurve, upperLipCtrlCurve, lowerLipCtrlCurve
开发者ID:adamfok,项目名称:afok_toolset,代码行数:30,代码来源:utils_mouth.py
示例19: create_guides
def create_guides(self):
"""Creates the guides.
Re-implemented to have the fingers separated.
"""
cmds.select(cl=True)
grp = cmds.group(n='%s_%s_%s_%s' % (self.side, self.modulename,
self.nc.guide, self.nc.group), empty=True)
for name, pos in self.guides.items():
if 'Base' in name:
cmds.select(grp, r=True)
# END if
jnt_name = '%s_%s_%s' % (self.side, name, self.nc.guide)
jnt = cmds.joint(p=pos, n=jnt_name)
if 'Base' in name and name != 'handBase':
base = '%s_%s_%s' % (self.side, 'handBase', self.nc.guide)
cmds.parent(jnt, base)
# END if
cmds.addAttr(jnt, ln='guideType', dt='string')
cmds.setAttr('%s.guideType' % jnt, e=True, keyable=True)
cmds.setAttr('%s.guideType' % jnt, 'guides', type='string')
# END for
cmds.select(grp, r=True)
for name, pos in self.additional_guides.items():
jnt_name = '%s_%s_%s' % (self.side, name, self.nc.guide)
jnt = cmds.joint(p=pos, n=jnt_name)
cmds.addAttr(jnt, ln='guideType', dt='string')
cmds.setAttr('%s.guideType' % jnt, e=True, keyable=True)
cmds.setAttr('%s.guideType' % jnt, 'additional_guides', type='string')
开发者ID:jonntd,项目名称:Rigganator,代码行数:29,代码来源:hand.py
示例20: autoRig
def autoRig(self,meshName):
height = self.getSizeY(meshName)
minPosY = height[1]
height = height[0]
width = self.getSizeX(meshName)
minPosX = width[1]
width = width[0]
bassinPoint = (minPosX + width * 0.0,minPosY + height * 0.48,self.getZ(minPosX + width * 0.0,minPosY + height * 0.48,meshName))
couPoint = (minPosX + width * 0.0,minPosY + height * 0.870,self.getZ(minPosX + width * 0.0,minPosY + height * 0.870,meshName))
epaulePoint = (minPosX + width * 0.129,minPosY + height * 0.825,self.getZ(minPosX + width * 0.129,minPosY + height * 0.825,meshName))
coudePoint = (minPosX + width * 0.315,minPosY + height * 0.825,self.getZ(minPosX + width * 0.315,minPosY + height * 0.825,meshName))
poignetPoint = (minPosX + width * 0.461,minPosY + height * 0.825,self.getZ(minPosX + width * 0.461,minPosY + height * 0.825,meshName))
jambePoint = (minPosX + width * 0.0955,minPosY + height * 0.4,self.getZ(minPosX + width * 0.0955,minPosY + height * 0.4,meshName))
genouPoint = (minPosX + width * 0.1,minPosY + height * 0.285,self.getZ(minPosX + width * 0.1,minPosY + height * 0.285,meshName))
piedPoint = (minPosX + width * 0.12,minPosY + height * 0.039 ,self.getZ(minPosX + width * 0.12,minPosY + height * 0.039,meshName))
cmds.select(clear=True)
cmds.joint(p=bassinPoint,name="bassinBase")
cmds.select("bassinBase")
rigList = [couPoint,epaulePoint,coudePoint,poignetPoint]
self.createListRig(rigList,"rigTop","bassinBase")
cmds.select("bassinBase")
rigList2 = [jambePoint,genouPoint,piedPoint]
self.createListRig(rigList2,"rigBot","bassinBase")
cmds.select("rigTop1")
cmds.mirrorJoint(mirrorYZ=True)
cmds.select("rigBot0")
cmds.mirrorJoint(mirrorYZ=True)
cmds.select("bassinBase")
cmds.select(meshName,tgl=True)
cmds.bindSkin()
开发者ID:LecomteEmerick,项目名称:MayaProject,代码行数:31,代码来源:autoriggin_ui.py
注:本文中的maya.cmds.joint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论