Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wish - to allow optional inputs in custom nodes #1765

Closed
eproca opened this issue Jun 15, 2014 · 4 comments
Closed

Wish - to allow optional inputs in custom nodes #1765

eproca opened this issue Jun 15, 2014 · 4 comments

Comments

@eproca
Copy link

eproca commented Jun 15, 2014

Some default nodes have optional inputs. For example, in PolyCurve.ByPoints Dynamo assumes correctly that normally I am not using it for closed profiles. So I am not having to connect a true/false node to "ConnectLasttoFirst" every time I am using it. "ConnectLasttoFirst" is an optional input with a default value of "false".

Sadly it seems not possible to make custom nodes with this smart behavior. All the inputs must be filled. Even if the internal logic of the custom node is taking care of what to do if some are not.

Maybe a possibility would be the option of setting a default value in the "input" nodes when defining a custom node. If nothing connected to the default value, that input must be filled necessarily when using the custom node. If something is connected to the default value, the input becomes optional.

@mjkkirschner
Copy link
Member

I can see why you would want this behavior on custom nodes with many inputs, and defining the behavior inside the node with something like an input node seems to make sense. A work around is to pass a default token like "default" and then like you noted, internally handle that to select a default value. But you still need to input this token to all inputs.

@eproca
Copy link
Author

eproca commented Jun 15, 2014

If I assume that I will connect always something, I can check if it is the expected entity and if not just use the default. But the idea is not having to connect anything except I want to change the default.

The curious thing is that you can do that in the normal environment, for example using Object.IsNull
01
In this sample I am defining the ref point for a profile (is a part of a global workflow to be integrated in a custom node). The default is to take the geometrical center (using the profile bounding box). But if I connect something to "RefPtOverride" it will use the given point instead. If nothing is connected to "RefPtOverride" it will use the geometrical center as ref point.

But It is not going to work when inside a custom node. Because every input must be filled when the custom node is in use.

The funny thing is that if you allow to set a default value in the "input" node of a custom node, it won't be needed to set any specific logic to control the default or the override (like I am doing with Object.IsNull). It would be far easier. In the sample I would just connect the geometrical center to the default value of the input.

Maybe an easy solution to avoid any disruption in the existing custom nodes, is to leave the current "Input" node like it is now, and have a new one like "InputOptional" or "InputWithDefaultValue".

@andydandy74
Copy link
Contributor

Thought I heard this before somewhere, quite some time ago: #267
This would be a really nice feature indeed.

@ikeough
Copy link
Contributor

ikeough commented Apr 27, 2016

Default values are now available in Input nodes in custom nodes. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants