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


Python cmds.isConnected函数代码示例

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


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

示例1: reverseCheck

 def reverseCheck(self, remapNode, reverseCheck ):
 
     if reverseCheck:
         revNode = self.getReverse()
         if not cmds.isConnected( revNode+'.output', remapNode+'.color' ):
             cmds.connectAttr( revNode+'.output', remapNode+'.color', f=1 )
         
         colorRCons = cmds.listConnections( remapNode+'.colorR', s=1, d=0, c=1, p=1 )
         if colorRCons: cmds.disconnectAttr( colorRCons[1], colorRCons[0] )
         colorGCons = cmds.listConnections( remapNode+'.colorG', s=1, d=0, c=1, p=1 )
         if colorGCons: cmds.disconnectAttr( colorGCons[1], colorGCons[0] )
         colorBCons = cmds.listConnections( remapNode+'.colorB', s=1, d=0, c=1, p=1 )
         if colorBCons: cmds.disconnectAttr( colorBCons[1], colorBCons[0] )
         
     else:
         sampler = self.getSamplerInfo()
         if not cmds.isConnected( sampler+'.facingRatio', remapNode+'.colorR' ):
             cmds.connectAttr( sampler+'.facingRatio', remapNode+'.colorR' )
         if not cmds.isConnected( sampler+'.facingRatio', remapNode+'.colorG' ):
             cmds.connectAttr( sampler+'.facingRatio', remapNode+'.colorG' )
         if not cmds.isConnected( sampler+'.facingRatio', remapNode+'.colorB' ):
             cmds.connectAttr( sampler+'.facingRatio', remapNode+'.colorB' )
         
         colorCons = cmds.listConnections( remapNode+'.color', s=1, d=0, c=1, p=1 )
         if colorCons:
             cmds.disconnectAttr( colorCons[1], colorCons[0] )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:26,代码来源:cmdModel.py

示例2: getReverse

 def getReverse(self):
     
     reverseName = RemapConnectInfo._reverseName
     reverseAttr = RemapConnectInfo._reverseAttr
     
     reverses = cmds.ls( type='reverse' )
     
     vrayRemapReverse = None
     
     if not reverses: reverses = []
     
     for reverse in reverses:
         if cmds.attributeQuery( reverseAttr, node=reverse, ex=1 ):
             vrayRemapReverse = reverse
             break
         
     if not vrayRemapReverse:
         vrayRemapReverse = cmds.shadingNode( 'reverse', n=reverseName, asUtility=1 )
         cmds.addAttr( vrayRemapReverse, ln=reverseAttr, at='message' )
     
     samplerInfos = cmds.listConnections( vrayRemapReverse, s=1, d=0, type='samplerInfo' )
     if not samplerInfos:
         samplerInfo = self.getSamplerInfo()
         if not cmds.isConnected( samplerInfo+'.facingRatio', vrayRemapReverse+'.inputX' ):
             cmds.connectAttr( samplerInfo+'.facingRatio', vrayRemapReverse+'.inputX', f=1 )
         if not cmds.isConnected( samplerInfo+'.facingRatio', vrayRemapReverse+'.inputY' ):
             cmds.connectAttr( samplerInfo+'.facingRatio', vrayRemapReverse+'.inputY', f=1 )
         if not cmds.isConnected( samplerInfo+'.facingRatio', vrayRemapReverse+'.inputZ' ):
             cmds.connectAttr( samplerInfo+'.facingRatio', vrayRemapReverse+'.inputZ', f=1 )
     
     return vrayRemapReverse
开发者ID:jonntd,项目名称:mayadev-1,代码行数:31,代码来源:cmdModel.py

示例3: createLocalBlendTwoMatrixObject

def createLocalBlendTwoMatrixObject( first, second, target = None ):
    
    import sgBFunction_attribute
    
    blMtx = cmds.createNode( 'blendTwoMatrixDecompose' )
    cmds.connectAttr( first+'.m', blMtx+'.inMatrix1' )
    cmds.connectAttr( second+'.m', blMtx+'.inMatrix2' )
    
    if not target: target = cmds.createNode( 'transform' )
    
    sgBFunction_attribute.addAttr( target, ln='blend', min=0, max=1, dv=0.5, k=1 )
    cmds.connectAttr( target+'.blend', blMtx+'.attributeBlender' )
    
    if cmds.nodeType( target ) == 'joint':
        try:cmds.setAttr( target+'.jo', 0,0,0 )
        except:pass
    
    if not cmds.isConnected( blMtx+'.ot', target+'.t' ):
        cmds.connectAttr( blMtx+'.ot', target+'.t', f=1 )
    if not cmds.isConnected( blMtx+'.or', target+'.r' ):
        cmds.connectAttr( blMtx+'.or', target+'.r', f=1 )
    if not cmds.isConnected( blMtx+'.os', target+'.s' ):
        cmds.connectAttr( blMtx+'.os', target+'.s', f=1 )
    if not cmds.isConnected( blMtx+'.osh', target+'.sh' ):
        cmds.connectAttr( blMtx+'.osh', target+'.sh', f=1 )
    
    cmds.select( blMtx, target )
    return blMtx, target
开发者ID:jonntd,项目名称:mayadev-1,代码行数:28,代码来源:sgBFunction_rigObject.py

示例4: addAngleDriverAttribute

def addAngleDriverAttribute( sel ):
    
    import sgBFunction_attribute
    
    sgBFunction_attribute.addAttr( sel, ln='angleRate0', cb=1 )
    sgBFunction_attribute.addAttr( sel, ln='angleRate1', cb=1 )
    sgBFunction_attribute.addAttr( sel, ln='angleRate2', cb=1 )
    
    if cmds.listConnections( sel, s=1, d=0, type='angleDriver' ): return None
    
    selP = cmds.listRelatives( sel, p=1, f=1 )[0]
    selName = sel.split( '|' )[-1]
    targetDriver = cmds.createNode( 'angleDriver', n= 'angleDriver_' + selName )
    mm = cmds.createNode( 'multMatrix', n='mm_' + selName )
    base = cmds.createNode( 'transform', n= 'angleBase_' + selName )

    base = cmds.parent( base, selP )[0]

    cmds.xform( base, ws=1, matrix= cmds.getAttr( sel+'.wm' ) )
    
    cmds.connectAttr( sel+'.wm', mm+'.i[0]' )
    cmds.connectAttr( base+'.wim', mm+'.i[1]' )
    cmds.connectAttr( mm+'.matrixSum', targetDriver+'.angleMatrix' )
        
    
    sgBFunction_attribute.addAttr( sel, ln='angleRate0', cb=1 )
    sgBFunction_attribute.addAttr( sel, ln='angleRate1', cb=1 )
    sgBFunction_attribute.addAttr( sel, ln='angleRate2', cb=1 )
    if not cmds.isConnected( targetDriver+'.outDriver0', sel+'.angleRate0' ):
        cmds.connectAttr( targetDriver+'.outDriver0', sel+'.angleRate0' )
    if not cmds.isConnected( targetDriver+'.outDriver1', sel+'.angleRate1' ):
        cmds.connectAttr( targetDriver+'.outDriver1', sel+'.angleRate1' )
    if not cmds.isConnected( targetDriver+'.outDriver2', sel+'.angleRate2' ):
        cmds.connectAttr( targetDriver+'.outDriver2', sel+'.angleRate2' )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:34,代码来源:sgBFunction_rigObject.py

示例5: createWorldBlendTwoMatrixObject

def createWorldBlendTwoMatrixObject( first, second, target = None ):
    
    import sgBFunction_attribute
    
    blMtx = cmds.createNode( 'blendTwoMatrix' )
    mmdc  = cmds.createNode( 'multMatrixDecompose' )
    cmds.connectAttr( first+'.wm', blMtx+'.inMatrix1' )
    cmds.connectAttr( second+'.wm', blMtx+'.inMatrix2' )
    cmds.connectAttr( blMtx+'.outMatrix', mmdc+'.i[0]' )
    
    if not target: target = cmds.createNode( 'transform' )
    cmds.connectAttr( target+'.pim', mmdc+'.i[1]' )
    
    sgBFunction_attribute.addAttr( target, ln='blend', min=0, max=1, dv=0.5, k=1 )
    cmds.connectAttr( target+'.blend', blMtx+'.attributeBlender' )
    
    if not cmds.isConnected( mmdc+'.ot', target+'.t' ):
        cmds.connectAttr( mmdc+'.ot', target+'.t', f=1 )
    if not cmds.isConnected( mmdc+'.or', target+'.r' ):
        cmds.connectAttr( mmdc+'.or', target+'.r', f=1 )
    if not cmds.isConnected( mmdc+'.os', target+'.s' ):
        cmds.connectAttr( mmdc+'.os', target+'.s', f=1 )
    if not cmds.isConnected( mmdc+'.osh', target+'.sh' ):
        cmds.connectAttr( mmdc+'.osh', target+'.sh', f=1 )
    
    cmds.select( blMtx, target )
    return blMtx, target
开发者ID:jonntd,项目名称:mayadev-1,代码行数:27,代码来源:sgBFunction_rigObject.py

示例6: tryConnect

 def tryConnect( srcAttr, dstAttr ):
     if not cmds.isConnected( srcAttr, dstAttr ):
         try:
             cmds.connectAttr( srcAttr, dstAttr, f=1 )
         except:
             pymelAttr = pymel.core.ls( srcAttr )[0]
             if not cmds.isConnected( pymelAttr.name(), dstAttr ):
                 try:cmds.connectAttr( pymelAttr.name(), dstAttr, f=1 )
                 except:pass
开发者ID:jonntd,项目名称:mayadev-1,代码行数:9,代码来源:__init__.py

示例7: isConnected

	def isConnected(self, other, inOrder = True ):
		""":param other: other AttributeNode
		:returns: if the attributes are connected"""
		if not self.exists:
			raise AttributeNotFound( self._node.name, self._attribute )
		if not other.exists:
			raise AttributeNotFound( self._node.name, self._attribute )
		if inOrder:
			return mc.isConnected( self.fullname, other.fullname )
		else:
			return mc.isConnected( other.fullname, self.fullname )
开发者ID:skarone,项目名称:PipeL,代码行数:11,代码来源:mayaNode.py

示例8: getInstanceObject

    def getInstanceObject():
        
        instObjName = 'sgPutObjectAtGround_instObj'
        selItem = Functions.getSelectedObject()
        
        selItemShape = cmds.listRelatives( selItem, s=1, f=1 )
        if not selItemShape: return None
        selItemShape = selItemShape[0]
        if cmds.objExists( instObjName ): 
            instObjShape = cmds.listRelatives( instObjName, s=1, f=1 )[0]
            if not cmds.isConnected( selItemShape + '.outMesh', instObjShape + '.inMesh' ):
                cmds.connectAttr( selItemShape + '.outMesh', instObjShape + '.inMesh', f=1 )
                dagPath = getDagPath( instObjShape )
                fnMesh = OpenMaya.MFnMesh( dagPath )
                fnMesh.getPoints( Tool_global.instancePoints )
            return instObjName
        
        shapeType = cmds.nodeType( selItemShape )
        
        instObjShape = cmds.createNode( shapeType )
        instObj = cmds.listRelatives( instObjShape, p=1, f=1 )[0]
        instObj = cmds.rename( instObj, instObjName )
        instObjShape = cmds.listRelatives( instObj, s=1, f=1 )[0]
        Tool_global.instShape = instObjShape
        
        if shapeType in ['nurbsSurface', 'nurbsCurve']:
            inputAttr = 'create'
            outputAttr = 'local'
        elif shapeType == 'mesh':
            inputAttr = 'inMesh'
            outputAttr = 'outMesh'
        
        if not cmds.isConnected( selItemShape + '.' + outputAttr, Tool_global.instShape + '.' + inputAttr ):
            cmds.connectAttr( selItemShape + '.' + outputAttr, Tool_global.instShape + '.' + inputAttr, f=1 )
            dagPath = getDagPath( instObjShape )
            fnMesh = OpenMaya.MFnMesh( dagPath )
            fnMesh.getPoints( Tool_global.instancePoints )

        shadingEngine = cmds.listConnections( selItemShape, s=0, d=1, type='shadingEngine' )
        if not shadingEngine: 
            cmds.sets( instObjShape, e=1, forceElement='initialShadingGroup' )
        else:
            cmds.sets( instObjShape, e=1, forceElement=shadingEngine[0] )
        
        dagPath = getDagPath( instObjShape )
        fnMesh = OpenMaya.MFnMesh( dagPath )
        fnMesh.getPoints( Tool_global.instancePoints )
        
        return instObj
开发者ID:jonntd,项目名称:mayadev-1,代码行数:49,代码来源:sgPutObjectOnGround.py

示例9: rebuildConnections

    def rebuildConnections(self):
        if not self.connectionStorage:
            raise Exception('No connection data stored to connect attributes with.')

        for node in self.connectionStorage:
            print "Node :: %s" % node
            for connectionPair in self.connectionStorage[node]:

                if connectionPair[0] == 'parent':
                    try:
                        cmds.parent(node, connectionPair[1])
                    except:
                        print "Could not connect :: %s To :: %s" % (node, connectionPair[1])

                if not cmds.objExists(connectionPair[0]) or not cmds.objExists(connectionPair[1]):
                    print '%s or %s are not valid objects, skipping to the next connection' % (
                    connectionPair[0], connectionPair[1])
                    continue

                print "Connecting :: %s To :: %s" % (connectionPair[0], connectionPair[1])

                if not cmds.isConnected(connectionPair[0], connectionPair[1]):
                    try:
                        cmds.connectAttr(connectionPair[0], connectionPair[1], f=True)
                    except:
                        print "Could not connect :: %s To :: %s" % (connectionPair[0], connectionPair[1])
开发者ID:bennymuller,项目名称:glTools,代码行数:26,代码来源:connectionAttrStorage.py

示例10: displayModCombine

def displayModCombine( sels ):
    import sgBFunction_dag
    
    targetMeshObjs = []
    
    sels = cmds.listRelatives( sels, s=1, f=1 )
    
    for sel in sels:
        if cmds.getAttr( sel+'.io' ): continue
        selP = cmds.listRelatives( sel, p=1, f=1 )[0]
        if selP.find( 'display_' ) == -1: continue
        targetMeshObjs.append( selP )
    
    targetMeshObjs = list( set( targetMeshObjs ) )
    
    cmds.select( targetMeshObjs )
    
    for targetMesh in targetMeshObjs:
        displayMod = cmds.ls( targetMesh )[0]
        realMod    = displayMod.replace( 'display_', '' )
        
        if not cmds.objExists( realMod ): continue
        
        displayModShape = sgBFunction_dag.getShape( displayMod )
        realModShape     = sgBFunction_dag.getShape( realMod )
        
        displayOrig = sgBFunction_dag.getOrigShape( displayModShape )
        
        if not cmds.isConnected( realModShape+'.outMesh', displayOrig+'.inMesh' ):
            cmds.connectAttr( realModShape+'.outMesh', displayOrig+'.inMesh', f=1 )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:30,代码来源:sgBExcute_asset.py

示例11: duplicateOnlyCurve

def duplicateOnlyCurve( curves ):
    
    import sgBFunction_dag
    curves = sgBFunction_dag.getChildrenCurveExists( curves )
    
    newCurves = []
    for curve in curves:
        curveP = sgBFunction_dag.getParent( curve )
        if curveP:
            newCurveParent = sgBFunction_dag.makeCloneObject( curveP )
        else:
            newCurveParent = None
        
        newCurveShape = cmds.createNode( 'nurbsCurve' )
        curveShape = sgBFunction_dag.getShape( curve )
        cmds.connectAttr( curveShape+'.local', newCurveShape+'.create' )
        
        newCurve = sgBFunction_dag.getTransform( newCurveShape )
        newCurve = cmds.rename( newCurve, 'du_' + curve.split( '|' )[-1] )
        if newCurveParent:
            newCurve = cmds.parent( newCurve, newCurveParent )[0]
        newCurves.append( newCurve )
    
    cmds.refresh()
    
    for i in range( len( newCurves ) ):
        curveShape = sgBFunction_dag.getShape( curves[i] )
        newCurveShape = sgBFunction_dag.getShape( newCurves[i] )
        if cmds.isConnected( curveShape+'.local', newCurveShape+'.create' ):
            cmds.disconnectAttr( curveShape+'.local', newCurveShape+'.create' )
    
    return newCurves
开发者ID:jonntd,项目名称:mayadev-1,代码行数:32,代码来源:sgBFunction_curve.py

示例12: cmdCreate

 def cmdCreate(self, *args ):
     
     import sgBFunction_dag
     
     controller = self.popupController.getFieldText()
     curves = self.popupCurves.getFieldTexts()
     
     curves = sgBFunction_dag.getChildrenShapeExists( curves )
     
     copyAttrs = [ 'globalEnvelope', 'globalWave1', 'globalTimeMult1', 'globalOffset1', 'globalLength1', 'globalWave2', 'globalTimeMult2', 'globalOffset2', 'globalLength2' ]
     
     targetCrvs = []
     aimMatrixs = []
     
     targetCrvGrps = cmds.createNode( 'transform', n= 'WobbleCurveGrp' )
     aimMatrixGrps = cmds.createNode( 'transform', n= 'aimMatrixGrp' )
     
     createNewCurve = cmds.checkBox( self.check, q=1, v=1 )
     
     for curve in curves:
         targetCrv, aimMatrix = sgRigCurve.createSgWobbleCurve( curve, True, createNewCurve, '_wobble' )
         
         targetCrvs.append( targetCrv )
         aimMatrixs.append( aimMatrix )
         
         for copyAttr in copyAttrs:
             sgRigAttribute.copyAttribute( targetCrv+'.'+copyAttr, controller )
             if cmds.isConnected( controller+'.'+copyAttr, targetCrv+'.'+copyAttr ): continue
             cmds.connectAttr( controller+'.'+copyAttr, targetCrv+'.'+copyAttr )
     
     if createNewCurve : cmds.parent( targetCrvs, targetCrvGrps )
     cmds.parent( aimMatrixs, aimMatrixGrps )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:32,代码来源:sgPWindow_curve_sgWobbleCurve.py

示例13: ctlVisConnection

def ctlVisConnection( ctl, targets, attrName = 'ctlVis' ):

    import sgBFunction_attribute
    
    sgBFunction_attribute.addAttr( ctl, ln=attrName, min=0, max=1, at='long', k=1 )
        
    for target in targets:
        targetP = cmds.listRelatives( target, p=1, f=1 )[0]
        
        if not cmds.isConnected( ctl+'.'+attrName, target+'.v' ):
            try:
                cmds.connectAttr( ctl+'.'+attrName, target+'.v' )
            except:
                if not cmds.isConnected( ctl+'.'+attrName, targetP+'.v' ):
                    try:cmds.connectAttr( ctl+'.'+attrName, targetP+'.v' )
                    except:pass
开发者ID:jonntd,项目名称:mayadev-1,代码行数:16,代码来源:sgBFunction_connection.py

示例14: breakReferencePlaceholderConnections

def breakReferencePlaceholderConnections(shape):
    """
    Break all reference placeholder connections to the shape.instObjGroups plug.
    @param shape: Shape to break reference placeholder connections from.
    @type shape: str
    """
    # Get Shape Connections
    placeHolderConn = cmds.listConnections(shape, s=True, d=True, p=True, c=True) or []

    # For Each Connection Pair
    for i in range(0, len(placeHolderConn), 2):

        # Check Reference Connection
        placeHolderNode = cmds.ls(placeHolderConn[i + 1], o=True)[0]
        if glTools.utils.reference.isReference(placeHolderNode):

            # Disconnect PlaceHolder
            if cmds.isConnected(placeHolderConn[i], placeHolderConn[i + 1]):
                try:
                    cmds.disconnectAttr(placeHolderConn[i], placeHolderConn[i + 1])
                except:
                    print('FAILED: ' + placeHolderConn[i] + ' >X< ' + placeHolderConn[i + 1] + '!')
                else:
                    print('Disconnected: ' + placeHolderConn[i] + ' >X< ' + placeHolderConn[i + 1] + '...')
            else:
                try:
                    cmds.disconnectAttr(placeHolderConn[i + 1], placeHolderConn[i])
                except:
                    print('FAILED: ' + placeHolderConn[i + 1] + ' >X< ' + placeHolderConn[i] + '!')
                else:
                    print('Disconnected: ' + placeHolderConn[i + 1] + ' >X< ' + placeHolderConn[i] + '...')
开发者ID:bennymuller,项目名称:glTools,代码行数:31,代码来源:shader.py

示例15: checkExistingItp

    def checkExistingItp( self, mainBlendShape, targetGeoms, indies ):
        
        neadIndies = []
        
        for i in range( len( indies ) ):
            index  = indies[i]
            targetGeomShape = cmds.listRelatives( targetGeoms[i+1], s=1 )[0]
            if cmds.attributeQuery( 'isFixEditMesh', node=targetGeomShape, ex=1 ): continue
            neadIndies.append( index )
        
        itpNodes = cmds.listConnections( mainBlendShape, type='vectorInterpolation' )
        if not itpNodes: return None
        itpNodes = list( set( itpNodes ) )

        for itpNode in itpNodes:
            inputs = cmds.listConnections( itpNode, s=1, d=0, c=1, type='blendShape' )[::2]
            
            if len( inputs ) != len( neadIndies ):
                continue
            
            inputConnected = True
            for inputValue in inputs:
                
                connected = False
                for index in indies:
                    if cmds.isConnected( mainBlendShape+'.w[%d]' % index, inputValue ): connected=True
                
                if not connected:
                    inputConnected = False
            
            if inputConnected: return itpNode
            
        return None
开发者ID:jonntd,项目名称:mayadev-1,代码行数:33,代码来源:createFixEditShape.py


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