EditorProperty

Inherits: Container < Control < CanvasItem < Node < Object

自定义控件属性添加到检查器中。

描述

该控件可以将一个或多个属性编辑到EditorInspector中。通过EditorInspectorPlugin添加。

属性

bool

checkable

false

bool

checked

false

bool

draw_red

false

bool

keying

false

String

label

“”

bool

read_only

false

方法

void

add_focusable ( Control control )

void

emit_changed ( String property, Variant value, String field=””, bool changing=false )

Object

get_edited_object ( )

String

get_edited_property ( )

String

get_tooltip_text ( ) const

void

set_bottom_editor ( Control editor )

void

update_property ( ) virtual

信号

如果你想同时修改多个属性,请触发它。如果通过EditorInspectorPlugin.parse_property添加,则不要使用。


  • object_id_selected ( String property, int id )

由子检查员使用。如果选择的是对象ID,则触发。


不要手动触发,使用 emit_changed 方法代替。


  • property_checked ( String property, bool checked )

检查属性时触发。在内部使用。


  • property_keyed ( String property )

如果您想将此值添加这个值为动画键,请触发它(首先检查是否启用了键控)。


如果你想用一个单一的值来键入一个属性,请触发它。


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/instancing chain, a script or a builtin class.


如果你想编辑一个子资源,请将此信号与资源一起发出。


选择时触发。内部使用。

属性说明

Default

false

Setter

set_checkable(value)

Getter

is_checkable()

在检查面板使用,当属性可点击时,设置为true


Default

false

Setter

set_checked(value)

Getter

is_checked()

在检查面板使用,当属性为可选中时,设置属性为true


Default

false

Setter

set_draw_red(value)

Getter

is_draw_red()

由检查器使用,当属性用编辑器主题的警告颜色着色时,设置为true。这用于可编辑的子节点的属性。


Default

false

Setter

set_keying(value)

Getter

is_keying()

在检查面板使用,设置为true时,该属性可以为动画添加键。


Default

“”

Setter

set_label(value)

Getter

get_label()

设置此属性可改变标签(如果你想显示标签)。


Default

false

Setter

set_read_only(value)

Getter

is_read_only()

在检查面板使用,当属性为只读时,设置为true

方法说明

  • void add_focusable ( Control control )

如果添加的任何控件可以获得键盘焦点,将其添加到此处。这样可以确保在检查器被刷新时恢复焦点。


如果一个或几个属性发生了变化,必然会调用这个函数。field是在你的编辑器可以单独修改字段的情况下使用的(比如Vector3.x)。changing参数可以避免编辑器要求刷新这个属性(如果不确定的话,就用false)。


获取编辑后的对象。


  • String get_edited_property ( )

获取已编辑的属性。如果你的编辑器是针对单个属性的(通过EditorInspectorPlugin.parse_property添加),那么这将返回属性。


  • String get_tooltip_text ( ) const

必须实现为属性编辑器提供一个自定义工具提示。


  • void set_bottom_editor ( Control editor )

editor 编辑器控件放在属性标签的下面。该控件必须事先用 Node.add_child 添加。


  • void update_property ( ) virtual

当这个虚函数被调用时,你必须更新你的编辑器。