[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KR6830YBV75P4AABHSK62R":3,"skill-same:01M6KR6830YBV75P4AABHSK62R":78},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":32,"linkOnly":33,"markdownContent":34,"markdownBody":35,"frontMatter":36,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M6KR6830YBV75P4AABHSK62R","addon-development",null,"Use when creating Godot editor plugins — EditorPlugin, @tool scripts, custom inspectors, and dock panels","jame581\u002FGodotPrompter","jame581","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F21112138?v=4","01M6KR3KEQ9Z30WVJRR2E2ZVXE","Jan Mesarč","01M6KR3KJVRMPDSMASQPBCBVK3",964,"MIT","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Faddon-development\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31],"addon development","development","tool","panels","custom","use","EditorPlugin","editor","scripts","plugins","godot","@Tool","when","2026-11-10 10:12:30",false,"---\nname: addon-development\ndescription: Use when creating Godot editor plugins — EditorPlugin, @tool scripts, custom inspectors, and dock panels\n---\n\n# Addon Development in Godot 4.3+\n\nEditor plugins extend the Godot editor itself: custom node types, inspector panels, dock widgets, 3D gizmos, and toolbar buttons. All examples target Godot 4.3+ with no deprecated APIs.\n\n> **Related skills:** **resource-pattern** for custom Resource editors, **godot-ui** for editor panel UI, **csharp-godot** for C# plugin development.\n\n---\n\n## 1. Plugin Structure\n\nEvery plugin lives inside `addons\u002F` at the project root. Godot discovers plugins by scanning for `plugin.cfg` files.\n\n```\nres:\u002F\u002F\n└── addons\u002F\n    └── my_plugin\u002F\n        ├── plugin.cfg          # required — plugin metadata\n        ├── plugin.gd           # main EditorPlugin script (named in plugin.cfg)\n        ├── my_inspector.gd     # optional — EditorInspectorPlugin\n        ├── my_dock.tscn        # optional — dock panel scene\n        └── icons\u002F\n            └── my_node.svg     # optional — custom node icons\n```\n\n`plugin.cfg` is a plain INI file. Godot reads it when scanning `addons\u002F`. The `script` key must point to the main plugin script relative to the plugin folder.\n\nEnable the plugin: **Project → Project Settings → Plugins** (**Project Settings → Addons → Plugins** on 4.8) → tick the checkbox next to your plugin name.\n\n---\n\n## 2. @tool Annotation\n\n`@tool` makes a GDScript (or its C# equivalent) run inside the editor process as well as at runtime. Without it, the script only runs when the game is playing.\n\n### GDScript\n\n```gdscript\n@tool\nextends Sprite2D\n\n# Engine.is_editor_hint() is true when running inside the editor,\n# false during a running game. Use it to guard editor-only logic.\nfunc _process(delta: float) -> void:\n    if Engine.is_editor_hint():\n        # This block runs in the editor viewport — safe to call editor APIs.\n        update_configuration_warnings()\n    else:\n        # Normal game logic here.\n        pass\n\n\n# _get_configuration_warnings() returns an array of strings shown as\n# yellow warning icons on the node in the Scene panel.\nfunc _get_configuration_warnings() -> PackedStringArray:\n    var warnings := PackedStringArray()\n    if texture == null:\n        warnings.append(\"Texture is not set. Assign a Texture2D in the Inspector.\")\n    return warnings\n```\n\n### C#\n\n```csharp\nusing Godot;\n\n[Tool]\npublic partial class MyToolSprite : Sprite2D\n{\n    public override void _Process(double delta)\n    {\n        if (Engine.IsEditorHint())\n        {\n            \u002F\u002F Editor-only logic. EditorInterface and other GodotSharpEditor types\n            \u002F\u002F exist only in the editor build — wrap them in #if TOOLS.\n            UpdateConfigurationWarnings();\n        }\n        else\n        {\n            \u002F\u002F Normal game logic.\n        }\n    }\n\n    public override string[] _GetConfigurationWarnings()\n    {\n        if (Texture == null)\n            return new[] { \"Texture is not set. Assign a Texture2D in the Inspector.\" };\n        return System.Array.Empty\u003Cstring>();\n    }\n}\n```\n\n> `TOOLS` is defined only in editor builds, so `#if TOOLS` removes a class from exported games: use it for editor-only classes (`EditorPlugin`, inspector plugins), never for a `[Tool]` node that also runs in the game. Exports include `@tool` scripts like any other script unless the preset's filters exclude them.\n\n**Key rules:**\n- Add `@tool` \u002F `[Tool]` at the top of every script that needs editor access.\n- Always guard runtime-only code with `Engine.is_editor_hint()` to avoid crashing the editor when processing begins before the scene is fully loaded.\n- Call `update_configuration_warnings()` whenever a property changes that might affect the warning state.\n\n---\n\n## 3. EditorPlugin Base\n\nThe main plugin script extends `EditorPlugin`. Godot calls `_enter_tree()` when the plugin is enabled and `_exit_tree()` when it is disabled or the project is closed. **Everything added in `_enter_tree()` must be removed in `_exit_tree()`.**\n\n### GDScript\n\n```gdscript\n# plugin.gd\n@tool\nextends EditorPlugin\n\n\nfunc _enter_tree() -> void:\n    # Register a custom node type. The editor shows MyNode in the\n    # \"Add Node\" dialog under the chosen base class, with a custom icon.\n    add_custom_type(\n        \"MyNode\",                              # name shown in editor\n        \"Node2D\",                              # base class to extend\n        preload(\"res:\u002F\u002Faddons\u002Fmy_plugin\u002Fmy_node.gd\"),\n        preload(\"res:\u002F\u002Faddons\u002Fmy_plugin\u002Ficons\u002Fmy_node.svg\")\n    )\n\n    # Add a menu item under Project > Tools.\n    add_tool_menu_item(\"My Plugin Action\", _on_tool_menu_item)\n\n\nfunc _exit_tree() -> void:\n    remove_custom_type(\"MyNode\")\n    remove_tool_menu_item(\"My Plugin Action\")\n\n\nfunc _on_tool_menu_item() -> void:\n    print(\"My Plugin Action triggered\")\n```\n\n### C#\n\n```csharp\n\u002F\u002F Plugin.cs\n#if TOOLS\nusing Godot;\n\n[Tool]\npublic partial class MyPlugin : EditorPlugin\n{\n    public override void _EnterTree()\n    {\n        AddCustomType(\n            \"MyNode\",\n            \"Node2D\",\n            GD.Load\u003CScript>(\"res:\u002F\u002Faddons\u002Fmy_plugin\u002FMyNode.cs\"),\n            GD.Load\u003CTexture2D>(\"res:\u002F\u002Faddons\u002Fmy_plugin\u002Ficons\u002Fmy_node.svg\")\n        );\n\n        AddToolMenuItem(\"My Plugin Action\", new Callable(this, MethodName.OnToolMenuAction));\n    }\n\n    public override void _ExitTree()\n    {\n        RemoveCustomType(\"MyNode\");\n        RemoveToolMenuItem(\"My Plugin Action\");\n    }\n\n    private void OnToolMenuAction()\n    {\n        GD.Print(\"My Plugin Action triggered\");\n    }\n}\n#endif\n```\n\n**add_custom_type parameters:**\n\n| Parameter | Description |\n|---|---|\n| `name` | The name shown in the Add Node dialog |\n| `base` | String name of the Godot base class |\n| `script` | The GDScript \u002F C# script resource |\n| `icon` | A `Texture2D`, typically a 16×16 SVG |\n\n**add_tool_menu_item** adds an entry under **Project → Tools** in the top menu bar. Pass a `Callable` that takes no arguments.\n\n### Unsaved-State & Script Editor Control (Godot 4.7+)\n\nGodot 4.7 adds file-management APIs useful for build\u002Fexport tooling — check for unsaved work before running an action, or refresh scripts changed by an external tool.\n\n```gdscript\nfunc _run_pre_build_check() -> void:\n    var unsaved_scenes := EditorInterface.get_unsaved_scenes()  # PackedStringArray of scene paths\n    var script_editor := EditorInterface.get_script_editor()\n    var unsaved_files := script_editor.get_unsaved_files()      # PackedStringArray of script paths\n    if not unsaved_scenes.is_empty() or not unsaved_files.is_empty():\n        push_warning(\"Unsaved work detected — save before building.\")\n\n    script_editor.save_all_scripts()   # saves every open script\n    script_editor.reload_open_files()  # re-read files changed outside the editor\n    # Closes the tab, discarding unsaved changes; OK or ERR_FILE_NOT_FOUND.\n    var err := script_editor.close_file(\"res:\u002F\u002Faddons\u002Fmy_plugin\u002Fgenerated.gd\")\n```\n\n```csharp\n#if TOOLS\nprivate void RunPreBuildCheck()\n{\n    string[] unsavedScenes = EditorInterface.Singleton.GetUnsavedScenes();\n    var scriptEditor = EditorInterface.Singleton.GetScriptEditor();\n    string[] unsavedFiles = scriptEditor.GetUnsavedFiles();\n    if (unsavedScenes.Length > 0 || unsavedFiles.Length > 0)\n        GD.PushWarning(\"Unsaved work detected — save before building.\");\n\n    scriptEditor.SaveAllScripts();\n    scriptEditor.ReloadOpenFiles();\n    Error err = scriptEditor.CloseFile(\"res:\u002F\u002Faddons\u002Fmy_plugin\u002FGenerated.cs\");\n}\n#endif\n```\n\n---\n\n## 4. Custom Inspector Plugin\n\nWhen you want a custom widget for an exported property of a specific type, register an `EditorInspectorPlugin` from your main `EditorPlugin`. The inspector plugin overrides `_can_handle` to opt in and `_parse_property` (or `_parse_begin`) to inject custom widgets. Pair with an `EditorProperty` subclass for the actual UI.\n\n> See [references\u002Finspector-plugins.md](references\u002Finspector-plugins.md) for the full GDScript and C# scaffold (custom inspector + EditorProperty + registration boilerplate).\n\n> **Godot 4.7+:** the static `EditorInspector.create_default_inspector(filter_line_edit: LineEdit = null)` returns an inspector with the same configuration as the editor's Inspector dock, ready to embed in plugin UIs — pass a `LineEdit` for live property filtering (see [references\u002Finspector-plugins.md](references\u002Finspector-plugins.md)). `EditorContextMenuPlugin` also gains `CONTEXT_SLOT_INSPECTOR_PROPERTY` in `ContextMenuSlot`, so context-menu plugins can extend the inspector property right-click menu: `_popup_menu()` receives `[object ID, property name]` and the option callback receives the `EditorProperty` directly.\n\n> **Changed in Godot 4.8:** `_popup_menu()` is deprecated; override `_get_menu_options(data: Dictionary[StringName, Variant])`, whose item callbacks receive the same dictionary. For the inspector slot it holds `&\"property\"` (the `EditorProperty`), `&\"object\"` (the edited object) and `&\"property_name\"`. 4.8 calls both methods, so a plugin that also supports 4.7 returns early from `_popup_menu` on 4.8 (keys for every slot and the cross-version scaffold: [references\u002Finspector-plugins.md](references\u002Finspector-plugins.md)).\n\n---\n\n## 5. Custom Dock Panel\n\nAdd a custom dock to the editor by calling `add_control_to_dock(slot, control)` from your `EditorPlugin._enter_tree`. Free the control on `_exit_tree`. Useful for project-wide tooling UIs (level browser, asset summary, build dashboard).\n\n> **Godot 4.6+:** `add_control_to_dock` is deprecated; wrap your control in an `EditorDock` and call `add_dock(dock)`, then `remove_dock(dock)` on exit. `add_dock` does not exist in 4.3 to 4.5, where `add_control_to_dock` is the only option, so a plugin that supports both guards on the version (see [references\u002Fdock-panels.md](references\u002Fdock-panels.md)).\n\n> **Changed in Godot 4.8:** main screens are docks. `_has_main_screen()` and `_get_plugin_icon()` are deprecated: add an `EditorDock` (still experimental) with `default_slot = EditorDock.DOCK_SLOT_MAIN_SCREEN`. `EditorInterface.get_editor_main_screen()` no longer returns the real main screen; a legacy main-screen plugin works only if it adds its panel there from `_enter_tree()`. Scaffold for 4.3 to 4.8 in [references\u002Fdock-panels.md](references\u002Fdock-panels.md).\n\n> See [references\u002Fdock-panels.md](references\u002Fdock-panels.md) for the full GDScript and C# dock scaffold.\n\n---\n\n## 6. Custom Resource Editors\n\n`EditorResourcePicker` lets you constrain a property to a specific Resource subclass with a tooltip and base-type filter. `EditorResourcePreviewGenerator` provides custom thumbnails for resources in the FileSystem dock and Inspector.\n\n> See [references\u002Finspector-plugins.md](references\u002Finspector-plugins.md) for the full GDScript and C# `EditorResourcePicker` and `EditorResourcePreviewGenerator` scaffolds.\n\n---\n\n## 7. Gizmos\n\n`EditorNode3DGizmoPlugin` adds visual handles for 3D nodes in the editor — wireframe shapes, draggable handles, rotation rings. Implement `_init` (materials), `_get_gizmo_name`, `_has_gizmo`, `_redraw` (draw lines\u002Fhandles), and `_get_handle_value` \u002F `_set_handle` \u002F `_commit_handle` for interactive editing.\n\n> See [references\u002Fgizmos-deep-dive.md](references\u002Fgizmos-deep-dive.md) for the full GDScript and C# gizmo plugin (with undo\u002Fredo wiring for handle commits).\n\n> **Godot 4.7+:** override `_can_commit_handle_on_click() -> bool` (returns `false` if not overridden) to commit a handle action even when the final handle position is the same as the initial one — i.e. on a plain click.\n\n---\n\n## 8. Testing Plugins\n\nToggle the plugin off and on in **Project Settings → Plugins** (**Project Settings → Addons → Plugins** on 4.8) to reload it; saving a `@tool` script hot-reloads automatically, but new class registrations and dock changes need the full cycle. `print()` \u002F `push_warning()` \u002F `push_error()` go to the Output panel. **C# plugins must recompile first** — \"Unable to load addon script from path … This might be due to a code error in that script\" usually means the assembly failed to build, so check the MSBuild panel before anything else.\n\nReload recipes (GDScript + C# `PluginReloader`), console launch flags, and the lifecycle-gotcha table (orphaned docks, stale custom types, double-registered inspector plugins): [references\u002Ftesting-plugins.md](references\u002Ftesting-plugins.md)\n\n---\n\n## 9. plugin.cfg Format\n\n`plugin.cfg` is a plain INI file placed at the root of the plugin folder. All five fields in the `[plugin]` section are required: the Plugins list skips a `plugin.cfg` that lacks any of them.\n\n```ini\n[plugin]\n\nname=\"My Plugin\"\ndescription=\"Adds MyNode, a custom inspector, and a dock panel to the editor.\"\nauthor=\"Your Name\"\nversion=\"1.0.0\"\nscript=\"plugin.gd\"\n```\n\n**Field reference:**\n\n| Key | Type | Description |\n|---|---|---|\n| `name` | String | Display name shown in the Plugins list (**Project Settings → Plugins**; **Project Settings → Addons → Plugins** on 4.8) |\n| `description` | String | Short summary shown in the Plugins list |\n| `author` | String | Author name or organisation |\n| `version` | String | Semantic version string (e.g. `\"1.2.0\"`) |\n| `script` | String | Path to the main `EditorPlugin` script, **relative to the plugin folder** |\n\n> There are no other standard keys in Godot 4.x `plugin.cfg`. Dependency management is handled externally (e.g., by the Asset Library or manual installation instructions).\n\n---\n\n## 10. Checklist\n\n- [ ] `addons\u002F\u003Cplugin_name>\u002Fplugin.cfg` exists with `name`, `description`, `author`, `version`, `script`\n- [ ] Main script extends `EditorPlugin` and is decorated with `@tool` (GDScript) or `[Tool]` inside `#if TOOLS` (C#)\n- [ ] Everything registered in `_enter_tree()` is unregistered in `_exit_tree()`\n- [ ] Custom node types use `add_custom_type` \u002F `remove_custom_type` with a matching icon SVG\n- [ ] `@tool` scripts guard editor-only code with `Engine.is_editor_hint()`\n- [ ] `_get_configuration_warnings()` returns non-empty array when node is misconfigured\n- [ ] Inspector plugins implement `_can_handle` to avoid handling unintended types\n- [ ] `_parse_property` returns `true` only for properties that need a custom editor\n- [ ] Dock scenes have a `Custom Minimum Size` set so the panel is usable at default dock widths\n- [ ] Dock `Control` is freed with `queue_free()` in `_exit_tree()`\n- [ ] `EditorResourcePreviewGenerator` is both added and removed via `EditorInterface.get_resource_previewer()`\n- [ ] Gizmo plugin implements `_commit_handle` with the EditorPlugin's `get_undo_redo()` (passed in) so handle drags are undoable\n- [ ] Plugin tested by full disable\u002Fenable cycle after each structural change\n- [ ] `push_error()` used instead of silent failures in all `_enter_tree` setup paths\n- [ ] C# plugin scripts wrapped in `#if TOOLS` \u002F `#endif`\n","# Addon Development in Godot 4.3+\n\nEditor plugins extend the Godot editor itself: custom node types, inspector panels, dock widgets, 3D gizmos, and toolbar buttons. All examples target Godot 4.3+ with no deprecated APIs.\n\n> **Related skills:** **resource-pattern** for custom Resource editors, **godot-ui** for editor panel UI, **csharp-godot** for C# plugin development.\n\n---\n\n## 1. Plugin Structure\n\nEvery plugin lives inside `addons\u002F` at the project root. Godot discovers plugins by scanning for `plugin.cfg` files.\n\n```\nres:\u002F\u002F\n└── addons\u002F\n    └── my_plugin\u002F\n        ├── plugin.cfg          # required — plugin metadata\n        ├── plugin.gd           # main EditorPlugin script (named in plugin.cfg)\n        ├── my_inspector.gd     # optional — EditorInspectorPlugin\n        ├── my_dock.tscn        # optional — dock panel scene\n        └── icons\u002F\n            └── my_node.svg     # optional — custom node icons\n```\n\n`plugin.cfg` is a plain INI file. Godot reads it when scanning `addons\u002F`. The `script` key must point to the main plugin script relative to the plugin folder.\n\nEnable the plugin: **Project → Project Settings → Plugins** (**Project Settings → Addons → Plugins** on 4.8) → tick the checkbox next to your plugin name.\n\n---\n\n## 2. @tool Annotation\n\n`@tool` makes a GDScript (or its C# equivalent) run inside the editor process as well as at runtime. Without it, the script only runs when the game is playing.\n\n### GDScript\n\n```gdscript\n@tool\nextends Sprite2D\n\n# Engine.is_editor_hint() is true when running inside the editor,\n# false during a running game. Use it to guard editor-only logic.\nfunc _process(delta: float) -> void:\n    if Engine.is_editor_hint():\n        # This block runs in the editor viewport — safe to call editor APIs.\n        update_configuration_warnings()\n    else:\n        # Normal game logic here.\n        pass\n\n\n# _get_configuration_warnings() returns an array of strings shown as\n# yellow warning icons on the node in the Scene panel.\nfunc _get_configuration_warnings() -> PackedStringArray:\n    var warnings := PackedStringArray()\n    if texture == null:\n        warnings.append(\"Texture is not set. Assign a Texture2D in the Inspector.\")\n    return warnings\n```\n\n### C#\n\n```csharp\nusing Godot;\n\n[Tool]\npublic partial class MyToolSprite : Sprite2D\n{\n    public override void _Process(double delta)\n    {\n        if (Engine.IsEditorHint())\n        {\n            \u002F\u002F Editor-only logic. EditorInterface and other GodotSharpEditor types\n            \u002F\u002F exist only in the editor build — wrap them in #if TOOLS.\n            UpdateConfigurationWarnings();\n        }\n        else\n        {\n            \u002F\u002F Normal game logic.\n        }\n    }\n\n    public override string[] _GetConfigurationWarnings()\n    {\n        if (Texture == null)\n            return new[] { \"Texture is not set. Assign a Texture2D in the Inspector.\" };\n        return System.Array.Empty\u003Cstring>();\n    }\n}\n```\n\n> `TOOLS` is defined only in editor builds, so `#if TOOLS` removes a class from exported games: use it for editor-only classes (`EditorPlugin`, inspector plugins), never for a `[Tool]` node that also runs in the game. Exports include `@tool` scripts like any other script unless the preset's filters exclude them.\n\n**Key rules:**\n- Add `@tool` \u002F `[Tool]` at the top of every script that needs editor access.\n- Always guard runtime-only code with `Engine.is_editor_hint()` to avoid crashing the editor when processing begins before the scene is fully loaded.\n- Call `update_configuration_warnings()` whenever a property changes that might affect the warning state.\n\n---\n\n## 3. EditorPlugin Base\n\nThe main plugin script extends `EditorPlugin`. Godot calls `_enter_tree()` when the plugin is enabled and `_exit_tree()` when it is disabled or the project is closed. **Everything added in `_enter_tree()` must be removed in `_exit_tree()`.**\n\n### GDScript\n\n```gdscript\n# plugin.gd\n@tool\nextends EditorPlugin\n\n\nfunc _enter_tree() -> void:\n    # Register a custom node type. The editor shows MyNode in the\n    # \"Add Node\" dialog under the chosen base class, with a custom icon.\n    add_custom_type(\n        \"MyNode\",                              # name shown in editor\n        \"Node2D\",                              # base class to extend\n        preload(\"res:\u002F\u002Faddons\u002Fmy_plugin\u002Fmy_node.gd\"),\n        preload(\"res:\u002F\u002Faddons\u002Fmy_plugin\u002Ficons\u002Fmy_node.svg\")\n    )\n\n    # Add a menu item under Project > Tools.\n    add_tool_menu_item(\"My Plugin Action\", _on_tool_menu_item)\n\n\nfunc _exit_tree() -> void:\n    remove_custom_type(\"MyNode\")\n    remove_tool_menu_item(\"My Plugin Action\")\n\n\nfunc _on_tool_menu_item() -> void:\n    print(\"My Plugin Action triggered\")\n```\n\n### C#\n\n```csharp\n\u002F\u002F Plugin.cs\n#if TOOLS\nusing Godot;\n\n[Tool]\npublic partial class MyPlugin : EditorPlugin\n{\n    public override void _EnterTree()\n    {\n        AddCustomType(\n            \"MyNode\",\n            \"Node2D\",\n            GD.Load\u003CScript>(\"res:\u002F\u002Faddons\u002Fmy_plugin\u002FMyNode.cs\"),\n            GD.Load\u003CTexture2D>(\"res:\u002F\u002Faddons\u002Fmy_plugin\u002Ficons\u002Fmy_node.svg\")\n        );\n\n        AddToolMenuItem(\"My Plugin Action\", new Callable(this, MethodName.OnToolMenuAction));\n    }\n\n    public override void _ExitTree()\n    {\n        RemoveCustomType(\"MyNode\");\n        RemoveToolMenuItem(\"My Plugin Action\");\n    }\n\n    private void OnToolMenuAction()\n    {\n        GD.Print(\"My Plugin Action triggered\");\n    }\n}\n#endif\n```\n\n**add_custom_type parameters:**\n\n| Parameter | Description |\n|---|---|\n| `name` | The name shown in the Add Node dialog |\n| `base` | String name of the Godot base class |\n| `script` | The GDScript \u002F C# script resource |\n| `icon` | A `Texture2D`, typically a 16×16 SVG |\n\n**add_tool_menu_item** adds an entry under **Project → Tools** in the top menu bar. Pass a `Callable` that takes no arguments.\n\n### Unsaved-State & Script Editor Control (Godot 4.7+)\n\nGodot 4.7 adds file-management APIs useful for build\u002Fexport tooling — check for unsaved work before running an action, or refresh scripts changed by an external tool.\n\n```gdscript\nfunc _run_pre_build_check() -> void:\n    var unsaved_scenes := EditorInterface.get_unsaved_scenes()  # PackedStringArray of scene paths\n    var script_editor := EditorInterface.get_script_editor()\n    var unsaved_files := script_editor.get_unsaved_files()      # PackedStringArray of script paths\n    if not unsaved_scenes.is_empty() or not unsaved_files.is_empty():\n        push_warning(\"Unsaved work detected — save before building.\")\n\n    script_editor.save_all_scripts()   # saves every open script\n    script_editor.reload_open_files()  # re-read files changed outside the editor\n    # Closes the tab, discarding unsaved changes; OK or ERR_FILE_NOT_FOUND.\n    var err := script_editor.close_file(\"res:\u002F\u002Faddons\u002Fmy_plugin\u002Fgenerated.gd\")\n```\n\n```csharp\n#if TOOLS\nprivate void RunPreBuildCheck()\n{\n    string[] unsavedScenes = EditorInterface.Singleton.GetUnsavedScenes();\n    var scriptEditor = EditorInterface.Singleton.GetScriptEditor();\n    string[] unsavedFiles = scriptEditor.GetUnsavedFiles();\n    if (unsavedScenes.Length > 0 || unsavedFiles.Length > 0)\n        GD.PushWarning(\"Unsaved work detected — save before building.\");\n\n    scriptEditor.SaveAllScripts();\n    scriptEditor.ReloadOpenFiles();\n    Error err = scriptEditor.CloseFile(\"res:\u002F\u002Faddons\u002Fmy_plugin\u002FGenerated.cs\");\n}\n#endif\n```\n\n---\n\n## 4. Custom Inspector Plugin\n\nWhen you want a custom widget for an exported property of a specific type, register an `EditorInspectorPlugin` from your main `EditorPlugin`. The inspector plugin overrides `_can_handle` to opt in and `_parse_property` (or `_parse_begin`) to inject custom widgets. Pair with an `EditorProperty` subclass for the actual UI.\n\n> See [references\u002Finspector-plugins.md](references\u002Finspector-plugins.md) for the full GDScript and C# scaffold (custom inspector + EditorProperty + registration boilerplate).\n\n> **Godot 4.7+:** the static `EditorInspector.create_default_inspector(filter_line_edit: LineEdit = null)` returns an inspector with the same configuration as the editor's Inspector dock, ready to embed in plugin UIs — pass a `LineEdit` for live property filtering (see [references\u002Finspector-plugins.md](references\u002Finspector-plugins.md)). `EditorContextMenuPlugin` also gains `CONTEXT_SLOT_INSPECTOR_PROPERTY` in `ContextMenuSlot`, so context-menu plugins can extend the inspector property right-click menu: `_popup_menu()` receives `[object ID, property name]` and the option callback receives the `EditorProperty` directly.\n\n> **Changed in Godot 4.8:** `_popup_menu()` is deprecated; override `_get_menu_options(data: Dictionary[StringName, Variant])`, whose item callbacks receive the same dictionary. For the inspector slot it holds `&\"property\"` (the `EditorProperty`), `&\"object\"` (the edited object) and `&\"property_name\"`. 4.8 calls both methods, so a plugin that also supports 4.7 returns early from `_popup_menu` on 4.8 (keys for every slot and the cross-version scaffold: [references\u002Finspector-plugins.md](references\u002Finspector-plugins.md)).\n\n---\n\n## 5. Custom Dock Panel\n\nAdd a custom dock to the editor by calling `add_control_to_dock(slot, control)` from your `EditorPlugin._enter_tree`. Free the control on `_exit_tree`. Useful for project-wide tooling UIs (level browser, asset summary, build dashboard).\n\n> **Godot 4.6+:** `add_control_to_dock` is deprecated; wrap your control in an `EditorDock` and call `add_dock(dock)`, then `remove_dock(dock)` on exit. `add_dock` does not exist in 4.3 to 4.5, where `add_control_to_dock` is the only option, so a plugin that supports both guards on the version (see [references\u002Fdock-panels.md](references\u002Fdock-panels.md)).\n\n> **Changed in Godot 4.8:** main screens are docks. `_has_main_screen()` and `_get_plugin_icon()` are deprecated: add an `EditorDock` (still experimental) with `default_slot = EditorDock.DOCK_SLOT_MAIN_SCREEN`. `EditorInterface.get_editor_main_screen()` no longer returns the real main screen; a legacy main-screen plugin works only if it adds its panel there from `_enter_tree()`. Scaffold for 4.3 to 4.8 in [references\u002Fdock-panels.md](references\u002Fdock-panels.md).\n\n> See [references\u002Fdock-panels.md](references\u002Fdock-panels.md) for the full GDScript and C# dock scaffold.\n\n---\n\n## 6. Custom Resource Editors\n\n`EditorResourcePicker` lets you constrain a property to a specific Resource subclass with a tooltip and base-type filter. `EditorResourcePreviewGenerator` provides custom thumbnails for resources in the FileSystem dock and Inspector.\n\n> See [references\u002Finspector-plugins.md](references\u002Finspector-plugins.md) for the full GDScript and C# `EditorResourcePicker` and `EditorResourcePreviewGenerator` scaffolds.\n\n---\n\n## 7. Gizmos\n\n`EditorNode3DGizmoPlugin` adds visual handles for 3D nodes in the editor — wireframe shapes, draggable handles, rotation rings. Implement `_init` (materials), `_get_gizmo_name`, `_has_gizmo`, `_redraw` (draw lines\u002Fhandles), and `_get_handle_value` \u002F `_set_handle` \u002F `_commit_handle` for interactive editing.\n\n> See [references\u002Fgizmos-deep-dive.md](references\u002Fgizmos-deep-dive.md) for the full GDScript and C# gizmo plugin (with undo\u002Fredo wiring for handle commits).\n\n> **Godot 4.7+:** override `_can_commit_handle_on_click() -> bool` (returns `false` if not overridden) to commit a handle action even when the final handle position is the same as the initial one — i.e. on a plain click.\n\n---\n\n## 8. Testing Plugins\n\nToggle the plugin off and on in **Project Settings → Plugins** (**Project Settings → Addons → Plugins** on 4.8) to reload it; saving a `@tool` script hot-reloads automatically, but new class registrations and dock changes need the full cycle. `print()` \u002F `push_warning()` \u002F `push_error()` go to the Output panel. **C# plugins must recompile first** — \"Unable to load addon script from path … This might be due to a code error in that script\" usually means the assembly failed to build, so check the MSBuild panel before anything else.\n\nReload recipes (GDScript + C# `PluginReloader`), console launch flags, and the lifecycle-gotcha table (orphaned docks, stale custom types, double-registered inspector plugins): [references\u002Ftesting-plugins.md](references\u002Ftesting-plugins.md)\n\n---\n\n## 9. plugin.cfg Format\n\n`plugin.cfg` is a plain INI file placed at the root of the plugin folder. All five fields in the `[plugin]` section are required: the Plugins list skips a `plugin.cfg` that lacks any of them.\n\n```ini\n[plugin]\n\nname=\"My Plugin\"\ndescription=\"Adds MyNode, a custom inspector, and a dock panel to the editor.\"\nauthor=\"Your Name\"\nversion=\"1.0.0\"\nscript=\"plugin.gd\"\n```\n\n**Field reference:**\n\n| Key | Type | Description |\n|---|---|---|\n| `name` | String | Display name shown in the Plugins list (**Project Settings → Plugins**; **Project Settings → Addons → Plugins** on 4.8) |\n| `description` | String | Short summary shown in the Plugins list |\n| `author` | String | Author name or organisation |\n| `version` | String | Semantic version string (e.g. `\"1.2.0\"`) |\n| `script` | String | Path to the main `EditorPlugin` script, **relative to the plugin folder** |\n\n> There are no other standard keys in Godot 4.x `plugin.cfg`. Dependency management is handled externally (e.g., by the Asset Library or manual installation instructions).\n\n---\n\n## 10. Checklist\n\n- [ ] `addons\u002F\u003Cplugin_name>\u002Fplugin.cfg` exists with `name`, `description`, `author`, `version`, `script`\n- [ ] Main script extends `EditorPlugin` and is decorated with `@tool` (GDScript) or `[Tool]` inside `#if TOOLS` (C#)\n- [ ] Everything registered in `_enter_tree()` is unregistered in `_exit_tree()`\n- [ ] Custom node types use `add_custom_type` \u002F `remove_custom_type` with a matching icon SVG\n- [ ] `@tool` scripts guard editor-only code with `Engine.is_editor_hint()`\n- [ ] `_get_configuration_warnings()` returns non-empty array when node is misconfigured\n- [ ] Inspector plugins implement `_can_handle` to avoid handling unintended types\n- [ ] `_parse_property` returns `true` only for properties that need a custom editor\n- [ ] Dock scenes have a `Custom Minimum Size` set so the panel is usable at default dock widths\n- [ ] Dock `Control` is freed with `queue_free()` in `_exit_tree()`\n- [ ] `EditorResourcePreviewGenerator` is both added and removed via `EditorInterface.get_resource_previewer()`\n- [ ] Gizmo plugin implements `_commit_handle` with the EditorPlugin's `get_undo_redo()` (passed in) so handle drags are undoable\n- [ ] Plugin tested by full disable\u002Fenable cycle after each structural change\n- [ ] `push_error()` used instead of silent failures in all `_enter_tree` setup paths\n- [ ] C# plugin scripts wrapped in `#if TOOLS` \u002F `#endif`\n",{"name":5,"description":7},"master","60c28fdc40706a24576731e9fb3508b9c95258ad","skills\u002Faddon-development",63,"https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter","https:\u002F\u002Fgithub.com\u002Fjame581","https:\u002F\u002Fjanmesarc.online\u002F","Software engineer. My biggest passion is game development.","2026-11-14 20:45:49",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add jame581\u002FGodotPrompter --skill addon-development",{"tool":52,"command":53},"bunx","bunx skills add jame581\u002FGodotPrompter --skill addon-development",{"tool":55,"command":56},"pnpm","pnpm dlx skills add jame581\u002FGodotPrompter --skill addon-development","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Faddon-development\u002FSKILL.md",true,[60,66,70,74],{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},"references\u002Fdock-panels.md","REFERENCE","参考文档",9829,"https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Faddon-development\u002Freferences\u002Fdock-panels.md",{"path":67,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":68,"sourceHtmlUrl":69},"references\u002Fgizmos-deep-dive.md",7673,"https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Faddon-development\u002Freferences\u002Fgizmos-deep-dive.md",{"path":71,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Finspector-plugins.md",14224,"https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Faddon-development\u002Freferences\u002Finspector-plugins.md",{"path":75,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Ftesting-plugins.md",4382,"https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Faddon-development\u002Freferences\u002Ftesting-plugins.md",[79,97,118,148,171,189],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":32},"01M6KRFE5BR2PSD08ZKDAS66R7","xr-development","Use when building VR\u002FAR\u002FXR applications — OpenXR setup, XROrigin3D, hand tracking, controllers, passthrough, and Meta Quest deployment in Godot 4.3+","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Fxr-development\u002FSKILL.md",[],[86,20,31,87,29,88,89,90,91,92,93,24,94,95,96],"xr development","deployment","vr","setup","tracking","godot 4","ar","hand","Meta","applications","quest",{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":32},"01M6KRF8GZTG1TAS506MFBSGFC","web-services","Use when a Godot game calls a web server — HTTPRequest, downloads, REST\u002FJSON APIs, auth headers, WebSocketPeer clients, TLS, retries, and keeping secrets out of the build. Not for game networking\u002FRPCs (multiplayer-basics) or browser export (web-export)","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Fweb-services\u002FSKILL.md",[],[104,105,106,107,108,109,110,111,24,31,29,112,113,114,115,116,117],"web services","web","services","tls","retries","calling","auth","downloads","clients","headers","secrets","json","build","REST",{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":129,"publishedAt":32},"01M6KRF38Q4WSKAYFS56PG87T0","web-export","Use when shipping a Godot game to the browser — Web export preset options, threads vs no-threads and COOP\u002FCOEP headers, hosting on itch.io or your own server, PWA, JavaScriptBridge, user:\u002F\u002F persistence, audio and input limits, and load size","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Fweb-export\u002FSKILL.md",[124],{"categoryNo":125,"categoryName":126,"taxonomyType":127,"taxonomyTypeDesc":128},"01JBSEEDCAT000000000000016","图像与多媒体","SCENARIO","使用场景",[105,130,131,132,133,134,135,136,113,137,138,31,139,140,141,142,143,144,24,145,146,147],"export","web export","threads","limits","shipping","size","options","hosting","input","Coop","preset","browser","game","io","load","pwa","Audio","server",{"skillNo":149,"name":150,"nameZh":6,"description":151,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":152,"categories":153,"keywords":162,"publishedAt":32},"01M6KREYFETEBH62ZTN6EZH2X3","using-godot-prompter","Bootstrap skill — establishes how to find and use GodotPrompter skills, with platform-specific tool mapping","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Fusing-godot-prompter\u002FSKILL.md",[154,157],{"categoryNo":155,"categoryName":156,"taxonomyType":127,"taxonomyTypeDesc":128},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":158,"categoryName":159,"taxonomyType":160,"taxonomyTypeDesc":161},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",[29,163,164,165,166,24,21,167,168,169,170],"using godot prompter","find","with","bootstrap","platform","mapping","how","how to",{"skillNo":172,"name":173,"nameZh":6,"description":174,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":175,"categories":176,"keywords":177,"publishedAt":32},"01M6KRER5G7EQWKGAFN8QJKQ69","tween-animation","Use when implementing tweens — property animation, method tweening, chaining, parallel sequences, easing, and common UI\u002Fgameplay motion recipes","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Ftween-animation\u002FSKILL.md",[],[178,179,24,180,181,182,183,184,185,186,187,31,188],"tween animation","Animation","motion","parallel","gameplay","chaining","ui","recipes","common","implementing","sequences",{"skillNo":190,"name":191,"nameZh":6,"description":192,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":193,"categories":194,"keywords":195,"publishedAt":32},"01M6KREKGCQMVDV8WX7HWX8BZG","state-machine","Use when building a state machine or refactoring logic into one — enum, node, and resource-based FSM patterns with trade-offs. Not for adding states to an existing one","https:\u002F\u002Fgithub.com\u002Fjame581\u002FGodotPrompter\u002Fblob\u002Fmaster\u002Fskills\u002Fstate-machine\u002FSKILL.md",[],[196,197,198,29,31,199,200,201,202,203,165,24,187,204],"state","state machine","machine","patterns","node","fsm","state machines","trade","trade-offs"]