diff options
79 files changed, 574 insertions, 467 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 22bf8571bf..c47f297a72 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -447,15 +447,24 @@ Ref<Resource> ResourceLoader::load_threaded_get(const String &p_path, Error *r_e ThreadLoadTask &load_task = thread_load_tasks[local_path]; - if (!load_task.cond_var && load_task.status == THREAD_LOAD_IN_PROGRESS) { - // A condition variable was never created for this task. - // That happens when a load has been initiated with subthreads disabled, - // but now another load thread needs to interact with this one (either - // because of subthreads being used this time, or because it's simply a - // threaded load running on a different thread). - // Since we want to be notified when the load ends, we must create the - // condition variable now. - load_task.cond_var = memnew(ConditionVariable); + if (load_task.status == THREAD_LOAD_IN_PROGRESS) { + if (load_task.loader_id == Thread::get_caller_id()) { + // Load is in progress, but it's precisely this thread the one in charge. + // That means this is a cyclic load. + if (r_error) { + *r_error = ERR_BUSY; + } + return Ref<Resource>(); + } else if (!load_task.cond_var) { + // Load is in progress, but a condition variable was never created for it. + // That happens when a load has been initiated with subthreads disabled, + // but now another load thread needs to interact with this one (either + // because of subthreads being used this time, or because it's simply a + // threaded load running on a different thread). + // Since we want to be notified when the load ends, we must create the + // condition variable now. + load_task.cond_var = memnew(ConditionVariable); + } } //cond var still exists, meaning it's still loading, request poll diff --git a/core/object/script_language.h b/core/object/script_language.h index 3ef121a8e7..696c9a94a5 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -249,7 +249,6 @@ public: virtual void init() = 0; virtual String get_type() const = 0; virtual String get_extension() const = 0; - virtual Error execute_file(const String &p_path) = 0; virtual void finish() = 0; /* EDITOR FUNCTIONS */ @@ -428,11 +427,6 @@ public: virtual int profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) = 0; virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) = 0; - virtual void *alloc_instance_binding_data(Object *p_object) { return nullptr; } //optional, not used by all languages - virtual void free_instance_binding_data(void *p_data) {} //optional, not used by all languages - virtual void refcount_incremented_instance_binding(Object *p_object) {} //optional, not used by all languages - virtual bool refcount_decremented_instance_binding(Object *p_object) { return true; } //return true if it can die //optional, not used by all languages - virtual void frame(); virtual bool handles_global_class_type(const String &p_type) const { return false; } diff --git a/core/object/script_language_extension.cpp b/core/object/script_language_extension.cpp index c7eb32c020..0df9d58334 100644 --- a/core/object/script_language_extension.cpp +++ b/core/object/script_language_extension.cpp @@ -84,7 +84,6 @@ void ScriptLanguageExtension::_bind_methods() { GDVIRTUAL_BIND(_init); GDVIRTUAL_BIND(_get_type); GDVIRTUAL_BIND(_get_extension); - GDVIRTUAL_BIND(_execute_file, "path"); GDVIRTUAL_BIND(_finish); GDVIRTUAL_BIND(_get_reserved_words); @@ -144,12 +143,6 @@ void ScriptLanguageExtension::_bind_methods() { GDVIRTUAL_BIND(_profiling_get_accumulated_data, "info_array", "info_max"); GDVIRTUAL_BIND(_profiling_get_frame_data, "info_array", "info_max"); - GDVIRTUAL_BIND(_alloc_instance_binding_data, "object"); - GDVIRTUAL_BIND(_free_instance_binding_data, "data"); - - GDVIRTUAL_BIND(_refcount_incremented_instance_binding, "object"); - GDVIRTUAL_BIND(_refcount_decremented_instance_binding, "object"); - GDVIRTUAL_BIND(_frame); GDVIRTUAL_BIND(_handles_global_class_type, "type"); diff --git a/core/object/script_language_extension.h b/core/object/script_language_extension.h index 8e162a1b0f..79cf712119 100644 --- a/core/object/script_language_extension.h +++ b/core/object/script_language_extension.h @@ -202,7 +202,6 @@ public: EXBIND0(init) EXBIND0RC(String, get_type) EXBIND0RC(String, get_extension) - EXBIND1R(Error, execute_file, const String &) EXBIND0(finish) /* EDITOR FUNCTIONS */ @@ -596,23 +595,6 @@ public: return ret; } - GDVIRTUAL1R(GDExtensionPtr<void>, _alloc_instance_binding_data, Object *) - - virtual void *alloc_instance_binding_data(Object *p_object) override { - GDExtensionPtr<void> ret = nullptr; - GDVIRTUAL_REQUIRED_CALL(_alloc_instance_binding_data, p_object, ret); - return ret.operator void *(); - } - - GDVIRTUAL1(_free_instance_binding_data, GDExtensionPtr<void>) - - virtual void free_instance_binding_data(void *p_data) override { - GDVIRTUAL_REQUIRED_CALL(_free_instance_binding_data, p_data); - } - - EXBIND1(refcount_incremented_instance_binding, Object *) - EXBIND1R(bool, refcount_decremented_instance_binding, Object *) - EXBIND0(frame) EXBIND1RC(bool, handles_global_class_type, const String &) diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index 04e1561a0c..2da9559873 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -3499,7 +3499,7 @@ bool Variant::identity_compare(const Variant &p_variant) const { switch (type) { case OBJECT: { - return _get_obj().obj == p_variant._get_obj().obj; + return _get_obj().id == p_variant._get_obj().id; } break; case DICTIONARY: { diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp index 042ebe368a..8f3ae65b9c 100644 --- a/core/variant/variant_utility.cpp +++ b/core/variant/variant_utility.cpp @@ -543,6 +543,13 @@ struct VariantUtilityFunctions { Variant base = *p_args[0]; Variant ret; for (int i = 1; i < p_argcount; i++) { + Variant::Type arg_type = p_args[i]->get_type(); + if (arg_type != Variant::INT && arg_type != Variant::FLOAT) { + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.expected = Variant::FLOAT; + r_error.argument = i; + return Variant(); + } bool valid; Variant::evaluate(Variant::OP_LESS, base, *p_args[i], ret, valid); if (!valid) { @@ -576,6 +583,13 @@ struct VariantUtilityFunctions { Variant base = *p_args[0]; Variant ret; for (int i = 1; i < p_argcount; i++) { + Variant::Type arg_type = p_args[i]->get_type(); + if (arg_type != Variant::INT && arg_type != Variant::FLOAT) { + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.expected = Variant::FLOAT; + r_error.argument = i; + return Variant(); + } bool valid; Variant::evaluate(Variant::OP_GREATER, base, *p_args[i], ret, valid); if (!valid) { diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index ed7bdc07fc..3bda3a3896 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -656,7 +656,7 @@ <method name="max" qualifiers="vararg"> <return type="Variant" /> <description> - Returns the maximum of the given values. This function can take any number of arguments. + Returns the maximum of the given numeric values. This function can take any number of arguments. [codeblock] max(1, 7, 3, -6, 5) # Returns 7 [/codeblock] @@ -689,7 +689,7 @@ <method name="min" qualifiers="vararg"> <return type="Variant" /> <description> - Returns the minimum of the given values. This function can take any number of arguments. + Returns the minimum of the given numeric values. This function can take any number of arguments. [codeblock] min(1, 7, 3, -6, 5) # Returns -6 [/codeblock] diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index 5f25bd8925..31b9703b01 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -1753,17 +1753,17 @@ [b]Note:[/b] This flag is implemented on macOS. </constant> <constant name="VSYNC_DISABLED" value="0" enum="VSyncMode"> - No vertical synchronization, which means the engine will display frames as fast as possible (tearing may be visible). Framerate is unlimited (nonwithstanding [member Engine.max_fps]). Not supported when using the Compatibility rendering method. + No vertical synchronization, which means the engine will display frames as fast as possible (tearing may be visible). Framerate is unlimited (nonwithstanding [member Engine.max_fps]). </constant> <constant name="VSYNC_ENABLED" value="1" enum="VSyncMode"> Default vertical synchronization mode, the image is displayed only on vertical blanking intervals (no tearing is visible). Framerate is limited by the monitor refresh rate (nonwithstanding [member Engine.max_fps]). </constant> <constant name="VSYNC_ADAPTIVE" value="2" enum="VSyncMode"> - Behaves like [constant VSYNC_DISABLED] when the framerate drops below the screen's refresh rate to reduce stuttering (tearing may be visible). Otherwise, vertical synchronization is enabled to avoid tearing. Framerate is limited by the monitor refresh rate (nonwithstanding [member Engine.max_fps]). Not supported when using the Compatibility rendering method. + Behaves like [constant VSYNC_DISABLED] when the framerate drops below the screen's refresh rate to reduce stuttering (tearing may be visible). Otherwise, vertical synchronization is enabled to avoid tearing. Framerate is limited by the monitor refresh rate (nonwithstanding [member Engine.max_fps]). Behaves like [constant VSYNC_ENABLED] when using the Compatibility rendering method. </constant> <constant name="VSYNC_MAILBOX" value="3" enum="VSyncMode"> Displays the most recent image in the queue on vertical blanking intervals, while rendering to the other images (no tearing is visible). Framerate is unlimited (nonwithstanding [member Engine.max_fps]). - Although not guaranteed, the images can be rendered as fast as possible, which may reduce input lag (also called "Fast" V-Sync mode). [constant VSYNC_MAILBOX] works best when at least twice as many frames as the display refresh rate are rendered. Not supported when using the Compatibility rendering method. + Although not guaranteed, the images can be rendered as fast as possible, which may reduce input lag (also called "Fast" V-Sync mode). [constant VSYNC_MAILBOX] works best when at least twice as many frames as the display refresh rate are rendered. Behaves like [constant VSYNC_ENABLED] when using the Compatibility rendering method. </constant> <constant name="DISPLAY_HANDLE" value="0" enum="HandleType"> Display handle: diff --git a/doc/classes/EditorExportPlugin.xml b/doc/classes/EditorExportPlugin.xml index fd76e8ddaa..5d1d2cd8f2 100644 --- a/doc/classes/EditorExportPlugin.xml +++ b/doc/classes/EditorExportPlugin.xml @@ -15,7 +15,8 @@ <param index="0" name="platform" type="EditorExportPlatform" /> <param index="1" name="features" type="PackedStringArray" /> <description> - Return true if this plugin will customize resources based on the platform and features used. + Return [code]true[/code] if this plugin will customize resources based on the platform and features used. + When enabled, [method _get_customization_configuration_hash], [method _customize_resource] and [method _customize_scene] will be called and must be implemented. </description> </method> <method name="_begin_customize_scenes" qualifiers="virtual const"> @@ -33,6 +34,7 @@ <description> Customize a resource. If changes are made to it, return the same or a new resource. Otherwise, return [code]null[/code]. The [i]path[/i] argument is only used when customizing an actual file, otherwise this means that this resource is part of another one and it will be empty. + Implementing this method is required if [method _begin_customize_resources] returns [code]true[/code]. </description> </method> <method name="_customize_scene" qualifiers="virtual"> @@ -41,6 +43,7 @@ <param index="1" name="path" type="String" /> <description> Customize a scene. If changes are made to it, return the same or a new scene. Otherwise, return [code]null[/code]. If a new scene is returned, it is up to you to dispose of the old one. + Implementing this method is required if [method _begin_customize_resources] returns [code]true[/code]. </description> </method> <method name="_end_customize_resources" qualifiers="virtual"> @@ -85,6 +88,7 @@ <return type="int" /> <description> Return a hash based on the configuration passed (for both scenes and resources). This helps keep separate caches for separate export configurations. + Implementing this method is required if [method _begin_customize_resources] returns [code]true[/code]. </description> </method> <method name="_get_export_features" qualifiers="virtual const"> @@ -98,7 +102,8 @@ <method name="_get_name" qualifiers="virtual const"> <return type="String" /> <description> - Return the name identifier of this plugin (for future identification by the exporter). + Return the name identifier of this plugin (for future identification by the exporter). The plugins are sorted by name before exporting. + Implementing this method is required. </description> </method> <method name="add_file"> diff --git a/doc/classes/Expression.xml b/doc/classes/Expression.xml index fd5a921836..2451ab1a0d 100644 --- a/doc/classes/Expression.xml +++ b/doc/classes/Expression.xml @@ -65,7 +65,7 @@ <method name="get_error_text" qualifiers="const"> <return type="String" /> <description> - Returns the error text if [method parse] has failed. + Returns the error text if [method parse] or [method execute] has failed. </description> </method> <method name="has_execute_failed" qualifiers="const"> diff --git a/doc/classes/ReflectionProbe.xml b/doc/classes/ReflectionProbe.xml index cc48e0612b..8532bbf491 100644 --- a/doc/classes/ReflectionProbe.xml +++ b/doc/classes/ReflectionProbe.xml @@ -11,7 +11,7 @@ [b]Note:[/b] When using the Mobile rendering method, reflection probes will only correctly affect meshes whose visibility AABB intersects with the reflection probe's AABB. If using a shader to deform the mesh in a way that makes it go outside its AABB, [member GeometryInstance3D.extra_cull_margin] must be increased on the mesh. Otherwise, the reflection probe may not be visible on the mesh. </description> <tutorials> - <link title="Reflection probes">$DOCS_URL/tutorials/3d/reflection_probes.html</link> + <link title="Reflection probes">$DOCS_URL/tutorials/3d/global_illumination/reflection_probes.html</link> </tutorials> <members> <member name="ambient_color" type="Color" setter="set_ambient_color" getter="get_ambient_color" default="Color(0, 0, 0, 1)"> diff --git a/doc/classes/ScriptLanguageExtension.xml b/doc/classes/ScriptLanguageExtension.xml index 2d41f8e880..d67fe5d255 100644 --- a/doc/classes/ScriptLanguageExtension.xml +++ b/doc/classes/ScriptLanguageExtension.xml @@ -21,12 +21,6 @@ <description> </description> </method> - <method name="_alloc_instance_binding_data" qualifiers="virtual"> - <return type="void*" /> - <param index="0" name="object" type="Object" /> - <description> - </description> - </method> <method name="_auto_indent_code" qualifiers="virtual const"> <return type="String" /> <param index="0" name="code" type="String" /> @@ -118,12 +112,6 @@ <description> </description> </method> - <method name="_execute_file" qualifiers="virtual"> - <return type="int" enum="Error" /> - <param index="0" name="path" type="String" /> - <description> - </description> - </method> <method name="_find_function" qualifiers="virtual const"> <return type="int" /> <param index="0" name="class_name" type="String" /> @@ -141,12 +129,6 @@ <description> </description> </method> - <method name="_free_instance_binding_data" qualifiers="virtual"> - <return type="void" /> - <param index="0" name="data" type="void*" /> - <description> - </description> - </method> <method name="_get_built_in_templates" qualifiers="virtual const"> <return type="Dictionary[]" /> <param index="0" name="object" type="StringName" /> @@ -298,18 +280,6 @@ <description> </description> </method> - <method name="_refcount_decremented_instance_binding" qualifiers="virtual"> - <return type="bool" /> - <param index="0" name="object" type="Object" /> - <description> - </description> - </method> - <method name="_refcount_incremented_instance_binding" qualifiers="virtual"> - <return type="void" /> - <param index="0" name="object" type="Object" /> - <description> - </description> - </method> <method name="_reload_all_scripts" qualifiers="virtual"> <return type="void" /> <description> diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml index 16e4ce3714..704430a1c2 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -214,6 +214,7 @@ <param index="0" name="ease" type="int" enum="Tween.EaseType" /> <description> Sets the default ease type for [PropertyTweener]s and [MethodTweener]s animated by this [Tween]. + If not specified, the default value is [constant EASE_IN_OUT]. </description> </method> <method name="set_loops"> @@ -260,6 +261,7 @@ <param index="0" name="trans" type="int" enum="Tween.TransitionType" /> <description> Sets the default transition type for [PropertyTweener]s and [MethodTweener]s animated by this [Tween]. + If not specified, the default value is [constant TRANS_LINEAR]. </description> </method> <method name="stop"> diff --git a/doc/classes/VehicleBody3D.xml b/doc/classes/VehicleBody3D.xml index 9f905c0ec5..6813c88940 100644 --- a/doc/classes/VehicleBody3D.xml +++ b/doc/classes/VehicleBody3D.xml @@ -23,7 +23,8 @@ </member> <member name="mass" type="float" setter="set_mass" getter="get_mass" overrides="RigidBody3D" default="40.0" /> <member name="steering" type="float" setter="set_steering" getter="get_steering" default="0.0"> - The steering angle for the vehicle, in radians. Setting this to a non-zero value will result in the vehicle turning when it's moving. Wheels that have [member VehicleWheel3D.use_as_steering] set to [code]true[/code] will automatically be rotated. + The steering angle for the vehicle. Setting this to a non-zero value will result in the vehicle turning when it's moving. Wheels that have [member VehicleWheel3D.use_as_steering] set to [code]true[/code] will automatically be rotated. + [b]Note:[/b] This property is edited in the inspector in degrees. In code the property is set in radians. </member> </members> </class> diff --git a/doc/classes/VisualInstance3D.xml b/doc/classes/VisualInstance3D.xml index 3781045c02..b2bc6709a0 100644 --- a/doc/classes/VisualInstance3D.xml +++ b/doc/classes/VisualInstance3D.xml @@ -62,7 +62,7 @@ For [Light3D]s, this can be used to control which [VisualInstance3D]s are affected by a specific light. For [GPUParticles3D], this can be used to control which particles are effected by a specific attractor. For [Decal]s, this can be used to control which [VisualInstance3D]s are affected by a specific decal. </member> <member name="sorting_offset" type="float" setter="set_sorting_offset" getter="get_sorting_offset" default="0.0"> - The sorting offset used by this [VisualInstance3D]. Adjusting it to a higher value will make the [VisualInstance3D] reliably draw on top of other [VisualInstance3D]s that are otherwise positioned at the same spot. + The amount by which the depth of this [VisualInstance3D] will be adjusted when sorting by depth. Uses the same units as the engine (which are typically meters). Adjusting it to a higher value will make the [VisualInstance3D] reliably draw on top of other [VisualInstance3D]s that are otherwise positioned at the same spot. To ensure it always draws on top of other objects around it (not positioned at the same spot), set the value to be greater than the distance between this [VisualInstance3D] and the other nearby [VisualInstance3D]s. </member> <member name="sorting_use_aabb_center" type="bool" setter="set_sorting_use_aabb_center" getter="is_sorting_use_aabb_center"> If [code]true[/code], the object is sorted based on the [AABB] center. The object will be sorted based on the global position otherwise. diff --git a/doc/classes/VisualShaderNodeDerivativeFunc.xml b/doc/classes/VisualShaderNodeDerivativeFunc.xml index 4a31969171..758c7458fe 100644 --- a/doc/classes/VisualShaderNodeDerivativeFunc.xml +++ b/doc/classes/VisualShaderNodeDerivativeFunc.xml @@ -16,7 +16,7 @@ A type of operands and returned value. See [enum OpType] for options. </member> <member name="precision" type="int" setter="set_precision" getter="get_precision" enum="VisualShaderNodeDerivativeFunc.Precision" default="0"> - Sets the level of precision to use for the derivative function. See [enum Precision] for options. When using the GL_Compatibility renderer, this setting has no effect. + Sets the level of precision to use for the derivative function. See [enum Precision] for options. When using the GL Compatibility renderer, this setting has no effect. </member> </members> <constants> diff --git a/doc/classes/VoxelGI.xml b/doc/classes/VoxelGI.xml index e453fbd855..f6c643d757 100644 --- a/doc/classes/VoxelGI.xml +++ b/doc/classes/VoxelGI.xml @@ -11,7 +11,7 @@ [b]Note:[/b] Meshes should have sufficiently thick walls to avoid light leaks (avoid one-sided walls). For interior levels, enclose your level geometry in a sufficiently large box and bridge the loops to close the mesh. To further prevent light leaks, you can also strategically place temporary [MeshInstance3D] nodes with their [member GeometryInstance3D.gi_mode] set to [constant GeometryInstance3D.GI_MODE_STATIC]. These temporary nodes can then be hidden after baking the [VoxelGI] node. </description> <tutorials> - <link title="VoxelGI">$DOCS_URL/tutorials/3d/using_voxel_gi.html</link> + <link title="VoxelGI">$DOCS_URL/tutorials/3d/global_illumination/using_voxel_gi.html</link> <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> </tutorials> <methods> diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index c585895f4b..99ec1e1ed8 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -3373,6 +3373,32 @@ void SceneShaderData::set_code(const String &p_code) { uses_vertex_time = gen_code.uses_vertex_time; uses_fragment_time = gen_code.uses_fragment_time; +#ifdef DEBUG_ENABLED + if (uses_particle_trails) { + WARN_PRINT_ONCE_ED("Particle trails are only available when using the Forward+ or Mobile rendering backends."); + } + + if (uses_sss) { + WARN_PRINT_ONCE_ED("Sub-surface scattering is only available when using the Forward+ rendering backend."); + } + + if (uses_transmittance) { + WARN_PRINT_ONCE_ED("Transmittance is only available when using the Forward+ rendering backend."); + } + + if (uses_screen_texture) { + WARN_PRINT_ONCE_ED("Reading from the screen texture is not supported when using the GL Compatibility backend yet. Support will be added in a future release."); + } + + if (uses_depth_texture) { + WARN_PRINT_ONCE_ED("Reading from the depth texture is not supported when using the GL Compatibility backend yet. Support will be added in a future release."); + } + + if (uses_normal_texture) { + WARN_PRINT_ONCE_ED("Reading from the normal-roughness texture is only available when using the Forward+ or Mobile rendering backends."); + } +#endif + #if 0 print_line("**compiling shader:"); print_line("**defines:\n"); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 0f9ce89f02..75a444c877 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -896,15 +896,16 @@ void CanvasItemEditor::_snap_changed() { } void CanvasItemEditor::_selection_result_pressed(int p_result) { - if (selection_results.size() <= p_result) { + if (selection_results_menu.size() <= p_result) { return; } - CanvasItem *item = selection_results[p_result].item; + CanvasItem *item = selection_results_menu[p_result].item; if (item) { _select_click_on_item(item, Point2(), selection_menu_additive_selection); } + selection_results_menu.clear(); } void CanvasItemEditor::_selection_menu_hide() { @@ -2247,6 +2248,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) { selection_menu->set_item_tooltip(i, String(item->get_name()) + "\nType: " + item->get_class() + "\nPath: " + node_path); } + selection_results_menu = selection_results; selection_menu_additive_selection = b->is_shift_pressed(); selection_menu->set_position(viewport->get_screen_transform().xform(b->get_position())); selection_menu->reset_size(); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index ebe87a56f7..c5b9bf9e0b 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -256,6 +256,7 @@ private: } }; Vector<_SelectResult> selection_results; + Vector<_SelectResult> selection_results_menu; struct _HoverResult { Point2 position; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 96f5aeedf0..7feb0146bc 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -1543,6 +1543,7 @@ void Node3DEditorViewport::_list_select(Ref<InputEventMouseButton> b) { selection_menu->set_item_tooltip(i, String(spat->get_name()) + "\nType: " + spat->get_class() + "\nPath: " + node_path); } + selection_results_menu = selection_results; selection_menu->set_position(get_screen_position() + b->get_position()); selection_menu->reset_size(); selection_menu->popup(); @@ -3609,15 +3610,17 @@ void Node3DEditorViewport::_toggle_cinema_preview(bool p_activate) { } void Node3DEditorViewport::_selection_result_pressed(int p_result) { - if (selection_results.size() <= p_result) { + if (selection_results_menu.size() <= p_result) { return; } - clicked = selection_results[p_result].item->get_instance_id(); + clicked = selection_results_menu[p_result].item->get_instance_id(); if (clicked.is_valid()) { _select_clicked(spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT); } + + selection_results_menu.clear(); } void Node3DEditorViewport::_selection_menu_hide() { @@ -7919,7 +7922,9 @@ void Node3DEditor::_load_default_preview_settings() { environ_sky_color->set_pick_color(Color(0.385, 0.454, 0.55)); environ_ground_color->set_pick_color(Color(0.2, 0.169, 0.133)); environ_energy->set_value(1.0); - environ_glow_button->set_pressed(true); + if (OS::get_singleton()->get_current_rendering_method() != "gl_compatibility") { + environ_glow_button->set_pressed(true); + } environ_tonemap_button->set_pressed(true); environ_ao_button->set_pressed(false); environ_gi_button->set_pressed(false); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index a1fd9757d0..e5267e5fad 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -290,6 +290,7 @@ private: ObjectID clicked; ObjectID material_target; Vector<_RayResult> selection_results; + Vector<_RayResult> selection_results_menu; bool clicked_wants_append = false; bool selection_in_progress = false; diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index 3dd0c84ee7..73d2da63b7 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -784,7 +784,7 @@ void GenericTilePolygonEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("remove_polygon", "index"), &GenericTilePolygonEditor::remove_polygon); ClassDB::bind_method(D_METHOD("clear_polygons"), &GenericTilePolygonEditor::clear_polygons); ClassDB::bind_method(D_METHOD("set_polygon", "index", "polygon"), &GenericTilePolygonEditor::set_polygon); - ClassDB::bind_method(D_METHOD("get_polygon", "index"), &GenericTilePolygonEditor::set_polygon); + ClassDB::bind_method(D_METHOD("get_polygon", "index"), &GenericTilePolygonEditor::get_polygon); ADD_SIGNAL(MethodInfo("polygons_changed")); } diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index 0e7476d045..3c6f5c0955 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -78,11 +78,11 @@ public: RegEx reg_image_unlock = RegEx("([a-zA-Z0-9_\\.]+)\\.unlock\\(\\)"); RegEx reg_instantiate = RegEx("\\.instance\\(([^\\)]*)\\)"); // Simple OS properties with getters/setters. - RegEx reg_os_current_screen = RegEx("\\bOS\\.(set_|get_)?current_screen\\b"); - RegEx reg_os_min_window_size = RegEx("\\bOS\\.(set_|get_)?min_window_size\\b"); - RegEx reg_os_max_window_size = RegEx("\\bOS\\.(set_|get_)?max_window_size\\b"); - RegEx reg_os_window_position = RegEx("\\bOS\\.(set_|get_)?window_position\\b"); - RegEx reg_os_window_size = RegEx("\\bOS\\.(set_|get_)?window_size\\b"); + RegEx reg_os_current_screen = RegEx("\\bOS\\.((set_|get_)?)current_screen\\b"); + RegEx reg_os_min_window_size = RegEx("\\bOS\\.((set_|get_)?)min_window_size\\b"); + RegEx reg_os_max_window_size = RegEx("\\bOS\\.((set_|get_)?)max_window_size\\b"); + RegEx reg_os_window_position = RegEx("\\bOS\\.((set_|get_)?)window_position\\b"); + RegEx reg_os_window_size = RegEx("\\bOS\\.((set_|get_)?)window_size\\b"); RegEx reg_os_getset_screen_orient = RegEx("\\bOS\\.(s|g)et_screen_orientation\\b"); // OS property getters/setters for non trivial replacements. RegEx reg_os_set_window_resizable = RegEx(make_regex_gds_os_property_set("set_window_resizable")); @@ -153,6 +153,7 @@ public: LocalVector<RegEx *> enum_regexes; LocalVector<RegEx *> gdscript_function_regexes; LocalVector<RegEx *> project_settings_regexes; + LocalVector<RegEx *> project_godot_regexes; LocalVector<RegEx *> input_map_regexes; LocalVector<RegEx *> gdscript_properties_regexes; LocalVector<RegEx *> gdscript_signals_regexes; @@ -173,10 +174,14 @@ public: for (unsigned int current_index = 0; RenamesMap3To4::gdscript_function_renames[current_index][0]; current_index++) { gdscript_function_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::gdscript_function_renames[current_index][0] + "\\b"))); } - // Project Settings. + // Project Settings in scripts. for (unsigned int current_index = 0; RenamesMap3To4::project_settings_renames[current_index][0]; current_index++) { project_settings_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::project_settings_renames[current_index][0] + "\\b"))); } + // Project Settings in project.godot. + for (unsigned int current_index = 0; RenamesMap3To4::project_godot_renames[current_index][0]; current_index++) { + project_godot_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::project_godot_renames[current_index][0] + "\\b"))); + } // Input Map. for (unsigned int current_index = 0; RenamesMap3To4::input_map_renames[current_index][0]; current_index++) { input_map_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::input_map_renames[current_index][0] + "\\b"))); @@ -253,6 +258,9 @@ public: for (RegEx *regex : project_settings_regexes) { memdelete(regex); } + for (RegEx *regex : project_godot_regexes) { + memdelete(regex); + } for (RegEx *regex : input_map_regexes) { memdelete(regex); } @@ -405,7 +413,7 @@ bool ProjectConverter3To4::convert() { custom_rename(lines, "\\.shader", ".gdshader"); } else if (file_name.ends_with("project.godot")) { - rename_common(RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, lines); + rename_common(RenamesMap3To4::project_godot_renames, reg_container.project_godot_regexes, lines); rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines); rename_common(RenamesMap3To4::input_map_renames, reg_container.input_map_regexes, lines); } else if (file_name.ends_with(".csproj")) { @@ -577,7 +585,7 @@ bool ProjectConverter3To4::validate_conversion() { changed_elements.append_array(check_for_custom_rename(lines, "\\.shader", ".gdshader")); } else if (file_name.ends_with("project.godot")) { - changed_elements.append_array(check_for_rename_common(RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::project_godot_renames, reg_container.project_godot_regexes, lines)); changed_elements.append_array(check_for_rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines)); changed_elements.append_array(check_for_rename_common(RenamesMap3To4::input_map_renames, reg_container.input_map_regexes, lines)); } else if (file_name.ends_with(".csproj")) { @@ -1055,20 +1063,20 @@ bool ProjectConverter3To4::test_array_names() { // List of excluded functions from builtin types and global namespace, because currently it is not possible to get list of functions from them. // This will be available when https://github.com/godotengine/godot/pull/49053 or similar will be included into Godot. - static const char *builtin_types_excluded_functions[] = { "dict_to_inst", "inst_to_dict", "bytes_to_var", "bytes_to_var_with_objects", "db_to_linear", "deg_to_rad", "linear_to_db", "rad_to_deg", "randf_range", "snapped", "str_to_var", "var_to_str", "var_to_bytes", "var_to_bytes_with_objects", "move_toward", "uri_encode", "uri_decode", "remove_at", "get_rotation_quaternion", "clamp", "grow_side", "is_absolute_path", "is_valid_int", "lerp", "to_ascii_buffer", "to_utf8_buffer", "to_utf32_buffer", "snapped", "remap", "rfind", nullptr }; + static const char *builtin_types_excluded_functions[] = { "dict_to_inst", "inst_to_dict", "bytes_to_var", "bytes_to_var_with_objects", "db_to_linear", "deg_to_rad", "linear_to_db", "rad_to_deg", "randf_range", "snapped", "str_to_var", "var_to_str", "var_to_bytes", "var_to_bytes_with_objects", "move_toward", "uri_encode", "uri_decode", "remove_at", "get_rotation_quaternion", "limit_length", "grow_side", "is_absolute_path", "is_valid_int", "lerp", "to_ascii_buffer", "to_utf8_buffer", "to_utf32_buffer", "snapped", "remap", "rfind", nullptr }; for (int current_index = 0; builtin_types_excluded_functions[current_index]; current_index++) { all_functions.insert(builtin_types_excluded_functions[current_index]); } - // for (int type = Variant::Type::NIL + 1; type < Variant::Type::VARIANT_MAX; type++) { - // List<MethodInfo> method_list; - // Variant::get_method_list_by_type(&method_list, Variant::Type(type)); - // for (MethodInfo &function_data : method_list) { - // if (!all_functions.has(function_data.name)) { - // all_functions.insert(function_data.name); - // } - // } - // } + //for (int type = Variant::Type::NIL + 1; type < Variant::Type::VARIANT_MAX; type++) { + // List<MethodInfo> method_list; + // Variant::get_method_list_by_type(&method_list, Variant::Type(type)); + // for (MethodInfo &function_data : method_list) { + // if (!all_functions.has(function_data.name)) { + // all_functions.insert(function_data.name); + // } + // } + //} List<StringName> classes_list; ClassDB::get_class_list(&classes_list); @@ -1106,6 +1114,7 @@ bool ProjectConverter3To4::test_array_names() { valid = valid && test_single_array(RenamesMap3To4::shaders_renames, true); valid = valid && test_single_array(RenamesMap3To4::gdscript_signals_renames); valid = valid && test_single_array(RenamesMap3To4::project_settings_renames); + valid = valid && test_single_array(RenamesMap3To4::project_godot_renames); valid = valid && test_single_array(RenamesMap3To4::input_map_renames); valid = valid && test_single_array(RenamesMap3To4::builtin_types_renames); valid = valid && test_single_array(RenamesMap3To4::color_renames); diff --git a/editor/renames_map_3_to_4.cpp b/editor/renames_map_3_to_4.cpp index d7cac9a2b9..90c8709c3b 100644 --- a/editor/renames_map_3_to_4.cpp +++ b/editor/renames_map_3_to_4.cpp @@ -154,6 +154,12 @@ const char *RenamesMap3To4::enum_renames[][2] = { }; const char *RenamesMap3To4::gdscript_function_renames[][2] = { + // NOTE: Commented out renames are disabled because deemed not suitable for + // the current way the regex-based converter works. + // When uncommenting any of those as suitable for conversion, please move it + // to the block with other enabled conversions, ordered alphabetically, and + // make sure to add it to the C# rename map too. + // { "_set_name", "get_tracker_name" }, // XRPositionalTracker -- CameraFeed uses this. // { "_unhandled_input", "_unhandled_key_input" }, // BaseButton, ViewportContainer -- Breaks Node, FileDialog, SubViewportContainer. // { "create_gizmo", "_create_gizmo" }, // EditorNode3DGizmoPlugin -- May be used. @@ -168,10 +174,13 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { // { "get_network_unique_id", "get_unique_id"}, // MultiplayerAPI -- Breaks SceneTree. // { "get_offset", "get_position_offset" }, // GraphNode -- Breaks Gradient. // { "get_peer_port", "get_peer" }, // ENetMultiplayerPeer -- Breaks WebSocketServer. + // { "get_points", "get_points_id" }, // AStar -- Breaks Line2D, ConvexPolygonShape. // { "get_process_mode", "get_process_callback" }, // ClippedCamera3D -- Breaks Node, Sky. // { "get_render_info", "get_rendering_info" }, // RenderingServer -- Breaks Viewport. + // { "get_stylebox", "get_theme_stylebox" }, // Control -- Would rename the method in Theme as well, skipping. // { "get_type", "get_tracker_type" }, // XRPositionalTracker -- Breaks GLTFAccessor, GLTFLight. // { "get_v_offset", "get_drag_vertical_offset" }, // Camera2D -- Breaks PathFollow, Camera. + // { "get_v_scroll", "get_v_scroll_bar" }, // ItemList -- Breaks TextView. // { "has_network_peer", "has_multiplayer_peer" }, // MultiplayerAPI -- Breaks SceneTree. // { "instance", "instantiate" }, // PackedScene, ClassDB -- Breaks FileSystemDock signal, and also .tscn files ("[instance=ExtResource( 17 )]"). This is implemented as custom rule. // { "is_listening", "is_bound"}, // PacketPeerUDP -- Breaks TCPServer, UDPServer. @@ -181,6 +190,7 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { // { "load", "_load"}, // ResourceFormatLoader -- Breaks ConfigFile, Image, StreamTexture2D. // { "make_current", "set_current" }, // Camera2D -- Breaks Camera3D, Listener2D. // { "process", "_process" }, // AnimationNode -- This word is too commonly used. + // { "raise", "move_to_front" }, // CanvasItem -- Too common. // { "save", "_save"}, // ResourceFormatLoader -- Breaks ConfigFile, Image, StreamTexture2D. // { "set_autowrap", "set_autowrap_mode" }, // AcceptDialog -- Breaks Label, also a cyclic rename. // { "set_color", "surface_set_color"}, // ImmediateMesh -- Breaks Light2D, Theme, SurfaceTool. @@ -197,9 +207,7 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { // { "set_tooltip", "set_tooltip_text" }, // Control -- Breaks TreeItem, at least for now. // { "set_uv", "surface_set_uv" }, // ImmediateMesh -- Breaks Polygon2D. // { "set_v_offset", "set_drag_vertical_offset" }, // Camera2D -- Breaks Camera3D, PathFollow3D, PathFollow2D. - // {"get_points","get_points_id" }, // AStar -- Breaks Line2D, ConvexPolygonShape. - // {"get_v_scroll","get_v_scroll_bar" }, // ItemList -- Breaks TextView. - // { "get_stylebox", "get_theme_stylebox" }, // Control -- Would rename the method in Theme as well, skipping. + { "_about_to_show", "_about_to_popup" }, // ColorPickerButton { "_get_configuration_warning", "_get_configuration_warnings" }, // Node { "_set_current", "set_current" }, // Camera2D @@ -358,6 +366,7 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { { "get_scancode_string", "get_keycode_string" }, // OS { "get_scancode_with_modifiers", "get_keycode_with_modifiers" }, // InputEventKey { "get_selected_path", "get_current_directory" }, // EditorInterface + { "get_shader_param", "get_shader_parameter" }, // ShaderMaterial { "get_shift", "is_shift_pressed" }, // InputEventWithModifiers { "get_size_override", "get_size_2d_override" }, // SubViewport { "get_slide_count", "get_slide_collision_count" }, // CharacterBody2D, CharacterBody3D @@ -374,6 +383,7 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { { "get_theme_item_types", "get_theme_item_type_list" }, // Theme { "get_timer_process_mode", "get_timer_process_callback" }, // Timer { "get_translation", "get_position" }, // Node3D -- Breaks GLTFNode, but it is used rarely. + { "get_uniform_name", "get_parameter_name" }, // ParameterRef { "get_unit_db", "get_volume_db" }, // AudioStreamPlayer3D { "get_unit_offset", "get_progress_ratio" }, // PathFollow2D, PathFollow3D { "get_use_in_baked_light", "is_baking_navigation" }, // GridMap @@ -456,7 +466,6 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { { "post_import", "_post_import" }, // EditorScenePostImport { "print_stray_nodes", "print_orphan_nodes" }, // Node { "property_list_changed_notify", "notify_property_list_changed" }, // Object - { "raise", "move_to_front" }, // CanvasItem { "recognize", "_recognize" }, // ResourceFormatLoader { "regen_normalmaps", "regen_normal_maps" }, // ArrayMesh { "remove_animation", "remove_animation_library" }, // AnimationPlayer @@ -533,6 +542,7 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { { "set_reverb_bus", "set_reverb_bus_name" }, // Area3D { "set_rotate", "set_rotates" }, // PathFollow2D { "set_scancode", "set_keycode" }, // InputEventKey + { "set_shader_param", "set_shader_parameter" }, // ShaderMaterial { "set_shift", "set_shift_pressed" }, // InputEventWithModifiers { "set_size_override", "set_size_2d_override" }, // SubViewport -- Breaks ImageTexture. { "set_size_override_stretch", "set_size_2d_override_stretch" }, // SubViewport @@ -548,6 +558,7 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { { "set_text_align", "set_text_alignment" }, // Button { "set_timer_process_mode", "set_timer_process_callback" }, // Timer { "set_translation", "set_position" }, // Node3D -- This breaks GLTFNode, but it is used rarely. + { "set_uniform_name", "set_parameter_name" }, // ParameterRef { "set_unit_db", "set_volume_db" }, // AudioStreamPlayer3D { "set_unit_offset", "set_progress_ratio" }, // PathFollow2D, PathFollow3D { "set_uv2", "surface_set_uv2" }, // ImmediateMesh -- Breaks SurfaceTool. @@ -570,26 +581,21 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { { "viewport_set_use_arvr", "viewport_set_use_xr" }, // RenderingServer { "warp_mouse_position", "warp_mouse" }, // Input { "world_to_map", "local_to_map" }, // TileMap, GridMap - { "set_shader_param", "set_shader_parameter" }, // ShaderMaterial - { "get_shader_param", "get_shader_parameter" }, // ShaderMaterial - { "set_uniform_name", "set_parameter_name" }, // ParameterRef - { "get_uniform_name", "get_parameter_name" }, // ParameterRef // Builtin types // Remember to add them to the builtin_types_excluded_functions variable, because for now these functions cannot be listed. - // { "empty", "is_empty" }, // Array -- Used as custom rule. Be careful, this will be used everywhere. - // { "remove", "remove_at" }, // Array -- Breaks Directory and several more. - { "clamped", "clamp" }, // Vector2 -- Be careful, this will be used everywhere. + // { "empty", "is_empty" }, // Array -- Used as custom rule. Be careful, this will be used everywhere. + // { "invert", "reverse" }, // Array -- Give it a check. Be careful, this will be used everywhere. + // { "remove", "remove_at" }, // Array -- Breaks Directory and several more. + { "clamped", "limit_length" }, // Vector2 { "get_rotation_quat", "get_rotation_quaternion" }, // Basis { "grow_margin", "grow_side" }, // Rect2 - { "invert", "reverse" }, // Array -- Give it a check. Be careful, this will be used everywhere. { "is_abs_path", "is_absolute_path" }, // String { "is_valid_integer", "is_valid_int" }, // String { "linear_interpolate", "lerp" }, // Color { "find_last", "rfind" }, // Array, String { "to_ascii", "to_ascii_buffer" }, // String { "to_utf8", "to_utf8_buffer" }, // String - { "to_wchar", "to_utf32_buffer" }, // String -- utf32 or utf16? // @GlobalScope // Remember to add them to the builtin_types_excluded_functions variable, because for now these functions cannot be listed. @@ -617,52 +623,6 @@ const char *RenamesMap3To4::gdscript_function_renames[][2] = { // gdscript_function_renames clone with CamelCase const char *RenamesMap3To4::csharp_function_renames[][2] = { - // { "_SetName", "GetTrackerName" }, // XRPositionalTracker -- CameraFeed uses this. - // { "_UnhandledInput", "_UnhandledKeyInput" }, // BaseButton, ViewportContainer -- Breaks Node, FileDialog, SubViewportContainer. - // { "CreateGizmo", "_CreateGizmo" }, // EditorNode3DGizmoPlugin -- May be used. - // { "GetDependencies", "_GetDependencies" }, // ResourceFormatLoader -- Breaks ResourceLoader. - // { "GetExtents", "GetSize" }, // BoxShape, RectangleShape -- Breaks Decal, VoxelGI, GPUParticlesCollisionBox, GPUParticlesCollisionSDF, GPUParticlesCollisionHeightField, GPUParticlesAttractorBox, GPUParticlesAttractorVectorField, FogVolume. - // { "GetHOffset", "GetDragHorizontalOffset" }, // Camera2D -- Breaks PathFollow, Camera. - // { "GetMode", "GetFileMode" }, // FileDialog -- Breaks Panel, Shader, CSGPolygon, TileMap. - // { "GetMotion", "GetTravel" }, // PhysicsTestMotionResult2D -- Breaks ParallaxLayer. - // { "GetName", "GetTrackerName" }, // XRPositionalTracker -- Breaks OS, Node - // { "GetNetworkConnectedPeers", "GetPeers" }, // MultiplayerAPI -- Breaks SceneTree. - // { "GetNetworkPeer", "HasMultiplayerPeer" }, // MultiplayerAPI -- Breaks SceneTree. - // { "GetNetworkUniqueId", "GetUniqueId" }, // MultiplayerAPI -- Breaks SceneTree. - // { "GetOffset", "GetPositionOffset" }, // GraphNode -- Breaks Gradient. - // { "GetPeerPort", "GetPeer" }, // ENetMultiplayerPeer -- Breaks WebSocketServer. - // { "GetProcessMode", "GetProcessCallback" }, // ClippedCamera3D -- Breaks Node, Sky. - // { "GetRenderInfo", "GetRenderingInfo" }, // RenderingServer -- Breaks Viewport. - // { "GetType", "GetTrackerType" }, // XRPositionalTracker -- Breaks GLTFAccessor, GLTFLight. - // { "GetVOffset", "GetDragVerticalOffset" }, // Camera2D -- Breaks PathFollow, Camera. - // { "HasNetworkPeer", "HasMultiplayerPeer" }, // MultiplayerAPI -- Breaks SceneTree. - // { "Instance", "Instantiate" }, // PackedScene, ClassDB -- Breaks FileSystemDock signal, and also .tscn files ("[instance=ExtResource( 17 )]"). This is implemented as custom rule. - // { "IsListening", "IsBound"}, // PacketPeerUDP -- Breaks TCPServer, UDPServer. - // { "IsRefusingNewNetworkConnections", "IsRefusingNewConnections"}, // MultiplayerAPI -- Breaks SceneTree. - // { "IsValid", "HasValidEvent" }, // Shortcut -- Breaks Callable, and more. - // { "Listen", "Bound"}, // PacketPeerUDP -- Breaks TCPServer, UDPServer. - // { "Load", "_Load"}, // ResourceFormatLoader -- Breaks ConfigFile, Image, StreamTexture2D. - // { "MakeCurrent", "SetCurrent" }, // Camera2D -- Breaks Camera3D, Listener2D. - // { "Process", "_Process" }, // AnimationNode -- This word is too commonly used. - // { "Save", "_Save"}, // ResourceFormatLoader -- Breaks ConfigFile, Image, StreamTexture2D. - // { "SetAutowrap", "SetAutowrapMode" }, // AcceptDialog -- Breaks Label, also a cyclic rename. - // { "SetColor", "SurfaceSetColor"}, // ImmediateMesh -- Breaks Light2D, Theme, SurfaceTool. - // { "SetEvent", "SetShortcut" }, // BaseButton -- Cyclic rename. - // { "SetExtents", "SetSize"}, // BoxShape, RectangleShape -- Breaks ReflectionProbe. - // { "SetFlag", "SetParticleFlag"}, // ParticleProcessMaterial -- Breaks Window, HingeJoint3D. - // { "SetHOffset", "SetDragHorizontalOffset" }, // Camera2D -- Breaks Camera3D, PathFollow3D, PathFollow2D. - // { "SetMargin", "SetOffset" }, // Control -- Breaks Shape3D, AtlasTexture. - // { "SetMode", "SetModeFileMode" }, // FileDialog -- Breaks Panel, Shader, CSGPolygon, TileMap. - // { "SetNormal", "SurfaceSetNormal"}, // ImmediateGeometry -- Breaks SurfaceTool, WorldMarginShape2D. - // { "SetOffset", "SetProgress" }, // PathFollow2D, PathFollow3D -- Too common. - // { "SetProcessMode", "SetProcessCallback" }, // AnimationTree -- Breaks Node, Tween, Sky. - // { "SetRefuseNewNetworkConnections", "SetRefuseNewConnections"}, // MultiplayerAPI -- Breaks SceneTree. - // { "SetTooltip", "SetTooltipText" }, // Control -- Breaks TreeItem, at least for now. - // { "SetUv", "SurfaceSetUv" }, // ImmediateMesh -- Breaks Polygon2D. - // { "SetVOffset", "SetDragVerticalOffset" }, // Camera2D -- Breaks Camera3D, PathFollow3D, PathFollow2D. - // {"GetPoints","GetPointsId" }, // AStar -- Breaks Line2D, ConvexPolygonShape. - // {"GetVScroll","GetVScrollBar" }, // ItemList -- Breaks TextView. - // { "GetStylebox", "GetThemeStylebox" }, // Control -- Would rename the method in Theme as well, skipping. { "_AboutToShow", "_AboutToPopup" }, // ColorPickerButton { "_GetConfigurationWarning", "_GetConfigurationWarnings" }, // Node { "_SetCurrent", "SetCurrent" }, // Camera2D @@ -815,6 +775,7 @@ const char *RenamesMap3To4::csharp_function_renames[][2] = { { "GetScancode", "GetKeycode" }, // InputEventKey { "GetScancodeString", "GetKeycodeString" }, // OS { "GetScancodeWithModifiers", "GetKeycodeWithModifiers" }, // InputEventKey + { "GetShaderParam", "GetShaderParameter" }, // ShaderMaterial { "GetShift", "IsShiftPressed" }, // InputEventWithModifiers { "GetSizeOverride", "GetSize2dOverride" }, // SubViewport { "GetSlipsOnSlope", "GetSlideOnSlope" }, // SeparationRayShape2D, SeparationRayShape3D @@ -830,6 +791,7 @@ const char *RenamesMap3To4::csharp_function_renames[][2] = { { "GetThemeItemTypes", "GetThemeItemTypeList" }, // Theme { "GetTimerProcessMode", "GetTimerProcessCallback" }, // Timer { "GetTranslation", "GetPosition" }, // Node3D -- Breaks GLTFNode, but it is used rarely. + { "GetUniformName", "GetParameterName" }, // ParameterRef { "GetUnitDb", "GetVolumeDb" }, // AudioStreamPlayer3D { "GetUnitOffset", "GetProgressRatio" }, // PathFollow2D, PathFollow3D { "GetUseInBakedLight", "IsBakingNavigation" }, // GridMap @@ -979,6 +941,7 @@ const char *RenamesMap3To4::csharp_function_renames[][2] = { { "SetReverbBus", "SetReverbBusName" }, // Area3D { "SetRotate", "SetRotates" }, // PathFollow2D { "SetScancode", "SetKeycode" }, // InputEventKey + { "SetShaderParam", "SetShaderParameter" }, // ShaderMaterial { "SetShift", "SetShiftPressed" }, // InputEventWithModifiers { "SetSizeOverride", "SetSize2dOverride" }, // SubViewport -- Breaks ImageTexture. { "SetSizeOverrideStretch", "SetSize2dOverrideStretch" }, // SubViewport @@ -995,6 +958,7 @@ const char *RenamesMap3To4::csharp_function_renames[][2] = { { "SetTimerProcessMode", "SetTimerProcessCallback" }, // Timer { "SetTonemapAutoExposure", "SetTonemapAutoExposureEnabled" }, // Environment { "SetTranslation", "SetPosition" }, // Node3D -- This breaks GLTFNode, but it is used rarely. + { "SetUniformName", "SetParameterName" }, // ParameterRef { "SetUnitDb", "SetVolumeDb" }, // AudioStreamPlayer3D { "SetUnitOffset", "SetProgressRatio" }, // PathFollow2D, PathFollow3D { "SetUv2", "SurfaceSetUv2" }, // ImmediateMesh -- Breaks SurfaceTool. @@ -1018,24 +982,16 @@ const char *RenamesMap3To4::csharp_function_renames[][2] = { { "ViewportSetUseArvr", "ViewportSetUseXr" }, // RenderingServer { "WarpMousePosition", "WarpMouse" }, // Input { "WorldToMap", "LocalToMap" }, // TileMap, GridMap - { "SetShaderParam", "SetShaderParameter" }, // ShaderMaterial - { "GetShaderParam", "GetShaderParameter" }, // ShaderMaterial - { "SetUniformName", "SetParameterName" }, // ParameterRef - { "GetUniformName", "GetParameterName" }, // ParameterRef // Builtin types - // { "Empty", "IsEmpty" }, // Array -- Used as custom rule. Be careful, this will be used everywhere. - // { "Remove", "RemoveAt" }, // Array -- Breaks Directory and several more. - { "Clamped", "Clamp" }, // Vector2 -- Be careful, this will be used everywhere. + { "Clamped", "LimitLength" }, // Vector2 { "GetRotationQuat", "GetRotationQuaternion" }, // Basis { "GrowMargin", "GrowSide" }, // Rect2 - { "Invert", "Reverse" }, // Array -- Give it a check. Be careful, this will be used everywhere. { "IsAbsPath", "IsAbsolutePath" }, // String { "IsValidInteger", "IsValidInt" }, // String { "LinearInterpolate", "Lerp" }, // Color { "ToAscii", "ToAsciiBuffer" }, // String { "ToUtf8", "ToUtf8Buffer" }, // String - { "ToWchar", "ToUtf32Buffer" }, // String -- utf32 or utf16? // @GlobalScope { "Bytes2Var", "BytesToVar" }, @@ -1060,40 +1016,49 @@ const char *RenamesMap3To4::csharp_function_renames[][2] = { }; const char *RenamesMap3To4::gdscript_properties_renames[][2] = { - // Some need to be disabled, because users frequently use these names for variables. - // // { "d", "distance" }, // WorldMarginShape2D -- TODO: looks like polish letters "ą" "ę" are treaten as space, not as letters. As such, "będą" is renamed to "będistanceą". - // // { "alt", "alt_pressed" }, // This may break a lot of comments and user variables. - // // { "command", "command_pressed" }, // This may break a lot of comments and user variables. - // // { "control", "ctrl_pressed" }, // This may break a lot of comments and user variables. - // // { "extends", "size" }, // BoxShape3D, LightmapGI -- Breaks ReflectionProbe. - // // { "meta", "meta_pressed" }, // This may break a lot of comments and user variables. - // // { "pause_mode", "process_mode" }, // Node -- Cyclic rename, look for others. - // // { "rotate", "rotates" }, // PathFollow2D - probably function exists with same name. - // // { "offset", "progress" }, // PathFollow2D, PathFollow3D -- Way too vague. - // // { "shift", "shift_pressed" }, // This may break a lot of comments and user variables. - // { "autowrap", "autowrap_mode" }, // Label - // { "cast_to", "target_position" }, // RayCast2D, RayCast3D - // { "device", "output_device" }, // AudioServer - Too vague, most likely breaks comments & variables - // { "doubleclick", "double_click" }, // InputEventMouseButton - // { "group", "button_group" }, // BaseButton - // { "percent_visible, "show_percentage }, // ProgressBar -- Breaks Label and RichTextLabel. Could it be worth it? - // { "process_mode", "process_callback" }, // AnimationTree, Camera2D - // { "scancode", "keycode" }, // InputEventKey - // { "toplevel", "top_level" }, // Node - // { "window_title", "title" }, // Window - // { "wrap_enabled", "wrap_mode" }, // TextEdit - // { "zfar", "far" }, // Camera3D - // { "znear", "near" }, // Camera3D - // { "filename", "scene_file_path" }, // Node - // { "pressed", "button_pressed" }, // BaseButton -- Would also rename the signal, skipping for now. + // NOTE: Commented out renames are disabled because deemed not suitable for + // the current way the regex-based converter works. + // When uncommenting any of those as suitable for conversion, please move it + // to the block with other enabled conversions, ordered alphabetically, and + // make sure to add it to the C# rename map too. + + // Too common words, users may use these names for variables or in comments. + // { "bg", "panel" }, // Theme + // { "alt", "alt_pressed" }, // InputEventWithModifiers + // { "command", "command_pressed" }, // InputEventWithModifiers + // { "control", "ctrl_pressed" }, // InputEventWithModifiers + // { "d", "distance" }, // WorldMarginShape2D + // { "device", "output_device" }, // AudioServer + // { "doubleclick", "double_click" }, // InputEventMouseButton + // { "filename", "scene_file_path" }, // Node + // { "group", "button_group" }, // BaseButton + // { "meta", "meta_pressed" }, // InputEventWithModifiers + // { "rotate", "rotates" }, // PathFollow2D + // { "off", "unchecked" }, // Theme + // { "ofs", "offset" }, // Theme + // { "offset", "progress" }, // PathFollow2D, PathFollow3D + // { "on", "checked" }, // Theme + // { "shift", "shift_pressed" }, // InputEventWithModifiers + // { "window_title", "title" }, // Window + // { "zfar", "far" }, // Camera3D + // { "znear", "near" }, // Camera3D + + // Would need bespoke solution. + // { "autowrap", "autowrap_mode" }, // Label -- Changed from bool to enum. + // { "frames", "sprite_frames" }, // AnimatedSprite2D, AnimatedSprite3D -- GH-73696 + // { "percent_visible, "show_percentage }, // ProgressBar -- Breaks Label and RichTextLabel. + // { "pressed", "button_pressed" }, // BaseButton -- Would also rename the signal. + // { "process_mode", "process_callback" }, // AnimationTree, Camera2D -- conflicts with Node. + // { "wrap_enabled", "wrap_mode" }, // TextEdit -- Changed from bool to enum. + { "as_normalmap", "as_normal_map" }, // NoiseTexture { "bbcode_text", "text" }, // RichTextLabel - { "bg", "panel" }, // Theme { "bg_focus", "focus" }, // Theme { "capture_device", "input_device" }, // AudioServer { "caret_blink_speed", "caret_blink_interval" }, // TextEdit, LineEdit { "caret_moving_by_right_click", "caret_move_on_right_click" }, // TextEdit { "caret_position", "caret_column" }, // LineEdit + { "cast_to", "target_position" }, // RayCast2D, RayCast3D { "check_vadjust", "check_v_offset" }, // Theme { "close_h_ofs", "close_h_offset" }, // Theme { "close_v_ofs", "close_v_offset" }, // Theme @@ -1107,6 +1072,7 @@ const char *RenamesMap3To4::gdscript_properties_renames[][2] = { { "drag_margin_top", "drag_top_margin" }, // Camera2D { "drag_margin_v_enabled", "drag_vertical_enabled" }, // Camera2D { "enabled_focus_mode", "focus_mode" }, // BaseButton - Removed + { "extents", "size" }, // BoxShape3D, LightmapGI, ReflectionProbe { "extra_spacing_bottom", "spacing_bottom" }, // Font { "extra_spacing_top", "spacing_top" }, // Font { "focus_neighbour_bottom", "focus_neighbor_bottom" }, // Control @@ -1133,10 +1099,7 @@ const char *RenamesMap3To4::gdscript_properties_renames[][2] = { { "neighbor_dist", "neighbor_distance" }, // NavigationAgent2D, NavigationAgent3D { "offset_h", "drag_horizontal_offset" }, // Camera2D { "offset_v", "drag_vertical_offset" }, // Camera2D - { "off", "unchecked" }, // Theme { "off_disabled", "unchecked_disabled" }, // Theme - { "ofs", "offset" }, // Theme - { "on", "checked" }, // Theme { "on_disabled", "checked_disabled" }, // Theme { "oneshot", "one_shot" }, // AnimatedTexture { "out_of_range_mode", "max_polyphony" }, // AudioStreamPlayer3D @@ -1155,6 +1118,7 @@ const char *RenamesMap3To4::gdscript_properties_renames[][2] = { { "refuse_new_network_connections", "refuse_new_connections" }, // MultiplayerAPI { "region_filter_clip", "region_filter_clip_enabled" }, // Sprite2D { "reverb_bus_enable", "reverb_bus_enabled" }, // Area3D + { "scancode", "keycode" }, // InputEventKey { "selectedframe", "selected_frame" }, // Theme { "size_override_stretch", "size_2d_override_stretch" }, // SubViewport { "slips_on_slope", "slide_on_slope" }, // SeparationRayShape2D @@ -1170,49 +1134,29 @@ const char *RenamesMap3To4::gdscript_properties_renames[][2] = { { "tab_align", "tab_alignment" }, // TabContainer { "table_hseparation", "table_h_separation" }, // Theme { "table_vseparation", "table_v_separation" }, // Theme - { "translation", "position" }, // Node3D -- Breaks GLTFNode + { "toplevel", "top_level" }, // Node + { "translation", "position" }, // Node3D { "unit_db", "volume_db" }, // AudioStreamPlayer3D { "unit_offset", "progress_ratio" }, // PathFollow2D, PathFollow3D { "vseparation", "v_separation" }, // Theme - // { "frames", "sprite_frames" }, // AnimatedSprite2D, AnimatedSprite3D -- GH-73696 { nullptr, nullptr }, }; const char *RenamesMap3To4::csharp_properties_renames[][2] = { - // Some need to be disabled, because users frequently use these names for variables. - // // { "D", "Distance" }, // WorldMarginShape2D -- TODO: looks like polish letters "ą" "ę" are treaten as space, not as letters. As such, "będą" is renamed to "będistanceą". - // // { "Alt", "AltPressed" }, // This may break a lot of comments and user variables. - // // { "Command", "CommandPressed" }, // This may break a lot of comments and user variables. - // // { "Control", "CtrlPressed" }, // This may break a lot of comments and user variables. - // // { "Extends", "Size" }, // BoxShape3D, LightmapGI -- Breaks ReflectionProbe. - // // { "Meta", "MetaPressed" }, // This may break a lot of comments and user variables. - // // { "PauseMode", "ProcessMode" }, // Node -- Cyclic rename, look for others. - // // { "Rotate", "Rotates" }, // PathFollow2D - probably function exists with same name. - // // { "Offset", "Progress" }, // PathFollow2D, PathFollow3D -- Way too vague. - // // { "Shift", "ShiftPressed" }, // This may break a lot of comments and user variables. - // { "Autowrap", "AutowrapMode" }, // Label - // { "CastTo", "TargetPosition" }, // RayCast2D, RayCast3D - // { "Doubleclick", "DoubleClick" }, // InputEventMouseButton - // { "Group", "ButtonGroup" }, // BaseButton - // { "PercentVisible, "ShowPercentage}, // ProgressBar -- Breaks Label and RichTextLabel. Could it be worth it? - // { "ProcessMode", "ProcessCallback" }, // AnimationTree, Camera2D - // { "Scancode", "Keycode" }, // InputEventKey - // { "Toplevel", "TopLevel" }, // Node - // { "WindowTitle", "Title" }, // Window - // { "WrapEnabled", "WrapMode" }, // TextEdit - // { "Zfar", "Far" }, // Camera3D - // { "Znear", "Near" }, // Camera3D - // { "Pressed", "ButtonPressed" }, // BaseButton -- Would also rename the signal, skipping for now. { "AsNormalmap", "AsNormalMap" }, // NoiseTexture { "BbcodeText", "Text" }, // RichTextLabel + { "BgFocus", "Focus" }, // Theme + { "CaptureDevice", "InputDevice" }, // AudioServer { "CaretBlinkSpeed", "CaretBlinkInterval" }, // TextEdit, LineEdit { "CaretMovingByRightClick", "CaretMoveOnRightClick" }, // TextEdit { "CaretPosition", "CaretColumn" }, // LineEdit + { "CastTo", "TargetPosition" }, // RayCast2D, RayCast3D { "CheckVadjust", "CheckVAdjust" }, // Theme { "CloseHOfs", "CloseHOffset" }, // Theme { "CloseVOfs", "CloseVOffset" }, // Theme { "Commentfocus", "CommentFocus" }, // Theme + { "ContactsReported", "MaxContactsReported" }, // RigidBody { "DepthBiasEnable", "DepthBiasEnabled" }, // RDPipelineRasterizationState { "DragMarginBottom", "DragBottomMargin" }, // Camera2D { "DragMarginHEnabled", "DragHorizontalEnabled" }, // Camera2D @@ -1221,6 +1165,7 @@ const char *RenamesMap3To4::csharp_properties_renames[][2] = { { "DragMarginTop", "DragTopMargin" }, // Camera2D { "DragMarginVEnabled", "DragVerticalEnabled" }, // Camera2D { "EnabledFocusMode", "FocusMode" }, // BaseButton - Removed + { "Extents", "Size" }, // BoxShape3D, LightmapGI, ReflectionProbe { "ExtraSpacingBottom", "SpacingBottom" }, // Font { "ExtraSpacingTop", "SpacingTop" }, // Font { "FocusNeighbourBottom", "FocusNeighborBottom" }, // Control @@ -1228,6 +1173,9 @@ const char *RenamesMap3To4::csharp_properties_renames[][2] = { { "FocusNeighbourRight", "FocusNeighborRight" }, // Control { "FocusNeighbourTop", "FocusNeighborTop" }, // Control { "FollowViewportEnable", "FollowViewportEnabled" }, // CanvasItem + { "FileIconModulate", "FileIconColor" }, // Theme + { "FilesDisabled", "FileDisabledColor" }, // Theme + { "FolderIconModulate", "FolderIconColor" }, // Theme { "GlobalRateScale", "PlaybackSpeedScale" }, // AudioServer { "GravityDistanceScale", "GravityPointDistanceScale" }, // Area2D { "GravityVec", "GravityDirection" }, // Area2D @@ -1244,7 +1192,8 @@ const char *RenamesMap3To4::csharp_properties_renames[][2] = { { "NeighborDist", "NeighborDistance" }, // NavigationAgent2D, NavigationAgent3D { "OffsetH", "DragHorizontalOffset" }, // Camera2D { "OffsetV", "DragVerticalOffset" }, // Camera2D - { "Ofs", "Offset" }, // Theme + { "OffDisabled", "UncheckedDisabled" }, // Theme + { "OnDisabled", "CheckedDisabled" }, // Theme { "Oneshot", "OneShot" }, // AnimatedTexture { "OutOfRangeMode", "MaxPolyphony" }, // AudioStreamPlayer3D { "PauseMode", "ProcessMode" }, // Node @@ -1262,6 +1211,7 @@ const char *RenamesMap3To4::csharp_properties_renames[][2] = { { "RefuseNewNetworkConnections", "RefuseNewConnections" }, // MultiplayerAPI { "RegionFilterClip", "RegionFilterClipEnabled" }, // Sprite2D { "ReverbBusEnable", "ReverbBusEnabled" }, // Area3D + { "Scancode", "Keycode" }, // InputEventKey { "Selectedframe", "SelectedFrame" }, // Theme { "SizeOverrideStretch", "Size2dOverrideStretch" }, // SubViewport { "SlipsOnSlope", "SlideOnSlope" }, // SeparationRayShape2D @@ -1277,7 +1227,8 @@ const char *RenamesMap3To4::csharp_properties_renames[][2] = { { "TabAlign", "TabAlignment" }, // TabContainer { "TableHseparation", "TableHSeparation" }, // Theme { "TableVseparation", "TableVSeparation" }, // Theme - { "Translation", "Position" }, // Node3D -- Breaks GLTFNode + { "Toplevel", "TopLevel" }, // Node + { "Translation", "Position" }, // Node3D { "UnitDb", "VolumeDb" }, // AudioStreamPlayer3D { "UnitOffset", "ProgressRatio" }, // PathFollow2D, PathFollow3D { "Vseparation", "VSeparation" }, // Theme @@ -1286,10 +1237,16 @@ const char *RenamesMap3To4::csharp_properties_renames[][2] = { }; const char *RenamesMap3To4::gdscript_signals_renames[][2] = { - // { "instantiate", "instance" }, // FileSystemDock - // { "hide", "hidden" }, // CanvasItem -- Function with same name exists. - // { "tween_all_completed", "loop_finished" }, // Tween -- TODO, not sure. + // NOTE: Commented out renames are disabled because deemed not suitable for + // the current way the regex-based converter works. + // When uncommenting any of those as suitable for conversion, please move it + // to the block with other enabled conversions, ordered alphabetically, and + // make sure to add it to the C# rename map too. + + // Too common words, users may use these names for variables or in comments. + // { "hide", "hidden" }, // CanvasItem // { "changed", "settings_changed" }, // EditorSettings + { "about_to_show", "about_to_popup" }, // Popup { "button_release", "button_released" }, // XRController3D { "cancelled", "canceled" }, // AcceptDialog @@ -1311,12 +1268,10 @@ const char *RenamesMap3To4::gdscript_signals_renames[][2] = { }; const char *RenamesMap3To4::csharp_signals_renames[][2] = { - // { "Instantiate", "Instance" }, // FileSystemDock - // { "Hide", "Hidden" }, // CanvasItem -- Function with same name exists. - // { "TweenAllCompleted", "LoopFinished" }, // Tween -- TODO, not sure. - // { "Changed", "SettingsChanged" }, // EditorSettings { "AboutToShow", "AboutToPopup" }, // Popup { "ButtonRelease", "ButtonReleased" }, // XRController3D + { "Cancelled", "Canceled" }, // AcceptDialog + { "ItemDoubleClicked", "ItemIconDoubleClicked" }, // Tree { "NetworkPeerConnected", "PeerConnected" }, // MultiplayerAPI { "NetworkPeerDisconnected", "PeerDisconnected" }, // MultiplayerAPI { "NetworkPeerPacket", "PeerPacket" }, // MultiplayerAPI @@ -1331,10 +1286,12 @@ const char *RenamesMap3To4::csharp_signals_renames[][2] = { { "TweenStep", "StepFinished" }, // Tween { nullptr, nullptr }, - }; const char *RenamesMap3To4::project_settings_renames[][2] = { + // Project setting paths in scripts include the category, but in project.godot, + // the category is the section delimiter, so we need to support the paths without it. + // The project.godot remaps are defined in the project_godot_renames, keep them in sync! { "audio/channel_disable_threshold_db", "audio/buses/channel_disable_threshold_db" }, { "audio/channel_disable_time", "audio/buses/channel_disable_time" }, { "audio/default_bus_layout", "audio/buses/default_bus_layout" }, @@ -1344,6 +1301,10 @@ const char *RenamesMap3To4::project_settings_renames[][2] = { { "audio/output_latency", "audio/driver/output_latency" }, { "audio/output_latency.web", "audio/driver/output_latency.web" }, { "audio/video_delay_compensation_ms", "audio/video/video_delay_compensation_ms" }, + { "display/window/size/width", "display/window/size/viewport_width" }, + { "display/window/size/height", "display/window/size/viewport_height" }, + { "display/window/size/test_width", "display/window/size/window_width_override" }, + { "display/window/size/test_height", "display/window/size/window_height_override" }, { "display/window/vsync/use_vsync", "display/window/vsync/vsync_mode" }, { "editor/main_run_args", "editor/run/main_run_args" }, { "gui/common/swap_ok_cancel", "gui/common/swap_cancel_ok" }, @@ -1371,10 +1332,52 @@ const char *RenamesMap3To4::project_settings_renames[][2] = { { "rendering/quality/shadow_atlas/size.mobile", "rendering/lights_and_shadows/shadow_atlas/size.mobile" }, { "rendering/vram_compression/import_etc2", "rendering/textures/vram_compression/import_etc2_astc" }, { "rendering/vram_compression/import_s3tc", "rendering/textures/vram_compression/import_s3tc_bptc" }, + + { nullptr, nullptr }, +}; + +const char *RenamesMap3To4::project_godot_renames[][2] = { + // Should be kept in sync with project_settings_renames. + { "channel_disable_threshold_db", "buses/channel_disable_threshold_db" }, + { "channel_disable_time", "buses/channel_disable_time" }, + { "default_bus_layout", "buses/default_bus_layout" }, + // { "driver", "driver/driver" }, -- Risk of conflicts. + { "enable_audio_input", "driver/enable_input" }, + // { "mix_rate", "driver/mix_rate" }, -- Risk of conflicts. + { "output_latency", "driver/output_latency" }, + { "output_latency.web", "driver/output_latency.web" }, + { "video_delay_compensation_ms", "video/video_delay_compensation_ms" }, { "window/size/width", "window/size/viewport_width" }, { "window/size/height", "window/size/viewport_height" }, { "window/size/test_width", "window/size/window_width_override" }, { "window/size/test_height", "window/size/window_height_override" }, + { "window/vsync/use_vsync", "window/vsync/vsync_mode" }, + { "main_run_args", "run/main_run_args" }, + { "common/swap_ok_cancel", "common/swap_cancel_ok" }, + { "limits/debugger_stdout/max_chars_per_second", "limits/debugger/max_chars_per_second" }, + { "limits/debugger_stdout/max_errors_per_second", "limits/debugger/max_errors_per_second" }, + { "limits/debugger_stdout/max_messages_per_frame", "limits/debugger/max_queued_messages" }, + { "limits/debugger_stdout/max_warnings_per_second", "limits/debugger/max_warnings_per_second" }, + { "ssl/certificates", "tls/certificate_bundle_override" }, + { "2d/thread_model", "2d/run_on_thread" }, // TODO: Not sure. + { "environment/default_clear_color", "environment/defaults/default_clear_color" }, + { "environment/default_environment", "environment/defaults/default_environment" }, + { "quality/depth_prepass/disable_for_vendors", "driver/depth_prepass/disable_for_vendors" }, + { "quality/depth_prepass/enable", "driver/depth_prepass/enable" }, + { "quality/shading/force_blinn_over_ggx", "shading/overrides/force_blinn_over_ggx" }, + { "quality/shading/force_blinn_over_ggx.mobile", "shading/overrides/force_blinn_over_ggx.mobile" }, + { "quality/shading/force_lambert_over_burley", "shading/overrides/force_lambert_over_burley" }, + { "quality/shading/force_lambert_over_burley.mobile", "shading/overrides/force_lambert_over_burley.mobile" }, + { "quality/shading/force_vertex_shading", "shading/overrides/force_vertex_shading" }, + { "quality/shading/force_vertex_shading.mobile", "shading/overrides/force_vertex_shading.mobile" }, + { "quality/shadow_atlas/quadrant_0_subdiv", "lights_and_shadows/shadow_atlas/quadrant_0_subdiv" }, + { "quality/shadow_atlas/quadrant_1_subdiv", "lights_and_shadows/shadow_atlas/quadrant_1_subdiv" }, + { "quality/shadow_atlas/quadrant_2_subdiv", "lights_and_shadows/shadow_atlas/quadrant_2_subdiv" }, + { "quality/shadow_atlas/quadrant_3_subdiv", "lights_and_shadows/shadow_atlas/quadrant_3_subdiv" }, + { "quality/shadow_atlas/size", "lights_and_shadows/shadow_atlas/size" }, + { "quality/shadow_atlas/size.mobile", "lights_and_shadows/shadow_atlas/size.mobile" }, + { "vram_compression/import_etc2", "textures/vram_compression/import_etc2_astc" }, + { "vram_compression/import_s3tc", "textures/vram_compression/import_s3tc_bptc" }, { nullptr, nullptr }, }; @@ -1424,15 +1427,17 @@ const char *RenamesMap3To4::shaders_renames[][2] = { }; const char *RenamesMap3To4::class_renames[][2] = { - // { "BulletPhysicsDirectBodyState", "BulletPhysicsDirectBodyState3D" }, // Class is not visible in ClassDB. - // { "BulletPhysicsServer", "BulletPhysicsServer3D" }, // Class is not visible in ClassDB. - // { "GDScriptFunctionState", "Node3D" }, // TODO: Not sure to which this should be changed. - // { "GDScriptNativeClass", "Node3D" }, // TODO: Not sure to which this should be changed. - // { "InputDefault",""}, // TODO: ? - // { "Physics2DDirectBodyStateSW", "GodotPhysicsDirectBodyState2D" }, // Class is not visible in ClassDB. - // { "Physics2DShapeQueryResult", "PhysicsShapeQueryResult2D" }, // Class is not visible in ClassDB. - // { "PhysicsShapeQueryResult", "PhysicsShapeQueryResult3D" }, // Class is not visible in ClassDB. - // { "NativeScript","GDExtension"}, // ?? + // { "Particles", "GPUParticles3D" }, // Common word, and incompatible class. + // { "World", "World3D" }, // Too common. + + // Risky as fairly common words, but worth it given how ubiquitous they are. + { "Area", "Area3D" }, + { "Camera", "Camera3D" }, + { "Path", "Path3D" }, + { "Reference", "RefCounted" }, + { "Shape", "Shape3D" }, + { "Tabs", "TabBar" }, + { "ARVRAnchor", "XRAnchor3D" }, { "ARVRCamera", "XRCamera3D" }, { "ARVRController", "XRController3D" }, @@ -1443,8 +1448,6 @@ const char *RenamesMap3To4::class_renames[][2] = { { "ARVRServer", "XRServer" }, { "AStar", "AStar3D" }, { "AnimatedSprite", "AnimatedSprite2D" }, - { "AnimationTreePlayer", "AnimationTree" }, // Was deprecated since Godot 3.1. - { "Area", "Area3D" }, // Be careful, this will be used everywhere. { "AudioStreamOGGVorbis", "AudioStreamOggVorbis" }, { "AudioStreamRandomPitch", "AudioStreamRandomizer" }, { "AudioStreamSample", "AudioStreamWAV" }, @@ -1463,7 +1466,6 @@ const char *RenamesMap3To4::class_renames[][2] = { { "CSGShape", "CSGShape3D" }, { "CSGSphere", "CSGSphere3D" }, { "CSGTorus", "CSGTorus3D" }, - { "Camera", "Camera3D" }, // Be careful, this will be used everywhere. { "CapsuleShape", "CapsuleShape3D" }, { "ClippedCamera", "Camera3D" }, { "CollisionObject", "CollisionObject3D" }, @@ -1485,11 +1487,9 @@ const char *RenamesMap3To4::class_renames[][2] = { { "EditorSpatialGizmo", "EditorNode3DGizmo" }, { "EditorSpatialGizmoPlugin", "EditorNode3DGizmoPlugin" }, { "ExternalTexture", "ImageTexture" }, - { "FuncRef", "Callable" }, { "GIProbe", "VoxelGI" }, { "GIProbeData", "VoxelGIData" }, { "Generic6DOFJoint", "Generic6DOFJoint3D" }, - { "Geometry", "Geometry2D" }, // Geometry class is split between Geometry2D and Geometry3D, so we need to choose one. { "GeometryInstance", "GeometryInstance3D" }, { "GradientTexture", "GradientTexture2D" }, { "HeightMapShape", "HeightMapShape3D" }, @@ -1513,10 +1513,7 @@ const char *RenamesMap3To4::class_renames[][2] = { { "MeshInstance", "MeshInstance3D" }, { "MultiMeshInstance", "MultiMeshInstance3D" }, { "MultiplayerPeerGDNative", "MultiplayerPeerExtension" }, - { "Navigation", "Node3D" }, - { "Navigation2D", "Node2D" }, // Replaced by other 2D Navigation nodes. { "Navigation2DServer", "NavigationServer2D" }, - { "Navigation3D", "Node3D" }, // Replaced by other 3D Navigation nodes. { "NavigationAgent", "NavigationAgent3D" }, { "NavigationMeshInstance", "NavigationRegion3D" }, { "NavigationObstacle", "NavigationObstacle3D" }, @@ -1530,10 +1527,8 @@ const char *RenamesMap3To4::class_renames[][2] = { { "PHashTranslation", "OptimizedTranslation" }, { "PacketPeerGDNative", "PacketPeerExtension" }, { "PanoramaSky", "Sky" }, - { "Particles", "GPUParticles3D" }, // Be careful, this will be used everywhere. { "Particles2D", "GPUParticles2D" }, { "ParticlesMaterial", "ParticleProcessMaterial" }, - { "Path", "Path3D" }, // Be careful, this will be used everywhere. { "PathFollow", "PathFollow3D" }, { "PhysicalBone", "PhysicalBone3D" }, { "Physics2DDirectBodyState", "PhysicsDirectBodyState2D" }, @@ -1557,12 +1552,10 @@ const char *RenamesMap3To4::class_renames[][2] = { { "RayCast", "RayCast3D" }, { "RayShape", "SeparationRayShape3D" }, { "RayShape2D", "SeparationRayShape2D" }, - { "Reference", "RefCounted" }, // Be careful, this will be used everywhere. { "RemoteTransform", "RemoteTransform3D" }, { "ResourceInteractiveLoader", "ResourceLoader" }, { "RigidBody", "RigidBody3D" }, { "SceneTreeTween", "Tween" }, - { "Shape", "Shape3D" }, // Be careful, this will be used everywhere. { "ShortCut", "Shortcut" }, { "Skeleton", "Skeleton3D" }, { "SkeletonIK", "SkeletonIK3D" }, @@ -1585,7 +1578,6 @@ const char *RenamesMap3To4::class_renames[][2] = { { "StreamTexture2DArray", "CompressedTexture2DArray" }, { "StreamTextureLayered", "CompressedTextureLayered" }, { "TCP_Server", "TCPServer" }, - { "Tabs", "TabBar" }, // Be careful, this will be used everywhere. { "TextFile", "Node3D" }, { "Texture", "Texture2D" }, // May break TextureRect. { "TextureArray", "Texture2DArray" }, @@ -1633,19 +1625,11 @@ const char *RenamesMap3To4::class_renames[][2] = { { "WebRTCMultiplayer", "WebRTCMultiplayerPeer" }, { "WebRTCPeerConnectionGDNative", "WebRTCPeerConnectionExtension" }, { "WindowDialog", "Window" }, - { "World", "World3D" }, // Be careful, this will be used everywhere. { "XRAnchor", "XRAnchor3D" }, { "XRController", "XRController3D" }, { "XROrigin", "XROrigin3D" }, { "YSort", "Node2D" }, // CanvasItem has a new "y_sort_enabled" property. - // Portal and room occlusion culling was replaced by raster occlusion culling. - { "CullInstance", "Node3D" }, - { "RoomGroup", "Node3D" }, - { "Room", "Node3D" }, - { "RoomManager", "Node3D" }, - { "Portal", "Node3D" }, - { nullptr, nullptr }, }; diff --git a/editor/renames_map_3_to_4.h b/editor/renames_map_3_to_4.h index 119ededf43..537e5f1db5 100644 --- a/editor/renames_map_3_to_4.h +++ b/editor/renames_map_3_to_4.h @@ -42,6 +42,7 @@ struct RenamesMap3To4 { static const char *gdscript_signals_renames[][2]; static const char *csharp_signals_renames[][2]; static const char *project_settings_renames[][2]; + static const char *project_godot_renames[][2]; static const char *input_map_renames[][2]; static const char *builtin_types_renames[][2]; static const char *shaders_renames[][2]; diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp index ff7c01f9fc..f7bdaf389e 100644 --- a/modules/basis_universal/register_types.cpp +++ b/modules/basis_universal/register_types.cpp @@ -58,27 +58,32 @@ static Vector<uint8_t> basis_universal_packer(const Ref<Image> &p_image, Image:: if (image->get_format() != Image::FORMAT_RGBA8) { image->convert(Image::FORMAT_RGBA8); } - Ref<Image> image_single = image->duplicate(); - { - if (image_single->has_mipmaps()) { - image_single->clear_mipmaps(); - } - basisu::image buimg(image_single->get_width(), image_single->get_height()); - Vector<uint8_t> vec = image_single->get_data(); + if (!image->has_mipmaps()) { + basisu::image buimg(image->get_width(), image->get_height()); + Vector<uint8_t> vec = image->get_data(); const uint8_t *r = vec.ptr(); memcpy(buimg.get_ptr(), r, vec.size()); params.m_source_images.push_back(buimg); + } else { + { + Ref<Image> base_image = image->get_image_from_mipmap(0); + Vector<uint8_t> image_vec = base_image->get_data(); + basisu::image buimg_image(base_image->get_width(), base_image->get_height()); + const uint8_t *r = image_vec.ptr(); + memcpy(buimg_image.get_ptr(), r, image_vec.size()); + params.m_source_images.push_back(buimg_image); + } + basisu::vector<basisu::image> images; + for (int32_t mip_map_i = 1; mip_map_i <= image->get_mipmap_count(); mip_map_i++) { + Ref<Image> mip_map = image->get_image_from_mipmap(mip_map_i); + Vector<uint8_t> mip_map_vec = mip_map->get_data(); + basisu::image buimg_mipmap(mip_map->get_width(), mip_map->get_height()); + const uint8_t *r = mip_map_vec.ptr(); + memcpy(buimg_mipmap.get_ptr(), r, mip_map_vec.size()); + images.push_back(buimg_mipmap); + } + params.m_source_mipmap_images.push_back(images); } - basisu::vector<basisu::image> source_images; - for (int32_t mipmap_i = 1; mipmap_i < image->get_mipmap_count(); mipmap_i++) { - Ref<Image> mip = image->get_image_from_mipmap(mipmap_i); - basisu::image buimg(mip->get_width(), mip->get_height()); - Vector<uint8_t> vec = mip->get_data(); - const uint8_t *r = vec.ptr(); - memcpy(buimg.get_ptr(), r, vec.size()); - source_images.push_back(buimg); - } - params.m_uastc = true; params.m_quality_level = basisu::BASISU_QUALITY_MIN; @@ -154,6 +159,7 @@ static Ref<Image> basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size const uint8_t *ptr = p_data; int size = p_size; + ERR_FAIL_COND_V_MSG(p_data == nullptr, image, "Cannot unpack invalid basis universal data."); basist::transcoder_texture_format format = basist::transcoder_texture_format::cTFTotalTextureFormats; Image::Format imgfmt = Image::FORMAT_MAX; @@ -228,35 +234,29 @@ static Ref<Image> basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size ERR_FAIL_COND_V(!tr.validate_header(ptr, size), image); + tr.start_transcoding(ptr, size); + basist::basisu_image_info info; tr.get_image_info(ptr, size, info, 0); - - int block_size = basist::basis_get_bytes_per_block_or_pixel(format); Vector<uint8_t> gpudata; - gpudata.resize(info.m_total_blocks * block_size); - - { - uint8_t *w = gpudata.ptrw(); - uint8_t *dst = w; - for (int i = 0; i < gpudata.size(); i++) { - dst[i] = 0x00; - } + gpudata.resize(Image::get_image_data_size(info.m_width, info.m_height, imgfmt, info.m_total_levels > 1)); - int ofs = 0; - tr.start_transcoding(ptr, size); - for (uint32_t i = 0; i < info.m_total_levels; i++) { - basist::basisu_image_level_info level; - tr.get_image_level_info(ptr, size, level, 0, i); - - bool ret = tr.transcode_image_level(ptr, size, 0, i, dst + ofs, level.m_total_blocks - i, format); - if (!ret) { - printf("failed! on level %u\n", i); - break; - }; - - ofs += level.m_total_blocks * block_size; + uint8_t *w = gpudata.ptrw(); + uint8_t *dst = w; + for (int i = 0; i < gpudata.size(); i++) { + dst[i] = 0x00; + } + uint32_t mip_count = Image::get_image_required_mipmaps(info.m_orig_width, info.m_orig_height, imgfmt); + for (uint32_t level_i = 0; level_i <= mip_count; level_i++) { + basist::basisu_image_level_info level; + tr.get_image_level_info(ptr, size, level, 0, level_i); + int ofs = Image::get_image_mipmap_offset(info.m_width, info.m_height, imgfmt, level_i); + bool ret = tr.transcode_image_level(ptr, size, 0, level_i, dst + ofs, level.m_total_blocks, format); + if (!ret) { + print_line(vformat("Basis universal cannot unpack level %d.", level_i)); + break; }; - }; + } image = Image::create_from_data(info.m_width, info.m_height, info.m_total_levels > 1, imgfmt, gpudata); diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 00f8d2817a..b6caefbdb5 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -2027,11 +2027,6 @@ String GDScriptLanguage::get_extension() const { return "gd"; } -Error GDScriptLanguage::execute_file(const String &p_path) { - // ?? - return OK; -} - void GDScriptLanguage::finish() { if (_call_stack) { memdelete_arr(_call_stack); diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h index 82d04f641c..0117ed40ab 100644 --- a/modules/gdscript/gdscript.h +++ b/modules/gdscript/gdscript.h @@ -473,7 +473,6 @@ public: virtual void init() override; virtual String get_type() const override; virtual String get_extension() const override; - virtual Error execute_file(const String &p_path) override; virtual void finish() override; /* EDITOR FUNCTIONS */ diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index e058187860..38d5ae6b77 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -2618,7 +2618,7 @@ void GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode *p_binary_o result = get_operation_type(p_binary_op->variant_op, left_type, right_type, valid, p_binary_op); if (!valid) { push_error(vformat(R"(Invalid operands "%s" and "%s" for "%s" operator.)", left_type.to_string(), right_type.to_string(), Variant::get_operator_name(p_binary_op->variant_op)), p_binary_op); - } else if (result.type_source != GDScriptParser::DataType::ANNOTATED_EXPLICIT) { + } else if (!result.is_hard_type()) { mark_node_unsafe(p_binary_op); } } else { diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp index 5b092e3691..d6f21d297a 100644 --- a/modules/gdscript/gdscript_byte_codegen.cpp +++ b/modules/gdscript/gdscript_byte_codegen.cpp @@ -1058,7 +1058,7 @@ void GDScriptByteCodeGenerator::write_call_gdscript_utility(const Address &p_tar void GDScriptByteCodeGenerator::write_call_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) { bool is_validated = true; if (Variant::is_utility_function_vararg(p_function)) { - is_validated = true; // Vararg works fine with any argument, since they can be any type. + is_validated = false; // Vararg needs runtime checks, can't use validated call. } else if (p_arguments.size() == Variant::get_utility_function_argument_count(p_function)) { bool all_types_exact = true; for (int i = 0; i < p_arguments.size(); i++) { @@ -1107,7 +1107,7 @@ void GDScriptByteCodeGenerator::write_call_builtin_type(const Address &p_target, // Check if all types are correct. if (Variant::is_builtin_method_vararg(p_type, p_method)) { - is_validated = true; // Vararg works fine with any argument, since they can be any type. + is_validated = false; // Vararg needs runtime checks, can't use validated call. } else if (p_arguments.size() == Variant::get_builtin_method_argument_count(p_type, p_method)) { bool all_types_exact = true; for (int i = 0; i < p_arguments.size(); i++) { diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index fad2bf334b..d0c2cb43a6 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -85,7 +85,7 @@ void GDScriptCompiler::_set_error(const String &p_error, const GDScriptParser::N } GDScriptDataType GDScriptCompiler::_gdtype_from_datatype(const GDScriptParser::DataType &p_datatype, GDScript *p_owner) { - if (!p_datatype.is_set() || !p_datatype.is_hard_type()) { + if (!p_datatype.is_set() || !p_datatype.is_hard_type() || p_datatype.is_coroutine) { return GDScriptDataType(); } @@ -211,10 +211,6 @@ static bool _can_use_ptrcall(const MethodBind *p_method, const Vector<GDScriptCo return true; } -inline static bool is_category_or_group(const PropertyInfo &p_info) { - return p_info.usage & PROPERTY_USAGE_CATEGORY || p_info.usage & PROPERTY_USAGE_GROUP || p_info.usage & PROPERTY_USAGE_SUBGROUP; -} - GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &codegen, Error &r_error, const GDScriptParser::ExpressionNode *p_expression, bool p_root, bool p_initializer, const GDScriptCodeGenerator::Address &p_index_addr) { if (p_expression->is_constant && !(p_expression->get_datatype().is_meta_type && p_expression->get_datatype().kind == GDScriptParser::DataType::CLASS)) { return codegen.add_constant(p_expression->reduced_value); @@ -242,7 +238,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code // Try class members. if (_is_class_member_property(codegen, identifier)) { // Get property. - GDScriptCodeGenerator::Address temp = codegen.add_temporary(); // TODO: Could get the type of the class member here. + GDScriptCodeGenerator::Address temp = codegen.add_temporary(_gdtype_from_datatype(p_expression->get_datatype(), codegen.script)); gen->write_get_member(temp, identifier); return temp; } @@ -250,7 +246,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code // Try members. if (!codegen.function_node || !codegen.function_node->is_static) { // Try member variables. - if (codegen.script->member_indices.has(identifier) && !is_category_or_group(codegen.script->member_info[identifier])) { + if (codegen.script->member_indices.has(identifier)) { if (codegen.script->member_indices[identifier].getter != StringName() && codegen.script->member_indices[identifier].getter != codegen.function_name) { // Perform getter. GDScriptCodeGenerator::Address temp = codegen.add_temporary(codegen.script->member_indices[identifier].data_type); @@ -2022,6 +2018,32 @@ GDScriptFunction *GDScriptCompiler::_parse_function(Error &r_error, GDScript *p_ bool is_initializer = p_func && !p_for_lambda && p_func->identifier->name == GDScriptLanguage::get_singleton()->strings._init; bool is_implicit_ready = !p_func && p_for_ready; + if (!p_for_lambda && is_implicit_initializer) { + // Initialize the default values for type variables before anything. + // This avoids crashes if they are accessed with validated calls before being properly initialized. + // It may happen with out-of-order access or with `@onready` variables. + for (const GDScriptParser::ClassNode::Member &member : p_class->members) { + if (member.type != GDScriptParser::ClassNode::Member::VARIABLE) { + continue; + } + + const GDScriptParser::VariableNode *field = member.variable; + GDScriptDataType field_type = _gdtype_from_datatype(field->get_datatype(), codegen.script); + GDScriptCodeGenerator::Address dst_address(GDScriptCodeGenerator::Address::MEMBER, codegen.script->member_indices[field->identifier->name].index, field_type); + + if (field_type.has_type) { + codegen.generator->write_newline(field->start_line); + + if (field_type.has_container_element_type()) { + codegen.generator->write_construct_typed_array(dst_address, field_type.get_container_element_type(), Vector<GDScriptCodeGenerator::Address>()); + } else if (field_type.kind == GDScriptDataType::BUILTIN) { + codegen.generator->write_construct(dst_address, field_type.builtin_type, Vector<GDScriptCodeGenerator::Address>()); + } + // The `else` branch is for objects, in such case we leave it as `null`. + } + } + } + if (!p_for_lambda && (is_implicit_initializer || is_implicit_ready)) { // Initialize class fields. for (int i = 0; i < p_class->members.size(); i++) { @@ -2055,16 +2077,6 @@ GDScriptFunction *GDScriptCompiler::_parse_function(Error &r_error, GDScript *p_ if (src_address.mode == GDScriptCodeGenerator::Address::TEMPORARY) { codegen.generator->pop_temporary(); } - } else if (field_type.has_type) { - codegen.generator->write_newline(field->start_line); - - // Initialize with default for type. - if (field_type.has_container_element_type()) { - codegen.generator->write_construct_typed_array(dst_address, field_type.get_container_element_type(), Vector<GDScriptCodeGenerator::Address>()); - } else if (field_type.kind == GDScriptDataType::BUILTIN) { - codegen.generator->write_construct(dst_address, field_type.builtin_type, Vector<GDScriptCodeGenerator::Address>()); - } - // The `else` branch is for objects, in such case we leave it as `null`. } } } diff --git a/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.gd b/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.gd index 6fc90ea29c..1e5c10b7d5 100644 --- a/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.gd +++ b/modules/gdscript/tests/scripts/analyzer/warnings/lambda_unused_arg.gd @@ -1,4 +1,4 @@ func test(): var lambda := func(unused: Variant) -> void: pass - lambda.call() + lambda.call("something") diff --git a/modules/gdscript/tests/scripts/runtime/features/conversions_from_native_members.gd b/modules/gdscript/tests/scripts/runtime/features/conversions_from_native_members.gd new file mode 100644 index 0000000000..a778fb1a94 --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/conversions_from_native_members.gd @@ -0,0 +1,11 @@ +class Foo extends Node: + func _init(): + name = 'f' + var string: String = name + assert(typeof(string) == TYPE_STRING) + assert(string == 'f') + print('ok') + +func test(): + var foo := Foo.new() + foo.free() diff --git a/modules/gdscript/tests/scripts/runtime/features/conversions_from_native_members.out b/modules/gdscript/tests/scripts/runtime/features/conversions_from_native_members.out new file mode 100644 index 0000000000..1b47ed10dc --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/conversions_from_native_members.out @@ -0,0 +1,2 @@ +GDTEST_OK +ok diff --git a/modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.gd b/modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.gd new file mode 100644 index 0000000000..03278e453f --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.gd @@ -0,0 +1,20 @@ +extends Node + +@onready var later_inferred := [1] +@onready var later_static : Array +@onready var later_static_with_init : Array = [1] +@onready var later_untyped = [1] + +func test(): + assert(typeof(later_inferred) == TYPE_ARRAY) + assert(later_inferred.size() == 0) + + assert(typeof(later_static) == TYPE_ARRAY) + assert(later_static.size() == 0) + + assert(typeof(later_static_with_init) == TYPE_ARRAY) + assert(later_static_with_init.size() == 0) + + assert(typeof(later_untyped) == TYPE_NIL) + + print("ok") diff --git a/modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.out b/modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.out new file mode 100644 index 0000000000..1b47ed10dc --- /dev/null +++ b/modules/gdscript/tests/scripts/runtime/features/default_set_beforehand.out @@ -0,0 +1,2 @@ +GDTEST_OK +ok diff --git a/modules/gdscript/tests/scripts/runtime/features/groups_are_not_properties.gd b/modules/gdscript/tests/scripts/runtime/features/groups_are_not_properties.gd deleted file mode 100644 index a5ad7c0b85..0000000000 --- a/modules/gdscript/tests/scripts/runtime/features/groups_are_not_properties.gd +++ /dev/null @@ -1,11 +0,0 @@ -# https://github.com/godotengine/godot/issues/73843 -extends RefCounted - -@export_group("Resource") -@export_category("RefCounted") - -func test(): - var res = Resource.new() - var ref = RefCounted.new() - prints("Resource class not shadowed:", res is Resource) - prints("RefCounted class not shadowed:", ref is RefCounted) diff --git a/modules/gdscript/tests/scripts/runtime/features/groups_are_not_properties.out b/modules/gdscript/tests/scripts/runtime/features/groups_are_not_properties.out deleted file mode 100644 index 182c6dcd3a..0000000000 --- a/modules/gdscript/tests/scripts/runtime/features/groups_are_not_properties.out +++ /dev/null @@ -1,3 +0,0 @@ -GDTEST_OK -Resource class not shadowed: true -RefCounted class not shadowed: true diff --git a/modules/gltf/doc_classes/GLTFState.xml b/modules/gltf/doc_classes/GLTFState.xml index b322c07cec..33b92f37c8 100644 --- a/modules/gltf/doc_classes/GLTFState.xml +++ b/modules/gltf/doc_classes/GLTFState.xml @@ -91,11 +91,6 @@ <description> </description> </method> - <method name="get_skeleton_to_node"> - <return type="Dictionary" /> - <description> - </description> - </method> <method name="get_skeletons"> <return type="GLTFSkeleton[]" /> <description> @@ -196,12 +191,6 @@ <description> </description> </method> - <method name="set_skeleton_to_node"> - <return type="void" /> - <param index="0" name="skeleton_to_node" type="Dictionary" /> - <description> - </description> - </method> <method name="set_skeletons"> <return type="void" /> <param index="0" name="skeletons" type="GLTFSkeleton[]" /> diff --git a/modules/gltf/gltf_state.cpp b/modules/gltf/gltf_state.cpp index b7b7113a97..b493e498f1 100644 --- a/modules/gltf/gltf_state.cpp +++ b/modules/gltf/gltf_state.cpp @@ -82,8 +82,6 @@ void GLTFState::_bind_methods() { ClassDB::bind_method(D_METHOD("set_unique_animation_names", "unique_animation_names"), &GLTFState::set_unique_animation_names); ClassDB::bind_method(D_METHOD("get_skeletons"), &GLTFState::get_skeletons); ClassDB::bind_method(D_METHOD("set_skeletons", "skeletons"), &GLTFState::set_skeletons); - ClassDB::bind_method(D_METHOD("get_skeleton_to_node"), &GLTFState::get_skeleton_to_node); - ClassDB::bind_method(D_METHOD("set_skeleton_to_node", "skeleton_to_node"), &GLTFState::set_skeleton_to_node); ClassDB::bind_method(D_METHOD("get_create_animations"), &GLTFState::get_create_animations); ClassDB::bind_method(D_METHOD("set_create_animations", "create_animations"), &GLTFState::set_create_animations); ClassDB::bind_method(D_METHOD("get_animations"), &GLTFState::get_animations); @@ -117,7 +115,6 @@ void GLTFState::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "unique_names", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_unique_names", "get_unique_names"); // Set<String> ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "unique_animation_names", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_unique_animation_names", "get_unique_animation_names"); // Set<String> ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "skeletons", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_skeletons", "get_skeletons"); // Vector<Ref<GLTFSkeleton>> - ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "skeleton_to_node", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_skeleton_to_node", "get_skeleton_to_node"); // RBMap<GLTFSkeletonIndex, ADD_PROPERTY(PropertyInfo(Variant::BOOL, "create_animations"), "set_create_animations", "get_create_animations"); // bool ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "animations", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_animations", "get_animations"); // Vector<Ref<GLTFAnimation>> ADD_PROPERTY(PropertyInfo(Variant::INT, "handle_binary_image", PROPERTY_HINT_ENUM, "Discard All Textures,Extract Textures,Embed As Basis Universal,Embed as Uncompressed", PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_EDITOR), "set_handle_binary_image", "get_handle_binary_image"); // enum @@ -315,14 +312,6 @@ void GLTFState::set_skeletons(TypedArray<GLTFSkeleton> p_skeletons) { GLTFTemplateConvert::set_from_array(skeletons, p_skeletons); } -Dictionary GLTFState::get_skeleton_to_node() { - return GLTFTemplateConvert::to_dict(skeleton_to_node); -} - -void GLTFState::set_skeleton_to_node(Dictionary p_skeleton_to_node) { - GLTFTemplateConvert::set_from_dict(skeleton_to_node, p_skeleton_to_node); -} - bool GLTFState::get_create_animations() { return create_animations; } diff --git a/modules/gltf/gltf_state.h b/modules/gltf/gltf_state.h index b6979ca48e..f2036fca1e 100644 --- a/modules/gltf/gltf_state.h +++ b/modules/gltf/gltf_state.h @@ -89,7 +89,6 @@ class GLTFState : public Resource { HashSet<String> unique_animation_names; Vector<Ref<GLTFSkeleton>> skeletons; - HashMap<GLTFSkeletonIndex, GLTFNodeIndex> skeleton_to_node; Vector<Ref<GLTFAnimation>> animations; HashMap<GLTFNodeIndex, Node *> scene_nodes; HashMap<GLTFNodeIndex, ImporterMeshInstance3D *> scene_mesh_instances; @@ -198,9 +197,6 @@ public: TypedArray<GLTFSkeleton> get_skeletons(); void set_skeletons(TypedArray<GLTFSkeleton> p_skeletons); - Dictionary get_skeleton_to_node(); - void set_skeleton_to_node(Dictionary p_skeleton_to_node); - bool get_create_animations(); void set_create_animations(bool p_create_animations); diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 43d2779e41..872e803b9c 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -92,11 +92,6 @@ String CSharpLanguage::get_extension() const { return "cs"; } -Error CSharpLanguage::execute_file(const String &p_path) { - // ?? - return OK; -} - void CSharpLanguage::init() { #ifdef DEBUG_METHODS_ENABLED if (OS::get_singleton()->get_cmdline_args().find("--class-db-json")) { diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 6021555255..02c354f74e 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -413,7 +413,6 @@ public: /* LANGUAGE FUNCTIONS */ String get_type() const override; String get_extension() const override; - Error execute_file(const String &p_path) override; void init() override; void finish() override; diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index ad6306bb41..cbe5266f7e 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -2831,7 +2831,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { TypeInterface itype = TypeInterface::create_object_type(type_cname, pascal_to_pascal_case(type_cname), api_type); itype.base_name = ClassDB::get_parent_class(type_cname); - itype.is_singleton = Engine::get_singleton()->has_singleton(itype.proxy_name); + itype.is_singleton = Engine::get_singleton()->has_singleton(type_cname); itype.is_instantiable = class_info->creation_func && !itype.is_singleton; itype.is_ref_counted = ClassDB::is_parent_class(type_cname, name_cache.type_RefCounted); itype.memory_own = itype.is_ref_counted; diff --git a/modules/text_server_adv/register_types.cpp b/modules/text_server_adv/register_types.cpp index 7820cd5e61..51a4d8171e 100644 --- a/modules/text_server_adv/register_types.cpp +++ b/modules/text_server_adv/register_types.cpp @@ -62,7 +62,7 @@ using namespace godot; extern "C" { -GDExtensionBool GDN_EXPORT textserver_advanced_init(const GDExtensionInterface *p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) { +GDExtensionBool GDE_EXPORT textserver_advanced_init(const GDExtensionInterface *p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) { GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization); init_obj.register_initializer(&initialize_text_server_adv_module); diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index b55188ce0c..22652daa24 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -3893,7 +3893,7 @@ bool TextServerAdvanced::_shaped_text_add_string(const RID &p_shaped, const Stri return true; } -bool TextServerAdvanced::_shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length, float p_baseline) { +bool TextServerAdvanced::_shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length, double p_baseline) { _THREAD_SAFE_METHOD_ ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -3924,7 +3924,7 @@ bool TextServerAdvanced::_shaped_text_add_object(const RID &p_shaped, const Vari return true; } -bool TextServerAdvanced::_shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, float p_baseline) { +bool TextServerAdvanced::_shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, double p_baseline) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -6274,7 +6274,7 @@ String TextServerAdvanced::_string_to_lower(const String &p_string, const String return String::utf16(lower.ptr(), len); } -PackedInt32Array TextServerAdvanced::_string_get_word_breaks(const String &p_string, const String &p_language, int p_chars_per_line) const { +PackedInt32Array TextServerAdvanced::_string_get_word_breaks(const String &p_string, const String &p_language, int64_t p_chars_per_line) const { const String lang = (p_language.is_empty()) ? TranslationServer::get_singleton()->get_tool_locale() : p_language; // Convert to UTF-16. Char16String utf16 = p_string.utf16(); diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h index 1acf5b21f0..02244a294e 100644 --- a/modules/text_server_adv/text_server_adv.h +++ b/modules/text_server_adv/text_server_adv.h @@ -469,7 +469,7 @@ class TextServerAdvanced : public TextServerExtension { int pos = 0; InlineAlignment inline_align = INLINE_ALIGNMENT_CENTER; Rect2 rect; - float baseline = 0; + double baseline = 0; }; HashMap<Variant, EmbeddedObject, VariantHasher, VariantComparator> objects; @@ -871,8 +871,8 @@ public: MODBIND2RC(int64_t, shaped_text_get_spacing, const RID &, SpacingType); MODBIND7R(bool, shaped_text_add_string, const RID &, const String &, const TypedArray<RID> &, int64_t, const Dictionary &, const String &, const Variant &); - MODBIND6R(bool, shaped_text_add_object, const RID &, const Variant &, const Size2 &, InlineAlignment, int64_t, float); - MODBIND5R(bool, shaped_text_resize_object, const RID &, const Variant &, const Size2 &, InlineAlignment, float); + MODBIND6R(bool, shaped_text_add_object, const RID &, const Variant &, const Size2 &, InlineAlignment, int64_t, double); + MODBIND5R(bool, shaped_text_resize_object, const RID &, const Variant &, const Size2 &, InlineAlignment, double); MODBIND1RC(int64_t, shaped_get_span_count, const RID &); MODBIND2RC(Variant, shaped_get_span_meta, const RID &, int64_t); @@ -917,7 +917,7 @@ public: MODBIND2RC(String, parse_number, const String &, const String &); MODBIND1RC(String, percent_sign, const String &); - MODBIND3RC(PackedInt32Array, string_get_word_breaks, const String &, const String &, int); + MODBIND3RC(PackedInt32Array, string_get_word_breaks, const String &, const String &, int64_t); MODBIND2RC(int64_t, is_confusable, const String &, const PackedStringArray &); MODBIND1RC(bool, spoof_check, const String &); diff --git a/modules/text_server_fb/register_types.cpp b/modules/text_server_fb/register_types.cpp index 4888fa9849..37c623c5eb 100644 --- a/modules/text_server_fb/register_types.cpp +++ b/modules/text_server_fb/register_types.cpp @@ -62,7 +62,7 @@ using namespace godot; extern "C" { -GDExtensionBool GDN_EXPORT textserver_fallback_init(const GDExtensionInterface *p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) { +GDExtensionBool GDE_EXPORT textserver_fallback_init(const GDExtensionInterface *p_interface, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) { GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization); init_obj.register_initializer(&initialize_text_server_fb_module); diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index b5d7d3a3cf..240ae8310a 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -2906,7 +2906,7 @@ bool TextServerFallback::_shaped_text_add_string(const RID &p_shaped, const Stri return true; } -bool TextServerFallback::_shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length, float p_baseline) { +bool TextServerFallback::_shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length, double p_baseline) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -2938,7 +2938,7 @@ bool TextServerFallback::_shaped_text_add_object(const RID &p_shaped, const Vari return true; } -bool TextServerFallback::_shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, float p_baseline) { +bool TextServerFallback::_shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, double p_baseline) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); @@ -4068,7 +4068,7 @@ String TextServerFallback::_string_to_lower(const String &p_string, const String return p_string.to_lower(); } -PackedInt32Array TextServerFallback::_string_get_word_breaks(const String &p_string, const String &p_language, int p_chars_per_line) const { +PackedInt32Array TextServerFallback::_string_get_word_breaks(const String &p_string, const String &p_language, int64_t p_chars_per_line) const { PackedInt32Array ret; int line_start = 0; diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h index 9fb048a581..12ed21ee95 100644 --- a/modules/text_server_fb/text_server_fb.h +++ b/modules/text_server_fb/text_server_fb.h @@ -417,7 +417,7 @@ class TextServerFallback : public TextServerExtension { int pos = 0; InlineAlignment inline_align = INLINE_ALIGNMENT_CENTER; Rect2 rect; - float baseline = 0; + double baseline = 0; }; HashMap<Variant, EmbeddedObject, VariantHasher, VariantComparator> objects; @@ -744,8 +744,8 @@ public: MODBIND2RC(int64_t, shaped_text_get_spacing, const RID &, SpacingType); MODBIND7R(bool, shaped_text_add_string, const RID &, const String &, const TypedArray<RID> &, int64_t, const Dictionary &, const String &, const Variant &); - MODBIND6R(bool, shaped_text_add_object, const RID &, const Variant &, const Size2 &, InlineAlignment, int64_t, float); - MODBIND5R(bool, shaped_text_resize_object, const RID &, const Variant &, const Size2 &, InlineAlignment, float); + MODBIND6R(bool, shaped_text_add_object, const RID &, const Variant &, const Size2 &, InlineAlignment, int64_t, double); + MODBIND5R(bool, shaped_text_resize_object, const RID &, const Variant &, const Size2 &, InlineAlignment, double); MODBIND1RC(int64_t, shaped_get_span_count, const RID &); MODBIND2RC(Variant, shaped_get_span_meta, const RID &, int64_t); @@ -786,7 +786,7 @@ public: MODBIND1RC(double, shaped_text_get_underline_position, const RID &); MODBIND1RC(double, shaped_text_get_underline_thickness, const RID &); - MODBIND3RC(PackedInt32Array, string_get_word_breaks, const String &, const String &, int); + MODBIND3RC(PackedInt32Array, string_get_word_breaks, const String &, const String &, int64_t); MODBIND2RC(String, string_to_upper, const String &, const String &); MODBIND2RC(String, string_to_lower, const String &, const String &); diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index b38f7225a2..6c961813b4 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -251,8 +251,12 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) { /* we're expecting more header packets. */ while ((theora_p && theora_p < 3) || (vorbis_p && vorbis_p < 3)) { + int ret = 0; + /* look for further theora headers */ - int ret = ogg_stream_packetout(&to, &op); + if (theora_p && theora_p < 3) { + ret = ogg_stream_packetout(&to, &op); + } while (theora_p && theora_p < 3 && ret) { if (ret < 0) { fprintf(stderr, "Error parsing Theora stream headers; corrupt stream?\n"); @@ -269,7 +273,9 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) { } /* look for more vorbis header packets */ - ret = ogg_stream_packetout(&vo, &op); + if (vorbis_p && vorbis_p < 3) { + ret = ogg_stream_packetout(&vo, &op); + } while (vorbis_p && vorbis_p < 3 && ret) { if (ret < 0) { fprintf(stderr, "Error parsing Vorbis stream headers; corrupt stream?\n"); diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp index 00d13c59b9..3f887ae9f3 100644 --- a/scene/2d/gpu_particles_2d.cpp +++ b/scene/2d/gpu_particles_2d.cpp @@ -143,6 +143,7 @@ void GPUParticles2D::set_trail_enabled(bool p_enabled) { trail_enabled = p_enabled; RS::get_singleton()->particles_set_trails(particles, trail_enabled, trail_lifetime); queue_redraw(); + update_configuration_warnings(); RS::get_singleton()->particles_set_transform_align(particles, p_enabled ? RS::PARTICLES_TRANSFORM_ALIGN_Y_TO_VELOCITY : RS::PARTICLES_TRANSFORM_ALIGN_DISABLED); } @@ -314,6 +315,10 @@ PackedStringArray GPUParticles2D::get_configuration_warnings() const { } } + if (trail_enabled && OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + warnings.push_back(RTR("Particle trails are only available when using the Forward+ or Mobile rendering backends.")); + } + return warnings; } diff --git a/scene/3d/decal.cpp b/scene/3d/decal.cpp index 6f2717fd41..50a5b2da70 100644 --- a/scene/3d/decal.cpp +++ b/scene/3d/decal.cpp @@ -165,6 +165,11 @@ void Decal::_validate_property(PropertyInfo &p_property) const { PackedStringArray Decal::get_configuration_warnings() const { PackedStringArray warnings = Node::get_configuration_warnings(); + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + warnings.push_back(RTR("Decals are only available when using the Forward+ or Mobile rendering backends.")); + return warnings; + } + if (textures[TEXTURE_ALBEDO].is_null() && textures[TEXTURE_NORMAL].is_null() && textures[TEXTURE_ORM].is_null() && textures[TEXTURE_EMISSION].is_null()) { warnings.push_back(RTR("The decal has no textures loaded into any of its texture properties, and will therefore not be visible.")); } diff --git a/scene/3d/fog_volume.cpp b/scene/3d/fog_volume.cpp index 9b0a7bb302..12ca1888c4 100644 --- a/scene/3d/fog_volume.cpp +++ b/scene/3d/fog_volume.cpp @@ -122,8 +122,13 @@ PackedStringArray FogVolume::get_configuration_warnings() const { Ref<Environment> environment = get_viewport()->find_world_3d()->get_environment(); + if (OS::get_singleton()->get_current_rendering_method() != "forward_plus") { + warnings.push_back(RTR("Fog Volumes are only visible when using the Forward+ backend.")); + return warnings; + } + if (environment.is_valid() && !environment->is_volumetric_fog_enabled()) { - warnings.push_back(("Fog Volumes need volumetric fog to be enabled in the scene's Environment in order to be visible.")); + warnings.push_back(RTR("Fog Volumes need volumetric fog to be enabled in the scene's Environment in order to be visible.")); } return warnings; diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index a330b76ec7..8eb1820cf8 100644 --- a/scene/3d/gpu_particles_3d.cpp +++ b/scene/3d/gpu_particles_3d.cpp @@ -358,6 +358,9 @@ PackedStringArray GPUParticles3D::get_configuration_warnings() const { if ((dp_count || !skin.is_null()) && (missing_trails || no_materials)) { warnings.push_back(RTR("Trails enabled, but one or more mesh materials are either missing or not set for trails rendering.")); } + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + warnings.push_back(RTR("Particle trails are only available when using the Forward+ or Mobile rendering backends.")); + } } return warnings; diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp index cca84c2b85..16c82bf6d2 100644 --- a/scene/3d/light_3d.cpp +++ b/scene/3d/light_3d.cpp @@ -56,11 +56,8 @@ void Light3D::set_shadow(bool p_enable) { shadow = p_enable; RS::get_singleton()->light_set_shadow(light, p_enable); - if (type == RenderingServer::LIGHT_SPOT || type == RenderingServer::LIGHT_OMNI) { - update_configuration_warnings(); - } - notify_property_list_changed(); + update_configuration_warnings(); } bool Light3D::has_shadow() const { @@ -175,6 +172,10 @@ AABB Light3D::get_aabb() const { PackedStringArray Light3D::get_configuration_warnings() const { PackedStringArray warnings = VisualInstance3D::get_configuration_warnings(); + if (has_shadow() && OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + warnings.push_back(RTR("Shadows are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); + } + if (!get_scale().is_equal_approx(Vector3(1, 1, 1))) { warnings.push_back(RTR("A light's scale does not affect the visual size of the light.")); } @@ -603,6 +604,10 @@ PackedStringArray OmniLight3D::get_configuration_warnings() const { warnings.push_back(RTR("Projector texture only works with shadows active.")); } + if (get_projector().is_valid() && OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + warnings.push_back(RTR("Projector textures are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); + } + return warnings; } @@ -635,6 +640,10 @@ PackedStringArray SpotLight3D::get_configuration_warnings() const { warnings.push_back(RTR("Projector texture only works with shadows active.")); } + if (get_projector().is_valid() && OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + warnings.push_back(RTR("Projector textures are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); + } + return warnings; } diff --git a/scene/3d/lightmap_gi.cpp b/scene/3d/lightmap_gi.cpp index b4387b0f3c..3ee08fd548 100644 --- a/scene/3d/lightmap_gi.cpp +++ b/scene/3d/lightmap_gi.cpp @@ -1458,6 +1458,17 @@ Ref<CameraAttributes> LightmapGI::get_camera_attributes() const { return camera_attributes; } +PackedStringArray LightmapGI::get_configuration_warnings() const { + PackedStringArray warnings = Node::get_configuration_warnings(); + + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + warnings.push_back(RTR("LightmapGI nodes are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); + return warnings; + } + + return warnings; +} + void LightmapGI::_validate_property(PropertyInfo &p_property) const { if (p_property.name == "environment_custom_sky" && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) { p_property.usage = PROPERTY_USAGE_NONE; diff --git a/scene/3d/lightmap_gi.h b/scene/3d/lightmap_gi.h index 40ff9e4cad..b9e33cf300 100644 --- a/scene/3d/lightmap_gi.h +++ b/scene/3d/lightmap_gi.h @@ -274,6 +274,9 @@ public: AABB get_aabb() const override; BakeError bake(Node *p_from_node, String p_image_data_path = "", Lightmapper::BakeStepFunc p_bake_step = nullptr, void *p_bake_userdata = nullptr); + + virtual PackedStringArray get_configuration_warnings() const override; + LightmapGI(); }; diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp index 62202c0b1b..e533f08861 100644 --- a/scene/3d/reflection_probe.cpp +++ b/scene/3d/reflection_probe.cpp @@ -180,6 +180,17 @@ AABB ReflectionProbe::get_aabb() const { return aabb; } +PackedStringArray ReflectionProbe::get_configuration_warnings() const { + PackedStringArray warnings = Node::get_configuration_warnings(); + + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + warnings.push_back(RTR("ReflectionProbes are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); + return warnings; + } + + return warnings; +} + void ReflectionProbe::_validate_property(PropertyInfo &p_property) const { if (p_property.name == "ambient_color" || p_property.name == "ambient_color_energy") { if (ambient_mode != AMBIENT_COLOR) { diff --git a/scene/3d/reflection_probe.h b/scene/3d/reflection_probe.h index 738277ad39..5438219d5e 100644 --- a/scene/3d/reflection_probe.h +++ b/scene/3d/reflection_probe.h @@ -118,6 +118,8 @@ public: virtual AABB get_aabb() const override; + virtual PackedStringArray get_configuration_warnings() const override; + ReflectionProbe(); ~ReflectionProbe(); }; diff --git a/scene/3d/visible_on_screen_notifier_3d.cpp b/scene/3d/visible_on_screen_notifier_3d.cpp index afddfdb749..d1ad713343 100644 --- a/scene/3d/visible_on_screen_notifier_3d.cpp +++ b/scene/3d/visible_on_screen_notifier_3d.cpp @@ -79,6 +79,16 @@ void VisibleOnScreenNotifier3D::_notification(int p_what) { } } +PackedStringArray VisibleOnScreenNotifier3D::get_configuration_warnings() const { + PackedStringArray warnings = VisualInstance3D::get_configuration_warnings(); + + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + warnings.push_back(RTR("VisibleOnScreenNotifier3D nodes are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); + } + + return warnings; +} + void VisibleOnScreenNotifier3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_aabb", "rect"), &VisibleOnScreenNotifier3D::set_aabb); ClassDB::bind_method(D_METHOD("is_on_screen"), &VisibleOnScreenNotifier3D::is_on_screen); diff --git a/scene/3d/visible_on_screen_notifier_3d.h b/scene/3d/visible_on_screen_notifier_3d.h index 7115de536f..85156c256e 100644 --- a/scene/3d/visible_on_screen_notifier_3d.h +++ b/scene/3d/visible_on_screen_notifier_3d.h @@ -57,6 +57,8 @@ public: virtual AABB get_aabb() const override; bool is_on_screen() const; + virtual PackedStringArray get_configuration_warnings() const override; + VisibleOnScreenNotifier3D(); ~VisibleOnScreenNotifier3D(); }; diff --git a/scene/3d/voxel_gi.cpp b/scene/3d/voxel_gi.cpp index 36a877246e..faeacec63a 100644 --- a/scene/3d/voxel_gi.cpp +++ b/scene/3d/voxel_gi.cpp @@ -492,8 +492,8 @@ AABB VoxelGI::get_aabb() const { PackedStringArray VoxelGI::get_configuration_warnings() const { PackedStringArray warnings = Node::get_configuration_warnings(); - if (RenderingServer::get_singleton()->is_low_end()) { - warnings.push_back(RTR("VoxelGIs are not supported by the OpenGL video driver.\nUse a LightmapGI instead.")); + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + warnings.push_back(RTR("VoxelGI nodes are not supported when using the GL Compatibility backend yet. Support will be added in a future release.")); } else if (probe_data.is_null()) { warnings.push_back(RTR("No VoxelGI data set, so this node is disabled. Bake static objects to enable GI.")); } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index cf73729c0a..1a6adca121 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -1715,12 +1715,12 @@ void PopupMenu::activate_item(int p_item) { need_hide = false; } - emit_signal(SNAME("id_pressed"), id); - emit_signal(SNAME("index_pressed"), p_item); - if (need_hide) { hide(); } + + emit_signal(SNAME("id_pressed"), id); + emit_signal(SNAME("index_pressed"), p_item); } void PopupMenu::remove_item(int p_idx) { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index ebca8296a0..7ab33d5c6c 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1548,7 +1548,7 @@ void TextEdit::_notification(int p_what) { ime_text = DisplayServer::get_singleton()->ime_get_text(); ime_selection = DisplayServer::get_singleton()->ime_get_selection(); - if (!ime_text.is_empty()) { + if (!ime_text.is_empty() && has_selection()) { delete_selection(); } diff --git a/scene/main/multiplayer_api.cpp b/scene/main/multiplayer_api.cpp index 950eb2809c..35e4302bb7 100644 --- a/scene/main/multiplayer_api.cpp +++ b/scene/main/multiplayer_api.cpp @@ -43,7 +43,7 @@ StringName MultiplayerAPI::default_interface; void MultiplayerAPI::set_default_interface(const StringName &p_interface) { ERR_FAIL_COND_MSG(!ClassDB::is_parent_class(p_interface, MultiplayerAPI::get_class_static()), vformat("Can't make %s the default multiplayer interface since it does not extend MultiplayerAPI.", p_interface)); - default_interface = p_interface; + default_interface = StringName(p_interface, true); } StringName MultiplayerAPI::get_default_interface() { diff --git a/scene/resources/camera_attributes.cpp b/scene/resources/camera_attributes.cpp index 61df56523d..8f4f804397 100644 --- a/scene/resources/camera_attributes.cpp +++ b/scene/resources/camera_attributes.cpp @@ -394,6 +394,13 @@ void CameraAttributesPhysical::_update_frustum() { bool use_far = (far < frustum_far) && (far > 0.0); bool use_near = near > frustum_near; +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility") { + // Force disable DoF in editor builds to suppress warnings. + use_far = false; + use_near = false; + } +#endif RS::get_singleton()->camera_attributes_set_dof_blur( get_rid(), use_far, diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 8b4656414d..757be51017 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -1108,13 +1108,6 @@ void Environment::_validate_property(PropertyInfo &p_property) const { }; - static const char *high_end_prefixes[] = { - "ssr_", - "ssao_", - nullptr - - }; - const char **prefixes = hide_prefixes; while (*prefixes) { String prefix = String(*prefixes); @@ -1127,20 +1120,6 @@ void Environment::_validate_property(PropertyInfo &p_property) const { prefixes++; } - - if (RenderingServer::get_singleton()->is_low_end()) { - prefixes = high_end_prefixes; - while (*prefixes) { - String prefix = String(*prefixes); - - if (p_property.name.begins_with(prefix)) { - p_property.usage = PROPERTY_USAGE_NO_EDITOR; - return; - } - - prefixes++; - } - } } #ifndef DISABLE_DEPRECATED diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 2627898f5f..8e0e38152f 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -1914,12 +1914,6 @@ void BaseMaterial3D::_validate_feature(const String &text, Feature feature, Prop } } -void BaseMaterial3D::_validate_high_end(const String &text, PropertyInfo &property) const { - if (property.name.begins_with(text)) { - property.usage |= PROPERTY_USAGE_HIGH_END_GFX; - } -} - void BaseMaterial3D::_validate_property(PropertyInfo &p_property) const { _validate_feature("normal", FEATURE_NORMAL_MAPPING, p_property); _validate_feature("emission", FEATURE_EMISSION, p_property); @@ -1933,10 +1927,6 @@ void BaseMaterial3D::_validate_property(PropertyInfo &p_property) const { _validate_feature("refraction", FEATURE_REFRACTION, p_property); _validate_feature("detail", FEATURE_DETAIL, p_property); - _validate_high_end("refraction", p_property); - _validate_high_end("subsurf_scatter", p_property); - _validate_high_end("heightmap", p_property); - if (p_property.name == "emission_intensity" && !GLOBAL_GET("rendering/lights_and_shadows/use_physical_light_units")) { p_property.usage = PROPERTY_USAGE_NONE; } diff --git a/scene/resources/material.h b/scene/resources/material.h index 5ea9a807d4..1fa9a24bc5 100644 --- a/scene/resources/material.h +++ b/scene/resources/material.h @@ -543,8 +543,6 @@ private: static HashMap<uint64_t, Ref<StandardMaterial3D>> materials_for_2d; //used by Sprite3D, Label3D and other stuff - void _validate_high_end(const String &text, PropertyInfo &property) const; - protected: static void _bind_methods(); void _validate_property(PropertyInfo &p_property) const; diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp index 0e992eb965..453cad5271 100644 --- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp @@ -114,8 +114,8 @@ void SceneShaderForwardMobile::ShaderData::set_code(const String &p_code) { actions.usage_flag_pointers["ALPHA_TEXTURE_COORDINATE"] = &uses_alpha_antialiasing; actions.render_mode_flags["depth_prepass_alpha"] = &uses_depth_prepass_alpha; - // actions.usage_flag_pointers["SSS_STRENGTH"] = &uses_sss; - // actions.usage_flag_pointers["SSS_TRANSMITTANCE_DEPTH"] = &uses_transmittance; + actions.usage_flag_pointers["SSS_STRENGTH"] = &uses_sss; + actions.usage_flag_pointers["SSS_TRANSMITTANCE_DEPTH"] = &uses_transmittance; actions.usage_flag_pointers["DISCARD"] = &uses_discard; actions.usage_flag_pointers["TIME"] = &uses_time; @@ -150,6 +150,16 @@ void SceneShaderForwardMobile::ShaderData::set_code(const String &p_code) { uses_depth_texture = gen_code.uses_depth_texture; uses_normal_texture = gen_code.uses_normal_roughness_texture; +#ifdef DEBUG_ENABLED + if (uses_sss) { + WARN_PRINT_ONCE_ED("Sub-surface scattering is only available when using the Forward+ rendering backend."); + } + + if (uses_transmittance) { + WARN_PRINT_ONCE_ED("Transmittance is only available when using the Forward+ rendering backend."); + } +#endif + #if 0 print_line("**compiling shader:"); print_line("**defines:\n"); diff --git a/servers/rendering/shader_preprocessor.cpp b/servers/rendering/shader_preprocessor.cpp index b45a7c0db3..ff1d55f905 100644 --- a/servers/rendering/shader_preprocessor.cpp +++ b/servers/rendering/shader_preprocessor.cpp @@ -679,6 +679,11 @@ void ShaderPreprocessor::process_include(Tokenizer *p_tokenizer) { path = state->current_filename.get_base_dir().path_join(path); } + if (!ResourceLoader::exists(path)) { + set_error(RTR("Shader include file does not exist: ") + path, line); + return; + } + Ref<Resource> res = ResourceLoader::load(path); if (res.is_null()) { set_error(RTR("Shader include load failed. Does the shader include exist? Is there a cyclic dependency?"), line); diff --git a/servers/rendering/storage/camera_attributes_storage.cpp b/servers/rendering/storage/camera_attributes_storage.cpp index 151ae4ccfe..d7f438a68c 100644 --- a/servers/rendering/storage/camera_attributes_storage.cpp +++ b/servers/rendering/storage/camera_attributes_storage.cpp @@ -65,7 +65,11 @@ void RendererCameraAttributes::camera_attributes_set_dof_blur_bokeh_shape(RS::DO void RendererCameraAttributes::camera_attributes_set_dof_blur(RID p_camera_attributes, bool p_far_enable, float p_far_distance, float p_far_transition, bool p_near_enable, float p_near_distance, float p_near_transition, float p_amount) { CameraAttributes *cam_attributes = camera_attributes_owner.get_or_null(p_camera_attributes); ERR_FAIL_COND(!cam_attributes); - +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility" && (p_far_enable || p_near_enable)) { + WARN_PRINT_ONCE_ED("DoF blur is only available when using the Forward+ or Mobile rendering backends."); + } +#endif cam_attributes->dof_blur_far_enabled = p_far_enable; cam_attributes->dof_blur_far_distance = p_far_distance; cam_attributes->dof_blur_far_transition = p_far_transition; @@ -139,6 +143,11 @@ void RendererCameraAttributes::camera_attributes_set_auto_exposure(RID p_camera_ if (!cam_attributes->use_auto_exposure && p_enable) { cam_attributes->auto_exposure_version = ++auto_exposure_counter; } +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility" && p_enable) { + WARN_PRINT_ONCE_ED("Auto exposure is only available when using the Forward+ or Mobile rendering backends."); + } +#endif cam_attributes->use_auto_exposure = p_enable; cam_attributes->auto_exposure_min_sensitivity = p_min_sensitivity; cam_attributes->auto_exposure_max_sensitivity = p_max_sensitivity; diff --git a/servers/rendering/storage/environment_storage.cpp b/servers/rendering/storage/environment_storage.cpp index 30a6a616bb..c07a5b6584 100644 --- a/servers/rendering/storage/environment_storage.cpp +++ b/servers/rendering/storage/environment_storage.cpp @@ -278,6 +278,11 @@ float RendererEnvironmentStorage::environment_get_fog_sky_affect(RID p_env) cons void RendererEnvironmentStorage::environment_set_volumetric_fog(RID p_env, bool p_enable, float p_density, const Color &p_albedo, const Color &p_emission, float p_emission_energy, float p_anisotropy, float p_length, float p_detail_spread, float p_gi_inject, bool p_temporal_reprojection, float p_temporal_reprojection_amount, float p_ambient_inject, float p_sky_affect) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() != "forward_plus" && p_enable) { + WARN_PRINT_ONCE_ED("Volumetric fog can only be enabled when using the Forward+ rendering backend."); + } +#endif env->volumetric_fog_enabled = p_enable; env->volumetric_fog_density = p_density; env->volumetric_fog_scattering = p_albedo; @@ -377,6 +382,11 @@ void RendererEnvironmentStorage::environment_set_glow(RID p_env, bool p_enable, Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); ERR_FAIL_COND_MSG(p_levels.size() != 7, "Size of array of glow levels must be 7"); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility" && p_enable) { + WARN_PRINT_ONCE_ED("Glow is not supported when using the GL Compatibility backend yet. Support will be added in a future release."); + } +#endif env->glow_enabled = p_enable; env->glow_levels = p_levels; env->glow_intensity = p_intensity; @@ -468,6 +478,11 @@ RID RendererEnvironmentStorage::environment_get_glow_map(RID p_env) const { void RendererEnvironmentStorage::environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() != "forward_plus" && p_enable) { + WARN_PRINT_ONCE_ED("Screen-space reflections (SSR) can only be enabled when using the Forward+ rendering backend."); + } +#endif env->ssr_enabled = p_enable; env->ssr_max_steps = p_max_steps; env->ssr_fade_in = p_fade_int; @@ -510,6 +525,11 @@ float RendererEnvironmentStorage::environment_get_ssr_depth_tolerance(RID p_env) void RendererEnvironmentStorage::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_power, float p_detail, float p_horizon, float p_sharpness, float p_light_affect, float p_ao_channel_affect) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() != "forward_plus" && p_enable) { + WARN_PRINT_ONCE_ED("Screen-space ambient occlusion (SSAO) can only be enabled when using the Forward+ rendering backend."); + } +#endif env->ssao_enabled = p_enable; env->ssao_radius = p_radius; env->ssao_intensity = p_intensity; @@ -580,6 +600,11 @@ float RendererEnvironmentStorage::environment_get_ssao_ao_channel_affect(RID p_e void RendererEnvironmentStorage::environment_set_ssil(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_sharpness, float p_normal_rejection) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() != "forward_plus" && p_enable) { + WARN_PRINT_ONCE_ED("Screen-space indirect lighting (SSIL) can only be enabled when using the Forward+ rendering backend."); + } +#endif env->ssil_enabled = p_enable; env->ssil_radius = p_radius; env->ssil_intensity = p_intensity; @@ -622,6 +647,11 @@ float RendererEnvironmentStorage::environment_get_ssil_normal_rejection(RID p_en void RendererEnvironmentStorage::environment_set_sdfgi(RID p_env, bool p_enable, int p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, float p_bounce_feedback, bool p_read_sky, float p_energy, float p_normal_bias, float p_probe_bias) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() != "forward_plus" && p_enable) { + WARN_PRINT_ONCE_ED("SDFGI can only be enabled when using the Forward+ rendering backend."); + } +#endif env->sdfgi_enabled = p_enable; env->sdfgi_cascades = p_cascades; env->sdfgi_min_cell_size = p_min_cell_size; @@ -699,6 +729,11 @@ RS::EnvironmentSDFGIYScale RendererEnvironmentStorage::environment_get_sdfgi_y_s void RendererEnvironmentStorage::environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, bool p_use_1d_color_correction, RID p_color_correction) { Environment *env = environment_owner.get_or_null(p_env); ERR_FAIL_COND(!env); +#ifdef DEBUG_ENABLED + if (OS::get_singleton()->get_current_rendering_method() == "gl_compatibility" && p_enable) { + WARN_PRINT_ONCE_ED("Adjustments are not supported when using the GL Compatibility backend yet. Support will be added in a future release."); + } +#endif env->adjustments_enabled = p_enable; env->adjustments_brightness = p_brightness; env->adjustments_contrast = p_contrast; diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp index cbf37f25d6..9a996c07d3 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -1041,13 +1041,13 @@ bool TextServerExtension::shaped_text_add_string(const RID &p_shaped, const Stri return ret; } -bool TextServerExtension::shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length, float p_baseline) { +bool TextServerExtension::shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length, double p_baseline) { bool ret = false; GDVIRTUAL_CALL(_shaped_text_add_object, p_shaped, p_key, p_size, p_inline_align, p_length, p_baseline, ret); return ret; } -bool TextServerExtension::shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, float p_baseline) { +bool TextServerExtension::shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, double p_baseline) { bool ret = false; GDVIRTUAL_CALL(_shaped_text_resize_object, p_shaped, p_key, p_size, p_inline_align, p_baseline, ret); return ret; @@ -1379,7 +1379,7 @@ TypedArray<Vector3i> TextServerExtension::parse_structured_text(StructuredTextPa return ret; } -PackedInt32Array TextServerExtension::string_get_word_breaks(const String &p_string, const String &p_language, int p_chars_per_line) const { +PackedInt32Array TextServerExtension::string_get_word_breaks(const String &p_string, const String &p_language, int64_t p_chars_per_line) const { PackedInt32Array ret; GDVIRTUAL_CALL(_string_get_word_breaks, p_string, p_language, p_chars_per_line, ret); return ret; diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h index 8536836983..5d11af0bf1 100644 --- a/servers/text/text_server_extension.h +++ b/servers/text/text_server_extension.h @@ -111,12 +111,12 @@ public: virtual void font_set_weight(const RID &p_font_rid, int64_t p_weight) override; virtual int64_t font_get_weight(const RID &p_font_rid) const override; - GDVIRTUAL2(_font_set_weight, RID, int); + GDVIRTUAL2(_font_set_weight, RID, int64_t); GDVIRTUAL1RC(int64_t, _font_get_weight, RID); virtual void font_set_stretch(const RID &p_font_rid, int64_t p_stretch) override; virtual int64_t font_get_stretch(const RID &p_font_rid) const override; - GDVIRTUAL2(_font_set_stretch, RID, int); + GDVIRTUAL2(_font_set_stretch, RID, int64_t); GDVIRTUAL1RC(int64_t, _font_get_stretch, RID); virtual void font_set_antialiasing(const RID &p_font_rid, TextServer::FontAntialiasing p_antialiasing) override; @@ -395,11 +395,11 @@ public: GDVIRTUAL2RC(int64_t, _shaped_text_get_spacing, RID, SpacingType); virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) override; - virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int64_t p_length = 1, float p_baseline = 0.0) override; - virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, float p_baseline = 0.0) override; + virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int64_t p_length = 1, double p_baseline = 0.0) override; + virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, double p_baseline = 0.0) override; GDVIRTUAL7R(bool, _shaped_text_add_string, RID, const String &, const TypedArray<RID> &, int64_t, const Dictionary &, const String &, const Variant &); - GDVIRTUAL6R(bool, _shaped_text_add_object, RID, const Variant &, const Size2 &, InlineAlignment, int64_t, float); - GDVIRTUAL5R(bool, _shaped_text_resize_object, RID, const Variant &, const Size2 &, InlineAlignment, float); + GDVIRTUAL6R(bool, _shaped_text_add_object, RID, const Variant &, const Size2 &, InlineAlignment, int64_t, double); + GDVIRTUAL5R(bool, _shaped_text_resize_object, RID, const Variant &, const Size2 &, InlineAlignment, double); virtual int64_t shaped_get_span_count(const RID &p_shaped) const override; virtual Variant shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const override; @@ -510,8 +510,8 @@ public: virtual String strip_diacritics(const String &p_string) const override; GDVIRTUAL1RC(String, _strip_diacritics, const String &); - virtual PackedInt32Array string_get_word_breaks(const String &p_string, const String &p_language = "", int p_chars_per_line = 0) const override; - GDVIRTUAL3RC(PackedInt32Array, _string_get_word_breaks, const String &, const String &, int); + virtual PackedInt32Array string_get_word_breaks(const String &p_string, const String &p_language = "", int64_t p_chars_per_line = 0) const override; + GDVIRTUAL3RC(PackedInt32Array, _string_get_word_breaks, const String &, const String &, int64_t); virtual bool is_valid_identifier(const String &p_string) const override; GDVIRTUAL1RC(bool, _is_valid_identifier, const String &); diff --git a/servers/text_server.h b/servers/text_server.h index a91d367e97..2c6a8af682 100644 --- a/servers/text_server.h +++ b/servers/text_server.h @@ -421,8 +421,8 @@ public: virtual int64_t shaped_text_get_spacing(const RID &p_shaped, SpacingType p_spacing) const = 0; virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) = 0; - virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int64_t p_length = 1, float p_baseline = 0.0) = 0; - virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, float p_baseline = 0.0) = 0; + virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int64_t p_length = 1, double p_baseline = 0.0) = 0; + virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, double p_baseline = 0.0) = 0; virtual int64_t shaped_get_span_count(const RID &p_shaped) const = 0; virtual Variant shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const = 0; @@ -494,7 +494,7 @@ public: virtual String percent_sign(const String &p_language = "") const = 0; // String functions. - virtual PackedInt32Array string_get_word_breaks(const String &p_string, const String &p_language = "", int p_chars_per_line = 0) const = 0; + virtual PackedInt32Array string_get_word_breaks(const String &p_string, const String &p_language = "", int64_t p_chars_per_line = 0) const = 0; virtual int64_t is_confusable(const String &p_string, const PackedStringArray &p_dict) const { return -1; }; virtual bool spoof_check(const String &p_string) const { return false; }; diff --git a/tests/core/variant/test_variant.h b/tests/core/variant/test_variant.h index dfbaa36af8..024fcf53c4 100644 --- a/tests/core/variant/test_variant.h +++ b/tests/core/variant/test_variant.h @@ -1056,6 +1056,14 @@ TEST_CASE("[Variant] Identity comparison") { Variant obj_null_two_var = Variant((Object *)nullptr); CHECK(obj_null_one_var.identity_compare(obj_null_one_var)); CHECK(obj_null_one_var.identity_compare(obj_null_two_var)); + + Object *freed_one = new Object(); + Variant freed_one_var = freed_one; + delete freed_one; + Object *freed_two = new Object(); + Variant freed_two_var = freed_two; + delete freed_two; + CHECK_FALSE(freed_one_var.identity_compare(freed_two_var)); } TEST_CASE("[Variant] Nested array comparison") { |