pymxs modifiers gizmo set position doesn't work like in MaxScript

pymxs modifiers gizmo set position doesn't work like in MaxScript

stevkalinowski
Contributor Contributor
1,743 Views
4 Replies
Message 1 of 5

pymxs modifiers gizmo set position doesn't work like in MaxScript

stevkalinowski
Contributor
Contributor

I'm trying to set a modifier gizmo's position using pymxs, but it doesn't seem to work like it does in Max Script.  When I execute this code I don't get an error, but nothing happens.

 

 

# Select an Editable Poly object, then execute this

import pymxs

pymxsRt = pymxs.runtime

s = pymxsRt.selection[0]

newMod = pymxsRt.UVWMap()
newMod.axis = 1
newMod.channel = 0
newMod.mapChannel = 2
pymxsRt.addModifier(s, newMod)
# does not work
s.modifiers[0].gizmo.position = pymxsRt.Point3(0,0,0)
# This doesn't work either
# s.modifiers[0].gizmo.position = [0,0,0]

 

 

Am I missing something?

0 Likes
Accepted solutions (1)
1,744 Views
4 Replies
Replies (4)
Message 2 of 5

drew_avis
Autodesk
Autodesk

Hi, thanks for asking about this - I've confirmed that it's a bug, and have logged a defect.  I will do a bit of research and see if I can find a usable work-around.

 

Drew



Drew Avis
Content Experience Designer
0 Likes
Message 3 of 5

stevkalinowski
Contributor
Contributor

Got it, thanks.

0 Likes
Message 4 of 5

drew_avis
Autodesk
Autodesk
Accepted solution

A developer looked into this, and it looks like a timing issue - the gizmo does not yet exist until the modifier is added to the object, AND the scene is re-drawn.  This happens after the python script completes.  One solution is to force a redraw before trying to modify the gizmo.  Here's a sample script:

from pymxs import runtime as mxs

b = mxs.box()
mod = mxs.UVWMap()
mod.axis = 1
mod.channel = 0
mod.mapChannel = 2
mxs.addModifier(b, mod)

mxs.completeRedraw() # redrawViews() also works

gizmo = b.modifiers[0].gizmo

print mxs.getProperty(gizmo, 'position')
mxs.setProperty(gizmo, 'position', mxs.Point3(0,0,0))
print mxs.getProperty(gizmo, 'position')

We will be adding this sample and a description of the issue to the docs.  Thanks again for pointing this out.

 

Drew



Drew Avis
Content Experience Designer
0 Likes
Message 5 of 5

stevkalinowski
Contributor
Contributor

Tested on my end and it works.  Thanks!

0 Likes