module
Lapis::EditorScriptCreation
Defined in:
libgodot/editor_script_creation.crConstant Summary
-
BUTTON_ID_OPEN_CRYSTAL_SCRIPT_BASE =
99000_i64 -
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 -
ID_SCENE_DETACH_CONVERT =
889903_i64 -
TEMPLATES =
["Standard Node (_ready & _process)", "Physics Movement (CharacterBody)", "Tool Script (@[Tool] In-Editor Execution)", "Empty Class"]
Class Method Summary
-
.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
- .cleanup : Void
- .cleanup_on_shutdown : Void
- .convert_crystal_node_to_parent(node : Node, parent_type : String, ed_iface : EditorInterface) : Void
-
.ensure_cr_extension(path : String) : String
Normalizes a path to end with exactly one .cr extension, stripping duplicate dots or other extensions
-
.find_all_children(parent : Node, type_name : String) : Array(Node)
Recursively discovers all child nodes matching the specified Godot class name
- .find_scene_tree_dock(base_ctrl : Control) : Node | Nil
-
.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
- .generate_template_code(class_name : String, base_type : String, tmpl_idx : Int64) : String
-
.get_create_dialog_selected_type(cd : Node) : String
Retrieves the selected type from a Godot CreateDialog by inspecting its Tree control
- .get_script_button_icon(ed_iface : EditorInterface) : Texture2D | Nil
-
.get_selected_node(ed_iface : EditorInterface) : Node | Nil
Retrieves the currently selected Node in the Godot Editor
-
.hook_create_new_submenu(fs_dock : Node, sub_node : Node) : Void
Hooks dynamically created "Create New" submenus in FileSystemDock
-
.open_crystal_script_info(ed_iface : EditorInterface, info : ScriptLocationInfo) : Void
Opens the given Crystal script in Godot's ScriptEditor at the specified 1-based line number and switches to the Script tab
- .register_script_button_info(info : ScriptLocationInfo) : Int64
-
.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
-
.setup_filesystem_dock_menus(ed_iface : EditorInterface) : Void
-
.setup_scene_tree_dock_menus(ed_iface : EditorInterface, base_ctrl : Control) : Void
-
.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.
-
.setup_toolbar_button(ed_iface : EditorInterface, base_ctrl : Control) : Void
- .show_detach_convert_dialog(node : Node, parent_type : String, ed_iface : EditorInterface, base_ctrl : Control) : Void
-
.show_dialog(initial_path : String = "", default_name : String = "", default_base : String = "") : Void
-
.sync_scene_tree_script_buttons(ed_iface : EditorInterface, base_ctrl : Control) : Void
Synchronizes "Open Script" icon buttons next to custom Crystal nodes and resources in the SceneTreeDock
- .sync_tree_item_buttons_recursive(item : Godot::Object, scene_root : Godot::Node, rel_path : String, script_icon : Godot::Texture2D) : Void
-
.to_snake_case(str : String) : String
Converts CamelCase to snake_case for clean Crystal file naming
Class Method Detail
Adapts the file path inside a native ScriptCreateDialog to ensure a clean .cr extension when Crystal is selected
Normalizes a path to end with exactly one .cr extension, stripping duplicate dots or other extensions
Recursively discovers all child nodes matching the specified Godot class name
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
Retrieves the selected type from a Godot CreateDialog by inspecting its Tree control
Retrieves the currently selected Node in the Godot Editor
Opens the given Crystal script in Godot's ScriptEditor at the specified 1-based line number and switches to the Script tab
Sets up all editor integration entry points: toolbar button, FileSystem dock menus, SceneTree menus, and ScriptCreateDialog interception
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.
- Top Toolbar "+ Script" Button
- Interactive Dialog Presentation
Synchronizes "Open Script" icon buttons next to custom Crystal nodes and resources in the SceneTreeDock