class_editorcommandpalette.rst 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/EditorCommandPalette.xml.
  6. .. _class_EditorCommandPalette:
  7. EditorCommandPalette
  8. ====================
  9. **Inherits:** :ref:`ConfirmationDialog<class_ConfirmationDialog>` **<** :ref:`AcceptDialog<class_AcceptDialog>` **<** :ref:`Window<class_Window>` **<** :ref:`Viewport<class_Viewport>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Godot editor's command palette.
  11. Description
  12. -----------
  13. Object that holds all the available Commands and their shortcuts text. These Commands can be accessed through **Editor > Command Palette** menu.
  14. Command key names use slash delimiters to distinguish sections, for example: ``"example/command1"`` then ``example`` will be the section name.
  15. .. tabs::
  16. .. code-tab:: gdscript
  17. var command_palette = get_editor_interface().get_command_palette()
  18. # external_command is a function that will be called with the command is executed.
  19. var command_callable = Callable(self, "external_command").bind(arguments)
  20. command_palette.add_command("command", "test/command",command_callable)
  21. .. code-tab:: csharp
  22. EditorCommandPalette commandPalette = GetEditorInterface().GetCommandPalette();
  23. // ExternalCommand is a function that will be called with the command is executed.
  24. Callable commandCallable = new Callable(this, nameof(ExternalCommand));
  25. commandPalette.AddCommand("command", "test/command", commandCallable)
  26. \ **Note:** This class shouldn't be instantiated directly. Instead, access the singleton using :ref:`EditorInterface.get_command_palette<class_EditorInterface_method_get_command_palette>`.
  27. Properties
  28. ----------
  29. +-------------------------+-------------------+------------------------------------------------------------------------------------------+
  30. | :ref:`bool<class_bool>` | dialog_hide_on_ok | ``false`` (overrides :ref:`AcceptDialog<class_AcceptDialog_property_dialog_hide_on_ok>`) |
  31. +-------------------------+-------------------+------------------------------------------------------------------------------------------+
  32. Methods
  33. -------
  34. +------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`add_command<class_EditorCommandPalette_method_add_command>` **(** :ref:`String<class_String>` command_name, :ref:`String<class_String>` key_name, :ref:`Callable<class_Callable>` binded_callable, :ref:`String<class_String>` shortcut_text="None" **)** |
  36. +------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`remove_command<class_EditorCommandPalette_method_remove_command>` **(** :ref:`String<class_String>` key_name **)** |
  38. +------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. Method Descriptions
  40. -------------------
  41. .. _class_EditorCommandPalette_method_add_command:
  42. - void **add_command** **(** :ref:`String<class_String>` command_name, :ref:`String<class_String>` key_name, :ref:`Callable<class_Callable>` binded_callable, :ref:`String<class_String>` shortcut_text="None" **)**
  43. Adds a custom command to EditorCommandPalette.
  44. - ``command_name``: :ref:`String<class_String>` (Name of the **Command**. This is displayed to the user.)
  45. - ``key_name``: :ref:`String<class_String>` (Name of the key for a particular **Command**. This is used to uniquely identify the **Command**.)
  46. - ``binded_callable``: :ref:`Callable<class_Callable>` (Callable of the **Command**. This will be executed when the **Command** is selected.)
  47. - ``shortcut_text``: :ref:`String<class_String>` (Shortcut text of the **Command** if available.)
  48. ----
  49. .. _class_EditorCommandPalette_method_remove_command:
  50. - void **remove_command** **(** :ref:`String<class_String>` key_name **)**
  51. Removes the custom command from EditorCommandPalette.
  52. - ``key_name``: :ref:`String<class_String>` (Name of the key for a particular **Command**.)
  53. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  54. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  55. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  56. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  57. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  58. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`