1 回答
TA贡献2065条经验 获得超14个赞
python的脚本如下
import maya.cmds as mc
win=mc.window()
mc.columnLayout( adjustableColumn = True )
btn1=mc.button(l="按钮开",c='')
btn2=mc.button(l="按钮2",c='mc.button(btn1,e = 1,l = "按钮关")')
mc.showWindow(win)
mel的脚本如下
window;
columnLayout -adj 1;
button -l "按钮开" -c "" btn1;
button -l "按钮2" -c "button -e -l \"按钮关\" btn1";
showWindow;
其实还可以写成函数来调用
python函数如下
import maya.cmds as mc
win=mc.window()
mc.columnLayout( adjustableColumn = True )
btn1=mc.button(l="按钮开",c='')
btn2=mc.button(l="按钮2",c = 'change()')
mc.showWindow(win)
def change():
btn = mc.button(btn1,q = 1,l = 1)
if btn == '按钮开':
mc.button(btn1,e = 1,l = '按钮关')
if btn == '按钮关':
mc.button(btn1,e = 1,l = '按钮开')
mel函数如下
window;
columnLayout -adj 1;
button -l "按钮开" -c "" btn1;
button -l "按钮2" -c "btn1";
showWindow;
proc btn1(){
string $btn1 = `button -q -l btn1`;
if($btn1 == "按钮开"){
button -e -l "按钮关" btn1;
}
if($btn1 == "按钮关"){
button -e -l "按钮开" btn1;
}
}
- 1 回答
- 0 关注
- 1334 浏览
添加回答
举报