From e1811b689b6854668ca690831df8603820b68573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Tue, 24 Nov 2020 10:12:55 +0100 Subject: [PATCH] Initialize class/struct variables with default values in platform/ and editor/ --- core/doc_data.h | 2 +- editor/animation_bezier_editor.h | 6 +-- editor/animation_track_editor.cpp | 40 +++++---------- editor/animation_track_editor.h | 28 +++++----- editor/audio_stream_preview.h | 4 +- editor/code_editor.cpp | 2 + editor/debugger/editor_profiler.h | 27 ++++------ editor/debugger/editor_visual_profiler.h | 8 +-- editor/dependency_editor.cpp | 2 + editor/editor_atlas_packer.h | 12 ++--- editor/editor_audio_buses.h | 16 +++--- editor/editor_autoload_settings.h | 14 ++--- editor/editor_data.h | 10 ++-- editor/editor_export.h | 18 +++---- editor/editor_file_system.h | 37 ++++++-------- editor/editor_help_search.h | 10 ++-- editor/editor_inspector.cpp | 1 + editor/editor_inspector.h | 2 +- editor/editor_node.h | 14 ++--- editor/editor_properties.h | 2 +- editor/editor_resource_preview.h | 6 +-- editor/editor_sectioned_inspector.cpp | 8 +-- editor/editor_settings.cpp | 12 ++--- editor/editor_settings.h | 4 +- editor/fileserver/editor_file_server.h | 6 +-- editor/filesystem_dock.h | 4 +- editor/find_in_files.cpp | 5 -- editor/find_in_files.h | 18 +++---- editor/import/collada.h | 28 +++++----- editor/import/editor_import_collada.cpp | 31 ++++------- editor/import/editor_scene_importer_gltf.h | 22 ++------ editor/import/resource_importer_texture.h | 8 +-- .../import/resource_importer_texture_atlas.h | 2 +- editor/multi_node_edit.h | 2 +- .../plugins/animation_player_editor_plugin.h | 24 ++++----- .../plugins/animation_state_machine_editor.h | 8 +-- editor/plugins/asset_library_editor_plugin.h | 16 +++--- editor/plugins/canvas_item_editor_plugin.h | 10 ++-- .../collision_shape_2d_editor_plugin.cpp | 2 + editor/plugins/editor_preview_plugins.h | 6 +-- editor/plugins/mesh_library_editor_plugin.cpp | 2 + editor/plugins/node_3d_editor_plugin.h | 32 +++++------- editor/plugins/path_3d_editor_plugin.cpp | 2 + editor/plugins/script_editor_plugin.cpp | 19 +++---- editor/plugins/script_editor_plugin.h | 2 +- editor/plugins/shader_editor_plugin.cpp | 2 + editor/plugins/skeleton_3d_editor_plugin.cpp | 7 +-- editor/plugins/skeleton_3d_editor_plugin.h | 39 +++++++------- editor/plugins/tile_map_editor_plugin.cpp | 2 +- editor/plugins/tile_map_editor_plugin.h | 4 -- .../plugins/visual_shader_editor_plugin.cpp | 5 +- editor/plugins/visual_shader_editor_plugin.h | 51 +++++++++---------- editor/progress_dialog.h | 10 ++-- editor/project_manager.cpp | 14 ++--- editor/quick_open.h | 2 +- editor/script_create_dialog.h | 4 +- .../gdscript/editor/gdscript_highlighter.h | 2 +- modules/mono/editor/bindings_generator.h | 6 +-- modules/mono/editor/godotsharp_export.cpp | 8 +-- modules/mono/editor/script_class_parser.h | 10 ++-- platform/android/android_keys_utils.h | 4 +- platform/android/api/java_class_wrapper.h | 4 +- platform/android/audio_driver_opensl.cpp | 2 - platform/android/audio_driver_opensl.h | 12 ++--- platform/android/display_server_android.h | 14 ++--- platform/android/export/export.cpp | 6 +-- platform/android/file_access_android.cpp | 5 -- platform/android/file_access_android.h | 9 ++-- platform/android/os_android.cpp | 1 + platform/iphone/export/export.cpp | 14 ++--- platform/linuxbsd/detect_prime_x11.cpp | 2 +- platform/linuxbsd/display_server_x11.h | 30 +++++------ platform/linuxbsd/joypad_linux.cpp | 9 ---- platform/linuxbsd/joypad_linux.h | 13 +++-- platform/osx/display_server_osx.h | 14 ++--- platform/osx/export/export.cpp | 2 +- platform/osx/joypad_osx.cpp | 8 --- platform/osx/joypad_osx.h | 18 +++---- platform/server/os_server.h | 12 ++--- platform/uwp/context_egl_uwp.cpp | 3 +- platform/uwp/export/export.cpp | 6 +-- platform/uwp/joypad_uwp.h | 21 +++----- platform/uwp/os_uwp.h | 14 ++--- platform/windows/context_gl_windows.cpp | 1 + platform/windows/crash_handler_windows.cpp | 2 +- platform/windows/joypad_windows.h | 20 +++----- platform/windows/os_windows.cpp | 5 ++ 87 files changed, 411 insertions(+), 540 deletions(-) diff --git a/core/doc_data.h b/core/doc_data.h index bf016792ea1..65b57d1381a 100644 --- a/core/doc_data.h +++ b/core/doc_data.h @@ -89,7 +89,7 @@ public: struct ConstantDoc { String name; String value; - bool is_value_valid; + bool is_value_valid = false; String enumeration; String description; bool operator<(const ConstantDoc &p_const) const { diff --git a/editor/animation_bezier_editor.h b/editor/animation_bezier_editor.h index 217393a3b3c..1b7ed8f06cc 100644 --- a/editor/animation_bezier_editor.h +++ b/editor/animation_bezier_editor.h @@ -111,10 +111,10 @@ class AnimationBezierTrackEdit : public Control { Vector2 menu_insert_key; struct AnimMoveRestore { - int track; - float time; + int track = 0; + float time = 0; Variant key; - float transition; + float transition = 0; }; AnimationTrackEditor *editor; diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index b1ffb1dc52b..717e4628aef 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -44,7 +44,7 @@ class AnimationTrackKeyEdit : public Object { GDCLASS(AnimationTrackKeyEdit, Object); public: - bool setting; + bool setting = false; bool _hide_script_from_inspector() { return true; @@ -622,15 +622,15 @@ public: } } - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; Ref animation; - int track; - float key_ofs; - Node *root_path; + int track = -1; + float key_ofs = 0; + Node *root_path = nullptr; PropertyInfo hint; NodePath base; - bool use_fps; + bool use_fps = false; void notify_change() { _change_notify(); @@ -644,21 +644,13 @@ public: use_fps = p_enable; _change_notify(); } - - AnimationTrackKeyEdit() { - use_fps = false; - key_ofs = 0; - track = -1; - setting = false; - root_path = nullptr; - } }; class AnimationMultiTrackKeyEdit : public Object { GDCLASS(AnimationMultiTrackKeyEdit, Object); public: - bool setting; + bool setting = false; bool _hide_script_from_inspector() { return true; @@ -1276,11 +1268,11 @@ public: Map base_map; PropertyInfo hint; - Node *root_path; + Node *root_path = nullptr; - bool use_fps; + bool use_fps = false; - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; void notify_change() { _change_notify(); @@ -1294,12 +1286,6 @@ public: use_fps = p_enable; _change_notify(); } - - AnimationMultiTrackKeyEdit() { - use_fps = false; - setting = false; - root_path = nullptr; - } }; void AnimationTimelineEdit::_zoom_changed(double) { @@ -4669,10 +4655,10 @@ void AnimationTrackEditor::_move_selection(float p_offset) { } struct _AnimMoveRestore { - int track; - float time; + int track = 0; + float time = 0; Variant key; - float transition; + float transition = 0; }; //used for undo/redo diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index a31ca892ef7..5e12791e349 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -253,8 +253,8 @@ class AnimationTrackEditGroup : public Control { Ref icon; String node_name; NodePath node; - Node *root; - AnimationTimelineEdit *timeline; + Node *root = nullptr; + AnimationTimelineEdit *timeline = nullptr; void _zoom_changed(); @@ -354,10 +354,10 @@ class AnimationTrackEditor : public VBoxContainer { struct InsertData { Animation::TrackType type; NodePath path; - int track_idx; + int track_idx = 0; Variant value; String query; - bool advance; + bool advance = false; }; /* insert_data;*/ Label *insert_confirm_text; @@ -392,13 +392,13 @@ class AnimationTrackEditor : public VBoxContainer { //selection struct SelectedKey { - int track; - int key; + int track = 0; + int key = 0; bool operator<(const SelectedKey &p_key) const { return track == p_key.track ? key < p_key.key : track < p_key.track; }; }; struct KeyInfo { - float pos; + float pos = 0; }; Map selection; @@ -467,15 +467,15 @@ class AnimationTrackEditor : public VBoxContainer { struct TrackClipboard { NodePath full_path; NodePath base_path; - Animation::TrackType track_type; - Animation::InterpolationType interp_type; - Animation::UpdateMode update_mode; - bool loop_wrap; - bool enabled; + Animation::TrackType track_type = Animation::TrackType::TYPE_ANIMATION; + Animation::InterpolationType interp_type = Animation::InterpolationType::INTERPOLATION_CUBIC; + Animation::UpdateMode update_mode = Animation::UpdateMode::UPDATE_CAPTURE; + bool loop_wrap = false; + bool enabled = false; struct Key { - float time; - float transition; + float time = 0; + float transition = 0; Variant value; }; Vector keys; diff --git a/editor/audio_stream_preview.h b/editor/audio_stream_preview.h index 97a582836c4..300f1dc5cad 100644 --- a/editor/audio_stream_preview.h +++ b/editor/audio_stream_preview.h @@ -60,9 +60,9 @@ class AudioStreamPreviewGenerator : public Node { Ref preview; Ref base_stream; Ref playback; - volatile bool generating; + volatile bool generating = false; ObjectID id; - Thread *thread; + Thread *thread = nullptr; }; Map previews; diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 823fd7e8525..7913f09a077 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -81,6 +81,8 @@ GotoLineDialog::GotoLineDialog() { register_text_enter(line); text_editor = nullptr; + line_label = nullptr; + set_hide_on_ok(false); } diff --git a/editor/debugger/editor_profiler.h b/editor/debugger/editor_profiler.h index aa2ef58db48..637f732b0b9 100644 --- a/editor/debugger/editor_profiler.h +++ b/editor/debugger/editor_profiler.h @@ -45,27 +45,27 @@ class EditorProfiler : public VBoxContainer { public: struct Metric { - bool valid; + bool valid = false; - int frame_number; - float frame_time; - float idle_time; - float physics_time; - float physics_frame_time; + int frame_number = 0; + float frame_time = 0; + float idle_time = 0; + float physics_time = 0; + float physics_frame_time = 0; struct Category { StringName signature; String name; - float total_time; //total for category + float total_time = 0; //total for category struct Item { StringName signature; String name; String script; - int line; - float self; - float total; - int calls; + int line = 0; + float self = 0; + float total = 0; + int calls = 0; }; Vector items; @@ -75,11 +75,6 @@ public: Map category_ptrs; Map item_ptrs; - - Metric() { - valid = false; - frame_number = 0; - } }; enum DisplayMode { diff --git a/editor/debugger/editor_visual_profiler.h b/editor/debugger/editor_visual_profiler.h index 3c1a55dc38b..49a2d5c53a2 100644 --- a/editor/debugger/editor_visual_profiler.h +++ b/editor/debugger/editor_visual_profiler.h @@ -46,9 +46,9 @@ class EditorVisualProfiler : public VBoxContainer { public: struct Metric { - bool valid; + bool valid = false; - uint64_t frame_number; + uint64_t frame_number = 0; struct Area { String name; @@ -59,10 +59,6 @@ public: }; Vector areas; - - Metric() { - valid = false; - } }; enum DisplayTimeMode { diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 527286583e8..1a7a30ba4e1 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -626,6 +626,8 @@ DependencyErrorDialog::DependencyErrorDialog() { vb->add_child(text); text->set_text(TTR("Which action should be taken?")); + mode = Mode::MODE_RESOURCE; + fdep = add_button(TTR("Fix Dependencies"), true, "fixdeps"); set_title(TTR("Errors loading!")); diff --git a/editor/editor_atlas_packer.h b/editor/editor_atlas_packer.h index 52ac9524aea..4a9c3a776bc 100644 --- a/editor/editor_atlas_packer.h +++ b/editor/editor_atlas_packer.h @@ -41,23 +41,23 @@ public: struct Chart { Vector vertices; struct Face { - int vertex[3]; + int vertex[3] = { 0 }; }; Vector faces; - bool can_transpose; + bool can_transpose = false; Vector2 final_offset; - bool transposed; + bool transposed = false; }; private: struct PlottedBitmap { - int chart_index; + int chart_index = 0; Vector2i offset; - int area; + int area = 0; Vector top_heights; Vector bottom_heights; - bool transposed; + bool transposed = false; Vector2 final_pos; diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h index 01221ad6ef3..f72541100d2 100644 --- a/editor/editor_audio_buses.h +++ b/editor/editor_audio_buses.h @@ -61,13 +61,13 @@ class EditorAudioBus : public PanelContainer { static const int CHANNELS_MAX = 4; struct { - bool prev_active; + bool prev_active = false; - float peak_l; - float peak_r; + float peak_l = 0; + float peak_r = 0; - TextureProgress *vu_l; - TextureProgress *vu_r; + TextureProgress *vu_l = nullptr; + TextureProgress *vu_r = nullptr; } channel[CHANNELS_MAX]; OptionButton *send; @@ -214,9 +214,9 @@ class EditorAudioMeterNotches : public Control { private: struct AudioNotch { - float relative_position; - float db_value; - bool render_db_value; + float relative_position = 0; + float db_value = 0; + bool render_db_value = false; _FORCE_INLINE_ AudioNotch(float r_pos, float db_v, bool rndr_val) { relative_position = r_pos; diff --git a/editor/editor_autoload_settings.h b/editor/editor_autoload_settings.h index 646fe3992c8..845f86fbb95 100644 --- a/editor/editor_autoload_settings.h +++ b/editor/editor_autoload_settings.h @@ -50,20 +50,14 @@ class EditorAutoloadSettings : public VBoxContainer { struct AutoLoadInfo { String name; String path; - bool is_singleton; - bool in_editor; - int order; - Node *node; + bool is_singleton = false; + bool in_editor = false; + int order = 0; + Node *node = nullptr; bool operator==(const AutoLoadInfo &p_info) const { return order == p_info.order; } - - AutoLoadInfo() { - is_singleton = false; - in_editor = false; - node = nullptr; - } }; List autoload_cache; diff --git a/editor/editor_data.h b/editor/editor_data.h index eec95554bef..e4ef9f56a51 100644 --- a/editor/editor_data.h +++ b/editor/editor_data.h @@ -47,12 +47,12 @@ class EditorHistory { REF ref; ObjectID object; String property; - bool inspector_only; + bool inspector_only = false; }; struct History { Vector path; - int level; + int level = 0; }; friend class EditorData; @@ -109,14 +109,14 @@ public: }; struct EditedScene { - Node *root; + Node *root = nullptr; String path; Dictionary editor_states; List selection; Vector history_stored; - int history_current; + int history_current = 0; Dictionary custom_state; - uint64_t version; + uint64_t version = 0; NodePath live_edit_root; }; diff --git a/editor/editor_export.h b/editor/editor_export.h index 09feaad2559..6f835f5a685 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -169,9 +169,9 @@ public: private: struct SavedData { - uint64_t ofs; - uint64_t size; - bool encrypted; + uint64_t ofs = 0; + uint64_t size = 0; + bool encrypted = false; Vector md5; CharString path_utf8; @@ -181,15 +181,15 @@ private: }; struct PackData { - FileAccess *f; + FileAccess *f = nullptr; Vector file_ofs; - EditorProgress *ep; - Vector *so_files; + EditorProgress *ep = nullptr; + Vector *so_files = nullptr; }; struct ZipData { - void *zip; - EditorProgress *ep; + void *zip = nullptr; + EditorProgress *ep = nullptr; }; struct FeatureContainers { @@ -294,7 +294,7 @@ class EditorExportPlugin : public Reference { struct ExtraFile { String path; Vector data; - bool remap; + bool remap = false; }; Vector extra_files; bool skipped; diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index d5ae046c36b..f89b4db933f 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -52,12 +52,12 @@ class EditorFileSystemDirectory : public Object { struct FileInfo { String file; StringName type; - uint64_t modified_time; - uint64_t import_modified_time; - bool import_valid; + uint64_t modified_time = 0; + uint64_t import_modified_time = 0; + bool import_valid = false; String import_group_file; Vector deps; - bool verified; //used for checking changes + bool verified = false; //used for checking changes String script_class_name; String script_class_extends; String script_class_icon_path; @@ -119,18 +119,11 @@ class EditorFileSystem : public Node { ACTION_FILE_RELOAD }; - Action action; - EditorFileSystemDirectory *dir; + Action action = ACTION_NONE; + EditorFileSystemDirectory *dir = nullptr; String file; - EditorFileSystemDirectory *new_dir; - EditorFileSystemDirectory::FileInfo *new_file; - - ItemAction() { - action = ACTION_NONE; - dir = nullptr; - new_dir = nullptr; - new_file = nullptr; - } + EditorFileSystemDirectory *new_dir = nullptr; + EditorFileSystemDirectory::FileInfo *new_file = nullptr; }; bool use_threads; @@ -162,10 +155,10 @@ class EditorFileSystem : public Node { /* Used for reading the filesystem cache file */ struct FileCache { String type; - uint64_t modification_time; - uint64_t import_modification_time; + uint64_t modification_time = 0; + uint64_t import_modification_time = 0; Vector deps; - bool import_valid; + bool import_valid = false; String import_group_file; String script_class_name; String script_class_extends; @@ -175,9 +168,9 @@ class EditorFileSystem : public Node { HashMap file_cache; struct ScanProgress { - float low; - float hi; - mutable EditorProgressBG *progress; + float low = 0; + float hi = 0; + mutable EditorProgressBG *progress = nullptr; void update(int p_current, int p_total) const; ScanProgress get_sub(int p_current, int p_total) const; }; @@ -220,7 +213,7 @@ class EditorFileSystem : public Node { struct ImportFile { String path; - int order; + int order = 0; bool operator<(const ImportFile &p_if) const { return order < p_if.order; } diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h index f1aab6cc815..cb52c515de3 100644 --- a/editor/editor_help_search.h +++ b/editor/editor_help_search.h @@ -98,7 +98,7 @@ class EditorHelpSearch::Runner : public Reference { struct ClassMatch { DocData::ClassDoc *doc; - bool name; + bool name = false; Vector methods; Vector signals; Vector constants; @@ -118,12 +118,12 @@ class EditorHelpSearch::Runner : public Reference { Ref empty_icon; Color disabled_color; - Map::Element *iterator_doc; + Map::Element *iterator_doc = nullptr; Map matches; - Map::Element *iterator_match; - TreeItem *root_item; + Map::Element *iterator_match = nullptr; + TreeItem *root_item = nullptr; Map class_items; - TreeItem *matched_item; + TreeItem *matched_item = nullptr; bool _is_class_disabled_by_feature_profile(const StringName &p_class); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index d88a0e3ff84..dd136c046f7 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -963,6 +963,7 @@ EditorProperty::EditorProperty() { selected_focusable = -1; label_reference = nullptr; bottom_editor = nullptr; + delete_hover = false; } //////////////////////////////////////////////// diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 10b10134860..d901bb4ecfe 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -176,7 +176,7 @@ class EditorInspectorPlugin : public Reference { friend class EditorInspector; struct AddedEditor { - Control *property_editor; + Control *property_editor = nullptr; Vector properties; String label; }; diff --git a/editor/editor_node.h b/editor/editor_node.h index dec28b0d2ba..9d1a890f0ef 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -107,10 +107,10 @@ public: String path; List args; String output; - Thread *execute_output_thread; + Thread *execute_output_thread = nullptr; Mutex execute_output_mutex; - int exitcode; - volatile bool done; + int exitcode = 0; + volatile bool done = false; }; private: @@ -409,8 +409,8 @@ private: struct BottomPanelItem { String name; - Control *control; - Button *button; + Control *control = nullptr; + Button *button = nullptr; }; Vector bottom_panel_items; @@ -554,8 +554,8 @@ private: struct ExportDefer { String preset; String path; - bool debug; - bool pack_only; + bool debug = false; + bool pack_only = false; } export_defer; bool cmdline_export_mode; diff --git a/editor/editor_properties.h b/editor/editor_properties.h index 828b6395273..63dee9f6d63 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -41,7 +41,7 @@ class EditorPropertyNil : public EditorProperty { GDCLASS(EditorPropertyNil, EditorProperty); - LineEdit *text; + LineEdit *text = nullptr; public: virtual void update_property() override; diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h index 2f4bc65de93..05a4e1bafba 100644 --- a/editor/editor_resource_preview.h +++ b/editor/editor_resource_preview.h @@ -77,9 +77,9 @@ class EditorResourcePreview : public Node { struct Item { Ref preview; Ref small_preview; - int order; - uint32_t last_hash; - uint64_t modified_time; + int order = 0; + uint32_t last_hash = 0; + uint64_t modified_time = 0; }; int order; diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index cf19b54cff8..bc9ca154674 100644 --- a/editor/editor_sectioned_inspector.cpp +++ b/editor/editor_sectioned_inspector.cpp @@ -35,9 +35,9 @@ class SectionedInspectorFilter : public Object { GDCLASS(SectionedInspectorFilter, Object); - Object *edited; + Object *edited = nullptr; String section; - bool allow_sub; + bool allow_sub = false; bool _set(const StringName &p_name, const Variant &p_value) { if (!edited) { @@ -123,10 +123,6 @@ public: edited = p_edited; _change_notify(); } - - SectionedInspectorFilter() { - edited = nullptr; - } }; void SectionedInspector::_bind_methods() { diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 0ea112d48c0..757e26f3081 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -158,10 +158,10 @@ void EditorSettings::_initial_set(const StringName &p_name, const Variant &p_val struct _EVCSort { String name; - Variant::Type type; - int order; - bool save; - bool restart_if_changed; + Variant::Type type = Variant::Type::NIL; + int order = 0; + bool save = false; + bool restart_if_changed = false; bool operator<(const _EVCSort &p_vcs) const { return order < p_vcs.order; } }; @@ -1540,8 +1540,8 @@ Ref ED_GET_SHORTCUT(const String &p_path) { } struct ShortcutMapping { - const char *path; - uint32_t keycode; + const char *path = nullptr; + uint32_t keycode = 0; }; Ref ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode) { diff --git a/editor/editor_settings.h b/editor/editor_settings.h index 41e6bab4ba3..3061da4d439 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -47,13 +47,13 @@ class EditorSettings : public Resource { public: struct Plugin { - EditorPlugin *instance; + EditorPlugin *instance = nullptr; String path; String name; String author; String version; String description; - bool installs; + bool installs = false; String script; Vector install_files; }; diff --git a/editor/fileserver/editor_file_server.h b/editor/fileserver/editor_file_server.h index ca5a8918561..6d3c0d0d47c 100644 --- a/editor/fileserver/editor_file_server.h +++ b/editor/fileserver/editor_file_server.h @@ -47,11 +47,11 @@ class EditorFileServer : public Object { }; struct ClientData { - Thread *thread; + Thread *thread = nullptr; Ref connection; Map files; - EditorFileServer *efs; - bool quit; + EditorFileServer *efs = nullptr; + bool quit = false; }; Ref server; diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index 1db14854261..c01d58dfbba 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -270,8 +270,8 @@ private: String path; StringName type; Vector sources; - bool import_broken; - uint64_t modified_time; + bool import_broken = false; + uint64_t modified_time = 0; bool operator<(const FileInfo &fi) const { return NaturalNoCaseComparator()(name, fi.name); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 8d3f0eb21f6..abcb7bbd930 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -86,11 +86,6 @@ static bool find_next(const String &line, String pattern, int from, bool match_c } //-------------------------------------------------------------------------------- -FindInFiles::FindInFiles() { - _searching = false; - _whole_words = true; - _match_case = true; -} void FindInFiles::set_search_text(String p_pattern) { _pattern = p_pattern; diff --git a/editor/find_in_files.h b/editor/find_in_files.h index 3b949a35b45..d4755c7b50b 100644 --- a/editor/find_in_files.h +++ b/editor/find_in_files.h @@ -42,8 +42,6 @@ public: static const char *SIGNAL_RESULT_FOUND; static const char *SIGNAL_FINISHED; - FindInFiles(); - void set_search_text(String p_pattern); void set_whole_words(bool p_whole_word); void set_match_case(bool p_match_case); @@ -76,15 +74,15 @@ private: String _pattern; Set _extension_filter; String _root_dir; - bool _whole_words; - bool _match_case; + bool _whole_words = true; + bool _match_case = true; // State - bool _searching; + bool _searching = false; String _current_dir; Vector _folders_stack; Vector _files_to_scan; - int _initial_files_count; + int _initial_files_count = 0; }; class LineEdit; @@ -188,10 +186,10 @@ private: void _on_replace_all_clicked(); struct Result { - int line_number; - int begin; - int end; - int begin_trimmed; + int line_number = 0; + int begin = 0; + int end = 0; + int begin_trimmed = 0; }; void apply_replaces_in_file(String fpath, const Vector &locations, String new_text); diff --git a/editor/import/collada.h b/editor/import/collada.h index 2f6db93dbcd..3b6b508b282 100644 --- a/editor/import/collada.h +++ b/editor/import/collada.h @@ -128,7 +128,7 @@ public: String name; struct Source { Vector array; - int stride; + int stride = 0; }; Map sources; @@ -142,15 +142,15 @@ public: struct Primitives { struct SourceRef { String source; - int offset; + int offset = 0; }; String material; Map sources; Vector polygons; Vector indices; - int count; - int vertex_size; + int count = 0; + int vertex_size = 0; }; Vector primitives; @@ -168,7 +168,7 @@ public: struct Source { Vector sarray; Vector array; - int stride; + int stride = 0; }; Map sources; @@ -200,14 +200,14 @@ public: struct Weights { struct SourceRef { String source; - int offset; + int offset = 0; }; String material; Map sources; Vector sets; Vector indices; - int count; + int count = 0; } weights; Map bone_rest_map; @@ -242,8 +242,8 @@ public: Color color; int uid = 0; struct Weight { - int bone_idx; - float weight; + int bone_idx = 0; + float weight = 0; bool operator<(const Weight w) const { return weight > w.weight; } //heaviest first }; @@ -331,7 +331,7 @@ public: }; String id; - Op op; + Op op = OP_ROTATE; Vector data; }; @@ -375,7 +375,7 @@ public: }; struct NodeGeometry : public Node { - bool controller; + bool controller = false; String source; struct Material { @@ -438,7 +438,7 @@ public: TYPE_MATRIX }; - float time; + float time = 0; Vector data; Point2 in_tangent; Point2 out_tangent; @@ -463,10 +463,10 @@ public: float unit_scale = 1.0; Vector3::Axis up_axis = Vector3::AXIS_Y; - bool z_up; + bool z_up = false; struct Version { - int major, minor, rev; + int major = 0, minor = 0, rev = 0; bool operator<(const Version &p_ver) const { return (major == p_ver.major) ? ((minor == p_ver.minor) ? (rev < p_ver.rev) : minor < p_ver.minor) : major < p_ver.major; } Version(int p_major = 0, int p_minor = 0, int p_rev = 0) { diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 12cbaaa885d..37792f2c089 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -46,29 +46,24 @@ struct ColladaImport { Collada collada; - Node3D *scene; + Node3D *scene = nullptr; Vector> animations; struct NodeMap { //String path; - Node3D *node; - int bone; + Node3D *node = nullptr; + int bone = -1; List anim_tracks; - - NodeMap() { - node = nullptr; - bone = -1; - } }; - bool found_ambient; + bool found_ambient = false; Color ambient; - bool found_directional; - bool force_make_tangents; - bool apply_mesh_xform_to_vertices; - bool use_mesh_builtin_materials; - float bake_fps; + bool found_directional = false; + bool force_make_tangents = false; + bool apply_mesh_xform_to_vertices = true; + bool use_mesh_builtin_materials = false; + float bake_fps = 15; Map node_map; //map from collada node to engine node Map node_name_map; //map from collada node to engine node @@ -98,14 +93,6 @@ struct ColladaImport { Vector missing_textures; void _pre_process_lights(Collada::Node *p_node); - - ColladaImport() { - found_ambient = false; - found_directional = false; - force_make_tangents = false; - apply_mesh_xform_to_vertices = true; - bake_fps = 15; - } }; Error ColladaImport::_populate_skeleton(Skeleton3D *p_skeleton, Collada::Node *p_node, int &r_bone, int p_parent) { diff --git a/editor/import/editor_scene_importer_gltf.h b/editor/import/editor_scene_importer_gltf.h index bd30f8f1dd6..5ea8bf17b83 100644 --- a/editor/import/editor_scene_importer_gltf.h +++ b/editor/import/editor_scene_importer_gltf.h @@ -116,8 +116,6 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { GLTFNodeIndex fake_joint_parent = -1; GLTFLightIndex light = -1; - - GLTFNode() {} }; struct GLTFBufferView { @@ -127,8 +125,6 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { int byte_stride = 0; bool indices = false; //matrices need to be transformed to this - - GLTFBufferView() {} }; struct GLTFAccessor { @@ -137,7 +133,7 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { int component_type = 0; bool normalized = false; int count = 0; - GLTFType type; + GLTFType type = GLTFType::TYPE_SCALAR; float min = 0; float max = 0; int sparse_count = 0; @@ -146,8 +142,6 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { int sparse_indices_component_type = 0; int sparse_values_buffer_view = 0; int sparse_values_byte_offset = 0; - - GLTFAccessor() {} }; struct GLTFTexture { GLTFImageIndex src_image; @@ -166,8 +160,6 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { // Set of unique bone names for the skeleton Set unique_names; - - GLTFSkeleton() {} }; struct GLTFSkin { @@ -204,8 +196,6 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { // The Actual Skin that will be created as a mapping between the IBM's of this skin // to the generated skeleton for the mesh instances. Ref godot_skin; - - GLTFSkin() {} }; struct GLTFMesh { @@ -218,8 +208,6 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { float fov_size = 64; float zfar = 500; float znear = 0.1; - - GLTFCamera() {} }; struct GLTFLight { @@ -229,8 +217,6 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { float range = Math_INF; float inner_cone_angle = 0.0f; float outer_cone_angle = Math_PI / 4.0; - - GLTFLight() {} }; struct GLTFAnimation { @@ -264,11 +250,11 @@ class EditorSceneImporterGLTF : public EditorSceneImporter { struct GLTFState { Dictionary json; - int major_version; - int minor_version; + int major_version = 0; + int minor_version = 0; Vector glb_data; - bool use_named_skin_binds; + bool use_named_skin_binds = false; Vector nodes; Vector> buffers; diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h index 97c46227313..39036d44230 100644 --- a/editor/import/resource_importer_texture.h +++ b/editor/import/resource_importer_texture.h @@ -60,13 +60,9 @@ protected: Mutex mutex; struct MakeInfo { - int flags; + int flags = 0; String normal_path_for_roughness; - RS::TextureDetectRoughnessChannel channel_for_roughness; - MakeInfo() { - flags = 0; - channel_for_roughness = RS::TEXTURE_DETECT_ROUGNHESS_R; - } + RS::TextureDetectRoughnessChannel channel_for_roughness = RS::TEXTURE_DETECT_ROUGNHESS_R; }; Map make_flags; diff --git a/editor/import/resource_importer_texture_atlas.h b/editor/import/resource_importer_texture_atlas.h index 9d973c3d8d4..d237b096d3c 100644 --- a/editor/import/resource_importer_texture_atlas.h +++ b/editor/import/resource_importer_texture_atlas.h @@ -38,7 +38,7 @@ class ResourceImporterTextureAtlas : public ResourceImporter { struct PackData { Rect2 region; - bool is_mesh; + bool is_mesh = false; Vector chart_pieces; //one for region, many for mesh Vector> chart_vertices; //for mesh Ref image; diff --git a/editor/multi_node_edit.h b/editor/multi_node_edit.h index 694dad76f18..3ccf06153d1 100644 --- a/editor/multi_node_edit.h +++ b/editor/multi_node_edit.h @@ -38,7 +38,7 @@ class MultiNodeEdit : public Reference { List nodes; struct PLData { - int uses; + int uses = 0; PropertyInfo info; }; diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h index e11db1390bd..17e554ee0dc 100644 --- a/editor/plugins/animation_player_editor_plugin.h +++ b/editor/plugins/animation_player_editor_plugin.h @@ -113,9 +113,9 @@ class AnimationPlayerEditor : public VBoxContainer { int current_option; struct BlendEditor { - AcceptDialog *dialog; - Tree *tree; - OptionButton *next; + AcceptDialog *dialog = nullptr; + Tree *tree = nullptr; + OptionButton *next = nullptr; } blend_editor; @@ -131,13 +131,13 @@ class AnimationPlayerEditor : public VBoxContainer { // Onion skinning. struct { // Settings. - bool enabled; - bool past; - bool future; - int steps; - bool differences_only; - bool force_white_modulate; - bool include_gizmos; + bool enabled = false; + bool past = false; + bool future = false; + int steps = 0; + bool differences_only = false; + bool force_white_modulate = false; + bool include_gizmos = false; int get_needed_capture_count() const { // 'Differences only' needs a capture of the present. @@ -145,8 +145,8 @@ class AnimationPlayerEditor : public VBoxContainer { } // Rendering. - int64_t last_frame; - int can_overlay; + int64_t last_frame = 0; + int can_overlay = 0; Size2 capture_size; Vector captures; Vector captures_valid; diff --git a/editor/plugins/animation_state_machine_editor.h b/editor/plugins/animation_state_machine_editor.h index f78d90bdbfd..119feb417d7 100644 --- a/editor/plugins/animation_state_machine_editor.h +++ b/editor/plugins/animation_state_machine_editor.h @@ -126,10 +126,10 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin { Vector2 to; AnimationNodeStateMachineTransition::SwitchMode mode; StringName advance_condition_name; - bool advance_condition_state; - bool disabled; - bool auto_advance; - float width; + bool advance_condition_state = false; + bool disabled = false; + bool auto_advance = false; + float width = 0; }; Vector transition_lines; diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h index 9761dbba1e7..b69dfc208ed 100644 --- a/editor/plugins/asset_library_editor_plugin.h +++ b/editor/plugins/asset_library_editor_plugin.h @@ -89,10 +89,10 @@ class EditorAssetLibraryItemDescription : public ConfirmationDialog { PanelContainer *previews_bg; struct Preview { - int id; - bool is_video; + int id = 0; + bool is_video = false; String video_link; - Button *button; + Button *button = nullptr; Ref image; }; @@ -234,12 +234,12 @@ class EditorAssetLibrary : public PanelContainer { }; struct ImageQueue { - bool active; - int queue_id; - ImageType image_type; - int image_index; + bool active = false; + int queue_id = 0; + ImageType image_type = ImageType::IMAGE_QUEUE_ICON; + int image_index = 0; String image_url; - HTTPRequest *request; + HTTPRequest *request = nullptr; ObjectID target; }; diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 859e80befef..c4a1dca593c 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -288,9 +288,9 @@ private: MenuOption last_option; struct _SelectResult { - CanvasItem *item; - float z_index; - bool has_z; + CanvasItem *item = nullptr; + float z_index = 0; + bool has_z = true; _FORCE_INLINE_ bool operator<(const _SelectResult &p_rr) const { return has_z && p_rr.has_z ? p_rr.z_index < z_index : p_rr.has_z; } @@ -308,8 +308,6 @@ private: Transform2D xform; float length = 0.f; uint64_t last_pass = 0; - - BoneList() {} }; uint64_t bone_last_frame; @@ -331,7 +329,7 @@ private: struct PoseClipboard { Vector2 pos; Vector2 scale; - float rot; + float rot = 0; ObjectID id; }; List pose_clipboard; diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index 105ac249509..23ab6a9de21 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -563,6 +563,8 @@ CollisionShape2DEditor::CollisionShape2DEditor(EditorNode *p_editor) { edit_handle = -1; pressed = false; + + shape_type = 0; } void CollisionShape2DEditorPlugin::edit(Object *p_obj) { diff --git a/editor/plugins/editor_preview_plugins.h b/editor/plugins/editor_preview_plugins.h index 9885efc2b5a..04e6be23547 100644 --- a/editor/plugins/editor_preview_plugins.h +++ b/editor/plugins/editor_preview_plugins.h @@ -90,7 +90,7 @@ class EditorMaterialPreviewPlugin : public EditorResourcePreviewGenerator { RID light2; RID light_instance2; RID camera; - mutable volatile bool preview_done; + mutable volatile bool preview_done = false; void _preview_done(const Variant &p_udata); @@ -134,7 +134,7 @@ class EditorMeshPreviewPlugin : public EditorResourcePreviewGenerator { RID light2; RID light_instance2; RID camera; - mutable volatile bool preview_done; + mutable volatile bool preview_done = false; void _preview_done(const Variant &p_udata); @@ -156,7 +156,7 @@ class EditorFontPreviewPlugin : public EditorResourcePreviewGenerator { RID viewport_texture; RID canvas; RID canvas_item; - mutable volatile bool preview_done; + mutable volatile bool preview_done = false; void _preview_done(const Variant &p_udata); diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 374a8c8290c..9d3498efa1b 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -301,4 +301,6 @@ MeshLibraryEditorPlugin::MeshLibraryEditorPlugin(EditorNode *p_node) { mesh_library_editor->set_anchors_and_margins_preset(Control::PRESET_TOP_WIDE); mesh_library_editor->set_end(Point2(0, 22)); mesh_library_editor->hide(); + + editor = nullptr; } diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 2e98fcad4c7..0c5959b8a11 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -61,16 +61,10 @@ public: Ref material; Ref skin_reference; RID skeleton; - bool billboard; - bool unscaled; - bool can_intersect; - bool extra_margin; - Instance() { - billboard = false; - unscaled = false; - can_intersect = false; - extra_margin = false; - } + bool billboard = false; + bool unscaled = false; + bool can_intersect = false; + bool extra_margin = false; void create_instance(Node3D *p_base, bool p_hidden = false); }; @@ -80,7 +74,7 @@ public: struct Handle { Vector3 pos; - bool billboard; + bool billboard = false; }; Vector handles; @@ -296,9 +290,9 @@ private: Label *fps_label; struct _RayResult { - Node3D *item; - float depth; - int handle; + Node3D *item = nullptr; + float depth = 0; + int handle = 0; _FORCE_INLINE_ bool operator<(const _RayResult &p_rr) const { return depth < p_rr.depth; } }; @@ -375,11 +369,11 @@ private: Vector3 click_ray_pos; Vector3 center; Vector3 orig_gizmo_pos; - int edited_gizmo; + int edited_gizmo = 0; Point2 mouse_pos; - bool snap; + bool snap = false; Ref gizmo; - int gizmo_handle; + int gizmo_handle = 0; Variant gizmo_initial_value; Vector3 gizmo_initial_pos; } _edit; @@ -625,8 +619,8 @@ private: AABB preview_bounds; struct Gizmo { - bool visible; - float scale; + bool visible = false; + float scale = 0; Transform transform; } gizmo; diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index 280f6fafd8a..dbb253dc572 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -290,6 +290,8 @@ void Path3DGizmo::redraw() { Path3DGizmo::Path3DGizmo(Path3D *p_path) { path = p_path; set_spatial_node(p_path); + orig_in_length = 0; + orig_out_length = 0; } bool Path3DEditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref &p_event) { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 12790a6746c..40ded6872af 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -234,15 +234,15 @@ static bool _is_built_in_script(Script *p_script) { class EditorScriptCodeCompletionCache : public ScriptCodeCompletionCache { struct Cache { - uint64_t time_loaded; + uint64_t time_loaded = 0; RES cache; }; Map cached; public: - uint64_t max_time_cache; - int max_cache_size; + uint64_t max_time_cache = 5 * 60 * 1000; //minutes, five + int max_cache_size = 128; void cleanup() { List::Element *> to_clean; @@ -292,11 +292,6 @@ public: return E->get().cache; } - EditorScriptCodeCompletionCache() { - max_cache_size = 128; - max_time_cache = 5 * 60 * 1000; //minutes, five - } - virtual ~EditorScriptCodeCompletionCache() {} }; @@ -1723,11 +1718,11 @@ struct _ScriptEditorItemData { String name; String sort_key; Ref icon; - int index; + int index = 0; String tooltip; - bool used; - int category; - Node *ref; + bool used = false; + int category = 0; + Node *ref = nullptr; bool operator<(const _ScriptEditorItemData &id) const { if (category == id.category) { diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index cc02a1ccbe8..08c6a2fba7d 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -291,7 +291,7 @@ class ScriptEditor : public PanelContainer { Vector> syntax_highlighters; struct ScriptHistory { - Control *control; + Control *control = nullptr; Variant state; }; diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 5b0e1ce5b50..6e174653f67 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -714,6 +714,8 @@ ShaderEditorPlugin::ShaderEditorPlugin(EditorNode *p_node) { shader_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE); button = editor->add_bottom_panel_item(TTR("Shader"), shader_editor); button->hide(); + + _2d = false; } ShaderEditorPlugin::~ShaderEditorPlugin() { diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index d6627147528..22f50c0689f 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -264,12 +264,7 @@ void BoneTransformEditor::_update_transform_properties(Transform tform) { } BoneTransformEditor::BoneTransformEditor(Skeleton3D *p_skeleton) : - skeleton(p_skeleton), - key_button(nullptr), - enabled_checkbox(nullptr), - keyable(false), - toggle_enabled(false), - updating(false) { + skeleton(p_skeleton) { undo_redo = EditorNode::get_undo_redo(); } diff --git a/editor/plugins/skeleton_3d_editor_plugin.h b/editor/plugins/skeleton_3d_editor_plugin.h index 7843fc17542..44dc1bc36ee 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.h +++ b/editor/plugins/skeleton_3d_editor_plugin.h @@ -47,13 +47,13 @@ class EditorPropertyVector3; class BoneTransformEditor : public VBoxContainer { GDCLASS(BoneTransformEditor, VBoxContainer); - EditorInspectorSection *section; + EditorInspectorSection *section = nullptr; - EditorPropertyVector3 *translation_property; - EditorPropertyVector3 *rotation_property; - EditorPropertyVector3 *scale_property; - EditorInspectorSection *transform_section; - EditorPropertyTransform *transform_property; + EditorPropertyVector3 *translation_property = nullptr; + EditorPropertyVector3 *rotation_property = nullptr; + EditorPropertyVector3 *scale_property = nullptr; + EditorInspectorSection *transform_section = nullptr; + EditorPropertyTransform *transform_property = nullptr; Rect2 background_rects[5]; @@ -62,12 +62,12 @@ class BoneTransformEditor : public VBoxContainer { UndoRedo *undo_redo; - Button *key_button; - CheckBox *enabled_checkbox; + Button *key_button = nullptr; + CheckBox *enabled_checkbox = nullptr; - bool keyable; - bool toggle_enabled; - bool updating; + bool keyable = false; + bool toggle_enabled = false; + bool updating = false; String label; @@ -128,7 +128,6 @@ class Skeleton3DEditor : public VBoxContainer { struct BoneInfo { PhysicalBone3D *physical_bone = nullptr; Transform relative_rest; // Relative to skeleton node - BoneInfo() {} }; EditorNode *editor; @@ -136,20 +135,20 @@ class Skeleton3DEditor : public VBoxContainer { Skeleton3D *skeleton; - Tree *joint_tree; - BoneTransformEditor *rest_editor; - BoneTransformEditor *pose_editor; - BoneTransformEditor *custom_pose_editor; + Tree *joint_tree = nullptr; + BoneTransformEditor *rest_editor = nullptr; + BoneTransformEditor *pose_editor = nullptr; + BoneTransformEditor *custom_pose_editor = nullptr; - MenuButton *options; - EditorFileDialog *file_dialog; + MenuButton *options = nullptr; + EditorFileDialog *file_dialog = nullptr; - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; void _on_click_option(int p_option); void _file_selected(const String &p_file); - EditorFileDialog *file_export_lib; + EditorFileDialog *file_export_lib = nullptr; void update_joint_tree(); void update_editors(); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 6c0efcb254e..189e5ec4428 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -409,7 +409,7 @@ void TileMapEditor::_sbox_input(const Ref &p_ie) { // In modern C++ this could have been inside its body. namespace { struct _PaletteEntry { - int id; + int id = 0; String name; bool operator<(const _PaletteEntry &p_rhs) const { diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index 848704e8300..3a4cb22ac12 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -131,8 +131,6 @@ class TileMapEditor : public VBoxContainer { bool yf = false; bool tr = false; Vector2 ac; - - CellOp() {} }; Map paint_undo; @@ -144,8 +142,6 @@ class TileMapEditor : public VBoxContainer { bool flip_v = false; bool transpose = false; Point2i autotile_coord; - - TileData() {} }; List copydata; diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 6112e69299b..07061a4bc5f 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -49,7 +49,7 @@ struct FloatConstantDef { String name; - float value; + float value = 0; String desc; }; @@ -4062,9 +4062,6 @@ void VisualShaderNodePortPreview::_notification(int p_what) { void VisualShaderNodePortPreview::_bind_methods() { } -VisualShaderNodePortPreview::VisualShaderNodePortPreview() { -} - ////////////////////////////////// String VisualShaderConversionPlugin::converts_to() const { diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index 2e7e9a88986..a5983410f93 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -56,26 +56,26 @@ class VisualShaderGraphPlugin : public Reference { private: struct InputPort { - Button *default_input_button; + Button *default_input_button = nullptr; }; struct Port { - TextureButton *preview_button; + TextureButton *preview_button = nullptr; }; struct Link { - VisualShader::Type type; - VisualShaderNode *visual_node; - GraphNode *graph_node; - bool preview_visible; - int preview_pos; + VisualShader::Type type = VisualShader::Type::TYPE_MAX; + VisualShaderNode *visual_node = nullptr; + GraphNode *graph_node = nullptr; + bool preview_visible = 0; + int preview_pos = 0; Map input_ports; Map output_ports; - VBoxContainer *preview_box; - LineEdit *uniform_name; - OptionButton *const_op; - CodeEdit *expression_edit; - CurveEditor *curve_editor; + VBoxContainer *preview_box = nullptr; + LineEdit *uniform_name = nullptr; + OptionButton *const_op = nullptr; + CodeEdit *expression_edit = nullptr; + CurveEditor *curve_editor = nullptr; }; Ref visual_shader; @@ -206,16 +206,16 @@ class VisualShaderEditor : public VBoxContainer { String category; String type; String description; - int sub_func; + int sub_func = 0; String sub_func_str; Ref