EditorPlugin
Used by the editor to extend its functionality.
Used by the editor to extend its functionality.
Plugins are used by the editor to extend functionality. The most common types of plugins are those which edit a given node or resource type, import plugins and export plugins. See also EditorScript to add functions to the editor.
Note: Some names in this class contain "left" or "right" (e.g. EditorPlugin.DockSlot.LeftUl). These APIs assume left-to-right layout, and would be backwards when using right-to-left layout. These names are kept for compatibility reasons.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
EditorPluginConstructor
public EditorPlugin();Methods78
AddAutoloadSingletonvoid
public void AddAutoloadSingleton(string name, string path);Adds a script at path to the Autoload list as name.
| Name | Type | Default |
|---|---|---|
name | string | — |
path | string | — |
AddContextMenuPluginvoid
public void AddContextMenuPlugin(EditorContextMenuPlugin.ContextMenuSlot slot, EditorContextMenuPlugin plugin);Adds a plugin to the context menu. slot is the context menu where the plugin will be added.
Note: A plugin instance can belong only to a single context menu slot.
| Name | Type | Default |
|---|---|---|
slot | EditorContextMenuPlugin.ContextMenuSlot | — |
plugin | EditorContextMenuPlugin | — |
AddControlToBottomPanel2 overloads · Includes deprecated
public Button AddControlToBottomPanel(Control control, string title);Adds a control to the bottom panel (together with Output, Debug, Animation, etc.). Returns a reference to a button that is outside the scene tree. It's up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with EditorPlugin.RemoveControlFromBottomPanel and free it with Entity.QueueFree.
shortcut is a shortcut that, when activated, will toggle the bottom panel's visibility. The shortcut object is only set when this control is added to the bottom panel.
Note: See the default editor bottom panel shortcuts in the Editor Settings for inspiration. By convention, they all use the [kbd]Alt[/kbd] modifier.
| Name | Type | Default |
|---|---|---|
control | Control | — |
title | string | — |
Buttonpublic Button AddControlToBottomPanel(Control control, string title, Shortcut shortcut = null);Adds a control to the bottom panel (together with Output, Debug, Animation, etc.). Returns a reference to a button that is outside the scene tree. It's up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with EditorPlugin.RemoveControlFromBottomPanel and free it with Entity.QueueFree.
shortcut is a shortcut that, when activated, will toggle the bottom panel's visibility. The shortcut object is only set when this control is added to the bottom panel.
Note: See the default editor bottom panel shortcuts in the Editor Settings for inspiration. By convention, they all use the [kbd]Alt[/kbd] modifier.
| Name | Type | Default |
|---|---|---|
control | Control | — |
title | string | — |
shortcut | Shortcut | null |
ButtonAddControlToContainervoid
public void AddControlToContainer(EditorPlugin.CustomControlContainer container, Control control);Adds a custom control to a container in the editor UI.
Please remember that you have to manage the visibility of your custom controls yourself (and likely hide it after adding it).
When your plugin is deactivated, make sure to remove your custom control with EditorPlugin.RemoveControlFromContainer and free it with Entity.QueueFree.
| Name | Type | Default |
|---|---|---|
container | EditorPlugin.CustomControlContainer | — |
control | Control | — |
AddControlToDock2 overloads · Includes deprecated
public void AddControlToDock(EditorPlugin.DockSlot slot, Control control);Adds the control to a specific dock slot.
If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions.
When your plugin is deactivated, make sure to remove your custom control with EditorPlugin.RemoveControlFromDocks and free it with Entity.QueueFree.
Optionally, you can specify a shortcut parameter. When pressed, this shortcut will open and focus the dock.
| Name | Type | Default |
|---|---|---|
slot | EditorPlugin.DockSlot | — |
control | Control | — |
public void AddControlToDock(EditorPlugin.DockSlot slot, Control control, Shortcut shortcut = null);Adds the control to a specific dock slot.
If the dock is repositioned and as long as the plugin is active, the editor will save the dock position on further sessions.
When your plugin is deactivated, make sure to remove your custom control with EditorPlugin.RemoveControlFromDocks and free it with Entity.QueueFree.
Optionally, you can specify a shortcut parameter. When pressed, this shortcut will open and focus the dock.
| Name | Type | Default |
|---|---|---|
slot | EditorPlugin.DockSlot | — |
control | Control | — |
shortcut | Shortcut | null |
AddCustomTypevoid
public void AddCustomType(string type, string @base, Script script, Texture2D icon);Adds a custom type, which will appear in the list of nodes or resources.
When a given node or resource is selected, the base type will be instantiated (e.g. "Entity3D", "Control", "Resource"), then the script will be loaded and set to this object.
Note: The base type is the base engine class which this type's class hierarchy inherits, not any custom type parent classes.
You can use the virtual method EditorPlugin._Handles to check if your custom object is being edited by checking the script or using the is keyword.
During run-time, this will be a simple object with a script so this function does not need to be called then.
Note: Custom types added this way are not true classes. They are just a helper to create a node with specific script.
| Name | Type | Default |
|---|---|---|
type | string | — |
base | string | — |
script | Script | — |
icon | Texture2D | — |
AddDebuggerPluginvoid
public void AddDebuggerPlugin(EditorDebuggerPlugin script);Adds a Script as debugger plugin to the Debugger. The script must extend EditorDebuggerPlugin.
| Name | Type | Default |
|---|---|---|
script | EditorDebuggerPlugin | — |
AddDockvoid
public void AddDock(EditorDock dock);Registers an owned EditorDock with the editor dock manager. Set Title and DefaultSlot first; registering the same object twice is rejected. Disable by unregistering and freeing your panel.
| Name | Type | Default |
|---|---|---|
dock | EditorDock | — |
dockCreated EditorDock. The main-workspace example uses DefaultSlot=MainScreen.
AddEntity3DGizmoPluginvoid
public void AddEntity3DGizmoPlugin(EditorEntity3DGizmoPlugin plugin);Register a 3D gizmo handler. Keep the instance for removal. In 1.0.0 registration does not guarantee rebuilding an already open scene's gizmos; save and reopen it when needed.
| Name | Type | Default |
|---|---|---|
plugin | EditorEntity3DGizmoPlugin | — |
pluginThe EditorEntity3DGizmoPlugin instance.
AddExportPlatformvoid
public void AddExportPlatform(EditorExportPlatform platform);Registers a new EditorExportPlatform. Export platforms provides functionality of exporting to the specific platform.
| Name | Type | Default |
|---|---|---|
platform | EditorExportPlatform | — |
AddExportPluginvoid
public void AddExportPlugin(EditorExportPlugin plugin);Registers a new EditorExportPlugin. Export plugins are used to perform tasks when the project is being exported.
See EditorPlugin.AddInspectorPlugin for an example of how to register a plugin.
| Name | Type | Default |
|---|---|---|
plugin | EditorExportPlugin | — |
AddImportPluginvoid
public void AddImportPlugin(EditorImportPlugin importer, bool firstPriority = false);Register an editor resource importer. Keep its reference for removal when disabling the plugin. After the initial scan, registration schedules another scan through a deferred call.
| Name | Type | Default |
|---|---|---|
importer | EditorImportPlugin | — |
firstPriority | bool | false |
importerThe custom EditorImportPlugin instance.
firstPriorityInsert at the front of the registration list. Numerical _GetPriority() still participates in selection; false by default.
AddInspectorPluginvoid
public void AddInspectorPlugin(EditorInspectorPlugin plugin);Registers a ref-counted Inspector plugin. An already open object can need reparse/reselection: registration does not rebuild every existing property editor.
| Name | Type | Default |
|---|---|---|
plugin | EditorInspectorPlugin | — |
pluginEditorInspectorPlugin instance later passed unchanged to RemoveInspectorPlugin.
AddResourceConversionPluginvoid
public void AddResourceConversionPlugin(EditorResourceConversionPlugin plugin);Registers a new EditorResourceConversionPlugin. Resource conversion plugins are used to add custom resource converters to the editor inspector.
See EditorResourceConversionPlugin for an example of how to create a resource conversion plugin.
| Name | Type | Default |
|---|---|---|
plugin | EditorResourceConversionPlugin | — |
AddSceneFormatImporterPluginvoid
public void AddSceneFormatImporterPlugin(EditorSceneFormatImporter sceneFormatImporter, bool firstPriority = false);Registers a new EditorSceneFormatImporter. Scene importers are used to import custom 3D asset formats as scenes.
If first_priority is true, the new import plugin is inserted first in the list and takes precedence over pre-existing plugins.
| Name | Type | Default |
|---|---|---|
sceneFormatImporter | EditorSceneFormatImporter | — |
firstPriority | bool | false |
AddScenePostImportPluginvoid
public void AddScenePostImportPlugin(EditorScenePostImportPlugin sceneImportPlugin, bool firstPriority = false);Add an EditorScenePostImportPlugin. These plugins allow customizing the import process of 3D assets by adding new options to the import dialogs.
If first_priority is true, the new import plugin is inserted first in the list and takes precedence over pre-existing plugins.
| Name | Type | Default |
|---|---|---|
sceneImportPlugin | EditorScenePostImportPlugin | — |
firstPriority | bool | false |
AddToolMenuItemvoid
public void AddToolMenuItem(string name, Callable callable);Adds a command to the project tools menu. Register once on plugin entry and remove on exit. Adding the same name again does not itself replace the previous item.
| Name | Type | Default |
|---|---|---|
name | string | — |
callable | Callable | — |
nameItem name later passed to RemoveToolMenuItem. Choose a sufficiently unique name.
callableCommand handler, such as Callable.From(InspectLevel). The example only reads the edited hierarchy.
AddToolSubmenuItemvoid
public void AddToolSubmenuItem(string name, PopupMenu submenu);Adds a custom PopupMenu submenu under Project > Tools > name. Use EditorPlugin.RemoveToolMenuItem on plugin clean up to remove the menu.
| Name | Type | Default |
|---|---|---|
name | string | — |
submenu | PopupMenu | — |
AddTranslationParserPluginvoid
public void AddTranslationParserPlugin(EditorTranslationParserPlugin parser);Registers a custom translation parser plugin for extracting translatable strings from custom files.
| Name | Type | Default |
|---|---|---|
parser | EditorTranslationParserPlugin | — |
AddUndoRedoInspectorHookCallbackvoid
public void AddUndoRedoInspectorHookCallback(Callable callable);Hooks a callback into the undo/redo action creation when a property is modified in the inspector. This allows, for example, to save other properties that may be lost when a given property is modified.
The callback should have 4 arguments: ReckfellObject undo_redo, ReckfellObject modified_object, string property and Variant new_value. They are, respectively, the UndoRedo object used by the inspector, the currently modified object, the name of the modified property and the new value the property is about to take.
| Name | Type | Default |
|---|---|---|
callable | Callable | — |
GetEditorInterfaceEditorInterface · Deprecated
public EditorInterface GetEditorInterface();Returns the EditorInterface singleton instance.
EditorInterfaceGetExportAsMenuPopupMenu
public PopupMenu GetExportAsMenu();Returns the PopupMenu under Scene > Export As....
PopupMenuGetPluginVersionstring
public string GetPluginVersion();Provide the version of the plugin declared in the plugin.cfg config file.
stringGetScriptCreateDialogScriptCreateDialog
public ScriptCreateDialog GetScriptCreateDialog();Gets the Editor's dialog used for making scripts. Note: Users can configure it before use. Warning: Removing and freeing this node will render a part of the editor useless and may cause a crash.
ScriptCreateDialogGetUndoRedoEditorUndoRedoManager
public EditorUndoRedoManager GetUndoRedo();Gets the undo/redo object. Most actions in the editor can be undoable, so use this object to make sure this happens when it's worth it.
EditorUndoRedoManagerHideBottomPanelvoid
public void HideBottomPanel();Minimizes the bottom panel.
MakeBottomPanelItemVisiblevoid
public void MakeBottomPanelItemVisible(Control item);Makes a specific item in the bottom panel visible.
| Name | Type | Default |
|---|---|---|
item | Control | — |
QueueSaveLayoutvoid
public void QueueSaveLayout();Queue save the project's editor layout.
RemoveAutoloadSingletonvoid
public void RemoveAutoloadSingleton(string name);Removes an Autoload name from the list.
| Name | Type | Default |
|---|---|---|
name | string | — |
RemoveContextMenuPluginvoid
public void RemoveContextMenuPlugin(EditorContextMenuPlugin plugin);Removes the specified context menu plugin.
| Name | Type | Default |
|---|---|---|
plugin | EditorContextMenuPlugin | — |
RemoveControlFromBottomPanelvoid · Deprecated
public void RemoveControlFromBottomPanel(Control control);Removes the control from the bottom panel. You have to manually Entity.QueueFree the control.
| Name | Type | Default |
|---|---|---|
control | Control | — |
RemoveControlFromContainervoid
public void RemoveControlFromContainer(EditorPlugin.CustomControlContainer container, Control control);Removes the control from the specified container. You have to manually Entity.QueueFree the control.
| Name | Type | Default |
|---|---|---|
container | EditorPlugin.CustomControlContainer | — |
control | Control | — |
RemoveControlFromDocksvoid · Deprecated
public void RemoveControlFromDocks(Control control);Removes the control from the dock. You have to manually Entity.QueueFree the control.
| Name | Type | Default |
|---|---|---|
control | Control | — |
RemoveCustomTypevoid
public void RemoveCustomType(string type);Removes a custom type added by EditorPlugin.AddCustomType.
| Name | Type | Default |
|---|---|---|
type | string | — |
RemoveDebuggerPluginvoid
public void RemoveDebuggerPlugin(EditorDebuggerPlugin script);Removes the debugger plugin with given script from the Debugger.
| Name | Type | Default |
|---|---|---|
script | EditorDebuggerPlugin | — |
RemoveDockvoid
public void RemoveDock(EditorDock dock);Unregisters a dock and detaches it from the manager. Does not free the object: separately QueueFree a plugin-owned panel.
| Name | Type | Default |
|---|---|---|
dock | EditorDock | — |
dockThe registered panel added by your plugin. Do not remove other extensions' panels.
RemoveEntity3DGizmoPluginvoid
public void RemoveEntity3DGizmoPlugin(EditorEntity3DGizmoPlugin plugin);Unregister a handler. Pass the same instance, then release your owned reference. Do not delete user Entities.
| Name | Type | Default |
|---|---|---|
plugin | EditorEntity3DGizmoPlugin | — |
pluginThe previously registered handler.
RemoveExportPlatformvoid
public void RemoveExportPlatform(EditorExportPlatform platform);Removes an export platform registered by EditorPlugin.AddExportPlatform.
| Name | Type | Default |
|---|---|---|
platform | EditorExportPlatform | — |
RemoveExportPluginvoid
public void RemoveExportPlugin(EditorExportPlugin plugin);Removes an export plugin registered by EditorPlugin.AddExportPlugin.
| Name | Type | Default |
|---|---|---|
plugin | EditorExportPlugin | — |
RemoveImportPluginvoid
public void RemoveImportPlugin(EditorImportPlugin importer);Unregister a previously added importer. Then release your owned reference; do not delete user source files. An existing cache does not replace the importer when output must be rebuilt.
| Name | Type | Default |
|---|---|---|
importer | EditorImportPlugin | — |
importerThe same instance passed to AddImportPlugin().
RemoveInspectorPluginvoid
public void RemoveInspectorPlugin(EditorInspectorPlugin plugin);Unregisters an Inspector plugin. Does not promise to remove existing widgets from every Inspector; the example separately rebuilds its resource's main Inspector and releases its ref-counted reference.
| Name | Type | Default |
|---|---|---|
plugin | EditorInspectorPlugin | — |
pluginThe registered instance. Do not apply Entity QueueFree to a ref-counted plugin.
RemoveResourceConversionPluginvoid
public void RemoveResourceConversionPlugin(EditorResourceConversionPlugin plugin);Removes a resource conversion plugin registered by EditorPlugin.AddResourceConversionPlugin.
| Name | Type | Default |
|---|---|---|
plugin | EditorResourceConversionPlugin | — |
RemoveSceneFormatImporterPluginvoid
public void RemoveSceneFormatImporterPlugin(EditorSceneFormatImporter sceneFormatImporter);Removes a scene format importer registered by EditorPlugin.AddSceneFormatImporterPlugin.
| Name | Type | Default |
|---|---|---|
sceneFormatImporter | EditorSceneFormatImporter | — |
RemoveScenePostImportPluginvoid
public void RemoveScenePostImportPlugin(EditorScenePostImportPlugin sceneImportPlugin);Remove the EditorScenePostImportPlugin, added with EditorPlugin.AddScenePostImportPlugin.
| Name | Type | Default |
|---|---|---|
sceneImportPlugin | EditorScenePostImportPlugin | — |
RemoveToolMenuItemvoid
public void RemoveToolMenuItem(string name);Removes a custom tools item by name. Call when disabling your plugin so reenablement leaves no old commands.
| Name | Type | Default |
|---|---|---|
name | string | — |
nameThe name supplied to AddToolMenuItem.
RemoveTranslationParserPluginvoid
public void RemoveTranslationParserPlugin(EditorTranslationParserPlugin parser);Removes a custom translation parser plugin registered by EditorPlugin.AddTranslationParserPlugin.
| Name | Type | Default |
|---|---|---|
parser | EditorTranslationParserPlugin | — |
RemoveUndoRedoInspectorHookCallbackvoid
public void RemoveUndoRedoInspectorHookCallback(Callable callable);Removes a callback previously added by EditorPlugin.AddUndoRedoInspectorHookCallback.
| Name | Type | Default |
|---|---|---|
callable | Callable | — |
SetDockTabIconvoid · Deprecated
public void SetDockTabIcon(Control control, Texture2D icon);Sets the tab icon for the given control in a dock slot. Setting to null removes the icon.
| Name | Type | Default |
|---|---|---|
control | Control | — |
icon | Texture2D | — |
SetForceDrawOverForwardingEnabledvoid
public void SetForceDrawOverForwardingEnabled();Enables calling of EditorPlugin._ForwardCanvasForceDrawOverViewport for the 2D editor and EditorPlugin._Forward3DForceDrawOverViewport for the 3D editor when their viewports are updated. You need to call this method only once and it will work permanently for this plugin.
SetInputEventForwardingAlwaysEnabledvoid
public void SetInputEventForwardingAlwaysEnabled();Use this method if you always want to receive inputs from 3D view screen inside EditorPlugin._Forward3DGuiInput. It might be especially usable if your plugin will want to use raycast in the scene.
UpdateOverlaysint
public int UpdateOverlays();Updates the overlays of the 2D and 3D editor viewport. Causes methods EditorPlugin._ForwardCanvasDrawOverViewport, EditorPlugin._ForwardCanvasForceDrawOverViewport, EditorPlugin._Forward3DDrawOverViewport and EditorPlugin._Forward3DForceDrawOverViewport to be called.
int_ApplyChangesvoid
public virtual void _ApplyChanges();This method is called when the editor is about to save the project, switch to another tab, etc. It asks the plugin to apply any pending state changes to ensure consistency. This is used, for example, in shader editors to let the plugin know that it must apply the shader code being written by the user to the object.
_Buildbool
public virtual bool _Build();This method is called when the editor is about to run the project. The plugin can then perform required operations before the project runs.
This method must return a boolean. If this method returns false, the project will not run. The run is aborted immediately, so this also prevents all other plugins' EditorPlugin._Build methods from running.
bool_Clearvoid
public virtual void _Clear();Clear all the state and reset the object being edited to zero. This ensures your plugin does not keep editing a currently existing node, or a node from the wrong scene.
_DisablePluginvoid
public virtual void _DisablePlugin();Called by the engine when the user disables the EditorPlugin in the Plugin tab of the project settings window.
_Editvoid
public virtual void _Edit(ReckfellObject @object);This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object.
object can be null if the plugin was editing an object, but there is no longer any selected object handled by this plugin. It can be used to cleanup editing state.
| Name | Type | Default |
|---|---|---|
object | ReckfellObject | — |
_EnablePluginvoid
public virtual void _EnablePlugin();Called by the engine when the user enables the EditorPlugin in the Plugin tab of the project settings window.
_Forward3DDrawOverViewportvoid
public virtual void _Forward3DDrawOverViewport(Control viewportControl);Called by the engine when the 3D editor's viewport is updated. viewport_control is an overlay on top of the viewport and it can be used for drawing. You can update the viewport manually by calling EditorPlugin.UpdateOverlays.
public override void _Forward3DDrawOverViewport(Control viewportControl)
{
// Draw a circle at the cursor's position.
viewportControl.DrawCircle(viewportControl.GetLocalMousePosition(), 64, Colors.White);
}
public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D viewportCamera, InputEvent @event)
{
if (@event is InputEventMouseMotion)
{
// Redraw the viewport when the cursor is moved.
UpdateOverlays();
return EditorPlugin.AfterGuiInput.Stop;
}
return EditorPlugin.AfterGuiInput.Pass;
}| Name | Type | Default |
|---|---|---|
viewportControl | Control | — |
_Forward3DForceDrawOverViewportvoid
public virtual void _Forward3DForceDrawOverViewport(Control viewportControl);This method is the same as EditorPlugin._Forward3DDrawOverViewport, except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
You need to enable calling of this method by using EditorPlugin.SetForceDrawOverForwardingEnabled.
| Name | Type | Default |
|---|---|---|
viewportControl | Control | — |
_Forward3DGuiInputint
public virtual int _Forward3DGuiInput(Camera3D viewportCamera, InputEvent @event);Called when there is a root node in the current edited scene, EditorPlugin._Handles is implemented, and an InputEvent happens in the 3D viewport. The return value decides whether the InputEvent is consumed or forwarded to other EditorPlugins. See EditorPlugin.AfterGuiInput for options.
// Prevents the InputEvent from reaching other Editor classes.
public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D camera, InputEvent @event)
{
return EditorPlugin.AfterGuiInput.Stop;
}This method must return EditorPlugin.AfterGuiInput.Pass in order to forward the InputEvent to other Editor classes.
// Consumes InputEventMouseMotion and forwards other InputEvent types.
public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D camera, InputEvent @event)
{
return @event is InputEventMouseMotion ? EditorPlugin.AfterGuiInput.Stop : EditorPlugin.AfterGuiInput.Pass;
}| Name | Type | Default |
|---|---|---|
viewportCamera | Camera3D | — |
event | InputEvent | — |
int_ForwardCanvasDrawOverViewportvoid
public virtual void _ForwardCanvasDrawOverViewport(Control viewportControl);Called by the engine when the 2D editor's viewport is updated. viewport_control is an overlay on top of the viewport and it can be used for drawing. You can update the viewport manually by calling EditorPlugin.UpdateOverlays.
public override void _ForwardCanvasDrawOverViewport(Control viewportControl)
{
// Draw a circle at the cursor's position.
viewportControl.DrawCircle(viewportControl.GetLocalMousePosition(), 64, Colors.White);
}
public override bool _ForwardCanvasGuiInput(InputEvent @event)
{
if (@event is InputEventMouseMotion)
{
// Redraw the viewport when the cursor is moved.
UpdateOverlays();
return true;
}
return false;
}| Name | Type | Default |
|---|---|---|
viewportControl | Control | — |
_ForwardCanvasForceDrawOverViewportvoid
public virtual void _ForwardCanvasForceDrawOverViewport(Control viewportControl);This method is the same as EditorPlugin._ForwardCanvasDrawOverViewport, except it draws on top of everything. Useful when you need an extra layer that shows over anything else.
You need to enable calling of this method by using EditorPlugin.SetForceDrawOverForwardingEnabled.
| Name | Type | Default |
|---|---|---|
viewportControl | Control | — |
_ForwardCanvasGuiInputbool
public virtual bool _ForwardCanvasGuiInput(InputEvent @event);Called when there is a root node in the current edited scene, EditorPlugin._Handles is implemented, and an InputEvent happens in the 2D viewport. If this method returns true, event is intercepted by this EditorPlugin, otherwise event is forwarded to other Editor classes.
// Prevents the InputEvent from reaching other Editor classes.
public override bool ForwardCanvasGuiInput(InputEvent @event)
{
return true;
}This method must return false in order to forward the InputEvent to other Editor classes.
// Consumes InputEventMouseMotion and forwards other InputEvent types.
public override bool _ForwardCanvasGuiInput(InputEvent @event)
{
if (@event is InputEventMouseMotion)
{
return true;
}
return false;
}| Name | Type | Default |
|---|---|---|
event | InputEvent | — |
bool_GetBreakpointsstring[]
public virtual string[] _GetBreakpoints();This is for editors that edit script-based objects. You can return a list of breakpoints in the format (script:line), for example: asset://path_to_script.cs:25.
string[]_GetPluginIconTexture2D · Deprecated
public virtual Texture2D _GetPluginIcon();Override this method in your plugin to return a Texture2D in order to give it an icon.
For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", "Game", and "Asset Store" buttons.
Ideally, the plugin icon should be white with a transparent background and 16×16 pixels in size.
public override Texture2D _GetPluginIcon()
{
// You can use a custom icon:
return ResourceLoader.Load<Texture2D>("asset://addons/my_plugin/my_plugin_icon.svg");
// Or use a built-in icon:
return EditorInterface.Singleton.GetEditorTheme().GetIcon("Entity", "EditorIcons");
}Texture2D_GetPluginNamestring
public virtual string _GetPluginName();Override this method in your plugin to provide the name of the plugin when displayed in the Reckfell editor.
For main screen plugins, this appears at the top of the screen, to the right of the "2D", "3D", "Script", "Game", and "Asset Store" buttons.
Note: Main screen plugins should instead use EditorDock.Title of a main screen dock.
string_GetStateReckfell.Collections.Dictionary
public virtual Reckfell.Collections.Dictionary _GetState();Override this method to provide a state data you want to be saved, like view position, grid settings, folding, etc. This is used when saving the scene (so state is kept when opening it again) and for switching tabs (so state can be restored when the tab returns). This data is automatically saved for each scene in an editstate file in the editor metadata folder. If you want to store global (scene-independent) editor data for your plugin, you can use EditorPlugin._GetWindowLayout instead.
Use EditorPlugin._SetState to restore your saved state.
Note: This method should not be used to save important settings that should persist with the project.
Note: You must implement EditorPlugin._GetPluginName for the state to be stored and restored correctly.
Reckfell.Collections.Dictionary_GetUnsavedStatusstring
public virtual string _GetUnsavedStatus(string forScene);Override this method to provide a custom message that lists unsaved changes. The editor will call this method when exiting or when closing a scene, and display the returned string in a confirmation dialog. Return empty string if the plugin has no unsaved changes.
When closing a scene, for_scene is the path to the scene being closed. You can use it to handle built-in resources in that scene.
If the user confirms saving, EditorPlugin._SaveExternalData will be called, before closing the editor.
If the plugin has no scene-specific changes, you can ignore the calls when closing scenes:
| Name | Type | Default |
|---|---|---|
forScene | string | — |
string_GetWindowLayoutvoid
public virtual void _GetWindowLayout(ConfigFile configuration);Override this method to provide the GUI layout of the plugin or any other data you want to be stored. This is used to save the project's editor layout when EditorPlugin.QueueSaveLayout is called or the editor layout was changed (for example changing the position of a dock). The data is stored in the editor_layout.cfg file in the editor metadata directory.
Use EditorPlugin._SetWindowLayout to restore your saved layout.
| Name | Type | Default |
|---|---|---|
configuration | ConfigFile | — |
_Handlesbool
public virtual bool _Handles(ReckfellObject @object);Implement this function if your plugin edits a specific type of object (Resource or Entity). If you return true, then you will get the functions EditorPlugin._Edit and EditorPlugin._MakeVisible called when the editor requests them. If you have declared the methods EditorPlugin._ForwardCanvasGuiInput and EditorPlugin._Forward3DGuiInput these will be called too.
Note: Each plugin should handle only one type of objects at a time. If a plugin handles more types of objects and they are edited at the same time, it will result in errors.
| Name | Type | Default |
|---|---|---|
object | ReckfellObject | — |
bool_HasMainScreenbool · Deprecated
public virtual bool _HasMainScreen();Return true if this is a main screen editor plugin (it goes in the workspace selector together with 2D, 3D, Script, Game, and Asset Store).
You can add a main screen dock by using EditorDock with EditorDock.DockLayout.MainScreen as available layout.
bool_MakeVisiblevoid
public virtual void _MakeVisible(bool visible);This function will be called when the editor is requested to become visible. It is used for plugins that edit a specific object type. Remember that you have to manage the visibility of all your editor controls manually.
| Name | Type | Default |
|---|---|---|
visible | bool | — |
_RunScenestring[]
public virtual string[] _RunScene(string scene, string[] args);This function is called when an individual scene is about to be played in the editor. args is a list of command line arguments that will be passed to the new Reckfell instance, which will be replaced by the list returned by this function.
Note: Text that is printed in this method will not be visible in the editor's Output panel unless EditorSettings.run/output/always_clear_output_on_play is false.
| Name | Type | Default |
|---|---|---|
scene | string | — |
args | string[] | — |
string[]_SaveExternalDatavoid
public virtual void _SaveExternalData();This method is called after the editor saves the project or when it's closed. It asks the plugin to save edited external scenes/resources.
_SetStatevoid
public virtual void _SetState(Reckfell.Collections.Dictionary state);Restore the state saved by EditorPlugin._GetState. This method is called when the current scene tab is changed in the editor.
Note: Your plugin must implement EditorPlugin._GetPluginName, otherwise it will not be recognized and this method will not be called.
| Name | Type | Default |
|---|---|---|
state | Reckfell.Collections.Dictionary | — |
_SetWindowLayoutvoid
public virtual void _SetWindowLayout(ConfigFile configuration);Restore the plugin GUI layout and data saved by EditorPlugin._GetWindowLayout. This method is called for every plugin on editor startup. Use the provided configuration file to read your saved data.
| Name | Type | Default |
|---|---|---|
configuration | ConfigFile | — |
Signals and events6
MainScreenChangedEvent
public event EditorPlugin.MainScreenChangedEventHandler MainScreenChanged;Emitted when user changes the workspace (2D, 3D, Script, Game, Asset Store). Also works with custom screens defined by plugins.
| Name | Type | Default |
|---|---|---|
screenName | string | — |
ProjectSettingsChangedEvent · Deprecated
public event Action ProjectSettingsChanged;Emitted when any project setting has changed.
ResourceSavedEvent
public event EditorPlugin.ResourceSavedEventHandler ResourceSaved;Emitted when the given resource was saved on disc. See also EditorPlugin.SceneSaved.
| Name | Type | Default |
|---|---|---|
resource | Resource | — |
SceneChangedEvent
public event EditorPlugin.SceneChangedEventHandler SceneChanged;Emitted when the scene is changed in the editor. The argument will return the root node of the scene that has just become active. If this scene is new and empty, the argument will be null.
| Name | Type | Default |
|---|---|---|
sceneRoot | Entity | — |
SceneClosedEvent
public event EditorPlugin.SceneClosedEventHandler SceneClosed;Emitted when user closes a scene. The argument is a file path to the closed scene.
| Name | Type | Default |
|---|---|---|
filepath | string | — |
SceneSavedEvent
public event EditorPlugin.SceneSavedEventHandler SceneSaved;Emitted when a scene was saved on disc. The argument is a file path to the saved scene. See also EditorPlugin.ResourceSaved.
| Name | Type | Default |
|---|---|---|
filepath | string | — |
EditorPlugin.AfterGuiInput
| Value | Description |
|---|---|
Custom = 2 | Pass the |
Pass = 0 | Forwards the |
Stop = 1 | Prevents the |
EditorPlugin.CustomControlContainer
| Value | Description |
|---|---|
CanvasEditorBottom = 8 | Bottom panel of the 2D editor. |
CanvasEditorMenu = 5 | The toolbar that appears when 2D editor is active. |
CanvasEditorSideLeft = 6 | Left sidebar of the 2D editor. |
CanvasEditorSideRight = 7 | Right sidebar of the 2D editor. |
InspectorBottom = 9 | Bottom section of the inspector. |
ProjectSettingTabLeft = 10 | Tab of Project Settings dialog, to the left of other tabs. |
ProjectSettingTabRight = 11 | Tab of Project Settings dialog, to the right of other tabs. |
SpatialEditorBottom = 4 | Bottom panel of the 3D editor. |
SpatialEditorMenu = 1 | The toolbar that appears when 3D editor is active. |
SpatialEditorSideLeft = 2 | Left sidebar of the 3D editor. |
SpatialEditorSideRight = 3 | Right sidebar of the 3D editor. |
Toolbar = 0 | Main editor toolbar, next to play buttons. |
EditorPlugin.DockSlot
| Value | Description |
|---|---|
Bottom = 8 | Bottom panel. |
LeftBl = 1 | Dock slot, left side, bottom-left (empty in default layout). |
LeftBr = 3 | Dock slot, left side, bottom-right (in default layout includes Content Browser). |
LeftUl = 0 | Dock slot, left side, upper-left (empty in default layout). |
LeftUr = 2 | Dock slot, left side, upper-right (in default layout includes Scene and Import docks). |
Max = 9 | Represents the size of the |
None = -1 | The dock is closed. |
RightBl = 5 | Dock slot, right side, bottom-left (empty in default layout). |
RightBr = 7 | Dock slot, right side, bottom-right (empty in default layout). |
RightUl = 4 | Dock slot, right side, upper-left (in default layout includes Inspector, Entity, and History docks). |
RightUr = 6 | Dock slot, right side, upper-right (empty in default layout). |