當前位置: 首頁>>代碼示例>>Python>>正文


Python cmds.disconnectAttr方法代碼示例

本文整理匯總了Python中maya.cmds.disconnectAttr方法的典型用法代碼示例。如果您正苦於以下問題:Python cmds.disconnectAttr方法的具體用法?Python cmds.disconnectAttr怎麽用?Python cmds.disconnectAttr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maya.cmds的用法示例。


在下文中一共展示了cmds.disconnectAttr方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: connectRenderMeshes

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
def connectRenderMeshes(self, renderMeshes, LOD=0):
        try:
            cmds.undoInfo(openChunk=True)
            lodAttr = None
            if LOD >=0 or LOD <=4:
                lodAttr = self.node + '.rendermeshes_LOD' + str(LOD)
                conns = cmds.listConnections(lodAttr, plugs=1, destination=1)
                if conns:
                    for conn in cmds.listConnections(lodAttr, plugs=1, destination=1):
                        cmds.disconnectAttr(lodAttr, conn)
            if lodAttr:
                for mesh in renderMeshes:
                    msgConnect(lodAttr, mesh + '.uExport')
            else:
                cmds.error('connectRenderMeshes>>> please specify a LOD integer (0-4) for your meshes')

        except Exception as e:
            print e
        finally:
            cmds.undoInfo(closeChunk=True) 
開發者ID:chrisevans3d,項目名稱:uExport,代碼行數:22,代碼來源:uExport.py

示例2: connectRoot

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
def connectRoot(self, uNode, root, rewire=1):
        try:
            cmds.undoInfo(openChunk=True)
            if rewire:
                conns = cmds.listConnections(uNode + '.export_root', plugs=1, source=1)
                if conns:
                    for conn in conns:
                        cmds.disconnectAttr(conn, uNode + '.export_root')

            if not attrExists(root+'.export'):
                cmds.addAttr(root, longName='export', attributeType='message')
            cmds.connectAttr(root + '.export', uNode + '.export_root' )
        except Exception as e:
            print e
        finally:
            cmds.undoInfo(closeChunk=True) 
開發者ID:chrisevans3d,項目名稱:uExport,代碼行數:18,代碼來源:uExport.py

示例3: _set_from_curve

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
def _set_from_curve(self, transform):
        """Store the parameters from an existing curve in the CurveShape object.

        :param transform: Transform
        """
        shape = shortcuts.get_shape(transform)
        if shape and cmds.nodeType(shape) == "nurbsCurve":
            create_attr = "{}.create".format(shape)
            connection = cmds.listConnections(create_attr, plugs=True, d=False)
            if connection:
                cmds.disconnectAttr(connection[0], create_attr)
            self.transform = transform
            self.cvs = cmds.getAttr("{}.cv[*]".format(shape))
            self.degree = cmds.getAttr("{}.degree".format(shape))
            self.form = cmds.getAttr("{}.form".format(shape))
            self.knots = get_knots(shape)
            if cmds.getAttr("{}.overrideEnabled".format(shape)):
                if cmds.getAttr("{}.overrideRGBColors".format(shape)):
                    self.color = cmds.getAttr("{}.overrideColorRGB".format(shape))[0]
                else:
                    self.color = cmds.getAttr("{}.overrideColor".format(shape))
            else:
                self.color = None
            if connection:
                cmds.connectAttr(connection[0], create_attr) 
開發者ID:chadmv,項目名稱:cmt,代碼行數:27,代碼來源:control.py

示例4: set_inputs

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
def set_inputs(self, inputs):
        """Set the rbf inputs to the given list of attributes.

        :param inputs: List of attributes
        """
        current_inputs = self.inputs()
        # Disconnect existing inputs
        for i, attribute in enumerate(current_inputs):
            cmds.disconnectAttr(attribute, "{}.inputValue[{}]".format(self.name, i))

        if not inputs:
            cmds.setAttr("{}.inputValueCount".format(self.name), 0)
            return
        for i, attribute in enumerate(inputs):
            cmds.connectAttr(attribute, "{}.inputValue[{}]".format(self.name, i))
        cmds.setAttr("{}.inputValueCount".format(self.name), len(inputs))
        # TODO: Reshuffle samples if inputs are being re-used 
開發者ID:chadmv,項目名稱:cmt,代碼行數:19,代碼來源:rbf.py

示例5: set_output_transforms

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
def set_output_transforms(self, output_transforms):
        current_output_transforms = self.output_transforms()
        # Disconnect existing transforms
        for i, node in enumerate(current_output_transforms):
            cmds.disconnectAttr(
                "{}.outputRotate[{}]".format(self.name, i), "{}.r".format(node)
            )

        if not output_transforms:
            cmds.setAttr("{}.outputQuatCount".format(self.name), 0)
            return
        for i, node in enumerate(output_transforms):
            cmds.connectAttr(
                "{}.outputRotate[{}]".format(self.name, i), "{}.r".format(node)
            )
        cmds.setAttr("{}.outputQuatCount".format(self.name), len(output_transforms)) 
開發者ID:chadmv,項目名稱:cmt,代碼行數:18,代碼來源:rbf.py

示例6: doit

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
def doit(cage_tgt=None):
    if not cage_tgt:
        cage_tgt = cmds.ls(sl=True, o=True)
    cage = cage_tgt[0]
    tgt = cage_tgt[1:]

    cmds.loadPlugin('greenCageDeformer.py', qt=True)
    deformer = cmds.deformer(tgt, type='greenCageDeformer')[0]

    freezer = cmds.createNode('transformGeometry')
    cmds.connectAttr(cage + '.o', freezer + '.ig')
    cmds.connectAttr(cage + '.wm', freezer + '.txf')
    cmds.connectAttr(freezer + '.og', deformer + '.bc')
    cmds.disconnectAttr(freezer + '.og', deformer + '.bc')
    cmds.delete(freezer)

    cmds.connectAttr(cage + '.w', deformer + '.ic')
    cmds.dgeval(cmds.listConnections(deformer + '.og', s=False, d=True, sh=True, p=True))


#doit([cmds.polyCube(w=2.5, d=2.5, h=2.5)[0], cmds.polySphere()[0]]) 
開發者ID:ryusas,項目名稱:maya_greenCageDeformer,代碼行數:23,代碼來源:createGreenCageDeformer.py

示例7: remove_instance

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
def remove_instance(self):
        selection = cmds.textScrollList('instanceList', q=1, selectItem=True)
        instancer = node_utils.get_instancer(self._node)

        if selection:
            for item in selection:
                obj_name = item.split(' ')[-1]
                connections = cmds.listConnections(obj_name, instancer, p=True, d=True, s=False)
                connection = [c for c in connections if c.split('.')[0] == instancer]
                for connection in connections:
                    if connection.split('.')[0] == instancer.split('|')[-1]:
                        cmds.disconnectAttr('{}.matrix'.format(obj_name), connection)

        self.update_instance_list() 
開發者ID:wiremas,項目名稱:spore,代碼行數:16,代碼來源:AEsporeNodeTemplate.py

示例8: repareDagSetMember

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
def repareDagSetMember(node):
    #Dagセットメンバーの接続を修正する、シンメトリウェイトできないとき用。
    shadingEngin = get_shading_engines(node)
    if shadingEngin == []:
        return
    shapes = cmds.listRelatives(node, s=True, pa=True, type='mesh')
    connections = cmds.listConnections(shapes[0], d=True, s=False, p=True, c=True)
    for con in connections:
        if shadingEngin[0]+'.dagSetMembers' in con:
            conAttr = con
            listIndex = connections.index(con)
            disconAttr = connections[listIndex-1]
            cmds.disconnectAttr(disconAttr, conAttr)
    cmds.connectAttr(shapes[0]+'.instObjGroups[0]', conAttr, f=True) 
開發者ID:ShikouYamaue,項目名稱:SISideBar,代碼行數:16,代碼來源:freeze.py

示例9: BT_DisconnectSetup

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
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 
開發者ID:duncanskertchly,項目名稱:BlendTransforms,代碼行數:41,代碼來源:BlendTransforms.py

示例10: teardown

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
def teardown():
    cmds.disconnectAttr("transform1.tx", "transform2.tx") 
開發者ID:mottosso,項目名稱:cmdx,代碼行數:4,代碼來源:plot.py

示例11: set_input_transforms

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
def set_input_transforms(self, input_transforms):
        current_input_transforms = self.input_transforms()
        # Disconnect existing input transforms
        for i, attribute in enumerate(current_input_transforms):
            cmds.disconnectAttr(attribute, "{}.inputQuat[{}]".format(self.name, i))

        if not input_transforms:
            cmds.setAttr("{}.inputQuatCount".format(self.name), 0)
            return
        for i, transform in enumerate(input_transforms):
            rotation = cmds.createNode(
                "decomposeMatrix", name="{}_rotation".format(transform)
            )
            cmds.connectAttr(
                "{}.matrix".format(transform), "{}.inputMatrix".format(rotation)
            )
            cmds.connectAttr(
                "{}.outputQuat".format(rotation),
                "{}.inputQuat[{}]".format(self.name, i),
            )
            q = cmds.getAttr("{}.outputQuat".format(rotation))[0]
            cmds.setAttr(
                "{}.inputRestQuat[{}]".format(self.name, i), *q, type="double4"
            )
        cmds.setAttr("{}.inputQuatCount".format(self.name), len(input_transforms))
        # TODO: Reshuffle samples if inputs are being re-used 
開發者ID:chadmv,項目名稱:cmt,代碼行數:28,代碼來源:rbf.py

示例12: set_outputs

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
def set_outputs(self, outputs):
        current_outputs = self.outputs()
        # Disconnect existing outputs
        for i, attribute in enumerate(current_outputs):
            cmds.disconnectAttr("{}.outputValue[{}]".format(self.name, i), attribute)

        if not outputs:
            cmds.setAttr("{}.outputValueCount".format(self.name), 0)
            return
        for i, attribute in enumerate(outputs):
            cmds.connectAttr(
                "{}.outputValue[{}]".format(self.name, i), attribute, f=True
            )
        cmds.setAttr("{}.outputValueCount".format(self.name), len(outputs))
        # TODO: Reshuffle samples if outputs are being re-used 
開發者ID:chadmv,項目名稱:cmt,代碼行數:17,代碼來源:rbf.py

示例13: BT_DeletePose

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import disconnectAttr [as 別名]
def BT_DeletePose(set = None, poseIndex = None):

    if not set or poseIndex is None:
        return False
    
    if not cmds.attributeQuery('Blend_Node', ex = True, n = set):
        return False

    if BT_IsSetupConnected(set):
        cmds.warning('Disconnect setup first!')
        return False

    blendNode = cmds.getAttr(set +'.Blend_Node')

    if not cmds.objExists(blendNode) or not cmds.objExists(set):
        return False

    numTransforms = cmds.getAttr(blendNode +'.transforms', size = True)

    if not numTransforms:
        return False

    numPoses = cmds.getAttr(blendNode +'.transforms[0].poses', size = True) 
    allUserDefined = cmds.listAttr(set, ud = True)
    btUserDefined = [x for x in allUserDefined if x.startswith('BT_')]

    if poseIndex >= numPoses:
        return False

    connectionsToBreak = cmds.listConnections(set +'.' +btUserDefined[poseIndex], d = True, s = False, p = True)
    for ctb in connectionsToBreak:
        cmds.disconnectAttr(set +'.' +btUserDefined[poseIndex], ctb)
    cmds.deleteAttr(set +'.' +btUserDefined[poseIndex])

    for i in range(0, numTransforms):
        for p in range(poseIndex, numPoses-1):
            #get the next items vales
            matrix = cmds.getAttr(blendNode +'.transforms[' +str(i) +'].poses[' +str(p+1) +'].matrix')
            scale = cmds.getAttr(blendNode +'.transforms[' +str(i) +'].poses[' +str(p+1) +'].scale')[0]
            conn = cmds.listConnections(blendNode +'.transforms[' +str(i) +'].poses[' +str(p+1) +'].weight', s = True, d = False, p = True)[0]

            cmds.setAttr(blendNode +'.transforms[' +str(i) +'].poses[' +str(p) +'].matrix', matrix, type = 'matrix')
            cmds.setAttr(blendNode +'.transforms[' +str(i) +'].poses[' +str(p) +'].scale', scale[0], scale[1], scale[2], type = 'double3')
            cmds.connectAttr(conn, blendNode +'.transforms[' +str(i) +'].poses[' +str(p) +'].weight', force = True)
            cmds.disconnectAttr(conn, blendNode +'.transforms[' +str(i) +'].poses[' +str(p+1) +'].weight')

    return True 
開發者ID:duncanskertchly,項目名稱:BlendTransforms,代碼行數:49,代碼來源:BlendTransforms.py


注:本文中的maya.cmds.disconnectAttr方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。