EditorCommandPalette.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="EditorCommandPalette" inherits="ConfirmationDialog" version="4.0">
  3. <brief_description>
  4. Godot editor's command palette.
  5. </brief_description>
  6. <description>
  7. Object that holds all the available Commands and their shortcuts text. These Commands can be accessed through [b]Editor &gt; Command Palette[/b] menu.
  8. Command key names use slash delimiters to distinguish sections Example: [code]"example/command1"[/code] then [code]example[/code] will be the section name.
  9. [codeblocks]
  10. [gdscript]
  11. var command_palette = get_editor_interface().get_command_palette()
  12. # external_command is a function that will be called with the command is executed.
  13. var command_callable = Callable(self, "external_command").bind(arguments)
  14. command_palette.add_command("command", "test/command",command_callable)
  15. [/gdscript]
  16. [csharp]
  17. EditorCommandPalette commandPalette = GetEditorInterface().GetCommandPalette();
  18. // ExternalCommand is a function that will be called with the command is executed.
  19. Callable commandCallable = new Callable(this, nameof(ExternalCommand));
  20. commandPalette.AddCommand("command", "test/command", commandCallable)
  21. [/csharp]
  22. [/codeblocks]
  23. [b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_command_palette].
  24. </description>
  25. <tutorials>
  26. </tutorials>
  27. <methods>
  28. <method name="add_command">
  29. <return type="void" />
  30. <argument index="0" name="command_name" type="String" />
  31. <argument index="1" name="key_name" type="String" />
  32. <argument index="2" name="binded_callable" type="Callable" />
  33. <argument index="3" name="shortcut_text" type="String" default="&quot;None&quot;" />
  34. <description>
  35. Adds a custom command to EditorCommandPalette.
  36. - [code]command_name[/code]: [String] (Name of the [b]Command[/b]. This is displayed to the user.)
  37. - [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].)
  38. - [code]binded_callable[/code]: [Callable] (Callable of the [b]Command[/b]. This will be executed when the [b]Command[/b] is selected.)
  39. - [code]shortcut_text[/code]: [String] (Shortcut text of the [b]Command[/b] if available.)
  40. </description>
  41. </method>
  42. <method name="remove_command">
  43. <return type="void" />
  44. <argument index="0" name="key_name" type="String" />
  45. <description>
  46. Removes the custom command from EditorCommandPalette.
  47. - [code]key_name[/code]: [String] (Name of the key for a particular [b]Command[/b].)
  48. </description>
  49. </method>
  50. </methods>
  51. <members>
  52. <member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok" override="true" default="false" />
  53. </members>
  54. </class>