EditorResourcePicker

Inherits: HBoxContainer < BoxContainer < Container < Control < CanvasItem < Node < Object

Inherited By: EditorScriptPicker

Godot editor's control for selecting Resource type properties.

Description

This Control node is used in the editor's Inspector dock to allow editing of Resource type properties. It provides options for creating, loading, saving and converting resources. Can be used with EditorInspectorPlugin to recreate the same behavior.

Note: This Control does not include any editor for the resource, as editing is controlled by the Inspector dock itself or sub-Inspectors.

Properties

String

base_type

""

bool

editable

true

Resource

edited_resource

bool

toggle_mode

false

Methods

bool

can_drop_data_fw ( Vector2 position, Variant data, Control from ) const

void

drop_data_fw ( Vector2 position, Variant data, Control from )

PoolStringArray

get_allowed_types ( ) const

Variant

get_drag_data_fw ( Vector2 position, Control from )

bool

handle_menu_selected ( int id ) virtual

void

set_create_options ( Object menu_node ) virtual

void

set_toggle_pressed ( bool pressed )


Signals

resource_changed ( Resource resource )

Emitted when the value of the edited resource was changed.


resource_selected ( Resource resource, 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

String base_type = ""

  • void set_base_type ( String value )

  • String get_base_type ( )

The base type of allowed resource types. Can be a comma-separated list of several options.


bool editable = true

  • void set_editable ( bool value )

  • bool is_editable ( )

If true, the value can be selected and edited.


Resource edited_resource

The edited resource value.


bool toggle_mode = false

  • void set_toggle_mode ( bool value )

  • bool is_toggle_mode ( )

If true, the main button with the resource preview works in the toggle mode. Use set_toggle_pressed to manually set the state.


Method Descriptions

bool can_drop_data_fw ( Vector2 position, Variant data, Control from ) const

There is currently no description for this method. Please help us by contributing one!


void drop_data_fw ( Vector2 position, Variant data, Control from )

There is currently no description for this method. Please help us by contributing one!


PoolStringArray get_allowed_types ( ) const

Returns a list of all allowed types and subtypes corresponding to the base_type. If the base_type is empty, an empty list is returned.


Variant get_drag_data_fw ( Vector2 position, Control from )

There is currently no description for this method. Please help us by contributing one!


bool handle_menu_selected ( int id ) virtual

This virtual method can be implemented to handle context menu items not handled by default. See set_create_options.


void set_create_options ( 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 PopupMenu node.

Note: Implement handle_menu_selected to handle these custom items.


void set_toggle_pressed ( bool pressed )

Sets the toggle mode state for the main button. Works only if toggle_mode is set to true.