[Bf-blender-cvs] [12757aad3f4] refactor-mesh-material-index-generic: Add an assert that material indices are on the correct domain, don't crash
Hans Goudey
noreply at git.blender.org
Mon Aug 29 22:10:23 CEST 2022
Commit: 12757aad3f41cb2b5976c991446f6be7d09cdaed
Author: Hans Goudey
Date: Mon Aug 29 15:10:15 2022 -0500
Branches: refactor-mesh-material-index-generic
https://developer.blender.org/rB12757aad3f41cb2b5976c991446f6be7d09cdaed
Add an assert that material indices are on the correct domain, don't crash
===================================================================
M source/blender/blenkernel/intern/mesh.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc
index d1c4d38e77f..7c6ded6a246 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -1423,6 +1423,10 @@ void BKE_mesh_material_index_remove(Mesh *me, short index)
if (!material_indices) {
return;
}
+ if (material_indices.domain != ATTR_DOMAIN_FACE) {
+ BLI_assert_unreachable();
+ return;
+ }
MutableVArraySpan<int> indices_span(material_indices.varray);
for (const int i : indices_span.index_range()) {
if (indices_span[i] > 0 && indices_span[i] > index) {
@@ -1487,6 +1491,10 @@ void BKE_mesh_material_remap(Mesh *me, const uint *remap, uint remap_len)
if (!material_indices) {
return;
}
+ if (material_indices.domain != ATTR_DOMAIN_FACE) {
+ BLI_assert_unreachable();
+ return;
+ }
MutableVArraySpan<int> indices_span(material_indices.varray);
for (const int i : indices_span.index_range()) {
MAT_NR_REMAP(indices_span[i]);
More information about the Bf-blender-cvs
mailing list