simvx.editor.plugin¶
Plugin System – Editor plugin architecture with discovery and lifecycle.
Provides an EditorPlugin base class that third-party addons can subclass to extend the editor with custom tools, inspectors, node types, and menu items.
Plugins are discovered from the addons/ directory in the project root.
Each plugin lives in its own subdirectory with a plugin.toml manifest:
addons/
my_plugin/
plugin.toml # Manifest (name, version, script, etc.)
plugin.py # Plugin script (subclass of EditorPlugin)
...
plugin.toml format: [plugin] name = “My Plugin” description = “Does something cool” author = “Name” version = “1.0.0” script = “plugin.py” icon = “icon.png”
The @tool decorator marks a Node subclass as an editor-time script,
meaning process() and ready() run inside the editor, not just in
the game.
Module Contents¶
Classes¶
Plugin metadata loaded from plugin.toml. |
|
Base class for editor plugins. |
|
Discovers, loads, and manages editor plugins. |
Functions¶
Data¶
API¶
- simvx.editor.plugin.log¶
‘getLogger(…)’
- simvx.editor.plugin.__all__¶
[‘EditorPlugin’, ‘PluginManifest’, ‘PluginManager’, ‘tool’]
- simvx.editor.plugin.tool(cls: type) type¶
Mark a Node subclass as an editor-time tool script.
Tool scripts have their
ready(),process(dt), anddraw()methods called while the editor is running (not just during play mode).Usage: @tool class MyGizmo(Node3D): def process(self, dt): # This runs in the editor! self.rotation.y += dt * 0.5
- simvx.editor.plugin.is_tool(cls_or_instance) bool¶
Check if a class or instance is a @tool script.
- class simvx.editor.plugin.PluginManifest¶
Plugin metadata loaded from plugin.toml.
- name: str¶
‘Unnamed Plugin’
- description: str = <Multiline-String>¶
- author: str = <Multiline-String>¶
- version: str¶
‘0.0.1’
- script: str¶
‘plugin.py’
- icon: str = <Multiline-String>¶
- path: pathlib.Path¶
‘field(…)’
- classmethod load(toml_path: pathlib.Path) simvx.editor.plugin.PluginManifest | None¶
Parse a plugin.toml file.
- to_dict() dict¶
- class simvx.editor.plugin.EditorPlugin(manifest: simvx.editor.plugin.PluginManifest, editor_state: simvx.editor.state.EditorState | None = None)¶
Base class for editor plugins.
Subclass and override
activate()/deactivate()to add editor functionality. Use the provided helper methods to register menus, dock controls, custom types, etc.Example: class MyPlugin(EditorPlugin): def activate(self): self.add_tool_menu_item(“My Tool”, self._on_tool_click) self.add_custom_type(“CoolNode”, “Node3D”, “res://cool_node.py”)
def deactivate(self): self.remove_tool_menu_item("My Tool") self.remove_custom_type("CoolNode")Initialization
- activate()¶
Called when the plugin is enabled. Override to set up UI and hooks.
- deactivate()¶
Called when the plugin is disabled. Override to tear down.
Add an item to the editor’s Tools menu.
The item will appear in the Tools menu when the plugin is active. The callback is invoked when the user clicks the menu item.
Remove a previously added tool menu item.
- add_control_to_dock(dock_name: str, control: simvx.core.Control)¶
Add a control widget to an editor dock panel.
The control will be added to the named dock zone (left, right, bottom). Valid dock_name values: “left”, “right”, “bottom”.
- remove_control_from_dock(control: simvx.core.Control)¶
Remove a previously added dock control.
- add_custom_type(type_name: str, base_type: str, script_path: str = '', icon: str = '')¶
Register a custom node type in the editor’s type list.
- remove_custom_type(type_name: str)¶
Unregister a custom node type.
- add_inspector_plugin(plugin: Any)¶
Register an inspector plugin for custom property editing.
- remove_inspector_plugin(plugin: Any)¶
Unregister an inspector plugin.
- class simvx.editor.plugin.PluginManager(editor_state: simvx.editor.state.EditorState | None = None)¶
Discovers, loads, and manages editor plugins.
Scans the
addons/directory for plugin.toml manifests, loads plugin scripts, and manages activation/deactivation lifecycle.Initialization
- scan_addons(project_path: str | pathlib.Path) list[simvx.editor.plugin.PluginManifest]¶
Scan addons/ directory for plugins. Returns discovered manifests.
- load_plugin(name: str) simvx.editor.plugin.EditorPlugin | None¶
Load a plugin by manifest name. Returns the plugin instance.
- activate_plugin(name: str) bool¶
Activate a loaded plugin.
- deactivate_plugin(name: str) bool¶
Deactivate a loaded plugin.
- get_manifest(name: str) simvx.editor.plugin.PluginManifest | None¶
- get_plugin(name: str) simvx.editor.plugin.EditorPlugin | None¶
- list_manifests() list[simvx.editor.plugin.PluginManifest]¶
- list_active() list[str]¶
- get_errors() dict[str, str]¶
- deactivate_all()¶
Deactivate all active plugins.
Get all tool menu items from active plugins. Returns (plugin_name, label, callback) tuples.
- get_all_custom_types() list[tuple[str, str]]¶
Get all custom types from active plugins. Returns (plugin_name, type_name) tuples.