diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-04-04 15:06:57 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-04-04 19:49:50 +0200 |
commit | f8ab79e68af20e18e1d868b64d6dfd0c429bc554 (patch) | |
tree | a9d2df2e2df939c189135b1c36a01e06b37b80b2 /editor/plugins/tiles | |
parent | 53317bbe146dd19a919685df8d846c55568daba1 (diff) |
Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
Diffstat (limited to 'editor/plugins/tiles')
-rw-r--r-- | editor/plugins/tiles/atlas_merging_dialog.h | 16 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_atlas_view.h | 36 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_data_editors.h | 46 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_map_editor.h | 110 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_proxies_manager_dialog.h | 22 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_set_atlas_source_editor.h | 70 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_set_editor.h | 32 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_set_scenes_collection_source_editor.h | 22 | ||||
-rw-r--r-- | editor/plugins/tiles/tiles_editor_plugin.h | 8 |
9 files changed, 181 insertions, 181 deletions
diff --git a/editor/plugins/tiles/atlas_merging_dialog.h b/editor/plugins/tiles/atlas_merging_dialog.h index 6cf555247d..9502d93f6b 100644 --- a/editor/plugins/tiles/atlas_merging_dialog.h +++ b/editor/plugins/tiles/atlas_merging_dialog.h @@ -49,19 +49,19 @@ private: LocalVector<Map<Vector2i, Vector2i>> merged_mapping; Ref<TileSet> tile_set; - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; // Settings. int next_line_after_column = 30; // GUI. - ItemList *atlas_merging_atlases_list; - EditorPropertyVector2i *texture_region_size_editor_property; - EditorPropertyInteger *columns_editor_property; - TextureRect *preview; - Label *select_2_atlases_label; - EditorFileDialog *editor_file_dialog; - Button *merge_button; + ItemList *atlas_merging_atlases_list = nullptr; + EditorPropertyVector2i *texture_region_size_editor_property = nullptr; + EditorPropertyInteger *columns_editor_property = nullptr; + TextureRect *preview = nullptr; + Label *select_2_atlases_label = nullptr; + EditorFileDialog *editor_file_dialog = nullptr; + Button *merge_button = nullptr; void _property_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing); diff --git a/editor/plugins/tiles/tile_atlas_view.h b/editor/plugins/tiles/tile_atlas_view.h index caf3ef9e4b..6e74858b08 100644 --- a/editor/plugins/tiles/tile_atlas_view.h +++ b/editor/plugins/tiles/tile_atlas_view.h @@ -45,8 +45,8 @@ class TileAtlasView : public Control { GDCLASS(TileAtlasView, Control); private: - TileSet *tile_set; - TileSetAtlasSource *tile_set_atlas_source; + TileSet *tile_set = nullptr; + TileSetAtlasSource *tile_set_atlas_source = nullptr; int source_id = TileSet::INVALID_SOURCE; enum DragType { @@ -55,9 +55,9 @@ private: }; DragType drag_type = DRAG_TYPE_NONE; float previous_zoom = 1.0; - EditorZoomWidget *zoom_widget; - Button *button_center_view; - CenterContainer *center_container; + EditorZoomWidget *zoom_widget = nullptr; + Button *button_center_view = nullptr; + CenterContainer *center_container = nullptr; Vector2 panning; void _update_zoom_and_panning(bool p_zoom_on_mouse_pos = false); void _zoom_widget_changed(); @@ -72,41 +72,41 @@ private: Map<Vector2, Map<int, Rect2i>> alternative_tiles_rect_cache; void _update_alternative_tiles_rect_cache(); - MarginContainer *margin_container; + MarginContainer *margin_container = nullptr; int margin_container_paddings[4] = { 0, 0, 0, 0 }; - HBoxContainer *hbox; - Label *missing_source_label; + HBoxContainer *hbox = nullptr; + Label *missing_source_label = nullptr; // Background - Control *background_left; + Control *background_left = nullptr; void _draw_background_left(); - Control *background_right; + Control *background_right = nullptr; void _draw_background_right(); // Left side. - Control *base_tiles_root_control; + Control *base_tiles_root_control = nullptr; void _base_tiles_root_control_gui_input(const Ref<InputEvent> &p_event); - Control *base_tiles_drawing_root; + Control *base_tiles_drawing_root = nullptr; - Control *base_tiles_draw; + Control *base_tiles_draw = nullptr; void _draw_base_tiles(); - Control *base_tiles_texture_grid; + Control *base_tiles_texture_grid = nullptr; void _draw_base_tiles_texture_grid(); - Control *base_tiles_shape_grid; + Control *base_tiles_shape_grid = nullptr; void _draw_base_tiles_shape_grid(); Size2i _compute_base_tiles_control_size(); // Right side. - Control *alternative_tiles_root_control; + Control *alternative_tiles_root_control = nullptr; void _alternative_tiles_root_control_gui_input(const Ref<InputEvent> &p_event); - Control *alternative_tiles_drawing_root; + Control *alternative_tiles_drawing_root = nullptr; - Control *alternatives_draw; + Control *alternatives_draw = nullptr; void _draw_alternatives(); Size2i _compute_alternative_tiles_control_size(); diff --git a/editor/plugins/tiles/tile_data_editors.h b/editor/plugins/tiles/tile_data_editors.h index 99724760a7..3ac9eacb05 100644 --- a/editor/plugins/tiles/tile_data_editors.h +++ b/editor/plugins/tiles/tile_data_editors.h @@ -93,7 +93,7 @@ private: bool multiple_polygon_mode = false; bool use_undo_redo = true; - UndoRedo *editor_undo_redo; + UndoRedo *editor_undo_redo = nullptr; // UI int hovered_polygon_index = -1; @@ -113,20 +113,20 @@ private: Vector2 drag_last_pos; PackedVector2Array drag_old_polygon; - HBoxContainer *toolbar; + HBoxContainer *toolbar = nullptr; Ref<ButtonGroup> tools_button_group; - Button *button_create; - Button *button_edit; - Button *button_delete; - Button *button_pixel_snap; - MenuButton *button_advanced_menu; + Button *button_create = nullptr; + Button *button_edit = nullptr; + Button *button_delete = nullptr; + Button *button_pixel_snap = nullptr; + MenuButton *button_advanced_menu = nullptr; Vector<Point2> in_creation_polygon; - Panel *panel; - Control *base_control; - EditorZoomWidget *editor_zoom_widget; - Button *button_center_view; + Panel *panel = nullptr; + Control *base_control = nullptr; + EditorZoomWidget *editor_zoom_widget = nullptr; + Button *button_center_view = nullptr; Vector2 panning; Ref<Texture2D> background_texture; @@ -188,12 +188,12 @@ class TileDataDefaultEditor : public TileDataEditor { private: // Toolbar HBoxContainer *toolbar = memnew(HBoxContainer); - Button *picker_button; + Button *picker_button = nullptr; // UI Ref<Texture2D> tile_bool_checked; Ref<Texture2D> tile_bool_unchecked; - Label *label; + Label *label = nullptr; EditorProperty *property_editor = nullptr; @@ -214,7 +214,7 @@ private: protected: DummyObject *dummy_object = memnew(DummyObject); - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; StringName type; String property; @@ -268,7 +268,7 @@ private: int occlusion_layer = -1; // UI - GenericTilePolygonEditor *polygon_editor; + GenericTilePolygonEditor *polygon_editor = nullptr; void _polygon_changed(PackedVector2Array p_polygon); @@ -279,7 +279,7 @@ private: virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) override; protected: - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; virtual void _tile_set_changed() override; @@ -299,7 +299,7 @@ class TileDataCollisionEditor : public TileDataDefaultEditor { int physics_layer = -1; // UI - GenericTilePolygonEditor *polygon_editor; + GenericTilePolygonEditor *polygon_editor = nullptr; DummyObject *dummy_object = memnew(DummyObject); Map<StringName, EditorProperty *> property_editors; @@ -314,7 +314,7 @@ class TileDataCollisionEditor : public TileDataDefaultEditor { virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) override; protected: - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; virtual void _tile_set_changed() override; @@ -335,7 +335,7 @@ class TileDataTerrainsEditor : public TileDataEditor { private: // Toolbar HBoxContainer *toolbar = memnew(HBoxContainer); - Button *picker_button; + Button *picker_button = nullptr; // Painting state. enum DragType { @@ -352,7 +352,7 @@ private: Variant drag_painted_value; // UI - Label *label; + Label *label = nullptr; DummyObject *dummy_object = memnew(DummyObject); EditorPropertyEnum *terrain_set_property_editor = nullptr; EditorPropertyEnum *terrain_property_editor = nullptr; @@ -366,7 +366,7 @@ protected: void _notification(int p_what); - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; public: virtual Control *get_toolbar() override { return toolbar; }; @@ -388,7 +388,7 @@ private: PackedVector2Array navigation_polygon; // UI - GenericTilePolygonEditor *polygon_editor; + GenericTilePolygonEditor *polygon_editor = nullptr; void _polygon_changed(PackedVector2Array p_polygon); @@ -399,7 +399,7 @@ private: virtual void _setup_undo_redo_action(TileSetAtlasSource *p_tile_set_atlas_source, Map<TileMapCell, Variant> p_previous_values, Variant p_new_value) override; protected: - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; virtual void _tile_set_changed() override; diff --git a/editor/plugins/tiles/tile_map_editor.h b/editor/plugins/tiles/tile_map_editor.h index d09061015f..3a0293f48f 100644 --- a/editor/plugins/tiles/tile_map_editor.h +++ b/editor/plugins/tiles/tile_map_editor.h @@ -51,8 +51,8 @@ class UndoRedo; class TileMapEditorPlugin : public Object { public: struct TabData { - Control *toolbar; - Control *panel; + Control *toolbar = nullptr; + Control *panel = nullptr; }; virtual Vector<TabData> get_tabs() const { @@ -69,33 +69,33 @@ class TileMapEditorTilesPlugin : public TileMapEditorPlugin { GDCLASS(TileMapEditorTilesPlugin, TileMapEditorPlugin); private: - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; ObjectID tile_map_id; int tile_map_layer = -1; virtual void edit(ObjectID p_tile_map_id, int p_tile_map_layer) override; ///// Toolbar ///// - HBoxContainer *toolbar; + HBoxContainer *toolbar = nullptr; Ref<ButtonGroup> tool_buttons_group; - Button *select_tool_button; - Button *paint_tool_button; - Button *line_tool_button; - Button *rect_tool_button; - Button *bucket_tool_button; + Button *select_tool_button = nullptr; + Button *paint_tool_button = nullptr; + Button *line_tool_button = nullptr; + Button *rect_tool_button = nullptr; + Button *bucket_tool_button = nullptr; - HBoxContainer *tools_settings; + HBoxContainer *tools_settings = nullptr; - VSeparator *tools_settings_vsep; - Button *picker_button; - Button *erase_button; + VSeparator *tools_settings_vsep = nullptr; + Button *picker_button = nullptr; + Button *erase_button = nullptr; - VSeparator *tools_settings_vsep_2; - CheckBox *bucket_contiguous_checkbox; - CheckBox *random_tile_checkbox; + VSeparator *tools_settings_vsep_2 = nullptr; + CheckBox *bucket_contiguous_checkbox = nullptr; + CheckBox *random_tile_checkbox = nullptr; float scattering = 0.0; - Label *scatter_label; - SpinBox *scatter_spinbox; + Label *scatter_label = nullptr; + SpinBox *scatter_spinbox = nullptr; void _on_random_tile_checkbox_toggled(bool p_pressed); void _on_scattering_spinbox_changed(double p_value); @@ -148,12 +148,12 @@ private: void _tab_changed(); ///// Bottom panel tiles //// - VBoxContainer *tiles_bottom_panel; - Label *missing_source_label; - Label *invalid_source_label; + VBoxContainer *tiles_bottom_panel = nullptr; + Label *missing_source_label = nullptr; + Label *invalid_source_label = nullptr; - ItemList *sources_list; - MenuButton *source_sort_button; + ItemList *sources_list = nullptr; + MenuButton *source_sort_button = nullptr; Ref<Texture2D> missing_atlas_texture_icon; void _update_tile_set_sources_list(); @@ -162,18 +162,18 @@ private: // Atlas sources. TileMapCell hovered_tile; - TileAtlasView *tile_atlas_view; - HSplitContainer *atlas_sources_split_container; + TileAtlasView *tile_atlas_view = nullptr; + HSplitContainer *atlas_sources_split_container = nullptr; bool tile_set_dragging_selection = false; Vector2i tile_set_drag_start_mouse_pos; - Control *tile_atlas_control; + Control *tile_atlas_control = nullptr; void _tile_atlas_control_mouse_exited(); void _tile_atlas_control_gui_input(const Ref<InputEvent> &p_event); void _tile_atlas_control_draw(); - Control *alternative_tiles_control; + Control *alternative_tiles_control = nullptr; void _tile_alternatives_control_draw(); void _tile_alternatives_control_mouse_exited(); void _tile_alternatives_control_gui_input(const Ref<InputEvent> &p_event); @@ -182,7 +182,7 @@ private: void _set_source_sort(int p_sort); // Scenes collection sources. - ItemList *scene_tiles_list; + ItemList *scene_tiles_list = nullptr; void _update_scenes_collection_view(); void _scene_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, Variant p_ud); @@ -190,9 +190,9 @@ private: void _scenes_list_nothing_selected(); ///// Bottom panel patterns //// - VBoxContainer *patterns_bottom_panel; - ItemList *patterns_item_list; - Label *patterns_help_label; + VBoxContainer *patterns_bottom_panel = nullptr; + ItemList *patterns_item_list = nullptr; + Label *patterns_help_label = nullptr; void _patterns_item_list_gui_input(const Ref<InputEvent> &p_event); void _pattern_preview_done(Ref<TileMapPattern> p_pattern, Ref<Texture2D> p_texture); bool select_last_pattern = false; @@ -220,32 +220,32 @@ class TileMapEditorTerrainsPlugin : public TileMapEditorPlugin { GDCLASS(TileMapEditorTerrainsPlugin, TileMapEditorPlugin); private: - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; ObjectID tile_map_id; int tile_map_layer = -1; virtual void edit(ObjectID p_tile_map_id, int p_tile_map_layer) override; // Toolbar. - HBoxContainer *toolbar; + HBoxContainer *toolbar = nullptr; Ref<ButtonGroup> tool_buttons_group; - Button *paint_tool_button; - Button *line_tool_button; - Button *rect_tool_button; - Button *bucket_tool_button; + Button *paint_tool_button = nullptr; + Button *line_tool_button = nullptr; + Button *rect_tool_button = nullptr; + Button *bucket_tool_button = nullptr; - HBoxContainer *tools_settings; + HBoxContainer *tools_settings = nullptr; - VSeparator *tools_settings_vsep; - Button *picker_button; - Button *erase_button; + VSeparator *tools_settings_vsep = nullptr; + Button *picker_button = nullptr; + Button *erase_button = nullptr; - VSeparator *tools_settings_vsep_2; - CheckBox *bucket_contiguous_checkbox; + VSeparator *tools_settings_vsep_2 = nullptr; + CheckBox *bucket_contiguous_checkbox = nullptr; void _update_toolbar(); // Main vbox. - VBoxContainer *main_vbox_container; + VBoxContainer *main_vbox_container = nullptr; // TileMap editing. bool has_mouse = false; @@ -278,8 +278,8 @@ private: void _update_selection(); // Bottom panel. - Tree *terrains_tree; - ItemList *terrains_tile_list; + Tree *terrains_tree = nullptr; + ItemList *terrains_tile_list = nullptr; // Cache. LocalVector<LocalVector<Set<TileSet::TerrainsPattern>>> per_terrain_terrains_patterns; @@ -306,7 +306,7 @@ class TileMapEditor : public VBoxContainer { GDCLASS(TileMapEditor, VBoxContainer); private: - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; bool tileset_changed_needs_update = false; ObjectID tile_map_id; int tile_map_layer = -1; @@ -315,24 +315,24 @@ private: Vector<TileMapEditorPlugin *> tile_map_editor_plugins; // Toolbar. - HBoxContainer *tile_map_toolbar; + HBoxContainer *tile_map_toolbar = nullptr; - PopupMenu *layers_selection_popup; - Button *layers_selection_button; - Button *toogle_highlight_selected_layer_button; + PopupMenu *layers_selection_popup = nullptr; + Button *layers_selection_button = nullptr; + Button *toogle_highlight_selected_layer_button = nullptr; void _layers_selection_button_draw(); void _layers_selection_button_pressed(); void _layers_selection_id_pressed(int p_id); - Button *toggle_grid_button; + Button *toggle_grid_button = nullptr; void _on_grid_toggled(bool p_pressed); - MenuButton *advanced_menu_button; + MenuButton *advanced_menu_button = nullptr; void _advanced_menu_button_id_pressed(int p_id); // Bottom panel. - Label *missing_tileset_label; - TabBar *tabs_bar; + Label *missing_tileset_label = nullptr; + TabBar *tabs_bar = nullptr; LocalVector<TileMapEditorPlugin::TabData> tabs_data; LocalVector<TileMapEditorPlugin *> tabs_plugins; void _update_bottom_panel(); diff --git a/editor/plugins/tiles/tile_proxies_manager_dialog.h b/editor/plugins/tiles/tile_proxies_manager_dialog.h index 3f1461391e..00866544be 100644 --- a/editor/plugins/tiles/tile_proxies_manager_dialog.h +++ b/editor/plugins/tiles/tile_proxies_manager_dialog.h @@ -43,24 +43,24 @@ private: int commited_actions_count = 0; Ref<TileSet> tile_set; - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; TileMapCell from; TileMapCell to; // GUI - ItemList *source_level_list; - ItemList *coords_level_list; - ItemList *alternative_level_list; + ItemList *source_level_list = nullptr; + ItemList *coords_level_list = nullptr; + ItemList *alternative_level_list = nullptr; - EditorPropertyInteger *source_from_property_editor; - EditorPropertyVector2i *coords_from_property_editor; - EditorPropertyInteger *alternative_from_property_editor; - EditorPropertyInteger *source_to_property_editor; - EditorPropertyVector2i *coords_to_property_editor; - EditorPropertyInteger *alternative_to_property_editor; + EditorPropertyInteger *source_from_property_editor = nullptr; + EditorPropertyVector2i *coords_from_property_editor = nullptr; + EditorPropertyInteger *alternative_from_property_editor = nullptr; + EditorPropertyInteger *source_to_property_editor = nullptr; + EditorPropertyVector2i *coords_to_property_editor = nullptr; + EditorPropertyInteger *alternative_to_property_editor = nullptr; - PopupMenu *popup_menu; + PopupMenu *popup_menu = nullptr; void _right_clicked(int p_item, Vector2 p_local_mouse_pos, Object *p_item_list); void _menu_id_pressed(int p_id); void _delete_selected_bindings(); diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.h b/editor/plugins/tiles/tile_set_atlas_source_editor.h index 4a90b821f8..b26b7edbfa 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.h +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.h @@ -85,7 +85,7 @@ public: GDCLASS(AtlasTileProxyObject, Object); private: - TileSetAtlasSourceEditor *tiles_set_atlas_source_editor; + TileSetAtlasSourceEditor *tiles_set_atlas_source_editor = nullptr; TileSetAtlasSource *tile_set_atlas_source = nullptr; Set<TileSelection> tiles = Set<TileSelection>(); @@ -114,16 +114,16 @@ private: TileSetAtlasSource *tile_set_atlas_source = nullptr; int tile_set_atlas_source_id = TileSet::INVALID_SOURCE; - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; bool tile_set_changed_needs_update = false; // -- Properties painting -- - VBoxContainer *tile_data_painting_editor_container; - Label *tile_data_editors_label; - Button *tile_data_editor_dropdown_button; - Popup *tile_data_editors_popup; - Tree *tile_data_editors_tree; + VBoxContainer *tile_data_painting_editor_container = nullptr; + Label *tile_data_editors_label = nullptr; + Button *tile_data_editor_dropdown_button = nullptr; + Popup *tile_data_editors_popup = nullptr; + Tree *tile_data_editors_tree = nullptr; void _tile_data_editor_dropdown_button_draw(); void _tile_data_editor_dropdown_button_pressed(); @@ -135,21 +135,21 @@ private: void _tile_data_editors_tree_selected(); // -- Inspector -- - AtlasTileProxyObject *tile_proxy_object; - Label *tile_inspector_label; - EditorInspector *tile_inspector; - Label *tile_inspector_no_tile_selected_label; + AtlasTileProxyObject *tile_proxy_object = nullptr; + Label *tile_inspector_label = nullptr; + EditorInspector *tile_inspector = nullptr; + Label *tile_inspector_no_tile_selected_label = nullptr; String selected_property; void _inspector_property_selected(String p_property); - TileSetAtlasSourceProxyObject *atlas_source_proxy_object; - Label *atlas_source_inspector_label; - EditorInspector *atlas_source_inspector; + TileSetAtlasSourceProxyObject *atlas_source_proxy_object = nullptr; + Label *atlas_source_inspector_label = nullptr; + EditorInspector *atlas_source_inspector = nullptr; // -- Atlas view -- - HBoxContainer *toolbox; - Label *tile_atlas_view_missing_source_label; - TileAtlasView *tile_atlas_view; + HBoxContainer *toolbox = nullptr; + Label *tile_atlas_view_missing_source_label = nullptr; + TileAtlasView *tile_atlas_view = nullptr; // Dragging enum DragType { @@ -202,17 +202,17 @@ private: // Tool buttons. Ref<ButtonGroup> tools_button_group; - Button *tool_setup_atlas_source_button; - Button *tool_select_button; - Button *tool_paint_button; - Label *tool_tile_id_label; + Button *tool_setup_atlas_source_button = nullptr; + Button *tool_select_button = nullptr; + Button *tool_paint_button = nullptr; + Label *tool_tile_id_label = nullptr; // Tool settings. - HBoxContainer *tool_settings; - VSeparator *tool_settings_vsep; - HBoxContainer *tool_settings_tile_data_toolbar_container; - Button *tools_settings_erase_button; - MenuButton *tool_advanced_menu_buttom; + HBoxContainer *tool_settings = nullptr; + VSeparator *tool_settings_vsep = nullptr; + HBoxContainer *tool_settings_tile_data_toolbar_container = nullptr; + Button *tools_settings_erase_button = nullptr; + MenuButton *tool_advanced_menu_buttom = nullptr; // Selection. Set<TileSelection> selection; @@ -223,12 +223,12 @@ private: // A control on the tile atlas to draw and handle input events. Vector2i hovered_base_tile_coords = TileSetSource::INVALID_ATLAS_COORDS; - PopupMenu *base_tile_popup_menu; - PopupMenu *empty_base_tile_popup_menu; + PopupMenu *base_tile_popup_menu = nullptr; + PopupMenu *empty_base_tile_popup_menu = nullptr; Ref<Texture2D> resize_handle; Ref<Texture2D> resize_handle_disabled; - Control *tile_atlas_control; - Control *tile_atlas_control_unscaled; + Control *tile_atlas_control = nullptr; + Control *tile_atlas_control_unscaled = nullptr; void _tile_atlas_control_draw(); void _tile_atlas_control_unscaled_draw(); void _tile_atlas_control_mouse_exited(); @@ -238,9 +238,9 @@ private: // A control over the alternative tiles. Vector3i hovered_alternative_tile_coords = Vector3i(TileSetSource::INVALID_ATLAS_COORDS.x, TileSetSource::INVALID_ATLAS_COORDS.y, TileSetSource::INVALID_TILE_ALTERNATIVE); - PopupMenu *alternative_tile_popup_menu; - Control *alternative_tiles_control; - Control *alternative_tiles_control_unscaled; + PopupMenu *alternative_tile_popup_menu = nullptr; + Control *alternative_tiles_control = nullptr; + Control *alternative_tiles_control_unscaled = nullptr; void _tile_alternatives_control_draw(); void _tile_alternatives_control_unscaled_draw(); void _tile_alternatives_control_mouse_exited(); @@ -264,7 +264,7 @@ private: // -- Misc -- void _auto_create_tiles(); void _auto_remove_tiles(); - AcceptDialog *confirm_auto_create_tiles; + AcceptDialog *confirm_auto_create_tiles = nullptr; void _tile_set_changed(); void _tile_proxy_object_changed(String p_what); @@ -293,7 +293,7 @@ class EditorPropertyTilePolygon : public EditorProperty { void _add_focusable_children(Node *p_node); - GenericTilePolygonEditor *generic_tile_polygon_editor; + GenericTilePolygonEditor *generic_tile_polygon_editor = nullptr; void _polygons_changed(); public: diff --git a/editor/plugins/tiles/tile_set_editor.h b/editor/plugins/tiles/tile_set_editor.h index b79b37cf2e..e633de37b0 100644 --- a/editor/plugins/tiles/tile_set_editor.h +++ b/editor/plugins/tiles/tile_set_editor.h @@ -47,18 +47,18 @@ class TileSetEditor : public VBoxContainer { private: Ref<TileSet> tile_set; bool tile_set_changed_needs_update = false; - HSplitContainer *split_container; + HSplitContainer *split_container = nullptr; // TabBar. - HBoxContainer *tile_set_toolbar; - TabBar *tabs_bar; + HBoxContainer *tile_set_toolbar = nullptr; + TabBar *tabs_bar = nullptr; // Tiles. - Label *no_source_selected_label; - TileSetAtlasSourceEditor *tile_set_atlas_source_editor; - TileSetScenesCollectionSourceEditor *tile_set_scenes_collection_source_editor; + Label *no_source_selected_label = nullptr; + TileSetAtlasSourceEditor *tile_set_atlas_source_editor = nullptr; + TileSetScenesCollectionSourceEditor *tile_set_scenes_collection_source_editor = nullptr; - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; void _drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); bool _can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; @@ -66,11 +66,11 @@ private: void _update_sources_list(int force_selected_id = -1); // Sources management. - Button *sources_delete_button; - MenuButton *sources_add_button; - MenuButton *source_sort_button; - MenuButton *sources_advanced_menu_button; - ItemList *sources_list; + Button *sources_delete_button = nullptr; + MenuButton *sources_add_button = nullptr; + MenuButton *source_sort_button = nullptr; + MenuButton *sources_advanced_menu_button = nullptr; + ItemList *sources_list = nullptr; Ref<Texture2D> missing_texture_texture; void _source_selected(int p_source_index); void _source_delete_pressed(); @@ -78,12 +78,12 @@ private: void _sources_advanced_menu_id_pressed(int p_id_pressed); void _set_source_sort(int p_sort); - AtlasMergingDialog *atlas_merging_dialog; - TileProxiesManagerDialog *tile_proxies_manager_dialog; + AtlasMergingDialog *atlas_merging_dialog = nullptr; + TileProxiesManagerDialog *tile_proxies_manager_dialog = nullptr; // Patterns. - ItemList *patterns_item_list; - Label *patterns_help_label; + ItemList *patterns_item_list = nullptr; + Label *patterns_help_label = nullptr; void _patterns_item_list_gui_input(const Ref<InputEvent> &p_event); void _pattern_preview_done(Ref<TileMapPattern> p_pattern, Ref<Texture2D> p_texture); bool select_last_pattern = false; diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h index 8904e8524a..657bfca032 100644 --- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.h @@ -70,7 +70,7 @@ private: GDCLASS(SceneTileProxyObject, Object); private: - TileSetScenesCollectionSourceEditor *tile_set_scenes_collection_source_editor; + TileSetScenesCollectionSourceEditor *tile_set_scenes_collection_source_editor = nullptr; TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr; int source_id; @@ -97,23 +97,23 @@ private: TileSetScenesCollectionSource *tile_set_scenes_collection_source = nullptr; int tile_set_source_id = -1; - UndoRedo *undo_redo; + UndoRedo *undo_redo = nullptr; bool tile_set_scenes_collection_source_changed_needs_update = false; // Source inspector. - TileSetScenesCollectionProxyObject *scenes_collection_source_proxy_object; - Label *scenes_collection_source_inspector_label; - EditorInspector *scenes_collection_source_inspector; + TileSetScenesCollectionProxyObject *scenes_collection_source_proxy_object = nullptr; + Label *scenes_collection_source_inspector_label = nullptr; + EditorInspector *scenes_collection_source_inspector = nullptr; // Tile inspector. - SceneTileProxyObject *tile_proxy_object; - Label *tile_inspector_label; - EditorInspector *tile_inspector; + SceneTileProxyObject *tile_proxy_object = nullptr; + Label *tile_inspector_label = nullptr; + EditorInspector *tile_inspector = nullptr; - ItemList *scene_tiles_list; - Button *scene_tile_add_button; - Button *scene_tile_delete_button; + ItemList *scene_tiles_list = nullptr; + Button *scene_tile_add_button = nullptr; + Button *scene_tile_delete_button = nullptr; void _tile_set_scenes_collection_source_changed(); void _scenes_collection_source_proxy_object_changed(String p_what); diff --git a/editor/plugins/tiles/tiles_editor_plugin.h b/editor/plugins/tiles/tiles_editor_plugin.h index eeff4da4e9..a22e782b34 100644 --- a/editor/plugins/tiles/tiles_editor_plugin.h +++ b/editor/plugins/tiles/tiles_editor_plugin.h @@ -57,11 +57,11 @@ private: ObjectID tile_map_id; Ref<TileSet> tile_set; - Button *tilemap_editor_button; - TileMapEditor *tilemap_editor; + Button *tilemap_editor_button = nullptr; + TileMapEditor *tilemap_editor = nullptr; - Button *tileset_editor_button; - TileSetEditor *tileset_editor; + Button *tileset_editor_button = nullptr; + TileSetEditor *tileset_editor = nullptr; void _update_editors(); |