Commit: 904dc50fd4c5c8fe6292009a9e1da13099a504f9
Author: Martin Felke
Date:   Mon Dec 15 13:36:42 2014 +0100
Branches: fracture_modifier
https://developer.blender.org/rB904dc50fd4c5c8fe6292009a9e1da13099a504f9

fix for inner vertex groups (contains real inner shards vertices now only) and 
option for smooth inner faces (useful with following subsurf and displacement 
modifier, works properly with boolean only

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

M       release/scripts/startup/bl_ui/properties_physics_fracture.py
M       source/blender/blenkernel/intern/fracture.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 7fd3316..5e22a04 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fracture.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fracture.py
@@ -80,6 +80,7 @@ class PHYSICS_PT_fracture(PhysicButtonsPanel, Panel):
         row = layout.row()
         row.prop(md, "shards_to_islands")
         row.prop(md, "auto_execute")
+        row.prop(md, "use_smooth")
         row = layout.row(align=True)
         row.prop(md, "splinter_axis")
         layout.prop(md, "splinter_length")
@@ -119,12 +120,13 @@ class PHYSICS_PT_fracture_simulation(PhysicButtonsPanel, 
Panel):
         col = layout.column(align=True)
         col.prop(md, "constraint_limit", text="Constraint limit, per 
MeshIsland")
         col.prop(md, "contact_dist")
+
         layout.label("Constraint Breaking Settings")
         col = layout.column(align=True)
         col.prop(md, "breaking_threshold", text="Threshold")
         col.prop(md, "cluster_breaking_threshold")
 
-        layout.label("Constraint Breaking Settings")
+        layout.label("Constraint Special Breaking Settings")
         col = layout.column(align=True)
         row = col.row(align=True)
         row.prop(md, "breaking_percentage", text="Percentage")
diff --git a/source/blender/blenkernel/intern/fracture.c 
b/source/blender/blenkernel/intern/fracture.c
index 33a0cd9..dc35850 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -901,6 +901,20 @@ static DerivedMesh *create_dm(FractureModifierData *fmd, 
bool doCustomData)
                                        medge[ml.e].flag |= ME_SHARP;
                                        mvert[ml.v].flag |= ME_VERT_TMP_TAG;
                                }
+
+                               if (fmd->use_smooth)
+                                       mp->flag |= ME_SMOOTH;
+                       }
+                       else
+                       {
+                               /*remove verts from unselected faces again*/
+                               int j = 0;
+                               for (j = 0; j < mp->totloop; j++)
+                               {
+                                       MLoop ml;
+                                       ml = mloop[mp->loopstart + j];
+                                       mvert[ml.v].flag &= ~ME_VERT_TMP_TAG;
+                               }
                        }
                }
        }
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index 4205577..9514903 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1476,6 +1476,7 @@ typedef struct FractureModifierData {
        int use_mass_dependent_thresholds;
        int use_particle_birth_coordinates;
        int use_breaking;
+       int use_smooth;
 
        int shards_to_islands;
        int execute_threaded;
@@ -1494,7 +1495,7 @@ typedef struct FractureModifierData {
        /* internal values */
        float max_vol;
 
-       char pad[4];
+       //char pad[4];
 } FractureModifierData;
 
 #endif  /* __DNA_MODIFIER_TYPES_H__ */
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index 8cf9157..5dd4800 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4106,6 +4106,11 @@ static void rna_def_modifier_fracture(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Breakable",
                                 "Constraints can be broken if it receives an 
impulse above the threshold");
        //RNA_def_property_update(prop, /*NC_OBJECT | ND_POINTCACHE*/ 0, 
"rna_Modifier_update");
+
+       prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "use_smooth", false);
+       RNA_def_property_ui_text(prop, "Smooth Inner Faces", "Set Inner Faces 
to Smooth Shading (needs refracture)");
+       RNA_def_property_update(prop, 0, "rna_Modifier_update");
 }
 
 void RNA_def_modifier(BlenderRNA *brna)
diff --git a/source/blender/modifiers/intern/MOD_fracture.c 
b/source/blender/modifiers/intern/MOD_fracture.c
index 0885fad..b612dc5 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -135,6 +135,7 @@ static void initData(ModifierData *md)
        /* used for advanced fracture settings now, XXX needs rename perhaps*/
        fmd->use_experimental = 0;
        fmd->use_breaking = true;
+       fmd->use_smooth = false;
 }
 
 static void freeMeshIsland(FractureModifierData *rmd, MeshIsland *mi, bool 
remove_rigidbody)
@@ -2190,8 +2191,8 @@ static DerivedMesh *do_autoHide(FractureModifierData 
*fmd, DerivedMesh *dm)
                BM_face_calc_center_mean(f2, f_centr_other);
 
 
-               if ((len_squared_v3v3(f_centr, f_centr_other) < 
fmd->autohide_dist && f1 != f2) &&
-                   (f1->mat_nr == 1 && f2->mat_nr == 1))
+               if ((len_squared_v3v3(f_centr, f_centr_other) < 
fmd->autohide_dist) && (f1 != f2) &&
+                   (f1->mat_nr == 1) && (f2->mat_nr == 1))
                {
 
                        faces = MEM_reallocN(faces, sizeof(BMFace *) * 
(del_faces + 2));
@@ -2218,7 +2219,7 @@ static DerivedMesh *do_autoHide(FractureModifierData 
*fmd, DerivedMesh *dm)
 
        BMO_op_callf(bm, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE), 
"delete_keep_normals geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES);
        BMO_op_callf(bm, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
-                    "automerge_keep_normals verts=%hv dist=%f", 
BM_ELEM_SELECT, fmd->autohide_dist * 10, false);
+                    "automerge_keep_normals verts=%hv dist=%f", 
BM_ELEM_SELECT, fmd->autohide_dist * 10, false); /*need to merge larger cracks*/
 
 #if 0
        //dissolve sharp edges

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

Reply via email to