Open Zireael07 opened 3 years ago
I am using Godot 100% via code (C#) and official support for this would be very helpful.
I have created a workaround: The Scene root node hooks the Pre-Save Notification to remove .Owner
information from procedural nodes, and hooks Post-Save to add .Owner
back. Of course it's not this simple, as to do this I need to add logic to track these "procedural nodes", and do that via a base class for all Scene Roots, which requires me to wrap all Nodes that could possibly be a Scene Root (currently just Node,Node3D, and CharacterBody3D for me).
I also add a variable+button to each SceneRoot to show/hide the procedural nodes under it, to manage clutter with complex scenes instantiating other scenes.
This workaround is successful like 99% of the time, but it fails occasionally, seeming when some exception is thrown, which causes the Pre-Save notification to not trigger, and my procedural nodes end up being saved. This isn't a problem for me as I'm 100% procedural so it's easy to detect, but if someone were to mix editor added nodes with procedural, this could be super problematic.
Here's a screenshot of my "setting up infrastructure" progress, showing how I use the Godot editor to visualize all my work (including running it)
As I'm 100% doing this via c#, I procedurally name my nodes based on the code's variable name (using the [CallerArgumentExpression] attribute) and line number from the callsite using [CallerLineNumber] attribute.
All that said, I'm pretty happy with the workflow as-is, as I have my workaround in place. I just hope that it doesn't get worse (breaking changes in 4.4 or 5.x).
Describe the project you are working on
3D procedurally generated city
Describe the problem or limitation you are having in your project
If I don't do get_owner(), the level isn't saved to file (therefore allowing me to regenerate every time I play or run the editor) but this means nodes aren't visible in editor either (see https://github.com/godotengine/godot/issues/53005 where it has came up most recently)
Get_owner() causes nodes to be saved to file, which means: a) it needlessly bloats the scene file with stuff that gets regenerated either way b) before generating I'd need to purge old stuff, lengthening load times even more
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Get_owner_tool() (_temp?) or some such that would allow me or other contributors to see nodes in editor but w/o saving them to file.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
See above.
If this enhancement will not be used often, can it be worked around with a few lines of script?
I wish I could work around it... have been battling this ever since I started this project, and it's either "see in editor" or "have cruft in scene files/leftover old nodes"
Is there a reason why this should be core and not an add-on in the asset library?
I don't think assets can help much with tool scripts and especially "ownership"