Git Product home page Git Product logo

Comments (3)

beeglebug avatar beeglebug commented on August 26, 2024

image

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.

beeglebug avatar beeglebug commented on August 26, 2024

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.

bhouston avatar bhouston commented on August 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.