class_editorresourcepicker.rst 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/EditorResourcePicker.xml.
  6. .. _class_EditorResourcePicker:
  7. EditorResourcePicker
  8. ====================
  9. **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>`
  10. **Inherited By:** :ref:`EditorScriptPicker<class_EditorScriptPicker>`
  11. Godot editor's control for selecting :ref:`Resource<class_Resource>` type properties.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. 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.
  16. \ **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.
  17. .. rst-class:: classref-reftable-group
  18. Properties
  19. ----------
  20. .. table::
  21. :widths: auto
  22. +---------------------------------+-----------------------------------------------------------------------------+-----------+
  23. | :ref:`String<class_String>` | :ref:`base_type<class_EditorResourcePicker_property_base_type>` | ``""`` |
  24. +---------------------------------+-----------------------------------------------------------------------------+-----------+
  25. | :ref:`bool<class_bool>` | :ref:`editable<class_EditorResourcePicker_property_editable>` | ``true`` |
  26. +---------------------------------+-----------------------------------------------------------------------------+-----------+
  27. | :ref:`Resource<class_Resource>` | :ref:`edited_resource<class_EditorResourcePicker_property_edited_resource>` | |
  28. +---------------------------------+-----------------------------------------------------------------------------+-----------+
  29. | :ref:`bool<class_bool>` | :ref:`toggle_mode<class_EditorResourcePicker_property_toggle_mode>` | ``false`` |
  30. +---------------------------------+-----------------------------------------------------------------------------+-----------+
  31. .. rst-class:: classref-reftable-group
  32. Methods
  33. -------
  34. .. table::
  35. :widths: auto
  36. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`can_drop_data_fw<class_EditorResourcePicker_method_can_drop_data_fw>` **(** :ref:`Vector2<class_Vector2>` position, :ref:`Variant<class_Variant>` data, :ref:`Control<class_Control>` from **)** |const| |
  38. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`drop_data_fw<class_EditorResourcePicker_method_drop_data_fw>` **(** :ref:`Vector2<class_Vector2>` position, :ref:`Variant<class_Variant>` data, :ref:`Control<class_Control>` from **)** |
  40. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_allowed_types<class_EditorResourcePicker_method_get_allowed_types>` **(** **)** |const| |
  42. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Variant<class_Variant>` | :ref:`get_drag_data_fw<class_EditorResourcePicker_method_get_drag_data_fw>` **(** :ref:`Vector2<class_Vector2>` position, :ref:`Control<class_Control>` from **)** |
  44. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`handle_menu_selected<class_EditorResourcePicker_method_handle_menu_selected>` **(** :ref:`int<class_int>` id **)** |virtual| |
  46. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`set_create_options<class_EditorResourcePicker_method_set_create_options>` **(** :ref:`Object<class_Object>` menu_node **)** |virtual| |
  48. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`set_toggle_pressed<class_EditorResourcePicker_method_set_toggle_pressed>` **(** :ref:`bool<class_bool>` pressed **)** |
  50. +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. .. rst-class:: classref-section-separator
  52. ----
  53. .. rst-class:: classref-descriptions-group
  54. Signals
  55. -------
  56. .. _class_EditorResourcePicker_signal_resource_changed:
  57. .. rst-class:: classref-signal
  58. **resource_changed** **(** :ref:`Resource<class_Resource>` resource **)**
  59. Emitted when the value of the edited resource was changed.
  60. .. rst-class:: classref-item-separator
  61. ----
  62. .. _class_EditorResourcePicker_signal_resource_selected:
  63. .. rst-class:: classref-signal
  64. **resource_selected** **(** :ref:`Resource<class_Resource>` resource, :ref:`bool<class_bool>` edit **)**
  65. 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.
  66. .. rst-class:: classref-section-separator
  67. ----
  68. .. rst-class:: classref-descriptions-group
  69. Property Descriptions
  70. ---------------------
  71. .. _class_EditorResourcePicker_property_base_type:
  72. .. rst-class:: classref-property
  73. :ref:`String<class_String>` **base_type** = ``""``
  74. .. rst-class:: classref-property-setget
  75. - void **set_base_type** **(** :ref:`String<class_String>` value **)**
  76. - :ref:`String<class_String>` **get_base_type** **(** **)**
  77. The base type of allowed resource types. Can be a comma-separated list of several options.
  78. .. rst-class:: classref-item-separator
  79. ----
  80. .. _class_EditorResourcePicker_property_editable:
  81. .. rst-class:: classref-property
  82. :ref:`bool<class_bool>` **editable** = ``true``
  83. .. rst-class:: classref-property-setget
  84. - void **set_editable** **(** :ref:`bool<class_bool>` value **)**
  85. - :ref:`bool<class_bool>` **is_editable** **(** **)**
  86. If ``true``, the value can be selected and edited.
  87. .. rst-class:: classref-item-separator
  88. ----
  89. .. _class_EditorResourcePicker_property_edited_resource:
  90. .. rst-class:: classref-property
  91. :ref:`Resource<class_Resource>` **edited_resource**
  92. .. rst-class:: classref-property-setget
  93. - void **set_edited_resource** **(** :ref:`Resource<class_Resource>` value **)**
  94. - :ref:`Resource<class_Resource>` **get_edited_resource** **(** **)**
  95. The edited resource value.
  96. .. rst-class:: classref-item-separator
  97. ----
  98. .. _class_EditorResourcePicker_property_toggle_mode:
  99. .. rst-class:: classref-property
  100. :ref:`bool<class_bool>` **toggle_mode** = ``false``
  101. .. rst-class:: classref-property-setget
  102. - void **set_toggle_mode** **(** :ref:`bool<class_bool>` value **)**
  103. - :ref:`bool<class_bool>` **is_toggle_mode** **(** **)**
  104. 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.
  105. .. rst-class:: classref-section-separator
  106. ----
  107. .. rst-class:: classref-descriptions-group
  108. Method Descriptions
  109. -------------------
  110. .. _class_EditorResourcePicker_method_can_drop_data_fw:
  111. .. rst-class:: classref-method
  112. :ref:`bool<class_bool>` **can_drop_data_fw** **(** :ref:`Vector2<class_Vector2>` position, :ref:`Variant<class_Variant>` data, :ref:`Control<class_Control>` from **)** |const|
  113. .. container:: contribute
  114. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_EditorResourcePicker_method_drop_data_fw:
  118. .. rst-class:: classref-method
  119. void **drop_data_fw** **(** :ref:`Vector2<class_Vector2>` position, :ref:`Variant<class_Variant>` data, :ref:`Control<class_Control>` from **)**
  120. .. container:: contribute
  121. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  122. .. rst-class:: classref-item-separator
  123. ----
  124. .. _class_EditorResourcePicker_method_get_allowed_types:
  125. .. rst-class:: classref-method
  126. :ref:`PoolStringArray<class_PoolStringArray>` **get_allowed_types** **(** **)** |const|
  127. 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.
  128. .. rst-class:: classref-item-separator
  129. ----
  130. .. _class_EditorResourcePicker_method_get_drag_data_fw:
  131. .. rst-class:: classref-method
  132. :ref:`Variant<class_Variant>` **get_drag_data_fw** **(** :ref:`Vector2<class_Vector2>` position, :ref:`Control<class_Control>` from **)**
  133. .. container:: contribute
  134. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _class_EditorResourcePicker_method_handle_menu_selected:
  138. .. rst-class:: classref-method
  139. :ref:`bool<class_bool>` **handle_menu_selected** **(** :ref:`int<class_int>` id **)** |virtual|
  140. 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>`.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_EditorResourcePicker_method_set_create_options:
  144. .. rst-class:: classref-method
  145. void **set_create_options** **(** :ref:`Object<class_Object>` menu_node **)** |virtual|
  146. 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.
  147. \ **Note:** Implement :ref:`handle_menu_selected<class_EditorResourcePicker_method_handle_menu_selected>` to handle these custom items.
  148. .. rst-class:: classref-item-separator
  149. ----
  150. .. _class_EditorResourcePicker_method_set_toggle_pressed:
  151. .. rst-class:: classref-method
  152. void **set_toggle_pressed** **(** :ref:`bool<class_bool>` pressed **)**
  153. Sets the toggle mode state for the main button. Works only if :ref:`toggle_mode<class_EditorResourcePicker_property_toggle_mode>` is set to ``true``.
  154. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  155. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  156. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  157. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`