[Closed] Accessing gizmo in modifier
My goal : I want to create a bunch of objects with the same modifier (uvw_map) but with unique random coords for modifier’s gizmo.
So my first attempt was to use “addmodifier”. But I can’t access the sublevel (gizmo).
Here is a snippet for only 1 object :
delete objects
refobj = Teapot()
addModifier refobj (UVWMap())
getProperty refobj.uvw_map #gizmo
-- Unknown property: "gizmo" in Uvwmap:UVW Map
I decide to use “modPanel.addmodtoselection” so that I can access modifier’s gizmo. But now I have to select each object, panel mode have to be set to “modify” causing flashing interface for each iteration.
delete objects
for i=1 to 10 do
(
refobj = Teapot isselected:on
modPanel.addmodtoselection (UVWMap()) ui:on
getProperty refobj.uvw_map #gizmo
)
-- no error, modifier is UNIQUE, but several anoying "modify mode panel" flash
Another way, preventing flashing interface, is to create my objects, assign an instanced modifier (only one access to modify panel). But how to make unique the modifiers so that I can edit their gizmo properties ?
delete objects
select (for i=1 to 5 collect Teapot())
modPanel.addmodtoselection (UVWMap()) ui:on
for o in selection do getProperty o.uvw_map #gizmo
-- no error, modifier is INSTANCE, only one "modify mode panel" opened
-- so, how to make unique each modifier now ?
Or am I totally wrong on the method ?
Thanks for any advice.
if you want a unique modifier to every object why do you apply one instance of modifier for multiple objects?
to get access to uvw gizmo you don’t need a node selected… just get it
<node>.uvw_map.gizmo
if you have more than one uvw modifier applied to the node use index:
<node>.modifiers[n].gizmo
This should work:
(
delete objects
objs = for j = 0 to 5 collect
(
p = plane pos:[j*30,0,0]
addmodifier p (uvwmap())
p
)
redrawviews()
for j in objs do j.uvw_map.gizmo.pos += [random -25 25, random -25 25, random -25 25]
)
In older Max versions you might need to replace “uvw_map” by “uvwmapping”.
“redrawviews()” is the key !
If I don’t use “redrawviews()”, max gives me an error saying that the gizmo is unknown.
When using it, everything works good.
It seems that max needs to draw objects on viewport to see the modifier’s gizmo …
Thanks for your answers.
so, this works fine for me now :
delete objects
for i=0 to 5 do
(
refobj = Teapot pos:[i*30,0,0]
addModifier refobj (UVWMap())
redrawviews()
refobj.uvw_map.gizmo.pos += [random -25 25, random -25 25, random -25 25]
)