EditorProperty

继承: Container < Control < CanvasItem < Node < Object

Custom control for editing properties that can be added to the EditorInspector.

描述

A custom control for editing properties that can be added to the EditorInspector. It is added via EditorInspectorPlugin.

属性

方法

void_set_read_only ( read_only: bool ) virtual1
void_update_property ( ) virtual1
voidadd_focusable ( control: Control )
voidemit_changed ( property: StringName, value: Variant, field: StringName = &"", changing: bool = false )
Objectget_edited_object ( )
StringNameget_edited_property ( ) const2
voidset_bottom_editor ( editor: Control )
voidupdate_property ( )

信号

multiple_properties_changed ( properties: PackedStringArray, value: Array )

Emit it if you want multiple properties modified at the same time. Do not use if added via EditorInspectorPlugin._parse_property.


object_id_selected ( property: StringName, id: int )

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


property_can_revert_changed ( property: StringName, can_revert: 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.


property_changed ( property: StringName, value: Variant, field: StringName, changing: bool )

Do not emit this manually, use the emit_changed method instead.


property_checked ( property: StringName, checked: bool )

Emitted when a property was checked. Used internally.


property_deleted ( property: StringName )

Emitted when a property was deleted. Used internally.


property_keyed ( property: StringName )

Emit it if you want to add this value as an animation key (check for keying being enabled first).


property_keyed_with_value ( property: StringName, value: Variant )

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


property_pinned ( property: StringName, pinned: 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.


resource_selected ( path: String, resource: Resource )

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


selected ( path: String, focusable_idx: int )

Emitted when selected. Used internally.


属性说明

bool checkable = false

  • void set_checkable ( value: bool )
  • bool is_checkable ( )

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


bool checked = false

  • void set_checked ( value: bool )
  • bool is_checked ( )

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


bool deletable = false

  • void set_deletable ( value: bool )
  • bool is_deletable ( )

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


bool draw_warning = false

  • void set_draw_warning ( value: bool )
  • bool is_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.


bool keying = false

  • void set_keying ( value: bool )
  • bool is_keying ( )

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


String label = ""

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


bool read_only = false

  • void set_read_only ( value: bool )
  • bool is_read_only ( )

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


方法说明

void _set_read_only ( read_only: bool ) virtual1

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 _update_property ( ) virtual1

When this virtual function is called, you must update your editor.


void add_focusable ( control: 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 emit_changed ( property: StringName, value: Variant, field: StringName = &"", changing: bool = false )

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).


Object get_edited_object ( )

Gets the edited object.


StringName get_edited_property ( ) const2

Gets the edited property. If your editor is for a single property (added via EditorInspectorPlugin._parse_property), then this will return the property.


void set_bottom_editor ( editor: Control )

Puts the editor control below the property label. The control must be previously added using Node.add_child.


void update_property ( )

Forces refresh of the property display.

1

本方法通常需要用户覆盖才能生效。

2

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。