Closed kamirr closed 1 year ago
Note: I've also experimented with an alternative of adding an input_ui
method to NodeDataTrait
, but I've found the patterns resulting from this choice more ergonomic. Also, extending WidgetValueTrait
from something only capable of providing default inputs to also configuring present inputs felt natural.
Other than my comment above, I'm wondering if it wouldn't be better to instead provide
value_widget
andvalue_widget_connected
. This would be more flexible. Because maybe the user wants to simply show two entirely different UIs when a port is connected vs when it's not, not just one half of the UI conditionally.
I guess it depends what semantics of inputs you have in mind, but it's certainly easier to emulate my behavior with your API than the other way around. I'll do that.
Made sure it works this time.
Depending on the usage of value widgets, we might wish to display some value UI even with an input connected.
Motivating example: consider a node with an input representing some amount of time in the context of digital signal processing. Multiple sensible representations of time may be desired as inputs:
In such a case we would use
value_widget
to display a widget for selecting the number in an unspecified unit, andvalue_widget_always
to display a combo-box for choosing the units. Then, when we connect an input we don't need the selection of the number, but we still wish to choose the units of the input.