summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authortrollodel <33117082+trollodel@users.noreply.github.com>2022-01-27 10:36:51 +0100
committertrollodel <33117082+trollodel@users.noreply.github.com>2022-02-14 14:16:24 +0100
commit05b56f316ddc94c2bb55b62477ec3914fe81a220 (patch)
tree928404930fc4f99dfb45d64a6b510e66e2bcc357 /modules
parentf5a27ee4fe45925cebfda11ea7d53ca8f39e0a13 (diff)
Remove most EditorNode constructor parameters and fields
Diffstat (limited to 'modules')
-rw-r--r--modules/csg/csg_gizmos.cpp2
-rw-r--r--modules/csg/csg_gizmos.h2
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.cpp4
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.h3
-rw-r--r--modules/gdnative/register_types.cpp2
-rw-r--r--modules/gltf/editor_scene_exporter_gltf_plugin.cpp13
-rw-r--r--modules/gltf/editor_scene_exporter_gltf_plugin.h3
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp13
-rw-r--r--modules/gridmap/grid_map_editor_plugin.h8
9 files changed, 20 insertions, 30 deletions
diff --git a/modules/csg/csg_gizmos.cpp b/modules/csg/csg_gizmos.cpp
index 076978c4fb..6ad2274a53 100644
--- a/modules/csg/csg_gizmos.cpp
+++ b/modules/csg/csg_gizmos.cpp
@@ -421,7 +421,7 @@ void CSGShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
}
}
-EditorPluginCSG::EditorPluginCSG(EditorNode *p_editor) {
+EditorPluginCSG::EditorPluginCSG(EditorNode *_p_editor) {
Ref<CSGShape3DGizmoPlugin> gizmo_plugin = Ref<CSGShape3DGizmoPlugin>(memnew(CSGShape3DGizmoPlugin));
Node3DEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin);
}
diff --git a/modules/csg/csg_gizmos.h b/modules/csg/csg_gizmos.h
index 46761370dd..f3c851d06b 100644
--- a/modules/csg/csg_gizmos.h
+++ b/modules/csg/csg_gizmos.h
@@ -57,7 +57,7 @@ class EditorPluginCSG : public EditorPlugin {
GDCLASS(EditorPluginCSG, EditorPlugin);
public:
- EditorPluginCSG(EditorNode *p_editor);
+ EditorPluginCSG(EditorNode *_p_editor);
};
#endif // CSG_GIZMOS_H
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp
index 868e1b878c..2440ef392e 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.cpp
+++ b/modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -408,10 +408,10 @@ void GDNativeLibraryEditorPlugin::make_visible(bool p_visible) {
}
}
-GDNativeLibraryEditorPlugin::GDNativeLibraryEditorPlugin(EditorNode *p_node) {
+GDNativeLibraryEditorPlugin::GDNativeLibraryEditorPlugin() {
library_editor = memnew(GDNativeLibraryEditor);
library_editor->set_custom_minimum_size(Size2(0, 250 * EDSCALE));
- button = p_node->add_bottom_panel_item(TTR("GDNativeLibrary"), library_editor);
+ button = EditorNode::get_singleton()->add_bottom_panel_item(TTR("GDNativeLibrary"), library_editor);
button->hide();
}
diff --git a/modules/gdnative/gdnative_library_editor_plugin.h b/modules/gdnative/gdnative_library_editor_plugin.h
index 8d007d207c..2e4b483ea7 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.h
+++ b/modules/gdnative/gdnative_library_editor_plugin.h
@@ -103,7 +103,6 @@ class GDNativeLibraryEditorPlugin : public EditorPlugin {
GDCLASS(GDNativeLibraryEditorPlugin, EditorPlugin);
GDNativeLibraryEditor *library_editor = nullptr;
- EditorNode *editor = nullptr;
Button *button = nullptr;
public:
@@ -113,7 +112,7 @@ public:
virtual bool handles(Object *p_node) const override;
virtual void make_visible(bool p_visible) override;
- GDNativeLibraryEditorPlugin(EditorNode *p_node);
+ GDNativeLibraryEditorPlugin();
};
#endif
#endif // GDNATIVE_LIBRARY_EDITOR_PLUGIN_H
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index fb682beccc..1121fd0e03 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -226,7 +226,7 @@ static void editor_init_callback() {
EditorExport::get_singleton()->add_export_plugin(export_plugin);
- EditorNode::get_singleton()->add_editor_plugin(memnew(GDNativeLibraryEditorPlugin(EditorNode::get_singleton())));
+ EditorNode::get_singleton()->add_editor_plugin(memnew(GDNativeLibraryEditorPlugin));
}
#endif
diff --git a/modules/gltf/editor_scene_exporter_gltf_plugin.cpp b/modules/gltf/editor_scene_exporter_gltf_plugin.cpp
index 9cae1cd87a..f9bfde5597 100644
--- a/modules/gltf/editor_scene_exporter_gltf_plugin.cpp
+++ b/modules/gltf/editor_scene_exporter_gltf_plugin.cpp
@@ -53,10 +53,9 @@ bool SceneExporterGLTFPlugin::has_main_screen() const {
return false;
}
-SceneExporterGLTFPlugin::SceneExporterGLTFPlugin(EditorNode *p_node) {
- editor = p_node;
+SceneExporterGLTFPlugin::SceneExporterGLTFPlugin(EditorNode *_p_node) {
file_export_lib = memnew(EditorFileDialog);
- editor->get_gui_base()->add_child(file_export_lib);
+ EditorNode::get_singleton()->get_gui_base()->add_child(file_export_lib);
file_export_lib->connect("file_selected", callable_mp(this, &SceneExporterGLTFPlugin::_gltf2_dialog_action));
file_export_lib->set_title(TTR("Export Library"));
file_export_lib->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
@@ -70,9 +69,9 @@ SceneExporterGLTFPlugin::SceneExporterGLTFPlugin(EditorNode *p_node) {
}
void SceneExporterGLTFPlugin::_gltf2_dialog_action(String p_file) {
- Node *root = editor->get_tree()->get_edited_scene_root();
+ Node *root = EditorNode::get_singleton()->get_tree()->get_edited_scene_root();
if (!root) {
- editor->show_accept(TTR("This operation can't be done without a scene."), TTR("OK"));
+ EditorNode::get_singleton()->show_accept(TTR("This operation can't be done without a scene."), TTR("OK"));
return;
}
List<String> deps;
@@ -93,9 +92,9 @@ void SceneExporterGLTFPlugin::_gltf2_dialog_action(String p_file) {
}
void SceneExporterGLTFPlugin::convert_scene_to_gltf2() {
- Node *root = editor->get_tree()->get_edited_scene_root();
+ Node *root = EditorNode::get_singleton()->get_tree()->get_edited_scene_root();
if (!root) {
- editor->show_accept(TTR("This operation can't be done without a scene."), TTR("OK"));
+ EditorNode::get_singleton()->show_accept(TTR("This operation can't be done without a scene."), TTR("OK"));
return;
}
String filename = String(root->get_scene_file_path().get_file().get_basename());
diff --git a/modules/gltf/editor_scene_exporter_gltf_plugin.h b/modules/gltf/editor_scene_exporter_gltf_plugin.h
index 99d8911f46..50febd45c9 100644
--- a/modules/gltf/editor_scene_exporter_gltf_plugin.h
+++ b/modules/gltf/editor_scene_exporter_gltf_plugin.h
@@ -38,7 +38,6 @@
class SceneExporterGLTFPlugin : public EditorPlugin {
GDCLASS(SceneExporterGLTFPlugin, EditorPlugin);
- EditorNode *editor = nullptr;
EditorFileDialog *file_export_lib = nullptr;
void _gltf2_dialog_action(String p_file);
void convert_scene_to_gltf2();
@@ -46,7 +45,7 @@ class SceneExporterGLTFPlugin : public EditorPlugin {
public:
virtual String get_name() const override;
bool has_main_screen() const override;
- SceneExporterGLTFPlugin(class EditorNode *p_node);
+ SceneExporterGLTFPlugin(EditorNode *_p_node);
};
#endif // TOOLS_ENABLED
#endif // EDITOR_SCENE_EXPORTER_GLTF_PLUGIN_H
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<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);
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<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();
};