Accessing and Transforming the UVW Map Gizmo in Maxscript


#1

Hello all. I am trying to do something very simple.

A little background: My script simply generates and object, loads a bitmap, applies it to a material, then applies it to the aforementioned object. I then create a uvw map, then add it to that object with the material.

What I wish to do is access the gizmo of the uvw map and rotate it around the center of the object.

I have tried multiple ways.
(1) The documentation mentions that to be able to do this, you specify an object using ‘subAnim’. The example in the documentation is this:

Uvwmap.gizmo SubAnim

I attempted to do this with a uvwmap called ‘map0’. The code looks something like this:

map0 = Uvwmap()
myshape = makeCubicBody() --this simply returns a newly created object
myshape.material = shapeMaterial
addmodifier myshape map0
mygiz = map0.gizmo subAnim
mygiz.rotation Quat (quat -1 0 -1 0)

This returns the Error: “Call needs function or class, got: SubAnim:Gizmo”, and does not manipulate the map at all.
A few quick notes: the default planar display method is good for my purposes, and I am having no trouble concerning the immediately accessible values of the uvw map modifier. Also, the gizmo cannot be accessed until you have applied the uvw map to a node.

Another method I tried, and with more success:
(2)
Code:

map0 = Uvwmap()
myshape = makeCubicBody() --this simply returns a newly created object
myshape.material = shapeMaterial
addmodifier myshape map0
myshape.modifiers[#UVW_Map].gizmo.rotation = EulerAngles 0 -90 0 as quat

This method is actually modifying the gizmo; however, it is rotating with it’s pivot point in a location other than the center, and that gives me some wonky, undesired results.

Accordingly, there are two ways to approach this problem, however, I cannot come to my desired result.
Thank you for any help in advance!