• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.skinCluster函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中maya.cmds.skinCluster函数的典型用法代码示例。如果您正苦于以下问题:Python skinCluster函数的具体用法?Python skinCluster怎么用?Python skinCluster使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了skinCluster函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: reset

def reset(geometry):
	'''
	Reset the skin cluster attached to the specified object
	@param geometry: Object whose attached skinCluster will be reset
	@type geometry: str
	'''
	# Delete bind pose nodes
	deleteBindPose()
	
	# Determine skinCluster
	skinCluster = findRelatedSkinCluster(geometry)
	
	# Detach skinCluster
	mc.skinCluster(geometry,e=True,ubk=True)
	
	# Get influence list
	influenceList = mc.skinCluster(skinCluster,q=True,inf=True)
	
	# Get MaxInfluence settings
	maxInfluences = mc.getAttr(skinCluster+'.maxInfluences')
	useMaxInfluences = mc.getAttr(skinCluster+'.maintainMaxInfluences')
	
	# Rebuild skinCluster
	skinCluster = mc.skinCluster(geometry,influenceList,dr=4,mi=maxInfluences,omi=useMaxInfluences,tsb=True)
	
	# Delete bind pose nodes
	deleteBindPose()
	
	# Return skinCluster
	return skinCluster
开发者ID:auqeyjf,项目名称:pubTool,代码行数:30,代码来源:skinCluster.py


示例2: bind_mesh

def bind_mesh():
    # メッセージ
    cmds.inViewMessage(
        amg="ウエイト調整後、<hl>「アニメーションをインポート」</hl>を押し、animデータを選択して下さい。", pos="midCenter", fade=True, fit=1, fst=4000, fts=20
    )

    cmds.select("Root_M", add=True, hi=True)

    # 正規表現、_controllerのジョイントを省く
    deselectObj = cmds.ls(sl=True)

    count = 0
    matchTxtEnd = re.compile("(_)(.*?)(controller)(.*)")

    for n in deselectObj:
        matchTrueEnd = matchTxtEnd.search(deselectObj[count])

        if matchTrueEnd != None:
            cmds.select(deselectObj[count], deselect=True)

        count += 1

    cmds.select("Mesh", add=True, hi=True)
    cmds.select("Mesh", deselect=True)

    cmds.skinCluster(maximumInfluences=3, dropoffRate=4, tsb=True)
开发者ID:akkey,项目名称:maya,代码行数:26,代码来源:LightSkeleton.py


示例3: joint

 def joint(self):
     """
     Getting vertax info and saves weights into txt file
     """
     
     # Getting selected name of mesh and vertex
     #self.name_mesh = cmds.ls(sl=True)  
     #self.name_vertex = cmds.ls(sl=True)
     #self.name_vertex = cmds.ls(self.name_mesh + '.vtx[*]')
     
     # Getting number and name of vertex 
     try :
         splited_vertex = string.split(self.name_vertex[0], ':')
         self.number_of_vertex = int(splited_vertex[-1][0:-1]) + 1
         self.name_splited_vertex = string.split(self.name_vertex[0], '[')               
 
     # Check if vertex is selected
     except :
         print "please select vertex"
         
     # Getting joint from skinned mesh
     try :
         self.name_skincluster = cmds.skinCluster(self.name_mesh, q=True, dt=True)
         self.name_skincluster = self.name_skincluster[-1][0:-7]
         self.name_joint = cmds.skinCluster(self.name_mesh, q=True, inf=True)
         return self.name_joint                 
 
     # Check if proper mesh is selected
     except :
         print "please select skinned mesh"
开发者ID:darkuress,项目名称:arFace,代码行数:30,代码来源:copyWeight.py


示例4: create_ik_setup

    def create_ik_setup(self):
        """Creates the IK setup."""
        ik = cmds.ikHandle(sj=self.result_jnts[0], ee=self.result_jnts[-1], sol='ikSplineSolver', ns=1)
        cmds.rename(ik[1], '%s_%s_%s' % (self.side, 'neck', self.nc.effector))
        curve = cmds.rename(ik[2], '%s_%s_%s' % (self.side, 'neck', self.nc.curve))
        cmds.setAttr('%s.inheritsTransform' % curve, 0)
        ik = cmds.rename(ik[0], '%s_%s_%s' % (self.side, 'neck', self.nc.ikhandle))
        cmds.select(self.additional_jnts, curve)
        cmds.skinCluster(tsb=True)
        cmds.parent(ik, self.top_grp)

        cmds.setAttr('%s.dTwistControlEnable' % ik, 1)
        cmds.setAttr('%s.dWorldUpType' % ik, 4)
        cmds.setAttr('%s.dWorldUpAxis' % ik, 4)
        cmds.setAttr('%s.dWorldUpVectorY' % ik, -1)
        cmds.setAttr('%s.dWorldUpVectorEndY' % ik, 1)
        cmds.setAttr('%s.dWorldUpVectorEndZ' % ik, -1)
        cmds.connectAttr('%s.worldMatrix[0]' % self.additional_jnts[0], '%s.dWorldUpMatrix' % ik, f=True)
        cmds.connectAttr('%s.worldMatrix[0]' % self.additional_jnts[1], '%s.dWorldUpMatrixEnd' % ik, f=True)
        self.head_grp = cmds.group(self.controls['head'])
        self.head_grp = cmds.rename(self.head_grp, '%s_head_CTL_%s' % (self.side, self.nc.group))
        cmds.parent(self.head_grp, self.top_grp)
        self.c.move_pivot_to(self.guides['neckEnd'][0], self.guides['neckEnd'][1], self.guides['neckEnd'][2], self.head_grp)
        cmds.parentConstraint(self.controls['head'], self.additional_jnts[-1], mo=True, weight=1)
        cmds.orientConstraint(self.controls['head_rot'], self.result_jnts[-1], mo=True, weight=1)
开发者ID:jonntd,项目名称:Rigganator,代码行数:25,代码来源:dragonneck.py


示例5: bindCurve

def bindCurve(crv=None):
    '''
    Creates a joint for each cv in the supplied or selected curve
    performs a smooth bind on the curve to the joints
    returns a list of the newly created joints
    
    '''
    # Validation of args
    if not crv:
        if len(cmds.ls(sl=1)) == 1:
            crv = cmds.ls(sl=1)[0]
        else:
            return common.showDialog( 'Argument Error', 'Please supply or select a nurbs curve' )
        
    jointList = []
        
    cvs = cmds.getAttr("%s.cv[*]" % crv)
    
    for cv in range(len(cvs)):
        cmds.select(clear=1)
        j = cmds.joint(p=cvs[cv], name='%s_%s_jnt' %(crv, cv+1))
        jointList.append(j)
        
    cmds.skinCluster(jointList, crv, tsb=1, name='%s_skinCluster' % crv)
    
    return jointList
开发者ID:duncanrudd,项目名称:rooftops,代码行数:26,代码来源:curve.py


示例6: copy_bind_from_ng_file

def copy_bind_from_ng_file(file):
    """ Copies skinCluster from ngSkinTools JSON file to make the same skinCluster before importing weights.
    Args:
        file (str): file...
    Returns [str]: list of joints that we used
    Usage:
        a=copy_bind_from_ng_file('/mpc/mayors1/scanaEnergyBears_5600278/build/char_linda_blackbear/maya/scenes/rig/andres-w/build/scripts/char_harry_blackbear_body_lodA_weights.json')
    """
    influences = []
    missing_influences = []
    with open(file) as f:
        data = f.read()
        json_data = json.loads(data)
        f.close()
        for value in json_data['influences']:
            influence = json_data['influences'][value]['path'].split('|')[-1]
            if mc.objExists(influence):
                influences.append(influence)
            else:
                missing_influences.append(influence)
                
        print 'Missing Influences from your file:'
        print missing_influences
        
        result = cmds.confirmDialog(b=['OK','CANCEL'], m='You have %d missing influences...continue adding skin cluster from file?' % (len(missing_influences)))
        if result == 'OK':
            mc.skinCluster(influences, mc.ls(sl=True)[0], tsb=True)
    return influences
开发者ID:AndresMWeber,项目名称:aw,代码行数:28,代码来源:aw_ngSkinTools.py


示例7: weightZero

def weightZero(skinClusterName, deformerName):
    scNormalWeights = skinClusterName + '.normalizeWeights'
    cmds.setAttr(scNormalWeights, 1)
    cmds.skinPercent(skinClusterName, transformValue=[ (deformerName, 1.0)])
    cmds.setAttr(scNormalWeights, 0)
    cmds.skinCluster(skinClusterName, edit = True, fnw = True)
    cmds.skinPercent(skinClusterName, transformValue=[ (deformerName, 0.0)])
开发者ID:tkabelan,项目名称:python_miscellaneous,代码行数:7,代码来源:weightExport_batch_pipelineCode.py


示例8: skin_dragon

    def skin_dragon(self):
        """@todo: insert doc for skin_dragon"""
        cmds.setAttr('L_foot_CTL.tx', 3.061)
        cmds.setAttr('R_foot_CTL.tx', -3.061)

        data = 'C:/PROJECTS/GOT_Dragon/data/'

        done = list()
        for weight in os.listdir(data):
            cmds.select(clear=True)
            if weight in done:
                continue
            name = weight.split('_weights')[0]
            if not cmds.objExists('Drache:%s' % name):
                continue
            weight = self.get_latest_version(weight, data)
            self.select_result_jnts(name)
            cmds.select('Drache:%s' % name, add=True)
            skin = cmds.skinCluster(tsb=True, sm=True)[0]
            cmds.deformerWeights(weight, im=True, method='index', deformer=skin, path=data)
            cmds.skinCluster(skin, e=True, forceNormalizeWeights=True)
            cmds.select('Drache:%s' % name)
            done.append(weight)
            #mel.eval('removeUnusedInfluences;')
        # end for weight in os.listdir(data)

        cmds.setAttr('L_foot_CTL.tx', 0)
        cmds.setAttr('R_foot_CTL.tx', 0)
开发者ID:jonntd,项目名称:Rigganator,代码行数:28,代码来源:dragon.py


示例9: copy

def copy():

    skin_cluster = None
    mesh_name = None
    selection = cmds.ls(sl=True)
    if selection:
        mesh_name = selection[0]
        shape = cmds.listRelatives(selection[0])
        skin_clusters = cmds.listConnections(shape[0], type='skinCluster')
        if skin_clusters:
            skin_cluster = skin_clusters[0]
        else:
            cmds.error('No skin cluster present')
    else:
        cmds.error('No valid selection')

    bones = cmds.skinCluster(skin_cluster, q=True, inf=True)
    num_verts = cmds.polyEvaluate(mesh_name, v=True)
    data = dict()

    for bone in bones:
        data[bone] = []
        for id in range(num_verts):

            data[bone].append(cmds.skinPercent(skin_cluster, '{0}.vtx[{1}]'.format(mesh_name, id), q=True, t=bone))

    pickled_list = pickle.dumps(data)
    cmds.scrollField('jt_copy_skin_values_field', e=True, tx=pickled_list)
    cmds.skinCluster(mesh_name, e=True, ub=True)
开发者ID:MaxIsJames,项目名称:jt_tools,代码行数:29,代码来源:jt_copy_skin.py


示例10: 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


示例11: copyWeight

def copyWeight( first, second ):
    
    hists = cmds.listHistory( first, pdo=1 )
    
    skinNode = None
    for hist in hists:
        
        if cmds.nodeType( hist ) == 'skinCluster':
            skinNode = hist
            
    if not skinNode: return None
    
    targetSkinNode = None
    targetHists = cmds.listHistory( second, pdo=1 )
    if targetHists:
        for hist in targetHists:
            if cmds.nodeType( hist ) == 'skinCluster':
                targetSkinNode = hist

    if not targetSkinNode:
        bindObjs = cmds.listConnections( skinNode+'.matrix', s=1, d=0, type='joint' )
        bindObjs.append( second )
        print bindObjs
        cmds.skinCluster( bindObjs, tsb=1 )
    
    cmds.copySkinWeights( first, second, noMirror=True, surfaceAssociation='closestPoint', influenceAssociation ='oneToOne' )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:26,代码来源:cmdModel.py


示例12: add_skinCluster_weights

def add_skinCluster_weights (vertexIDs, src_mesh, dst_mesh, mask_joint=None):
    src_skin = get_skinCluster(src_mesh)
    dst_skin = get_skinCluster(dst_mesh)
    
    src_skinCls_matrix_dict = loads_skinCluster_matrix(src_mesh)
    dst_skinCls_matrix_dict = loads_skinCluster_matrix(dst_mesh)
    
    cmds.skinCluster(dst_skin, e=True, normalizeWeights=False)
    
    for vertexID in vertexIDs:
        if not mask_joint: #if no mask joint defined, overwrite weight onto dst mesh
            cmds.skinPercent( dst_skin, "%s.vtx[%s]"%(dst_mesh, vertexID), pruneWeights=100)
            maskValue = 1
        else:
            mask_jointIndex = dst_skinCls_matrix_dict[mask_joint]
            maskValue = cmds.getAttr("%s.wl[%s].w[%s]" %(dst_skin, vertexID, mask_jointIndex))
            cmds.setAttr("%s.wl[%s].w[%s]" %(dst_skin, vertexID, mask_jointIndex), 0)
                        
        for src_joint, src_jointIndex in src_skinCls_matrix_dict.iteritems():
            weight = cmds.getAttr("%s.wl[%s].w[%s]" %(src_skin, vertexID, src_jointIndex)) * maskValue
            if weight != 0.0:
                dst_jointIndex = dst_skinCls_matrix_dict[src_joint]
                cmds.setAttr("%s.wl[%s].w[%s]" %(dst_skin, vertexID, dst_jointIndex), weight)

    cmds.skinCluster(dst_skin, e=True, normalizeWeights=True)
开发者ID:adamfok,项目名称:afok_toolset,代码行数:25,代码来源:utils_skinCluster.py


示例13: rigFace

def rigFace() : 
    jntGrp = 'facialJnt_grp'

    if not mc.objExists(jntGrp) : 
        mc.group(em = True, n = jntGrp)

    facePolyMap = {'L_brow_ply': 'L_brow_ctrl',
                     'L_baseEye_ply': 'L_baseEye_ctrl', 
                     'L_eye_ply': 'L_eye_ctrl',
                     'R_brow_ply': 'R_brow_ctrl', 
                     'R_baseEye_ply': 'R_baseEye_ctrl', 
                     'R_eye_ply': 'R_eye_ctrl', 
                     'nose_ply': 'noseface_ctrl', 
                     'mouth_ply': 'mount_ctrl'
                     }

    for each in facePolyMap : 
        poly = each
        ctrl = facePolyMap[poly]

        if mc.objExists(poly) : 

            movePivot(ctrl, poly)

            joint = mc.createNode('joint', n = poly.replace('_ply', '_jnt'))
            mc.delete(mc.pointConstraint(poly, joint))
            mc.skinCluster(poly, joint, tsb = True)
            mc.parentConstraint(ctrl, joint)
            mc.scaleConstraint(ctrl, joint)

            mc.parent(joint, jntGrp)
开发者ID:myCodeTD,项目名称:rigTools,代码行数:31,代码来源:gen2DRig+(tanimator's+conflicted+copy+2014-11-28).py


示例14: mirrorSkin

def mirrorSkin(skinCluster,search='L_',replace='R_'):
	'''
	Create a mirrored skinCluster based on the influence list and weights of another specified skinCluster
	@param skinCluster: The existing skinCluster to mirror
	@type skinCluster: str
	@param search: Name prefix of the source skinCluster
	@type search: str
	@param replace: Name prefix of the destination skinCluster geometry/influences
	@type replace: str
	'''
	# Check skinCluster
	if not isSkinCluster(skinCluster):
		raise Exception('Object "'+skinCluster+'" is not a valid skinCluster!')
	
	# Get affected object
	sourceGeo = glTools.utils.deformer.getAffectedGeometry(skinCluster).keys()[0]
	if not sourceGeo.startswith(search):
		raise Exception('Search string "'+search+'" not found in source geometry name!')
	destGeo = sourceGeo.replace(search,replace)
	if not mc.objExists(destGeo):
		raise Exception('Destination geometry "'+destGeo+'" does not exist!')
	
	# Get influence list
	influenceList = mc.skinCluster(skinCluster,q=True,inf=True)
	
	# Check destination skinCluster
	mSkinCluster = skinCluster.replace(search,replace)
	destSkinCluster = findRelatedSkinCluster(destGeo)
	if destSkinCluster and destSkinCluster != mSkinCluster:
		mc.rename(destSkinCluster,mSkinCluster)
	
	# Check influenceList
	mInfluenceList = [inf.replace(search,replace) for inf in influenceList]
	for mInf in mInfluenceList:
		if not mc.objExists(mInf):
			raise Exception('Mirror influence "'+mInf+'" does not exist!!')
	
	# Check mirror skinCluster
	if not mc.objExists(mSkinCluster):
		# Create skinCluster
		mSkinCluster = mc.skinCluster(mInfluenceList,destGeo,tsb=True,n=mSkinCluster)[0]
	else:
		# Add influence
		destInfluenceList = mc.skinCluster(mSkinCluster,q=True,inf=True)
		for mInf in mInfluenceList:
			if not destInfluenceList.count(mInf):
				mc.skinCluster(mSkinCluster,e=True,ai=mInf)
	
	# Get Mirror Weights
	mirroWeightList = {}
	for inf in influenceList:
		mirroWeightList[inf] = getInfluenceWeights(skinCluster,inf)
	
	# Clear mirrorSkin weights
	clearWeights(destGeo)
	
	# Apply mirror weights
	for i in range(len(influenceList)):
		setInfluenceWeights(mSkinCluster,mInfluenceList[i],mirroWeightList[influenceList[i]])
开发者ID:auqeyjf,项目名称:pubTool,代码行数:59,代码来源:skinCluster.py


示例15: applyRigidSkin

def applyRigidSkin():
    """"""
    sel = cmds.ls(sl=1, ap=1)
    if len(sel) < 2:
        om.MGlobal.displayError("Please select joints first, then mesh.")
        return
    mesh = sel.pop()
    cmds.skinCluster(sel, mesh, tsb=1, mi=0, nw=1, bm=1)
开发者ID:00christian00,项目名称:DeformationLearningSolver,代码行数:8,代码来源:miscFunc.py


示例16: rigFace2

def rigFace2() : 
    jntGrp = 'facialJnt_grp'

    if not mc.objExists(jntGrp) : 
        mc.group(em = True, n = jntGrp)

    facePolyMap = {'L_brow_ply': 'L_brow_ctrl',
                     'L_baseEye_ply': 'L_baseEye_ctrl', 
                     'L_eye_ply': 'L_eye_ctrl',
                     'R_brow_ply': 'R_brow_ctrl', 
                     'R_baseEye_ply': 'R_baseEye_ctrl', 
                     'R_eye_ply': 'R_eye_ctrl', 
                     'nose_ply': 'noseface_ctrl', 
                     'mouth_ply': 'mouth_ctrl', 
                     'L_eyeLine_ply': 'L_eyeLine_ctrl', 
                     'R_eyeLine_ply': 'R_eyeLine_ctrl', 
                     'L_wrinkle_ply': 'L_wrinkle_ctrl', 
                     'R_wrinkle_ply': 'R_wrinkle_ctrl'
                     }

    # facePolyMap = {'L_brow_ply': 'L_brow_ctrl',
    #                  'L_Eye_line_ply': 'L_baseEye_ctrl', 
    #                  'L_eye_ply': 'L_eye_ctrl',
    #                  'R_brow_ply': 'R_brow_ctrl', 
    #                  'R_Eye_line_ply': 'R_baseEye_ctrl', 
    #                  'R_eye_ply': 'R_eye_ctrl', 
    #                  'nose_ply': 'noseface_ctrl', 
    #                  'mouth_ply': 'mount_ctrl',
    #                  'L_wrinkle_ply': 'L_wrinkle_ctrl',
    #                  'R_wrinkle_ply': 'R_wrinkle_ctrl'
    #                  }

    for each in facePolyMap : 
        poly = each
        ctrl = facePolyMap[poly]

        if mc.objExists(poly) : 
            joint = mc.createNode('joint', n = ctrl.replace('_ctrl', '_jnt'))
            jntZgrp = mc.group(joint, n = '%sJnt_zGrp' % ctrl.replace('_ctrl', '_jnt'))
            mc.delete(mc.pointConstraint(poly, jntZgrp))
            mc.skinCluster(poly, joint, tsb = True)

            mc.pointConstraint(ctrl, joint, mo = True)

            # mc.connectAttr('%s.translateX' % ctrl, '%s.translateX' % joint, f = True)
            # mc.connectAttr('%s.translateY' % ctrl, '%s.translateY' % joint, f = True)
            # mc.connectAttr('%s.translateZ' % ctrl, '%s.translateZ' % joint, f = True)
            mc.connectAttr('%s.rotateX' % ctrl, '%s.rotateX' % joint, f = True)
            mc.connectAttr('%s.rotateY' % ctrl, '%s.rotateY' % joint, f = True)
            mc.connectAttr('%s.rotateZ' % ctrl, '%s.rotateZ' % joint, f = True)
            mc.connectAttr('%s.scaleX' % ctrl, '%s.scaleX' % joint, f = True)
            mc.connectAttr('%s.scaleY' % ctrl, '%s.scaleY' % joint, f = True)
            mc.connectAttr('%s.scaleZ' % ctrl, '%s.scaleZ' % joint, f = True)

            mc.parent(jntZgrp, jntGrp)

        else : 
            print '%s not exists' % poly
开发者ID:myCodeTD,项目名称:rigTools,代码行数:58,代码来源:gen2DRig+(tanimator's+conflicted+copy+2014-11-28).py


示例17: checkLockedInfluences

 def checkLockedInfluences(self, skinCluster):
     '''
     Check if provided skinCluster has locked influences
     '''
     influenceObjects = cmds.skinCluster(skinCluster,q=True, inf=True )
     for currentJoint in influenceObjects:
         if (cmds.skinCluster(skinCluster,q=True,lw=True, inf=currentJoint )):
             return True
     return False
开发者ID:chrisevans3d,项目名称:skinWrangler,代码行数:9,代码来源:skinWrangler.py


示例18: buildPointWeights

def buildPointWeights(	points,
						influenceList,
						skinCluster,
						maxInfluences = 3 ):
	'''
	Build and execute skinPercent commands to apply distance based weights given a list of deformed components and a list of influences.
	Weights are calculated using an inverse distance function using a set number of influences per point.
	@param points: List of deformed points to calculate skin weights for
	@type points: list
	@param influenceList: List of skinCluster influences to calculate weights from
	@type influenceList: list
	@param skinCluster: SkinCluster to apply weights to
	@type skinCluster: str
	@param maxInfluences: Number of influences per component
	@type maxInfluences: int
	'''
	# ==========
	# - Checks -
	# ==========
	
	# Build Influence Points
	influencePts = [glTools.utils.base.getPosition(i) for i in influenceList]
	
	# Add Missing Influences
	skinInfList = mc.skinCluster(skinCluster,q=True,inf=True)
	missingInfList = list(set(influenceList)-set(skinInfList)) or []
	for inf in missingInfList:
		mc.skinCluster(skinCluster,e=True,addInfluence=inf,lockWeights=True)
	for inf in missingInfList:
		mc.setAttr(inf+'.liw',0)
	
	# =======================
	# - Build Point Weights -
	# =======================
	
	#glTools.utils.progressBar.init('Beginning Weights', len(points)/10)

	cmd = ''
	ptWts = {}
	for i, pt in enumerate(points):
		
		ptPos = glTools.utils.base.getPosition(pt)
		wt, influenceID = calcPointWeights(ptPos,influencePts,maxInfluences)
		ptWts[pt] = [influenceID, wt]
		
	cmd += buildSkinPercentCmd(pt, influenceList, wt, skinCluster, ptWts)
		
	#if not i%10: glTools.utils.progressBar.update(1,'Generating Weights')
	
	# =================
	# - Return Result -
	# =================
	
	#glTools.utils.progressBar.end()
	
	# Run Cmd
	mm.eval(cmd)
开发者ID:auqeyjf,项目名称:glTools,代码行数:57,代码来源:inverseDistanceWeights.py


示例19: transferSingleFunction

 def transferSingleFunction(self, getChildrenController, getChildrenTarget, skinPath):
     print "here is "+getChildrenController[0], getChildrenTarget[0]
     queryJoint=cmds.optionMenu(jointSelect, q=1, v=1)
     queryJoint=queryJoint+":"
     try:
         newname, skinID=getClass.getSkinWeightsforXML(getChildrenController[0])
         cmds.deformerWeights (newname+".xml", p=skinPath,  ex=True, deformer=skinID)
         print "deformer weights have been exported from "+getChildrenController[0]
     except:
         print "shape missing"  
         pass
     try:
         GetPath=skinPath+newname+".xml"
     except:
         print  getChildrenController[0]+" does not have a skinCluster to reference from"
     getCtrlgetChildrenTargetName=getChildrenController[0].split(":")
     getTgtgetChildrenTargetName=getChildrenTarget[0].split(":")
     getOldMeshNameSpace=':'.join(getCtrlgetChildrenTargetName[:-1])+":"
     try:
         getSkinCluster=cmds.skinCluster(getChildrenController[0], q=1, dt=1)
         skinID, getInf=getClass.skinClust(getSkinCluster, getChildrenController[0])   
         getJointNameSpace=getInf[0].split(":")
         getOldJointNameSpace=':'.join(getJointNameSpace[:-1])+":"
         dataFromTextFile=open(GetPath).read()
         dataFromTextFile=dataFromTextFile.replace(getOldJointNameSpace, queryJoint)
         if "face" in getOldJointNameSpace:
             dataFromTextFile=dataFromTextFile.replace(getOldJointNameSpace, "")            
         replacedDataTextFile=open(GetPath, 'w')
         replacedDataTextFile.write(dataFromTextFile)
         replacedDataTextFile.close() 
         print "xml has been updated with new joint names"                             
         pass
     except:
         print "shape is missing - passed"
         pass
     getJointBucket=[]
     for jointItem in getInf:
         getJointName=jointItem.split(":")
         getJoint=getJointName[-1:][0]
         getNewJoint=queryJoint+getJoint
         getJointBucket.append(getNewJoint)
     cmds.select(getChildrenTarget[0])
     try:
         cmds.skinCluster(getChildrenTarget[0],getJointBucket[0], tsb=1, nw=1)
         print getChildrenTarget[0]+" has been successfully bound to "+getJointBucket[0]
         if len(getJointBucket)>1:
             for eachjoint in getJointBucket[1:]:
                 try:
                     cmds.skinCluster(getChildrenTarget[0], e=1, ai=eachjoint, tsb=1, nw=1) 
                     print eachjoint+" has been successfully added to "+getChildrenTarget[0]
                 except:
                     pass              
     except:
         print getChildrenTarget[0]+" is already bound"                      
     newgetChildrenTargetName, newskinID=getClass.getSkinWeightsforXML(getChildrenTarget[0])
     cmds.deformerWeights (newname+".xml", p=skinPath, im=True, deformer=newskinID) 
     print "deformer weights have been applied to "+newgetChildrenTargetName
开发者ID:edeglau,项目名称:storage,代码行数:57,代码来源:skinTransfer.py


示例20: ReSeat

def ReSeat(joints):
    """ Allow movement of Joints. """
    skins = set(cmds.listConnections(joints, type="skinCluster", s=True) or [])
    for sk in skins:
        cmds.skinCluster(sk, e=True, mjm=True) # Turn off skin
    try:
        yield
    finally:
        for sk in skins:
            cmds.skinCluster(sk, e=True, mjm=False) # Turn on skin
开发者ID:internetimagery,项目名称:twinSkeleton,代码行数:10,代码来源:fixorient.py



注:本文中的maya.cmds.skinCluster函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.skinPercent函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.showWindow函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap