Commit: ca18f5ddd4967460e1ee8c8d237e0d33df3aae11
Author: Martin Felke
Date:   Wed Nov 4 15:05:19 2015 +0100
Branches: fracture_modifier
https://developer.blender.org/rBca18f5ddd4967460e1ee8c8d237e0d33df3aae11

added inner uv map setting, which will contain only inner face's UVs, useful 
for texture based inner smoke in conjunction with fracture modifier

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

M       release/scripts/startup/bl_ui/properties_physics_fracture.py
M       source/blender/blenkernel/BKE_fracture.h
M       source/blender/blenkernel/BKE_fracture_util.h
M       source/blender/blenkernel/intern/fracture.c
M       source/blender/blenkernel/intern/fracture_util.c
M       source/blender/makesdna/DNA_modifier_types.h
M       source/blender/makesrna/intern/rna_modifier.c
M       source/blender/modifiers/intern/MOD_fracture.c

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

diff --git a/release/scripts/startup/bl_ui/properties_physics_fracture.py 
b/release/scripts/startup/bl_ui/properties_physics_fracture.py
index 230250c..e49c618 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fracture.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fracture.py
@@ -92,10 +92,11 @@ class PHYSICS_PT_fracture(PhysicButtonsPanel, Panel):
         col.prop(md, "point_seed")
         layout.prop(md, "cluster_group")
         layout.prop(md, "cluster_constraint_type")
-        if md.frac_algorithm == 'BOOLEAN' or md.frac_algorithm == 
'BISECT_FILL' or md.frac_algorithm == 'BISECT_FAST_FILL':
-            layout.prop(md, "inner_material")
+        if md.frac_algorithm in {'BOOLEAN', 'BISECT_FILL', 'BISECT_FAST_FILL', 
'BOOLEAN_FRACTAL'}:
+            col = layout.column()
+            col.prop(md, "inner_material")
+            col.prop_search(md, "uv_layer", ob.data, "uv_textures")
         if md.frac_algorithm == 'BOOLEAN_FRACTAL':
-            layout.prop(md, "inner_material")
             col = layout.column(align=True)
             row = col.row(align=True)
             row.prop(md, "fractal_cuts")
diff --git a/source/blender/blenkernel/BKE_fracture.h 
b/source/blender/blenkernel/BKE_fracture.h
index 17c3e92..baf3aa8 100644
--- a/source/blender/blenkernel/BKE_fracture.h
+++ b/source/blender/blenkernel/BKE_fracture.h
@@ -87,7 +87,8 @@ struct DerivedMesh *BKE_shard_create_dm(struct Shard *s, bool 
doCustomData);
 /* create shards from base mesh and a list of points */
 void BKE_fracture_shard_by_points(struct FracMesh *fmesh, ShardID id, struct 
FracPointCloud *points, int algorithm,
                                   struct Object *obj, struct DerivedMesh *dm, 
short inner_material_index, float mat[4][4],
-                                  int num_cuts, float fractal, bool smooth, 
int num_levels, int mode, bool reset, int active_setting, int num_settings);
+                                  int num_cuts, float fractal, bool smooth, 
int num_levels, int mode, bool reset, int active_setting,
+                                  int num_settings, char uv_layer[]);
 
 /* create shards from a base mesh and a set of other objects / cutter planes */
 void BKE_fracture_shard_by_planes(struct FractureModifierData *fmd, struct 
Object *obj, short inner_material_index, float mat[4][4]);
diff --git a/source/blender/blenkernel/BKE_fracture_util.h 
b/source/blender/blenkernel/BKE_fracture_util.h
index a06e563..08652d2 100644
--- a/source/blender/blenkernel/BKE_fracture_util.h
+++ b/source/blender/blenkernel/BKE_fracture_util.h
@@ -35,9 +35,9 @@
 
 #include "DNA_fracture_types.h"
 
-Shard *BKE_fracture_shard_boolean(Object *obj, DerivedMesh *dm_parent, Shard* 
child, short inner_material_index, int num_cuts, float fractal, Shard **other, 
float mat[4][4], float radius, bool use_smooth_inner, int num_levels);
+Shard *BKE_fracture_shard_boolean(Object *obj, DerivedMesh *dm_parent, Shard* 
child, short inner_material_index, int num_cuts, float fractal, Shard **other, 
float mat[4][4], float radius, bool use_smooth_inner, int num_levels, char 
uv_layer[]);
 Shard *BKE_fracture_shard_bisect(struct BMesh *bm_orig, Shard* child, float 
obmat[4][4], bool use_fill,
                                  bool clear_inner, bool clear_outer, int 
cutlimit, float centroid[],
-                                 short inner_mat_index);
+                                 short inner_mat_index, char uv_layer[]);
 
 #endif /* BKE_FRACTURE_UTIL_H*/
diff --git a/source/blender/blenkernel/intern/fracture.c 
b/source/blender/blenkernel/intern/fracture.c
index f0fe7ab..11bad32 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -175,13 +175,18 @@ static int shard_sortsize(const void *s1, const void *s2, 
void* UNUSED(context))
 
 Shard *BKE_custom_data_to_shard(Shard *s, DerivedMesh *dm)
 {
+       /*
        CustomData_reset(&s->vertData);
        CustomData_reset(&s->loopData);
        CustomData_reset(&s->polyData);
 
        CustomData_add_layer(&s->vertData, CD_MDEFORMVERT, CD_DUPLICATE, 
CustomData_get_layer(&dm->vertData, CD_MDEFORMVERT), s->totvert);
        CustomData_add_layer(&s->loopData, CD_MLOOPUV, CD_DUPLICATE, 
CustomData_get_layer(&dm->loopData, CD_MLOOPUV), s->totloop);
-       CustomData_add_layer(&s->polyData, CD_MTEXPOLY, CD_DUPLICATE, 
CustomData_get_layer(&dm->polyData, CD_MTEXPOLY), s->totpoly);
+       CustomData_add_layer(&s->polyData, CD_MTEXPOLY, CD_DUPLICATE, 
CustomData_get_layer(&dm->polyData, CD_MTEXPOLY), s->totpoly);*/
+
+       CustomData_copy(&dm->vertData, &s->vertData, CD_MASK_MDEFORMVERT, 
CD_DUPLICATE, s->totvert);
+       CustomData_copy(&dm->loopData, &s->loopData, CD_MASK_MLOOPUV, 
CD_DUPLICATE, s->totloop);
+       CustomData_copy(&dm->polyData, &s->polyData, CD_MASK_MTEXPOLY, 
CD_DUPLICATE, s->totpoly);
 
        return s;
 }
@@ -395,7 +400,8 @@ FracMesh *BKE_create_fracture_container(void)
 }
 
 static void handle_fast_bisect(FracMesh *fm, int expected_shards, int 
algorithm, BMesh** bm_parent, float obmat[4][4],
-                               float centroid[3], short inner_material_index, 
int parent_id, Shard **tempshards, Shard ***tempresults)
+                               float centroid[3], short inner_material_index, 
int parent_id, Shard **tempshards, Shard ***tempresults,
+                               char uv_layer[64])
 {
        int i = 0;
 
@@ -430,8 +436,10 @@ static void handle_fast_bisect(FracMesh *fm, int 
expected_shards, int algorithm,
                printf("Bisecting cell %d...\n", i);
                printf("Bisecting cell %d...\n", i + 1);
 
-               s = BKE_fracture_shard_bisect(*bm_parent, t, obmat, algorithm 
== MOD_FRACTURE_BISECT_FAST_FILL, false, true, index, centroid, 
inner_material_index);
-               s2 = BKE_fracture_shard_bisect(*bm_parent, t, obmat, algorithm 
== MOD_FRACTURE_BISECT_FAST_FILL, true, false, index, centroid, 
inner_material_index);
+               s = BKE_fracture_shard_bisect(*bm_parent, t, obmat, algorithm 
== MOD_FRACTURE_BISECT_FAST_FILL,
+                                             false, true, index, centroid, 
inner_material_index, uv_layer);
+               s2 = BKE_fracture_shard_bisect(*bm_parent, t, obmat, algorithm 
== MOD_FRACTURE_BISECT_FAST_FILL,
+                                              true, false, index, centroid, 
inner_material_index, uv_layer);
 
                if (s != NULL && s2 != NULL && tempresults != NULL) {
                        int j = 0;
@@ -474,7 +482,7 @@ static void handle_fast_bisect(FracMesh *fm, int 
expected_shards, int algorithm,
 
 static void handle_boolean_fractal(Shard* s, Shard* t, int expected_shards, 
DerivedMesh* dm_parent, Object *obj, short inner_material_index,
                                    int num_cuts, float fractal, int 
num_levels, bool smooth,int parent_id, int* i, Shard ***tempresults,
-                                   DerivedMesh **dm_p)
+                                   DerivedMesh **dm_p, char uv_layer[64])
 {
        /* physics shard and fractalized shard, so we need to booleanize twice 
*/
        /* and we need both halves, so twice again */
@@ -513,7 +521,7 @@ static void handle_boolean_fractal(Shard* s, Shard* t, int 
expected_shards, Deri
                loc_eul_size_to_mat4(matrix, loc, eul, one);
 
                /*visual shards next, fractalized cuts */
-               s = BKE_fracture_shard_boolean(obj, *dm_p, t, 
inner_material_index, num_cuts,fractal, &s2, matrix, radius, smooth, 
num_levels);
+               s = BKE_fracture_shard_boolean(obj, *dm_p, t, 
inner_material_index, num_cuts,fractal, &s2, matrix, radius, smooth, 
num_levels, uv_layer);
 
                if (index < max_retries)
                {
@@ -565,7 +573,7 @@ static void handle_boolean_fractal(Shard* s, Shard* t, int 
expected_shards, Deri
 
 static bool handle_boolean_bisect(FracMesh *fm, Object *obj, int 
expected_shards, int algorithm, int parent_id, Shard **tempshards,
                                   DerivedMesh *dm_parent, BMesh* bm_parent, 
float obmat[4][4], short inner_material_index, int num_cuts,
-                                  int num_levels, float fractal, int *i, bool 
smooth, Shard*** tempresults, DerivedMesh **dm_p)
+                                  int num_levels, float fractal, int *i, bool 
smooth, Shard*** tempresults, DerivedMesh **dm_p, char uv_layer[64])
 {
        Shard *s = NULL, *t = NULL;
        if (fm->cancel == 1)
@@ -587,16 +595,16 @@ static bool handle_boolean_bisect(FracMesh *fm, Object 
*obj, int expected_shards
 
        /* XXX TODO, need object for material as well, or atleast a material 
index... */
        if (algorithm == MOD_FRACTURE_BOOLEAN) {
-               s = BKE_fracture_shard_boolean(obj, dm_parent, t, 
inner_material_index, 0, 0.0f, NULL, NULL, 0.0f, false, 0);
+               s = BKE_fracture_shard_boolean(obj, dm_parent, t, 
inner_material_index, 0, 0.0f, NULL, NULL, 0.0f, false, 0, uv_layer);
        }
        else if (algorithm == MOD_FRACTURE_BOOLEAN_FRACTAL) {
                handle_boolean_fractal(s, t, expected_shards, dm_parent, obj, 
inner_material_index, num_cuts, fractal,
-                                      num_levels, smooth, parent_id, i, 
tempresults, dm_p);
+                                      num_levels, smooth, parent_id, i, 
tempresults, dm_p, uv_layer);
        }
        else if (algorithm == MOD_FRACTURE_BISECT || algorithm == 
MOD_FRACTURE_BISECT_FILL) {
                float co[3] = {0, 0, 0};
                printf("Bisecting cell %d...\n", *i);
-               s = BKE_fracture_shard_bisect(bm_parent, t, obmat, algorithm == 
MOD_FRACTURE_BISECT_FILL, false, true, 0, co, inner_material_index);
+               s = BKE_fracture_shard_bisect(bm_parent, t, obmat, algorithm == 
MOD_FRACTURE_BISECT_FILL, false, true, 0, co, inner_material_index, uv_layer);
        }
        else {
                /* do not fracture case */
@@ -769,7 +777,7 @@ static void do_prepare_cells(FracMesh *fm, cell *cells, int 
expected_shards, int
 /* parse the voro++ cell data */
 static void parse_cells(cell *cells, int expected_shards, ShardID parent_id, 
FracMesh *fm, int algorithm, Object *obj, DerivedMesh *dm,
                         short inner_material_index, float mat[4][4], int 
num_cuts, float fractal, bool smooth, int num_levels, int mode,
-                        bool reset, int active_setting, int num_settings)
+                        bool reset, int active_setting, int num_settings, char 
uv_layer[64])
 {
        /*Parse voronoi raw data*/
        int i = 0, j = 0, count = 0;
@@ -893,7 +901,7 @@ static void parse_cells(cell *cells, int expected_shards, 
ShardID parent_id, Fra
                for (i = 0; i < expected_shards; i++) {
                        bool stop 

@@ Diff output truncated at 10240 characters. @@

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

Reply via email to