godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 69 forks source link

Add an editor action to apply changes from inheriting scenes to the base scene #4820

Open Flavelius opened 2 years ago

Flavelius commented 2 years ago

Describe the project you are working on

A 3D rpg-like with lots of scene inheritance

Describe the problem or limitation you are having in your project

For games with many entities that share common functionality, the scene inheritance system is a really good solution. It is not uncommon though (and i stumble upon this quite a lot) to decide late in the process that a range of changes in a scene should be baseline to all inheritors. And sometimes it's even necessary to modify scene instance children in the context of another scene (to align things properly etc.). This is currently impossible without manually copy-pasting all changes separately to the base scene.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

In unity it is possible and quite powerful to be able to apply scene modifications to a prefab, this allows to take full advantage of prefab inheritance. It would be really helpful if godot had similar functionality (apply added nodes & property value overrides to packedscene)

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

It could be part of the rightclick menu, additionally exposing an 'apply property overrides to asset' or similar or 'Apply added node to asset', or just an overall button or menu entry on the instance's base to apply all changes to its asset.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I think technically it may be possible to re-pack from the scene and override an existing PackedScene asset to mimic that, but there currently are bugs that prevent persisting direct scene inheritance; and there's no API for modifying or persisting SceneState (https://docs.godotengine.org/en/stable/classes/class_scenestate.html), which would probably have less sideffects for most of the required operations than plainly repacking the whole scene.

Is there a reason why this should be core and not an add-on in the asset library?

It's part of an efficient workflow that everyone working with scene inheritance would benefit from.

hsandt commented 1 year ago

There could also be an equivalent "Revert" button. This is of course less critical because there are already individual Revert buttons near each overridden properties, but a nice addition to allow batch Revert.

I can also imagine a Unity-like panel that lists all the modified properties, and an Apply/Revert button besides each. But that can come later, even Unity took many versions to add it.