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...
EditorInspector
繼承: ScrollContainer < Container < Control < CanvasItem < Node < Object
用於編輯物件屬性的控制項。
說明
這是實作編輯器設定對話框、屬性檢視器面板等中屬性編輯功能的 Control。若要取得在編輯器屬性檢視器面板中使用的 EditorInspector,請使用 EditorInterface.get_inspector()。
EditorInspector 將會依照由 Object.get_property_list() 傳回的陣列順序顯示屬性。
如果屬性的名稱類似路徑 (亦即如果它包含斜線 /),EditorInspector 將會沿著路徑為「目錄」建立巢狀區段。例如,如果屬性名稱為 highlighting/gdscript/node_path_color,它將會顯示為「Node Path Color」,位於巢狀於「Highlighting」區段內的「GDScript」區段中。
如果屬性具有 @GlobalScope.PROPERTY_USAGE_GROUP 用途,它將會將名稱以屬性提示字串開頭的後續屬性分組。當屬性名稱不是以該提示字串開頭,或當一個新的群組開始時,群組即結束。空的群組名稱實際上會結束目前群組。EditorInspector 將會為每個群組建立一個頂層區段。例如,如果一個具有群組用途的屬性名稱為 Collide With,且其提示字串為 collide_with_,則後續的 collide_with_area 屬性將會顯示為「Area」,位於「Collide With」區段內。還有一個特殊情況:當提示字串包含屬性的名稱時,該屬性也會被分組。這主要是為了幫助分組像 font、font_color 和 font_size 這樣的屬性 (使用提示字串 font_)。
如果屬性具有 @GlobalScope.PROPERTY_USAGE_SUBGROUP 用途,將會以與群組相同的方式建立一個子群組,並為每個子群組建立一個第二層區段。
注意: 與從類似路徑的屬性名稱建立的區段不同,EditorInspector 不會將從群組建立的區段名稱大寫。因此,具有群組用途的屬性通常使用大寫名稱,而非 snake_case 的名稱。
屬性
draw_focus_border |
|
|
focus_mode |
|
|
follow_focus |
|
|
horizontal_scroll_mode |
|
方法
void |
|
create_default_inspector(filter_line_edit: LineEdit = null) static |
|
void |
|
void |
|
void |
|
get_selected_path() const |
|
instantiate_property_editor(object: Object, type: Variant.Type, path: String, hint: PropertyHint, hint_text: String, usage: int, wide: bool = false) static |
訊號
edited_object_changed() 🔗
當正在被屬性檢視器編輯的物件已變更時發出。
當 Object 的編輯按鈕在屬性檢視器中被按下時發出。 這主要用於遠端場景樹屬性檢視器。
property_deleted(property: String) 🔗
當屬性從屬性檢視器中被移除時發出。
property_edited(property: String) 🔗
當屬性在屬性檢視器中被編輯時發出。
property_keyed(property: String, value: Variant, advance: bool) 🔗
當屬性在屬性檢視器中被 Key 時發出。當動畫面板被切換時,可以透過點擊屬性旁邊的「Key」圖示來 Key 屬性。
property_selected(property: String) 🔗
當屬性在屬性檢視器中被選取時觸發。
property_toggled(property: String, checked: bool) 🔗
當屬性檢視器中的布林值屬性被切換狀態時發出。
注意: 如果內部 autoclear 屬性已啟用,此訊號從未發出。由於此屬性在編輯器屬性檢視器中總是已啟用,因此此訊號不會由編輯器本身發出。
resource_selected(resource: Resource, path: String) 🔗
當在屬性檢視器中選取資源時發出。
restart_requested() 🔗
當在屬性檢視器中編輯了需要重新啟動才能套用的屬性時發出。這僅用於專案設定和編輯器設定。
方法說明
void collapse_all_folding() 🔗
Collapses all foldable sections.
EditorInspector create_default_inspector(filter_line_edit: LineEdit = null) static 🔗
Creates an inspector with the same configuration as the one used in the editor's Inspector dock. When passing a LineEdit into filter_line_edit, the inspector will filter its properties based on LineEdit.text whenever LineEdit.text_changed is emitted.
Shows the properties of the given object in this inspector for editing. To clear the inspector, call this method with null.
Note: If you want to edit an object in the editor's main inspector, use the edit_* methods in EditorInterface instead.
void expand_all_folding() 🔗
Expands all foldable sections.
void expand_revertable() 🔗
Expands only the foldable sections that contain a revertable (i.e. non-default) property.
返回發出該訊號的物件。
String get_selected_path() const 🔗
獲取目前選定屬性的路徑。
EditorProperty instantiate_property_editor(object: Object, type: Variant.Type, path: String, hint: PropertyHint, hint_text: String, usage: int, wide: bool = false) static 🔗
Creates a property editor that can be used by plugin UI to edit the specified property of an object.