From 44fb6bd1fa9f34b1f648f57aa3543512d3af4c48 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Mon, 7 Feb 2011 11:43:33 +0000 Subject: Hair ui simplification: * There were a lot of settings in the particle panels that made no sense for simple hair and only cluttered up the ui. * Now these settings are hidden by default unless "advanced" hair options are shown. * Without advanced options the particle velocity controls are replaced by a simple "hair length" value, which actually corresponds to the grown hair length in blender units. * Some hair effector options that are actually very useful were not shown in ui. These are now found in the "field weights" panel. --- source/blender/makesrna/intern/rna_particle.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'source/blender/makesrna/intern/rna_particle.c') diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 82e2eb96002..14afbf93373 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -387,6 +387,18 @@ static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value) settings->end = value; } +static void rna_PartSetting_hairlength_set(struct PointerRNA *ptr, float value) +{ + ParticleSettings *settings = (ParticleSettings*)ptr->data; + settings->normfac = value / 4.f; +} + +static float rna_PartSetting_hairlength_get(struct PointerRNA *ptr) +{ + ParticleSettings *settings = (ParticleSettings*)ptr->data; + return settings->normfac * 4.f; +} + static void rna_PartSetting_linelentail_set(struct PointerRNA *ptr, float value) { ParticleSettings *settings = (ParticleSettings*)ptr->data; @@ -1277,6 +1289,12 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PART_HIDE_ADVANCED_HAIR); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D); RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface"); @@ -1294,7 +1312,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT); - RNA_def_property_ui_text(prop, "Children", "Apply effectors to children"); + RNA_def_property_ui_text(prop, "Effect Children", "Apply effectors to children"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); prop= RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE); @@ -1776,6 +1794,13 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation phase"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_funcs(prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", NULL); + RNA_def_property_range(prop, 0.0f, 1000.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_ui_text(prop, "Hair Length", "Length of the hair"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + /* physical properties */ prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.001f, 100000.0f); -- cgit v1.2.3