Subdivide Selected

Posted: August 26, 2009 at 11:48 pm

Edit: You can totally manage Subdiv Selected through Shared Geometric Attributes. I fail at life.

First off - yes I am done with the Disney project. It went very very well and Kristi strongly urged me to apply for their internship program next summer (since I obviously won’t be done with my thesis by then. Pah!). She must have liked me and/or possibly my work as well. I like when things go nicely. I wouldn’t mind working with her and Adolph on a project sometime (maybe in a year? Aww yeah!).

In relation to that - this means the project is done! However the lawyers are deliberating on whether we can post it on the internet or not. Thus, I cannot share it until we get the word sent down from upon the mountaintop.

Now, if you’ve ever used Renderman for Maya (I doubt it) you know that adding the subdivision attribute to your objects is….well….pretty crappy. So I wrote a neat little script during the summer that adds it to everything you have selected in your scene. I figure I might as well post it here just in case I lose the script someday sometime somewhere. Plus you all (meaning Mom) can use pieces of it if you need.


Maya 2008 & Renderman for Maya 2.0.1

This script adds the Renderman SubDivision attribute for all polygonal meshes currently selected.
It will not add the attribute to any other object type and will automatically add the
attribute to the correct shape in the polymesh hierarchy


$selectedmeshes = `ls -sl`; /* list everything selected */
int $size = size($selectedmeshes); /* find size of selected array */
string $attrnm=`rmanGetAttrName subdivScheme`; /* get the subdiv attribute name so you can add it later.
do it this way because the name is long/nasty/changes.
Hardcoding the name may leave you incompatable later on. */

for($i=0; $i<$size; $i++) /* loop until end of array */

string $shps[] = `listRelatives -shapes $selectedmeshes[$i]`; /* find the shape of what’s selected */

if (`objectType -isType “mesh” $shps[0]`){ /* check to see if its a polymesh. skip otherwise. */
rmanAddAttr $shps[0] $attrnm “”; /* add the subdiv attribute to the mesh */
renderManUpdateAE; /* Update and move on */
renderManShaderUpdateAE “”;}

Yes that’s a lot of comments. That’s how I write code boys and girls. Don’t complain that you actually know how this thing works at first glance.

2 Responses to “Subdivide Selected”

  1. eli Says:

    syntax is incorrect…

  2. eli Says:

    never mind it was weird when I compared it to mine… good job on the comments though

Leave a Reply