Hi,
First, super contexts are special in Maya and you would need to query the super context to get the actual tool name like this.
string $curContext = `currentCtx`;
string $curTool = (`superCtx -exists $curContext` ? `superCtx -q $curContext` : $curContext);
Second, the flag you want to query on the manipRotateContext is -currentActiveHandle / -cah
However, most Mel code in Maya just checks explicitly for the scale/rotate/move contexts using something like this since there is only a single context and they are called Move/Rotate/Scale.
int $activeHandle = -1;
string $curContext = `currentCtx`;
string $curTool = (`superCtx -exists $curContext` ? `superCtx -q $curContext` : $curContext);
if ($curTool == "Move") {
$activeHandle = `manipMoveContext -q -currentActiveHandle $curTool`;
} else if ($curTool == "Rotate") {
$activeHandle = `manipRotateContext -q -currentActiveHandle $curTool`;
} else if ($curTool == "Scale") {
$activeHandle = `manipScaleContext -q -currentActiveHandle $curTool`;
}
if ($activeHandle == 0) {
print "X handle is active";
} else if ($activeHandle == 1) {
print "Y handle is active";
} else if ($activeHandle == 2) {
print "Z handle is active";
} else if ($activeHandle == -1) {
print "No active transform tool";
} else {
print "Some other handle is active";
}
Brent McPherson
Principle Engineer