From 143d8c87bb4c004c0078c5db93e57f89338ff133 Mon Sep 17 00:00:00 2001 From: demolke Date: Sat, 30 Nov 2024 00:05:05 +0100 Subject: [PATCH] Move reimport check to EditorImportPlugin reimport_append is used by gltf_document, fbx_document and editor_import_plugin. The first two will never call it when importing == false. It's only the editor_import_plugin that should guard against that. https://docs.godotengine.org/en/stable/classes/class_editorimportplugin.html#class-editorimportplugin-method-append-import-external-resource The motivation of removing the check from gltf_document call path is to be able to test nested imports (texture embedded in gltf). --- editor/editor_file_system.cpp | 1 - editor/import/editor_import_plugin.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 4911d5c702d..b3abbb9e70f 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -3205,7 +3205,6 @@ void EditorFileSystem::reimport_files(const Vector &p_files) { } Error EditorFileSystem::reimport_append(const String &p_file, const HashMap &p_custom_options, const String &p_custom_importer, Variant p_generator_parameters) { - ERR_FAIL_COND_V_MSG(!importing, ERR_INVALID_PARAMETER, "Can only append files to import during a current reimport process."); Vector reloads; reloads.append(p_file); diff --git a/editor/import/editor_import_plugin.cpp b/editor/import/editor_import_plugin.cpp index 27b59d3bef5..82710103e1f 100644 --- a/editor/import/editor_import_plugin.cpp +++ b/editor/import/editor_import_plugin.cpp @@ -214,6 +214,7 @@ Error EditorImportPlugin::_append_import_external_resource(const String &p_file, } Error EditorImportPlugin::append_import_external_resource(const String &p_file, const HashMap &p_custom_options, const String &p_custom_importer, Variant p_generator_parameters) { + ERR_FAIL_COND_V_MSG(!EditorFileSystem::get_singleton()->is_importing(), ERR_INVALID_PARAMETER, "Can only append files to import during a current reimport process."); return EditorFileSystem::get_singleton()->reimport_append(p_file, p_custom_options, p_custom_importer, p_generator_parameters); }