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

Python cmds.sets函数代码示例

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

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



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

示例1: importSculpt

def importSculpt(path, sel=None):
    '''
    Provide the full path:eg. home/user/exportfile.txt .txt in the name is critical.
    sel = <Transform> Provide the transform that the sculpts are connected to, recommened through script
    sel = <None>(Default), recommended through User Interface calls
    '''
    if sel == None:
        sel = validateSelection()

    if sel != None:
        # get a list of all the files
        path = os.path.join(path, 'sculpt_set')
        if os.path.exists(path):
            files = os.listdir(path)
            for f in files:
                # It's expected that only the sculpt files will be in here
                if os.path.splitext(f)[1] == '.txt':
                    # get the shape
                    shape = pm.ls(sel)[0].getShape().name()
                    _file = file(os.path.join(path, f), 'r')
                    info = _file.readlines()
                    _file.close()
                    deformer = info[0].strip('\n')
                    vertex = eval(info[1])
                    sculptset = cmds.listConnections(deformer + '.message', s=False, d=True)[0]
                    # clear the set
                    cmds.sets(cl=sculptset)
                    # add vertex to the set
                    cmds.sets(vertex, fe=sculptset)
开发者ID:boochos,项目名称:work,代码行数:29,代码来源:atom_utilities_lib.py


示例2: creatSphere

def creatSphere(*args):
    circleSel = mc.ls(sl=1)[0]
    radiusCircle = mc.circle(circleSel, q=1, r=1)
    radiusSpere = radiusCircle*.75
    particleSphere = mc.polySphere(n='%s_Sphere'%circleSel, r=radiusSpere, sx=float(radiusSpere), sy=float(radiusSpere), ax=[0, 1, 0])[0]
    mc.parentConstraint(circleSel, particleSphere, mo=0, w=1)
    #mc.parent(particleSphere, circleSel)
    mc.setAttr('%s.tx'%particleSphere, 0)
    mc.setAttr('%s.ty'%particleSphere, 0)
    mc.setAttr('%s.tz'%particleSphere, 0)
    mc.setAttr('%s.rx'%particleSphere, 0)
    mc.setAttr('%s.ry'%particleSphere, 0)
    mc.setAttr('%s.rz'%particleSphere, 0)
    mc.setAttr('%s.v'%particleSphere, 0)
    mc.select(particleSphere, r=1) 
    mc.emitter(type='surface', r=4, dx=1, dy=0, dz=0, n='%s_emitter'%circleSel )
    mc.particle( n='%s_Particles'%circleSel )
    mc.connectDynamic( '%s_Particles'%circleSel, em='%s_emitter'%circleSel )
    particlesShape = mc.listRelatives('%s_Particles'%circleSel, s=1)[0]
    mc.setAttr('%s.lifespanMode'%particlesShape, 1)
    mc.setAttr('%s.lifespan'%particlesShape, 0.4)
    mc.setAttr('%s.startFrame'%particlesShape, 1001)
    mc.connectControl( 'numText', '%s.rate'%('%s_emitter'%circleSel) )
    mc.shadingNode('blinn', n='%s_blinn'%circleSel, asShader=1)
    mc.sets( n='%s_blinnSG'%circleSel, renderable=True, noSurfaceShader=True, empty=1)
    mc.connectAttr('%s.outColor'%('%s_blinn'%circleSel), '%s.surfaceShader'%('%s_blinnSG'%circleSel))
    mc.connectControl( 'myColorIndex', '%s.color'%('%s_blinn'%circleSel) )
    mc.connectControl( 'lifeText', '%s.lifespan'%particlesShape )
    mc.sets('%s_Particles'%circleSel, e=1, forceElement='%s'%('%s_blinnSG'%circleSel))
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:29,代码来源:creaetParticles_04.py


示例3: importPolyMesh

def importPolyMesh(name, identifier, jobInfo, parentXform=None, isConstant=False, useDynTopo=False):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importPolyMesh")

	try:
		reader = ""
		shape  = fnt.alembicCreateNode(name, "mesh", parentXform)
		cmds.sets(shape, e=True, forceElement="initialShadingGroup")

		topoReader = cmds.createNode("ExocortexAlembicPolyMesh")
		cmds.connectAttr(topoReader+".outMesh", shape+".inMesh")
		cmds.connectAttr(jobInfo.filenode+".outFileName", topoReader+".fileName")
		cmds.setAttr(topoReader+".identifier", identifier, type="string")
		cmds.setAttr(topoReader+".normals", jobInfo.useNormals)
		cmds.setAttr(topoReader+".uvs", jobInfo.useUVs)
		if jobInfo.useFaceSets:
			cmds.ExocortexAlembic_createFaceSets(o=shape, f=jobInfo.filename, i=identifier)

		if useDynTopo:
			cmds.connectAttr(jobInfo.timeCtrl+".outTime", topoReader+".inTime")
			reader = topoReader
		elif not isConstant:
			reader = cmds.deformer(shape, type="ExocortexAlembicPolyMeshDeform")[0]
			setupReaderAttribute(reader, identifier, isConstant, jobInfo)

		#if not useDynTopo:
		#	setupReaderAttribute(topoReader, identifier, isConstant, jobInfo)

	except Exception as ex:
		shape = "?importPolyMesh --> exception: \"" + str(ex.args) + "\" of type " + str(type(ex));
		apix.MPxCommand.setResult(shape)
	cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importPolyMesh")
	return shape
开发者ID:EriLee,项目名称:ExocortexCrate,代码行数:32,代码来源:_import.py


示例4: perform

def perform(**kwargs):
	sel = cmds.ls(sl=True)
	sel3=[]
	for s in sel:
	    sel3+=cmds.xform(s,q=True, ws=True, t=True)
	pointset=[]
	for i in xrange(len(sel3)/3):
	    pointset+=[Vector(sel3[i*3],sel3[i*3+1],sel3[i*3+2])]
	bbox = BBox()
	bbox.obbFromPointSet(pointset)
	t = Transform(bbox.axis[0],bbox.axis[1],bbox.axis[2])
	t = t.transpose()
	z = t.getEuler()
	cube = cmds.createNode("polyCube")
	cubeShape = cmds.createNode("mesh")
	cubeTrans = cmds.listRelatives(cubeShape,p=True)[0]
	cmds.connectAttr(cube+".output",cubeShape+".inMesh")
	cmds.setAttr(cubeTrans+".tx",bbox.center[0])
	cmds.setAttr(cubeTrans+".ty",bbox.center[1])
	cmds.setAttr(cubeTrans+".tz",bbox.center[2])
	cmds.setAttr(cubeTrans+".rz",degrees(z[2]))
	cmds.setAttr(cubeTrans+".ry",degrees(z[1]))
	cmds.setAttr(cubeTrans+".rx",degrees(z[0]))
	cmds.setAttr(cube+".width",bbox.max[0]-bbox.min[0])
	cmds.setAttr(cube+".height",bbox.max[1]-bbox.min[1])
	cmds.setAttr(cube+".depth",bbox.max[2]-bbox.min[2])
	cmds.sets(e=True,forceElement="initialShadingGroup")
	cmds.select(sel)
开发者ID:ainaerco,项目名称:meshTools,代码行数:28,代码来源:obb.py


示例5: __setup_sculpt_shader

 def __setup_sculpt_shader(self):
     #--- this method setups the sculpt shader color
     #--- list all the shader names
     shader_list = ['sculptShaderGreen']
     #--- check if shader exists, else create a new one
     for s in range(len(shader_list)):
         if cmds.objExists(shader_list[s]):
             #--- check which mesh is selected
             self.shader = shader_list[0]
             self.shader_set = shader_list[0] + '3SG'
         else:
             #--- create the lambert shader
             self.shader = cmds.shadingNode('lambert',
                                            asShader = True,
                                            name = shader_list[0])
             self.shader_set = cmds.sets(self.shader,
                                         renderable = True,
                                         noSurfaceShader = True,
                                         empty = True,
                                         name = shader_list[0] + '3SG')
             cmds.connectAttr(self.shader + '.outColor',
                              self.shader_set + '.surfaceShader',
                              force = True)
     #--- change the color
     cmds.setAttr(self.shader + '.color', 0, 1, 1)
     #--- assign the shader to the sculpt_mesh
     cmds.sets(self.sculpt_mesh, forceElement = self.shader_set)
开发者ID:jonntd,项目名称:Public,代码行数:27,代码来源:shotfinaling.py


示例6: setDeformerMembership

	def setDeformerMembership(self,geoList=[]):
		'''
		'''
		# Check geometry list
		if not geoList: geoList = self.deformerData.keys()
		
		# Check deformer
		deformer = self.deformerName
		if not glTools.utils.deformer.isDeformer(deformer):
			raise Exception('Deformer "'+deformer+'" does not exist!')
		
		# Get deformer set
		deformerSet = glTools.utils.deformer.getDeformerSet(deformer)
		
		for geo in geoList:
			
			# Get current and stored membership
			setMembers = self.deformerData[geo]['membership']
			currMembers = glTools.utils.deformer.getDeformerSetMemberIndices(deformer,geo)
			removeMembers = list(set(currMembers)-set(setMembers))
			
			# Determine component type
			pt = 'cv'
			if self.deformerData[geo]['geometryType'] == 'mesh': pt = 'vtx'
			
			# Remove unused
			if removeMembers:
				mc.sets([geo+'.'+pt+'['+str(i)+']' for i in removeMembers],rm=deformerSet)
			
			# Add remaining members
			mc.sets(self.getMemberList([geo]),fe=deformerSet)
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:31,代码来源:deformerData.py


示例7: importPolyMesh

def importPolyMesh(name, identifier, jobInfo, parentXform=None, isConstant=False, useDynTopo=False):
	cmds.ExocortexAlembic_profileBegin(f="Python.ExocortexAlembic._import.importPolyMesh")

	# TODO: set isConstant properly elsewhere when there are no transforms but are
	# animated attributes
	isConstant = False
	try:
		reader = ""
		shape  = fnt.alembicCreateNode(name, "mesh", parentXform)
		cmds.sets(shape, e=True, forceElement="initialShadingGroup")

		topoReader = cmds.createNode("ExocortexAlembicPolyMesh")
		cmds.connectAttr(topoReader+".outMesh", shape+".inMesh")
		cmds.connectAttr(jobInfo.filenode+".outFileName", topoReader+".fileName")
		cmds.setAttr(topoReader+".identifier", identifier, type="string")
		cmds.setAttr(topoReader+".normals", jobInfo.useNormals)
		cmds.setAttr(topoReader+".uvs", jobInfo.useUVs)
		if jobInfo.useFaceSets:
			cmds.ExocortexAlembic_createFaceSets(o=shape, f=jobInfo.filename, i=identifier)

		if useDynTopo:
			cmds.connectAttr(jobInfo.timeCtrl+".outTime", topoReader+".inTime")
			reader = topoReader
		elif not isConstant:
			reader = cmds.deformer(shape, type="ExocortexAlembicPolyMeshDeform")[0]
			setupReaderAttribute(reader, identifier, isConstant, jobInfo)

		#if not useDynTopo:
		#	setupReaderAttribute(topoReader, identifier, isConstant, jobInfo)

	except:
		return [traceback.format_exc()]
	finally:
		cmds.ExocortexAlembic_profileEnd(f="Python.ExocortexAlembic._import.importPolyMesh")
	return [shape, reader]
开发者ID:AardmanCGI,项目名称:ExocortexCrate,代码行数:35,代码来源:_import.py


示例8: makeStreetTree

def makeStreetTree(shaders):
    '''
    Creates a tree on a circular platform and with a circular fence around it.
    
    shaders: A list of shaders for the tree crowns.
    On exit: A tree has been created using makeTree(...), a circular platform
             has been created underneath it and a fence around it. Appropriate 
             shaders have been assigned. Everything is united into one polygonal
             object and returned as a tuple with the object name and the node 
             name.
    '''
    tree = makeTree(shaders)
    platform = cmds.polyCylinder(name = "platform",h = 0.1, r = 0.8)
    cmds.move(0.25, y = True)
    cmds.sets(platform[0], edit=True, forceElement="fountainMaterialGroup")
    pole = cmds.polyCube(name = "pole", h = 0.6, w = 0.04, d = 0.04)
    cmds.xform(pole, t = (0.7,0.45,0))
    angle = 360/10.0
    for i in range(1,10):
        pole1 = cmds.polyCube(name = "pole", h = 0.6, w = 0.04, d = 0.04)
        cmds.rotate(angle * i, y = True)
        cmds.move(0.7,0.45,0, os = True)
        pole = cmds.polyUnite(pole, pole1)
    bar = cmds.polyPipe(name = "bar", h = 0.1, r = 0.65, t = 0.04)
    cmds.move(0.65, y = True)
    bar1 = cmds.duplicate(bar[0])
    cmds.move(-0.2, y = True, r = True)
    fence = cmds.polyUnite(pole, bar, bar1)
    cmds.sets(fence[0], edit=True, forceElement="blackMetalGroup")
    streetTree = cmds.polyUnite(tree,platform, fence)
    cmds.delete(streetTree, ch = True)
    return streetTree
开发者ID:hcbsundberg,项目名称:City_Generator,代码行数:32,代码来源:park.py


示例9: set_isolate_set

def set_isolate_set(selected):
    set_name = get_isolate_set_name()
    # Trying to hide visible children in hierarchy to get wanted isolate
    # behavior.
    for sel in selected:
        for child in sel.iterchildren():
            if child in selected or not child.type == MFn.kTransform:
                continue
            # Only work on visible children
            if child.attr['visibility']:
                child.attr['visibility'] = False
                HIDDEN_CHILDREN.add(child)

    hilited = DagpathList(
        [dag for dag in mampy.daglist(hl=True) if dag not in selected]
    )
    if hilited:
        cmds.hilite(hilited.cmdslist(), toggle=True)
        # In case the dag object was a child of unhilited object rehilite it.
        for dag in selected:
            cmds.hilite(str(dag))

    if not set_name:
        for dag in selected:
            cmds.isolateSelect(get_active_panel(), addDagObject=str(dag))
        return

    cmds.sets(clear=set_name)
    cmds.sets(selected.cmdslist(), include=set_name)
开发者ID:arubertoson,项目名称:maya-mamselect,代码行数:29,代码来源:isolate.py


示例10: makeFountain

def makeFountain():
    '''
    Creates a fountain.
    
    On exit: A fountain shaped polygonal object has been created, assigned a shader
             and is returned as a tuple with the object name and node name. The 
             procedure uses random numbers in order to create different looking fountains
             every time it is called.
    '''
    steps = random.randint(1,3)
    fountain = cmds.polyCylinder(name = "Fountain", h = 0.1)
    cmds.xform(fountain, translation = (0, 0.25, 0))
    cmds.select(fountain[0] + ".f[40:59]")
    for i in range(steps):
        scale_ = random.uniform(0.6, 0.95) 
        cmds.polyExtrudeFacet(scale = (scale_, scale_, scale_))
        translation = random.uniform(0.1, 0.6)
        cmds.polyExtrudeFacet(translate = (0, translation, 0))
    cmds.polyExtrudeFacet(scale = (0.9,0.9,0.9))
    cmds.polyExtrudeFacet(translate = (0, -0.3,0))
    scale_ = random.uniform(0.3,0.6)
    cmds.polyExtrudeFacet(scale = (scale_,scale_,scale_))
    translation = random.uniform(0.2,0.4)
    cmds.polyExtrudeFacet(translate = (0,translation,0))
    stepsUp = random.randint(1,3)
    for i in range(stepsUp):
        scale_ = random.uniform(0.4,0.9) 
        cmds.polyExtrudeFacet(scale = (scale_,scale_,scale_))
        translation = random.uniform(0.05,1)
        cmds.polyExtrudeFacet(translate = (0,translation,0))
    top = fountainTop(fountain) # Create a top for the fountain.
    fountain = cmds.polyUnite(top[0],fountain)
    cmds.sets(fountain[0], edit=True, forceElement="fountainMaterialGroup")
    return fountain
开发者ID:hcbsundberg,项目名称:City_Generator,代码行数:34,代码来源:park.py


示例11: makeTree

def makeTree(shaders):
    '''
    Creates a tree.
    
    shaders: A list of shaders for the tree crown.
    On exit: A tree has been modeled, and is returned as a tuple 
             containing the object name and the node name. Some of the
             variables are chosen randomly to create different results.
    '''
    height = random.uniform(0.3,1.5)
    trunk = cmds.polyCylinder(name = "trunk", h = height, r = 0.07)
    cmds.sets(trunk[0], edit=True, forceElement="trunkMaterialGroup")
    cmds.xform(trunk, translation = (0,height/2.0 + 0.2,0))
    crown = cmds.polySphere(name = "crown", r = 0.5)
    cmds.xform(crown, translation = (0,height + 0.6,0))
    cmds.softSelect(sse = True, ssd = 0.86)
    cmds.select(crown[0] + ".vtx[381]")
    translation = random.uniform(0.3,1.5)
    cmds.move(translation, y = True, r = True)
    cmds.softSelect(sse = False)
    shader = random.choice(shaders)
    scale_ = random.uniform(0.7,1.8)
    cmds.select(crown)
    cmds.scale(scale_, scale_, scale_, pivot = (0,height,0))
    cmds.sets(crown[0], edit=True, forceElement= shader[1])
    tree = cmds.polyUnite(trunk[0],crown[0])
    cmds.delete(tree[0], ch = True)
    return tree
开发者ID:hcbsundberg,项目名称:City_Generator,代码行数:28,代码来源:park.py


示例12: addLocators

def addLocators(factory=None, group="", locators=[]):
	if not factory: factory = MayaFactory.MayaFactory()
	
	if not group and not locators:
		selection = mc.ls(sl=True)
		if len(selection) < 2:
			raise Errors.BadArgumentError("Please select some objects to turn into Massive locators, and a massive group.")
		group = selection[-1]
		locators = selection[0:-1]
		addLocators(group, locators)
	else:
		if not group or not locators:
			raise Errors.BadArgumentError("Please select some objects to turn into Massive locators, and a massive group.")
		if not isGroup(group):
			raise Errors.BadArgumentError("%s is not a massive group." % group)
		if factory.isGroupsSet(group):
			raise Errors.BadArgumentError("%s can not have locators added to it." % group)
		for locator in locators:
			try:
				mc.xform(locator, query=True, worldSpace=True, translation=True)
			except:
				raise Errors.BadArgumentError("%s can not be turned into a Massive locator.\n" +
											  "Please select items whose transformation is accessible through the 'xform' command." % locator)
			if not mc.objExists("%s.massive" % locator):
				mc.addAttr(locator, longName="massive", attributeType="long")
		mc.sets(locators, add=group)
开发者ID:UIKit0,项目名称:massiveImporter,代码行数:26,代码来源:MayaPlacement.py


示例13: combineShader

 def combineShader( shaderList ):
     
     cmds.undoInfo( ock=1 )
     
     targetObjs = []
     for shader in shaderList:
         cmds.hyperShade( objects = shader )
         targetObjs += cmds.ls( sl=1 )
     shadingEngines = cmds.listConnections( shaderList, s=0, d=1, type='shadingEngine' )
     if not shadingEngines: return None
     shadingEngines = list( set( shadingEngines ) )
     targetShadingEngine = shadingEngines[0]
     
     cmds.sets( targetObjs, e=1, forceElement = targetShadingEngine )
     
     cmds.delete( shadingEngines[1:] )
     for shader in shaderList:
         shadingEngines = cmds.listConnections( shader, s=0, d=1, type='shadingEngine' )
         if not shadingEngines:
             cmds.delete( shader )
         elif not targetShadingEngine in shadingEngines:
             cmds.delete( shader, shadingEngines )
     
     Window_global.nodeInfomation = {}
     
     cmds.undoInfo( cck=1 )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:26,代码来源:__init__.py


示例14: load_shader

    def load_shader(self, look_file, shader_file, ref=True):
        if not os.path.isfile(look_file) and not os.path.isfile(shader_file):
            return False
        asset_ref_name = self.asset_name()
        asset_ref_name += '_Shad'
        # 用引用的方式导入材质文件,如果引用已经存在,无需导入
        if not mc.objExists(asset_ref_name + 'RN'):
            if ref:
                mc.file(shader_file, r=True, ignoreVersion=True, mergeNamespacesOnClash=False, gl=True,
                        namespace=asset_ref_name, options='v=0;p=17;f=0', typ='mayaBinary', pr=True)
            else:
                mc.file(shader_file, i=True, ignoreVersion=True, mergeNamespacesOnClash=False,
                        namespace=asset_ref_name, options='v=0;p=17;f=0', typ='mayaBinary', pr=True)
        else:
            print('Shader is loaded.')

        # 读入材质链接信息,讲材质赋给模型
        with open(look_file) as f:
            data = json.loads(f.read())
        link_list = data['shader_link']
        for k in link_list.keys():
            for s in link_list[k]:
                sg_name = '%s:%s' % (asset_ref_name, s)
                if mc.objExists(k):
                    mc.sets(k, e=1, forceElement=sg_name)
                    print("Assign shader %s to %s." % (sg_name, k))
                else:
                    asset_n = k.split('|')[0]
                    this_obj = k.replace(asset_n, self.__name)
                    if mc.objExists(this_obj):
                        mc.sets(k, e=1, forceElement=sg_name)
                        print("Assign shader %s to %s." % (sg_name, this_obj))
        print('Load shader for %s successful.' % self.name())
        return True
开发者ID:akoon,项目名称:OldPipeline,代码行数:34,代码来源:maya_asset.py


示例15: copyShader_multi

 def copyShader_multi( inputFirst, inputSeconds ):
     first = pymel.core.ls( inputFirst )[0]
     if not pymel.core.objExists( first ): return None
     try:firstShape = first.getShape()
     except:firstShape = first
     engines = firstShape.listConnections( type='shadingEngine' )
     if not engines: return None
     
     engines = list( set( engines ) )
     copyObjAndEngines = []
     
     seconds = [ pymel.core.ls( inputSecond )[0] for inputSecond in inputSeconds ]
     
     for engine in engines:
         srcCons = filter( lambda x : x.longName() in ['message', 'outColor'], engine.listConnections( s=1, d=0, p=1 ) )
         if not srcCons: continue
         pymel.core.hyperShade( objects = srcCons[0].node() )
         selObjs = pymel.core.ls( sl=1 )
         targetObjs = []
         for selObj in selObjs:
             if selObj.node() != firstShape: continue
             if selObj.find( '.' ) != -1:
                 for second in seconds:
                     targetObjs.append( second+'.'+ selObj.split( '.' )[-1] )
             else:
                 for second in seconds:
                     targetObjs.append( second )
         if not targetObjs: continue        
         for targetObj in targetObjs:
             cmds.sets( targetObj, e=1, forceElement=engine.name() )
             copyObjAndEngines.append( [targetObj, engine.name()] )
 
     return copyObjAndEngines
开发者ID:jonntd,项目名称:mayadev-1,代码行数:33,代码来源:tBurster2.py


示例16: makeSnowflakes

def makeSnowflakes(number,size,sizeVar,rgb1,rgb2,transparency,glow):
    '''
    Creates a number of snowflakes
    
    number       : Number of particles to create
    size         : Radius of the snowflakes
    sizeVar      : Variation in the radius
    rgb1         : One end of the colour range in the form (r,g,b)
    rgb2         : The other end of the colour range in the form (r,g,b)
    transparency : Alpha value for the shader
    glow         : Glow value for the shader
    
    The progress window is updated and the shading group list is created. 
    A while loop is initiated to create snowflakes, add them to the list 
    and assign shaders. The list of objects is returned.
    '''
    cmds.progressWindow(e=1,progress=0,status='Making Snowflakes...')
    SGList = createColourList(rgb1,rgb2,transparency,glow,5)
    list=[]
    count=0
    while count<number:
        radius = size+random.uniform(-(size*sizeVar*0.01),(size*sizeVar*0.01))
        list[len(list):] = [makeFlake(random.randint(5,8),radius)]
        cmds.sets(list[-1], e=1, forceElement=SGList[random.randint(0,4)])
        cmds.progressWindow(e=1,step=100/number)
        count += 1
    return list
开发者ID:philrouse,项目名称:snowFX,代码行数:27,代码来源:makeSnowflakes.py


示例17: getObjMaterials

def getObjMaterials():
    global remapAndLuminaceNodes
    index = 0
    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)
        remapAndLuminaceNodes.append(duplicateNodes[1])
        remapAndLuminaceNodes.append(duplicateNodes[2])
        remapAndLuminaceNodes.extend(duplicateNodes)
        for item in duplicateNodes:
            if cmds.nodeType(item) == "shadingEngine":
                duplicateShading = item
            if cmds.nodeType(item) in shadingType:
                duplicateMaterials.append(item)
            #     duplicateMaterials.append(item)
            #     remapAndLuminaceNodes.remove(item)
            # if cmds.nodeType(item) == displacementShading:
            #     if index >= 1: continue
            #     cmds.connectAttr('%s.displacement'%item, '%s.displacementShader'%duplicateShading, f = 1)
            #     index += 1
            # remapAndLuminaceNodes.remove(item)
        cmds.sets(obj, e=1, fe=duplicateShading)
    cmds.select(selObjsList, r=1)
    return list(set(duplicateMaterials))
开发者ID:chuckbruno,项目名称:remap,代码行数:35,代码来源:RemapAndIllumanceForSelectObjsInstance.py


示例18:

def	postProcessControl	(	_control,	_function,	_controlled	):	# <<< string, string, list
	lockHideAttributes	(	_control	)

	if (cmds.objExists('anim_control_set') == False):	cmds.createNode('objectSet',name='anim_control_set',skipSelect=True)

	cmds.sets	(	_control,	addElement	=	'anim_control_set'	)
	cmds.toggle	(	localAxis				=	1	)

	if	len	(	_controlled	)	==	0:
		_control	=	cmds.rename	(	'_'	+	_function	+	'_control'	)
		_control	=	cmds.group	( 	world	=	1,	name	=	'_'	+	_function	+	'_control_offSet'	)
		cmds.move					(	0,	0,	0,	_control	+	'.rotatePivot',	_control	+	'.scalePivot'	)

		lockHideAttributes	(	_control	)

	else:
		_k				=	_controlled[0].rfind	(	'|'	)
		_control		=	_controlled[0][_k+1:]
		cmds.rename		(	_control	+	'_'	+	_function	+	'_control'	)
		_control		=	cmds.group	(	world	=	1,	name	=	_control	+	'_'	+ _function	+	'_control_offSet'	)
		cmds.move			(	0, 0, 0, _control + '.rotatePivot', _control + '.scalePivot' )

		lockHideAttributes	(	_control	)

		cmds.select		(	_controlled[0],	toggle	=	True	)
		cmds.parent		()
		cmds.xform		(	translation	=	(	0,	0,	0	),	rotation	=	(	0,	0,	0	)	)
		cmds.parent		(	world		= 	1	)
	
	cmds.pickWalk	(	direction	=	"down"	)
开发者ID:danielforgacs,项目名称:code-dump,代码行数:30,代码来源:ford_riggingAid.py


示例19: appointShader

 def appointShader(self , name, side , modular , shaderName , obj):
         objShape = mc.listRelatives(obj , s=True)[0]
         shader = mc.createNode('lambert',n=shaderName)
         mc.sets(shader ,renderable=True , noSurfaceShader=True , empty=1 , name=name+side+modular+'shader_help')
         mc.connectAttr(shader+'.outColor' ,  name+side+modular+'shader_help.surfaceShader')
         mc.sets(objShape,e=True,fe=name+side+modular+'shader_help')
         return shader
开发者ID:wangqinghuaTudou,项目名称:test,代码行数:7,代码来源:Template.py


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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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