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...
EditorResourcePicker
繼承: HBoxContainer < BoxContainer < Container < Control < CanvasItem < Node < Object
被繼承: EditorScriptPicker
Godot 編輯器用於選擇 Resource 型別屬性的控制項。
說明
此 Control 節點用於編輯器的屬性屬性檢視器以允許編輯 Resource 型別屬性。它提供了建立、載入、保存和轉換資源的選項。可以與 EditorInspectorPlugin 屬性檢視器外掛程式一起使用以重新建立相同的行為。
注意:這個 Control 不包括資源的任何編輯器,因為編輯是由屬性屬性檢視器本身或子屬性檢視器控制的。
屬性
|
||
|
||
|
方法
_handle_menu_selected(id: int) virtual |
|
void |
_set_create_options(menu_node: Object) virtual |
get_allowed_types() const |
|
void |
set_toggle_pressed(pressed: bool) |
訊號
resource_changed(resource: Resource) 🔗
當正在編輯的資源改變值時發出。
resource_selected(resource: Resource, inspect: bool) 🔗
當資源值被設定,並且使用者點擊它編輯時觸發。當 inspect 為 true 時,該訊號是由本文功能表“編輯”或“檢查”選項引起的。
屬性說明
允許資源型別的基本型別。可以是幾個選項的逗號分離列表。
如果為 true,則可以選擇和編輯該值。
已編輯的資源值。
如果為 true,帶有資源預覽的主按鈕在切換模式下工作。使用 set_toggle_pressed() 來手動設定狀態。
方法說明
該虛方法可以被實作,以處理預設未處理的本文功能表專案目。請參閱 _set_create_options()。
void _set_create_options(menu_node: Object) virtual 🔗
This virtual method is called when updating the context menu of an editable EditorResourcePicker. Implement this method to override the "New" items section with your own options. menu_node is a reference to the PopupMenu node.
Note: Implement _handle_menu_selected() to handle these custom items.
Note: Relevant built-in options ("Load", "Copy", "Paste", etc.) are automatically added to the menu_node afterwards, using their hard-coded IDs starting from 0. Custom options need to use non-colliding IDs to be handled properly. Using id = 100 + custom_option_index is safe (this is what the default items in the "New" section use).
PackedStringArray get_allowed_types() const 🔗
返回一個與 base_type 對應的所有允許的型別和子型別的列表。如果 base_type 是空,將返回一個空的列表。
void set_toggle_pressed(pressed: bool) 🔗
設定主按鈕的切換模式狀態。只有當 toggle_mode 被設定為 true 時才起作用。