diff options
-rw-r--r-- | doc/classes/Color.xml | 2 | ||||
-rw-r--r-- | doc/classes/LightmapGI.xml | 4 | ||||
-rw-r--r-- | doc/classes/LightmapperRD.xml | 2 | ||||
-rw-r--r-- | doc/classes/Mesh.xml | 2 | ||||
-rw-r--r-- | doc/classes/NavigationServer2D.xml | 8 | ||||
-rw-r--r-- | doc/classes/NavigationServer3D.xml | 8 | ||||
-rw-r--r-- | doc/classes/ShapeCast3D.xml | 4 | ||||
-rw-r--r-- | doc/classes/TileSet.xml | 2 | ||||
-rw-r--r-- | editor/editor_resource_preview.cpp | 6 | ||||
-rw-r--r-- | editor/import/scene_import_settings.cpp | 3 | ||||
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 35 | ||||
-rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/for_range_usage.gd | 7 | ||||
-rw-r--r-- | modules/gdscript/tests/scripts/analyzer/features/for_range_usage.out | 2 | ||||
-rw-r--r-- | modules/gridmap/editor/grid_map_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | scene/2d/camera_2d.cpp | 12 | ||||
-rw-r--r-- | scene/3d/shape_cast_3d.cpp | 20 | ||||
-rw-r--r-- | scene/3d/shape_cast_3d.h | 6 |
17 files changed, 74 insertions, 51 deletions
diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index faa658971d..6dbc475bdf 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -181,7 +181,7 @@ <return type="Color" /> <param index="0" name="rgbe" type="int" /> <description> - Encodes a [Color] from a RGBE9995 format integer. See [constant Image.FORMAT_RGBE9995]. + Decodes a [Color] from a RGBE9995 format integer. See [constant Image.FORMAT_RGBE9995]. </description> </method> <method name="from_string" qualifiers="static"> diff --git a/doc/classes/LightmapGI.xml b/doc/classes/LightmapGI.xml index 723e6bbf21..235e412757 100644 --- a/doc/classes/LightmapGI.xml +++ b/doc/classes/LightmapGI.xml @@ -9,7 +9,7 @@ [b]Performance:[/b] [LightmapGI] provides the best possible run-time performance for global illumination. It is suitable for low-end hardware including integrated graphics and mobile devices. [b]Note:[/b] Due to how lightmaps work, most properties only have a visible effect once lightmaps are baked again. [b]Note:[/b] Lightmap baking on [CSGShape3D]s and [PrimitiveMesh]es is not supported, as these cannot store UV2 data required for baking. - [b]Note:[/b] If no custom lightmappers are installed, [LightmapGI] can only be baked when using the Vulkan backend (Clustered or Mobile), not OpenGL. + [b]Note:[/b] If no custom lightmappers are installed, [LightmapGI] can only be baked when using the Vulkan backend (Forward+ or Mobile), not OpenGL. </description> <tutorials> </tutorials> @@ -73,7 +73,7 @@ High bake quality (slow bake times). The quality of this preset can be adjusted by changing [member ProjectSettings.rendering/lightmapping/bake_quality/high_quality_ray_count] and [member ProjectSettings.rendering/lightmapping/bake_quality/high_quality_probe_ray_count]. </constant> <constant name="BAKE_QUALITY_ULTRA" value="3" enum="BakeQuality"> - Highest bake quality (slowest bake times). The quality of this preset can be adjusted by changing [member ProjectSettings.rendering/lightmapping/bake_quality/high_quality_ray_count] and [member ProjectSettings.rendering/lightmapping/bake_quality/ultra_quality_probe_ray_count]. + Highest bake quality (slowest bake times). The quality of this preset can be adjusted by changing [member ProjectSettings.rendering/lightmapping/bake_quality/ultra_quality_ray_count] and [member ProjectSettings.rendering/lightmapping/bake_quality/ultra_quality_probe_ray_count]. </constant> <constant name="GENERATE_PROBES_DISABLED" value="0" enum="GenerateProbes"> Don't generate lightmap probes for lighting dynamic objects. diff --git a/doc/classes/LightmapperRD.xml b/doc/classes/LightmapperRD.xml index e4b68a7ef8..a3c815f58e 100644 --- a/doc/classes/LightmapperRD.xml +++ b/doc/classes/LightmapperRD.xml @@ -5,7 +5,7 @@ </brief_description> <description> LightmapperRD ("RD" stands for [RenderingDevice]) is the built-in GPU-based lightmapper for use with [LightmapGI]. On most dedicated GPUs, it can bake lightmaps much faster than most CPU-based lightmappers. LightmapperRD uses compute shaders to bake lightmaps, so it does not require CUDA or OpenCL libraries to be installed to be usable. - [b]Note:[/b] Only usable when using the Vulkan backend (Clustered or Mobile), not OpenGL. + [b]Note:[/b] Only usable when using the Vulkan backend (Forward+ or Mobile), not OpenGL. </description> <tutorials> </tutorials> diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml index ece3199aab..3063e76c65 100644 --- a/doc/classes/Mesh.xml +++ b/doc/classes/Mesh.xml @@ -258,7 +258,7 @@ Indicates this custom channel contains half precision float colors, encoded as [PackedByteArray]. </constant> <constant name="ARRAY_CUSTOM_R_FLOAT" value="4" enum="ArrayCustomFormat"> - Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only the red green channel is used. + Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only the red channel is used. </constant> <constant name="ARRAY_CUSTOM_RG_FLOAT" value="5" enum="ArrayCustomFormat"> Indicates this custom channel contains full float colors, in a [PackedFloat32Array]. Only red and green channels are used. diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml index 103de8eddb..60d473a103 100644 --- a/doc/classes/NavigationServer2D.xml +++ b/doc/classes/NavigationServer2D.xml @@ -155,7 +155,7 @@ <return type="float" /> <param index="0" name="link" type="RID" /> <description> - Returns the [code]enter_cost[/code] of this [code]link[/code]. + Returns the enter cost of this [param link]. </description> </method> <method name="link_get_map" qualifiers="const"> @@ -190,7 +190,7 @@ <return type="float" /> <param index="0" name="link" type="RID" /> <description> - Returns the [code]travel_cost[/code] of this [code]link[/code]. + Returns the travel cost of this [param link]. </description> </method> <method name="link_is_bidirectional" qualifiers="const"> @@ -429,7 +429,7 @@ <return type="float" /> <param index="0" name="region" type="RID" /> <description> - Returns the [code]enter_cost[/code] of this [param region]. + Returns the enter cost of this [param region]. </description> </method> <method name="region_get_map" qualifiers="const"> @@ -457,7 +457,7 @@ <return type="float" /> <param index="0" name="region" type="RID" /> <description> - Returns the [code]travel_cost[/code] of this [param region]. + Returns the travel cost of this [param region]. </description> </method> <method name="region_owns_point" qualifiers="const"> diff --git a/doc/classes/NavigationServer3D.xml b/doc/classes/NavigationServer3D.xml index 0d8cb78ff9..71906729d1 100644 --- a/doc/classes/NavigationServer3D.xml +++ b/doc/classes/NavigationServer3D.xml @@ -162,7 +162,7 @@ <return type="float" /> <param index="0" name="link" type="RID" /> <description> - Returns the [code]enter_cost[/code] of this [code]link[/code]. + Returns the enter cost of this [param link]. </description> </method> <method name="link_get_map" qualifiers="const"> @@ -197,7 +197,7 @@ <return type="float" /> <param index="0" name="link" type="RID" /> <description> - Returns the [code]travel_cost[/code] of this [code]link[/code]. + Returns the travel cost of this [param link]. </description> </method> <method name="link_is_bidirectional" qualifiers="const"> @@ -477,7 +477,7 @@ <return type="float" /> <param index="0" name="region" type="RID" /> <description> - Returns the [code]enter_cost[/code] of this [param region]. + Returns the enter cost of this [param region]. </description> </method> <method name="region_get_map" qualifiers="const"> @@ -505,7 +505,7 @@ <return type="float" /> <param index="0" name="region" type="RID" /> <description> - Returns the [code]travel_cost[/code] of this [param region]. + Returns the travel cost of this [param region]. </description> </method> <method name="region_owns_point" qualifiers="const"> diff --git a/doc/classes/ShapeCast3D.xml b/doc/classes/ShapeCast3D.xml index 735b91cee9..907ae73055 100644 --- a/doc/classes/ShapeCast3D.xml +++ b/doc/classes/ShapeCast3D.xml @@ -14,7 +14,7 @@ <methods> <method name="add_exception"> <return type="void" /> - <param index="0" name="node" type="Object" /> + <param index="0" name="node" type="CollisionObject3D" /> <description> Adds a collision exception so the shape does not report collisions with the specified [CollisionObject3D] node. </description> @@ -108,7 +108,7 @@ </method> <method name="remove_exception"> <return type="void" /> - <param index="0" name="node" type="Object" /> + <param index="0" name="node" type="CollisionObject3D" /> <description> Removes a collision exception so the shape does report collisions with the specified [CollisionObject3D] node. </description> diff --git a/doc/classes/TileSet.xml b/doc/classes/TileSet.xml index a39a43be4c..ec2c7860d8 100644 --- a/doc/classes/TileSet.xml +++ b/doc/classes/TileSet.xml @@ -300,7 +300,7 @@ <param index="1" name="coords_from" type="Vector2i" /> <param index="2" name="alternative_from" type="int" /> <description> - Returns if there is and alternative-level proxy for the given identifiers. + Returns if there is an alternative-level proxy for the given identifiers. </description> </method> <method name="has_coords_level_tile_proxy"> diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index db4d12c761..6eef4e5a5a 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -424,8 +424,10 @@ void EditorResourcePreview::check_for_invalidation(const String &p_path) { } void EditorResourcePreview::start() { - ERR_FAIL_COND_MSG(thread.is_started(), "Thread already started."); - thread.start(_thread_func, this); + if (DisplayServer::get_singleton()->get_name() != "headless") { + ERR_FAIL_COND_MSG(thread.is_started(), "Thread already started."); + thread.start(_thread_func, this); + } } void EditorResourcePreview::stop() { diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp index a09e0e7408..8471e0d8a3 100644 --- a/editor/import/scene_import_settings.cpp +++ b/editor/import/scene_import_settings.cpp @@ -594,6 +594,9 @@ void SceneImportSettings::open_settings(const String &p_path, bool p_for_animati // Visibility data_mode->set_tab_hidden(1, p_for_animation); data_mode->set_tab_hidden(2, p_for_animation); + if (p_for_animation) { + data_mode->set_current_tab(0); + } action_menu->get_popup()->set_item_disabled(action_menu->get_popup()->get_item_id(ACTION_EXTRACT_MATERIALS), p_for_animation); action_menu->get_popup()->set_item_disabled(action_menu->get_popup()->get_item_id(ACTION_CHOOSE_MESH_SAVE_PATHS), p_for_animation); diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 1161403c0c..e058187860 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -1857,29 +1857,40 @@ void GDScriptAnalyzer::resolve_for(GDScriptParser::ForNode *p_for) { push_error(vformat(R"*(Invalid call for "range()" function. Expected at most 3 arguments, %d given.)*", call->arguments.size()), call->callee); } else { // Now we can optimize it. - bool all_is_constant = true; + bool can_reduce = true; Vector<Variant> args; args.resize(call->arguments.size()); for (int i = 0; i < call->arguments.size(); i++) { GDScriptParser::ExpressionNode *argument = call->arguments[i]; reduce_expression(argument); - if (!argument->is_constant) { - all_is_constant = false; - break; - } - if (argument->reduced_value.get_type() != Variant::INT && argument->reduced_value.get_type() != Variant::FLOAT) { - push_error(vformat(R"*(Invalid argument for "range()" call. Argument %d should be int or float but "%s" was given.)*", i + 1, Variant::get_type_name(argument->reduced_value.get_type())), argument); - all_is_constant = false; - break; + if (argument->is_constant) { + if (argument->reduced_value.get_type() != Variant::INT && argument->reduced_value.get_type() != Variant::FLOAT) { + can_reduce = false; + push_error(vformat(R"*(Invalid argument for "range()" call. Argument %d should be int or float but "%s" was given.)*", i + 1, Variant::get_type_name(argument->reduced_value.get_type())), argument); + } + if (can_reduce) { + args.write[i] = argument->reduced_value; + } + } else { + can_reduce = false; + GDScriptParser::DataType argument_type = argument->get_datatype(); + if (argument_type.is_variant() || !argument_type.is_hard_type()) { + mark_node_unsafe(argument); + } + if (!argument_type.is_variant() && (argument_type.builtin_type != Variant::INT && argument_type.builtin_type != Variant::FLOAT)) { + if (!argument_type.is_hard_type()) { + downgrade_node_type_source(argument); + } else { + push_error(vformat(R"*(Invalid argument for "range()" call. Argument %d should be int or float but "%s" was given.)*", i + 1, argument_type.to_string()), argument); + } + } } - - args.write[i] = argument->reduced_value; } Variant reduced; - if (all_is_constant) { + if (can_reduce) { switch (args.size()) { case 1: reduced = (int32_t)args[0]; diff --git a/modules/gdscript/tests/scripts/analyzer/features/for_range_usage.gd b/modules/gdscript/tests/scripts/analyzer/features/for_range_usage.gd new file mode 100644 index 0000000000..4a7f10f1ee --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/for_range_usage.gd @@ -0,0 +1,7 @@ +func test(): + var array := [3, 6, 9] + var result := '' + for i in range(array.size(), 0, -1): + result += str(array[i - 1]) + assert(result == '963') + print('ok') diff --git a/modules/gdscript/tests/scripts/analyzer/features/for_range_usage.out b/modules/gdscript/tests/scripts/analyzer/features/for_range_usage.out new file mode 100644 index 0000000000..1b47ed10dc --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/features/for_range_usage.out @@ -0,0 +1,2 @@ +GDTEST_OK +ok diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index 9a7b37df21..214d4d8ec2 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -913,7 +913,7 @@ void GridMapEditor::update_palette() { } void GridMapEditor::edit(GridMap *p_gridmap) { - if (!p_gridmap && node) { + if (node) { node->disconnect("cell_size_changed", callable_mp(this, &GridMapEditor::_draw_grids)); } diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index f7d2ae7d2d..2b90a3702f 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -414,15 +414,19 @@ Camera2D::Camera2DProcessCallback Camera2D::get_process_callback() const { } void Camera2D::_make_current(Object *p_which) { + if (!viewport || (custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) { + return; + } + if (p_which == this) { if (is_inside_tree()) { - get_viewport()->_camera_2d_set(this); + viewport->_camera_2d_set(this); queue_redraw(); } } else { if (is_inside_tree()) { - if (get_viewport()->get_camera_2d() == this) { - get_viewport()->_camera_2d_set(nullptr); + if (viewport->get_camera_2d() == this) { + viewport->_camera_2d_set(nullptr); } queue_redraw(); } @@ -449,7 +453,7 @@ void Camera2D::make_current() { void Camera2D::clear_current() { ERR_FAIL_COND(!is_current()); - if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id))) { + if (viewport && !(custom_viewport && !ObjectDB::get_instance(custom_viewport_id)) && viewport->is_inside_tree()) { viewport->assign_next_enabled_camera_2d(group_name); } } diff --git a/scene/3d/shape_cast_3d.cpp b/scene/3d/shape_cast_3d.cpp index 87361d6b38..d880e422f0 100644 --- a/scene/3d/shape_cast_3d.cpp +++ b/scene/3d/shape_cast_3d.cpp @@ -437,26 +437,18 @@ void ShapeCast3D::add_exception_rid(const RID &p_rid) { exclude.insert(p_rid); } -void ShapeCast3D::add_exception(const Object *p_object) { - ERR_FAIL_NULL(p_object); - const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object); - if (!co) { - return; - } - add_exception_rid(co->get_rid()); +void ShapeCast3D::add_exception(const CollisionObject3D *p_node) { + ERR_FAIL_NULL_MSG(p_node, "The passed Node must be an instance of CollisionObject3D."); + add_exception_rid(p_node->get_rid()); } void ShapeCast3D::remove_exception_rid(const RID &p_rid) { exclude.erase(p_rid); } -void ShapeCast3D::remove_exception(const Object *p_object) { - ERR_FAIL_NULL(p_object); - const CollisionObject3D *co = Object::cast_to<CollisionObject3D>(p_object); - if (!co) { - return; - } - remove_exception_rid(co->get_rid()); +void ShapeCast3D::remove_exception(const CollisionObject3D *p_node) { + ERR_FAIL_NULL_MSG(p_node, "The passed Node must be an instance of CollisionObject3D."); + remove_exception_rid(p_node->get_rid()); } void ShapeCast3D::clear_exceptions() { diff --git a/scene/3d/shape_cast_3d.h b/scene/3d/shape_cast_3d.h index 344f1d3b8a..98158d3c7c 100644 --- a/scene/3d/shape_cast_3d.h +++ b/scene/3d/shape_cast_3d.h @@ -34,6 +34,8 @@ #include "scene/3d/node_3d.h" #include "scene/resources/shape_3d.h" +class CollisionObject3D; + class ShapeCast3D : public Node3D { GDCLASS(ShapeCast3D, Node3D); @@ -133,9 +135,9 @@ public: bool is_colliding() const; void add_exception_rid(const RID &p_rid); - void add_exception(const Object *p_object); + void add_exception(const CollisionObject3D *p_node); void remove_exception_rid(const RID &p_rid); - void remove_exception(const Object *p_object); + void remove_exception(const CollisionObject3D *p_node); void clear_exceptions(); virtual PackedStringArray get_configuration_warnings() const override; |