EditorCommandPalette
继承: ConfirmationDialog
< AcceptDialog
< Window
< Viewport
< Node
< Object
Godot editor's command palette.
描述
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.
var command_palette = EditorInterface.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)
EditorCommandPalette commandPalette = EditorInterface.Singleton.GetCommandPalette();
// ExternalCommand is a function that will be called with the command is executed.
Callable commandCallable = new Callable(this, MethodName.ExternalCommand);
commandPalette.AddCommand("command", "test/command", commandCallable)
Note: This class shouldn't be instantiated directly. Instead, access the singleton using EditorInterface.get_command_palette
.
属性
bool | dialog_hide_on_ok |
方法
void | add_command ( command_name: String , key_name: String , binded_callable: Callable , shortcut_text: String = "None" ) |
void | remove_command ( key_name: String ) |
方法说明
void
add_command ( command_name: String
, key_name: String
, binded_callable: Callable
, shortcut_text: String
= "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 ( key_name: String
)
Removes the custom command from EditorCommandPalette.
key_name
:String
(Name of the key for a particular Command.)
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。