当前位置: 首页>>代码示例>>Python>>正文


Python core.listConnections函数代码示例

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


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

示例1: matchIkToFk

def matchIkToFk(ikControl, ikPole, offset=100.0, msgAttr='fkjoints', autoKey=True):
    """
    Matches ikControl and ikPole Vector control to match the current pose of underlying
    fk duplicate joint chains
    Finds the fk joints using a previously created message connection to the attribute msgAttr
    """

    fkJoints = pmc.listConnections('{0}.{1}'.format(ikControl, msgAttr),
                                   destination=False, source=True)

    attr = pmc.listConnections('{0}.ikfk'.format(ikControl), destination=False,
                               source=True, plugs=True, scn=True)[0]
    switchControl = attr.node()
    switchAttr = attr.name(includeNode=False)

    frameBeforeCurrent = pmc.currentTime(q=True) - 1
    if autoKey:
        pmc.setKeyframe(switchControl, attribute=switchAttr, time=frameBeforeCurrent,
                        value=1, outTangentType='step')
        pmc.setKeyframe([ikControl, ikPole], time=frameBeforeCurrent, outTangentType='step')

        pmc.setKeyframe(switchControl, attribute=switchAttr, value=0, outTangentType='step')

    alignObjects(ikControl, fkJoints[-1])
    loc = getPoleVectorPosition(fkJoints, offset, curveGuide=False)
    alignObjects(ikPole, loc, position=True, rotation=False)
    pmc.delete(loc)

    if autoKey:
        pmc.setKeyframe([ikControl, ikPole], time=frameBeforeCurrent)

    pmc.headsUpMessage('BAMF!')
开发者ID:taozenforce,项目名称:cogswelladvancedrigging2014,代码行数:32,代码来源:ikfk.py

示例2: bdBuildSplineSolverScale

    def bdBuildSplineSolverScale(self,condition):
        
        print 'asdas'
        self.splineCurve = pm.listConnections(self.ikSpline, type = 'nurbsCurve')[0]

        effector = pm.listConnections(self.ikSpline ,source=True, type='ikEffector')[0]
        endJoint = pm.listConnections(effector,source=True, type='joint')[0]
        startJointChild = pm.listRelatives(self.startJoint,c=True, type='joint')[0]
        self.jointChain = []
        self.jointChain.append(self.startJoint)
        self.jointChain.append(startJointChild)
        while startJointChild.name() != endJoint.name():
            startJointChild = pm.listRelatives(startJointChild,c=True, type='joint')[0]
            self.jointChain.append(startJointChild)
        
        self.splineCurveScl = pm.duplicate(self.splineCurve,name = self.splineCurve.name().replace('crv','crv_scl'))
        strArclenSCL = pm.arclen(self.splineCurveScl,ch=True)
        strArclenCRV = pm.arclen(self.splineCurve,ch=True)
        arclenSCL = pm.ls( strArclenSCL ) [0]
        arclenCRV = pm.ls( strArclenCRV ) [0]
        arclenSCL.rename(self.splineCurveScl[0].name() + '_length')
        arclenCRV.rename(self.splineCurve.name() + '_length')
        
        mdScaleFactor = pm.createNode('multiplyDivide', name = self.splineCurve.name().replace('crv','crv_scaleFactor_md'))
        arclenCRV.arcLength.connect(mdScaleFactor.input1X)
        arclenSCL.arcLength.connect(mdScaleFactor.input2X)
        mdScaleFactor.operation.set(2)

        for jnt in self.jointChain:
            mdScaleFactor.outputX.connect(jnt.scaleX) 
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:30,代码来源:bdScaleSpline.py

示例3: build_twist_deform

 def build_twist_deform(self, *args):
     """ builds a curve with 3 cv's controled by clusters
     Args:
         None
     Returns (None)
     """
     surf_wireShp_name = self.flexiPlaneNameField.getText() + '_flexiPlane_wire_bShp_SURF'
     wireNode_name = self.flexiPlaneNameField.getText() + '_flexiPlane_bShp_wireNode_SURF'
     twistNode_name = self.flexiPlaneNameField.getText() + '_flexiPlane_bShp_twistNode_SURF'
     twistHandle_name = self.flexiPlaneNameField.getText() + '_flexiPlane_twist_Handle'
     surf_bShpGRP_name = self.flexiPlaneNameField.getText() + '_flexiPlane_bShp_GRP'
     
     pm.select( surf_wireShp_name, r = True )
     twist_deformer = mel.eval("nonLinear -type twist -lowBound -1 -highBound 1 -startAngle 0 -endAngle 0;")[0]
     
     twistSurf_inputList = pm.listConnections( surf_wireShp_name + 'Shape' )
     pm.rename( twistSurf_inputList [-3] , twistNode_name )
     
     twistNode_inputList = pm.listConnections( twistNode_name )
     pm.rename( twistNode_inputList [-1] , twistHandle_name )
     pm.setAttr( twistHandle_name + '.rotateZ', 90 )
     pm.reorderDeformers( wireNode_name, twistNode_name, surf_wireShp_name )
     pm.parent( twistHandle_name, surf_bShpGRP_name )
     
     pm.select( cl = True )
开发者ID:michaelanieves,项目名称:Rigging,代码行数:25,代码来源:flexi_plane.py

示例4: assignToSelected

    def assignToSelected(self, layerIndex, channelIndex):
        for obj in pm.selected():
            materialChannelList = [".diffuse", ".diffuse_weight", ".transparency", ".reflectivity", ".refl_gloss",
                                   ".cutout_opacity", ".bump", ".normal"]
            shapeNode = pm.listRelatives(obj, c=True, s=True)
            shadingGrp = pm.listConnections(shapeNode, type="shadingEngine")[0]
            mat = list(set(
                pm.listConnections(shadingGrp, type=['mia_material_x', 'mia_material_x_passes', 'lambert', 'phong'])))[
                0]
            try:
                currentItem = self.layeredTextureTreeModel.itemFromIndex(layerIndex[0]).node
            except:
                pm.cmds.warning("Please select a texture from the list.")
            try:
                if channelIndex < 6:
                    outAttr = ".outColor"
                    if channelIndex != 0:
                        outAttr = ".outAlpha"

                    currentItemOutColor = currentItem + outAttr
                    materialInput = mat + materialChannelList[channelIndex]
                    pm.connectAttr(currentItemOutColor, materialInput, f=True)
                elif channelIndex == 6:
                    createBump(currentItem, mat)
                else:
                    createBump(currentItem, mat, normal=True)
            except:
                pm.cmds.warning("Could not connect materials to " + obj)
开发者ID:kudiaborm,项目名称:mkScripts,代码行数:28,代码来源:ui.py

示例5: shader_getShader

 def shader_getShader(self, arg):
     # get shapes of selection:
     shape = pm.ls(arg, dag=1,o=1,s=1)
     # get shading groups from shapes:
     shadingGrp = pm.listConnections(shape,type='shadingEngine')
     # get the shaders:
     shader = pm.ls(pm.listConnections(shadingGrp),materials=1) 
     return shader
开发者ID:AndresMWeber,项目名称:aw,代码行数:8,代码来源:aw_shaders.py

示例6: getShader

def getShader():
    # get shapes of selection:
    shapesInSel = py.ls(dag=1,o=1,s=1,sl=1)
    # get shading groups from shapes:
    shadingGrps = py.listConnections(shapesInSel,type='shadingEngine')
    # get the shaders:
    shader = py.ls(py.listConnections(shadingGrps),materials=1)
    return shader[0] 
开发者ID:dbokser,项目名称:MayaToolbox,代码行数:8,代码来源:shaders.py

示例7: illumDefaultCommand

	def illumDefaultCommand(self, *args):
		connections = pm.listConnections('defaultLightSet', d=False, s=True)
		if self.illDefault_box.getValue() == 0 and self.lightTransform in connections:
			defaultSet = pm.listConnections(self.lightTransform, d=True, s=False, plugs=True)[0]
			pm.disconnectAttr(self.lightTransform+'.instObjGroups[0]', defaultSet)

		elif self.illDefault_box.getValue() == 1:
			pm.connectAttr(self.lightTransform+'.instObjGroups',  'defaultLightSet.dagSetMembers', nextAvailable=True)
开发者ID:Huston94,项目名称:Simple_Lights_GUI,代码行数:8,代码来源:simple_lights_GUI.py

示例8: bdBuildRPSolverScale

    def bdBuildRPSolverScale(self,condition):
        print 'RP Solver'
        
        #self.splineCurve = pm.listConnections(self.ikSpline, type = 'nurbsCurve')[0]
        pm.select(cl=True)
        ikGrp = pm.group(n=self.ikSpline.name() + '_GRP')
        ikParent = self.ikSpline.getParent()
        ikPos = self.ikSpline.getTranslation(space= 'world')
        ikGrp.setTranslation(ikPos)
        pm.parent(ikGrp,ikParent)
        pm.parent(self.ikSpline,ikGrp)
        

        sclJnt = pm.duplicate(self.startJoint, parentOnly = True , name = self.startJoint.name().replace('JNT','SCL'))[0]
        effector = pm.listConnections(self.ikSpline ,source=True, type='ikEffector')[0]
        endJoint = pm.listConnections(effector,source=True, type='joint')[0]
        startJointChild = pm.listRelatives(self.startJoint,c=True, type='joint')[0]
        self.jointChain = []
        self.jointChain.append(self.startJoint)
        self.jointChain.append(startJointChild)
        while startJointChild.name() != endJoint.name():
            startJointChild = pm.listRelatives(startJointChild,c=True, type='joint')[0]
            self.jointChain.append(startJointChild)
        
        jntPos = []
        for jnt in self.jointChain:
            pos = jnt.getTranslation(space= 'world')
            jntPos.append(pos)
        
        self.splineCurveScl = pm.curve(p=jntPos, degree =1, n = self.startJoint.name().replace('01_JNT','CRV_SCL'))
        self.splineCurveScl.setPivots(jntPos[0])
        pm.parent(self.splineCurveScl, sclJnt)
        
        strArclenSCL = pm.arclen(self.splineCurveScl,ch=True)
        arclenSCL = pm.ls( strArclenSCL ) [0]
        arclenSCL.rename(self.splineCurveScl.name() + '_length')
        distanceNode = pm.createNode('distanceBetween',name = self.startJoint.name().replace('_01_JNT','distance'))
        
        sclJnt.rotatePivotTranslate.connect(distanceNode.point1)
        ikGrp.rotatePivotTranslate.connect(distanceNode.point2)
        sclJnt.worldMatrix.connect(distanceNode.inMatrix1)
        ikGrp.worldMatrix.connect(distanceNode.inMatrix2)
     
        mdScaleFactor = pm.createNode('multiplyDivide', name = self.splineCurveScl.name().replace('CRV_SCL','CRV_scaleFactor_MD'))
        distanceNode.distance.connect(mdScaleFactor.input1X)
        arclenSCL.arcLength.connect(mdScaleFactor.input2X)
        mdScaleFactor.operation.set(2)

        cndScaleFactor = pm.createNode('condition', name = self.splineCurveScl.name().replace('CRV_SCL','CRV_scaleFactor_CND'))
        distanceNode.distance.connect(cndScaleFactor.firstTerm)
        arclenSCL.arcLength.connect(cndScaleFactor.secondTerm)
        mdScaleFactor.outputX.connect(cndScaleFactor.colorIfTrueR)
        
        cndScaleFactor.operation.set(2)
        
        
        for jnt in self.jointChain:
            cndScaleFactor.outColorR.connect(jnt.scaleX)                 
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:58,代码来源:bdScaleSpline.py

示例9: createCgfxShader

    def createCgfxShader(self):
        # get the materials starting from the shaders and looking for connections
        shadersList = [sh.name() for sh in pm.ls(type="shadingEngine")]
        # maya's default shaders, we remove them
        mayaShaders = ["initialParticleSE", "initialShadingGroup"]

        shadersList = set(shadersList) - set(mayaShaders)
        materialList = []

        for sh in shadersList:

            mat = pm.listConnections("%s.surfaceShader" % sh)[0]
            materialList.append(mat)

        for mat in materialList:
            try:
                diffuseFile = pm.listConnections("%s.color" % mat)[0]
            except:
                pm.warning("No diffuse file found")
            try:
                specFile = pm.listConnections("%s.specularColor" % mat)[0]
            except:
                pm.warning("No spec file found")
            try:
                normFile = pm.listConnections("%s.normalCamera" % mat)[0]
            except:
                pm.warning("No norm file found")

            # create a cgfx material
            cgfxShader = pm.shadingNode("cgfxShader", asShader=1)
            cgfxShader.rename(mat + "_cgfx")
            cmd = 'cgfxShader -e -fx "'

            cmd += CHARACTERS_PATH.replace("scenes/characters", "renderData/shaders") + 'zoobeCharacterShader2.cgfx"'
            cmd += cgfxShader.name()
            # assign the zoobe cgfx shader file
            pm.mel.eval(cmd)

            self.saveChar(self.name)
            """
            if diffuseFile:
                #diffuseFile.outColor.connect(cgfxShader.diffuseMapSampler)
                pm.connectAttr('%s.outColor'%diffuseFile.name(),'%s.diffuseMapSampler'%cgfxShader.name())
            
            if specFile:
                specFile.outColor.connect(cgfxShader.specularMapSampler)
            if normFile:
                normFile.outNormal.connect(cgfxShader.normalMapSampler)
            """
            # get the shaders for the materials
            shader = pm.listConnections("%s.outColor" % mat)[0]
            print shader

            # connect the cgfx material to the mesh shader
            shader.surfaceShader.disconnect()
            cgfxShader.outColor.connect(shader.surfaceShader)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:56,代码来源:zoobeMixamoBatchTest.py

示例10: getSourcePlug

def getSourcePlug(plugname, index):
    conns = []
    if index < 0:
        conns = pm.listConnections(plugname, p=1, s=1, d=0)
    else:
        conns = pm.listConnections('%s[%s]'%(plugname, index), p=1, s=1, d=0)
    if conns:
        if len(conns) == 1:
            return conns[0]
        else:
            return ""
开发者ID:Quazo,项目名称:breakingpoint,代码行数:11,代码来源:lightTemplate.py

示例11: bdSetUpLamberts

def bdSetUpLamberts():
	cgfxShaders = pm.ls(type='cgfxShader')
	for cgfx in cgfxShaders:
		diffuseFile = pm.listConnections('%s.diffuseMapSampler'%cgfx)[0]
		shaderNode = pm.listConnections('%s.outColor'%cgfx)[0]
		#transparancyFile = pm.listConnections('%s.specularMapSampler'%cgfx)[0]
		lambertNode = pm.shadingNode('lambert',asShader=1,n=cgfx.name() + '_LMB' )
		diffuseFile.outColor.connect(lambertNode.color)
		
		cgfx.outColor.disconnect()
		lambertNode.outColor.connect(shaderNode.surfaceShader)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:11,代码来源:bdReplaceCgfxLambert.py

示例12: createDistanceTool

def createDistanceTool(objA=None, objB=None):
    """ A better version of Maya's Distance Tool """
    if objA == None and objB == None:
        objA, objB = getSelection(2)
    elif objA == None or objB == None:
        raise SelectionError("Incorrect Selection!")
    spPos = getPosition(objA)
    epPos = getPosition(objB)
    distanceNode = pm.distanceDimension(sp=spPos, ep=epPos)
    locSp = pm.listConnections(str(distanceNode) + ".startPoint")[0]
    locEp = pm.listConnections(str(distanceNode) + ".endPoint")[0]
    return [locSp, locEp]
开发者ID:atvKumar,项目名称:mkUtils,代码行数:12,代码来源:mkUtils.py

示例13: multi_illDefault

def multi_illDefault(*args):
	sel_lights = pm.ls(sl=True, lights=True, dag=True)
	connections = pm.listConnections('defaultLightSet', d=False, s=True)

	for each in sel_lights:
		trans = pm.listRelatives(each, parent=True, fullPath=True)[0]
		if multi_illDefault_box.getValue() == 0 and trans in connections:
			defaultSet = pm.listConnections(trans, d=True, s=True, plugs=True)[0]
			pm.disconnectAttr(trans+'.instObjGroups[0]', defaultSet)

		elif multi_illDefault_box.getValue() == 1:
			pm.connectAttr(trans+'.instObjGroups',  'defaultLightSet.dagSetMembers', nextAvailable=True)
开发者ID:Huston94,项目名称:Simple_Lights_GUI,代码行数:12,代码来源:simple_lights_GUI.py

示例14: bdBuildSplineSolverScale

def bdBuildSplineSolverScale():
    selection = pm.ls(sl=1,type='transform')
    startJoint = ''
    if selection:
        startJoint = selection[0]
    else:
        return
    
    print startJoint
    
    ikSpline  = pm.listConnections(startJoint,type='ikHandle')[0]
    print ikSpline  
    solver = ikSpline.ikSolver.inputs()[0]
    
    if 'ikSplineSolver' in solver.name():
        sclChain = pm.duplicate(startJoint,name = startJoint.name() + '_SCL')[0]
        sclChainAll = sclChain.listRelatives(f=True, ad=True,type='joint')
        
        print sclChainAll  
        
        for sclJnt in sclChainAll:
            pm.rename(sclJnt,sclJnt+'_SCL')
        
        splineCurve = pm.listConnections(ikSpline, type = 'nurbsCurve')[0]
    
        effector = pm.listConnections(ikSpline ,source=True, type='ikEffector')[0]
        endJoint = pm.listConnections(effector,source=True, type='joint')[0]
        jointChain = startJoint.listRelatives(f=True, ad=True,type='joint')
        jointChain  = jointChain + [startJoint]
        jointChain.reverse()
        print jointChain
        
        splineCurveScl = pm.duplicate(splineCurve,name = splineCurve.name().replace('crv','crv_scl'))
        strArclenSCL = pm.arclen(splineCurveScl,ch=True)
        strArclenCRV = pm.arclen(splineCurve,ch=True)
        arclenSCL = pm.ls( strArclenSCL ) [0]
        arclenCRV = pm.ls( strArclenCRV ) [0]
        arclenSCL.rename(splineCurveScl[0].name() + '_length')
        arclenCRV.rename(splineCurve.name() + '_length')
        
        mdScaleFactor = pm.createNode('multiplyDivide', name = splineCurve.name().replace('crv','crv_scaleFactor_md'))
        arclenCRV.arcLength.connect(mdScaleFactor.input1X)
        arclenSCL.arcLength.connect(mdScaleFactor.input2X)
        mdScaleFactor.operation.set(2)
    
        for jnt in jointChain[1:]:
            mdJntTr = pm.createNode('multiplyDivide', name = jnt + '_trX_MD')
            #mdJntTr.operation.set(2)
            
            sclJnt = pm.ls(jnt + '_SCL')[0]
            mdScaleFactor.outputX.connect(mdJntTr.input2X)
            sclJnt.translateX.connect(mdJntTr.input1X)
            mdJntTr.outputX.connect(jnt.translateX)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:53,代码来源:bdRigUtils.py

示例15: connectToAlembicCache

	def connectToAlembicCache(self, namespace = ''):
		
		#get SelectionList
		selectionList = pm.ls(sl = True, fl = True, type = 'transform')
		pm.select(cl = True)
		
		#check if objects are selected
		if not(selectionList):
			if(self.verbose): print('No objects selected, please select at least one object.')
			return None
			
		#Check if namespace is valid
		if not(namespace in self.getNamespaces()):
			if(self.verbose): print('Picked namespace does not exists anymore. Please refresh namespace list')
			return None
		
		
		
		
		#Connect to alembic node
		
		
		#Iterate through selectionList and connect same object plus namespace to alembic cache node if possible
		for masterTrans in selectionList:
			
			#getShape
			masterShape = masterTrans.getShape()
			
			#check if masterShape inMesh Attr connected to Alembic
			if not(pm.nodeType(pm.listConnections(masterShape.inMesh, s = True)[0]) == 'AlembicNode'):
				if(self.verbose): print(masterTrans.name() +' inMesh Attribute not connected to Alembic node. Continuing...')
				continue
				
			#Check if namespace + masterTrans object exists
			if not(pm.objExists(namespace +':' +masterTrans.name().split(':')[-1])):
				if(self.verbose): print(namespace +':' +masterTrans.name().split(':')[-1] +' does not exist. Continuing...')
				continue
				
			
			#Connect Object to Alembic Node
			connectioSourceAttr = pm.listConnections(masterShape.inMesh, s = True, p = True)[0]
			connectionDestinationAttr = namespace +':'  +masterShape.name().split(':')[-1] +'.inMesh'
			pm.connectAttr(connectioSourceAttr, connectionDestinationAttr,f = True)
		
		
		
		#Success Msg
		if(self.verbose): print('Successfully connected PaintFx Hair Geo to Alembic Cache')
开发者ID:gitter-badger,项目名称:rugbybugs,代码行数:48,代码来源:rbPaintFxTransferAnimation.py


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