summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/packed_scene.cpp16
-rw-r--r--scene/resources/theme.cpp7
2 files changed, 17 insertions, 6 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp
index 5df22ba8cc..5ac7946391 100644
--- a/scene/resources/packed_scene.cpp
+++ b/scene/resources/packed_scene.cpp
@@ -545,9 +545,19 @@ https://github.com/godotengine/godot/issues/3127
}
#endif
- if (exists && bool(Variant::evaluate(Variant::OP_EQUAL,value,original))) {
- //exists and did not change
- continue;
+ if (exists) {
+
+ //check if already exists and did not change
+ if (value.get_type()==Variant::REAL && original.get_type()==Variant::REAL) {
+ //this must be done because, as some scenes save as text, there might be a tiny difference in floats due to numerical error
+ float a = value;
+ float b = original;
+
+ if (Math::abs(a-b)<CMP_EPSILON)
+ continue;
+ } else if (bool(Variant::evaluate(Variant::OP_EQUAL,value,original))) {
+ continue;
+ }
}
if (!exists && isdefault) {
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 8d0aedbf93..2f4d37053e 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -240,7 +240,7 @@ Ref<Texture> Theme::get_icon(const StringName& p_name,const StringName& p_type)
bool Theme::has_icon(const StringName& p_name,const StringName& p_type) const {
- return (icon_map.has(p_type) && icon_map[p_type].has(p_name));
+ return (icon_map.has(p_type) && icon_map[p_type].has(p_name) && icon_map[p_type][p_name].is_valid());
}
@@ -337,12 +337,13 @@ Ref<StyleBox> Theme::get_stylebox(const StringName& p_name,const StringName& p_t
return style_map[p_type][p_name];
} else {
return default_style;
+
}
}
bool Theme::has_stylebox(const StringName& p_name,const StringName& p_type) const {
- return (style_map.has(p_type) && style_map[p_type].has(p_name) );
+ return (style_map.has(p_type) && style_map[p_type].has(p_name) && style_map[p_type][p_name].is_valid());
}
void Theme::clear_stylebox(const StringName& p_name,const StringName& p_type) {
@@ -402,7 +403,7 @@ Ref<Font> Theme::get_font(const StringName& p_name,const StringName& p_type) con
bool Theme::has_font(const StringName& p_name,const StringName& p_type) const {
- return (font_map.has(p_type) && font_map[p_type].has(p_name));
+ return (font_map.has(p_type) && font_map[p_type].has(p_name) && font_map[p_type][p_name].is_valid());
}
void Theme::clear_font(const StringName& p_name,const StringName& p_type) {