tredeger
09-27-2006, 11:06 AM
I'm rather new to coding plug-ins through the C++ API. I'm writing a custom node and all the examples I've seen pretty much encapsulate all the calculation and performance functionality completely in the 'compute' method of the node.
I've also read in David Gould's book some confusing passages about not being able to write custom function sets.
I would like to make the code more modular and write some functions that will be called by the compute function during it's operation. This is especially important because I need to call one function recursively, which is AFAIK impossible to do with inline code. My confusion is somewhat general and may stem from some overall misconceptions on my part about how Maya exposes object data for access and manipulation. It all seems rather convoluted to me.
My question is this: in general, how should I approach writing supporting functions to be called by 'compute'? And how should I handle data access? Should the function by default operate on the same object as compute or do I need to pass it some kind of reference? Is that allowed? Can I just call the same methods that I would be calling in 'compute' or do i need to tell it about those methods somehow? Should I get all the data in compute and pass it to the sub-function or get the data handles in the sub-function directly? This last part confuses me with respect to when I am dealing with real references to the data or just copies of the data. As I understand it, I never deal with the data directly.
Yeah, these questions are DEFINITELY showing off my ignorance vis a vis the object model, so thanks mightily for any wisdom you can shed on these issues. I've only just started tackling the API and it's rather daunting. My terminology is probably all wrong too.
cheers
I've also read in David Gould's book some confusing passages about not being able to write custom function sets.
I would like to make the code more modular and write some functions that will be called by the compute function during it's operation. This is especially important because I need to call one function recursively, which is AFAIK impossible to do with inline code. My confusion is somewhat general and may stem from some overall misconceptions on my part about how Maya exposes object data for access and manipulation. It all seems rather convoluted to me.
My question is this: in general, how should I approach writing supporting functions to be called by 'compute'? And how should I handle data access? Should the function by default operate on the same object as compute or do I need to pass it some kind of reference? Is that allowed? Can I just call the same methods that I would be calling in 'compute' or do i need to tell it about those methods somehow? Should I get all the data in compute and pass it to the sub-function or get the data handles in the sub-function directly? This last part confuses me with respect to when I am dealing with real references to the data or just copies of the data. As I understand it, I never deal with the data directly.
Yeah, these questions are DEFINITELY showing off my ignorance vis a vis the object model, so thanks mightily for any wisdom you can shed on these issues. I've only just started tackling the API and it's rather daunting. My terminology is probably all wrong too.
cheers
