Skip to content

Commit 97e5d8c

Browse files
committed
Add EditorInterface methods to open Project Settings and Export Dialog
1 parent ccf414e commit 97e5d8c

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

editor/editor_interface.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include "editor/settings/editor_command_palette.h"
5353
#include "editor/settings/editor_feature_profile.h"
5454
#include "editor/settings/editor_settings.h"
55+
#include "editor/settings/project_settings_editor.h"
5556
#include "editor/themes/editor_scale.h"
5657
#include "main/main.h"
5758
#include "scene/3d/light_3d.h"
@@ -105,6 +106,17 @@ EditorUndoRedoManager *EditorInterface::get_editor_undo_redo() const {
105106
return EditorUndoRedoManager::get_singleton();
106107
}
107108

109+
void EditorInterface::open_project_settings(const String &p_general_page, const String &p_filter) {
110+
ProjectSettingsEditor *project_settings = EditorNode::get_singleton()->get_project_settings();
111+
project_settings->set_general_page(p_general_page);
112+
project_settings->set_filter(p_filter);
113+
project_settings->popup_project_settings(false);
114+
}
115+
116+
void EditorInterface::open_export_dialog() {
117+
EditorNode::get_singleton()->open_export_dialog();
118+
}
119+
108120
AABB EditorInterface::_calculate_aabb_for_scene(Node *p_node, AABB &p_scene_aabb) {
109121
MeshInstance3D *mesh_node = Object::cast_to<MeshInstance3D>(p_node);
110122
if (mesh_node && mesh_node->get_mesh().is_valid()) {
@@ -830,6 +842,9 @@ void EditorInterface::_bind_methods() {
830842
ClassDB::bind_method(D_METHOD("get_editor_toaster"), &EditorInterface::get_editor_toaster);
831843
ClassDB::bind_method(D_METHOD("get_editor_undo_redo"), &EditorInterface::get_editor_undo_redo);
832844

845+
ClassDB::bind_method(D_METHOD("open_project_settings", "general_page", "filter"), &EditorInterface::open_project_settings);
846+
ClassDB::bind_method(D_METHOD("open_export_dialog"), &EditorInterface::open_export_dialog);
847+
833848
ClassDB::bind_method(D_METHOD("make_mesh_previews", "meshes", "preview_size"), &EditorInterface::_make_mesh_previews);
834849

835850
ClassDB::bind_method(D_METHOD("set_plugin_enabled", "plugin", "enabled"), &EditorInterface::set_plugin_enabled);

editor/editor_interface.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ class EditorInterface : public Object {
109109
EditorToaster *get_editor_toaster() const;
110110
EditorUndoRedoManager *get_editor_undo_redo() const;
111111

112+
void open_project_settings(const String &p_general_page, const String &p_filter);
113+
void open_export_dialog();
114+
112115
Vector<Ref<Texture2D>> make_mesh_previews(const Vector<Ref<Mesh>> &p_meshes, Vector<Transform3D> *p_transforms, int p_preview_size);
113116
void make_scene_preview(const String &p_path, Node *p_scene, int p_preview_size);
114117

editor/editor_node.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7432,6 +7432,10 @@ bool EditorNode::is_editor_dimmed() const {
74327432
return dimmed;
74337433
}
74347434

7435+
void EditorNode::open_export_dialog() {
7436+
project_export->popup_export();
7437+
}
7438+
74357439
void EditorNode::open_export_template_manager() {
74367440
export_template_manager->popup_manager();
74377441
}

editor/editor_node.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,7 @@ class EditorNode : public Node {
982982
void save_editor_layout_delayed();
983983
void save_default_environment();
984984

985+
void open_export_dialog();
985986
void open_export_template_manager();
986987

987988
void reload_scene(const String &p_path);

0 commit comments

Comments
 (0)