Repository navigation
Editor Scripts
The GDGist Pro Edition unlocks the ability to define and execute raw Godot EditorScript objects directly from your snippet library. This completely eliminates the need to pollute your project's FileSystem with temporary @tool scripts just to perform one-off batch operations or IDE automation.
An EditorScript is a native Godot base class designed to run code strictly within the editor environment. The engine natively sandboxes these and never includes them in exported projects.
The execution entry point for any Editor Script is the _run() method:
@tool
extends EditorScript
func _run() -> void:
# Automation logic executes here
passWhen writing Editor Scripts, you have full architectural access to the active workspace. Critical inherited methods include:
-
get_scene(): Returns the root Node of the currently open scene tab, allowing you to recursively traverse and modify the active scene tree. -
get_editor_interface(): Returns the EditorInterface singleton. This provides direct hooks into the script editor, the file system dock, and current user selections.
Opening an Editor Script snippet in GDGist displays a dedicated execution window containing the script editor and run controls.
Pressing the Run Script button evaluates the code directly in memory; it does not save your modifications back to the hard disk. This provides a massive structural advantage: volatile execution states. You can define configuration constants or target paths at the top of your script, temporarily modify them within the GDGist window to suit your immediate task, and execute the code. Because the execution does not trigger a disk write, closing and reopening the gist will immediately restore it to its original, pristine state. You can rapidly tweak runtime parameters without ever permanently altering your baseline snippet codebase.
Because Editor Scripts can interface with the entirety of Godot's editor API, they are incredibly versatile for deep project refactoring:
-
IDE Interaction & Batch Operations: Querying get_editor_interface().get_selection() to grab the currently selected nodes in the scene tree to batch-rename them, reassign materials, or strictly enforce naming conventions.
-
Code Refactoring & Formatting: Accessing the active ScriptEditor, grabbing the currently selected text or cursor position, and automatically reformatting complex data structures or injecting generated code natively into the open script.
-
Resource Generation: Automatically slicing large sprite sheets into hundreds of individual .tres AtlasTexture resources to optimize GPU draw calls, or procedurally building standardized CollisionShapes for an entire directory of meshes.
-
AI Prompt Generation: The bundled "AI Prompter" script utilizes get_editor_interface().get_resource_filesystem() to grab selected files and concatenate their raw text into a single clipboard string for rapid LLM context injection.
🔹 Home 🔹
Wiki Root
Getting Started
Working with GDGist
Pro Features
Settings
Workflows & Examples