Forum

Optional delegates

i want to test if a delegate input is connected.
if yes - ok, use that
if not - use a default delegate that is provided by the node itself

usecase is writing nodes that could be extended via delegates, but don’t fail if no delegate is connected.

@azeno pointed me to the optional datatype which solves most of the puzzle, but now a user has to deal with optional and cannot just connect a delegate. also the node isn’t useable as region.

image

delegates.vl (36.3 KB)

this patch also contains a small sidequest for the brave ones :)

1 Like

Ah I see, that’s not nice. Other option would probably be to define your own delegate in C#. You can give the pins nice names then and the default should also be null in that case. In retrospective the decision to not take null as default for those guys was probably not the best one :/

Well and of course we should also have a look why the implicit link doesn’t work with optional and delegates. Could probably be perceived as a bug.

1 Like

Linking the delegate into the optional pin should work in latest previews.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.