summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-12 19:33:07 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-12 19:33:07 -0300
commitf0abda999e179faf1577026d0369062349cb4897 (patch)
treebae45f79daffddd7524dc142df0324841c453103 /tools
parentbe223c91f93f8e5235a4425236a4c3254c3e62c1 (diff)
resolve numerical error when comparing instancing an inheritance to avoid saving changed properties when they didn't, closes 4759
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/property_editor.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 2f0ba2da99..7dfcf88e2c 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -1963,6 +1963,13 @@ bool PropertyEditor::_is_property_different(const Variant& p_current, const Vari
return false;
}
+ if (p_current.get_type()==Variant::REAL && p_orig.get_type()==Variant::REAL) {
+ float a = p_current;
+ float b = p_orig;
+
+ return Math::abs(a-b)>CMP_EPSILON; //this must be done because, as some scenes save as text, there might be a tiny difference in floats due to numerical error
+ }
+
return bool(Variant::evaluate(Variant::OP_NOT_EQUAL,p_current,p_orig));
}
@@ -2232,6 +2239,7 @@ void PropertyEditor::_check_reload_status(const String&p_name, TreeItem* item) {
if (_get_instanced_node_original_property(p_name,vorig) || usage) {
Variant v = obj->get(p_name);
+
bool changed = _is_property_different(v,vorig,usage);
//if ((found!=-1 && !is_disabled)!=changed) {