当前位置: 首页>>代码示例>>Python>>正文


Python cmds.scale函数代码示例

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


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

示例1: test_agst

    def test_agst(self):

        # animated geometry, static transform node
        nodename = 'agst_node'
        MayaCmds.polyCube(name=nodename)
        MayaCmds.select(nodename+'.vtx[0:8]')
        MayaCmds.setKeyframe(time=1.0)
        MayaCmds.scale(1.5, 1.5, 1.8)
        MayaCmds.setKeyframe(time=5.0)

        self.__files.append(util.expandFileName('agst_motionblur_noSampleGeo_Test.abc'))
        MayaCmds.AbcExport(j='-fr 1 5 -step 0.5 -wfg -root %s -file %s' % (
            nodename, self.__files[-1]))

        # frameRange: 1, 2, 3, 4, 5, 6
        self.isFrameRangeTransAndFrameRangeShapeExists(self.__files[-1])

        self.__files.append(util.expandFileName('agst_motionblur_Test.abc'))
        MayaCmds.AbcExport(j='-fr 1 5 -step 0.5 -root %s -f %s' % (
            nodename, self.__files[-1]))

        # frameRange: 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6
        self.isFrameRangeExists(self.__files[-1])

        self.__files.append(util.expandFileName('agst_noSampleGeo_Test.abc'))
        MayaCmds.AbcExport(j='-fr 1 5 -wfg -root %s -f %s' % (nodename,
            self.__files[-1]))

        # frameRange: 1, 2, 3, 4, 5
        self.isFrameRangeExists(self.__files[-1])
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:30,代码来源:AbcExport_subframes_test.py

示例2: setup_scene

def setup_scene(name=sys.argv[1]):
    # imports shirt, scales to fit, converts to ncloth
    try:
        cmds.loadPlugin("objExport")
    except:
        pass
    mel.eval('file -f -options "mo=1" -ignoreVersion -typ "OBJ" -o "%s";' \
         % name)
    try:
        mel.eval('rename "Mesh" "shirt";')
    except:
        pass
    # scale shirt to fit
    create_table()
    if (fold_num == 0):
        bbx = cmds.xform("shirt", q=True, bb=True, ws=True)
        s_x_len = abs(bbx[3] - bbx[0])
        s_y_len = abs(bbx[4] - bbx[1])
        global GLOBAL_SCALE
        if (s_x_len >= s_y_len):
            GLOBAL_SCALE = s_x_len/(SHIRT_SCALE * TABLE_SIZE)
        else:
            GLOBAL_SCALE = s_y_len/(SHIRT_SCALE * TABLE_SIZE)
        cmds.select("shirt")
        cmds.move(0, 0.0001, 0, relative = True)
    cmds.scale(GLOBAL_SCALE, GLOBAL_SCALE, GLOBAL_SCALE, "table", centerPivot = True)
    shirt_to_nCloth()
    create_camera()
开发者ID:wenlongx,项目名称:Maya-Cloth-Simulation,代码行数:28,代码来源:main_backup.py

示例3: locatorOnly

def locatorOnly(self):

    sel = cmds.ls(sl=True)

    # Gives error if more than one object is selected.
    if len(sel) > 1:
        cmds.error("Too many objects selected!")

    # Creates and snaps a locator to object.
    elif len(sel):
        tObj = sel[0]
        tLoc = "{0}_tLoc".format(tObj)
        LScale = cmds.floatField(LocScale, q=True, v=True)

        if cmds.objExists(tLoc):
            cmds.delete(tLoc)

        cmds.spaceLocator(n="{0}_tLoc".format(tObj))
        cmds.scale(LScale, LScale, LScale)
        cmds.parentConstraint(tObj, tLoc, mo=False)
        cmds.parentConstraint(tObj, tLoc, rm=True)

        print LScale
    # Gives error if no objects are selected.
    else:
        cmds.error("No objects selected!")
开发者ID:Italic-,项目名称:maya-prefs,代码行数:26,代码来源:jamTrack.py

示例4: implicitSphere

def implicitSphere(name,group=False,size=1.0):
    ''' Creates a square shape.
        If group is True, will group control and
        return a list [group,control].
    '''
    
    #creating the curve
    curve=cmds.createNode('implicitSphere')
    curve=cmds.listRelatives(curve,parent=True)[0]
    
    #setup curve
    cmds.makeIdentity(curve,apply=True, t=1, r=1, s=1, n=0)
    
    #naming control
    node=cmds.rename(curve,name)
    
    #sizing
    cmds.scale(size,size,size,node)
    cmds.FreezeTransformations(node)
    
    #grouping control
    if group==True:
        grp=cmds.group(node,n=name+'_grp')
        
        return [grp,node]
    
    #return
    return node
开发者ID:Bumpybox,项目名称:Tapp,代码行数:28,代码来源:utils.py

示例5: createIKCtrlsOnJnts

def createIKCtrlsOnJnts(ikCrv, parentCtrl, size=1):
    ikCVNum = ll.getCurveCVCount(ikCrv)
    prev=parentCtrl
    for i in range(1, ikCVNum):
        clus = mc.cluster('%s.cv[%d]'%(ikCrv, i), n=parentCtrl.replace('masterctrl','ikClus%d')%i)
        cvPos = mc.xform('%s.cv[%d]'%(ikCrv, i), q=1, ws=1, t=1)
        mc.select(parentCtrl)
        meval('wireShape("plus")')
        ikCtrl = mc.rename(masterCtrl.replace('masterctrl','ikCtrl%d'%i))
        mc.xform(ikCtrl, t=cvPos, ws=1)
        mc.scale(size, size, size, ikCtrl, ocp=1)
        mc.makeIdentity(ikCtrl, a=1, s=1)
        mc.parent(ikCtrl, parentCtrl)
        lsZeroOut(ikCtrl)
        ctrlPR = lsZeroOut(ikCtrl, 'PR')
        mc.addAttr(ikCtrl, ln='SPACE', at='bool', k=1)
        mc.setAttr(ikCtrl+'.SPACE', l=1)
        mc.addAttr(ikCtrl, ln='parent', at='float', dv=0, min=0, max=1, k=1)
        mc.addAttr(ikCtrl, ln='master', at='float', dv=1, min=0, max=1, k=1)
        mc.addAttr(ikCtrl, ln='world', at='float', dv=0, min=0, max=1, k=1)
        mc.parentConstraint(ikCtrl, clus)
        cons = mc.parentConstraint(prev, parentCtrl, ctrlPR, mo=1)[0]
        wal = mc.parentConstraint(cons, q=1, wal=1)
        if len(wal) > 1:
            mc.connectAttr(ikCtrl+'.parent', '%s.%s'%(cons, wal[0]), f=1)
            mc.connectAttr(ikCtrl+'.master', '%s.%s'%(cons, wal[1]), f=1)
        prev=ikCtrl
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:27,代码来源:hair.py

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

示例7: Circle

def Circle(name='circle_cnt',group=False,size=1.0):
    ''' Creates a circle shape.
        If group is True, will group control and
        return a list [group,control].
    '''
    
    #creating the curve
    curve=cmds.circle(radius=1,constructionHistory=False)
    
    #transform to standard
    cmds.rotate(0,90,0,curve)
    
    cmds.makeIdentity(curve,apply=True, t=1, r=1, s=1, n=0)
    
    #naming control
    node=cmds.rename(curve,name)
    
    #sizing
    cmds.scale(size,size,size,node)
    cmds.FreezeTransformations(node)
    
    #grouping control
    if group==True:
        grp=cmds.group(node,n=name+'_grp')
        
        return [grp,node]
    
    #return
    return node
开发者ID:Bumpybox,项目名称:Tapp,代码行数:29,代码来源:utils.py

示例8: createSquare

def createSquare(*args):
    cmds.curve(d=1,p=[(0.5,0,0.5), (-0.5,0,0.5), 
    (-0.5,0,-0.5),(0.5,0,-0.5),(0.5,0,0.5)],
    k=[0,1,2,3,4],per=True)
    cmds.scale(2.458224,2.459224,2.459224,r=True)
    cmds.select(cl=True)
    print 'Created a Nurbs Square'
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:7,代码来源:Melville_Tobias_RBA_1201_finalToolSet.py

示例9: createCOG

def createCOG(*args):
    cmds.circle(nr=(0,1,0),s=16, r=2)
    cmds.scale(0.177161, 0.177161, 0.177161,'.cv[15]','.cv[13]','.cv[11]','.cv[9]','.cv[7]',
                '.cv[5]','.cv[3]','.cv[1]',r=True)
    cmds.scale(1.848257, 1.848257, 1.848257, r=True)
    cmds.select(cl=True)
    print 'Created a COG'
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:7,代码来源:Melville_Tobias_RBA_1201_finalToolSet.py

示例10: Neck_Control

	def Neck_Control(*args, **kwargs):
		NeckJt = "Neck_Jt"
		NeckCtrl = [mc.curve(name="Neck_Ctrl",degree=3,point=[(-0.801407, 0, 0.00716748),(-0.802768, 0.023587, -0.220859), (-0.805489, 0.0707609, -0.676912),
						   (0.761595, -0.283043, -0.667253), (1.045492, -0.194522, -0.0218101), (1.046678, -0.194804, 0.0403576),(0.758039, -0.282198, 0.63974),
						   (-0.806291, 0.0676615, 0.650803),(-0.803035, 0.0225538, 0.221713),(-0.801407, 0, 0.00716748)]),
						   mc.setAttr("Neck_Ctrl.overrideColor",18),mc.setAttr("Neck_Ctrl.overrideEnabled",1)]
		mc.scale(2.1,3.16,2.8)
		mc.makeIdentity( 'Neck_Ctrl', apply=True, translate=True,scale=True)
		lockScaling = mc.setAttr("Neck_Ctrl.scale",lock=True)
		
		# xform translation
		valNeck = mc.xform(NeckJt,ws=True,query=True,translation=True)
		mc.xform(NeckCtrl,ws=1,t = (valNeck[0],valNeck[1],valNeck[2]))
		
		mc.orientConstraint("Neck_Ctrl", NeckJt)
		mc.pointConstraint("Neck_Ctrl", NeckJt)
		grpNeck = mc.group("Neck_Ctrl", name="GRP_Neck")
		
		mc.parent("GRP_Neck","Front_Spine_Ctrl")
		
		#Lock translation for curve
		lockTranslation = mc.setAttr("Neck_Ctrl.translate",lock=True)
		

		return NeckCtrl,NeckJt
开发者ID:PaulElmo,项目名称:Quad_Rig_Tool,代码行数:25,代码来源:Q_RigWindow.py

示例11: createStalk

 def createStalk(self):
     ''' This method creates the stalk. '''
     
     # y ax is calculated by flower position
     mc.polyPipe( subdivisionsHeight=3 );
     mc.scale( 0.24, self.flowerTY+1, 0.24 )
     mc.move( 0, -self.flowerTY/2, 0 );
     mc.displaySmoothness( divisionsU=3, divisionsV=3, pointsWire=16, pointsShaded=4, polygonObject=3 );
     self.currentStalk = mc.ls( sl=True );
     currentStalk0 = self.currentStalk[0]
      
     # bend the stalk
     bendStalkRandomUpX = 1.5 * (1.0 - random.random())
     bendStalkRandomUpZ = 1.5 * (1.0 - random.random())
     for uCV in range (40,60):    
         mc.select( currentStalk0 + ".vtx[" + str(uCV) + "]" );
         mc.move( bendStalkRandomUpX, 0, bendStalkRandomUpZ, r=True );
         mc.select( currentStalk0 + ".vtx[" + str(uCV+60) + "]" );
         mc.move( bendStalkRandomUpX, 0, bendStalkRandomUpZ, r=True );
     
     bendStalkRandomDownX = 1.2 * (1.0 - random.random())
     bendStalkRandomDownZ = 1.2 * (1.0 - random.random())
     for uCV in range (20,40):
         mc.select( currentStalk0 + ".vtx[" + str(uCV) + "]" );
         mc.move( bendStalkRandomDownX, 0, bendStalkRandomDownZ, r=True );
         mc.select( currentStalk0 + ".vtx[" + str(uCV+100) + "]" );
         mc.move( bendStalkRandomDownX, 0, bendStalkRandomDownZ, r=True )
     
     # delete history
     mc.select( currentStalk0 )
     maya.mel.eval( "DeleteHistory" )
     
     mc.select( clear=True )
     
     return self.currentStalk
开发者ID:remusvrm,项目名称:plugins,代码行数:35,代码来源:Flower_v03.py

示例12: __finaliseCtrl

    def __finaliseCtrl(self):

        """
        This function is in charge for orienting, scaling and zeroing out the control
        
        """

        self.__aimCtrl()

        if self.size != 1:

            shapes = cmds.listRelatives(self.control, shapes=True)

            for s in shapes:

                cmds.select("%s.cv[:]" % s)
                cmds.scale(self.size, self.size, self.size, r=1)
                cmds.select(clear=True)

            cmds.delete(self.control, ch=1)

        if self.group == True:

            common.insertGroup(self.control)
            # self.controlGrp = self.__groupHier(self.control)

        if self.flip == True:

            self.__flip()
开发者ID:jbrodskytd,项目名称:anomalia,代码行数:29,代码来源:controls.py

示例13: create_controls

    def create_controls(self):
        """Creates the controls for the neck module."""
        neck_ctl = self.c.controls('circle')
        cmds.makeIdentity(neck_ctl, apply=True, t=1, r=1, s=1, n=0, pn=1)
        shape = cmds.listRelatives(neck_ctl, c=True, type='shape')[0]
        shape = cmds.rename(shape, '%s%s' % (self.fk_jnts[0], 'Shape'))
        cmds.parent(shape, self.fk_jnts[0], s=True, r=True)
        cmds.delete(neck_ctl)
        cmds.select('%s.cv[0:10]' % shape, r=True)
        cmds.scale(8, 8, 8)
        cmds.move(0, 0, 2.5, r=True, os=True, wd=True)
        cmds.select(cl=True)
        self.controls['neck'] = self.fk_jnts[0]

        head_ctl = self.c.controls('circle')
        self.c.snap_a_to_b(head_ctl, self.result_jnts[-1])
        cmds.xform(head_ctl, ro=[0, 0, 90], s=[14, 1, 24])
        cmds.select('%s.cv[0:10]' % head_ctl, r=True)
        cmds.move(12, 0, 0, r=True, os=True, wd=True)
        head_ctl = cmds.rename(head_ctl, '%s_%s_%s' % (self.side, 'head', self.nc.control))
        cmds.makeIdentity(head_ctl, apply=True, t=1, r=1, s=1, n=0, pn=1)
        cmds.addAttr(head_ctl, ln='FK_Rotation_Space', nn='FK Rotation Space',
                     at='enum', en='Head:Shoulder:Body:Root')
        cmds.setAttr('%s.FK_Rotation_Space' % head_ctl, e=True, keyable=True)
        cmds.addAttr(head_ctl, ln='FK_Translation_Space', nn='FKTranslation Space',
                     at='enum', en='Head:Shoulder:Body:Root')
        cmds.setAttr('%s.FK_Translation_Space' % head_ctl, e=True, keyable=True)
        self.controls['head'] = head_ctl
开发者ID:jonntd,项目名称:Rigganator,代码行数:28,代码来源:neck.py

示例14: scaleGeo

def scaleGeo():
	
	transx = cmds.intField("gTransX", q=True, value=True)
	transy = cmds.intField("gTransY", q=True, value=True)
	transz = cmds.intField("gTransZ", q=True, value=True)
	
	cmds.scale( transx,transy,transz )
开发者ID:mfossett,项目名称:PythonScripts,代码行数:7,代码来源:Modeling_Toolset_v2.py

示例15: on3DSceneClick

	def on3DSceneClick(self):
		if not cmds.window("autorigging_ui", exists=True) :
			self.resetExternalContext()
			return
		
		if not self.isActive :
			self.setConsoleText("Vous devez activer l'autorigging.",color=[255,0,0])
			return

		if not self.currentPointKey :
			self.setConsoleText("Choisissez un type de point a placer.")
			return


		pos = cmds.draggerContext("riggingContext", query=1, anchorPoint=1)
		strPos = "x:"+str(round(pos[0],2)) +"\ny:" + str(round(pos[1],2))

		if self.pointsMap[self.currentPointKey]["isSet"] is True :
			cmds.delete(self.currentPointKey+"sphere")
		
		
		nextObj = cmds.polySphere(name=self.currentPointKey+"sphere", radius=0.3)
		cmds.move(pos[0], pos[1], 10, nextObj)
		cmds.scale(1.0,1.0,0.0, nextObj)

		self.pointsMap[self.currentPointKey]["isSet"] = True
		self.pointsMap[self.currentPointKey]["clickedPoint"] = pos
		cmds.button(self.pointsMap[self.currentPointKey]["stateButton"], e=1, backgroundColor=[0,255,0],label=strPos)
开发者ID:LecomteEmerick,项目名称:MayaProject,代码行数:28,代码来源:autoriggin_ui.py


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