• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.disconnectAttr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: updateOutMesh

def updateOutMesh(srcMesh=None, outMesh=None, force=True):
    """
    Update given outMesh, then remove connection

    :param srcMesh: Source mesh
    :type srcMesh: str
    :param outMesh: Out mesh
    :type outMesh: str
    :param force: Force connection
    :type force: True
    """
    # --- Check Object List ---#
    if srcMesh is None and outMesh is None:
        selObjects = mc.ls(sl=True)
        print selObjects
        if not selObjects:
            print "!!! Error: Select srcMesh, then outMesh !!!"
        else:
            srcMesh = selObjects[0]
            outMesh = selObjects[1]
    # --- Update Mesh ---#
    connectOutMesh(srcMesh, outMesh, force=force)
    mc.refresh()
    mc.disconnectAttr("%s.worldMesh" % srcMesh, "%s.inMesh" % outMesh)
    print "// Update %s.worldMesh ---> %s.inMesh" % (srcMesh, outMesh)
开发者ID:snaress,项目名称:studio_dev,代码行数:25,代码来源:pMode.py


示例2: disconnect

 def disconnect(self, plug):
     if plug is str:
         plug = Plug.fromName(plug)
     if plug.isArray:
         mc.disconnectAttr(self.name, plug.name, nextAvailable = True)
     else:
         mc.disconnectAttr(self.name, plug.name)
开发者ID:hal1932,项目名称:pm2,代码行数:7,代码来源:plug.py


示例3: create

def create(geo,wrapGeo,worldSpace=True,prefix=''):
	'''
	Create a wrap deformer using the specified geometry
	@param geo: Geometry to deform
	@type geo: str
	@param wrapGeo: Wrap deformer influence geometry
	@type wrapGeo: str
	@param prefix: Naming prefix
	@type prefix: str
	'''
	# Build/Store Selection
	sel = mc.ls(sl=1)
	mc.select(geo,wrapGeo)
	
	# Create Wrap Deformer
	mm.eval('CreateWrap')
	wrap = mc.ls(mc.listHistory(geo),type='wrap')[0]
	wrap = mc.rename(wrap,prefix+'_wrap')
	
	# World/Local Space Deformation
	if not worldSpace:
		geomMatrixInput = mc.listConnections(wrap+'.geomMatrix',s=True,d=False,p=True)
		if geomMatrixInput: mc.disconnectAttr(geomMatrixInput[0],wrap+'.geomMatrix')
	
	# Clean Base
	cleanWrapBase(wrap)
	
	# Restore Selection
	if sel: mc.select(sel)
	
	# Return Result
	return wrap
开发者ID:auqeyjf,项目名称:glTools,代码行数:32,代码来源:wrap.py


示例4: duplicateObj

 def duplicateObj( self, targetObj, skinNode, addName='_add' ):
     
     if cmds.nodeType( targetObj ) != 'transform':
         targetObj = cmds.listRelatives( targetObj, p=1 )
         
         if targetObj: targetObj = targetObj [0]
         else: return None
     targetShape = cmds.listRelatives( targetObj, s=1 )[0]
     targetAttr = targetShape+'.outMesh'
     outputAttr = cmds.listConnections( skinNode+'.input[0].inputGeometry', s=1, d=0, p=1, c=1 )[1]
     
     secondMesh = cmds.createNode( 'mesh' )
     thirdMesh  = cmds.createNode( 'mesh' )
     
     secondObj = cmds.listRelatives( secondMesh, p=1 )[0]
     thirdObj  = cmds.listRelatives( thirdMesh, p=1 )[0]
     
     cmds.connectAttr( targetAttr, secondMesh+'.inMesh' )
     cmds.connectAttr( outputAttr, thirdMesh +'.inMesh' )
     
     cmds.refresh()
     
     cmds.disconnectAttr( targetAttr, secondMesh+'.inMesh' )
     cmds.disconnectAttr( outputAttr, thirdMesh +'.inMesh' )
     
     secondObj = cmds.rename( secondObj, targetObj+addName )
     thirdObj  = cmds.rename( thirdObj , targetObj+addName+'_inv' )
     
     return secondObj, thirdObj
开发者ID:jonntd,项目名称:mayadev-1,代码行数:29,代码来源:simpleAddShape.py


示例5: getSourceCurveAttr

def getSourceCurveAttr( shape ):
    
    cons = cmds.listConnections( shape+'.create', s=1, d=0, p=1, c=1 )
    shapeP = cmds.listRelatives( shape, p=1 )[0]
    
    if not cons:
        
        duObj = cmds.duplicate( shape )[0]
        duShapes = cmds.listRelatives( duObj, s=1, f=1 )
        
        targetOrig = ''
        for duShape in duShapes:
            if not cmds.getAttr( duShape+'.io' ):
                targetOrig = duShape
                break
        
        cmds.setAttr( targetOrig+'.io', 1 )
        targetOrig = cmds.parent( targetOrig, shapeP, s=1, add=1 )[0]
        
        cmds.delete( duObj )
        
        cons = cmds.listConnections( shape+'.controlPoints', p=1, c=1, s=1, d=0 )
        if cons:
            for i in range( 0, len( cons ), 2 ):
                cmds.connectAttr( cons[i+1], cons[i].replace( shape, targetOrig ) )
                cmds.disconnectAttr( cons[i+1], cons[i] )
            
        return targetOrig+'.local'
        
    else:
        return cons[1]
开发者ID:jonntd,项目名称:mayadev-1,代码行数:31,代码来源:sgModelCurve.py


示例6: _disable_editing_for_deformer

def _disable_editing_for_deformer(deformer):
    # Select the inverted blend shape, so we're symmetrical with what enable_editing does.
    # That way, enable_editing and disable_editing toggles back and forth cleanly.
    inverted_mesh_shape = _find_inverted_shape_for_deformer(deformer)
    inverted_mesh = cmds.listRelatives(inverted_mesh_shape, p=True, path=True)[0]
    cmds.select(inverted_mesh)
    
    posed_mesh = _get_active_sculpting_mesh_for_deformer(deformer)
    if not posed_mesh:
        OpenMaya.MGlobal.displayWarning('%s isn\'t enabled for editing' % deformer)

        # Don't show the "disabled editing" message, so it doesn't imply that it was
        # actually enabled before.
        return False

    # .tweak[0] is connected to posed_mesh's .tweakLocation.  Disconnect this connection.
    cmds.disconnectAttr('%s.tweak[0]' % deformer, '%s.tweakLocation' % posed_mesh)

    # If we have a .savedTweakConnection, connect posed_mesh's .tweakLocation back to it.
    saved_tweak_connection = cmds.listConnections('%s.savedTweakConnection[0]' % deformer, p=True)
    if saved_tweak_connection:
        print 'Restoring', saved_tweak_connection
        saved_tweak_connection = saved_tweak_connection[0]
        cmds.connectAttr(saved_tweak_connection, '%s.tweakLocation' % posed_mesh)
        cmds.disconnectAttr(saved_tweak_connection, '%s.savedTweakConnection[0]' % deformer)

    cmds.setAttr('%s.enableTweak' % deformer, False)

    return True
开发者ID:SEVEZ,项目名称:zInvertedBlendShape,代码行数:29,代码来源:zInvertedBlendShape.py


示例7: connect_zDepth

def connect_zDepth(*args):
    r_cam = cmds.textScrollList('r_cam', q=True, si=True)
    if not(type(r_cam) == types.NoneType):
        
        for rc in r_cam:
            x = cmds.listRelatives(rc, shapes=True)
            wh = "vrayRE_Z_depth.vray_depthWhite"
            bl = "vrayRE_Z_depth.vray_depthBlack"
            bMin = cmds.connectionInfo(wh ,id=True)
            bMax = cmds.connectionInfo(bl ,id=True)
            cMin = cmds.connectionInfo(wh ,sfd=True)
            cMax = cmds.connectionInfo(bl ,sfd=True)
            
            
            if bMin :
                cmds.disconnectAttr(cMin, wh)
                cmds.connectAttr( x[0]+".nearClipPlane", wh )
            else :
                cmds.connectAttr( x[0]+".nearClipPlane", wh )
                
            if bMax : 
                cmds.disconnectAttr(cMax, bl)
                cmds.connectAttr( x[0]+".farClipPlane" , bl )
            else :
                cmds.connectAttr( x[0]+".farClipPlane" , bl )
开发者ID:muskccat,项目名称:RenderLayerUtils,代码行数:25,代码来源:render_layer_creator_v2.py


示例8: importAssetCache

 def importAssetCache(self, cacheXmlLt, cacheErrorCheck = False):
     """ cacheXmlLt = "R:/data/cache/sq001/sh001/light/char/ben00c_ben/ben00c_ben.xml" """
     if os.path.exists(cacheXmlLt):
         cacheChannels = mc.cacheFile(fileName=cacheXmlLt,q=1,channelName=1)
         cacheGeos = self.getCacheGeos()
         cacheGeoDict, cacheChannelsTmp = {}, []
         for chn in cacheChannels:
             for geo in cacheGeos:
                 baseChn = utils.stripNames(utils.convertName(chn, "texture"))
                 baseGeo = utils.stripNames(utils.stripNames(geo, ":"), "|")
                 if baseChn in baseGeo:
                     cacheGeoDict[chn] = geo
                     cacheChannelsTmp.append(chn)
                     continue
     else:
         utils.msgWin("Error", "File does not exist : %s"%cacheXmlLt, self.silent)
         return False
     if cacheErrorCheck:
         missedChannels = list(set(cacheChannels).difference(set(cacheGeoDict.keys())))
         if len(missedChannels) > 0:
             msg = "Cache geometry missing\n"
             msg += "\n".join(missedChannels)
             utils.msgWin("Error", msg, self.silent)
             return missedChannels
         else:
             return False
     for chNode in self.getCacheNodes():
         mc.delete(chNode)
     for chn in cacheGeoDict.keys():
         deformShp = cacheGeoDict[chn]
         try:
             shpSwitch = mc.deformer(deformShp, type="historySwitch")
         except:
             continue
         shpHist = mc.listHistory(deformShp, pdo=1)
         if shpHist:
             for hist in shpHist:
                 if mc.nodeType(hist) == "tweak":
                     dblList = mc.listAttr("%s.plist"%hist, m= 1)
                     fltList = mc.listAttr("%s.vlist"%hist, m= 1)
                     dbCon, flCon = False, False
                     if dblList:
                         if len(dblList) > 1: dbCon = True
                     if fltList:
                         if len(fltList) > 1: flCon = True
                     if not(dbCon or flCon):
                         mc.delete(hist)
                     break
         conns = mc.listConnections("%s.ip[0].ig"%shpSwitch[0], p=1)
         mc.connectAttr(conns[0], "%s.ug[0]"%shpSwitch[0])
         mc.setAttr("%s.playFromCache"%shpSwitch[0], 1)
         mc.getAttr("%s.op[0]"%shpSwitch[0], sl = 1)
         mc.setAttr("%s.playFromCache"%shpSwitch[0], 0)
         mc.disconnectAttr(conns[0], "%s.ug[0]"%shpSwitch[0])
         switch = mc.rename(shpSwitch[0],'cacheSwitch#')
         mc.setAttr(switch+'.ihi',0)
         cacheNode = mc.cacheFile(f = cacheXmlLt, attachFile = True, ia = '%s.inp[0]'%switch, cnm = chn)
         mc.connectAttr(cacheNode+".inRange", switch + '.playFromCache')
     utils.msgWin("Message", "Cache loaded successfully for %s"%self.namespace, self.silent)
     return True
开发者ID:sid2364,项目名称:Maya_Python,代码行数:60,代码来源:pipeClasses.py


示例9: parentConnect

def parentConnect(parent=None, child=None):
    '''
    Specific method for connecting parent / child relationships in a metarig
    
    '''
    #Validation
    if not parent or not child and (len(cmds.ls(sl=1)) == 2):
        parent = cmds.ls(sl=1)[0]
        child = cmds.ls(sl=1)[1]
        
    if not parent or not child:
        return 'Argument Error, Please supply a parent and child node'
    
    if parent in getAllMetaChildren(child):
        return '%s is a meta descendent of %s and cannot also be its parent' % (parent, child)
    
    # Disconnect from old parent's children array
    oldParent = cmds.listConnections('%s.metaParent' % child)
    
    if type(oldParent) == type([]):
        metaChildren = getMetaChildren(oldParent[0])
        childIndex = metaChildren.index(child)
        cmds.disconnectAttr('%s.message' % child, '%s.metaChildren[%s]' % (oldParent[0], childIndex))
    # Connect to new parent's children array
    metaChildren = getMetaChildren(parent)
    cmds.connectAttr('%s.message' % child, '%s.metaChildren[%s]' % (parent, len(metaChildren)))
    
    # Connect new parent
    messageConnect(fromNode=parent, toNode=child, fromName='message', toName='metaParent')
开发者ID:duncanrudd,项目名称:rooftops,代码行数:29,代码来源:metadata.py


示例10: replace_follicle_atcach_geometry

def replace_follicle_atcach_geometry(follicle, new_geo):
    """
    connect follicle to new face...
    """
    position = mc.xform(follicle, q=True, ws=True, t=True)
    geo_shape = mc.listRelatives(new_geo, s=True, path=True)[0]

    # - disconnect old connect...
    for attr in ("is", "inm", "iwm"):
        source_attr = mc.connectionInfo("{0}.{1}".format(follicle, attr), sfd=True)
        if source_attr:
            mc.disconnectAttr(source_attr, "{0}.{1}".format(follicle, attr))

    # - set new UV parameters...
    if mc.nodeType(geo_shape) == "mesh":
        u_value, v_value = polygon.get_polygon_uv_at_point(new_geo, position)
    else:
        u_value, v_value = nurbsSurface.get_nurbs_uv_at_point(new_geo, position)
    set_follicle_parameter(follicle, u_value, v_value)

    # - connect geometry...
    if mc.nodeType(geo_shape) == "mesh":
        connect_follicle_polygon(follicle, new_geo)
    else:
        connect_follicle_nurbs(follicle, new_geo)

    return True
开发者ID:TianD,项目名称:TianD_KX_TOOL,代码行数:27,代码来源:follicle.py


示例11: mImportOutkey

def mImportOutkey(keyFile, assetNS, assetName, outAniNode):
	"""
	"""
	inputDict = {}
	jsonFile = keyFile.replace('_outKeys.ma', '_input.json')
	with open(jsonFile, 'r') as json_file:
		inputDict = json.load(json_file)

	imported = False
	outNode = inputDict.keys()[0]
	for inTarget in inputDict[outNode]:
		targetList = cmds.ls('*' + inTarget.split(':')[-1], r= 1, l= 1)
		
		try:
			inNode = [target for target in targetList if target.startswith('|' + assetNS) or target.startswith(assetNS)][0]
		except:
			logger.warning('[' + outAniNode + '] input target not found [' + inTarget.split(':')[-1] + '] -x')
			continue
		
		try:
			inputAni = cmds.listConnections(inNode, p= 1, d= 0, scn= 1)
			if inputAni:
				try:
					cmds.disconnectAttr(inputAni[0], inNode)
					cmds.delete(inputAni[0].split('.')[0])
					logger.warning('viskey PARTIAL deleted. [' + inputAni[0] + ']')
				except:
					logger.warning('viskey PARTIAL delete failed. [' + inputAni[0] + ']')
			if not imported:
				cmds.file(keyFile, i= 1, typ= 'mayaAscii', iv= 1, mnc= 1, ns= ':' + assetName)
				imported = True
			cmds.connectAttr(outAniNode + '.output', inNode)
			logger.info('outNode target connected. [' + outAniNode + '] -> {' + inNode + '}')
		except:
			logger.warning('outNode target connection failed. [' + outAniNode + '] -x {' + inNode + '}')
开发者ID:davidpower,项目名称:MS_Research,代码行数:35,代码来源:moGeoCacheMethod.py


示例12: EvaluateFrames

def EvaluateFrames(node, timeAttr, inRenderFrame):
    """
    timeAttr may have expression applied
    EvaluateFrames returns adequatly modified render and sample frames
    """
    timePlug = "%s.%s" % (node, timeAttr)
    outRenderFrame = inRenderFrame
    outSampleFrame = cmds.getAttr(timePlug)
    
    conns = cmds.listConnections(timePlug, s=1, d=0, sh=1, p=1)
    if conns != None:
        restoreConns = []
        srcPlug = conns[0]
        srcNode = srcPlug.split(".")[0]
        hist = cmds.listHistory(srcNode)
        if hist != None:
            for h in hist:
                tconns = cmds.listConnections(h, s=1, d=0, p=1, c=1, type="time")
                if tconns is None:
                    continue
                i = 0
                n = len(tconns)
                while i < n:
                    restoreConns.append((tconns[i+1], tconns[i]))
                    cmds.disconnectAttr(tconns[i+1], tconns[i])
                    cmds.setAttr(tconns[i], inRenderFrame)
                    i += 2
        if len(restoreConns) > 0:
            outRenderFrame = cmds.getAttr(srcPlug)
            for src, dst in restoreConns:
                cmds.connectAttr(src, dst)
   
    return (outRenderFrame, outSampleFrame)
开发者ID:gatgui,项目名称:mtoaScriptedTranslators,代码行数:33,代码来源:scriptedTranslatorUtils.py


示例13: _disconnectAndRemoveAttr

def _disconnectAndRemoveAttr(attr, remove=False):
	"""Disconnects inputs and outputs from the given attribute."""
	
	sel = cmds.ls(sl=True)
	cmds.select(cl=True)
	
	# unlock if needed
	cmds.setAttr(attr, l=False)
	
	# if any connection, disconnect
	srcAttrs = cmds.listConnections(attr, d=False, p=True) or []
	destAttrs = cmds.listConnections(attr, s=False, p=True) or []
	for srcAttr in srcAttrs:
		cmds.disconnectAttr(srcAttr, attr)
	
	for destAttr in destAttrs:
		cmds.disconnectAttr(attr, destAttr)
	
	# remove element
	if remove:
		cmds.removeMultiInstance(attr)
		
		# remove alias
		if cmds.aliasAttr(attr, q=True):
			cmds.aliasAttr(attr, rm=True)
	
	cmds.select(sel or None)
开发者ID:Bumpybox,项目名称:Tapp,代码行数:27,代码来源:ZvRadialBlendShape.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: facialRenderConnect

def facialRenderConnect(connect=False): 
    nodeKey = 'facialRender_lt'
    targetAttr = '.color'
    connectKey = 'tmpFacialConnect'

    if not connect: 
        if mc.objExists(nodeKey): 
            srcNode = '%s.outColor' % nodeKey
            dstNodes = mc.listConnections(srcNode, s = False, d = True, p = True)
            
            if dstNodes: 
                dstNodeAttr = dstNodes[0]
                dstNode = dstNodeAttr.split('.')[0]

                mc.disconnectAttr(srcNode, dstNodeAttr)
                mc.rename(dstNode, '%s_%s' % (dstNode, connectKey))

    else: 
        targetShd = mc.ls('*_%s' % connectKey)

        if targetShd and mc.objExists(nodeKey): 
            queryNode = mc.listConnections('%s.color' % targetShd[0], s=True, d=False, p=True)
            
            if not queryNode: 
                mc.connectAttr('%s.outColor' % nodeKey, '%s.color' % targetShd[0], f=True)
                mc.rename(targetShd[0], targetShd[0].replace('_%s' % connectKey, ''))
开发者ID:myCodeTD,项目名称:ptAlembic,代码行数:26,代码来源:exportShade.py


示例16: 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


示例17: makeActive

def makeActive( rfn ):
    """
    Make active all nested references.
    """
    result = []
    references = referenceRelatives( rfn, onlyLoaded=False, parents=False )
    if references:
        m_count = len( references )
        if m_count > 1:
            for i in range( 0, m_count ):
                if references[i] not in result:
                    result.append( references[i] )
                    pm = cmds.listConnections( "%s.proxyMsg" % references[i], type="proxyManager" )
                    if pm:
                        pm = pm[0]
                        #Get active reference.
                        rfn = ""
                        proxy = cmds.listConnections( "%s.proxyList" % pm, type="reference", source=False, destination=True )
                        if proxy:
                            for n in range( 0, len( proxy )):
                                if cmds.referenceQuery( proxy[n], isLoaded=True ):
                                    rfn = proxy[n]
                                    break
                        if rfn == "":
                            rfn = proxy[0]
                        #Deactivate all non active references.
                        active = cmds.listConnections( "%s.activeProxy" % pm, plugs=True )
                        if active:
                            for n in range( 0, len( active )):
                                cmds.disconnectAttr( "%s.activeProxy" % pm, active[n] )
                        #Make active reference.
                        lproxy = cmds.connectionInfo( "%s.proxyMsg" % rfn, sourceFromDestination=True )
                        if lproxy:
                            cmds.connectAttr( "%s.activeProxy" % pm, lproxy )
    return result
开发者ID:k0k0c,项目名称:scripts,代码行数:35,代码来源:ml_reference.py


示例18: replaceConnection

def replaceConnection( first, second ):
    
    fSrcCons = cmds.listConnections( first, s=1, d=0, p=1, c=1 )
    
    if fSrcCons:
        outputs = fSrcCons[1::2]
        inputs  = fSrcCons[::2]
        
        for i in range( len( outputs ) ):
            try:
                cmds.connectAttr( outputs[i], inputs[i].replace( first, second ), f=1 )
                cmds.disconnectAttr( outputs[i], inputs[i] )
            except: pass
    
    fDesCons = cmds.listConnections( first, s=0, d=1, p=1, c=1 )
    
    if fDesCons:
        outputs = fDesCons[::2]
        inputs  = fDesCons[1::2]
        
        for i in range( len( outputs ) ):
            try:
                cmds.connectAttr( outputs[i].replace( first, second ), inputs[i], f=1 )
                cmds.disconnectAttr( outputs[i], inputs[i] )
            except:pass
开发者ID:jonntd,项目名称:mayadev-1,代码行数:25,代码来源:cmdModel.py


示例19: clearInput

def clearInput(switchList):
	'''
	Disconnect all incoming mesh connections to the list of specified meshSwitch nodes
	@param switchList: The list of meshSwitch nodes to disconnect incoming connections from.
	@type switchList: list
	'''
	# Check switchList
	if type(switchList) == str or type(switchList) == unicode:
		switchList = [str(switchList)]
	
	# For each switch
	for meshSwitch in switchList:
		
		# Get list of incoming mesh connections
		connectionList = mc.listConnections(meshSwitch+'.inMesh',s=True,d=False,p=True,c=True)
		if not connectionList: continue
		
		# Iterate over connections
		for i in range(len(connectionList)):
			
			# Skip odd numbered iteration
			if i%2: continue
			
			# Disconnect attribute
			mc.disconnectAttr(connectionList[i+1],connectionList[i])
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:25,代码来源:meshSwitch.py


示例20: latticeRemove

def latticeRemove():

    #undo enable
    cmds.undoInfo(openChunk=True)

    #getting nodes
    sel = cmds.ls(selection=True)
    if not sel:
        cmds.warning('No nodes selected!')
        return

    lat = sel[-1]
    objs = sel[0:-1]

    if cmds.nodeType(cmds.listRelatives(lat, shapes=True)[0]) != 'lattice':
        cmds.warning('Last selected is NOT a lattice!')
        return

    #removing from lattice
    for obj in objs:
        try:
            cmds.lattice(lat, e=True, remove=True, geometry=obj)

            #disconnecting shapes
            shapes = cmds.listRelatives(obj, shapes=True)
            for shp in shapes:
                source = cmds.listConnections(shp + '.inMesh', source=True)
                if cmds.nodeType(source) == 'ffd':
                    attr = cmds.listConnections(shp + '.inMesh', plugs=True)[0]
                    cmds.disconnectAttr(attr, shp + '.inMesh')
        except:
            pass

    cmds.undoInfo(closeChunk=True)
开发者ID:Bumpybox,项目名称:Tapp,代码行数:34,代码来源:lattice.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.dockControl函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.deleteUI函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap