godot-visual-script
godot-visual-script copied to clipboard
Groups Nodes replace Functions in Visual Scripting
Groups Nodes replace Functions
Grouping of Nodes in a chain should be allowed to simplify the process of creation of Node Units and increasing reusability of parts of the Visual Scripts.
Quick Mockup.
Group Nodes should be stored as custom Nodes that are accessible from the same drop down for searching the Nodes and also allow for saving and loading groups as resources for use as custom nodes all across the project.
Probably even have a default folder where we can place all the Grouped Node(Custom Node) Resources that we want to be accessible across the project as custom nodes, automagically. This would remove the need to newbie users to learn how to create Tool Scripts.
Details
The Groups will be simple and clean and will act like bookmarks that will take us to the respective Group Node Structure we double click on.
The Groups will be a much simpler concept compared to functions but will technically use the same structure/codebase. It will also the first step towards addition of Unified Visual Script editor Graph.
Being able to save these can come extremely handy, such as having a module for simple visual script functions required and even Visual Shader node groups.
cc: @fire
Moved this comment here.
Groups
We have a super class called groups which are an interface with implementation.
This feature is useful for merge and removing entire groups of nodes.
Groups have:
- title
- a list of grouped nodes
- input-output port
- position
Comments
Comments derives from the group class.
Each comment group can be moved as a group.
Each comment has:
- Inherited group properties
- comment string.
Custom nodes
Custom nodes derive from the group class.
Each custom node has:
- Inherited group members
- Gdscript
Expression nodes in Visual Shader
An expression derives from the group class
Each expression node has:
- Inherited group members
- Shaders code (text)
To do for loops requires a generic shader node.
The Expression node is enough for "for" loops. The Visual Shaders currently do not support Functions and Flow control signatures.
#22243
Requires adding a method to add input variables.
I don't think it's good for ui to merge the concept of commenting and node definition. The "GroupA" in the mockup should stay a comment and not a integrated blob structure that auto expands from a node definition.
There could be a concept of autoloaded visual script libraries that are vs scripts and are effectively globals.
This feature/proposal went through a lot of discussions internally and we decided to not remove functions for both backwards compatibilities and to keep the system as simplistic.
But rather add a Visualscript submodules feature to be able to save blocks of visual script code as resources aka submodules and then reuse it in any other script or multiple times in the same script via simple import mechanisms. And have the same edit functionality as the VisualScript.
Hey all, any update on the project? I'm currently writing a shader mixed with nodes and "expression" nodes (code), but I really need to collect a lot of reused code into a custom node. Would be awesome to have this feature now 0:) Cheers and stay healthy!
@shiMusa Well things will get redone for 4.0 and this will likely make it in then, so not likely that it will be available in 3.2. Unless I find a way to implement it without breaking compatibility.....
@swarnimarun Ping! How is the rebase?
@fire https://github.com/godotengine/godot/pull/45294
Created the draft PR, will be testing it a bit just to see if perhaps something else might have broken during rebase of Godot GUI code changes.
I'll keep this proposal open until it is merged.
Note that I've transferred it despite groups being useful in shaders as well because most of the discussion and work referenced here seems to be around scripting. A new proposal can be made in the main repo for group in graphs in general or for grouping in shaders. I suspect the underlying implementations for shaders would be pretty different anyway.