Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

EditorResourcePicker

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

Heredado por: EditorScriptPicker

Control del editor de Godot para seleccionar propiedades de tipo Resource.

Descripción

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.

Propiedades

String

base_type

""

bool

editable

true

Resource

edited_resource

bool

toggle_mode

false

Métodos

bool

_handle_menu_selected(id: int) virtual

void

_set_create_options(menu_node: Object) virtual

PackedStringArray

get_allowed_types() const

void

set_toggle_pressed(pressed: bool)


Señales

resource_changed(resource: Resource) 🔗

Emitida cuando se cambia el valor del recurso editado.


resource_selected(resource: Resource, inspect: bool) 🔗

Emitida cuando se establece el valor del recurso y el usuario hace clic para editarlo. Cuando inspect es true, la señal fue causada por la opción del menú contextual "Editar" o "Inspeccionar".


Descripciones de Propiedades

String base_type = "" 🔗

El tipo base de los tipos de recursos permitidos. Puede ser una lista separada por comas de varias opciones.


bool editable = true 🔗

  • void set_editable(value: bool)

  • bool is_editable()

Si es true, el valor puede ser seleccionado y editado.


Resource edited_resource 🔗

El valor del recurso editado.


bool toggle_mode = false 🔗

  • void set_toggle_mode(value: bool)

  • bool is_toggle_mode()

Si es true, el botón principal con la vista previa del recurso funciona en el modo de alternancia. Utiliza set_toggle_pressed() para establecer manualmente el estado.


Descripciones de Métodos

bool _handle_menu_selected(id: int) virtual 🔗

Este método virtual puede ser implementado para manejar elementos del menú contextual no manejados por defecto. Véase _set_create_options().


void _set_create_options(menu_node: Object) virtual 🔗

This virtual method is called when updating the context menu of an editable EditorResourcePicker. Implement this method to override the "New" items section with your own options. menu_node is a reference to the PopupMenu node.

Note: Implement _handle_menu_selected() to handle these custom items.

Note: Relevant built-in options ("Load", "Copy", "Paste", etc.) are automatically added to the menu_node afterwards, using their hard-coded IDs starting from 0. Custom options need to use non-colliding IDs to be handled properly. Using id = 100 + custom_option_index is safe (this is what the default items in the "New" section use).


PackedStringArray get_allowed_types() const 🔗

Devuelve una lista de todos los tipos y subtipos permitidos correspondientes a base_type. Si base_type está vacío, se devuelve una lista vacía.


void set_toggle_pressed(pressed: bool) 🔗

Establece el estado del modo de alternancia para el botón principal. Solo funciona si toggle_mode se establece en true.