diff options
-rw-r--r-- | core/bind/core_bind.cpp | 12 | ||||
-rw-r--r-- | core/bind/core_bind.h | 2 | ||||
-rw-r--r-- | core/object.cpp | 16 | ||||
-rw-r--r-- | editor/editor_node.cpp | 47 | ||||
-rw-r--r-- | editor/editor_node.h | 2 | ||||
-rw-r--r-- | editor/editor_resource_preview.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 25 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 6 | ||||
-rw-r--r-- | scene/gui/center_container.cpp | 6 | ||||
-rw-r--r-- | scene/gui/graph_edit.cpp | 7 |
10 files changed, 76 insertions, 49 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/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/editor/editor_node.cpp b/editor/editor_node.cpp index 0ea8e04471..c5b67eb971 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -369,6 +369,19 @@ void EditorNode::_notification(int p_what) { case NOTIFICATION_READY: { + { + _initializing_addons = true; + Vector<String> addons; + if (ProjectSettings::get_singleton()->has_setting("editor_plugins/enabled")) { + addons = ProjectSettings::get_singleton()->get("editor_plugins/enabled"); + } + + for (int i = 0; i < addons.size(); i++) { + set_addon_plugin_enabled(addons[i], true); + } + _initializing_addons = false; + } + VisualServer::get_singleton()->viewport_set_hide_scenario(get_scene_root()->get_viewport_rid(), true); VisualServer::get_singleton()->viewport_set_hide_canvas(get_scene_root()->get_viewport_rid(), true); VisualServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(), true); @@ -660,12 +673,14 @@ void EditorNode::_sources_changed(bool p_exist) { if (waiting_for_first_scan) { waiting_for_first_scan = false; - EditorResourcePreview::get_singleton()->start(); //start previes now that it's safe + // Start preview thread now that it's safe. + if (!singleton->cmdline_export_mode) { + EditorResourcePreview::get_singleton()->start(); + } _load_docks(); if (defer_load_scene != "") { - load_scene(defer_load_scene); defer_load_scene = ""; } @@ -1155,7 +1170,10 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { save.step(TTR("Saving Scene"), 4); _save_scene(p_file, p_idx); - EditorResourcePreview::get_singleton()->check_for_invalidation(p_file); + + if (!singleton->cmdline_export_mode) { + EditorResourcePreview::get_singleton()->check_for_invalidation(p_file); + } } bool EditorNode::_validate_scene_recursive(const String &p_filename, Node *p_node) { @@ -3839,7 +3857,7 @@ Ref<Texture> EditorNode::get_class_icon(const String &p_class, const String &p_f void EditorNode::progress_add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) { - if (singleton->disable_progress_dialog) { + if (singleton->cmdline_export_mode) { print_line(p_task + ": begin: " + p_label + " steps: " + itos(p_steps)); } else { singleton->progress_dialog->add_task(p_task, p_label, p_steps, p_can_cancel); @@ -3848,7 +3866,7 @@ void EditorNode::progress_add_task(const String &p_task, const String &p_label, bool EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_refresh) { - if (singleton->disable_progress_dialog) { + if (singleton->cmdline_export_mode) { print_line("\t" + p_task + ": step " + itos(p_step) + ": " + p_state); return false; } else { @@ -3859,7 +3877,7 @@ bool EditorNode::progress_task_step(const String &p_task, const String &p_state, void EditorNode::progress_end_task(const String &p_task) { - if (singleton->disable_progress_dialog) { + if (singleton->cmdline_export_mode) { print_line(p_task + ": end"); } else { singleton->progress_dialog->end_task(p_task); @@ -3945,7 +3963,7 @@ Error EditorNode::export_preset(const String &p_preset, const String &p_path, bo export_defer.path = p_path; export_defer.debug = p_debug; export_defer.pack_only = p_pack_only; - disable_progress_dialog = true; + cmdline_export_mode = true; return OK; } @@ -5587,7 +5605,7 @@ EditorNode::EditorNode() { _initializing_addons = false; docks_visible = true; restoring_scenes = false; - disable_progress_dialog = false; + cmdline_export_mode = false; scene_distraction = false; script_distraction = false; @@ -6776,19 +6794,6 @@ EditorNode::EditorNode() { import_dock->initialize_import_options(); - { - _initializing_addons = true; - Vector<String> addons; - if (ProjectSettings::get_singleton()->has_setting("editor_plugins/enabled")) { - addons = ProjectSettings::get_singleton()->get("editor_plugins/enabled"); - } - - for (int i = 0; i < addons.size(); i++) { - set_addon_plugin_enabled(addons[i], true); - } - _initializing_addons = false; - } - FileAccess::set_file_close_fail_notify_callback(_file_access_close_error_notify); waiting_for_first_scan = true; diff --git a/editor/editor_node.h b/editor/editor_node.h index 7f53f77c76..a5c04d3531 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -561,7 +561,7 @@ private: bool pack_only; } export_defer; - bool disable_progress_dialog; + bool cmdline_export_mode; static EditorNode *singleton; diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 9d31e26086..f63d4884e2 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -215,7 +215,6 @@ void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref< void EditorResourcePreview::_thread() { -#ifndef SERVER_ENABLED exited = false; while (!exit) { @@ -349,7 +348,6 @@ void EditorResourcePreview::_thread() { preview_mutex->unlock(); } } -#endif exited = true; } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 9223e86f42..e9a705a0dc 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3987,29 +3987,21 @@ void CanvasItemEditor::_update_scrollbars() { updating_scroll = true; - // Move the zoom buttons + // Move the zoom buttons. Point2 controls_vb_begin = Point2(5, 5); controls_vb_begin += (show_rulers) ? Point2(RULER_WIDTH, RULER_WIDTH) : Point2(); controls_vb->set_begin(controls_vb_begin); - // Move and resize the scrollbars - Size2 size = viewport->get_size(); Size2 hmin = h_scroll->get_minimum_size(); Size2 vmin = v_scroll->get_minimum_size(); - v_scroll->set_begin(Point2(size.width - vmin.width, (show_rulers) ? RULER_WIDTH : 0)); - v_scroll->set_end(Point2(size.width, size.height)); - - h_scroll->set_begin(Point2((show_rulers) ? RULER_WIDTH : 0, size.height - hmin.height)); - h_scroll->set_end(Point2(size.width - vmin.width, size.height)); - - // Get the visible frame + // Get the visible frame. Size2 screen_rect = Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height")); Rect2 local_rect = Rect2(Point2(), viewport->get_size() - Size2(vmin.width, hmin.height)); _queue_update_bone_list(); - // Calculate scrollable area + // Calculate scrollable area. Rect2 canvas_item_rect = Rect2(Point2(), screen_rect); if (editor->get_edited_scene()) { Rect2 content_rect = _get_encompassing_rect(editor->get_edited_scene()); @@ -4019,7 +4011,8 @@ void CanvasItemEditor::_update_scrollbars() { canvas_item_rect.size += screen_rect * 2; canvas_item_rect.position -= screen_rect; - // Constraints the view offset and updates the scrollbars + // Constraints the view offset and updates the scrollbars. + Size2 size = viewport->get_size(); Point2 begin = canvas_item_rect.position; Point2 end = canvas_item_rect.position + canvas_item_rect.size - local_rect.size / zoom; bool constrain_editor_view = bool(EditorSettings::get_singleton()->get("editors/2d/constrain_editor_view")); @@ -4066,7 +4059,13 @@ void CanvasItemEditor::_update_scrollbars() { h_scroll->set_page(screen_rect.x); } - // Calculate scrollable area + // Move and resize the scrollbars, avoiding overlap. + v_scroll->set_begin(Point2(size.width - vmin.width, (show_rulers) ? RULER_WIDTH : 0)); + v_scroll->set_end(Point2(size.width, size.height - (h_scroll->is_visible() ? hmin.height : 0))); + h_scroll->set_begin(Point2((show_rulers) ? RULER_WIDTH : 0, size.height - hmin.height)); + h_scroll->set_end(Point2(size.width - (v_scroll->is_visible() ? vmin.width : 0), size.height)); + + // Calculate scrollable area. v_scroll->set_value(view_offset.y); h_scroll->set_value(view_offset.x); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 2b002d3b5d..6a214b8669 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -479,7 +479,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; } - (NSRange)markedRange { - return (markedText.length > 0) ? NSMakeRange(0, markedText.length - 1) : kEmptyRange; + return NSMakeRange(0, markedText.length); } - (NSRange)selectedRange { @@ -492,6 +492,10 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; } else { [markedText initWithString:aString]; } + if (markedText.length == 0) { + [self unmarkText]; + return; + } if (OS_OSX::singleton->im_active) { imeInputEventInProgress = true; OS_OSX::singleton->im_text.parse_utf8([[markedText mutableString] UTF8String]); diff --git a/scene/gui/center_container.cpp b/scene/gui/center_container.cpp index 9f4353ceb6..64d6885bc8 100644 --- a/scene/gui/center_container.cpp +++ b/scene/gui/center_container.cpp @@ -54,7 +54,13 @@ Size2 CenterContainer::get_minimum_size() const { void CenterContainer::set_use_top_left(bool p_enable) { + if (use_top_left == p_enable) { + return; + } + use_top_left = p_enable; + + minimum_size_changed(); queue_sort(); } diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index be465751b6..42bb8023f2 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -200,6 +200,13 @@ void GraphEdit::_update_scroll() { else v_scroll->show(); + Size2 hmin = h_scroll->get_combined_minimum_size(); + Size2 vmin = v_scroll->get_combined_minimum_size(); + + // Avoid scrollbar overlapping. + h_scroll->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, v_scroll->is_visible() ? -vmin.width : 0); + v_scroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, h_scroll->is_visible() ? -hmin.height : 0); + set_block_minimum_size_adjust(false); if (!awaiting_scroll_offset_update) { |