Notifications
Clear all

[Closed] How to Clear/Remove Transform Gizmo Axis Constraints

Hey guys,
long time lurker here. You have been such a valuable source to me, that I have been able to find almost any answer here regarding maxscript and the sdk, thank you soooo much for taking the time and sharing your knowledge!

Now there’s this one thing where I’m literarily banging my head against the wall. I’ve been crawling through google and the sdk documentation for several hours now without much success.

I’m trying to replicate a behavior from Maya for the Transform Gizmos (Move/Rotate/Scale).

In 3ds Max we can click an axis on the gizmo and it becomes the constrained axis like shown with the X-Axis in the image below.

If we want to move in screen-space again we just click the center box handle, like shown below.

Maya let’s you do this by simply pressing the same tool mode shortcut a second time. ( no need to click with the mouse)
For example: If the Move-Tool is active and your axis is locked to X, just press the Move-Tool button again and it will clear/remove any axis constraints.

I would like to solve this via maxscript / C#.
What I’ve tried so far is using the “AxisConstraints” property from the core interface.
It allows me to set the axis constraints using the following mappings which I got from the maxapi.h:

If I get the value from this property when no constraint is active I get the minimum value of an integer value, which is -2147483648
But if I try to set this value on the property myself, nothing happens.

I’ve found no other way so far and would very much appreciate if someone with more knowledge than me could investigate into this

Thank you for taking the time to read this,
Dennis

4 Replies

try this


(dotNetClass "Autodesk.Max.GlobalInterface").Instance.coreinterface7.PushAxisConstraints -2147483646

Great, that works!
At least for translate and rotate mode. Scale doesn’t seem to play nice with any of the Push/Set AxisConstraint Methods.

The only thing I don’t like about his, is the fact that we clutter the AxisConstraint stack. Hmmm

I guess you first need to change to non-uniform scale mode and only then set the constraint mode

toolMode.CommandMode = #nuscale
(dotNetClass "Autodesk.Max.GlobalInterface").Instance.coreinterface7.axisconstraints = 0 -- 0..5 range

Hey Serejah,

toolmode.nonUniformScale()

using this instead it seems to work more consisten. Still no chance to select the center of the gizmo.

So far my own investigations have shown that the scale command behaves totally different from the other commands.
It doesn’t seem to properly store the center selection, even if you click on it. As soon as the mouse hovers over any of the adjacent axis, the selection get’s lost and defaults to some other axis, when the mouse moves away.

I think it’s all pretty deeply nested in the selection processors which max uses for gizmo selection and is kind of a dead end.
They are also not part of the SDK, so no chance to have a look at the code. I’ll stop my investigations at this point.

Thank you for your help so far!