[Bf-blender-cvs] [e1ea9a4afd8] fracture_modifier: added constraint type setting for FM constraints
Martin Felke
noreply at git.blender.org
Fri Jun 16 18:43:35 CEST 2017
Commit: e1ea9a4afd8eac05a27a369acdd4dedb2e6c332f
Author: Martin Felke
Date: Fri Jun 16 18:43:15 2017 +0200
Branches: fracture_modifier
https://developer.blender.org/rBe1ea9a4afd8eac05a27a369acdd4dedb2e6c332f
added constraint type setting for FM constraints
previously there was only a cluster constraint setting
===================================================================
M release/scripts/startup/bl_operators/presets.py
M release/scripts/startup/bl_ui/properties_physics_fracture.py
M source/blender/blenkernel/intern/rigidbody.c
M source/blender/blenloader/intern/readfile.c
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/intern/rna_fracture.c
M source/blender/modifiers/intern/MOD_fracture.c
===================================================================
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
index 1f045e2e92b..98b84a5f323 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -689,7 +689,8 @@ class AddPresetFracture(AddPresetBase, Operator):
"fracture.material_offset_intersect",
"fracture.orthogonality_factor",
"fracture.keep_distort",
- "fracture.do_merge"
+ "fracture.do_merge",
+ "fracture.constraint_type"
]
preset_subdir = "fracture"
diff --git a/release/scripts/startup/bl_ui/properties_physics_fracture.py b/release/scripts/startup/bl_ui/properties_physics_fracture.py
index 675a640f1ec..a1bf23978a5 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fracture.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fracture.py
@@ -115,7 +115,9 @@ class PHYSICS_PT_fracture(PhysicButtonsPanel, Panel):
col.prop(md, "cluster_count")
col.prop(md, "point_seed")
layout.prop(md, "cluster_group")
- layout.prop(md, "cluster_constraint_type")
+ col = layout.column(align=True)
+ col.prop(md, "constraint_type")
+ col.prop(md, "cluster_constraint_type")
if md.frac_algorithm in {'BOOLEAN', 'BISECT_FILL', 'BISECT_FAST_FILL', 'BOOLEAN_FRACTAL'}:
col = layout.column()
col.prop(md, "inner_material")
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index c42ee663e98..c844be77d24 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1514,7 +1514,7 @@ static MeshIsland* find_closest_meshisland_to_point(FractureModifierData* fmd, O
mi2 = mi_array[ind];
//connect ?
- BKE_meshisland_constraint_create(fmd, mi, mi2, RBC_TYPE_FIXED, fmd->breaking_threshold);
+ BKE_meshisland_constraint_create(fmd, mi, mi2, fmd->constraint_type, fmd->breaking_threshold);
}
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index aea2b1fdafa..e22b43eaf8f 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5266,6 +5266,12 @@ static void load_fracture_modifier(FileData* fd, FractureModifierData *fmd)
fmd->dynamic_min_size = 1.0f;
}
+#if 0
+ if (fd->fileversion < 279) {
+ fmd->constraint_type = RBC_TYPE_FIXED;
+ }
+#endif
+
if (fm == NULL || fmd->dm_group) {
fmd->dm = NULL;
fmd->meshIslands.first = NULL;
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 7c87a5e22c5..bbaa970b294 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1715,6 +1715,7 @@ typedef struct FractureModifierData {
int fracture_mode;
int boolean_solver;
int dynamic_percentage;
+ int constraint_type;
float breaking_angle;
float breaking_distance;
@@ -1794,7 +1795,7 @@ typedef struct FractureModifierData {
short mat_ofs_intersect;
short mat_ofs_difference;
- char pad[4];
+ //char pad[4];
} FractureModifierData;
typedef struct DataTransferModifierData {
diff --git a/source/blender/makesrna/intern/rna_fracture.c b/source/blender/makesrna/intern/rna_fracture.c
index fecf0b0402c..daede62a9e9 100644
--- a/source/blender/makesrna/intern/rna_fracture.c
+++ b/source/blender/makesrna/intern/rna_fracture.c
@@ -359,6 +359,13 @@ static void rna_FractureModifier_use_breaking_set(PointerRNA *ptr, bool value)
}
}
+static void rna_FractureModifier_constraint_type_set(PointerRNA* ptr, int value)
+{
+ FractureModifierData *rmd = (FractureModifierData*)ptr->data;
+ rmd->constraint_type = value;
+ rmd->refresh_constraints = true;
+}
+
static void rna_FractureModifier_cluster_constraint_type_set(PointerRNA* ptr, int value)
{
FractureModifierData *rmd = (FractureModifierData*)ptr->data;
@@ -1076,6 +1083,14 @@ void RNA_def_fracture(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "constraint_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "constraint_type");
+ RNA_def_property_enum_items(prop, rna_enum_rigidbody_constraint_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_FractureModifier_constraint_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Constraint Type", "Type of Rigid Body Constraint between shards and inside clusters");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
prop = RNA_def_property(srna, "cluster_constraint_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "cluster_constraint_type");
RNA_def_property_enum_items(prop, rna_enum_rigidbody_constraint_type_items);
diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c
index aaac78e5b3a..c7df550bc0c 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -216,6 +216,7 @@ static void initData(ModifierData *md)
fmd->cutter_axis = MOD_FRACTURE_CUTTER_Z;
fmd->cluster_constraint_type = RBC_TYPE_FIXED;
+ fmd->constraint_type = RBC_TYPE_FIXED;
fmd->vert_index_map = NULL;
fmd->constraint_target = MOD_FRACTURE_CENTROID;
fmd->vertex_island_map = NULL;
@@ -1858,6 +1859,7 @@ static void copyData(ModifierData *md, ModifierData *target)
trmd->keep_distort = rmd->keep_distort;
trmd->do_merge = rmd->do_merge;
trmd->orthogonality_factor = rmd->orthogonality_factor;
+ trmd->constraint_type = rmd->constraint_type;
}
//XXXX TODO, is BB really useds still ? aint there exact volume calc now ?
@@ -2613,7 +2615,7 @@ static void search_tree_based(FractureModifierData *rmd, MeshIsland *mi, MeshIsl
}
if ((mi != mi2) && (mi2 != NULL)) {
float thresh = rmd->breaking_threshold;
- int con_type = rmd->use_compounds ? RBC_TYPE_COMPOUND : RBC_TYPE_FIXED;
+ int con_type = rmd->use_compounds ? RBC_TYPE_COMPOUND : rmd->constraint_type;
if ((i >= limit) && (limit > 0)) {
break;
More information about the Bf-blender-cvs
mailing list