godotengine / godot-proposals

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

Expose autoloaded scene/script methods to Node panel signals in editor UI #9723

Open AlexKisil opened 2 months ago

AlexKisil commented 2 months ago

Describe the project you are working on

A very simple case study of Boomshine, a 2D arcade-style game where you create chain-reactions on screen by causing ripples.

Describe the problem or limitation you are having in your project

Because all levels are effectively the same scene with a few different parameters, I "load" different levels by keeping the scene active and swapping out its children based on an array of custom resources held within an autloaded GameManager. My main menu loads the level scene via a button press, but the level scene doesn't know which resource to load its contents from without consulting the GameManager. The level scene itself is extremely simple and doesn't require any other script logic, thus it doesn't have an attached script. I want to be able to connect the ready() signal of the level scene to the _on_load_level_requested() method on my GameManager, but it's not available as an option within the Node/Signals pane for the level scene (since the GameManager is its own separate autoloaded scene). The signal can be connected via code, but it's cumbersome and unclear to have to do this to connect built-in signals to autoloaded scene/script methods, especially when the scene wouldn't otherwise have an attached script.

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

Expose any methods in autoloaded scenes/scripts to the Node/Signals pane in the editor UI. This lets the UI reflect the same behavior as code: allowing signals to connect to methods they have access to.

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

image

In this pop-up UI, autoloaded scenes would be listed alongside the selected scene, either as if they were siblings or in a separate tab. When selected, the methods in these autoloaded scenes would be available when clicking the "pick" button.

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

Yes, but it's inconvenient and inconsistent with Godot's behavior in code.

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

The current behavior misrepresents what methods are available to signals in the Godot editor, which seems like an (understandable) oversight rather than a bonus feature.

AThousandShips commented 2 months ago

See also: