godotengine / godot-proposals

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

Add 'Local To Node' option for subresources #6195

Open FeldrinH opened 1 year ago

FeldrinH commented 1 year ago

Describe the project you are working on

A platform game with lots of variable-sized terrain pieces, where each piece needs a differently sized collision shape.

Describe the problem or limitation you are having in your project

When creating a level I would like to easily add new terrain pieces with reasonable default values. Creating a scene for each terrain piece configuration is cumbersome, since the terrain piece configurations are very varied. So an easy and convenient way to build levels would be to copy an existing terrain piece (usind Ctrl+D or Ctrl+C and Ctrl+V) and tweak it. Unfortunately, this results in the copy and the original terrain piece having shared subresources (in this case sharing a collision shapes), which means that to change the collision shape for only the copy, I have to open navigate multiple layers of nesting to open a menu and click 'Make unique' on the collision shape resource. This is fairly annoying and completely breaks my flow when designing a level.

While this is a specific example, I imagine that a lot of level designers using Godot will have encountered similar issues with wanting to quickly tweak a subresource of a copied node and finding that it is shared with the original node. While you can manually make the resource unique, this is an annoying process that tends to break the flow of actually designing your level. The problem is even worse if you want to tweak more than one shared subresource.

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

In addition to the 'Local To Scene' option, which creates a unique copy of the resource for each instance of the scene, I propose adding a 'Local To Node' option which creates a unique copy of the subresource for each copy of the node.

Under this proposal each subresource would have three possible sharing modes:

Using the 'Local To Node' mode my workflow would work as desired, with no need to manually make resources unique.

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

The 'Local To Node' checkbox would be replaced with a dropdown with the three aforementioned modes available for selection.

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

You could probably create an editor plugin that copies a selected node and makes your desired resource unique, but at least with my limited knowledge of editor plugins it seems that getting this plugin to work reliably would be nontrivial and making configuring it straightforward would be even more nontrivial.

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

While an add-on probably could provide this feature, at least in the editor, it feels like a feature that the editor itself should have, given that the 'Local to scene' option already exists.

FeldrinH commented 1 year ago

Depending on how/if they are implemented, this proposal may be superseded by https://github.com/godotengine/godot-proposals/issues/4672 or https://github.com/godotengine/godot-proposals/issues/317.

KoBeWi commented 1 year ago

I have to open navigate multiple layers of nesting to open a menu and click 'Make unique' on the collision shape resource.

If your shape is the only resource in the node, you can use "Make Sub-Resources Unique" option.

FeldrinH commented 1 year ago

If your shape is the only resource in the node, you can use "Make Sub-Resources Unique" option.

Yes, that might be slightly faster, however it doesn't do much for my main issue which is that having to do this manually breaks the editing flow and makes concentrating on the actual level design harder.