summaryrefslogtreecommitdiff
path: root/editor/editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_plugin.cpp')
-rw-r--r--editor/editor_plugin.cpp55
1 files changed, 52 insertions, 3 deletions
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 606fd8ee5e..968be43946 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -171,6 +171,46 @@ void EditorPlugin::set_input_event_forwarding_always_enabled() {
always_input_forwarding_list->add_plugin(this);
}
+Node *EditorPlugin::get_edited_scene_root() {
+ return EditorNode::get_singleton()->get_edited_scene();
+}
+
+Array EditorPlugin::get_opened_scenes_list() const {
+
+ Array ret;
+ Vector<EditorData::EditedScene> scenes = EditorNode::get_singleton()->get_editor_data().get_edited_scenes();
+
+ int scns_amount = scenes.size();
+ for (int idx_scn = 0; idx_scn < scns_amount; idx_scn++) {
+ if (scenes[idx_scn].root == NULL)
+ continue;
+ ret.push_back(scenes[idx_scn].root->get_filename());
+ }
+ return ret;
+}
+
+ScriptEditor *EditorPlugin::get_script_editor() {
+ return ScriptEditor::get_singleton();
+}
+
+void EditorPlugin::notify_scene_changed(const Node *scn_root) {
+ if (scn_root == NULL) return;
+ emit_signal("scene_changed", scn_root);
+}
+
+void EditorPlugin::notify_main_screen_changed(const String &screen_name) {
+
+ if (screen_name == last_main_screen_name)
+ return;
+
+ emit_signal("main_screen_changed", screen_name);
+ last_main_screen_name = screen_name;
+}
+
+void EditorPlugin::notify_scene_closed(const String &scene_filepath) {
+ emit_signal("scene_closed", scene_filepath);
+}
+
Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial *p_spatial) {
//??
if (get_script_instance() && get_script_instance()->has_method("create_spatial_gizmo")) {
@@ -392,13 +432,17 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_undo_redo:UndoRedo"), &EditorPlugin::_get_undo_redo);
ClassDB::bind_method(D_METHOD("get_selection:EditorSelection"), &EditorPlugin::get_selection);
ClassDB::bind_method(D_METHOD("get_editor_settings:EditorSettings"), &EditorPlugin::get_editor_settings);
+ ClassDB::bind_method(D_METHOD("get_script_editor:ScriptEditor"), &EditorPlugin::get_script_editor);
ClassDB::bind_method(D_METHOD("queue_save_layout"), &EditorPlugin::queue_save_layout);
- ClassDB::bind_method(D_METHOD("edit_resource"), &EditorPlugin::edit_resource);
+ ClassDB::bind_method(D_METHOD("edit_resource", "resource:Resource"), &EditorPlugin::edit_resource);
ClassDB::bind_method(D_METHOD("open_scene_from_path", "scene_filepath"), &EditorPlugin::open_scene_from_path);
ClassDB::bind_method(D_METHOD("reload_scene_from_path", "scene_filepath"), &EditorPlugin::reload_scene_from_path);
- ClassDB::bind_method(D_METHOD("add_import_plugin"), &EditorPlugin::add_import_plugin);
- ClassDB::bind_method(D_METHOD("remove_import_plugin"), &EditorPlugin::remove_import_plugin);
+ ClassDB::bind_method(D_METHOD("add_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::add_import_plugin);
+ ClassDB::bind_method(D_METHOD("remove_import_plugin", "importer:EditorImportPlugin"), &EditorPlugin::remove_import_plugin);
ClassDB::bind_method(D_METHOD("set_input_event_forwarding_always_enabled"), &EditorPlugin::set_input_event_forwarding_always_enabled);
+ ClassDB::bind_method(D_METHOD("get_opened_scenes_list"), &EditorPlugin::get_opened_scenes_list);
+ ClassDB::bind_method(D_METHOD("get_edited_scene_root:Node"), &EditorPlugin::get_edited_scene_root);
+
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_draw_over_canvas", PropertyInfo(Variant::TRANSFORM2D, "canvas_xform"), PropertyInfo(Variant::OBJECT, "canvas:Control")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
@@ -420,6 +464,10 @@ void EditorPlugin::_bind_methods() {
ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo("get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile")));
+ ADD_SIGNAL(MethodInfo("scene_changed", PropertyInfo(Variant::OBJECT, "scene_root:Node")));
+ ADD_SIGNAL(MethodInfo("scene_closed", PropertyInfo(Variant::STRING, "filepath:String")));
+ ADD_SIGNAL(MethodInfo("main_screen_changed", PropertyInfo(Variant::STRING, "screen_name:String")));
+
BIND_CONSTANT(CONTAINER_TOOLBAR);
BIND_CONSTANT(CONTAINER_SPATIAL_EDITOR_MENU);
BIND_CONSTANT(CONTAINER_SPATIAL_EDITOR_SIDE);
@@ -442,6 +490,7 @@ void EditorPlugin::_bind_methods() {
EditorPlugin::EditorPlugin() {
undo_redo = NULL;
input_event_forwarding_always_enabled = false;
+ last_main_screen_name = "";
}
EditorPlugin::~EditorPlugin() {