reckfellENGINE

EditorContextMenuPlugin

Plugin for adding custom context menus in the editor.

On this page
class EditorContextMenuPluginReckfellSharpEditorInherits RefCounted

Plugin for adding custom context menus in the editor.

EditorContextMenuPlugin allows for the addition of custom options in the editor's context menu. Register them with EditorPlugin.AddContextMenuPlugin. See EditorContextMenuPlugin.ContextMenuSlot for the list of available areas where context menu plugins are supported.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

EditorContextMenuPluginConstructor
# EditorContextMenuPlugin
C#
public EditorContextMenuPlugin();

Methods6

AddContextMenuItemvoid
# AddContextMenuItem
C#
public void AddContextMenuItem(string name, Callable callback, Texture2D icon = null);

Add custom option to the context menu of the plugin's specified slot. callback should be a method that takes a single argument of type Reckfell.Collections.Dictionary. It will be called when the option is activated and the data received in the callback is the same as in EditorContextMenuPlugin._GetMenuOptions.

If you want to assign shortcut to the menu item, use EditorContextMenuPlugin.AddContextMenuItemFromShortcut instead.

Parameters
NameTypeDefault
namestring—
callbackCallable—
iconTexture2Dnull
AddContextMenuItemFromShortcutvoid
# AddContextMenuItemFromShortcut
C#
public void AddContextMenuItemFromShortcut(string name, Shortcut shortcut, Texture2D icon = null);

Add custom option to the context menu of the plugin's specified slot. The option will have the shortcut assigned and reuse its callback. The shortcut has to be registered beforehand with EditorContextMenuPlugin.AddMenuShortcut.

Parameters
NameTypeDefault
namestring—
shortcutShortcut—
iconTexture2Dnull
AddContextSubmenuItemvoid
# AddContextSubmenuItem
C#
public void AddContextSubmenuItem(string name, PopupMenu menu, Texture2D icon = null);

Add a submenu to the context menu of the plugin's specified slot. The submenu is not automatically handled, you need to connect to its signals yourself. Also the submenu is freed on every popup, so provide a new PopupMenu every time.

Parameters
NameTypeDefault
namestring—
menuPopupMenu—
iconTexture2Dnull
AddMenuShortcutvoid
# AddMenuShortcut
C#
public void AddMenuShortcut(Shortcut shortcut, Callable callback);

Registers a shortcut associated with the plugin's context menu. This method should be called once (e.g. in the plugin's Object._init). callback will be called when user presses the specified shortcut while the menu's context is in effect (e.g. Content Browser is focused). Callback should take single data Reckfell.Collections.Dictionary, same as in EditorContextMenuPlugin.AddContextMenuItem.

Parameters
NameTypeDefault
shortcutShortcut—
callbackCallable—
_GetMenuOptionsvoid
# _GetMenuOptions
C#
public virtual void _GetMenuOptions(Reckfell.Collections.Dictionary<StringName, Variant> data);

Called when creating a context menu, custom options can be added by using the EditorContextMenuPlugin.AddContextMenuItem or EditorContextMenuPlugin.AddContextMenuItemFromShortcut functions. data contains the context data, which differs depending on the context menu slot. See the descriptions of EditorContextMenuPlugin.ContextMenuSlot for more information.

Parameters
NameTypeDefault
dataReckfell.Collections.Dictionary<StringName, Variant>—
_PopupMenuvoid · Deprecated
# _PopupMenu
C#
public virtual void _PopupMenu(string[] paths);

Note: Implementing this method makes the shortcut callbacks receive legacy data (for compatibility reasons).

Parameters
NameTypeDefault
pathsstring[]—

EditorContextMenuPlugin.ContextMenuSlot

ValueDescription
Filesystem = 1

Context menu of Content Browser. The data Reckfell.Collections.Dictionary contains: &"selected_files": PackedStringArray - The list of selected files.

FilesystemCreate = 3

The "Create..." submenu of Content Browser's context menu, or the "New" section of the main context menu when empty space is clicked. The data Reckfell.Collections.Dictionary contains: &"base_directory": String - Path to the base directory where a file should be created. &"needs_prefix": bool - Whether the option needs a "New" prefix (for consistency with native options).

InspectorProperty = 7

Context menu of an editor property in the inspector. The data Reckfell.Collections.Dictionary contains: &"property": EditorProperty - The clicked EditorProperty object. &"object": Object - The object edited by the inspector. &"property_name": StringName - The name of the object's property that was clicked.

SceneTabs = 5

Context menu of scene tabs. The data Reckfell.Collections.Dictionary contains: &"selected_scene": String - Scene path of the selected/clicked scene tab. Empty if empty space was clicked.

SceneTree = 0

Context menu of Scene dock. The data Reckfell.Collections.Dictionary contains: &"selected_nodes": Array[Entity](/en/docs/api/entity) - The list of currently selected nodes (same as EditorSelection.GetTopSelectedEntities).

ScriptEditor = 2

Context menu of Script editor's script tabs and Shader editor's shader tabs. The data Reckfell.Collections.Dictionary contains: &"selected_resource": Resource - The currently selected resource. Can be a Script, a Shader, a text file, or null in case of help pages. &"path": String - The path of the selected file. If a help page is selected, the path will be the name of the opened class, prefixed with help:.

ScriptEditorCode = 4

Context menu of Script editor's code editor. The data Reckfell.Collections.Dictionary contains: &"code_edit": CodeEdit - The code editor instance. &"file_path": String - Path to the currently edited file.

Slot2DEditor = 6

Context menu of the 2D editor's viewport. The data Reckfell.Collections.Dictionary contains: &"hovered_nodes": Array[CanvasItem](/en/docs/api/canvasitem) - The CanvasItem nodes under the cursor. &"mouse_position": Vector2 - The local mouse position in the 2D scene.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.