Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / SDK / How does a custom locator update and redraw itself? What is the trigger?
  RSS 2.0 ATOM  

How does a custom locator update and redraw itself? What is the trigger?
Rate this thread
 
39486
 
Permlink of this thread  
avatar
  • tim verba
  • Posted: 05 February 2010 08:28 AM
  • Total Posts: 1
  • Joined: 18 August 2008 02:37 AM

Hi I’m writing a custom locator. I’ve written nodes before but this is my first locator. I would like it to draw icons based on its velocity. I am having trouble visualizing the compute order for a locator. A typical node will check its dirty propagation and then update. What does a locator do? How does it handle incoming information and how does it pass information out?

I have accesss to the locator’s matrices very easily. How do I retain one of those matrices from one frame to another or from one refresh to another? And when does a locator redraw itself?



Replies: 0
avatar
  • chaneyX
  • Posted: 15 February 2010 08:43 AM

The MPxLocator draw is what is typically called. 

You can also implement all of the standard compute , attributeAffects , etc. , that you would for a normal dependency node . But in order to update your data on draw , you need to request it -> which will force the compute function to be called -> which will handle all the dirty clean propogation .

Heres the rough idea :

void myLocator::draw( M3dView& view, const MDagPath& DGpath,M3dView::DisplayStyle style,M3dView::DisplayStatus status )
{

MFnDagNode fn( thisMObject() )
MPlug attrPlug = fn.findPlug( radius ) ;
attrPlug.getValue( rad ) ; // I think this forces compute to be called

... etc.

}

Check out .
http://mayaprogramming.blogspot.com/
This code did work 100% for me , but it got me 3/4 there and it is pretty cool when it works .

This guy is great . He has plenty of cutom locators . You may learn some tricks .
http://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/



Replies: 0