EditorProperty
繼承: Container < Control < CanvasItem < Node < Object
用於編輯屬性的自訂控制項,可以新增到 EditorInspector 中。
說明
用於編輯屬性的自訂控制項,可以新增到 EditorInspector 中。通過 EditorInspectorPlugin 新增。
屬性
|
||
|
||
|
||
|
||
|
||
|
||
focus_mode |
|
|
|
||
|
||
|
||
|
||
|
||
|
方法
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) 🔗
Emit it if you want to mark a property as favorited, making it appear at the top of the inspector.
property_keyed(property: StringName) 🔗
如果你想將此值新增這個值為動畫鍵,請觸發它(首先檢查是否啟用了鍵控)。
property_keyed_with_value(property: StringName, value: Variant) 🔗
如果你想用一個單一的值來鍵入一個屬性,請觸發它。
property_overridden() 🔗
Emitted when a setting override for the current project is requested.
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 🔗
Space distribution ratio between the label and the editing field.
用於屬性檢視器,該屬性為唯讀時設定為 true。
由屬性檢視器使用,當屬性可選取時設為 true。
由屬性檢視器使用,當屬性使用摺疊功能時,設定為 true。
方法說明
void _set_read_only(read_only: bool) virtual 🔗
當屬性的唯讀狀態被改變時被呼叫。它可用於將自訂控制項改變為唯讀或可修改的狀態。
void _update_property() virtual 🔗
當這個虛函式被呼叫時,你必須更新你的編輯器。
void add_focusable(control: Control) 🔗
如果任何新增的 Control 可以取得鍵盤焦點,請在此新增。這可確保如果屬性檢視器被重新整理,焦點將會被還原。
void deselect() 🔗
將屬性繪製為未選取狀態。由屬性檢視器使用。
void emit_changed(property: StringName, value: Variant, field: StringName = &"", changing: bool = false) 🔗
如果一個或幾個屬性發生了變化,必然會呼叫這個函式。field 用於你的編輯器可以單獨修改欄位的情況(例如,Vector3.x)。changing 參數可以避免編輯器請求更新該屬性(如果不確定,請保留為 false)。
Returns the edited object.
Note: This method could return null if the editor has not yet been associated with a property. However, in _update_property() and _set_read_only(), this value is guaranteed to be non-null.
StringName get_edited_property() const 🔗
Returns the edited property. If your editor is for a single property (added via EditorInspectorPlugin._parse_property()), then this will return the property.
Note: This method could return null if the editor has not yet been associated with a property. However, in _update_property() and _set_read_only(), this value is guaranteed to be non-null.
Returns true if property is drawn as selected. Used by the inspector.
void select(focusable: int = -1) 🔗
將屬性以選取狀態繪製。由屬性檢視器使用。
void set_bottom_editor(editor: Control) 🔗
將 editor 控制項放在屬性標籤的下方。該控制項必須事先用 Node.add_child() 新增。
void set_label_reference(control: 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_object_and_property(object: Object, property: StringName) 🔗
Assigns object and property to edit.
void update_property() 🔗
Forces a refresh of the property display.