[Bf-blender-cvs] [0384b49] fracture_modifier: fix for material assignment to meshislands, dont create unnecessary material slots any more
Martin Felke
noreply at git.blender.org
Fri Jan 22 10:33:35 CET 2016
Commit: 0384b49e14c42385da2559e5eea5e3b33edf9c6f
Author: Martin Felke
Date: Fri Jan 22 10:33:20 2016 +0100
Branches: fracture_modifier
https://developer.blender.org/rB0384b49e14c42385da2559e5eea5e3b33edf9c6f
fix for material assignment to meshislands, dont create unnecessary material slots any more
===================================================================
M source/blender/blenkernel/intern/fracture.c
===================================================================
diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index 1168466..3df1565 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -2397,7 +2397,7 @@ short BKE_fracture_collect_materials(Object* o, Object* ob, short matstart, GHas
{
short *totcolp = NULL, k = 0;
Material ***matarar = NULL;
- int j;
+ int j, l = 0;
/* append materials to target object, if not existing yet */
totcolp = give_totcolp(o);
@@ -2412,11 +2412,19 @@ short BKE_fracture_collect_materials(Object* o, Object* ob, short matstart, GHas
index = matstart + k;
k++;
}
+ else
+ {
+ /* dont assign slots for other multi-user materials if already assigned */
+ if ((*matarar)[j]->id.us > 1)
+ {
+ l++;
+ }
+ }
BLI_ghash_insert(*mat_index_map, SET_INT_IN_POINTER(matstart+j), SET_INT_IN_POINTER(index));
}
- return *totcolp;
+ return (*totcolp) - l;
}
MeshIsland* BKE_fracture_mesh_island_add(FractureModifierData *fmd, Object* own, Object *target, int index, bool update)
More information about the Bf-blender-cvs
mailing list