class_editorresourcepicker.rst 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the EditorResourcePicker.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_EditorResourcePicker:
  6. EditorResourcePicker
  7. ====================
  8. **Inherits:** :ref:`HBoxContainer<class_HBoxContainer>` **<** :ref:`BoxContainer<class_BoxContainer>` **<** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`EditorScriptPicker<class_EditorScriptPicker>`
  10. Godot editor's control for selecting :ref:`Resource<class_Resource>` type properties.
  11. Description
  12. -----------
  13. This :ref:`Control<class_Control>` node is used in the editor's Inspector dock to allow editing of :ref:`Resource<class_Resource>` type properties. It provides options for creating, loading, saving and converting resources. Can be used with :ref:`EditorInspectorPlugin<class_EditorInspectorPlugin>` to recreate the same behavior.
  14. \ **Note:** This :ref:`Control<class_Control>` does not include any editor for the resource, as editing is controlled by the Inspector dock itself or sub-Inspectors.
  15. Properties
  16. ----------
  17. +---------------------------------+-----------------------------------------------------------------------------+-----------+
  18. | :ref:`String<class_String>` | :ref:`base_type<class_EditorResourcePicker_property_base_type>` | ``""`` |
  19. +---------------------------------+-----------------------------------------------------------------------------+-----------+
  20. | :ref:`bool<class_bool>` | :ref:`editable<class_EditorResourcePicker_property_editable>` | ``true`` |
  21. +---------------------------------+-----------------------------------------------------------------------------+-----------+
  22. | :ref:`Resource<class_Resource>` | :ref:`edited_resource<class_EditorResourcePicker_property_edited_resource>` | |
  23. +---------------------------------+-----------------------------------------------------------------------------+-----------+
  24. | :ref:`bool<class_bool>` | :ref:`toggle_mode<class_EditorResourcePicker_property_toggle_mode>` | ``false`` |
  25. +---------------------------------+-----------------------------------------------------------------------------+-----------+
  26. Methods
  27. -------
  28. +---------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`_handle_menu_selected<class_EditorResourcePicker_method__handle_menu_selected>` **(** :ref:`int<class_int>` id **)** |virtual| |
  30. +---------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`_set_create_options<class_EditorResourcePicker_method__set_create_options>` **(** :ref:`Object<class_Object>` menu_node **)** |virtual| |
  32. +---------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_allowed_types<class_EditorResourcePicker_method_get_allowed_types>` **(** **)** |const| |
  34. +---------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`set_toggle_pressed<class_EditorResourcePicker_method_set_toggle_pressed>` **(** :ref:`bool<class_bool>` pressed **)** |
  36. +---------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
  37. Signals
  38. -------
  39. .. _class_EditorResourcePicker_signal_resource_changed:
  40. - **resource_changed** **(** :ref:`Resource<class_Resource>` resource **)**
  41. Emitted when the value of the edited resource was changed.
  42. ----
  43. .. _class_EditorResourcePicker_signal_resource_selected:
  44. - **resource_selected** **(** :ref:`Resource<class_Resource>` resource, :ref:`bool<class_bool>` edit **)**
  45. Emitted when the resource value was set and user clicked to edit it. When ``edit`` is ``true``, the signal was caused by the context menu "Edit" option.
  46. Property Descriptions
  47. ---------------------
  48. .. _class_EditorResourcePicker_property_base_type:
  49. - :ref:`String<class_String>` **base_type**
  50. +-----------+----------------------+
  51. | *Default* | ``""`` |
  52. +-----------+----------------------+
  53. | *Setter* | set_base_type(value) |
  54. +-----------+----------------------+
  55. | *Getter* | get_base_type() |
  56. +-----------+----------------------+
  57. The base type of allowed resource types. Can be a comma-separated list of several options.
  58. ----
  59. .. _class_EditorResourcePicker_property_editable:
  60. - :ref:`bool<class_bool>` **editable**
  61. +-----------+---------------------+
  62. | *Default* | ``true`` |
  63. +-----------+---------------------+
  64. | *Setter* | set_editable(value) |
  65. +-----------+---------------------+
  66. | *Getter* | is_editable() |
  67. +-----------+---------------------+
  68. If ``true``, the value can be selected and edited.
  69. ----
  70. .. _class_EditorResourcePicker_property_edited_resource:
  71. - :ref:`Resource<class_Resource>` **edited_resource**
  72. +----------+----------------------------+
  73. | *Setter* | set_edited_resource(value) |
  74. +----------+----------------------------+
  75. | *Getter* | get_edited_resource() |
  76. +----------+----------------------------+
  77. The edited resource value.
  78. ----
  79. .. _class_EditorResourcePicker_property_toggle_mode:
  80. - :ref:`bool<class_bool>` **toggle_mode**
  81. +-----------+------------------------+
  82. | *Default* | ``false`` |
  83. +-----------+------------------------+
  84. | *Setter* | set_toggle_mode(value) |
  85. +-----------+------------------------+
  86. | *Getter* | is_toggle_mode() |
  87. +-----------+------------------------+
  88. If ``true``, the main button with the resource preview works in the toggle mode. Use :ref:`set_toggle_pressed<class_EditorResourcePicker_method_set_toggle_pressed>` to manually set the state.
  89. Method Descriptions
  90. -------------------
  91. .. _class_EditorResourcePicker_method__handle_menu_selected:
  92. - :ref:`bool<class_bool>` **_handle_menu_selected** **(** :ref:`int<class_int>` id **)** |virtual|
  93. This virtual method can be implemented to handle context menu items not handled by default. See :ref:`_set_create_options<class_EditorResourcePicker_method__set_create_options>`.
  94. ----
  95. .. _class_EditorResourcePicker_method__set_create_options:
  96. - void **_set_create_options** **(** :ref:`Object<class_Object>` menu_node **)** |virtual|
  97. This virtual method is called when updating the context menu of ``EditorResourcePicker``. Implement this method to override the "New ..." items with your own options. ``menu_node`` is a reference to the :ref:`PopupMenu<class_PopupMenu>` node.
  98. \ **Note:** Implement :ref:`_handle_menu_selected<class_EditorResourcePicker_method__handle_menu_selected>` to handle these custom items.
  99. ----
  100. .. _class_EditorResourcePicker_method_get_allowed_types:
  101. - :ref:`PackedStringArray<class_PackedStringArray>` **get_allowed_types** **(** **)** |const|
  102. Returns a list of all allowed types and subtypes corresponding to the :ref:`base_type<class_EditorResourcePicker_property_base_type>`. If the :ref:`base_type<class_EditorResourcePicker_property_base_type>` is empty, an empty list is returned.
  103. ----
  104. .. _class_EditorResourcePicker_method_set_toggle_pressed:
  105. - void **set_toggle_pressed** **(** :ref:`bool<class_bool>` pressed **)**
  106. Sets the toggle mode state for the main button. Works only if :ref:`toggle_mode<class_EditorResourcePicker_property_toggle_mode>` is set to ``true``.
  107. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  108. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  109. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  110. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  111. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  112. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`