Comments (3)
I've made a start on this, but have a question. In the image above, there is a float variable, but the "variable" input sockets on the Set and Get nodes both have a valueType of "id", which is causing an issue.
At the moment, sockets can only be connected when valueTypes match (float -> float, flow -> flow etc), from a user perspective, it would make sense for a float variable to only be able to connect to matching nodes, but the data for that decision is not self contained on the socket spec.
I could potentially add special logic which, when it encounters an "id" variable type, it looks at the other non-flow sockets on the node for a valueType, in this case it would find "float".
from behave-flow.
Thinking about this some more, i think its right that "id" is its own valueType so that variables can only be connected to variable slots (similar to flow sockets), perhaps I just need to add some custom logic at the point a connection is attempted to check the variable type also matches.
This still leaves the question of how to determine the type, at the moment I think its only get/set nodes which have variable sockets, in which case the correct valueType is whatever the value of the sole non-flow non-variable socket is, but is this universally true?
from behave-flow.
I came up with a different solution by looking at Unreal Engine's blueprints. What they do is that after you have "declared" variables by adding variable entries to their list of variables, it create new nodes that include basically the name of the variable in their name.
Basically if you declare a "count" variable in a blueprint, you can now create nodes of type "get count" and "set count" in which the value socket is of the same value type of "count."
I've implemented this pattern in the behave-graph library recently. So we can mimic it.
The node names in the JSON would be "variable/set/${variable.id}" and "variable/get/${variable.id}".
I've made these two functions that dynamically create these nodes:
https://github.com/bhouston/behave-graph/blob/main/src/lib/Profiles/Core/Variables/VariableSet.ts#L9
https://github.com/bhouston/behave-graph/blob/main/src/lib/Profiles/Core/Variables/VariableGet.ts#L8
from behave-flow.
Related Issues (20)
- Allow for nodes to be different colours. HOT 6
- stop node moving when selecting text in input
- Allow for tracing of execution - using NodeEvaluationEvent
- More than one input to a parameter socket shouldn't be allowed. HOT 1
- If a "flow" socket's name isn't "flow" we should show the name, helps with For Loops. HOT 1
- Support for custom events
- dont allow multiple identical flow connections
- Is there a way to peak into a nodes implementation?
- Load Node definitions from a JSON file HOT 2
- Display node names using node labels
- Give focus to search text field when new node menu appears HOT 1
- Support for Javascript
- Save/load positional data into the graph JSON data. HOT 2
- README.md and links to demo HOT 1
- only allow connections between matching types
- create node context menu when dropping connection in blank space
- auto complete node list
- auto size inputs based on contents
- don't use exported spec file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from behave-flow.