diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/camera_2d.cpp | 6 | ||||
-rw-r--r-- | scene/2d/camera_2d.h | 2 | ||||
-rw-r--r-- | scene/2d/line_builder.cpp | 2 | ||||
-rw-r--r-- | scene/2d/navigation_agent_2d.cpp | 2 | ||||
-rw-r--r-- | scene/3d/navigation_agent_3d.cpp | 2 | ||||
-rw-r--r-- | scene/main/window.cpp | 10 | ||||
-rw-r--r-- | scene/resources/tile_set.cpp | 4 |
7 files changed, 22 insertions, 6 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index fe6bee0f1b..f7d2ae7d2d 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -266,6 +266,8 @@ void Camera2D::_notification(int p_what) { clear_current(); } viewport = nullptr; + just_exited_tree = true; + callable_mp(this, &Camera2D::_reset_just_exited).call_deferred(); } break; #ifdef TOOLS_ENABLED @@ -438,6 +440,10 @@ void Camera2D::_update_process_internal_for_smoothing() { void Camera2D::make_current() { ERR_FAIL_COND(!enabled || !is_inside_tree()); get_tree()->call_group(group_name, "_make_current", this); + if (just_exited_tree) { + // If camera exited the scene tree in the same frame, group call will skip it, so this needs to be called manually. + _make_current(this); + } _update_scroll(); } diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h index 7a77266db8..2417953691 100644 --- a/scene/2d/camera_2d.h +++ b/scene/2d/camera_2d.h @@ -51,6 +51,7 @@ protected: Point2 camera_pos; Point2 smoothed_camera_pos; bool first = true; + bool just_exited_tree = false; ObjectID custom_viewport_id; // to check validity Viewport *custom_viewport = nullptr; @@ -88,6 +89,7 @@ protected: void _update_scroll(); void _make_current(Object *p_which); + void _reset_just_exited() { just_exited_tree = false; } void _set_old_smoothing(real_t p_enable); diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp index d91f6e36bb..0970325502 100644 --- a/scene/2d/line_builder.cpp +++ b/scene/2d/line_builder.cpp @@ -393,6 +393,8 @@ void LineBuilder::build() { if (end_cap_mode == Line2D::LINE_CAP_BOX) { pos_up1 += f0 * hw * width_factor; pos_down1 += f0 * hw * width_factor; + + current_distance1 += hw * width_factor; } if (texture_mode == Line2D::LINE_TEXTURE_TILE) { diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp index 6aa7779b09..52a1213a49 100644 --- a/scene/2d/navigation_agent_2d.cpp +++ b/scene/2d/navigation_agent_2d.cpp @@ -119,7 +119,7 @@ void NavigationAgent2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_debug_path_custom_line_width", "line_width"), &NavigationAgent2D::set_debug_path_custom_line_width); ClassDB::bind_method(D_METHOD("get_debug_path_custom_line_width"), &NavigationAgent2D::get_debug_path_custom_line_width); - ADD_GROUP("Debug", ""); + ADD_GROUP("Debug", "debug_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_enabled"), "set_debug_enabled", "get_debug_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_use_custom"), "set_debug_use_custom", "get_debug_use_custom"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_path_custom_color"), "set_debug_path_custom_color", "get_debug_path_custom_color"); diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp index 081e7505d0..16f357194e 100644 --- a/scene/3d/navigation_agent_3d.cpp +++ b/scene/3d/navigation_agent_3d.cpp @@ -130,7 +130,7 @@ void NavigationAgent3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_debug_path_custom_point_size", "point_size"), &NavigationAgent3D::set_debug_path_custom_point_size); ClassDB::bind_method(D_METHOD("get_debug_path_custom_point_size"), &NavigationAgent3D::get_debug_path_custom_point_size); - ADD_GROUP("Debug", ""); + ADD_GROUP("Debug", "debug_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_enabled"), "set_debug_enabled", "get_debug_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_use_custom"), "set_debug_use_custom", "get_debug_use_custom"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_path_custom_color"), "set_debug_path_custom_color", "get_debug_path_custom_color"); diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 771e074d48..663dd586c0 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -1422,6 +1422,9 @@ void Window::popup_centered_clamped(const Size2i &p_size, float p_fallback_ratio ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND_MSG(window_id == DisplayServer::MAIN_WINDOW_ID, "Can't popup the main window."); + // Consider the current size when calling with the default value. + Size2i expected_size = p_size == Size2i() ? size : p_size; + Rect2 parent_rect; if (is_embedded()) { @@ -1436,7 +1439,7 @@ void Window::popup_centered_clamped(const Size2i &p_size, float p_fallback_ratio Vector2i size_ratio = parent_rect.size * p_fallback_ratio; Rect2i popup_rect; - popup_rect.size = Vector2i(MIN(size_ratio.x, p_size.x), MIN(size_ratio.y, p_size.y)); + popup_rect.size = Vector2i(MIN(size_ratio.x, expected_size.x), MIN(size_ratio.y, expected_size.y)); popup_rect.size = _clamp_window_size(popup_rect.size); if (parent_rect != Rect2()) { @@ -1450,6 +1453,9 @@ void Window::popup_centered(const Size2i &p_minsize) { ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND_MSG(window_id == DisplayServer::MAIN_WINDOW_ID, "Can't popup the main window."); + // Consider the current size when calling with the default value. + Size2i expected_size = p_minsize == Size2i() ? size : p_minsize; + Rect2 parent_rect; if (is_embedded()) { @@ -1462,7 +1468,7 @@ void Window::popup_centered(const Size2i &p_minsize) { } Rect2i popup_rect; - popup_rect.size = _clamp_window_size(get_size().max(p_minsize)); + popup_rect.size = _clamp_window_size(expected_size); if (parent_rect != Rect2()) { popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2; diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 58a638804d..fee0a4a910 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -4805,8 +4805,8 @@ void TileSetScenesCollectionSource::set_scene_tile_scene(int p_id, Ref<PackedSce scene_state = scene_state->get_base_scene_state(); } ERR_FAIL_COND_MSG(type.is_empty(), vformat("Invalid PackedScene for TileSetScenesCollectionSource: %s. Could not get the type of the root node.", p_packed_scene->get_path())); - bool extends_correct_class = ClassDB::is_parent_class(type, "Control") || ClassDB::is_parent_class(type, "Node2D"); - ERR_FAIL_COND_MSG(!extends_correct_class, vformat("Invalid PackedScene for TileSetScenesCollectionSource: %s. Root node should extend Control or Node2D. Found %s instead.", p_packed_scene->get_path(), type)); + bool extends_correct_class = ClassDB::is_parent_class(type, "CanvasItem"); + ERR_FAIL_COND_MSG(!extends_correct_class, vformat("Invalid PackedScene for TileSetScenesCollectionSource: %s. Root node should extend CanvasItem. Found %s instead.", p_packed_scene->get_path(), type)); scenes[p_id].scene = p_packed_scene; } else { |