diff options
23 files changed, 119 insertions, 146 deletions
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 54e14074d9..2d3ec437c6 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -367,7 +367,6 @@ void EditorSpinSlider::_draw_spin_slider() { if (!hide_slider) { if (get_step() == 1) { - number_width -= updown->get_width(); Ref<Texture2D> updown2 = get_theme_icon(is_read_only() ? SNAME("updown_disabled") : SNAME("updown"), SNAME("SpinBox")); int updown_vofs = (size.height - updown2->get_height()) / 2; if (rtl) { diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 78e437b42a..602d07d9a7 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -1576,11 +1576,8 @@ void GDScriptAnalyzer::resolve_function_body(GDScriptParser::FunctionNode *p_fun resolve_suite(p_function->body); - GDScriptParser::DataType return_type = p_function->body->get_datatype(); - - if (!p_function->get_datatype().is_hard_type() && return_type.is_set()) { + if (!p_function->get_datatype().is_hard_type() && p_function->body->get_datatype().is_set()) { // Use the suite inferred type if return isn't explicitly set. - return_type.type_source = GDScriptParser::DataType::INFERRED; p_function->set_datatype(p_function->body->get_datatype()); } else if (p_function->get_datatype().is_hard_type() && (p_function->get_datatype().kind != GDScriptParser::DataType::BUILTIN || p_function->get_datatype().builtin_type != Variant::NIL)) { if (!p_function->body->has_return && (p_is_lambda || p_function->identifier->name != GDScriptLanguage::get_singleton()->strings._init)) { @@ -3017,7 +3014,7 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a push_error(vformat(R"*(Cannot call non-static function "%s()" from static function "%s()".)*", p_call->function_name, parent_function->identifier->name), p_call); } else if (!is_self && base_type.is_meta_type && !is_static) { base_type.is_meta_type = false; // For `to_string()`. - push_error(vformat(R"*(Cannot call non-static function "%s()" on a class directly. Make an instance instead.)*", p_call->function_name), p_call); + push_error(vformat(R"*(Cannot call non-static function "%s()" on the class "%s" directly. Make an instance instead.)*", p_call->function_name, base_type.to_string()), p_call); } else if (is_self && !is_static) { mark_lambda_use_self(); } @@ -4564,6 +4561,16 @@ bool GDScriptAnalyzer::get_function_signature(GDScriptParser::Node *p_source, bo base_script = base_script->get_base_script(); } + // If the base is a script, it might be trying to access members of the Script class itself. + if (p_base_type.is_meta_type && !p_is_constructor && (p_base_type.kind == GDScriptParser::DataType::SCRIPT || p_base_type.kind == GDScriptParser::DataType::CLASS)) { + MethodInfo info; + StringName script_class = p_base_type.kind == GDScriptParser::DataType::SCRIPT ? p_base_type.script_type->get_class_name() : StringName(GDScript::get_class_static()); + + if (ClassDB::get_method_info(script_class, function_name, &info)) { + return function_signature_from_info(info, r_return_type, r_par_types, r_default_arg_count, r_static, r_vararg); + } + } + if (p_is_constructor) { // Native types always have a default constructor. r_return_type = p_base_type; diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 210550a674..46cd4b0d55 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -591,6 +591,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code } } else if (callee->type == GDScriptParser::Node::SUBSCRIPT) { const GDScriptParser::SubscriptNode *subscript = static_cast<const GDScriptParser::SubscriptNode *>(call->callee); + if (subscript->is_attribute) { // May be static built-in method call. if (!call->is_super && subscript->base->type == GDScriptParser::Node::IDENTIFIER && GDScriptParser::get_builtin_type(static_cast<GDScriptParser::IdentifierNode *>(subscript->base)->name) < Variant::VARIANT_MAX) { @@ -614,7 +615,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code } else { class_name = base.type.native_type == StringName() ? base.type.script_type->get_instance_base_type() : base.type.native_type; } - if (!subscript->base->is_constant && ClassDB::class_exists(class_name) && ClassDB::has_method(class_name, call->function_name)) { + if (ClassDB::class_exists(class_name) && ClassDB::has_method(class_name, call->function_name)) { MethodBind *method = ClassDB::get_method(class_name, call->function_name); if (_can_use_ptrcall(method, arguments)) { // Exact arguments, use ptrcall. diff --git a/modules/gdscript/tests/scripts/analyzer/errors/gdscript_duplicate.gd b/modules/gdscript/tests/scripts/analyzer/errors/gdscript_duplicate.gd deleted file mode 100644 index 966d2b0aa2..0000000000 --- a/modules/gdscript/tests/scripts/analyzer/errors/gdscript_duplicate.gd +++ /dev/null @@ -1,5 +0,0 @@ -const TestClass = preload("gdscript_duplicate_class.notest.gd") - -func test(): - # (TestClass as GDScript).duplicate() exists - TestClass.duplicate() diff --git a/modules/gdscript/tests/scripts/analyzer/errors/gdscript_duplicate.out b/modules/gdscript/tests/scripts/analyzer/errors/gdscript_duplicate.out deleted file mode 100644 index b2c7fec86e..0000000000 --- a/modules/gdscript/tests/scripts/analyzer/errors/gdscript_duplicate.out +++ /dev/null @@ -1,2 +0,0 @@ -GDTEST_ANALYZER_ERROR -Cannot call non-static function "duplicate()" on a class directly. Make an instance instead. diff --git a/modules/gdscript/tests/scripts/analyzer/errors/gdscript_duplicate_class.notest.gd b/modules/gdscript/tests/scripts/analyzer/errors/gdscript_duplicate_class.notest.gd deleted file mode 100644 index 61510e14cd..0000000000 --- a/modules/gdscript/tests/scripts/analyzer/errors/gdscript_duplicate_class.notest.gd +++ /dev/null @@ -1 +0,0 @@ -extends Node diff --git a/modules/gdscript/tests/scripts/analyzer/features/gdscript_duplicate.gd b/modules/gdscript/tests/scripts/analyzer/features/gdscript_duplicate.gd deleted file mode 100644 index 030daf502c..0000000000 --- a/modules/gdscript/tests/scripts/analyzer/features/gdscript_duplicate.gd +++ /dev/null @@ -1,6 +0,0 @@ -const TestClass = preload("gdscript_duplicate_class.notest.gd") - -func test(): - # TestClass.duplicate() fails - @warning_ignore("return_value_discarded") - (TestClass as GDScript).duplicate() diff --git a/modules/gdscript/tests/scripts/analyzer/features/gdscript_duplicate.out b/modules/gdscript/tests/scripts/analyzer/features/gdscript_duplicate.out deleted file mode 100644 index d73c5eb7cd..0000000000 --- a/modules/gdscript/tests/scripts/analyzer/features/gdscript_duplicate.out +++ /dev/null @@ -1 +0,0 @@ -GDTEST_OK diff --git a/modules/gdscript/tests/scripts/analyzer/features/gdscript_duplicate_class.notest.gd b/modules/gdscript/tests/scripts/analyzer/features/gdscript_duplicate_class.notest.gd deleted file mode 100644 index 61510e14cd..0000000000 --- a/modules/gdscript/tests/scripts/analyzer/features/gdscript_duplicate_class.notest.gd +++ /dev/null @@ -1 +0,0 @@ -extends Node diff --git a/modules/gdscript/tests/scripts/parser/features/super_class_check.gd b/modules/gdscript/tests/scripts/parser/features/super_class_check.gd deleted file mode 100644 index edfc45a8d8..0000000000 --- a/modules/gdscript/tests/scripts/parser/features/super_class_check.gd +++ /dev/null @@ -1,13 +0,0 @@ -# https://github.com/godotengine/godot/issues/71994 - -func test(): - pass - -class A extends RefCounted: - pass - -class B extends A: - # Parsing `duplicate()` here would throw this error: - # Parse Error: The function signature doesn't match the parent. Parent signature is "duplicate(bool = default) -> Resource". - func duplicate(): - pass diff --git a/modules/gdscript/tests/scripts/parser/features/super_class_check.out b/modules/gdscript/tests/scripts/parser/features/super_class_check.out deleted file mode 100644 index d73c5eb7cd..0000000000 --- a/modules/gdscript/tests/scripts/parser/features/super_class_check.out +++ /dev/null @@ -1 +0,0 @@ -GDTEST_OK diff --git a/modules/gdscript/tests/scripts/runtime/features/static_duplicate.gd b/modules/gdscript/tests/scripts/runtime/features/static_duplicate.gd deleted file mode 100644 index 418501dcc5..0000000000 --- a/modules/gdscript/tests/scripts/runtime/features/static_duplicate.gd +++ /dev/null @@ -1,19 +0,0 @@ -const PreloadClass = preload("static_duplicate_preload.notest.gd") -const PreloadClassAlias = PreloadClass - -func test(): - var dup_preload_one = PreloadClass.duplicate() - print(dup_preload_one == Vector2.ONE) - - var dup_preload_two = (PreloadClass as GDScript).duplicate() - print(dup_preload_two is GDScript) - - var dup_preload_alias_one = PreloadClassAlias.duplicate() - print(dup_preload_alias_one == Vector2.ONE) - - var dup_preload_alias_two = (PreloadClassAlias as GDScript).duplicate() - print(dup_preload_alias_two is GDScript) - - var PreloadClassAsGDScript = PreloadClass as GDScript - var dup_preload_class_as_gdscript_one = PreloadClassAsGDScript.duplicate() - print(dup_preload_class_as_gdscript_one is GDScript) diff --git a/modules/gdscript/tests/scripts/runtime/features/static_duplicate.out b/modules/gdscript/tests/scripts/runtime/features/static_duplicate.out deleted file mode 100644 index 34cd5c7652..0000000000 --- a/modules/gdscript/tests/scripts/runtime/features/static_duplicate.out +++ /dev/null @@ -1,9 +0,0 @@ -GDTEST_OK -preload duplicate -true -true -preload duplicate -true -true -preload duplicate -false diff --git a/modules/gdscript/tests/scripts/runtime/features/static_duplicate_preload.notest.gd b/modules/gdscript/tests/scripts/runtime/features/static_duplicate_preload.notest.gd deleted file mode 100644 index 291ffc2c0b..0000000000 --- a/modules/gdscript/tests/scripts/runtime/features/static_duplicate_preload.notest.gd +++ /dev/null @@ -1,5 +0,0 @@ -extends RefCounted - -static func duplicate() -> Vector2: - print("preload duplicate") - return Vector2.ONE diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index 436b936586..77bf15125e 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -162,12 +162,10 @@ void AudioStreamPlayer3D::_calc_reverb_vol(Area3D *area, Vector3 listener_area_p rev_pos.y = 0; rev_pos.normalize(); - if (channel_count >= 1) { - // Stereo pair - float c = rev_pos.x * 0.5 + 0.5; - reverb_vol.write[0].l = 1.0 - c; - reverb_vol.write[0].r = c; - } + // Stereo pair. + float c = rev_pos.x * 0.5 + 0.5; + reverb_vol.write[0].l = 1.0 - c; + reverb_vol.write[0].r = c; if (channel_count >= 3) { // Center pair + Side pair @@ -183,7 +181,6 @@ void AudioStreamPlayer3D::_calc_reverb_vol(Area3D *area, Vector3 listener_area_p if (channel_count >= 4) { // Rear pair // FIXME: Not sure what math should be done here - float c = rev_pos.x * 0.5 + 0.5; reverb_vol.write[3].l = 1.0 - c; reverb_vol.write[3].r = c; } diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 8087ac6250..ad0c19b1e6 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -1233,7 +1233,7 @@ void AnimationPlayer::_animation_update_transforms() { if (aa->time < pasi.start) { stop = true; } - } else if (aa->backward) { + } else { if (aa->time > pasi.start) { stop = true; } diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index dfe9ea3b08..760c86b2cc 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -276,10 +276,6 @@ Size2 AcceptDialog::_get_contents_minimum_size() const { // Plus there is a separation size added on top. content_minsize.y += theme_cache.buttons_separation; - // Last, we make sure that we aren't below the minimum window size. - Size2 window_minsize = get_min_size(); - content_minsize.x = MAX(window_minsize.x, content_minsize.x); - content_minsize.y = MAX(window_minsize.y, content_minsize.y); return content_minsize; } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index cbb34a480b..a1e7555a5d 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -380,7 +380,7 @@ void Viewport::_notification(int p_what) { if (get_tree()->is_debugging_collisions_hint()) { PhysicsServer2D::get_singleton()->space_set_debug_contacts(find_world_2d()->get_space(), get_tree()->get_collision_debug_contact_count()); contact_2d_debug = RenderingServer::get_singleton()->canvas_item_create(); - RenderingServer::get_singleton()->canvas_item_set_parent(contact_2d_debug, find_world_2d()->get_canvas()); + RenderingServer::get_singleton()->canvas_item_set_parent(contact_2d_debug, current_canvas); #ifndef _3D_DISABLED PhysicsServer3D::get_singleton()->space_set_debug_contacts(find_world_3d()->get_space(), get_tree()->get_collision_debug_contact_count()); contact_3d_debug_multimesh = RenderingServer::get_singleton()->multimesh_create(); @@ -1172,11 +1172,16 @@ Ref<InputEvent> Viewport::_make_input_local(const Ref<InputEvent> &ev) { } Vector2 Viewport::get_mouse_position() const { - return gui.last_mouse_pos; + if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_MOUSE)) { + return get_screen_transform_internal(true).affine_inverse().xform(DisplayServer::get_singleton()->mouse_get_position()); + } else { + // Fallback to Input for getting mouse position in case of emulated mouse. + return get_screen_transform_internal().affine_inverse().xform(Input::get_singleton()->get_mouse_position()); + } } void Viewport::warp_mouse(const Vector2 &p_position) { - Transform2D xform = get_screen_transform(); + Transform2D xform = get_screen_transform_internal(); Vector2 gpos = xform.xform(p_position); Input::get_singleton()->warp_mouse(gpos); } @@ -2556,20 +2561,14 @@ bool Viewport::_sub_windows_forward_input(const Ref<InputEvent> &p_event) { if (gui.subwindow_drag == SUB_WINDOW_DRAG_RESIZE) { Vector2i diff = mm->get_position() - gui.subwindow_drag_from; Size2i min_size = gui.subwindow_focused->get_min_size(); + Size2i min_size_clamped = gui.subwindow_focused->get_clamped_minimum_size(); - Size2i min_size_adjusted = min_size; - if (gui.subwindow_focused->is_wrapping_controls()) { - Size2i cms = gui.subwindow_focused->get_contents_minimum_size(); - min_size_adjusted.x = MAX(cms.x, min_size.x); - min_size_adjusted.y = MAX(cms.y, min_size.y); - } - - min_size_adjusted.x = MAX(min_size_adjusted.x, 1); - min_size_adjusted.y = MAX(min_size_adjusted.y, 1); + min_size_clamped.x = MAX(min_size_clamped.x, 1); + min_size_clamped.y = MAX(min_size_clamped.y, 1); Rect2i r = gui.subwindow_resize_from_rect; - Size2i limit = r.size - min_size_adjusted; + Size2i limit = r.size - min_size_clamped; switch (gui.subwindow_resize_mode) { case SUB_WINDOW_RESIZE_TOP_LEFT: { @@ -3288,6 +3287,10 @@ Viewport::SDFScale Viewport::get_sdf_scale() const { } Transform2D Viewport::get_screen_transform() const { + return get_screen_transform_internal(); +} + +Transform2D Viewport::get_screen_transform_internal(bool p_absolute_position) const { return get_final_transform(); } @@ -4226,14 +4229,14 @@ DisplayServer::WindowID SubViewport::get_window_id() const { return DisplayServer::INVALID_WINDOW_ID; } -Transform2D SubViewport::get_screen_transform() const { +Transform2D SubViewport::get_screen_transform_internal(bool p_absolute_position) const { Transform2D container_transform; SubViewportContainer *c = Object::cast_to<SubViewportContainer>(get_parent()); if (c) { if (c->is_stretch_enabled()) { container_transform.scale(Vector2(c->get_stretch_shrink(), c->get_stretch_shrink())); } - container_transform = c->get_viewport()->get_screen_transform() * c->get_global_transform_with_canvas() * container_transform; + container_transform = c->get_viewport()->get_screen_transform_internal(p_absolute_position) * c->get_global_transform_with_canvas() * container_transform; } else { WARN_PRINT_ONCE("SubViewport is not a child of a SubViewportContainer. get_screen_transform doesn't return the actual screen position."); } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 4144eaabb9..055fad5369 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -651,7 +651,8 @@ public: virtual bool is_size_2d_override_stretch_enabled() const { return true; } - virtual Transform2D get_screen_transform() const; + Transform2D get_screen_transform() const; + virtual Transform2D get_screen_transform_internal(bool p_absolute_position = false) const; virtual Transform2D get_popup_base_transform() const { return Transform2D(); } #ifndef _3D_DISABLED @@ -780,7 +781,7 @@ public: void set_clear_mode(ClearMode p_mode); ClearMode get_clear_mode() const; - virtual Transform2D get_screen_transform() const override; + virtual Transform2D get_screen_transform_internal(bool p_absolute_position = false) const override; virtual Transform2D get_popup_base_transform() const override; SubViewport(); diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 9fcfb29ef7..44df648552 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -349,8 +349,30 @@ Size2i Window::get_size_with_decorations() const { return size; } +Size2i Window::_clamp_limit_size(const Size2i &p_limit_size) { + // Force window limits to respect size limitations of rendering server. + Size2i max_window_size = RS::get_singleton()->get_maximum_viewport_size(); + if (max_window_size != Size2i()) { + return p_limit_size.clamp(Vector2i(), max_window_size); + } else { + return p_limit_size.max(Vector2i()); + } +} + +void Window::_validate_limit_size() { + // When max_size is invalid, max_size_used falls back to respect size limitations of rendering server. + bool max_size_valid = (max_size.x > 0 || max_size.y > 0) && max_size.x >= min_size.x && max_size.y >= min_size.y; + max_size_used = max_size_valid ? max_size : RS::get_singleton()->get_maximum_viewport_size(); +} + void Window::set_max_size(const Size2i &p_max_size) { - max_size = p_max_size; + Size2i max_size_clamped = _clamp_limit_size(p_max_size); + if (max_size == max_size_clamped) { + return; + } + max_size = max_size_clamped; + + _validate_limit_size(); _update_window_size(); } @@ -359,7 +381,13 @@ Size2i Window::get_max_size() const { } void Window::set_min_size(const Size2i &p_min_size) { - min_size = p_min_size; + Size2i min_size_clamped = _clamp_limit_size(p_min_size); + if (min_size == min_size_clamped) { + return; + } + min_size = min_size_clamped; + + _validate_limit_size(); _update_window_size(); } @@ -833,49 +861,35 @@ bool Window::is_visible() const { return visible; } -void Window::_update_window_size() { - // Force window to respect size limitations of rendering server. - RenderingServer *rendering_server = RenderingServer::get_singleton(); - if (rendering_server) { - Size2i max_window_size = rendering_server->get_maximum_viewport_size(); +Size2i Window::_clamp_window_size(const Size2i &p_size) { + Size2i window_size_clamped = p_size; + Size2 minsize = get_clamped_minimum_size(); + window_size_clamped = window_size_clamped.max(minsize); - if (max_window_size != Size2i()) { - size = size.min(max_window_size); - min_size = min_size.min(max_window_size); - max_size = max_size.min(max_window_size); - } + if (max_size_used != Size2i()) { + window_size_clamped = window_size_clamped.min(max_size_used); } - Size2i size_limit; - if (wrap_controls) { - size_limit = get_contents_minimum_size(); - } + return window_size_clamped; +} - size_limit.x = MAX(size_limit.x, min_size.x); - size_limit.y = MAX(size_limit.y, min_size.y); +void Window::_update_window_size() { + Size2i size_limit = get_clamped_minimum_size(); - size.x = MAX(size_limit.x, size.x); - size.y = MAX(size_limit.y, size.y); + size = size.max(size_limit); bool reset_min_first = false; - bool max_size_valid = false; - if ((max_size.x > 0 || max_size.y > 0) && (max_size.x >= min_size.x && max_size.y >= min_size.y)) { - max_size_valid = true; + if (max_size_used != Size2i()) { + // Force window size to respect size limitations of max_size_used. + size = size.min(max_size_used); - if (size.x > max_size.x) { - size.x = max_size.x; - } - if (size_limit.x > max_size.x) { - size_limit.x = max_size.x; + if (size_limit.x > max_size_used.x) { + size_limit.x = max_size_used.x; reset_min_first = true; } - - if (size.y > max_size.y) { - size.y = max_size.y; - } - if (size_limit.y > max_size.y) { - size_limit.y = max_size.y; + if (size_limit.y > max_size_used.y) { + size_limit.y = max_size_used.y; reset_min_first = true; } } @@ -891,7 +905,7 @@ void Window::_update_window_size() { DisplayServer::get_singleton()->window_set_min_size(Size2i(), window_id); } - DisplayServer::get_singleton()->window_set_max_size(max_size_valid ? max_size : Size2i(), window_id); + DisplayServer::get_singleton()->window_set_max_size(max_size_used, window_id); DisplayServer::get_singleton()->window_set_min_size(size_limit, window_id); DisplayServer::get_singleton()->window_set_size(size, window_id); } @@ -1423,6 +1437,8 @@ void Window::popup_centered_clamped(const Size2i &p_size, float 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 = _clamp_window_size(popup_rect.size); + if (parent_rect != Rect2()) { popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2; } @@ -1446,9 +1462,7 @@ void Window::popup_centered(const Size2i &p_minsize) { } Rect2i popup_rect; - Size2 contents_minsize = _get_contents_minimum_size(); - popup_rect.size.x = MAX(p_minsize.x, contents_minsize.x); - popup_rect.size.y = MAX(p_minsize.y, contents_minsize.y); + popup_rect.size = _clamp_window_size(p_minsize); if (parent_rect != Rect2()) { popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2; @@ -1476,6 +1490,7 @@ void Window::popup_centered_ratio(float p_ratio) { Rect2i popup_rect; if (parent_rect != Rect2()) { popup_rect.size = parent_rect.size * p_ratio; + popup_rect.size = _clamp_window_size(popup_rect.size); popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2; } @@ -1539,6 +1554,14 @@ Size2 Window::get_contents_minimum_size() const { return _get_contents_minimum_size(); } +Size2 Window::get_clamped_minimum_size() const { + if (!wrap_controls) { + return min_size; + } + + return min_size.max(get_contents_minimum_size()); +} + void Window::grab_focus() { if (embedder) { embedder->_sub_window_grab_focus(this); @@ -2120,11 +2143,13 @@ Transform2D Window::get_final_transform() const { return window_transform * stretch_transform * global_canvas_transform; } -Transform2D Window::get_screen_transform() const { +Transform2D Window::get_screen_transform_internal(bool p_absolute_position) const { Transform2D embedder_transform; if (_get_embedder()) { embedder_transform.translate_local(get_position()); - embedder_transform = _get_embedder()->get_screen_transform() * embedder_transform; + embedder_transform = _get_embedder()->get_screen_transform_internal(p_absolute_position) * embedder_transform; + } else if (p_absolute_position) { + embedder_transform.translate_local(get_position()); } return embedder_transform * get_final_transform(); } @@ -2389,6 +2414,7 @@ Window::Window() { RenderingServer *rendering_server = RenderingServer::get_singleton(); if (rendering_server) { max_size = rendering_server->get_maximum_viewport_size(); + max_size_used = max_size; // Update max_size_used. } theme_owner = memnew(ThemeOwner); diff --git a/scene/main/window.h b/scene/main/window.h index 9861fefc68..5359c37e9a 100644 --- a/scene/main/window.h +++ b/scene/main/window.h @@ -135,6 +135,11 @@ private: void _clear_window(); void _update_from_window(); + Size2i max_size_used; + + Size2i _clamp_limit_size(const Size2i &p_limit_size); + Size2i _clamp_window_size(const Size2i &p_size); + void _validate_limit_size(); void _update_viewport_size(); void _update_window_size(); @@ -306,6 +311,7 @@ public: void popup_centered_clamped(const Size2i &p_size = Size2i(), float p_fallback_ratio = 0.75); Size2 get_contents_minimum_size() const; + Size2 get_clamped_minimum_size() const; void grab_focus(); bool has_focus() const; @@ -377,7 +383,7 @@ public: // virtual Transform2D get_final_transform() const override; - virtual Transform2D get_screen_transform() const override; + virtual Transform2D get_screen_transform_internal(bool p_absolute_position = false) const override; virtual Transform2D get_popup_base_transform() const override; Rect2i get_parent_rect() const; diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index 3006da5309..448e800900 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -601,9 +601,11 @@ Error ResourceLoaderText::load() { *progress = resource_current / float(resources_total); } - int_resources[id] = res; //always assign int resources - if (do_assign && cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) { - res->set_path(path, cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE); + int_resources[id] = res; // Always assign int resources. + if (do_assign) { + if (cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) { + res->set_path(path, cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE); + } res->set_scene_unique_id(id); } diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp index 7d9ca070b0..f9529de6dd 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp @@ -593,12 +593,10 @@ void RenderForwardMobile::_pre_opaque_render(RenderDataRD *p_render_data) { bool render_shadows = p_render_data->directional_shadows.size() || p_render_data->shadows.size(); + //prepare shadow rendering if (render_shadows) { RENDER_TIMESTAMP("Render Shadows"); - } - //prepare shadow rendering - if (render_shadows) { _render_shadow_begin(); //render directional shadows |