diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/bind/core_bind.cpp | 12 | ||||
-rw-r--r-- | core/bind/core_bind.h | 2 | ||||
-rw-r--r-- | core/class_db.cpp | 7 | ||||
-rw-r--r-- | core/io/marshalls.cpp | 12 | ||||
-rw-r--r-- | core/io/resource_loader.cpp | 5 | ||||
-rw-r--r-- | core/object.cpp | 16 | ||||
-rw-r--r-- | core/os/os.cpp | 6 | ||||
-rw-r--r-- | core/os/os.h | 1 | ||||
-rw-r--r-- | core/project_settings.cpp | 10 |
9 files changed, 59 insertions, 12 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 0eacffeb88..68650019a2 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -3024,6 +3024,16 @@ float _Engine::get_frames_per_second() const { return Engine::get_singleton()->get_frames_per_second(); } +uint64_t _Engine::get_physics_frames() const { + + return Engine::get_singleton()->get_physics_frames(); +} + +uint64_t _Engine::get_idle_frames() const { + + return Engine::get_singleton()->get_idle_frames(); +} + void _Engine::set_time_scale(float p_scale) { Engine::get_singleton()->set_time_scale(p_scale); } @@ -3108,6 +3118,8 @@ void _Engine::_bind_methods() { ClassDB::bind_method(D_METHOD("get_frames_drawn"), &_Engine::get_frames_drawn); ClassDB::bind_method(D_METHOD("get_frames_per_second"), &_Engine::get_frames_per_second); + ClassDB::bind_method(D_METHOD("get_physics_frames"), &_Engine::get_physics_frames); + ClassDB::bind_method(D_METHOD("get_idle_frames"), &_Engine::get_idle_frames); ClassDB::bind_method(D_METHOD("get_main_loop"), &_Engine::get_main_loop); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 7c5031cad4..65f20c375e 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -747,6 +747,8 @@ public: int get_target_fps() const; float get_frames_per_second() const; + uint64_t get_physics_frames() const; + uint64_t get_idle_frames() const; int get_frames_drawn(); diff --git a/core/class_db.cpp b/core/class_db.cpp index 3cd04c6573..65f0c6008c 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -389,6 +389,13 @@ uint64_t ClassDB::get_api_hash(APIType p_api) { while ((k = t->method_map.next(k))) { + String name = k->operator String(); + + ERR_CONTINUE(name.empty()); + + if (name[0] == '_') + continue; // Ignore non-virtual methods that start with an underscore + snames.push_back(*k); } diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 8c8f65c3a0..e847a9cf0c 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -803,6 +803,18 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo } } break; case Variant::OBJECT: { +#ifdef DEBUG_ENABLED + // Test for potential wrong values sent by the debugger when it breaks. + Object *obj = p_variant; + if (!obj || !ObjectDB::instance_validate(obj)) { + // Object is invalid, send a NULL instead. + if (buf) { + encode_uint32(Variant::NIL, buf); + } + r_len += 4; + return OK; + } +#endif // DEBUG_ENABLED if (!p_full_objects) { flags |= ENCODE_FLAG_OBJECT_AS_ID; } diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 5d85634895..7471ab4241 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -277,6 +277,11 @@ RES ResourceLoader::_load(const String &p_path, const String &p_original_path, c ERR_FAIL_COND_V_MSG(found, RES(), "Failed loading resource: " + p_path + "."); +#ifdef TOOLS_ENABLED + FileAccessRef file_check = FileAccess::create(FileAccess::ACCESS_RESOURCES); + ERR_FAIL_COND_V_MSG(!file_check->file_exists(p_path), RES(), "Resource file not found: " + p_path + "."); +#endif + ERR_FAIL_V_MSG(RES(), "No loader found for resource: " + p_path + "."); } diff --git a/core/object.cpp b/core/object.cpp index 35ccc38d4e..21666a334c 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1185,13 +1185,11 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int const Connection &c = slot_map.getv(i).conn; - Object *target; -#ifdef DEBUG_ENABLED - target = ObjectDB::get_instance(slot_map.getk(i)._id); - ERR_CONTINUE(!target); -#else - target = c.target; -#endif + Object *target = ObjectDB::get_instance(slot_map.getk(i)._id); + if (!target) { + // Target might have been deleted during signal callback, this is expected and OK. + continue; + } const Variant **args = p_args; int argc = p_argcount; @@ -1519,10 +1517,6 @@ void Object::_disconnect(const StringName &p_signal, Object *p_to_object, const Signal *s = signal_map.getptr(p_signal); ERR_FAIL_COND_MSG(!s, vformat("Nonexistent signal '%s' in %s.", p_signal, to_string())); - ERR_FAIL_COND_MSG(s->lock > 0, - vformat("Attempt to disconnect %s signal '%s' while in emission callback '%s' (in target %s). Use CONNECT_DEFERRED (to be able to safely disconnect) or CONNECT_ONESHOT (for automatic disconnection) as connection flags.", - to_string(), p_signal, p_to_method, p_to_object->to_string())); - Signal::Target target(p_to_object->get_instance_id(), p_to_method); ERR_FAIL_COND_MSG(!s->slot_map.has(target), "Disconnecting nonexistent signal '" + p_signal + "', slot: " + itos(target._id) + ":" + target.method + "."); diff --git a/core/os/os.cpp b/core/os/os.cpp index edb2416b67..81dea159a6 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -343,6 +343,12 @@ String OS::get_cache_path() const { return "."; } +// Path to macOS .app bundle resources +String OS::get_bundle_resource_dir() const { + + return "."; +}; + // OS specific path for user:// String OS::get_user_data_dir() const { diff --git a/core/os/os.h b/core/os/os.h index 593ea2b645..714c4e3f09 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -411,6 +411,7 @@ public: virtual String get_data_path() const; virtual String get_config_path() const; virtual String get_cache_path() const; + virtual String get_bundle_resource_dir() const; virtual String get_user_data_dir() const; virtual String get_resource_dir() const; diff --git a/core/project_settings.cpp b/core/project_settings.cpp index a30967dcca..a01a8a35c6 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -383,8 +383,16 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b } } - // Attempt with PCK bundled into executable +#ifdef OSX_ENABLED + // Attempt to load PCK from macOS .app bundle resources + if (!found) { + if (_load_resource_pack(OS::get_singleton()->get_bundle_resource_dir().plus_file(exec_basename + ".pck"))) { + found = true; + } + } +#endif + // Attempt with PCK bundled into executable if (!found) { if (_load_resource_pack(exec_path)) { found = true; |