[Bf-blender-cvs] [2ccdaf3] fracture_modifier: changed calculation of stability factor for compounds and adapted UI a bit (for compounds)
Martin Felke
noreply at git.blender.org
Wed Oct 28 17:38:44 CET 2015
Commit: 2ccdaf398e94dc7d56d7a5fe72c6c0d54317c9bb
Author: Martin Felke
Date: Wed Oct 28 17:38:34 2015 +0100
Branches: fracture_modifier
https://developer.blender.org/rB2ccdaf398e94dc7d56d7a5fe72c6c0d54317c9bb
changed calculation of stability factor for compounds and adapted UI a bit (for compounds)
===================================================================
M release/scripts/startup/bl_ui/properties_physics_fracture.py
M source/blender/blenkernel/intern/rigidbody.c
M source/blender/makesrna/intern/rna_modifier.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_physics_fracture.py b/release/scripts/startup/bl_ui/properties_physics_fracture.py
index f2048a3..0e405e5 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fracture.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fracture.py
@@ -156,17 +156,22 @@ class PHYSICS_PT_fracture_simulation(PhysicButtonsPanel, Panel):
col.prop(md, "constraint_limit", text="Constraint limit, per MeshIsland")
col.prop(md, "contact_dist")
- layout.label("Constraint Breaking Settings")
+ if md.use_compounds:
+ layout.label("Compound Breaking Settings")
+ else:
+ layout.label("Constraint Breaking Settings")
+
col = layout.column(align=True)
col.prop(md, "breaking_threshold", text="Threshold")
col.prop(md, "cluster_breaking_threshold")
if md.use_compounds:
- layout.label("Compound Damage Propagation Settings")
+ #layout.label("Compound Damage Propagation Settings")
col = layout.column(align=True)
col.prop(md, "minimum_impulse")
#col.prop(md, "impulse_dampening")
#col.prop(md, "directional_factor")
+ col.prop(md, "mass_threshold_factor")
else:
layout.label("Constraint Special Breaking Settings")
col = layout.column(align=True)
@@ -190,9 +195,7 @@ class PHYSICS_PT_fracture_simulation(PhysicButtonsPanel, Panel):
col = layout.column(align=True)
col.prop(md, "solver_iterations_override")
col.prop(md, "cluster_solver_iterations_override")
-
- layout.prop(md, "use_mass_dependent_thresholds")
- layout.prop(md, "mass_threshold_factor")
+ layout.prop(md, "use_mass_dependent_thresholds")
class PHYSICS_PT_fracture_utilities(PhysicButtonsPanel, Panel):
bl_label = "Fracture Utilities"
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index fd86064..07e1e64 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -191,16 +191,21 @@ void BKE_rigidbody_calc_threshold(float max_con_mass, FractureModifierData *rmd,
max_thresh = thresh = rmd->breaking_threshold;
if ((con->mi1->rigidbody != NULL) && (con->mi2->rigidbody != NULL)) {
- con_mass = con->mi1->rigidbody->mass + con->mi2->rigidbody->mass;
- if (rmd->use_mass_dependent_thresholds)
+ if (rmd->use_compounds)
{
- thresh = (con_mass / max_con_mass) * max_thresh;
- }
+ float min_mass = MIN2(con->mi1->rigidbody->mass, con->mi2->rigidbody->mass);
+ float max_mass = MAX2(con->mi1->rigidbody->mass, con->mi2->rigidbody->mass);
- if (rmd->mass_threshold_factor > 0.0f)
+ thresh = (min_mass + (rmd->mass_threshold_factor * max_mass) / min_mass + max_mass) * max_thresh;
+ }
+ else
{
- thresh = thresh * con_mass * rmd->mass_threshold_factor;
+ con_mass = con->mi1->rigidbody->mass + con->mi2->rigidbody->mass;
+ if (rmd->use_mass_dependent_thresholds)
+ {
+ thresh = (con_mass / max_con_mass) * max_thresh;
+ }
}
con->breaking_threshold = thresh;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 6b48257..ce8b47d 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5244,7 +5244,7 @@ static void rna_def_modifier_fracture(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, NULL, "rna_FractureModifier_mass_threshold_factor_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Stability Factor",
- "Determines how 'stable' an object is, by multiplying threshold * mass * this factor, 0 means disabled, 1 means highest mass dependent stability");
+ "Determines how 'stable' an object is 0 means min_mass / min_mass + max_mass, 1 means maximal threshold everywhere");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
More information about the Bf-blender-cvs
mailing list