summaryrefslogtreecommitdiffstats
path: root/core/io/resource_format_binary.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2018-11-08 11:30:02 -0300
committerJuan Linietsky <reduzio@gmail.com>2018-11-08 11:30:59 -0300
commitf2e54057aec3a4e4fbb9f9da5729915deb2f4648 (patch)
tree664e4d0ee569a4f9f2a9254771168949a2e35b14 /core/io/resource_format_binary.cpp
parente7cb47e686368b462a5aec62379dcfb1c6d7a821 (diff)
downloadredot-engine-f2e54057aec3a4e4fbb9f9da5729915deb2f4648.tar.gz
-Moved EditorDefaultValue to ClassDB, made it core
-Removed one and zero hints for properties, replaced by default value
Diffstat (limited to 'core/io/resource_format_binary.cpp')
-rw-r--r--core/io/resource_format_binary.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index aa73d7bc5c..6f3a8c3d2e 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -1813,8 +1813,13 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p
Property p;
p.name_idx = get_string_index(F->get().name);
p.value = E->get()->get(F->get().name);
- if (((F->get().usage & PROPERTY_USAGE_STORE_IF_NONZERO) && p.value.is_zero()) || ((F->get().usage & PROPERTY_USAGE_STORE_IF_NONONE) && p.value.is_one()))
+
+ Variant default_value = ClassDB::class_get_default_property_value(E->get()->get_class(), F->get().name);
+
+ if (default_value.get_type() != Variant::NIL && bool(Variant::evaluate(Variant::OP_EQUAL, p.value, default_value))) {
continue;
+ }
+
p.pi = F->get();
rd.properties.push_back(p);