From c273ddc3eefce78f8eed86dbc71fffd1b0443e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 2 May 2022 16:28:25 +0200 Subject: Style: Partially apply clang-tidy's `cppcoreguidelines-pro-type-member-init` Didn't commit all the changes where it wants to initialize a struct with `{}`. Should be reviewed in a separate PR. Option `IgnoreArrays` enabled for now to be conservative, can be disabled to see if it proposes more useful changes. Also fixed manually a handful of other missing initializations / moved some from constructors. --- .clang-tidy | 6 +- core/config/project_settings.cpp | 6 +- core/core_constants.cpp | 2 +- core/input/input.h | 4 +- core/io/file_access_network.h | 11 +-- core/io/file_access_zip.h | 2 +- core/io/ip.cpp | 3 +- core/math/convex_hull.cpp | 2 +- core/math/geometry_2d.cpp | 6 +- core/math/random_pcg.h | 4 +- core/os/os.h | 3 +- core/os/pool_allocator.h | 16 ++-- core/string/optimized_translation.cpp | 4 +- core/variant/variant_call.cpp | 18 ++--- core/variant/variant_construct.cpp | 10 +-- core/variant/variant_setget.cpp | 26 +++---- core/variant/variant_utility.cpp | 14 ++-- drivers/gles3/rasterizer_storage_gles3.h | 2 +- drivers/gles3/shader_gles3.h | 2 +- drivers/gles3/storage/config.h | 68 ++++++++-------- drivers/unix/dir_access_unix.h | 4 +- drivers/vulkan/rendering_device_vulkan.h | 4 +- drivers/vulkan/vulkan_context.h | 42 +++++----- editor/animation_bezier_editor.h | 12 +-- editor/animation_track_editor.cpp | 18 ----- editor/animation_track_editor.h | 33 ++++---- editor/animation_track_editor_plugins.cpp | 1 - editor/animation_track_editor_plugins.h | 8 +- editor/code_editor.cpp | 4 - editor/code_editor.h | 8 +- editor/connections_dialog.h | 2 +- .../debug_adapter/debug_adapter_protocol.h | 6 +- editor/debugger/editor_performance_profiler.h | 2 +- editor/debugger/editor_profiler.cpp | 6 -- editor/debugger/editor_profiler.h | 14 ++-- editor/debugger/editor_visual_profiler.cpp | 14 ---- editor/debugger/editor_visual_profiler.h | 17 ++-- editor/editor_audio_buses.cpp | 1 - editor/editor_audio_buses.h | 8 +- editor/editor_file_dialog.cpp | 7 -- editor/editor_file_dialog.h | 18 ++--- editor/editor_help.h | 4 +- editor/editor_node.cpp | 10 --- editor/editor_node.h | 24 +++--- editor/editor_spin_slider.cpp | 4 - editor/editor_spin_slider.h | 17 ++-- editor/fileserver/editor_file_server.cpp | 3 - editor/fileserver/editor_file_server.h | 8 +- editor/import/scene_import_settings.h | 14 ++-- editor/plugin_config_dialog.h | 2 +- editor/plugins/abstract_polygon_2d_editor.cpp | 4 - editor/plugins/abstract_polygon_2d_editor.h | 8 +- editor/plugins/animation_blend_space_1d_editor.cpp | 5 -- editor/plugins/animation_blend_space_1d_editor.h | 10 +-- editor/plugins/animation_state_machine_editor.cpp | 9 --- editor/plugins/animation_state_machine_editor.h | 20 ++--- editor/plugins/asset_library_editor_plugin.h | 10 +-- editor/plugins/canvas_item_editor_plugin.cpp | 8 -- editor/plugins/canvas_item_editor_plugin.h | 20 ++--- editor/plugins/mesh_library_editor_plugin.h | 6 +- editor/plugins/multimesh_editor_plugin.h | 2 +- editor/plugins/node_3d_editor_plugin.h | 8 +- editor/plugins/path_2d_editor_plugin.h | 6 +- editor/plugins/path_3d_editor_plugin.h | 2 +- editor/plugins/polygon_2d_editor_plugin.h | 4 +- editor/plugins/polygon_3d_editor_plugin.h | 4 +- editor/plugins/script_editor_plugin.h | 2 +- editor/plugins/shader_editor_plugin.h | 2 +- editor/plugins/skeleton_3d_editor_plugin.h | 2 +- editor/plugins/sprite_frames_editor_plugin.h | 2 +- editor/plugins/texture_region_editor_plugin.h | 4 +- editor/plugins/tiles/tile_data_editors.h | 10 +-- editor/plugins/visual_shader_editor_plugin.cpp | 4 +- editor/progress_dialog.h | 2 +- editor/property_editor.h | 4 +- editor/property_selector.h | 2 +- editor/rename_dialog.h | 6 +- editor/scene_tree_dock.h | 2 +- modules/cvtt/image_compress_cvtt.cpp | 4 +- modules/dds/texture_loader_dds.cpp | 2 +- modules/gdscript/gdscript_utility_functions.cpp | 2 +- .../openxr/extensions/openxr_vulkan_extension.h | 10 +-- modules/openxr/openxr_api.h | 4 +- modules/text_server_adv/text_server_adv.cpp | 4 +- modules/text_server_fb/text_server_fb.cpp | 4 +- modules/theora/video_stream_theora.h | 2 +- .../editor/visual_script_property_selector.h | 4 +- .../visual_script/visual_script_builtin_funcs.cpp | 4 +- modules/visual_script/visual_script_expression.cpp | 4 +- .../visual_script/visual_script_flow_control.cpp | 30 ++++---- modules/visual_script/visual_script_func_nodes.cpp | 26 +++---- modules/visual_script/visual_script_nodes.cpp | 72 ++++++++--------- .../visual_script/visual_script_yield_nodes.cpp | 8 +- modules/websocket/wsl_client.h | 2 +- platform/iphone/export/export_plugin.h | 2 - platform/linuxbsd/detect_prime_x11.cpp | 2 +- platform/linuxbsd/display_server_x11.cpp | 30 +------- platform/linuxbsd/display_server_x11.h | 38 ++++----- platform/uwp/export/app_packager.h | 4 +- scene/2d/area_2d.h | 2 +- scene/2d/cpu_particles_2d.h | 2 +- scene/2d/gpu_particles_2d.cpp | 3 - scene/2d/gpu_particles_2d.h | 22 +++--- scene/2d/light_occluder_2d.cpp | 1 - scene/2d/light_occluder_2d.h | 5 +- scene/2d/navigation_agent_2d.h | 14 ++-- scene/3d/area_3d.h | 4 +- scene/3d/cpu_particles_3d.h | 6 +- scene/3d/gpu_particles_3d.h | 18 ++--- scene/3d/navigation_agent_3d.h | 16 ++-- scene/3d/skeleton_3d.h | 2 +- scene/3d/sprite_3d.h | 8 +- scene/3d/vehicle_body_3d.cpp | 2 +- scene/gui/graph_edit.h | 11 +-- scene/main/viewport.h | 1 - scene/resources/canvas_item_material.h | 8 +- scene/resources/material.h | 64 +++++++-------- scene/resources/particles_material.h | 32 ++++---- .../skeleton_modification_2d_physicalbones.h | 2 +- scene/resources/sky_material.h | 28 +++---- scene/resources/sphere_shape_3d.h | 2 +- servers/audio/audio_filter_sw.cpp | 9 --- servers/audio/audio_filter_sw.h | 34 ++++---- servers/audio/audio_stream.cpp | 5 +- servers/audio/audio_stream.h | 10 +-- .../audio/effects/audio_effect_stereo_enhance.cpp | 8 +- .../audio/effects/audio_effect_stereo_enhance.h | 18 ++--- servers/audio/effects/reverb.cpp | 2 - servers/audio/effects/reverb.h | 7 +- servers/audio_server.cpp | 20 ----- servers/audio_server.h | 90 ++++++++++------------ servers/physics_2d/godot_collision_solver_2d.cpp | 2 +- .../physics_2d/godot_collision_solver_2d_sat.cpp | 2 +- servers/physics_3d/gjk_epa.cpp | 18 ++--- servers/physics_3d/godot_collision_solver_3d.cpp | 28 +++---- .../physics_3d/godot_collision_solver_3d_sat.cpp | 2 +- servers/physics_3d/godot_shape_3d.cpp | 8 +- .../scene_shader_forward_clustered.cpp | 2 - .../scene_shader_forward_clustered.h | 50 ++++++------ .../forward_mobile/scene_shader_forward_mobile.cpp | 2 - .../forward_mobile/scene_shader_forward_mobile.h | 46 +++++------ servers/rendering/renderer_rd/pipeline_cache_rd.h | 2 +- .../renderer_rd/renderer_canvas_render_rd.cpp | 6 -- .../renderer_rd/renderer_canvas_render_rd.h | 6 +- .../renderer_rd/renderer_compositor_rd.cpp | 1 - .../rendering/renderer_rd/renderer_compositor_rd.h | 14 ++-- .../renderer_rd/renderer_scene_render_rd.cpp | 4 - .../renderer_rd/renderer_scene_render_rd.h | 59 +++++++------- .../renderer_rd/renderer_scene_sky_rd.cpp | 4 - .../rendering/renderer_rd/renderer_scene_sky_rd.h | 17 ++-- .../renderer_rd/storage_rd/particles_storage.cpp | 4 - .../renderer_rd/storage_rd/particles_storage.h | 7 +- servers/rendering/renderer_scene_cull.h | 2 +- servers/rendering/shader_compiler.h | 4 +- servers/rendering/shader_language.h | 18 ++--- servers/rendering_server.h | 2 +- 156 files changed, 757 insertions(+), 959 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/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/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/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> Geometry2D::decompose_polygon_in_convex(Vector 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 &p_rects, Vector &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/os/os.h b/core/os/os.h index 9ec0dd7728..0047943056 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); 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 &p_from) { 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 &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 &p_defvals, Callable::CallError &r_error) = nullptr; + Variant::ValidatedBuiltInMethod validated_call = nullptr; + Variant::PTRBuiltInMethod ptrcall = nullptr; Vector default_arguments; Vector 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 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 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(#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 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/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 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/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 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/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; - int selected_track; + int selected_track = 0; Vector 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 &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 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 &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; 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 &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; - int track; + int track = 0; Rect2 check_rect; Rect2 path_rect; @@ -187,12 +188,12 @@ class AnimationTrackEdit : public Control { Ref _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 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 _current_peer; - int breakpoint_id; - int stackframe_id; - int variable_id; + int breakpoint_id = 0; + int stackframe_id = 0; + int variable_id = 0; List breakpoint_list; Map> stackframe_list; Map 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 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 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_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 local_history; - int local_history_pos; + int local_history_pos = 0; void _push_history(); Vector 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 constant_line; Map enum_line; Map> 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 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 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 &p_event); void _value_input_closed(); void _value_input_submitted(const String &); void _value_focus_exited(); void _value_input_gui_input(const Ref &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/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 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 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 pre_move_edit; Vector 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 animations_to_add; - float add_point_pos; + float add_point_pos = 0.0f; Vector 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 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 &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 prev_weights; Vector2 bone_paint_pos; AcceptDialog *grid_settings = nullptr; @@ -110,7 +110,7 @@ class Polygon2DEditor : public AbstractPolygon2DEditor { Vector uv_create_uv_prev; Vector uv_create_poly_prev; Vector 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 frames_selected; Set 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> cache_map; List 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 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/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 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 node; Vector properties; Vector