Mar. 30, 2016 ver. 0.1
This is useful when importing or referencing a lot of content into a single file, like what I teach in Chapter 9 of Intrduction to 3D Modeling in Maya, 2nd Edition.
This will change the subdivision surface attributes for all selected objects. The Attribute Editor doesn’t allow attribute changes for all objects selected, and the Spreadsheet Editor doesn’t list the Smooth Mesh and OpenSubdiv attributes. The solution is a tool that can simply walk though each item in the selection.
I’ll refine this more, and add a UI in due time.
Edit: The UI is added.

Stoehr’s Subd Manager
/******************************************
version 0.1
03/30/2016
Matthew L. Stoehr
formandspace.com
Stoehr's Subd Manager
Objective:
To change Smooth Mesh settings for all
selected objects.
******************************************/
global proc mls_manageSubDLevelUI()
{
int $dev = false;
if ($dev && `window -exists "mls_subDManagerWindow"`)
{
deleteUI -window "mls_subDManagerWindow";
}
if (!`window -exists "mls_subDManagerWindow"`)
{
window -title "Stoehr's Subd Manager"
-widthHeight 100 100
-resizeToFitChildren true
"mls_subDManagerWindow";
columnLayout -adjustableColumn true
-visible true
"mls_subDWindow";
separator -style "in";
//optimize realtime
button -label "Optimize Subd for Real-time"
-parent "mls_subDWindow"
-command ("intSliderGrp -e -value 1 \"mls_realTimeSlider\";"
+"checkBox -e -value true \"mls_previewCheckBox\";"
+"intSliderGrp -e -enable false \"mls_renderTimeSlider\";"
+"checkBox -e -value true \"mls_SubDsOn_checkBox\";")
-ebg on
"mls_optReal_btn";
//optimize rendertime
button -label "Optimize Subd for Render-time"
-parent "mls_subDWindow"
-command ("intSliderGrp -e -value 0 \"mls_realTimeSlider\";"
+"checkBox -e -value false \"mls_previewCheckBox\";"
+"intSliderGrp -e -enable true \"mls_renderTimeSlider\";"
+"intSliderGrp -e -value 3 \"mls_renderTimeSlider\";"
+"checkBox -e -value true \"mls_SubDsOn_checkBox\";")
-ebg on
"mls_optRender_btn";
separator -style "in";
checkBox -label "Smooth Mesh (Subd) Preview On"
-value true
-width 50
-parent "mls_subDWindow"
//-ebg on
"mls_SubDsOn_checkBox";
separator -style "in";
//real-time
text -label "Real-time Divisions";
intSliderGrp //-label "RealTime Div"
-field true
-value 2
-minValue 0
-maxValue 3
-parent "mls_subDWindow"
"mls_realTimeSlider";
//preview as render time
checkBox -label "Use Real-time Divisions for Rendering"
-value true
-parent "mls_subDWindow"
-onCommand ("intSliderGrp -e -enable false \"mls_renderTimeSlider\"")
-offCommand ("intSliderGrp -e -enable true \"mls_renderTimeSlider\"")
"mls_previewCheckBox";
separator -style "in";
text -label "Render-time Divisions";
intSliderGrp //-label "Render Div"
-field true
-value 2
-minValue 0
-maxValue 7
-enable false
-parent "mls_subDWindow"
"mls_renderTimeSlider";
button -label "Apply"
-parent "mls_subDWindow"
-width 50
-height 30
-backgroundColor 0.1 0.5 0.0
-command ("mls_changeSubDLevel();mls_toggleSubd");
separator -style "in";
text -label "For more good stuff go to formandspace.com"
-hyperlink true
-bgc 0.0 .7 0.55;
text -label "Mar. 30, 2016 - ver. 0.1 Check for new version."
-hyperlink true
-bgc 0.0 .7 0.55;
}
showWindow "mls_subDManagerWindow";
}
global proc mls_toggleSubd()
{
string $object[] = `ls -sl -tr`;
int $amount = size($object);
int $v = `checkBox -q -value "mls_SubDsOn_checkBox"`;
for($i=0; $i<$amount; $i++)
{
int $display[] = `displaySmoothness -q -polygonObject $object[$i]`;
print $display;
if($v)
{
displaySmoothness -polygonObject 3 $object[$i];
}
if(!$v)
{
displaySmoothness -polygonObject 1 $object[$i];
}
}
}
global proc mls_changeSubDLevel()
{
int $p = `checkBox -q -value "mls_previewCheckBox"`;
int $q = `intSliderGrp -q -value "mls_renderTimeSlider"`;
int $r = `intSliderGrp -q -value "mls_realTimeSlider"`;
string $object[] = `ls -sl -tr`;
int $amount = size($object);
for($i=0; $i<$amount; $i++)
{
//set divisions
setAttr ($object[$i] + ".smoothLevel") $r;
setAttr ($object[$i] + ".renderSmoothLevel") $q;
//is render same as preview
setAttr ($object[$i] + ".useSmoothPreviewForRender") $p;
}
}
4 responses to “Subdivision Surface Management”
Leave a Reply
You must be logged in to post a comment.
Updated. This tool now has a UI with some recommended settings for Subdivision Surfaces for real-time and render-time. I’ll add a few more things to it soon.
Updated. Refined user experience and provided links.
Added download link with the MELscript file.
Great Tool, Would Use Again