Mel腳本分享

更新日志:
-v0.01
-v0.02


插件界面 0.2

Mel腳本展示

if(`window -ex tapWin`)
{deleteUI tapWin;}
//New window
window 
    -menuBar true
    -t "一鍵工具箱_v0.02" 
    -wh 200 300 
    -s 0 tapWin;
menu 
    -label "Help"
    -helpMenu true;
    menuItem 
            -label "About the Plugin"
            -command "AboutHelp";
columnLayout -adjustableColumn true;
//add iconButton 
iconTextButton
    -en true 
    -style "iconAndTextVertical"
    -w 100
    -h 50
    -image1 "channelBoxSlow.png"
    -label "   1??  一鍵解鎖"
    -command "yjjs"; 
iconTextButton
    -en true
    -style "iconAndTextVertical"
    -w 100
    -h 50
    -image1 "WireFrame.png"
    -label "   2??  一鍵隱藏(ctrl+H)"
    -command "yjyc";   
iconTextButton
    -en true
    -style "iconAndTextVertical"
    -w 100
    -h 50
    -image1 "channelBoxUnknownSpeed.png"
    -label "   3??  角色陰影層設(shè)置"
    -command "chaShadow";
iconTextButton
    -en true
    -style "iconAndTextVertical"
    -w 100
    -h 50
    -image1 "channelBoxUnknownSpeed.png"
    -label "   4??  場(chǎng)景陰影層設(shè)置"
    -command "bgShadow";
window -e -wh 200 300 tapWin;
showWindow tapWin;
//Use script
global proc yjjs()
{
    string $OneTap[] = `ls -selection`;
    for($AllObject in $OneTap)
    {    
    setAttr ($AllObject+".overrideDisplayType") 0;
    }    
}
global proc yjyc()
{
    string $TwoTap[] = `ls -selection`;
    for($AllObjectTwo in $TwoTap)
        {
        setAttr ($AllObjectTwo+".visibility") 0;
        }    
}
global proc AboutHelp()
{
    confirmDialog 
        -title "注意!" 
        -message "先選擇物體再執(zhí)行插件"
        -button "Yes";
}
global proc chaShadow()
{
    string $FourTap[] = `ls -selection`;
    for($AllObjectFour in $FourTap)
        {
            SpreadSheetWindow;
            setAttr ($AllObjectFour+".castsShadows") 1;
            setAttr ($AllObjectFour+".receiveShadows") 0;
            setAttr ($AllObjectFour+".primaryVisibility") 0;
        }    
}
global proc bgShadow()
{
    string $FiveTap[] = `ls -selection`;
    for($AllObjectFive in $FiveTap)
        {
            SpreadSheetWindow;
            setAttr ($AllObjectFive+".castsShadows") 0;
            setAttr ($AllObjectFive+".receiveShadows") 1;
            setAttr ($AllObjectFive+".primaryVisibility") 1;
        }    
}


插件界面 0.1

Mel腳本展示

if(`window -ex tapWin`)
{deleteUI tapWin;}
//New window
window 
    -menuBar true
    -t "一鍵工具箱_v0.01" 
    -wh 200 300 
    -s 0 tapWin;
menu 
    -label "Help"
    -helpMenu true;
    menuItem 
            -label "About the Plugin"
            -command "AboutHelp";
columnLayout -adjustableColumn true;
//add button
button 
    -w 180 
    -h 50
    -label "一鍵解鎖"
    -command "yjjs"; 
button
    -w 180
    -h 50
    -label "一鍵隱藏(ctrl+H)"
    -command "yjyc";
window -e -wh 200 300 tapWin;    
showWindow tapWin;
//Use script
global proc yjjs()
{
string $OneTap[] = `ls -selection`;
for($AllObject in $OneTap)
{setAttr ($AllObject+".overrideDisplayType") 0;}    
}
global proc yjyc()
{
string $TwoTap[] = `ls -selection`;
for($AllObjectTwo in $TwoTap)
{setAttr ($AllObjectTwo+".visibility") 0;}    
}
setAttr "pCube1.visibility" 1;
global proc AboutHelp()
{
confirmDialog 
    -title "注意!" 
    -message "先選擇物體再執(zhí)行插件"
    -button "Yes";
}
//Autodesk Maya 2018 
//
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容