Sunday, May 24, 2009

NRiHook

I haven't added an entry for a while so this is just a copy&paste from my hidden blog which tells you how to use Shake's NRiHook. This entry is just for telling you that I'm not dead ;)


class TamHook : public NRiHook
{
public:
TamHook(NRiNode *hNode, const NRiName &hName):NRiHook(hNode, hName){}
virtual void notify (Event e, void *n);
};

void TamHook::notify(Event e, void *n)
{
NRiSys::error("TamHook::notify called.\n");
}

TamHook* t;
NRiNode* node = NRiNode::findNode("NRiScript1.foo");
t = new TamHook(node, "tamtam");


You can see what has happened to "foo" by looking at the 'Event' object passed as an argument. Take care of memory management (Make sure you delete a hook which is not used any more) when you use it.

I tried to show an working example from one of my plugins but it was way way too complicated to copy it here. Please let me know if you happen to be interested.

No comments: