Skip to content

Commit 3ab6edc

Browse files
committed
Fix for .blend files that do not import textures.
1 parent ef02314 commit 3ab6edc

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

modules/gltf/editor/editor_scene_importer_blend.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,16 @@ Node *EditorSceneFormatImporterBlend::import_scene(const String &p_path, uint32_
352352
}
353353
ERR_FAIL_COND_V(!p_options.has("animation/fps"), nullptr);
354354

355+
// TODO: Fix the bug for cases where only some of the textures can't be found as well!
356+
// If no textures are found, we will try to import without the "blender/materials/unpack_enabled" option.
357+
// This solution is intended for cases when Geometry Nodes are used with UV nodes in a shader.
358+
// But that doesn't help when at least one texture has been found.
359+
if (state->get_textures().size() == 0 && p_options.has("blender/materials/unpack_enabled")) {
360+
HashMap<StringName, Variant> new_options(p_options);
361+
new_options.erase("blender/materials/unpack_enabled");
362+
return import_scene(p_path, p_flags, new_options, r_missing_deps, r_err);
363+
}
364+
355365
#ifndef DISABLE_DEPRECATED
356366
bool trimming = p_options.has("animation/trimming") ? (bool)p_options["animation/trimming"] : false;
357367
return gltf->generate_scene(state, (float)p_options["animation/fps"], trimming, false);

0 commit comments

Comments
 (0)