1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-06 17:25:19 +00:00

Merge pull request #106099 from xefensor/master

Fix edit resource on inspector when inside array or dictionary
This commit is contained in:
Thaddeus Crews
2025-11-07 10:32:34 -06:00
2 changed files with 17 additions and 0 deletions

View File

@@ -301,6 +301,10 @@ void EditorPropertyArray::_object_id_selected(const StringName &p_property, Obje
emit_signal(SNAME("object_id_selected"), p_property, p_id);
}
void EditorPropertyArray::_resource_selected(const String &p_path, Ref<Resource> p_resource) {
emit_signal(SNAME("resource_selected"), get_edited_property(), p_resource);
}
void EditorPropertyArray::_create_new_property_slot() {
int idx = slots.size();
HBoxContainer *hbox = memnew(HBoxContainer);
@@ -516,6 +520,9 @@ void EditorPropertyArray::update_property() {
new_prop->set_use_folding(is_using_folding());
new_prop->connect(SNAME("property_changed"), callable_mp(this, &EditorPropertyArray::_property_changed));
new_prop->connect(SNAME("object_id_selected"), callable_mp(this, &EditorPropertyArray::_object_id_selected));
if (value_type == Variant::OBJECT) {
new_prop->connect("resource_selected", callable_mp(this, &EditorPropertyArray::_resource_selected), CONNECT_DEFERRED);
}
new_prop->set_h_size_flags(SIZE_EXPAND_FILL);
new_prop->set_read_only(is_read_only());
@@ -1415,6 +1422,9 @@ void EditorPropertyDictionary::update_property() {
new_prop->set_use_folding(is_using_folding());
new_prop->connect(SNAME("property_changed"), callable_mp(this, &EditorPropertyDictionary::_property_changed));
new_prop->connect(SNAME("object_id_selected"), callable_mp(this, &EditorPropertyDictionary::_object_id_selected));
if (value_type == Variant::OBJECT) {
new_prop->connect("resource_selected", callable_mp(this, &EditorPropertyDictionary::_resource_selected), CONNECT_DEFERRED);
}
new_prop->set_h_size_flags(SIZE_EXPAND_FILL);
if (slot.index != EditorPropertyDictionaryObject::NEW_KEY_INDEX && slot.index != EditorPropertyDictionaryObject::NEW_VALUE_INDEX) {
new_prop->set_label(" ");
@@ -1477,6 +1487,10 @@ void EditorPropertyDictionary::_object_id_selected(const StringName &p_property,
emit_signal(SNAME("object_id_selected"), p_property, p_id);
}
void EditorPropertyDictionary::_resource_selected(const String &p_path, Ref<Resource> p_resource) {
emit_signal(SNAME("resource_selected"), get_edited_property(), p_resource);
}
void EditorPropertyDictionary::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {