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

Python cmds.listConnections函数代码示例

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

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



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

示例1: getKeyAttrConnectedChildren

def getKeyAttrConnectedChildren( topObj ):
    
    children = cmds.listRelatives( topObj, c=1, ad=1, f=1 )
    children.append( topObj )
    
    targetChildren = []
    targetCons = []
    for child in children:
        if not cmds.nodeType( child ) in ['joint', 'transform']: continue
        listAttrs = cmds.listAttr( child, k=1 )
        for attr in listAttrs:
            cons = cmds.listConnections( child+'.'+ attr, s=1, d=0 )
            if cons:
                targetChildren.append( child )
                targetCons += cons
            else:
                parentAttrs = cmds.attributeQuery( attr, node=child, listParent = 1 )
                if parentAttrs:
                    cons= cmds.listConnections( child+'.'+parentAttrs[0], s=1, d=0 )
                    if cons:
                        targetChildren.append( child )
                        targetCons += cons
    
    targetChildren = list( set( targetChildren ) )
    targetCons = list( set( targetCons ) )
    return targetChildren, targetCons
开发者ID:jonntd,项目名称:mayadev-1,代码行数:26,代码来源:sgModelCache.py


示例2: removeLayTex

 def removeLayTex(self, argsv):
     # get shapes of selection:
     args = cmds.ls(sl=1)
     shapesInSel = cmds.ls(dag=1,o=1,s=1,sl=1)
     shapeIndex = 0
     for arg in args :
         # get shading groups from shapes:
         shadingGrps = cmds.listConnections(shapesInSel[shapeIndex],type='shadingEngine')
         # get the shaders:
         shaders = cmds.ls(cmds.listConnections(shadingGrps),materials=1) 
         shader = shaders[0]
         #print cmds.listRelatives (p=True, arg)
         
         layeredTex = cmds.listConnections(shader, type='layeredTexture')
         layeredTex = layeredTex[0]
         
         if (not layeredTex == None):
             fileTex = cmds.listConnections(layeredTex, type='file')
             fileTex = fileTex[0]
             
             if (not fileTex == None):
                 cmds.delete(layeredTex)
                 print 'Connecting ' + shader + '.color to ' + fileTex + '.outColor'
                 cmds.connectAttr(fileTex+'.outColor', shader+'.color', f=1)
             else:
                 print ('Object ' + arg + ' does not have a file texture attached, skipping')
         else:
             print ('Object ' + arg + ' does not have a layered texture attached, skipping')
         shapeIndex += 1
开发者ID:AndresMWeber,项目名称:aw,代码行数:29,代码来源:aw_texTools.py


示例3: getSkinClusterNode

def getSkinClusterNode(obj):
    shapes = []
    objSets = []
    connections = []
    skinClusters = []

    shapes = cmds.listRelatives(obj, shapes=True)
    if shapes and len(shapes) > 0: #found shape node
        directSkinClusters = cmds.listConnections(shapes[0], type='skinCluster')
        if directSkinClusters:
            print '1'
            skinClusters.append(directSkinClusters[0])
        else:
            print '2'
            objSets = cmds.listConnections(shapes[0], type='objectSet')
            if objSets and len(objSets) > 0: #found objectSet node
                print objSets
                for objSet in objSets:
                    connections = cmds.listConnections(objSet, type='skinCluster')
                    if connections and len(connections) > 0: #found skinCluster node
                        print '4'
                        if not connections[0] in skinClusters:
                            skinClusters.append(connections[0])
                            
    if len(skinClusters) > 1:
        print "more than one skinClusters found"
    else:
        return skinClusters[0]
开发者ID:adamfok,项目名称:afok_toolset,代码行数:28,代码来源:skin_weight_editor.py


示例4: makeActive

def makeActive( rfn ):
    """
    Make active all nested references.
    """
    result = []
    references = referenceRelatives( rfn, onlyLoaded=False, parents=False )
    if references:
        m_count = len( references )
        if m_count > 1:
            for i in range( 0, m_count ):
                if references[i] not in result:
                    result.append( references[i] )
                    pm = cmds.listConnections( "%s.proxyMsg" % references[i], type="proxyManager" )
                    if pm:
                        pm = pm[0]
                        #Get active reference.
                        rfn = ""
                        proxy = cmds.listConnections( "%s.proxyList" % pm, type="reference", source=False, destination=True )
                        if proxy:
                            for n in range( 0, len( proxy )):
                                if cmds.referenceQuery( proxy[n], isLoaded=True ):
                                    rfn = proxy[n]
                                    break
                        if rfn == "":
                            rfn = proxy[0]
                        #Deactivate all non active references.
                        active = cmds.listConnections( "%s.activeProxy" % pm, plugs=True )
                        if active:
                            for n in range( 0, len( active )):
                                cmds.disconnectAttr( "%s.activeProxy" % pm, active[n] )
                        #Make active reference.
                        lproxy = cmds.connectionInfo( "%s.proxyMsg" % rfn, sourceFromDestination=True )
                        if lproxy:
                            cmds.connectAttr( "%s.activeProxy" % pm, lproxy )
    return result
开发者ID:k0k0c,项目名称:scripts,代码行数:35,代码来源:ml_reference.py


示例5: memberList

def memberList(layer, objectList=True):
    """
    Return a list of objects assigned to the specified layer
    @param obj: The layer to return an object list for
    @type obj: bool
    """
    # Check Layer
    if not isLayer(layer):
        raise Excpetion('Object "' + layer + '" is not a valid layer type!')

    # Get Member List
    members = []
    if isDisplayLayer(layer):
        members = cmds.listConnections(layer + '.drawInfo', s=False, d=True, sh=True)
    if isRenderLayer(layer):
        members = cmds.listConnections(layer + '.renderInfo', s=False, d=True, sh=True)
    if isAnimLayer(layer):
        members = cmds.listConnections(layer + '.dagSetMembers', s=True, d=False, sh=True)

    # Get List of Objects from Member List
    if objectList: members = cmds.ls(members, o=True)

    # Format Result
    if not members: members = []
    members = list(set(members))

    # Return Result
    return members
开发者ID:bennymuller,项目名称:glTools,代码行数:28,代码来源:layer.py


示例6: get_shader

def get_shader(node):
    '''Get the shader applied to a transform or mesh

    :param node: Transform or mesh shape
    '''

    node_type = cmds.nodeType(node)

    if node_type == 'transform':
        shape = get_shape(node)
        if not shape:
            return
    elif node_type == 'mesh':
        shape = node

    try:
        shading_engine = cmds.listConnections(shape, type='shadingEngine')[0]
    except IndexError:
        raise Exception('{} is not attached to a shading engine'.format(shape))

    try:
        shader = cmds.listConnections(shading_engine + '.surfaceShader')[0]
    except IndexError:
        raise Exception('{} shadingEngine has no surfaceShader attached'.format(shading_engine))

    return shader
开发者ID:danbradham,项目名称:shadeset,代码行数:26,代码来源:utils.py


示例7: switchProxy

def switchProxy( rfn, to="" ):
    if cmds.nodeType( rfn ) == "reference":
        pm = cmds.listConnections( rfn, type="proxyManager" )
    else:
        print "%s has not any connected proxy references." % rfn
        return None
    if pm:
        pm = pm[0]
        if to == "":
            references = cmds.listConnections( "%s.proxyList" % pm, type="reference", source=False, destination=True )
            active = cmds.listConnections( "%s.activeProxy" % pm, source=False, destination=True, plugs=True )
            if active:
                for i in range( 0, len( references )):
                    connections = cmds.listConnections( "%s.proxyMsg" % references[i], type="proxyManager", source=True, destination=False, plugs=True )
                    if connections and active[0] in connections:
                        return loadReference( references[i-1] )
                        break 
            else:
                return loadReference( references[0] )
        else:
            if cmds.objExists( to ) and cmds.nodeType( to ) == "reference":
                tm = cmds.listConnections( to, type="proxyManager" )
                if tm and pm == tm[0]:
                    return loadReference( to )
                else:
                    print "%s is not proxy reference for current reference." % to
                    return None
            else:
                print "%s is not proxy reference." % to
                return None
开发者ID:k0k0c,项目名称:scripts,代码行数:30,代码来源:ml_reference.py


示例8: createMaterialSelect

def createMaterialSelect():
       
    selNodes = cmds.ls(selection=True) # get selection
    
    mtlSelectToCreate = [] # clean out array
    
    for node in selNodes:
        if cmds.nodeType(node) == 'VRayBlendMtl': #make sure it's a vray blend mat
            mat = (cmds.listConnections('%s.base_material' % (node))[0])
            print mat, node
            if mat != None and mat not in mtlSelectToCreate:
                mtlSelectToCreate.append(mat)
            for n in range(0,9):
                mat = (cmds.listConnections('%s.coat_material_%d' % (node,n))) # go thru each coat and add if it's there
                if mat != None and mat not in mtlSelectToCreate:
                    mtlSelectToCreate.append(mat[0])
        if cmds.nodeType(node) == 'VRayMtl':
            if node not in mtlSelectToCreate:
                mtlSelectToCreate.append(node) 
                
    for curMat in mtlSelectToCreate:
        matSelName = 'mtl_%s' % (curMat) # create a reasonable name
        if not cmds.objExists(matSelName): # make sure it doesn't already exist
            renderElement = mel.eval('vrayAddRenderElement MaterialSelectElement;') # create render element
            renderElement = cmds.rename(renderElement,matSelName) # rename the old to new
            cmds.connectAttr (curMat + '.outColor', renderElement + '.vray_mtl_mtlselect') # connect up the shader to the render element
            cmds.setAttr (renderElement + '.vray_explicit_name_mtlselect', matSelName, type = 'string') # make sure the name that gets shoved in the exr is named the same
开发者ID:AntiCG,项目名称:vfxpipe,代码行数:27,代码来源:createMaterialSelect.py


示例9: ConstraintVisibility

    def ConstraintVisibility(self, Objects , ControlObject , SpaceSwitchName = 'spaceSwitch', reverse = False ):
        if (self.AddNumericParameter (ControlObject, Name = SpaceSwitchName)):
            SWMultDiv = cmds.shadingNode("multiplyDivide",asUtility = True ,name = SpaceSwitchName + "SWMultDivide" )
            SWMultDiv = self.NameConv.RMRenameBasedOnBaseName(ControlObject, SWMultDiv, NewName = SWMultDiv)
            cmds.connectAttr(ControlObject+"."+SpaceSwitchName ,SWMultDiv+".input1X")
            cmds.setAttr(SWMultDiv+".input2X",10)
            cmds.setAttr(SWMultDiv+".operation",2)
        else:
            SWMultDiv = cmds.listConnections(ControlObject + "." + SpaceSwitchName, type = "multiplyDivide")[0]

        if reverse == True:
            ConnectionsList = cmds.listConnections (SWMultDiv + ".outputX", type = "reverse")
            reverseSW = ""
            if ConnectionsList and len(ConnectionsList) >= 1:
                reverseSW = ConnectionsList[0]
            else :
                reverseSW = cmds.shadingNode('reverse', asUtility=True, name = SpaceSwitchName + "SWReverse")
                reverseSW = self.NameConv.RMRenameBasedOnBaseName(ControlObject, reverseSW, NewName ="SWReverse")
                cmds.connectAttr( SWMultDiv + ".outputX", reverseSW + ".inputX")

                if self.NameConv.RMIsNameInFormat (ControlObject):
                    reverseSW = self.NameConv.RMRenameBasedOnBaseName(ControlObject,reverseSW, NewName = reverseSW)
                else:
                    reverseSW = self.NameConv.RMRenameNameInFormat(reverseSW)
            for eachObject in Objects:
                cmds.connectAttr(reverseSW + ".outputX", eachObject + ".visibility")
        
        else:
            for eachObject in Objects:
                cmds.connectAttr(SWMultDiv + ".outputX", eachObject + ".visibility")
开发者ID:rendermotion,项目名称:RMMel,代码行数:30,代码来源:RMSpaceSwitch.py


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


示例11:

def	setupStrechy	():
	# >>>	get IK from selection, get start/end joints & IK curve, determine strechy joints
	_IK				=	cmds.ls					(selection	=	True)[0]
	_IKcurve		=	cmds.listConnections	(_IK	+	'.inCurve',				destination	=	True)[0]
	_startJoint		=	cmds.listConnections	(_IK	+	'.startJoint',			destination	=	True)[0]
	_endEffector	=	cmds.listConnections	(_IK	+	'.endEffector',			destination	=	True)[0]
	_endJoint		=	cmds.listConnections	(_endEffector	+	'.translateX',	destination	=	True)[0]
	cmds.select									(_endJoint,	hierarchy	=	True)
	_jointsTrash	=	cmds.ls					(selection	=	True)
	cmds.select									(_startJoint,	hierarchy	=	True)
	_strachyJoints_	=	cmds.ls					(selection	=	True)
	_strachyJoints_	=	_strachyJoints_[:len	(_strachyJoints_)	-	len	(_jointsTrash)-1]
	
	# >>>	setup utility nodes
	_curveInfo		=	cmds.arclen			(_IKcurve,	constructionHistory	=	True)
	_condtition		=	cmds.createNode		('condition')
	_startLength	=	cmds.getAttr		(_curveInfo	+	'.arcLength')
	_currentLength	=	cmds.createNode		('multiplyDivide')
	cmds.setAttr							(_currentLength	+	'.operation',	2)
	cmds.setAttr							(_currentLength	+	'.input2X',	_startLength)
	cmds.setAttr							(_condtition	+	'.firstTerm',	_startLength)
	cmds.setAttr							(_condtition	+	'.operation',	4)
	cmds.connectAttr						(_curveInfo		+	'.arcLength',	_currentLength	+	'.input1X',	force	=	True)
	cmds.connectAttr						(_curveInfo		+	'.arcLength',	_condtition	+	'.secondTerm',	force	=	True)
	cmds.connectAttr						(_currentLength	+	'.outputX',	_condtition	+	'.colorIfTrueR',	force	=	True)

	# >>>	connect calculated scale to joints
	for	_j	in	_strachyJoints_:
		cmds.connectAttr					(_condtition	+	'.outColorR',	_j	+	'.scaleX',	force	=	True)
开发者ID:danielforgacs,项目名称:code-dump,代码行数:29,代码来源:ford_riggingAid.py


示例12: separateMeshsBySkinWeight2

def separateMeshsBySkinWeight2( meshObjs ):
    
    import sgBFunction_connection
    import sgBFunction_dag
    
    meshObjs = sgBFunction_dag.getChildrenMeshExists( meshObjs )
    
    
    meshs = []
    for meshObj in meshObjs:
        meshs += separateMeshBySkinWeight2( meshObj )
    
    jntAndBindTargets = {}
    appendedJnts = []
    
    for sel in meshs:
        mmdc = cmds.listConnections( sel, s=1, d=0 )[0]
        bindObj = cmds.listConnections( mmdc, s=1, d=0 )[0]
        bindObjP = cmds.listRelatives( bindObj, p=1, f=1 )[0]
        
        if not bindObjP in appendedJnts:
            appendedJnts.append( bindObjP )
            jntAndBindTargets.update( {bindObjP:[]} )
        
        jntAndBindTargets[ bindObjP ].append( sel )
    
    for jnt, bindObjs in jntAndBindTargets.items():
        
        if len( bindObjs ) == 1: continue
        
        bindObj, polyUnite = cmds.polyUnite( bindObjs, n=bindObjs[0] )
        bindObj = cmds.rename( bindObj, jnt.split( '|' )[-1]+'_mesh' )
        sgBFunction_connection.bindConnect( bindObj, jnt )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:33,代码来源:sgBRig_character.py


示例13: deleteExpression

def deleteExpression(con='', attr=''):
    '''
    #
    '''
    # find exp
    cnn = cmds.listConnections(con + '.' + attr, s=True, d=False)
    if cnn:
        if cmds.nodeType(cnn[0]) == 'unitConversion':
            cnn_uc = cmds.listConnections(cnn, s=True, d=False, type='expression')
            if cnn_uc:
                if cmds.nodeType(cnn_uc[0]) == 'expression':
                    exp = cnn_uc[0]
        elif cmds.nodeType(cnn[0]) == 'expression':
            exp = cnn[0]
        # delete exp
        if exp:
            st1 = cmds.expression(exp, q=True, s=True)
            st2 = 'frame'
            if st2 in st1:
                cmds.delete(exp)
                print 'deleted___  ', con, '  ___  ', exp
            else:
                print '    nope     '
        else:
            print 'no expression  ', attr
开发者ID:boochos,项目名称:work,代码行数:25,代码来源:delayExpression.py


示例14: chimaPullThemDown

def chimaPullThemDown() :

	num = -6975.209
	nodes = mc.ls( sl=True )
	tys = []

	for node in nodes :
		
		src = mc.listConnections( '%s.ty' % node , p=True , s=True , d=False )[0]
		srcType = mc.nodeType( src )
		ty = ''

		if srcType == 'character' :
			ty = mc.listConnections( src , s=True , d=False )[0]
		elif srcType == 'animCurveTL' :
			ty = src.split( '.' )[0]
		else :
			print '%s has been constrained to object' % node
			ty = None
		if ty :
			tys.append( ty )
	
	mc.keyframe( tys ,
					e=True ,
					includeUpperBound=False ,
					animation='objects' ,
					time=(0,100000) ,
					r=True ,
					o='move' ,
					timeChange=0 ,
					valueChange=num
				)
开发者ID:myCodeTD,项目名称:pkmel,代码行数:32,代码来源:pkTools.py


示例15: getMuscle

def getMuscle(muscleObject):
    """
    Get muscle connected to the specified muscleObject
    @param muscleObject: Muscle object to query
    @type muscleObject: str
    """
    # Get muscle object type
    muscleObjType = getMuscleObjectType(muscleObject)

    # Get muscle
    muscle = ''
    if muscleObjType == 'geo':
        muscle = muscleObject
    elif (muscleObjType == 'profile') or (muscleObjType == 'attachment') or (muscleObjType == 'spline'):
        muscleConn = cmds.listConnections(muscleObject + '.muscle', s=True, d=False)
        if not muscleConn:
            raise Exception('Unable to determine muscle connection from muscleObject "' + muscleObject + '"!')
        muscle = muscleConn[0]
    elif (muscleObjType == 'attachmentTangent'):
        muscleObjParent = cmds.listRelatives(muscleObject, p=True)[0]
        muscleConn = cmds.listConnections(muscleObjParent + '.muscle', s=True, d=False)
        if not muscleConn:
            raise Exception('Unable to determine muscle connection from muscleObject "' + muscleObject + '"!')
        muscle = muscleConn[0]
    else:
        raise Exception('Invalid muscleObjectType value: "' + muscleObjType + '"!')

    # Return result
    return muscle
开发者ID:bennymuller,项目名称:glTools,代码行数:29,代码来源:muscle.py


示例16: reorderInfluence

def reorderInfluence(glusterNode):

    influenceList = mc.listConnections(glusterNode + ".matrix", s=1, d=0)
    bindPreMatrixList = mc.listConnections(glusterNode + ".bindPreMatrix", s=1, d=0)
    indexArray = range(len(influenceList))
    indexArray.reverse()

    popWeightList = mc.getAttr(glusterNode + ".influenceWeight[" + str(indexArray[0]) + "]")

    for ind in indexArray:
        if ind:
            copyWeightList = mc.getAttr(glusterNode + ".influenceWeight[" + str(ind - 1) + "]")
            mc.setAttr(glusterNode + ".influenceWeight[" + str(ind) + "]", copyWeightList, type="doubleArray")
            mc.connectAttr(influenceList[(ind - 1)] + ".worldMatrix[0]", glusterNode + ".matrix[" + str(ind) + "]", f=1)
            mc.connectAttr(
                bindPreMatrixList[(ind - 1)] + ".worldInverseMatrix[0]",
                glusterNode + ".bindPreMatrix[" + str(ind) + "]",
                f=1,
            )
        else:
            mc.setAttr(glusterNode + ".influenceWeight[" + str(ind) + "]", popWeightList, type="doubleArray")
            mc.connectAttr(influenceList[indexArray[0]] + ".worldMatrix[0]", glusterNode + ".matrix[0]", f=1)
            mc.connectAttr(
                bindPreMatrixList[indexArray[0]] + ".worldInverseMatrix[0]", glusterNode + ".bindPreMatrix[0]", f=1
            )
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:25,代码来源:gluster.py


示例17: finalize

 def finalize(self):
     """ corrective shape finalize """
     mesh = self.mesh
     if not mesh:
         sels = cmds.ls(sl = 1)
         if sels:
             mesh = sels[0]
         #END if
     #END if
     assert mesh, "--\ncorrectiveData.createCorrectiveUI.__finalize: no mesh specified"
     corrs = cmds.ls(type = "correctiveShape")
     if not corrs:
         print "No corrective shapes found in " + mesh + "'s history"
         return
     #END if
     csp = corrs[0]
     sculpt = cmds.listConnections(csp + ".inputMesh")
     shape = cmds.listConnections(csp + ".og[0]")
     if sculpt:
         sculptShapes = cmds.listRelatives(sculpt[0], s=True, ad=True)
         sculpt.insert(0, sculptShapes[0])
     #END if
     cmds.delete(sculpt)
     cmds.select(shape[0])
     cmds.DeleteHistory()  
开发者ID:blackoz,项目名称:jun,代码行数:25,代码来源:poseDeformer.py


示例18: getAffectedJoints

def getAffectedJoints(ikHandle):
    """
    Get a list of joints affected by a specified ikHandle
    @param ikHandle: IK Handle to query affected joints for
    @type ikHandle: str
    """
    # Check ikHandle
    if not cmds.objExists(ikHandle):
        raise Exception('IK handle ' + ikHandle + ' does not exist!')
    if cmds.objectType(ikHandle) != 'ikHandle':
        raise Exception('Object ' + ikHandle + ' is not a valid ikHandle!')

    # Get startJoint
    startJoint = cmds.listConnections(ikHandle + '.startJoint', s=True, d=False)[0]
    # Get endEffector
    endEffector = cmds.listConnections(ikHandle + '.endEffector', s=True, d=False)[0]
    endJoint = cmds.listConnections(endEffector + '.translateX', s=True, d=False)[0]

    # Get list of joints affected by ikHandle
    ikJoints = [endJoint]
    while ikJoints[-1] != startJoint:
        ikJoints.append(cmds.listRelatives(ikJoints[-1], p=True)[0])
    # Reverse joint list
    ikJoints.reverse()

    # Return ik joints list
    return ikJoints
开发者ID:bennymuller,项目名称:glTools,代码行数:27,代码来源:ik.py


示例19: cleanupReference

def cleanupReference( rfn ):
    #Get reference node.
    if cmds.nodeType( rfn ) == "reference":
        rfn = rfn
    elif os.path.isfile( rfn ):
        rfn = cmds.referenceQuery( rfn, rfn=True )
    else:
        print "%s is not reference" % rfn
        return None
    references = []
    pm = cmds.listConnections( rfn, type="proxyManager" )
    if pm:
        references = cmds.listConnections( "%s.proxyList" % pm[0], type="reference" )
    if not references:
        references = [ rfn ]
        m_words = "|".join( references )
    else:
        references = [ rfn ]
        m_words = rfn
    edits = []
    if references:
        for i in range( 0, len( references )):
            strings = cmds.referenceQuery( references[i], failedEdits=True, successfulEdits=True, editStrings=True )
            if strings:
                for i in range( 0, len( strings )):
                    if strings[i] not in edits:
                        if not re.findall( m_words, strings[i] ):
                            edits.append( strings[i] )
    if edits:
        removeEdits( rfn, edits )
开发者ID:k0k0c,项目名称:scripts,代码行数:30,代码来源:ml_reference.py


示例20: pfxhairDynamicSetting

def pfxhairDynamicSetting( hairSystems, skinMesh ):

    startCurvesAll = []
    for hairSystem in hairSystems:
        hairSystemShape = cmds.listRelatives( hairSystem, s=1 )[0]
        follicles = cmds.listConnections( hairSystemShape+'.inputHair', s=1, d=0, type='follicle', shapes=1 )
        startCurves = cmds.listConnections( follicles, s=1, d=0, type='nurbsCurve' )
        
        startCurvesShapes = cmds.listRelatives( startCurves, s=1, f=1 )
        
        for shape in startCurvesShapes:
            cons = cmds.listConnections( shape, d=1, s=0, shapes=1 )
            if not cons: 
                cmds.delete( shape )
                continue
            if cmds.nodeType( cons[0] ) == 'follicle':
                cmds.setAttr( shape+'.io', 1 )
        
        startCurvesAll += startCurves
    
    grp = cmds.group( startCurvesAll, n='startCurveGrps' )
    
    startCurvesAll = cmds.listRelatives( grp, c=1, type='transform', f=1 )
    
    import sgRigSkinCluster
    
    for curve in startCurvesAll:
        sgRigSkinCluster.autoCopyWeight( skinMesh, curve )
    
    return grp
开发者ID:jonntd,项目名称:mayadev-1,代码行数:30,代码来源:p2014_06_jinro.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python cmds.listHistory函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.listAttr函数代码示例发布时间: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