class_editorresourcepicker.rst 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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/4.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/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:`_handle_menu_selected<class_EditorResourcePicker_private_method__handle_menu_selected>` **(** :ref:`int<class_int>` id **)** |virtual| |
  38. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`_set_create_options<class_EditorResourcePicker_private_method__set_create_options>` **(** :ref:`Object<class_Object>` menu_node **)** |virtual| |
  40. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`get_allowed_types<class_EditorResourcePicker_method_get_allowed_types>` **(** **)** |const| |
  42. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`set_toggle_pressed<class_EditorResourcePicker_method_set_toggle_pressed>` **(** :ref:`bool<class_bool>` pressed **)** |
  44. +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. .. rst-class:: classref-section-separator
  46. ----
  47. .. rst-class:: classref-descriptions-group
  48. Signals
  49. -------
  50. .. _class_EditorResourcePicker_signal_resource_changed:
  51. .. rst-class:: classref-signal
  52. **resource_changed** **(** :ref:`Resource<class_Resource>` resource **)**
  53. Emitted when the value of the edited resource was changed.
  54. .. rst-class:: classref-item-separator
  55. ----
  56. .. _class_EditorResourcePicker_signal_resource_selected:
  57. .. rst-class:: classref-signal
  58. **resource_selected** **(** :ref:`Resource<class_Resource>` resource, :ref:`bool<class_bool>` inspect **)**
  59. Emitted when the resource value was set and user clicked to edit it. When ``inspect`` is ``true``, the signal was caused by the context menu "Edit" or "Inspect" option.
  60. .. rst-class:: classref-section-separator
  61. ----
  62. .. rst-class:: classref-descriptions-group
  63. Property Descriptions
  64. ---------------------
  65. .. _class_EditorResourcePicker_property_base_type:
  66. .. rst-class:: classref-property
  67. :ref:`String<class_String>` **base_type** = ``""``
  68. .. rst-class:: classref-property-setget
  69. - void **set_base_type** **(** :ref:`String<class_String>` value **)**
  70. - :ref:`String<class_String>` **get_base_type** **(** **)**
  71. The base type of allowed resource types. Can be a comma-separated list of several options.
  72. .. rst-class:: classref-item-separator
  73. ----
  74. .. _class_EditorResourcePicker_property_editable:
  75. .. rst-class:: classref-property
  76. :ref:`bool<class_bool>` **editable** = ``true``
  77. .. rst-class:: classref-property-setget
  78. - void **set_editable** **(** :ref:`bool<class_bool>` value **)**
  79. - :ref:`bool<class_bool>` **is_editable** **(** **)**
  80. If ``true``, the value can be selected and edited.
  81. .. rst-class:: classref-item-separator
  82. ----
  83. .. _class_EditorResourcePicker_property_edited_resource:
  84. .. rst-class:: classref-property
  85. :ref:`Resource<class_Resource>` **edited_resource**
  86. .. rst-class:: classref-property-setget
  87. - void **set_edited_resource** **(** :ref:`Resource<class_Resource>` value **)**
  88. - :ref:`Resource<class_Resource>` **get_edited_resource** **(** **)**
  89. The edited resource value.
  90. .. rst-class:: classref-item-separator
  91. ----
  92. .. _class_EditorResourcePicker_property_toggle_mode:
  93. .. rst-class:: classref-property
  94. :ref:`bool<class_bool>` **toggle_mode** = ``false``
  95. .. rst-class:: classref-property-setget
  96. - void **set_toggle_mode** **(** :ref:`bool<class_bool>` value **)**
  97. - :ref:`bool<class_bool>` **is_toggle_mode** **(** **)**
  98. 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.
  99. .. rst-class:: classref-section-separator
  100. ----
  101. .. rst-class:: classref-descriptions-group
  102. Method Descriptions
  103. -------------------
  104. .. _class_EditorResourcePicker_private_method__handle_menu_selected:
  105. .. rst-class:: classref-method
  106. :ref:`bool<class_bool>` **_handle_menu_selected** **(** :ref:`int<class_int>` id **)** |virtual|
  107. This virtual method can be implemented to handle context menu items not handled by default. See :ref:`_set_create_options<class_EditorResourcePicker_private_method__set_create_options>`.
  108. .. rst-class:: classref-item-separator
  109. ----
  110. .. _class_EditorResourcePicker_private_method__set_create_options:
  111. .. rst-class:: classref-method
  112. void **_set_create_options** **(** :ref:`Object<class_Object>` menu_node **)** |virtual|
  113. 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.
  114. \ **Note:** Implement :ref:`_handle_menu_selected<class_EditorResourcePicker_private_method__handle_menu_selected>` to handle these custom items.
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_EditorResourcePicker_method_get_allowed_types:
  118. .. rst-class:: classref-method
  119. :ref:`PackedStringArray<class_PackedStringArray>` **get_allowed_types** **(** **)** |const|
  120. 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.
  121. .. rst-class:: classref-item-separator
  122. ----
  123. .. _class_EditorResourcePicker_method_set_toggle_pressed:
  124. .. rst-class:: classref-method
  125. void **set_toggle_pressed** **(** :ref:`bool<class_bool>` pressed **)**
  126. Sets the toggle mode state for the main button. Works only if :ref:`toggle_mode<class_EditorResourcePicker_property_toggle_mode>` is set to ``true``.
  127. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  128. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  129. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  130. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  131. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  132. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  133. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`