[MEL] manipRotateContext - get values?


#1

Hi,

When you are in Rotate and switch to “Axis Orientation - Component” you get those values down in fields which are different depending on face selected.
Would anyone know how to get those values (image below)?

What i have, for example, is:


RotateTool;
// get inital axis orientation
$getAxisO = `manipRotateContext -q -mode Rotate`;
// set to component
manipRotateContext -e -mode 9 Rotate;

// GET THOSE VALUES ON IMAGE  //

// set back to initial axis orientation
manipRotateContext -e -mode $getAxisO Rotate;

Thanks!


#2

The best way to find these sorts of things is to figure out which script manages that Tool Settings page. Usually all tools will have a <toolName>Values.mel and <toolName>Properties.mel script.

The <toolName>Properties script is responsible for building the UI.
The <toolName>Values script is responsible for populating the values into that UI.

In this case, you want to look at manipRotateValues.mel to figure out how it populates it. And from that code, you’ll see the orientAxis flag is the one you want to query. An example script is below:

import maya.cmds as cmds
import math

rad = cmds.manipRotateContext('Rotate',q=True,orientAxes=True)

# Convert radians to degrees
deg = [math.degrees(x) for x in rad]
print deg


#3

Ah, i see i was correct initially it’s just that i wasn’t converting radians to degrees so i thought i was getting wrong numbers.

Thank you very much for help!