[Bf-blender-cvs] [bf3bb95] fracture_modifier: added dynamic minimum shard size as option
Martin Felke
noreply at git.blender.org
Thu Oct 13 21:51:53 CEST 2016
Commit: bf3bb9509758f5386b6d62c67c203662bf72a3f5
Author: Martin Felke
Date: Thu Oct 13 21:51:35 2016 +0200
Branches: fracture_modifier
https://developer.blender.org/rBbf3bb9509758f5386b6d62c67c203662bf72a3f5
added dynamic minimum shard size as option
===================================================================
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_modifier.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 b0cb74f..cd6d123 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -681,7 +681,8 @@ class AddPresetFracture(AddPresetBase, Operator):
"fracture.boolean_solver",
"fracture.boolean_double_threshold",
"fracture.dynamic_percentage",
- "fracture.dynamic_new_constraints"
+ "fracture.dynamic_new_constraints",
+ "fracture.dynamic_min_size"
]
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 2dba3b3..ce01175 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fracture.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fracture.py
@@ -95,9 +95,11 @@ class PHYSICS_PT_fracture(PhysicButtonsPanel, Panel):
row = layout.row(align=True)
row.prop(md, "dynamic_force")
row.prop(md, "dynamic_percentage")
- col = layout.column()
+ col = layout.column(align=True)
col.prop(md, "dynamic_new_constraints")
- col.prop(md, "limit_impact")
+ row = col.row(align=True)
+ row.prop(md, "limit_impact")
+ row.prop(md, "dynamic_min_size")
layout.prop(md, "frac_algorithm")
if md.frac_algorithm in {'BOOLEAN', 'BOOLEAN_FRACTAL'}:
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 60ee9c0..318d2bb 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -2085,7 +2085,7 @@ static MeshIsland* findMeshIsland(FractureModifierData *fmd, int id)
static bool check_shard_size(FractureModifierData *fmd, int id)
{
FractureID *fid;
- float size = 1.0f, diff[3];
+ float size = fmd->dynamic_min_size, diff[3];
Shard *s = NULL;
s = findShard(fmd, id);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index e86dea9..0fe0705 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5246,6 +5246,7 @@ static void load_fracture_modifier(FileData* fd, FractureModifierData *fmd)
fmd->keep_cutter_shards = MOD_FRACTURE_KEEP_BOTH;
fmd->dynamic_new_constraints = MOD_FRACTURE_ALL_DYNAMIC_CONSTRAINTS;
fmd->dynamic_percentage = 0;
+ fmd->dynamic_min_size = 1.0f;
}
if (fm == NULL || fmd->dm_group) {
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 22ef3b2..a4598f1 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1736,6 +1736,7 @@ typedef struct FractureModifierData {
float directional_factor;
float mass_threshold_factor;
float boolean_double_threshold;
+ float dynamic_min_size;
/* flags */
int refresh;
@@ -1781,7 +1782,7 @@ typedef struct FractureModifierData {
int keep_cutter_shards;
- //char pad[4];
+ char pad[4];
} FractureModifierData;
typedef struct DataTransferModifierData {
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index fd22d36..207aafb 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -6414,6 +6414,12 @@ static void rna_def_modifier_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, "dynamic_min_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dynamic_min_size");
+ RNA_def_property_range(prop, 0.001f, 10000.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Minimum Size", "Minimum shard size in blenderunits");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
/*Fracture Modifiers own python / RNA API */
diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c
index 7d47e1f..6e0c8f0 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -225,6 +225,7 @@ static void initData(ModifierData *md)
fmd->boolean_double_threshold = 1e-6f;
fmd->dynamic_percentage = 0.0f;
fmd->dynamic_new_constraints = MOD_FRACTURE_ALL_DYNAMIC_CONSTRAINTS;
+ fmd->dynamic_min_size = 1.0f;
}
//XXX TODO, freeing functionality should be in BKE too
@@ -1795,6 +1796,7 @@ static void copyData(ModifierData *md, ModifierData *target)
trmd->dynamic_percentage = rmd->dynamic_percentage;
trmd->dynamic_new_constraints = rmd->dynamic_new_constraints;
+ trmd->dynamic_min_size = rmd->dynamic_min_size;
}
//XXXX TODO, is BB really useds still ? aint there exact volume calc now ?
More information about the Bf-blender-cvs
mailing list