godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.05k stars 65 forks source link

Automatically add new script to new scene #9649

Open crotron opened 2 weeks ago

crotron commented 2 weeks ago

Describe the project you are working on

A hobby game that will probably never see the light of day at the rate I am going at :(

Describe the problem or limitation you are having in your project

When I create a new scene, most of the time I want to add a script to it, so I go ahead and do that. This takes a few clicks to accomplish.

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

Have an option (maybe a checkbox) in the "Create New Scene" dialog that automatically creates and attaches a .gd script to the new scene using the default template if it's checked. If the checkbox remembers its previous setting, this would only require two clicks to accomplish (one right click to open the dialog, and one left click to create the scene + script)

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

The functionality would be equivalent to creating a new scene with a given name, clicking on the "attach script" button, waiting for the "Attach Node Script" window to pop up, and clicking on "Create".

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

Considering this involves the engine UI, I'm unsure as to whether this can be done from within Godot.

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

Again, unsure as to whether this can even be accomplished with an asset since it's part of the UI of the engine itself. I did look through the asset library briefly but didn't notice anything that appeared to do what I'm thinking about.

AThousandShips commented 2 weeks ago

You can also bind a shortcut to the attach script option and just press that

I don't think there's good reason to add more complexity to the create scene dialog, it's already a bit cramped, and it's not a major hassle to attach a script

Now instead you have the problem of forgetting to uncheck it, many scenes don't use scripts on the root necessarily