class_editorcommandpalette.rst 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Object that holds all the available Commands and their shortcuts text. These Commands can be accessed through **Editor > Command Palette** menu.
  15. Command key names use slash delimiters to distinguish sections, for example: ``"example/command1"`` then ``example`` will be the section name.
  16. .. tabs::
  17. .. code-tab:: gdscript
  18. var command_palette = EditorInterface.get_command_palette()
  19. # external_command is a function that will be called with the command is executed.
  20. var command_callable = Callable(self, "external_command").bind(arguments)
  21. command_palette.add_command("command", "test/command",command_callable)
  22. .. code-tab:: csharp
  23. EditorCommandPalette commandPalette = EditorInterface.Singleton.GetCommandPalette();
  24. // ExternalCommand is a function that will be called with the command is executed.
  25. Callable commandCallable = new Callable(this, MethodName.ExternalCommand);
  26. commandPalette.AddCommand("command", "test/command", commandCallable)
  27. \ **Note:** This class shouldn't be instantiated directly. Instead, access the singleton using :ref:`EditorInterface.get_command_palette<class_EditorInterface_method_get_command_palette>`.
  28. .. rst-class:: classref-reftable-group
  29. Properties
  30. ----------
  31. .. table::
  32. :widths: auto
  33. +-------------------------+-------------------+------------------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | dialog_hide_on_ok | ``false`` (overrides :ref:`AcceptDialog<class_AcceptDialog_property_dialog_hide_on_ok>`) |
  35. +-------------------------+-------------------+------------------------------------------------------------------------------------------+
  36. .. rst-class:: classref-reftable-group
  37. Methods
  38. -------
  39. .. table::
  40. :widths: auto
  41. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | |void| | :ref:`add_command<class_EditorCommandPalette_method_add_command>`\ (\ command_name\: :ref:`String<class_String>`, key_name\: :ref:`String<class_String>`, binded_callable\: :ref:`Callable<class_Callable>`, shortcut_text\: :ref:`String<class_String>` = "None"\ ) |
  43. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | |void| | :ref:`remove_command<class_EditorCommandPalette_method_remove_command>`\ (\ key_name\: :ref:`String<class_String>`\ ) |
  45. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. .. rst-class:: classref-section-separator
  47. ----
  48. .. rst-class:: classref-descriptions-group
  49. Method Descriptions
  50. -------------------
  51. .. _class_EditorCommandPalette_method_add_command:
  52. .. rst-class:: classref-method
  53. |void| **add_command**\ (\ command_name\: :ref:`String<class_String>`, key_name\: :ref:`String<class_String>`, binded_callable\: :ref:`Callable<class_Callable>`, shortcut_text\: :ref:`String<class_String>` = "None"\ ) :ref:`🔗<class_EditorCommandPalette_method_add_command>`
  54. Adds a custom command to EditorCommandPalette.
  55. - ``command_name``: :ref:`String<class_String>` (Name of the **Command**. This is displayed to the user.)
  56. - ``key_name``: :ref:`String<class_String>` (Name of the key for a particular **Command**. This is used to uniquely identify the **Command**.)
  57. - ``binded_callable``: :ref:`Callable<class_Callable>` (Callable of the **Command**. This will be executed when the **Command** is selected.)
  58. - ``shortcut_text``: :ref:`String<class_String>` (Shortcut text of the **Command** if available.)
  59. .. rst-class:: classref-item-separator
  60. ----
  61. .. _class_EditorCommandPalette_method_remove_command:
  62. .. rst-class:: classref-method
  63. |void| **remove_command**\ (\ key_name\: :ref:`String<class_String>`\ ) :ref:`🔗<class_EditorCommandPalette_method_remove_command>`
  64. Removes the custom command from EditorCommandPalette.
  65. - ``key_name``: :ref:`String<class_String>` (Name of the key for a particular **Command**.)
  66. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  67. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  68. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  69. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  70. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  71. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  72. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  73. .. |void| replace:: :abbr:`void (No return value.)`