Class EditorResourcePicker
- Namespace
- Godot
- Assembly
- GodotSharpEditor.dll
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.
public class EditorResourcePicker : HBoxContainer, IDisposable
- Inheritance
-
EditorResourcePicker
- Implements
- Derived
- Inherited Members
Constructors
EditorResourcePicker()
public EditorResourcePicker()
Properties
BaseType
The base type of allowed resource types. Can be a comma-separated list of several options.
public string BaseType { get; set; }
Property Value
Editable
If true
, the value can be selected and edited.
public bool Editable { get; set; }
Property Value
EditedResource
The edited resource value.
public Resource EditedResource { get; set; }
Property Value
ToggleMode
If true
, the main button with the resource preview works in the toggle mode. Use SetTogglePressed(bool) to manually set the state.
public bool ToggleMode { get; set; }
Property Value
Methods
GetAllowedTypes()
Returns a list of all allowed types and subtypes corresponding to the BaseType. If the BaseType is empty, an empty list is returned.
public string[] GetAllowedTypes()
Returns
- string[]
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
SetTogglePressed(bool)
Sets the toggle mode state for the main button. Works only if ToggleMode is set to true
.
public void SetTogglePressed(bool pressed)
Parameters
pressed
bool
_HandleMenuSelected(int)
This virtual method can be implemented to handle context menu items not handled by default. See _SetCreateOptions(GodotObject).
public virtual bool _HandleMenuSelected(int id)
Parameters
id
int
Returns
_SetCreateOptions(GodotObject)
This virtual method is called when updating the context menu of EditorResourcePicker. Implement this method to override the "New ..." items with your own options. menuNode
is a reference to the PopupMenu node.
Note: Implement _HandleMenuSelected(int) to handle these custom items.
public virtual void _SetCreateOptions(GodotObject menuNode)
Parameters
menuNode
GodotObject
Events
ResourceChanged
Emitted when the value of the edited resource was changed.
public event EditorResourcePicker.ResourceChangedEventHandler ResourceChanged
Event Type
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.
public event EditorResourcePicker.ResourceSelectedEventHandler ResourceSelected