Class EditorProperty
Custom control for editing properties that can be added to the EditorInspector.
- Inheritance
-
EditorProperty
Remarks
A custom control for editing properties that can be added to the EditorInspector. It is added via EditorInspectorPlugin.
Properties
checkable
Used by the inspector, set to true
when the property is checkable.
var checkable : bool = false
Property Value
Remarks
checked
Used by the inspector, set to true
when the property is checked.
var checked : bool = false
Property Value
Remarks
deletable
Used by the inspector, set to true
when the property can be deleted by the user.
var deletable : bool = false
Property Value
Remarks
draw_background
Used by the inspector, set to true
when the property label is drawn.
var draw_background : bool = true
Property Value
Remarks
draw_label
Used by the inspector, set to true
when the property background is drawn.
var draw_label : bool = true
Property Value
Remarks
draw_warning
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.
var draw_warning : bool = false
Property Value
Remarks
keying
Used by the inspector, set to true
when the property can add keys for animation.
var keying : bool = false
Property Value
Remarks
label
Set this property to change the label (if you want to show one).
var label : String = ""
Property Value
Remarks
name_split_ratio
Space distribution ratio between the label and the editing field.
var name_split_ratio : float = 0.5
Property Value
Remarks
read_only
Used by the inspector, set to true
when the property is read-only.
var read_only : bool = false
Property Value
Remarks
selectable
Used by the inspector, set to true
when the property is selectable.
var selectable : bool = true
Property Value
Remarks
use_folding
Used by the inspector, set to true
when the property is using folding.
var use_folding : bool = false
Property Value
Remarks
Methods
_set_read_only(bool)
Qualifiers: virtual
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.
void _set_read_only(bool read_only)
Parameters
read_only
bool
_update_property
Qualifiers: virtual
When this virtual function is called, you must update your editor.
void _update_property
add_focusable(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.
void add_focusable(Control control)
Parameters
control
Control
deselect
Draw property as not selected. Used by the inspector.
void deselect
emit_changed(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).
void emit_changed(StringName property, Variant value, StringName field, bool changing)
Parameters
property
StringNamevalue
Variantfield
StringNamechanging
bool
get_edited_object
Gets the edited object.
Object get_edited_object
get_edited_property
Qualifiers: const
Gets the edited property. If your editor is for a single property (added via EditorInspectorPlugin._parse_property), then this will return the property.
StringName get_edited_property
is_selected
Qualifiers: const
Returns true
if property is drawn as selected. Used by the inspector.
bool is_selected
select(int)
Draw property as selected. Used by the inspector.
void select(int focusable)
Parameters
focusable
int
set_bottom_editor(Control)
Puts the editor
control below the property label. The control must be previously added using Node.add_child.
void set_bottom_editor(Control editor)
Parameters
editor
Control
set_label_reference(Control)
Used by the inspector, set to a control that will be used as a reference to calculate the size of the label.
void set_label_reference(Control control)
Parameters
control
Control
set_object_and_property(Object, StringName)
Assigns object and property to edit.
void set_object_and_property(Object object, StringName property)
Parameters
object
Objectproperty
StringName
update_property
Forces refresh of the property display.
void update_property
Events
multiple_properties_changed(PackedStringArray, Array)
Emit it if you want multiple properties modified at the same time. Do not use if added via EditorInspectorPlugin._parse_property.
signal multiple_properties_changed(PackedStringArray properties, Array value)
Parameters
properties
PackedStringArrayvalue
Array
object_id_selected(StringName, int)
Used by sub-inspectors. Emit it if what was selected was an Object ID.
signal object_id_selected(StringName property, int id)
Parameters
property
StringNameid
int
property_can_revert_changed(StringName, bool)
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.
signal property_can_revert_changed(StringName property, bool can_revert)
Parameters
property
StringNamecan_revert
bool
property_changed(StringName, Variant, StringName, bool)
Do not emit this manually, use the EditorProperty.emit_changed method instead.
signal property_changed(StringName property, Variant value, StringName field, bool changing)
Parameters
property
StringNamevalue
Variantfield
StringNamechanging
bool
property_checked(StringName, bool)
Emitted when a property was checked. Used internally.
signal property_checked(StringName property, bool checked)
Parameters
property
StringNamechecked
bool
property_deleted(StringName)
Emitted when a property was deleted. Used internally.
signal property_deleted(StringName property)
Parameters
property
StringName
property_favorited(StringName, bool)
Emit it if you want to mark a property as favorited, making it appear at the top of the inspector.
signal property_favorited(StringName property, bool favorited)
Parameters
property
StringNamefavorited
bool
property_keyed(StringName)
Emit it if you want to add this value as an animation key (check for keying being enabled first).
signal property_keyed(StringName property)
Parameters
property
StringName
property_keyed_with_value(StringName, Variant)
Emit it if you want to key a property with a single value.
signal property_keyed_with_value(StringName property, Variant value)
Parameters
property
StringNamevalue
Variant
property_pinned(StringName, bool)
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.
signal property_pinned(StringName property, bool pinned)
Parameters
property
StringNamepinned
bool
resource_selected(String, Resource)
If you want a sub-resource to be edited, emit this signal with the resource.
signal resource_selected(String path, Resource resource)
Parameters
selected(String, int)
Emitted when selected. Used internally.
signal selected(String path, int focusable_idx)