Anders,

I suspect (but as a non-Foundry employee, of course I cannot *know*) that 
what's happening here is that Nuke is needing the state of your Iop at two 
different OutputContexts, possibly because it's needing your output state at 
two different frames, for some reason, at the same time - perhaps for some 
time-based downstream processing, possibly?

Perhaps the right thing to do is to create a singleton instance of your socket 
communications object - perhaps even as a system service of some kind - and 
then call it from your Iop.  That guarantees that only one instance of the comm 
system has been instantiated.

Also, do check the 'frame' property of the OutputContext of the inputs to your 
node, and if you've already obtained the data for the specified frame, there 
would be no reason to get it again.

I hope that helps some.

Also, have you perhaps thought of implementing your node as a 'Reader' rather 
than an Iop?  Iops pretty much assume inputs in the DAG, whereas Readers are 
sources of image data.

Steve

From: nuke-dev-boun...@support.thefoundry.co.uk 
[mailto:nuke-dev-boun...@support.thefoundry.co.uk] On Behalf Of Anders Langlands
Sent: Friday, March 23, 2012 3:23 AM
To: Nuke plug-in development discussion
Subject: [Nuke-dev] nuke creating many instances of my iop

I'm writing a plugin Iop that describes a no-inputs op which essentially just 
receives image data from a server (that is in turn accepting data from a 
renderer). I'm trying to understand the logic of when Nuke creates multiple 
instances of my Iop.

In normal use I see nuke call MyIop::MyIop(Node*), then MyIop::attach(), then 
MyIop::_validate(), as expected. However in certain circumstances when I am 
pushing image data to my node across a socket, Nuke starts creating many 
instances of MyIop, then calling _validate() without calling attach() (which 
makes sense since I have not created any new nodes). This is causing me issues 
because every time _validate() is called MyIop tries to make a new connection 
to the server, which is bad. I understand from the docs that I shouldn't expect 
to only ever have one instance of MyIop for each node in the graph, but none of 
the circumstances listed for when this might happen seems to apply in this case.

This seems to happen when I am pushing a lot of data to several nodes - every 
time there is a new bucket of image data passed from the server, I am calling 
flagForUpdate() and asapUpdate() from a listener thread. If I am rendering to 
say, 4 nodes, this can happen quite a lot.

Is this expected behaviour? Or is it due to something I am doing? Should I be 
checking whether a MyIop instance is actually attach()ed to a node before doing 
any processing with it?

I've been through all the docs that seem pertinent, but still I don't really 
understand why Nuke might be creating these extra instances of my iop.

Cheers,

Anders


(CONFIDENTIALITY NOTICE: The information contained in this email may be 
confidential and/or privileged. This email is intended to be reviewed by only 
the individual or organization named above. If you are not the intended 
recipient, or an authorized representative of the intended recipient, you are 
hereby notified that any review, dissemination or copying of this email, or the 
information contained herein is strictly prohibited. If you have received this 
communication in error, please notify the sender by return email and delete 
this email from your system. Thank You.)

_______________________________________________
Nuke-dev mailing list
Nuke-dev@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to