Python maya.cmds.connectAttr() Examples

The following are 30 code examples of maya.cmds.connectAttr(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module maya.cmds , or try the search function .
Example #1
Source File: dpIsolate.py    From dpAutoRigSystem with GNU General Public License v2.0 6 votes vote down vote up
def dpIsolate(self, attrName, nodeList, *args):
        """ Function to run isolate setup.
        """
        # get father zero out transform node
        zeroGrp = cmds.listRelatives(nodeList[2], allParents=True, type="transform")[0]
        # create parent constraint
        pConst = cmds.parentConstraint(nodeList[0], nodeList[1], zeroGrp, maintainOffset=True, skipTranslate=["x", "y", "z"])[0]
        # add isolate attribute to selected control
        cmds.addAttr(nodeList[2], longName=attrName, defaultValue=1.0, minValue=0, maxValue=1, keyable=True) 
        # create reverse node
        reverseNode = cmds.createNode('reverse', name=nodeList[2]+"_"+attrName.capitalize()+"_Rev")
        # do isolate connections
        cmds.connectAttr(nodeList[2]+"."+attrName, pConst+"."+nodeList[0]+"W0", force=True)
        cmds.connectAttr(nodeList[2]+"."+attrName, reverseNode+".inputX", force=True)
        cmds.connectAttr(reverseNode+".outputX", pConst+"."+nodeList[1]+"W1", force=True)
        cmds.select(nodeList[2]) 
Example #2
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def cloud():
    node = cmds.shadingNode('cloud', asTexture=True)
    tex = cmds.shadingNode('place3dTexture', asUtility=True)
    cmds.connectAttr(
        tex + '.worldInverseMatrix', node + '.placementMatrix') 
Example #3
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def stucco():
    node = cmds.shadingNode('stucco', asTexture=True)
    tex = cmds.shadingNode('place3dTexture', asUtility=True)
    cmds.connectAttr(
        tex + '.worldInverseMatrix', node + '.placementMatrix') 
Example #4
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def bulge():
    node = cmds.shadingNode('bulge', asTexture=True)
    tex = cmds.shadingNode('place2dTexture', asUtility=True)
    cmds.connectAttr(tex + '.outUV', node + '.uvCoord')
    cmds.connectAttr(tex + '.outUvFilterSize', node + '.uvFilterSize')
    cmds.setAttr(tex + '.repeatU', 4)
    cmds.setAttr(tex + '.repeatV', 4) 
Example #5
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def cloth():
    node = cmds.shadingNode('cloth', asTexture=True)
    tex = cmds.shadingNode('place2dTexture', asUtility=True)
    cmds.connectAttr(tex + '.outUV', node + '.uvCoord')
    cmds.connectAttr(tex + '.outUvFilterSize', node + '.uvFilterSize')
    cmds.setAttr(tex + '.repeatU', 4)
    cmds.setAttr(tex + '.repeatV', 4) 
Example #6
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def fluidTexture2D():
    node = cmds.shadingNode('fluidTexture2D', asTexture=True)
    tex = cmds.shadingNode('place2dTexture', asUtility=True)
    cmds.connectAttr(tex + '.outUV', node + '.uvCoord')
    cmds.connectAttr(tex + '.outUvFilterSize', node + '.uvFilterSize') 
Example #7
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def fractal():
    node = cmds.shadingNode('fractal', asTexture=True)
    tex = cmds.shadingNode('place2dTexture', asUtility=True)
    cmds.connectAttr(tex + '.outUV', node + '.uvCoord')
    cmds.connectAttr(tex + '.outUvFilterSize', node + '.uvFilterSize')
    cmds.setAttr(tex + '.repeatU', 1)
    cmds.setAttr(tex + '.repeatV', 1) 
Example #8
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def grid():
    node = cmds.shadingNode('grid', asTexture=True)
    tex = cmds.shadingNode('place2dTexture', asUtility=True)
    cmds.connectAttr(tex + '.outUV', node + '.uvCoord')
    cmds.connectAttr(tex + '.outUvFilterSize', node + '.uvFilterSize')
    cmds.setAttr(tex + '.repeatU', 4)
    cmds.setAttr(tex + '.repeatV', 4) 
Example #9
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def mandelbrot():
    node = cmds.shadingNode('mandelbrot', asTexture=True)
    tex = cmds.shadingNode('place2dTexture', asUtility=True)
    cmds.connectAttr(tex + '.outUV', node + '.uvCoord')
    cmds.connectAttr(tex + '.outUvFilterSize', node + '.uvFilterSize') 
Example #10
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def movie():
    node = cmds.shadingNode('movie', asTexture=True)
    tex = cmds.shadingNode('place2dTexture', asUtility=True)
    cmds.connectAttr(tex + '.outUV', node + '.uvCoord')
    cmds.connectAttr(tex + '.outUvFilterSize', node + '.uvFilterSize')
    cmds.setAttr(tex + '.repeatU', 1)
    cmds.setAttr(tex + '.repeatV', 1) 
Example #11
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def noise():
    node = cmds.shadingNode('noise', asTexture=True)
    tex = cmds.shadingNode('place2dTexture', asUtility=True)
    cmds.connectAttr(tex + '.outUV', node + '.uvCoord')
    cmds.connectAttr(tex + '.outUvFilterSize', node + '.uvFilterSize')
    cmds.setAttr(tex + '.repeatU', 1)
    cmds.setAttr(tex + '.repeatV', 1) 
Example #12
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def envSphere():
    node = cmds.shadingNode('envSphere', asTexture=True)
    tex = cmds.shadingNode('place3dTexture', asUtility=True)
    cmds.connectAttr(
        tex + '.worldInverseMatrix', node + '.placementMatrix') 
Example #13
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def marble():
    node = cmds.shadingNode('marble', asTexture=True)
    tex = cmds.shadingNode('place3dTexture', asUtility=True)
    cmds.connectAttr(
        tex + '.worldInverseMatrix', node + '.placementMatrix') 
Example #14
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def mandelbrot3D():
    node = cmds.shadingNode('mandelbrot3D', asTexture=True)
    tex = cmds.shadingNode('place3dTexture', asUtility=True)
    cmds.connectAttr(
        tex + '.worldInverseMatrix', node + '.placementMatrix') 
Example #15
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def leather():
    node = cmds.shadingNode('leather', asTexture=True)
    tex = cmds.shadingNode('place3dTexture', asUtility=True)
    cmds.connectAttr(
        tex + '.worldInverseMatrix', node + '.placementMatrix') 
Example #16
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def granite():
    node = cmds.shadingNode('granite', asTexture=True)
    tex = cmds.shadingNode('place3dTexture', asUtility=True)
    cmds.connectAttr(
        tex + '.worldInverseMatrix', node + '.placementMatrix') 
Example #17
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def rock():
    node = cmds.shadingNode('rock', asTexture=True)
    tex = cmds.shadingNode('place3dTexture', asUtility=True)
    cmds.connectAttr(
        tex + '.worldInverseMatrix', node + '.placementMatrix') 
Example #18
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def brownian():
    node = cmds.shadingNode('brownian', asTexture=True)
    tex = cmds.shadingNode('place3dTexture', asUtility=True)
    cmds.connectAttr(
        tex + '.worldInverseMatrix', node + '.placementMatrix') 
Example #19
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def displacementShader():
    node = cmds.shadingNode('displacementShader', asShader=True)
    shaderGroup = cmds.sets(renderable=True, noSurfaceShader=True,
                            empty=True, name=node + "SG")
    cmds.connectAttr(
        node + '.displacement',
        shaderGroup + '.displacementShader',
        force=True) 
Example #20
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def cMuscleShader():
    node = cmds.shadingNode('cMuscleShader', asShader=True)
    shaderGroup = cmds.sets(renderable=True, noSurfaceShader=True,
                            empty=True, name=node + "SG")
    cmds.connectAttr(
        node + '.outColor',
        shaderGroup + '.displacementShader',
        force=True) 
Example #21
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def volumeShader():
    node = cmds.shadingNode('volumeShader', asShader=True)
    shaderGroup = cmds.sets(renderable=True, noSurfaceShader=True,
                            empty=True, name=node + "SG")
    cmds.connectAttr(
        node + '.outColor', shaderGroup + '.volumeShader', force=True) 
Example #22
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def particleCloud():
    node = cmds.shadingNode('particleCloud', asShader=True)
    shaderGroup = cmds.sets(renderable=True, noSurfaceShader=True,
                            empty=True, name=node + "SG")
    cmds.connectAttr(
        node + '.outColor', shaderGroup + '.volumeShader', force=True) 
Example #23
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def lightFog():
    node = cmds.shadingNode('lightFog', asShader=True)
    shaderGroup = cmds.sets(renderable=True, noSurfaceShader=True,
                            empty=True, name=node + "SG")
    cmds.connectAttr(
        node + '.outColor', shaderGroup + '.volumeShader', force=True) 
Example #24
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def fluidShape():
    node = cmds.shadingNode('fluidShape', asShader=True)
    shaderGroup = cmds.sets(renderable=True, noSurfaceShader=True,
                            empty=True, name=node + "SG")
    cmds.connectAttr(
        node + '.outColor', shaderGroup + '.volumeShader', force=True)
    cmds.connectAttr("time1.outTime", node + ".currentTime") 
Example #25
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def envFog():
    node = cmds.shadingNode('envFog', asShader=True)
    shaderGroup = cmds.sets(renderable=True, noSurfaceShader=True,
                            empty=True, name=node + "SG")
    cmds.connectAttr(
        node + '.outColor', shaderGroup + '.volumeShader', force=True) 
Example #26
Source File: MayaNodes.py    From rush with MIT License 5 votes vote down vote up
def oceanShader():
    node = cmds.shadingNode('oceanShader', asTexture=True)
    cmds.connectAttr("time1.outTime", node + ".time") 
Example #27
Source File: BlendTransforms.py    From BlendTransforms with The Unlicense 5 votes vote down vote up
def BT_DisconnectSetup(set = None):
    
    if not set:
        return False

    if not BT_IsSetupConnected(set = set):
        cmds.warning('Setup already disconnected!')
        return False

    btNode = cmds.getAttr(set +'.Blend_Node')
    if not btNode or not cmds.objExists(btNode):
        return False

    numOutputs = cmds.getAttr(btNode +'.output', size = True)
    print numOutputs
    tempMult = None
    for i in range(0, numOutputs):

        conns = cmds.listConnections(btNode +'.output[' +str(i) +'].outputT', s = False, d = True)
        if conns:
            tempMult = cmds.createNode('multiplyDivide')
            cmds.disconnectAttr(btNode +'.output[' +str(i) +'].outputT', conns[0] +'.translate')
            cmds.connectAttr(btNode +'.output[' +str(i) +'].outputT', tempMult +'.input1')

        conns = cmds.listConnections(btNode +'.output[' +str(i) +'].outputR', s = False, d = True)
        if conns:
            tempMult = cmds.createNode('multiplyDivide')
            cmds.disconnectAttr(btNode +'.output[' +str(i) +'].outputR', conns[0] +'.rotate')
            cmds.connectAttr(btNode +'.output[' +str(i) +'].outputR', tempMult +'.input1')
        
        conns = cmds.listConnections(btNode +'.output[' +str(i) +'].outputS', s = False, d = True)
        if conns:
            tempMult = cmds.createNode('multiplyDivide')
            cmds.disconnectAttr(btNode +'.output[' +str(i) +'].outputS', conns[0] +'.scale')
            cmds.connectAttr(btNode +'.output[' +str(i) +'].outputS', tempMult +'.input1')

    cmds.select(cl = True)

    return True 
Example #28
Source File: BlendTransforms.py    From BlendTransforms with The Unlicense 5 votes vote down vote up
def BT_ConnectOutputs(index = 0, node = None, transform = None):
    if not transform:
        return False
    
    cmds.connectAttr(node +'.output[' +str(index) +'].outputT', transform +'.translate')
    cmds.connectAttr(node +'.output[' +str(index) +'].outputR', transform +'.rotate')
    cmds.connectAttr(node +'.output[' +str(index) +'].outputS', transform +'.scale')

    return True 
Example #29
Source File: BlendTransforms.py    From BlendTransforms with The Unlicense 5 votes vote down vote up
def BT_ConnectOutputs(index = 0, node = None, transform = None):
    if not transform:
        return False
    
    cmds.connectAttr(node +'.output[' +str(index) +'].outputT', transform +'.translate')
    cmds.connectAttr(node +'.output[' +str(index) +'].outputR', transform +'.rotate')
    cmds.connectAttr(node +'.output[' +str(index) +'].outputS', transform +'.scale')

    return True 
Example #30
Source File: BlendTransforms.py    From BlendTransforms with The Unlicense 5 votes vote down vote up
def BT_ConnectOutputs(index = 0, node = None, transform = None):
    if not transform:
        return False
    
    cmds.connectAttr(node +'.output[' +str(index) +'].outputT', transform +'.translate')
    cmds.connectAttr(node +'.output[' +str(index) +'].outputR', transform +'.rotate')
    cmds.connectAttr(node +'.output[' +str(index) +'].outputS', transform +'.scale')

    return True