/godot-editorscript-launcher

A hotbar for launching your editor scripts.

Primary LanguageGDScriptMIT LicenseMIT

EditorScript Launcher

Adds a hotbar with buttons for each of your editor scripts so you can write scripts to speed up your Godot development. Scripts can specify custom UI so you can pass parameters.

While Godot has built-in EditorScript, they only run from the code editor which means you can't see the scene and can't run when using an external editor.

Setup

Install and enable the addon as usual.

Put your editor scripts in res://code/editor/ and make them extend LaunchableScript. See code/editor/layout_circle.gd and code/editor/rename_selected.gd for examples.

You'll get a new "Script Launcher" button on the bottom toolbar that incldues buttons for all of your scripts: toolbar

Example New Script

Add res://code/editor/rename_copy_first.gd:

tool
extends LaunchableScript

static func run_script(ed: EditorInterface, ui_root: Control):
    var selection := LaunchableScript.get_selection_or_children(ed)
    var name_of_first = selection[0].name.rstrip(" 0123456789")
    for item in selection:
        item.name = name_of_first

Hit Refresh, and now you'll have a new button!

rename copy first

Included scripts

Some of the included scripts as demonstrations of what's possible:

align_to_grid.gd align to grid

layout_circle.gd layout circle

rename_selected.gd rename selected

Troubleshooting

Sometimes Godot won't recompile your code so you'll have to disable + enable the EditorScript-Launcher plugin or restart the editor.

License

MIT