Move by custom space (pivot orientation)

Move by custom space (pivot orientation)

ondrej_malota
Participant Participant
683 Views
2 Replies
Message 1 of 3

Move by custom space (pivot orientation)

ondrej_malota
Participant
Participant

I am working on a simple script that creates a widget with XYZ inputs the same way as there is “Input line menu of operation” with relative transform, but it works only in World/Object/Component space orientation.
I want the XYZ relative transform was according to Custom space orientation of pivot. Example:
Select a vertex > press D > change orientation as I need > run a script that moves the vertex by 5 units along the custom X pivot orientation, not the World/Local/Object/Component X space.

0 Likes
Accepted solutions (1)
684 Views
2 Replies
Replies (2)
Message 2 of 3

brentmc
Autodesk
Autodesk
Accepted solution

Hi,

You can learn a lot of stuff from the scripts included with Maya. For example bakeCustomToolPivot.mel shows how you can detect and extract the custom axis orientation values from the tool. (which could be used to work out the axis directions etc.)

However, in this case you can just use the Move Tool itself to do the transformation for you.
Note: This is how the input fields for the Move Tool work in the Modeling Toolkit panel.

// Get existing translation values for the current axis mode
float $v[] = `manipMoveContext -q -translate Move`;

// Translate one additional unit along tool's Y axis
$v[1] += 1.0;

// Apply new values
manipMoveContext -e -translate $v[0] $v[1] $v[2] Move;

 

Brent McPherson
Principle Software Developer
0 Likes
Message 3 of 3

ondrej_malota
Participant
Participant

This is exactly what I’ve been looking for.

Thank you!

0 Likes