Skip to content

Commit 50eee00

Browse files
committed
Merge pull request godotengine#94093 from Yahkub-R/94056-fix
Fix instanced .blend/GLTF scenes lose all children after update until .tscn is reopened
2 parents f135f72 + 66822a8 commit 50eee00

File tree

4 files changed

+239
-81
lines changed

4 files changed

+239
-81
lines changed

doc/classes/EditorFileSystem.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@
8484
Emitted if a resource is reimported.
8585
</description>
8686
</signal>
87+
<signal name="resources_reimporting">
88+
<param index="0" name="resources" type="PackedStringArray" />
89+
<description>
90+
Emitted before a resource is reimported.
91+
</description>
92+
</signal>
8793
<signal name="resources_reload">
8894
<param index="0" name="resources" type="PackedStringArray" />
8995
<description>

editor/editor_file_system.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2603,11 +2603,15 @@ void EditorFileSystem::_find_group_files(EditorFileSystemDirectory *efd, HashMap
26032603
}
26042604

26052605
void EditorFileSystem::reimport_file_with_custom_parameters(const String &p_file, const String &p_importer, const HashMap<StringName, Variant> &p_custom_params) {
2606+
Vector<String> reloads;
2607+
reloads.append(p_file);
2608+
2609+
// Emit the resource_reimporting signal for the single file before the actual importation.
2610+
emit_signal(SNAME("resources_reimporting"), reloads);
2611+
26062612
_reimport_file(p_file, p_custom_params, p_importer);
26072613

26082614
// Emit the resource_reimported signal for the single file we just reimported.
2609-
Vector<String> reloads;
2610-
reloads.append(p_file);
26112615
emit_signal(SNAME("resources_reimported"), reloads);
26122616
}
26132617

@@ -2669,6 +2673,9 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
26692673

26702674
reimport_files.sort();
26712675

2676+
// Emit the resource_reimporting signal for the single file before the actual importation.
2677+
emit_signal(SNAME("resources_reimporting"), reloads);
2678+
26722679
#ifdef THREADS_ENABLED
26732680
bool use_multiple_threads = GLOBAL_GET("editor/import/use_multiple_threads");
26742681
#else
@@ -2763,11 +2770,15 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
27632770

27642771
Error EditorFileSystem::reimport_append(const String &p_file, const HashMap<StringName, Variant> &p_custom_options, const String &p_custom_importer, Variant p_generator_parameters) {
27652772
ERR_FAIL_COND_V_MSG(!importing, ERR_INVALID_PARAMETER, "Can only append files to import during a current reimport process.");
2773+
Vector<String> reloads;
2774+
reloads.append(p_file);
2775+
2776+
// Emit the resource_reimporting signal for the single file before the actual importation.
2777+
emit_signal(SNAME("resources_reimporting"), reloads);
2778+
27662779
Error ret = _reimport_file(p_file, p_custom_options, p_custom_importer, &p_generator_parameters);
27672780

27682781
// Emit the resource_reimported signal for the single file we just reimported.
2769-
Vector<String> reloads;
2770-
reloads.append(p_file);
27712782
emit_signal(SNAME("resources_reimported"), reloads);
27722783
return ret;
27732784
}
@@ -2967,6 +2978,7 @@ void EditorFileSystem::_bind_methods() {
29672978
ADD_SIGNAL(MethodInfo("filesystem_changed"));
29682979
ADD_SIGNAL(MethodInfo("script_classes_updated"));
29692980
ADD_SIGNAL(MethodInfo("sources_changed", PropertyInfo(Variant::BOOL, "exist")));
2981+
ADD_SIGNAL(MethodInfo("resources_reimporting", PropertyInfo(Variant::PACKED_STRING_ARRAY, "resources")));
29702982
ADD_SIGNAL(MethodInfo("resources_reimported", PropertyInfo(Variant::PACKED_STRING_ARRAY, "resources")));
29712983
ADD_SIGNAL(MethodInfo("resources_reload", PropertyInfo(Variant::PACKED_STRING_ARRAY, "resources")));
29722984
}

0 commit comments

Comments
 (0)