diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/bind/core_bind.cpp | 2 | ||||
-rw-r--r-- | core/bind/core_bind.h | 2 | ||||
-rw-r--r-- | core/math/camera_matrix.cpp | 10 | ||||
-rw-r--r-- | core/math/camera_matrix.h | 2 | ||||
-rw-r--r-- | core/object.cpp | 15 | ||||
-rw-r--r-- | core/object.h | 4 | ||||
-rw-r--r-- | core/os/midi_driver.cpp | 7 | ||||
-rw-r--r-- | core/os/os.cpp | 2 | ||||
-rw-r--r-- | core/os/os.h | 4 |
9 files changed, 26 insertions, 22 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 95f433607c..efd7e3dbf5 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1266,7 +1266,7 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_processor_count"), &_OS::get_processor_count); ClassDB::bind_method(D_METHOD("get_executable_path"), &_OS::get_executable_path); - ClassDB::bind_method(D_METHOD("execute", "path", "arguments", "blocking", "output", "read_stderr"), &_OS::execute, DEFVAL(Array()), DEFVAL(false)); + ClassDB::bind_method(D_METHOD("execute", "path", "arguments", "blocking", "output", "read_stderr"), &_OS::execute, DEFVAL(true), DEFVAL(Array()), DEFVAL(false)); ClassDB::bind_method(D_METHOD("kill", "pid"), &_OS::kill); ClassDB::bind_method(D_METHOD("shell_open", "uri"), &_OS::shell_open); ClassDB::bind_method(D_METHOD("get_process_id"), &_OS::get_process_id); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 65f20c375e..87da51f97e 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -227,7 +227,7 @@ public: int get_low_processor_usage_mode_sleep_usec() const; String get_executable_path() const; - int execute(const String &p_path, const Vector<String> &p_arguments, bool p_blocking, Array p_output = Array(), bool p_read_stderr = false); + int execute(const String &p_path, const Vector<String> &p_arguments, bool p_blocking = true, Array p_output = Array(), bool p_read_stderr = false); Error kill(int p_pid); Error shell_open(String p_uri); diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 165bb9f823..380bae871a 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -247,7 +247,7 @@ real_t CameraMatrix::get_z_near() const { return new_plane.d; } -void CameraMatrix::get_viewport_size(real_t &r_width, real_t &r_height) const { +Vector2 CameraMatrix::get_viewport_half_extents() const { const real_t *matrix = (const real_t *)this->matrix; ///////--- Near Plane ---/////// @@ -273,8 +273,7 @@ void CameraMatrix::get_viewport_size(real_t &r_width, real_t &r_height) const { Vector3 res; near_plane.intersect_3(right_plane, top_plane, &res); - r_width = res.x; - r_height = res.y; + return Vector2(res.x, res.y); } bool CameraMatrix::get_endpoints(const Transform &p_transform, Vector3 *p_8points) const { @@ -563,9 +562,8 @@ CameraMatrix::operator String() const { real_t CameraMatrix::get_aspect() const { - real_t w, h; - get_viewport_size(w, h); - return w / h; + Vector2 vp_he = get_viewport_half_extents(); + return vp_he.x / vp_he.y; } int CameraMatrix::get_pixels_per_meter(int p_for_pixel_width) const { diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h index 59e34c0855..2eed6d25d6 100644 --- a/core/math/camera_matrix.h +++ b/core/math/camera_matrix.h @@ -73,7 +73,7 @@ struct CameraMatrix { Vector<Plane> get_projection_planes(const Transform &p_transform) const; bool get_endpoints(const Transform &p_transform, Vector3 *p_8points) const; - void get_viewport_size(real_t &r_width, real_t &r_height) const; + Vector2 get_viewport_half_extents() const; void invert(); CameraMatrix inverse() const; diff --git a/core/object.cpp b/core/object.cpp index 21666a334c..21a3b2cc6c 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1213,9 +1213,9 @@ Error Object::emit_signal(const StringName &p_name, const Variant **p_args, int MessageQueue::get_singleton()->push_call(target->get_instance_id(), c.method, args, argc, true); } else { Variant::CallError ce; - s->lock++; + _emitting = true; target->call(c.method, args, argc, ce); - s->lock--; + _emitting = false; if (ce.error != Variant::CallError::CALL_OK) { #ifdef DEBUG_ENABLED @@ -1920,6 +1920,7 @@ Object::Object() { _instance_id = ObjectDB::add_instance(this); _can_translate = true; _is_queued_for_deletion = false; + _emitting = false; instance_binding_count = 0; memset(_script_instance_bindings, 0, sizeof(void *) * MAX_SCRIPT_INSTANCE_BINDINGS); script_instance = NULL; @@ -1942,15 +1943,15 @@ Object::~Object() { const StringName *S = NULL; + if (_emitting) { + //@todo this may need to actually reach the debugger prioritarily somehow because it may crash before + ERR_PRINTS("Object " + to_string() + " was freed or unreferenced while a signal is being emitted from it. Try connecting to the signal using 'CONNECT_DEFERRED' flag, or use queue_free() to free the object (if this object is a Node) to avoid this error and potential crashes."); + } + while ((S = signal_map.next(NULL))) { Signal *s = &signal_map[*S]; - if (s->lock > 0) { - //@todo this may need to actually reach the debugger prioritarily somehow because it may crash before - ERR_PRINTS("Object was freed or unreferenced while signal '" + String(*S) + "' is being emitted from it. Try connecting to the signal using 'CONNECT_DEFERRED' flag, or use queue_free() to free the object (if this object is a Node) to avoid this error and potential crashes."); - } - //brute force disconnect for performance int slot_count = s->slot_map.size(); const VMap<Signal::Target, Signal::Slot>::Pair *slot_list = s->slot_map.get_array(); diff --git a/core/object.h b/core/object.h index ad1865da7b..865c155764 100644 --- a/core/object.h +++ b/core/object.h @@ -465,8 +465,7 @@ private: MethodInfo user; VMap<Target, Slot> slot_map; - int lock; - Signal() { lock = 0; } + Signal() {} }; HashMap<StringName, Signal> signal_map; @@ -481,6 +480,7 @@ private: bool _predelete(); void _postinitialize(); bool _can_translate; + bool _emitting; #ifdef TOOLS_ENABLED bool _edited; uint32_t _edited_version; diff --git a/core/os/midi_driver.cpp b/core/os/midi_driver.cpp index 614ce99b2e..3e020a1585 100644 --- a/core/os/midi_driver.cpp +++ b/core/os/midi_driver.cpp @@ -52,7 +52,12 @@ void MIDIDriver::receive_input_packet(uint64_t timestamp, uint8_t *data, uint32_ uint32_t param_position = 1; if (length >= 1) { - if ((data[0] & 0x80) == 0x00) { + if (data[0] >= 0xF0) { + // channel does not apply to system common messages + event->set_channel(0); + event->set_message(data[0]); + last_received_message = data[0]; + } else if ((data[0] & 0x80) == 0x00) { // running status event->set_channel(last_received_message & 0xF); event->set_message(last_received_message >> 4); diff --git a/core/os/os.cpp b/core/os/os.cpp index 81dea159a6..1ed9484208 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -221,7 +221,7 @@ bool OS::has_virtual_keyboard() const { return false; } -void OS::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect) { +void OS::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect, int p_max_input_length) { } void OS::hide_virtual_keyboard() { diff --git a/core/os/os.h b/core/os/os.h index 714c4e3f09..89b3414b3e 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -267,7 +267,7 @@ public: virtual int get_low_processor_usage_mode_sleep_usec() const; virtual String get_executable_path() const; - virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL) = 0; + virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking = true, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL) = 0; virtual Error kill(const ProcessID &p_pid) = 0; virtual int get_process_id() const; virtual void vibrate_handheld(int p_duration_ms = 500); @@ -380,7 +380,7 @@ public: }; virtual bool has_virtual_keyboard() const; - virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2()); + virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2(), int p_max_input_length = -1); virtual void hide_virtual_keyboard(); // returns height of the currently shown virtual keyboard (0 if keyboard is hidden) |