可以快速切换视图的插件,没啥实际用途,可以学习学习
import maya.cmds as cmds
try:
if cmds.window(window, exists = True):
cmds.deleteUI(window)
except NameError:
print 'error'
window = cmds.window(t = "快速切换视图",w= 300, h=150,sizeable = True)
cmds.columnLayout()
#-------------------------------------------------------------------------------------------------------------------------
cmds.separator(h = 10, w = 300,style = 'out')
create_RootY_button = cmds.button(label = "前视图",w = 300,c = "viewSet(0)")
cmds.separator(h = 10,w = 300, style = 'out')
create_RootXYZ_button = cmds.button(label = "左视图",w = 300,c = "viewSet(1)")
cmds.separator(h = 10,w = 300, style = 'out')
create_Root_button = cmds.button(label = "透视图",w = 300,c = "viewSet(2)")
DynFsgCol1 = 65
DynFsgCol2 = 75
DynFsgCol3 = 150
cmds.separator(h = 10,w = 300, style = 'out')
leaf_size_slider = cmds.floatSliderGrp(label="骨骼尺寸", min=0.01, max=10, value=0.01,field=True,cw3= (DynFsgCol1, DynFsgCol2, DynFsgCol3), changeCommand=setJointScale)
#-------------------------------------------------------------------------------------------------------------------------
cmds.showWindow(window)
def viewSet(a):
if a==0:
cmds.viewSet( f=True )
elif a==1:
cmds.viewSet( ls=True )
elif a==2:
cmds.viewSet( p=True )
#设置骨骼大小
def setJointScale(value):
#print("设置骨骼尺寸")
print(value)
cmds.jointDisplayScale(value)
|