当前位置: 首页>>代码示例>>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;未经允许,请勿转载。