:github_url: hide .. Generated automatically by doc/tools/make_rst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the EditorResourcePicker.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_EditorResourcePicker: EditorResourcePicker ==================== **Inherits:** :ref:`HBoxContainer` **<** :ref:`BoxContainer` **<** :ref:`Container` **<** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Inherited By:** :ref:`EditorScriptPicker` Godot editor's control for selecting :ref:`Resource` type properties. Description ----------- This :ref:`Control` node is used in the editor's Inspector dock to allow editing of :ref:`Resource` type properties. It provides options for creating, loading, saving and converting resources. Can be used with :ref:`EditorInspectorPlugin` to recreate the same behavior. **Note:** This :ref:`Control` does not include any editor for the resource, as editing is controlled by the Inspector dock itself or sub-Inspectors. Properties ---------- +---------------------------------+-----------------------------------------------------------------------------+-----------+ | :ref:`String` | :ref:`base_type` | ``""`` | +---------------------------------+-----------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`editable` | ``true`` | +---------------------------------+-----------------------------------------------------------------------------+-----------+ | :ref:`Resource` | :ref:`edited_resource` | | +---------------------------------+-----------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`toggle_mode` | ``false`` | +---------------------------------+-----------------------------------------------------------------------------+-----------+ Methods ------- +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`can_drop_data_fw` **(** :ref:`Vector2` position, :ref:`Variant` data, :ref:`Control` from **)** |const| | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`drop_data_fw` **(** :ref:`Vector2` position, :ref:`Variant` data, :ref:`Control` from **)** | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PoolStringArray` | :ref:`get_allowed_types` **(** **)** |const| | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`get_drag_data_fw` **(** :ref:`Vector2` position, :ref:`Control` from **)** | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`handle_menu_selected` **(** :ref:`int` id **)** |virtual| | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_create_options` **(** :ref:`Object` menu_node **)** |virtual| | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_toggle_pressed` **(** :ref:`bool` pressed **)** | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- .. _class_EditorResourcePicker_signal_resource_changed: - **resource_changed** **(** :ref:`Resource` resource **)** Emitted when the value of the edited resource was changed. ---- .. _class_EditorResourcePicker_signal_resource_selected: - **resource_selected** **(** :ref:`Resource` resource, :ref:`bool` edit **)** 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. Property Descriptions --------------------- .. _class_EditorResourcePicker_property_base_type: - :ref:`String` **base_type** +-----------+----------------------+ | *Default* | ``""`` | +-----------+----------------------+ | *Setter* | set_base_type(value) | +-----------+----------------------+ | *Getter* | get_base_type() | +-----------+----------------------+ The base type of allowed resource types. Can be a comma-separated list of several options. ---- .. _class_EditorResourcePicker_property_editable: - :ref:`bool` **editable** +-----------+---------------------+ | *Default* | ``true`` | +-----------+---------------------+ | *Setter* | set_editable(value) | +-----------+---------------------+ | *Getter* | is_editable() | +-----------+---------------------+ If ``true``, the value can be selected and edited. ---- .. _class_EditorResourcePicker_property_edited_resource: - :ref:`Resource` **edited_resource** +----------+----------------------------+ | *Setter* | set_edited_resource(value) | +----------+----------------------------+ | *Getter* | get_edited_resource() | +----------+----------------------------+ The edited resource value. ---- .. _class_EditorResourcePicker_property_toggle_mode: - :ref:`bool` **toggle_mode** +-----------+------------------------+ | *Default* | ``false`` | +-----------+------------------------+ | *Setter* | set_toggle_mode(value) | +-----------+------------------------+ | *Getter* | is_toggle_mode() | +-----------+------------------------+ If ``true``, the main button with the resource preview works in the toggle mode. Use :ref:`set_toggle_pressed` to manually set the state. Method Descriptions ------------------- .. _class_EditorResourcePicker_method_can_drop_data_fw: - :ref:`bool` **can_drop_data_fw** **(** :ref:`Vector2` position, :ref:`Variant` data, :ref:`Control` from **)** |const| ---- .. _class_EditorResourcePicker_method_drop_data_fw: - void **drop_data_fw** **(** :ref:`Vector2` position, :ref:`Variant` data, :ref:`Control` from **)** ---- .. _class_EditorResourcePicker_method_get_allowed_types: - :ref:`PoolStringArray` **get_allowed_types** **(** **)** |const| Returns a list of all allowed types and subtypes corresponding to the :ref:`base_type`. If the :ref:`base_type` is empty, an empty list is returned. ---- .. _class_EditorResourcePicker_method_get_drag_data_fw: - :ref:`Variant` **get_drag_data_fw** **(** :ref:`Vector2` position, :ref:`Control` from **)** ---- .. _class_EditorResourcePicker_method_handle_menu_selected: - void **handle_menu_selected** **(** :ref:`int` id **)** |virtual| 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: - void **set_create_options** **(** :ref:`Object` menu_node **)** |virtual| 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` node. **Note:** Implement :ref:`handle_menu_selected` to handle these custom items. ---- .. _class_EditorResourcePicker_method_set_toggle_pressed: - void **set_toggle_pressed** **(** :ref:`bool` pressed **)** Sets the toggle mode state for the main button. Works only if :ref:`toggle_mode` is set to ``true``. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`