Run a script to all objects

Hi, Continuing with my simple questions about maxscript, I did myself (not easy for me) this very simple script, to apply an Edit Poly after the Base Object and execute the Quadrify command.

It works great for me, but I want to do it to the entire scene, or all selected objects. But, how to do it?

My script:

(
max modify mode
modPanel.setCurrentObject $.baseObject
macros.run "Modifiers" "EditPolyMod"
macros.run "PolyTools" "Quadrify"
)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
caebrasil's picture

renaming modifier

Ok, I want to do just one more thing:
How can I rename the new Edit Poly created? I want to rename "Edit Poly" to "Edit Poly Quad"...

Anubis's picture

use .name prop

max modify mode
objs = getCurrentSelection()
for o in objs do
(
	modPanel.setCurrentObject o.baseObject
	macros.run "Modifiers" "EditPolyMod"
	macros.run "PolyTools" "Quadrify"
	o.modifiers[o.modifiers.count].name = "Edit Poly Quad"
)

my recent MAXScripts RSS (archive here)

caebrasil's picture

perfect!

again, thank you Anubis!

caebrasil's picture

Both works smoothly, THANK

Both works smoothly, THANK YOU!

Anubis's picture

loop through selected...

max modify mode
objs = getCurrentSelection()
for o in objs do
(
	modPanel.setCurrentObject o.baseObject
	macros.run "Modifiers" "EditPolyMod"
	macros.run "PolyTools" "Quadrify"
)

woops, forgot to refresh the page before post :)

my recent MAXScripts RSS (archive here)

br0t's picture

--for selected

--for selected objects:
theSel = selection as Array
for s in theSel do
(
   max modify mode
   modPanel.setCurrentObject s.baseObject
   macros.run "Modifiers" "EditPolyMod"
   macros.run "PolyTools" "Quadrify"
)
--for all objects in the scene:
for o in objects do
(
   ...
)

Cheers

Never get low & slow & out of ideas

caebrasil's picture

br0t, your simple explanation

br0t, your simple explanation just open my mind! I can apply this for a lot of tasks I do repeatedly!
Definitively, I need to study maxscript.
Again, thank you!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.