summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy6
-rw-r--r--SConstruct8
-rw-r--r--core/config/project_settings.cpp6
-rw-r--r--core/core_constants.cpp2
-rw-r--r--core/extension/gdnative_interface.cpp2
-rw-r--r--core/extension/gdnative_interface.h3
-rw-r--r--core/extension/native_extension.cpp9
-rw-r--r--core/extension/native_extension.h2
-rw-r--r--core/input/input.h4
-rw-r--r--core/io/file_access_network.h11
-rw-r--r--core/io/file_access_zip.h2
-rw-r--r--core/io/ip.cpp3
-rw-r--r--core/io/resource_format_binary.cpp1
-rw-r--r--core/math/convex_hull.cpp2
-rw-r--r--core/math/geometry_2d.cpp6
-rw-r--r--core/math/random_pcg.h4
-rw-r--r--core/object/class_db.cpp187
-rw-r--r--core/object/class_db.h30
-rw-r--r--core/os/os.h5
-rw-r--r--core/os/pool_allocator.h16
-rw-r--r--core/string/optimized_translation.cpp4
-rw-r--r--core/string/ustring.cpp33
-rw-r--r--core/variant/variant.cpp59
-rw-r--r--core/variant/variant_call.cpp18
-rw-r--r--core/variant/variant_construct.cpp10
-rw-r--r--core/variant/variant_setget.cpp26
-rw-r--r--core/variant/variant_utility.cpp14
-rw-r--r--doc/classes/@GlobalScope.xml1
-rw-r--r--doc/classes/BaseMaterial3D.xml15
-rw-r--r--doc/classes/DisplayServer.xml13
-rw-r--r--doc/classes/Label3D.xml10
-rw-r--r--doc/classes/NavigationRegion2D.xml8
-rw-r--r--doc/classes/NavigationRegion3D.xml6
-rw-r--r--doc/classes/SpriteBase3D.xml5
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h2
-rw-r--r--drivers/gles3/shader_gles3.h2
-rw-r--r--drivers/gles3/storage/config.h68
-rw-r--r--drivers/gles3/storage/material_storage.cpp68
-rw-r--r--drivers/unix/dir_access_unix.h4
-rw-r--r--drivers/unix/os_unix.cpp7
-rw-r--r--drivers/unix/os_unix.h2
-rw-r--r--drivers/vulkan/rendering_device_vulkan.h4
-rw-r--r--drivers/vulkan/vulkan_context.h42
-rw-r--r--editor/animation_bezier_editor.h12
-rw-r--r--editor/animation_track_editor.cpp18
-rw-r--r--editor/animation_track_editor.h33
-rw-r--r--editor/animation_track_editor_plugins.cpp1
-rw-r--r--editor/animation_track_editor_plugins.h8
-rw-r--r--editor/code_editor.cpp4
-rw-r--r--editor/code_editor.h8
-rw-r--r--editor/connections_dialog.h2
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_protocol.h6
-rw-r--r--editor/debugger/editor_performance_profiler.h2
-rw-r--r--editor/debugger/editor_profiler.cpp6
-rw-r--r--editor/debugger/editor_profiler.h14
-rw-r--r--editor/debugger/editor_visual_profiler.cpp14
-rw-r--r--editor/debugger/editor_visual_profiler.h17
-rw-r--r--editor/editor_about.cpp1
-rw-r--r--editor/editor_audio_buses.cpp1
-rw-r--r--editor/editor_audio_buses.h8
-rw-r--r--editor/editor_file_dialog.cpp7
-rw-r--r--editor/editor_file_dialog.h18
-rw-r--r--editor/editor_help.h4
-rw-r--r--editor/editor_node.cpp10
-rw-r--r--editor/editor_node.h24
-rw-r--r--editor/editor_spin_slider.cpp4
-rw-r--r--editor/editor_spin_slider.h17
-rw-r--r--editor/fileserver/editor_file_server.cpp3
-rw-r--r--editor/fileserver/editor_file_server.h8
-rw-r--r--editor/filesystem_dock.cpp16
-rw-r--r--editor/filesystem_dock.h1
-rw-r--r--editor/icons/RandomNumberGenerator.svg1
-rw-r--r--editor/import/scene_import_settings.cpp2
-rw-r--r--editor/import/scene_import_settings.h14
-rw-r--r--editor/plugin_config_dialog.h2
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp4
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.h8
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.cpp5
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.h10
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp9
-rw-r--r--editor/plugins/animation_state_machine_editor.h20
-rw-r--r--editor/plugins/asset_library_editor_plugin.h10
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp8
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h20
-rw-r--r--editor/plugins/mesh_library_editor_plugin.h6
-rw-r--r--editor/plugins/multimesh_editor_plugin.h2
-rw-r--r--editor/plugins/node_3d_editor_plugin.h8
-rw-r--r--editor/plugins/path_2d_editor_plugin.h6
-rw-r--r--editor/plugins/path_3d_editor_plugin.h2
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.h4
-rw-r--r--editor/plugins/polygon_3d_editor_plugin.h4
-rw-r--r--editor/plugins/script_editor_plugin.h2
-rw-r--r--editor/plugins/shader_editor_plugin.h2
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.h2
-rw-r--r--editor/plugins/sprite_frames_editor_plugin.h2
-rw-r--r--editor/plugins/texture_region_editor_plugin.h4
-rw-r--r--editor/plugins/tiles/tile_data_editors.h10
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp30
-rw-r--r--editor/plugins/tiles/tile_map_editor.h2
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp4
-rw-r--r--editor/progress_dialog.h2
-rw-r--r--editor/property_editor.h4
-rw-r--r--editor/property_selector.h2
-rw-r--r--editor/rename_dialog.h6
-rw-r--r--editor/scene_tree_dock.h2
-rw-r--r--modules/cvtt/image_compress_cvtt.cpp4
-rw-r--r--modules/dds/texture_loader_dds.cpp2
-rw-r--r--modules/gdscript/gdscript_utility_functions.cpp2
-rw-r--r--modules/navigation/navigation_mesh_generator.cpp18
-rw-r--r--modules/noise/noise.cpp4
-rw-r--r--modules/openxr/extensions/openxr_vulkan_extension.h10
-rw-r--r--modules/openxr/openxr_api.h4
-rw-r--r--modules/text_server_adv/text_server_adv.cpp4
-rw-r--r--modules/text_server_fb/text_server_fb.cpp4
-rw-r--r--modules/theora/video_stream_theora.h2
-rw-r--r--modules/visual_script/editor/visual_script_property_selector.h4
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp4
-rw-r--r--modules/visual_script/visual_script_expression.cpp4
-rw-r--r--modules/visual_script/visual_script_flow_control.cpp30
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp26
-rw-r--r--modules/visual_script/visual_script_nodes.cpp72
-rw-r--r--modules/visual_script/visual_script_yield_nodes.cpp8
-rw-r--r--modules/websocket/wsl_client.cpp14
-rw-r--r--modules/websocket/wsl_client.h2
-rw-r--r--platform/android/display_server_android.cpp19
-rw-r--r--platform/android/display_server_android.h3
-rw-r--r--platform/android/export/export_plugin.cpp17
-rw-r--r--platform/android/export/gradle_export_util.cpp2
-rw-r--r--platform/android/java/app/AndroidManifest.xml7
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotIO.java23
-rw-r--r--platform/android/java_godot_io_wrapper.cpp47
-rw-r--r--platform/android/java_godot_io_wrapper.h8
-rw-r--r--platform/android/os_android.cpp7
-rw-r--r--platform/android/os_android.h2
-rw-r--r--platform/iphone/display_server_iphone.h2
-rw-r--r--platform/iphone/display_server_iphone.mm33
-rw-r--r--platform/iphone/export/export_plugin.h2
-rw-r--r--platform/iphone/os_iphone.h2
-rw-r--r--platform/iphone/os_iphone.mm9
-rw-r--r--platform/javascript/os_javascript.cpp7
-rw-r--r--platform/javascript/os_javascript.h2
-rw-r--r--platform/linuxbsd/detect_prime_x11.cpp2
-rw-r--r--platform/linuxbsd/display_server_x11.cpp30
-rw-r--r--platform/linuxbsd/display_server_x11.h38
-rw-r--r--platform/osx/os_osx.h2
-rw-r--r--platform/osx/os_osx.mm7
-rw-r--r--platform/uwp/export/app_packager.h4
-rw-r--r--platform/uwp/os_uwp.cpp7
-rw-r--r--platform/uwp/os_uwp.h2
-rw-r--r--platform/windows/os_windows.cpp6
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--scene/2d/area_2d.h2
-rw-r--r--scene/2d/cpu_particles_2d.h2
-rw-r--r--scene/2d/gpu_particles_2d.cpp3
-rw-r--r--scene/2d/gpu_particles_2d.h22
-rw-r--r--scene/2d/light_occluder_2d.cpp1
-rw-r--r--scene/2d/light_occluder_2d.h5
-rw-r--r--scene/2d/navigation_agent_2d.h14
-rw-r--r--scene/2d/navigation_region_2d.cpp6
-rw-r--r--scene/2d/navigation_region_2d.h2
-rw-r--r--scene/3d/area_3d.h4
-rw-r--r--scene/3d/cpu_particles_3d.h6
-rw-r--r--scene/3d/gpu_particles_3d.h18
-rw-r--r--scene/3d/label_3d.cpp36
-rw-r--r--scene/3d/label_3d.h8
-rw-r--r--scene/3d/navigation_agent_3d.h16
-rw-r--r--scene/3d/navigation_region_3d.cpp6
-rw-r--r--scene/3d/navigation_region_3d.h2
-rw-r--r--scene/3d/skeleton_3d.h2
-rw-r--r--scene/3d/sprite_3d.cpp22
-rw-r--r--scene/3d/sprite_3d.h12
-rw-r--r--scene/3d/vehicle_body_3d.cpp2
-rw-r--r--scene/animation/tween.cpp29
-rw-r--r--scene/animation/tween.h3
-rw-r--r--scene/gui/graph_edit.h11
-rw-r--r--scene/main/viewport.h1
-rw-r--r--scene/resources/canvas_item_material.h8
-rw-r--r--scene/resources/material.h64
-rw-r--r--scene/resources/particles_material.h32
-rw-r--r--scene/resources/primitive_meshes.cpp6
-rw-r--r--scene/resources/resource_format_text.cpp39
-rw-r--r--scene/resources/skeleton_modification_2d_physicalbones.h2
-rw-r--r--scene/resources/sky_material.h28
-rw-r--r--scene/resources/sphere_shape_3d.h2
-rw-r--r--scene/resources/theme.cpp65
-rw-r--r--scene/resources/theme.h3
-rw-r--r--servers/audio/audio_filter_sw.cpp9
-rw-r--r--servers/audio/audio_filter_sw.h34
-rw-r--r--servers/audio/audio_stream.cpp5
-rw-r--r--servers/audio/audio_stream.h10
-rw-r--r--servers/audio/effects/audio_effect_stereo_enhance.cpp8
-rw-r--r--servers/audio/effects/audio_effect_stereo_enhance.h18
-rw-r--r--servers/audio/effects/reverb.cpp2
-rw-r--r--servers/audio/effects/reverb.h7
-rw-r--r--servers/audio_server.cpp20
-rw-r--r--servers/audio_server.h90
-rw-r--r--servers/display_server.cpp3
-rw-r--r--servers/display_server.h3
-rw-r--r--servers/physics_2d/godot_collision_solver_2d.cpp2
-rw-r--r--servers/physics_2d/godot_collision_solver_2d_sat.cpp2
-rw-r--r--servers/physics_3d/gjk_epa.cpp18
-rw-r--r--servers/physics_3d/godot_collision_solver_3d.cpp28
-rw-r--r--servers/physics_3d/godot_collision_solver_3d_sat.cpp2
-rw-r--r--servers/physics_3d/godot_shape_3d.cpp8
-rw-r--r--servers/rendering/renderer_rd/effects/tone_mapper.cpp26
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp2
-rw-r--r--servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h50
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp2
-rw-r--r--servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h46
-rw-r--r--servers/rendering/renderer_rd/pipeline_cache_rd.h2
-rw-r--r--servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp6
-rw-r--r--servers/rendering/renderer_rd/renderer_canvas_render_rd.h6
-rw-r--r--servers/rendering/renderer_rd/renderer_compositor_rd.cpp1
-rw-r--r--servers/rendering/renderer_rd/renderer_compositor_rd.h14
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_render_rd.h59
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp4
-rw-r--r--servers/rendering/renderer_rd/renderer_scene_sky_rd.h17
-rw-r--r--servers/rendering/renderer_rd/storage_rd/material_storage.cpp68
-rw-r--r--servers/rendering/renderer_rd/storage_rd/particles_storage.cpp4
-rw-r--r--servers/rendering/renderer_rd/storage_rd/particles_storage.h7
-rw-r--r--servers/rendering/renderer_scene_cull.h2
-rw-r--r--servers/rendering/renderer_viewport.cpp20
-rw-r--r--servers/rendering/shader_compiler.h4
-rw-r--r--servers/rendering/shader_language.cpp42
-rw-r--r--servers/rendering/shader_language.h18
-rw-r--r--servers/rendering_server.h2
-rw-r--r--tests/core/string/test_string.h40
-rw-r--r--tests/scene/test_theme.h257
-rw-r--r--tests/test_main.cpp1
-rw-r--r--thirdparty/noise/FastNoiseLite.h9
-rw-r--r--thirdparty/noise/patches/FastNoiseLite.patch23
232 files changed, 1797 insertions, 1418 deletions
diff --git a/.clang-tidy b/.clang-tidy
index fa57c94a21..659b91013d 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,5 +1,5 @@
---
-Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-nullptr,readability-braces-around-statements,readability-redundant-member-init'
+Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,cppcoreguidelines-pro-type-member-init,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-use-default-member-init,modernize-use-nullptr,readability-braces-around-statements,readability-redundant-member-init'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
@@ -13,6 +13,10 @@ CheckOptions:
value: '1'
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
value: '1'
+ - key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
+ value: '1'
+ - key: cppcoreguidelines-pro-type-member-init.UseAssignment
+ value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
diff --git a/SConstruct b/SConstruct
index af01329933..1c9ef7d820 100644
--- a/SConstruct
+++ b/SConstruct
@@ -618,10 +618,14 @@ if selected_platform in platform_list:
env.Append(CXXFLAGS=["-Wno-error=cpp"])
if cc_version_major == 7: # Bogus warning fixed in 8+.
env.Append(CCFLAGS=["-Wno-error=strict-overflow"])
+ if cc_version_major >= 12: # False positives in our error macros, see GH-58747.
+ env.Append(CCFLAGS=["-Wno-error=return-type"])
elif methods.using_clang(env) or methods.using_emcc(env):
env.Append(CXXFLAGS=["-Wno-error=#warnings"])
- else: # always enable those errors
- env.Append(CCFLAGS=["-Werror=return-type"])
+ else: # Always enable those errors.
+ # False positives in our error macros, see GH-58747.
+ if not (methods.using_gcc(env) and cc_version_major >= 12):
+ env.Append(CCFLAGS=["-Werror=return-type"])
if hasattr(detect, "get_program_suffix"):
suffix = "." + detect.get_program_suffix()
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 06bfc0c562..79fa6a0895 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -321,9 +321,9 @@ bool ProjectSettings::_get(const StringName &p_name, Variant &r_ret) const {
struct _VCSort {
String name;
- Variant::Type type;
- int order;
- uint32_t flags;
+ Variant::Type type = Variant::VARIANT_MAX;
+ int order = 0;
+ uint32_t flags = 0;
bool operator<(const _VCSort &p_vcs) const { return order == p_vcs.order ? name < p_vcs.name : order < p_vcs.order; }
};
diff --git a/core/core_constants.cpp b/core/core_constants.cpp
index 98b720ab65..2a514b68d8 100644
--- a/core/core_constants.cpp
+++ b/core/core_constants.cpp
@@ -41,7 +41,7 @@ struct _CoreConstant {
StringName enum_name;
bool ignore_value_in_docs = false;
#endif
- const char *name;
+ const char *name = nullptr;
int value = 0;
_CoreConstant() {}
diff --git a/core/extension/gdnative_interface.cpp b/core/extension/gdnative_interface.cpp
index a312ce4ebd..a1d54f9c6d 100644
--- a/core/extension/gdnative_interface.cpp
+++ b/core/extension/gdnative_interface.cpp
@@ -1069,4 +1069,6 @@ void gdnative_setup_interface(GDNativeInterface *p_interface) {
gdni.classdb_register_extension_class_property_subgroup = nullptr;
gdni.classdb_register_extension_class_signal = nullptr;
gdni.classdb_unregister_extension_class = nullptr;
+
+ gdni.get_library_path = nullptr;
}
diff --git a/core/extension/gdnative_interface.h b/core/extension/gdnative_interface.h
index 2bac52dc4a..ad4c8917df 100644
--- a/core/extension/gdnative_interface.h
+++ b/core/extension/gdnative_interface.h
@@ -545,6 +545,9 @@ typedef struct {
void (*classdb_register_extension_class_property_subgroup)(const GDNativeExtensionClassLibraryPtr p_library, const char *p_class_name, const char *p_subgroup_name, const char *p_prefix);
void (*classdb_register_extension_class_signal)(const GDNativeExtensionClassLibraryPtr p_library, const char *p_class_name, const char *p_signal_name, const GDNativePropertyInfo *p_argument_info, GDNativeInt p_argument_count);
void (*classdb_unregister_extension_class)(const GDNativeExtensionClassLibraryPtr p_library, const char *p_class_name); /* Unregistering a parent class before a class that inherits it will result in failure. Inheritors must be unregistered first. */
+
+ void (*get_library_path)(const GDNativeExtensionClassLibraryPtr p_library, GDNativeStringPtr r_path);
+
} GDNativeInterface;
/* INITIALIZATION */
diff --git a/core/extension/native_extension.cpp b/core/extension/native_extension.cpp
index 076d04a5eb..4fc7d71387 100644
--- a/core/extension/native_extension.cpp
+++ b/core/extension/native_extension.cpp
@@ -261,8 +261,14 @@ void NativeExtension::_unregister_extension_class(const GDNativeExtensionClassLi
self->extension_classes.erase(class_name);
}
+void NativeExtension::_get_library_path(const GDNativeExtensionClassLibraryPtr p_library, GDNativeStringPtr r_path) {
+ NativeExtension *self = static_cast<NativeExtension *>(p_library);
+
+ *(String *)r_path = self->library_path;
+}
+
Error NativeExtension::open_library(const String &p_path, const String &p_entry_symbol) {
- Error err = OS::get_singleton()->open_dynamic_library(p_path, library, true);
+ Error err = OS::get_singleton()->open_dynamic_library(p_path, library, true, &library_path);
if (err != OK) {
return err;
}
@@ -354,6 +360,7 @@ void NativeExtension::initialize_native_extensions() {
gdnative_interface.classdb_register_extension_class_property_subgroup = _register_extension_class_property_subgroup;
gdnative_interface.classdb_register_extension_class_signal = _register_extension_class_signal;
gdnative_interface.classdb_unregister_extension_class = _unregister_extension_class;
+ gdnative_interface.get_library_path = _get_library_path;
}
RES NativeExtensionResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) {
diff --git a/core/extension/native_extension.h b/core/extension/native_extension.h
index ebfedfb29a..d29ccd81b8 100644
--- a/core/extension/native_extension.h
+++ b/core/extension/native_extension.h
@@ -39,6 +39,7 @@ class NativeExtension : public Resource {
GDCLASS(NativeExtension, Resource)
void *library = nullptr; // pointer if valid,
+ String library_path;
struct Extension {
ObjectNativeExtension native_extension;
@@ -54,6 +55,7 @@ class NativeExtension : public Resource {
static void _register_extension_class_property_subgroup(const GDNativeExtensionClassLibraryPtr p_library, const char *p_class_name, const char *p_subgroup_name, const char *p_prefix);
static void _register_extension_class_signal(const GDNativeExtensionClassLibraryPtr p_library, const char *p_class_name, const char *p_signal_name, const GDNativePropertyInfo *p_argument_info, GDNativeInt p_argument_count);
static void _unregister_extension_class(const GDNativeExtensionClassLibraryPtr p_library, const char *p_class_name);
+ static void _get_library_path(const GDNativeExtensionClassLibraryPtr p_library, GDNativeStringPtr r_path);
GDNativeInitialization initialization;
int32_t level_initialized = -1;
diff --git a/core/input/input.h b/core/input/input.h
index 42016f2417..23c7ebee02 100644
--- a/core/input/input.h
+++ b/core/input/input.h
@@ -113,10 +113,10 @@ private:
int mouse_from_touch_index = -1;
struct VelocityTrack {
- uint64_t last_tick;
+ uint64_t last_tick = 0;
Vector2 velocity;
Vector2 accum;
- float accum_t;
+ float accum_t = 0.0f;
float min_ref_frame;
float max_ref_frame;
diff --git a/core/io/file_access_network.h b/core/io/file_access_network.h
index 6afbf6adf5..214d391c95 100644
--- a/core/io/file_access_network.h
+++ b/core/io/file_access_network.h
@@ -86,15 +86,15 @@ class FileAccessNetwork : public FileAccess {
Semaphore page_sem;
Mutex buffer_mutex;
bool opened = false;
- uint64_t total_size;
+ uint64_t total_size = 0;
mutable uint64_t pos = 0;
- int32_t id;
+ int32_t id = -1;
mutable bool eof_flag = false;
mutable int32_t last_page = -1;
mutable uint8_t *last_page_buff = nullptr;
- int32_t page_size;
- int32_t read_ahead;
+ int32_t page_size = 0;
+ int32_t read_ahead = 0;
mutable int waiting_on_page = -1;
@@ -108,7 +108,8 @@ class FileAccessNetwork : public FileAccess {
mutable Error response;
- uint64_t exists_modtime;
+ uint64_t exists_modtime = 0;
+
friend class FileAccessNetworkClient;
void _queue_page(int32_t p_page) const;
void _respond(uint64_t p_len, Error p_status);
diff --git a/core/io/file_access_zip.h b/core/io/file_access_zip.h
index 2504aeedc4..ae58d99a66 100644
--- a/core/io/file_access_zip.h
+++ b/core/io/file_access_zip.h
@@ -80,7 +80,7 @@ class FileAccessZip : public FileAccess {
unzFile zfile = nullptr;
unz_file_info64 file_info;
- mutable bool at_eof;
+ mutable bool at_eof = false;
void _close();
diff --git a/core/io/ip.cpp b/core/io/ip.cpp
index 52674150bb..5156a5cb99 100644
--- a/core/io/ip.cpp
+++ b/core/io/ip.cpp
@@ -74,8 +74,7 @@ struct _IP_ResolverPrivate {
Semaphore sem;
Thread thread;
- //Semaphore* semaphore;
- bool thread_abort;
+ bool thread_abort = false;
void resolve_queues() {
for (int i = 0; i < IP::RESOLVER_MAX_QUERIES; i++) {
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index b6988109c5..bc7e524892 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -1287,6 +1287,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
fw->store_8(b);
b = f->get_8();
}
+ f.unref();
bool all_ok = fw->get_error() == OK;
diff --git a/core/math/convex_hull.cpp b/core/math/convex_hull.cpp
index 23a0b5dd54..996f4f4d67 100644
--- a/core/math/convex_hull.cpp
+++ b/core/math/convex_hull.cpp
@@ -666,7 +666,7 @@ public:
face_pool.reset(true);
}
- Vertex *vertex_list;
+ Vertex *vertex_list = nullptr;
void compute(const Vector3 *p_coords, int32_t p_count);
diff --git a/core/math/geometry_2d.cpp b/core/math/geometry_2d.cpp
index 46b7d99b43..31fade5a99 100644
--- a/core/math/geometry_2d.cpp
+++ b/core/math/geometry_2d.cpp
@@ -74,14 +74,14 @@ Vector<Vector<Vector2>> Geometry2D::decompose_polygon_in_convex(Vector<Point2> p
struct _AtlasWorkRect {
Size2i s;
Point2i p;
- int idx;
+ int idx = 0;
_FORCE_INLINE_ bool operator<(const _AtlasWorkRect &p_r) const { return s.width > p_r.s.width; };
};
struct _AtlasWorkRectResult {
Vector<_AtlasWorkRect> result;
- int max_w;
- int max_h;
+ int max_w = 0;
+ int max_h = 0;
};
void Geometry2D::make_atlas(const Vector<Size2i> &p_rects, Vector<Point2i> &r_result, Size2i &r_size) {
diff --git a/core/math/random_pcg.h b/core/math/random_pcg.h
index 65fcf67664..a088b30d17 100644
--- a/core/math/random_pcg.h
+++ b/core/math/random_pcg.h
@@ -61,8 +61,8 @@ static int __bsr_clz32(uint32_t x) {
class RandomPCG {
pcg32_random_t pcg;
- uint64_t current_seed; // The seed the current generator state started from.
- uint64_t current_inc;
+ uint64_t current_seed = 0; // The seed the current generator state started from.
+ uint64_t current_inc = 0;
public:
static const uint64_t DEFAULT_SEED = 12047754176567800795U;
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp
index 61ce965bc3..593f27b7cf 100644
--- a/core/object/class_db.cpp
+++ b/core/object/class_db.cpp
@@ -39,190 +39,13 @@
#ifdef DEBUG_METHODS_ENABLED
-MethodDefinition D_METHOD(const char *p_name) {
+MethodDefinition D_METHODP(const char *p_name, const char *const **p_args, uint32_t p_argcount) {
MethodDefinition md;
md.name = StaticCString::create(p_name);
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.push_back(StaticCString::create(p_arg1));
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.resize(2);
- md.args.write[0] = StaticCString::create(p_arg1);
- md.args.write[1] = StaticCString::create(p_arg2);
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.resize(3);
- md.args.write[0] = StaticCString::create(p_arg1);
- md.args.write[1] = StaticCString::create(p_arg2);
- md.args.write[2] = StaticCString::create(p_arg3);
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.resize(4);
- md.args.write[0] = StaticCString::create(p_arg1);
- md.args.write[1] = StaticCString::create(p_arg2);
- md.args.write[2] = StaticCString::create(p_arg3);
- md.args.write[3] = StaticCString::create(p_arg4);
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.resize(5);
- md.args.write[0] = StaticCString::create(p_arg1);
- md.args.write[1] = StaticCString::create(p_arg2);
- md.args.write[2] = StaticCString::create(p_arg3);
- md.args.write[3] = StaticCString::create(p_arg4);
- md.args.write[4] = StaticCString::create(p_arg5);
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.resize(6);
- md.args.write[0] = StaticCString::create(p_arg1);
- md.args.write[1] = StaticCString::create(p_arg2);
- md.args.write[2] = StaticCString::create(p_arg3);
- md.args.write[3] = StaticCString::create(p_arg4);
- md.args.write[4] = StaticCString::create(p_arg5);
- md.args.write[5] = StaticCString::create(p_arg6);
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.resize(7);
- md.args.write[0] = StaticCString::create(p_arg1);
- md.args.write[1] = StaticCString::create(p_arg2);
- md.args.write[2] = StaticCString::create(p_arg3);
- md.args.write[3] = StaticCString::create(p_arg4);
- md.args.write[4] = StaticCString::create(p_arg5);
- md.args.write[5] = StaticCString::create(p_arg6);
- md.args.write[6] = StaticCString::create(p_arg7);
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.resize(8);
- md.args.write[0] = StaticCString::create(p_arg1);
- md.args.write[1] = StaticCString::create(p_arg2);
- md.args.write[2] = StaticCString::create(p_arg3);
- md.args.write[3] = StaticCString::create(p_arg4);
- md.args.write[4] = StaticCString::create(p_arg5);
- md.args.write[5] = StaticCString::create(p_arg6);
- md.args.write[6] = StaticCString::create(p_arg7);
- md.args.write[7] = StaticCString::create(p_arg8);
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.resize(9);
- md.args.write[0] = StaticCString::create(p_arg1);
- md.args.write[1] = StaticCString::create(p_arg2);
- md.args.write[2] = StaticCString::create(p_arg3);
- md.args.write[3] = StaticCString::create(p_arg4);
- md.args.write[4] = StaticCString::create(p_arg5);
- md.args.write[5] = StaticCString::create(p_arg6);
- md.args.write[6] = StaticCString::create(p_arg7);
- md.args.write[7] = StaticCString::create(p_arg8);
- md.args.write[8] = StaticCString::create(p_arg9);
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.resize(10);
- md.args.write[0] = StaticCString::create(p_arg1);
- md.args.write[1] = StaticCString::create(p_arg2);
- md.args.write[2] = StaticCString::create(p_arg3);
- md.args.write[3] = StaticCString::create(p_arg4);
- md.args.write[4] = StaticCString::create(p_arg5);
- md.args.write[5] = StaticCString::create(p_arg6);
- md.args.write[6] = StaticCString::create(p_arg7);
- md.args.write[7] = StaticCString::create(p_arg8);
- md.args.write[8] = StaticCString::create(p_arg9);
- md.args.write[9] = StaticCString::create(p_arg10);
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.resize(11);
- md.args.write[0] = StaticCString::create(p_arg1);
- md.args.write[1] = StaticCString::create(p_arg2);
- md.args.write[2] = StaticCString::create(p_arg3);
- md.args.write[3] = StaticCString::create(p_arg4);
- md.args.write[4] = StaticCString::create(p_arg5);
- md.args.write[5] = StaticCString::create(p_arg6);
- md.args.write[6] = StaticCString::create(p_arg7);
- md.args.write[7] = StaticCString::create(p_arg8);
- md.args.write[8] = StaticCString::create(p_arg9);
- md.args.write[9] = StaticCString::create(p_arg10);
- md.args.write[10] = StaticCString::create(p_arg11);
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11, const char *p_arg12) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.resize(12);
- md.args.write[0] = StaticCString::create(p_arg1);
- md.args.write[1] = StaticCString::create(p_arg2);
- md.args.write[2] = StaticCString::create(p_arg3);
- md.args.write[3] = StaticCString::create(p_arg4);
- md.args.write[4] = StaticCString::create(p_arg5);
- md.args.write[5] = StaticCString::create(p_arg6);
- md.args.write[6] = StaticCString::create(p_arg7);
- md.args.write[7] = StaticCString::create(p_arg8);
- md.args.write[8] = StaticCString::create(p_arg9);
- md.args.write[9] = StaticCString::create(p_arg10);
- md.args.write[10] = StaticCString::create(p_arg11);
- md.args.write[11] = StaticCString::create(p_arg12);
- return md;
-}
-
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11, const char *p_arg12, const char *p_arg13) {
- MethodDefinition md;
- md.name = StaticCString::create(p_name);
- md.args.resize(13);
- md.args.write[0] = StaticCString::create(p_arg1);
- md.args.write[1] = StaticCString::create(p_arg2);
- md.args.write[2] = StaticCString::create(p_arg3);
- md.args.write[3] = StaticCString::create(p_arg4);
- md.args.write[4] = StaticCString::create(p_arg5);
- md.args.write[5] = StaticCString::create(p_arg6);
- md.args.write[6] = StaticCString::create(p_arg7);
- md.args.write[7] = StaticCString::create(p_arg8);
- md.args.write[8] = StaticCString::create(p_arg9);
- md.args.write[9] = StaticCString::create(p_arg10);
- md.args.write[10] = StaticCString::create(p_arg11);
- md.args.write[11] = StaticCString::create(p_arg12);
- md.args.write[12] = StaticCString::create(p_arg13);
+ md.args.resize(p_argcount);
+ for (uint32_t i = 0; i < p_argcount; i++) {
+ md.args.write[i] = StaticCString::create(*p_args[i]);
+ }
return md;
}
diff --git a/core/object/class_db.h b/core/object/class_db.h
index 333a3307e2..d4e1fc4e76 100644
--- a/core/object/class_db.h
+++ b/core/object/class_db.h
@@ -35,10 +35,6 @@
#include "core/object/object.h"
#include "core/string/print_string.h"
-/** To bind more then 6 parameters include this:
- *
- */
-
// Makes callable_mp readily available in all classes connecting signals.
// Needs to come after method_bind and object have been included.
#include "core/object/callable_method_pointer.h"
@@ -57,20 +53,18 @@ struct MethodDefinition {
name(p_name) {}
};
-MethodDefinition D_METHOD(const char *p_name);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11, const char *p_arg12);
-MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11, const char *p_arg12, const char *p_arg13);
+MethodDefinition D_METHODP(const char *p_name, const char *const **p_args, uint32_t p_argcount);
+
+template <typename... VarArgs>
+MethodDefinition D_METHOD(const char *p_name, const VarArgs... p_args) {
+ const char *args[sizeof...(p_args) + 1] = { p_args..., nullptr }; // +1 makes sure zero sized arrays are also supported.
+ const char *const *argptrs[sizeof...(p_args) + 1];
+ for (uint32_t i = 0; i < sizeof...(p_args); i++) {
+ argptrs[i] = &args[i];
+ }
+
+ return D_METHODP(p_name, sizeof...(p_args) == 0 ? nullptr : (const char *const **)argptrs, sizeof...(p_args));
+}
#else
diff --git a/core/os/os.h b/core/os/os.h
index 9ec0dd7728..a7cf3f1679 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -54,7 +54,6 @@ class OS {
bool _single_window = false;
String _local_clipboard;
int _exit_code = EXIT_FAILURE; // unexpected exit is marked as failure
- int _orientation;
bool _allow_hidpi = false;
bool _allow_layered = false;
bool _stdout_enabled = true;
@@ -68,7 +67,7 @@ class OS {
// for the user interface we keep a record of the current display driver
// so we can retrieve the rendering drivers available
int _display_driver_id = -1;
- String _current_rendering_driver_name = "";
+ String _current_rendering_driver_name;
protected:
void _set_logger(CompositeLogger *p_logger);
@@ -138,7 +137,7 @@ public:
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) { return ERR_UNAVAILABLE; }
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) { return ERR_UNAVAILABLE; }
virtual Error close_dynamic_library(void *p_library_handle) { return ERR_UNAVAILABLE; }
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) { return ERR_UNAVAILABLE; }
diff --git a/core/os/pool_allocator.h b/core/os/pool_allocator.h
index 27a936ed78..a7a8523aa4 100644
--- a/core/os/pool_allocator.h
+++ b/core/os/pool_allocator.h
@@ -77,20 +77,20 @@ private:
Entry *entry_array = nullptr;
int *entry_indices = nullptr;
- int entry_max;
- int entry_count;
+ int entry_max = 0;
+ int entry_count = 0;
uint8_t *pool = nullptr;
void *mem_ptr = nullptr;
- int pool_size;
+ int pool_size = 0;
- int free_mem;
- int free_mem_peak;
+ int free_mem = 0;
+ int free_mem_peak = 0;
- unsigned int check_count;
- int align;
+ unsigned int check_count = 0;
+ int align = 1;
- bool needs_locking;
+ bool needs_locking = false;
inline int entry_end(const Entry &p_entry) const {
return p_entry.pos + aligned(p_entry.len);
diff --git a/core/string/optimized_translation.cpp b/core/string/optimized_translation.cpp
index 07b58f2418..93429744fc 100644
--- a/core/string/optimized_translation.cpp
+++ b/core/string/optimized_translation.cpp
@@ -37,9 +37,9 @@ extern "C" {
}
struct CompressedString {
- int orig_len;
+ int orig_len = 0;
CharString compressed;
- int offset;
+ int offset = 0;
};
void OptimizedTranslation::generate(const Ref<Translation> &p_from) {
diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index a2b1e4c428..5d998d22d4 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -4427,7 +4427,7 @@ String String::sprintf(const Array &values, bool *error) const {
int min_chars = 0;
int min_decimals = 0;
bool in_decimals = false;
- bool pad_with_zeroes = false;
+ bool pad_with_zeros = false;
bool left_justified = false;
bool show_sign = false;
@@ -4480,7 +4480,7 @@ String String::sprintf(const Array &values, bool *error) const {
// Padding.
int pad_chars_count = (value < 0 || show_sign) ? min_chars - 1 : min_chars;
- String pad_char = pad_with_zeroes ? String("0") : String(" ");
+ String pad_char = pad_with_zeros ? String("0") : String(" ");
if (left_justified) {
str = str.rpad(pad_chars_count, pad_char);
} else {
@@ -4488,10 +4488,13 @@ String String::sprintf(const Array &values, bool *error) const {
}
// Sign.
- if (show_sign && value >= 0) {
- str = str.insert(pad_with_zeroes ? 0 : str.length() - number_len, "+");
- } else if (value < 0) {
- str = str.insert(pad_with_zeroes ? 0 : str.length() - number_len, "-");
+ if (show_sign || value < 0) {
+ String sign_char = value < 0 ? "-" : "+";
+ if (left_justified) {
+ str = str.insert(0, sign_char);
+ } else {
+ str = str.insert(pad_with_zeros ? 0 : str.length() - number_len, sign_char);
+ }
}
formatted += str;
@@ -4520,13 +4523,9 @@ String String::sprintf(const Array &values, bool *error) const {
// Padding. Leave room for sign later if required.
int pad_chars_count = (is_negative || show_sign) ? min_chars - 1 : min_chars;
- String pad_char = pad_with_zeroes ? String("0") : String(" ");
+ String pad_char = pad_with_zeros ? String("0") : String(" ");
if (left_justified) {
- if (pad_with_zeroes) {
- return "left justification cannot be used with zeros as the padding";
- } else {
- str = str.rpad(pad_chars_count, pad_char);
- }
+ str = str.rpad(pad_chars_count, pad_char);
} else {
str = str.lpad(pad_chars_count, pad_char);
}
@@ -4537,7 +4536,7 @@ String String::sprintf(const Array &values, bool *error) const {
if (left_justified) {
str = str.insert(0, sign_char);
} else {
- str = str.insert(pad_with_zeroes ? 0 : str.length() - initial_len, sign_char);
+ str = str.insert(pad_with_zeros ? 0 : str.length() - initial_len, sign_char);
}
}
@@ -4626,7 +4625,11 @@ String String::sprintf(const Array &values, bool *error) const {
min_decimals += n;
} else {
if (c == '0' && min_chars == 0) {
- pad_with_zeroes = true;
+ if (left_justified) {
+ WARN_PRINT("'0' flag ignored with '-' flag in string format");
+ } else {
+ pad_with_zeros = true;
+ }
} else {
min_chars *= 10;
min_chars += n;
@@ -4675,7 +4678,7 @@ String String::sprintf(const Array &values, bool *error) const {
// Back to defaults:
min_chars = 0;
min_decimals = 6;
- pad_with_zeroes = false;
+ pad_with_zeros = false;
left_justified = false;
show_sign = false;
in_decimals = false;
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index da5d73d519..0eb93a72b4 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -3341,27 +3341,7 @@ String Variant::get_construct_string() const {
}
String Variant::get_call_error_text(const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce) {
- String err_text;
-
- if (ce.error == Callable::CallError::CALL_ERROR_INVALID_ARGUMENT) {
- int errorarg = ce.argument;
- if (p_argptrs) {
- err_text = "Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(p_argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(Variant::Type(ce.expected)) + ".";
- } else {
- err_text = "Cannot convert argument " + itos(errorarg + 1) + " from [missing argptr, type unknown] to " + Variant::get_type_name(Variant::Type(ce.expected)) + ".";
- }
- } else if (ce.error == Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) {
- err_text = "Method expected " + itos(ce.argument) + " arguments, but called with " + itos(p_argcount) + ".";
- } else if (ce.error == Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) {
- err_text = "Method expected " + itos(ce.argument) + " arguments, but called with " + itos(p_argcount) + ".";
- } else if (ce.error == Callable::CallError::CALL_ERROR_INVALID_METHOD) {
- err_text = "Method not found.";
- } else if (ce.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
- err_text = "Instance is null";
- } else if (ce.error == Callable::CallError::CALL_OK) {
- return "Call OK";
- }
- return "'" + String(p_method) + "': " + err_text;
+ return get_call_error_text(nullptr, p_method, p_argptrs, p_argcount, ce);
}
String Variant::get_call_error_text(Object *p_base, const StringName &p_method, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce) {
@@ -3386,37 +3366,20 @@ String Variant::get_call_error_text(Object *p_base, const StringName &p_method,
return "Call OK";
}
- String class_name = p_base->get_class();
- Ref<Resource> script = p_base->get_script();
- if (script.is_valid() && script->get_path().is_resource_file()) {
- class_name += "(" + script->get_path().get_file() + ")";
+ String base_text;
+ if (p_base) {
+ base_text = p_base->get_class();
+ Ref<Resource> script = p_base->get_script();
+ if (script.is_valid() && script->get_path().is_resource_file()) {
+ base_text += "(" + script->get_path().get_file() + ")";
+ }
+ base_text += "::";
}
- return "'" + class_name + "::" + String(p_method) + "': " + err_text;
+ return "'" + base_text + String(p_method) + "': " + err_text;
}
String Variant::get_callable_error_text(const Callable &p_callable, const Variant **p_argptrs, int p_argcount, const Callable::CallError &ce) {
- String err_text;
-
- if (ce.error == Callable::CallError::CALL_ERROR_INVALID_ARGUMENT) {
- int errorarg = ce.argument;
- if (p_argptrs) {
- err_text = "Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(p_argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(Variant::Type(ce.expected)) + ".";
- } else {
- err_text = "Cannot convert argument " + itos(errorarg + 1) + " from [missing argptr, type unknown] to " + Variant::get_type_name(Variant::Type(ce.expected)) + ".";
- }
- } else if (ce.error == Callable::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) {
- err_text = "Method expected " + itos(ce.argument) + " arguments, but called with " + itos(p_argcount) + ".";
- } else if (ce.error == Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) {
- err_text = "Method expected " + itos(ce.argument) + " arguments, but called with " + itos(p_argcount) + ".";
- } else if (ce.error == Callable::CallError::CALL_ERROR_INVALID_METHOD) {
- err_text = "Method not found.";
- } else if (ce.error == Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
- err_text = "Instance is null";
- } else if (ce.error == Callable::CallError::CALL_OK) {
- return "Call OK";
- }
-
- return String(p_callable) + " : " + err_text;
+ return get_call_error_text(p_callable.get_object(), p_callable.get_method(), p_argptrs, p_argcount, ce);
}
String vformat(const String &p_text, const Variant &p1, const Variant &p2, const Variant &p3, const Variant &p4, const Variant &p5) {
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index 9dae0720d9..cc7e84203f 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -949,20 +949,20 @@ struct _VariantCall {
_VariantCall::ConstantData *_VariantCall::constant_data = nullptr;
struct VariantBuiltInMethodInfo {
- void (*call)(Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error);
- Variant::ValidatedBuiltInMethod validated_call;
- Variant::PTRBuiltInMethod ptrcall;
+ void (*call)(Variant *base, const Variant **p_args, int p_argcount, Variant &r_ret, const Vector<Variant> &p_defvals, Callable::CallError &r_error) = nullptr;
+ Variant::ValidatedBuiltInMethod validated_call = nullptr;
+ Variant::PTRBuiltInMethod ptrcall = nullptr;
Vector<Variant> default_arguments;
Vector<String> argument_names;
- bool is_const;
- bool is_static;
- bool has_return_type;
- bool is_vararg;
+ bool is_const = false;
+ bool is_static = false;
+ bool has_return_type = false;
+ bool is_vararg = false;
Variant::Type return_type;
- int argument_count;
- Variant::Type (*get_argument_type)(int p_arg);
+ int argument_count = 0;
+ Variant::Type (*get_argument_type)(int p_arg) = nullptr;
};
typedef OAHashMap<StringName, VariantBuiltInMethodInfo> BuiltinMethodMap;
diff --git a/core/variant/variant_construct.cpp b/core/variant/variant_construct.cpp
index 351f4ae253..6b12b054a0 100644
--- a/core/variant/variant_construct.cpp
+++ b/core/variant/variant_construct.cpp
@@ -31,11 +31,11 @@
#include "variant_construct.h"
struct VariantConstructData {
- void (*construct)(Variant &r_base, const Variant **p_args, Callable::CallError &r_error);
- Variant::ValidatedConstructor validated_construct;
- Variant::PTRConstructor ptr_construct;
- Variant::Type (*get_argument_type)(int);
- int argument_count;
+ void (*construct)(Variant &r_base, const Variant **p_args, Callable::CallError &r_error) = nullptr;
+ Variant::ValidatedConstructor validated_construct = nullptr;
+ Variant::PTRConstructor ptr_construct = nullptr;
+ Variant::Type (*get_argument_type)(int) = nullptr;
+ int argument_count = 0;
Vector<String> arg_names;
};
diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp
index 705aa27be6..397a57f59f 100644
--- a/core/variant/variant_setget.cpp
+++ b/core/variant/variant_setget.cpp
@@ -805,16 +805,16 @@ INDEXED_SETGET_STRUCT_TYPED(PackedColorArray, Color)
INDEXED_SETGET_STRUCT_DICT(Dictionary)
struct VariantIndexedSetterGetterInfo {
- void (*setter)(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob);
- void (*getter)(const Variant *base, int64_t index, Variant *value, bool *oob);
+ void (*setter)(Variant *base, int64_t index, const Variant *value, bool *valid, bool *oob) = nullptr;
+ void (*getter)(const Variant *base, int64_t index, Variant *value, bool *oob) = nullptr;
- Variant::ValidatedIndexedSetter validated_setter;
- Variant::ValidatedIndexedGetter validated_getter;
+ Variant::ValidatedIndexedSetter validated_setter = nullptr;
+ Variant::ValidatedIndexedGetter validated_getter = nullptr;
- Variant::PTRIndexedSetter ptr_setter;
- Variant::PTRIndexedGetter ptr_getter;
+ Variant::PTRIndexedSetter ptr_setter = nullptr;
+ Variant::PTRIndexedGetter ptr_getter = nullptr;
- uint64_t (*get_indexed_size)(const Variant *base);
+ uint64_t (*get_indexed_size)(const Variant *base) = nullptr;
Variant::Type index_type;
@@ -1018,13 +1018,13 @@ struct VariantKeyedSetGetObject {
};
struct VariantKeyedSetterGetterInfo {
- Variant::ValidatedKeyedSetter validated_setter;
- Variant::ValidatedKeyedGetter validated_getter;
- Variant::ValidatedKeyedChecker validated_checker;
+ Variant::ValidatedKeyedSetter validated_setter = nullptr;
+ Variant::ValidatedKeyedGetter validated_getter = nullptr;
+ Variant::ValidatedKeyedChecker validated_checker = nullptr;
- Variant::PTRKeyedSetter ptr_setter;
- Variant::PTRKeyedGetter ptr_getter;
- Variant::PTRKeyedChecker ptr_checker;
+ Variant::PTRKeyedSetter ptr_setter = nullptr;
+ Variant::PTRKeyedGetter ptr_getter = nullptr;
+ Variant::PTRKeyedChecker ptr_checker = nullptr;
bool valid = false;
};
diff --git a/core/variant/variant_utility.cpp b/core/variant/variant_utility.cpp
index 6ed85815be..7c821ad41d 100644
--- a/core/variant/variant_utility.cpp
+++ b/core/variant/variant_utility.cpp
@@ -1110,14 +1110,14 @@ static _FORCE_INLINE_ Variant::Type get_ret_type_helper(void (*p_func)(P...)) {
register_utility_function<Func_##m_func>(#m_func, m_args)
struct VariantUtilityFunctionInfo {
- void (*call_utility)(Variant *r_ret, const Variant **p_args, int p_argcount, Callable::CallError &r_error);
- Variant::ValidatedUtilityFunction validated_call_utility;
- Variant::PTRUtilityFunction ptr_call_utility;
+ void (*call_utility)(Variant *r_ret, const Variant **p_args, int p_argcount, Callable::CallError &r_error) = nullptr;
+ Variant::ValidatedUtilityFunction validated_call_utility = nullptr;
+ Variant::PTRUtilityFunction ptr_call_utility = nullptr;
Vector<String> argnames;
- bool is_vararg;
- bool returns_value;
- int argcount;
- Variant::Type (*get_arg_type)(int);
+ bool is_vararg = false;
+ bool returns_value = false;
+ int argcount = 0;
+ Variant::Type (*get_arg_type)(int) = nullptr;
Variant::Type return_type;
Variant::UtilityFunctionType type;
};
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 0021b2f857..a40b851efc 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -457,6 +457,7 @@
rotation = lerp_angle(min_angle, max_angle, elapsed)
elapsed += delta
[/codeblock]
+ [b]Note:[/b] This method lerps through the shortest path between [code]from[/code] and [code]to[/code]. However, when these two angles are approximately [code]PI + k * TAU[/code] apart for any integer [code]k[/code], it's not obvious which way they lerp due to floating-point precision errors. For example, [code]lerp_angle(0, PI, weight)[/code] lerps counter-clockwise, while [code]lerp_angle(0, PI + 5 * TAU, weight)[/code] lerps clockwise.
</description>
</method>
<method name="linear2db">
diff --git a/doc/classes/BaseMaterial3D.xml b/doc/classes/BaseMaterial3D.xml
index 4b6f6eec67..f3e2c4b308 100644
--- a/doc/classes/BaseMaterial3D.xml
+++ b/doc/classes/BaseMaterial3D.xml
@@ -59,6 +59,7 @@
<members>
<member name="albedo_color" type="Color" setter="set_albedo" getter="get_albedo" default="Color(1, 1, 1, 1)">
The material's base color.
+ [b]Note:[/b] If [member detail_enabled] is [code]true[/code] and a [member detail_albedo] texture is specified, [member albedo_color] will [i]not[/i] modulate the detail texture. This can be used to color partial areas of a material by not specifying an albedo texture and using a transparent [member detail_albedo] texture instead.
</member>
<member name="albedo_tex_force_srgb" type="bool" setter="set_flag" getter="get_flag" default="false">
Forces a conversion of the [member albedo_texture] from sRGB space to linear space.
@@ -148,19 +149,20 @@
Determines when depth rendering takes place. See [enum DepthDrawMode]. See also [member transparency].
</member>
<member name="detail_albedo" type="Texture2D" setter="set_texture" getter="get_texture">
- Texture that specifies the color of the detail overlay.
+ Texture that specifies the color of the detail overlay. [member detail_albedo]'s alpha channel is used as a mask, even when the material is opaque. To use a dedicated texture as a mask, see [member detail_mask].
+ [b]Note:[/b] [member detail_albedo] is [i]not[/i] modulated by [member albedo_color].
</member>
<member name="detail_blend_mode" type="int" setter="set_detail_blend_mode" getter="get_detail_blend_mode" enum="BaseMaterial3D.BlendMode" default="0">
Specifies how the [member detail_albedo] should blend with the current [code]ALBEDO[/code]. See [enum BlendMode] for options.
</member>
<member name="detail_enabled" type="bool" setter="set_feature" getter="get_feature" default="false">
- If [code]true[/code], enables the detail overlay. Detail is a second texture that gets mixed over the surface of the object based on [member detail_mask]. This can be used to add variation to objects, or to blend between two different albedo/normal textures.
+ If [code]true[/code], enables the detail overlay. Detail is a second texture that gets mixed over the surface of the object based on [member detail_mask] and [member detail_albedo]'s alpha channel. This can be used to add variation to objects, or to blend between two different albedo/normal textures.
</member>
<member name="detail_mask" type="Texture2D" setter="set_texture" getter="get_texture">
- Texture used to specify how the detail textures get blended with the base textures.
+ Texture used to specify how the detail textures get blended with the base textures. [member detail_mask] can be used together with [member detail_albedo]'s alpha channel (if any).
</member>
<member name="detail_normal" type="Texture2D" setter="set_texture" getter="get_texture">
- Texture that specifies the per-pixel normal of the detail overlay.
+ Texture that specifies the per-pixel normal of the detail overlay. The [member detail_normal] texture only uses the red and green channels; the blue and alpha channels are ignored. The normal read from [member detail_normal] is oriented around the surface normal provided by the [Mesh].
[b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines.
</member>
<member name="detail_uv_layer" type="int" setter="set_detail_uv" getter="get_detail_uv" enum="BaseMaterial3D.DetailUV" default="0">
@@ -262,9 +264,10 @@
The strength of the normal map's effect.
</member>
<member name="normal_texture" type="Texture2D" setter="set_texture" getter="get_texture">
- Texture used to specify the normal at a given pixel. The [code]normal_texture[/code] only uses the red and green channels; the blue and alpha channels are ignored. The normal read from [code]normal_texture[/code] is oriented around the surface normal provided by the [Mesh].
+ Texture used to specify the normal at a given pixel. The [member normal_texture] only uses the red and green channels; the blue and alpha channels are ignored. The normal read from [member normal_texture] is oriented around the surface normal provided by the [Mesh].
[b]Note:[/b] The mesh must have both normals and tangents defined in its vertex data. Otherwise, the normal map won't render correctly and will only appear to darken the whole surface. If creating geometry with [SurfaceTool], you can use [method SurfaceTool.generate_normals] and [method SurfaceTool.generate_tangents] to automatically generate normals and tangents respectively.
[b]Note:[/b] Godot expects the normal map to use X+, Y+, and Z+ coordinates. See [url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates]this page[/url] for a comparison of normal map coordinates expected by popular engines.
+ [b]Note:[/b] If [member detail_enabled] is [code]true[/code], the [member detail_albedo] texture is drawn [i]below[/i] the [member normal_texture]. To display a normal map [i]above[/i] the [member detail_albedo] texture, use [member detail_normal] instead.
</member>
<member name="orm_texture" type="Texture2D" setter="set_texture" getter="get_texture">
</member>
@@ -709,7 +712,7 @@
Used to read from the alpha channel of a texture.
</constant>
<constant name="TEXTURE_CHANNEL_GRAYSCALE" value="4" enum="TextureChannel">
- Currently unused.
+ Used to read from the linear (non-perceptual) average of the red, green and blue channels of a texture.
</constant>
<constant name="EMISSION_OP_ADD" value="0" enum="EmissionOperator">
Adds the emission color to the color from the emission texture.
diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml
index ede3a1e199..cec504584c 100644
--- a/doc/classes/DisplayServer.xml
+++ b/doc/classes/DisplayServer.xml
@@ -104,6 +104,19 @@
<description>
</description>
</method>
+ <method name="get_display_cutouts" qualifiers="const">
+ <return type="Array" />
+ <description>
+ Returns an [Array] of [Rect2], each of which is the bounding rectangle for a display cutout or notch. These are non-functional areas on edge-to-edge screens used by cameras and sensors. Returns an empty array if the device does not have cutouts. See also [method get_display_safe_area].
+ [b]Note:[/b] Currently only implemented on Android. Other platforms will return an empty array even if they do have display cutouts or notches.
+ </description>
+ </method>
+ <method name="get_display_safe_area" qualifiers="const">
+ <return type="Rect2i" />
+ <description>
+ Returns the unobscured area of the display where interactive controls should be rendered. See also [method get_display_cutouts].
+ </description>
+ </method>
<method name="get_name" qualifiers="const">
<return type="String" />
<description>
diff --git a/doc/classes/Label3D.xml b/doc/classes/Label3D.xml
index fbb53715c4..1bd52ab2dc 100644
--- a/doc/classes/Label3D.xml
+++ b/doc/classes/Label3D.xml
@@ -98,12 +98,22 @@
<member name="outline_modulate" type="Color" setter="set_outline_modulate" getter="get_outline_modulate" default="Color(0, 0, 0, 1)">
The tint of [Font]'s outline.
</member>
+ <member name="outline_render_priority" type="int" setter="set_outline_render_priority" getter="get_outline_render_priority" default="-1">
+ Sets the render priority for the text outline. Higher priority objects will be sorted in front of lower priority objects.
+ [b]Node:[/b] This only applies if [member alpha_cut] is set to [constant ALPHA_CUT_DISABLED] (default value).
+ [b]Note:[/b] This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
+ </member>
<member name="outline_size" type="int" setter="set_outline_size" getter="get_outline_size" default="0">
Text outline size.
</member>
<member name="pixel_size" type="float" setter="set_pixel_size" getter="get_pixel_size" default="0.01">
The size of one pixel's width on the label to scale it in 3D.
</member>
+ <member name="render_priority" type="int" setter="set_render_priority" getter="get_render_priority" default="0">
+ Sets the render priority for the text. Higher priority objects will be sorted in front of lower priority objects.
+ [b]Node:[/b] This only applies if [member alpha_cut] is set to [constant ALPHA_CUT_DISABLED] (default value).
+ [b]Note:[/b] This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
+ </member>
<member name="shaded" type="bool" setter="set_draw_flag" getter="get_draw_flag" default="false">
If [code]true[/code], the [Light3D] in the [Environment] has effects on the label.
</member>
diff --git a/doc/classes/NavigationRegion2D.xml b/doc/classes/NavigationRegion2D.xml
index b1165174a2..5cd2e035b6 100644
--- a/doc/classes/NavigationRegion2D.xml
+++ b/doc/classes/NavigationRegion2D.xml
@@ -10,6 +10,14 @@
</description>
<tutorials>
</tutorials>
+ <methods>
+ <method name="get_region_rid" qualifiers="const">
+ <return type="RID" />
+ <description>
+ Returns the [RID] of this region on the [NavigationServer2D]. Combined with [method NavigationServer2D.map_get_closest_point_owner] can be used to identify the [NavigationRegion2D] closest to a point on the merged navigation map.
+ </description>
+ </method>
+ </methods>
<members>
<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true">
Determines if the [NavigationRegion2D] is enabled or disabled.
diff --git a/doc/classes/NavigationRegion3D.xml b/doc/classes/NavigationRegion3D.xml
index e007633a1e..b27410ed74 100644
--- a/doc/classes/NavigationRegion3D.xml
+++ b/doc/classes/NavigationRegion3D.xml
@@ -16,6 +16,12 @@
Bakes the [NavigationMesh]. The baking is done in a separate thread because navigation baking is not a cheap operation. This can be done at runtime. When it is completed, it automatically sets the new [NavigationMesh].
</description>
</method>
+ <method name="get_region_rid" qualifiers="const">
+ <return type="RID" />
+ <description>
+ Returns the [RID] of this region on the [NavigationServer3D]. Combined with [method NavigationServer3D.map_get_closest_point_owner] can be used to identify the [NavigationRegion3D] closest to a point on the merged navigation map.
+ </description>
+ </method>
</methods>
<members>
<member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true">
diff --git a/doc/classes/SpriteBase3D.xml b/doc/classes/SpriteBase3D.xml
index 9733fa3a26..41b02b6dc9 100644
--- a/doc/classes/SpriteBase3D.xml
+++ b/doc/classes/SpriteBase3D.xml
@@ -75,6 +75,11 @@
<member name="pixel_size" type="float" setter="set_pixel_size" getter="get_pixel_size" default="0.01">
The size of one pixel's width on the sprite to scale it in 3D.
</member>
+ <member name="render_priority" type="int" setter="set_render_priority" getter="get_render_priority" default="0">
+ Sets the render priority for the sprite. Higher priority objects will be sorted in front of lower priority objects.
+ [b]Node:[/b] This only applies if [member alpha_cut] is set to [constant ALPHA_CUT_DISABLED] (default value).
+ [b]Note:[/b] This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
+ </member>
<member name="shaded" type="bool" setter="set_draw_flag" getter="get_draw_flag" default="false">
If [code]true[/code], the [Light3D] in the [Environment] has effects on the sprite.
</member>
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 0aa486cbb5..3858f2bbd0 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -53,7 +53,7 @@ public:
// RasterizerCanvasGLES3 *canvas;
// RasterizerSceneGLES3 *scene;
- GLES3::Config *config;
+ GLES3::Config *config = nullptr;
struct Resources {
GLuint mipmap_blur_fbo;
diff --git a/drivers/gles3/shader_gles3.h b/drivers/gles3/shader_gles3.h
index 14579e6535..15281064af 100644
--- a/drivers/gles3/shader_gles3.h
+++ b/drivers/gles3/shader_gles3.h
@@ -141,7 +141,7 @@ private:
static bool shader_cache_save_debug;
bool shader_cache_dir_valid = false;
- GLint max_image_units;
+ GLint max_image_units = 0;
enum StageType {
STAGE_TYPE_VERTEX,
diff --git a/drivers/gles3/storage/config.h b/drivers/gles3/storage/config.h
index bb4352ce9a..0646881b72 100644
--- a/drivers/gles3/storage/config.h
+++ b/drivers/gles3/storage/config.h
@@ -51,47 +51,47 @@ private:
static Config *singleton;
public:
- bool use_nearest_mip_filter;
- bool use_skeleton_software;
+ bool use_nearest_mip_filter = false;
+ bool use_skeleton_software = false;
- int max_vertex_texture_image_units;
- int max_texture_image_units;
- int max_texture_size;
- int max_uniform_buffer_size;
+ int max_vertex_texture_image_units = 0;
+ int max_texture_image_units = 0;
+ int max_texture_size = 0;
+ int max_uniform_buffer_size = 0;
// TODO implement wireframe in OpenGL
// bool generate_wireframes;
Set<String> extensions;
- bool float_texture_supported;
- bool s3tc_supported;
- bool latc_supported;
- bool rgtc_supported;
- bool bptc_supported;
- bool etc_supported;
- bool etc2_supported;
- bool srgb_decode_supported;
-
- bool keep_original_textures;
-
- bool force_vertex_shading;
-
- bool use_rgba_2d_shadows;
- bool use_rgba_3d_shadows;
-
- bool support_32_bits_indices;
- bool support_write_depth;
- bool support_half_float_vertices;
- bool support_npot_repeat_mipmap;
- bool support_depth_cubemaps;
- bool support_shadow_cubemaps;
- bool support_anisotropic_filter;
- float anisotropic_level;
-
- GLuint depth_internalformat;
- GLuint depth_type;
- GLuint depth_buffer_internalformat;
+ bool float_texture_supported = false;
+ bool s3tc_supported = false;
+ bool latc_supported = false;
+ bool rgtc_supported = false;
+ bool bptc_supported = false;
+ bool etc_supported = false;
+ bool etc2_supported = false;
+ bool srgb_decode_supported = false;
+
+ bool keep_original_textures = false;
+
+ bool force_vertex_shading = false;
+
+ bool use_rgba_2d_shadows = false;
+ bool use_rgba_3d_shadows = false;
+
+ bool support_32_bits_indices = false;
+ bool support_write_depth = false;
+ bool support_half_float_vertices = false;
+ bool support_npot_repeat_mipmap = false;
+ bool support_depth_cubemaps = false;
+ bool support_shadow_cubemaps = false;
+ bool support_anisotropic_filter = false;
+ float anisotropic_level = 0.0f;
+
+ GLuint depth_internalformat = 0;
+ GLuint depth_type = 0;
+ GLuint depth_buffer_internalformat = 0;
// in some cases the legacy render didn't orphan. We will mark these
// so the user can switch orphaning off for them.
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp
index fae23980b6..1b97e268df 100644
--- a/drivers/gles3/storage/material_storage.cpp
+++ b/drivers/gles3/storage/material_storage.cpp
@@ -392,26 +392,60 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
float *gui = (float *)data;
if (p_array_size > 0) {
- const PackedVector3Array &a = value;
- int s = a.size();
+ if (value.get_type() == Variant::PACKED_COLOR_ARRAY) {
+ const PackedColorArray &a = value;
+ int s = a.size();
- for (int i = 0, j = 0; i < p_array_size; i++, j += 4) {
- if (i < s) {
- gui[j] = a[i].x;
- gui[j + 1] = a[i].y;
- gui[j + 2] = a[i].z;
- } else {
- gui[j] = 0;
- gui[j + 1] = 0;
- gui[j + 2] = 0;
+ for (int i = 0, j = 0; i < p_array_size; i++, j += 4) {
+ if (i < s) {
+ Color color = a[i];
+ if (p_linear_color) {
+ color = color.srgb_to_linear();
+ }
+ gui[j] = color.r;
+ gui[j + 1] = color.g;
+ gui[j + 2] = color.b;
+ } else {
+ gui[j] = 0;
+ gui[j + 1] = 0;
+ gui[j + 2] = 0;
+ }
+ gui[j + 3] = 0; // ignored
+ }
+ } else {
+ const PackedVector3Array &a = value;
+ int s = a.size();
+
+ for (int i = 0, j = 0; i < p_array_size; i++, j += 4) {
+ if (i < s) {
+ gui[j] = a[i].x;
+ gui[j + 1] = a[i].y;
+ gui[j + 2] = a[i].z;
+ } else {
+ gui[j] = 0;
+ gui[j + 1] = 0;
+ gui[j + 2] = 0;
+ }
+ gui[j + 3] = 0; // ignored
}
- gui[j + 3] = 0; // ignored
}
} else {
- Vector3 v = value;
- gui[0] = v.x;
- gui[1] = v.y;
- gui[2] = v.z;
+ if (value.get_type() == Variant::COLOR) {
+ Color v = value;
+
+ if (p_linear_color) {
+ v = v.srgb_to_linear();
+ }
+
+ gui[0] = v.r;
+ gui[1] = v.g;
+ gui[2] = v.b;
+ } else {
+ Vector3 v = value;
+ gui[0] = v.x;
+ gui[1] = v.y;
+ gui[2] = v.z;
+ }
}
} break;
case ShaderLanguage::TYPE_VEC4: {
@@ -925,7 +959,7 @@ void MaterialData::update_uniform_buffer(const Map<StringName, ShaderLanguage::S
//value=E.value.default_value;
} else {
//zero because it was not provided
- if (E.value.type == ShaderLanguage::TYPE_VEC4 && E.value.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ if ((E.value.type == ShaderLanguage::TYPE_VEC3 || E.value.type == ShaderLanguage::TYPE_VEC4) && E.value.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
//colors must be set as black, with alpha as 1.0
_fill_std140_variant_ubo_value(E.value.type, E.value.array_size, Color(0, 0, 0, 1), data, p_use_linear_color);
} else {
diff --git a/drivers/unix/dir_access_unix.h b/drivers/unix/dir_access_unix.h
index 4fea7cd154..69530de337 100644
--- a/drivers/unix/dir_access_unix.h
+++ b/drivers/unix/dir_access_unix.h
@@ -46,8 +46,8 @@ class DirAccessUnix : public DirAccess {
static Ref<DirAccess> create_fs();
String current_dir;
- bool _cisdir;
- bool _cishidden;
+ bool _cisdir = false;
+ bool _cishidden = false;
protected:
virtual String fix_unicode_name(const char *p_name) const { return String::utf8(p_name); }
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 3b5e1bf91d..12e2113364 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -429,7 +429,7 @@ String OS_Unix::get_locale() const {
return locale;
}
-Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
+Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) {
String path = p_path;
if (FileAccess::exists(path) && path.is_relative_path()) {
@@ -450,6 +450,11 @@ Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle
p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ". Error: " + dlerror());
+
+ if (r_resolved_path != nullptr) {
+ *r_resolved_path = path;
+ }
+
return OK;
}
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index 460ba4b9e1..6116574528 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -55,7 +55,7 @@ public:
virtual Error get_entropy(uint8_t *r_buffer, int p_bytes) override; // Should return cryptographycally-safe random bytes.
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) override;
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) override;
virtual Error close_dynamic_library(void *p_library_handle) override;
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) override;
diff --git a/drivers/vulkan/rendering_device_vulkan.h b/drivers/vulkan/rendering_device_vulkan.h
index 7d9bd19309..219d48a9f5 100644
--- a/drivers/vulkan/rendering_device_vulkan.h
+++ b/drivers/vulkan/rendering_device_vulkan.h
@@ -886,8 +886,8 @@ class RenderingDeviceVulkan : public RenderingDevice {
DrawList *draw_list = nullptr; // One for regular draw lists, multiple for split.
uint32_t draw_list_subpass_count = 0;
uint32_t draw_list_count = 0;
- VkRenderPass draw_list_render_pass;
- VkFramebuffer draw_list_vkframebuffer;
+ VkRenderPass draw_list_render_pass = VK_NULL_HANDLE;
+ VkFramebuffer draw_list_vkframebuffer = VK_NULL_HANDLE;
#ifdef DEBUG_ENABLED
FramebufferFormatID draw_list_framebuffer_format = INVALID_ID;
#endif
diff --git a/drivers/vulkan/vulkan_context.h b/drivers/vulkan/vulkan_context.h
index 8c0111714c..365ee3c9b0 100644
--- a/drivers/vulkan/vulkan_context.h
+++ b/drivers/vulkan/vulkan_context.h
@@ -185,27 +185,27 @@ private:
*/
bool enabled_debug_report = false;
- PFN_vkCreateDebugUtilsMessengerEXT CreateDebugUtilsMessengerEXT;
- PFN_vkDestroyDebugUtilsMessengerEXT DestroyDebugUtilsMessengerEXT;
- PFN_vkSubmitDebugUtilsMessageEXT SubmitDebugUtilsMessageEXT;
- PFN_vkCmdBeginDebugUtilsLabelEXT CmdBeginDebugUtilsLabelEXT;
- PFN_vkCmdEndDebugUtilsLabelEXT CmdEndDebugUtilsLabelEXT;
- PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsertDebugUtilsLabelEXT;
- PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT;
- PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
- PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
- PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
- PFN_vkGetPhysicalDeviceSurfaceSupportKHR fpGetPhysicalDeviceSurfaceSupportKHR;
- PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR fpGetPhysicalDeviceSurfaceCapabilitiesKHR;
- PFN_vkGetPhysicalDeviceSurfaceFormatsKHR fpGetPhysicalDeviceSurfaceFormatsKHR;
- PFN_vkGetPhysicalDeviceSurfacePresentModesKHR fpGetPhysicalDeviceSurfacePresentModesKHR;
- PFN_vkCreateSwapchainKHR fpCreateSwapchainKHR;
- PFN_vkDestroySwapchainKHR fpDestroySwapchainKHR;
- PFN_vkGetSwapchainImagesKHR fpGetSwapchainImagesKHR;
- PFN_vkAcquireNextImageKHR fpAcquireNextImageKHR;
- PFN_vkQueuePresentKHR fpQueuePresentKHR;
- PFN_vkGetRefreshCycleDurationGOOGLE fpGetRefreshCycleDurationGOOGLE;
- PFN_vkGetPastPresentationTimingGOOGLE fpGetPastPresentationTimingGOOGLE;
+ PFN_vkCreateDebugUtilsMessengerEXT CreateDebugUtilsMessengerEXT = nullptr;
+ PFN_vkDestroyDebugUtilsMessengerEXT DestroyDebugUtilsMessengerEXT = nullptr;
+ PFN_vkSubmitDebugUtilsMessageEXT SubmitDebugUtilsMessageEXT = nullptr;
+ PFN_vkCmdBeginDebugUtilsLabelEXT CmdBeginDebugUtilsLabelEXT = nullptr;
+ PFN_vkCmdEndDebugUtilsLabelEXT CmdEndDebugUtilsLabelEXT = nullptr;
+ PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsertDebugUtilsLabelEXT = nullptr;
+ PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT = nullptr;
+ PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT = nullptr;
+ PFN_vkDebugReportMessageEXT DebugReportMessageEXT = nullptr;
+ PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT = nullptr;
+ PFN_vkGetPhysicalDeviceSurfaceSupportKHR fpGetPhysicalDeviceSurfaceSupportKHR = nullptr;
+ PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR fpGetPhysicalDeviceSurfaceCapabilitiesKHR = nullptr;
+ PFN_vkGetPhysicalDeviceSurfaceFormatsKHR fpGetPhysicalDeviceSurfaceFormatsKHR = nullptr;
+ PFN_vkGetPhysicalDeviceSurfacePresentModesKHR fpGetPhysicalDeviceSurfacePresentModesKHR = nullptr;
+ PFN_vkCreateSwapchainKHR fpCreateSwapchainKHR = nullptr;
+ PFN_vkDestroySwapchainKHR fpDestroySwapchainKHR = nullptr;
+ PFN_vkGetSwapchainImagesKHR fpGetSwapchainImagesKHR = nullptr;
+ PFN_vkAcquireNextImageKHR fpAcquireNextImageKHR = nullptr;
+ PFN_vkQueuePresentKHR fpQueuePresentKHR = nullptr;
+ PFN_vkGetRefreshCycleDurationGOOGLE fpGetRefreshCycleDurationGOOGLE = nullptr;
+ PFN_vkGetPastPresentationTimingGOOGLE fpGetPastPresentationTimingGOOGLE = nullptr;
VkDebugUtilsMessengerEXT dbg_messenger = VK_NULL_HANDLE;
VkDebugReportCallbackEXT dbg_debug_report = VK_NULL_HANDLE;
diff --git a/editor/animation_bezier_editor.h b/editor/animation_bezier_editor.h
index dcb6502440..f228f66771 100644
--- a/editor/animation_bezier_editor.h
+++ b/editor/animation_bezier_editor.h
@@ -53,7 +53,7 @@ class AnimationBezierTrackEdit : public Control {
float play_position_pos = 0;
Ref<Animation> animation;
- int selected_track;
+ int selected_track = 0;
Vector<Rect2> view_rects;
@@ -98,8 +98,8 @@ class AnimationBezierTrackEdit : public Control {
bool moving_selection_attempt = false;
IntPair select_single_attempt;
bool moving_selection = false;
- int moving_selection_from_key;
- int moving_selection_from_track;
+ int moving_selection_from_key = 0;
+ int moving_selection_from_track = 0;
Vector2 moving_selection_offset;
@@ -114,7 +114,7 @@ class AnimationBezierTrackEdit : public Control {
int moving_handle_track = 0;
Vector2 moving_handle_left;
Vector2 moving_handle_right;
- int moving_handle_mode; // value from Animation::HandleMode
+ int moving_handle_mode = 0; // value from Animation::HandleMode
void _clear_selection();
void _clear_selection_for_anim(const Ref<Animation> &p_anim);
@@ -136,8 +136,8 @@ class AnimationBezierTrackEdit : public Control {
Rect2 point_rect;
Rect2 in_rect;
Rect2 out_rect;
- int track;
- int key;
+ int track = 0;
+ int key = 0;
};
Vector<EditPoint> edit_points;
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index e724d4ccdb..462622fec5 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -1886,10 +1886,7 @@ void AnimationTimelineEdit::_bind_methods() {
AnimationTimelineEdit::AnimationTimelineEdit() {
name_limit = 150 * EDSCALE;
- zoom = nullptr;
- track_edit = nullptr;
- play_position_pos = 0;
play_position = memnew(Control);
play_position->set_mouse_filter(MOUSE_FILTER_PASS);
add_child(play_position);
@@ -3217,17 +3214,6 @@ void AnimationTrackEdit::_bind_methods() {
}
AnimationTrackEdit::AnimationTrackEdit() {
- undo_redo = nullptr;
- timeline = nullptr;
- root = nullptr;
- path = nullptr;
- path_popup = nullptr;
- menu = nullptr;
- dropping_at = 0;
-
- select_single_attempt = -1;
-
- play_position_pos = 0;
play_position = memnew(Control);
play_position->set_mouse_filter(MOUSE_FILTER_PASS);
add_child(play_position);
@@ -6238,8 +6224,6 @@ void AnimationTrackEditor::_pick_track_filter_input(const Ref<InputEvent> &p_ie)
}
AnimationTrackEditor::AnimationTrackEditor() {
- root = nullptr;
-
undo_redo = EditorNode::get_singleton()->get_undo_redo();
main_panel = memnew(PanelContainer);
@@ -6452,8 +6436,6 @@ AnimationTrackEditor::AnimationTrackEditor() {
insert_confirm_reset->set_text(TTR("Create RESET Track(s)", ""));
insert_confirm_reset->set_pressed(EDITOR_GET("editors/animation/default_create_reset_tracks"));
ichb->add_child(insert_confirm_reset);
- key_edit = nullptr;
- multi_key_edit = nullptr;
box_selection = memnew(Control);
add_child(box_selection);
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index 92b203d183..bd66a4b2df 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -54,10 +54,10 @@ class AnimationTimelineEdit : public Range {
Ref<Animation> animation;
AnimationTrackEdit *track_edit = nullptr;
- int name_limit;
+ int name_limit = 0;
Range *zoom = nullptr;
Range *h_scroll = nullptr;
- float play_position_pos;
+ float play_position_pos = 0.0f;
HBoxContainer *len_hb = nullptr;
EditorSpinSlider *length = nullptr;
@@ -86,8 +86,8 @@ class AnimationTimelineEdit : public Range {
bool dragging_timeline = false;
bool dragging_hsize = false;
- float dragging_hsize_from;
- float dragging_hsize_at;
+ float dragging_hsize_from = 0.0f;
+ float dragging_hsize_at = 0.0f;
virtual void gui_input(const Ref<InputEvent> &p_event) override;
void _track_added(int p_track);
@@ -145,17 +145,18 @@ class AnimationTrackEdit : public Control {
MENU_KEY_ADD_RESET,
MENU_KEY_DELETE
};
+
AnimationTimelineEdit *timeline = nullptr;
UndoRedo *undo_redo = nullptr;
Popup *path_popup = nullptr;
LineEdit *path = nullptr;
Node *root = nullptr;
Control *play_position = nullptr; //separate control used to draw so updates for only position changed are much faster
- float play_position_pos;
+ float play_position_pos = 0.0f;
NodePath node_path;
Ref<Animation> animation;
- int track;
+ int track = 0;
Rect2 check_rect;
Rect2 path_rect;
@@ -187,12 +188,12 @@ class AnimationTrackEdit : public Control {
Ref<Texture2D> _get_key_type_icon() const;
- mutable int dropping_at;
- float insert_at_pos;
+ mutable int dropping_at = 0;
+ float insert_at_pos = 0.0f;
bool moving_selection_attempt = false;
- int select_single_attempt;
+ int select_single_attempt = -1;
bool moving_selection = false;
- float moving_selection_from_ofs;
+ float moving_selection_from_ofs = 0.0f;
bool in_group = false;
AnimationTrackEditor *editor = nullptr;
@@ -341,7 +342,7 @@ class AnimationTrackEditor : public VBoxContainer {
PropertySelector *prop_selector = nullptr;
PropertySelector *method_selector = nullptr;
SceneTreeDialog *pick_track = nullptr;
- int adding_track_type;
+ int adding_track_type = 0;
NodePath adding_track_path;
bool keying = false;
@@ -353,7 +354,7 @@ class AnimationTrackEditor : public VBoxContainer {
Variant value;
String query;
bool advance = false;
- }; /* insert_data;*/
+ };
Label *insert_confirm_text = nullptr;
CheckBox *insert_confirm_bezier = nullptr;
@@ -388,8 +389,8 @@ class AnimationTrackEditor : public VBoxContainer {
void _timeline_value_changed(double);
- float insert_key_from_track_call_ofs;
- int insert_key_from_track_call_track;
+ float insert_key_from_track_call_ofs = 0.0f;
+ int insert_key_from_track_call_track = 0;
void _insert_key_from_track(float p_ofs, int p_track);
void _add_method_key(const String &p_method);
@@ -415,7 +416,7 @@ class AnimationTrackEditor : public VBoxContainer {
void _key_deselected(int p_key, int p_track);
bool moving_selection = false;
- float moving_selection_offset;
+ float moving_selection_offset = 0.0f;
void _move_selection_begin();
void _move_selection(float p_offset);
void _move_selection_commit();
@@ -459,7 +460,7 @@ class AnimationTrackEditor : public VBoxContainer {
void _edit_menu_about_to_popup();
void _edit_menu_pressed(int p_option);
- int last_menu_track_opt;
+ int last_menu_track_opt = 0;
void _cleanup_animation(Ref<Animation> p_animation);
diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp
index d07881e28e..cd40b53919 100644
--- a/editor/animation_track_editor_plugins.cpp
+++ b/editor/animation_track_editor_plugins.cpp
@@ -966,7 +966,6 @@ void AnimationTrackEditTypeAudio::_bind_methods() {
AnimationTrackEditTypeAudio::AnimationTrackEditTypeAudio() {
AudioStreamPreviewGenerator::get_singleton()->connect("preview_updated", callable_mp(this, &AnimationTrackEditTypeAudio::_preview_changed));
- len_resizing = false;
}
bool AnimationTrackEditTypeAudio::can_drop_data(const Point2 &p_point, const Variant &p_data) const {
diff --git a/editor/animation_track_editor_plugins.h b/editor/animation_track_editor_plugins.h
index adfe517356..e3cafaa97d 100644
--- a/editor/animation_track_editor_plugins.h
+++ b/editor/animation_track_editor_plugins.h
@@ -115,10 +115,10 @@ class AnimationTrackEditTypeAudio : public AnimationTrackEdit {
void _preview_changed(ObjectID p_which);
bool len_resizing = false;
- bool len_resizing_start;
- int len_resizing_index;
- float len_resizing_from_px;
- float len_resizing_rel;
+ bool len_resizing_start = false;
+ int len_resizing_index = 0;
+ float len_resizing_from_px = 0.0f;
+ float len_resizing_rel = 0.0f;
bool over_drag_position = false;
protected:
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index c9868bc3c2..7c00cf351c 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -657,10 +657,6 @@ void FindReplaceBar::_bind_methods() {
}
FindReplaceBar::FindReplaceBar() {
- results_count = -1;
- results_count_to_current = -1;
- needs_to_count_results = true;
-
vbc_lineedit = memnew(VBoxContainer);
add_child(vbc_lineedit);
vbc_lineedit->set_alignment(BoxContainer::ALIGNMENT_CENTER);
diff --git a/editor/code_editor.h b/editor/code_editor.h
index bb1791940e..e2441cec2b 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -84,10 +84,10 @@ class FindReplaceBar : public HBoxContainer {
uint32_t flags = 0;
- int result_line;
- int result_col;
- int results_count;
- int results_count_to_current;
+ int result_line = 0;
+ int result_col = 0;
+ int results_count = -1;
+ int results_count_to_current = -1;
bool replace_all_mode = false;
bool preserve_cursor = false;
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h
index 4b1b8363dd..f8f15b32af 100644
--- a/editor/connections_dialog.h
+++ b/editor/connections_dialog.h
@@ -111,7 +111,7 @@ private:
StringName signal;
LineEdit *dst_method = nullptr;
ConnectDialogBinds *cdbinds = nullptr;
- bool edit_mode;
+ bool edit_mode = false;
NodePath dst_path;
VBoxContainer *vbc_right = nullptr;
diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.h b/editor/debugger/debug_adapter/debug_adapter_protocol.h
index e4760bea54..66db75c634 100644
--- a/editor/debugger/debug_adapter/debug_adapter_protocol.h
+++ b/editor/debugger/debug_adapter/debug_adapter_protocol.h
@@ -111,9 +111,9 @@ private:
String _current_request;
Ref<DAPeer> _current_peer;
- int breakpoint_id;
- int stackframe_id;
- int variable_id;
+ int breakpoint_id = 0;
+ int stackframe_id = 0;
+ int variable_id = 0;
List<DAP::Breakpoint> breakpoint_list;
Map<DAP::StackFrame, List<int>> stackframe_list;
Map<int, Array> variable_list;
diff --git a/editor/debugger/editor_performance_profiler.h b/editor/debugger/editor_performance_profiler.h
index a917ddbe28..ab0e43de2f 100644
--- a/editor/debugger/editor_performance_profiler.h
+++ b/editor/debugger/editor_performance_profiler.h
@@ -66,7 +66,7 @@ private:
Control *monitor_draw = nullptr;
Label *info_message = nullptr;
StringName marker_key;
- int marker_frame;
+ int marker_frame = 0;
const int MARGIN = 4;
const int POINT_SEPARATION = 5;
const int MARKER_MARGIN = 2;
diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp
index 4e2e8634e5..50f3b19cc2 100644
--- a/editor/debugger/editor_profiler.cpp
+++ b/editor/debugger/editor_profiler.cpp
@@ -662,9 +662,6 @@ EditorProfiler::EditorProfiler() {
int metric_size = CLAMP(int(EDITOR_GET("debugger/profiler_frame_history_size")), 60, 1024);
frame_metrics.resize(metric_size);
- total_metrics = 0;
- last_metric = -1;
- hover_metric = -1;
EDITOR_DEF("debugger/profiler_frame_max_functions", 64);
@@ -682,7 +679,4 @@ EditorProfiler::EditorProfiler() {
plot_sigs.insert("physics_frame_time");
plot_sigs.insert("category_frame_time");
-
- seeking = false;
- graph_height = 1;
}
diff --git a/editor/debugger/editor_profiler.h b/editor/debugger/editor_profiler.h
index 34f34be7c3..1a65e2e3d6 100644
--- a/editor/debugger/editor_profiler.h
+++ b/editor/debugger/editor_profiler.h
@@ -106,18 +106,18 @@ private:
SpinBox *cursor_metric_edit = nullptr;
Vector<Metric> frame_metrics;
- int total_metrics;
- int last_metric;
+ int total_metrics = 0;
+ int last_metric = -1;
- int max_functions;
+ int max_functions = 0;
- bool updating_frame;
+ bool updating_frame = false;
- int hover_metric;
+ int hover_metric = -1;
- float graph_height;
+ float graph_height = 1.0f;
- bool seeking;
+ bool seeking = false;
Timer *frame_delay = nullptr;
Timer *plot_delay = nullptr;
diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp
index 2f33a0bc31..503c03bafe 100644
--- a/editor/debugger/editor_visual_profiler.cpp
+++ b/editor/debugger/editor_visual_profiler.cpp
@@ -782,7 +782,6 @@ EditorVisualProfiler::EditorVisualProfiler() {
graph = memnew(TextureRect);
graph->set_ignore_texture_size(true);
graph->set_mouse_filter(MOUSE_FILTER_STOP);
- //graph->set_ignore_mouse(false);
graph->connect("draw", callable_mp(this, &EditorVisualProfiler::_graph_tex_draw));
graph->connect("gui_input", callable_mp(this, &EditorVisualProfiler::_graph_tex_input));
graph->connect("mouse_exited", callable_mp(this, &EditorVisualProfiler::_graph_tex_mouse_exit));
@@ -792,11 +791,6 @@ EditorVisualProfiler::EditorVisualProfiler() {
int metric_size = CLAMP(int(EDITOR_GET("debugger/profiler_frame_history_size")), 60, 1024);
frame_metrics.resize(metric_size);
- last_metric = -1;
- //cursor_metric=-1;
- hover_metric = -1;
-
- //display_mode=DISPLAY_FRAME_TIME;
frame_delay = memnew(Timer);
frame_delay->set_wait_time(0.1);
@@ -809,12 +803,4 @@ EditorVisualProfiler::EditorVisualProfiler() {
plot_delay->set_one_shot(true);
add_child(plot_delay);
plot_delay->connect("timeout", callable_mp(this, &EditorVisualProfiler::_update_plot));
-
- seeking = false;
- graph_height_cpu = 1;
- graph_height_gpu = 1;
-
- graph_limit = 1000 / 60.0;
-
- //activate->set_disabled(true);
}
diff --git a/editor/debugger/editor_visual_profiler.h b/editor/debugger/editor_visual_profiler.h
index 14eacca02d..4e5169da9e 100644
--- a/editor/debugger/editor_visual_profiler.h
+++ b/editor/debugger/editor_visual_profiler.h
@@ -83,21 +83,20 @@ private:
SpinBox *cursor_metric_edit = nullptr;
Vector<Metric> frame_metrics;
- int last_metric;
+ int last_metric = -1;
- StringName selected_area;
+ int hover_metric = -1;
- bool updating_frame;
+ StringName selected_area;
- //int cursor_metric;
- int hover_metric;
+ bool updating_frame = false;
- float graph_height_cpu;
- float graph_height_gpu;
+ float graph_height_cpu = 1.0f;
+ float graph_height_gpu = 1.0f;
- float graph_limit;
+ float graph_limit = 1000.0f / 60;
- bool seeking;
+ bool seeking = false;
Timer *frame_delay = nullptr;
Timer *plot_delay = nullptr;
diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp
index 877af41160..cd5a4f16e4 100644
--- a/editor/editor_about.cpp
+++ b/editor/editor_about.cpp
@@ -129,6 +129,7 @@ EditorAbout::EditorAbout() {
vbc->add_child(hbc);
_logo = memnew(TextureRect);
+ _logo->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED);
hbc->add_child(_logo);
VBoxContainer *version_info_vbc = memnew(VBoxContainer);
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 4474d6893a..d34bc521f1 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -1263,7 +1263,6 @@ void EditorAudioBuses::_bind_methods() {
}
EditorAudioBuses::EditorAudioBuses() {
- drop_end = nullptr;
top_hb = memnew(HBoxContainer);
add_child(top_hb);
diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h
index 81a6e5b86d..70c0712b52 100644
--- a/editor/editor_audio_buses.h
+++ b/editor/editor_audio_buses.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef EDITORAUDIOBUSES_H
-#define EDITORAUDIOBUSES_H
+#ifndef EDITOR_AUDIO_BUSES_H
+#define EDITOR_AUDIO_BUSES_H
#include "editor/editor_plugin.h"
#include "scene/gui/box_container.h"
@@ -192,7 +192,7 @@ class EditorAudioBuses : public VBoxContainer {
void _new_layout();
EditorFileDialog *file_dialog = nullptr;
- bool new_layout;
+ bool new_layout = false;
void _file_dialog_callback(const String &p_string);
@@ -275,4 +275,4 @@ public:
~AudioBusesEditorPlugin();
};
-#endif // EDITORAUDIOBUSES_H
+#endif // EDITOR_AUDIO_BUSES_H
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 0ed0e9bcd7..0129a6453d 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -1583,11 +1583,9 @@ bool EditorFileDialog::are_previews_enabled() {
EditorFileDialog::EditorFileDialog() {
show_hidden_files = default_show_hidden_files;
display_mode = default_display_mode;
- local_history_pos = 0;
VBoxContainer *vbc = memnew(VBoxContainer);
add_child(vbc);
- mode = FILE_MODE_SAVE_FILE;
set_title(TTR("Save a File"));
ED_SHORTCUT("file_dialog/go_back", TTR("Go Back"), KeyModifierMask::ALT | Key::LEFT);
@@ -1795,7 +1793,6 @@ EditorFileDialog::EditorFileDialog() {
item_vb->add_child(file_box);
dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- access = ACCESS_RESOURCES;
_update_drives();
connect("confirmed", callable_mp(this, &EditorFileDialog::_action_pressed));
@@ -1808,7 +1805,6 @@ EditorFileDialog::EditorFileDialog() {
filter->connect("item_selected", callable_mp(this, &EditorFileDialog::_filter_selected));
confirm_save = memnew(ConfirmationDialog);
- //confirm_save->set_as_top_level(true);
add_child(confirm_save);
confirm_save->connect("confirmed", callable_mp(this, &EditorFileDialog::_save_confirm_pressed));
@@ -1843,9 +1839,6 @@ EditorFileDialog::EditorFileDialog() {
if (register_func) {
register_func(this);
}
-
- preview_wheel_timeout = 0;
- preview_wheel_index = 0;
}
EditorFileDialog::~EditorFileDialog() {
diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h
index db2a2ab09f..0460576bc5 100644
--- a/editor/editor_file_dialog.h
+++ b/editor/editor_file_dialog.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef EDITORFILEDIALOG_H
-#define EDITORFILEDIALOG_H
+#ifndef EDITOR_FILE_DIALOG_H
+#define EDITOR_FILE_DIALOG_H
#include "core/io/dir_access.h"
#include "editor/plugins/editor_preview_plugins.h"
@@ -88,11 +88,11 @@ private:
LineEdit *makedirname = nullptr;
Button *makedir = nullptr;
- Access access;
+ Access access = ACCESS_RESOURCES;
VBoxContainer *vbox = nullptr;
- FileMode mode;
- bool can_create_dir;
+ FileMode mode = FILE_MODE_SAVE_FILE;
+ bool can_create_dir = false;
LineEdit *dir = nullptr;
Button *dir_prev = nullptr;
@@ -130,15 +130,15 @@ private:
ItemList *recent = nullptr;
Vector<String> local_history;
- int local_history_pos;
+ int local_history_pos = 0;
void _push_history();
Vector<String> filters;
bool previews_enabled = true;
bool preview_waiting = false;
- int preview_wheel_index;
- float preview_wheel_timeout;
+ int preview_wheel_index = 0;
+ float preview_wheel_timeout = 0.0f;
static bool default_show_hidden_files;
static DisplayMode default_display_mode;
@@ -257,4 +257,4 @@ VARIANT_ENUM_CAST(EditorFileDialog::FileMode);
VARIANT_ENUM_CAST(EditorFileDialog::Access);
VARIANT_ENUM_CAST(EditorFileDialog::DisplayMode);
-#endif // EDITORFILEDIALOG_H
+#endif // EDITOR_FILE_DIALOG_H
diff --git a/editor/editor_help.h b/editor/editor_help.h
index 054fd84af6..e289f91414 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -56,7 +56,7 @@ class FindBar : public HBoxContainer {
RichTextLabel *rich_text_label = nullptr;
- int results_count;
+ int results_count = 0;
void _hide_bar();
@@ -112,7 +112,7 @@ class EditorHelp : public VBoxContainer {
Map<String, int> constant_line;
Map<String, int> enum_line;
Map<String, Map<String, int>> enum_values_line;
- int description_line;
+ int description_line = 0;
RichTextLabel *class_desc = nullptr;
HSplitContainer *h_split = nullptr;
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 3d52686378..20128b3436 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -5909,7 +5909,6 @@ EditorNode::EditorNode() {
}
singleton = this;
- last_checked_version = 0;
TranslationServer::get_singleton()->set_enabled(false);
// Load settings.
@@ -6263,8 +6262,6 @@ EditorNode::EditorNode() {
dock_vb->add_child(dock_float);
dock_select_popup->reset_size();
- dock_select_rect_over_idx = -1;
- dock_popup_selected_idx = -1;
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
dock_slot[i]->set_custom_minimum_size(Size2(170, 0) * EDSCALE);
@@ -6811,7 +6808,6 @@ EditorNode::EditorNode() {
// Define corresponding default layout.
const String docks_section = "docks";
- overridden_default_layout = -1;
default_layout.instantiate();
// Dock numbers are based on DockSlot enum value + 1.
default_layout->set_value(docks_section, "dock_3", "Scene,Import");
@@ -6890,8 +6886,6 @@ EditorNode::EditorNode() {
Button *output_button = add_bottom_panel_item(TTR("Output"), log);
log->set_tool_button(output_button);
- old_split_ofs = 0;
-
center_split->connect("resized", callable_mp(this, &EditorNode::_vp_resized));
native_shader_source_visualizer = memnew(EditorNativeShaderSourceVisualizer);
@@ -7157,7 +7151,6 @@ EditorNode::EditorNode() {
}
update_spinner_step_msec = OS::get_singleton()->get_ticks_msec();
update_spinner_step_frame = Engine::get_singleton()->get_frames_drawn();
- update_spinner_step = 0;
editor_plugin_screen = nullptr;
editor_plugins_over = memnew(EditorPluginList);
@@ -7191,9 +7184,6 @@ EditorNode::EditorNode() {
open_imported->connect("custom_action", callable_mp(this, &EditorNode::_inherit_imported));
gui_base->add_child(open_imported);
- saved_version = 1;
- _last_instantiated_scene = nullptr;
-
quick_open = memnew(EditorQuickOpen);
gui_base->add_child(quick_open);
quick_open->connect("quick_open", callable_mp(this, &EditorNode::_quick_opened));
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 82118b8b70..0d1ca3a42d 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -283,7 +283,7 @@ private:
ConfirmationDialog *video_restart_dialog = nullptr;
- int rendering_driver_current;
+ int rendering_driver_current = 0;
String rendering_driver_request;
// Split containers.
@@ -305,12 +305,12 @@ private:
PopupMenu *scene_tabs_context_menu = nullptr;
Panel *tab_preview_panel = nullptr;
TextureRect *tab_preview = nullptr;
- int tab_closing_idx;
+ int tab_closing_idx = 0;
bool exiting = false;
bool dimmed = false;
- int old_split_ofs;
+ int old_split_ofs = 0;
VSplitContainer *top_split = nullptr;
HBoxContainer *bottom_hb = nullptr;
Control *vp_base = nullptr;
@@ -363,7 +363,7 @@ private:
EditorAbout *about = nullptr;
AcceptDialog *warning = nullptr;
- int overridden_default_layout;
+ int overridden_default_layout = -1;
Ref<ConfigFile> default_layout;
PopupMenu *editor_layouts = nullptr;
EditorLayoutsDialog *layout_dialog = nullptr;
@@ -412,8 +412,8 @@ private:
TabContainer *dock_slot[DOCK_SLOT_MAX];
Timer *dock_drag_timer = nullptr;
bool docks_visible = true;
- int dock_popup_selected_idx;
- int dock_select_rect_over_idx;
+ int dock_popup_selected_idx = -1;
+ int dock_select_rect_over_idx = -1;
HBoxContainer *tabbar_container = nullptr;
Button *distraction_free = nullptr;
@@ -446,24 +446,24 @@ private:
bool unsaved_cache = true;
bool waiting_for_first_scan = true;
- int current_menu_option;
+ int current_menu_option = 0;
SubViewport *scene_root = nullptr; // Root of the scene being edited.
Object *current = nullptr;
Ref<Resource> saving_resource;
- uint64_t update_spinner_step_msec;
- uint64_t update_spinner_step_frame;
- int update_spinner_step;
+ uint64_t update_spinner_step_msec = 0;
+ uint64_t update_spinner_step_frame = 0;
+ int update_spinner_step = 0;
String _tmp_import_path;
String external_file;
String open_navigate;
String run_custom_filename;
- uint64_t saved_version;
- uint64_t last_checked_version;
+ uint64_t saved_version = 1;
+ uint64_t last_checked_version = 0;
DynamicFontImportSettings *fontdata_import_settings = nullptr;
SceneImportSettings *scene_import_settings = nullptr;
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index 32d28cd3a7..ec8130e862 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -656,10 +656,7 @@ void EditorSpinSlider::_ensure_input_popup() {
}
EditorSpinSlider::EditorSpinSlider() {
- grabbing_spinner_dist_cache = 0;
- pre_grab_value = 0;
set_focus_mode(FOCUS_ALL);
- updown_offset = -1;
grabber = memnew(TextureRect);
add_child(grabber);
grabber->hide();
@@ -668,5 +665,4 @@ EditorSpinSlider::EditorSpinSlider() {
grabber->connect("mouse_entered", callable_mp(this, &EditorSpinSlider::_grabber_mouse_entered));
grabber->connect("mouse_exited", callable_mp(this, &EditorSpinSlider::_grabber_mouse_exited));
grabber->connect("gui_input", callable_mp(this, &EditorSpinSlider::_grabber_gui_input));
- grabber_range = 1;
}
diff --git a/editor/editor_spin_slider.h b/editor/editor_spin_slider.h
index fc9f6b8722..f0adf5b7a1 100644
--- a/editor/editor_spin_slider.h
+++ b/editor/editor_spin_slider.h
@@ -40,41 +40,42 @@ class EditorSpinSlider : public Range {
String label;
String suffix;
- int updown_offset;
+ int updown_offset = -1;
bool hover_updown = false;
bool mouse_hover = false;
TextureRect *grabber = nullptr;
- int grabber_range;
+ int grabber_range = 1;
bool mouse_over_spin = false;
bool mouse_over_grabber = false;
bool mousewheel_over_grabber = false;
bool grabbing_grabber = false;
- int grabbing_from;
- float grabbing_ratio;
+ int grabbing_from = 0;
+ float grabbing_ratio = 0.0f;
bool grabbing_spinner_attempt = false;
bool grabbing_spinner = false;
bool read_only = false;
- float grabbing_spinner_dist_cache;
+ float grabbing_spinner_dist_cache = 0.0f;
Vector2 grabbing_spinner_mouse_pos;
- double pre_grab_value;
+ double pre_grab_value = 0.0;
Popup *value_input_popup = nullptr;
LineEdit *value_input = nullptr;
bool value_input_just_closed = false;
bool value_input_dirty = false;
+ bool hide_slider = false;
+ bool flat = false;
+
void _grabber_gui_input(const Ref<InputEvent> &p_event);
void _value_input_closed();
void _value_input_submitted(const String &);
void _value_focus_exited();
void _value_input_gui_input(const Ref<InputEvent> &p_event);
- bool hide_slider = false;
- bool flat = false;
void _evaluate_input_text();
diff --git a/editor/fileserver/editor_file_server.cpp b/editor/fileserver/editor_file_server.cpp
index 46fb767c00..0a59ecf1b3 100644
--- a/editor/fileserver/editor_file_server.cpp
+++ b/editor/fileserver/editor_file_server.cpp
@@ -311,9 +311,6 @@ void EditorFileServer::stop() {
EditorFileServer::EditorFileServer() {
server.instantiate();
- quit = false;
- active = false;
- cmd = CMD_NONE;
thread.start(_thread_start, this);
EDITOR_DEF("filesystem/file_server/port", 6010);
diff --git a/editor/fileserver/editor_file_server.h b/editor/fileserver/editor_file_server.h
index ccebd1465d..7e771db55f 100644
--- a/editor/fileserver/editor_file_server.h
+++ b/editor/fileserver/editor_file_server.h
@@ -63,12 +63,12 @@ class EditorFileServer : public Object {
Mutex wait_mutex;
Thread thread;
static void _thread_start(void *);
- bool quit;
- Command cmd;
+ bool quit = false;
+ Command cmd = CMD_NONE;
String password;
- int port;
- bool active;
+ int port = 0;
+ bool active = false;
public:
void start();
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 33c6ce9622..e08e7343ba 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -2025,6 +2025,16 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected
}
} break;
+ case FILE_COPY_UID: {
+ if (!p_selected.is_empty()) {
+ ResourceUID::ID uid = ResourceLoader::get_resource_uid(p_selected[0]);
+ if (uid != ResourceUID::INVALID_ID) {
+ String uid_string = ResourceUID::get_singleton()->id_to_text(uid);
+ DisplayServer::get_singleton()->clipboard_set(uid_string);
+ }
+ }
+ } break;
+
case FILE_NEW_RESOURCE: {
new_resource_dialog->popup_create(true);
} break;
@@ -2550,6 +2560,9 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
if (p_paths.size() == 1) {
p_popup->add_icon_shortcut(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/copy_path"), FILE_COPY_PATH);
+ if (ResourceLoader::get_resource_uid(p_paths[0]) != ResourceUID::INVALID_ID) {
+ p_popup->add_icon_shortcut(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/copy_uid"), FILE_COPY_UID);
+ }
if (p_paths[0] != "res://") {
p_popup->add_icon_shortcut(get_theme_icon(SNAME("Rename"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/rename"), FILE_RENAME);
p_popup->add_icon_shortcut(get_theme_icon(SNAME("Duplicate"), SNAME("EditorIcons")), ED_GET_SHORTCUT("filesystem_dock/duplicate"), FILE_DUPLICATE);
@@ -2771,6 +2784,8 @@ void FileSystemDock::_tree_gui_input(Ref<InputEvent> p_event) {
_tree_rmb_option(FILE_DUPLICATE);
} else if (ED_IS_SHORTCUT("filesystem_dock/copy_path", p_event)) {
_tree_rmb_option(FILE_COPY_PATH);
+ } else if (ED_IS_SHORTCUT("filesystem_dock/copy_uid", p_event)) {
+ _tree_rmb_option(FILE_COPY_UID);
} else if (ED_IS_SHORTCUT("filesystem_dock/delete", p_event)) {
_tree_rmb_option(FILE_REMOVE);
} else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) {
@@ -2999,6 +3014,7 @@ FileSystemDock::FileSystemDock() {
// `KeyModifierMask::CMD | Key::C` conflicts with other editor shortcuts.
ED_SHORTCUT("filesystem_dock/copy_path", TTR("Copy Path"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::C);
+ ED_SHORTCUT("filesystem_dock/copy_uid", TTR("Copy UID"));
ED_SHORTCUT("filesystem_dock/duplicate", TTR("Duplicate..."), KeyModifierMask::CMD | Key::D);
ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), Key::KEY_DELETE);
ED_SHORTCUT("filesystem_dock/rename", TTR("Rename..."), Key::F2);
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 15fade2d95..736651c17c 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -94,6 +94,7 @@ private:
FILE_NEW_SCENE,
FILE_SHOW_IN_EXPLORER,
FILE_COPY_PATH,
+ FILE_COPY_UID,
FILE_NEW_RESOURCE,
FILE_NEW_TEXTFILE,
FOLDER_EXPAND_ALL,
diff --git a/editor/icons/RandomNumberGenerator.svg b/editor/icons/RandomNumberGenerator.svg
new file mode 100644
index 0000000000..214a7452ed
--- /dev/null
+++ b/editor/icons/RandomNumberGenerator.svg
@@ -0,0 +1 @@
+<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8.0000004 0c-7.63857653 0-8.0000004.36172395-8.0000004 8.0066027 0 7.6431663.32714821 7.9720723 7.9277171 7.9929163 3.4504629.00951 5.0807119-.12114 5.9272279-.475116 1.794714-.750503 2.145055-1.974798 2.145055-7.5178003 0-7.64487875-.361425-8.0066027-7.9999996-8.0066027zm-4.0341882 2.0158259c1.7899451 0 2.786201 2.0256492 1.6859585 3.4255356-.8444948 1.0744791-2.3331923 1.1725336-3.2879122.2170288-1.3527384-1.3538547-.3466043-3.6425644 1.6019537-3.6425644zm4.0869355 3.7383699c1.7899399 0 2.7862023 2.0236959 1.6859586 3.4235804-.8444989 1.0745018-2.3331926 1.1744878-3.2879123.218984-1.3527384-1.3538549-.3466055-3.6425644 1.6019537-3.6425644zm4.0615383 3.9690852c1.09547.036419 2.143101.848375 2.143101 2.113587 0 1.788519-2.569649 2.876024-3.713797 1.571993-.9034489-1.029694-.9772793-1.902694-.23834-2.842882.476145-.6058151 1.151756-.8645864 1.809036-.842698z" fill="#fff" stroke-width=".256504"/></svg>
diff --git a/editor/import/scene_import_settings.cpp b/editor/import/scene_import_settings.cpp
index b08622b910..8866794505 100644
--- a/editor/import/scene_import_settings.cpp
+++ b/editor/import/scene_import_settings.cpp
@@ -558,6 +558,8 @@ void SceneImportSettings::open_settings(const String &p_path, bool p_for_animati
node_map.clear();
defaults.clear();
+ mesh_preview->hide();
+
selected_id = "";
selected_type = "";
diff --git a/editor/import/scene_import_settings.h b/editor/import/scene_import_settings.h
index 55cfba3275..ec24a8a5a5 100644
--- a/editor/import/scene_import_settings.h
+++ b/editor/import/scene_import_settings.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef SCENEIMPORTSETTINGS_H
-#define SCENEIMPORTSETTINGS_H
+#ifndef SCENE_IMPORT_SETTINGS_H
+#define SCENE_IMPORT_SETTINGS_H
#include "editor/import/resource_importer_scene.h"
#include "scene/3d/camera_3d.h"
@@ -86,9 +86,9 @@ class SceneImportSettings : public ConfirmationDialog {
Ref<StandardMaterial3D> collider_mat;
- float cam_rot_x;
- float cam_rot_y;
- float cam_zoom;
+ float cam_rot_x = 0.0f;
+ float cam_rot_y = 0.0f;
+ float cam_zoom = 0.0f;
void _update_scene();
@@ -176,7 +176,7 @@ class SceneImportSettings : public ConfirmationDialog {
void _menu_callback(int p_id);
void _save_dir_callback(const String &p_path);
- int current_action;
+ int current_action = 0;
Vector<TreeItem *> save_path_items;
@@ -205,4 +205,4 @@ public:
~SceneImportSettings();
};
-#endif // SCENEIMPORTSETTINGS_H
+#endif // SCENE_IMPORT_SETTINGS_H
diff --git a/editor/plugin_config_dialog.h b/editor/plugin_config_dialog.h
index 76fec636f3..5c6043da12 100644
--- a/editor/plugin_config_dialog.h
+++ b/editor/plugin_config_dialog.h
@@ -54,7 +54,7 @@ class PluginConfigDialog : public ConfirmationDialog {
TextureRect *subfolder_validation = nullptr;
TextureRect *script_validation = nullptr;
- bool _edit_mode;
+ bool _edit_mode = false;
void _clear_fields();
void _on_confirmed();
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index 22e0a3dabb..ad6d8e6379 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -703,10 +703,8 @@ AbstractPolygon2DEditor::PosVertex AbstractPolygon2DEditor::closest_edge_point(c
}
AbstractPolygon2DEditor::AbstractPolygon2DEditor(bool p_wip_destructive) {
- canvas_item_editor = nullptr;
undo_redo = EditorNode::get_undo_redo();
- wip_active = false;
edited_point = PosVertex();
wip_destructive = p_wip_destructive;
@@ -736,8 +734,6 @@ AbstractPolygon2DEditor::AbstractPolygon2DEditor(bool p_wip_destructive) {
create_resource = memnew(ConfirmationDialog);
add_child(create_resource);
create_resource->get_ok_button()->set_text(TTR("Create"));
-
- mode = MODE_EDIT;
}
void AbstractPolygon2DEditorPlugin::edit(Object *p_object) {
diff --git a/editor/plugins/abstract_polygon_2d_editor.h b/editor/plugins/abstract_polygon_2d_editor.h
index b0483cbb62..696fd7b637 100644
--- a/editor/plugins/abstract_polygon_2d_editor.h
+++ b/editor/plugins/abstract_polygon_2d_editor.h
@@ -80,10 +80,10 @@ class AbstractPolygon2DEditor : public HBoxContainer {
Vector<Vector2> pre_move_edit;
Vector<Vector2> wip;
- bool wip_active;
- bool wip_destructive;
+ bool wip_active = false;
+ bool wip_destructive = false;
- bool _polygon_editing_enabled;
+ bool _polygon_editing_enabled = false;
CanvasItemEditor *canvas_item_editor = nullptr;
Panel *panel = nullptr;
@@ -97,7 +97,7 @@ protected:
MODE_CONT,
};
- int mode;
+ int mode = MODE_EDIT;
UndoRedo *undo_redo = nullptr;
diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp
index 94882b3464..ae4482155c 100644
--- a/editor/plugins/animation_blend_space_1d_editor.cpp
+++ b/editor/plugins/animation_blend_space_1d_editor.cpp
@@ -594,7 +594,6 @@ AnimationNodeBlendSpace1DEditor *AnimationNodeBlendSpace1DEditor::singleton = nu
AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
singleton = this;
- updating = false;
HBoxContainer *top_hb = memnew(HBoxContainer);
add_child(top_hb);
@@ -745,9 +744,5 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() {
open_file->connect("file_selected", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_file_opened));
undo_redo = EditorNode::get_undo_redo();
- selected_point = -1;
- dragging_selected = false;
- dragging_selected_attempt = false;
-
set_custom_minimum_size(Size2(0, 150 * EDSCALE));
}
diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h
index 816c2555ca..2f7dee65fc 100644
--- a/editor/plugins/animation_blend_space_1d_editor.h
+++ b/editor/plugins/animation_blend_space_1d_editor.h
@@ -65,14 +65,14 @@ class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin {
SpinBox *edit_value = nullptr;
Button *open_editor = nullptr;
- int selected_point;
+ int selected_point = -1;
Control *blend_space_draw = nullptr;
PanelContainer *error_panel = nullptr;
Label *error_label = nullptr;
- bool updating;
+ bool updating = false;
UndoRedo *undo_redo = nullptr;
@@ -90,11 +90,11 @@ class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin {
PopupMenu *menu = nullptr;
PopupMenu *animations_menu = nullptr;
Vector<String> animations_to_add;
- float add_point_pos;
+ float add_point_pos = 0.0f;
Vector<real_t> points;
- bool dragging_selected_attempt;
- bool dragging_selected;
+ bool dragging_selected_attempt = false;
+ bool dragging_selected = false;
Vector2 drag_from;
Vector2 drag_ofs;
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index 8397772bf8..40e93780e4 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -1214,7 +1214,6 @@ AnimationNodeStateMachineEditor *AnimationNodeStateMachineEditor::singleton = nu
AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
singleton = this;
- updating = false;
HBoxContainer *top_hb = memnew(HBoxContainer);
add_child(top_hb);
@@ -1347,12 +1346,4 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() {
open_file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
open_file->connect("file_selected", callable_mp(this, &AnimationNodeStateMachineEditor::_file_opened));
undo_redo = EditorNode::get_undo_redo();
-
- over_node_what = -1;
- dragging_selected_attempt = false;
- connecting = false;
-
- last_active = false;
-
- error_time = 0;
}
diff --git a/editor/plugins/animation_state_machine_editor.h b/editor/plugins/animation_state_machine_editor.h
index fe3f6f370c..16542a4a1a 100644
--- a/editor/plugins/animation_state_machine_editor.h
+++ b/editor/plugins/animation_state_machine_editor.h
@@ -74,7 +74,7 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
PanelContainer *error_panel = nullptr;
Label *error_label = nullptr;
- bool updating;
+ bool updating = false;
UndoRedo *undo_redo = nullptr;
@@ -93,14 +93,14 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
Vector2 add_node_pos;
- bool dragging_selected_attempt;
- bool dragging_selected;
+ bool dragging_selected_attempt = false;
+ bool dragging_selected = false;
Vector2 drag_from;
Vector2 drag_ofs;
StringName snap_x;
StringName snap_y;
- bool connecting;
+ bool connecting = false;
StringName connecting_from;
Vector2 connecting_to;
StringName connecting_to_node;
@@ -139,7 +139,7 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
StringName selected_transition_to;
StringName over_node;
- int over_node_what;
+ int over_node_what = -1;
String prev_name;
void _name_edited(const String &p_text);
@@ -155,15 +155,15 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
void _autoplay_selected();
void _end_selected();
- bool last_active;
+ bool last_active = false;
StringName last_blend_from_node;
StringName last_current_node;
Vector<StringName> last_travel_path;
- float last_play_pos;
- float play_pos;
- float current_length;
+ float last_play_pos = 0.0f;
+ float play_pos = 0.0f;
+ float current_length = 0.0f;
- float error_time;
+ float error_time = 0.0f;
String error_text;
EditorFileDialog *open_file = nullptr;
diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h
index 96830c31fd..65c8398558 100644
--- a/editor/plugins/asset_library_editor_plugin.h
+++ b/editor/plugins/asset_library_editor_plugin.h
@@ -60,9 +60,9 @@ class EditorAssetLibraryItem : public PanelContainer {
TextureRect *stars[5];
Label *price = nullptr;
- int asset_id;
- int category_id;
- int author_id;
+ int asset_id = 0;
+ int category_id = 0;
+ int author_id = 0;
void _asset_clicked();
void _category_clicked();
@@ -102,7 +102,7 @@ class EditorAssetLibraryItemDescription : public ConfirmationDialog {
void set_image(int p_type, int p_index, const Ref<Texture2D> &p_image);
- int asset_id;
+ int asset_id = 0;
String download_url;
String title;
String sha256;
@@ -146,7 +146,7 @@ class EditorAssetLibraryItemDownload : public MarginContainer {
int prev_status;
- int asset_id;
+ int asset_id = 0;
bool external_install;
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index c840ce22ce..09cca41bc9 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -4888,14 +4888,6 @@ CanvasItemEditor::CanvasItemEditor() {
view_offset = Point2(-150 - RULER_WIDTH, -95 - RULER_WIDTH);
previous_update_view_offset = view_offset; // Moves the view a little bit to the left so that (0,0) is visible. The values a relative to a 16/10 screen
- grid_offset = Point2();
- grid_step = Point2(8, 8); // A power-of-two value works better as a default
- primary_grid_steps = 8; // A power-of-two value works better as a default
- grid_step_multiplier = 0;
-
- snap_rotation_offset = 0;
- snap_rotation_step = Math::deg2rad(15.0);
- snap_scale_step = 0.1f;
snap_target[0] = SNAP_TARGET_NONE;
snap_target[1] = SNAP_TARGET_NONE;
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 26852ea8ed..7a49041131 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -180,7 +180,7 @@ private:
GRID_VISIBILITY_HIDE,
};
- bool selection_menu_additive_selection;
+ bool selection_menu_additive_selection = false;
Tool tool = TOOL_SELECT;
Control *viewport = nullptr;
@@ -204,20 +204,20 @@ private:
bool show_edit_locks = true;
bool show_transformation_gizmos = true;
- real_t zoom;
+ real_t zoom = 1.0;
Point2 view_offset;
Point2 previous_update_view_offset;
bool selected_from_canvas = false;
Point2 grid_offset;
- Point2 grid_step;
- int primary_grid_steps;
- int grid_step_multiplier;
+ Point2 grid_step = Point2(8, 8); // A power-of-two value works better as a default.
+ int primary_grid_steps = 8;
+ int grid_step_multiplier = 0;
- real_t snap_rotation_step;
- real_t snap_rotation_offset;
- real_t snap_scale_step;
+ real_t snap_rotation_step = 0.0;
+ real_t snap_rotation_offset = Math::deg2rad(15.0);
+ real_t snap_scale_step = 0.1f;
bool smart_snap_active = false;
bool grid_snap_active = false;
@@ -241,7 +241,7 @@ private:
bool pan_pressed = false;
bool ruler_tool_active = false;
- Point2 ruler_tool_origin = Point2();
+ Point2 ruler_tool_origin;
Point2 node_create_position;
MenuOption last_option;
@@ -346,7 +346,7 @@ private:
bool is_hovering_h_guide = false;
bool is_hovering_v_guide = false;
- bool updating_value_dialog;
+ bool updating_value_dialog = false;
Point2 box_selecting_to;
diff --git a/editor/plugins/mesh_library_editor_plugin.h b/editor/plugins/mesh_library_editor_plugin.h
index 85ead35534..f4b4288a5f 100644
--- a/editor/plugins/mesh_library_editor_plugin.h
+++ b/editor/plugins/mesh_library_editor_plugin.h
@@ -47,8 +47,8 @@ class MeshLibraryEditor : public Control {
ConfirmationDialog *cd_remove = nullptr;
ConfirmationDialog *cd_update = nullptr;
EditorFileDialog *file = nullptr;
- bool apply_xforms;
- int to_erase;
+ bool apply_xforms = false;
+ int to_erase = 0;
enum {
MENU_OPTION_ADD_ITEM,
@@ -58,7 +58,7 @@ class MeshLibraryEditor : public Control {
MENU_OPTION_IMPORT_FROM_SCENE_APPLY_XFORMS
};
- int option;
+ int option = 0;
void _import_scene_cbk(const String &p_str);
void _menu_cbk(int p_option);
void _menu_remove_confirm();
diff --git a/editor/plugins/multimesh_editor_plugin.h b/editor/plugins/multimesh_editor_plugin.h
index 9f5e85216c..5773989d0d 100644
--- a/editor/plugins/multimesh_editor_plugin.h
+++ b/editor/plugins/multimesh_editor_plugin.h
@@ -46,7 +46,7 @@ class MultiMeshEditor : public Control {
AcceptDialog *err_dialog = nullptr;
MenuButton *options = nullptr;
MultiMeshInstance3D *_last_pp_node = nullptr;
- bool browsing_source;
+ bool browsing_source = false;
Panel *panel = nullptr;
MultiMeshInstance3D *node = nullptr;
diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h
index d5d50c743c..43efdeec72 100644
--- a/editor/plugins/node_3d_editor_plugin.h
+++ b/editor/plugins/node_3d_editor_plugin.h
@@ -211,7 +211,7 @@ private:
Control *surface = nullptr;
SubViewport *viewport = nullptr;
Camera3D *camera = nullptr;
- bool transforming;
+ bool transforming = false;
bool orthogonal;
bool auto_orthogonal;
bool lock_rotation;
@@ -271,7 +271,7 @@ private:
ObjectID clicked;
Vector<_RayResult> selection_results;
- bool clicked_wants_append;
+ bool clicked_wants_append = false;
bool selection_in_progress = false;
PopupMenu *selection_menu = nullptr;
@@ -551,12 +551,12 @@ private:
RID origin;
RID origin_instance;
- bool origin_enabled;
+ bool origin_enabled = false;
RID grid[3];
RID grid_instance[3];
bool grid_visible[3]; //currently visible
bool grid_enable[3]; //should be always visible if true
- bool grid_enabled;
+ bool grid_enabled = false;
bool grid_init_draw = false;
Camera3D::Projection grid_camera_last_update_perspective = Camera3D::PROJECTION_PERSPECTIVE;
Vector3 grid_camera_last_update_position = Vector3();
diff --git a/editor/plugins/path_2d_editor_plugin.h b/editor/plugins/path_2d_editor_plugin.h
index ff74aeedf7..720f5c090f 100644
--- a/editor/plugins/path_2d_editor_plugin.h
+++ b/editor/plugins/path_2d_editor_plugin.h
@@ -82,11 +82,11 @@ class Path2DEditor : public HBoxContainer {
};
Action action;
- int action_point;
+ int action_point = 0;
Point2 moving_from;
Point2 moving_screen_from;
- float orig_in_length;
- float orig_out_length;
+ float orig_in_length = 0.0f;
+ float orig_out_length = 0.0f;
Vector2 edge_point;
void _mode_selected(int p_mode);
diff --git a/editor/plugins/path_3d_editor_plugin.h b/editor/plugins/path_3d_editor_plugin.h
index 72c24732c0..ee31fcf43d 100644
--- a/editor/plugins/path_3d_editor_plugin.h
+++ b/editor/plugins/path_3d_editor_plugin.h
@@ -84,7 +84,7 @@ class Path3DEditorPlugin : public EditorPlugin {
void _mode_changed(int p_idx);
void _close_curve();
void _handle_option_pressed(int p_option);
- bool handle_clicked;
+ bool handle_clicked = false;
bool mirror_handle_angle;
bool mirror_handle_length;
diff --git a/editor/plugins/polygon_2d_editor_plugin.h b/editor/plugins/polygon_2d_editor_plugin.h
index 4403d1e9c7..d878d3f9af 100644
--- a/editor/plugins/polygon_2d_editor_plugin.h
+++ b/editor/plugins/polygon_2d_editor_plugin.h
@@ -96,7 +96,7 @@ class Polygon2DEditor : public AbstractPolygon2DEditor {
SpinBox *bone_paint_radius = nullptr;
Label *bone_paint_radius_label = nullptr;
bool bone_painting;
- int bone_painting_bone;
+ int bone_painting_bone = 0;
Vector<float> prev_weights;
Vector2 bone_paint_pos;
AcceptDialog *grid_settings = nullptr;
@@ -110,7 +110,7 @@ class Polygon2DEditor : public AbstractPolygon2DEditor {
Vector<Vector2> uv_create_uv_prev;
Vector<Vector2> uv_create_poly_prev;
Vector<Color> uv_create_colors_prev;
- int uv_create_prev_internal_vertices;
+ int uv_create_prev_internal_vertices = 0;
Array uv_create_bones_prev;
Array polygons_prev;
diff --git a/editor/plugins/polygon_3d_editor_plugin.h b/editor/plugins/polygon_3d_editor_plugin.h
index 3ad7a4df58..e1e1261250 100644
--- a/editor/plugins/polygon_3d_editor_plugin.h
+++ b/editor/plugins/polygon_3d_editor_plugin.h
@@ -66,14 +66,14 @@ class Polygon3DEditor : public HBoxContainer {
MenuButton *options = nullptr;
- int edited_point;
+ int edited_point = 0;
Vector2 edited_point_pos;
PackedVector2Array pre_move_edit;
PackedVector2Array wip;
bool wip_active;
bool snap_ignore;
- float prev_depth;
+ float prev_depth = 0.0f;
void _wip_close();
void _polygon_draw();
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 7885ffe2c5..f0e7fccdea 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -249,7 +249,7 @@ class ScriptEditor : public PanelContainer {
MenuButton *debug_menu = nullptr;
PopupMenu *context_menu = nullptr;
Timer *autosave_timer = nullptr;
- uint64_t idle;
+ uint64_t idle = 0;
PopupMenu *recent_scripts = nullptr;
PopupMenu *theme_submenu = nullptr;
diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h
index 067711c75c..bd0c2db824 100644
--- a/editor/plugins/shader_editor_plugin.h
+++ b/editor/plugins/shader_editor_plugin.h
@@ -114,7 +114,7 @@ class ShaderEditor : public PanelContainer {
MenuButton *help_menu = nullptr;
PopupMenu *context_menu = nullptr;
RichTextLabel *warnings_panel = nullptr;
- uint64_t idle;
+ uint64_t idle = 0;
GotoLineDialog *goto_line_dialog = nullptr;
ConfirmationDialog *erase_tab_confirm = nullptr;
diff --git a/editor/plugins/skeleton_3d_editor_plugin.h b/editor/plugins/skeleton_3d_editor_plugin.h
index 911e39a34f..f4a82225f2 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.h
+++ b/editor/plugins/skeleton_3d_editor_plugin.h
@@ -131,7 +131,7 @@ class Skeleton3DEditor : public VBoxContainer {
EditorFileDialog *file_dialog = nullptr;
- bool keyable;
+ bool keyable = false;
static Skeleton3DEditor *singleton;
diff --git a/editor/plugins/sprite_frames_editor_plugin.h b/editor/plugins/sprite_frames_editor_plugin.h
index d31ce84d09..3230228fdd 100644
--- a/editor/plugins/sprite_frames_editor_plugin.h
+++ b/editor/plugins/sprite_frames_editor_plugin.h
@@ -105,7 +105,7 @@ class SpriteFramesEditor : public HSplitContainer {
EditorFileDialog *file_split_sheet = nullptr;
Set<int> frames_selected;
Set<int> frames_toggled_by_mouse_hover;
- int last_frame_selected;
+ int last_frame_selected = 0;
float scale_ratio;
int thumbnail_default_size;
diff --git a/editor/plugins/texture_region_editor_plugin.h b/editor/plugins/texture_region_editor_plugin.h
index 1e1cc2b7b2..2493446303 100644
--- a/editor/plugins/texture_region_editor_plugin.h
+++ b/editor/plugins/texture_region_editor_plugin.h
@@ -87,14 +87,14 @@ class TextureRegionEditor : public VBoxContainer {
Rect2 rect;
Rect2 rect_prev;
- float prev_margin;
+ float prev_margin = 0.0f;
int edited_margin;
Map<RID, List<Rect2>> cache_map;
List<Rect2> autoslice_cache;
bool autoslice_is_dirty;
bool drag;
- bool creating;
+ bool creating = false;
Vector2 drag_from;
int drag_index;
diff --git a/editor/plugins/tiles/tile_data_editors.h b/editor/plugins/tiles/tile_data_editors.h
index 3ac9eacb05..2c849637f0 100644
--- a/editor/plugins/tiles/tile_data_editors.h
+++ b/editor/plugins/tiles/tile_data_editors.h
@@ -108,8 +108,8 @@ private:
DRAG_TYPE_PAN,
};
DragType drag_type = DRAG_TYPE_NONE;
- int drag_polygon_index;
- int drag_point_index;
+ int drag_polygon_index = 0;
+ int drag_point_index = 0;
Vector2 drag_last_pos;
PackedVector2Array drag_old_polygon;
@@ -132,9 +132,9 @@ private:
Ref<Texture2D> background_texture;
Rect2 background_region;
Vector2 background_offset;
- bool background_h_flip;
- bool background_v_flip;
- bool background_transpose;
+ bool background_h_flip = false;
+ bool background_v_flip = false;
+ bool background_transpose = false;
Color background_modulate;
Color polygon_color = Color(1.0, 0.0, 0.0);
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index c1a95c11f6..ba87eba9e0 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -76,7 +76,7 @@ void TileMapEditorTilesPlugin::_update_toolbar() {
picker_button->show();
erase_button->show();
tools_settings_vsep_2->show();
- random_tile_checkbox->show();
+ random_tile_toggle->show();
scatter_label->show();
scatter_spinbox->show();
} else if (tool_buttons_group->get_pressed_button() == line_tool_button) {
@@ -84,7 +84,7 @@ void TileMapEditorTilesPlugin::_update_toolbar() {
picker_button->show();
erase_button->show();
tools_settings_vsep_2->show();
- random_tile_checkbox->show();
+ random_tile_toggle->show();
scatter_label->show();
scatter_spinbox->show();
} else if (tool_buttons_group->get_pressed_button() == rect_tool_button) {
@@ -92,7 +92,7 @@ void TileMapEditorTilesPlugin::_update_toolbar() {
picker_button->show();
erase_button->show();
tools_settings_vsep_2->show();
- random_tile_checkbox->show();
+ random_tile_toggle->show();
scatter_label->show();
scatter_spinbox->show();
} else if (tool_buttons_group->get_pressed_button() == bucket_tool_button) {
@@ -101,7 +101,7 @@ void TileMapEditorTilesPlugin::_update_toolbar() {
erase_button->show();
tools_settings_vsep_2->show();
bucket_contiguous_checkbox->show();
- random_tile_checkbox->show();
+ random_tile_toggle->show();
scatter_label->show();
scatter_spinbox->show();
}
@@ -461,6 +461,7 @@ void TileMapEditorTilesPlugin::_update_theme() {
picker_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("ColorPick"), SNAME("EditorIcons")));
erase_button->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("Eraser"), SNAME("EditorIcons")));
+ random_tile_toggle->set_icon(tiles_bottom_panel->get_theme_icon(SNAME("RandomNumberGenerator"), SNAME("EditorIcons")));
missing_atlas_texture_icon = tiles_bottom_panel->get_theme_icon(SNAME("TileSet"), SNAME("EditorIcons"));
}
@@ -870,7 +871,7 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over
Transform2D tile_xform;
tile_xform.set_origin(tile_map->map_to_world(E.key));
tile_xform.set_scale(tile_set->get_tile_size());
- if (!(drag_erasing || erase_button->is_pressed()) && random_tile_checkbox->is_pressed()) {
+ if (!(drag_erasing || erase_button->is_pressed()) && random_tile_toggle->is_pressed()) {
tile_set->draw_tile_shape(p_overlay, xform * tile_xform, Color(1.0, 1.0, 1.0, 0.5), true);
} else {
if (tile_set->has_source(E.value.source_id)) {
@@ -1001,7 +1002,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_line(Vector2 p_start_
Map<Vector2i, TileMapCell> output;
if (!pattern->is_empty()) {
// Paint the tiles on the tile map.
- if (!p_erase && random_tile_checkbox->is_pressed()) {
+ if (!p_erase && random_tile_toggle->is_pressed()) {
// Paint a random tile.
Vector<Vector2i> line = TileMapEditor::get_line(tile_map, tile_map->world_to_map(p_from_mouse_pos), tile_map->world_to_map(p_to_mouse_pos));
for (int i = 0; i < line.size(); i++) {
@@ -1061,7 +1062,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_rect(Vector2i p_start
Map<Vector2i, TileMapCell> output;
if (!pattern->is_empty()) {
- if (!p_erase && random_tile_checkbox->is_pressed()) {
+ if (!p_erase && random_tile_toggle->is_pressed()) {
// Paint a random tile.
for (int x = 0; x < rect.size.x; x++) {
for (int y = 0; y < rect.size.y; y++) {
@@ -1134,7 +1135,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_bucket_fill(Vector2i
source_cell.get_atlas_coords() == tile_map->get_cell_atlas_coords(tile_map_layer, coords) &&
source_cell.alternative_tile == tile_map->get_cell_alternative_tile(tile_map_layer, coords) &&
(source_cell.source_id != TileSet::INVALID_SOURCE || boundaries.has_point(coords))) {
- if (!p_erase && random_tile_checkbox->is_pressed()) {
+ if (!p_erase && random_tile_toggle->is_pressed()) {
// Paint a random tile.
output.insert(coords, _pick_random_tile(pattern));
} else {
@@ -1180,7 +1181,7 @@ Map<Vector2i, TileMapCell> TileMapEditorTilesPlugin::_draw_bucket_fill(Vector2i
source_cell.get_atlas_coords() == tile_map->get_cell_atlas_coords(tile_map_layer, coords) &&
source_cell.alternative_tile == tile_map->get_cell_alternative_tile(tile_map_layer, coords) &&
(source_cell.source_id != TileSet::INVALID_SOURCE || boundaries.has_point(coords))) {
- if (!p_erase && random_tile_checkbox->is_pressed()) {
+ if (!p_erase && random_tile_toggle->is_pressed()) {
// Paint a random tile.
output.insert(coords, _pick_random_tile(pattern));
} else {
@@ -2103,11 +2104,12 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() {
tools_settings->add_child(bucket_contiguous_checkbox);
// Random tile checkbox.
- random_tile_checkbox = memnew(CheckBox);
- random_tile_checkbox->set_flat(true);
- random_tile_checkbox->set_text(TTR("Place Random Tile"));
- random_tile_checkbox->connect("toggled", callable_mp(this, &TileMapEditorTilesPlugin::_on_random_tile_checkbox_toggled));
- tools_settings->add_child(random_tile_checkbox);
+ random_tile_toggle = memnew(Button);
+ random_tile_toggle->set_flat(true);
+ random_tile_toggle->set_toggle_mode(true);
+ random_tile_toggle->set_tooltip(TTR("Place Random Tile"));
+ random_tile_toggle->connect("toggled", callable_mp(this, &TileMapEditorTilesPlugin::_on_random_tile_checkbox_toggled));
+ tools_settings->add_child(random_tile_toggle);
// Random tile scattering.
scatter_label = memnew(Label);
diff --git a/editor/plugins/tiles/tile_map_editor.h b/editor/plugins/tiles/tile_map_editor.h
index 3a0293f48f..ec32c83d10 100644
--- a/editor/plugins/tiles/tile_map_editor.h
+++ b/editor/plugins/tiles/tile_map_editor.h
@@ -92,7 +92,7 @@ private:
VSeparator *tools_settings_vsep_2 = nullptr;
CheckBox *bucket_contiguous_checkbox = nullptr;
- CheckBox *random_tile_checkbox = nullptr;
+ Button *random_tile_toggle = nullptr;
float scattering = 0.0;
Label *scatter_label = nullptr;
SpinBox *scatter_spinbox = nullptr;
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index dc07ac7c39..09a2b2ec92 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -5864,7 +5864,7 @@ public:
class VisualShaderNodePluginDefaultEditor : public VBoxContainer {
GDCLASS(VisualShaderNodePluginDefaultEditor, VBoxContainer);
Ref<Resource> parent_resource;
- int node_id;
+ int node_id = 0;
VisualShader::Type shader_type;
public:
@@ -5927,7 +5927,7 @@ public:
InspectorDock::get_inspector_singleton()->edit(p_resource.ptr());
}
- bool updating;
+ bool updating = false;
Ref<VisualShaderNode> node;
Vector<EditorProperty *> properties;
Vector<Label *> prop_names;
diff --git a/editor/progress_dialog.h b/editor/progress_dialog.h
index f395750165..23a77ea201 100644
--- a/editor/progress_dialog.h
+++ b/editor/progress_dialog.h
@@ -85,7 +85,7 @@ class ProgressDialog : public PopupPanel {
void _popup();
void _cancel_pressed();
- bool cancelled;
+ bool cancelled = false;
protected:
void _notification(int p_what);
diff --git a/editor/property_editor.h b/editor/property_editor.h
index 1a4d88f7fa..ae623f1ad3 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -104,7 +104,7 @@ class CustomPropertyEditor : public PopupPanel {
Variant::Type type;
Variant v;
List<String> field_names;
- int hint;
+ int hint = 0;
String hint_text;
HBoxContainer *value_hboxes[MAX_VALUE_EDITORS / 4];
VBoxContainer *value_vbox = nullptr;
@@ -120,7 +120,7 @@ class CustomPropertyEditor : public PopupPanel {
ColorPicker *color_picker = nullptr;
TextEdit *text_edit = nullptr;
bool read_only = false;
- bool picking_viewport;
+ bool picking_viewport = false;
GridContainer *checks20gc = nullptr;
CheckBox *checks20[20];
SpinBox *spinbox = nullptr;
diff --git a/editor/property_selector.h b/editor/property_selector.h
index 597804da31..f42f5daa3f 100644
--- a/editor/property_selector.h
+++ b/editor/property_selector.h
@@ -50,7 +50,7 @@ class PropertySelector : public ConfirmationDialog {
EditorHelpBit *help_bit = nullptr;
- bool properties;
+ bool properties = false;
String selected;
Variant::Type type;
String base_type;
diff --git a/editor/rename_dialog.h b/editor/rename_dialog.h
index d05e80fc04..f3a850045e 100644
--- a/editor/rename_dialog.h
+++ b/editor/rename_dialog.h
@@ -64,7 +64,7 @@ class RenameDialog : public ConfirmationDialog {
SceneTreeEditor *scene_tree_editor = nullptr;
UndoRedo *undo_redo = nullptr;
- int global_count;
+ int global_count = 0;
LineEdit *lne_search = nullptr;
LineEdit *lne_replace = nullptr;
@@ -97,9 +97,9 @@ class RenameDialog : public ConfirmationDialog {
List<Pair<NodePath, String>> to_rename;
Node *preview_node = nullptr;
- bool lock_preview_update;
+ bool lock_preview_update = false;
ErrorHandlerList eh;
- bool has_errors;
+ bool has_errors = false;
protected:
static void _bind_methods();
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index 77e727b2c8..76067ef8be 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -108,7 +108,7 @@ class SceneTreeDock : public VBoxContainer {
bool restore_script_editor_on_drag = false;
bool reset_create_dialog = false;
- int current_option;
+ int current_option = 0;
CreateDialog *create_dialog = nullptr;
#ifdef MODULE_REGEX_ENABLED
RenameDialog *rename_dialog = nullptr;
diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp
index d18340a2c8..a7cfcaa262 100644
--- a/modules/cvtt/image_compress_cvtt.cpp
+++ b/modules/cvtt/image_compress_cvtt.cpp
@@ -46,7 +46,7 @@ struct CVTTCompressionJobParams {
};
struct CVTTCompressionRowTask {
- const uint8_t *in_mm_bytes;
+ const uint8_t *in_mm_bytes = nullptr;
uint8_t *out_mm_bytes = nullptr;
int y_start = 0;
int width = 0;
@@ -55,7 +55,7 @@ struct CVTTCompressionRowTask {
struct CVTTCompressionJobQueue {
CVTTCompressionJobParams job_params;
- const CVTTCompressionRowTask *job_tasks;
+ const CVTTCompressionRowTask *job_tasks = nullptr;
uint32_t num_tasks = 0;
SafeNumeric<uint32_t> current_task;
};
diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp
index 58e5e31f46..ad2d58a0e9 100644
--- a/modules/dds/texture_loader_dds.cpp
+++ b/modules/dds/texture_loader_dds.cpp
@@ -68,7 +68,7 @@ enum DDSFormat {
};
struct DDSFormatInfo {
- const char *name;
+ const char *name = nullptr;
bool compressed = false;
bool palette = false;
uint32_t divisor = 0;
diff --git a/modules/gdscript/gdscript_utility_functions.cpp b/modules/gdscript/gdscript_utility_functions.cpp
index 89d94d8635..a914374985 100644
--- a/modules/gdscript/gdscript_utility_functions.cpp
+++ b/modules/gdscript/gdscript_utility_functions.cpp
@@ -545,7 +545,7 @@ struct GDScriptUtilityFunctionsDefinitions {
};
struct GDScriptUtilityFunctionInfo {
- GDScriptUtilityFunctions::FunctionPtr function;
+ GDScriptUtilityFunctions::FunctionPtr function = nullptr;
MethodInfo info;
bool is_constant = false;
};
diff --git a/modules/navigation/navigation_mesh_generator.cpp b/modules/navigation/navigation_mesh_generator.cpp
index 9e2daf3a99..2d6c78f704 100644
--- a/modules/navigation/navigation_mesh_generator.cpp
+++ b/modules/navigation/navigation_mesh_generator.cpp
@@ -34,7 +34,6 @@
#include "core/math/convex_hull.h"
#include "core/os/thread.h"
-#include "scene/3d/collision_shape_3d.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/multimesh_instance_3d.h"
#include "scene/3d/physics_body_3d.h"
@@ -202,14 +201,17 @@ void NavigationMeshGenerator::_parse_geometry(const Transform3D &p_navmesh_trans
StaticBody3D *static_body = Object::cast_to<StaticBody3D>(p_node);
if (static_body->get_collision_layer() & p_collision_mask) {
- for (int i = 0; i < p_node->get_child_count(); ++i) {
- Node *child = p_node->get_child(i);
- if (Object::cast_to<CollisionShape3D>(child)) {
- CollisionShape3D *col_shape = Object::cast_to<CollisionShape3D>(child);
-
- Transform3D transform = p_navmesh_transform * static_body->get_global_transform() * col_shape->get_transform();
+ List<uint32_t> shape_owners;
+ static_body->get_shape_owners(&shape_owners);
+ for (uint32_t shape_owner : shape_owners) {
+ const int shape_count = static_body->shape_owner_get_shape_count(shape_owner);
+ for (int i = 0; i < shape_count; i++) {
+ Ref<Shape3D> s = static_body->shape_owner_get_shape(shape_owner, i);
+ if (s.is_null()) {
+ continue;
+ }
- Ref<Shape3D> s = col_shape->get_shape();
+ const Transform3D transform = p_navmesh_transform * static_body->get_global_transform() * static_body->shape_owner_get_transform(shape_owner);
BoxShape3D *box = Object::cast_to<BoxShape3D>(*s);
if (box) {
diff --git a/modules/noise/noise.cpp b/modules/noise/noise.cpp
index ad3df0a016..d14b63f7c8 100644
--- a/modules/noise/noise.cpp
+++ b/modules/noise/noise.cpp
@@ -31,6 +31,8 @@
#include "noise.h"
Ref<Image> Noise::get_seamless_image(int p_width, int p_height, bool p_invert, bool p_in_3d_space, real_t p_blend_skirt) const {
+ ERR_FAIL_COND_V(p_width <= 0 || p_height <= 0, Ref<Image>());
+
int skirt_width = p_width * p_blend_skirt;
int skirt_height = p_height * p_blend_skirt;
int src_width = p_width + skirt_width;
@@ -55,6 +57,8 @@ uint8_t Noise::_alpha_blend<uint8_t>(uint8_t p_bg, uint8_t p_fg, int p_alpha) co
}
Ref<Image> Noise::get_image(int p_width, int p_height, bool p_invert, bool p_in_3d_space) const {
+ ERR_FAIL_COND_V(p_width <= 0 || p_height <= 0, Ref<Image>());
+
Vector<uint8_t> data;
data.resize(p_width * p_height);
diff --git a/modules/openxr/extensions/openxr_vulkan_extension.h b/modules/openxr/extensions/openxr_vulkan_extension.h
index cf55ae264f..1e34fe1f80 100644
--- a/modules/openxr/extensions/openxr_vulkan_extension.h
+++ b/modules/openxr/extensions/openxr_vulkan_extension.h
@@ -78,11 +78,11 @@ private:
bool check_graphics_api_support(XrVersion p_desired_version);
- VkInstance vulkan_instance;
- VkPhysicalDevice vulkan_physical_device;
- VkDevice vulkan_device;
- uint32_t vulkan_queue_family_index;
- uint32_t vulkan_queue_index;
+ VkInstance vulkan_instance = nullptr;
+ VkPhysicalDevice vulkan_physical_device = nullptr;
+ VkDevice vulkan_device = nullptr;
+ uint32_t vulkan_queue_family_index = 0;
+ uint32_t vulkan_queue_index = 0;
XrResult xrGetVulkanGraphicsRequirements2KHR(XrInstance p_instance, XrSystemId p_system_id, XrGraphicsRequirementsVulkanKHR *p_graphics_requirements);
XrResult xrCreateVulkanInstanceKHR(XrInstance p_instance, const XrVulkanInstanceCreateInfoKHR *p_create_info, VkInstance *r_vulkan_instance, VkResult *r_vulkan_result);
diff --git a/modules/openxr/openxr_api.h b/modules/openxr/openxr_api.h
index 57475944c0..702f6b9b1d 100644
--- a/modules/openxr/openxr_api.h
+++ b/modules/openxr/openxr_api.h
@@ -104,9 +104,9 @@ private:
// state
XrInstance instance = XR_NULL_HANDLE;
- XrSystemId system_id;
+ XrSystemId system_id = 0;
String system_name;
- uint32_t vendor_id;
+ uint32_t vendor_id = 0;
XrSystemTrackingProperties tracking_properties;
XrSession session = XR_NULL_HANDLE;
XrSessionState session_state = XR_SESSION_STATE_UNKNOWN;
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index 437fbe76ab..8e0bedd8f6 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -878,8 +878,8 @@ _FORCE_INLINE_ TextServerAdvanced::FontTexturePosition TextServerAdvanced::find_
struct MSContext {
msdfgen::Point2 position;
- msdfgen::Shape *shape;
- msdfgen::Contour *contour;
+ msdfgen::Shape *shape = nullptr;
+ msdfgen::Contour *contour = nullptr;
};
class DistancePixelConversion {
diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp
index d84e9e581a..8ae56aa64d 100644
--- a/modules/text_server_fb/text_server_fb.cpp
+++ b/modules/text_server_fb/text_server_fb.cpp
@@ -322,8 +322,8 @@ _FORCE_INLINE_ TextServerFallback::FontTexturePosition TextServerFallback::find_
struct MSContext {
msdfgen::Point2 position;
- msdfgen::Shape *shape;
- msdfgen::Contour *contour;
+ msdfgen::Shape *shape = nullptr;
+ msdfgen::Contour *contour = nullptr;
};
class DistancePixelConversion {
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index 6fa7313fad..8fce85679f 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -99,7 +99,7 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback {
Ref<ImageTexture> texture;
- AudioMixCallback mix_callback;
+ AudioMixCallback mix_callback = nullptr;
void *mix_udata = nullptr;
bool paused = false;
diff --git a/modules/visual_script/editor/visual_script_property_selector.h b/modules/visual_script/editor/visual_script_property_selector.h
index 1b32ee2967..90a6265ab7 100644
--- a/modules/visual_script/editor/visual_script_property_selector.h
+++ b/modules/visual_script/editor/visual_script_property_selector.h
@@ -173,8 +173,8 @@ class VisualScriptPropertySelector::SearchRunner : public RefCounted {
Control *ui_service = nullptr;
Tree *results_tree = nullptr;
String term;
- int search_flags;
- int scope_flags;
+ int search_flags = 0;
+ int scope_flags = 0;
Ref<Texture2D> empty_icon;
Color disabled_color;
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 7e2df23618..5320f99b7c 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -1180,8 +1180,8 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
class VisualScriptNodeInstanceBuiltinFunc : public VisualScriptNodeInstance {
public:
- VisualScriptBuiltinFunc *node;
- VisualScriptInstance *instance;
+ VisualScriptBuiltinFunc *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
VisualScriptBuiltinFunc::BuiltinFunc func;
diff --git a/modules/visual_script/visual_script_expression.cpp b/modules/visual_script/visual_script_expression.cpp
index bd36a9ceec..e0f6436094 100644
--- a/modules/visual_script/visual_script_expression.cpp
+++ b/modules/visual_script/visual_script_expression.cpp
@@ -1299,8 +1299,8 @@ bool VisualScriptExpression::_compile_expression() {
class VisualScriptNodeInstanceExpression : public VisualScriptNodeInstance {
public:
- VisualScriptInstance *instance;
- VisualScriptExpression *expression;
+ VisualScriptInstance *instance = nullptr;
+ VisualScriptExpression *expression = nullptr;
//virtual int get_working_memory_size() const override { return 0; }
//execute by parsing the tree directly
diff --git a/modules/visual_script/visual_script_flow_control.cpp b/modules/visual_script/visual_script_flow_control.cpp
index 7946d96b29..0e63753720 100644
--- a/modules/visual_script/visual_script_flow_control.cpp
+++ b/modules/visual_script/visual_script_flow_control.cpp
@@ -119,9 +119,9 @@ void VisualScriptReturn::_bind_methods() {
class VisualScriptNodeInstanceReturn : public VisualScriptNodeInstance {
public:
- VisualScriptReturn *node;
- VisualScriptInstance *instance;
- bool with_value;
+ VisualScriptReturn *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
+ bool with_value = false;
virtual int get_working_memory_size() const override { return 1; }
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
@@ -213,8 +213,8 @@ void VisualScriptCondition::_bind_methods() {
class VisualScriptNodeInstanceCondition : public VisualScriptNodeInstance {
public:
- VisualScriptCondition *node;
- VisualScriptInstance *instance;
+ VisualScriptCondition *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
//virtual int get_working_memory_size() const override { return 1; }
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
@@ -293,8 +293,8 @@ void VisualScriptWhile::_bind_methods() {
class VisualScriptNodeInstanceWhile : public VisualScriptNodeInstance {
public:
- VisualScriptWhile *node;
- VisualScriptInstance *instance;
+ VisualScriptWhile *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
//virtual int get_working_memory_size() const override { return 1; }
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
@@ -376,8 +376,8 @@ void VisualScriptIterator::_bind_methods() {
class VisualScriptNodeInstanceIterator : public VisualScriptNodeInstance {
public:
- VisualScriptIterator *node;
- VisualScriptInstance *instance;
+ VisualScriptIterator *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
virtual int get_working_memory_size() const override { return 2; }
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
@@ -508,9 +508,9 @@ void VisualScriptSequence::_bind_methods() {
class VisualScriptNodeInstanceSequence : public VisualScriptNodeInstance {
public:
- VisualScriptSequence *node;
- VisualScriptInstance *instance;
- int steps;
+ VisualScriptSequence *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
+ int steps = 0;
virtual int get_working_memory_size() const override { return 1; }
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
@@ -596,8 +596,8 @@ String VisualScriptSwitch::get_text() const {
class VisualScriptNodeInstanceSwitch : public VisualScriptNodeInstance {
public:
- VisualScriptInstance *instance;
- int case_count;
+ VisualScriptInstance *instance = nullptr;
+ int case_count = 0;
//virtual int get_working_memory_size() const override { return 0; }
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
@@ -774,7 +774,7 @@ VisualScriptTypeCast::TypeGuess VisualScriptTypeCast::guess_output_type(TypeGues
class VisualScriptNodeInstanceTypeCast : public VisualScriptNodeInstance {
public:
- VisualScriptInstance *instance;
+ VisualScriptInstance *instance = nullptr;
StringName base_type;
String script;
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index 5cc9236a9a..483fc8b6c3 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -720,15 +720,15 @@ class VisualScriptNodeInstanceFunctionCall : public VisualScriptNodeInstance {
public:
VisualScriptFunctionCall::CallMode call_mode;
NodePath node_path;
- int input_args;
- bool validate;
- int returns;
+ int input_args = 0;
+ bool validate = false;
+ int returns = 0;
VisualScriptFunctionCall::RPCCallMode rpc_mode;
StringName function;
StringName singleton;
- VisualScriptFunctionCall *node;
- VisualScriptInstance *instance;
+ VisualScriptFunctionCall *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
//virtual int get_working_memory_size() const override { return 0; }
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
@@ -1462,11 +1462,11 @@ public:
NodePath node_path;
StringName property;
- VisualScriptPropertySet *node;
- VisualScriptInstance *instance;
+ VisualScriptPropertySet *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
VisualScriptPropertySet::AssignOp assign_op;
StringName index;
- bool needs_get;
+ bool needs_get = false;
//virtual int get_working_memory_size() const override { return 0; }
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
@@ -2152,8 +2152,8 @@ public:
StringName property;
StringName index;
- VisualScriptPropertyGet *node;
- VisualScriptInstance *instance;
+ VisualScriptPropertyGet *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
switch (call_mode) {
@@ -2362,9 +2362,9 @@ void VisualScriptEmitSignal::_bind_methods() {
class VisualScriptNodeInstanceEmitSignal : public VisualScriptNodeInstance {
public:
- VisualScriptEmitSignal *node;
- VisualScriptInstance *instance;
- int argcount;
+ VisualScriptEmitSignal *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
+ int argcount = 0;
StringName name;
//virtual int get_working_memory_size() const override { return 0; }
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 6e10b72013..dbbe74f3d5 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -271,8 +271,8 @@ Multiplayer::RPCMode VisualScriptFunction::get_rpc_mode() const {
class VisualScriptNodeInstanceFunction : public VisualScriptNodeInstance {
public:
- VisualScriptFunction *node;
- VisualScriptInstance *instance;
+ VisualScriptFunction *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
//virtual int get_working_memory_size() const override { return 0; }
@@ -1097,7 +1097,7 @@ void VisualScriptOperator::_bind_methods() {
class VisualScriptNodeInstanceOperator : public VisualScriptNodeInstance {
public:
- bool unary;
+ bool unary = false;
Variant::Operator op;
//virtual int get_working_memory_size() const override { return 0; }
@@ -1328,8 +1328,8 @@ void VisualScriptVariableGet::_bind_methods() {
class VisualScriptNodeInstanceVariableGet : public VisualScriptNodeInstance {
public:
- VisualScriptVariableGet *node;
- VisualScriptInstance *instance;
+ VisualScriptVariableGet *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
StringName variable;
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
@@ -1438,8 +1438,8 @@ void VisualScriptVariableSet::_bind_methods() {
class VisualScriptNodeInstanceVariableSet : public VisualScriptNodeInstance {
public:
- VisualScriptVariableSet *node;
- VisualScriptInstance *instance;
+ VisualScriptVariableSet *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
StringName variable;
//virtual int get_working_memory_size() const override { return 0; }
@@ -1851,8 +1851,7 @@ int VisualScriptGlobalConstant::get_global_constant() {
class VisualScriptNodeInstanceGlobalConstant : public VisualScriptNodeInstance {
public:
- int index;
- //virtual int get_working_memory_size() const override { return 0; }
+ int index = 0;
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
*p_outputs[0] = CoreConstants::get_global_constant_value(index);
@@ -1963,9 +1962,8 @@ StringName VisualScriptClassConstant::get_base_type() {
class VisualScriptNodeInstanceClassConstant : public VisualScriptNodeInstance {
public:
- int value;
- bool valid;
- //virtual int get_working_memory_size() const override { return 0; }
+ int value = 0;
+ bool valid = false;
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
if (!valid) {
@@ -2098,8 +2096,7 @@ Variant::Type VisualScriptBasicTypeConstant::get_basic_type() const {
class VisualScriptNodeInstanceBasicTypeConstant : public VisualScriptNodeInstance {
public:
Variant value;
- bool valid;
- //virtual int get_working_memory_size() const override { return 0; }
+ bool valid = false;
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
if (!valid) {
@@ -2227,8 +2224,7 @@ VisualScriptMathConstant::MathConstant VisualScriptMathConstant::get_math_consta
class VisualScriptNodeInstanceMathConstant : public VisualScriptNodeInstance {
public:
- float value;
- //virtual int get_working_memory_size() const override { return 0; }
+ float value = 0.0f;
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
*p_outputs[0] = value;
@@ -2320,7 +2316,7 @@ String VisualScriptEngineSingleton::get_singleton() {
class VisualScriptNodeInstanceEngineSingleton : public VisualScriptNodeInstance {
public:
- Object *singleton;
+ Object *singleton = nullptr;
//virtual int get_working_memory_size() const override { return 0; }
@@ -2429,8 +2425,8 @@ NodePath VisualScriptSceneNode::get_node_path() {
class VisualScriptNodeInstanceSceneNode : public VisualScriptNodeInstance {
public:
- VisualScriptSceneNode *node;
- VisualScriptInstance *instance;
+ VisualScriptSceneNode *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
NodePath path;
//virtual int get_working_memory_size() const override { return 0; }
@@ -2610,8 +2606,8 @@ String VisualScriptSceneTree::get_caption() const {
class VisualScriptNodeInstanceSceneTree : public VisualScriptNodeInstance {
public:
- VisualScriptSceneTree *node;
- VisualScriptInstance *instance;
+ VisualScriptSceneTree *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
//virtual int get_working_memory_size() const override { return 0; }
@@ -2779,7 +2775,7 @@ String VisualScriptSelf::get_caption() const {
class VisualScriptNodeInstanceSelf : public VisualScriptNodeInstance {
public:
- VisualScriptInstance *instance;
+ VisualScriptInstance *instance = nullptr;
//virtual int get_working_memory_size() const override { return 0; }
@@ -2965,11 +2961,11 @@ String VisualScriptCustomNode::get_category() const {
class VisualScriptNodeInstanceCustomNode : public VisualScriptNodeInstance {
public:
- VisualScriptInstance *instance;
- VisualScriptCustomNode *node;
- int in_count;
- int out_count;
- int work_mem_size;
+ VisualScriptInstance *instance = nullptr;
+ VisualScriptCustomNode *node = nullptr;
+ int in_count = 0;
+ int out_count = 0;
+ int work_mem_size = 0;
virtual int get_working_memory_size() const override { return work_mem_size; }
virtual int step(const Variant **p_inputs, Variant **p_outputs, StartMode p_start_mode, Variant *p_working_mem, Callable::CallError &r_error, String &r_error_str) override {
@@ -3161,10 +3157,10 @@ String VisualScriptSubCall::get_category() const {
class VisualScriptNodeInstanceSubCall : public VisualScriptNodeInstance {
public:
- VisualScriptInstance *instance;
- VisualScriptSubCall *subcall;
- int input_args;
- bool valid;
+ VisualScriptInstance *instance = nullptr;
+ VisualScriptSubCall *subcall = nullptr;
+ int input_args = 0;
+ bool valid = false;
//virtual int get_working_memory_size() const override { return 0; }
@@ -3281,7 +3277,7 @@ String VisualScriptComment::get_category() const {
class VisualScriptNodeInstanceComment : public VisualScriptNodeInstance {
public:
- VisualScriptInstance *instance;
+ VisualScriptInstance *instance = nullptr;
//virtual int get_working_memory_size() const override { return 0; }
@@ -3380,9 +3376,9 @@ Dictionary VisualScriptConstructor::get_constructor() const {
class VisualScriptNodeInstanceConstructor : public VisualScriptNodeInstance {
public:
- VisualScriptInstance *instance;
+ VisualScriptInstance *instance = nullptr;
Variant::Type type;
- int argcount;
+ int argcount = 0;
//virtual int get_working_memory_size() const override { return 0; }
@@ -3497,7 +3493,7 @@ Variant::Type VisualScriptLocalVar::get_var_type() const {
class VisualScriptNodeInstanceLocalVar : public VisualScriptNodeInstance {
public:
- VisualScriptInstance *instance;
+ VisualScriptInstance *instance = nullptr;
StringName name;
virtual int get_working_memory_size() const override { return 1; }
@@ -3604,7 +3600,7 @@ Variant::Type VisualScriptLocalVarSet::get_var_type() const {
class VisualScriptNodeInstanceLocalVarSet : public VisualScriptNodeInstance {
public:
- VisualScriptInstance *instance;
+ VisualScriptInstance *instance = nullptr;
StringName name;
virtual int get_working_memory_size() const override { return 1; }
@@ -3728,7 +3724,7 @@ VisualScriptInputAction::Mode VisualScriptInputAction::get_action_mode() const {
class VisualScriptNodeInstanceInputAction : public VisualScriptNodeInstance {
public:
- VisualScriptInstance *instance;
+ VisualScriptInstance *instance = nullptr;
StringName action;
VisualScriptInputAction::Mode mode;
@@ -3906,7 +3902,7 @@ Array VisualScriptDeconstruct::_get_elem_cache() const {
class VisualScriptNodeInstanceDeconstruct : public VisualScriptNodeInstance {
public:
- VisualScriptInstance *instance;
+ VisualScriptInstance *instance = nullptr;
Vector<StringName> outputs;
//virtual int get_working_memory_size() const override { return 0; }
diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp
index e6e7f79d1f..96e91a0baf 100644
--- a/modules/visual_script/visual_script_yield_nodes.cpp
+++ b/modules/visual_script/visual_script_yield_nodes.cpp
@@ -93,7 +93,7 @@ String VisualScriptYield::get_text() const {
class VisualScriptNodeInstanceYield : public VisualScriptNodeInstance {
public:
VisualScriptYield::YieldMode mode;
- double wait_time;
+ double wait_time = 0.0;
virtual int get_working_memory_size() const override { return 1; } //yield needs at least 1
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
@@ -500,11 +500,11 @@ class VisualScriptNodeInstanceYieldSignal : public VisualScriptNodeInstance {
public:
VisualScriptYieldSignal::CallMode call_mode;
NodePath node_path;
- int output_args;
+ int output_args = 0;
StringName signal;
- VisualScriptYieldSignal *node;
- VisualScriptInstance *instance;
+ VisualScriptYieldSignal *node = nullptr;
+ VisualScriptInstance *instance = nullptr;
virtual int get_working_memory_size() const override { return 1; }
//virtual bool is_output_port_unsequenced(int p_idx) const { return false; }
diff --git a/modules/websocket/wsl_client.cpp b/modules/websocket/wsl_client.cpp
index 58c329f043..6f0b726f5c 100644
--- a/modules/websocket/wsl_client.cpp
+++ b/modules/websocket/wsl_client.cpp
@@ -103,13 +103,14 @@ bool WSLClient::_verify_headers(String &r_protocol) {
String s = (char *)_resp_buf;
Vector<String> psa = s.split("\r\n");
int len = psa.size();
- ERR_FAIL_COND_V_MSG(len < 4, false, "Not enough response headers, got: " + itos(len) + ", expected >= 4.");
+ ERR_FAIL_COND_V_MSG(len < 4, false, "Not enough response headers. Got: " + itos(len) + ", expected >= 4.");
Vector<String> req = psa[0].split(" ", false);
- ERR_FAIL_COND_V_MSG(req.size() < 2, false, "Invalid protocol or status code.");
+ ERR_FAIL_COND_V_MSG(req.size() < 2, false, "Invalid protocol or status code. Got '" + psa[0] + "', expected 'HTTP/1.1 101'.");
// Wrong protocol
- ERR_FAIL_COND_V_MSG(req[0] != "HTTP/1.1" || req[1] != "101", false, "Invalid protocol or status code.");
+ ERR_FAIL_COND_V_MSG(req[0] != "HTTP/1.1", false, "Invalid protocol. Got: '" + req[0] + "', expected 'HTTP/1.1'.");
+ ERR_FAIL_COND_V_MSG(req[1] != "101", false, "Invalid status code. Got: '" + req[1] + "', expected '101'.");
Map<String, String> headers;
for (int i = 1; i < len; i++) {
@@ -137,9 +138,11 @@ bool WSLClient::_verify_headers(String &r_protocol) {
#undef WSL_CHECK
if (_protocols.size() == 0) {
// We didn't request a custom protocol
- ERR_FAIL_COND_V(headers.has("sec-websocket-protocol"), false);
+ ERR_FAIL_COND_V_MSG(headers.has("sec-websocket-protocol"), false, "Received unrequested sub-protocol -> " + headers["sec-websocket-protocol"]);
} else {
- ERR_FAIL_COND_V(!headers.has("sec-websocket-protocol"), false);
+ // We requested at least one custom protocol but didn't receive one
+ ERR_FAIL_COND_V_MSG(!headers.has("sec-websocket-protocol"), false, "Requested sub-protocol(s) but received none.");
+ // Check received sub-protocol was one of those requested.
r_protocol = headers["sec-websocket-protocol"];
bool valid = false;
for (int i = 0; i < _protocols.size(); i++) {
@@ -150,6 +153,7 @@ bool WSLClient::_verify_headers(String &r_protocol) {
break;
}
if (!valid) {
+ ERR_FAIL_V_MSG(false, "Received unrequested sub-protocol -> " + r_protocol);
return false;
}
}
diff --git a/modules/websocket/wsl_client.h b/modules/websocket/wsl_client.h
index 22b3a4f373..04af83f28c 100644
--- a/modules/websocket/wsl_client.h
+++ b/modules/websocket/wsl_client.h
@@ -63,7 +63,7 @@ private:
String _key;
String _host;
- uint16_t _port;
+ uint16_t _port = 0;
Array _ip_candidates;
Vector<String> _protocols;
bool _use_ssl = false;
diff --git a/platform/android/display_server_android.cpp b/platform/android/display_server_android.cpp
index 2eb7056a36..d414ea5824 100644
--- a/platform/android/display_server_android.cpp
+++ b/platform/android/display_server_android.cpp
@@ -136,6 +136,18 @@ bool DisplayServerAndroid::clipboard_has() const {
}
}
+Array DisplayServerAndroid::get_display_cutouts() const {
+ GodotIOJavaWrapper *godot_io_java = OS_Android::get_singleton()->get_godot_io_java();
+ ERR_FAIL_NULL_V(godot_io_java, Array());
+ return godot_io_java->get_display_cutouts();
+}
+
+Rect2i DisplayServerAndroid::get_display_safe_area() const {
+ GodotIOJavaWrapper *godot_io_java = OS_Android::get_singleton()->get_godot_io_java();
+ ERR_FAIL_NULL_V(godot_io_java, Rect2i());
+ return godot_io_java->get_display_safe_area();
+}
+
void DisplayServerAndroid::screen_set_keep_on(bool p_enable) {
GodotJavaWrapper *godot_java = OS_Android::get_singleton()->get_godot_java();
ERR_FAIL_COND(!godot_java);
@@ -177,11 +189,8 @@ Size2i DisplayServerAndroid::screen_get_size(int p_screen) const {
}
Rect2i DisplayServerAndroid::screen_get_usable_rect(int p_screen) const {
- GodotIOJavaWrapper *godot_io_java = OS_Android::get_singleton()->get_godot_io_java();
- ERR_FAIL_COND_V(!godot_io_java, Rect2i());
- int xywh[4];
- godot_io_java->screen_get_usable_rect(xywh);
- return Rect2i(xywh[0], xywh[1], xywh[2], xywh[3]);
+ Size2i display_size = OS_Android::get_singleton()->get_display_size();
+ return Rect2i(0, 0, display_size.width, display_size.height);
}
int DisplayServerAndroid::screen_get_dpi(int p_screen) const {
diff --git a/platform/android/display_server_android.h b/platform/android/display_server_android.h
index 2604214ac0..65bf2ec1a8 100644
--- a/platform/android/display_server_android.h
+++ b/platform/android/display_server_android.h
@@ -104,6 +104,9 @@ public:
virtual String clipboard_get() const override;
virtual bool clipboard_has() const override;
+ virtual Array get_display_cutouts() const override;
+ virtual Rect2i get_display_safe_area() const override;
+
virtual void screen_set_keep_on(bool p_enable) override;
virtual bool screen_is_kept_on() const override;
diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp
index 8cfa3a67b9..d357cd586e 100644
--- a/platform/android/export/export_plugin.cpp
+++ b/platform/android/export/export_plugin.cpp
@@ -1000,16 +1000,23 @@ void EditorExportPlatformAndroid::_fix_manifest(const Ref<EditorExportPreset> &p
}
}
- if (tname == "meta-data" && attrname == "name" && value == "xr_hand_tracking_metadata_name") {
- if (xr_mode_index == XR_MODE_OPENXR && hand_tracking_index > XR_HAND_TRACKING_NONE) {
+ // Hand tracking related configurations
+ if (xr_mode_index == XR_MODE_OPENXR && hand_tracking_index > XR_HAND_TRACKING_NONE) {
+ if (tname == "meta-data" && attrname == "name" && value == "xr_hand_tracking_metadata_name") {
string_table.write[attr_value] = "com.oculus.handtracking.frequency";
}
- }
- if (tname == "meta-data" && attrname == "value" && value == "xr_hand_tracking_metadata_value") {
- if (xr_mode_index == XR_MODE_OPENXR && hand_tracking_index > XR_HAND_TRACKING_NONE) {
+ if (tname == "meta-data" && attrname == "value" && value == "xr_hand_tracking_metadata_value") {
string_table.write[attr_value] = (hand_tracking_frequency_index == XR_HAND_TRACKING_FREQUENCY_LOW ? "LOW" : "HIGH");
}
+
+ if (tname == "meta-data" && attrname == "name" && value == "xr_hand_tracking_version_name") {
+ string_table.write[attr_value] = "com.oculus.handtracking.version";
+ }
+
+ if (tname == "meta-data" && attrname == "name" && value == "xr_hand_tracking_version_value") {
+ string_table.write[attr_value] = "V2.0";
+ }
}
iofs += 20;
diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp
index 173bb8bcb7..d9574a1a52 100644
--- a/platform/android/export/gradle_export_util.cpp
+++ b/platform/android/export/gradle_export_util.cpp
@@ -279,6 +279,7 @@ String _get_application_tag(const Ref<EditorExportPreset> &p_preset, bool p_has_
" android:requestLegacyExternalStorage=\"%s\"\n"
" tools:replace=\"android:allowBackup,android:isGame,android:hasFragileUserData,android:requestLegacyExternalStorage\"\n"
" tools:ignore=\"GoogleAppIndexingWarning\">\n\n"
+ " <meta-data tools:node=\"remove\" android:name=\"xr_hand_tracking_version_name\" />\n"
" <meta-data tools:node=\"remove\" android:name=\"xr_hand_tracking_metadata_name\" />\n",
bool_to_string(p_preset->get("user_data_backup/allow")),
bool_to_string(p_preset->get("package/classify_as_game")),
@@ -293,6 +294,7 @@ String _get_application_tag(const Ref<EditorExportPreset> &p_preset, bool p_has_
manifest_application_text += vformat(
" <meta-data tools:node=\"replace\" android:name=\"com.oculus.handtracking.frequency\" android:value=\"%s\" />\n",
hand_tracking_frequency);
+ manifest_application_text += " <meta-data tools:node=\"replace\" android:name=\"com.oculus.handtracking.version\" android:value=\"V2.0\" />\n";
}
} else {
manifest_application_text += " <meta-data tools:node=\"remove\" android:name=\"com.oculus.supportedDevices\" />\n";
diff --git a/platform/android/java/app/AndroidManifest.xml b/platform/android/java/app/AndroidManifest.xml
index 4c4501729d..c98e8f1d55 100644
--- a/platform/android/java/app/AndroidManifest.xml
+++ b/platform/android/java/app/AndroidManifest.xml
@@ -40,6 +40,13 @@
android:name="xr_hand_tracking_metadata_name"
android:value="xr_hand_tracking_metadata_value"/>
+ <!-- XR hand tracking version -->
+ <!-- This is modified by the exporter based on the selected xr mode. DO NOT CHANGE the values here. -->
+ <!-- Removed at export time if the xr mode is not VR or hand tracking is disabled. -->
+ <meta-data
+ android:name="xr_hand_tracking_version_name"
+ android:value="xr_hand_tracking_version_value"/>
+
<!-- Supported Meta devices -->
<!-- This is removed by the exporter if the xr mode is not VR. -->
<meta-data
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
index e8e292df5d..b69d25dd8b 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
@@ -38,6 +38,7 @@ import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.AssetManager;
import android.graphics.Point;
+import android.graphics.Rect;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
@@ -51,6 +52,7 @@ import android.view.DisplayCutout;
import android.view.WindowInsets;
import java.io.IOException;
+import java.util.List;
import java.util.Locale;
// Wrapper for native library
@@ -238,7 +240,7 @@ public class GodotIO {
return fallback;
}
- public int[] screenGetUsableRect() {
+ public int[] getDisplaySafeArea() {
DisplayMetrics metrics = activity.getResources().getDisplayMetrics();
Display display = activity.getWindowManager().getDefaultDisplay();
Point size = new Point();
@@ -260,6 +262,25 @@ public class GodotIO {
return result;
}
+ public int[] getDisplayCutouts() {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P)
+ return new int[0];
+ DisplayCutout cutout = activity.getWindow().getDecorView().getRootWindowInsets().getDisplayCutout();
+ if (cutout == null)
+ return new int[0];
+ List<Rect> rects = cutout.getBoundingRects();
+ int cutouts = rects.size();
+ int[] result = new int[cutouts * 4];
+ int index = 0;
+ for (Rect rect : rects) {
+ result[index++] = rect.left;
+ result[index++] = rect.top;
+ result[index++] = rect.width();
+ result[index++] = rect.height();
+ }
+ return result;
+ }
+
public void showKeyboard(String p_existing_text, boolean p_multiline, int p_max_input_length, int p_cursor_start, int p_cursor_end) {
if (edit != null)
edit.showKeyboard(p_existing_text, p_multiline, p_max_input_length, p_cursor_start, p_cursor_end);
diff --git a/platform/android/java_godot_io_wrapper.cpp b/platform/android/java_godot_io_wrapper.cpp
index 5b21e696c3..7ae3a65105 100644
--- a/platform/android/java_godot_io_wrapper.cpp
+++ b/platform/android/java_godot_io_wrapper.cpp
@@ -31,6 +31,8 @@
#include "java_godot_io_wrapper.h"
#include "core/error/error_list.h"
+#include "core/math/rect2.h"
+#include "core/variant/variant.h"
// JNIEnv is only valid within the thread it belongs to, in a multi threading environment
// we can't cache it.
@@ -51,12 +53,13 @@ GodotIOJavaWrapper::GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instanc
_open_URI = p_env->GetMethodID(cls, "openURI", "(Ljava/lang/String;)I");
_get_cache_dir = p_env->GetMethodID(cls, "getCacheDir", "()Ljava/lang/String;");
_get_data_dir = p_env->GetMethodID(cls, "getDataDir", "()Ljava/lang/String;");
+ _get_display_cutouts = p_env->GetMethodID(cls, "getDisplayCutouts", "()[I"),
+ _get_display_safe_area = p_env->GetMethodID(cls, "getDisplaySafeArea", "()[I"),
_get_locale = p_env->GetMethodID(cls, "getLocale", "()Ljava/lang/String;");
_get_model = p_env->GetMethodID(cls, "getModel", "()Ljava/lang/String;");
_get_screen_DPI = p_env->GetMethodID(cls, "getScreenDPI", "()I");
_get_scaled_density = p_env->GetMethodID(cls, "getScaledDensity", "()F");
_get_screen_refresh_rate = p_env->GetMethodID(cls, "getScreenRefreshRate", "(D)D");
- _screen_get_usable_rect = p_env->GetMethodID(cls, "screenGetUsableRect", "()[I"),
_get_unique_id = p_env->GetMethodID(cls, "getUniqueID", "()Ljava/lang/String;");
_show_keyboard = p_env->GetMethodID(cls, "showKeyboard", "(Ljava/lang/String;ZIII)V");
_hide_keyboard = p_env->GetMethodID(cls, "hideKeyboard", "()V");
@@ -162,18 +165,38 @@ float GodotIOJavaWrapper::get_screen_refresh_rate(float fallback) {
return fallback;
}
-void GodotIOJavaWrapper::screen_get_usable_rect(int (&p_rect_xywh)[4]) {
- if (_screen_get_usable_rect) {
- JNIEnv *env = get_jni_env();
- ERR_FAIL_COND(env == nullptr);
- jintArray returnArray = (jintArray)env->CallObjectMethod(godot_io_instance, _screen_get_usable_rect);
- ERR_FAIL_COND(env->GetArrayLength(returnArray) != 4);
- jint *arrayBody = env->GetIntArrayElements(returnArray, JNI_FALSE);
- for (int i = 0; i < 4; i++) {
- p_rect_xywh[i] = arrayBody[i];
- }
- env->ReleaseIntArrayElements(returnArray, arrayBody, 0);
+Array GodotIOJavaWrapper::get_display_cutouts() {
+ Array result;
+ ERR_FAIL_NULL_V(_get_display_cutouts, result);
+ JNIEnv *env = get_jni_env();
+ ERR_FAIL_NULL_V(env, result);
+ jintArray returnArray = (jintArray)env->CallObjectMethod(godot_io_instance, _get_display_cutouts);
+ jint arrayLength = env->GetArrayLength(returnArray);
+ jint *arrayBody = env->GetIntArrayElements(returnArray, JNI_FALSE);
+ int cutouts = arrayLength / 4;
+ for (int i = 0; i < cutouts; i++) {
+ int x = arrayBody[i * 4];
+ int y = arrayBody[i * 4 + 1];
+ int width = arrayBody[i * 4 + 2];
+ int height = arrayBody[i * 4 + 3];
+ Rect2 cutout(x, y, width, height);
+ result.append(cutout);
}
+ env->ReleaseIntArrayElements(returnArray, arrayBody, 0);
+ return result;
+}
+
+Rect2i GodotIOJavaWrapper::get_display_safe_area() {
+ Rect2i result;
+ ERR_FAIL_NULL_V(_get_display_safe_area, result);
+ JNIEnv *env = get_jni_env();
+ ERR_FAIL_NULL_V(env, result);
+ jintArray returnArray = (jintArray)env->CallObjectMethod(godot_io_instance, _get_display_safe_area);
+ ERR_FAIL_COND_V(env->GetArrayLength(returnArray) != 4, result);
+ jint *arrayBody = env->GetIntArrayElements(returnArray, JNI_FALSE);
+ result = Rect2i(arrayBody[0], arrayBody[1], arrayBody[2], arrayBody[3]);
+ env->ReleaseIntArrayElements(returnArray, arrayBody, 0);
+ return result;
}
String GodotIOJavaWrapper::get_unique_id() {
diff --git a/platform/android/java_godot_io_wrapper.h b/platform/android/java_godot_io_wrapper.h
index 08e3092afd..02c57130ab 100644
--- a/platform/android/java_godot_io_wrapper.h
+++ b/platform/android/java_godot_io_wrapper.h
@@ -37,6 +37,8 @@
#include <android/log.h>
#include <jni.h>
+#include "core/math/rect2i.h"
+#include "core/variant/array.h"
#include "string_android.h"
// Class that makes functions in java/src/org/godotengine/godot/GodotIO.java callable from C++
@@ -48,12 +50,13 @@ private:
jmethodID _open_URI = 0;
jmethodID _get_cache_dir = 0;
jmethodID _get_data_dir = 0;
+ jmethodID _get_display_cutouts = 0;
+ jmethodID _get_display_safe_area = 0;
jmethodID _get_locale = 0;
jmethodID _get_model = 0;
jmethodID _get_screen_DPI = 0;
jmethodID _get_scaled_density = 0;
jmethodID _get_screen_refresh_rate = 0;
- jmethodID _screen_get_usable_rect = 0;
jmethodID _get_unique_id = 0;
jmethodID _show_keyboard = 0;
jmethodID _hide_keyboard = 0;
@@ -75,7 +78,8 @@ public:
int get_screen_dpi();
float get_scaled_density();
float get_screen_refresh_rate(float fallback);
- void screen_get_usable_rect(int (&p_rect_xywh)[4]);
+ Array get_display_cutouts();
+ Rect2i get_display_safe_area();
String get_unique_id();
bool has_vk();
void show_vk(const String &p_existing, bool p_multiline, int p_max_input_length, int p_cursor_start, int p_cursor_end);
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index fc46005b41..25daf1ca90 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -162,9 +162,14 @@ Vector<String> OS_Android::get_granted_permissions() const {
return godot_java->get_granted_permissions();
}
-Error OS_Android::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
+Error OS_Android::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) {
p_library_handle = dlopen(p_path.utf8().get_data(), RTLD_NOW);
ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ", error: " + dlerror() + ".");
+
+ if (r_resolved_path != nullptr) {
+ *r_resolved_path = p_path;
+ }
+
return OK;
}
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index a40e17dc2c..f86c5b5212 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -90,7 +90,7 @@ public:
virtual void alert(const String &p_alert, const String &p_title) override;
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) override;
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) override;
virtual String get_name() const override;
virtual MainLoop *get_main_loop() const override;
diff --git a/platform/iphone/display_server_iphone.h b/platform/iphone/display_server_iphone.h
index 6ae190b81a..7af222e3f8 100644
--- a/platform/iphone/display_server_iphone.h
+++ b/platform/iphone/display_server_iphone.h
@@ -134,6 +134,8 @@ public:
virtual void tts_resume() override;
virtual void tts_stop() override;
+ virtual Rect2i get_display_safe_area() const override;
+
virtual int get_screen_count() const override;
virtual Point2i screen_get_position(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
virtual Size2i screen_get_size(int p_screen = SCREEN_OF_MAIN_WINDOW) const override;
diff --git a/platform/iphone/display_server_iphone.mm b/platform/iphone/display_server_iphone.mm
index ec58ab195a..573ee9b7a8 100644
--- a/platform/iphone/display_server_iphone.mm
+++ b/platform/iphone/display_server_iphone.mm
@@ -360,6 +360,22 @@ void DisplayServerIPhone::tts_stop() {
[tts stopSpeaking];
}
+Rect2i DisplayServerIPhone::get_display_safe_area() const {
+ if (@available(iOS 11, *)) {
+ UIEdgeInsets insets = UIEdgeInsetsZero;
+ UIView *view = AppDelegate.viewController.godotView;
+ if ([view respondsToSelector:@selector(safeAreaInsets)]) {
+ insets = [view safeAreaInsets];
+ }
+ float scale = screen_get_scale();
+ Size2i insets_position = Size2i(insets.left, insets.top) * scale;
+ Size2i insets_size = Size2i(insets.left + insets.right, insets.top + insets.bottom) * scale;
+ return Rect2i(screen_get_position() + insets_position, screen_get_size() - insets_size);
+ } else {
+ return Rect2i(screen_get_position(), screen_get_size());
+ }
+}
+
int DisplayServerIPhone::get_screen_count() const {
return 1;
}
@@ -379,22 +395,7 @@ Size2i DisplayServerIPhone::screen_get_size(int p_screen) const {
}
Rect2i DisplayServerIPhone::screen_get_usable_rect(int p_screen) const {
- if (@available(iOS 11, *)) {
- UIEdgeInsets insets = UIEdgeInsetsZero;
- UIView *view = AppDelegate.viewController.godotView;
-
- if ([view respondsToSelector:@selector(safeAreaInsets)]) {
- insets = [view safeAreaInsets];
- }
-
- float scale = screen_get_scale(p_screen);
- Size2i insets_position = Size2i(insets.left, insets.top) * scale;
- Size2i insets_size = Size2i(insets.left + insets.right, insets.top + insets.bottom) * scale;
-
- return Rect2i(screen_get_position(p_screen) + insets_position, screen_get_size(p_screen) - insets_size);
- } else {
- return Rect2i(screen_get_position(p_screen), screen_get_size(p_screen));
- }
+ return Rect2i(screen_get_position(p_screen), screen_get_size(p_screen));
}
int DisplayServerIPhone::screen_get_dpi(int p_screen) const {
diff --git a/platform/iphone/export/export_plugin.h b/platform/iphone/export/export_plugin.h
index 3831f3bff2..2c6faed691 100644
--- a/platform/iphone/export/export_plugin.h
+++ b/platform/iphone/export/export_plugin.h
@@ -53,8 +53,6 @@
class EditorExportPlatformIOS : public EditorExportPlatform {
GDCLASS(EditorExportPlatformIOS, EditorExportPlatform);
- int version_code;
-
Ref<ImageTexture> logo;
// Plugins
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index 6a61f3a910..d03403bbb4 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -92,7 +92,7 @@ public:
virtual void alert(const String &p_alert, const String &p_title = "ALERT!") override;
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) override;
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) override;
virtual Error close_dynamic_library(void *p_library_handle) override;
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) override;
diff --git a/platform/iphone/os_iphone.mm b/platform/iphone/os_iphone.mm
index f7974c4b3d..95b06b728e 100644
--- a/platform/iphone/os_iphone.mm
+++ b/platform/iphone/os_iphone.mm
@@ -204,12 +204,17 @@ void OSIPhone::finalize() {
// MARK: Dynamic Libraries
-Error OSIPhone::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
+Error OSIPhone::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) {
if (p_path.length() == 0) {
p_library_handle = RTLD_SELF;
+
+ if (r_resolved_path != nullptr) {
+ *r_resolved_path = p_path;
+ }
+
return OK;
}
- return OS_Unix::open_dynamic_library(p_path, p_library_handle, p_also_set_library_path);
+ return OS_Unix::open_dynamic_library(p_path, p_library_handle, p_also_set_library_path, r_resolved_path);
}
Error OSIPhone::close_dynamic_library(void *p_library_handle) {
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index da88ea18b0..79c2b2fefb 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -221,10 +221,15 @@ bool OS_JavaScript::is_userfs_persistent() const {
return idb_available;
}
-Error OS_JavaScript::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
+Error OS_JavaScript::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) {
String path = p_path.get_file();
p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ". Error: " + dlerror());
+
+ if (r_resolved_path != nullptr) {
+ *r_resolved_path = path;
+ }
+
return OK;
}
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 9e272f9aa1..09497ebc5d 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -99,7 +99,7 @@ public:
void alert(const String &p_alert, const String &p_title = "ALERT!") override;
- Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) override;
+ Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) override;
void resume_audio();
diff --git a/platform/linuxbsd/detect_prime_x11.cpp b/platform/linuxbsd/detect_prime_x11.cpp
index 63531d33fa..42b7f68a5e 100644
--- a/platform/linuxbsd/detect_prime_x11.cpp
+++ b/platform/linuxbsd/detect_prime_x11.cpp
@@ -55,7 +55,7 @@
typedef GLXContext (*GLXCREATECONTEXTATTRIBSARBPROC)(Display *, GLXFBConfig, GLXContext, Bool, const int *);
struct vendor {
- const char *glxvendor;
+ const char *glxvendor = nullptr;
int priority = 0;
};
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index 027f8562eb..f0b3cfc5d3 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -4531,24 +4531,11 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
r_error = OK;
- current_cursor = CURSOR_ARROW;
- mouse_mode = MOUSE_MODE_VISIBLE;
-
for (int i = 0; i < CURSOR_MAX; i++) {
cursors[i] = None;
img[i] = nullptr;
}
- xmbstring = nullptr;
-
- last_click_ms = 0;
- last_click_button_index = MouseButton::NONE;
- last_click_pos = Point2i(-100, -100);
-
- last_timestamp = 0;
- last_mouse_pos_valid = false;
- last_keyrelease_time = 0;
-
XInitThreads(); //always use threads
/** XLIB INITIALIZATION **/
@@ -4583,8 +4570,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
const char *err;
- xrr_get_monitors = nullptr;
- xrr_free_monitors = nullptr;
int xrandr_major = 0;
int xrandr_minor = 0;
int event_base, error_base;
@@ -4660,11 +4645,10 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
XFree(imvalret);
}
- /* Atorm internment */
+ /* Atom internment */
wm_delete = XInternAtom(x11_display, "WM_DELETE_WINDOW", true);
- //Set Xdnd (drag & drop) support
+ // Set Xdnd (drag & drop) support.
xdnd_aware = XInternAtom(x11_display, "XdndAware", False);
- xdnd_version = 5;
xdnd_enter = XInternAtom(x11_display, "XdndEnter", False);
xdnd_position = XInternAtom(x11_display, "XdndPosition", False);
xdnd_status = XInternAtom(x11_display, "XdndStatus", False);
@@ -4751,11 +4735,7 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
driver_found = true;
- // gl_manager->set_use_vsync(current_videomode.use_vsync);
-
if (true) {
- // if (RasterizerGLES3::is_viable() == OK) {
- // RasterizerGLES3::register_config();
RasterizerGLES3::make_current();
} else {
memdelete(gl_manager);
@@ -4930,12 +4910,6 @@ DisplayServerX11::DisplayServerX11(const String &p_rendering_driver, WindowMode
}
cursor_set_shape(CURSOR_BUSY);
- requested = None;
-
- /*if (p_desired.layered) {
- set_window_per_pixel_transparency_enabled(true);
- }*/
-
XEvent xevent;
while (XPending(x11_display) > 0) {
XNextEvent(x11_display, &xevent);
diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h
index 3d49886b94..5d5d01ed8d 100644
--- a/platform/linuxbsd/display_server_x11.h
+++ b/platform/linuxbsd/display_server_x11.h
@@ -100,8 +100,8 @@ class DisplayServerX11 : public DisplayServer {
Atom xdnd_finished;
Atom xdnd_selection;
Atom xdnd_aware;
- Atom requested;
- int xdnd_version;
+ Atom requested = None;
+ int xdnd_version = 5;
#if defined(GLES3_ENABLED)
GLManager_X11 *gl_manager = nullptr;
@@ -174,21 +174,21 @@ class DisplayServerX11 : public DisplayServer {
String internal_clipboard;
String internal_clipboard_primary;
- Window xdnd_source_window;
+ Window xdnd_source_window = 0;
::Display *x11_display;
char *xmbstring = nullptr;
- int xmblen;
- unsigned long last_timestamp;
- ::Time last_keyrelease_time;
+ int xmblen = 0;
+ unsigned long last_timestamp = 0;
+ ::Time last_keyrelease_time = 0;
::XIM xim;
::XIMStyle xim_style;
static void _xim_destroy_callback(::XIM im, ::XPointer client_data,
::XPointer call_data);
Point2i last_mouse_pos;
- bool last_mouse_pos_valid;
- Point2i last_click_pos;
- uint64_t last_click_ms;
+ bool last_mouse_pos_valid = false;
+ Point2i last_click_pos = Point2i(-100, -100);
+ uint64_t last_click_ms = 0;
MouseButton last_click_button_index = MouseButton::NONE;
MouseButton last_button_state = MouseButton::NONE;
bool app_focused = false;
@@ -221,7 +221,7 @@ class DisplayServerX11 : public DisplayServer {
void _get_key_modifier_state(unsigned int p_x11_state, Ref<InputEventWithModifiers> state);
void _flush_mouse_motion();
- MouseMode mouse_mode;
+ MouseMode mouse_mode = MOUSE_MODE_VISIBLE;
Point2i center;
void _handle_key_event(WindowID p_window, XKeyEvent *p_event, LocalVector<XEvent> &p_events, uint32_t &p_event_index, bool p_echo = false);
@@ -233,30 +233,26 @@ class DisplayServerX11 : public DisplayServer {
String _clipboard_get(Atom p_source, Window x11_window) const;
void _clipboard_transfer_ownership(Atom p_source, Window x11_window) const;
- //bool minimized;
- //bool window_has_focus;
- bool do_mouse_warp;
+ bool do_mouse_warp = false;
- const char *cursor_theme;
- int cursor_size;
+ const char *cursor_theme = nullptr;
+ int cursor_size = 0;
XcursorImage *img[CURSOR_MAX];
Cursor cursors[CURSOR_MAX];
Cursor null_cursor;
- CursorShape current_cursor;
+ CursorShape current_cursor = CURSOR_ARROW;
Map<CursorShape, Vector<Variant>> cursors_cache;
- bool layered_window;
+ bool layered_window = false;
String rendering_driver;
- //bool window_focused;
- //void set_wm_border(bool p_enabled);
void set_wm_fullscreen(bool p_enabled);
void set_wm_above(bool p_enabled);
typedef xrr_monitor_info *(*xrr_get_monitors_t)(Display *dpy, Window window, Bool get_active, int *nmonitors);
typedef void (*xrr_free_monitors_t)(xrr_monitor_info *monitors);
- xrr_get_monitors_t xrr_get_monitors;
- xrr_free_monitors_t xrr_free_monitors;
+ xrr_get_monitors_t xrr_get_monitors = nullptr;
+ xrr_free_monitors_t xrr_free_monitors = nullptr;
void *xrandr_handle = nullptr;
Bool xrandr_ext_ok;
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 53c5c8bd90..e4ec411c96 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -80,7 +80,7 @@ public:
virtual void alert(const String &p_alert, const String &p_title = "ALERT!") override;
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) override;
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) override;
virtual MainLoop *get_main_loop() const override;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 33fee01c08..a8fa56e34b 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -150,7 +150,7 @@ void OS_OSX::alert(const String &p_alert, const String &p_title) {
}
}
-Error OS_OSX::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
+Error OS_OSX::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) {
String path = get_framework_executable(p_path);
if (!FileAccess::exists(path)) {
@@ -165,6 +165,11 @@ Error OS_OSX::open_dynamic_library(const String p_path, void *&p_library_handle,
p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ", error: " + dlerror() + ".");
+
+ if (r_resolved_path != nullptr) {
+ *r_resolved_path = path;
+ }
+
return OK;
}
diff --git a/platform/uwp/export/app_packager.h b/platform/uwp/export/app_packager.h
index a32b78bf04..ea42e9bdfe 100644
--- a/platform/uwp/export/app_packager.h
+++ b/platform/uwp/export/app_packager.h
@@ -93,8 +93,8 @@ class AppxPackager {
Vector<FileMeta> file_metadata;
- ZPOS64_T central_dir_offset;
- ZPOS64_T end_of_central_dir_offset;
+ ZPOS64_T central_dir_offset = 0;
+ ZPOS64_T end_of_central_dir_offset = 0;
Vector<uint8_t> central_dir_data;
String hash_block(const uint8_t *p_block_data, size_t p_block_len);
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 22a54911f9..5ce045eb20 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -733,10 +733,15 @@ static String format_error_message(DWORD id) {
return msg;
}
-Error OS_UWP::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
+Error OS_UWP::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) {
String full_path = "game/" + p_path;
p_library_handle = (void *)LoadPackagedLibrary((LPCWSTR)(full_path.utf16().get_data()), 0);
ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + full_path + ", error: " + format_error_message(GetLastError()) + ".");
+
+ if (r_resolved_path != nullptr) {
+ *r_resolved_path = full_path;
+ }
+
return OK;
}
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index f955be1da9..709bf16bec 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -233,7 +233,7 @@ public:
virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2(), bool p_multiline = false, int p_max_input_length = -1, int p_cursor_start = -1, int p_cursor_end = -1);
virtual void hide_virtual_keyboard();
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false);
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr);
virtual Error close_dynamic_library(void *p_library_handle);
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false);
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 8755bc65dc..6b4e455197 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -202,7 +202,7 @@ Error OS_Windows::get_entropy(uint8_t *r_buffer, int p_bytes) {
return OK;
}
-Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
+Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path, String *r_resolved_path) {
String path = p_path.replace("/", "\\");
if (!FileAccess::exists(path)) {
@@ -230,6 +230,10 @@ Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_han
remove_dll_directory(cookie);
}
+ if (r_resolved_path != nullptr) {
+ *r_resolved_path = path;
+ }
+
return OK;
}
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 370cb77fde..81cc7c3fc1 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -108,7 +108,7 @@ public:
virtual Error get_entropy(uint8_t *r_buffer, int p_bytes) override;
- virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false) override;
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false, String *r_resolved_path = nullptr) override;
virtual Error close_dynamic_library(void *p_library_handle) override;
virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional = false) override;
diff --git a/scene/2d/area_2d.h b/scene/2d/area_2d.h
index 68047ccebf..a42e7722b0 100644
--- a/scene/2d/area_2d.h
+++ b/scene/2d/area_2d.h
@@ -49,7 +49,7 @@ public:
private:
SpaceOverride gravity_space_override = SPACE_OVERRIDE_DISABLED;
Vector2 gravity_vec;
- real_t gravity;
+ real_t gravity = 0.0;
bool gravity_is_point = false;
real_t gravity_distance_scale = 0.0;
diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h
index 7ae51e3966..51d58723b4 100644
--- a/scene/2d/cpu_particles_2d.h
+++ b/scene/2d/cpu_particles_2d.h
@@ -137,7 +137,7 @@ private:
real_t randomness_ratio = 0.0;
double lifetime_randomness = 0.0;
double speed_scale = 1.0;
- bool local_coords;
+ bool local_coords = false;
int fixed_fps = 0;
bool fractional_delta = true;
diff --git a/scene/2d/gpu_particles_2d.cpp b/scene/2d/gpu_particles_2d.cpp
index 04518dff97..35f1ae5421 100644
--- a/scene/2d/gpu_particles_2d.cpp
+++ b/scene/2d/gpu_particles_2d.cpp
@@ -666,9 +666,6 @@ GPUParticles2D::GPUParticles2D() {
set_speed_scale(1);
set_fixed_fps(30);
set_collision_base_size(collision_base_size);
-#ifdef TOOLS_ENABLED
- show_visibility_rect = false;
-#endif
}
GPUParticles2D::~GPUParticles2D() {
diff --git a/scene/2d/gpu_particles_2d.h b/scene/2d/gpu_particles_2d.h
index 852270dd3c..3c7f4cd9b5 100644
--- a/scene/2d/gpu_particles_2d.h
+++ b/scene/2d/gpu_particles_2d.h
@@ -47,20 +47,20 @@ public:
private:
RID particles;
- bool one_shot;
- int amount;
- double lifetime;
- double pre_process_time;
- real_t explosiveness_ratio;
- real_t randomness_ratio;
- double speed_scale;
+ bool one_shot = false;
+ int amount = 0;
+ double lifetime = 0.0;
+ double pre_process_time = 0.0;
+ real_t explosiveness_ratio = 0.0;
+ real_t randomness_ratio = 0.0;
+ double speed_scale = 0.0;
Rect2 visibility_rect;
- bool local_coords;
- int fixed_fps;
- bool fractional_delta;
+ bool local_coords = false;
+ int fixed_fps = 0;
+ bool fractional_delta = false;
bool interpolate = true;
#ifdef TOOLS_ENABLED
- bool show_visibility_rect;
+ bool show_visibility_rect = false;
#endif
Ref<Material> process_material;
diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp
index c4e57b375d..14188d7120 100644
--- a/scene/2d/light_occluder_2d.cpp
+++ b/scene/2d/light_occluder_2d.cpp
@@ -285,7 +285,6 @@ void LightOccluder2D::_bind_methods() {
LightOccluder2D::LightOccluder2D() {
occluder = RS::get_singleton()->canvas_light_occluder_create();
- mask = 1;
set_notify_transform(true);
set_as_sdf_collision(true);
diff --git a/scene/2d/light_occluder_2d.h b/scene/2d/light_occluder_2d.h
index 4f8c6d20df..4acfeaf781 100644
--- a/scene/2d/light_occluder_2d.h
+++ b/scene/2d/light_occluder_2d.h
@@ -81,10 +81,9 @@ class LightOccluder2D : public Node2D {
GDCLASS(LightOccluder2D, Node2D);
RID occluder;
- bool enabled;
- int mask;
+ int mask = 1;
Ref<OccluderPolygon2D> occluder_polygon;
- bool sdf_collision;
+ bool sdf_collision = false;
void _poly_changed();
protected:
diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h
index 2fb6fab91c..1447e25e8c 100644
--- a/scene/2d/navigation_agent_2d.h
+++ b/scene/2d/navigation_agent_2d.h
@@ -45,17 +45,17 @@ class NavigationAgent2D : public Node {
uint32_t navigable_layers = 1;
real_t target_desired_distance = 1.0;
- real_t radius;
- real_t neighbor_dist;
- int max_neighbors;
- real_t time_horizon;
- real_t max_speed;
+ real_t radius = 0.0;
+ real_t neighbor_dist = 0.0;
+ int max_neighbors = 0;
+ real_t time_horizon = 0.0;
+ real_t max_speed = 0.0;
real_t path_max_distance = 3.0;
Vector2 target_location;
Vector<Vector2> navigation_path;
- int nav_path_index;
+ int nav_path_index = 0;
bool velocity_submitted = false;
Vector2 prev_safe_velocity;
/// The submitted target velocity
@@ -63,7 +63,7 @@ class NavigationAgent2D : public Node {
bool target_reached = false;
bool navigation_finished = true;
// No initialized on purpose
- uint32_t update_frame_id;
+ uint32_t update_frame_id = 0;
protected:
static void _bind_methods();
diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp
index 261d371dc4..3cc9f3f2c4 100644
--- a/scene/2d/navigation_region_2d.cpp
+++ b/scene/2d/navigation_region_2d.cpp
@@ -387,6 +387,10 @@ uint32_t NavigationRegion2D::get_layers() const {
return NavigationServer2D::get_singleton()->region_get_layers(region);
}
+RID NavigationRegion2D::get_region_rid() const {
+ return region;
+}
+
/////////////////////////////
#ifdef TOOLS_ENABLED
Rect2 NavigationRegion2D::_edit_get_rect() const {
@@ -534,6 +538,8 @@ void NavigationRegion2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_layers", "layers"), &NavigationRegion2D::set_layers);
ClassDB::bind_method(D_METHOD("get_layers"), &NavigationRegion2D::get_layers);
+ ClassDB::bind_method(D_METHOD("get_region_rid"), &NavigationRegion2D::get_region_rid);
+
ClassDB::bind_method(D_METHOD("_navpoly_changed"), &NavigationRegion2D::_navpoly_changed);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "navpoly", PROPERTY_HINT_RESOURCE_TYPE, "NavigationPolygon"), "set_navigation_polygon", "get_navigation_polygon");
diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_region_2d.h
index 487a578401..3c4a4e81d9 100644
--- a/scene/2d/navigation_region_2d.h
+++ b/scene/2d/navigation_region_2d.h
@@ -117,6 +117,8 @@ public:
void set_layers(uint32_t p_layers);
uint32_t get_layers() const;
+ RID get_region_rid() const;
+
void set_navigation_polygon(const Ref<NavigationPolygon> &p_navpoly);
Ref<NavigationPolygon> get_navigation_polygon() const;
diff --git a/scene/3d/area_3d.h b/scene/3d/area_3d.h
index c2399985ff..31ded00fb7 100644
--- a/scene/3d/area_3d.h
+++ b/scene/3d/area_3d.h
@@ -49,7 +49,7 @@ public:
private:
SpaceOverride gravity_space_override = SPACE_OVERRIDE_DISABLED;
Vector3 gravity_vec;
- real_t gravity;
+ real_t gravity = 0.0;
bool gravity_is_point = false;
real_t gravity_distance_scale = 0.0;
@@ -228,4 +228,4 @@ public:
VARIANT_ENUM_CAST(Area3D::SpaceOverride);
-#endif // AREA__H
+#endif // AREA_3D_H
diff --git a/scene/3d/cpu_particles_3d.h b/scene/3d/cpu_particles_3d.h
index 521b6c615e..7f225ee98d 100644
--- a/scene/3d/cpu_particles_3d.h
+++ b/scene/3d/cpu_particles_3d.h
@@ -174,9 +174,9 @@ private:
Vector<Color> emission_colors;
int emission_point_count = 0;
Vector3 emission_ring_axis;
- real_t emission_ring_height;
- real_t emission_ring_radius;
- real_t emission_ring_inner_radius;
+ real_t emission_ring_height = 0.0;
+ real_t emission_ring_radius = 0.0;
+ real_t emission_ring_inner_radius = 0.0;
Ref<Curve> scale_curve_x;
Ref<Curve> scale_curve_y;
diff --git a/scene/3d/gpu_particles_3d.h b/scene/3d/gpu_particles_3d.h
index f3eb52d124..adce45a0a9 100644
--- a/scene/3d/gpu_particles_3d.h
+++ b/scene/3d/gpu_particles_3d.h
@@ -61,16 +61,16 @@ private:
RID particles;
bool one_shot;
- int amount;
- double lifetime;
- double pre_process_time;
- real_t explosiveness_ratio;
- real_t randomness_ratio;
- double speed_scale;
+ int amount = 0;
+ double lifetime = 0.0;
+ double pre_process_time = 0.0;
+ real_t explosiveness_ratio = 0.0;
+ real_t randomness_ratio = 0.0;
+ double speed_scale = 0.0;
AABB visibility_aabb;
- bool local_coords;
- int fixed_fps;
- bool fractional_delta;
+ bool local_coords = false;
+ int fixed_fps = 0;
+ bool fractional_delta = false;
bool interpolate = true;
NodePath sub_emitter;
real_t collision_base_size = 0.01;
diff --git a/scene/3d/label_3d.cpp b/scene/3d/label_3d.cpp
index 3750249d59..9375190151 100644
--- a/scene/3d/label_3d.cpp
+++ b/scene/3d/label_3d.cpp
@@ -69,6 +69,12 @@ void Label3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_uppercase", "enable"), &Label3D::set_uppercase);
ClassDB::bind_method(D_METHOD("is_uppercase"), &Label3D::is_uppercase);
+ ClassDB::bind_method(D_METHOD("set_render_priority", "priority"), &Label3D::set_render_priority);
+ ClassDB::bind_method(D_METHOD("get_render_priority"), &Label3D::get_render_priority);
+
+ ClassDB::bind_method(D_METHOD("set_outline_render_priority", "priority"), &Label3D::set_outline_render_priority);
+ ClassDB::bind_method(D_METHOD("get_outline_render_priority"), &Label3D::get_outline_render_priority);
+
ClassDB::bind_method(D_METHOD("set_font", "font"), &Label3D::set_font);
ClassDB::bind_method(D_METHOD("get_font"), &Label3D::get_font);
@@ -126,6 +132,8 @@ void Label3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "alpha_cut", PROPERTY_HINT_ENUM, "Disabled,Discard,Opaque Pre-Pass"), "set_alpha_cut_mode", "get_alpha_cut_mode");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "alpha_scissor_threshold", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_alpha_scissor_threshold", "get_alpha_scissor_threshold");
ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Nearest Mipmap,Linear Mipmap,Nearest Mipmap Anisotropic,Linear Mipmap Anisotropic"), "set_texture_filter", "get_texture_filter");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "render_priority", PROPERTY_HINT_RANGE, itos(RS::MATERIAL_RENDER_PRIORITY_MIN) + "," + itos(RS::MATERIAL_RENDER_PRIORITY_MAX) + ",1"), "set_render_priority", "get_render_priority");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "outline_render_priority", PROPERTY_HINT_RANGE, itos(RS::MATERIAL_RENDER_PRIORITY_MIN) + "," + itos(RS::MATERIAL_RENDER_PRIORITY_MAX) + ",1"), "set_outline_render_priority", "get_outline_render_priority");
ADD_GROUP("Text", "");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "modulate"), "set_modulate", "get_modulate");
@@ -580,13 +588,13 @@ void Label3D::_shape() {
// Outline surfaces.
Vector2 ol_offset = offset;
for (int j = 0; j < gl_size; j++) {
- _generate_glyph_surfaces(glyphs[j], ol_offset, outline_modulate, -1, outline_size);
+ _generate_glyph_surfaces(glyphs[j], ol_offset, outline_modulate, outline_render_priority, outline_size);
}
}
// Main text surfaces.
for (int j = 0; j < gl_size; j++) {
- _generate_glyph_surfaces(glyphs[j], offset, modulate, 0);
+ _generate_glyph_surfaces(glyphs[j], offset, modulate, render_priority);
}
offset.y -= (TS->shaped_text_get_descent(lines_rid[i]) + line_spacing + font->get_spacing(TextServer::SPACING_BOTTOM)) * pixel_size;
}
@@ -732,6 +740,30 @@ bool Label3D::is_uppercase() const {
return uppercase;
}
+void Label3D::set_render_priority(int p_priority) {
+ ERR_FAIL_COND(p_priority < RS::MATERIAL_RENDER_PRIORITY_MIN || p_priority > RS::MATERIAL_RENDER_PRIORITY_MAX);
+ if (render_priority != p_priority) {
+ render_priority = p_priority;
+ _queue_update();
+ }
+}
+
+int Label3D::get_render_priority() const {
+ return render_priority;
+}
+
+void Label3D::set_outline_render_priority(int p_priority) {
+ ERR_FAIL_COND(p_priority < RS::MATERIAL_RENDER_PRIORITY_MIN || p_priority > RS::MATERIAL_RENDER_PRIORITY_MAX);
+ if (outline_render_priority != p_priority) {
+ outline_render_priority = p_priority;
+ _queue_update();
+ }
+}
+
+int Label3D::get_outline_render_priority() const {
+ return outline_render_priority;
+}
+
void Label3D::_font_changed() {
dirty_font = true;
_queue_update();
diff --git a/scene/3d/label_3d.h b/scene/3d/label_3d.h
index 22a99987ef..86b8faa617 100644
--- a/scene/3d/label_3d.h
+++ b/scene/3d/label_3d.h
@@ -98,6 +98,8 @@ private:
Ref<Font> font_override;
Color modulate = Color(1, 1, 1, 1);
Point2 lbl_offset;
+ int outline_render_priority = -1;
+ int render_priority = 0;
int outline_size = 0;
Color outline_modulate = Color(0, 0, 0, 1);
@@ -150,6 +152,12 @@ public:
void set_vertical_alignment(VerticalAlignment p_alignment);
VerticalAlignment get_vertical_alignment() const;
+ void set_render_priority(int p_priority);
+ int get_render_priority() const;
+
+ void set_outline_render_priority(int p_priority);
+ int get_outline_render_priority() const;
+
void set_text(const String &p_string);
String get_text() const;
diff --git a/scene/3d/navigation_agent_3d.h b/scene/3d/navigation_agent_3d.h
index f4afebb36e..283b99a24f 100644
--- a/scene/3d/navigation_agent_3d.h
+++ b/scene/3d/navigation_agent_3d.h
@@ -45,19 +45,19 @@ class NavigationAgent3D : public Node {
uint32_t navigable_layers = 1;
real_t target_desired_distance = 1.0;
- real_t radius;
+ real_t radius = 0.0;
real_t navigation_height_offset = 0.0;
- bool ignore_y;
- real_t neighbor_dist;
- int max_neighbors;
- real_t time_horizon;
- real_t max_speed;
+ bool ignore_y = false;
+ real_t neighbor_dist = 0.0;
+ int max_neighbors = 0;
+ real_t time_horizon = 0.0;
+ real_t max_speed = 0.0;
real_t path_max_distance = 3.0;
Vector3 target_location;
Vector<Vector3> navigation_path;
- int nav_path_index;
+ int nav_path_index = 0;
bool velocity_submitted = false;
Vector3 prev_safe_velocity;
/// The submitted target velocity
@@ -65,7 +65,7 @@ class NavigationAgent3D : public Node {
bool target_reached = false;
bool navigation_finished = true;
// No initialized on purpose
- uint32_t update_frame_id;
+ uint32_t update_frame_id = 0;
protected:
static void _bind_methods();
diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp
index 215e18869a..7f6ecbebb7 100644
--- a/scene/3d/navigation_region_3d.cpp
+++ b/scene/3d/navigation_region_3d.cpp
@@ -73,6 +73,10 @@ uint32_t NavigationRegion3D::get_layers() const {
return NavigationServer3D::get_singleton()->region_get_layers(region);
}
+RID NavigationRegion3D::get_region_rid() const {
+ return region;
+}
+
/////////////////////////////
void NavigationRegion3D::_notification(int p_what) {
@@ -198,6 +202,8 @@ void NavigationRegion3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_layers", "layers"), &NavigationRegion3D::set_layers);
ClassDB::bind_method(D_METHOD("get_layers"), &NavigationRegion3D::get_layers);
+ ClassDB::bind_method(D_METHOD("get_region_rid"), &NavigationRegion3D::get_region_rid);
+
ClassDB::bind_method(D_METHOD("bake_navigation_mesh"), &NavigationRegion3D::bake_navigation_mesh);
ClassDB::bind_method(D_METHOD("_bake_finished", "nav_mesh"), &NavigationRegion3D::_bake_finished);
diff --git a/scene/3d/navigation_region_3d.h b/scene/3d/navigation_region_3d.h
index 1a50bb5f64..1c559bc31a 100644
--- a/scene/3d/navigation_region_3d.h
+++ b/scene/3d/navigation_region_3d.h
@@ -57,6 +57,8 @@ public:
void set_layers(uint32_t p_layers);
uint32_t get_layers() const;
+ RID get_region_rid() const;
+
void set_navigation_mesh(const Ref<NavigationMesh> &p_navmesh);
Ref<NavigationMesh> get_navigation_mesh() const;
diff --git a/scene/3d/skeleton_3d.h b/scene/3d/skeleton_3d.h
index f8c9fa2c96..ca706bea98 100644
--- a/scene/3d/skeleton_3d.h
+++ b/scene/3d/skeleton_3d.h
@@ -137,7 +137,7 @@ private:
bool animate_physical_bones = true;
Vector<Bone> bones;
- bool process_order_dirty;
+ bool process_order_dirty = false;
Vector<int> parentless_bones;
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 6a8fa9327c..223da13b71 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -134,6 +134,16 @@ Color SpriteBase3D::get_modulate() const {
return modulate;
}
+void SpriteBase3D::set_render_priority(int p_priority) {
+ ERR_FAIL_COND(p_priority < RS::MATERIAL_RENDER_PRIORITY_MIN || p_priority > RS::MATERIAL_RENDER_PRIORITY_MAX);
+ render_priority = p_priority;
+ _queue_update();
+}
+
+int SpriteBase3D::get_render_priority() const {
+ return render_priority;
+}
+
void SpriteBase3D::set_pixel_size(real_t p_amount) {
pixel_size = p_amount;
_queue_update();
@@ -295,6 +305,9 @@ void SpriteBase3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_modulate", "modulate"), &SpriteBase3D::set_modulate);
ClassDB::bind_method(D_METHOD("get_modulate"), &SpriteBase3D::get_modulate);
+ ClassDB::bind_method(D_METHOD("set_render_priority", "priority"), &SpriteBase3D::set_render_priority);
+ ClassDB::bind_method(D_METHOD("get_render_priority"), &SpriteBase3D::get_render_priority);
+
ClassDB::bind_method(D_METHOD("set_pixel_size", "pixel_size"), &SpriteBase3D::set_pixel_size);
ClassDB::bind_method(D_METHOD("get_pixel_size"), &SpriteBase3D::get_pixel_size);
@@ -335,6 +348,7 @@ void SpriteBase3D::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "fixed_size"), "set_draw_flag", "get_draw_flag", FLAG_FIXED_SIZE);
ADD_PROPERTY(PropertyInfo(Variant::INT, "alpha_cut", PROPERTY_HINT_ENUM, "Disabled,Discard,Opaque Pre-Pass"), "set_alpha_cut_mode", "get_alpha_cut_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Nearest Mipmap,Linear Mipmap,Nearest Mipmap Anisotropic,Linear Mipmap Anisotropic"), "set_texture_filter", "get_texture_filter");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "render_priority", PROPERTY_HINT_RANGE, itos(RS::MATERIAL_RENDER_PRIORITY_MIN) + "," + itos(RS::MATERIAL_RENDER_PRIORITY_MAX) + ",1"), "set_render_priority", "get_render_priority");
BIND_ENUM_CONSTANT(FLAG_TRANSPARENT);
BIND_ENUM_CONSTANT(FLAG_SHADED);
@@ -614,6 +628,10 @@ void Sprite3D::_draw() {
RS::get_singleton()->material_set_param(get_material(), "texture_albedo", texture->get_rid());
last_texture = texture->get_rid();
}
+ if (get_alpha_cut_mode() == ALPHA_CUT_DISABLED) {
+ RS::get_singleton()->material_set_render_priority(get_material(), get_render_priority());
+ RS::get_singleton()->mesh_surface_set_material(mesh, 0, get_material());
+ }
}
void Sprite3D::set_texture(const Ref<Texture2D> &p_texture) {
@@ -976,6 +994,10 @@ void AnimatedSprite3D::_draw() {
RS::get_singleton()->material_set_param(get_material(), "texture_albedo", texture->get_rid());
last_texture = texture->get_rid();
}
+ if (get_alpha_cut_mode() == ALPHA_CUT_DISABLED) {
+ RS::get_singleton()->material_set_render_priority(get_material(), get_render_priority());
+ RS::get_singleton()->mesh_surface_set_material(mesh, 0, get_material());
+ }
}
void AnimatedSprite3D::_validate_property(PropertyInfo &property) const {
diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h
index 047ed5a40d..028720a783 100644
--- a/scene/3d/sprite_3d.h
+++ b/scene/3d/sprite_3d.h
@@ -71,6 +71,7 @@ private:
bool vflip = false;
Color modulate = Color(1, 1, 1, 1);
+ int render_priority = 0;
Vector3::Axis axis = Vector3::AXIS_Z;
real_t pixel_size = 0.01;
@@ -100,10 +101,10 @@ protected:
uint32_t mesh_surface_offsets[RS::ARRAY_MAX];
PackedByteArray vertex_buffer;
PackedByteArray attribute_buffer;
- uint32_t vertex_stride;
- uint32_t attrib_stride;
- uint32_t skin_stride;
- uint32_t mesh_surface_format;
+ uint32_t vertex_stride = 0;
+ uint32_t attrib_stride = 0;
+ uint32_t skin_stride = 0;
+ uint32_t mesh_surface_format = 0;
void _queue_update();
@@ -120,6 +121,9 @@ public:
void set_flip_v(bool p_flip);
bool is_flipped_v() const;
+ void set_render_priority(int p_priority);
+ int get_render_priority() const;
+
void set_modulate(const Color &p_color);
Color get_modulate() const;
diff --git a/scene/3d/vehicle_body_3d.cpp b/scene/3d/vehicle_body_3d.cpp
index f5a451ca04..675cd1b172 100644
--- a/scene/3d/vehicle_body_3d.cpp
+++ b/scene/3d/vehicle_body_3d.cpp
@@ -40,7 +40,7 @@ public:
Vector3 m_0MinvJt;
Vector3 m_1MinvJt;
//Optimization: can be stored in the w/last component of one of the vectors
- real_t m_Adiag;
+ real_t m_Adiag = 0.0;
real_t getDiagonal() const { return m_Adiag; }
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 9bd1624e89..24fbc1e431 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -278,14 +278,15 @@ bool Tween::step(float p_delta) {
bool step_active = false;
total_time += rem_delta;
+#ifdef DEBUG_ENABLED
+ float initial_delta = rem_delta;
+ bool potential_infinite = false;
+#endif
+
while (rem_delta > 0 && running) {
float step_delta = rem_delta;
step_active = false;
-#ifdef DEBUG_ENABLED
- float prev_delta = rem_delta;
-#endif
-
for (Ref<Tweener> &tweener : tweeners.write[current_step]) {
// Modified inside Tweener.step().
float temp_delta = rem_delta;
@@ -310,17 +311,21 @@ bool Tween::step(float p_delta) {
emit_signal(SNAME("loop_finished"), loops_done);
current_step = 0;
start_tweeners();
+#ifdef DEBUG_ENABLED
+ if (loops <= 0 && Math::is_equal_approx(rem_delta, initial_delta)) {
+ if (!potential_infinite) {
+ potential_infinite = true;
+ } else {
+ // Looped twice without using any time, this is 100% certain infinite loop.
+ ERR_FAIL_V_MSG(false, "Infinite loop detected. Check set_loops() description for more info.");
+ }
+ }
+#endif
}
} else {
start_tweeners();
}
}
-
-#ifdef DEBUG_ENABLED
- if (Math::is_equal_approx(rem_delta, prev_delta) && running && loops <= 0) {
- ERR_FAIL_V_MSG(false, "Infinite loop detected. Check set_loops() description for more info.");
- }
-#endif
}
return true;
@@ -850,7 +855,7 @@ bool CallbackTweener::step(float &r_delta) {
Callable::CallError ce;
callback.call(nullptr, 0, result, ce);
if (ce.error != Callable::CallError::CALL_OK) {
- ERR_FAIL_V_MSG(false, "Error calling method from CallbackTweener: " + Variant::get_call_error_text(callback.get_object(), callback.get_method(), nullptr, 0, ce));
+ ERR_FAIL_V_MSG(false, "Error calling method from CallbackTweener: " + Variant::get_callable_error_text(callback, nullptr, 0, ce));
}
finished = true;
@@ -921,7 +926,7 @@ bool MethodTweener::step(float &r_delta) {
Callable::CallError ce;
callback.call(argptr, 1, result, ce);
if (ce.error != Callable::CallError::CALL_OK) {
- ERR_FAIL_V_MSG(false, "Error calling method from MethodTweener: " + Variant::get_call_error_text(callback.get_object(), callback.get_method(), argptr, 1, ce));
+ ERR_FAIL_V_MSG(false, "Error calling method from MethodTweener: " + Variant::get_callable_error_text(callback, argptr, 1, ce));
}
if (time < duration) {
diff --git a/scene/animation/tween.h b/scene/animation/tween.h
index 5c1567d510..40268405cf 100644
--- a/scene/animation/tween.h
+++ b/scene/animation/tween.h
@@ -116,6 +116,9 @@ private:
bool valid = false;
bool default_parallel = false;
bool parallel_enabled = false;
+#ifdef DEBUG_ENABLED
+ bool is_infinite = false;
+#endif
typedef real_t (*interpolater)(real_t t, real_t b, real_t c, real_t d);
static interpolater interpolaters[TRANS_MAX][EASE_MAX];
diff --git a/scene/gui/graph_edit.h b/scene/gui/graph_edit.h
index 18b9eeebd4..f556fcdd23 100644
--- a/scene/gui/graph_edit.h
+++ b/scene/gui/graph_edit.h
@@ -125,7 +125,7 @@ private:
VScrollBar *v_scroll = nullptr;
float port_grab_distance_horizontal = 0.0;
- float port_grab_distance_vertical;
+ float port_grab_distance_vertical = 0.0;
Ref<ViewPanner> panner;
bool warped_panning = true;
@@ -142,7 +142,7 @@ private:
bool connecting_target = false;
Vector2 connecting_to;
String connecting_target_to;
- int connecting_target_index;
+ int connecting_target_index = 0;
bool just_disconnected = false;
bool connecting_valid = false;
Vector2 click_pos;
@@ -155,8 +155,9 @@ private:
float zoom = 1.0;
float zoom_step = 1.2;
- float zoom_min;
- float zoom_max;
+ // Proper values set in constructor.
+ float zoom_min = 0.0;
+ float zoom_max = 0.0;
void _zoom_minus();
void _zoom_reset();
@@ -206,7 +207,7 @@ private:
Array _get_connection_list() const;
- bool lines_on_bg;
+ bool lines_on_bg = false;
struct ConnType {
union {
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 32882fbb68..c1e71c69a3 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -230,7 +230,6 @@ private:
Rect2 last_vp_rect;
bool transparent_bg = false;
- bool filter;
bool gen_mipmaps = false;
bool snap_controls_to_pixels = true;
diff --git a/scene/resources/canvas_item_material.h b/scene/resources/canvas_item_material.h
index e40e4392cb..b097d174f0 100644
--- a/scene/resources/canvas_item_material.h
+++ b/scene/resources/canvas_item_material.h
@@ -107,10 +107,10 @@ private:
LightMode light_mode = LIGHT_MODE_NORMAL;
bool particles_animation = false;
- // Initialized in the constructor.
- int particles_anim_h_frames;
- int particles_anim_v_frames;
- bool particles_anim_loop;
+ // Proper values set in constructor.
+ int particles_anim_h_frames = 0;
+ int particles_anim_v_frames = 0;
+ bool particles_anim_loop = false;
protected:
static void _bind_methods();
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 99e125f5b0..71150c2d23 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -449,36 +449,36 @@ private:
bool orm;
Color albedo;
- float specular;
- float metallic;
- float roughness;
+ float specular = 0.0f;
+ float metallic = 0.0f;
+ float roughness = 0.0f;
Color emission;
- float emission_energy;
- float normal_scale;
- float rim;
- float rim_tint;
- float clearcoat;
- float clearcoat_roughness;
- float anisotropy;
- float heightmap_scale;
- float subsurface_scattering_strength;
- float transmittance_amount;
+ float emission_energy = 0.0f;
+ float normal_scale = 0.0f;
+ float rim = 0.0f;
+ float rim_tint = 0.0f;
+ float clearcoat = 0.0f;
+ float clearcoat_roughness = 0.0f;
+ float anisotropy = 0.0f;
+ float heightmap_scale = 0.0f;
+ float subsurface_scattering_strength = 0.0f;
+ float transmittance_amount = 0.0f;
Color transmittance_color;
- float transmittance_depth;
- float transmittance_boost;
+ float transmittance_depth = 0.0f;
+ float transmittance_boost = 0.0f;
Color backlight;
- float refraction;
- float point_size;
- float alpha_scissor_threshold;
- float alpha_hash_scale;
- float alpha_antialiasing_edge;
+ float refraction = 0.0f;
+ float point_size = 0.0f;
+ float alpha_scissor_threshold = 0.0f;
+ float alpha_hash_scale = 0.0f;
+ float alpha_antialiasing_edge = 0.0f;
bool grow_enabled = false;
- float ao_light_affect;
- float grow;
- int particles_anim_h_frames;
- int particles_anim_v_frames;
- bool particles_anim_loop;
+ float ao_light_affect = 0.0f;
+ float grow = 0.0f;
+ int particles_anim_h_frames = 0;
+ int particles_anim_v_frames = 0;
+ bool particles_anim_loop = false;
Transparency transparency = TRANSPARENCY_DISABLED;
ShadingMode shading_mode = SHADING_MODE_PER_PIXEL;
@@ -486,29 +486,29 @@ private:
Vector3 uv1_scale;
Vector3 uv1_offset;
- float uv1_triplanar_sharpness;
+ float uv1_triplanar_sharpness = 0.0f;
Vector3 uv2_scale;
Vector3 uv2_offset;
- float uv2_triplanar_sharpness;
+ float uv2_triplanar_sharpness = 0.0f;
DetailUV detail_uv = DETAIL_UV_1;
bool deep_parallax = false;
- int deep_parallax_min_layers;
- int deep_parallax_max_layers;
+ int deep_parallax_min_layers = 0;
+ int deep_parallax_max_layers = 0;
bool heightmap_parallax_flip_tangent = false;
bool heightmap_parallax_flip_binormal = false;
bool proximity_fade_enabled = false;
- float proximity_fade_distance;
+ float proximity_fade_distance = 0.0f;
float msdf_pixel_range = 4.f;
float msdf_outline_size = 0.f;
DistanceFadeMode distance_fade = DISTANCE_FADE_DISABLED;
- float distance_fade_max_distance;
- float distance_fade_min_distance;
+ float distance_fade_max_distance = 0.0f;
+ float distance_fade_min_distance = 0.0f;
BlendMode blend_mode = BLEND_MODE_MIX;
BlendMode detail_blend_mode = BLEND_MODE_MIX;
diff --git a/scene/resources/particles_material.h b/scene/resources/particles_material.h
index 57da344ce0..4c3a3ba16c 100644
--- a/scene/resources/particles_material.h
+++ b/scene/resources/particles_material.h
@@ -230,8 +230,8 @@ private:
bool is_initialized = false;
Vector3 direction;
- float spread;
- float flatness;
+ float spread = 0.0f;
+ float flatness = 0.0f;
float params_min[PARAM_MAX];
float params_max[PARAM_MAX];
@@ -244,34 +244,34 @@ private:
bool particle_flags[PARTICLE_FLAG_MAX];
EmissionShape emission_shape;
- float emission_sphere_radius;
+ float emission_sphere_radius = 0.0f;
Vector3 emission_box_extents;
Ref<Texture2D> emission_point_texture;
Ref<Texture2D> emission_normal_texture;
Ref<Texture2D> emission_color_texture;
Vector3 emission_ring_axis;
- real_t emission_ring_height;
- real_t emission_ring_radius;
- real_t emission_ring_inner_radius;
+ real_t emission_ring_height = 0.0f;
+ real_t emission_ring_radius = 0.0f;
+ real_t emission_ring_inner_radius = 0.0f;
int emission_point_count = 1;
- bool anim_loop;
+ bool anim_loop = false;
Vector3 gravity;
- double lifetime_randomness;
+ double lifetime_randomness = 0.0;
SubEmitterMode sub_emitter_mode;
- double sub_emitter_frequency;
- int sub_emitter_amount_at_end;
- bool sub_emitter_keep_velocity;
+ double sub_emitter_frequency = 0.0;
+ int sub_emitter_amount_at_end = 0;
+ bool sub_emitter_keep_velocity = false;
//do not save emission points here
- bool attractor_interaction_enabled;
- bool collision_enabled;
- bool collision_scale;
- float collision_friction;
- float collision_bounce;
+ bool attractor_interaction_enabled = false;
+ bool collision_enabled = false;
+ bool collision_scale = false;
+ float collision_friction = 0.0f;
+ float collision_bounce = 0.0f;
protected:
static void _bind_methods();
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index 40edc5f198..c9a890194d 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -314,7 +314,7 @@ void CapsuleMesh::create_mesh_array(Array &p_arr, const float radius, const floa
Vector3 p = Vector3(x * radius * w, y, -z * radius * w);
points.push_back(p + Vector3(0.0, 0.5 * height - radius, 0.0));
normals.push_back(p.normalized());
- ADD_TANGENT(z, 0.0, x, 1.0)
+ ADD_TANGENT(-z, 0.0, -x, 1.0)
uvs.push_back(Vector2(u, v * onethird));
point++;
@@ -353,7 +353,7 @@ void CapsuleMesh::create_mesh_array(Array &p_arr, const float radius, const floa
Vector3 p = Vector3(x * radius, y, -z * radius);
points.push_back(p);
normals.push_back(Vector3(x, 0.0, -z));
- ADD_TANGENT(z, 0.0, x, 1.0)
+ ADD_TANGENT(-z, 0.0, -x, 1.0)
uvs.push_back(Vector2(u, onethird + (v * onethird)));
point++;
@@ -393,7 +393,7 @@ void CapsuleMesh::create_mesh_array(Array &p_arr, const float radius, const floa
Vector3 p = Vector3(x * radius * w, y, -z * radius * w);
points.push_back(p + Vector3(0.0, -0.5 * height + radius, 0.0));
normals.push_back(p.normalized());
- ADD_TANGENT(z, 0.0, x, 1.0)
+ ADD_TANGENT(-z, 0.0, -x, 1.0)
uvs.push_back(Vector2(u2, twothirds + ((v - 1.0) * onethird)));
point++;
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index b18456d464..7eeb3f5f85 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -890,7 +890,6 @@ Error ResourceLoaderText::rename_dependencies(Ref<FileAccess> p_f, const String
fw->store_8(c);
c = f->get_8();
}
- f.unref();
bool all_ok = fw->get_error() == OK;
@@ -898,12 +897,6 @@ Error ResourceLoaderText::rename_dependencies(Ref<FileAccess> p_f, const String
return ERR_CANT_CREATE;
}
- fw.unref();
-
- Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- da->remove(p_path);
- da->rename(p_path + ".depren", p_path);
-
return OK;
}
@@ -1370,9 +1363,12 @@ void ResourceFormatLoaderText::get_recognized_extensions_for_type(const String &
return;
}
- if (p_type == "PackedScene") {
+ if (ClassDB::is_parent_class("PackedScene", p_type)) {
p_extensions->push_back("tscn");
- } else {
+ }
+
+ // Don't allow .tres for PackedScenes.
+ if (p_type != "PackedScene") {
p_extensions->push_back("tres");
}
}
@@ -1439,15 +1435,26 @@ void ResourceFormatLoaderText::get_dependencies(const String &p_path, List<Strin
}
Error ResourceFormatLoaderText::rename_dependencies(const String &p_path, const Map<String, String> &p_map) {
- Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
- if (f.is_null()) {
- ERR_FAIL_V(ERR_CANT_OPEN);
+ Error err = OK;
+ {
+ Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
+ if (f.is_null()) {
+ ERR_FAIL_V(ERR_CANT_OPEN);
+ }
+
+ ResourceLoaderText loader;
+ loader.local_path = ProjectSettings::get_singleton()->localize_path(p_path);
+ loader.res_path = loader.local_path;
+ err = loader.rename_dependencies(f, p_path, p_map);
}
- ResourceLoaderText loader;
- loader.local_path = ProjectSettings::get_singleton()->localize_path(p_path);
- loader.res_path = loader.local_path;
- return loader.rename_dependencies(f, p_path, p_map);
+ if (err == OK) {
+ Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ da->remove(p_path);
+ da->rename(p_path + ".depren", p_path);
+ }
+
+ return err;
}
ResourceFormatLoaderText *ResourceFormatLoaderText::singleton = nullptr;
diff --git a/scene/resources/skeleton_modification_2d_physicalbones.h b/scene/resources/skeleton_modification_2d_physicalbones.h
index d53102fa5e..373ff666ee 100644
--- a/scene/resources/skeleton_modification_2d_physicalbones.h
+++ b/scene/resources/skeleton_modification_2d_physicalbones.h
@@ -52,7 +52,7 @@ private:
bool _simulation_state_dirty = false;
TypedArray<StringName> _simulation_state_dirty_names;
- bool _simulation_state_dirty_process;
+ bool _simulation_state_dirty_process = false;
void _update_simulation_state();
protected:
diff --git a/scene/resources/sky_material.h b/scene/resources/sky_material.h
index 8112892ceb..8163a42519 100644
--- a/scene/resources/sky_material.h
+++ b/scene/resources/sky_material.h
@@ -40,19 +40,19 @@ class ProceduralSkyMaterial : public Material {
private:
Color sky_top_color;
Color sky_horizon_color;
- float sky_curve;
- float sky_energy;
+ float sky_curve = 0.0f;
+ float sky_energy = 0.0f;
Ref<Texture2D> sky_cover;
Color sky_cover_modulate;
Color ground_bottom_color;
Color ground_horizon_color;
- float ground_curve;
- float ground_energy;
+ float ground_curve = 0.0f;
+ float ground_energy = 0.0f;
- float sun_angle_max;
- float sun_curve;
- float dither_strength;
+ float sun_angle_max = 0.0f;
+ float sun_curve = 0.0f;
+ float dither_strength = 0.0f;
static Mutex shader_mutex;
static RID shader;
@@ -158,16 +158,16 @@ private:
static Mutex shader_mutex;
static RID shader;
- float rayleigh;
+ float rayleigh = 0.0f;
Color rayleigh_color;
- float mie;
- float mie_eccentricity;
+ float mie = 0.0f;
+ float mie_eccentricity = 0.0f;
Color mie_color;
- float turbidity;
- float sun_disk_scale;
+ float turbidity = 0.0f;
+ float sun_disk_scale = 0.0f;
Color ground_color;
- float exposure;
- float dither_strength;
+ float exposure = 0.0f;
+ float dither_strength = 0.0f;
Ref<Texture2D> night_sky;
static void _update_shader();
mutable bool shader_set = false;
diff --git a/scene/resources/sphere_shape_3d.h b/scene/resources/sphere_shape_3d.h
index ff6d883940..20887dd092 100644
--- a/scene/resources/sphere_shape_3d.h
+++ b/scene/resources/sphere_shape_3d.h
@@ -35,7 +35,7 @@
class SphereShape3D : public Shape3D {
GDCLASS(SphereShape3D, Shape3D);
- float radius;
+ float radius = 1.0f;
protected:
static void _bind_methods();
diff --git a/scene/resources/theme.cpp b/scene/resources/theme.cpp
index 373fbb94ea..be54c309c8 100644
--- a/scene/resources/theme.cpp
+++ b/scene/resources/theme.cpp
@@ -261,6 +261,27 @@ int Theme::get_fallback_font_size() {
return fallback_font_size;
}
+bool Theme::is_valid_type_name(const String &p_name) {
+ for (int i = 0; i < p_name.length(); i++) {
+ if (!is_ascii_identifier_char(p_name[i])) {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool Theme::is_valid_item_name(const String &p_name) {
+ if (p_name.is_empty()) {
+ return false;
+ }
+ for (int i = 0; i < p_name.length(); i++) {
+ if (!is_ascii_identifier_char(p_name[i])) {
+ return false;
+ }
+ }
+ return true;
+}
+
// Fallback values for theme item types, configurable per theme.
void Theme::set_default_base_scale(float p_base_scale) {
if (default_base_scale == p_base_scale) {
@@ -326,6 +347,9 @@ bool Theme::has_default_font_size() const {
// Icons.
void Theme::set_icon(const StringName &p_name, const StringName &p_theme_type, const Ref<Texture2D> &p_icon) {
+ ERR_FAIL_COND_MSG(!is_valid_item_name(p_name), vformat("Invalid item name: '%s'", p_name));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+
bool existing = false;
if (icon_map[p_theme_type].has(p_name) && icon_map[p_theme_type][p_name].is_valid()) {
existing = true;
@@ -358,6 +382,8 @@ bool Theme::has_icon_nocheck(const StringName &p_name, const StringName &p_theme
}
void Theme::rename_icon(const StringName &p_old_name, const StringName &p_name, const StringName &p_theme_type) {
+ ERR_FAIL_COND_MSG(!is_valid_item_name(p_name), vformat("Invalid item name: '%s'", p_name));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
ERR_FAIL_COND_MSG(!icon_map.has(p_theme_type), "Cannot rename the icon '" + String(p_old_name) + "' because the node type '" + String(p_theme_type) + "' does not exist.");
ERR_FAIL_COND_MSG(icon_map[p_theme_type].has(p_name), "Cannot rename the icon '" + String(p_old_name) + "' because the new name '" + String(p_name) + "' already exists.");
ERR_FAIL_COND_MSG(!icon_map[p_theme_type].has(p_old_name), "Cannot rename the icon '" + String(p_old_name) + "' because it does not exist.");
@@ -396,6 +422,8 @@ void Theme::get_icon_list(StringName p_theme_type, List<StringName> *p_list) con
}
void Theme::add_icon_type(const StringName &p_theme_type) {
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+
if (icon_map.has(p_theme_type)) {
return;
}
@@ -433,6 +461,9 @@ void Theme::get_icon_type_list(List<StringName> *p_list) const {
// Styleboxes.
void Theme::set_stylebox(const StringName &p_name, const StringName &p_theme_type, const Ref<StyleBox> &p_style) {
+ ERR_FAIL_COND_MSG(!is_valid_item_name(p_name), vformat("Invalid item name: '%s'", p_name));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+
bool existing = false;
if (style_map[p_theme_type].has(p_name) && style_map[p_theme_type][p_name].is_valid()) {
existing = true;
@@ -465,6 +496,8 @@ bool Theme::has_stylebox_nocheck(const StringName &p_name, const StringName &p_t
}
void Theme::rename_stylebox(const StringName &p_old_name, const StringName &p_name, const StringName &p_theme_type) {
+ ERR_FAIL_COND_MSG(!is_valid_item_name(p_name), vformat("Invalid item name: '%s'", p_name));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
ERR_FAIL_COND_MSG(!style_map.has(p_theme_type), "Cannot rename the stylebox '" + String(p_old_name) + "' because the node type '" + String(p_theme_type) + "' does not exist.");
ERR_FAIL_COND_MSG(style_map[p_theme_type].has(p_name), "Cannot rename the stylebox '" + String(p_old_name) + "' because the new name '" + String(p_name) + "' already exists.");
ERR_FAIL_COND_MSG(!style_map[p_theme_type].has(p_old_name), "Cannot rename the stylebox '" + String(p_old_name) + "' because it does not exist.");
@@ -503,6 +536,8 @@ void Theme::get_stylebox_list(StringName p_theme_type, List<StringName> *p_list)
}
void Theme::add_stylebox_type(const StringName &p_theme_type) {
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+
if (style_map.has(p_theme_type)) {
return;
}
@@ -540,6 +575,9 @@ void Theme::get_stylebox_type_list(List<StringName> *p_list) const {
// Fonts.
void Theme::set_font(const StringName &p_name, const StringName &p_theme_type, const Ref<Font> &p_font) {
+ ERR_FAIL_COND_MSG(!is_valid_item_name(p_name), vformat("Invalid item name: '%s'", p_name));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+
bool existing = false;
if (font_map[p_theme_type][p_name].is_valid()) {
existing = true;
@@ -574,6 +612,8 @@ bool Theme::has_font_nocheck(const StringName &p_name, const StringName &p_theme
}
void Theme::rename_font(const StringName &p_old_name, const StringName &p_name, const StringName &p_theme_type) {
+ ERR_FAIL_COND_MSG(!is_valid_item_name(p_name), vformat("Invalid item name: '%s'", p_name));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
ERR_FAIL_COND_MSG(!font_map.has(p_theme_type), "Cannot rename the font '" + String(p_old_name) + "' because the node type '" + String(p_theme_type) + "' does not exist.");
ERR_FAIL_COND_MSG(font_map[p_theme_type].has(p_name), "Cannot rename the font '" + String(p_old_name) + "' because the new name '" + String(p_name) + "' already exists.");
ERR_FAIL_COND_MSG(!font_map[p_theme_type].has(p_old_name), "Cannot rename the font '" + String(p_old_name) + "' because it does not exist.");
@@ -612,6 +652,8 @@ void Theme::get_font_list(StringName p_theme_type, List<StringName> *p_list) con
}
void Theme::add_font_type(const StringName &p_theme_type) {
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+
if (font_map.has(p_theme_type)) {
return;
}
@@ -649,6 +691,9 @@ void Theme::get_font_type_list(List<StringName> *p_list) const {
// Font sizes.
void Theme::set_font_size(const StringName &p_name, const StringName &p_theme_type, int p_font_size) {
+ ERR_FAIL_COND_MSG(!is_valid_item_name(p_name), vformat("Invalid item name: '%s'", p_name));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+
bool existing = has_font_size_nocheck(p_name, p_theme_type);
font_size_map[p_theme_type][p_name] = p_font_size;
@@ -674,6 +719,8 @@ bool Theme::has_font_size_nocheck(const StringName &p_name, const StringName &p_
}
void Theme::rename_font_size(const StringName &p_old_name, const StringName &p_name, const StringName &p_theme_type) {
+ ERR_FAIL_COND_MSG(!is_valid_item_name(p_name), vformat("Invalid item name: '%s'", p_name));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
ERR_FAIL_COND_MSG(!font_size_map.has(p_theme_type), "Cannot rename the font size '" + String(p_old_name) + "' because the node type '" + String(p_theme_type) + "' does not exist.");
ERR_FAIL_COND_MSG(font_size_map[p_theme_type].has(p_name), "Cannot rename the font size '" + String(p_old_name) + "' because the new name '" + String(p_name) + "' already exists.");
ERR_FAIL_COND_MSG(!font_size_map[p_theme_type].has(p_old_name), "Cannot rename the font size '" + String(p_old_name) + "' because it does not exist.");
@@ -708,6 +755,8 @@ void Theme::get_font_size_list(StringName p_theme_type, List<StringName> *p_list
}
void Theme::add_font_size_type(const StringName &p_theme_type) {
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+
if (font_size_map.has(p_theme_type)) {
return;
}
@@ -733,6 +782,9 @@ void Theme::get_font_size_type_list(List<StringName> *p_list) const {
// Colors.
void Theme::set_color(const StringName &p_name, const StringName &p_theme_type, const Color &p_color) {
+ ERR_FAIL_COND_MSG(!is_valid_item_name(p_name), vformat("Invalid item name: '%s'", p_name));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+
bool existing = has_color_nocheck(p_name, p_theme_type);
color_map[p_theme_type][p_name] = p_color;
@@ -756,6 +808,8 @@ bool Theme::has_color_nocheck(const StringName &p_name, const StringName &p_them
}
void Theme::rename_color(const StringName &p_old_name, const StringName &p_name, const StringName &p_theme_type) {
+ ERR_FAIL_COND_MSG(!is_valid_item_name(p_name), vformat("Invalid item name: '%s'", p_name));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
ERR_FAIL_COND_MSG(!color_map.has(p_theme_type), "Cannot rename the color '" + String(p_old_name) + "' because the node type '" + String(p_theme_type) + "' does not exist.");
ERR_FAIL_COND_MSG(color_map[p_theme_type].has(p_name), "Cannot rename the color '" + String(p_old_name) + "' because the new name '" + String(p_name) + "' already exists.");
ERR_FAIL_COND_MSG(!color_map[p_theme_type].has(p_old_name), "Cannot rename the color '" + String(p_old_name) + "' because it does not exist.");
@@ -790,6 +844,8 @@ void Theme::get_color_list(StringName p_theme_type, List<StringName> *p_list) co
}
void Theme::add_color_type(const StringName &p_theme_type) {
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+
if (color_map.has(p_theme_type)) {
return;
}
@@ -815,6 +871,9 @@ void Theme::get_color_type_list(List<StringName> *p_list) const {
// Theme constants.
void Theme::set_constant(const StringName &p_name, const StringName &p_theme_type, int p_constant) {
+ ERR_FAIL_COND_MSG(!is_valid_item_name(p_name), vformat("Invalid item name: '%s'", p_name));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+
bool existing = has_constant_nocheck(p_name, p_theme_type);
constant_map[p_theme_type][p_name] = p_constant;
@@ -838,6 +897,8 @@ bool Theme::has_constant_nocheck(const StringName &p_name, const StringName &p_t
}
void Theme::rename_constant(const StringName &p_old_name, const StringName &p_name, const StringName &p_theme_type) {
+ ERR_FAIL_COND_MSG(!is_valid_item_name(p_name), vformat("Invalid item name: '%s'", p_name));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
ERR_FAIL_COND_MSG(!constant_map.has(p_theme_type), "Cannot rename the constant '" + String(p_old_name) + "' because the node type '" + String(p_theme_type) + "' does not exist.");
ERR_FAIL_COND_MSG(constant_map[p_theme_type].has(p_name), "Cannot rename the constant '" + String(p_old_name) + "' because the new name '" + String(p_name) + "' already exists.");
ERR_FAIL_COND_MSG(!constant_map[p_theme_type].has(p_old_name), "Cannot rename the constant '" + String(p_old_name) + "' because it does not exist.");
@@ -872,6 +933,8 @@ void Theme::get_constant_list(StringName p_theme_type, List<StringName> *p_list)
}
void Theme::add_constant_type(const StringName &p_theme_type) {
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+
if (constant_map.has(p_theme_type)) {
return;
}
@@ -1154,6 +1217,8 @@ void Theme::get_theme_item_type_list(DataType p_data_type, List<StringName> *p_l
// Theme type variations.
void Theme::set_type_variation(const StringName &p_theme_type, const StringName &p_base_type) {
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_theme_type), vformat("Invalid type name: '%s'", p_theme_type));
+ ERR_FAIL_COND_MSG(!is_valid_type_name(p_base_type), vformat("Invalid type name: '%s'", p_base_type));
ERR_FAIL_COND_MSG(p_theme_type == StringName(), "An empty theme type cannot be marked as a variation of another type.");
ERR_FAIL_COND_MSG(ClassDB::class_exists(p_theme_type), "A type associated with a built-in class cannot be marked as a variation of another type.");
ERR_FAIL_COND_MSG(p_base_type == StringName(), "An empty theme type cannot be the base type of a variation. Use clear_type_variation() instead if you want to unmark '" + String(p_theme_type) + "' as a variation.");
diff --git a/scene/resources/theme.h b/scene/resources/theme.h
index 9afe05007d..f8f1e95634 100644
--- a/scene/resources/theme.h
+++ b/scene/resources/theme.h
@@ -137,6 +137,9 @@ public:
static Ref<Font> get_fallback_font();
static int get_fallback_font_size();
+ static bool is_valid_type_name(const String &p_name);
+ static bool is_valid_item_name(const String &p_name);
+
void set_default_base_scale(float p_base_scale);
float get_default_base_scale() const;
bool has_default_base_scale() const;
diff --git a/servers/audio/audio_filter_sw.cpp b/servers/audio/audio_filter_sw.cpp
index 082931647a..003275f302 100644
--- a/servers/audio/audio_filter_sw.cpp
+++ b/servers/audio/audio_filter_sw.cpp
@@ -211,15 +211,6 @@ float AudioFilterSW::get_response(float p_freq, Coeffs *p_coeffs) {
return H;
}
-AudioFilterSW::AudioFilterSW() {
- sampling_rate = 44100;
- resonance = 0.5;
- cutoff = 5000;
- gain = 1.0;
- mode = LOWPASS;
- stages = 1;
-}
-
AudioFilterSW::Processor::Processor() {
set_filter(nullptr);
}
diff --git a/servers/audio/audio_filter_sw.h b/servers/audio/audio_filter_sw.h
index 1ec1abd4d5..e3f8188997 100644
--- a/servers/audio/audio_filter_sw.h
+++ b/servers/audio/audio_filter_sw.h
@@ -36,11 +36,11 @@
class AudioFilterSW {
public:
struct Coeffs {
- float a1, a2;
- float b0, b1, b2;
-
- //bool operator==(const Coeffs &p_rv) { return (FLOATS_EQ(a1,p_rv.a1) && FLOATS_EQ(a2,p_rv.a2) && FLOATS_EQ(b1,p_rv.b1) && FLOATS_EQ(b2,p_rv.b2) && FLOATS_EQ(b0,p_rv.b0) ); }
- Coeffs() { a1 = a2 = b0 = b1 = b2 = 0.0; }
+ float a1 = 0.0f;
+ float a2 = 0.0f;
+ float b0 = 0.0f;
+ float b1 = 0.0f;
+ float b2 = 0.0f;
};
enum Mode {
@@ -52,14 +52,16 @@ public:
BANDLIMIT,
LOWSHELF,
HIGHSHELF
-
};
- class Processor { // simple filter processor
-
+ class Processor { // Simple filter processor.
AudioFilterSW *filter = nullptr;
Coeffs coeffs;
- float ha1, ha2, hb1, hb2; //history
+ // History.
+ float ha1 = 0.0f;
+ float ha2 = 0.0f;
+ float hb1 = 0.0f;
+ float hb2 = 0.0f;
Coeffs incr_coeffs;
public:
@@ -73,12 +75,12 @@ public:
};
private:
- float cutoff;
- float resonance;
- float gain;
- float sampling_rate;
- int stages;
- Mode mode;
+ float cutoff = 5000.0f;
+ float resonance = 0.5f;
+ float gain = 1.0f;
+ float sampling_rate = 44100.0f;
+ int stages = 1;
+ Mode mode = LOWPASS;
public:
float get_response(float p_freq, Coeffs *p_coeffs);
@@ -92,7 +94,7 @@ public:
void prepare_coefficients(Coeffs *p_coeffs);
- AudioFilterSW();
+ AudioFilterSW() {}
};
/* inline methods */
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index 1ebd57fa7f..9a9b9815ae 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -709,10 +709,7 @@ void AudioStreamRandomizer::_bind_methods() {
BIND_ENUM_CONSTANT(PLAYBACK_SEQUENTIAL);
}
-AudioStreamRandomizer::AudioStreamRandomizer() {
- random_pitch_scale = 1.1;
- random_volume_offset_db = 5;
-}
+AudioStreamRandomizer::AudioStreamRandomizer() {}
void AudioStreamPlaybackRandomizer::start(float p_from_pos) {
playing = playback;
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index 55031dec2c..9800707849 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -78,7 +78,7 @@ class AudioStreamPlaybackResampled : public AudioStreamPlayback {
AudioFrame internal_buffer[INTERNAL_BUFFER_LEN + CUBIC_INTERP_HISTORY];
unsigned int internal_buffer_end = -1;
- uint64_t mix_offset;
+ uint64_t mix_offset = 0;
protected:
void begin_resample();
@@ -145,8 +145,8 @@ class AudioStreamPlaybackMicrophone : public AudioStreamPlaybackResampled {
GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlaybackResampled);
friend class AudioStreamMicrophone;
- bool active;
- unsigned int input_ofs;
+ bool active = false;
+ unsigned int input_ofs = 0;
Ref<AudioStreamMicrophone> microphone;
@@ -194,8 +194,8 @@ private:
Set<AudioStreamPlaybackRandomizer *> playbacks;
Vector<PoolEntry> audio_stream_pool;
- float random_pitch_scale;
- float random_volume_offset_db;
+ float random_pitch_scale = 1.1f;
+ float random_volume_offset_db = 5.0f;
Ref<AudioStreamPlayback> instance_playback_random();
Ref<AudioStreamPlayback> instance_playback_no_repeats();
diff --git a/servers/audio/effects/audio_effect_stereo_enhance.cpp b/servers/audio/effects/audio_effect_stereo_enhance.cpp
index c81efc55e2..7bb62bcbed 100644
--- a/servers/audio/effects/audio_effect_stereo_enhance.cpp
+++ b/servers/audio/effects/audio_effect_stereo_enhance.cpp
@@ -29,7 +29,9 @@
/*************************************************************************/
#include "audio_effect_stereo_enhance.h"
+
#include "servers/audio_server.h"
+
void AudioEffectStereoEnhanceInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) {
float intensity = base->pan_pullout;
bool surround_mode = base->surround > 0;
@@ -140,8 +142,4 @@ void AudioEffectStereoEnhance::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "surround", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_surround", "get_surround");
}
-AudioEffectStereoEnhance::AudioEffectStereoEnhance() {
- pan_pullout = 1;
- time_pullout = 0;
- surround = 0;
-}
+AudioEffectStereoEnhance::AudioEffectStereoEnhance() {}
diff --git a/servers/audio/effects/audio_effect_stereo_enhance.h b/servers/audio/effects/audio_effect_stereo_enhance.h
index 1f93d1cf9f..30ea11f625 100644
--- a/servers/audio/effects/audio_effect_stereo_enhance.h
+++ b/servers/audio/effects/audio_effect_stereo_enhance.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef AUDIOEFFECTSTEREOENHANCE_H
-#define AUDIOEFFECTSTEREOENHANCE_H
+#ifndef AUDIO_EFFECT_STEREO_ENHANCE_H
+#define AUDIO_EFFECT_STEREO_ENHANCE_H
#include "servers/audio/audio_effect.h"
@@ -45,8 +45,8 @@ class AudioEffectStereoEnhanceInstance : public AudioEffectInstance {
};
float *delay_ringbuff = nullptr;
- unsigned int ringbuff_pos;
- unsigned int ringbuff_mask;
+ unsigned int ringbuff_pos = 0;
+ unsigned int ringbuff_mask = 0;
public:
virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) override;
@@ -58,11 +58,11 @@ class AudioEffectStereoEnhance : public AudioEffect {
GDCLASS(AudioEffectStereoEnhance, AudioEffect);
friend class AudioEffectStereoEnhanceInstance;
- float volume_db;
+ float volume_db = 0.0f;
- float pan_pullout;
- float time_pullout;
- float surround;
+ float pan_pullout = 1.0f;
+ float time_pullout = 0.0f;
+ float surround = 0.0f;
protected:
static void _bind_methods();
@@ -82,4 +82,4 @@ public:
AudioEffectStereoEnhance();
};
-#endif // AUDIOEFFECTSTEREOENHANCE_H
+#endif // AUDIO_EFFECT_STEREO_ENHANCE_H
diff --git a/servers/audio/effects/reverb.cpp b/servers/audio/effects/reverb.cpp
index 4b5b9ab79f..adfd648514 100644
--- a/servers/audio/effects/reverb.cpp
+++ b/servers/audio/effects/reverb.cpp
@@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-// Author: Juan Linietsky <reduzio@gmail.com>, (C) 2006
-
#include "reverb.h"
#include "core/math/math_funcs.h"
diff --git a/servers/audio/effects/reverb.h b/servers/audio/effects/reverb.h
index de25e8c52b..c9602c5b5a 100644
--- a/servers/audio/effects/reverb.h
+++ b/servers/audio/effects/reverb.h
@@ -77,10 +77,11 @@ private:
AllPass allpass[MAX_ALLPASS];
float *input_buffer = nullptr;
float *echo_buffer = nullptr;
- int echo_buffer_size;
- int echo_buffer_pos;
+ int echo_buffer_size = 0;
+ int echo_buffer_pos = 0;
- float hpf_h1, hpf_h2 = 0;
+ float hpf_h1 = 0.0f;
+ float hpf_h2 = 0.0f;
struct Parameters {
float room_size;
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 777bebcf60..c8f48207e4 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -164,17 +164,6 @@ Array AudioDriver::capture_get_device_list() {
return list;
}
-AudioDriver::AudioDriver() {
- _last_mix_time = 0;
- _last_mix_frames = 0;
- input_position = 0;
- input_size = 0;
-
-#ifdef DEBUG_ENABLED
- prof_time = 0;
-#endif
-}
-
AudioDriverDummy AudioDriverManager::dummy_driver;
AudioDriver *AudioDriverManager::drivers[MAX_DRIVERS] = {
&AudioDriverManager::dummy_driver,
@@ -1748,15 +1737,6 @@ void AudioServer::_bind_methods() {
AudioServer::AudioServer() {
singleton = this;
- mix_frames = 0;
- channel_count = 0;
- to_mix = 0;
-#ifdef DEBUG_ENABLED
- prof_time = 0;
-#endif
- mix_time = 0;
- mix_size = 0;
- playback_speed_scale = 1;
}
AudioServer::~AudioServer() {
diff --git a/servers/audio_server.h b/servers/audio_server.h
index 5563d60e4a..3d8755071a 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -48,18 +48,18 @@ class AudioStreamPlayback;
class AudioDriver {
static AudioDriver *singleton;
- uint64_t _last_mix_time;
- uint64_t _last_mix_frames;
+ uint64_t _last_mix_time = 0;
+ uint64_t _last_mix_frames = 0;
#ifdef DEBUG_ENABLED
- uint64_t prof_ticks;
- uint64_t prof_time;
+ uint64_t prof_ticks = 0;
+ uint64_t prof_time = 0;
#endif
protected:
Vector<int32_t> input_buffer;
- unsigned int input_position;
- unsigned int input_size;
+ unsigned int input_position = 0;
+ unsigned int input_size = 0;
void audio_server_process(int p_frames, int32_t *p_buffer, bool p_update_mix_time = true);
void update_mix_time(int p_frames);
@@ -121,7 +121,7 @@ public:
void reset_profiling_time() { prof_time = 0; }
#endif
- AudioDriver();
+ AudioDriver() {}
virtual ~AudioDriver() {}
};
@@ -169,66 +169,61 @@ public:
typedef void (*AudioCallback)(void *p_userdata);
private:
- uint64_t mix_time;
- int mix_size;
+ uint64_t mix_time = 0;
+ int mix_size = 0;
- uint32_t buffer_size;
- uint64_t mix_count;
- uint64_t mix_frames;
+ uint32_t buffer_size = 0;
+ uint64_t mix_count = 0;
+ uint64_t mix_frames = 0;
#ifdef DEBUG_ENABLED
- uint64_t prof_time;
+ uint64_t prof_time = 0;
#endif
- float channel_disable_threshold_db;
- uint32_t channel_disable_frames;
+ float channel_disable_threshold_db = 0.0f;
+ uint32_t channel_disable_frames = 0;
- int channel_count;
- int to_mix;
+ int channel_count = 0;
+ int to_mix = 0;
- float playback_speed_scale;
+ float playback_speed_scale = 1.0f;
struct Bus {
StringName name;
- bool solo;
- bool mute;
- bool bypass;
+ bool solo = false;
+ bool mute = false;
+ bool bypass = false;
- bool soloed;
+ bool soloed = false;
- //Each channel is a stereo pair.
+ // Each channel is a stereo pair.
struct Channel {
- bool used;
- bool active;
- AudioFrame peak_volume;
+ bool used = false;
+ bool active = false;
+ AudioFrame peak_volume = AudioFrame(AUDIO_MIN_PEAK_DB, AUDIO_MIN_PEAK_DB);
Vector<AudioFrame> buffer;
Vector<Ref<AudioEffectInstance>> effect_instances;
- uint64_t last_mix_with_audio;
- Channel() {
- last_mix_with_audio = 0;
- used = false;
- active = false;
- peak_volume = AudioFrame(AUDIO_MIN_PEAK_DB, AUDIO_MIN_PEAK_DB);
- }
+ uint64_t last_mix_with_audio = 0;
+ Channel() {}
};
Vector<Channel> channels;
struct Effect {
Ref<AudioEffect> effect;
- bool enabled;
+ bool enabled = false;
#ifdef DEBUG_ENABLED
- uint64_t prof_time;
+ uint64_t prof_time = 0;
#endif
};
Vector<Effect> effects;
- float volume_db;
+ float volume_db = 0.0f;
StringName send;
- int index_cache;
+ int index_cache = 0;
};
struct AudioStreamPlaybackBusDetails {
- bool bus_active[MAX_BUSES_PER_PLAYBACK] = { false, false, false, false, false, false };
+ bool bus_active[MAX_BUSES_PER_PLAYBACK] = {};
StringName bus[MAX_BUSES_PER_PLAYBACK];
AudioFrame volume[MAX_BUSES_PER_PLAYBACK][MAX_CHANNELS_PER_BUS];
};
@@ -312,7 +307,7 @@ public:
ERR_FAIL_V(1);
}
- //do not use from outside audio thread
+ // Do not use from outside audio thread.
bool thread_has_channel_mix_buffer(int p_bus, int p_buffer) const;
AudioFrame *thread_get_channel_mix_buffer(int p_bus, int p_buffer);
int thread_get_mix_buffer_size() const;
@@ -442,26 +437,21 @@ class AudioBusLayout : public Resource {
struct Bus {
StringName name;
- bool solo;
- bool mute;
- bool bypass;
+ bool solo = false;
+ bool mute = false;
+ bool bypass = false;
struct Effect {
Ref<AudioEffect> effect;
- bool enabled;
+ bool enabled = false;
};
Vector<Effect> effects;
- float volume_db;
+ float volume_db = 0.0f;
StringName send;
- Bus() {
- solo = false;
- mute = false;
- bypass = false;
- volume_db = 0;
- }
+ Bus() {}
};
Vector<Bus> buses;
diff --git a/servers/display_server.cpp b/servers/display_server.cpp
index 8d97cd2543..23961e0ca4 100644
--- a/servers/display_server.cpp
+++ b/servers/display_server.cpp
@@ -579,6 +579,9 @@ void DisplayServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("clipboard_set_primary", "clipboard_primary"), &DisplayServer::clipboard_set_primary);
ClassDB::bind_method(D_METHOD("clipboard_get_primary"), &DisplayServer::clipboard_get_primary);
+ ClassDB::bind_method(D_METHOD("get_display_cutouts"), &DisplayServer::get_display_cutouts);
+ ClassDB::bind_method(D_METHOD("get_display_safe_area"), &DisplayServer::get_display_safe_area);
+
ClassDB::bind_method(D_METHOD("get_screen_count"), &DisplayServer::get_screen_count);
ClassDB::bind_method(D_METHOD("screen_get_position", "screen"), &DisplayServer::screen_get_position, DEFVAL(SCREEN_OF_MAIN_WINDOW));
ClassDB::bind_method(D_METHOD("screen_get_size", "screen"), &DisplayServer::screen_get_size, DEFVAL(SCREEN_OF_MAIN_WINDOW));
diff --git a/servers/display_server.h b/servers/display_server.h
index 19efcbd3dd..136f95a74f 100644
--- a/servers/display_server.h
+++ b/servers/display_server.h
@@ -228,6 +228,9 @@ public:
virtual void clipboard_set_primary(const String &p_text);
virtual String clipboard_get_primary() const;
+ virtual Array get_display_cutouts() const { return Array(); }
+ virtual Rect2i get_display_safe_area() const { return screen_get_usable_rect(); }
+
enum {
SCREEN_OF_MAIN_WINDOW = -1
};
diff --git a/servers/physics_2d/godot_collision_solver_2d.cpp b/servers/physics_2d/godot_collision_solver_2d.cpp
index 383c6a915c..e1b49b77a3 100644
--- a/servers/physics_2d/godot_collision_solver_2d.cpp
+++ b/servers/physics_2d/godot_collision_solver_2d.cpp
@@ -140,7 +140,7 @@ struct _ConcaveCollisionInfo2D {
Vector2 motion_B;
real_t margin_A = 0.0;
real_t margin_B = 0.0;
- GodotCollisionSolver2D::CallbackResult result_callback;
+ GodotCollisionSolver2D::CallbackResult result_callback = nullptr;
void *userdata = nullptr;
bool swap_result = false;
bool collided = false;
diff --git a/servers/physics_2d/godot_collision_solver_2d_sat.cpp b/servers/physics_2d/godot_collision_solver_2d_sat.cpp
index ded3ff356b..d758d1e3b1 100644
--- a/servers/physics_2d/godot_collision_solver_2d_sat.cpp
+++ b/servers/physics_2d/godot_collision_solver_2d_sat.cpp
@@ -33,7 +33,7 @@
#include "core/math/geometry_2d.h"
struct _CollectorCallback2D {
- GodotCollisionSolver2D::CallbackResult callback;
+ GodotCollisionSolver2D::CallbackResult callback = nullptr;
void *userdata = nullptr;
bool swap = false;
bool collided = false;
diff --git a/servers/physics_3d/gjk_epa.cpp b/servers/physics_3d/gjk_epa.cpp
index 23c8079538..ba362740b2 100644
--- a/servers/physics_3d/gjk_epa.cpp
+++ b/servers/physics_3d/gjk_epa.cpp
@@ -113,7 +113,7 @@ struct MinkowskiDiff {
real_t margin_A = 0.0;
real_t margin_B = 0.0;
- Vector3 (*get_support)(const GodotShape3D*, const Vector3&, real_t);
+ Vector3 (*get_support)(const GodotShape3D*, const Vector3&, real_t) = nullptr;
void Initialize(const GodotShape3D* shape0, const Transform3D& wtrs0, const real_t margin0,
const GodotShape3D* shape1, const Transform3D& wtrs1, const real_t margin1) {
@@ -191,13 +191,13 @@ struct GJK
/* Fields */
tShape m_shape;
Vector3 m_ray;
- real_t m_distance;
+ real_t m_distance = 0.0f;
sSimplex m_simplices[2];
sSV m_store[4];
sSV* m_free[4];
- U m_nfree;
- U m_current;
- sSimplex* m_simplex;
+ U m_nfree = 0;
+ U m_current = 0;
+ sSimplex* m_simplex = nullptr;
eStatus::_ m_status;
/* Methods */
GJK()
@@ -548,12 +548,12 @@ struct GJK
struct sFace
{
Vector3 n;
- real_t d;
+ real_t d = 0.0f;
sSV* c[3];
sFace* f[3];
sFace* l[2];
U1 e[3];
- U1 pass;
+ U1 pass = 0;
};
struct sList
{
@@ -583,10 +583,10 @@ struct GJK
eStatus::_ m_status;
GJK::sSimplex m_result;
Vector3 m_normal;
- real_t m_depth;
+ real_t m_depth = 0.0f;
sSV m_sv_store[EPA_MAX_VERTICES];
sFace m_fc_store[EPA_MAX_FACES];
- U m_nextsv;
+ U m_nextsv = 0;
sList m_hull;
sList m_stock;
/* Methods */
diff --git a/servers/physics_3d/godot_collision_solver_3d.cpp b/servers/physics_3d/godot_collision_solver_3d.cpp
index 0adfabef78..afc74df166 100644
--- a/servers/physics_3d/godot_collision_solver_3d.cpp
+++ b/servers/physics_3d/godot_collision_solver_3d.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "godot_collision_solver_3d.h"
+
#include "godot_collision_solver_3d_sat.h"
#include "godot_soft_body_3d.h"
@@ -276,19 +277,20 @@ bool GodotCollisionSolver3D::solve_soft_body(const GodotShape3D *p_shape_A, cons
}
struct _ConcaveCollisionInfo {
- const Transform3D *transform_A;
- const GodotShape3D *shape_A;
- const Transform3D *transform_B;
- GodotCollisionSolver3D::CallbackResult result_callback;
- void *userdata;
- bool swap_result;
- bool collided;
- int aabb_tests;
- int collisions;
- bool tested;
- real_t margin_A;
- real_t margin_B;
- Vector3 close_A, close_B;
+ const Transform3D *transform_A = nullptr;
+ const GodotShape3D *shape_A = nullptr;
+ const Transform3D *transform_B = nullptr;
+ GodotCollisionSolver3D::CallbackResult result_callback = nullptr;
+ void *userdata = nullptr;
+ bool swap_result = false;
+ bool collided = false;
+ int aabb_tests = 0;
+ int collisions = 0;
+ bool tested = false;
+ real_t margin_A = 0.0f;
+ real_t margin_B = 0.0f;
+ Vector3 close_A;
+ Vector3 close_B;
};
bool GodotCollisionSolver3D::concave_callback(void *p_userdata, GodotShape3D *p_convex) {
diff --git a/servers/physics_3d/godot_collision_solver_3d_sat.cpp b/servers/physics_3d/godot_collision_solver_3d_sat.cpp
index ca429040f5..7b7a09f31d 100644
--- a/servers/physics_3d/godot_collision_solver_3d_sat.cpp
+++ b/servers/physics_3d/godot_collision_solver_3d_sat.cpp
@@ -68,7 +68,7 @@
*************************************************************************/
struct _CollectorCallback {
- GodotCollisionSolver3D::CallbackResult callback;
+ GodotCollisionSolver3D::CallbackResult callback = nullptr;
void *userdata = nullptr;
bool swap = false;
bool collided = false;
diff --git a/servers/physics_3d/godot_shape_3d.cpp b/servers/physics_3d/godot_shape_3d.cpp
index 21595c9612..63ba28258f 100644
--- a/servers/physics_3d/godot_shape_3d.cpp
+++ b/servers/physics_3d/godot_shape_3d.cpp
@@ -1438,7 +1438,7 @@ Vector3 GodotConcavePolygonShape3D::get_moment_of_inertia(real_t p_mass) const {
struct _Volume_BVH_Element {
AABB aabb;
Vector3 center;
- int face_index;
+ int face_index = 0;
};
struct _Volume_BVH_CompareX {
@@ -1461,10 +1461,10 @@ struct _Volume_BVH_CompareZ {
struct _Volume_BVH {
AABB aabb;
- _Volume_BVH *left;
- _Volume_BVH *right;
+ _Volume_BVH *left = nullptr;
+ _Volume_BVH *right = nullptr;
- int face_index;
+ int face_index = 0;
};
_Volume_BVH *_volume_build_bvh(_Volume_BVH_Element *p_elements, int p_size, int &count) {
diff --git a/servers/rendering/renderer_rd/effects/tone_mapper.cpp b/servers/rendering/renderer_rd/effects/tone_mapper.cpp
index 7eb15f418b..e5642116bb 100644
--- a/servers/rendering/renderer_rd/effects/tone_mapper.cpp
+++ b/servers/rendering/renderer_rd/effects/tone_mapper.cpp
@@ -151,37 +151,37 @@ void ToneMapper::tonemapper(RID p_source_color, RID p_dst_framebuffer, const Ton
mode += 6;
}
- RID default_shader = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- RID default_mipmap_shader = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ RID default_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ RID default_mipmap_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
RD::Uniform u_source_color;
u_source_color.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_source_color.binding = 0;
- u_source_color.append_id(default_shader);
+ u_source_color.append_id(default_sampler);
u_source_color.append_id(p_source_color);
RD::Uniform u_exposure_texture;
u_exposure_texture.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_exposure_texture.binding = 0;
- u_exposure_texture.append_id(default_shader);
+ u_exposure_texture.append_id(default_sampler);
u_exposure_texture.append_id(p_settings.exposure_texture);
RD::Uniform u_glow_texture;
u_glow_texture.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_glow_texture.binding = 0;
- u_glow_texture.append_id(default_mipmap_shader);
+ u_glow_texture.append_id(default_mipmap_sampler);
u_glow_texture.append_id(p_settings.glow_texture);
RD::Uniform u_glow_map;
u_glow_map.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_glow_map.binding = 1;
- u_glow_map.append_id(default_mipmap_shader);
+ u_glow_map.append_id(default_mipmap_sampler);
u_glow_map.append_id(p_settings.glow_map);
RD::Uniform u_color_correction_texture;
u_color_correction_texture.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_color_correction_texture.binding = 0;
- u_color_correction_texture.append_id(default_shader);
+ u_color_correction_texture.append_id(default_sampler);
u_color_correction_texture.append_id(p_settings.color_correction_texture);
RID shader = tonemap.shader.version_get_shader(tonemap.shader_version, mode);
@@ -233,8 +233,8 @@ void ToneMapper::tonemapper(RD::DrawListID p_subpass_draw_list, RID p_source_col
tonemap.push_constant.use_debanding = p_settings.use_debanding;
tonemap.push_constant.luminance_multiplier = p_settings.luminance_multiplier;
- RID default_shader = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
- RID default_mipmap_shader = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ RID default_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
+ RID default_mipmap_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED);
RD::Uniform u_source_color;
u_source_color.uniform_type = RD::UNIFORM_TYPE_INPUT_ATTACHMENT;
@@ -244,25 +244,25 @@ void ToneMapper::tonemapper(RD::DrawListID p_subpass_draw_list, RID p_source_col
RD::Uniform u_exposure_texture;
u_exposure_texture.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_exposure_texture.binding = 0;
- u_exposure_texture.append_id(default_shader);
+ u_exposure_texture.append_id(default_sampler);
u_exposure_texture.append_id(p_settings.exposure_texture);
RD::Uniform u_glow_texture;
u_glow_texture.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_glow_texture.binding = 0;
- u_glow_texture.append_id(default_mipmap_shader);
+ u_glow_texture.append_id(default_mipmap_sampler);
u_glow_texture.append_id(p_settings.glow_texture);
RD::Uniform u_glow_map;
u_glow_map.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_glow_map.binding = 1;
- u_glow_map.append_id(default_mipmap_shader);
+ u_glow_map.append_id(default_mipmap_sampler);
u_glow_map.append_id(p_settings.glow_map);
RD::Uniform u_color_correction_texture;
u_color_correction_texture.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE;
u_color_correction_texture.binding = 0;
- u_color_correction_texture.append_id(default_shader);
+ u_color_correction_texture.append_id(default_sampler);
u_color_correction_texture.append_id(p_settings.color_correction_texture);
RID shader = tonemap.shader.version_get_shader(tonemap.shader_version, mode);
diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
index 3c115c942b..e60651f092 100644
--- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
+++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
@@ -452,8 +452,6 @@ RS::ShaderNativeSourceCode SceneShaderForwardClustered::ShaderData::get_native_s
SceneShaderForwardClustered::ShaderData::ShaderData() :
shader_list_element(this) {
- valid = false;
- uses_screen_texture = false;
}
SceneShaderForwardClustered::ShaderData::~ShaderData() {
diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h
index 6185fa7413..0b2df983ff 100644
--- a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h
+++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h
@@ -130,9 +130,9 @@ public:
ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE_AND_TO_ONE
};
- bool valid;
+ bool valid = false;
RID version;
- uint32_t vertex_input_mask;
+ uint32_t vertex_input_mask = 0;
PipelineCacheRD pipelines[CULL_VARIANT_MAX][RS::PRIMITIVE_MAX][PIPELINE_VERSION_MAX];
PipelineCacheRD color_pipelines[CULL_VARIANT_MAX][RS::PRIMITIVE_MAX][PIPELINE_COLOR_PASS_FLAG_COUNT];
@@ -142,7 +142,7 @@ public:
Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Vector<uint32_t> ubo_offsets;
- uint32_t ubo_size;
+ uint32_t ubo_size = 0;
String code;
Map<StringName, Map<int, RID>> default_texture_params;
@@ -150,28 +150,28 @@ public:
DepthDraw depth_draw;
DepthTest depth_test;
- bool uses_point_size;
- bool uses_alpha;
- bool uses_blend_alpha;
- bool uses_alpha_clip;
- bool uses_depth_pre_pass;
- bool uses_discard;
- bool uses_roughness;
- bool uses_normal;
- bool uses_particle_trails;
-
- bool unshaded;
- bool uses_vertex;
- bool uses_position;
- bool uses_sss;
- bool uses_transmittance;
- bool uses_screen_texture;
- bool uses_depth_texture;
- bool uses_normal_texture;
- bool uses_time;
- bool writes_modelview_or_projection;
- bool uses_world_coordinates;
- Cull cull_mode;
+ bool uses_point_size = false;
+ bool uses_alpha = false;
+ bool uses_blend_alpha = false;
+ bool uses_alpha_clip = false;
+ bool uses_depth_pre_pass = false;
+ bool uses_discard = false;
+ bool uses_roughness = false;
+ bool uses_normal = false;
+ bool uses_particle_trails = false;
+
+ bool unshaded = false;
+ bool uses_vertex = false;
+ bool uses_position = false;
+ bool uses_sss = false;
+ bool uses_transmittance = false;
+ bool uses_screen_texture = false;
+ bool uses_depth_texture = false;
+ bool uses_normal_texture = false;
+ bool uses_time = false;
+ bool writes_modelview_or_projection = false;
+ bool uses_world_coordinates = false;
+ Cull cull_mode = CULL_DISABLED;
uint64_t last_pass = 0;
uint32_t index = 0;
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 60badbdfee..cdddc35579 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
@@ -415,8 +415,6 @@ RS::ShaderNativeSourceCode SceneShaderForwardMobile::ShaderData::get_native_sour
SceneShaderForwardMobile::ShaderData::ShaderData() :
shader_list_element(this) {
- valid = false;
- uses_screen_texture = false;
}
SceneShaderForwardMobile::ShaderData::~ShaderData() {
diff --git a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h
index b89fe908d3..50b5fb26ec 100644
--- a/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h
+++ b/servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.h
@@ -97,9 +97,9 @@ public:
ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE_AND_TO_ONE
};
- bool valid;
+ bool valid = false;
RID version;
- uint32_t vertex_input_mask;
+ uint32_t vertex_input_mask = 0;
PipelineCacheRD pipelines[CULL_VARIANT_MAX][RS::PRIMITIVE_MAX][SHADER_VERSION_MAX];
String path;
@@ -108,7 +108,7 @@ public:
Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Vector<uint32_t> ubo_offsets;
- uint32_t ubo_size;
+ uint32_t ubo_size = 0;
String code;
Map<StringName, Map<int, RID>> default_texture_params;
@@ -116,26 +116,26 @@ public:
DepthDraw depth_draw;
DepthTest depth_test;
- bool uses_point_size;
- bool uses_alpha;
- bool uses_blend_alpha;
- bool uses_alpha_clip;
- bool uses_depth_pre_pass;
- bool uses_discard;
- bool uses_roughness;
- bool uses_normal;
- bool uses_particle_trails;
-
- bool unshaded;
- bool uses_vertex;
- bool uses_sss;
- bool uses_transmittance;
- bool uses_screen_texture;
- bool uses_depth_texture;
- bool uses_normal_texture;
- bool uses_time;
- bool writes_modelview_or_projection;
- bool uses_world_coordinates;
+ bool uses_point_size = false;
+ bool uses_alpha = false;
+ bool uses_blend_alpha = false;
+ bool uses_alpha_clip = false;
+ bool uses_depth_pre_pass = false;
+ bool uses_discard = false;
+ bool uses_roughness = false;
+ bool uses_normal = false;
+ bool uses_particle_trails = false;
+
+ bool unshaded = false;
+ bool uses_vertex = false;
+ bool uses_sss = false;
+ bool uses_transmittance = false;
+ bool uses_screen_texture = false;
+ bool uses_depth_texture = false;
+ bool uses_normal_texture = false;
+ bool uses_time = false;
+ bool writes_modelview_or_projection = false;
+ bool uses_world_coordinates = false;
uint64_t last_pass = 0;
uint32_t index = 0;
diff --git a/servers/rendering/renderer_rd/pipeline_cache_rd.h b/servers/rendering/renderer_rd/pipeline_cache_rd.h
index 1e80381d88..ad83fc76b7 100644
--- a/servers/rendering/renderer_rd/pipeline_cache_rd.h
+++ b/servers/rendering/renderer_rd/pipeline_cache_rd.h
@@ -45,7 +45,7 @@ class PipelineCacheRD {
RD::PipelineMultisampleState multisample_state;
RD::PipelineDepthStencilState depth_stencil_state;
RD::PipelineColorBlendState blend_state;
- int dynamic_state_flags;
+ int dynamic_state_flags = 0;
Vector<RD::PipelineSpecializationConstant> base_specialization_constants;
struct Version {
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
index 8c727b2512..506fc3b2ab 100644
--- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp
@@ -2232,12 +2232,6 @@ RS::ShaderNativeSourceCode RendererCanvasRenderRD::CanvasShaderData::get_native_
return canvas_singleton->shader.canvas_shader.version_get_native_source_code(version);
}
-RendererCanvasRenderRD::CanvasShaderData::CanvasShaderData() {
- valid = false;
- uses_screen_texture = false;
- uses_sdf = false;
-}
-
RendererCanvasRenderRD::CanvasShaderData::~CanvasShaderData() {
RendererCanvasRenderRD *canvas_singleton = static_cast<RendererCanvasRenderRD *>(RendererCanvasRender::singleton);
ERR_FAIL_COND(!canvas_singleton);
diff --git a/servers/rendering/renderer_rd/renderer_canvas_render_rd.h b/servers/rendering/renderer_rd/renderer_canvas_render_rd.h
index 6448e1a664..06970acca6 100644
--- a/servers/rendering/renderer_rd/renderer_canvas_render_rd.h
+++ b/servers/rendering/renderer_rd/renderer_canvas_render_rd.h
@@ -161,7 +161,7 @@ class RendererCanvasRenderRD : public RendererCanvasRender {
BLEND_MODE_DISABLED,
};
- bool valid;
+ bool valid = false;
RID version;
PipelineVariants pipeline_variants;
String path;
@@ -170,7 +170,7 @@ class RendererCanvasRenderRD : public RendererCanvasRender {
Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Vector<uint32_t> ubo_offsets;
- uint32_t ubo_size;
+ uint32_t ubo_size = 0;
String code;
Map<StringName, Map<int, RID>> default_texture_params;
@@ -190,7 +190,7 @@ class RendererCanvasRenderRD : public RendererCanvasRender {
virtual Variant get_default_parameter(const StringName &p_parameter) const;
virtual RS::ShaderNativeSourceCode get_native_source_code() const;
- CanvasShaderData();
+ CanvasShaderData() {}
virtual ~CanvasShaderData();
};
diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
index fd56de845f..759b8690eb 100644
--- a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp
@@ -286,7 +286,6 @@ RendererCompositorRD::RendererCompositorRD() {
}
singleton = this;
- time = 0;
texture_storage = memnew(RendererRD::TextureStorage);
material_storage = memnew(RendererRD::MaterialStorage);
diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.h b/servers/rendering/renderer_rd/renderer_compositor_rd.h
index 768e9e0947..26bd28286b 100644
--- a/servers/rendering/renderer_rd/renderer_compositor_rd.h
+++ b/servers/rendering/renderer_rd/renderer_compositor_rd.h
@@ -50,11 +50,11 @@ class RendererCompositorRD : public RendererCompositor {
protected:
UniformSetCacheRD *uniform_set_cache = nullptr;
RendererCanvasRenderRD *canvas = nullptr;
- RendererRD::LightStorage *light_storage;
- RendererRD::MaterialStorage *material_storage;
- RendererRD::MeshStorage *mesh_storage;
- RendererRD::ParticlesStorage *particles_storage;
- RendererRD::TextureStorage *texture_storage;
+ RendererRD::LightStorage *light_storage = nullptr;
+ RendererRD::MaterialStorage *material_storage = nullptr;
+ RendererRD::MeshStorage *mesh_storage = nullptr;
+ RendererRD::ParticlesStorage *particles_storage = nullptr;
+ RendererRD::TextureStorage *texture_storage = nullptr;
RendererStorageRD *storage = nullptr;
RendererSceneRenderRD *scene = nullptr;
@@ -92,8 +92,8 @@ protected:
Map<RID, RID> render_target_descriptors;
- double time;
- double delta;
+ double time = 0.0;
+ double delta = 0.0;
static uint64_t frame;
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
index 26365aafc4..3bfcf18f12 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp
@@ -3976,10 +3976,6 @@ RS::ShaderNativeSourceCode RendererSceneRenderRD::FogShaderData::get_native_sour
return scene_singleton->volumetric_fog.shader.version_get_native_source_code(version);
}
-RendererSceneRenderRD::FogShaderData::FogShaderData() {
- valid = false;
-}
-
RendererSceneRenderRD::FogShaderData::~FogShaderData() {
RendererSceneRenderRD *scene_singleton = static_cast<RendererSceneRenderRD *>(RendererSceneRenderRD::singleton);
ERR_FAIL_COND(!scene_singleton);
diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.h b/servers/rendering/renderer_rd/renderer_scene_render_rd.h
index 2b79d8997f..6bf3a95dd0 100644
--- a/servers/rendering/renderer_rd/renderer_scene_render_rd.h
+++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.h
@@ -47,10 +47,10 @@
#include "servers/rendering/rendering_device.h"
struct RenderDataRD {
- RID render_buffers = RID();
+ RID render_buffers;
- Transform3D cam_transform = Transform3D();
- CameraMatrix cam_projection = CameraMatrix();
+ Transform3D cam_transform;
+ CameraMatrix cam_projection;
bool cam_orthogonal = false;
// For stereo rendering
@@ -67,18 +67,18 @@ struct RenderDataRD {
const PagedArray<RID> *decals = nullptr;
const PagedArray<RID> *lightmaps = nullptr;
const PagedArray<RID> *fog_volumes = nullptr;
- RID environment = RID();
- RID camera_effects = RID();
- RID shadow_atlas = RID();
- RID reflection_atlas = RID();
- RID reflection_probe = RID();
+ RID environment;
+ RID camera_effects;
+ RID shadow_atlas;
+ RID reflection_atlas;
+ RID reflection_probe;
int reflection_probe_pass = 0;
float lod_distance_multiplier = 0.0;
- Plane lod_camera_plane = Plane();
+ Plane lod_camera_plane;
float screen_mesh_lod_threshold = 0.0;
- RID cluster_buffer = RID();
+ RID cluster_buffer;
uint32_t cluster_size = 0;
uint32_t cluster_max_elements = 0;
@@ -95,8 +95,8 @@ class RendererSceneRenderRD : public RendererSceneRender {
protected:
RendererStorageRD *storage = nullptr;
RendererRD::ToneMapper *tone_mapper = nullptr;
- double time;
- double time_step = 0;
+ double time = 0.0;
+ double time_step = 0.0;
struct RenderBufferData {
virtual void configure(RID p_color_buffer, RID p_depth_buffer, RID p_target_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa, uint32_t p_view_count) = 0;
@@ -236,7 +236,7 @@ private:
struct DecalInstance {
RID decal;
Transform3D transform;
- uint32_t cull_mask;
+ uint32_t cull_mask = 0;
ForwardID forward_id = -1;
};
@@ -256,7 +256,7 @@ private:
struct ShadowShrinkStage {
RID texture;
RID filter_texture;
- uint32_t size;
+ uint32_t size = 0;
};
struct ShadowAtlas {
@@ -268,27 +268,20 @@ private:
};
struct Quadrant {
- uint32_t subdivision;
+ uint32_t subdivision = 0;
struct Shadow {
RID owner;
- uint64_t version;
- uint64_t fog_version; // used for fog
- uint64_t alloc_tick;
-
- Shadow() {
- version = 0;
- fog_version = 0;
- alloc_tick = 0;
- }
+ uint64_t version = 0;
+ uint64_t fog_version = 0; // used for fog
+ uint64_t alloc_tick = 0;
+
+ Shadow() {}
};
Vector<Shadow> shadows;
- Quadrant() {
- subdivision = 0; //not in use
- }
-
+ Quadrant() {}
} quadrants[4];
int size_order[4] = { 0, 1, 2, 3 };
@@ -337,7 +330,6 @@ private:
int size = 0;
bool use_16_bits = true;
int current_light = 0;
-
} directional_shadow;
void _update_directional_shadow_atlas();
@@ -910,7 +902,7 @@ private:
void _update_volumetric_fog(RID p_render_buffers, RID p_environment, const CameraMatrix &p_cam_projection, const Transform3D &p_cam_transform, RID p_shadow_atlas, int p_directional_light_count, bool p_use_directional_shadows, int p_positional_light_count, int p_voxel_gi_count, const PagedArray<RID> &p_fog_volumes);
struct FogShaderData : public RendererRD::ShaderData {
- bool valid;
+ bool valid = false;
RID version;
RID pipeline;
@@ -918,13 +910,13 @@ private:
Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Vector<uint32_t> ubo_offsets;
- uint32_t ubo_size;
+ uint32_t ubo_size = 0;
String path;
String code;
Map<StringName, Map<int, RID>> default_texture_params;
- bool uses_time;
+ bool uses_time = false;
virtual void set_code(const String &p_Code);
virtual void set_default_texture_param(const StringName &p_name, RID p_texture, int p_index);
@@ -935,7 +927,8 @@ private:
virtual bool casts_shadows() const;
virtual Variant get_default_parameter(const StringName &p_parameter) const;
virtual RS::ShaderNativeSourceCode get_native_source_code() const;
- FogShaderData();
+
+ FogShaderData() {}
virtual ~FogShaderData();
};
diff --git a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
index db7a5250b6..a3d53e00af 100644
--- a/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_scene_sky_rd.cpp
@@ -224,10 +224,6 @@ RS::ShaderNativeSourceCode RendererSceneSkyRD::SkyShaderData::get_native_source_
return scene_singleton->sky.sky_shader.shader.version_get_native_source_code(version);
}
-RendererSceneSkyRD::SkyShaderData::SkyShaderData() {
- valid = false;
-}
-
RendererSceneSkyRD::SkyShaderData::~SkyShaderData() {
RendererSceneRenderRD *scene_singleton = static_cast<RendererSceneRenderRD *>(RendererSceneRenderRD::singleton);
ERR_FAIL_COND(!scene_singleton);
diff --git a/servers/rendering/renderer_rd/renderer_scene_sky_rd.h b/servers/rendering/renderer_rd/renderer_scene_sky_rd.h
index 010e2178a9..497d27ec26 100644
--- a/servers/rendering/renderer_rd/renderer_scene_sky_rd.h
+++ b/servers/rendering/renderer_rd/renderer_scene_sky_rd.h
@@ -106,7 +106,7 @@ private:
};
struct SkyShaderData : public RendererRD::ShaderData {
- bool valid;
+ bool valid = false;
RID version;
PipelineCacheRD pipelines[SKY_VERSION_MAX];
@@ -114,17 +114,17 @@ private:
Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Vector<uint32_t> ubo_offsets;
- uint32_t ubo_size;
+ uint32_t ubo_size = 0;
String path;
String code;
Map<StringName, Map<int, RID>> default_texture_params;
- bool uses_time;
- bool uses_position;
- bool uses_half_res;
- bool uses_quarter_res;
- bool uses_light;
+ bool uses_time = false;
+ bool uses_position = false;
+ bool uses_half_res = false;
+ bool uses_quarter_res = false;
+ bool uses_light = false;
virtual void set_code(const String &p_Code);
virtual void set_default_texture_param(const StringName &p_name, RID p_texture, int p_index);
@@ -135,7 +135,8 @@ private:
virtual bool casts_shadows() const;
virtual Variant get_default_parameter(const StringName &p_parameter) const;
virtual RS::ShaderNativeSourceCode get_native_source_code() const;
- SkyShaderData();
+
+ SkyShaderData() {}
virtual ~SkyShaderData();
};
diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
index d939a0d641..c3747ffabc 100644
--- a/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/material_storage.cpp
@@ -388,26 +388,60 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
float *gui = reinterpret_cast<float *>(data);
if (p_array_size > 0) {
- const PackedVector3Array &a = value;
- int s = a.size();
+ if (value.get_type() == Variant::PACKED_COLOR_ARRAY) {
+ const PackedColorArray &a = value;
+ int s = a.size();
- for (int i = 0, j = 0; i < p_array_size; i++, j += 4) {
- if (i < s) {
- gui[j] = a[i].x;
- gui[j + 1] = a[i].y;
- gui[j + 2] = a[i].z;
- } else {
- gui[j] = 0;
- gui[j + 1] = 0;
- gui[j + 2] = 0;
+ for (int i = 0, j = 0; i < p_array_size; i++, j += 4) {
+ if (i < s) {
+ Color color = a[i];
+ if (p_linear_color) {
+ color = color.srgb_to_linear();
+ }
+ gui[j] = color.r;
+ gui[j + 1] = color.g;
+ gui[j + 2] = color.b;
+ } else {
+ gui[j] = 0;
+ gui[j + 1] = 0;
+ gui[j + 2] = 0;
+ }
+ gui[j + 3] = 0; // ignored
+ }
+ } else {
+ const PackedVector3Array &a = value;
+ int s = a.size();
+
+ for (int i = 0, j = 0; i < p_array_size; i++, j += 4) {
+ if (i < s) {
+ gui[j] = a[i].x;
+ gui[j + 1] = a[i].y;
+ gui[j + 2] = a[i].z;
+ } else {
+ gui[j] = 0;
+ gui[j + 1] = 0;
+ gui[j + 2] = 0;
+ }
+ gui[j + 3] = 0; // ignored
}
- gui[j + 3] = 0; // ignored
}
} else {
- Vector3 v = value;
- gui[0] = v.x;
- gui[1] = v.y;
- gui[2] = v.z;
+ if (value.get_type() == Variant::COLOR) {
+ Color v = value;
+
+ if (p_linear_color) {
+ v = v.srgb_to_linear();
+ }
+
+ gui[0] = v.r;
+ gui[1] = v.g;
+ gui[2] = v.b;
+ } else {
+ Vector3 v = value;
+ gui[0] = v.x;
+ gui[1] = v.y;
+ gui[2] = v.z;
+ }
}
} break;
case ShaderLanguage::TYPE_VEC4: {
@@ -921,7 +955,7 @@ void MaterialData::update_uniform_buffer(const Map<StringName, ShaderLanguage::S
//value=E.value.default_value;
} else {
//zero because it was not provided
- if (E.value.type == ShaderLanguage::TYPE_VEC4 && E.value.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ if ((E.value.type == ShaderLanguage::TYPE_VEC3 || E.value.type == ShaderLanguage::TYPE_VEC4) && E.value.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
//colors must be set as black, with alpha as 1.0
_fill_std140_variant_ubo_value(E.value.type, E.value.array_size, Color(0, 0, 0, 1), data, p_use_linear_color);
} else {
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
index 402536de88..13b171979a 100644
--- a/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
+++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.cpp
@@ -1664,10 +1664,6 @@ RS::ShaderNativeSourceCode ParticlesStorage::ParticlesShaderData::get_native_sou
return ParticlesStorage::get_singleton()->particles_shader.shader.version_get_native_source_code(version);
}
-ParticlesStorage::ParticlesShaderData::ParticlesShaderData() {
- valid = false;
-}
-
ParticlesStorage::ParticlesShaderData::~ParticlesShaderData() {
//pipeline variants will clear themselves if shader is gone
if (version.is_valid()) {
diff --git a/servers/rendering/renderer_rd/storage_rd/particles_storage.h b/servers/rendering/renderer_rd/storage_rd/particles_storage.h
index 7764af08f2..c6480794c1 100644
--- a/servers/rendering/renderer_rd/storage_rd/particles_storage.h
+++ b/servers/rendering/renderer_rd/storage_rd/particles_storage.h
@@ -341,16 +341,15 @@ private:
/* Particle Shader */
struct ParticlesShaderData : public ShaderData {
- bool valid;
+ bool valid = false;
RID version;
bool uses_collision = false;
- //PipelineCacheRD pipelines[SKY_VERSION_MAX];
Map<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms;
Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Vector<uint32_t> ubo_offsets;
- uint32_t ubo_size;
+ uint32_t ubo_size = 0;
String path;
String code;
@@ -373,7 +372,7 @@ private:
virtual Variant get_default_parameter(const StringName &p_parameter) const;
virtual RS::ShaderNativeSourceCode get_native_source_code() const;
- ParticlesShaderData();
+ ParticlesShaderData() {}
virtual ~ParticlesShaderData();
};
diff --git a/servers/rendering/renderer_scene_cull.h b/servers/rendering/renderer_scene_cull.h
index 5f71250ced..b5e8cf702f 100644
--- a/servers/rendering/renderer_scene_cull.h
+++ b/servers/rendering/renderer_scene_cull.h
@@ -921,7 +921,7 @@ public:
RID_Owner<Instance, true> instance_owner;
- uint32_t geometry_instance_pair_mask; // used in traditional forward, unnecessary on clustered
+ uint32_t geometry_instance_pair_mask = 0; // used in traditional forward, unnecessary on clustered
virtual RID instance_allocate();
virtual void instance_initialize(RID p_rid);
diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp
index 8507e20648..99e8d22b75 100644
--- a/servers/rendering/renderer_viewport.cpp
+++ b/servers/rendering/renderer_viewport.cpp
@@ -195,8 +195,6 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
}
}
- Color bgcolor = RSG::storage->get_default_clear_color();
-
if (!p_viewport->disable_2d && !p_viewport->disable_environment && RSG::scene->is_scenario(p_viewport->scenario)) {
RID environment = RSG::scene->scenario_get_environment(p_viewport->scenario);
if (RSG::scene->is_environment(environment)) {
@@ -207,15 +205,6 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
bool can_draw_3d = RSG::scene->is_camera(p_viewport->camera) && !p_viewport->disable_3d;
- if (p_viewport->clear_mode != RS::VIEWPORT_CLEAR_NEVER) {
- if (p_viewport->transparent_bg) {
- bgcolor = Color(0, 0, 0, 0);
- }
- if (p_viewport->clear_mode == RS::VIEWPORT_CLEAR_ONLY_NEXT_FRAME) {
- p_viewport->clear_mode = RS::VIEWPORT_CLEAR_NEVER;
- }
- }
-
if ((scenario_draw_canvas_bg || can_draw_3d) && !p_viewport->render_buffers.is_valid()) {
//wants to draw 3D but there is no render buffer, create
p_viewport->render_buffers = RSG::scene->render_buffers_create();
@@ -223,7 +212,14 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
_configure_3d_render_buffers(p_viewport);
}
- RSG::texture_storage->render_target_request_clear(p_viewport->render_target, bgcolor);
+ Color bgcolor = p_viewport->transparent_bg ? Color(0, 0, 0, 0) : RSG::storage->get_default_clear_color();
+
+ if (p_viewport->clear_mode != RS::VIEWPORT_CLEAR_NEVER) {
+ RSG::texture_storage->render_target_request_clear(p_viewport->render_target, bgcolor);
+ if (p_viewport->clear_mode == RS::VIEWPORT_CLEAR_ONLY_NEXT_FRAME) {
+ p_viewport->clear_mode = RS::VIEWPORT_CLEAR_NEVER;
+ }
+ }
if (!scenario_draw_canvas_bg && can_draw_3d) {
_draw_3d(p_viewport);
diff --git a/servers/rendering/shader_compiler.h b/servers/rendering/shader_compiler.h
index 8f0ee664ac..347ecf2988 100644
--- a/servers/rendering/shader_compiler.h
+++ b/servers/rendering/shader_compiler.h
@@ -106,8 +106,8 @@ private:
void _dump_function_deps(const ShaderLanguage::ShaderNode *p_node, const StringName &p_for_func, const Map<StringName, String> &p_func_code, String &r_to_add, Set<StringName> &added);
String _dump_node_code(const ShaderLanguage::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning, bool p_scope = true);
- const ShaderLanguage::ShaderNode *shader;
- const ShaderLanguage::FunctionNode *function;
+ const ShaderLanguage::ShaderNode *shader = nullptr;
+ const ShaderLanguage::FunctionNode *function = nullptr;
StringName current_func_name;
StringName time_name;
Set<StringName> texture_functions;
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 54d1a6fd8d..1fd7062d6e 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -3548,13 +3548,25 @@ Variant ShaderLanguage::constant_value_to_variant(const Vector<ShaderLanguage::C
if (array_size > 0) {
array_size *= 3;
- PackedVector3Array array = PackedVector3Array();
- for (int i = 0; i < array_size; i += 3) {
- array.push_back(Vector3(p_value[i].real, p_value[i + 1].real, p_value[i + 2].real));
+ if (p_hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ PackedColorArray array = PackedColorArray();
+ for (int i = 0; i < array_size; i += 3) {
+ array.push_back(Color(p_value[i].real, p_value[i + 1].real, p_value[i + 2].real));
+ }
+ value = Variant(array);
+ } else {
+ PackedVector3Array array = PackedVector3Array();
+ for (int i = 0; i < array_size; i += 3) {
+ array.push_back(Vector3(p_value[i].real, p_value[i + 1].real, p_value[i + 2].real));
+ }
+ value = Variant(array);
}
- value = Variant(array);
} else {
- value = Variant(Vector3(p_value[0].real, p_value[1].real, p_value[2].real));
+ if (p_hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ value = Variant(Color(p_value[0].real, p_value[1].real, p_value[2].real));
+ } else {
+ value = Variant(Vector3(p_value[0].real, p_value[1].real, p_value[2].real));
+ }
}
break;
case ShaderLanguage::TYPE_VEC4:
@@ -3760,9 +3772,19 @@ PropertyInfo ShaderLanguage::uniform_to_property_info(const ShaderNode::Uniform
break;
case ShaderLanguage::TYPE_VEC3:
if (p_uniform.array_size > 0) {
- pi.type = Variant::PACKED_VECTOR3_ARRAY;
+ if (p_uniform.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ pi.hint = PROPERTY_HINT_COLOR_NO_ALPHA;
+ pi.type = Variant::PACKED_COLOR_ARRAY;
+ } else {
+ pi.type = Variant::PACKED_VECTOR3_ARRAY;
+ }
} else {
- pi.type = Variant::VECTOR3;
+ if (p_uniform.hint == ShaderLanguage::ShaderNode::Uniform::HINT_COLOR) {
+ pi.hint = PROPERTY_HINT_COLOR_NO_ALPHA;
+ pi.type = Variant::COLOR;
+ } else {
+ pi.type = Variant::VECTOR3;
+ }
}
break;
case ShaderLanguage::TYPE_VEC4: {
@@ -8001,8 +8023,8 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
} else if (tk.type == TK_HINT_BLACK_ALBEDO_TEXTURE) {
uniform2.hint = ShaderNode::Uniform::HINT_BLACK_ALBEDO;
} else if (tk.type == TK_HINT_COLOR) {
- if (type != TYPE_VEC4) {
- _set_error(vformat(RTR("Color hint is for '%s' only."), "vec4"));
+ if (type != TYPE_VEC3 && type != TYPE_VEC4) {
+ _set_error(vformat(RTR("Color hint is for '%s' or '%s' only."), "vec3", "vec4"));
return ERR_PARSE_ERROR;
}
uniform2.hint = ShaderNode::Uniform::HINT_COLOR;
@@ -9514,7 +9536,7 @@ Error ShaderLanguage::complete(const String &p_code, const ShaderCompileInfo &p_
} break;
case COMPLETION_HINT: {
- if (completion_base == DataType::TYPE_VEC4) {
+ if (completion_base == DataType::TYPE_VEC3 || completion_base == DataType::TYPE_VEC4) {
ScriptLanguage::CodeCompletionOption option("hint_color", ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT);
r_options->push_back(option);
} else if ((completion_base == DataType::TYPE_INT || completion_base == DataType::TYPE_FLOAT) && !completion_base_array) {
diff --git a/servers/rendering/shader_language.h b/servers/rendering/shader_language.h
index de6d912a4f..c707d09f29 100644
--- a/servers/rendering/shader_language.h
+++ b/servers/rendering/shader_language.h
@@ -874,11 +874,11 @@ private:
static const KeyWord keyword_list[];
- GlobalVariableGetTypeFunc global_var_get_type_func;
+ GlobalVariableGetTypeFunc global_var_get_type_func = nullptr;
- bool error_set;
+ bool error_set = false;
String error_str;
- int error_line;
+ int error_line = 0;
#ifdef DEBUG_ENABLED
struct Usage {
@@ -902,7 +902,7 @@ private:
List<ShaderWarning> warnings;
bool check_warnings = false;
- uint32_t warning_flags;
+ uint32_t warning_flags = 0;
void _add_line_warning(ShaderWarning::Code p_code, const StringName &p_subject = "", const Vector<Variant> &p_extra_args = Vector<Variant>()) {
warnings.push_back(ShaderWarning(p_code, tk_line, p_subject, p_extra_args));
@@ -917,8 +917,8 @@ private:
#endif // DEBUG_ENABLED
String code;
- int char_idx;
- int tk_line;
+ int char_idx = 0;
+ int tk_line = 0;
StringName current_function;
bool last_const = false;
@@ -1020,14 +1020,14 @@ private:
};
CompletionType completion_type;
- int completion_line;
+ int completion_line = 0;
BlockNode *completion_block = nullptr;
DataType completion_base;
- bool completion_base_array;
+ bool completion_base_array = false;
SubClassTag completion_class;
StringName completion_function;
StringName completion_struct;
- int completion_argument;
+ int completion_argument = 0;
const Map<StringName, FunctionInfo> *stages = nullptr;
diff --git a/servers/rendering_server.h b/servers/rendering_server.h
index 71896e9d11..2db384f7df 100644
--- a/servers/rendering_server.h
+++ b/servers/rendering_server.h
@@ -47,7 +47,7 @@ class RenderingServer : public Object {
static RenderingServer *singleton;
- int mm_policy;
+ int mm_policy = 0;
bool render_loop_enabled = true;
Array _get_array_from_surface(uint32_t p_format, Vector<uint8_t> p_vertex_data, Vector<uint8_t> p_attrib_data, Vector<uint8_t> p_skin_data, int p_vertex_len, Vector<uint8_t> p_index_data, int p_index_len) const;
diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.h
index 87016dddf6..58372a0ed6 100644
--- a/tests/core/string/test_string.h
+++ b/tests/core/string/test_string.h
@@ -636,6 +636,38 @@ TEST_CASE("[String] sprintf") {
REQUIRE(error == false);
CHECK(output == String("fish -5 frog"));
+ // Negative int left padded with spaces.
+ format = "fish %5d frog";
+ args.clear();
+ args.push_back(-5);
+ output = format.sprintf(args, &error);
+ REQUIRE(error == false);
+ CHECK(output == String("fish -5 frog"));
+
+ // Negative int left padded with zeros.
+ format = "fish %05d frog";
+ args.clear();
+ args.push_back(-5);
+ output = format.sprintf(args, &error);
+ REQUIRE(error == false);
+ CHECK(output == String("fish -0005 frog"));
+
+ // Negative int right padded with spaces.
+ format = "fish %-5d frog";
+ args.clear();
+ args.push_back(-5);
+ output = format.sprintf(args, &error);
+ REQUIRE(error == false);
+ CHECK(output == String("fish -5 frog"));
+
+ // Negative int right padded with zeros. (0 ignored)
+ format = "fish %-05d frog";
+ args.clear();
+ args.push_back(-5);
+ output = format.sprintf(args, &error);
+ REQUIRE(error == false);
+ CHECK(output == String("fish -5 frog"));
+
// Hex (lower)
format = "fish %x frog";
args.clear();
@@ -726,6 +758,14 @@ TEST_CASE("[String] sprintf") {
REQUIRE(error == false);
CHECK(output == String("fish 100 frog"));
+ // Negative real right padded with zeros. (0 ignored)
+ format = "fish %-011f frog";
+ args.clear();
+ args.push_back(-99.99);
+ output = format.sprintf(args, &error);
+ REQUIRE(error == false);
+ CHECK(output == String("fish -99.990000 frog"));
+
/////// Strings.
// String
diff --git a/tests/scene/test_theme.h b/tests/scene/test_theme.h
new file mode 100644
index 0000000000..fedffc8449
--- /dev/null
+++ b/tests/scene/test_theme.h
@@ -0,0 +1,257 @@
+/*************************************************************************/
+/* test_theme.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef TEST_THEME_H
+#define TEST_THEME_H
+
+#include "scene/resources/theme.h"
+#include "tests/test_tools.h"
+
+#include "thirdparty/doctest/doctest.h"
+
+namespace TestTheme {
+
+class Fixture {
+public:
+ struct DataEntry {
+ Theme::DataType type;
+ Variant value;
+ } const valid_data[Theme::DATA_TYPE_MAX] = {
+ { Theme::DATA_TYPE_COLOR, Color() },
+ { Theme::DATA_TYPE_CONSTANT, 42 },
+ { Theme::DATA_TYPE_FONT, Ref<Font>(memnew(Font)) },
+ { Theme::DATA_TYPE_FONT_SIZE, 42 },
+ { Theme::DATA_TYPE_ICON, Ref<Texture>(memnew(ImageTexture)) },
+ { Theme::DATA_TYPE_STYLEBOX, Ref<StyleBox>(memnew(StyleBoxFlat)) },
+ };
+
+ const StringName valid_item_name = "valid_item_name";
+ const StringName valid_type_name = "ValidTypeName";
+};
+
+TEST_CASE_FIXTURE(Fixture, "[Theme] Good theme type names") {
+ StringName names[] = {
+ "", // Empty name.
+ "CapitalizedName",
+ "snake_cased_name",
+ "42",
+ "_Underscore_",
+ };
+
+ SUBCASE("add_type") {
+ for (const StringName &name : names) {
+ Ref<Theme> theme = memnew(Theme);
+
+ ErrorDetector ed;
+ theme->add_type(name);
+ CHECK_FALSE(ed.has_error);
+ }
+ }
+
+ SUBCASE("set_theme_item") {
+ for (const StringName &name : names) {
+ for (const DataEntry &entry : valid_data) {
+ Ref<Theme> theme = memnew(Theme);
+
+ ErrorDetector ed;
+ theme->set_theme_item(entry.type, valid_item_name, name, entry.value);
+ CHECK_FALSE(ed.has_error);
+ }
+ }
+ }
+
+ SUBCASE("add_theme_item_type") {
+ for (const StringName &name : names) {
+ for (const DataEntry &entry : valid_data) {
+ Ref<Theme> theme = memnew(Theme);
+
+ ErrorDetector ed;
+ theme->add_theme_item_type(entry.type, name);
+ CHECK_FALSE(ed.has_error);
+ }
+ }
+ }
+
+ SUBCASE("set_type_variation") {
+ for (const StringName &name : names) {
+ Ref<Theme> theme = memnew(Theme);
+
+ ErrorDetector ed;
+ theme->set_type_variation(valid_type_name, name);
+ CHECK(ed.has_error == (name == StringName()));
+ }
+ for (const StringName &name : names) {
+ Ref<Theme> theme = memnew(Theme);
+
+ ErrorDetector ed;
+ theme->set_type_variation(name, valid_type_name);
+ CHECK(ed.has_error == (name == StringName()));
+ }
+ }
+}
+
+TEST_CASE_FIXTURE(Fixture, "[Theme] Bad theme type names") {
+ StringName names[] = {
+ "With/Slash",
+ "With Space",
+ "With@various$symbols!",
+ String::utf8("contains_汉字"),
+ };
+
+ SUBCASE("add_type") {
+ for (const StringName &name : names) {
+ Ref<Theme> theme = memnew(Theme);
+
+ ErrorDetector ed;
+ theme->add_type(name);
+ CHECK(ed.has_error);
+ }
+ }
+
+ SUBCASE("set_theme_item") {
+ for (const StringName &name : names) {
+ for (const DataEntry &entry : valid_data) {
+ Ref<Theme> theme = memnew(Theme);
+
+ ErrorDetector ed;
+ theme->set_theme_item(entry.type, valid_item_name, name, entry.value);
+ CHECK(ed.has_error);
+ }
+ }
+ }
+
+ SUBCASE("add_theme_item_type") {
+ for (const StringName &name : names) {
+ for (const DataEntry &entry : valid_data) {
+ Ref<Theme> theme = memnew(Theme);
+
+ ErrorDetector ed;
+ theme->add_theme_item_type(entry.type, name);
+ CHECK(ed.has_error);
+ }
+ }
+ }
+
+ SUBCASE("set_type_variation") {
+ for (const StringName &name : names) {
+ Ref<Theme> theme = memnew(Theme);
+
+ ErrorDetector ed;
+ theme->set_type_variation(valid_type_name, name);
+ CHECK(ed.has_error);
+ }
+ for (const StringName &name : names) {
+ Ref<Theme> theme = memnew(Theme);
+
+ ErrorDetector ed;
+ theme->set_type_variation(name, valid_type_name);
+ CHECK(ed.has_error);
+ }
+ }
+}
+
+TEST_CASE_FIXTURE(Fixture, "[Theme] Good theme item names") {
+ StringName names[] = {
+ "CapitalizedName",
+ "snake_cased_name",
+ "42",
+ "_Underscore_",
+ };
+
+ SUBCASE("set_theme_item") {
+ for (const StringName &name : names) {
+ for (const DataEntry &entry : valid_data) {
+ Ref<Theme> theme = memnew(Theme);
+
+ ErrorDetector ed;
+ theme->set_theme_item(entry.type, name, valid_type_name, entry.value);
+ CHECK_FALSE(ed.has_error);
+ CHECK(theme->has_theme_item(entry.type, name, valid_type_name));
+ }
+ }
+ }
+
+ SUBCASE("rename_theme_item") {
+ for (const StringName &name : names) {
+ for (const DataEntry &entry : valid_data) {
+ Ref<Theme> theme = memnew(Theme);
+ theme->set_theme_item(entry.type, valid_item_name, valid_type_name, entry.value);
+
+ ErrorDetector ed;
+ theme->rename_theme_item(entry.type, valid_item_name, name, valid_type_name);
+ CHECK_FALSE(ed.has_error);
+ CHECK_FALSE(theme->has_theme_item(entry.type, valid_item_name, valid_type_name));
+ CHECK(theme->has_theme_item(entry.type, name, valid_type_name));
+ }
+ }
+ }
+}
+
+TEST_CASE_FIXTURE(Fixture, "[Theme] Bad theme item names") {
+ StringName names[] = {
+ "", // Empty name.
+ "With/Slash",
+ "With Space",
+ "With@various$symbols!",
+ String::utf8("contains_汉字"),
+ };
+
+ SUBCASE("set_theme_item") {
+ for (const StringName &name : names) {
+ for (const DataEntry &entry : valid_data) {
+ Ref<Theme> theme = memnew(Theme);
+
+ ErrorDetector ed;
+ theme->set_theme_item(entry.type, name, valid_type_name, entry.value);
+ CHECK(ed.has_error);
+ CHECK_FALSE(theme->has_theme_item(entry.type, name, valid_type_name));
+ }
+ }
+ }
+
+ SUBCASE("rename_theme_item") {
+ for (const StringName &name : names) {
+ for (const DataEntry &entry : valid_data) {
+ Ref<Theme> theme = memnew(Theme);
+ theme->set_theme_item(entry.type, valid_item_name, valid_type_name, entry.value);
+
+ ErrorDetector ed;
+ theme->rename_theme_item(entry.type, valid_item_name, name, valid_type_name);
+ CHECK(ed.has_error);
+ CHECK(theme->has_theme_item(entry.type, valid_item_name, valid_type_name));
+ CHECK_FALSE(theme->has_theme_item(entry.type, name, valid_type_name));
+ }
+ }
+ }
+}
+
+} // namespace TestTheme
+
+#endif // TEST_THEME_H
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index a059949105..be51afd83c 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -77,6 +77,7 @@
#include "tests/scene/test_gradient.h"
#include "tests/scene/test_path_3d.h"
#include "tests/scene/test_text_edit.h"
+#include "tests/scene/test_theme.h"
#include "tests/servers/test_text_server.h"
#include "tests/test_validate_testing.h"
diff --git a/thirdparty/noise/FastNoiseLite.h b/thirdparty/noise/FastNoiseLite.h
index 8015bf636a..a213f0888e 100644
--- a/thirdparty/noise/FastNoiseLite.h
+++ b/thirdparty/noise/FastNoiseLite.h
@@ -1611,6 +1611,12 @@ private:
}
}
+// GCC raises warnings when integer overflows occur, which are needed for hashing here.
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Waggressive-loop-optimizations"
+#endif
+
template <typename FNfloat>
float SingleCellular(int seed, FNfloat x, FNfloat y, FNfloat z) const
{
@@ -1765,6 +1771,9 @@ private:
}
}
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif
// Perlin Noise
diff --git a/thirdparty/noise/patches/FastNoiseLite.patch b/thirdparty/noise/patches/FastNoiseLite.patch
index 41ec943077..3c835c7b06 100644
--- a/thirdparty/noise/patches/FastNoiseLite.patch
+++ b/thirdparty/noise/patches/FastNoiseLite.patch
@@ -430,3 +430,26 @@
{
x *= frequency;
y *= frequency;
+@@ -1611,6 +1611,12 @@ private:
+ }
+ }
+
++// GCC raises warnings when integer overflows occur, which are needed for hashing here.
++#if defined(__GNUC__) && !defined(__clang__)
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Waggressive-loop-optimizations"
++#endif
++
+ template <typename FNfloat>
+ float SingleCellular(int seed, FNfloat x, FNfloat y, FNfloat z) const
+ {
+@@ -1765,6 +1771,9 @@ private:
+ }
+ }
+
++#if defined(__GNUC__) && !defined(__clang__)
++#pragma GCC diagnostic pop
++#endif
+
+ // Perlin Noise
+ \ No newline at end of file