Browse Source

Merge pull request #107049 from OzelotVanilla/fix-resourcesaver-saving-default-value

Fix `ResourceSaver` saving default value of `Resource`
Thaddeus Crews 2 months ago
parent
commit
bd94fc7c19
1 changed files with 2 additions and 1 deletions
  1. 2 1
      scene/resources/resource_format_text.cpp

+ 2 - 1
scene/resources/resource_format_text.cpp

@@ -34,6 +34,7 @@
 #include "core/io/dir_access.h"
 #include "core/io/missing_resource.h"
 #include "core/object/script_language.h"
+#include "scene/property_utils.h"
 
 void ResourceLoaderText::_printerr() {
 	ERR_PRINT(vformat("%s:%d - Parse Error: %s.", res_path, lines, error_text));
@@ -1930,7 +1931,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Reso
 					}
 				}
 
-				Variant default_value = ClassDB::class_get_default_property_value(res->get_class(), name);
+				Variant default_value = PropertyUtils::get_property_default_value(res.ptr(), name);
 
 				if (default_value.get_type() != Variant::NIL && bool(Variant::evaluate(Variant::OP_EQUAL, value, default_value))) {
 					continue;