PDA

View Full Version : draggerContext, Maya 6.0, MaxOS X, bug?


sparaig
12-03-2006, 11:42 AM
so, I copied and paste the simple script for draggerContext and it doesn't work as advertised.

the -drawString flag doesn't draw a string, and if I put in a call to spaceLocator inside the sampleContextPress callback nothing happens either. Here is the code, straight out of the MEL reference help. I'm trying to create an array of mouse positions based on where the mouse is pressed, with feedback for where the mouse is pressed. If there is another way to do this short of trying to write a C++ plugin, please let me know. Thanks.:


draggerContext
-pressCommand "sampleContextPress"
-dragCommand "sampleContextDrag"
-cursor "crossHair"
sampleContext;

global proc sampleContextPress()
{
float $pressPosition[] = `draggerContext -query -anchorPoint sampleContext`;
print ("Press: " + $pressPosition[0] + " " + $pressPosition[1] + " "
+ $pressPosition[2] + "\n");
}

global proc sampleContextDrag()
{
float $dragPosition[] = `draggerContext -query -dragPoint sampleContext`;
int $button = `draggerContext -query -button sampleContext`;
string $modifier = `draggerContext -query -modifier sampleContext`;

print ("Drag: " + $dragPosition[0] + " " + $dragPosition[1] + " "
+ $dragPosition[2]
+ " Button is " + $button + " Modifier is " + $modifier + "\n");

string $message = ($dragPosition[0] + ", " + $dragPosition[1]);
draggerContext -edit -drawString $message sampleContext;
}

setToolTo sampleContext;

sparaig
12-03-2006, 03:59 PM
stupid me. Don't now why I didn't get this to work before. The code below sets up a callback to draw a sphere on any of the othagonal view planes with no problems. Other uses seem more problematic right now...


global proc sampleContextPress()
{
draggerContext -edit -space world -pr objectViewPlane sampleContext;
float $pressPosition[] = `draggerContext -query -anchorPoint sampleContext`;
sphere -p $pressPosition[0] $pressPosition[1] $pressPosition[2] -ax 0 1 0 -ssw 0 -esw 360 -r .05 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 0;
print $pressPosition; print "\n";
};

CGTalk Moderation
12-03-2006, 03:59 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.