[Bf-blender-cvs] [b53c4fa8daa] blender-v3.4-release: Fix T102522: Geometry nodes boolean doesent respect material index
Hans Goudey
noreply at git.blender.org
Mon Nov 21 22:50:40 CET 2022
Commit: b53c4fa8daa199a8ccd4080baf2267c82d8b69a8
Author: Hans Goudey
Date: Mon Nov 21 15:49:18 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rBb53c4fa8daa199a8ccd4080baf2267c82d8b69a8
Fix T102522: Geometry nodes boolean doesent respect material index
The refactor in f1c0249f34c417 incorrectly placed the material index
remapping before the transfer of generic attributes. Now that the
material index is a generic attribute, it was overwritten.
===================================================================
M source/blender/blenkernel/intern/mesh_boolean_convert.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/mesh_boolean_convert.cc b/source/blender/blenkernel/intern/mesh_boolean_convert.cc
index 360c7da2ae2..21d9baf7f7e 100644
--- a/source/blender/blenkernel/intern/mesh_boolean_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_boolean_convert.cc
@@ -410,16 +410,6 @@ static void copy_poly_attributes(Mesh *dest_mesh,
Span<short> material_remap,
MutableSpan<int> dst_material_indices)
{
- const VArray<int> src_material_indices = orig_me->attributes().lookup_or_default<int>(
- "material_index", ATTR_DOMAIN_FACE, 0);
- const int src_index = src_material_indices[index_in_orig_me];
- if (material_remap.size() > 0 && material_remap.index_range().contains(src_index)) {
- dst_material_indices[mp_index] = material_remap[src_index];
- }
- else {
- dst_material_indices[mp_index] = src_index;
- }
-
mp->flag = orig_mp->flag;
CustomData *target_cd = &dest_mesh->pdata;
const CustomData *source_cd = &orig_me->pdata;
@@ -435,6 +425,17 @@ static void copy_poly_attributes(Mesh *dest_mesh,
source_cd, target_cd, source_layer_i, target_layer_i, index_in_orig_me, mp_index, 1);
}
}
+
+ /* Fix material indices after they have been transferred as a generic attribute. */
+ const VArray<int> src_material_indices = orig_me->attributes().lookup_or_default<int>(
+ "material_index", ATTR_DOMAIN_FACE, 0);
+ const int src_index = src_material_indices[index_in_orig_me];
+ if (material_remap.size() > 0 && material_remap.index_range().contains(src_index)) {
+ dst_material_indices[mp_index] = material_remap[src_index];
+ }
+ else {
+ dst_material_indices[mp_index] = src_index;
+ }
}
/* Similar to copy_vert_attributes but for edge attributes. */
More information about the Bf-blender-cvs
mailing list