diff options
author | Rafał Mikrut <mikrutrafal@protonmail.com> | 2020-11-24 10:12:55 +0100 |
---|---|---|
committer | Rafał Mikrut <mikrutrafal@protonmail.com> | 2020-12-02 16:09:11 +0100 |
commit | e1811b689b6854668ca690831df8603820b68573 (patch) | |
tree | b13641bf9a704ec71f8ac90f3dd8d41a1174ae04 | |
parent | d1231be1c8f8f2c16fd1047adcd3c7f997a07c1f (diff) |
Initialize class/struct variables with default values in platform/ and editor/
87 files changed, 411 insertions, 540 deletions
diff --git a/core/doc_data.h b/core/doc_data.h index bf016792ea..65b57d1381 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 217393a3b3..1b7ed8f06c 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 b1ffb1dc52..717e4628ae 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> 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<int, NodePath> 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 a31ca892ef..5e12791e34 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -253,8 +253,8 @@ class AnimationTrackEditGroup : public Control { Ref<Texture2D> 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<SelectedKey, KeyInfo> 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<Key> keys; diff --git a/editor/audio_stream_preview.h b/editor/audio_stream_preview.h index 97a582836c..300f1dc5ca 100644 --- a/editor/audio_stream_preview.h +++ b/editor/audio_stream_preview.h @@ -60,9 +60,9 @@ class AudioStreamPreviewGenerator : public Node { Ref<AudioStreamPreview> preview; Ref<AudioStream> base_stream; Ref<AudioStreamPlayback> playback; - volatile bool generating; + volatile bool generating = false; ObjectID id; - Thread *thread; + Thread *thread = nullptr; }; Map<ObjectID, Preview> previews; diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 823fd7e852..7913f09a07 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 aa2ef58db4..637f732b0b 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<Item> items; @@ -75,11 +75,6 @@ public: Map<StringName, Category *> category_ptrs; Map<StringName, Category::Item *> 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 3c1a55dc38..49a2d5c53a 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<Area> areas; - - Metric() { - valid = false; - } }; enum DisplayTimeMode { diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index 527286583e..1a7a30ba4e 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 52ac9524ae..4a9c3a776b 100644 --- a/editor/editor_atlas_packer.h +++ b/editor/editor_atlas_packer.h @@ -41,23 +41,23 @@ public: struct Chart { Vector<Vector2> vertices; struct Face { - int vertex[3]; + int vertex[3] = { 0 }; }; Vector<Face> 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<int> top_heights; Vector<int> 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 01221ad6ef..f72541100d 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 646fe3992c..845f86fbb9 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<AutoLoadInfo> autoload_cache; diff --git a/editor/editor_data.h b/editor/editor_data.h index eec95554be..e4ef9f56a5 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<Obj> 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<Node *> selection; Vector<EditorHistory::History> 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 09feaad255..6f835f5a68 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<uint8_t> md5; CharString path_utf8; @@ -181,15 +181,15 @@ private: }; struct PackData { - FileAccess *f; + FileAccess *f = nullptr; Vector<SavedData> file_ofs; - EditorProgress *ep; - Vector<SharedObject> *so_files; + EditorProgress *ep = nullptr; + Vector<SharedObject> *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<uint8_t> data; - bool remap; + bool remap = false; }; Vector<ExtraFile> extra_files; bool skipped; diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index d5ae046c36..f89b4db933 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<String> 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<String> 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<String, FileCache> 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 f1aab6cc81..cb52c515de 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<DocData::MethodDoc *> methods; Vector<DocData::MethodDoc *> signals; Vector<DocData::ConstantDoc *> constants; @@ -118,12 +118,12 @@ class EditorHelpSearch::Runner : public Reference { Ref<Texture2D> empty_icon; Color disabled_color; - Map<String, DocData::ClassDoc>::Element *iterator_doc; + Map<String, DocData::ClassDoc>::Element *iterator_doc = nullptr; Map<String, ClassMatch> matches; - Map<String, ClassMatch>::Element *iterator_match; - TreeItem *root_item; + Map<String, ClassMatch>::Element *iterator_match = nullptr; + TreeItem *root_item = nullptr; Map<String, TreeItem *> 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 d88a0e3ff8..dd136c046f 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 10b1013486..d901bb4ecf 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<String> properties; String label; }; diff --git a/editor/editor_node.h b/editor/editor_node.h index dec28b0d2b..9d1a890f0e 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -107,10 +107,10 @@ public: String path; List<String> 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<BottomPanelItem> 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 828b639527..63dee9f6d6 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 2f4bc65de9..05a4e1bafb 100644 --- a/editor/editor_resource_preview.h +++ b/editor/editor_resource_preview.h @@ -77,9 +77,9 @@ class EditorResourcePreview : public Node { struct Item { Ref<Texture2D> preview; Ref<Texture2D> 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 cf19b54cff..bc9ca15467 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 0ea112d48c..757e26f308 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<Shortcut> ED_GET_SHORTCUT(const String &p_path) { } struct ShortcutMapping { - const char *path; - uint32_t keycode; + const char *path = nullptr; + uint32_t keycode = 0; }; Ref<Shortcut> 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 41e6bab4ba..3061da4d43 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<String> install_files; }; diff --git a/editor/fileserver/editor_file_server.h b/editor/fileserver/editor_file_server.h index ca5a891856..6d3c0d0d47 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<StreamPeerTCP> connection; Map<int, FileAccess *> files; - EditorFileServer *efs; - bool quit; + EditorFileServer *efs = nullptr; + bool quit = false; }; Ref<TCP_Server> server; diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index 1db1485426..c01d58dfbb 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -270,8 +270,8 @@ private: String path; StringName type; Vector<String> 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 8d3f0eb21f..abcb7bbd93 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 3b949a35b4..d4755c7b50 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<String> _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<PackedStringArray> _folders_stack; Vector<String> _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<Result> &locations, String new_text); diff --git a/editor/import/collada.h b/editor/import/collada.h index 2f6db93dbc..3b6b508b28 100644 --- a/editor/import/collada.h +++ b/editor/import/collada.h @@ -128,7 +128,7 @@ public: String name; struct Source { Vector<float> array; - int stride; + int stride = 0; }; Map<String, Source> sources; @@ -142,15 +142,15 @@ public: struct Primitives { struct SourceRef { String source; - int offset; + int offset = 0; }; String material; Map<String, SourceRef> sources; Vector<float> polygons; Vector<float> indices; - int count; - int vertex_size; + int count = 0; + int vertex_size = 0; }; Vector<Primitives> primitives; @@ -168,7 +168,7 @@ public: struct Source { Vector<String> sarray; Vector<float> array; - int stride; + int stride = 0; }; Map<String, Source> sources; @@ -200,14 +200,14 @@ public: struct Weights { struct SourceRef { String source; - int offset; + int offset = 0; }; String material; Map<String, SourceRef> sources; Vector<float> sets; Vector<float> indices; - int count; + int count = 0; } weights; Map<String, Transform> 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<float> 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<float> 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 12cbaaa885..37792f2c08 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<Ref<Animation>> animations; struct NodeMap { //String path; - Node3D *node; - int bone; + Node3D *node = nullptr; + int bone = -1; List<int> 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<String, NodeMap> node_map; //map from collada node to engine node Map<String, String> node_name_map; //map from collada node to engine node @@ -98,14 +93,6 @@ struct ColladaImport { Vector<String> 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 bd30f8f1dd..5ea8bf17b8 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<String> 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<Skin> 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<uint8_t> glb_data; - bool use_named_skin_binds; + bool use_named_skin_binds = false; Vector<GLTFNode *> nodes; Vector<Vector<uint8_t>> buffers; diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h index 97c4622731..39036d4423 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<StringName, MakeInfo> make_flags; diff --git a/editor/import/resource_importer_texture_atlas.h b/editor/import/resource_importer_texture_atlas.h index 9d973c3d8d..d237b096d3 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<int> chart_pieces; //one for region, many for mesh Vector<Vector<Vector2>> chart_vertices; //for mesh Ref<Image> image; diff --git a/editor/multi_node_edit.h b/editor/multi_node_edit.h index 694dad76f1..3ccf06153d 100644 --- a/editor/multi_node_edit.h +++ b/editor/multi_node_edit.h @@ -38,7 +38,7 @@ class MultiNodeEdit : public Reference { List<NodePath> 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 e11db1390b..17e554ee0d 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<RID> captures; Vector<bool> captures_valid; diff --git a/editor/plugins/animation_state_machine_editor.h b/editor/plugins/animation_state_machine_editor.h index f78d90bdbf..119feb417d 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<TransitionLine> transition_lines; diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h index 9761dbba1e..b69dfc208e 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<Texture2D> 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 859e80befe..c4a1dca593 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<PoseClipboard> pose_clipboard; diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index 105ac24950..23ab6a9de2 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 9885efc2b5..04e6be2354 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 374a8c8290..9d3498efa1 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 2e98fcad4c..0c5959b8a1 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -61,16 +61,10 @@ public: Ref<Material> material; Ref<SkinReference> 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<Vector3> 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<EditorNode3DGizmo> 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 280f6fafd8..dbb253dc57 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<InputEvent> &p_event) { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 12790a6746..40ded6872a 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<String, Cache> 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<Map<String, Cache>::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<Texture2D> 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 cc02a1ccbe..08c6a2fba7 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -291,7 +291,7 @@ class ScriptEditor : public PanelContainer { Vector<Ref<EditorSyntaxHighlighter>> 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 5b0e1ce5b5..6e174653f6 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 d662714752..22f50c0689 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 7843fc1754..44dc1bc36e 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 6c0efcb254..189e5ec442 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<InputEvent> &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 848704e830..3a4cb22ac1 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<Point2i, CellOp> paint_undo; @@ -144,8 +142,6 @@ class TileMapEditor : public VBoxContainer { bool flip_v = false; bool transpose = false; Point2i autotile_coord; - - TileData() {} }; List<TileData> copydata; diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 6112e69299..07061a4bc5 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 2e7e9a8898..a5983410f9 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<int, InputPort> input_ports; Map<int, Port> 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<VisualShader> 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<Script> script; - int mode; - int return_type; - int func; - float value; - bool highend; - bool is_custom; - int temp_idx; + int mode = 0; + int return_type = 0; + int func = 0; + float value = 0; + bool highend = false; + bool is_custom = false; + int temp_idx = 0; AddOption(const String &p_name = String(), const String &p_category = String(), const String &p_sub_category = String(), const String &p_type = String(), const String &p_description = String(), int p_sub_func = -1, int p_return_type = -1, int p_mode = -1, int p_func = -1, float p_value = -1, bool p_highend = false) { name = p_name; @@ -283,8 +283,8 @@ class VisualShaderEditor : public VBoxContainer { static VisualShaderEditor *singleton; struct DragOp { - VisualShader::Type type; - int node; + VisualShader::Type type = VisualShader::Type::TYPE_MAX; + int node = 0; Vector2 from; Vector2 to; }; @@ -462,9 +462,9 @@ public: class VisualShaderNodePortPreview : public Control { GDCLASS(VisualShaderNodePortPreview, Control); Ref<VisualShader> shader; - VisualShader::Type type; - int node; - int port; + VisualShader::Type type = VisualShader::Type::TYPE_MAX; + int node = 0; + int port = 0; void _shader_changed(); //must regen protected: void _notification(int p_what); @@ -473,7 +473,6 @@ protected: public: virtual Size2 get_minimum_size() const override; void setup(const Ref<VisualShader> &p_shader, VisualShader::Type p_type, int p_node, int p_port); - VisualShaderNodePortPreview(); }; class VisualShaderConversionPlugin : public EditorResourceConversionPlugin { diff --git a/editor/progress_dialog.h b/editor/progress_dialog.h index 753b6ac955..d8a33cc2cc 100644 --- a/editor/progress_dialog.h +++ b/editor/progress_dialog.h @@ -43,8 +43,8 @@ class BackgroundProgress : public HBoxContainer { _THREAD_SAFE_CLASS_ struct Task { - HBoxContainer *hb; - ProgressBar *progress; + HBoxContainer *hb = nullptr; + ProgressBar *progress = nullptr; }; Map<String, Task> tasks; @@ -70,9 +70,9 @@ class ProgressDialog : public PopupPanel { GDCLASS(ProgressDialog, PopupPanel); struct Task { String task; - VBoxContainer *vb; - ProgressBar *progress; - Label *state; + VBoxContainer *vb = nullptr; + ProgressBar *progress = nullptr; + Label *state = nullptr; }; HBoxContainer *cancel_hb; Button *cancel; diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 47b1135133..3ec0c5a6a4 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -984,13 +984,13 @@ public: String path; String icon; String main_scene; - uint64_t last_edited; - bool favorite; - bool grayed; - bool missing; - int version; + uint64_t last_edited = 0; + bool favorite = false; + bool grayed = false; + bool missing = false; + int version = 0; - ProjectListItemControl *control; + ProjectListItemControl *control = nullptr; Item() {} @@ -1076,7 +1076,7 @@ private: }; struct ProjectListComparator { - FilterOption order_option; + FilterOption order_option = FilterOption::EDIT_DATE; // operator< _FORCE_INLINE_ bool operator()(const ProjectList::Item &a, const ProjectList::Item &b) const { diff --git a/editor/quick_open.h b/editor/quick_open.h index 3b199f9561..a507a0da9c 100644 --- a/editor/quick_open.h +++ b/editor/quick_open.h @@ -49,7 +49,7 @@ class EditorQuickOpen : public ConfirmationDialog { struct Entry { String path; - float score; + float score = 0; }; struct EntryComparator { diff --git a/editor/script_create_dialog.h b/editor/script_create_dialog.h index 40415ea209..a73be29259 100644 --- a/editor/script_create_dialog.h +++ b/editor/script_create_dialog.h @@ -86,8 +86,8 @@ class ScriptCreateDialog : public ConfirmationDialog { SCRIPT_ORIGIN_EDITOR, }; struct ScriptTemplateInfo { - int id; - ScriptOrigin origin; + int id = 0; + ScriptOrigin origin = ScriptOrigin::SCRIPT_ORIGIN_EDITOR; String dir; String name; String extension; diff --git a/modules/gdscript/editor/gdscript_highlighter.h b/modules/gdscript/editor/gdscript_highlighter.h index 49357f3d2e..e38647eaab 100644 --- a/modules/gdscript/editor/gdscript_highlighter.h +++ b/modules/gdscript/editor/gdscript_highlighter.h @@ -42,7 +42,7 @@ private: Color color; String start_key; String end_key; - bool line_only; + bool line_only = false; }; Vector<ColorRegion> color_regions; Map<int, int> color_region_cache; diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h index 6fefcd48a4..0cc1bb5f46 100644 --- a/modules/mono/editor/bindings_generator.h +++ b/modules/mono/editor/bindings_generator.h @@ -45,7 +45,7 @@ class BindingsGenerator { struct ConstantInterface { String name; String proxy_name; - int value; + int value = 0; const DocData::ConstantDoc *const_doc; ConstantInterface() {} @@ -75,7 +75,7 @@ class BindingsGenerator { struct PropertyInterface { StringName cname; String proxy_name; - int index; + int index = 0; StringName setter; StringName getter; @@ -480,7 +480,7 @@ class BindingsGenerator { String im_type_out; // Return type for the C# method declaration. Also used as companion of [unique_siq] String im_sig; // Signature for the C# method declaration String unique_sig; // Unique signature to avoid duplicates in containers - bool editor_only; + bool editor_only = false; InternalCall() {} diff --git a/modules/mono/editor/godotsharp_export.cpp b/modules/mono/editor/godotsharp_export.cpp index 1a0d5743ae..b006eed69f 100644 --- a/modules/mono/editor/godotsharp_export.cpp +++ b/modules/mono/editor/godotsharp_export.cpp @@ -55,10 +55,10 @@ MonoAssemblyName *new_mono_assembly_name() { struct AssemblyRefInfo { String name; - uint16_t major; - uint16_t minor; - uint16_t build; - uint16_t revision; + uint16_t major = 0; + uint16_t minor = 0; + uint16_t build = 0; + uint16_t revision = 0; }; AssemblyRefInfo get_assemblyref_name(MonoImage *p_image, int index) { diff --git a/modules/mono/editor/script_class_parser.h b/modules/mono/editor/script_class_parser.h index 3c55fa07a7..deb6061191 100644 --- a/modules/mono/editor/script_class_parser.h +++ b/modules/mono/editor/script_class_parser.h @@ -45,22 +45,22 @@ public: }; String name; - Type type; + Type type = NAMESPACE_DECL; }; struct ClassDecl { String name; String namespace_; Vector<String> base; - bool nested; + bool nested = false; }; private: String code; - int idx; - int line; + int idx = 0; + int line = 0; String error_str; - bool error; + bool error = false; Variant value; Vector<ClassDecl> classes; diff --git a/platform/android/android_keys_utils.h b/platform/android/android_keys_utils.h index a10afa1df8..4a34e77324 100644 --- a/platform/android/android_keys_utils.h +++ b/platform/android/android_keys_utils.h @@ -35,8 +35,8 @@ #include <core/os/keyboard.h> struct _WinTranslatePair { - unsigned int keysym; - unsigned int keycode; + unsigned int keysym = 0; + unsigned int keycode = 0; }; static _WinTranslatePair _ak_to_keycode[] = { diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h index 64da049407..63d71f5cf1 100644 --- a/platform/android/api/java_class_wrapper.h +++ b/platform/android/api/java_class_wrapper.h @@ -66,10 +66,10 @@ class JavaClass : public Reference { Map<StringName, Variant> constant_map; struct MethodInfo { - bool _static; + bool _static = false; Vector<uint32_t> param_types; Vector<StringName> param_sigs; - uint32_t return_type; + uint32_t return_type = 0; jmethodID method; }; diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp index 740e9a3132..e96e80e967 100644 --- a/platform/android/audio_driver_opensl.cpp +++ b/platform/android/audio_driver_opensl.cpp @@ -339,6 +339,4 @@ void AudioDriverOpenSL::set_pause(bool p_pause) { AudioDriverOpenSL::AudioDriverOpenSL() { s_ad = this; - pause = false; - active = false; } diff --git a/platform/android/audio_driver_opensl.h b/platform/android/audio_driver_opensl.h index b30711705b..999cbe4657 100644 --- a/platform/android/audio_driver_opensl.h +++ b/platform/android/audio_driver_opensl.h @@ -38,19 +38,19 @@ #include <SLES/OpenSLES_Android.h> class AudioDriverOpenSL : public AudioDriver { - bool active; + bool active = false; Mutex mutex; enum { BUFFER_COUNT = 2 }; - bool pause; + bool pause = false; - uint32_t buffer_size; - int16_t *buffers[BUFFER_COUNT]; - int32_t *mixdown_buffer; - int last_free; + uint32_t buffer_size = 0; + int16_t *buffers[BUFFER_COUNT] = {}; + int32_t *mixdown_buffer = nullptr; + int last_free = 0; Vector<int16_t> rec_buffer; diff --git a/platform/android/display_server_android.h b/platform/android/display_server_android.h index aa5a2c1185..7480eb8ebf 100644 --- a/platform/android/display_server_android.h +++ b/platform/android/display_server_android.h @@ -41,7 +41,7 @@ class RenderingDeviceVulkan; class DisplayServerAndroid : public DisplayServer { public: struct TouchPos { - int id; + int id = 0; Point2 pos; }; @@ -52,12 +52,12 @@ public: }; struct JoypadEvent { - int device; - int type; - int index; - bool pressed; - float value; - int hat; + int device = 0; + int type = 0; + int index = 0; + bool pressed = false; + float value = 0; + int hat = 0; }; private: diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index d24c96f87a..eed3b226c8 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -205,7 +205,7 @@ static const char *SPLASH_BG_COLOR_PATH = "res/drawable/splash_bg_color.png"; struct LauncherIcon { const char *export_path; - int dimensions; + int dimensions = 0; }; static const int icon_densities_count = 6; @@ -250,12 +250,12 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { String id; String name; String description; - int api_level; + int api_level = 0; }; struct APKExportData { zipFile apk; - EditorProgress *ep; + EditorProgress *ep = nullptr; }; Vector<PluginConfig> plugins; diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp index 2446ca2829..0d933fb858 100644 --- a/platform/android/file_access_android.cpp +++ b/platform/android/file_access_android.cpp @@ -157,11 +157,6 @@ bool FileAccessAndroid::file_exists(const String &p_path) { return true; } -FileAccessAndroid::FileAccessAndroid() { - a = nullptr; - eof = false; -} - FileAccessAndroid::~FileAccessAndroid() { close(); } diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h index a347c63ffb..7fc7d8c83d 100644 --- a/platform/android/file_access_android.h +++ b/platform/android/file_access_android.h @@ -39,10 +39,10 @@ class FileAccessAndroid : public FileAccess { static FileAccess *create_android(); - mutable AAsset *a; - mutable size_t len; - mutable size_t pos; - mutable bool eof; + mutable AAsset *a = nullptr; + mutable size_t len = 0; + mutable size_t pos = 0; + mutable bool eof = false; public: static AAssetManager *asset_manager; @@ -74,7 +74,6 @@ public: //static void make_default(); - FileAccessAndroid(); ~FileAccessAndroid(); }; diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 00733f6dbb..25a8297a3d 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -314,6 +314,7 @@ OS_Android::OS_Android(GodotJavaWrapper *p_godot_java, GodotIOJavaWrapper *p_god #if defined(OPENGL_ENABLED) gl_extensions = nullptr; use_gl2 = false; + use_16bits_fbo = false; #endif #if defined(VULKAN_ENABLED) diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index fff82c9467..3406c75c35 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -94,8 +94,8 @@ class EditorExportPlatformIOS : public EditorExportPlatform { struct IOSExportAsset { String exported_path; - bool is_framework; // framework is anything linked to the binary, otherwise it's a resource - bool should_embed; + bool is_framework = false; // framework is anything linked to the binary, otherwise it's a resource + bool should_embed = false; }; String _get_additional_plist_content(); @@ -314,9 +314,9 @@ Vector<EditorExportPlatformIOS::ExportArchitecture> EditorExportPlatformIOS::_ge struct LoadingScreenInfo { const char *preset_key; const char *export_name; - int width; - int height; - bool rotate; + int width = 0; + int height = 0; + bool rotate = false; }; static const LoadingScreenInfo loading_screen_infos[] = { @@ -667,7 +667,7 @@ struct IconInfo { const char *actual_size_side; const char *scale; const char *unscaled_size; - bool is_required; + bool is_required = false; }; static const IconInfo icon_infos[] = { @@ -962,7 +962,7 @@ Error EditorExportPlatformIOS::_walk_dir_recursive(DirAccess *p_da, FileHandler struct CodesignData { const Ref<EditorExportPreset> &preset; - bool debug; + bool debug = false; CodesignData(const Ref<EditorExportPreset> &p_preset, bool p_debug) : preset(p_preset), diff --git a/platform/linuxbsd/detect_prime_x11.cpp b/platform/linuxbsd/detect_prime_x11.cpp index e5a9bb4737..709523e836 100644 --- a/platform/linuxbsd/detect_prime_x11.cpp +++ b/platform/linuxbsd/detect_prime_x11.cpp @@ -56,7 +56,7 @@ typedef GLXContext (*GLXCREATECONTEXTATTRIBSARBPROC)(Display *, GLXFBConfig, GLX struct vendor { const char *glxvendor; - int priority; + int priority = 0; }; vendor vendormap[] = { diff --git a/platform/linuxbsd/display_server_x11.h b/platform/linuxbsd/display_server_x11.h index 61fb04cbf3..55d2627a59 100644 --- a/platform/linuxbsd/display_server_x11.h +++ b/platform/linuxbsd/display_server_x11.h @@ -63,25 +63,25 @@ // Hints for X11 fullscreen typedef struct { - unsigned long flags; - unsigned long functions; - unsigned long decorations; - long inputMode; - unsigned long status; + unsigned long flags = 0; + unsigned long functions = 0; + unsigned long decorations = 0; + long inputMode = 0; + unsigned long status = 0; } Hints; typedef struct _xrr_monitor_info { Atom name; - Bool primary; - Bool automatic; - int noutput; - int x; - int y; - int width; - int height; - int mwidth; - int mheight; - RROutput *outputs; + Bool primary = false; + Bool automatic = false; + int noutput = 0; + int x = 0; + int y = 0; + int width = 0; + int height = 0; + int mwidth = 0; + int mheight = 0; + RROutput *outputs = nullptr; } xrr_monitor_info; #undef CursorShape diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp index 4a9d0a8181..0676587f7a 100644 --- a/platform/linuxbsd/joypad_linux.cpp +++ b/platform/linuxbsd/joypad_linux.cpp @@ -49,15 +49,6 @@ static const char *ignore_str = "/dev/input/js"; #endif -JoypadLinux::Joypad::Joypad() { - fd = -1; - dpad = 0; - devpath = ""; - for (int i = 0; i < MAX_ABS; i++) { - abs_info[i] = nullptr; - } -} - JoypadLinux::Joypad::~Joypad() { for (int i = 0; i < MAX_ABS; i++) { if (abs_info[i]) { diff --git a/platform/linuxbsd/joypad_linux.h b/platform/linuxbsd/joypad_linux.h index 0d175193a5..71eab78f99 100644 --- a/platform/linuxbsd/joypad_linux.h +++ b/platform/linuxbsd/joypad_linux.h @@ -56,17 +56,16 @@ private: Input::JoyAxis curr_axis[MAX_ABS]; int key_map[MAX_KEY]; int abs_map[MAX_ABS]; - int dpad; - int fd; + int dpad = 0; + int fd = -1; String devpath; - input_absinfo *abs_info[MAX_ABS]; + input_absinfo *abs_info[MAX_ABS] = {}; - bool force_feedback; - int ff_effect_id; - uint64_t ff_effect_timestamp; + bool force_feedback = false; + int ff_effect_id = 0; + uint64_t ff_effect_timestamp = 0; - Joypad(); ~Joypad(); void reset(); }; diff --git a/platform/osx/display_server_osx.h b/platform/osx/display_server_osx.h index 073d35008b..ea55a3ff28 100644 --- a/platform/osx/display_server_osx.h +++ b/platform/osx/display_server_osx.h @@ -77,13 +77,13 @@ public: struct KeyEvent { WindowID window_id; - unsigned int osx_state; - bool pressed; - bool echo; - bool raw; - uint32_t keycode; - uint32_t physical_keycode; - uint32_t unicode; + unsigned int osx_state = false; + bool pressed = false; + bool echo = false; + bool raw = false; + uint32_t keycode = 0; + uint32_t physical_keycode = 0; + uint32_t unicode = 0; }; struct WarpEvent { diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index e988e51e72..424e2ee5d5 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -48,7 +48,7 @@ class EditorExportPlatformOSX : public EditorExportPlatform { GDCLASS(EditorExportPlatformOSX, EditorExportPlatform); - int version_code; + int version_code = 0; Ref<ImageTexture> logo; diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index cfc371710b..b2871b261e 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -37,14 +37,6 @@ static JoypadOSX *self = nullptr; joypad::joypad() { - device_ref = nullptr; - ff_device = nullptr; - ff_axes = nullptr; - ff_directions = nullptr; - ffservice = 0; - ff_timestamp = 0; - id = 0; - ff_constant_force.lMagnitude = 10000; ff_effect.dwDuration = 0; ff_effect.dwSamplePeriod = 0; diff --git a/platform/osx/joypad_osx.h b/platform/osx/joypad_osx.h index dc238e68e4..6c2a1ea70b 100644 --- a/platform/osx/joypad_osx.h +++ b/platform/osx/joypad_osx.h @@ -46,10 +46,10 @@ struct rec_element { IOHIDElementRef ref; IOHIDElementCookie cookie; - uint32_t usage; + uint32_t usage = 0; - int min; - int max; + int min = 0; + int max = 0; struct Comparator { bool operator()(const rec_element p_a, const rec_element p_b) const { return p_a.usage < p_b.usage; } @@ -57,22 +57,22 @@ struct rec_element { }; struct joypad { - IOHIDDeviceRef device_ref; + IOHIDDeviceRef device_ref = nullptr; Vector<rec_element> axis_elements; Vector<rec_element> button_elements; Vector<rec_element> hat_elements; - int id; + int id = 0; - io_service_t ffservice; /* Interface for force feedback, 0 = no ff */ + io_service_t ffservice = 0; /* Interface for force feedback, 0 = no ff */ FFCONSTANTFORCE ff_constant_force; FFDeviceObjectReference ff_device; FFEffectObjectReference ff_object; - uint64_t ff_timestamp; - LONG *ff_directions; + uint64_t ff_timestamp = 0; + LONG *ff_directions = nullptr; FFEFFECT ff_effect; - DWORD *ff_axes; + DWORD *ff_axes = nullptr; void add_hid_elements(CFArrayRef p_array); void add_hid_element(IOHIDElementRef p_element); diff --git a/platform/server/os_server.h b/platform/server/os_server.h index 06ea483fd4..c717fcd369 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -47,22 +47,22 @@ #undef CursorShape class OS_Server : public OS_Unix { - RenderingServer *rendering_server; + RenderingServer *rendering_server = nullptr; VideoMode current_videomode; List<String> args; - MainLoop *main_loop; + MainLoop *main_loop = nullptr; - bool grab; + bool grab = false; virtual void delete_main_loop(); - bool force_quit; + bool force_quit = false; - InputDefault *input; + InputDefault *input = nullptr; CrashHandler crash_handler; - int video_driver_index; + int video_driver_index = 0; Ref<ResourceFormatDummyTexture> resource_loader_dummy; diff --git a/platform/uwp/context_egl_uwp.cpp b/platform/uwp/context_egl_uwp.cpp index 2da6c5897a..a6607ed42c 100644 --- a/platform/uwp/context_egl_uwp.cpp +++ b/platform/uwp/context_egl_uwp.cpp @@ -204,7 +204,8 @@ ContextEGL_UWP::ContextEGL_UWP(CoreWindow ^ p_window, Driver p_driver) : mEglContext(EGL_NO_CONTEXT), mEglSurface(EGL_NO_SURFACE), driver(p_driver), - window(p_window) {} + window(p_window), + vsync(false) {} ContextEGL_UWP::~ContextEGL_UWP() { cleanup(); diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index 30568241a9..00b57c48f3 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -108,7 +108,7 @@ class AppxPackager { struct BlockHash { String base64_hash; - size_t compressed_size; + size_t compressed_size = 0; }; struct FileMeta { @@ -120,12 +120,10 @@ class AppxPackager { Vector<BlockHash> hashes; uLong file_crc32 = 0; ZPOS64_T zip_offset = 0; - - FileMeta() {} }; String progress_task; - FileAccess *package; + FileAccess *package = nullptr; Set<String> mime_types; diff --git a/platform/uwp/joypad_uwp.h b/platform/uwp/joypad_uwp.h index 13f246a438..2df87d6fd5 100644 --- a/platform/uwp/joypad_uwp.h +++ b/platform/uwp/joypad_uwp.h @@ -58,21 +58,12 @@ private: struct ControllerDevice { Windows::Gaming::Input::IGameController ^ controller_reference; - int id; - bool connected; - ControllerType type; - float ff_timestamp; - float ff_end_timestamp; - bool vibrating; - - ControllerDevice() { - id = -1; - connected = false; - type = ControllerType::GAMEPAD_CONTROLLER; - ff_timestamp = 0.0f; - ff_end_timestamp = 0.0f; - vibrating = false; - } + int id = -1; + bool connected = false; + ControllerType type = ControllerType::GAMEPAD_CONTROLLER; + float ff_timestamp = 0; + float ff_end_timestamp = 0; + bool vibrating = false; }; ControllerDevice controllers[MAX_CONTROLLERS]; diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index 88961bf143..100bbd6a50 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -55,13 +55,13 @@ public: CHAR_EVENT_MESSAGE }; - bool alt, shift, control; - MessageType type; - bool pressed; - unsigned int keycode; - unsigned int physical_keycode; - unsigned int unicode; - bool echo; + bool alt = false, shift = false, control = false; + MessageType type = KEY_EVENT_MESSAGE; + bool pressed = false; + unsigned int keycode = 0; + unsigned int physical_keycode = 0; + unsigned int unicode = 0; + bool echo = false; CorePhysicalKeyStatus status; }; diff --git a/platform/windows/context_gl_windows.cpp b/platform/windows/context_gl_windows.cpp index 1c32639a38..54251fc66c 100644 --- a/platform/windows/context_gl_windows.cpp +++ b/platform/windows/context_gl_windows.cpp @@ -211,6 +211,7 @@ ContextGL_Windows::ContextGL_Windows(HWND hwnd, bool p_opengl_3_context) { hWnd = hwnd; use_vsync = false; vsync_via_compositor = false; + pixel_format = 0; } ContextGL_Windows::~ContextGL_Windows() { diff --git a/platform/windows/crash_handler_windows.cpp b/platform/windows/crash_handler_windows.cpp index 7abf451062..0f2f49c5ce 100644 --- a/platform/windows/crash_handler_windows.cpp +++ b/platform/windows/crash_handler_windows.cpp @@ -57,7 +57,7 @@ struct module_data { std::string image_name; std::string module_name; - void *base_address; + void *base_address = nullptr; DWORD load_size; }; diff --git a/platform/windows/joypad_windows.h b/platform/windows/joypad_windows.h index 223b44fcd6..08adc6b663 100644 --- a/platform/windows/joypad_windows.h +++ b/platform/windows/joypad_windows.h @@ -92,21 +92,13 @@ private: }; struct xinput_gamepad { - int id; - bool attached; - bool vibrating; - DWORD last_packet; + int id = 0; + bool attached = false; + bool vibrating = false; + DWORD last_packet = 0; XINPUT_STATE state; - uint64_t ff_timestamp; - uint64_t ff_end_timestamp; - - xinput_gamepad() { - attached = false; - vibrating = false; - ff_timestamp = 0; - ff_end_timestamp = 0; - last_packet = 0; - } + uint64_t ff_timestamp = 0; + uint64_t ff_end_timestamp = 0; }; typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex, XINPUT_STATE *pState); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 646bc3aa4c..11a884e382 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -802,6 +802,11 @@ void OS_Windows::set_current_tablet_driver(const String &p_driver) { } OS_Windows::OS_Windows(HINSTANCE _hInstance) { + ticks_per_second = 0; + ticks_start = 0; + main_loop = nullptr; + process_map = nullptr; + //Note: Wacom WinTab driver API for pen input, for devices incompatible with Windows Ink. HMODULE wintab_lib = LoadLibraryW(L"wintab32.dll"); if (wintab_lib) { |