- 插件类型:
- 插件语言:
不同maya窗口间的数据传输。 在以前制作课件时,遇到了这样的问题,就是。需要把制作案例的过程重复一遍。 这样录制过程中,物体的位置、旋转缩放的数据总是需要不停的在两个maya之间copy。 累啊。于是编写了这个小工具。 在两个maya窗口中,都打开这个工具。在一边点记录,另一边点读取即可。非常方便。 以下是本插件源代码: 源码: //Coded by Jinghai Tian in 2008 //you first open two maya main windows. //this procedure can transport data between objects with the same name form different maya main windows. //to do this well ,you must ensure the objects with the same name in different maya main windows. //UI attrTransport; global proc attrTransport() { if (`windowPref -exists attrTransportWindow`) windowPref -remove attrTransportWindow; if (`window -exists attrTransportWindow`) deleteUI attrTransportWindow; window -widthHeight 200 150 -title "AttrTransport by Jinghai Tian.2005-2008" -topLeftCorner 50 200 -bgc 0.1 0.3 0.4 -sizeable 1 -rtf 1 -minimizeButton 1 -maximizeButton 0 attrTransportWindow; columnLayout -adj 1 -w 200 -h 150 -columnAlign "center" -bgc 0.576 0.607 0.726 ; text -bgc 0.576 0.607 0.726 -al "left" -l "此工具从不同的maya窗口\n之间传递同名物体的数据 \n"; text -bgc 0.576 0.607 0.726 -al "left" -l " Use Methord:"; text -bgc 0.576 0.607 0.726 -al "left" -l " 1.选择多个物体."; button -bgc 0.748 0.790 0.949 -w 150 -label " 记录变换数据" -command "writeDataToTempFile" ; text -bgc 0.576 0.607 0.726 -al "left" -l " 2.直接执行."; button -bgc 0.748 0.790 0.949 -w 150 -label " 读取数据 " -command "readDataFromTempFile" ; text -bgc 0.576 0.607 0.726 -al "center" -l "\n "; showWindow; } global proc string attrTransportSettings() { string $finalCommands=""; //add attr you want to transport underline. $finalCommands+=`attrTransportProcess tx`; $finalCommands+=`attrTransportProcess ty`; $finalCommands+=`attrTransportProcess tz`; $finalCommands+=`attrTransportProcess rx`; $finalCommands+=`attrTransportProcess ry`; $finalCommands+=`attrTransportProcess rz`; $finalCommands+=`attrTransportProcess sx`; $finalCommands+=`attrTransportProcess sy`; $finalCommands+=`attrTransportProcess sz`; //$finalCommands+=`attrTransportProcess coneAngle`; //$finalCommands+=`attrTransportProcess intensity`; //$finalCommands+=`vectorAttrTransportProcess color`; return $finalCommands; } global proc string attrTransportProcess(string $attr) { string $selects[]=`ls -sl`; int $selNum=size($selects); string $finalCommands; for ($i=0;$i<$selNum;$i++) { if(`objExists ($selects[$i]+"."+$attr)`){ float $data=`getAttr ($selects[$i]+"."+$attr)`; //Returns a number rounded to the largest integer less than or equal to a floating point number. $data=floor($data*10)/10; $finalCommands+="setAttr "+$selects[$i]+"."+$attr+" "+$data+";\n"; } } return $finalCommands; } global proc string vectorAttrTransportProcess(string $attr) { string $selects[]=`ls -sl`; int $selNum=size($selects); string $finalCommands; for ($i=0;$i<$selNum;$i++) { if(`objExists ($selects[$i]+"."+$attr)`){ vector $data=`getAttr ($selects[$i]+"."+$attr)`; $finalCommands+="setAttr "+$selects[$i]+"."+$attr+" -type double3 "+$data.x+" "+$data.y+" "+$data.z+" "+";\n"; } } return $finalCommands; } global proc writeDataToTempFile() { $tempFileName = ( `internalVar -userTmpDir` + "attrTransport.tmp" ); $fileId=`fopen $tempFileName "w"`; string $finalCommands=`attrTransportSettings`; fprint $fileId $finalCommands; fclose $fileId; print "write successful!"; } // Now, open the file and read the data // global proc readDataFromTempFile() { $tempFileName = ( `internalVar -userTmpDir` + "attrTransport.tmp" ); $fileId=`fopen $tempFileName "r"`; string $finalCommands; $finalCommands=`fread $fileId $finalCommands`; eval_r($finalCommands); fclose $fileId; print "read successful!"; } 要下载该文件,需要先登录哦~
|
楼主热帖
更多帖子
-
Mery Rig 国外高级绑定模型 迪士尼梦工厂模型下载
浏览:417657 | 评论:1531 -
国外精品模型欧美男孩maya模型下载 帅气卡通男孩maya模型下载
浏览:309667 | 评论:1379 -
12组Maya角色动画绑定模型包Gumroad – Body Mechanic Rigs Mega
浏览:274405 | 评论:1155 -
海贼王3D电影里的女帝-汉库克maya模型下载
浏览:235544 | 评论:570 -
Wrapit 1.54 - 超强的3DMAX模型拓扑插件【免积分放出】
浏览:233921 | 评论:846 -
玛蒂尔达玛雅的CG角色MAYA模型 女性角色高模MAYA模型
浏览:225129 | 评论:641 -
带绑定带表情贴图的女孩maya模型下载
浏览:223539 | 评论:562 -
高精度女性写实maya模型Cowgirl 女人maya高模下载
浏览:218089 | 评论:496 -
高精女人3DMAX模型 带骨骼绑定 表情动画 (带贴图)
浏览:201506 | 评论:504 -
非常给力的古代皇宫maya模型 古代宫殿建筑maya模型下载
浏览:190715 | 评论:536