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

Python cmds.connectionInfo函数代码示例

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

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



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

示例1: connect_alpha

    def connect_alpha(self, newNode, mayaMat):

        alpha_attr1 = '.transparency'
        alpha_attr2 = '.matteOpacity'  # may use this in the future

        if cmds.connectionInfo(mayaMat + "%s" % alpha_attr1, isDestination=1):
            plug_source = cmds.connectionInfo(mayaMat + "%s" % alpha_attr1,
                                              sourceFromDestination=1)

            node_source = plug_source.split(".")[0]

            node_outAlpha = node_source + '.outAlpha'
            node_outTransparency = node_source + '.outTransparency'

            for i in self.aiTransparencyList:
                if ".opacity" in i:
                    print 'opacity mode'
                    try:
                        cmds.connectAttr(node_outTransparency, newNode + i)
                    except:
                        cmds.connectAttr(node_outAlpha, newNode + i)

                if i == ".Kt" and self.useaiTransparency is True:
                    cmds.connectAttr(node_outTransparency, newNode + i)

            print "alpha connect ok!"
            return True

        else:
            return False
开发者ID:mkolar,项目名称:Tapp,代码行数:30,代码来源:mayaMat2Ai.py


示例2: constrainJoints

	def constrainJoints(self): # Rivet & constrain joints to the ArcCtrl surface

		rivetArgs=[]
		cjLen=1
		for j in self.jointHierarchy[1:]:
			if self.spread:
				cj=removeAll\
				(
					self.jointHierarchy[1:],
					iterable(mc.listRelatives(j,c=True,type='transform'))
				)
				rivetArgs.extend(cj)
				cjLen=len(cj)+1

			rivetArgs.append(j)

		skipRotate=[]
		for sr in range(1,cjLen+1):
			skipRotate.append(-sr)

		rivetArgs.append(self.ArcCtrl.outputSurface)

		self.rivet=Rivet(rivetArgs,constraint=True,skipRotate=skipRotate)

		if not\
		(
			mc.connectionInfo(self.jointHierarchy[-1]+'.r',id=True) or
			mc.connectionInfo(self.jointHierarchy[-1]+'.rx',id=True) or
			mc.connectionInfo(self.jointHierarchy[-1]+'.ry',id=True) or
			mc.connectionInfo(self.jointHierarchy[-1]+'.rz',id=True)
		):
			mc.parentConstraint(self.ArcCtrl.handles[-1],self.jointHierarchy[-1],st=('x','y','z'),mo=True)
			if self.spread or self.curl:
				for j in cj:
					mc.parentConstraint(self.ArcCtrl.handles[-1],j,st=('x','y','z'),mo=True)
开发者ID:jonntd,项目名称:zentools,代码行数:35,代码来源:arcIK.py


示例3: isConnected

def isConnected (attr, node = None, incoming = True, outgoing = True):
    '''
    Check if attribute is connected

    .. python ::
        isConnected ("testMe.translateX")
        # Result: False

    @param attr: Attribute name or path
    @type attr: *str*

    @param node: Attribute parent node
    @type node: *str*

    @return: Return status
    @rtype: *bool*
    '''
    # Resolve attribute
    attrPath = resolveArgs (attr, node) [0]

    # Check if attribute is connected
    if outgoing and cmds.connectionInfo (attrPath, isSource = True):
        return True
    elif incoming and cmds.connectionInfo (attrPath, isDestination = True):
        return True
    else:
        return False
开发者ID:jonntd,项目名称:japeto,代码行数:27,代码来源:attribute.py


示例4: getObjMaterials

def getObjMaterials():
    global remapAndLuminaceNodes
    shadingType = ['blinn', 'phong', 'RedshiftArchitectural', 'aiStandard']
    displacementShading = ['RedshiftDisplacement', 'displacementShader']
    duplicateMaterials = list()
    selObjsList = cmds.ls(sl = 1, tr = 1)
    if not selObjsList: assert 'No object is selected!'
    obj = selObjsList[0]
    duplicateNodes = list()
    cmds.select(obj, r = 1)
    cmds.hyperShade(smn = 1)
    selObjsDuplicateMaterials = cmds.duplicate(un = 1)
    for item in selObjsDuplicateMaterials:
        dupliMater = cmds.rename(item, '%s_duplicate'%(item))
        duplicateNodes.append(dupliMater)
    for item in duplicateNodes:
        if cmds.nodeType(item) in shadingType:
            duplicateShading = cmds.sets(r = 1, nss = 1, em = 1, n = '%s_SG'%item)
            cmds.connectAttr('%s.outColor'%item, '%s.surfaceShader'%duplicateShading, f = 1)
            duplicateMaterials.append(item)
        elif cmds.nodeType(item) == 'RedshiftDisplacement':
            conInfo = cmds.connectionInfo('%s.displacementShader'%duplicateShading, sfd = 1)
            if not conInfo:
                cmds.connectAttr('%s.out'%item, '%s.displacementShader'%duplicateShading, f = 1)
        elif cmds.nodeType(item) == 'displacementShader':
            conInfo = cmds.connectionInfo('%s.displacementShader'%duplicateShading, sfd = 1)
            if not conInfo:
                cmds.connectAttr('%s.displacement'%item, '%s.displacementShader'%duplicateShading, f = 1)
    cmds.sets(obj, e = 1, fe = duplicateShading)
    cmds.select(selObjsList, r = 1)
    return list(set(duplicateMaterials))
开发者ID:chuckbruno,项目名称:remap,代码行数:31,代码来源:RemapAndIllumanceForSameTexture.py


示例5: getObjMaterials

def getObjMaterials():
    global remapAndLuminaceNodes
    shadingType = ["blinn", "phong", "RedshiftArchitectural", "aiStandard"]
    displacementShading = ["RedshiftDisplacement", "displacementShader"]
    duplicateMaterials = list()
    selObjsList = cmds.ls(sl=1, tr=1)
    if not selObjsList:
        assert "No object is selected!"
    for obj in selObjsList:
        duplicateNodes = list()
        cmds.select(obj, r=1)
        cmds.hyperShade(smn=1)
        selObjsDuplicateMaterials = cmds.duplicate(un=1)
        for item in selObjsDuplicateMaterials:
            dupliMater = cmds.rename(item, "%s_duplicate" % (item))
            duplicateNodes.append(dupliMater)
        for item in duplicateNodes:
            if cmds.nodeType(item) in shadingType:
                duplicateShading = cmds.sets(r=1, nss=1, em=1, n="%s_SG" % item)
                cmds.connectAttr("%s.outColor" % item, "%s.surfaceShader" % duplicateShading, f=1)
                duplicateMaterials.append(item)
            elif cmds.nodeType(item) == "RedshiftDisplacement":
                conInfo = cmds.connectionInfo("%s.displacementShader" % duplicateShading, sfd=1)
                if not conInfo:
                    cmds.connectAttr("%s.out" % item, "%s.displacementShader" % duplicateShading, f=1)
            elif cmds.nodeType(item) == "displacementShader":
                conInfo = cmds.connectionInfo("%s.displacementShader" % duplicateShading, sfd=1)
                if not conInfo:
                    cmds.connectAttr("%s.displacement" % item, "%s.displacementShader" % duplicateShading, f=1)
        cmds.sets(obj, e=1, fe=duplicateShading)
    cmds.select(selObjsList, r=1)
    return list(set(duplicateMaterials))
开发者ID:chuckbruno,项目名称:remap,代码行数:32,代码来源:RemapAndIllumanceForAllShadings_modify_01.py


示例6: channelbox_command_break

def channelbox_command_break(box, menuItem, key, *args):
    with sysCmd.Undo():
        for plug in channelBox_SelectedPlugs(box):
            if cmds.connectionInfo(plug, isDestination=1):
                destination = cmds.connectionInfo(plug, getExactDestination=1)

                # when delete source conn from character, must remove from character set or set becomes inconsistent
                src_conn = cmds.listConnections(destination, s=1, d=0, type="character")
                if src_conn:
                    warn_msg = "Removed \'^1s\' from character \'^2s\'."
                    cmds.warning(cmds.format(warn_msg, s=(destination, src_conn[0])))
                    cmds.character(destination, e=1, rm=src_conn[0])

                # is tracking edits?
                import maya.api.OpenMaya as om
                obj = om.MSelectionList().add(destination).getDependNode(0)
                depend_fn = om.MFnDependencyNode(obj)
                tracking_edits = depend_fn.isTrackingEdits()
                del obj
                del depend_fn

                if tracking_edits:
                    src = cmds.connectionInfo(destination, sourceFromDestination=1)
                    cmds.disconnectAttr(src, destination)
                else:
                    cmds.delete(destination, icn=1)
开发者ID:Vaei,项目名称:ModularChannelBox,代码行数:26,代码来源:jtChannelBox_Commands_Default.py


示例7: on_actionLoadSourceControl_triggered

 def on_actionLoadSourceControl_triggered(self, clicked=None):
     if clicked == None:return
     selectOBJ = mc.ls(sl=True)
     
     if len(selectOBJ) == 0:return
     self.sourceControlFLD.setText(selectOBJ[0])
     
     KeyableAttr = mc.listAttr(selectOBJ[0], k=True)
     
     del self.sourceAtrLst[:]
     del self.targentAtrLst[:]
     # loop  Attributes..
     for Attr in KeyableAttr:
         SDKeys = mc.connectionInfo('%s.%s'%(selectOBJ[0], Attr), dfs=True)
         # loop driven Attributes..
         for key in SDKeys:
             if mc.nodeType(key) == 'unitConversion':
                 keyNode = mc.connectionInfo('%s.output'%key.split('.')[0], dfs=True)[0].split('.')[0]
             
             elif mc.nodeType(key) not in ('animCurve','animCurveTA', 'animCurveTL', 'animCurveTT','animCurveTU','animCurveUA','animCurveUL','animCurveUT','animCurveUU'):
                 continue
             else:
                 keyNode = key.split('.')[0]
             DriverValues     =  mc.keyframe(keyNode, q=True, fc=True)
             DrivenValues     =  mc.keyframe(keyNode, q=True, vc=True)
             DriverAttribute =  mc.connectionInfo('%s.output'%keyNode, dfs=True)[0]
             
             # if more than one Drivers, from add  node get the attribute..
             if  DriverAttribute.endswith(']'):
                 DriverAttribute = mc.connectionInfo('%s.output'%(DriverAttribute.split('.')[0]), dfs=True)[0]
              
             self.sourceAtrLst.append(['%s.%s'%(selectOBJ[0], Attr), DriverAttribute, DriverValues, DrivenValues])
     
     self.on_actionInputSearchReplace_triggered()
开发者ID:AtonLerin,项目名称:RiggingTeamTools,代码行数:34,代码来源:mirrorSDK.py


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


示例9: channelbox_command_selectConnection

def channelbox_command_selectConnection(box, menuItem, key, *args):
    with sysCmd.Undo():
        for plug in channelBox_SelectedPlugs(box):
            if cmds.connectionInfo(plug, isDestination=1):
                destination = cmds.connectionInfo(plug, getExactDestination=1)
                dest_input = cmds.listConnections(destination)
                cmds.select(dest_input[0], r=1)
开发者ID:Vaei,项目名称:ModularChannelBox,代码行数:7,代码来源:jtChannelBox_Commands_Default.py


示例10: getShaveAttrs

 def getShaveAttrs(self,filePath):
     
     output = open(filePath,'wb')
     attrDict = dict()
     shaveAttrs = cmds.listAttr(self.shaveNode,se = True)
     valueSetAttrs = []
     connectedAttrs = []
     
     for attr in shaveAttrs:
         
         try:
             if cmds.connectionInfo('%s.%s'%(self.shaveNode,attr),id = True):
                 connection = cmds.connectionInfo('%s.%s'%(self.shaveNode,attr),sfd = True)
                 connectedAttrs.append([connection,attr])
                 
             else:
                 attrValue = cmds.getAttr('%s.%s'%(self.shaveNode,attr))
                 print attr,attrValue
                 valueSetAttrs.append([attr,attrValue])
         except (RuntimeError,ValueError):
             pass
     
     attrDict['valueSet'] =  valueSetAttrs      
     attrDict['connected'] = connectedAttrs
     
     pickle.dump(attrDict,output)
     output.close()
开发者ID:Owacle,项目名称:maya-toolbelt,代码行数:27,代码来源:ShaveLib.py


示例11: attachCurves

def attachCurves(name, identifier, jobInfo, isConstant=False):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._attach.attachCurves")
	if cmds.objExists( name ):
		curObj = cmds.connectionInfo(name+".visibility", sfd=True)
		if curObj and cmds.objectType(curObj) == "ExocortexAlembicCurvesDeform":
			attachTimeAndFile(curObj, jobInfo, isConstant)
			return

		# create deformer, and attach time and file
		newDform = cmds.deformer(name, type="ExocortexAlembicCurvesDeform")[0]
		cmds.setAttr(newDform+".identifier", identifier, type="string")
		attachTimeAndFile(newDform, jobInfo, isConstant)

		# get curObj new "output" attribute connection
		if cmds.objExists( curObj ):
			if curObj != None and cmds.objectType(curObj) != "ExocortexAlembicCurves":
				originalCur = cmds.connectionInfo(curObj+".output", sfd=True).split('.')[0]

				cmds.delete(curObj)
				curObj = cmds.createNode("ExocortexAlembicCurves")
				attachTimeAndFile(curObj, jobInfo, isConstant)

				cmds.connectAttr(curObj+".outCurve", originalCur+".create")
				cmds.connectAttr(jobInfo.filenode+".outFileName", curObj+".fileName")
				cmds.setAttr(curObj+".identifier", identifier, type="string")

	cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._attach.attachCurves")
	pass
开发者ID:skarone,项目名称:PipeL,代码行数:28,代码来源:_attach.py


示例12: createDistanceNodeBetweenObjects

def createDistanceNodeBetweenObjects (obj1,obj2):
    """
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    DESCRIPTION:
    Creates a distance node between objects

    ARGUMENTS:
    obj1(string)
    obj2(string)

    RETURNS:
    none
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    """
    """ Creates a distance node between objects """
    pos1 = returnWorldSpacePosition (obj1)
    pos2 = returnWorldSpacePosition (obj2)
    tmp = mc.distanceDimension( sp=pos1, ep=pos2 )
    distBuffer = mc.listRelatives ( [tmp], p=True)
    distanceObj = mc.rename (distBuffer, (obj1+'_to_'+obj2+'_distMeas') )
    #return the stupid locators it makes so we can connect our own stuff
    distanceStartPoint = (distanceObj+'Shape.startPoint')
    distanceEndPoint = (distanceObj+'Shape.endPoint')
    locAttr1connection =  (mc.connectionInfo (distanceStartPoint,sourceFromDestination=True))
    locAttr2connection =  (mc.connectionInfo (distanceEndPoint,sourceFromDestination=True))
    locAttr1Stripped = '.'.join(locAttr1connection.split('.')[0:-1])
    locAttr2Stripped = '.'.join(locAttr2connection.split('.')[0:-1])
    loc1Buffer = (mc.listRelatives (locAttr1Stripped,parent=True))
    loc2Buffer = (mc.listRelatives (locAttr2Stripped,parent=True))
    #distObj1 = mc.rename (loc1Buffer, (obj1+'_distLoc') )
    #distObj2 = mc.rename (loc2Buffer, (obj2+'_distLoc') )
    
    return distanceObj
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:33,代码来源:distance.py


示例13: listNodeConnections

def listNodeConnections(*args,**keywords):

	s=True
	d=True
	sn=False
	
	sel=[]
	if len(args)==0:
		sel=mc.ls(sl=True)
		
	for a in args:
		if isIterable(a):
			sel.extend(a)
		else:
			sel.append(a)
			
	for k in keywords:
		if k=='s' or k=='source':
			s=keywords[k]
		if k=='d' or k=='destination':
			d=keywords[k]
		if k=='sn' or k=='shortName':
			sn=keywords[k]
		elif k in locals():
			exec(k+'=keywords[k]')
	
	connections=[]
	
	for conn in removeDuplicates(mc.listConnections(sel[0],s=s,d=d,p=True)):
		
		if len(sel)==1 or mc.ls(conn,o=True)[0]==sel[1]:
			if mc.connectionInfo(conn,isSource=True):
				for dfs in mc.connectionInfo(conn,dfs=True):
					if mc.ls(dfs,o=True)[0]==sel[0]:
						if sn:
							connections.append\
							(
								[
									mc.ls(conn,o=True)[0]+'.'+mc.listAttr(conn,sn=True)[0],
									mc.ls(dfs,o=True)[0]+'.'+mc.listAttr(dfs,sn=True)[0]
								]
							)
						else:
							connections.append([conn,dfs])
			if mc.connectionInfo(conn,id=True):
				sfd=mc.connectionInfo(conn,sfd=True)
				if mc.ls(sfd,o=True)[0]==sel[0]:
					if sn:
						connections.append\
						(
							[
								mc.ls(sfd,o=True)[0]+'.'+mc.listAttr(sfd,sn=True)[0],
								mc.ls(conn,o=True)[0]+'.'+mc.listAttr(conn,sn=True)[0]
							]
						)
					else:
						connections.append([sfd,conn])
						
	return removeDuplicates(connections)
开发者ID:jonntd,项目名称:zentools,代码行数:59,代码来源:listNodeConnections.py


示例14: getReferenceFromNamespace

def getReferenceFromNamespace(ns, parentNS=None):
    """
    Get the reference node associated with the specified namespace
    @param ns: Namespace to query reference node from
    @type ns: str
    @param parentNS: Parent namespace to query reference nodes from
    @type parentNS: str or None
    """
    # Check Namespace
    if ns.endswith(":"):
        ns = ns[:-1]
    if not cmds.namespace(ex=ns):
        raise Exception('Namespace "' + ns + '" does not exist!')

    # Check Parent Namespace
    if parentNS:
        parentNS += ":"
    else:
        parentNS = ""

    # Check Each Reference
    for refNode in listReferences(parentNS):

        # Get Reference Namespace
        try:
            refNS = cmds.referenceQuery(refNode, namespace=True)
        except:
            # print('Unable to get namespace from reference "'+refNode+'"!')
            continue

        # Strip Leading ":"
        if refNS.startswith(":"):
            refNS = refNS[1:]

        # Check Namespace Match
        if refNS == parentNS + ns:

            # Check Proxy Manager Connections
            if cmds.attributeQuery("proxyMsg", n=refNode, ex=True):
                proxyManager = (
                    cmds.ls(cmds.listConnections(refNode + ".proxyMsg", s=True, d=False) or [], type="proxyManager")
                    or []
                )
                if proxyManager:
                    # Check Active Proxy
                    activeProxyPlug = cmds.connectionInfo(proxyManager[0] + ".activeProxy", destinationFromSource=True)[
                        0
                    ]
                    activeProxyInfo = cmds.connectionInfo(activeProxyPlug, destinationFromSource=True)
                    if not activeProxyInfo:
                        raise Exception('Error getting active reference from proxy manager "' + proxyManager[0] + '"!')
                    return cmds.ls(activeProxyInfo[0], o=True)[0]

            # Return Reference
            return refNode

    # No Reference Found from Namespace - Print Msg
    print ("Unable to determine reference from namespace: " + ns)
    return ""
开发者ID:bennymuller,项目名称:glTools,代码行数:59,代码来源:reference.py


示例15: breakCncts

def breakCncts(attr, s=1, d=1):
    if s:
        n=MC.connectionInfo(attr, sfd=1)
        if n:
            MC.disconnectAttr(n, attr)
    if d:
        for n in MC.connectionInfo(attr, dfs=1):
            MC.disconnectAttr(attr, n)
开发者ID:jspatrick,项目名称:beings,代码行数:8,代码来源:GeneralUtils.py


示例16: attachedGeo

 def attachedGeo(self, node):
     shapez = {}
     sgs = m.connectionInfo("%s.outColor" % node, dfs=True)
     for sg in sgs:
         sg = sg.split(".")[0]
         for index in m.getAttr("%s.dagSetMembers" % sg, mi=True):
             shape = m.connectionInfo("%s.dagSetMembers[%s]" % (sg, index), sfd=True).split(".")[0]
             shapez[shape] = m.listRelatives(shape, p=True)
     return shapez
开发者ID:hradec,项目名称:pipeVFX,代码行数:9,代码来源:nodeWatcher.py


示例17: has_shader_connected

def has_shader_connected(node_name):
    # check that the shape has a shader connected
    if not cmds.listConnections(node_name, t='shadingEngine'):
        return False

    shadingEngine = cmds.listConnections(node_name, t='shadingEngine')[0]
    if not cmds.connectionInfo(shadingEngine + '.surfaceShader', sourceFromDestination=True).split('.')[0]:
        return False

    return cmds.connectionInfo(shadingEngine + '.surfaceShader', sourceFromDestination=True).split('.')[0]
开发者ID:hipopotamo-hipotalamo,项目名称:appleseed,代码行数:10,代码来源:ms_commands.py


示例18: _isError

 def _isError(shader):
     if not mc.connectionInfo(shader+'.standard_bump', id=True):
         for a in ('.standard_bumpX', '.standard_bumpY', '.standard_bumpZ'):
             if mc.getAttr(shader+a) != 0:
                 return False
     if not mc.connectionInfo(shader+'.overall_bump', id=True):
         for a in ('.overall_bumpX', '.overall_bumpY', '.overall_bumpZ'):
             if mc.getAttr(shader+a) != 0:
                 return False
     return True
开发者ID:chiaxin,项目名称:inspector,代码行数:10,代码来源:mentalray.py


示例19: attachTimeAndFile

def attachTimeAndFile(node, jobInfo, isConstant=False):
	connAttr = cmds.connectionInfo(node+".inTime", sfd=True)
	if connAttr == "" and not isConstant:
		cmds.connectAttr(jobInfo.timeCtrl+".outTime", node+".inTime")

	node = node + ".fileName"	# compute once, used 2-3 times
	connAttr = cmds.connectionInfo(node, sfd=True)
	if connAttr != None and connAttr != "":
		cmds.disconnectAttr(connAttr, node)
	cmds.connectAttr(jobInfo.filenode+".outFileName", node)
	pass
开发者ID:skarone,项目名称:PipeL,代码行数:11,代码来源:_attach.py


示例20: duplicateShape

def duplicateShape(*args,**keywords):
	asHistory=False
	shortNames=\
	{
		'ah':'asHistory'
	}
	for k in keywords:
		if k in locals():
			exec(k+'=keywords[k]')
		elif k in shortNames:
			exec(shortNames[k]+'=keywords[k]')	
	if len(args)==0: args=mc.ls(sl=True)
	sel=[]
	for a in args:
		sel.extend(iterable(a))
	for i in range(0,len(sel)):
		sel[i]=shape(sel[i])
	returnVal=[]
	for sh in sel:
		tr=mc.listRelatives(sh,p=True)[0]
		trDup=mc.duplicate(tr,rc=True)[0]
		shDup=mc.listRelatives(trDup,s=True)[mc.listRelatives(tr,s=True).index(sh)]
		mc.parent(shDup,tr,s=True,add=True)
		mc.delete(trDup)
		returnVal.append(shDup)
		if asHistory:
			hist=''
			plugIn=''
			plugOut=''
			if mc.nodeType(sh)=='mesh':
				plugIn='.inMesh'
				plugOut='.outMesh'
				if mc.connectionInfo(sh+'.inMesh',id=True):
					hist=mc.connectionInfo(sh+'.inMesh',sfd=True)
			elif  'nurbs' in mc.nodeType(sh):
				plugIn='.create'
				plugOut='.local'
				if mc.connectionInfo(sh+'.create',id=True):
					hist=mc.connectionInfo(sh+'.create',sfd=True)
			if mc.objExists(sh+plugIn) and mc.objExists(shDup+plugIn):
				if mc.objExists(hist): 
					mc.connectAttr(hist,shDup+plugIn,f=True)
				mc.connectAttr(shDup+plugOut,sh+plugIn,f=True)
				mc.setAttr(shDup+'.io',True)		
	if len(returnVal)==1:
		return returnVal[0]
	elif len(returnVal)==0:
		return ''
	else:
		return returnVal
开发者ID:jonntd,项目名称:zentools,代码行数:50,代码来源:duplicateShape.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python cmds.container函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.connectAttr函数代码示例发布时间: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