alelievr / NodeGraphProcessor

Node graph editor framework focused on data processing using Unity UIElements and C# 4.6
https://github.com/alelievr/NodeGraphProcessor/projects/2
MIT License
2.34k stars 387 forks source link

Any plans to decouple parameters from graphs, similar to material->shader relationship? #187

Open minism opened 3 years ago

minism commented 3 years ago

First of all thanks for your work on this awesome library!

I'm wondering if there are any plans, or if there is a way to currently do this, to support decoupling a graph asset from the set of parameters assigned to that graph.

The analogy would be between Materials and Shaders.

You could imagine designing a graph which represents the logic structure of some system, and then have a one-to-many relationship between that graph and other ScriptableObject assets which represent particular instantiations of that graph with a parameter set.

leissler commented 3 years ago

Please do not do this. The parameters of a graph should be something like the graph's local variables, which inherently exist in connection with the graph. It's like a function with parameters, which you fill out with values before you can run it. Graph parameters should therefore not be separate objects. However, introducing a concept of global variables that "live" in ScriptableObjects (something like global blackboards) does make sense, but could be out of the scope of NodeGraphProcessor.

minism commented 3 years ago

Thanks for your reply.

I think we are on the same page, and I probably worded my question incorrectly. Certainly I agree that parameters are strongly coupled to the graph like parameters in a function signature -- they are owned by the graph and can't be changed.

What i meant to say was that it would be useful to have a mechanism for storing a set of "parameter values" (e.g. function arguments using the same analogy) as its own asset, in the way that a shader defines its parameters, but a material is an asset file pointing to that shader along with a specific set of values for each shader parameter.

Likely this would just be a higher-level asset than BaseGraph, which stores { graph, parameter values }

alelievr commented 3 years ago

Currently, it's not planned. But it's possible to do something pretty similar to prefab variants for parameters. If you look at the Mixture variants system: https://github.com/alelievr/Mixture/blob/master/Packages/com.alelievr.mixture/Documentation~/MixtureVariants.md#mixture-variants It allows you to process a graph with a separate set of parameters saved in another asset that references the parent graph.