Remove most EditorNode constructor parameters and fields

This commit is contained in:
trollodel
2022-01-27 10:36:51 +01:00
parent f5a27ee4fe
commit 05b56f316d
144 changed files with 568 additions and 714 deletions

View File

@ -924,7 +924,7 @@ void GridMapEditor::edit(GridMap *p_gridmap) {
_update_selection_transform();
_update_paste_indicator();
spatial_editor = Object::cast_to<Node3DEditorPlugin>(editor->get_editor_plugin_screen());
spatial_editor = Object::cast_to<Node3DEditorPlugin>(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);

View File

@ -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<InputEvent> &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();
};