Skip to content

Commit 66822a8

Browse files
yahkrKoBeWiAThousandShipsHilderin
committed
Fix instanced .blend/GLTF scenes lose all children after update until .tscn is reopened
Co-Authored-By: Tomek <[email protected]> Co-Authored-By: A Thousand Ships <[email protected]> Co-Authored-By: Hilderin <[email protected]>
1 parent 383a6e4 commit 66822a8

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
@@ -2605,11 +2605,15 @@ void EditorFileSystem::_find_group_files(EditorFileSystemDirectory *efd, HashMap
26052605
}
26062606

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

26102616
// Emit the resource_reimported signal for the single file we just reimported.
2611-
Vector<String> reloads;
2612-
reloads.append(p_file);
26132617
emit_signal(SNAME("resources_reimported"), reloads);
26142618
}
26152619

@@ -2671,6 +2675,9 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
26712675

26722676
reimport_files.sort();
26732677

2678+
// Emit the resource_reimporting signal for the single file before the actual importation.
2679+
emit_signal(SNAME("resources_reimporting"), reloads);
2680+
26742681
#ifdef THREADS_ENABLED
26752682
bool use_multiple_threads = GLOBAL_GET("editor/import/use_multiple_threads");
26762683
#else
@@ -2765,11 +2772,15 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
27652772

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

27702783
// Emit the resource_reimported signal for the single file we just reimported.
2771-
Vector<String> reloads;
2772-
reloads.append(p_file);
27732784
emit_signal(SNAME("resources_reimported"), reloads);
27742785
return ret;
27752786
}
@@ -2969,6 +2980,7 @@ void EditorFileSystem::_bind_methods() {
29692980
ADD_SIGNAL(MethodInfo("filesystem_changed"));
29702981
ADD_SIGNAL(MethodInfo("script_classes_updated"));
29712982
ADD_SIGNAL(MethodInfo("sources_changed", PropertyInfo(Variant::BOOL, "exist")));
2983+
ADD_SIGNAL(MethodInfo("resources_reimporting", PropertyInfo(Variant::PACKED_STRING_ARRAY, "resources")));
29722984
ADD_SIGNAL(MethodInfo("resources_reimported", PropertyInfo(Variant::PACKED_STRING_ARRAY, "resources")));
29732985
ADD_SIGNAL(MethodInfo("resources_reload", PropertyInfo(Variant::PACKED_STRING_ARRAY, "resources")));
29742986
}

0 commit comments

Comments
 (0)