Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2015-04-03 16:18:52 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-04-03 16:18:52 +0300
commit3cbdb312559684d4c69a1249e2678c817e122d45 (patch)
treee2670450278c0f61ab19e71d65b3a615ef85ffbd /source/blender/makesrna/intern/rna_cache_library.c
parent0ab2bb586e6ca29570c91332e6d66ef379f0dde1 (diff)
Added the major parameters for the hair simulation.
This is basically copied from existing cloth sim settings, with a good deal of cleanup and sanitization. Unlike cloth parameters, the damping values are described as relative to their associated stiffness values for springs. This is much easier to use in practice and less prone to lead to unstable simulations. Damping simply works best when the force is in the same order of magnitude as the stiffness, so having a relative factor requires much less adjustment on the user side.
Diffstat (limited to 'source/blender/makesrna/intern/rna_cache_library.c')
-rw-r--r--source/blender/makesrna/intern/rna_cache_library.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_cache_library.c b/source/blender/makesrna/intern/rna_cache_library.c
index aa18e4c0295..4de85f5895d 100644
--- a/source/blender/makesrna/intern/rna_cache_library.c
+++ b/source/blender/makesrna/intern/rna_cache_library.c
@@ -176,10 +176,71 @@ static void rna_def_hair_sim_params(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Hair Simulation Parameters", "Simulation parameters for hair simulation");
RNA_def_struct_ui_icon(srna, ICON_HAIR);
+ prop = RNA_def_property(srna, "timescale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "Time Scale", "Simulation time scale relative to scene time");
+ RNA_def_property_update(prop, 0, "rna_CacheModifier_update");
+
+ prop = RNA_def_property(srna, "substeps", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 80);
+ RNA_def_property_ui_text(prop, "Substeps", "Simulation steps per frame");
+ RNA_def_property_update(prop, 0, "rna_CacheModifier_update");
+
prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "EffectorWeights");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Effector Weights", "");
+
+ prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Mass", "Mass of hair vertices");
+ RNA_def_property_update(prop, 0, "rna_CacheModifier_update");
+
+ prop = RNA_def_property(srna, "drag", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "Drag", "Drag simulating friction with surrounding air");
+ RNA_def_property_update(prop, 0, "rna_CacheModifier_update");
+
+ prop = RNA_def_property(srna, "goal_stiffness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "Goal Strength", "Goal spring, pulling vertices toward their rest position");
+ RNA_def_property_update(prop, 0, "rna_CacheModifier_update");
+
+ prop = RNA_def_property(srna, "goal_damping", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Goal Damping", "Damping factor of goal springs");
+ RNA_def_property_update(prop, 0, "rna_CacheModifier_update");
+
+ prop = RNA_def_property(srna, "stretch_stiffness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "Stretch Stiffness", "Resistence to stretching");
+ RNA_def_property_update(prop, 0, "rna_CacheModifier_update");
+
+ prop = RNA_def_property(srna, "stretch_damping", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Stretch Damping", "Damping factor of stretch springs");
+ RNA_def_property_update(prop, 0, "rna_CacheModifier_update");
+
+ prop = RNA_def_property(srna, "bend_stiffness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "Bend Stiffness", "Resistance to bending of the rest shape");
+ RNA_def_property_update(prop, 0, "rna_CacheModifier_update");
+
+ prop = RNA_def_property(srna, "bend_damping", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Bend Damping", "Damping factor of bending springs");
+ RNA_def_property_update(prop, 0, "rna_CacheModifier_update");
}
static void rna_def_cache_modifier_hair_simulation(BlenderRNA *brna)