EditorCommandPalette

Inherits: ConfirmationDialog < AcceptDialog < Window < Viewport < Node < Object

Godot editor’s command palette.

Description

Object that holds all the available Commands and their shortcuts text. These Commands can be accessed through Editor > Command Palette menu.

Command key names use slash delimiters to distinguish sections, for example: "example/command1" then example will be the section name.

GDScriptC#

  1. var command_palette = EditorInterface.get_command_palette()
  2. # external_command is a function that will be called with the command is executed.
  3. var command_callable = Callable(self, "external_command").bind(arguments)
  4. command_palette.add_command("command", "test/command",command_callable)
  1. EditorCommandPalette commandPalette = EditorInterface.Singleton.GetCommandPalette();
  2. // ExternalCommand is a function that will be called with the command is executed.
  3. Callable commandCallable = new Callable(this, MethodName.ExternalCommand);
  4. commandPalette.AddCommand("command", "test/command", commandCallable)

Note: This class shouldn’t be instantiated directly. Instead, access the singleton using EditorInterface.get_command_palette.

Properties

bool

dialog_hide_on_ok

false (overrides AcceptDialog)

Methods

void

add_command ( String command_name, String key_name, Callable binded_callable, String shortcut_text=”None” )

void

remove_command ( String key_name )


Method Descriptions

void add_command ( String command_name, String key_name, Callable binded_callable, String shortcut_text=”None” )

Adds a custom command to EditorCommandPalette.

  • command_name: String (Name of the Command. This is displayed to the user.)

  • key_name: String (Name of the key for a particular Command. This is used to uniquely identify the Command.)

  • binded_callable: Callable (Callable of the Command. This will be executed when the Command is selected.)

  • shortcut_text: String (Shortcut text of the Command if available.)


void remove_command ( String key_name )

Removes the custom command from EditorCommandPalette.

  • key_name: String (Name of the key for a particular Command.)

Previous Next


© Copyright 2014-present Juan Linietsky, Ariel Manzur and the Godot community (CC BY 3.0). Revision 53e837c6.

Built with Sphinx using a theme provided by Read the Docs.