Commit: 51a088cbea83f146f4416d1d25edc8d64d7b7cb2
Author: Martin Felke
Date:   Wed Jun 7 16:15:39 2017 +0200
Branches: fracture_modifier
https://developer.blender.org/rB51a088cbea83f146f4416d1d25edc8d64d7b7cb2

also store material index in shards, so it can be loaded from blend later

===================================================================

M       source/blender/blenkernel/intern/fracture.c

===================================================================

diff --git a/source/blender/blenkernel/intern/fracture.c 
b/source/blender/blenkernel/intern/fracture.c
index 642aeae925b..d1d9b73a8e9 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -2733,7 +2733,7 @@ int BKE_fracture_update_visual_mesh(FractureModifierData 
*fmd, Object *ob, bool
        DerivedMesh *dm = fmd->visible_mesh_cached;
        int vertstart = 0, totvert = 0, totpoly = 0, polystart = 0, matstart = 
1, defstart = 0;
        MVert *mv = NULL;
-       MPoly *mp = NULL, *mpoly = NULL, *ppoly = NULL, *pp = NULL;
+       MPoly *mp = NULL, *mpoly = NULL, *ppoly = NULL, *pp = NULL, *spoly = 
NULL, *sp = NULL;
        int i = 0, j = 0;
        MDeformVert *dvert = NULL;
 
@@ -2846,7 +2846,8 @@ int BKE_fracture_update_visual_mesh(FractureModifierData 
*fmd, Object *ob, bool
 
                totpoly = mi->physics_mesh->getNumPolys(mi->physics_mesh);
                ppoly = mi->physics_mesh->getPolyArray(mi->physics_mesh);
-               for (j = 0, mp = mpoly + polystart, pp = ppoly; j < totpoly; 
j++, mp++, pp++)
+               spoly = s->mpoly;
+               for (j = 0, mp = mpoly + polystart, pp = ppoly, sp = spoly; j < 
totpoly; j++, mp++, pp++, sp++)
                {
                        /* material index lookup and correction, avoid having 
the same material in different slots */
                        int index = 
GET_INT_FROM_POINTER(BLI_ghash_lookup(fmd->material_index_map,
@@ -2856,9 +2857,10 @@ int BKE_fracture_update_visual_mesh(FractureModifierData 
*fmd, Object *ob, bool
                                index--;
 
                        mp->mat_nr = index;
-                       //store this on physics mesh as well, so for being able 
to reload it from blend later (without
+                       //store this on physics mesh as well, and on shard too 
so for being able to reload it from blend later (without
                        // having a materialmap then)
                        pp->mat_nr = index;
+                       sp->mat_nr = index;
                }
 
                /* fortunately we know how many faces "belong" to this 
meshisland, too */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to