diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/io/resource_format_binary.cpp | 7 | ||||
-rw-r--r-- | core/io/resource_format_binary.h | 1 | ||||
-rw-r--r-- | core/math/math_funcs.h | 6 | ||||
-rw-r--r-- | core/object.cpp | 2 | ||||
-rw-r--r-- | core/script_debugger_remote.cpp | 8 | ||||
-rw-r--r-- | core/script_debugger_remote.h | 4 |
6 files changed, 11 insertions, 17 deletions
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index d2c656b8eb..6c48942d72 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1501,7 +1501,7 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia if (!resource_set.has(res)) { f->store_32(OBJECT_EMPTY); - ERR_EXPLAIN("Resource was not pre cached for the resource section, bug?"); + ERR_EXPLAIN("Resource was not pre cached for the resource section, most likely due to circular refedence."); ERR_FAIL(); } @@ -1650,6 +1650,10 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant return; if (!p_main && (!bundle_resources) && res->get_path().length() && res->get_path().find("::") == -1) { + if (res->get_path() == path) { + ERR_PRINTS("Circular reference to resource being saved found: '" + local_path + "' will be null next time it's loaded."); + return; + } int idx = external_resources.size(); external_resources[res] = idx; return; @@ -1774,6 +1778,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p takeover_paths = false; local_path = p_path.get_base_dir(); + path = ProjectSettings::get_singleton()->localize_path(p_path); _find_resources(p_resource, true); diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h index c3c477b805..a4894e4033 100644 --- a/core/io/resource_format_binary.h +++ b/core/io/resource_format_binary.h @@ -114,6 +114,7 @@ public: class ResourceFormatSaverBinaryInstance { String local_path; + String path; bool relative_paths; bool bundle_resources; diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 629002ced6..f8f5ddfeaa 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -219,15 +219,15 @@ public: static _ALWAYS_INLINE_ int wrapi(int value, int min, int max) { int rng = max - min; - return min + ((((value - min) % rng) + rng) % rng); + return (rng != 0) ? min + ((((value - min) % rng) + rng) % rng) : min; } static _ALWAYS_INLINE_ double wrapf(double value, double min, double max) { double rng = max - min; - return value - (rng * Math::floor((value - min) / rng)); + return (!is_equal_approx(rng, 0.0)) ? value - (rng * Math::floor((value - min) / rng)) : min; } static _ALWAYS_INLINE_ float wrapf(float value, float min, float max) { float rng = max - min; - return value - (rng * Math::floor((value - min) / rng)); + return (!is_equal_approx(rng, 0.0f)) ? value - (rng * Math::floor((value - min) / rng)) : min; } // double only, as these functions are mainly used by the editor and not performance-critical, diff --git a/core/object.cpp b/core/object.cpp index 4e0416ccb0..c46ecc5193 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1014,7 +1014,7 @@ void Object::set_script(const RefPtr &p_script) { } } - _change_notify("script"); + _change_notify(); //scripts may add variables, so refresh is desired emit_signal(CoreStringNames::get_singleton()->script_changed); } diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index ee6133f374..9780cc48ea 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -139,10 +139,6 @@ void ScriptDebuggerRemote::debug(ScriptLanguage *p_script, bool p_can_continue) ERR_FAIL(); } - if (allow_focus_steal_pid) { - OS::get_singleton()->enable_for_stealing_focus(allow_focus_steal_pid); - } - packet_peer_stream->put_var("debug_enter"); packet_peer_stream->put_var(2); packet_peer_stream->put_var(p_can_continue); @@ -1058,9 +1054,6 @@ void ScriptDebuggerRemote::profiling_set_frame_times(float p_frame_time, float p physics_frame_time = p_physics_frame_time; } -void ScriptDebuggerRemote::set_allow_focus_steal_pid(OS::ProcessID p_pid) { - allow_focus_steal_pid = p_pid; -} ScriptDebuggerRemote::ResourceUsageFunc ScriptDebuggerRemote::resource_usage_func = NULL; @@ -1083,7 +1076,6 @@ ScriptDebuggerRemote::ScriptDebuggerRemote() : char_count(0), last_msec(0), msec_count(0), - allow_focus_steal_pid(0), locking(false), poll_every(0), request_scene_tree(NULL), diff --git a/core/script_debugger_remote.h b/core/script_debugger_remote.h index 7afc90428d..1fc9d7c7f1 100644 --- a/core/script_debugger_remote.h +++ b/core/script_debugger_remote.h @@ -99,8 +99,6 @@ class ScriptDebuggerRemote : public ScriptDebugger { uint64_t last_msec; uint64_t msec_count; - OS::ProcessID allow_focus_steal_pid; - bool locking; //hack to avoid a deadloop static void _print_handler(void *p_this, const String &p_string, bool p_error); @@ -174,8 +172,6 @@ public: virtual void profiling_end(); virtual void profiling_set_frame_times(float p_frame_time, float p_idle_time, float p_physics_time, float p_physics_frame_time); - void set_allow_focus_steal_pid(OS::ProcessID p_pid); - ScriptDebuggerRemote(); ~ScriptDebuggerRemote(); }; |