//
// 
//Script Name:多米诺骨牌v.1
//Author:疯狂小猪 
//Last Updated: 2011.10.5
//Email:wzybwj@163.com
// 
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------

global proc createDmn()
{
 if (`window -ex dmn`)
            deleteUI dmn;

window
            -t "多米诺骨牌v.1" 
            -w 400 -h 300
            -menuBar true
            -menuBarVisible true
            dmn;
     menu
            -label "edit"
            -tearOff 0;
       menuItem
              -label "默认设置" -c "err";
       menuItem
              -label "退出"
              -c "deleteUI dmn";
     menu
           -label "help"
           -tearOff 0;
     
     
     columnLayout
                -cw 300   
                -adj true   
                -rowSpacing 5 ;
       button  
                -h 30
                -l "拾取曲线"
                -al "center"
                -c "loadCurve"
                selectLabel;
       textFieldGrp
               
                 -l  "曲线选择"
                 loadCurve;
                      
     columnLayout   
                -adj true
                -cal "left"       
                -rowSpacing 5 ;
       separator
                -style "in";
       text  
            -fn boldLabelFont
              -al "left"
              -l "创建设置:";
       intSliderGrp
                -field true
                -l"骨牌间隔"   
                -minValue 1 -maxValue 100.0
                -fieldMinValue 1 -fieldMaxValue 100
                -value 10 jiange;
       intSliderGrp
                -field true
                -l"距离长度"   
                -minValue 400 -maxValue 1000
                -fieldMinValue 400 -fieldMaxValue 1000
                -value 400 changdu;
       floatSliderGrp
                -field true
                -l"骨牌宽度"   
                -minValue 0 -maxValue 10
                -fieldMinValue 0 -fieldMaxValue 10
                -value 1.25 x;
       floatSliderGrp
                -field true
                -l"骨牌高度"   
                -minValue 0 -maxValue 10
                -fieldMinValue 0 -fieldMaxValue 10
                -value 3 y;
       floatSliderGrp
                -field true
                -l"骨牌厚度"   
                -minValue 0 -maxValue 10
                -fieldMinValue 0 -fieldMaxValue 10
                -value 0.3 z;
       separator
                -height 5
                -style "in";
       text  
              -fn boldLabelFont
              -al "left"
              -l "速度设置:";
      
       intSliderGrp
                -field true
                -l"单体倒塌速度"   
                -minValue 1 -maxValue 100.0
                -fieldMinValue 1 -fieldMaxValue 100
                -value 20 dtsudu;
       intSliderGrp
                -field true
                -l"全局倒塌速度"   
                -minValue 1 -maxValue 50
                -fieldMinValue 1 -fieldMaxValue 50
                -value 15 qjsudu;
       intSliderGrp
                -field true
                -l"倒塌角度极限"   
                -minValue 50 -maxValue 90
                -fieldMinValue 50 -fieldMaxValue 90
                -value 84 singleRot;
     columnLayout
                -adj 1     
                -cal "left"
                -cat "both" 5
                -columnWidth 68
                -rowSpacing 5;

button  
                -h 30
                -l"创建骨牌"
                -al "center"
                -c "createDmn";
       button
                -h 30
                -l"删除骨牌"
                -al "center"
                 -c "deleteGp ";
       button
                -h 30
                -l"删除曲线"
                -al "center"
                -c "deleteCurve";
       button
                -h 30
                -l"创建动画"
                -c "addMotion"
                -al "center";
       button
                -h 30
                -l"删除动画"
                -c "deleteMotion"
                -al "center";
    
     setParent..;
     showWindow dmn;
}

global proc dmn()
{   
     $curveName = `textFieldGrp -q -tx loadCurve`;

$mp = `intSliderGrp
                            -q -v changdu`;
     $jiange = `intSliderGrp
                            -q -v jiange`;
     $x = `floatSliderGrp
                            -q -v x`;
     $y = `floatSliderGrp
                            -q -v y`;
     $z = `floatSliderGrp
                            -q -v z`;
            polyCube
                   -ch on
                   -o on
                   -w $x
                   -h $y
                   -d $z
                   -cuv 4
                   -n gp1;
            move 
                   -r 0 ($y/2*-1) 0 gp1.scalePivot gp1.rotatePivot ;
            setAttr "gp1.translateY" ($y/2*-1);
            group
                   -name "gp";
            xform
                   -os
                   -piv 0 0 0;
            select
                   -cl  ;

select
                   -r gp1  $curveName ;
            pathAnimation
                         -fractionMode true
                         -follow true
                         -followAxis z
                         -upAxis y
                         -worldUpType "vector"
                         -worldUpVector 0 1 0
                         -inverseUp false
                         -inverseFront false
                         -bank false
                         -startTimeU 1
                         -endTimeU                         
                         $mp;

for($ee=$jiange;$ee<=$mp;$ee+=$jiange)
                    {
                      currentTime $ee;
                      select
                            -r gp1 ;
                      duplicate
                            -rr;
                     }
             currentTime 1;
             cycleCheck -e 0;
             delete motionPath1;
}

global proc createDmn()
{

if(`objExists curve1`)
       {
            if(`objExists gp`)
              {
               delete gp;
               dmn;
               }
           else
               {
               dmn;        
                }          
         }
     else
         {
          confirmDialog
                       -message "你必须创建一条曲线!"
                       -button "确定";
                      
          }
  
}

global proc deleteCurve()
{
           select -cl;
           SelectAllNURBSCurves;
           $selection = `ls -sl`;
                  if(`size($selection)` == 0)
                        confirmDialog
                                     -message "场景中没有可删除曲线"
                                     -button "确定";
                  else
                      delete;
}

global proc deleteGp()
{
           if(`objExists gp`)
               delete gp;
           else
               confirmDialog
                            -message "场景中没有可删除的骨牌模型!"
                            -button "确定";
}

global proc loadCurve()
{
           $select = `ls -sl`;
            if(`size($select)` == 0)
             {
                             confirmDialog
                                           -message "你什么都没有选择"
                                           -button "确定";
             }
            else
            {
                 $selectShap = `listRelatives -f $select[0]` ;
                
                 if(`nodeType $selectShap` != "nurbsCurve")  
                   {
                             confirmDialog
                                           -button "确定"
                                           -message "你选择的不是曲线物体";
                    }
                 else
                    {
                     textFieldGrp -e -tx $selectShap loadCurve;
                     }
            }
           
}

global proc addMotion()
{
if(`objExists dmnMotion`)
    {
     delete dmnMotion;
      }
expression -s "select -cl;\r\nselect \"gp*\";\r\n$select = `ls -sl`;\r\n$num = (`size($select)` -1 )/2;\r\nint $singleSpeed = `intSliderGrp -q -v dtsudu`;\r\nint $globalSpeed = `intSliderGrp -q -v qjsudu`;\r\nint $finalRot = `intSliderGrp -q -v singleRot`;\r\n\r\n\r\n\r\nfor($i=1;$i<=$num;$i++)\r\n{\r\n string $attr=\"gp\"+$i+\".rx\";\r\n $rot=linstep(0+$i*$globalSpeed,$singleSpeed+$i*$globalSpeed,frame)*$finalRot;\r\n setAttr $attr $rot;\r\n}"  -o "" -n "dmnMotion" -ae 1 -uc all ;
}

global proc deleteMotion()
{
if(`objExists dmnMotion`)
{
      currentTime 1;
      delete dmnMotion;
 }
}

多米诺骨牌v.1MEL语言相关推荐

  1. Blender多米诺骨牌动画学习教程 The Impossible Domino Run in Blender

    流派:电子学习| MP4 |视频:h264,1280×720 |音频:AAC,48.0 KHz 语言:英语+中英文字幕(根据原英文字幕机译更准确)|大小:8.53 GB 含课程文件 |时长:8h 20 ...

  2. LeetCode 1128.等价多米诺骨牌

    题目 给你一个由一些多米诺骨牌组成的列表 dominoes. 如果其中某一张多米诺骨牌可以通过旋转 0 度或 180 度得到另一张多米诺骨牌,我们就认为这两张牌是等价的. 形式上,dominoes[i ...

  3. 多米诺骨牌——变形版0,1背包问题

    多米诺骨牌--变形版0,1背包问题 1.题目描述 2.问题分析 3.算法源码 1.题目描述 多米诺骨牌有上下2个方块组成,每个方块中有1~6个点.现有排成行的上方块中点数之和记为S1,下方块中点数之和 ...

  4. POJ 1135 Domino Effect(最短路 多米诺骨牌)

    题意 题目描述:  你知道多米诺骨牌除了用来玩多米诺骨牌游戏外,还有其他用途吗?多米诺骨牌游戏:取一 些多米诺骨牌,竖着排成连续的一行,两张骨牌之间只有很短的空隙.如果排列得很好,当你推 倒第 1张骨 ...

  5. S6 edge+的多米诺骨牌效应:大屏的趋势

    日前,为庆祝三星S6 edge+国行版的顺利发售,三星盖乐世社区的一些粉丝自发组织了三星疯狂"盖星人"第一期活动--活动现场除了可以对S6 edge+进行全方面体验之外,还将演示著 ...

  6. P1282 多米诺骨牌 (差值DP+背包)

    题目描述 多米诺骨牌有上下2个方块组成,每个方块中有1~6个点.现有排成行的 上方块中点数之和记为S1,下方块中点数之和记为S2,它们的差为|S1-S2|.例如在图8-1中,S1=6+1+1+1=9, ...

  7. P1282-多米诺骨牌【dp,背包】

    正题 评测记录:https://www.luogu.org/recordnew/lists?uid=52918&pid=P1282 题目大意 n个多米诺骨牌,上下值不相同,可以交换一个多米诺上 ...

  8. 【动态规划】 多米诺骨牌 (ssl 1632/luogu 1282)

    多米诺骨牌多米诺骨牌多米诺骨牌 Description Input 输入文件的第一行是一个正整数n(1≤n≤1000),表示多米诺骨牌数.接下来的n行表示n个多米诺骨牌的点数.每行有两个用空格隔开的正 ...

  9. 【01背包】洛谷P1282多米诺骨牌

    题目描述 多米诺骨牌有上下2个方块组成,每个方块中有1~6个点.现有排成行的 上方块中点数之和记为S1,下方块中点数之和记为S2,它们的差为|S1-S2|.例如在图8-1中,S1=6+1+1+1=9, ...

最新文章

  1. 能进这个Java组织的都是大神,现在只有三个中国人
  2. torch拼接合并 cat优化记录
  3. TP v5中环境变量在项目中的应用
  4. 大连理工大学c语言第三次上机作业答案,大连理工大学软件学院C语言上机第五六章课后题...
  5. php5.5 sqlserver 2012,PHP连接SQLSERVER2012
  6. 0069 如何在Intellij IDEA中查看Spring MVC项目的所有请求与处理方法的映射列表
  7. 安装指定的vue-router版本
  8. 安装GIT,集成到Powershell中
  9. 2022年国家自然基金标书撰写要点的全解
  10. 分省老年抚养比和老年人口比重(1995-2018年)
  11. win10/11: Windows Audio无法启动 错误 0x80070005:拒绝访问
  12. 有什么好用的gif制作软件 制作GIF表情包教程
  13. C#,图像二值化(05)——全局阈值的联高自适应算法(Legal Self-Adaptive Thresholding)及其源代码
  14. AcWing133. 蚯蚓
  15. 计算机丢了文件游戏打不开,你好360检测说我电脑文件缺失现在我电脑里游戏客户端打不开了怎么办...
  16. k8s-nexus私库
  17. resilience4j-ratelimiter:限流器
  18. java 使用JSONUtil工具类
  19. c语言实现单链表的创建(完整版)
  20. css零到一基础教程044:CSS 图标

热门文章

  1. c++ socket学习(1.4)
  2. 二分法:两个有序数组长度为N,找到第N、N+1大的数
  3. Opencv——霍夫变换以及遇到的一些问题
  4. c# 字节十六进制转十进制_用C中的十进制,八进制和十六进制数字初始化字节数组...
  5. 2013_nanjing_online
  6. 处理大并发之一 对epoll的理解,epoll客户端服务端代码
  7. 【算法】蛮力法/穷举法/枚举法 的基本问题分析
  8. 【汇编语言】8086汇编语言的debug中,t和p命令的区别
  9. Linux下多线程模拟停车场停车
  10. 三面美团Java岗,java架构师线下培训