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.cpp300
1 files changed, 196 insertions, 104 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index a4c1964515..a3743efb38 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -36,7 +36,6 @@
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/io/stream_peer_ssl.h"
-#include "core/io/zip_io.h"
#include "core/message_queue.h"
#include "core/os/file_access.h"
#include "core/os/input.h"
@@ -228,12 +227,6 @@ void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) {
_editor_select_prev();
}
- if (k->get_scancode() == KEY_ESCAPE) {
- for (int i = 0; i < bottom_panel_items.size(); i++) {
- _bottom_panel_switch(false, i);
- }
- }
-
if (old_editor != editor_plugin_screen) {
get_tree()->set_input_as_handled();
}
@@ -391,7 +384,6 @@ void EditorNode::_notification(int p_what) {
update_menu->set_icon(gui_base->get_icon("Progress1", "EditorIcons"));
PopupMenu *p = help_menu->get_popup();
- p->set_item_icon(p->get_item_index(HELP_CLASSES), gui_base->get_icon("ClassList", "EditorIcons"));
p->set_item_icon(p->get_item_index(HELP_SEARCH), gui_base->get_icon("HelpSearch", "EditorIcons"));
p->set_item_icon(p->get_item_index(HELP_DOCS), gui_base->get_icon("Instance", "EditorIcons"));
p->set_item_icon(p->get_item_index(HELP_QA), gui_base->get_icon("Instance", "EditorIcons"));
@@ -417,51 +409,50 @@ void EditorNode::_on_plugin_ready(Object *p_script, const String &p_activate_nam
push_item(script.operator->());
}
-void EditorNode::_fs_changed() {
+void EditorNode::_resources_changed(const PoolVector<String> &p_resources) {
- for (Set<FileDialog *>::Element *E = file_dialogs.front(); E; E = E->next()) {
+ List<Ref<Resource> > changed;
- E->get()->invalidate();
- }
+ int rc = p_resources.size();
+ for (int i = 0; i < rc; i++) {
- for (Set<EditorFileDialog *>::Element *E = editor_file_dialogs.front(); E; E = E->next()) {
+ Ref<Resource> res(ResourceCache::get(p_resources.get(i)));
+ if (res.is_null()) {
+ continue;
+ }
- E->get()->invalidate();
- }
+ if (!res->editor_can_reload_from_file())
+ continue;
+ if (!res->get_path().is_resource_file() && !res->get_path().is_abs_path())
+ continue;
+ if (!FileAccess::exists(res->get_path()))
+ continue;
- {
- //reload changed resources
- List<Ref<Resource> > changed;
+ if (res->get_import_path() != String()) {
+ //this is an imported resource, will be reloaded if reimported via the _resources_reimported() callback
+ continue;
+ }
- List<Ref<Resource> > cached;
- ResourceCache::get_cached_resources(&cached);
- // FIXME: This should be done in a thread.
- for (List<Ref<Resource> >::Element *E = cached.front(); E; E = E->next()) {
+ changed.push_back(res);
+ }
- if (!E->get()->editor_can_reload_from_file())
- continue;
- if (!E->get()->get_path().is_resource_file() && !E->get()->get_path().is_abs_path())
- continue;
- if (!FileAccess::exists(E->get()->get_path()))
- continue;
+ if (changed.size()) {
+ for (List<Ref<Resource> >::Element *E = changed.front(); E; E = E->next()) {
+ E->get()->reload_from_file();
+ }
+ }
+}
- if (E->get()->get_import_path() != String()) {
- //this is an imported resource, will be reloaded if reimported via the _resources_reimported() callback
- continue;
- }
+void EditorNode::_fs_changed() {
- uint64_t mt = FileAccess::get_modified_time(E->get()->get_path());
+ for (Set<FileDialog *>::Element *E = file_dialogs.front(); E; E = E->next()) {
- if (mt != E->get()->get_last_modified_time()) {
- changed.push_back(E->get());
- }
- }
+ E->get()->invalidate();
+ }
- if (changed.size()) {
- for (List<Ref<Resource> >::Element *E = changed.front(); E; E = E->next()) {
- E->get()->reload_from_file();
- }
- }
+ for (Set<EditorFileDialog *>::Element *E = editor_file_dialogs.front(); E; E = E->next()) {
+
+ E->get()->invalidate();
}
_mark_unsaved_scenes();
@@ -581,13 +572,29 @@ void EditorNode::_editor_select_prev() {
_editor_select(editor);
}
-Error EditorNode::load_resource(const String &p_scene) {
+Error EditorNode::load_resource(const String &p_resource, bool p_ignore_broken_deps) {
+
+ dependency_errors.clear();
- RES res = ResourceLoader::load(p_scene);
+ Error err;
+ RES res = ResourceLoader::load(p_resource, "", false, &err);
ERR_FAIL_COND_V(!res.is_valid(), ERR_CANT_OPEN);
- inspector_dock->edit_resource(res);
+ if (!p_ignore_broken_deps && dependency_errors.has(p_resource)) {
+
+ //current_option = -1;
+ Vector<String> errors;
+ for (Set<String>::Element *E = dependency_errors[p_resource].front(); E; E = E->next()) {
+ errors.push_back(E->get());
+ }
+ dependency_error->show(DependencyErrorDialog::MODE_RESOURCE, p_resource, errors);
+ dependency_errors.erase(p_resource);
+
+ return ERR_FILE_MISSING_DEPENDENCIES;
+ }
+
+ inspector_dock->edit_resource(res);
return OK;
}
@@ -628,6 +635,7 @@ void EditorNode::save_resource(const Ref<Resource> &p_resource) {
void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String &p_at_path) {
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
+ saving_resource = p_resource;
current_option = RESOURCE_SAVE_AS;
List<String> extensions;
@@ -991,6 +999,22 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
EditorResourcePreview::get_singleton()->check_for_invalidation(p_file);
}
+bool EditorNode::_validate_scene_recursive(const String &p_filename, Node *p_node) {
+
+ for (int i = 0; i < p_node->get_child_count(); i++) {
+ Node *child = p_node->get_child(i);
+ if (child->get_filename() == p_filename) {
+ return true;
+ }
+
+ if (_validate_scene_recursive(p_filename, child)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
void EditorNode::_save_scene(String p_file, int idx) {
Node *scene = editor_data.get_edited_scene_root(idx);
@@ -1001,6 +1025,11 @@ void EditorNode::_save_scene(String p_file, int idx) {
return;
}
+ if (scene->get_filename() != String() && _validate_scene_recursive(scene->get_filename(), scene)) {
+ show_accept(TTR("This scene can't be saved because there is a cyclic instancing inclusion.\nPlease resolve it and then attempt to save again."), TTR("OK"));
+ return;
+ }
+
editor_data.apply_changes_in_editors();
_save_default_environment();
@@ -1068,6 +1097,9 @@ void EditorNode::_save_scene(String p_file, int idx) {
set_current_version(editor_data.get_undo_redo().get_version());
else
editor_data.set_edited_scene_version(0, idx);
+
+ editor_folding.save_scene_folding(scene, p_file);
+
_update_title();
_update_scene_tabs();
} else {
@@ -1251,15 +1283,13 @@ void EditorNode::_dialog_action(String p_file) {
case RESOURCE_SAVE:
case RESOURCE_SAVE_AS: {
- uint32_t current = editor_history.get_current();
+ ERR_FAIL_COND(saving_resource.is_null())
+ save_resource_in_path(saving_resource, p_file);
+ saving_resource = Ref<Resource>();
+ ObjectID current = editor_history.get_current();
Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
-
- ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj))
-
- RES current_res = RES(Object::cast_to<Resource>(current_obj));
-
- save_resource_in_path(current_res, p_file);
-
+ ERR_FAIL_COND(!current_obj);
+ current_obj->_change_notify();
} break;
case SETTINGS_LAYOUT_SAVE: {
@@ -1739,13 +1769,13 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case FILE_QUICK_OPEN_SCENE: {
- quick_open->popup("PackedScene", true);
+ quick_open->popup_dialog("PackedScene", true);
quick_open->set_title(TTR("Quick Open Scene..."));
} break;
case FILE_QUICK_OPEN_SCRIPT: {
- quick_open->popup("Script", true);
+ quick_open->popup_dialog("Script", true);
quick_open->set_title(TTR("Quick Open Script..."));
} break;
@@ -1991,7 +2021,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (err != OK)
ERR_PRINT("Failed to load scene");
editor_data.move_edited_scene_to_index(cur_idx);
- get_undo_redo()->clear_history();
+ get_undo_redo()->clear_history(false);
scene_tabs->set_current_tab(cur_idx);
} break;
@@ -2003,7 +2033,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case RUN_PLAY_CUSTOM_SCENE: {
if (run_custom_filename.empty() || editor_run.get_status() == EditorRun::STATUS_STOP) {
_menu_option_confirm(RUN_STOP, true);
- quick_run->popup("PackedScene", true);
+ quick_run->popup_dialog("PackedScene", true);
quick_run->set_title(TTR("Quick Run Scene..."));
play_custom_scene_button->set_pressed(false);
} else {
@@ -2251,14 +2281,11 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file->popup_centered_ratio();
} break;
- 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/");
+ OS::get_singleton()->shell_open("https://docs.godotengine.org/");
} break;
case HELP_QA: {
OS::get_singleton()->shell_open("https://godotengine.org/qa/");
@@ -2558,6 +2585,12 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled)
return;
}
+ //errors in the script cause the base_type to be ""
+ if (String(script->get_instance_base_type()) == "") {
+ show_warning(vformat(TTR("Unable to load addon script from path: '%s' There seems to be an error in the code, please check the syntax."), path));
+ return;
+ }
+
//could check inheritance..
if (String(script->get_instance_base_type()) != "EditorPlugin") {
show_warning(vformat(TTR("Unable to load addon script from path: '%s' Base type is not EditorPlugin."), path));
@@ -2601,7 +2634,7 @@ void EditorNode::_remove_edited_scene() {
}
_scene_tab_changed(new_index);
editor_data.remove_scene(old_index);
- editor_data.get_undo_redo().clear_history();
+ editor_data.get_undo_redo().clear_history(false);
_update_title();
_update_scene_tabs();
}
@@ -2849,7 +2882,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
errors.push_back(E->get());
}
- dependency_error->show(lpath, errors);
+ dependency_error->show(DependencyErrorDialog::MODE_SCENE, lpath, errors);
opening_prev = false;
if (prev != -1) {
@@ -2914,6 +2947,13 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b
_update_scene_tabs();
_add_to_recent_scenes(lpath);
+ if (editor_folding.has_folding_data(lpath)) {
+ editor_folding.load_scene_folding(new_scene, lpath);
+ } else if (EDITOR_GET("interface/inspector/auto_unfold_foreign_scenes")) {
+ editor_folding.unfold_scene(new_scene);
+ editor_folding.save_scene_folding(new_scene, lpath);
+ }
+
prev_scene->set_disabled(previous_scenes.size() == 0);
opening_prev = false;
@@ -3136,34 +3176,33 @@ Ref<Texture> EditorNode::get_object_icon(const Object *p_object, const String &p
script = p_object;
}
- StringName name;
- String icon_path;
if (script.is_valid()) {
- name = EditorNode::get_editor_data().script_class_get_name(script->get_path());
- icon_path = EditorNode::get_editor_data().script_class_get_icon_path(name);
- name = script->get_instance_base_type();
+ StringName name = EditorNode::get_editor_data().script_class_get_name(script->get_path());
+ String icon_path = EditorNode::get_editor_data().script_class_get_icon_path(name);
+ if (icon_path.length())
+ return ResourceLoader::load(icon_path);
+
+ // should probably be deprecated in 4.x
+ StringName base = script->get_instance_base_type();
+ if (base != StringName()) {
+ const Map<String, Vector<EditorData::CustomType> > &p_map = EditorNode::get_editor_data().get_custom_types();
+ for (const Map<String, Vector<EditorData::CustomType> >::Element *E = p_map.front(); E; E = E->next()) {
+ const Vector<EditorData::CustomType> &ct = E->value();
+ for (int i = 0; i < ct.size(); ++i) {
+ if (ct[i].name == base && ct[i].icon.is_valid()) {
+ return ct[i].icon;
+ }
+ }
+ }
+ }
}
- if (gui_base->has_icon(p_object->get_class(), "EditorIcons"))
- return gui_base->get_icon(p_object->get_class(), "EditorIcons");
-
- if (icon_path.length())
- return ResourceLoader::load(icon_path);
-
+ // should probably be deprecated in 4.x
if (p_object->has_meta("_editor_icon"))
return p_object->get_meta("_editor_icon");
- if (name != StringName()) {
- const Map<String, Vector<EditorData::CustomType> > &p_map = EditorNode::get_editor_data().get_custom_types();
- for (const Map<String, Vector<EditorData::CustomType> >::Element *E = p_map.front(); E; E = E->next()) {
- const Vector<EditorData::CustomType> &ct = E->value();
- for (int i = 0; i < ct.size(); ++i) {
- if (ct[i].name == name && ct[i].icon.is_valid()) {
- return ct[i].icon;
- }
- }
- }
- }
+ if (gui_base->has_icon(p_object->get_class(), "EditorIcons"))
+ return gui_base->get_icon(p_object->get_class(), "EditorIcons");
if (p_fallback.length())
return gui_base->get_icon(p_fallback, "EditorIcons");
@@ -3202,7 +3241,7 @@ Ref<Texture> EditorNode::get_class_icon(const String &p_class, const String &p_f
}
}
- if (p_fallback.length())
+ if (p_fallback.length() && gui_base->has_icon(p_fallback, "EditorIcons"))
return gui_base->get_icon(p_fallback, "EditorIcons");
return NULL;
@@ -3210,17 +3249,31 @@ Ref<Texture> EditorNode::get_class_icon(const String &p_class, const String &p_f
void EditorNode::progress_add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) {
- singleton->progress_dialog->add_task(p_task, p_label, p_steps, p_can_cancel);
+ if (singleton->disable_progress_dialog) {
+ print_line(p_task + ": begin: " + p_label + " steps: " + itos(p_steps));
+ } else {
+ singleton->progress_dialog->add_task(p_task, p_label, p_steps, p_can_cancel);
+ }
}
bool EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_refresh) {
- return singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_refresh);
+ if (singleton->disable_progress_dialog) {
+ print_line("\t" + p_task + ": step " + itos(p_step) + ": " + p_state);
+ return false;
+ } else {
+
+ return singleton->progress_dialog->task_step(p_task, p_state, p_step, p_force_refresh);
+ }
}
void EditorNode::progress_end_task(const String &p_task) {
- singleton->progress_dialog->end_task(p_task);
+ if (singleton->disable_progress_dialog) {
+ print_line(p_task + ": end");
+ } else {
+ singleton->progress_dialog->end_task(p_task);
+ }
}
void EditorNode::progress_add_task_bg(const String &p_task, const String &p_label, int p_steps) {
@@ -3302,7 +3355,7 @@ Error EditorNode::export_preset(const String &p_preset, const String &p_path, bo
export_defer.path = p_path;
export_defer.debug = p_debug;
export_defer.password = p_password;
-
+ disable_progress_dialog = true;
return OK;
}
@@ -3908,7 +3961,7 @@ void EditorNode::_scene_tab_closed(int p_tab) {
}
void EditorNode::_scene_tab_hover(int p_tab) {
- if (bool(EDITOR_GET("interface/scene_tabs/show_thumbnail_on_hover")) == false) {
+ if (!bool(EDITOR_GET("interface/scene_tabs/show_thumbnail_on_hover"))) {
return;
}
int current_tab = scene_tabs->get_current_tab();
@@ -3917,7 +3970,9 @@ void EditorNode::_scene_tab_hover(int p_tab) {
tab_preview_panel->hide();
} else {
String path = editor_data.get_scene_path(p_tab);
- EditorResourcePreview::get_singleton()->queue_resource_preview(path, this, "_thumbnail_done", p_tab);
+ if (path != String()) {
+ EditorResourcePreview::get_singleton()->queue_resource_preview(path, this, "_thumbnail_done", p_tab);
+ }
}
}
@@ -3953,7 +4008,7 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) {
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/save_all_scenes"), FILE_SAVE_ALL_SCENES);
if (scene_tabs->get_hovered_tab() >= 0) {
scene_tabs_context_menu->add_separator();
- scene_tabs_context_menu->add_item(TTR("Show in filesystem"), FILE_SHOW_IN_FILESYSTEM);
+ scene_tabs_context_menu->add_item(TTR("Show in FileSystem"), FILE_SHOW_IN_FILESYSTEM);
scene_tabs_context_menu->add_item(TTR("Play This Scene"), RUN_PLAY_SCENE);
scene_tabs_context_menu->add_item(TTR("Close Tab"), FILE_CLOSE);
}
@@ -4541,6 +4596,16 @@ void EditorNode::_bottom_panel_raise_toggled(bool p_pressed) {
}
}
+void EditorNode::_update_video_driver_color() {
+
+ //todo probably should de-harcode this and add to editor settings
+ if (video_driver->get_text() == "GLES2") {
+ video_driver->add_color_override("font_color", Color::hex(0x5586a4ff));
+ } else if (video_driver->get_text() == "GLES3") {
+ video_driver->add_color_override("font_color", Color::hex(0xa5557dff));
+ }
+}
+
void EditorNode::_video_driver_selected(int p_which) {
String driver = video_driver->get_item_metadata(p_which);
@@ -4554,6 +4619,20 @@ void EditorNode::_video_driver_selected(int p_which) {
video_driver_request = driver;
video_restart_dialog->popup_centered_minsize();
video_driver->select(video_driver_current);
+ _update_video_driver_color();
+}
+
+void EditorNode::_resource_saved(RES p_resource, const String &p_path) {
+ if (EditorFileSystem::get_singleton()) {
+ EditorFileSystem::get_singleton()->update_file(p_path);
+ }
+
+ singleton->editor_folding.save_resource_folding(p_resource, p_path);
+}
+
+void EditorNode::_resource_loaded(RES p_resource, const String &p_path) {
+
+ singleton->editor_folding.load_resource_folding(p_resource, p_path);
}
void EditorNode::_bind_methods() {
@@ -4630,11 +4709,12 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("_video_driver_selected"), &EditorNode::_video_driver_selected);
+ ClassDB::bind_method(D_METHOD("_resources_changed"), &EditorNode::_resources_changed);
+
ADD_SIGNAL(MethodInfo("play_pressed"));
ADD_SIGNAL(MethodInfo("pause_pressed"));
ADD_SIGNAL(MethodInfo("stop_pressed"));
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")));
}
@@ -4683,7 +4763,7 @@ EditorNode::EditorNode() {
_initializing_addons = false;
docks_visible = true;
restoring_scenes = false;
-
+ disable_progress_dialog = false;
scene_distraction = false;
script_distraction = false;
@@ -4856,8 +4936,9 @@ EditorNode::EditorNode() {
EDITOR_DEF_RST("interface/scene_tabs/show_thumbnail_on_hover", true);
EDITOR_DEF_RST("interface/inspector/capitalize_properties", true);
EDITOR_DEF_RST("interface/inspector/disable_folding", false);
+ EDITOR_DEF_RST("interface/inspector/auto_unfold_foreign_scenes", true);
EDITOR_DEF("interface/inspector/horizontal_vector2_editing", false);
- EDITOR_DEF("interface/inspector/horizontal_vector3_editing", true);
+ EDITOR_DEF("interface/inspector/horizontal_vector_types_editing", true);
EDITOR_DEF("interface/inspector/open_resources_in_current_inspector", true);
EDITOR_DEF("interface/inspector/resources_types_to_open_in_new_inspector", "SpatialMaterial,Script");
EDITOR_DEF("run/auto_save/save_before_running", true);
@@ -4995,7 +5076,7 @@ EditorNode::EditorNode() {
dock_select_rect_over = -1;
dock_popup_selected = -1;
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
- dock_slot[i]->set_custom_minimum_size(Size2(230, 220) * EDSCALE);
+ dock_slot[i]->set_custom_minimum_size(Size2(170, 0) * EDSCALE);
dock_slot[i]->set_v_size_flags(Control::SIZE_EXPAND_FILL);
dock_slot[i]->set_popup(dock_select_popup);
dock_slot[i]->connect("pre_popup_pressed", this, "_dock_pre_popup", varray(i));
@@ -5172,7 +5253,7 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/save_scene", TTR("Save Scene"), KEY_MASK_CMD + KEY_S), FILE_SAVE_SCENE);
p->add_shortcut(ED_SHORTCUT("editor/save_scene_as", TTR("Save Scene As..."), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_S), FILE_SAVE_AS_SCENE);
- p->add_shortcut(ED_SHORTCUT("editor/save_all_scenes", TTR("Save all Scenes"), KEY_MASK_ALT + KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_S), FILE_SAVE_ALL_SCENES);
+ p->add_shortcut(ED_SHORTCUT("editor/save_all_scenes", TTR("Save All Scenes"), KEY_MASK_ALT + KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_S), FILE_SAVE_ALL_SCENES);
p->add_separator();
p->add_shortcut(ED_SHORTCUT("editor/close_scene", TTR("Close Scene"), KEY_MASK_SHIFT + KEY_MASK_CMD + KEY_W), FILE_CLOSE);
p->add_separator();
@@ -5263,10 +5344,13 @@ EditorNode::EditorNode() {
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();
+ //those are now on by default, since they are harmless
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->set_item_checked(p->get_item_count() - 1, true);
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->set_item_checked(p->get_item_count() - 1, true);
p->connect("id_pressed", this, "_menu_option");
menu_hb->add_spacer();
@@ -5316,8 +5400,7 @@ EditorNode::EditorNode() {
p = help_menu->get_popup();
p->set_hide_on_window_lose_focus(true);
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_icon_shortcut(gui_base->get_icon("HelpSearch", "EditorIcons"), ED_SHORTCUT("editor/editor_help", TTR("Search"), KEY_F4), 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);
@@ -5416,6 +5499,7 @@ EditorNode::EditorNode() {
video_driver->set_focus_mode(Control::FOCUS_NONE);
video_driver->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
video_driver->connect("item_selected", this, "_video_driver_selected");
+ video_driver->add_font_override("font", gui_base->get_font("bold", "EditorFonts"));
menu_hb->add_child(video_driver);
String video_drivers = ProjectSettings::get_singleton()->get_custom_property_info()["rendering/quality/driver/driver_name"].hint_string;
@@ -5432,6 +5516,8 @@ EditorNode::EditorNode() {
}
}
+ _update_video_driver_color();
+
video_restart_dialog = memnew(ConfirmationDialog);
video_restart_dialog->set_text(TTR("Changing the video driver requires restarting the editor."));
video_restart_dialog->get_ok()->set_text(TTR("Save & Restart"));
@@ -5508,8 +5594,8 @@ EditorNode::EditorNode() {
right_r_vsplit->hide();
// Add some offsets to left_r and main hsplits to make LEFT_R and RIGHT_L docks wider than minsize
- left_r_hsplit->set_split_offset(40 * EDSCALE);
- main_hsplit->set_split_offset(-40 * EDSCALE);
+ left_r_hsplit->set_split_offset(70 * EDSCALE);
+ main_hsplit->set_split_offset(-70 * EDSCALE);
// Define corresponding default layout
@@ -5524,8 +5610,8 @@ EditorNode::EditorNode() {
for (int i = 0; i < vsplits.size(); i++)
default_layout->set_value(docks_section, "dock_split_" + itos(i + 1), 0);
default_layout->set_value(docks_section, "dock_hsplit_1", 0);
- default_layout->set_value(docks_section, "dock_hsplit_2", 40 * EDSCALE);
- default_layout->set_value(docks_section, "dock_hsplit_3", -40 * EDSCALE);
+ default_layout->set_value(docks_section, "dock_hsplit_2", 70 * EDSCALE);
+ default_layout->set_value(docks_section, "dock_hsplit_3", -70 * EDSCALE);
default_layout->set_value(docks_section, "dock_hsplit_4", 0);
_update_layouts_menu();
@@ -5749,6 +5835,7 @@ EditorNode::EditorNode() {
_edit_current();
current = NULL;
+ saving_resource = Ref<Resource>();
reference_resource_mem = true;
save_external_resources_mem = true;
@@ -5791,6 +5878,7 @@ EditorNode::EditorNode() {
EditorFileSystem::get_singleton()->connect("sources_changed", this, "_sources_changed");
EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_fs_changed");
EditorFileSystem::get_singleton()->connect("resources_reimported", this, "_resources_reimported");
+ EditorFileSystem::get_singleton()->connect("resources_reload", this, "_resources_changed");
_build_icon_type_cache();
@@ -5838,6 +5926,9 @@ EditorNode::EditorNode() {
print_handler.userdata = this;
add_print_handler(&print_handler);
+ ResourceSaver::set_save_callback(_resource_saved);
+ ResourceLoader::set_load_callback(_resource_loaded);
+
#ifdef OSX_ENABLED
ED_SHORTCUT("editor/editor_2d", TTR("Open 2D Editor"), KEY_MASK_ALT | KEY_1);
ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_MASK_ALT | KEY_2);
@@ -5866,6 +5957,7 @@ EditorNode::~EditorNode() {
memdelete(editor_plugins_force_input_forwarding);
memdelete(file_server);
memdelete(progress_hb);
+
EditorSettings::destroy();
}