maya vray渲染细分工具

Maya2 字

![](https://aduvfx-1252404142.cos.ap-beijing.myqcloud.com/ueditor/php/upload/image/20160817/1471436574561117.png)

MEL:
```
global proc VRaySubdivisionTool(){
if(`window -exists VRaySubdivisionToolUI`){
deleteUI VRaySubdivisionToolUI;
}
window -wh 100 75 -rtf 1 -mxb 0 -title "VraySubTool" VRaySubdivisionToolUI;
columnLayout mainCol;
formLayout -w 150 -h 75 mainForm;
text -l "VRay Subdivision Tool v1.0" mainText;
separator -w 140 topSep;
text -label "Max Subdivisions" intText;
intField -w 55 -value 2 -min 1 -max 50 subCall;

button -label "apply" -w 150 -command vraySmooth procButton;
formLayout -e
-ap mainText "left" 8 0
-ap mainText "top" 5 0

-ap topSep "left" 5 0
-ac topSep "top" 5 mainText

-ap intText "left" 5 0
-ac intText "top" 5 topSep
-ac subCall "left" 5 intText
-ac subCall "top" 2 topSep
-ac procButton "top" 5 subCall

mainForm;
showWindow VRaySubdivisionToolUI;
}
////////////////////////////////////
global proc vraySmooth(){
//Put selected objects transform and shape nodes into arrays
string $a[] = `ls-sl`;
string $y[] = `listRelatives -typ "shape"`;
//define an integer marker to represent array index item
int $x=0;
//query user input from UI
int $subCallValue = `intField -q -v subCall`;
//add subdivision and subdivision quality attributes to each selected obbject
for($each in $a){
vray addAttributesFromGroup (("|"+$a[$x])+("|"+ $y[$x])) vray_subdivision 1;
vrayAddAttr (("|"+$a[$x])+("|"+ $y[$x])) vraySubdivEnable;vrayAddAttr (("|"+$a[$x])+("|"+ $y[$x])) vraySubdivUVsAtBorders;vrayAddAttr (("|"+$a[$x])+("|"+ $y[$x])) vraySubdivUVs;vrayAddAttr (("|"+$a[$x])+("|"+ $y[$x])) vrayStaticSubdiv;
setUITemplate -pst attributeEditorTemplate;
vray addAttributesFromGroup (("|"+$a[$x])+("|"+ $y[$x])) vray_subquality 1;
vrayAddAttr (("|"+$a[$x])+("|"+ $y[$x])) vrayOverrideGlobalSubQual;vrayAddAttr (("|"+$a[$x])+("|"+ $y[$x])) vrayViewDep;vrayAddAttr (("|"+$a[$x])+("|"+ $y[$x])) vrayEdgeLength;vrayAddAttr (("|"+$a[$x])+("|"+ $y[$x])) vrayMaxSubdivs;
setUITemplate -pst attributeEditorTemplate;
// set max subdivisions.
setAttr (($y[$x])+".vrayMaxSubdivs") $subCallValue;
// bump up index marker
$x++;
}}
```

运行:
```
VRaySubdivisionTool;
```

admin
博学之,审问之,慎思之,明辨之,笃行之。
OωO
开启隐私评论,您的评论仅作者和评论双方可见
评论 ( 2 )
  1. rivay1127

    coolOωO

    2020年10月25日回复
  2. angelina

    2016年08月20日回复