I have a node which takes an arbitrary number of connections. However, a certain type of node can only be connected to this node once.
To manage this I use a boolean flag member variable. As this info can be derived from the incoming connections I found storing it into an serialized custom knob overkill. The latter is also not safe: if the connection is broken outside Nuke, say by some part of a pipeline mangling Nuke scripts, the saved state would be incorrect. The flag member variable is set in _validate(). test_input() then checks that and refuses a connection if the flag is set, aka if validate_() has detected that a node of the resp. type is connected. This works fine, generally. Specifically it fails when I load a script where the node has already one such connection. _validate() sets the flag correct, seeing the existing connection. But later, when test_input() is called, the flag is unset again. I found the reason to be that Nuke sometimes creates a copy of the Op, internally. Now the question is if there is anything, a callback, (like a standard copy constructor), that could use to preserve the state of the original for the copied Op. The option of making the flag mutable and doing the change in e.g. test_input() is certainly not thread safe. It seems to work as we're doing this in another node. But is there a better option? .mm _______________________________________________ Nuke-dev mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
