美文网首页
Mel脚本分享

Mel脚本分享

作者: XueWen | 来源:发表于2019-02-03 22:04 被阅读0次

    更新日志:
    -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⃣️  角色阴影层设置"
        -command "chaShadow";
    iconTextButton
        -en true
        -style "iconAndTextVertical"
        -w 100
        -h 50
        -image1 "channelBoxUnknownSpeed.png"
        -label "   4⃣️  场景阴影层设置"
        -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 "先选择物体再执行插件"
            -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 "先选择物体再执行插件"
        -button "Yes";
    }
    //Autodesk Maya 2018 
    //

    相关文章

      网友评论

          本文标题:Mel脚本分享

          本文链接:https://www.haomeiwen.com/subject/hbeusqtx.html