mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
f7c611ab71
- Removed empty paragraphs in XML. - Consistently use bold style for "Example:", on a new line. - Fix usage of `[code]` when hyperlinks could be used (`[member]`, `[constant]`). - Fix invalid usage of backticks for inline code in BBCode. - Fix some American/British English spelling inconsistencies. - Other minor fixes spotted along the way, including typo fixes with codespell. - Don't specify `@GlobalScope` for `enum` and `constant`.
55 lines
2.8 KiB
XML
55 lines
2.8 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<class name="EditorCommandPalette" inherits="ConfirmationDialog" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
|
<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, for 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>
|
|
<methods>
|
|
<method name="add_command">
|
|
<return type="void" />
|
|
<param index="0" name="command_name" type="String" />
|
|
<param index="1" name="key_name" type="String" />
|
|
<param index="2" name="binded_callable" type="Callable" />
|
|
<param index="3" name="shortcut_text" type="String" default=""None"" />
|
|
<description>
|
|
Adds a custom command to EditorCommandPalette.
|
|
- [param command_name]: [String] (Name of the [b]Command[/b]. This is displayed to the user.)
|
|
- [param key_name]: [String] (Name of the key for a particular [b]Command[/b]. This is used to uniquely identify the [b]Command[/b].)
|
|
- [param binded_callable]: [Callable] (Callable of the [b]Command[/b]. This will be executed when the [b]Command[/b] is selected.)
|
|
- [param shortcut_text]: [String] (Shortcut text of the [b]Command[/b] if available.)
|
|
</description>
|
|
</method>
|
|
<method name="remove_command">
|
|
<return type="void" />
|
|
<param index="0" name="key_name" type="String" />
|
|
<description>
|
|
Removes the custom command from EditorCommandPalette.
|
|
- [param key_name]: [String] (Name of the key for a particular [b]Command[/b].)
|
|
</description>
|
|
</method>
|
|
</methods>
|
|
<members>
|
|
<member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok" overrides="AcceptDialog" default="false" />
|
|
</members>
|
|
</class>
|