2017-03-23 4 views
0
import maya.cmds as cmds 

def shapeTool(): 
    ram = 'RenamerWin' 
    if cmds.window(ram, q = True, exists =True): 
     cmds.deleteUI(ram) 

    ram = cmds.window("RenamerWin",t = "Shape Tool", w=300, h=300) 
    cmds.columnLayout(adj = True) 
    cmds.separator(h=20) 
    cmds.text("Welcome to the Shape Creator") 
    cmds.separator(h=20) 


    cubW = cmds.intSliderGrp(l = "Width", min =0, max = 10, field = True) 
    cubH = cmds.intSliderGrp(l = "Height", min =0, max = 10, field = True) 
    cubD = cmds.intSliderGrp(l = "Depth", min =0, max = 10, field = True) 

    cubX = cmds.intSliderGrp(l = "Translate X axis", field = True) 
    cubY = cmds.intSliderGrp(l = "Translate Y axis", field = True) 
    cubZ = cmds.intSliderGrp(l = "Translate Z axis", field = True) 

    def myCube(_): 
     myCubeWidth = cmds.intSliderGrp(cubW , q= True,value =True) 
     myCubeHeight = cmds.intSliderGrp(cubH , q= True,value =True) 
     myCubeDepth = cmds.intSliderGrp(cubD , q= True,value =True) 
     myCubeMoveX = cmds.intSliderGrp(cubMX , q= True,value =True) 
     myCubeMoveY = cmds.intSliderGrp(cubMY , q= True,value =True) 
     myCubeMoveZ = cmds.intSliderGrp(cubMZ , q= True,value =True) 
     cmds.polyCube(w=myCubeWidth,h=myCubeHeight,d=myCubeDepth , n = "myCube") 
     cmds.move(myCubeMoveX, x=True) 
     cmds.move(myCubeMoveY, x=True) 
     cmds.move(myCubeMoveZ, x=True) 

    cmds.button(l = "Create a Cube",c=myCube) 

    cmds.showWindow(ram) 

shapeTool() 

こんにちは(PYTHON)、cmds.move問題マヤGUI

私はいけないuderstand私は移動をコメントアウトすると、このありえないの作業が...、その後、GUIがそう働く理由、それはそれをどうしなければなりません。 誰もが考えている場合は私に教えてください

ありがとう。

+0

を働いているわずかな修正版です人々がより効果的に援助するためのあなたの記述の誤りを引き起こさなければならない。 – theodox

答えて

0

あなたはすべての3つの方向に移動する場合は基本的に、あなたは真のxyz =を渡す必要があり、タイプミスもないcubMXだけCUBXを持っていたが?..ここでは、

import maya.cmds as cmds 

def shapeTool(): 
    ram = 'RenamerWin' 
    if cmds.window(ram, q = True, exists =True): 
     cmds.deleteUI(ram) 

    ram = cmds.window("RenamerWin",t = "Shape Tool", w=300, h=300) 
    cmds.columnLayout(adj = True) 
    cmds.separator(h=20) 
    cmds.text("Welcome to the Shape Creator") 
    cmds.separator(h=20) 


    cubW = cmds.intSliderGrp(l = "Width", min =0, max = 10, field = True) 
    cubH = cmds.intSliderGrp(l = "Height", min =0, max = 10, field = True) 
    cubD = cmds.intSliderGrp(l = "Depth", min =0, max = 10, field = True) 

    cubX = cmds.intSliderGrp(l = "Translate X axis", field = True) 
    cubY = cmds.intSliderGrp(l = "Translate Y axis", field = True) 
    cubZ = cmds.intSliderGrp(l = "Translate Z axis", field = True) 

    def myCube(_): 
     myCubeWidth = cmds.intSliderGrp(cubW , q= True,value =True) 
     myCubeHeight = cmds.intSliderGrp(cubH , q= True,value =True) 
     myCubeDepth = cmds.intSliderGrp(cubD , q= True,value =True) 
     myCubeMoveX = cmds.intSliderGrp(cubX , q= True,value =True) 
     myCubeMoveY = cmds.intSliderGrp(cubY , q= True,value =True) 
     myCubeMoveZ = cmds.intSliderGrp(cubZ , q= True,value =True) 
     print myCubeMoveZ, myCubeMoveY, myCubeMoveX 
     cmds.polyCube(w=myCubeWidth,h=myCubeHeight,d=myCubeDepth , n = "myCube") 
     cmds.move(myCubeMoveX,myCubeMoveY,myCubeMoveZ, xyz=True) 

    cmds.button(l = "Create a Cube",c=myCube) 

    cmds.showWindow(ram) 

shapeTool() 
関連する問題