NodeGraphProcessor icon indicating copy to clipboard operation
NodeGraphProcessor copied to clipboard

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

Open minism opened this issue 4 years ago • 3 comments

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.

minism avatar Oct 10 '21 00:10 minism

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.

leissler avatar Oct 11 '21 22:10 leissler

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 }

minism avatar Oct 12 '21 04:10 minism

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.

alelievr avatar Oct 12 '21 09:10 alelievr