PDA

View Full Version : Lonely Compute Function


RonGriswold
11-07-2005, 05:59 PM
Hi Folks,

This is probably a simple and common one, but it's got be baffled. I'm writing a simple utility node that lerps between two values (vectors or scalars) given a param attr. I've set everyting up as I've done in other nodes that have worked fine, but in this case my compute function is never getting called.

I have the node in a graph such that it's output is going into the translate of a locator, yet I notice several peculiar things (aside from the fact that it's just not working). First, when one of the input objects is selected, there is no color que that the locator is being affected by the input object. Second, in the DG, when I RMB on my node I do not get my output listed.

I have double checked that the attributes are being added (and they are), and I have set up every possible attributeAffects combination possible.

Does anyone have any ideas?

Thanks

Ron Griswold
R!OT Santa Monica
rgriswold@rioting.com

jdj
11-08-2005, 12:34 PM
Hi,

Two suggestions:

1. Put a debug breakpoint in your initialization code OR include some print statement there for debug purposes. This will tell you if your initializing routine gets called at all. If this works, do the same for your compute function. I would believe that they are not executed for some reason.

2. If they are not executed, check that your overloaded function declarations have the exact same declarations as the base functions - do not forget the const keyword for instance.

Good luck
/ Daniel

Robert Bateman
11-08-2005, 01:42 PM
to get the pink "i'm affected colour", connect a message attribute between the two nodes. To get the RMB working in the Hypergraph, you need to provide an MPxDragAndDropBehaviour class with your plugin.

To get the node to update correctly, ensure that you output attr is NOT writable, NOT storable, NOT keyable and IS readable. Then just do

attributeAffects(input,output);

The compute will not be called unless the output attribute is connected to something....

RonGriswold
11-08-2005, 09:03 PM
Thanks folks.

jdj - Everything about the node worked (i.e. initialization was fine) but the compute wasn't being called. The function signature did match. I did find the solution though (see below).

Robert - Thanks for the tip on the message attribute.

The solution to my problem was that I was in fact setting keyable to true on the outputs (copy and paste - bad! ;) )

Thanks guys!

CGTalk Moderation
11-08-2005, 09:03 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.