summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp1383
1 files changed, 789 insertions, 594 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 18c16af5af..242648d4a9 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -6,6 +6,7 @@
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -37,7 +38,6 @@
#include "editor_help.h"
#include "editor_settings.h"
#include "editor_themes.h"
-#include "global_config.h"
#include "io/config_file.h"
#include "io/stream_peer_ssl.h"
#include "io/zip_io.h"
@@ -49,6 +49,7 @@
#include "os/os.h"
#include "path_remap.h"
#include "print_string.h"
+#include "project_settings.h"
#include "pvrtc_compress.h"
#include "register_exporters.h"
#include "scene/resources/packed_scene.h"
@@ -71,9 +72,10 @@
#include "plugins/collision_polygon_2d_editor_plugin.h"
#include "plugins/collision_polygon_editor_plugin.h"
#include "plugins/collision_shape_2d_editor_plugin.h"
-#include "plugins/color_ramp_editor_plugin.h"
#include "plugins/cube_grid_theme_editor_plugin.h"
+#include "plugins/curve_editor_plugin.h"
#include "plugins/gi_probe_editor_plugin.h"
+#include "plugins/gradient_editor_plugin.h"
#include "plugins/item_list_editor_plugin.h"
#include "plugins/light_occluder_2d_editor_plugin.h"
#include "plugins/line_2d_editor_plugin.h"
@@ -108,6 +110,7 @@
// end
#include "editor_settings.h"
#include "import/editor_import_collada.h"
+#include "import/editor_scene_importer_gltf.h"
#include "io_plugins/editor_bitmask_import_plugin.h"
#include "io_plugins/editor_export_scene.h"
#include "io_plugins/editor_font_import_plugin.h"
@@ -159,7 +162,7 @@ void EditorNode::_update_scene_tabs() {
void EditorNode::_update_title() {
- String appname = GlobalConfig::get_singleton()->get("application/name");
+ String appname = ProjectSettings::get_singleton()->get("application/config/name");
String title = appname.empty() ? String(VERSION_FULL_NAME) : String(_MKSTR(VERSION_NAME) + String(" - ") + appname);
String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String();
if (!edited.empty())
@@ -170,12 +173,13 @@ void EditorNode::_update_title() {
OS::get_singleton()->set_window_title(title);
}
-void EditorNode::_unhandled_input(const InputEvent &p_event) {
+void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) {
if (Node::get_viewport()->get_modal_stack_top())
return; //ignore because of modal window
- if (p_event.type == InputEvent::KEY && p_event.key.pressed && !p_event.key.echo && !gui_base->get_viewport()->gui_has_modal_stack()) {
+ Ref<InputEventKey> k = p_event;
+ if (k.is_valid() && k->is_pressed() && !k->is_echo() && !gui_base->get_viewport()->gui_has_modal_stack()) {
if (ED_IS_SHORTCUT("editor/next_tab", p_event)) {
int next_tab = editor_data.get_edited_scene() + 1;
@@ -191,28 +195,20 @@ void EditorNode::_unhandled_input(const InputEvent &p_event) {
filesystem_dock->focus_on_filter();
}
- switch (p_event.key.scancode) {
-
- /*case KEY_F1:
- if (!p_event.key.mod.shift && !p_event.key.mod.command)
- _editor_select(EDITOR_SCRIPT);
- break;*/
- case KEY_F1:
- if (!p_event.key.mod.shift && !p_event.key.mod.command)
- _editor_select(EDITOR_2D);
- break;
- case KEY_F2:
- if (!p_event.key.mod.shift && !p_event.key.mod.command)
- _editor_select(EDITOR_3D);
- break;
- case KEY_F3:
- if (!p_event.key.mod.shift && !p_event.key.mod.command)
- _editor_select(EDITOR_SCRIPT);
- break;
- /* case KEY_F5: _menu_option_confirm((p_event.key.mod.control&&p_event.key.mod.shift)?RUN_PLAY_CUSTOM_SCENE:RUN_PLAY,true); break;
- case KEY_F6: _menu_option_confirm(RUN_PLAY_SCENE,true); break;
- //case KEY_F7: _menu_option_confirm(RUN_PAUSE,true); break;
- case KEY_F8: _menu_option_confirm(RUN_STOP,true); break;*/
+ if (ED_IS_SHORTCUT("editor/editor_2d", p_event)) {
+ _editor_select(EDITOR_2D);
+ } else if (ED_IS_SHORTCUT("editor/editor_3d", p_event)) {
+ _editor_select(EDITOR_3D);
+ } else if (ED_IS_SHORTCUT("editor/editor_script", p_event)) {
+ _editor_select(EDITOR_SCRIPT);
+ } else if (ED_IS_SHORTCUT("editor/editor_help", p_event)) {
+ emit_signal("request_help_search", "");
+ } else if (ED_IS_SHORTCUT("editor/editor_assetlib", p_event)) {
+ _editor_select(EDITOR_ASSETLIB);
+ } else if (ED_IS_SHORTCUT("editor/editor_next", p_event)) {
+ _editor_select_next();
+ } else if (ED_IS_SHORTCUT("editor/editor_prev", p_event)) {
+ _editor_select_prev();
}
}
}
@@ -233,7 +229,7 @@ void EditorNode::_notification(int p_what) {
Rect2 grect = scene_root_base->get_global_rect();
Rect2 grectsrp = scene_root_parent->get_global_rect();
if (grect!=grectsrp) {
- scene_root_parent->set_pos(grect.pos);
+ scene_root_parent->set_position(grect.pos);
scene_root_parent->set_size(grect.size);
}
}
@@ -273,28 +269,9 @@ void EditorNode::_notification(int p_what) {
update_menu->set_icon(gui_base->get_icon("Progress" + itos(circle_step + 1), "EditorIcons"));
}
}
-
editor_selection->update();
- {
- uint32_t p32 = 0; //AudioServer::get_singleton()->read_output_peak()>>8;
-
- float peak = p32 == 0 ? -80 : Math::linear2db(p32 / 65535.0);
-
- if (peak < -80)
- peak = -80;
- float vu = audio_vu->get_value();
-
- if (peak > vu) {
- audio_vu->set_value(peak);
- } else {
- float new_vu = vu - get_process_delta_time() * 70.0;
- if (new_vu < -80)
- new_vu = -80;
- if (new_vu != -80 && vu != -80)
- audio_vu->set_value(new_vu);
- }
- }
+ scene_root->set_size_override(true, Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height")));
ResourceImporterTexture::get_singleton()->update_imports();
}
@@ -353,10 +330,25 @@ void EditorNode::_notification(int p_what) {
if (p_what == MainLoop::NOTIFICATION_WM_QUIT_REQUEST) {
_menu_option_confirm(FILE_QUIT, false);
- };
+ }
if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
+ property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true)));
+ Ref<Theme> theme = create_editor_theme();
+ theme_base->set_theme(theme);
+ gui_base->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles"));
+ play_button_panel->add_style_override("panel", gui_base->get_stylebox("PlayButtonPanel", "EditorStyles"));
+ scene_root_parent->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles"));
+ bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer"));
+ scene_tabs->add_style_override("tab_fg", gui_base->get_stylebox("SceneTabFG", "EditorStyles"));
+ scene_tabs->add_style_override("tab_bg", gui_base->get_stylebox("SceneTabBG", "EditorStyles"));
+ if (bool(EDITOR_DEF("interface/scene_tabs/resize_if_many_tabs", true))) {
+ scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE);
+ } else {
+ scene_tabs->set_min_width(0);
+ }
+ _update_scene_tabs();
}
}
@@ -372,10 +364,28 @@ void EditorNode::_fs_changed() {
E->get()->invalidate();
}
- if (export_defer.platform != "") {
+ if (export_defer.preset != "") {
+ Ref<EditorExportPreset> preset;
+ for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) {
+ preset = EditorExport::get_singleton()->get_export_preset(i);
+ if (preset->get_name() == export_defer.preset) {
+ break;
+ }
+ }
+ if (preset.is_null()) {
+ String err = "Unknown export preset: " + export_defer.preset;
+ ERR_PRINT(err.utf8().get_data());
+ } else {
+ Ref<EditorExportPlatform> platform = preset->get_platform();
+ if (platform.is_null()) {
+ String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform.";
+ ERR_PRINT(err.utf8().get_data());
+ } else {
+ platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0);
+ }
+ }
- //project_export_settings->export_platform(export_defer.platform,export_defer.path,export_defer.debug,export_defer.password,true);
- export_defer.platform = "";
+ export_defer.preset = "";
}
{
@@ -424,6 +434,8 @@ void EditorNode::_fs_changed() {
}
}
}
+
+ _mark_unsaved_scenes();
}
void EditorNode::_sources_changed(bool p_exist) {
@@ -432,7 +444,7 @@ void EditorNode::_sources_changed(bool p_exist) {
if (defer_load_scene != "") {
- print_line("loading scene DEFERED");
+ print_line("loading scene DEFERRED");
load_scene(defer_load_scene);
defer_load_scene = "";
}
@@ -444,24 +456,36 @@ void EditorNode::_sources_changed(bool p_exist) {
void EditorNode::_vp_resized() {
}
-void EditorNode::_rebuild_import_menu() {
- PopupMenu *p = import_menu->get_popup();
- p->clear();
-//p->add_item(TTR("Node From Scene"), FILE_IMPORT_SUBSCENE);
-//p->add_separator();
-#if 0
- for (int i = 0; i < editor_import_export->get_import_plugin_count(); i++) {
- p->add_item(editor_import_export->get_import_plugin(i)->get_visible_name(), IMPORT_PLUGIN_BASE + i);
- }
-#endif
-}
-
void EditorNode::_node_renamed() {
if (property_editor)
property_editor->update_tree();
}
+void EditorNode::_editor_select_next() {
+
+ int editor = _get_current_main_editor();
+
+ if (editor == editor_table.size() - 1) {
+ editor = 0;
+ } else {
+ editor++;
+ }
+ _editor_select(editor);
+}
+
+void EditorNode::_editor_select_prev() {
+
+ int editor = _get_current_main_editor();
+
+ if (editor == 0) {
+ editor = editor_table.size() - 1;
+ } else {
+ editor--;
+ }
+ _editor_select(editor);
+}
+
Error EditorNode::load_resource(const String &p_scene) {
RES res = ResourceLoader::load(p_scene);
@@ -512,7 +536,7 @@ void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const St
flg|=ResourceSaver::FLAG_RELATIVE_PATHS;
*/
- String path = GlobalConfig::get_singleton()->localize_path(p_path);
+ String path = ProjectSettings::get_singleton()->localize_path(p_path);
Error err = ResourceSaver::save(path, p_resource, flg | ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS);
if (err != OK) {
@@ -695,34 +719,34 @@ void EditorNode::_set_scene_metadata(const String &p_file, int p_idx) {
ERR_FAIL_COND(err != OK);
}
-bool EditorNode::_find_and_save_resource(RES res, Map<RES, bool> &processed, int32_t flags) {
+bool EditorNode::_find_and_save_resource(RES p_res, Map<RES, bool> &processed, int32_t flags) {
- if (res.is_null())
+ if (p_res.is_null())
return false;
- if (processed.has(res)) {
+ if (processed.has(p_res)) {
- return processed[res];
+ return processed[p_res];
}
- bool changed = res->is_edited();
- res->set_edited(false);
+ bool changed = p_res->is_edited();
+ p_res->set_edited(false);
- bool subchanged = _find_and_save_edited_subresources(res.ptr(), processed, flags);
+ bool subchanged = _find_and_save_edited_subresources(p_res.ptr(), processed, flags);
- //print_line("checking if edited: "+res->get_type()+" :: "+res->get_name()+" :: "+res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged));
+ //print_line("checking if edited: "+p_res->get_type()+" :: "+p_res->get_name()+" :: "+p_res->get_path()+" :: "+itos(changed)+" :: SR "+itos(subchanged));
- if (res->get_path().is_resource_file()) {
+ if (p_res->get_path().is_resource_file()) {
if (changed || subchanged) {
//save
- print_line("Also saving modified external resource: " + res->get_path());
- ResourceSaver::save(res->get_path(), res, flags);
+ print_line("Also saving modified external resource: " + p_res->get_path());
+ ResourceSaver::save(p_res->get_path(), p_res, flags);
}
- processed[res] = false; //because it's a file
+ processed[p_res] = false; //because it's a file
return false;
} else {
- processed[res] = changed;
+ processed[p_res] = changed;
return changed;
}
}
@@ -828,56 +852,54 @@ void EditorNode::_save_scene_with_preview(String p_file) {
}
save.step(TTR("Creating Thumbnail"), 1);
//current view?
- int screen = -1;
- for (int i = 0; i < editor_table.size(); i++) {
- if (editor_plugin_screen == editor_table[i]) {
- screen = i;
- break;
- }
+
+ Ref<Image> img;
+ if (is2d) {
+ img = scene_root->get_texture()->get_data();
+ } else {
+ img = SpatialEditor::get_singleton()->get_editor_viewport(0)->get_viewport_node()->get_texture()->get_data();
}
- _editor_select(is2d ? EDITOR_2D : EDITOR_3D);
+ if (img.is_valid()) {
+ save.step(TTR("Creating Thumbnail"), 2);
+ save.step(TTR("Creating Thumbnail"), 3);
- save.step(TTR("Creating Thumbnail"), 2);
- save.step(TTR("Creating Thumbnail"), 3);
-#if 0
- Image img = VS::get_singleton()->viewport_texture(scree_capture(viewport);
- int preview_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
- preview_size*=EDSCALE;
- int width,height;
- if (img.get_width() > preview_size && img.get_width() >= img.get_height()) {
+ int preview_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
+ preview_size *= EDSCALE;
+ int width, height;
+ if (img->get_width() > preview_size && img->get_width() >= img->get_height()) {
- width=preview_size;
- height = img.get_height() * preview_size / img.get_width();
- } else if (img.get_height() > preview_size && img.get_height() >= img.get_width()) {
+ width = preview_size;
+ height = img->get_height() * preview_size / img->get_width();
+ } else if (img->get_height() > preview_size && img->get_height() >= img->get_width()) {
- height=preview_size;
- width = img.get_width() * preview_size / img.get_height();
- } else {
+ height = preview_size;
+ width = img->get_width() * preview_size / img->get_height();
+ } else {
- width=img.get_width();
- height=img.get_height();
- }
+ width = img->get_width();
+ height = img->get_height();
+ }
- img.convert(Image::FORMAT_RGB8);
- img.resize(width,height);
+ img->convert(Image::FORMAT_RGB8);
+ img->resize(width, height);
+ img->flip_y();
- String pfile = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp/last_scene_preview.png");
- img.save_png(pfile);
- Vector<uint8_t> imgdata = FileAccess::get_file_as_array(pfile);
+ //save thumbnail directly, as thumbnailer may not update due to actual scene not changing md5
+ String temp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp");
+ String cache_base = ProjectSettings::get_singleton()->globalize_path(p_file).md5_text();
+ cache_base = temp_path.plus_file("resthumb-" + cache_base);
- //print_line("img data is "+itos(imgdata.size()));
+ //does not have it, try to load a cached thumbnail
- if (editor_data.get_edited_scene_import_metadata().is_null())
- editor_data.set_edited_scene_import_metadata(Ref<ResourceImportMetadata>( memnew( ResourceImportMetadata ) ) );
- editor_data.get_edited_scene_import_metadata()->set_option("thumbnail",imgdata);
-#endif
- //tamanio tel thumbnail
- if (screen != -1) {
- _editor_select(screen);
+ String file = cache_base + ".png";
+
+ img->save_png(file);
}
+
save.step(TTR("Saving Scene"), 4);
_save_scene(p_file);
+ EditorResourcePreview::get_singleton()->check_for_invalidation(p_file);
}
void EditorNode::_save_scene(String p_file, int idx) {
@@ -895,6 +917,7 @@ void EditorNode::_save_scene(String p_file, int idx) {
}
editor_data.apply_changes_in_editors();
+ _save_default_environment();
_set_scene_metadata(p_file, idx);
@@ -944,7 +967,7 @@ void EditorNode::_save_scene(String p_file, int idx) {
_save_edited_subresources(scene, processed, flg);
editor_data.save_editor_external_data();
if (err == OK) {
- scene->set_filename(GlobalConfig::get_singleton()->localize_path(p_file));
+ scene->set_filename(ProjectSettings::get_singleton()->localize_path(p_file));
//EditorFileSystem::get_singleton()->update_file(p_file,sdata->get_type());
if (idx < 0 || idx == editor_data.get_edited_scene())
set_current_version(editor_data.get_undo_redo().get_version());
@@ -956,7 +979,47 @@ void EditorNode::_save_scene(String p_file, int idx) {
_dialog_display_file_error(p_file, err);
}
-};
+}
+
+void EditorNode::_save_all_scenes() {
+
+ for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
+ Node *scene = editor_data.get_edited_scene_root(i);
+ if (scene && scene->get_filename() != "") {
+ // save in background if in the script editor
+ if (i != editor_data.get_edited_scene() || _get_current_main_editor() == EDITOR_SCRIPT) {
+ _save_scene(scene->get_filename(), i);
+ } else {
+ _save_scene_with_preview(scene->get_filename());
+ }
+ } // else: ignore new scenes
+ }
+
+ _save_default_environment();
+}
+
+void EditorNode::_mark_unsaved_scenes() {
+
+ for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
+
+ Node *node = editor_data.get_edited_scene_root(i);
+ if (!node)
+ continue;
+
+ String path = node->get_filename();
+ if (!(path == String() || FileAccess::exists(path))) {
+
+ node->set_filename("");
+ if (i == editor_data.get_edited_scene())
+ set_current_version(-1);
+ else
+ editor_data.set_edited_scene_version(-1, i);
+ }
+ }
+
+ _update_title();
+ _update_scene_tabs();
+}
void EditorNode::_import_action(const String &p_action) {
#if 0
@@ -983,7 +1046,7 @@ void EditorNode::_import_action(const String &p_action) {
EditorImport::generate_version_hashes(src);
- Node *dst = SceneLoader::load(editor_data.get_imported_scene(GlobalConfig::get_singleton()->localize_path(_tmp_import_path)));
+ Node *dst = SceneLoader::load(editor_data.get_imported_scene(ProjectSettings::get_singleton()->localize_path(_tmp_import_path)));
if (!dst) {
@@ -1086,9 +1149,10 @@ void EditorNode::_dialog_action(String p_file) {
} break;
case SETTINGS_PICK_MAIN_SCENE: {
- GlobalConfig::get_singleton()->set("application/main_scene", p_file);
- GlobalConfig::get_singleton()->save();
- //would be nice to show the project manager opened with the hilighted field..
+ ProjectSettings::get_singleton()->set("application/run/main_scene", p_file);
+ ProjectSettings::get_singleton()->save();
+ //would be nice to show the project manager opened with the highlighted field..
+ _run(false, ""); // automatically run the project
} break;
case FILE_SAVE_OPTIMIZED: {
@@ -1113,13 +1177,26 @@ void EditorNode::_dialog_action(String p_file) {
get_undo_redo()->clear_history();
} break;
+ case FILE_CLOSE:
+ case FILE_CLOSE_ALL_AND_QUIT:
+ case FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER:
+ case SCENE_TAB_CLOSE:
case FILE_SAVE_SCENE:
case FILE_SAVE_AS_SCENE: {
+ int scene_idx = (current_option == FILE_SAVE_SCENE || current_option == FILE_SAVE_AS_SCENE) ? -1 : tab_closing;
+
if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) {
//_save_scene(p_file);
- _save_scene_with_preview(p_file);
+ _save_default_environment();
+ if (scene_idx != editor_data.get_edited_scene() || _get_current_main_editor() == EDITOR_SCRIPT)
+ _save_scene(p_file, scene_idx);
+ else
+ _save_scene_with_preview(p_file);
+
+ if (scene_idx != -1)
+ _discard_changes();
}
} break;
@@ -1128,6 +1205,7 @@ void EditorNode::_dialog_action(String p_file) {
if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) {
//_save_scene(p_file);
+ _save_default_environment();
_save_scene_with_preview(p_file);
_call_build();
_run(true);
@@ -1154,7 +1232,7 @@ void EditorNode::_dialog_action(String p_file) {
ml = Ref<MeshLibrary>(memnew(MeshLibrary));
}
- //MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(),ml,true);
+ MeshLibraryEditor::update_library_file(editor_data.get_edited_scene_root(), ml, true);
Error err = ResourceSaver::save(p_file, ml);
if (err) {
@@ -1225,7 +1303,7 @@ void EditorNode::_dialog_action(String p_file) {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err == ERR_CANT_OPEN) {
config.instance(); // new config
@@ -1236,7 +1314,7 @@ void EditorNode::_dialog_action(String p_file) {
_save_docks_to_config(config, p_file);
- config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
layout_dialog->hide();
_update_layouts_menu();
@@ -1253,7 +1331,7 @@ void EditorNode::_dialog_action(String p_file) {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err != OK || !config->has_section(p_file)) {
show_warning(TTR("Layout name not found!"));
@@ -1267,7 +1345,7 @@ void EditorNode::_dialog_action(String p_file) {
config->set_value(p_file, E->get(), Variant());
}
- config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ config->save(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
layout_dialog->hide();
_update_layouts_menu();
@@ -1298,7 +1376,7 @@ void EditorNode::push_item(Object *p_object, const String &p_property) {
return;
}
- uint32_t id = p_object->get_instance_ID();
+ uint32_t id = p_object->get_instance_id();
if (id != editor_history.get_current()) {
if (p_property == "")
@@ -1381,6 +1459,17 @@ void EditorNode::_property_editor_back() {
_edit_current();
}
+void EditorNode::_save_default_environment() {
+
+ Ref<Environment> fallback = get_tree()->get_root()->get_world()->get_fallback_environment();
+
+ if (fallback.is_valid() && fallback->get_path().is_resource_file()) {
+ Map<RES, bool> processed;
+ _find_and_save_edited_subresources(fallback.ptr(), processed, 0);
+ save_resource_in_path(fallback, fallback->get_path());
+ }
+}
+
void EditorNode::_imported(Node *p_node) {
/*
@@ -1451,7 +1540,7 @@ void EditorNode::_edit_current() {
property_editor->edit(current_res);
node_dock->set_node(NULL);
object_menu->set_disabled(false);
-
+ EditorNode::get_singleton()->get_import_dock()->set_edit_path(current_res->get_path());
//resources_dock->add_resource(Ref<Resource>(current_res));
//top_pallete->set_current_tab(1);
@@ -1459,11 +1548,16 @@ void EditorNode::_edit_current() {
Node *current_node = current_obj->cast_to<Node>();
ERR_FAIL_COND(!current_node);
- ERR_FAIL_COND(!current_node->is_inside_tree());
+ // ERR_FAIL_COND(!current_node->is_inside_tree());
property_editor->edit(current_node);
- node_dock->set_node(current_node);
- scene_tree_dock->set_selected(current_node);
+ if (current_node->is_inside_tree()) {
+ node_dock->set_node(current_node);
+ scene_tree_dock->set_selected(current_node);
+ } else {
+ node_dock->set_node(NULL);
+ scene_tree_dock->set_selected(NULL);
+ }
object_menu->get_popup()->clear();
//top_pallete->set_current_tab(0);
@@ -1498,6 +1592,11 @@ void EditorNode::_edit_current() {
editor_plugin_screen->make_visible(true);
+ int plugin_count = editor_data.get_editor_plugin_count();
+ for (int i = 0; i < plugin_count; i++) {
+ editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name());
+ }
+
for (int i = 0; i < editor_table.size(); i++) {
main_editor_buttons[i]->set_pressed(editor_table[i] == main_plugin);
@@ -1551,7 +1650,7 @@ void EditorNode::_edit_current() {
p->add_separator();
p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique", TTR("Make Sub-Resources Unique")), OBJECT_UNIQUE_RESOURCES);
p->add_separator();
- p->add_icon_shortcut(gui_base->get_icon("Help", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP);
+ p->add_icon_shortcut(gui_base->get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("property_editor/open_help", TTR("Open in Help")), OBJECT_REQUEST_HELP);
}
List<MethodInfo> methods;
@@ -1654,12 +1753,12 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
if (run_filename == "") {
//evidently, run the scene
- main_scene = GLOBAL_DEF("application/main_scene", "");
+ main_scene = GLOBAL_DEF("application/run/main_scene", "");
if (main_scene == "") {
current_option = -1;
//accept->get_cancel()->hide();
- pick_main_scene->set_text(TTR("No main scene has ever been defined, select one?\nYou can change it later in later in \"Project Settings\" under the 'application' category."));
+ pick_main_scene->set_text(TTR("No main scene has ever been defined, select one?\nYou can change it later in \"Project Settings\" under the 'application' category."));
pick_main_scene->popup_centered_minsize();
return;
}
@@ -1720,7 +1819,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
List<String> breakpoints;
editor_data.get_editor_breakpoints(&breakpoints);
- args = GlobalConfig::get_singleton()->get("editor/main_run_args");
+ args = ProjectSettings::get_singleton()->get("editor/main_run_args");
Error error = editor_run.run(run_filename, args, breakpoints);
@@ -1864,42 +1963,45 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
open_request(previous_scenes.back()->get());
} break;
+ case FILE_CLOSE_ALL_AND_QUIT:
+ case FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER:
case FILE_CLOSE: {
- if (!p_confirmed && unsaved_cache) {
- confirmation->get_ok()->set_text(TTR("Yes"));
- //confirmation->get_cancel()->show();
- confirmation->set_text(TTR("Close scene? (Unsaved changes will be lost)"));
- confirmation->popup_centered_minsize();
+ if (!p_confirmed && (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER)) {
+ tab_closing = p_option == FILE_CLOSE ? editor_data.get_edited_scene() : _next_unsaved_scene(false);
+ String scene_filename = editor_data.get_edited_scene_root(tab_closing)->get_filename();
+ save_confirmation->get_ok()->set_text(TTR("Save & Close"));
+ save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene"));
+ save_confirmation->popup_centered_minsize();
break;
}
-
- _remove_edited_scene();
-
- } break;
- case SCENE_TAB_CLOSE: {
- _remove_scene(tab_closing);
- _update_scene_tabs();
- current_option = -1;
- } break;
+ } // fallthrough
+ case SCENE_TAB_CLOSE:
case FILE_SAVE_SCENE: {
- Node *scene = editor_data.get_edited_scene_root();
+ int scene_idx = (p_option == FILE_SAVE_SCENE) ? -1 : tab_closing;
+
+ Node *scene = editor_data.get_edited_scene_root(scene_idx);
if (scene && scene->get_filename() != "") {
// save in background if in the script editor
- if (_get_current_main_editor() == EDITOR_SCRIPT) {
- _save_scene(scene->get_filename());
+ if (scene_idx != editor_data.get_edited_scene() || _get_current_main_editor() == EDITOR_SCRIPT) {
+ _save_scene(scene->get_filename(), scene_idx);
} else {
_save_scene_with_preview(scene->get_filename());
}
- return;
- };
+
+ if (scene_idx != -1)
+ _discard_changes();
+
+ break;
+ }
// fallthrough to save_as
};
case FILE_SAVE_AS_SCENE: {
+ int scene_idx = (p_option == FILE_SAVE_SCENE || p_option == FILE_SAVE_AS_SCENE) ? -1 : tab_closing;
- Node *scene = editor_data.get_edited_scene_root();
+ Node *scene = editor_data.get_edited_scene_root(scene_idx);
if (!scene) {
@@ -1935,7 +2037,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
String existing;
if (extensions.size()) {
- String root_name(get_edited_scene()->get_name());
+ String root_name(scene->get_name());
existing = root_name + "." + extensions.front()->get().to_lower();
}
file->set_current_path(existing);
@@ -1946,28 +2048,20 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case FILE_SAVE_ALL_SCENES: {
- for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
- Node *scene = editor_data.get_edited_scene_root(i);
- if (scene && scene->get_filename() != "") {
- // save in background if in the script editor
- if (i != editor_data.get_edited_scene() || _get_current_main_editor() == EDITOR_SCRIPT) {
- _save_scene(scene->get_filename(), i);
- } else {
- _save_scene_with_preview(scene->get_filename());
- }
- } // else: ignore new scenes
- }
+
+ _save_all_scenes();
} break;
case FILE_SAVE_BEFORE_RUN: {
if (!p_confirmed) {
- accept->get_ok()->set_text(TTR("Yes"));
- accept->set_text(TTR("This scene has never been saved. Save before running?"));
- accept->popup_centered_minsize();
+ confirmation->get_cancel()->set_text(TTR("No"));
+ confirmation->get_ok()->set_text(TTR("Yes"));
+ confirmation->set_text(TTR("This scene has never been saved. Save before running?"));
+ confirmation->popup_centered_minsize();
break;
}
_menu_option(FILE_SAVE_AS_SCENE);
- _menu_option_confirm(FILE_SAVE_AND_RUN, true);
+ _menu_option_confirm(FILE_SAVE_AND_RUN, false);
} break;
case FILE_SAVE_OPTIMIZED: {
@@ -2074,22 +2168,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
- case FILE_QUIT: {
-
- if (!p_confirmed) {
-
- confirmation->get_ok()->set_text(TTR("Quit"));
- //confirmation->get_cancel()->show();
- confirmation->set_text(TTR("Exit the editor?"));
- confirmation->popup_centered(Size2(180, 70) * EDSCALE);
- break;
- }
-
- _menu_option_confirm(RUN_STOP, true);
- exiting = true;
- get_tree()->quit();
-
- } break;
case FILE_EXTERNAL_OPEN_SCENE: {
if (unsaved_cache && !p_confirmed) {
@@ -2208,7 +2286,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
instanced_scene->generate_instance_state();
- instanced_scene->set_filename( GlobalConfig::get_singleton()->localize_path(external_file) );
+ instanced_scene->set_filename( ProjectSettings::get_singleton()->localize_path(external_file) );
editor_data.get_undo_redo().create_action("Instance Scene");
editor_data.get_undo_redo().add_do_method(parent,"add_child",instanced_scene);
@@ -2390,6 +2468,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case RUN_PLAY_SCENE: {
+
+ _save_default_environment();
_menu_option_confirm(RUN_STOP, true);
_call_build();
_run(true);
@@ -2416,54 +2496,77 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
project_settings->popup_project_settings();
} break;
+ case FILE_QUIT:
case RUN_PROJECT_MANAGER: {
if (!p_confirmed) {
- confirmation->get_ok()->set_text(TTR("Yes"));
- confirmation->set_text(TTR("Open Project Manager? \n(Unsaved changes will be lost)"));
- confirmation->popup_centered_minsize();
- break;
- }
+ bool save_each = EDITOR_DEF("interface/save_each_scene_on_quit", true);
+ if (_next_unsaved_scene(!save_each) == -1) {
- _menu_option_confirm(RUN_STOP, true);
- exiting = true;
- get_tree()->quit();
- String exec = OS::get_singleton()->get_executable_path();
+ bool confirm = EDITOR_DEF("interface/quit_confirmation", true);
+ if (confirm) {
- List<String> args;
- args.push_back("-path");
- args.push_back(exec.get_base_dir());
- args.push_back("-pm");
+ confirmation->get_ok()->set_text(p_option == FILE_QUIT ? TTR("Quit") : TTR("Yes"));
+ confirmation->set_text(p_option == FILE_QUIT ? TTR("Exit the editor?") : TTR("Open Project Manager?"));
+ confirmation->popup_centered_minsize();
+ } else {
+ _discard_changes();
+ break;
+ }
+ } else {
- OS::ProcessID pid = 0;
- Error err = OS::get_singleton()->execute(exec, args, false, &pid);
- ERR_FAIL_COND(err);
+ if (save_each) {
+
+ _menu_option_confirm(p_option == FILE_QUIT ? FILE_CLOSE_ALL_AND_QUIT : FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER, false);
+ } else {
+
+ String unsaved_scenes;
+ int i = _next_unsaved_scene(true, 0);
+ while (i != -1) {
+ unsaved_scenes += "\n " + editor_data.get_edited_scene_root(i)->get_filename();
+ i = _next_unsaved_scene(true, ++i);
+ }
+
+ save_confirmation->get_ok()->set_text(TTR("Save & Quit"));
+ save_confirmation->set_text((p_option == FILE_QUIT ? TTR("Save changes to the following scene(s) before quitting?") : TTR("Save changes the following scene(s) before opening Project Manager?")) + unsaved_scenes);
+ save_confirmation->popup_centered_minsize();
+ }
+ }
+
+ OS::get_singleton()->request_attention();
+ break;
+ }
+
+ if (_next_unsaved_scene(true) != -1) {
+ _save_all_scenes();
+ }
+ _discard_changes();
} break;
case RUN_FILE_SERVER: {
//file_server
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_FILE_SERVER));
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER));
if (ischecked) {
file_server->stop();
run_native->set_deploy_dumb(false);
- //debug_button->set_icon(gui_base->get_icon("FileServer","EditorIcons"));
- //debug_button->get_popup()->set_item_text( debug_button->get_popup()->get_item_index(RUN_FILE_SERVER),"Enable File Server");
+ //debug_menu->set_icon(gui_base->get_icon("FileServer","EditorIcons"));
+ //debug_menu->get_popup()->set_item_text( debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER),"Enable File Server");
} else {
file_server->start();
run_native->set_deploy_dumb(true);
- //debug_button->set_icon(gui_base->get_icon("FileServerActive","EditorIcons"));
- //debug_button->get_popup()->set_item_text( debug_button->get_popup()->get_item_index(RUN_FILE_SERVER),"Disable File Server");
+ //debug_menu->set_icon(gui_base->get_icon("FileServerActive","EditorIcons"));
+ //debug_menu->get_popup()->set_item_text( debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER),"Disable File Server");
}
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_FILE_SERVER), !ischecked);
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_FILE_SERVER), !ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_file_server", !ischecked);
} break;
case RUN_LIVE_DEBUG: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_LIVE_DEBUG));
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_LIVE_DEBUG));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_LIVE_DEBUG), !ischecked);
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_LIVE_DEBUG), !ischecked);
ScriptEditor::get_singleton()->get_debugger()->set_live_debugging(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_live_debug", !ischecked);
@@ -2471,23 +2574,23 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
/*case RUN_DEPLOY_DUMB_CLIENTS: {
- bool ischecked = debug_button->get_popup()->is_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS));
- debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS),!ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked( debug_menu->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS));
+ debug_menu->get_popup()->set_item_checked( debug_menu->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS),!ischecked);
run_native->set_deploy_dumb(!ischecked);
} break;*/
case RUN_DEPLOY_REMOTE_DEBUG: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG), !ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG));
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG), !ischecked);
run_native->set_deploy_debug_remote(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_deploy_remote_debug", !ischecked);
} break;
case RUN_DEBUG_COLLISONS: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_DEBUG_COLLISONS));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_DEBUG_COLLISONS), !ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_COLLISONS));
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_COLLISONS), !ischecked);
run_native->set_debug_collisions(!ischecked);
editor_run.set_debug_collisions(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_collisons", !ischecked);
@@ -2495,8 +2598,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case RUN_DEBUG_NAVIGATION: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION), !ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION));
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_NAVIGATION), !ischecked);
run_native->set_debug_navigation(!ischecked);
editor_run.set_debug_navigation(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_navigation", !ischecked);
@@ -2504,8 +2607,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case RUN_RELOAD_SCRIPTS: {
- bool ischecked = debug_button->get_popup()->is_item_checked(debug_button->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS));
- debug_button->get_popup()->set_item_checked(debug_button->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS), !ischecked);
+ bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS));
+ debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS), !ischecked);
ScriptEditor::get_singleton()->set_live_auto_reload_running_scripts(!ischecked);
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_reload_scripts", !ischecked);
@@ -2567,9 +2670,26 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file->popup_centered_ratio();
} break;
- case SETTINGS_ABOUT: {
-
- about->popup_centered_minsize(Size2(500, 130) * EDSCALE);
+ case HELP_CLASSES: {
+ emit_signal("request_help_index", "");
+ } break;
+ case HELP_SEARCH: {
+ emit_signal("request_help_search", "");
+ } break;
+ case HELP_DOCS: {
+ OS::get_singleton()->shell_open("http://docs.godotengine.org/");
+ } break;
+ case HELP_QA: {
+ OS::get_singleton()->shell_open("https://godotengine.org/qa/");
+ } break;
+ case HELP_ISSUES: {
+ OS::get_singleton()->shell_open("https://github.com/godotengine/godot/issues");
+ } break;
+ case HELP_COMMUNITY: {
+ OS::get_singleton()->shell_open("https://godotengine.org/community");
+ } break;
+ case HELP_ABOUT: {
+ about->popup_centered_minsize(Size2(780, 500) * EDSCALE);
} break;
case SOURCES_REIMPORT: {
@@ -2646,6 +2766,73 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
}
+int EditorNode::_next_unsaved_scene(bool p_valid_filename, int p_start) {
+
+ for (int i = p_start; i < editor_data.get_edited_scene_count(); i++) {
+
+ if (!editor_data.get_edited_scene_root(i))
+ continue;
+ int current = editor_data.get_edited_scene();
+ bool unsaved = (i == current) ? saved_version != editor_data.get_undo_redo().get_version() : editor_data.get_scene_version(i) != 0;
+ if (unsaved) {
+ String scene_filename = editor_data.get_edited_scene_root(i)->get_filename();
+ if (p_valid_filename && scene_filename.length() == 0)
+ continue;
+ return i;
+ }
+ }
+ return -1;
+}
+
+void EditorNode::_discard_changes(const String &p_str) {
+
+ switch (current_option) {
+
+ case FILE_CLOSE_ALL_AND_QUIT:
+ case FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER:
+ case FILE_CLOSE:
+ case SCENE_TAB_CLOSE: {
+
+ _remove_scene(tab_closing);
+ _update_scene_tabs();
+
+ if (current_option == FILE_CLOSE_ALL_AND_QUIT || current_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) {
+ if (_next_unsaved_scene(false) == -1) {
+ current_option = current_option == FILE_CLOSE_ALL_AND_QUIT ? FILE_QUIT : RUN_PROJECT_MANAGER;
+ _discard_changes();
+ } else {
+ _menu_option_confirm(current_option, false);
+ }
+ } else {
+ current_option = -1;
+ save_confirmation->hide();
+ }
+ } break;
+ case FILE_QUIT: {
+
+ _menu_option_confirm(RUN_STOP, true);
+ exiting = true;
+ get_tree()->quit();
+ } break;
+ case RUN_PROJECT_MANAGER: {
+
+ _menu_option_confirm(RUN_STOP, true);
+ exiting = true;
+ get_tree()->quit();
+ String exec = OS::get_singleton()->get_executable_path();
+
+ List<String> args;
+ args.push_back("-path");
+ args.push_back(exec.get_base_dir());
+ args.push_back("-pm");
+
+ OS::ProcessID pid = 0;
+ Error err = OS::get_singleton()->execute(exec, args, false, &pid);
+ ERR_FAIL_COND(err);
+ } break;
+ }
+}
+
void EditorNode::_update_debug_options() {
bool check_deploy_remote = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_deploy_remote_debug", false);
@@ -2697,6 +2884,19 @@ void EditorNode::_editor_select(int p_which) {
editor_plugin_screen = new_editor;
editor_plugin_screen->make_visible(true);
editor_plugin_screen->selected_notify();
+
+ int plugin_count = editor_data.get_editor_plugin_count();
+ for (int i = 0; i < plugin_count; i++) {
+ editor_data.get_editor_plugin(i)->notify_main_screen_changed(editor_plugin_screen->get_name());
+ }
+
+ if (EditorSettings::get_singleton()->get("interface/separate_distraction_mode")) {
+ if (p_which == EDITOR_SCRIPT) {
+ set_distraction_free_mode(script_distraction);
+ } else {
+ set_distraction_free_mode(scene_distraction);
+ }
+ }
}
void EditorNode::add_editor_plugin(EditorPlugin *p_editor) {
@@ -2707,6 +2907,8 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor) {
tb->set_toggle_mode(true);
tb->connect("pressed", singleton, "_editor_select", varray(singleton->main_editor_buttons.size()));
tb->set_text(p_editor->get_name());
+ tb->set_icon(p_editor->get_base_control()->get_icon(p_editor->get_name(), "EditorIcons"));
+ tb->set_name(p_editor->get_name());
singleton->main_editor_buttons.push_back(tb);
singleton->main_editor_button_vb->add_child(tb);
singleton->editor_table.push_back(p_editor);
@@ -2736,7 +2938,6 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) {
}
}
- //singleton->main_editor_tabs->add_tab(p_editor->get_name());
singleton->editor_table.erase(p_editor);
}
p_editor->make_visible(false);
@@ -2758,9 +2959,9 @@ void EditorNode::_update_addon_config() {
}
if (enabled_addons.size() == 0) {
- GlobalConfig::get_singleton()->set("editor_plugins/enabled", Variant());
+ ProjectSettings::get_singleton()->set("editor_plugins/enabled", Variant());
} else {
- GlobalConfig::get_singleton()->set("editor_plugins/enabled", enabled_addons);
+ ProjectSettings::get_singleton()->set("editor_plugins/enabled", enabled_addons);
}
project_settings->queue_save();
@@ -2812,7 +3013,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled)
}
if (!script->is_tool()) {
- show_warning("Unable to load addon script from path: '" + path + "' Script is does not support tool mode.");
+ show_warning("Unable to load addon script from path: '" + path + "' Script is not in tool mode.");
return;
}
@@ -3101,7 +3302,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
if (p_clear_errors)
load_errors->clear();
- String lpath = GlobalConfig::get_singleton()->localize_path(p_scene);
+ String lpath = ProjectSettings::get_singleton()->localize_path(p_scene);
if (!lpath.begins_with("res://")) {
@@ -3389,7 +3590,7 @@ void EditorNode::animation_editor_make_visible(bool p_visible) {
#endif
void EditorNode::_add_to_recent_scenes(const String &p_scene) {
- String base = "_" + GlobalConfig::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::");
+ String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::");
Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array());
String name = p_scene;
name = name.replace("res://", "");
@@ -3406,21 +3607,12 @@ void EditorNode::_add_to_recent_scenes(const String &p_scene) {
void EditorNode::_open_recent_scene(int p_idx) {
- String base = "_" + GlobalConfig::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::");
+ String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::");
Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array());
ERR_FAIL_INDEX(p_idx, rc.size());
String path = "res://" + rc[p_idx];
-
- /*if (unsaved_cache) {
- _recent_scene=rc[p_idx];
- open_recent_confirmation->set_text("Discard current scene and open:\n'"+rc[p_idx]+"'");
- open_recent_confirmation->get_label()->set_align(Label::ALIGN_CENTER);
- open_recent_confirmation->popup_centered(Size2(400,100));
- return;
- }*/
-
load_scene(path);
}
@@ -3458,13 +3650,13 @@ void EditorNode::_save_optimized() {
}
- project_settings->add_remapped_path(GlobalConfig::get_singleton()->localize_path(get_edited_scene()->get_filename()),GlobalConfig::get_singleton()->localize_path(path),platform);
+ project_settings->add_remapped_path(ProjectSettings::get_singleton()->localize_path(get_edited_scene()->get_filename()),ProjectSettings::get_singleton()->localize_path(path),platform);
#endif
}
void EditorNode::_update_recent_scenes() {
- String base = "_" + GlobalConfig::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::");
+ String base = "_" + ProjectSettings::get_singleton()->get_resource_path().replace("\\", "::").replace("/", "::");
Vector<String> rc = EDITOR_DEF(base + "/_recent_scenes", Array());
recent_scenes->clear();
for (int i = 0; i < rc.size(); i++) {
@@ -3566,7 +3758,7 @@ bool EditorNode::is_scene_in_use(const String &p_path) {
void EditorNode::register_editor_types() {
ClassDB::register_class<EditorPlugin>();
- // ClassDB::register_class<EditorImportPlugin>();
+ ClassDB::register_class<EditorImportPlugin>();
// ClassDB::register_class<EditorExportPlugin>();
// ClassDB::register_class<EditorScenePostImport>();
ClassDB::register_class<EditorScript>();
@@ -3579,6 +3771,7 @@ void EditorNode::register_editor_types() {
ClassDB::register_class<EditorResourcePreviewGenerator>();
ClassDB::register_class<EditorFileSystem>();
ClassDB::register_class<EditorFileSystemDirectory>();
+ ClassDB::register_virtual_class<ScriptEditor>();
//ClassDB::register_type<EditorImporter>();
//ClassDB::register_type<EditorPostImport>();
@@ -3599,9 +3792,9 @@ void EditorNode::progress_add_task(const String &p_task, const String &p_label,
singleton->progress_dialog->add_task(p_task, p_label, p_steps);
}
-void EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_redraw) {
+void EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_refresh) {
- singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_redraw);
+ singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_refresh);
}
void EditorNode::progress_end_task(const String &p_task) {
@@ -3669,9 +3862,9 @@ void EditorNode::_editor_file_dialog_unregister(EditorFileDialog *p_dialog) {
Vector<EditorNodeInitCallback> EditorNode::_init_callbacks;
-Error EditorNode::export_platform(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) {
+Error EditorNode::export_preset(const String &preset, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) {
- export_defer.platform = p_platform;
+ export_defer.preset = preset;
export_defer.path = p_path;
export_defer.debug = p_debug;
export_defer.password = p_password;
@@ -3686,11 +3879,13 @@ void EditorNode::show_warning(const String &p_text, const String &p_title) {
warning->popup_centered_minsize();
}
-void EditorNode::_dock_select_input(const InputEvent &p_input) {
+void EditorNode::_dock_select_input(const Ref<InputEvent> &p_input) {
+
+ Ref<InputEventMouse> me = p_input;
- if (p_input.type == InputEvent::MOUSE_BUTTON || p_input.type == InputEvent::MOUSE_MOTION) {
+ if (me.is_valid()) {
- Vector2 point(p_input.mouse_motion.x, p_input.mouse_motion.y);
+ Vector2 point = me->get_position();
int nrect = -1;
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
@@ -3708,7 +3903,9 @@ void EditorNode::_dock_select_input(const InputEvent &p_input) {
if (nrect == -1)
return;
- if (p_input.type == InputEvent::MOUSE_BUTTON && p_input.mouse_button.button_index == 1 && p_input.mouse_button.pressed && dock_popup_selected != nrect) {
+ Ref<InputEventMouseButton> mb = me;
+
+ if (mb.is_valid() && mb->get_button_index() == 1 && mb->is_pressed() && dock_popup_selected != nrect) {
Control *dock = dock_slot[dock_popup_selected]->get_current_tab_control();
if (dock) {
dock_slot[dock_popup_selected]->remove_child(dock);
@@ -3798,7 +3995,7 @@ void EditorNode::_dock_select_draw() {
unusable.a = 0.1;
Rect2 unr(s.x * 2, 0, s.x * 2, s.y * 2);
- unr.pos += Vector2(2, 5);
+ unr.position += Vector2(2, 5);
unr.size -= Vector2(4, 7);
dock_select->draw_rect(unr, unusable);
@@ -3851,7 +4048,7 @@ void EditorNode::_dock_select_draw() {
Rect2 r(ofs, s);
dock_select_rect[i] = r;
- r.pos += Vector2(2, 5);
+ r.position += Vector2(2, 5);
r.size -= Vector2(4, 7);
if (i == dock_select_rect_over) {
@@ -4134,7 +4331,7 @@ void EditorNode::_update_layouts_menu() {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err != OK) {
return; //no config
}
@@ -4182,7 +4379,7 @@ void EditorNode::_layout_menu_option(int p_id) {
Ref<ConfigFile> config;
config.instance();
- Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts.cfg"));
+ Error err = config->load(EditorSettings::get_singleton()->get_settings_path().plus_file("editor_layouts-3.cfg"));
if (err != OK) {
return; //no config
}
@@ -4203,23 +4400,76 @@ void EditorNode::_scene_tab_script_edited(int p_tab) {
void EditorNode::_scene_tab_closed(int p_tab) {
current_option = SCENE_TAB_CLOSE;
tab_closing = p_tab;
+ Node *scene = editor_data.get_edited_scene_root(p_tab);
+ if (!scene) {
+ _discard_changes();
+ return;
+ }
bool unsaved = (p_tab == editor_data.get_edited_scene()) ?
saved_version != editor_data.get_undo_redo().get_version() :
editor_data.get_scene_version(p_tab) != 0;
if (unsaved) {
- confirmation->get_ok()->set_text(TTR("Yes"));
+ save_confirmation->get_ok()->set_text(TTR("Save & Close"));
+ save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene->get_filename() != "" ? scene->get_filename() : "unsaved scene"));
+ save_confirmation->popup_centered_minsize();
+ } else {
+ _discard_changes();
+ }
+}
- //confirmation->get_cancel()->show();
- confirmation->set_text(TTR("Close scene? (Unsaved changes will be lost)"));
- confirmation->popup_centered_minsize();
+void EditorNode::_scene_tab_hover(int p_tab) {
+ if (bool(EDITOR_DEF("interface/scene_tabs/show_thumbnail_on_hover", true)) == false) {
+ return;
+ }
+ int current_tab = scene_tabs->get_current_tab();
+
+ if (p_tab == current_tab || p_tab < 0) {
+ tab_preview_panel->hide();
} else {
- _remove_scene(p_tab);
- _update_scene_tabs();
+ String path = editor_data.get_scene_path(p_tab);
+ EditorResourcePreview::get_singleton()->queue_resource_preview(path, this, "_thumbnail_done", p_tab);
+ }
+}
+
+void EditorNode::_scene_tab_exit() {
+ tab_preview_panel->hide();
+}
+
+void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) {
+ Ref<InputEventMouseButton> mb = p_input;
+
+ if (mb.is_valid()) {
+ if (scene_tabs->get_hovered_tab() >= 0) {
+ if (mb->get_button_index() == BUTTON_MIDDLE && mb->is_pressed()) {
+ _scene_tab_closed(scene_tabs->get_hovered_tab());
+ }
+ } else {
+ if ((mb->get_button_index() == BUTTON_LEFT && mb->is_doubleclick()) || (mb->get_button_index() == BUTTON_MIDDLE && mb->is_pressed())) {
+ _menu_option_confirm(FILE_NEW_SCENE, true);
+ }
+ }
+ }
+}
+
+void EditorNode::_reposition_active_tab(int idx_to) {
+ editor_data.move_edited_scene_to_index(idx_to);
+ _update_scene_tabs();
+}
+
+void EditorNode::_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata) {
+ int p_tab = p_udata.operator signed int();
+ if (p_preview.is_valid()) {
+ Rect2 rect = scene_tabs->get_tab_rect(p_tab);
+ rect.position += scene_tabs->get_global_position();
+ tab_preview->set_texture(p_preview);
+ tab_preview_panel->set_position(rect.position + Vector2(0, rect.size.height));
+ tab_preview_panel->show();
}
}
void EditorNode::_scene_tab_changed(int p_tab) {
+ tab_preview_panel->hide();
//print_line("set current 1 ");
bool unsaved = (saved_version != editor_data.get_undo_redo().get_version());
@@ -4390,7 +4640,25 @@ bool EditorNode::get_docks_visible() const {
void EditorNode::_toggle_distraction_free_mode() {
- set_distraction_free_mode(distraction_free->is_pressed());
+ if (EditorSettings::get_singleton()->get("interface/separate_distraction_mode")) {
+ int screen = -1;
+ for (int i = 0; i < editor_table.size(); i++) {
+ if (editor_plugin_screen == editor_table[i]) {
+ screen = i;
+ break;
+ }
+ }
+
+ if (screen == EDITOR_SCRIPT) {
+ script_distraction = !script_distraction;
+ set_distraction_free_mode(script_distraction);
+ } else {
+ scene_distraction = !scene_distraction;
+ set_distraction_free_mode(scene_distraction);
+ }
+ } else {
+ set_distraction_free_mode(distraction_free->is_pressed());
+ }
}
void EditorNode::set_distraction_free_mode(bool p_enter) {
@@ -4445,8 +4713,9 @@ Variant EditorNode::drag_resource(const Ref<Resource> &p_res, Control *p_from) {
{
//todo make proper previews
Ref<ImageTexture> pic = gui_base->get_icon("FileBig", "EditorIcons");
- Image img = pic->get_data();
- img.resize(48, 48); //meh
+ Ref<Image> img = pic->get_data();
+ img = img->duplicate();
+ img->resize(48, 48); //meh
Ref<ImageTexture> resized_pic = Ref<ImageTexture>(memnew(ImageTexture));
resized_pic->create_from_image(img);
preview = resized_pic;
@@ -4466,7 +4735,7 @@ Variant EditorNode::drag_resource(const Ref<Resource> &p_res, Control *p_from) {
p_from->set_drag_preview(drag_control); //wait until it enters scene
- label->set_pos(Point2((preview->get_width() - label->get_minimum_size().width) / 2, preview->get_height()));
+ label->set_position(Point2((preview->get_width() - label->get_minimum_size().width) / 2, preview->get_height()));
Dictionary drag_data;
drag_data["type"] = "resource";
@@ -4656,13 +4925,19 @@ void EditorNode::dim_editor(bool p_dimming) {
static int dim_count = 0;
bool dim_ui = EditorSettings::get_singleton()->get("interface/dim_editor_on_dialog_popup");
if (p_dimming) {
- if (dim_ui && dim_count == 0)
- _start_dimming(true);
- dim_count++;
+ if (dim_ui) {
+ if (dim_count == 0) {
+ _start_dimming(true);
+ }
+ dim_count++;
+ }
} else {
- dim_count--;
- if (dim_count < 1)
+ if (dim_count == 1) {
_start_dimming(false);
+ dim_count = 0;
+ } else if (dim_ui && dim_count > 0) {
+ dim_count--;
+ }
}
}
@@ -4690,6 +4965,22 @@ void EditorNode::_dim_timeout() {
}
}
+void EditorNode::_check_gui_base_size() {
+ if (gui_base->get_size().width > 1200 * EDSCALE) {
+ for (int i = 0; i < singleton->main_editor_button_vb->get_child_count(); i++) {
+ ToolButton *btn = singleton->main_editor_button_vb->get_child(i)->cast_to<ToolButton>();
+ if (btn == singleton->distraction_free) continue;
+ btn->set_text(btn->get_name());
+ }
+ } else {
+ for (int i = 0; i < singleton->main_editor_button_vb->get_child_count(); i++) {
+ ToolButton *btn = singleton->main_editor_button_vb->get_child(i)->cast_to<ToolButton>();
+ if (btn == singleton->distraction_free) continue;
+ btn->set_text("");
+ }
+ }
+}
+
void EditorNode::open_export_template_manager() {
export_template_manager->popup_manager();
@@ -4751,9 +5042,15 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method("set_current_version", &EditorNode::set_current_version);
ClassDB::bind_method("_scene_tab_changed", &EditorNode::_scene_tab_changed);
ClassDB::bind_method("_scene_tab_closed", &EditorNode::_scene_tab_closed);
+ ClassDB::bind_method("_scene_tab_hover", &EditorNode::_scene_tab_hover);
+ ClassDB::bind_method("_scene_tab_exit", &EditorNode::_scene_tab_exit);
+ ClassDB::bind_method("_scene_tab_input", &EditorNode::_scene_tab_input);
+ ClassDB::bind_method("_reposition_active_tab", &EditorNode::_reposition_active_tab);
+ ClassDB::bind_method("_thumbnail_done", &EditorNode::_thumbnail_done);
ClassDB::bind_method("_scene_tab_script_edited", &EditorNode::_scene_tab_script_edited);
ClassDB::bind_method("_set_main_scene_state", &EditorNode::_set_main_scene_state);
ClassDB::bind_method("_update_scene_tabs", &EditorNode::_update_scene_tabs);
+ ClassDB::bind_method("_discard_changes", &EditorNode::_discard_changes);
ClassDB::bind_method("_prepare_history", &EditorNode::_prepare_history);
ClassDB::bind_method("_select_history", &EditorNode::_select_history);
@@ -4772,11 +5069,14 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("_open_imported"), &EditorNode::_open_imported);
ClassDB::bind_method(D_METHOD("_inherit_imported"), &EditorNode::_inherit_imported);
ClassDB::bind_method(D_METHOD("_dim_timeout"), &EditorNode::_dim_timeout);
+ ClassDB::bind_method(D_METHOD("_check_gui_base_size"), &EditorNode::_check_gui_base_size);
ADD_SIGNAL(MethodInfo("play_pressed"));
ADD_SIGNAL(MethodInfo("pause_pressed"));
ADD_SIGNAL(MethodInfo("stop_pressed"));
ADD_SIGNAL(MethodInfo("request_help"));
+ ADD_SIGNAL(MethodInfo("request_help_search"));
+ ADD_SIGNAL(MethodInfo("request_help_index"));
ADD_SIGNAL(MethodInfo("script_add_function_request", PropertyInfo(Variant::OBJECT, "obj"), PropertyInfo(Variant::STRING, "function"), PropertyInfo(Variant::POOL_STRING_ARRAY, "args")));
ADD_SIGNAL(MethodInfo("resource_saved", PropertyInfo(Variant::OBJECT, "obj")));
}
@@ -4791,9 +5091,11 @@ EditorNode::EditorNode() {
Resource::_get_local_scene_func = _resource_get_edited_scene;
VisualServer::get_singleton()->textures_keep_original(true);
+ VisualServer::get_singleton()->set_debug_generate_wireframes(true);
EditorHelp::generate_doc(); //before any editor classes are crated
SceneState::set_disable_placeholders(true);
+ ResourceLoader::clear_translation_remaps(); //no remaps using during editor
editor_initialize_certificates(); //for asset sharing
InputDefault *id = Input::get_singleton()->cast_to<InputDefault>();
@@ -4814,6 +5116,9 @@ EditorNode::EditorNode() {
_initializing_addons = false;
docks_visible = true;
+ scene_distraction = false;
+ script_distraction = false;
+
FileAccess::set_backup_save(true);
TranslationServer::get_singleton()->set_enabled(false);
@@ -4859,10 +5164,6 @@ EditorNode::EditorNode() {
import_wav.instance();
ResourceFormatImporter::get_singleton()->add_importer(import_wav);
- Ref<ResourceImporterOBJ> import_obj;
- import_obj.instance();
- ResourceFormatImporter::get_singleton()->add_importer(import_obj);
-
Ref<ResourceImporterScene> import_scene;
import_scene.instance();
ResourceFormatImporter::get_singleton()->add_importer(import_scene);
@@ -4871,6 +5172,14 @@ EditorNode::EditorNode() {
Ref<EditorSceneImporterCollada> import_collada;
import_collada.instance();
import_scene->add_importer(import_collada);
+
+ Ref<EditorOBJImporter> import_obj;
+ import_obj.instance();
+ import_scene->add_importer(import_obj);
+
+ Ref<EditorSceneImporterGLTF> import_gltf;
+ import_gltf.instance();
+ import_scene->add_importer(import_gltf);
}
}
@@ -4901,17 +5210,19 @@ EditorNode::EditorNode() {
ClassDB::set_class_enabled("CollisionShape2D", true);
ClassDB::set_class_enabled("CollisionPolygon2D", true);
- Control *theme_base = memnew(Control);
+ theme_base = memnew(Control);
add_child(theme_base);
theme_base->set_area_as_parent_rect();
gui_base = memnew(Panel);
theme_base->add_child(gui_base);
gui_base->set_area_as_parent_rect();
+ gui_base->connect("item_rect_changed", this, "_check_gui_base_size");
Ref<Theme> theme = create_editor_theme();
theme_base->set_theme(theme);
gui_base->set_theme(create_custom_theme());
+ gui_base->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles"));
resource_preview = memnew(EditorResourcePreview);
add_child(resource_preview);
@@ -4926,29 +5237,11 @@ EditorNode::EditorNode() {
main_vbox = memnew(VBoxContainer);
gui_base->add_child(main_vbox);
main_vbox->set_area_as_parent_rect(8);
-
-#if 0
- PanelContainer *top_dark_panel = memnew( PanelContainer );
- Ref<StyleBoxTexture> top_dark_sb;
- top_dark_sb.instance();
- top_dark_sb->set_texture(theme->get_icon("PanelTop","EditorIcons"));
- for(int i=0;i<4;i++) {
- top_dark_sb->set_margin_size(Margin(i),3);
- top_dark_sb->set_default_margin(Margin(i),0);
- }
- top_dark_sb->set_expand_margin_size(MARGIN_LEFT,20);
- top_dark_sb->set_expand_margin_size(MARGIN_RIGHT,20);
-
- top_dark_panel->add_style_override("panel",top_dark_sb);
- VBoxContainer *top_dark_vb = memnew( VBoxContainer );
- main_vbox->add_child(top_dark_panel);
- top_dark_panel->add_child(top_dark_vb);
-#endif
+ main_vbox->set_margin(MARGIN_TOP, 5);
menu_hb = memnew(HBoxContainer);
main_vbox->add_child(menu_hb);
- //top_dark_vb->add_child(scene_tabs);
//left
left_l_hsplit = memnew(HSplitContainer);
main_vbox->add_child(left_l_hsplit);
@@ -5023,10 +5316,10 @@ EditorNode::EditorNode() {
main_hsplit->connect("dragged", this, "_dock_split_dragged");
right_hsplit->connect("dragged", this, "_dock_split_dragged");
- dock_select_popoup = memnew(PopupPanel);
- gui_base->add_child(dock_select_popoup);
+ dock_select_popup = memnew(PopupPanel);
+ gui_base->add_child(dock_select_popup);
VBoxContainer *dock_vb = memnew(VBoxContainer);
- dock_select_popoup->add_child(dock_vb);
+ dock_select_popup->add_child(dock_vb);
HBoxContainer *dock_hb = memnew(HBoxContainer);
dock_tab_move_left = memnew(ToolButton);
@@ -5053,18 +5346,15 @@ EditorNode::EditorNode() {
dock_select->set_v_size_flags(Control::SIZE_EXPAND_FILL);
dock_vb->add_child(dock_select);
- dock_select_popoup->set_as_minsize();
+ dock_select_popup->set_as_minsize();
dock_select_rect_over = -1;
dock_popup_selected = -1;
- //dock_select_popoup->set_(Size2(20,20));
-
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
dock_slot[i]->set_custom_minimum_size(Size2(230, 220) * EDSCALE);
dock_slot[i]->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- dock_slot[i]->set_popup(dock_select_popoup);
+ dock_slot[i]->set_popup(dock_select_popup);
dock_slot[i]->connect("pre_popup_pressed", this, "_dock_pre_popup", varray(i));
-
- //dock_slot[i]->set_tab_align(TabContainer::ALIGN_LEFT);
+ dock_slot[i]->set_tab_align(TabContainer::ALIGN_LEFT);
}
dock_drag_timer = memnew(Timer);
@@ -5083,22 +5373,50 @@ EditorNode::EditorNode() {
top_split->add_child(srt);
srt->add_constant_override("separation", 0);
- /* main_editor_tabs = memnew( Tabs );
- main_editor_tabs->connect("tab_changed",this,"_editor_select");
- main_editor_tabs->set_tab_close_display_policy(Tabs::SHOW_NEVER);
-*/
+ tab_preview_panel = memnew(Panel);
+ tab_preview_panel->set_size(Size2(100, 100) * EDSCALE);
+ tab_preview_panel->hide();
+ tab_preview_panel->set_self_modulate(Color(1, 1, 1, 0.7));
+ gui_base->add_child(tab_preview_panel);
+
+ tab_preview = memnew(TextureRect);
+ tab_preview->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED);
+ tab_preview->set_size(Size2(96, 96) * EDSCALE);
+ tab_preview->set_position(Point2(2, 2) * EDSCALE);
+ tab_preview_panel->add_child(tab_preview);
+
scene_tabs = memnew(Tabs);
+ scene_tabs->add_style_override("tab_fg", gui_base->get_stylebox("SceneTabFG", "EditorStyles"));
+ scene_tabs->add_style_override("tab_bg", gui_base->get_stylebox("SceneTabBG", "EditorStyles"));
scene_tabs->add_tab("unsaved");
- scene_tabs->set_tab_align(Tabs::ALIGN_CENTER);
+ scene_tabs->set_tab_align(Tabs::ALIGN_LEFT);
scene_tabs->set_tab_close_display_policy((bool(EDITOR_DEF("interface/always_show_close_button_in_scene_tabs", false)) ? Tabs::CLOSE_BUTTON_SHOW_ALWAYS : Tabs::CLOSE_BUTTON_SHOW_ACTIVE_ONLY));
+ scene_tabs->set_min_width(int(EDITOR_DEF("interface/scene_tabs/minimum_width", 50)) * EDSCALE);
scene_tabs->connect("tab_changed", this, "_scene_tab_changed");
scene_tabs->connect("right_button_pressed", this, "_scene_tab_script_edited");
scene_tabs->connect("tab_close", this, "_scene_tab_closed");
+ scene_tabs->connect("tab_hover", this, "_scene_tab_hover");
+ scene_tabs->connect("mouse_exited", this, "_scene_tab_exit");
+ scene_tabs->connect("gui_input", this, "_scene_tab_input");
+ scene_tabs->connect("reposition_active_tab_request", this, "_reposition_active_tab");
- srt->add_child(scene_tabs);
+ HBoxContainer *tabbar_container = memnew(HBoxContainer);
+ scene_tabs->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+
+ srt->add_child(tabbar_container);
+ tabbar_container->add_child(scene_tabs);
+ distraction_free = memnew(ToolButton);
+ tabbar_container->add_child(distraction_free);
+ distraction_free->set_shortcut(ED_SHORTCUT("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11));
+ distraction_free->set_tooltip(TTR("Toggle distraction-free mode."));
+ distraction_free->connect("pressed", this, "_toggle_distraction_free_mode");
+ distraction_free->set_icon(gui_base->get_icon("DistractionFree", "EditorIcons"));
+ distraction_free->set_toggle_mode(true);
scene_root_parent = memnew(PanelContainer);
scene_root_parent->set_custom_minimum_size(Size2(0, 80) * EDSCALE);
+ scene_root_parent->add_style_override("panel", gui_base->get_stylebox("Content", "EditorStyles"));
+ // sc->add_style_override("panel", gui_base->get_stylebox("Background", "EditorStyles"));
//Ref<StyleBox> sp = scene_root_parent->get_stylebox("panel","TabContainer");
//scene_root_parent->add_style_override("panel",sp);
@@ -5118,29 +5436,29 @@ EditorNode::EditorNode() {
VisualServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport_rid(), true);
scene_root->set_disable_input(true);
scene_root->set_as_audio_listener_2d(true);
- //scene_root->set_size_override(true,Size2(GlobalConfig::get_singleton()->get("display/width"),GlobalConfig::get_singleton()->get("display/height")));
+ //scene_root->set_size_override(true,Size2(ProjectSettings::get_singleton()->get("display/width"),ProjectSettings::get_singleton()->get("display/height")));
//scene_root->set_world_2d( Ref<World2D>( memnew( World2D )) );
viewport = memnew(VBoxContainer);
viewport->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ viewport->add_constant_override("separation", 0);
/*for(int i=0;i<4;i++) {
viewport->set_margin(Margin(i),sp->get_margin(Margin(i)));
}*/
scene_root_parent->add_child(viewport);
PanelContainer *top_region = memnew(PanelContainer);
- top_region->add_style_override("panel", gui_base->get_stylebox("hover", "Button"));
+ top_region->add_style_override("panel", gui_base->get_stylebox("MenuPanel", "EditorStyles"));
HBoxContainer *left_menu_hb = memnew(HBoxContainer);
top_region->add_child(left_menu_hb);
menu_hb->add_child(top_region);
- PopupMenu *p;
-
file_menu = memnew(MenuButton);
file_menu->set_text(TTR("Scene"));
//file_menu->set_icon(gui_base->get_icon("Save","EditorIcons"));
left_menu_hb->add_child(file_menu);
+ file_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
prev_scene = memnew(ToolButton);
prev_scene->set_icon(gui_base->get_icon("PrevScene", "EditorIcons"));
@@ -5149,12 +5467,13 @@ EditorNode::EditorNode() {
//left_menu_hb->add_child( prev_scene );
prev_scene->connect("pressed", this, "_menu_option", make_binds(FILE_OPEN_PREV));
gui_base->add_child(prev_scene);
- prev_scene->set_pos(Point2(3, 24));
+ prev_scene->set_position(Point2(3, 24));
prev_scene->hide();
ED_SHORTCUT("editor/next_tab", TTR("Next tab"), KEY_MASK_CMD + KEY_TAB);
ED_SHORTCUT("editor/prev_tab", TTR("Previous tab"), KEY_MASK_CMD + KEY_MASK_SHIFT + KEY_TAB);
ED_SHORTCUT("editor/filter_files", TTR("Filter Files.."), KEY_MASK_ALT + KEY_MASK_CMD + KEY_P);
+ PopupMenu *p;
file_menu->set_tooltip(TTR("Operations with scene files."));
p = file_menu->get_popup();
@@ -5168,13 +5487,11 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/close_scene", TTR("Close Scene"), KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_W), FILE_CLOSE);
p->add_separator();
- //p->add_shortcut(ED_SHORTCUT("editor/save_scene",TTR("Close Goto Prev. Scene")),FILE_OPEN_PREV,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_P);
p->add_submenu_item(TTR("Open Recent"), "RecentScenes", FILE_OPEN_RECENT);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/quick_open_scene", TTR("Quick Open Scene.."), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_O), FILE_QUICK_OPEN_SCENE);
p->add_shortcut(ED_SHORTCUT("editor/quick_open_script", TTR("Quick Open Script.."), KEY_MASK_ALT + KEY_MASK_CMD + KEY_O), FILE_QUICK_OPEN_SCRIPT);
p->add_separator();
-
PopupMenu *pm_export = memnew(PopupMenu);
pm_export->set_name("Export");
p->add_child(pm_export);
@@ -5188,18 +5505,7 @@ EditorNode::EditorNode() {
p->add_shortcut(ED_SHORTCUT("editor/undo", TTR("Undo"), KEY_MASK_CMD + KEY_Z), EDIT_UNDO, true);
p->add_shortcut(ED_SHORTCUT("editor/redo", TTR("Redo"), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_Z), EDIT_REDO, true);
p->add_separator();
- p->add_item(TTR("Run Script"), FILE_RUN_SCRIPT, KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_R);
- p->add_separator();
- p->add_item(TTR("Project Settings"), RUN_SETTINGS);
- p->add_separator();
p->add_item(TTR("Revert Scene"), EDIT_REVERT);
- p->add_separator();
-#ifdef OSX_ENABLED
- p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q);
-#else
- p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_Q);
-#endif
- p->add_item(TTR("Quit"), FILE_QUIT, KEY_MASK_CMD + KEY_Q);
recent_scenes = memnew(PopupMenu);
recent_scenes->set_name("RecentScenes");
@@ -5211,96 +5517,117 @@ EditorNode::EditorNode() {
sp->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
menu_hb->add_child(sp);
}
+ p->add_separator();
+ p->add_item(TTR("Quit"), FILE_QUIT, KEY_MASK_CMD + KEY_Q);
- PanelContainer *editor_region = memnew(PanelContainer);
- editor_region->add_style_override("panel", gui_base->get_stylebox("hover", "Button"));
- main_editor_button_vb = memnew(HBoxContainer);
- editor_region->add_child(main_editor_button_vb);
- menu_hb->add_child(editor_region);
-
- distraction_free = memnew(ToolButton);
- main_editor_button_vb->add_child(distraction_free);
- distraction_free->set_shortcut(ED_SHORTCUT("editor/distraction_free_mode", TTR("Distraction Free Mode"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F11));
- distraction_free->connect("pressed", this, "_toggle_distraction_free_mode");
- distraction_free->set_icon(gui_base->get_icon("DistractionFree", "EditorIcons"));
- distraction_free->set_toggle_mode(true);
+ project_menu = memnew(MenuButton);
+ project_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools."));
+ project_menu->set_text(TTR("Project"));
+ project_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ left_menu_hb->add_child(project_menu);
-//menu_hb->add_spacer();
-#if 0
- node_menu = memnew( MenuButton );
- node_menu->set_text("Node");
- node_menu->set_pos( Point2( 50,0) );
- menu_panel->add_child( node_menu );
-
- p=node_menu->get_popup();
- p->add_item("Create",NODE_CREATE);
- p->add_item("Instance",NODE_INSTANCE);
- p->add_separator();
- p->add_item("Reparent",NODE_REPARENT);
- p->add_item("Move Up",NODE_MOVE_UP);
- p->add_item("Move Down",NODE_MOVE_DOWN);
- p->add_separator();
- p->add_item("Duplicate",NODE_DUPLICATE);
+ p = project_menu->get_popup();
+ p->add_item(TTR("Project Settings"), RUN_SETTINGS);
p->add_separator();
- p->add_item("Remove (Branch)",NODE_REMOVE_BRANCH);
- p->add_item("Remove (Element)",NODE_REMOVE_ELEMENT);
+ p->connect("id_pressed", this, "_menu_option");
+ p->add_item(TTR("Run Script"), FILE_RUN_SCRIPT, KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_R);
+ p->add_item(TTR("Export"), FILE_EXPORT_PROJECT);
+
+ PopupMenu *tool_menu = memnew(PopupMenu);
+ tool_menu->set_name("Tools");
+ tool_menu->connect("id_pressed", this, "_menu_option");
+ p->add_child(tool_menu);
+ p->add_submenu_item(TTR("Tools"), "Tools");
+ tool_menu->add_item(TTR("Orphan Resource Explorer"), TOOLS_ORPHAN_RESOURCES);
p->add_separator();
- p->add_item("Edit Subscriptions..",NODE_CONNECTIONS);
- p->add_item("Edit Groups..",NODE_GROUPS);
- resource_menu = memnew( MenuButton );
- resource_menu->set_text("Resource");
- resource_menu->set_pos( Point2( 90,0) );
- menu_panel->add_child( resource_menu );
+#ifdef OSX_ENABLED
+ p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_ALT + KEY_Q);
+#else
+ p->add_item(TTR("Quit to Project List"), RUN_PROJECT_MANAGER, KEY_MASK_SHIFT + KEY_MASK_CTRL + KEY_Q);
#endif
- import_menu = memnew(MenuButton);
- import_menu->set_tooltip(TTR("Import assets to the project."));
- import_menu->set_text(TTR("Import"));
- //import_menu->set_icon(gui_base->get_icon("Save","EditorIcons"));
- left_menu_hb->add_child(import_menu);
-
- p = import_menu->get_popup();
- p->connect("id_pressed", this, "_menu_option");
-
- tool_menu = memnew(MenuButton);
- tool_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools."));
- tool_menu->set_text(TTR("Tools"));
+ PanelContainer *editor_region = memnew(PanelContainer);
+ main_editor_button_vb = memnew(HBoxContainer);
+ editor_region->add_child(main_editor_button_vb);
- //tool_menu->set_icon(gui_base->get_icon("Save","EditorIcons"));
- left_menu_hb->add_child(tool_menu);
+ menu_hb->add_spacer();
+ menu_hb->add_child(editor_region);
- p = tool_menu->get_popup();
+ debug_menu = memnew(MenuButton);
+ debug_menu->set_text(TTR("Debug"));
+ debug_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ left_menu_hb->add_child(debug_menu);
+ p = debug_menu->get_popup();
+ p->set_hide_on_item_selection(false);
+ p->add_check_item(TTR("Deploy with Remote Debug"), RUN_DEPLOY_REMOTE_DEBUG);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("When exporting or deploying, the resulting executable will attempt to connect to the IP of this computer in order to be debugged."));
+ p->add_check_item(TTR("Small Deploy with Network FS"), RUN_FILE_SERVER);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is enabled, export or deploy will produce a minimal executable.\nThe filesystem will be provided from the project by the editor over the network.\nOn Android, deploy will use the USB cable for faster performance. This option speeds up testing for games with a large footprint."));
+ p->add_separator();
+ p->add_check_item(TTR("Visible Collision Shapes"), RUN_DEBUG_COLLISONS);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("Collision shapes and raycast nodes (for 2D and 3D) will be visible on the running game if this option is turned on."));
+ p->add_check_item(TTR("Visible Navigation"), RUN_DEBUG_NAVIGATION);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("Navigation meshes and polygons will be visible on the running game if this option is turned on."));
+ p->add_separator();
+ p->add_check_item(TTR("Sync Scene Changes"), RUN_LIVE_DEBUG);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any changes made to the scene in the editor will be replicated in the running game.\nWhen used remotely on a device, this is more efficient with network filesystem."));
+ p->add_check_item(TTR("Sync Script Changes"), RUN_RELOAD_SCRIPTS);
+ p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any script that is saved will be reloaded on the running game.\nWhen used remotely on a device, this is more efficient with network filesystem."));
p->connect("id_pressed", this, "_menu_option");
- p->add_item(TTR("Orphan Resource Explorer"), TOOLS_ORPHAN_RESOURCES);
-
- export_button = memnew(ToolButton);
- export_button->set_tooltip(TTR("Export the project to many platforms."));
- export_button->set_text(TTR("Export"));
- export_button->connect("pressed", this, "_menu_option", varray(FILE_EXPORT_PROJECT));
- export_button->set_focus_mode(Control::FOCUS_NONE);
- left_menu_hb->add_child(export_button);
menu_hb->add_spacer();
- //Separator *s1 = memnew( VSeparator );
- //menu_panel->add_child(s1);
- //s1->set_pos(Point2(210,4));
- //s1->set_size(Point2(10,15));
+ settings_menu = memnew(MenuButton);
+ left_menu_hb->add_child(settings_menu);
+ settings_menu->set_text(TTR("Editor"));
+ settings_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ //settings_menu->set_anchor(MARGIN_RIGHT,ANCHOR_END);
+ p = settings_menu->get_popup();
+
+ //p->add_item("Export Settings",SETTINGS_EXPORT_PREFERENCES);
+ p->add_item(TTR("Editor Settings"), SETTINGS_PREFERENCES);
+ //p->add_item("Optimization Presets",SETTINGS_OPTIMIZED_PRESETS);
+ p->add_separator();
+ editor_layouts = memnew(PopupMenu);
+ editor_layouts->set_name("Layouts");
+ p->add_child(editor_layouts);
+ editor_layouts->connect("id_pressed", this, "_layout_menu_option");
+ p->add_submenu_item(TTR("Editor Layout"), "Layouts");
+ p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREN);
+ p->add_separator();
+ p->add_item(TTR("Manage Export Templates"), SETTINGS_MANAGE_EXPORT_TEMPLATES);
+
+ // Help Menu
+ MenuButton *help_menu = memnew(MenuButton);
+ left_menu_hb->add_child(help_menu);
+ help_menu->set_text(TTR("Help"));
+ help_menu->add_style_override("hover", gui_base->get_stylebox("MenuHover", "EditorStyles"));
+ p = help_menu->get_popup();
+ p->connect("id_pressed", this, "_menu_option");
+ p->add_icon_item(gui_base->get_icon("ClassList", "EditorIcons"), TTR("Classes"), HELP_CLASSES);
+ p->add_icon_item(gui_base->get_icon("HelpSearch", "EditorIcons"), TTR("Search"), HELP_SEARCH);
+ p->add_separator();
+ p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Online Docs"), HELP_DOCS);
+ p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Q&A"), HELP_QA);
+ p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Issue Tracker"), HELP_ISSUES);
+ p->add_icon_item(gui_base->get_icon("Instance", "EditorIcons"), TTR("Community"), HELP_COMMUNITY);
+ p->add_separator();
+ p->add_icon_item(gui_base->get_icon("GodotDocs", "EditorIcons"), TTR("About"), HELP_ABOUT);
play_cc = memnew(CenterContainer);
play_cc->set_mouse_filter(Control::MOUSE_FILTER_IGNORE);
- gui_base->add_child(play_cc);
+ menu_hb->add_child(play_cc);
play_cc->set_area_as_parent_rect();
play_cc->set_anchor_and_margin(MARGIN_BOTTOM, Control::ANCHOR_BEGIN, 10);
play_cc->set_margin(MARGIN_TOP, 5);
- top_region = memnew(PanelContainer);
- top_region->add_style_override("panel", gui_base->get_stylebox("hover", "Button"));
- play_cc->add_child(top_region);
+ play_button_panel = memnew(PanelContainer);
+ play_button_panel->add_style_override("panel", gui_base->get_stylebox("PlayButtonPanel", "EditorStyles"));
+ play_cc->add_child(play_button_panel);
HBoxContainer *play_hb = memnew(HBoxContainer);
- top_region->add_child(play_hb);
+ play_button_panel->add_child(play_hb);
play_button = memnew(ToolButton);
play_hb->add_child(play_button);
@@ -5312,7 +5639,6 @@ EditorNode::EditorNode() {
play_button->set_shortcut(ED_SHORTCUT("editor/play", TTR("Play"), KEY_F5));
pause_button = memnew(ToolButton);
- //menu_panel->add_child(pause_button); - not needed for now?
pause_button->set_toggle_mode(true);
pause_button->set_icon(gui_base->get_icon("Pause", "EditorIcons"));
pause_button->set_focus_mode(Control::FOCUS_NONE);
@@ -5340,9 +5666,6 @@ EditorNode::EditorNode() {
native_play_button->get_popup()->connect("id_pressed", this, "_run_in_device");
run_native->connect("native_run", this, "_menu_option", varray(RUN_PLAY_NATIVE));
- //VSeparator *s1 = memnew( VSeparator );
- //play_hb->add_child(s1);
-
play_scene_button = memnew(ToolButton);
play_hb->add_child(play_scene_button);
play_scene_button->set_toggle_mode(true);
@@ -5361,109 +5684,25 @@ EditorNode::EditorNode() {
play_custom_scene_button->set_tooltip(TTR("Play custom scene"));
play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5));
- debug_button = memnew(MenuButton);
- debug_button->set_flat(true);
- play_hb->add_child(debug_button);
- //debug_button->set_toggle_mode(true);
- debug_button->set_focus_mode(Control::FOCUS_NONE);
- debug_button->set_icon(gui_base->get_icon("Remote", "EditorIcons"));
- //debug_button->connect("pressed", this,"_menu_option",make_binds(RUN_LIVE_DEBUG));
- debug_button->set_tooltip(TTR("Debug options"));
-
- p = debug_button->get_popup();
- p->set_hide_on_item_selection(false);
- p->add_check_item(TTR("Deploy with Remote Debug"), RUN_DEPLOY_REMOTE_DEBUG);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("When exporting or deploying, the resulting executable will attempt to connect to the IP of this computer in order to be debugged."));
- p->add_check_item(TTR("Small Deploy with Network FS"), RUN_FILE_SERVER);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is enabled, export or deploy will produce a minimal executable.\nThe filesystem will be provided from the project by the editor over the network.\nOn Android, deploy will use the USB cable for faster performance. This option speeds up testing for games with a large footprint."));
- p->add_separator();
- p->add_check_item(TTR("Visible Collision Shapes"), RUN_DEBUG_COLLISONS);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("Collision shapes and raycast nodes (for 2D and 3D) will be visible on the running game if this option is turned on."));
- p->add_check_item(TTR("Visible Navigation"), RUN_DEBUG_NAVIGATION);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("Navigation meshes and polygons will be visible on the running game if this option is turned on."));
- p->add_separator();
- p->add_check_item(TTR("Sync Scene Changes"), RUN_LIVE_DEBUG);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any changes made to the scene in the editor will be replicated in the running game.\nWhen used remotely on a device, this is more efficient with network filesystem."));
- p->add_check_item(TTR("Sync Script Changes"), RUN_RELOAD_SCRIPTS);
- p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any script that is saved will be reloaded on the running game.\nWhen used remotely on a device, this is more efficient with network filesystem."));
- p->connect("id_pressed", this, "_menu_option");
-
- /*
- run_settings_button = memnew( ToolButton );
- //menu_hb->add_child(run_settings_button);
- //run_settings_button->set_toggle_mode(true);
- run_settings_button->set_focus_mode(Control::FOCUS_NONE);
- run_settings_button->set_icon(gui_base->get_icon("Run","EditorIcons"));
- run_settings_button->connect("pressed", this,"_menu_option",make_binds(RUN_SCENE_SETTINGS));
-*/
-
- /*
- run_settings_button = memnew( ToolButton );
- menu_panel->add_child(run_settings_button);
- run_settings_button->set_pos(Point2(305,0));
- run_settings_button->set_focus_mode(Control::FOCUS_NONE);
- run_settings_button->set_icon(gui_base->get_icon("Run","EditorIcons"));
- run_settings_button->connect("pressed", this,"_menu_option",make_binds(RUN_SETTINGS));
-*/
-
progress_hb = memnew(BackgroundProgress);
- menu_hb->add_child(progress_hb);
+ //menu_hb->add_child(progress_hb);
{
Control *sp = memnew(Control);
sp->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
- menu_hb->add_child(sp);
+ //menu_hb->add_child(sp);
}
- PanelContainer *vu_cont = memnew(PanelContainer);
- vu_cont->add_style_override("panel", gui_base->get_stylebox("hover", "Button"));
- menu_hb->add_child(vu_cont);
-
- audio_vu = memnew(TextureProgress);
- CenterContainer *vu_cc = memnew(CenterContainer);
- vu_cc->add_child(audio_vu);
- vu_cont->add_child(vu_cc);
- audio_vu->set_under_texture(gui_base->get_icon("VuEmpty", "EditorIcons"));
- audio_vu->set_progress_texture(gui_base->get_icon("VuFull", "EditorIcons"));
- audio_vu->set_max(24);
- audio_vu->set_min(-80);
- audio_vu->set_step(0.01);
- audio_vu->set_value(0);
-
{
Control *sp = memnew(Control);
sp->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
- menu_hb->add_child(sp);
+ //menu_hb->add_child(sp);
}
top_region = memnew(PanelContainer);
- top_region->add_style_override("panel", gui_base->get_stylebox("hover", "Button"));
HBoxContainer *right_menu_hb = memnew(HBoxContainer);
- top_region->add_child(right_menu_hb);
- menu_hb->add_child(top_region);
-
- settings_menu = memnew(MenuButton);
- settings_menu->set_text(TTR("Settings"));
- //settings_menu->set_anchor(MARGIN_RIGHT,ANCHOR_END);
- right_menu_hb->add_child(settings_menu);
- p = settings_menu->get_popup();
-
- //p->add_item("Export Settings",SETTINGS_EXPORT_PREFERENCES);
- p->add_item(TTR("Editor Settings"), SETTINGS_PREFERENCES);
- //p->add_item("Optimization Presets",SETTINGS_OPTIMIZED_PRESETS);
- p->add_separator();
- editor_layouts = memnew(PopupMenu);
- editor_layouts->set_name("Layouts");
- p->add_child(editor_layouts);
- editor_layouts->connect("id_pressed", this, "_layout_menu_option");
- p->add_submenu_item(TTR("Editor Layout"), "Layouts");
-
- p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREN);
-
- p->add_separator();
- p->add_item(TTR("Manage Export Templates"), SETTINGS_MANAGE_EXPORT_TEMPLATES);
- p->add_separator();
- p->add_item(TTR("About"), SETTINGS_ABOUT);
+ //top_region->add_child(right_menu_hb);
+ menu_hb->add_child(right_menu_hb);
layout_dialog = memnew(EditorNameDialog);
gui_base->add_child(layout_dialog);
@@ -5471,16 +5710,11 @@ EditorNode::EditorNode() {
layout_dialog->set_size(Size2(175, 70) * EDSCALE);
layout_dialog->connect("name_confirmed", this, "_dialog_action");
- sources_button = memnew(ToolButton);
- right_menu_hb->add_child(sources_button);
- sources_button->set_icon(gui_base->get_icon("DependencyOk", "EditorIcons"));
- sources_button->connect("pressed", this, "_menu_option", varray(SOURCES_REIMPORT));
- sources_button->set_tooltip(TTR("Alerts when an external resource has changed."));
-
update_menu = memnew(MenuButton);
update_menu->set_tooltip(TTR("Spins when the editor window repaints!"));
right_menu_hb->add_child(update_menu);
update_menu->set_icon(gui_base->get_icon("Progress1", "EditorIcons"));
+ update_menu->get_popup()->connect("id_pressed", this, "_menu_option");
p = update_menu->get_popup();
p->add_check_item(TTR("Update Always"), SETTINGS_UPDATE_ALWAYS);
p->add_check_item(TTR("Update Changes"), SETTINGS_UPDATE_CHANGES);
@@ -5488,52 +5722,15 @@ EditorNode::EditorNode() {
p->add_check_item(TTR("Disable Update Spinner"), SETTINGS_UPDATE_SPINNER_HIDE);
p->set_item_checked(1, true);
- //sources_button->connect();
-
- /*
- Separator *s2 = memnew( VSeparator );
- menu_panel->add_child(s2);
- s2->set_pos(Point2(338,4));
- s2->set_size(Point2(10,15));
-*/
-
- //editor_hsplit = memnew( HSplitContainer );
- //main_split->add_child(editor_hsplit);
- //editor_hsplit->set_v_size_flags(Control::SIZE_EXPAND_FILL);
-
- //editor_vsplit = memnew( VSplitContainer );
- //editor_hsplit->add_child(editor_vsplit);
-
- //top_pallete = memnew( TabContainer );
scene_tree_dock = memnew(SceneTreeDock(this, scene_root, editor_selection, editor_data));
scene_tree_dock->set_name(TTR("Scene"));
- //top_pallete->add_child(scene_tree_dock);
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(scene_tree_dock);
#if 0
resources_dock = memnew( ResourcesDock(this) );
resources_dock->set_name("Resources");
- //top_pallete->add_child(resources_dock);
dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(resources_dock);
- //top_pallete->set_v_size_flags(Control::SIZE_EXPAND_FILL);
#endif
dock_slot[DOCK_SLOT_LEFT_BR]->hide();
- /*Control *editor_spacer = memnew( Control );
- editor_spacer->set_custom_minimum_size(Size2(260,200));
- editor_spacer->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- editor_vsplit->add_child( editor_spacer );
- editor_spacer->add_child( top_pallete );
- top_pallete->set_area_as_parent_rect();*/
-
- //prop_pallete = memnew( TabContainer );
-
- //prop_pallete->set_v_size_flags(Control::SIZE_EXPAND_FILL);
-
- /*editor_spacer = memnew( Control );
- editor_spacer->set_custom_minimum_size(Size2(260,200));
- editor_spacer->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- editor_vsplit->add_child( editor_spacer );
- editor_spacer->add_child( prop_pallete );
- prop_pallete->set_area_as_parent_rect();*/
VBoxContainer *prop_editor_base = memnew(VBoxContainer);
prop_editor_base->set_name(TTR("Inspector")); // Properties?
@@ -5603,7 +5800,7 @@ EditorNode::EditorNode() {
search_button = memnew(ToolButton);
search_button->set_toggle_mode(true);
search_button->set_pressed(false);
- search_button->set_icon(gui_base->get_icon("Zoom", "EditorIcons"));
+ search_button->set_icon(gui_base->get_icon("Search", "EditorIcons"));
prop_editor_hb->add_child(search_button);
search_button->connect("toggled", this, "_toggle_search_bar");
@@ -5637,8 +5834,11 @@ EditorNode::EditorNode() {
property_editor = memnew(PropertyEditor);
property_editor->set_autoclear(true);
property_editor->set_show_categories(true);
+ property_editor->set_use_folding(true);
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
property_editor->set_use_doc_hints(true);
+ property_editor->set_hide_script(false);
+ property_editor->set_enable_capitalize_paths(bool(EDITOR_DEF("interface/capitalize_properties", true)));
property_editor->hide_top_label();
property_editor->register_text_enter(search_box);
@@ -5672,7 +5872,6 @@ EditorNode::EditorNode() {
} else {
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(filesystem_dock);
}
- //prop_pallete->add_child(filesystem_dock);
filesystem_dock->connect("open", this, "open_request");
filesystem_dock->connect("instance", this, "_instance_request");
@@ -5681,7 +5880,7 @@ EditorNode::EditorNode() {
overridden_default_layout = -1;
default_layout.instance();
default_layout->set_value(docks_section, "dock_3", TTR("FileSystem"));
- default_layout->set_value(docks_section, "dock_5", TTR("Scene"));
+ default_layout->set_value(docks_section, "dock_5", TTR("Scene") + "," + TTR("Import"));
default_layout->set_value(docks_section, "dock_6", TTR("Inspector") + "," + TTR("Node"));
for (int i = 0; i < DOCK_SLOT_MAX / 2; i++)
@@ -5692,7 +5891,7 @@ EditorNode::EditorNode() {
_update_layouts_menu();
bottom_panel = memnew(PanelContainer);
- bottom_panel->add_style_override("panel", gui_base->get_stylebox("panelf", "Panel"));
+ bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer"));
center_split->add_child(bottom_panel);
center_split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN);
@@ -5723,17 +5922,6 @@ EditorNode::EditorNode() {
//progress_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- /*
- animation_menu = memnew( ToolButton );
- animation_menu->set_pos(Point2(500,0));
- animation_menu->set_size(Size2(20,20));
- animation_menu->set_toggle_mode(true);
- animation_menu->set_focus_mode(Control::FOCUS_NONE);
- menu_panel->add_child(animation_menu);
- animation_menu->set_icon(gui_base->get_icon("Animation","EditorIcons"));
- animation_menu->connect("pressed",this,"_animation_visibility_toggle");
-*/
-
orphan_resources = memnew(OrphanResourcesDialog);
gui_base->add_child(orphan_resources);
@@ -5741,6 +5929,12 @@ EditorNode::EditorNode() {
gui_base->add_child(confirmation);
confirmation->connect("confirmed", this, "_menu_confirm_current");
+ save_confirmation = memnew(ConfirmationDialog);
+ save_confirmation->add_button(TTR("Don't Save"), OS::get_singleton()->get_swap_ok_cancel(), "discard");
+ gui_base->add_child(save_confirmation);
+ save_confirmation->connect("confirmed", this, "_menu_confirm_current");
+ save_confirmation->connect("custom_action", this, "_discard_changes");
+
accept = memnew(AcceptDialog);
gui_base->add_child(accept);
accept->connect("confirmed", this, "_menu_confirm_current");
@@ -5771,7 +5965,7 @@ EditorNode::EditorNode() {
settings_config_dialog = memnew(EditorSettingsDialog);
gui_base->add_child(settings_config_dialog);
- project_settings = memnew(ProjectSettings(&editor_data));
+ project_settings = memnew(ProjectSettingsEditor(&editor_data));
gui_base->add_child(project_settings);
import_confirmation = memnew(ConfirmationDialog);
@@ -5782,29 +5976,15 @@ EditorNode::EditorNode() {
import_confirmation->connect("custom_action", this, "_import_action");
gui_base->add_child(import_confirmation);
- open_recent_confirmation = memnew(ConfirmationDialog);
- add_child(open_recent_confirmation);
- open_recent_confirmation->connect("confirmed", this, "_open_recent_scene_confirm");
-
run_settings_dialog = memnew(RunSettingsDialog);
gui_base->add_child(run_settings_dialog);
export_template_manager = memnew(ExportTemplateManager);
gui_base->add_child(export_template_manager);
- about = memnew(AcceptDialog);
- about->set_title(TTR("Thanks from the Godot community!"));
- about->get_ok()->set_text(TTR("Thanks!"));
- about->set_hide_on_ok(true);
+ about = memnew(EditorAbout);
+ about->get_logo()->set_texture(gui_base->get_icon("Logo", "EditorIcons"));
gui_base->add_child(about);
- HBoxContainer *hbc = memnew(HBoxContainer);
- about->add_child(hbc);
- Label *about_text = memnew(Label);
- about_text->set_text(VERSION_FULL_NAME "\n(c) 2008-2017 Juan Linietsky, Ariel Manzur.\n");
- TextureRect *logo = memnew(TextureRect);
- logo->set_texture(gui_base->get_icon("Logo", "EditorIcons"));
- hbc->add_child(logo);
- hbc->add_child(about_text);
warning = memnew(AcceptDialog);
gui_base->add_child(warning);
@@ -5864,7 +6044,6 @@ EditorNode::EditorNode() {
file_menu->get_popup()->connect("id_pressed", this, "_menu_option");
object_menu->get_popup()->connect("id_pressed", this, "_menu_option");
- update_menu->get_popup()->connect("id_pressed", this, "_menu_option");
settings_menu->get_popup()->connect("id_pressed", this, "_menu_option");
file->connect("file_selected", this, "_dialog_action");
@@ -5899,21 +6078,17 @@ EditorNode::EditorNode() {
add_editor_plugin( memnew( ShaderEditorPlugin(this,false) ) );*/
add_editor_plugin(memnew(CameraEditorPlugin(this)));
- // add_editor_plugin( memnew( SampleEditorPlugin(this) ) );
- // add_editor_plugin( memnew( SampleLibraryEditorPlugin(this) ) );
add_editor_plugin(memnew(ThemeEditorPlugin(this)));
add_editor_plugin(memnew(MultiMeshEditorPlugin(this)));
add_editor_plugin(memnew(MeshInstanceEditorPlugin(this)));
add_editor_plugin(memnew(AnimationTreeEditorPlugin(this)));
- //add_editor_plugin( memnew( SamplePlayerEditorPlugin(this) ) ); - this is kind of useless at this point
- //add_editor_plugin( memnew( MeshLibraryEditorPlugin(this) ) );
- //add_editor_plugin( memnew( StreamEditorPlugin(this) ) );
+ add_editor_plugin(memnew(MeshLibraryEditorPlugin(this)));
add_editor_plugin(memnew(StyleBoxEditorPlugin(this)));
- //add_editor_plugin( memnew( ParticlesEditorPlugin(this) ) );
+ add_editor_plugin(memnew(ParticlesEditorPlugin(this)));
add_editor_plugin(memnew(ResourcePreloaderEditorPlugin(this)));
add_editor_plugin(memnew(ItemListEditorPlugin(this)));
//add_editor_plugin( memnew( RichTextEditorPlugin(this) ) );
- //add_editor_plugin( memnew( CollisionPolygonEditorPlugin(this) ) );
+ add_editor_plugin(memnew(CollisionPolygonEditorPlugin(this)));
add_editor_plugin(memnew(CollisionPolygon2DEditorPlugin(this)));
add_editor_plugin(memnew(TileSetEditorPlugin(this)));
add_editor_plugin(memnew(TileMapEditorPlugin(this)));
@@ -5922,18 +6097,18 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(Particles2DEditorPlugin(this)));
add_editor_plugin(memnew(GIProbeEditorPlugin(this)));
add_editor_plugin(memnew(Path2DEditorPlugin(this)));
- //add_editor_plugin( memnew( PathEditorPlugin(this) ) );
- //add_editor_plugin( memnew( BakedLightEditorPlugin(this) ) );
+ add_editor_plugin(memnew(PathEditorPlugin(this)));
add_editor_plugin(memnew(Line2DEditorPlugin(this)));
add_editor_plugin(memnew(Polygon2DEditorPlugin(this)));
add_editor_plugin(memnew(LightOccluder2DEditorPlugin(this)));
add_editor_plugin(memnew(NavigationPolygonEditorPlugin(this)));
- add_editor_plugin(memnew(ColorRampEditorPlugin(this)));
+ add_editor_plugin(memnew(GradientEditorPlugin(this)));
add_editor_plugin(memnew(CollisionShape2DEditorPlugin(this)));
+ add_editor_plugin(memnew(CurveEditorPlugin(this)));
add_editor_plugin(memnew(TextureEditorPlugin(this)));
add_editor_plugin(memnew(AudioBusesEditorPlugin(audio_bus_editor)));
//add_editor_plugin( memnew( MaterialEditorPlugin(this) ) );
- //add_editor_plugin( memnew( MeshEditorPlugin(this) ) );
+ add_editor_plugin(memnew(MeshEditorPlugin(this)));
for (int i = 0; i < EditorPlugins::get_plugin_count(); i++)
add_editor_plugin(EditorPlugins::create(i, this));
@@ -5942,23 +6117,21 @@ EditorNode::EditorNode() {
plugin_init_callbacks[i]();
}
- /*resource_preview->add_preview_generator( Ref<EditorTexturePreviewPlugin>( memnew(EditorTexturePreviewPlugin )));
- resource_preview->add_preview_generator( Ref<EditorPackedScenePreviewPlugin>( memnew(EditorPackedScenePreviewPlugin )));
- resource_preview->add_preview_generator( Ref<EditorMaterialPreviewPlugin>( memnew(EditorMaterialPreviewPlugin )));
- resource_preview->add_preview_generator( Ref<EditorScriptPreviewPlugin>( memnew(EditorScriptPreviewPlugin )));
- resource_preview->add_preview_generator( Ref<EditorSamplePreviewPlugin>( memnew(EditorSamplePreviewPlugin )));
- resource_preview->add_preview_generator( Ref<EditorMeshPreviewPlugin>( memnew(EditorMeshPreviewPlugin )));
- resource_preview->add_preview_generator( Ref<EditorBitmapPreviewPlugin>( memnew(EditorBitmapPreviewPlugin )));
-*/
+ resource_preview->add_preview_generator(Ref<EditorTexturePreviewPlugin>(memnew(EditorTexturePreviewPlugin)));
+ resource_preview->add_preview_generator(Ref<EditorPackedScenePreviewPlugin>(memnew(EditorPackedScenePreviewPlugin)));
+ resource_preview->add_preview_generator(Ref<EditorMaterialPreviewPlugin>(memnew(EditorMaterialPreviewPlugin)));
+ resource_preview->add_preview_generator(Ref<EditorScriptPreviewPlugin>(memnew(EditorScriptPreviewPlugin)));
+ //resource_preview->add_preview_generator( Ref<EditorSamplePreviewPlugin>( memnew(EditorSamplePreviewPlugin )));
+ resource_preview->add_preview_generator(Ref<EditorMeshPreviewPlugin>(memnew(EditorMeshPreviewPlugin)));
+ resource_preview->add_preview_generator(Ref<EditorBitmapPreviewPlugin>(memnew(EditorBitmapPreviewPlugin)));
circle_step_msec = OS::get_singleton()->get_ticks_msec();
circle_step_frame = Engine::get_singleton()->get_frames_drawn();
circle_step = 0;
- _rebuild_import_menu();
-
editor_plugin_screen = NULL;
editor_plugins_over = memnew(EditorPluginList);
+ editor_plugins_force_input_forwarding = memnew(EditorPluginList);
//force_top_viewport(true);
_edit_current();
@@ -5968,7 +6141,7 @@ EditorNode::EditorNode() {
Physics2DServer::get_singleton()->set_active(false); // no physics by default if editor
ScriptServer::set_scripting_enabled(false); // no scripting by default if editor
- //GlobalConfig::get_singleton()->set("render/room_cull_enabled",false);
+ //ProjectSettings::get_singleton()->set("render/room_cull_enabled",false);
reference_resource_mem = true;
save_external_resources_mem = true;
@@ -5981,7 +6154,7 @@ EditorNode::EditorNode() {
//store project name in ssettings
String project_name;
//figure it out from path
- project_name = GlobalConfig::get_singleton()->get_resource_path().replace("\\", "/");
+ project_name = ProjectSettings::get_singleton()->get_resource_path().replace("\\", "/");
print_line("path: " + project_name);
if (project_name.length() && project_name[project_name.length() - 1] == '/')
project_name = project_name.substr(0, project_name.length() - 1);
@@ -5989,7 +6162,7 @@ EditorNode::EditorNode() {
project_name = project_name.replace("/", "::");
if (project_name != "") {
- EditorSettings::get_singleton()->set("projects/" + project_name, GlobalConfig::get_singleton()->get_resource_path());
+ EditorSettings::get_singleton()->set("projects/" + project_name, ProjectSettings::get_singleton()->get_resource_path());
EditorSettings::get_singleton()->raise_order("projects/" + project_name);
EditorSettings::get_singleton()->save();
}
@@ -6066,10 +6239,15 @@ EditorNode::EditorNode() {
editor_data.set_edited_scene(0);
_update_scene_tabs();
+ import_dock->initialize_import_options();
+
{
_initializing_addons = true;
- Vector<String> addons = GlobalConfig::get_singleton()->get("editor_plugins/enabled");
+ Vector<String> addons;
+ if (ProjectSettings::get_singleton()->has("editor_plugins/enabled")) {
+ addons = ProjectSettings::get_singleton()->get("editor_plugins/enabled");
+ }
for (int i = 0; i < addons.size(); i++) {
set_addon_plugin_enabled(addons[i], true);
@@ -6089,6 +6267,14 @@ EditorNode::EditorNode() {
_dim_timer->set_wait_time(0.01666f);
_dim_timer->connect("timeout", this, "_dim_timeout");
add_child(_dim_timer);
+
+ ED_SHORTCUT("editor/editor_2d", TTR("Open 2D Editor"), KEY_F1);
+ ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_F2);
+ ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_F3); //hack neded for script editor F3 search to work :) Assign like this or don't use F3
+ ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_F4);
+ ED_SHORTCUT("editor/editor_assetlib", TTR("Open Asset Library"));
+ ED_SHORTCUT("editor/editor_next", TTR("Open the next Editor"));
+ ED_SHORTCUT("editor/editor_prev", TTR("Open the previous Editor"));
}
EditorNode::~EditorNode() {
@@ -6096,6 +6282,7 @@ EditorNode::~EditorNode() {
memdelete(EditorHelp::get_doc_data());
memdelete(editor_selection);
memdelete(editor_plugins_over);
+ memdelete(editor_plugins_force_input_forwarding);
memdelete(file_server);
EditorSettings::destroy();
}
@@ -6118,7 +6305,7 @@ void EditorPluginList::edit(Object *p_object) {
}
}
-bool EditorPluginList::forward_gui_input(const Transform2D &p_canvas_xform, const InputEvent &p_event) {
+bool EditorPluginList::forward_gui_input(const Transform2D &p_canvas_xform, const Ref<InputEvent> &p_event) {
bool discard = false;
@@ -6131,10 +6318,14 @@ bool EditorPluginList::forward_gui_input(const Transform2D &p_canvas_xform, cons
return discard;
}
-bool EditorPluginList::forward_spatial_gui_input(Camera *p_camera, const InputEvent &p_event) {
+bool EditorPluginList::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event, bool serve_when_force_input_enabled) {
bool discard = false;
for (int i = 0; i < plugins_list.size(); i++) {
+ if ((!serve_when_force_input_enabled) && plugins_list[i]->is_input_event_forwarding_always_enabled()) {
+ continue;
+ }
+
if (plugins_list[i]->forward_spatial_gui_input(p_camera, p_event)) {
discard = true;
}
@@ -6150,6 +6341,10 @@ void EditorPluginList::forward_draw_over_canvas(const Transform2D &p_canvas_xfor
}
}
+void EditorPluginList::add_plugin(EditorPlugin *p_plugin) {
+ plugins_list.push_back(p_plugin);
+}
+
bool EditorPluginList::empty() {
return plugins_list.empty();
}