diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index ba97ae4931e0..485db754138a 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1579,14 +1579,17 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant if (E->get().usage & PROPERTY_USAGE_STORAGE) { Variant value = res->get(E->get().name); if (E->get().usage & PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT) { + NonPersistentKey npk; + npk.base = res; + npk.property = E->get().name; + non_persistent_map[npk] = value; + RES sres = value; if (sres.is_valid()) { - NonPersistentKey npk; - npk.base = res; - npk.property = E->get().name; - non_persistent_map[npk] = sres; resource_set.insert(sres); saved_resources.push_back(sres); + } else { + _find_resources(value); } } else { _find_resources(value); diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h index df8711b0524a..0cec1ceb2968 100644 --- a/core/io/resource_format_binary.h +++ b/core/io/resource_format_binary.h @@ -129,7 +129,7 @@ class ResourceFormatSaverBinaryInstance { bool operator<(const NonPersistentKey &p_key) const { return base == p_key.base ? property < p_key.property : base < p_key.base; } }; - Map non_persistent_map; + Map non_persistent_map; Map string_map; Vector strings; diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 79742491490f..141ea4635ce7 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -1357,14 +1357,17 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant &p_variant, Variant v = res->get(I->get().name); if (pi.usage & PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT) { + NonPersistentKey npk; + npk.base = res; + npk.property = pi.name; + non_persistent_map[npk] = v; + RES sres = v; if (sres.is_valid()) { - NonPersistentKey npk; - npk.base = res; - npk.property = pi.name; - non_persistent_map[npk] = sres; resource_set.insert(sres); saved_resources.push_back(sres); + } else { + _find_resources(v); } } else { _find_resources(v); diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h index d6a9061fd883..854995e10138 100644 --- a/scene/resources/resource_format_text.h +++ b/scene/resources/resource_format_text.h @@ -159,7 +159,7 @@ class ResourceFormatSaverTextInstance { bool operator<(const NonPersistentKey &p_key) const { return base == p_key.base ? property < p_key.property : base < p_key.base; } }; - Map non_persistent_map; + Map non_persistent_map; Set resource_set; List saved_resources; diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index ff3ad883637f..808989eea543 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -2703,7 +2703,7 @@ void TextureLayered::_bind_methods() { ClassDB::bind_method(D_METHOD("_get_data"), &TextureLayered::_get_data); ADD_PROPERTY(PropertyInfo(Variant::INT, "flags", PROPERTY_HINT_FLAGS, "Mipmaps,Repeat,Filter,Anisotropic Filter"), "set_flags", "get_flags"); - ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_data", "_get_data"); + ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT), "_set_data", "_get_data"); BIND_ENUM_CONSTANT(FLAGS_DEFAULT_TEXTURE_ARRAY); BIND_ENUM_CONSTANT(FLAGS_DEFAULT_TEXTURE_3D);