GSOC 2019 Final Report - Visual Scripting Improvements
- Name: Swarnim Arun
- IRC/Reddit: minraws
- Twitter/Github: @swarnimarun
- Mentors: iFire(K. S. Ernest Lee), Kidrigger(Anish Bhobe)
It's been a long fun experience working on improving one of the tools I so love to use and have been using for a very long time now. This experience has made me aware of a lot of new things and has allowed me to cherish the OSS community and the effort of all the contributors to Godot even more.
A detailed list of all the work done in GSOC.
-> Each PR will have its own list of changes mentioned.
❗ Visual Script Graph Unification
Pull Request: #29681
- The graph for the Visual Script has been unified, that is, all the functions are shown in the graph simultaneuosly. As of now, there's a default function behind the scenes that makes this possible. It's supposed to be changed to refactoring the ownership model of the Visual Script graph by making the visualscript-nodes held by a list inside the graph and not inside the functions.
- The visualscript-nodes figure out which function they belong to from the connections that they have.
- Port connection swapping was also added as a minor UX improvement. Basically, the nodes are aware of the fact if the port changed has already had a connection or not, if it does then the connections are swapped on reconnection otherwise it's ignored.
- There's also auto constructor addition to the graph in case there's a need for type conversion, completely incompatible type ports don't connect which makes committing silly mistakes much more difficult but
Anytype can still connect to all the ports.
- Then there are in-graph editable nodes, which provide a simple yet powerful UX improvement to the Visual Script. These nodes need to inherit from the VisualScriptLists virtual class which has certain conditions for itself hardcoded in the editor. That provide the Node with editable input and output value ports.
- Right Click "popup" search menu was also added, and the sidebar was mostly moved to the top providing more room for the member list and the graph as well.
- Helper Dialog to add functions was also created to make adding new functions less of a pain.
- And dozens or other fixes involving VisualScript Nodes, adding Fuzzy Search functionality, working on improving Type Guessing and etc....
In-Graph Editable Nodes
Right Click Menu
Helper Dialog for Function Creation
❗ Visual Script Tool Script
Pull Request: #30852
This is the tool script functionality for the Visual Script. It simply adds the UI and the internals to allow for tool scriptability. There is not much extra to the visual script and this means that the compatibility has not been broken and this might even allow the PR to be cherry picked for the older versions of Godot.
❗ Visual Script Instance/Construct Node
Pull Request: #31044
Allow to instance any of the instantiable Class from ClassDB similar to how GDScript does it. With managed memory allocations. It's still to be decided if the memory should be managed or not, most probably it will take a flag to decide if the memory is supposed to be managed or not. Or will have to create a wrapper class to allow for proper ref counted allocations and deallocations inside Visual Script. And mostly needs further testing to figure out which approach would be the best overall.
The current implementation directly references and deallocates the reference on the Script destruction or next compute cycle of the Visual Script Node system's step function.
❗ Visual Script Getters and Setter
Pull Request: #31572
This is meant to add getter and setter functionality to the Visual Script variables similar to the GDScript getter and setter. The functionality is added directly to the VisualScript Language, by additions to the get and set functions, with indirect function calls and the GUI is supposed to allow for the nodes to select a function from the graph from a drop down list.
Getting Started - Of the Project
For now, I have a few builds upon the this -> Google Drive Folder if you don't wanna build it yourself.
You can build the Godot source as well just as you would normally but you would have to pull from my branch.
If you find any bugs feel free to report it in the PR itself. For now.
If it has been merged you could also create it as a separate issue on the GitHub and ping me using my handle
Here's a quick walkthrough of the features changes of the project from a usability perspective that you might want to read to quickly get used to all the changes done.
The basic process of everything remains the same and so I will just highlight the pertinent changes in the project.
You can now right-click to bring up the Node Search Menu
You now have a proper dialog box to create functions, it's much easier to add input arguments and such.
Type Conversion Nodes are now added on there own, just to ease the pain of adding an extra node. Incompatible type ports don't usually connect either.
All the functions are now in the same graph but interconnection between the functions are not there(at least not yet).
Data nodes are disconnected in case connections from multiple connections are present the current connection that you make takes precedence.
The connection is what derive which function a node is a part of, by default the functions are part of a default function which is inaccessible.
You can use Ctrl + G to quick create functions from the selected nodes.
More about the project experience
There were also things I think I could have done better which would involve better testing and debugging setup which did cause me to waste some of my time, and probably should have had a testing workflow prepared for stress testing the changes I was going to make.
But things can always be better ;)
Stuff that went well
If I were, to be honest things went a lot better than I had expected, other than a few minor setbacks and changes in the plan most of the work has been completed and it's getting close to getting the PR for the Graph Unification Merged. I know there will be bugs but there always are...
I enjoyed every single day I spent working on the project(probably not the mindless debugging), and especially following a more thoughtful method of working on project goals.
Is anything else left?
Not really but perhaps, tbh, there are a lot more things that I would want to do and I do intend to work on them. And not just the Visual Scripting part but the Editor as a whole and probably some other aspects as well(I really would like more joints to make the 2D Physics applications simpler, or some changes with the rendering as well) but a lot of them might be breaking changes so I will create PRs once we have moved on to working for 4.0
To sum it all up, the journey of GSOC has been a really amazing one and I not only learned new things in the process but also hopefully made some constructive contributions to the project. And hopefully will be able to continue to help the project as a whole in whatever capacity I can. :)