module

Godot::EditorScriptCreation

Constants

COMMON_BASE_TYPES = ["Node", "Node2D", "Node3D", "CharacterBody3D", "CharacterBody2D", "Control", "Camera3D", "Area3D", "Area2D", "RigidBody3D", "RigidBody2D", "Resource", "RefCounted"]
ID_CRYSTAL_SCRIPT = 889901_i64
ID_SCENE_ATTACH = 889902_i64
TEMPLATES = ["Standard Node (_ready & _process)", "Physics Movement (CharacterBody)", "Tool Script (@[Tool] In-Editor Execution)", "Empty Class"]

Class methods

adapt_script_create_dialog_path(scd : Node) : Void

Adapts the file path inside a native ScriptCreateDialog to ensure a clean .cr extension when Crystal is selected

Source
cleanup
Source
cleanup_on_shutdown
Source
ensure_cr_extension(path : String) : String

Normalizes a path to end with exactly one .cr extension, stripping duplicate dots or other extensions

Source
find_all_children(parent : Node, type_name : String) : Array(Node)

Recursively discovers all child nodes matching the specified Godot class name

Source
fix_script_create_dialog(scd : Node) : Void

Repairs a Godot native ScriptCreateDialog's language menu:

  • Updates index 1 (CrystalLanguage) text to "Crystal" and sets official Crystal icon
  • Prunes any out-of-bounds surplus items (count must never exceed ScriptServer language count)
  • Ensures valid selection index so it never shows broken red icon or empty fields
  • Sets up live path adaptation when language is switched
Source
generate_template_code(class_name : String, base_type : String, tmpl_idx : Int64) : String
Source
get_create_dialog_selected_type(cd : Node) : String

Retrieves the selected type from a Godot CreateDialog by inspecting its Tree control

Source
hook_create_new_submenu(fs_dock : Node, sub_node : Node) : Void

Hooks dynamically created "Create New" submenus in FileSystemDock

Source
setup(ed_iface : EditorInterface, base_ctrl : Control) : Void

Sets up all editor integration entry points: toolbar button, FileSystem dock menus, SceneTree menus, and ScriptCreateDialog interception

Source
setup_filesystem_dock_menus(ed_iface : EditorInterface) : Void
  1. FileSystem Dock Context Menu & Create New Menu
Source
setup_scene_tree_dock_menus(ed_iface : EditorInterface, base_ctrl : Control) : Void
  1. SceneTree Dock Node Context Menu ("Attach/New Crystal Script...")
Source
setup_script_create_dialog_interception(ed_iface : EditorInterface, base_ctrl : Control) : Void

Intercepts Godot's built-in ScriptCreateDialog whenever CrystalScript is selected in "Create New Resource" (FileSystem Dock -> Create New -> Resource -> CrystalScript) and repairs native ScriptCreateDialog instances so they never show broken red icons.

Source
setup_toolbar_button(ed_iface : EditorInterface, base_ctrl : Control) : Void
  1. Top Toolbar "+ Script" Button
Source
show_dialog(initial_path : String = "", default_name : String = "", default_base : String = "") : Void
  1. Interactive Dialog Presentation
Source
to_snake_case(str : String) : String

Converts CamelCase to snake_case for clean Crystal file naming

Source