From 05b56f316ddc94c2bb55b62477ec3914fe81a220 Mon Sep 17 00:00:00 2001 From: trollodel <33117082+trollodel@users.noreply.github.com> Date: Thu, 27 Jan 2022 10:36:51 +0100 Subject: Remove most EditorNode constructor parameters and fields --- modules/gridmap/grid_map_editor_plugin.cpp | 13 +++++-------- modules/gridmap/grid_map_editor_plugin.h | 8 ++------ 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'modules/gridmap') diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 5c0b45865d..d1ca84fa6b 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -924,7 +924,7 @@ void GridMapEditor::edit(GridMap *p_gridmap) { _update_selection_transform(); _update_paste_indicator(); - spatial_editor = Object::cast_to(editor->get_editor_plugin_screen()); + spatial_editor = Object::cast_to(EditorNode::get_singleton()->get_editor_plugin_screen()); if (!node) { set_process(false); @@ -1160,9 +1160,8 @@ void GridMapEditor::_bind_methods() { ClassDB::bind_method("_set_selection", &GridMapEditor::_set_selection); } -GridMapEditor::GridMapEditor(EditorNode *p_editor) { - editor = p_editor; - undo_redo = p_editor->get_undo_redo(); +GridMapEditor::GridMapEditor() { + undo_redo = EditorNode::get_singleton()->get_undo_redo(); int mw = EDITOR_DEF("editors/grid_map/palette_min_width", 230); Control *ec = memnew(Control); @@ -1490,13 +1489,11 @@ void GridMapEditorPlugin::make_visible(bool p_visible) { } } -GridMapEditorPlugin::GridMapEditorPlugin(EditorNode *p_node) { - editor = p_node; - +GridMapEditorPlugin::GridMapEditorPlugin(EditorNode *_p_node) { EDITOR_DEF("editors/grid_map/editor_side", 1); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/grid_map/editor_side", PROPERTY_HINT_ENUM, "Left,Right")); - grid_map_editor = memnew(GridMapEditor(editor)); + grid_map_editor = memnew(GridMapEditor); switch ((int)EditorSettings::get_singleton()->get("editors/grid_map/editor_side")) { case 0: { // Left. Node3DEditor::get_singleton()->add_control_to_left_panel(grid_map_editor); diff --git a/modules/gridmap/grid_map_editor_plugin.h b/modules/gridmap/grid_map_editor_plugin.h index 3b54138e36..4a0ebdc237 100644 --- a/modules/gridmap/grid_map_editor_plugin.h +++ b/modules/gridmap/grid_map_editor_plugin.h @@ -192,8 +192,6 @@ class GridMapEditor : public VBoxContainer { ItemList *mesh_library_palette; Label *info_message; - EditorNode *editor; - void update_grid(); // Change which and where the grid is displayed void _draw_grids(const Vector3 &cell_size); void _configure(); @@ -239,8 +237,7 @@ public: EditorPlugin::AfterGUIInput forward_spatial_input_event(Camera3D *p_camera, const Ref &p_event); void edit(GridMap *p_gridmap); - GridMapEditor() {} - GridMapEditor(EditorNode *p_editor); + GridMapEditor(); ~GridMapEditor(); }; @@ -248,7 +245,6 @@ class GridMapEditorPlugin : public EditorPlugin { GDCLASS(GridMapEditorPlugin, EditorPlugin); GridMapEditor *grid_map_editor; - EditorNode *editor; protected: void _notification(int p_what); @@ -261,7 +257,7 @@ public: virtual bool handles(Object *p_object) const override; virtual void make_visible(bool p_visible) override; - GridMapEditorPlugin(EditorNode *p_node); + GridMapEditorPlugin(EditorNode *_p_node); ~GridMapEditorPlugin(); }; -- cgit v1.2.3