Hi all, So I'm writing up this script that I'll be officially releasing soon but I can't seem to get it to run with multiple objects selected. I get the error "// Warning: Line 3.49 : Redeclaration of variable "$shape" shadows previous declaration at line 2. Previous value will be overwritten by explicit initializer."
was curious if any of you mel wizzards could help me out.
//High Poly Preview with no holding edges
string $sel[]=`ls -sl`;
string $shape[]=`listRelatives -type mesh $sel`;
int $currentCrease = `getAttr ($shape[0]+".smoothLevel")`;
// TURN ON
if ($currentCrease == 0 || $currentCrease == 2){
polySelectConstraint -m 3 -t 0x8000 -sm 1; // to get hard edges
polyCrease -value 3.0;
displaySmoothness -divisionsU 3 -divisionsV 3 -pointsWire 16 -pointsShaded 4 -polygonObject 3;
setAttr ($shape[0]+".smoothLevel") 4;
polySelectConstraint -sm 0; // turn off edge smoothness constraint
}
//TURN OFF
//Toggle off high poly preview
else{
displaySmoothness -divisionsU 0 -divisionsV 0 -pointsWire 4 -pointsShaded 1 -polygonObject 1;
PolyRemoveAllCrease;
setAttr ($shape[0]+".smoothLevel") 2;
}
Replies
**EDIT: Fixed an error with iteration and selection.
Updated Code Above^^
And, no problem ArtQuest. Happy to help
Still have a lot to learn
EDIT: actually it's not even writing the file the first time. it simply isn't there. I've checked the properties and it says it's read + write for my user.
Maybe I'm going about this wrong. perhaps a cleaner way would be to duplicate the model instead of exporting it and hide it in the scene?
The goal is to be able to dynamically swap back and forth between a light version of the mesh and a more detailed one. The only difference being that one mesh has holding edges applied automatically and one is the simple low poly version. I also want to be able to do this after saving and closing maya with hours/days inbetween sessions.
Current code:
Or you can use the root directory of your current workspace stored in a variable and save the file there:
I would love any suggestions you have, allow me to redirect you to the full (beta) release thread of the tool. Thanks to you I have all the basic functionality working and ready to go.
http://polycount.com/discussion/168879/new-tool-for-maya-autohighpoly-beta#latest
Maybe try this? (I've used something like this when undo stacks would break in my scripts).