diff options
-rw-r--r-- | core/io/resource_loader.cpp | 14 | ||||
-rw-r--r-- | editor/editor_file_system.cpp | 14 | ||||
-rw-r--r-- | editor/editor_settings.cpp | 10 | ||||
-rw-r--r-- | editor/editor_settings.h | 3 | ||||
-rw-r--r-- | editor/import/3d/resource_importer_scene.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | platform/android/audio_driver_opensl.cpp | 35 | ||||
-rw-r--r-- | platform/android/audio_driver_opensl.h | 18 | ||||
-rw-r--r-- | platform/web/js/libs/library_godot_audio.js | 4 | ||||
-rw-r--r-- | platform/windows/display_server_windows.cpp | 7 | ||||
-rw-r--r-- | platform/windows/display_server_windows.h | 1 | ||||
-rw-r--r-- | platform/windows/gl_manager_windows_angle.cpp | 5 | ||||
-rw-r--r-- | platform/windows/gl_manager_windows_angle.h | 2 |
13 files changed, 99 insertions, 19 deletions
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index d606db620c..2b5e83264e 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -345,7 +345,14 @@ void ResourceLoader::_thread_load_function(void *p_userdata) { bool ignoring = load_task.cache_mode == ResourceFormatLoader::CACHE_MODE_IGNORE || load_task.cache_mode == ResourceFormatLoader::CACHE_MODE_IGNORE_DEEP; bool replacing = load_task.cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE || load_task.cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE_DEEP; + bool unlock_pending = true; if (load_task.resource.is_valid()) { + // From now on, no critical section needed as no one will write to the task anymore. + // Moreover, the mutex being unlocked is a requirement if some of the calls below + // that set the resource up invoke code that in turn requests resource loading. + thread_load_mutex.unlock(); + unlock_pending = false; + if (!ignoring) { if (replacing) { Ref<Resource> old_res = ResourceCache::get_ref(load_task.local_path); @@ -383,13 +390,18 @@ void ResourceLoader::_thread_load_function(void *p_userdata) { load_task.status = THREAD_LOAD_LOADED; load_task.progress = 1.0; + thread_load_mutex.unlock(); + unlock_pending = false; + if (_loaded_callback) { _loaded_callback(load_task.resource, load_task.local_path); } } } - thread_load_mutex.unlock(); + if (unlock_pending) { + thread_load_mutex.unlock(); + } if (load_nesting == 0) { if (own_mq_override) { diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 412d60f931..a99e1dc731 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -438,7 +438,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo Error err; Ref<FileAccess> f = FileAccess::open(p_path + ".import", FileAccess::READ, &err); - if (f.is_null()) { //no import file, do reimport + if (f.is_null()) { // No import file, reimport. return true; } @@ -472,10 +472,15 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo break; } else if (err != OK) { ERR_PRINT("ResourceFormatImporter::load - '" + p_path + ".import:" + itos(lines) + "' error '" + error_text + "'."); - return false; //parse error, try reimport manually (Avoid reimport loop on broken file) + // Parse error, skip and let user attempt manual reimport to avoid reimport loop. + return false; } if (!assign.is_empty()) { + if (assign == "valid" && value.operator bool() == false) { + // Invalid import (failed previous import), skip and let user attempt manual reimport to avoid reimport loop. + return false; + } if (assign.begins_with("path")) { to_check.push_back(value); } else if (assign == "files") { @@ -502,6 +507,11 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo } } + if (!ResourceFormatImporter::get_singleton()->are_import_settings_valid(p_path)) { + // Reimport settings are out of sync with project settings, reimport. + return true; + } + if (importer_name == "keep" || importer_name == "skip") { return false; //keep mode, do not reimport } diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 1cf3a4e0c4..0956d12236 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -998,6 +998,13 @@ const String EditorSettings::_get_project_metadata_path() const { return EditorPaths::get_singleton()->get_project_settings_dir().path_join("project_metadata.cfg"); } +#ifndef DISABLE_DEPRECATED +void EditorSettings::_remove_deprecated_settings() { + erase("run/output/always_open_output_on_play"); + erase("run/output/always_close_output_on_stop"); +} +#endif + // PUBLIC METHODS EditorSettings *EditorSettings::get_singleton() { @@ -1078,6 +1085,9 @@ void EditorSettings::create() { singleton->setup_network(); singleton->load_favorites_and_recent_dirs(); singleton->list_text_editor_themes(); +#ifndef DISABLE_DEPRECATED + singleton->_remove_deprecated_settings(); +#endif return; } diff --git a/editor/editor_settings.h b/editor/editor_settings.h index 6a329f6979..62ac0c60f3 100644 --- a/editor/editor_settings.h +++ b/editor/editor_settings.h @@ -114,6 +114,9 @@ private: bool _save_text_editor_theme(const String &p_file); bool _is_default_text_editor_theme(const String &p_theme_name); const String _get_project_metadata_path() const; +#ifndef DISABLE_DEPRECATED + void _remove_deprecated_settings(); +#endif protected: static void _bind_methods(); diff --git a/editor/import/3d/resource_importer_scene.cpp b/editor/import/3d/resource_importer_scene.cpp index 5ee4322a22..df4026195c 100644 --- a/editor/import/3d/resource_importer_scene.cpp +++ b/editor/import/3d/resource_importer_scene.cpp @@ -2806,6 +2806,7 @@ Node *ResourceImporterScene::pre_import(const String &p_source_file, const HashM } ERR_FAIL_COND_V(!importer.is_valid(), nullptr); + ERR_FAIL_COND_V(p_options.is_empty(), nullptr); Error err = OK; @@ -2864,6 +2865,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p } ERR_FAIL_COND_V(!importer.is_valid(), ERR_FILE_UNRECOGNIZED); + ERR_FAIL_COND_V(p_options.is_empty(), ERR_BUG); int import_flags = 0; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index bd720cde93..59a4ac8075 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -1051,6 +1051,9 @@ void Node3DEditorViewport::_select_region() { Vector<Node *> selected; Node *edited_scene = get_tree()->get_edited_scene_root(); + if (edited_scene == nullptr) { + return; + } for (int i = 0; i < instances.size(); i++) { Node3D *sp = Object::cast_to<Node3D>(ObjectDB::get_instance(instances[i])); diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp index 51e89c720d..ef9c51db07 100644 --- a/platform/android/audio_driver_opensl.cpp +++ b/platform/android/audio_driver_opensl.cpp @@ -268,6 +268,10 @@ Error AudioDriverOpenSL::init_input_device() { } Error AudioDriverOpenSL::input_start() { + if (recordItf || recordBufferQueueItf) { + return ERR_ALREADY_IN_USE; + } + if (OS::get_singleton()->request_permission("RECORD_AUDIO")) { return init_input_device(); } @@ -277,6 +281,10 @@ Error AudioDriverOpenSL::input_start() { } Error AudioDriverOpenSL::input_stop() { + if (!recordItf || !recordBufferQueueItf) { + return ERR_CANT_OPEN; + } + SLuint32 state; SLresult res = (*recordItf)->GetRecordState(recordItf, &state); ERR_FAIL_COND_V(res != SL_RESULT_SUCCESS, ERR_CANT_OPEN); @@ -313,13 +321,36 @@ void AudioDriverOpenSL::unlock() { } void AudioDriverOpenSL::finish() { - (*sl)->Destroy(sl); + if (recordItf) { + (*recordItf)->SetRecordState(recordItf, SL_RECORDSTATE_STOPPED); + recordItf = nullptr; + } + if (recorder) { + (*recorder)->Destroy(recorder); + recorder = nullptr; + } + if (playItf) { + (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_STOPPED); + playItf = nullptr; + } + if (player) { + (*player)->Destroy(player); + player = nullptr; + } + if (OutputMix) { + (*OutputMix)->Destroy(OutputMix); + OutputMix = nullptr; + } + if (sl) { + (*sl)->Destroy(sl); + sl = nullptr; + } } void AudioDriverOpenSL::set_pause(bool p_pause) { pause = p_pause; - if (active) { + if (active && playItf) { if (pause) { (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PAUSED); } else { diff --git a/platform/android/audio_driver_opensl.h b/platform/android/audio_driver_opensl.h index 6ea0f77def..bcd173826a 100644 --- a/platform/android/audio_driver_opensl.h +++ b/platform/android/audio_driver_opensl.h @@ -54,15 +54,15 @@ class AudioDriverOpenSL : public AudioDriver { Vector<int16_t> rec_buffer; - SLPlayItf playItf; - SLRecordItf recordItf; - SLObjectItf sl; - SLEngineItf EngineItf; - SLObjectItf OutputMix; - SLObjectItf player; - SLObjectItf recorder; - SLAndroidSimpleBufferQueueItf bufferQueueItf; - SLAndroidSimpleBufferQueueItf recordBufferQueueItf; + SLPlayItf playItf = nullptr; + SLRecordItf recordItf = nullptr; + SLObjectItf sl = nullptr; + SLEngineItf EngineItf = nullptr; + SLObjectItf OutputMix = nullptr; + SLObjectItf player = nullptr; + SLObjectItf recorder = nullptr; + SLAndroidSimpleBufferQueueItf bufferQueueItf = nullptr; + SLAndroidSimpleBufferQueueItf recordBufferQueueItf = nullptr; SLDataSource audioSource; SLDataFormat_PCM pcm; SLDataSink audioSink; diff --git a/platform/web/js/libs/library_godot_audio.js b/platform/web/js/libs/library_godot_audio.js index f1f02df985..8b7c572196 100644 --- a/platform/web/js/libs/library_godot_audio.js +++ b/platform/web/js/libs/library_godot_audio.js @@ -630,7 +630,9 @@ class SampleNode { * @returns {void} */ _restart() { - this._source.disconnect(); + if (this._source != null) { + this._source.disconnect(); + } this._source = GodotAudio.ctx.createBufferSource(); this._source.buffer = this.getSample().getAudioBuffer(); diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 44097b7fc9..36f3f632d5 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -4852,16 +4852,16 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA rect_changed = true; } #if defined(RD_ENABLED) - if (rendering_context && window.context_created) { + if (window.create_completed && rendering_context && window.context_created) { // Note: Trigger resize event to update swapchains when window is minimized/restored, even if size is not changed. rendering_context->window_set_size(window_id, window.width, window.height); } #endif #if defined(GLES3_ENABLED) - if (gl_manager_native) { + if (window.create_completed && gl_manager_native) { gl_manager_native->window_resize(window_id, window.width, window.height); } - if (gl_manager_angle) { + if (window.create_completed && gl_manager_angle) { gl_manager_angle->window_resize(window_id, window.width, window.height); } #endif @@ -5590,6 +5590,7 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode, SetWindowPos(wd.hWnd, HWND_TOP, srect.position.x, srect.position.y, srect.size.width, srect.size.height, SWP_NOZORDER | SWP_NOACTIVATE); } + wd.create_completed = true; window_id_counter++; } diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index 7b259def14..de5b813953 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -441,6 +441,7 @@ class DisplayServerWindows : public DisplayServer { Vector<Vector2> mpath; + bool create_completed = false; bool pre_fs_valid = false; RECT pre_fs_rect; bool maximized = false; diff --git a/platform/windows/gl_manager_windows_angle.cpp b/platform/windows/gl_manager_windows_angle.cpp index 3086edc7f2..c52564676f 100644 --- a/platform/windows/gl_manager_windows_angle.cpp +++ b/platform/windows/gl_manager_windows_angle.cpp @@ -67,4 +67,9 @@ Vector<EGLint> GLManagerANGLE_Windows::_get_platform_context_attribs() const { return ret; } +void GLManagerANGLE_Windows::window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height) { + window_make_current(p_window_id); + eglWaitNative(EGL_CORE_NATIVE_ENGINE); +} + #endif // WINDOWS_ENABLED && GLES3_ENABLED diff --git a/platform/windows/gl_manager_windows_angle.h b/platform/windows/gl_manager_windows_angle.h index d8dc651cfd..f43a6fbe02 100644 --- a/platform/windows/gl_manager_windows_angle.h +++ b/platform/windows/gl_manager_windows_angle.h @@ -50,7 +50,7 @@ private: virtual Vector<EGLint> _get_platform_context_attribs() const override; public: - void window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height) {} + void window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height); GLManagerANGLE_Windows(){}; ~GLManagerANGLE_Windows(){}; |