Maybe I was overthinking this. It looks like Merge2 is a special case with its dynamic number of inputs, and so no matter how many inputs it has, mask is always input index 2. I swear I found a scenario where it wasn't, but now it appears to be reliably so.
Anyway, sorry for the noise. Cheers, Ean On Jan 8, 2013, at 8:30 AM, Ean Carr <eanc...@gmail.com> wrote: > Hi all, > > Anyone found a reliable way to get the index of a node's mask input? I'm > talking about the input on the right of some nodes which feeds their > 'maskChannelMask' knobs, like Shake. > > I'm not confident that optionalInput is always returning the mask index. At > least, testing this method in Nuke 6 returns different indices depending on > what order inputs are set to a Merge2, for example. Sometimes it returns 2, > sometimes not. > > Ideally nodes would have something like a 'maskInput' method which would > return the index or None for nodes which don't have it (NoOp, Dot, etc). > > I've played around with combinations of methods returned by: > > [x for x in dir(nuke.nodes.Merge2()) if 'input' in x.lower()] > > ...without much luck in Nuke 6.3v8 - linux. > > Oh, just did some quick testing in 7 and it appears I *can* determine the > mask input by getting the optionalInput index, then testing for > 'maskChannelMask' in node.knobs().keys()... I think (?) > > Thanks, > Ean _______________________________________________ Nuke-python mailing list Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python