From cc566c548577426d7a596b00135cfc120b8b8e71 Mon Sep 17 00:00:00 2001 From: Bhuvan Vemula Date: Fri, 13 Aug 2021 14:34:01 +0530 Subject: [PATCH] `EditorCommandPalette` Documentation. --- doc/classes/EditorCommandPalette.xml | 25 +++++++++++++++++++++++++ doc/classes/EditorInterface.xml | 1 + 2 files changed, 26 insertions(+) diff --git a/doc/classes/EditorCommandPalette.xml b/doc/classes/EditorCommandPalette.xml index 743c59eec24..1d3b21255f4 100644 --- a/doc/classes/EditorCommandPalette.xml +++ b/doc/classes/EditorCommandPalette.xml @@ -1,8 +1,26 @@ + Godot editor's command palette. + Object that holds all the available Commands and their shortcuts text. These Commands can be accessed through [b]Editor > Command Palette[/b] menu. + Command key names use slash delimiters to distinguish sections Example: [code]"example/command1"[/code] then [code]example[/code] will be the section name. + [codeblocks] + [gdscript] + var command_palette = get_editor_interface().get_command_palette() + # external_command is a function that will be called with the command is executed. + var command_callable = Callable(self, "external_command").bind(arguments) + command_palette.add_command("command", "test/command",command_callable) + [/gdscript] + [csharp] + EditorCommandPalette commandPalette = GetEditorInterface().GetCommandPalette(); + // ExternalCommand is a function that will be called with the command is executed. + Callable commandCallable = new Callable(this, nameof(ExternalCommand)); + commandPalette.AddCommand("command", "test/command", commandCallable) + [/csharp] + [/codeblocks] + [b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_command_palette]. @@ -14,12 +32,19 @@ + Adds a custom command to EditorCommandPalette. + - [code]command_name[/code]: [String] (Name of the [b]Command[/b]. This is displayed to the user.) + - [code]key_name[/code]: [String] (Name of the key for a particular [b]Command[/b]. This is used to uniquely identify the [b]Command[/b].) + - [code]binded_callable[/code]: [Callable] (Callable of the [b]Command[/b]. This will be executed when the [b]Command[/b] is selected.) + - [code]shortcut_text[/code]: [String] (Shortcut text of the [b]Command[/b] if available.) + Removes the custom command from EditorCommandPalette. + - [code]key_name[/code]: [String] (Name of the key for a particular [b]Command[/b].) diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml index 91e1dfbf57e..8558f4b9f7e 100644 --- a/doc/classes/EditorInterface.xml +++ b/doc/classes/EditorInterface.xml @@ -33,6 +33,7 @@ + Returns the editor's [EditorCommandPalette] instance.