ARTillery
03-30-2007, 10:17 AM
Hi all,
I'm trying to do 2 scripts that perform a similar function, first one would select only bones in the scene and turn any editpoly modifiers on them on and off, the seconed would select any object who had a turbosmooth modifier and turn it on and off.
I'm new to max script so I need a much help here, however I'll start by a simple question and I'll see how to go, this is also an exercise to train me on the use of Max script.
the questions are:
1- Why does the line $.modifiers[1].turbosmooth == turbosmooth return false although the object has a turbosmooth modifier on?
Obviously this won’t work in the final version because the turbo smooth modifier doesn’t have to be the first in the stack but I just want to know why this doesn’t work.
The line $.modifiers[1] returns Turbosmooth:Turbosmooth so how come it returns false?
It didn’t select any objects when I wrote
select (for o in Geometry where try(o.modifiers[1] == turbosmooth)catch(false) collect o)
so I had to check it out.
2- I managed to finally make the right script for this, or so I believe it goes like this
macroScript polyOn category:"My Scripts"
(
for o in objects where try (o.turbosmooth.enabled == false) catch (false) do (o.turbosmooth.enabled = true)
)
macroScript polyOff category:"My Scripts"
(
for o in objects where try (o.turbosmooth.enabled == false) catch (false) do (o.turbosmooth.enabled = true)
)
my question is, is there a better way to do this?
3- is there an object collection for bones or do I have to check if the base object is bone all the time?
thanks in advance.
I'm trying to do 2 scripts that perform a similar function, first one would select only bones in the scene and turn any editpoly modifiers on them on and off, the seconed would select any object who had a turbosmooth modifier and turn it on and off.
I'm new to max script so I need a much help here, however I'll start by a simple question and I'll see how to go, this is also an exercise to train me on the use of Max script.
the questions are:
1- Why does the line $.modifiers[1].turbosmooth == turbosmooth return false although the object has a turbosmooth modifier on?
Obviously this won’t work in the final version because the turbo smooth modifier doesn’t have to be the first in the stack but I just want to know why this doesn’t work.
The line $.modifiers[1] returns Turbosmooth:Turbosmooth so how come it returns false?
It didn’t select any objects when I wrote
select (for o in Geometry where try(o.modifiers[1] == turbosmooth)catch(false) collect o)
so I had to check it out.
2- I managed to finally make the right script for this, or so I believe it goes like this
macroScript polyOn category:"My Scripts"
(
for o in objects where try (o.turbosmooth.enabled == false) catch (false) do (o.turbosmooth.enabled = true)
)
macroScript polyOff category:"My Scripts"
(
for o in objects where try (o.turbosmooth.enabled == false) catch (false) do (o.turbosmooth.enabled = true)
)
my question is, is there a better way to do this?
3- is there an object collection for bones or do I have to check if the base object is bone all the time?
thanks in advance.
