sparaig
12-03-2006, 10: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;
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;
