Table of Contents

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

bool

Checked

Used by the inspector, set to true when the property is checked.

public bool Checked { get; set; }

Property Value

bool

Deletable

Used by the inspector, set to true when the property can be deleted by the user.

public bool Deletable { get; set; }

Property Value

bool

DrawBackground

Used by the inspector, set to true when the property label is drawn.

public bool DrawBackground { get; set; }

Property Value

bool

DrawLabel

Used by the inspector, set to true when the property background is drawn.

public bool DrawLabel { get; set; }

Property Value

bool

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

bool

Keying

Used by the inspector, set to true when the property can add keys for animation.

public bool Keying { get; set; }

Property Value

bool

Label

Set this property to change the label (if you want to show one).

public string Label { get; set; }

Property Value

string

NameSplitRatio

Space distribution ratio between the label and the editing field.

public float NameSplitRatio { get; set; }

Property Value

float

ReadOnly

Used by the inspector, set to true when the property is read-only.

public bool ReadOnly { get; set; }

Property Value

bool

Selectable

Used by the inspector, set to true when the property is selectable.

public bool Selectable { get; set; }

Property Value

bool

UseFolding

Used by the inspector, set to true when the property is using folding.

public bool UseFolding { get; set; }

Property Value

bool

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 StringName
value Variant
field StringName
changing bool

EmitSignalMultiplePropertiesChanged(string[], Array)

protected void EmitSignalMultiplePropertiesChanged(string[] properties, Array value)

Parameters

properties string[]
value Array

EmitSignalObjectIdSelected(StringName, long)

protected void EmitSignalObjectIdSelected(StringName property, long id)

Parameters

property StringName
id long

EmitSignalPropertyCanRevertChanged(StringName, bool)

protected void EmitSignalPropertyCanRevertChanged(StringName property, bool canRevert)

Parameters

property StringName
canRevert bool

EmitSignalPropertyChanged(StringName, Variant, StringName, bool)

protected void EmitSignalPropertyChanged(StringName property, Variant value, StringName field, bool changing)

Parameters

property StringName
value Variant
field StringName
changing bool

EmitSignalPropertyChecked(StringName, bool)

protected void EmitSignalPropertyChecked(StringName property, bool @checked)

Parameters

property StringName
checked bool

EmitSignalPropertyDeleted(StringName)

protected void EmitSignalPropertyDeleted(StringName property)

Parameters

property StringName

EmitSignalPropertyFavorited(StringName, bool)

protected void EmitSignalPropertyFavorited(StringName property, bool favorited)

Parameters

property StringName
favorited bool

EmitSignalPropertyKeyed(StringName)

protected void EmitSignalPropertyKeyed(StringName property)

Parameters

property StringName

EmitSignalPropertyKeyedWithValue(StringName, Variant)

protected void EmitSignalPropertyKeyedWithValue(StringName property, Variant value)

Parameters

property StringName
value Variant

EmitSignalPropertyPinned(StringName, bool)

protected void EmitSignalPropertyPinned(StringName property, bool pinned)

Parameters

property StringName
pinned bool

EmitSignalResourceSelected(string, Resource)

protected void EmitSignalResourceSelected(string path, Resource resource)

Parameters

path string
resource Resource

EmitSignalSelected(string, long)

protected void EmitSignalSelected(string path, long focusableIdx)

Parameters

path string
focusableIdx long

GetEditedObject()

Gets the edited object.

public GodotObject GetEditedObject()

Returns

GodotObject

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

StringName

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_name

Name of the method to check for.

Returns

bool

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_name

Name of the signal to check for.

Returns

bool

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_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsSelected()

Returns true if property is drawn as selected. Used by the inspector.

public bool IsSelected()

Returns

bool

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 GodotObject
property 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

EditorProperty.MultiplePropertiesChangedEventHandler

ObjectIdSelected

Used by sub-inspectors. Emit it if what was selected was an Object ID.

public event EditorProperty.ObjectIdSelectedEventHandler ObjectIdSelected

Event Type

EditorProperty.ObjectIdSelectedEventHandler

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

EditorProperty.PropertyCanRevertChangedEventHandler

PropertyChanged

Do not emit this manually, use the EmitChanged(StringName, Variant, StringName, bool) method instead.

public event EditorProperty.PropertyChangedEventHandler PropertyChanged

Event Type

EditorProperty.PropertyChangedEventHandler

PropertyChecked

Emitted when a property was checked. Used internally.

public event EditorProperty.PropertyCheckedEventHandler PropertyChecked

Event Type

EditorProperty.PropertyCheckedEventHandler

PropertyDeleted

Emitted when a property was deleted. Used internally.

public event EditorProperty.PropertyDeletedEventHandler PropertyDeleted

Event Type

EditorProperty.PropertyDeletedEventHandler

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

EditorProperty.PropertyFavoritedEventHandler

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

EditorProperty.PropertyKeyedEventHandler

PropertyKeyedWithValue

Emit it if you want to key a property with a single value.

public event EditorProperty.PropertyKeyedWithValueEventHandler PropertyKeyedWithValue

Event Type

EditorProperty.PropertyKeyedWithValueEventHandler

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

EditorProperty.PropertyPinnedEventHandler

ResourceSelected

If you want a sub-resource to be edited, emit this signal with the resource.

public event EditorProperty.ResourceSelectedEventHandler ResourceSelected

Event Type

EditorProperty.ResourceSelectedEventHandler

Selected

Emitted when selected. Used internally.

public event EditorProperty.SelectedEventHandler Selected

Event Type

EditorProperty.SelectedEventHandler