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-09-01 20:38:56 +0300
committerAras Pranckevicius <aras@nesnausk.org>2022-09-01 20:38:56 +0300
commitf366d197db24cf611866a8d847b4022a6a46504e (patch)
treeea79b5c35d6103fcacaba7d8006a43ffee61adbb /source/blender/io/collada
parentad4dcfe2273790584743abd83dacb57ce99d16a6 (diff)
Fix T100737: OBJ/USD import: imported object has no active material, material has 2 users
Fixes issues in importers written in C++ (T100737): - Materials had one reference count too much. Affected Collada, Alembic, USD, OBJ importers, looks like "since forever". - Active material index was not properly set on imported meshes. Regression since 3.3 (D15145). Affected Alembic, USD, OBJ. Note: now it sets the first material as the active one, whereas previously the last one was set as active. First one sounds more "intuitive" to me. Reviewed By: Bastien Montagne Differential Revision: https://developer.blender.org/D15831
Diffstat (limited to 'source/blender/io/collada')
-rw-r--r--source/blender/io/collada/DocumentImporter.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp
index 2ce97bc8b5d..1ffe412b3ed 100644
--- a/source/blender/io/collada/DocumentImporter.cpp
+++ b/source/blender/io/collada/DocumentImporter.cpp
@@ -743,6 +743,7 @@ bool DocumentImporter::writeMaterial(const COLLADAFW::Material *cmat)
const std::string &str_mat_id = cmat->getName().empty() ? cmat->getOriginalId() :
cmat->getName();
Material *ma = BKE_material_add(bmain, (char *)str_mat_id.c_str());
+ id_us_min(&ma->id);
this->uid_effect_map[cmat->getInstantiatedEffect()] = ma;
this->uid_material_map[cmat->getUniqueId()] = ma;