You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Remove the EditorNode parameter from EditorPlugins create methods
Remove EditorNode usage from the Navigation editor plugin.
This commit is contained in:
@@ -7033,7 +7033,7 @@ EditorNode::EditorNode() {
|
|||||||
add_editor_plugin(memnew(ControlEditorPlugin));
|
add_editor_plugin(memnew(ControlEditorPlugin));
|
||||||
|
|
||||||
for (int i = 0; i < EditorPlugins::get_plugin_count(); i++) {
|
for (int i = 0; i < EditorPlugins::get_plugin_count(); i++) {
|
||||||
add_editor_plugin(EditorPlugins::create(i, this));
|
add_editor_plugin(EditorPlugins::create(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < plugin_init_callback_count; i++) {
|
for (int i = 0; i < plugin_init_callback_count; i++) {
|
||||||
|
|||||||
@@ -43,7 +43,6 @@
|
|||||||
#include "scene/main/node.h"
|
#include "scene/main/node.h"
|
||||||
#include "scene/resources/texture.h"
|
#include "scene/resources/texture.h"
|
||||||
|
|
||||||
class EditorNode;
|
|
||||||
class Node3D;
|
class Node3D;
|
||||||
class Camera3D;
|
class Camera3D;
|
||||||
class EditorCommandPalette;
|
class EditorCommandPalette;
|
||||||
@@ -312,7 +311,7 @@ public:
|
|||||||
VARIANT_ENUM_CAST(EditorPlugin::CustomControlContainer);
|
VARIANT_ENUM_CAST(EditorPlugin::CustomControlContainer);
|
||||||
VARIANT_ENUM_CAST(EditorPlugin::DockSlot);
|
VARIANT_ENUM_CAST(EditorPlugin::DockSlot);
|
||||||
|
|
||||||
typedef EditorPlugin *(*EditorPluginCreateFunc)(EditorNode *);
|
typedef EditorPlugin *(*EditorPluginCreateFunc)();
|
||||||
|
|
||||||
class EditorPlugins {
|
class EditorPlugins {
|
||||||
enum {
|
enum {
|
||||||
@@ -323,15 +322,15 @@ class EditorPlugins {
|
|||||||
static int creation_func_count;
|
static int creation_func_count;
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static EditorPlugin *creator(EditorNode *p_node) {
|
static EditorPlugin *creator() {
|
||||||
return memnew(T(p_node));
|
return memnew(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int get_plugin_count() { return creation_func_count; }
|
static int get_plugin_count() { return creation_func_count; }
|
||||||
static EditorPlugin *create(int p_idx, EditorNode *p_editor) {
|
static EditorPlugin *create(int p_idx) {
|
||||||
ERR_FAIL_INDEX_V(p_idx, creation_func_count, nullptr);
|
ERR_FAIL_INDEX_V(p_idx, creation_func_count, nullptr);
|
||||||
return creation_funcs[p_idx](p_editor);
|
return creation_funcs[p_idx]();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ void CSGShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorPluginCSG::EditorPluginCSG(EditorNode *_p_editor) {
|
EditorPluginCSG::EditorPluginCSG() {
|
||||||
Ref<CSGShape3DGizmoPlugin> gizmo_plugin = Ref<CSGShape3DGizmoPlugin>(memnew(CSGShape3DGizmoPlugin));
|
Ref<CSGShape3DGizmoPlugin> gizmo_plugin = Ref<CSGShape3DGizmoPlugin>(memnew(CSGShape3DGizmoPlugin));
|
||||||
Node3DEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin);
|
Node3DEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class EditorPluginCSG : public EditorPlugin {
|
|||||||
GDCLASS(EditorPluginCSG, EditorPlugin);
|
GDCLASS(EditorPluginCSG, EditorPlugin);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EditorPluginCSG(EditorNode *_p_editor);
|
EditorPluginCSG();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CSG_GIZMOS_H
|
#endif // CSG_GIZMOS_H
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ bool SceneExporterGLTFPlugin::has_main_screen() const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneExporterGLTFPlugin::SceneExporterGLTFPlugin(EditorNode *_p_node) {
|
SceneExporterGLTFPlugin::SceneExporterGLTFPlugin() {
|
||||||
file_export_lib = memnew(EditorFileDialog);
|
file_export_lib = memnew(EditorFileDialog);
|
||||||
EditorNode::get_singleton()->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->connect("file_selected", callable_mp(this, &SceneExporterGLTFPlugin::_gltf2_dialog_action));
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class SceneExporterGLTFPlugin : public EditorPlugin {
|
|||||||
public:
|
public:
|
||||||
virtual String get_name() const override;
|
virtual String get_name() const override;
|
||||||
bool has_main_screen() const override;
|
bool has_main_screen() const override;
|
||||||
SceneExporterGLTFPlugin(EditorNode *_p_node);
|
SceneExporterGLTFPlugin();
|
||||||
};
|
};
|
||||||
#endif // TOOLS_ENABLED
|
#endif // TOOLS_ENABLED
|
||||||
#endif // EDITOR_SCENE_EXPORTER_GLTF_PLUGIN_H
|
#endif // EDITOR_SCENE_EXPORTER_GLTF_PLUGIN_H
|
||||||
|
|||||||
@@ -1489,7 +1489,7 @@ void GridMapEditorPlugin::make_visible(bool p_visible) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GridMapEditorPlugin::GridMapEditorPlugin(EditorNode *_p_node) {
|
GridMapEditorPlugin::GridMapEditorPlugin() {
|
||||||
EDITOR_DEF("editors/grid_map/editor_side", 1);
|
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"));
|
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/grid_map/editor_side", PROPERTY_HINT_ENUM, "Left,Right"));
|
||||||
|
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ public:
|
|||||||
virtual bool handles(Object *p_object) const override;
|
virtual bool handles(Object *p_object) const override;
|
||||||
virtual void make_visible(bool p_visible) override;
|
virtual void make_visible(bool p_visible) override;
|
||||||
|
|
||||||
GridMapEditorPlugin(EditorNode *_p_node);
|
GridMapEditorPlugin();
|
||||||
~GridMapEditorPlugin();
|
~GridMapEditorPlugin();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -140,10 +140,9 @@ void NavigationMeshEditorPlugin::make_visible(bool p_visible) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationMeshEditorPlugin::NavigationMeshEditorPlugin(EditorNode *p_node) {
|
NavigationMeshEditorPlugin::NavigationMeshEditorPlugin() {
|
||||||
editor = p_node;
|
|
||||||
navigation_mesh_editor = memnew(NavigationMeshEditor);
|
navigation_mesh_editor = memnew(NavigationMeshEditor);
|
||||||
editor->get_main_control()->add_child(navigation_mesh_editor);
|
EditorNode::get_singleton()->get_main_control()->add_child(navigation_mesh_editor);
|
||||||
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, navigation_mesh_editor->bake_hbox);
|
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, navigation_mesh_editor->bake_hbox);
|
||||||
navigation_mesh_editor->hide();
|
navigation_mesh_editor->hide();
|
||||||
navigation_mesh_editor->bake_hbox->hide();
|
navigation_mesh_editor->bake_hbox->hide();
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
#include "editor/editor_plugin.h"
|
#include "editor/editor_plugin.h"
|
||||||
|
|
||||||
class EditorNode;
|
|
||||||
class NavigationRegion3D;
|
class NavigationRegion3D;
|
||||||
|
|
||||||
class NavigationMeshEditor : public Control {
|
class NavigationMeshEditor : public Control {
|
||||||
@@ -70,7 +69,6 @@ class NavigationMeshEditorPlugin : public EditorPlugin {
|
|||||||
GDCLASS(NavigationMeshEditorPlugin, EditorPlugin);
|
GDCLASS(NavigationMeshEditorPlugin, EditorPlugin);
|
||||||
|
|
||||||
NavigationMeshEditor *navigation_mesh_editor;
|
NavigationMeshEditor *navigation_mesh_editor;
|
||||||
EditorNode *editor;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual String get_name() const override { return "NavigationMesh"; }
|
virtual String get_name() const override { return "NavigationMesh"; }
|
||||||
@@ -79,7 +77,7 @@ public:
|
|||||||
virtual bool handles(Object *p_object) const override;
|
virtual bool handles(Object *p_object) const override;
|
||||||
virtual void make_visible(bool p_visible) override;
|
virtual void make_visible(bool p_visible) override;
|
||||||
|
|
||||||
NavigationMeshEditorPlugin(EditorNode *p_node);
|
NavigationMeshEditorPlugin();
|
||||||
~NavigationMeshEditorPlugin();
|
~NavigationMeshEditorPlugin();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user