ScriptSpot

Forum topic · General Scripting

Rotate Unwrap UVW modifier gizmo 90*

By wiesner · 2012-07-16

Description

Does anyone know if there is a simpler way to target the gizmo in the Unwrap UVW modifier (not the UVW Mapping modifier) and rotate it 90 degrees though maxscript?
I am currently using the unwrap5.setGizmoTM matrix but this isn't accurate enough for what I am trying to create.

Any help is appreciated.

Comments (5)

Random rotate

JokerMartini · 2012-07-18

randomly rotate uvw map mod

rollout t "Test"
(
local mymod = (UVWMap())

button b "Create UVWMap"
button b2 "Random"

on b pressed do
(
mapMod = UVWMap maptype:4
addmod = for i in selection do addModifier i (mapMod) ui:on
)

on b2 pressed do
(
for i = 1 to selection.count do
(
obj = selection[i]
giz =obj.modifiers[1].gizmo
val = (random -360 360)
giz.rotation = (angleaxis val [1,1,1]) as quat
)
)

)
createdialog t

barigazy · 2012-07-18

Hi John,
Now try with UnvrapUVW modifier :)

example

barigazy · 2012-07-16

I came up with this
I use Box object with UnwrapUVW Mod with BoxMap projection

unwrapTM = $Box001.modifiers[#Unwrap_UVW].getGizmoTM()
tp = unwrapTM.translationpart
--rotate about Z-axis
rot = rotateZ unwrapTM 90
rot.row4 = tp
$Box001.modifiers[#Unwrap_UVW].setGizmoTM rot

wiesner · 2012-07-16

Works great. Thank you for your help.

:)

barigazy · 2012-07-16

My pleasure
Cheers!