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 /editor | |
parent | d1231be1c8f8f2c16fd1047adcd3c7f997a07c1f (diff) |
Initialize class/struct variables with default values in platform/ and editor/
Diffstat (limited to 'editor')
55 files changed, 290 insertions, 382 deletions
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; |