Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
EditorProperty
继承: Container < Control < CanvasItem < Node < Object
用于编辑属性的自定义控件,可以添加到 EditorInspector 中。
描述
用于编辑属性的自定义控件,可以添加到 EditorInspector 中。通过 EditorInspectorPlugin 添加。
属性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法
void |
_set_read_only(read_only: bool) virtual |
void |
_update_property() virtual |
void |
add_focusable(control: Control) |
void |
deselect() |
void |
emit_changed(property: StringName, value: Variant, field: StringName = &"", changing: bool = false) |
get_edited_property() const |
|
is_selected() const |
|
void |
|
void |
set_bottom_editor(editor: Control) |
void |
set_label_reference(control: Control) |
void |
set_object_and_property(object: Object, property: StringName) |
void |
信号
multiple_properties_changed(properties: PackedStringArray, value: Array) 🔗
如果想要同时修改多个属性,请发出它。如果属性是通过 EditorInspectorPlugin._parse_property() 添加的,请勿使用。
object_id_selected(property: StringName, id: int) 🔗
子检查器会使用。如果选择的是对象 ID,则触发。
property_can_revert_changed(property: StringName, can_revert: bool) 🔗
当属性的可恢复性(即,它是否具有非默认值并因此显示为带有恢复图标)发生变化时发出。
property_changed(property: StringName, value: Variant, field: StringName, changing: bool) 🔗
不要手动触发,使用 emit_changed() 方法代替。
property_checked(property: StringName, checked: bool) 🔗
勾选某个属性时发出。内部使用。
property_deleted(property: StringName) 🔗
删除某个属性时发出。内部使用。
property_favorited(property: StringName, favorited: bool) 🔗
请在想要将属性标记为收藏时发出,会让属性显示在检查器开头。
property_keyed(property: StringName) 🔗
请在想要将这个值添加为动画关键帧时发出(请先检查是否启用了键控)。
property_keyed_with_value(property: StringName, value: Variant) 🔗
请在想用单个值为属性设置关键帧时发出。
property_pinned(property: StringName, pinned: bool) 🔗
如果想要对某个属性进行标记(或者取消标记),让它无论是否与默认值相等都进行保存,请发出它。
默认值指节点刚刚实例化后属性的取值,可以来自继承/实例化链上的祖先场景、脚本或内置类。
resource_selected(path: String, resource: Resource) 🔗
如果你想编辑一个子资源,请将此信号与资源一起发出。
selected(path: String, focusable_idx: int) 🔗
选择时触发。内部使用。
属性说明
用于检查器,该属性可勾选时设置为 true
。
用于检查器,该属性已勾选时设置为 true
。
用于检查器,该属性可以被用户删除时设置为 true
。
用于检查器,该属性绘制标签时设置为 true
。
用于检查器,该属性绘制背景时设置为 true
。
用于检查器,该属性用编辑器主题的警告色绘制时设置为 true
。用于可编辑子节点的属性。
用于检查器,该属性可以被添加为动画关键帧时设置为 true
。
设置此属性可改变标签(如果你想显示标签)。
float name_split_ratio = 0.5
🔗
标签和编辑框之间的空间占比。
用于检查器,该属性为只读时设置为 true
。
用于检查器,该属性可选中时设置为 true
。
用于检查器,该属性使用折叠时设置为 true
。
方法说明
void _set_read_only(read_only: bool) virtual 🔗
当属性的只读状态被改变时被调用。它可用于将自定义控件改变为只读或可修改的状态。
void _update_property() virtual 🔗
当这个虚函数被调用时,你必须更新你的编辑器。
void add_focusable(control: Control) 🔗
如果添加的任何控件可以获得键盘焦点,将其添加到此处。这样可以确保在检查器被刷新时恢复焦点。
void deselect() 🔗
以未选中的形式绘制属性。由检查器使用。
void emit_changed(property: StringName, value: Variant, field: StringName = &"", changing: bool = false) 🔗
如果一个或几个属性发生了变化,必然会调用这个函数。field
用于你的编辑器可以单独修改字段的情况(例如,Vector3.x)。changing
参数可以避免编辑器请求刷新该属性(如果不确定,请保留为 false
)。
获取被编辑的对象。
StringName get_edited_property() const 🔗
获取被编辑的属性。如果你的编辑器适用于单个属性(通过 EditorInspectorPlugin._parse_property() 添加),则返回该属性。
如果属性以未选中的形式绘制,则返回 true
。由检查器使用。
void select(focusable: int = -1) 🔗
以选中的形式绘制属性。由检查器使用。
void set_bottom_editor(editor: Control) 🔗
将 editor
控件放在属性标签的下方。该控件必须事先用 Node.add_child() 添加。
void set_label_reference(control: Control) 🔗
由检查器使用,设为计算标签大小时用作参考的控件。
void set_object_and_property(object: Object, property: StringName) 🔗
分配要编辑的对象和属性。
void update_property() 🔗
强制刷新属性显示。