EditorResourcePicker
Reckfell editor's control for selecting Resource type properties.
Reckfell 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.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
EditorResourcePickerConstructor
public EditorResourcePicker();Properties4
BaseTypeProperty
public string BaseType { get; set; }The base type of allowed resource types. Can be a comma-separated list of several options.
EditableProperty
public bool Editable { get; set; }If true, the value can be selected and edited.
EditedResourceProperty
public Resource EditedResource { get; set; }The edited resource value.
ToggleModeProperty
public bool ToggleMode { get; set; }If true, the main button with the resource preview works in the toggle mode. Use EditorResourcePicker.SetTogglePressed to manually set the state.
Methods12
GetAllowedTypesstring[]
public string[] GetAllowedTypes();Returns a list of all allowed types and subtypes corresponding to the EditorResourcePicker.BaseType. If the EditorResourcePicker.BaseType is empty, an empty list is returned.
string[]GetBaseTypestring
public string GetBaseType();stringGetEditedResourceResource
public Resource GetEditedResource();ResourceIsEditablebool
public bool IsEditable();boolIsToggleModebool
public bool IsToggleMode();boolSetBaseTypevoid
public void SetBaseType(string baseType);| Name | Type | Default |
|---|---|---|
baseType | string | — |
SetEditablevoid
public void SetEditable(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetEditedResourcevoid
public void SetEditedResource(Resource resource);| Name | Type | Default |
|---|---|---|
resource | Resource | — |
SetToggleModevoid
public void SetToggleMode(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetTogglePressedvoid
public void SetTogglePressed(bool pressed);Sets the toggle mode state for the main button. Works only if EditorResourcePicker.ToggleMode is set to true.
| Name | Type | Default |
|---|---|---|
pressed | bool | — |
_HandleMenuSelectedbool
public virtual bool _HandleMenuSelected(int id);This virtual method can be implemented to handle context menu items not handled by default. See EditorResourcePicker._SetCreateOptions.
| Name | Type | Default |
|---|---|---|
id | int | — |
bool_SetCreateOptionsvoid
public virtual void _SetCreateOptions(ReckfellObject menuNode);This virtual method is called when updating the context menu of an EditorResourcePicker.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 EditorResourcePicker._HandleMenuSelected 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).
| Name | Type | Default |
|---|---|---|
menuNode | ReckfellObject | — |
Signals and events2
ResourceChangedEvent
public event EditorResourcePicker.ResourceChangedEventHandler ResourceChanged;Emitted when the value of the edited resource was changed.
| Name | Type | Default |
|---|---|---|
resource | Resource | — |
ResourceSelectedEvent
public event EditorResourcePicker.ResourceSelectedEventHandler ResourceSelected;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.
| Name | Type | Default |
|---|---|---|
resource | Resource | — |
inspect | bool | — |