Search - User list
Full Version: Dynamic number of inputs in an HDA
Root » Technical Discussion » Dynamic number of inputs in an HDA
tomteller
Hi all - have been digging around for this and haven’t been able to find an answer. I’m building an HDA in LOP’s with render layer functionality where I would like to tie the number of inputs to a parameter (like a multiparm block where the user can easily add more).

The HDA is structured in a way where each input renders out as a separate EXR (very useful for splitting out elements for comp, or rendering multiple variations). In some instances like rendering 7 variations it would be great to dynamically add more input slots on the node - without permanently cluttering the node with a ton of inputs when not needed. Curious if anyone has done this before.

Cheers!
vikus
Hey,
you can dynamically change the number of HDA inputs, but it is a property of a node type and not of a node instance, which would mean that if you call two instances of this node type and dynamically adjust their number of inputs, the change would affect both or generally all instances at the same time.

Here is an example:

# HDA/Scripts/OnInputChanged
n = kwargs["node"]
nt = n.type()
ntd = nt.definition()
input_cnt = len(n.inputConnections())
ntd.setMaxNumInputs(input_cnt + 1)
tamte
tomteller
- without permanently cluttering the node with a ton of inputs when not needed
just set your number of inputs to maximum you thing you will need
as long as you have the Max Inputs set to at least 28 there is no clutter as they appear like a single line like in Merge SOP

I wouldn't advise to dynamically change the HDA definition as that's usually in an external file and can be shared across many setups so any alteration may break scenes using instances of that definition
tomteller
Ah, thanks guys! Really appreciate both of these approaches.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB