[Closed] keep UVW-Map Gizmo-Position on Origin
Hi,
as I found no way to have an UVW-Maps Gizmo centered to the origin and have several objects share this Gizmo and have it locked there I tried to write a little scipt that adds a UVW-Map to all my selected objects after I finished my work and moves every single Gizmo to 0,0,0.
(Problem is that when you create a group of all the objects and apply one UVW-Map to them, when you move one object afterwards its Gizmo doesnt stay in origin.)
So, after all I came to this script that works on one selected object, but when I select more objects, it says: Unknown property: “gizmo in Uvwmap.test”
Why is that?
for i in selection do
(
addModifier i (Uvwmap name:"test" maptype:4 length:1 height:1 width:1)
objTM = i.objecttransform
modTM = getModContextTM i i.test
i.test.Gizmo = modTM * (inverse objTM)
)
Isn’t there anyone who can tell me why this script works when only one object is selected but doesn’t work when multiple objects are selected?
I thought “for i in selection” should take care of multiple selections!
OK,
it works when I make one loop for the addModifier-Command and another for the transform of the gizmo.
for i in selection do
(
addModifier i (Uvwmap maptype:4 name:"Mapchannel99" length:(39.37) width:(39.37) height:(39.37) mapChannel:99)
)
for i in selection do
(
objTM = i.objecttransform
modTM = getModContextTM i i.Mapchannel99
i.Mapchannel99.Gizmo = modTM * (inverse objTM)
)
But this still only works when I open my script and press Ctrl-e.
It still doesn’t work when I choose MAXScript->RunScript. Why is that?
not entirely sure about this but it may be mapping
try
for i = 1 to selection.count do
(
something to selection[i]
)
Thanks Alex, that works when I have my script open and press Ctrl-e too, but still doesn’t work when choosing “Run Script”.