diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 47b5fa4d1a..6899a35ded 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -175,7 +175,7 @@ static const String REMOVE_ANDROID_BUILD_TEMPLATE_MESSAGE = "The Android build t static const String INSTALL_ANDROID_BUILD_TEMPLATE_MESSAGE = "This will set up your project for gradle Android builds by installing the source template to \"%s\".\nNote that in order to make gradle builds instead of using pre-built APKs, the \"Use Gradle Build\" option should be enabled in the Android export preset."; bool EditorProgress::step(const String &p_state, int p_step, bool p_force_refresh) { - if (Thread::is_main_thread()) { + if (!force_background && Thread::is_main_thread()) { return EditorNode::progress_task_step(task, p_state, p_step, p_force_refresh); } else { EditorNode::progress_task_step_bg(task, p_step); @@ -183,17 +183,18 @@ bool EditorProgress::step(const String &p_state, int p_step, bool p_force_refres } } -EditorProgress::EditorProgress(const String &p_task, const String &p_label, int p_amount, bool p_can_cancel) { - if (Thread::is_main_thread()) { +EditorProgress::EditorProgress(const String &p_task, const String &p_label, int p_amount, bool p_can_cancel, bool p_force_background) { + if (!p_force_background && Thread::is_main_thread()) { EditorNode::progress_add_task(p_task, p_label, p_amount, p_can_cancel); } else { EditorNode::progress_add_task_bg(p_task, p_label, p_amount); } task = p_task; + force_background = p_force_background; } EditorProgress::~EditorProgress() { - if (Thread::is_main_thread()) { + if (!force_background && Thread::is_main_thread()) { EditorNode::progress_end_task(task); } else { EditorNode::progress_end_task_bg(task); @@ -824,6 +825,7 @@ void EditorNode::_notification(int p_what) { if (EditorSettings::get_singleton()->check_changed_settings_in_group("docks/filesystem")) { HashSet<String> updated_textfile_extensions; + HashSet<String> updated_other_file_extensions; bool extensions_match = true; const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); for (const String &E : textfile_ext) { @@ -832,9 +834,17 @@ void EditorNode::_notification(int p_what) { extensions_match = false; } } + const Vector<String> other_file_ext = ((String)(EDITOR_GET("docks/filesystem/other_file_extensions"))).split(",", false); + for (const String &E : other_file_ext) { + updated_other_file_extensions.insert(E); + if (extensions_match && !other_file_extensions.has(E)) { + extensions_match = false; + } + } - if (!extensions_match || updated_textfile_extensions.size() < textfile_extensions.size()) { + if (!extensions_match || updated_textfile_extensions.size() < textfile_extensions.size() || updated_other_file_extensions.size() < other_file_extensions.size()) { textfile_extensions = updated_textfile_extensions; + other_file_extensions = updated_other_file_extensions; EditorFileSystem::get_singleton()->scan(); } } @@ -1325,6 +1335,9 @@ Error EditorNode::load_resource(const String &p_resource, bool p_ignore_broken_d res = ResourceLoader::load(p_resource, "", ResourceFormatLoader::CACHE_MODE_REUSE, &err); } else if (textfile_extensions.has(p_resource.get_extension())) { res = ScriptEditor::get_singleton()->open_file(p_resource); + } else if (other_file_extensions.has(p_resource.get_extension())) { + OS::get_singleton()->shell_open(ProjectSettings::get_singleton()->globalize_path(p_resource)); + return OK; } ERR_FAIL_COND_V(!res.is_valid(), ERR_CANT_OPEN); @@ -5239,8 +5252,8 @@ void EditorNode::_copy_warning(const String &p_str) { } void EditorNode::_save_editor_layout() { - if (waiting_for_first_scan) { - return; // Scanning, do not touch docks. + if (!load_editor_layout_done) { + return; } Ref<ConfigFile> config; config.instantiate(); @@ -5296,22 +5309,22 @@ void EditorNode::_load_editor_layout() { if (overridden_default_layout >= 0) { _layout_menu_option(overridden_default_layout); } - return; - } - - ep.step(TTR("Loading docks..."), 1, true); - editor_dock_manager->load_docks_from_config(config, "docks"); + } else { + ep.step(TTR("Loading docks..."), 1, true); + editor_dock_manager->load_docks_from_config(config, "docks"); - ep.step(TTR("Reopening scenes..."), 2, true); - _load_open_scenes_from_config(config); + ep.step(TTR("Reopening scenes..."), 2, true); + _load_open_scenes_from_config(config); - ep.step(TTR("Loading central editor layout..."), 3, true); - _load_central_editor_layout_from_config(config); + ep.step(TTR("Loading central editor layout..."), 3, true); + _load_central_editor_layout_from_config(config); - ep.step(TTR("Loading plugin window layout..."), 4, true); - editor_data.set_plugin_window_layout(config); + ep.step(TTR("Loading plugin window layout..."), 4, true); + editor_data.set_plugin_window_layout(config); - ep.step(TTR("Editor layout ready."), 5, true); + ep.step(TTR("Editor layout ready."), 5, true); + } + load_editor_layout_done = true; } void EditorNode::_save_central_editor_layout_to_config(Ref<ConfigFile> p_config_file) { @@ -6979,6 +6992,10 @@ EditorNode::EditorNode() { for (const String &E : textfile_ext) { textfile_extensions.insert(E); } + const Vector<String> other_file_ext = ((String)(EDITOR_GET("docks/filesystem/other_file_extensions"))).split(",", false); + for (const String &E : other_file_ext) { + other_file_extensions.insert(E); + } resource_preview = memnew(EditorResourcePreview); add_child(resource_preview); |