Python maya.cmds.disconnectAttr() Examples
The following are 19
code examples of maya.cmds.disconnectAttr().
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: createGreenCageDeformer.py From maya_greenCageDeformer with MIT License | 6 votes |
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]])
Example #2
Source File: rbf.py From cmt with MIT License | 6 votes |
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))
Example #3
Source File: rbf.py From cmt with MIT License | 6 votes |
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
Example #4
Source File: control.py From cmt with MIT License | 6 votes |
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)
Example #5
Source File: uExport.py From uExport with zlib License | 6 votes |
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)
Example #6
Source File: uExport.py From uExport with zlib License | 6 votes |
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)
Example #7
Source File: freeze.py From SIWeightEditor with MIT License | 5 votes |
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)
Example #8
Source File: AEsporeNodeTemplate.py From spore with MIT License | 5 votes |
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()
Example #9
Source File: rbf.py From cmt with MIT License | 5 votes |
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
Example #10
Source File: rbf.py From cmt with MIT License | 5 votes |
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
Example #11
Source File: plot.py From cmdx with BSD 2-Clause "Simplified" License | 5 votes |
def teardown(): cmds.disconnectAttr("transform1.tx", "transform2.tx")
Example #12
Source File: BlendTransforms.py From BlendTransforms with The Unlicense | 5 votes |
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 #13
Source File: BlendTransforms.py From BlendTransforms with The Unlicense | 5 votes |
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 #14
Source File: BlendTransforms.py From BlendTransforms with The Unlicense | 5 votes |
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 #15
Source File: BlendTransforms.py From BlendTransforms with The Unlicense | 4 votes |
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
Example #16
Source File: BlendTransforms.py From BlendTransforms with The Unlicense | 4 votes |
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
Example #17
Source File: BlendTransforms.py From BlendTransforms with The Unlicense | 4 votes |
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
Example #18
Source File: BlendTransforms.py From BlendTransforms with The Unlicense | 4 votes |
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
Example #19
Source File: freeze.py From SISideBar with MIT License | 4 votes |
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)