[Bf-blender-cvs] [4ac1aeebc7f] temp-fracture-modifier-2.8: most stuff re-implemented, but still rather buggy, needs polish.
Martin Felke
noreply at git.blender.org
Thu Aug 23 03:18:59 CEST 2018
Commit: 4ac1aeebc7f235f9db6ea7c179a6d5cd398cef59
Author: Martin Felke
Date: Thu Aug 23 03:18:22 2018 +0200
Branches: temp-fracture-modifier-2.8
https://developer.blender.org/rB4ac1aeebc7f235f9db6ea7c179a6d5cd398cef59
most stuff re-implemented, but still rather buggy, needs polish.
===================================================================
M release/scripts/startup/bl_ui/properties_physics_fracture.py
M source/blender/blenkernel/BKE_fracture.h
M source/blender/blenkernel/intern/fracture.c
M source/blender/blenkernel/intern/fracture_constraints.c
M source/blender/blenkernel/intern/fracture_dynamic.c
M source/blender/blenkernel/intern/fracture_external.c
M source/blender/blenkernel/intern/fracture_prefractured.c
M source/blender/blenkernel/intern/fracture_rigidbody.c
M source/blender/blenkernel/intern/rigidbody.c
M source/blender/editors/object/object_intern.h
M source/blender/editors/object/object_modifier.c
M source/blender/editors/object/object_ops.c
M source/blender/makesdna/DNA_fracture_types.h
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesdna/DNA_rigidbody_types.h
M source/blender/makesrna/intern/rna_fracture.c
M source/blender/makesrna/intern/rna_rigidbody.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_physics_fracture.py b/release/scripts/startup/bl_ui/properties_physics_fracture.py
index f0ff79fa51e..8cbebe4e641 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fracture.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fracture.py
@@ -70,32 +70,37 @@ class PHYSICS_PT_fracture_advanced(PhysicButtonsPanel, Panel):
layout.label("Fracture Point Source:")
col = layout.column()
+ col.context_pointer_set("modifier", md)
col.prop(md, "point_source")
if 'GRID' in md.point_source:
sub = col.split(0.33)
sub.prop(md, "grid_resolution")
sub.prop(md, "grid_offset")
sub.prop(md, "grid_spacing")
- if 'GREASE_PENCIL' in md.point_source:
- col.prop(md, "use_greasepencil_edges")
- col.prop(md, "grease_offset")
- col.prop(md, "grease_decimate")
- col.prop(md, "cutter_axis")
- col.prop(md, "extra_group", text="Helpers")
- col.prop(md, "dm_group", text="Combination")
- col.prop(md, "use_constraint_group")
- col.prop(md, "cutter_group")
- if (md.cutter_group):
- col.prop(md, "keep_cutter_shards")
- col.label("Material Index Offset")
- row = col.row(align=True)
- row.prop(md, "material_offset_intersect", text="Intersect")
- row.prop(md, "material_offset_difference", text="Difference")
+ #if 'GREASE_PENCIL' in md.point_source:
+ # col.prop(md, "use_greasepencil_edges")
+ # col.prop(md, "grease_offset")
+ # col.prop(md, "grease_decimate")
+ # col.prop(md, "cutter_axis")
+ if {'EXTRA_PARTICLES', 'EXTRA_VERTICES'} in md.point_source:
+ col.prop(md, "extra_group", text="Helpers")
+ if 'CUSTOM' in md.point_source:
+ col.prop(md, "cutter_group")
+ if (md.cutter_group):
+ col.prop(md, "keep_cutter_shards")
+ col.label("Material Index Offset")
+ row = col.row(align=True)
+ row.prop(md, "material_offset_intersect", text="Intersect")
+ row.prop(md, "material_offset_difference", text="Difference")
+ row = col.row()
+ row.prop(md, "dm_group", text="Pack Group")
+ row.prop(md, "use_constraint_group", text="Constraints Only")
+ col.operator("object.fracture_pack", text="Pack", icon="PACKAGE")
col.prop(md, "use_particle_birth_coordinates")
col.prop(md, "percentage")
sub = col.column(align=True)
sub.prop_search(md, "thresh_vertex_group", ob, "vertex_groups", text = "Threshold")
- sub.prop_search(md, "ground_vertex_group", ob, "vertex_groups", text = "Passive")
+ sub.prop_search(md, "passive_vertex_group", ob, "vertex_groups", text = "Passive")
sub.prop_search(md, "inner_vertex_group", ob, "vertex_groups", text = "Inner")
sub.prop(md, "inner_crease")
if (md.frac_algorithm in {'BISECT_FAST', 'BISECT_FAST_FILL', 'BOOLEAN_FRACTAL'}):
@@ -315,8 +320,8 @@ class PHYSICS_PT_fracture_utilities(PhysicButtonsPanel, Panel):
col = layout.column(align=True)
col.context_pointer_set("modifier", md)
- col.operator("object.rigidbody_convert_to_objects", text = "Convert To Objects")
- col.operator("object.rigidbody_convert_to_keyframes", text = "Convert To Keyframed Objects")
+ col.operator("object.rigidbody_convert_to_objects", text = "Convert To Objects", icon="UGLYPACKAGE")
+ col.operator("object.rigidbody_convert_to_keyframes", text = "Convert To Keyframed Objects", icon="KEY_HLT")
classes = (
FRACTURE_MT_presets,
diff --git a/source/blender/blenkernel/BKE_fracture.h b/source/blender/blenkernel/BKE_fracture.h
index 8b100895f26..74e8bc04506 100644
--- a/source/blender/blenkernel/BKE_fracture.h
+++ b/source/blender/blenkernel/BKE_fracture.h
@@ -160,5 +160,10 @@ void BKE_fracture_dynamic_do(struct FractureModifierData *fmd, struct Object* ob
struct Depsgraph* depsgraph, struct Main* bmain);
void BKE_fracture_clear_cache(struct FractureModifierData* fmd, struct Object *ob, struct Scene *scene);
+void BKE_fracture_meshisland_vertexgroups_do(struct FractureModifierData *fmd, struct Object *ob, struct MeshIsland* mi);
+void BKE_fracture_meshislands_pack(struct FractureModifierData *fmd, struct Object* obj, struct Main* bmain, struct Scene* scene);
+
+void BKE_fracture_postprocess_meshisland(struct FractureModifierData *fmd, struct Object* ob, struct MeshIsland*mi,
+ struct Mesh** temp_meshs, int count, struct Main* bmain, struct Scene* scene, int frame);
#endif /* BKE_FRACTURE_H */
diff --git a/source/blender/blenkernel/intern/fracture.c b/source/blender/blenkernel/intern/fracture.c
index ca96229da5f..a444f32e023 100644
--- a/source/blender/blenkernel/intern/fracture.c
+++ b/source/blender/blenkernel/intern/fracture.c
@@ -34,10 +34,9 @@
#include "MEM_guardedalloc.h"
-#include "BKE_cdderivedmesh.h"
+#include "BKE_collection.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_fracture.h"
#include "BKE_fracture_util.h"
#include "BKE_global.h"
@@ -96,8 +95,10 @@ static void parse_cell_verts(cell c, MVert *mvert, int totvert);
static void parse_cell_polys(cell c, MPoly *mpoly, int totpoly);
static void parse_cell_loops(cell c, MLoop *mloop, MPoly *mpoly, int totpoly);
static void parse_cell_neighbors(cell c, int *neighbors, int totpoly);
-static void do_island_index_map(FractureModifierData *fmd, Object *ob);
-static void do_rigidbody(Main* bmain, Scene* scene, MeshIsland* mi, Object* ob, short rb_type, int i);
+static void do_island_index_map(FractureModifierData *fmd, Object *obj);
+static void fracture_meshisland_custom(FractureModifierData *fmd, Object *obj, MeshIsland* mii, Main* bmain, Scene* scene, int frame);
+void BKE_fracture_postprocess_meshisland(FractureModifierData *fmd, Object* ob, MeshIsland*mi, Mesh** temp_meshs, int count,
+ Main* bmain, Scene* scene, int frame);
static void fracture_meshisland_add(FractureModifierData *fmd, MeshIsland *mi)
@@ -470,7 +471,7 @@ static void process_cells(FractureModifierData* fmd, MeshIsland* mi, Main* bmain
Mesh* me = NULL, *mesh = mi->mesh;
int count_new = count+1;
float frame = BKE_scene_frame_get(scene);
- float quat[4], size[3];
+ float size[3];
/*global preparations */
islands = MEM_callocN(sizeof(MeshIsland*) * count, "islands");
@@ -566,6 +567,8 @@ static void process_cells(FractureModifierData* fmd, MeshIsland* mi, Main* bmain
}
}
+ BKE_fracture_postprocess_meshisland(fmd, ob, mi, temp_meshs, count, bmain, scene, frame);
+#if 0
if (fmd->split_islands)
{
int diff = 1;
@@ -589,8 +592,6 @@ static void process_cells(FractureModifierData* fmd, MeshIsland* mi, Main* bmain
}
}
- mat4_to_quat(quat, ob->obmat);
- invert_qt(quat);
mat4_to_size(size, ob->obmat);
for (i = 0; i < count_new; i++)
@@ -604,6 +605,15 @@ static void process_cells(FractureModifierData* fmd, MeshIsland* mi, Main* bmain
fracture_meshisland_add(fmd, result);
result->id = mi->id + j;
+ /* process vertexgroups, if any */
+ BKE_fracture_meshisland_vertexgroups_do(fmd, ob, result);
+ if (result->passive_weight > 0.01f) {
+ /*dont make passive, but kinematic / triggered */
+ /*so triggers can affect it */
+ result->rigidbody->flag |= RBO_FLAG_KINEMATIC;
+ result->rigidbody->flag |= RBO_FLAG_IS_TRIGGERED;
+ }
+
/*match transform and speed of rigidbody, for dynamic*/
copy_v3_v3(loc, mi->rigidbody->pos);
copy_qt_qt(rot, mi->rigidbody->orn);
@@ -611,7 +621,6 @@ static void process_cells(FractureModifierData* fmd, MeshIsland* mi, Main* bmain
//handle initial rot ?
invert_qt_qt(qrot, result->rot);
mul_qt_qtqt(qrot, rot, qrot);
- //mul_qt_qtqt(qrot, quat, qrot);
copy_v3_v3(centr, result->centroid);
sub_v3_v3(centr, mi->centroid);
@@ -638,6 +647,7 @@ static void process_cells(FractureModifierData* fmd, MeshIsland* mi, Main* bmain
}
}
}
+#endif
BLI_kdtree_balance(tree);
@@ -767,6 +777,7 @@ static void parse_cell_neighbors(cell c, int *neighbors, int totpoly)
}
}
+#if 0
static void stroke_to_faces(FractureModifierData *fmd, BMesh** bm, bGPDstroke *gps, int inner_material_index)
{
BMVert *lastv1 = NULL;
@@ -891,157 +902,8 @@ static void fracture_shard_material_add(MeshIsland* s, Object *ob, short mat_ofs
}
}
}
-
-#if 0 //TODO FIX
-static void do_intersect(FractureModifierData *fmd, Object* ob, MeshIsland *t, short inner_mat_index,
- bool is_zero, float mat[4][4], int **shard_counts, int* count,
- int k, Mesh **dm_parent, bool keep_other_shard, float thresh)
-{
- /*just keep appending items at the end here */
- MPoly *mpoly, *mp;
- int totpoly;
- MeshIsland *parent = *dm_parent;
- MeshIsland *s = NULL, *s2 = NULL;
- int shards = 0, j = 0;
-
- if (is_zero == false && *dm_parent == NULL) {
- parent = BLI_findlink(&fmd->shared->frac_mesh->shard_map, k);
- *dm_parent = BKE_fracture_shard_to_mesh(parent, true);
- }
-
- mpoly = (*dm_parent)->mpoly;
- totpoly = (*dm_parent)->totpoly;
-
- for (j = 0, mp = mpoly; j < totpoly; j++, mp++) {
- mp->flag &= ~ME_FACE_SEL;
- }
-
- if (keep_other_shard)
- {
- s = BKE_fracture_shard_boolean(ob, *dm_parent, t, inner_mat_index, 0, 0.0f, &s2, NULL, 0.0f, false, 0, fmd->uvlayer_name, thresh);
- }
- else
- {
- s = BKE_fracture_shard_boolean(ob, *dm_parent, t, inner_mat_index, 0, 0.0f, NULL, NULL, 0.0f, false, 0, fmd->uvlayer_name, thresh);
- }
-
- //printf("Fractured: %d\n", k);
-
- if (ELEM(fmd->keep_cutter_shards, MOD_FRACTURE_KEEP_BOTH, MOD_FRACTURE_KEEP_INTERSECT)) {
- if (s != NULL) {
- fracture_shard_vgroup_add(s, ob, "Intersect");
- fracture_shard_material_add(s, ob, fmd->mat_ofs_intersect);
- fracture_shard_add(fmd->shared->frac_mesh, s, mat);
- shards++;
- s = NULL;
- }
- }
-
- if (ELEM(fmd->keep_cutter_shards, MOD_FRACTURE_KEEP_BOTH, MOD_FRACTURE_KEEP_DIFFERENCE)) {
- if (s2 != NULL) {
- fr
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list