Class EditorProperty
- Namespace
- Godot
- Assembly
- GodotSharpEditor.dll
A custom control for editing properties that can be added to the EditorInspector. It is added via EditorInspectorPlugin.
public class EditorProperty : Container, IDisposable
- Inheritance
-
EditorProperty
- Implements
- Inherited Members
Constructors
EditorProperty()
public EditorProperty()
Properties
Checkable
Used by the inspector, set to true when the property is checkable.
public bool Checkable { get; set; }
Property Value
Checked
Used by the inspector, set to true when the property is checked.
public bool Checked { get; set; }
Property Value
Deletable
Used by the inspector, set to true when the property can be deleted by the user.
public bool Deletable { get; set; }
Property Value
DrawBackground
Used by the inspector, set to true when the property label is drawn.
public bool DrawBackground { get; set; }
Property Value
DrawLabel
Used by the inspector, set to true when the property background is drawn.
public bool DrawLabel { get; set; }
Property Value
DrawWarning
Used by the inspector, set to true when the property is drawn with the editor theme's warning color. This is used for editable children's properties.
public bool DrawWarning { get; set; }
Property Value
Keying
Used by the inspector, set to true when the property can add keys for animation.
public bool Keying { get; set; }
Property Value
Label
Set this property to change the label (if you want to show one).
public string Label { get; set; }
Property Value
NameSplitRatio
Space distribution ratio between the label and the editing field.
public float NameSplitRatio { get; set; }
Property Value
ReadOnly
Used by the inspector, set to true when the property is read-only.
public bool ReadOnly { get; set; }
Property Value
Selectable
Used by the inspector, set to true when the property is selectable.
public bool Selectable { get; set; }
Property Value
UseFolding
Used by the inspector, set to true when the property is using folding.
public bool UseFolding { get; set; }
Property Value
Methods
AddFocusable(Control)
If any of the controls added can gain keyboard focus, add it here. This ensures that focus will be restored if the inspector is refreshed.
public void AddFocusable(Control control)
Parameters
control
Control
Deselect()
Draw property as not selected. Used by the inspector.
public void Deselect()
EmitChanged(StringName, Variant, StringName, bool)
If one or several properties have changed, this must be called. field
is used in case your editor can modify fields separately (as an example, Vector3.x). The changing
argument avoids the editor requesting this property to be refreshed (leave as false if unsure).
public void EmitChanged(StringName property, Variant value, StringName field = null, bool changing = false)
Parameters
property
StringNamevalue
Variantfield
StringNamechanging
bool
EmitSignalMultiplePropertiesChanged(string[], Array)
protected void EmitSignalMultiplePropertiesChanged(string[] properties, Array value)
Parameters
EmitSignalObjectIdSelected(StringName, long)
protected void EmitSignalObjectIdSelected(StringName property, long id)
Parameters
property
StringNameid
long
EmitSignalPropertyCanRevertChanged(StringName, bool)
protected void EmitSignalPropertyCanRevertChanged(StringName property, bool canRevert)
Parameters
property
StringNamecanRevert
bool
EmitSignalPropertyChanged(StringName, Variant, StringName, bool)
protected void EmitSignalPropertyChanged(StringName property, Variant value, StringName field, bool changing)
Parameters
property
StringNamevalue
Variantfield
StringNamechanging
bool
EmitSignalPropertyChecked(StringName, bool)
protected void EmitSignalPropertyChecked(StringName property, bool @checked)
Parameters
property
StringNamechecked
bool
EmitSignalPropertyDeleted(StringName)
protected void EmitSignalPropertyDeleted(StringName property)
Parameters
property
StringName
EmitSignalPropertyFavorited(StringName, bool)
protected void EmitSignalPropertyFavorited(StringName property, bool favorited)
Parameters
property
StringNamefavorited
bool
EmitSignalPropertyKeyed(StringName)
protected void EmitSignalPropertyKeyed(StringName property)
Parameters
property
StringName
EmitSignalPropertyKeyedWithValue(StringName, Variant)
protected void EmitSignalPropertyKeyedWithValue(StringName property, Variant value)
Parameters
property
StringNamevalue
Variant
EmitSignalPropertyPinned(StringName, bool)
protected void EmitSignalPropertyPinned(StringName property, bool pinned)
Parameters
property
StringNamepinned
bool
EmitSignalResourceSelected(string, Resource)
protected void EmitSignalResourceSelected(string path, Resource resource)
Parameters
EmitSignalSelected(string, long)
protected void EmitSignalSelected(string path, long focusableIdx)
Parameters
GetEditedObject()
Gets the edited object.
public GodotObject GetEditedObject()
Returns
GetEditedProperty()
Gets the edited property. If your editor is for a single property (added via _ParseProperty(GodotObject, Type, string, PropertyHint, string, PropertyUsageFlags, bool)), then this will return the property.
public StringName GetEditedProperty()
Returns
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
IsSelected()
Returns true if property is drawn as selected. Used by the inspector.
public bool IsSelected()
Returns
Select(int)
Draw property as selected. Used by the inspector.
public void Select(int focusable = -1)
Parameters
focusable
int
SetBottomEditor(Control)
Puts the editor
control below the property label. The control must be previously added using AddChild(Node, bool, InternalMode).
public void SetBottomEditor(Control editor)
Parameters
editor
Control
SetLabelReference(Control)
Used by the inspector, set to a control that will be used as a reference to calculate the size of the label.
public void SetLabelReference(Control control)
Parameters
control
Control
SetObjectAndProperty(GodotObject, StringName)
Assigns object and property to edit.
public void SetObjectAndProperty(GodotObject @object, StringName property)
Parameters
object
GodotObjectproperty
StringName
UpdateProperty()
Forces refresh of the property display.
public void UpdateProperty()
_SetReadOnly(bool)
Called when the read-only status of the property is changed. It may be used to change custom controls into a read-only or modifiable state.
public virtual void _SetReadOnly(bool readOnly)
Parameters
readOnly
bool
_UpdateProperty()
When this virtual function is called, you must update your editor.
public virtual void _UpdateProperty()
Events
MultiplePropertiesChanged
Emit it if you want multiple properties modified at the same time. Do not use if added via _ParseProperty(GodotObject, Type, string, PropertyHint, string, PropertyUsageFlags, bool).
public event EditorProperty.MultiplePropertiesChangedEventHandler MultiplePropertiesChanged
Event Type
ObjectIdSelected
Used by sub-inspectors. Emit it if what was selected was an Object ID.
public event EditorProperty.ObjectIdSelectedEventHandler ObjectIdSelected
Event Type
PropertyCanRevertChanged
Emitted when the revertability (i.e., whether it has a non-default value and thus is displayed with a revert icon) of a property has changed.
public event EditorProperty.PropertyCanRevertChangedEventHandler PropertyCanRevertChanged
Event Type
PropertyChanged
Do not emit this manually, use the EmitChanged(StringName, Variant, StringName, bool) method instead.
public event EditorProperty.PropertyChangedEventHandler PropertyChanged
Event Type
PropertyChecked
Emitted when a property was checked. Used internally.
public event EditorProperty.PropertyCheckedEventHandler PropertyChecked
Event Type
PropertyDeleted
Emitted when a property was deleted. Used internally.
public event EditorProperty.PropertyDeletedEventHandler PropertyDeleted
Event Type
PropertyFavorited
Emit it if you want to mark a property as favorited, making it appear at the top of the inspector.
public event EditorProperty.PropertyFavoritedEventHandler PropertyFavorited
Event Type
PropertyKeyed
Emit it if you want to add this value as an animation key (check for keying being enabled first).
public event EditorProperty.PropertyKeyedEventHandler PropertyKeyed
Event Type
PropertyKeyedWithValue
Emit it if you want to key a property with a single value.
public event EditorProperty.PropertyKeyedWithValueEventHandler PropertyKeyedWithValue
Event Type
PropertyPinned
Emit it if you want to mark (or unmark) the value of a property for being saved regardless of being equal to the default value.
The default value is the one the property will get when the node is just instantiated and can come from an ancestor scene in the inheritance/instantiation chain, a script or a builtin class.
public event EditorProperty.PropertyPinnedEventHandler PropertyPinned
Event Type
ResourceSelected
If you want a sub-resource to be edited, emit this signal with the resource.
public event EditorProperty.ResourceSelectedEventHandler ResourceSelected
Event Type
Selected
Emitted when selected. Used internally.
public event EditorProperty.SelectedEventHandler Selected