diff options
author | Aras Pranckevicius <aras@nesnausk.org> | 2022-09-01 20:44:09 +0300 |
---|---|---|
committer | Aras Pranckevicius <aras@nesnausk.org> | 2022-09-01 20:44:09 +0300 |
commit | 08894ac929cbad25219d107f7877b1300135fb60 (patch) | |
tree | 434d98a19022c131730891a3ae8d6c26aa36e2d5 /source/blender | |
parent | 82e3513a8d0fcfb3e7410b88a4ba5683bb45876b (diff) | |
parent | f366d197db24cf611866a8d847b4022a6a46504e (diff) |
Merge branch 'blender-v3.3-release'
Diffstat (limited to 'source/blender')
5 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index 16e5ee968a3..a4b6c32ef64 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -26,6 +26,7 @@ #include "BLI_math_geom.h" #include "BKE_attribute.hh" +#include "BKE_lib_id.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_mesh.h" @@ -93,6 +94,7 @@ static void assign_materials(Main *bmain, mat_iter = matname_to_material.find(mat_name); if (mat_iter == matname_to_material.end()) { assigned_mat = BKE_material_add(bmain, mat_name.c_str()); + id_us_min(&assigned_mat->id); matname_to_material[mat_name] = assigned_mat; } else { @@ -101,6 +103,9 @@ static void assign_materials(Main *bmain, BKE_object_material_assign_single_obdata(bmain, ob, assigned_mat, mat_index); } + if (ob->totcol > 0) { + ob->actcol = 1; + } } } /* namespace utils */ 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; diff --git a/source/blender/io/usd/intern/usd_reader_material.cc b/source/blender/io/usd/intern/usd_reader_material.cc index f59b8be147e..4b72a075106 100644 --- a/source/blender/io/usd/intern/usd_reader_material.cc +++ b/source/blender/io/usd/intern/usd_reader_material.cc @@ -4,6 +4,7 @@ #include "usd_reader_material.h" #include "BKE_image.h" +#include "BKE_lib_id.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_node.h" @@ -323,6 +324,7 @@ Material *USDMaterialReader::add_material(const pxr::UsdShadeMaterial &usd_mater /* Create the material. */ Material *mtl = BKE_material_add(bmain_, mtl_name.c_str()); + id_us_min(&mtl->id); /* Get the UsdPreviewSurface shader source for the material, * if there is one. */ diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc index 89a98097780..4155f6ac40f 100644 --- a/source/blender/io/usd/intern/usd_reader_mesh.cc +++ b/source/blender/io/usd/intern/usd_reader_mesh.cc @@ -183,6 +183,9 @@ static void assign_materials(Main *bmain, std::cout << "WARNING: Couldn't assign material " << it->first << std::endl; } } + if (ob->totcol > 0) { + ob->actcol = 1; + } } } // namespace utils diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc index 7f7fda8d8f1..40a958919f1 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc +++ b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc @@ -302,6 +302,8 @@ static Material *get_or_create_material(Main *bmain, const MTLMaterial &mtl = *materials.lookup_or_add(name, std::make_unique<MTLMaterial>()); Material *mat = BKE_material_add(bmain, name.c_str()); + id_us_min(&mat->id); + ShaderNodetreeWrap mat_wrap{bmain, mtl, mat, relative_paths}; mat->use_nodes = true; mat->nodetree = mat_wrap.get_nodetree(); @@ -325,6 +327,9 @@ void MeshFromGeometry::create_materials(Main *bmain, } BKE_object_material_assign_single_obdata(bmain, obj, mat, obj->totcol + 1); } + if (obj->totcol > 0) { + obj->actcol = 1; + } } void MeshFromGeometry::create_normals(Mesh *mesh) |