Ah - I think I know why.
My node has minimum_inputs set to return 2 and as a result inputs()
doesn't go below this value.
Checking each input( n) separately does the trick it seems.
Jeff Clifford wrote:
Hi,
I'm after the best way to check the number of inputs from within the
execute method of my plugin (which derives from both Iop &
Executable).
My node accepts a multiple number of inputs but I need to check that at
least 2 inputs are connected.
Currently I do this:
void MyClass::execute()
{
if( inputs() < 2 )
{
cerr << "Error - Too few image inputs." << endl;
message_f( '!', "Too few image inputs." );
return;
}
...
}
But I'm finding that if someone disconnects an input to my node (so as
to leave just 1 input) and then triggers the knob button to call my
execute method inputs() still evaluates to 2. I've put comments in my
code and it appears _validate() doesn't get called as a result of
disconnecting the input node - so my node still thinks it has 2 inputs
attached.
Is there are more appropriate test to check for this condition? Should
I call validate() from within execute() or is this asking for trouble?
I was going to try casting the second input to the desired node type
and checking against NULL as a getaround solution but I'm guessing
there's a better way.
Thanks,
Jeff.
_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
|
_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev