Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAras Pranckevicius <aras@nesnausk.org>2022-07-31 18:10:48 +0300
committerAras Pranckevicius <aras@nesnausk.org>2022-07-31 18:10:48 +0300
commitbea52819190e54da2907e6c367b493db29f6f5c9 (patch)
treee0e0d57ab7ca341d61dc735b5482dc50d8982118 /source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
parent27e6962beda6df155599cbbd1682c20f4e1cd06d (diff)
Fix T100075: OBJ import: images loaded multiple times instead of being reused
The new OBJ/MTL importer was creating a new image for any referenced texture, even if another material (or another property of the same material) already referenced the same texture. Make it use BKE_image_load_exists function just like Collada or USD importers do. Fixes T100075. Extended test coverage to count imported images; without the fix import_cubes_with_textures_rel would have incorrectly created 5 images instead of 4.
Diffstat (limited to 'source/blender/io/wavefront_obj/importer/obj_import_mtl.cc')
-rw-r--r--source/blender/io/wavefront_obj/importer/obj_import_mtl.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
index 60e419728f3..f7685ba0b7b 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_mtl.cc
@@ -65,7 +65,7 @@ static bool load_texture_image_at_path(Main *bmain,
bNode *r_node,
const std::string &path)
{
- Image *tex_image = BKE_image_load(bmain, path.c_str());
+ Image *tex_image = BKE_image_load_exists(bmain, path.c_str());
if (!tex_image) {
fprintf(stderr, "Cannot load image file: '%s'\n", path.c_str());
return false;