Merge pull request #51615 from Bhu1-V/PR/docs/cmd-plt
`EditorCommandPalette` Documentation.
This commit is contained in:
commit
7d43b0f7a8
2 changed files with 26 additions and 0 deletions
|
@ -1,8 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="EditorCommandPalette" inherits="ConfirmationDialog" version="4.0">
|
||||
<brief_description>
|
||||
Godot editor's command palette.
|
||||
</brief_description>
|
||||
<description>
|
||||
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].
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
@ -14,12 +32,19 @@
|
|||
<argument index="2" name="binded_callable" type="Callable" />
|
||||
<argument index="3" name="shortcut_text" type="String" default=""None"" />
|
||||
<description>
|
||||
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.)
|
||||
</description>
|
||||
</method>
|
||||
<method name="remove_command">
|
||||
<return type="void" />
|
||||
<argument index="0" name="key_name" type="String" />
|
||||
<description>
|
||||
Removes the custom command from EditorCommandPalette.
|
||||
- [code]key_name[/code]: [String] (Name of the key for a particular [b]Command[/b].)
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
<method name="get_command_palette" qualifiers="const">
|
||||
<return type="EditorCommandPalette" />
|
||||
<description>
|
||||
Returns the editor's [EditorCommandPalette] instance.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_current_path" qualifiers="const">
|
||||
|
|
Loading…
Reference in a new issue