Class EditorCommandPalette
- Namespace
- Godot
- Assembly
- GodotSharpEditor.dll
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.
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 GetCommandPalette().
public class EditorCommandPalette : ConfirmationDialog, IDisposable
- Inheritance
-
EditorCommandPalette
- Implements
- Inherited Members
Constructors
EditorCommandPalette()
public EditorCommandPalette()
Methods
AddCommand(string, string, Callable, string)
Adds a custom command to EditorCommandPalette.
- commandName
: string (Name of the Command. This is displayed to the user.)
- keyName
: string (Name of the key for a particular Command. This is used to uniquely identify the Command.)
- bindedCallable
: Callable (Callable of the Command. This will be executed when the Command is selected.)
- shortcutText
: string (Shortcut text of the Command if available.)
public void AddCommand(string commandName, string keyName, Callable bindedCallable, string shortcutText = "None")
Parameters
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
RemoveCommand(string)
Removes the custom command from EditorCommandPalette.
- keyName
: string (Name of the key for a particular Command.)
public void RemoveCommand(string keyName)
Parameters
keyName
string