EditorResourcePicker
继承: HBoxContainer
< BoxContainer
< Container
< Control
< CanvasItem
< Node
< Object
Godot editor's control for selecting Resource
type properties.
描述
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.
属性
方法
bool | _handle_menu_selected ( id: int ) virtual1 |
void | _set_create_options ( menu_node: Object ) virtual1 |
PackedStringArray | get_allowed_types ( ) const2 |
void | set_toggle_pressed ( pressed: bool ) |
信号
resource_changed ( resource: Resource
)
Emitted when the value of the edited resource was changed.
resource_selected ( resource: Resource
, inspect: bool
)
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.
属性说明
String
base_type = ""
The base type of allowed resource types. Can be a comma-separated list of several options.
bool
editable = true
If true
, the value can be selected and edited.
Resource
edited_resource
The edited resource value.
bool
toggle_mode = false
If true
, the main button with the resource preview works in the toggle mode. Use set_toggle_pressed
to manually set the state.
方法说明
bool
_handle_menu_selected ( id: int
) virtual1
This virtual method can be implemented to handle context menu items not handled by default. See _set_create_options
.
void
_set_create_options ( menu_node: Object
) virtual1
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.
PackedStringArray
get_allowed_types ( ) const2
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.
void
set_toggle_pressed ( pressed: bool
)
Sets the toggle mode state for the main button. Works only if toggle_mode
is set to true
.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。