antimony
antimony copied to clipboard
Functions for variable connection.
To keep things centered in the model I'd like to specify a function for a wire (e.g. x / 2)
+1
I was doing the screwdriver demo and I wanted this for the inserts (eg, extrude from -radius to +xmax).
Interesting. What do you see this looking like in the UI? I could imagine a smaller text box midway through the connection with a single expression that's evaluated (maybe using _ as the input variable).
Maybe just a node with a number input (x, a) and a number output (y, b), but no shapes?
That's already pretty easy with a custom script, something like
title("/2")
input("a", float)
output("b", a/2)
Does that do what you're asking?
Workflows vary from person to person, but when designing anything interesting, I end up spending a lot of time customizing the pre-existing nodes by editing their scripts (rather than trying to find ones that do exactly what I need and connecting them).
Yeah, that works. But it'd be nice if I could have a node like
| a | 2 |
| b | -a |
So that simple one-line expressions don't involve writing a full node.
I solved it this way:
title("Multiply")
input("a", float)
input("mul", float)
output("b", a*mul)
this allows me to set mul to -1 for b = -a and 0.5 for b = a/2
I found myself wanting this too. Treat constants, not just shapes, as data in the DAG.
This is how I imagine this should be handled in the UI:

Expressions like that are already evaluated correctly. All thats needed is to draw the connection between the nodes and highlight the names of the variables.
Conceivably, this would also allow you to have multiple outputs feeding into the same input. These would just be represented as different variables in the expression.
Hm. Making node reference more prominent would certainly solve the problems described here, and drawing lines would make the connection more obvious.
The way this doesn't solve the problem is if the same equation is used in more than one place in the drawing, but that can be remedied with a simple "constant" block with 1 float input and no outputs.
(As a nitpick, maybe draw them in a different style (thinner, dashed, gray) so that it's obvious to the user that this is an indirect link and non-interactive.)
+1