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
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
ReadOnly
Used by the inspector, set to true
when the property is read-only.
public bool ReadOnly { 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
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
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
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
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
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