diff options
-rw-r--r-- | doc/classes/NavigationServer2D.xml | 13 | ||||
-rw-r--r-- | doc/classes/NavigationServer3D.xml | 13 | ||||
-rw-r--r-- | doc/classes/TextureRect.xml | 3 | ||||
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 1 | ||||
-rw-r--r-- | modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs | 3 | ||||
-rw-r--r-- | modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/UnmanagedCallbacksGenerator.cs | 4 | ||||
-rw-r--r-- | scene/gui/aspect_ratio_container.cpp | 12 | ||||
-rw-r--r-- | scene/gui/label.cpp | 16 | ||||
-rw-r--r-- | servers/navigation_server_2d.cpp | 6 | ||||
-rw-r--r-- | servers/navigation_server_2d.h | 2 | ||||
-rw-r--r-- | servers/navigation_server_3d.cpp | 37 | ||||
-rw-r--r-- | servers/navigation_server_3d.h | 9 | ||||
-rw-r--r-- | servers/navigation_server_3d_dummy.h | 2 |
13 files changed, 88 insertions, 33 deletions
diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml index e7a2b99172..103de8eddb 100644 --- a/doc/classes/NavigationServer2D.xml +++ b/doc/classes/NavigationServer2D.xml @@ -126,6 +126,12 @@ Destroys the given RID. </description> </method> + <method name="get_debug_enabled" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] when the NavigationServer has debug enabled. + </description> + </method> <method name="get_maps" qualifiers="const"> <return type="RID[]" /> <description> @@ -520,6 +526,13 @@ Sets the [param travel_cost] for this [param region]. </description> </method> + <method name="set_debug_enabled"> + <return type="void" /> + <param index="0" name="enabled" type="bool" /> + <description> + If [code]true[/code] enables debug mode on the NavigationServer. + </description> + </method> </methods> <signals> <signal name="map_changed"> diff --git a/doc/classes/NavigationServer3D.xml b/doc/classes/NavigationServer3D.xml index 1feb363999..0d8cb78ff9 100644 --- a/doc/classes/NavigationServer3D.xml +++ b/doc/classes/NavigationServer3D.xml @@ -126,6 +126,12 @@ Destroys the given RID. </description> </method> + <method name="get_debug_enabled" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] when the NavigationServer has debug enabled. + </description> + </method> <method name="get_maps" qualifiers="const"> <return type="RID[]" /> <description> @@ -575,6 +581,13 @@ Control activation of this server. </description> </method> + <method name="set_debug_enabled"> + <return type="void" /> + <param index="0" name="enabled" type="bool" /> + <description> + If [code]true[/code] enables debug mode on the NavigationServer. + </description> + </method> </methods> <signals> <signal name="map_changed"> diff --git a/doc/classes/TextureRect.xml b/doc/classes/TextureRect.xml index 460ffbbb80..3500a0ddf5 100644 --- a/doc/classes/TextureRect.xml +++ b/doc/classes/TextureRect.xml @@ -10,8 +10,9 @@ <link title="3D Voxel Demo">https://godotengine.org/asset-library/asset/676</link> </tutorials> <members> - <member name="expand_mode" type="int" setter="set_expand_mode" getter="get_expand_mode" enum="TextureRect.ExpandMode" default="0"> + <member name="expand_mode" type="int" setter="set_expand_mode" getter="get_expand_mode" enum="TextureRect.ExpandMode" default="0" is_experimental="true"> Defines how minimum size is determined based on the texture's size. See [enum ExpandMode] for options. + [b]Note:[/b] Using [constant EXPAND_FIT_WIDTH], [constant EXPAND_FIT_WIDTH_PROPORTIONAL], [constant EXPAND_FIT_HEIGHT] or [constant EXPAND_FIT_HEIGHT_PROPORTIONAL] may result in unstable behavior in some containers. This functionality is being re-evaluated and will change in the future. </member> <member name="flip_h" type="bool" setter="set_flip_h" getter="is_flipped_h" default="false"> If [code]true[/code], texture is flipped horizontally. diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 8d09249125..d0525be853 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -1742,6 +1742,7 @@ void GDScriptAnalyzer::resolve_assignable(GDScriptParser::AssignableNode *p_assi } type.is_constant = is_constant; + type.is_read_only = false; p_assignable->set_datatype(type); } diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs index 43ead4af69..060c01b3f9 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs +++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs @@ -272,8 +272,7 @@ namespace GodotTools } } - string resourcePath = ProjectSettings.GlobalizePath("res://"); - args.Add(resourcePath); + args.Add(Path.GetDirectoryName(GodotSharpDirs.ProjectSlnPath)); string scriptPath = ProjectSettings.GlobalizePath(script.ResourcePath); diff --git a/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/UnmanagedCallbacksGenerator.cs b/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/UnmanagedCallbacksGenerator.cs index 3226ca79e5..6b000cc89b 100644 --- a/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/UnmanagedCallbacksGenerator.cs +++ b/modules/mono/glue/GodotSharp/Godot.SourceGenerators.Internal/UnmanagedCallbacksGenerator.cs @@ -168,7 +168,9 @@ using Godot.NativeInterop; { var parameter = callback.Parameters[i]; - source.Append(parameter.ToDisplayString()); + AppendRefKind(source, parameter.RefKind); + source.Append(' '); + source.Append(parameter.Type.FullQualifiedNameIncludeGlobal()); source.Append(' '); source.Append(parameter.Name); diff --git a/scene/gui/aspect_ratio_container.cpp b/scene/gui/aspect_ratio_container.cpp index 802189c374..94240ccead 100644 --- a/scene/gui/aspect_ratio_container.cpp +++ b/scene/gui/aspect_ratio_container.cpp @@ -30,6 +30,8 @@ #include "aspect_ratio_container.h" +#include "scene/gui/texture_rect.h" + Size2 AspectRatioContainer::get_minimum_size() const { Size2 ms; for (int i = 0; i < get_child_count(); i++) { @@ -113,6 +115,16 @@ void AspectRatioContainer::_notification(int p_what) { if (c->is_set_as_top_level()) { continue; } + + // Temporary fix for editor crash. + TextureRect *trect = Object::cast_to<TextureRect>(c); + if (trect) { + if (trect->get_expand_mode() == TextureRect::EXPAND_FIT_WIDTH_PROPORTIONAL || trect->get_expand_mode() == TextureRect::EXPAND_FIT_HEIGHT_PROPORTIONAL) { + WARN_PRINT_ONCE("Proportional TextureRect is currently not supported inside AspectRatioContainer"); + continue; + } + } + Size2 child_minsize = c->get_combined_minimum_size(); Size2 child_size = Size2(ratio, 1.0); float scale_factor = 1.0; diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index 45218773fe..b861d7af01 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -139,11 +139,14 @@ bool Label::_shape() { can_process_lines = true; lines_dirty = false; } else { - // With autowrap on, we won't compute the minimum size until width is stable (two shape requests in a - // row with the same width.) This avoids situations in which the initial width is very narrow and the label - // would break text into many very short lines, causing a very tall label that can leave a deformed container. - - can_process_lines = get_size().width == stable_width || autowrap_mode == TextServer::AUTOWRAP_OFF; + // With autowrap on or off with trimming enabled, we won't compute the minimum size until width is stable + // (two shape requests in a row with the same width.) This avoids situations in which the initial width is + // very narrow and the label would break text into many very short lines, causing a very tall label that can + // leave a deformed container. In the remaining case (namely, autowrap off and no trimming), the label is + // free to dictate its own width, something that will be taken advtantage of. + bool can_dictate_width = autowrap_mode == TextServer::AUTOWRAP_OFF && overrun_behavior == TextServer::OVERRUN_NO_TRIMMING; + bool is_width_stable = get_size().width == stable_width; + can_process_lines = can_dictate_width || is_width_stable; stable_width = get_size().width; if (can_process_lines) { @@ -171,14 +174,13 @@ bool Label::_shape() { } } - if (autowrap_mode == TextServer::AUTOWRAP_OFF) { + if (can_dictate_width) { for (int i = 0; i < lines_rid.size(); i++) { if (minsize.width < TS->shaped_text_get_size(lines_rid[i]).x) { minsize.width = TS->shaped_text_get_size(lines_rid[i]).x; } } - // With autowrap off, by now we already know the width the label will take. width = (minsize.width - style->get_minimum_size().width); } diff --git a/servers/navigation_server_2d.cpp b/servers/navigation_server_2d.cpp index 668b1dffc3..273bb9ceda 100644 --- a/servers/navigation_server_2d.cpp +++ b/servers/navigation_server_2d.cpp @@ -152,14 +152,15 @@ void NavigationServer2D::_emit_map_changed(RID p_map) { emit_signal(SNAME("map_changed"), p_map); } -#ifdef DEBUG_ENABLED void NavigationServer2D::set_debug_enabled(bool p_enabled) { NavigationServer3D::get_singleton()->set_debug_enabled(p_enabled); } + bool NavigationServer2D::get_debug_enabled() const { return NavigationServer3D::get_singleton()->get_debug_enabled(); } +#ifdef DEBUG_ENABLED void NavigationServer2D::set_debug_navigation_edge_connection_color(const Color &p_color) { NavigationServer3D::get_singleton()->set_debug_navigation_edge_connection_color(p_color); } @@ -341,6 +342,9 @@ void NavigationServer2D::_bind_methods() { ClassDB::bind_method(D_METHOD("free_rid", "rid"), &NavigationServer2D::free); + ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &NavigationServer2D::set_debug_enabled); + ClassDB::bind_method(D_METHOD("get_debug_enabled"), &NavigationServer2D::get_debug_enabled); + ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map"))); ADD_SIGNAL(MethodInfo("navigation_debug_changed")); diff --git a/servers/navigation_server_2d.h b/servers/navigation_server_2d.h index 153e60272c..ed2e39e53c 100644 --- a/servers/navigation_server_2d.h +++ b/servers/navigation_server_2d.h @@ -234,10 +234,10 @@ public: NavigationServer2D(); virtual ~NavigationServer2D(); -#ifdef DEBUG_ENABLED void set_debug_enabled(bool p_enabled); bool get_debug_enabled() const; +#ifdef DEBUG_ENABLED void set_debug_navigation_edge_connection_color(const Color &p_color); Color get_debug_navigation_edge_connection_color() const; diff --git a/servers/navigation_server_3d.cpp b/servers/navigation_server_3d.cpp index fbe97b9acb..e5cc426708 100644 --- a/servers/navigation_server_3d.cpp +++ b/servers/navigation_server_3d.cpp @@ -116,6 +116,9 @@ void NavigationServer3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_active", "active"), &NavigationServer3D::set_active); + ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &NavigationServer3D::set_debug_enabled); + ClassDB::bind_method(D_METHOD("get_debug_enabled"), &NavigationServer3D::get_debug_enabled); + ADD_SIGNAL(MethodInfo("map_changed", PropertyInfo(Variant::RID, "map"))); ADD_SIGNAL(MethodInfo("navigation_debug_changed")); @@ -184,6 +187,24 @@ NavigationServer3D::~NavigationServer3D() { singleton = nullptr; } +void NavigationServer3D::set_debug_enabled(bool p_enabled) { +#ifdef DEBUG_ENABLED + if (debug_enabled != p_enabled) { + debug_dirty = true; + } + + debug_enabled = p_enabled; + + if (debug_dirty) { + call_deferred("_emit_navigation_debug_changed_signal"); + } +#endif // DEBUG_ENABLED +} + +bool NavigationServer3D::get_debug_enabled() const { + return debug_enabled; +} + #ifdef DEBUG_ENABLED void NavigationServer3D::_emit_navigation_debug_changed_signal() { if (debug_dirty) { @@ -533,22 +554,6 @@ bool NavigationServer3D::get_debug_navigation_enable_link_connections_xray() con return debug_navigation_enable_link_connections_xray; } -void NavigationServer3D::set_debug_enabled(bool p_enabled) { - if (debug_enabled != p_enabled) { - debug_dirty = true; - } - - debug_enabled = p_enabled; - - if (debug_dirty) { - call_deferred("_emit_navigation_debug_changed_signal"); - } -} - -bool NavigationServer3D::get_debug_enabled() const { - return debug_enabled; -} - void NavigationServer3D::set_debug_navigation_enable_agent_paths(const bool p_value) { if (debug_navigation_enable_agent_paths != p_value) { debug_dirty = true; diff --git a/servers/navigation_server_3d.h b/servers/navigation_server_3d.h index 79729c55be..05df5ca0fe 100644 --- a/servers/navigation_server_3d.h +++ b/servers/navigation_server_3d.h @@ -274,9 +274,13 @@ public: virtual int get_process_info(ProcessInfo p_info) const = 0; -#ifdef DEBUG_ENABLED + void set_debug_enabled(bool p_enabled); + bool get_debug_enabled() const; + private: bool debug_enabled = false; + +#ifdef DEBUG_ENABLED bool debug_dirty = true; void _emit_navigation_debug_changed_signal(); @@ -313,9 +317,6 @@ private: Ref<StandardMaterial3D> debug_navigation_agent_path_point_material; public: - void set_debug_enabled(bool p_enabled); - bool get_debug_enabled() const; - void set_debug_navigation_edge_connection_color(const Color &p_color); Color get_debug_navigation_edge_connection_color() const; diff --git a/servers/navigation_server_3d_dummy.h b/servers/navigation_server_3d_dummy.h index d2f8fe6048..fd9226e59e 100644 --- a/servers/navigation_server_3d_dummy.h +++ b/servers/navigation_server_3d_dummy.h @@ -112,6 +112,8 @@ public: void process(real_t delta_time) override {} NavigationUtilities::PathQueryResult _query_path(const NavigationUtilities::PathQueryParameters &p_parameters) const override { return NavigationUtilities::PathQueryResult(); } int get_process_info(ProcessInfo p_info) const override { return 0; } + void set_debug_enabled(bool p_enabled) {} + bool get_debug_enabled() const { return false; } }; #endif // NAVIGATION_SERVER_3D_DUMMY_H |