diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_particle.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 277 |
1 files changed, 207 insertions, 70 deletions
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 1151215f5f7..14afbf93373 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -95,6 +95,9 @@ EnumPropertyItem part_hair_ren_as_items[] = { #ifdef RNA_RUNTIME +#include "BLI_math.h" +#include "BLI_listbase.h" + #include "BKE_context.h" #include "BKE_cloth.h" #include "BKE_deform.h" @@ -104,9 +107,6 @@ EnumPropertyItem part_hair_ren_as_items[] = { #include "BKE_particle.h" #include "BKE_pointcache.h" -#include "BLI_math.h" -#include "BLI_listbase.h" - /* use for object space hair get/set */ static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt, ParticleData **pa_pt) { @@ -201,10 +201,10 @@ static void particle_recalc(Main *bmain, Scene *scene, PointerRNA *ptr, short fl psys->recalc = flag; - DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA); + DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA); } else - DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA|flag); + DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA|flag); WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL); } @@ -279,7 +279,7 @@ static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr psys->recalc = PSYS_RECALC_RESET; - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); DAG_scene_sort(bmain, scene); } @@ -295,13 +295,14 @@ static void rna_Particle_target_redo(Main *bmain, Scene *scene, PointerRNA *ptr) psys->recalc = PSYS_RECALC_REDO; - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL); } } static void rna_Particle_hair_dynamics(Main *bmain, Scene *scene, PointerRNA *ptr) { + Object *ob = (Object*)ptr->id.data; ParticleSystem *psys = (ParticleSystem*)ptr->data; if(psys && !psys->clmd) { @@ -313,6 +314,8 @@ static void rna_Particle_hair_dynamics(Main *bmain, Scene *scene, PointerRNA *pt } else WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL); + + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } static PointerRNA rna_particle_settings_get(PointerRNA *ptr) { @@ -325,15 +328,21 @@ static PointerRNA rna_particle_settings_get(PointerRNA *ptr) static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value) { ParticleSystem *psys= (ParticleSystem*)ptr->data; + int old_type = 0; + - if(psys->part) + if(psys->part) { + old_type = psys->part->type; psys->part->id.us--; + } psys->part = (ParticleSettings *)value.data; if(psys->part) { psys->part->id.us++; psys_check_boid_data(psys); + if(old_type != psys->part->type) + psys->recalc |= PSYS_RECALC_TYPE; } } static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -378,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; @@ -414,6 +435,14 @@ static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr) return settings->draw_line[1]; } + +static int rna_PartSettings_is_fluid_get(PointerRNA *ptr) +{ + ParticleSettings *part= (ParticleSettings*)ptr->data; + + return part->type == PART_FLUID; +} + static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr) { ParticleSystem *psys= (ParticleSystem*)ptr->data; @@ -512,6 +541,27 @@ static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str) else strcpy(str, "Invalid target!"); } + +static int particle_id_check(PointerRNA *ptr) +{ + ID *id= ptr->id.data; + + return (GS(id->name) == ID_PA); +} + +static char *rna_SPHFluidSettings_path(PointerRNA *ptr) +{ + SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data; + + if(particle_id_check(ptr)) { + ParticleSettings *part = (ParticleSettings*)ptr->id.data; + + if (part->fluid == fluid) + return BLI_sprintfN("fluid"); + } + return NULL; +} + static int rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr) { ParticleSystem *psys= (ParticleSystem*)ptr->data; @@ -697,6 +747,12 @@ static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int i } } +static char *rna_ParticleSystem_path(PointerRNA *ptr) +{ + ParticleSystem *psys= (ParticleSystem*)ptr->data; + return BLI_sprintfN("particle_systems[\"%s\"]", psys->name); +} + /* irritating string functions for each index :/ */ static void rna_ParticleVGroup_name_get_0(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 0); } static void rna_ParticleVGroup_name_get_1(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 1); } @@ -863,7 +919,7 @@ static void rna_def_particle(BlenderRNA *brna) /* Hair & Keyed Keys */ - prop= RNA_def_property(srna, "is_hair", PROP_COLLECTION, PROP_NONE); + prop= RNA_def_property(srna, "hair", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey"); RNA_def_property_struct_type(prop, "ParticleHairKey"); RNA_def_property_ui_text(prop, "Hair", ""); @@ -936,7 +992,7 @@ static void rna_def_particle_dupliweight(BlenderRNA *brna) RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED); - RNA_def_property_range(prop, 0, INT_MAX); + RNA_def_property_range(prop, 0, SHRT_MAX); RNA_def_property_ui_text(prop, "Count", "The number of times this object is repeated with respect to other objects"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); } @@ -947,64 +1003,94 @@ static void rna_def_fluid_settings(BlenderRNA *brna) PropertyRNA *prop; srna = RNA_def_struct(brna, "SPHFluidSettings", NULL); + RNA_def_struct_path_func(srna, "rna_SPHFluidSettings_path"); RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics"); /* Fluid settings */ prop= RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "spring_k"); - RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Spring", "Spring force constant"); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); + RNA_def_property_range(prop, 0.0f, 100.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_ui_text(prop, "Spring Force", "Spring force"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "radius"); - RNA_def_property_range(prop, 0.0f, 2.0f); - RNA_def_property_ui_text(prop, "Radius", "Fluid interaction Radius"); + RNA_def_property_range(prop, 0.0f, 20.0f); + RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3); + RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + /* Hidden in ui to give a little easier user experience. */ prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "rest_length"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Rest Length", "The Spring Rest Length (factor of interaction radius)"); - RNA_def_property_update(prop, 0, "rna_Particle_reset"); + RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of interaction radius)"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_VISCOELASTIC_SPRINGS); + RNA_def_property_ui_text(prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH); + RNA_def_property_ui_text(prop, "Initial Rest Length", "Use the initial length as spring rest length instead of interaction radius/2"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "plasticity_constant"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Plasticity", "How much the spring rest length can change after the elastic limit is crossed"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + + prop= RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "yield_ratio"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Elastic Limit", "How much the spring has to be stretched/compressed in order to change it's rest length"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); /* Viscosity */ - prop= RNA_def_property(srna, "viscosity_omega", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "viscosity_omega"); RNA_def_property_range(prop, 0.0f, 100.0f); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); - prop= RNA_def_property(srna, "viscosity_beta", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "square_viscosity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "viscosity_beta"); RNA_def_property_range(prop, 0.0f, 100.0f); - RNA_def_property_ui_text(prop, "Square viscosity", "Square viscosity factor"); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_ui_text(prop, "Square viscosity", "Square viscosity"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); /* Double density relaxation */ - prop= RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "density_force", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "stiffness_k"); RNA_def_property_range(prop, 0.0f, 100.0f); - RNA_def_property_ui_text(prop, "Stiffness ", "Constant K - Stiffness"); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_ui_text(prop, "Density Force", "How strongly the fluid tends to rest density"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); - prop= RNA_def_property(srna, "stiffness_near", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "repulsion_force", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "stiffness_knear"); RNA_def_property_range(prop, 0.0f, 100.0f); - RNA_def_property_ui_text(prop, "Repulsion", "Repulsion factor: stiffness_knear"); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3); + RNA_def_property_ui_text(prop, "Repulsion", "How strongly the fluid tries to keep from clustering"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rest_density"); - RNA_def_property_range(prop, 0.0f, 100.0f); - RNA_def_property_ui_text(prop, "Rest Density", "Density"); + RNA_def_property_range(prop, 0.0f, 1000.0f); + RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3); + RNA_def_property_ui_text(prop, "Rest Density", "Rest density of the fluid"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); /* Buoyancy */ prop= RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "buoyancy"); RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Buoyancy", ""); + RNA_def_property_ui_text(prop, "Buoyancy", "Artificial buoyancy force in negative gravity direction based on pressure differences inside the fluid"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); } @@ -1066,8 +1152,8 @@ static void rna_def_particle_settings(BlenderRNA *brna) static EnumPropertyItem child_type_items[] = { {0, "NONE", 0, "None", ""}, - {PART_CHILD_PARTICLES, "PARTICLES", 0, "Particles", ""}, - {PART_CHILD_FACES, "FACES", 0, "Faces", ""}, + {PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""}, + {PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""}, {0, NULL, 0, NULL, NULL} }; @@ -1133,6 +1219,12 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems"); RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA); + /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */ + prop= RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", NULL); + RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation"); + /* flag */ prop= RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END); @@ -1146,6 +1238,11 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Multi React", "React multiple times"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "regrow_hair", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_REGROW); + RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + prop= RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN); RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted"); @@ -1192,26 +1289,17 @@ 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"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); - prop= RNA_def_property(srna, "use_branching", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BRANCHING); - RNA_def_property_ui_text(prop, "Branching", "Branch child paths from each other"); - RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); - - prop= RNA_def_property(srna, "use_animate_branching", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ANIM_BRANCHING); - RNA_def_property_ui_text(prop, "Animated", "Animate branching"); - RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); - - prop= RNA_def_property(srna, "use_symmetric_branching", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SYMM_BRANCHING); - RNA_def_property_ui_text(prop, "Symmetric", "Start and end points are the same"); - RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); - prop= RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE); RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines"); @@ -1219,18 +1307,18 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT); - RNA_def_property_ui_text(prop, "Invert", "Invert what is considered object and what is not"); + RNA_def_property_ui_text(prop, "Invert Grid", "Invert what is considered object and what is not"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); 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, "child_seams", PROP_BOOLEAN, PROP_NONE); - //RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_SEAMS); - //RNA_def_property_ui_text(prop, "Use seams", "Use seams to determine parents"); - //RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + prop= RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_LONG_HAIR); + RNA_def_property_ui_text(prop, "Long Hair", "Calculate children that suit long hair well"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); prop= RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE); @@ -1390,7 +1478,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "draw_size", PROP_INT, PROP_NONE); RNA_def_property_range(prop, 0, 1000); - RNA_def_property_ui_range(prop, 1, 100, 1, 0); + RNA_def_property_ui_range(prop, 0, 100, 1, 0); RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in pixels (0=default)"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); @@ -1420,7 +1508,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) //TODO: not found in UI, readonly? prop= RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 0, INT_MAX);//TODO:min,max + RNA_def_property_range(prop, 0, SHRT_MAX);//TODO:min,max RNA_def_property_ui_text(prop, "Keys Step", ""); /* adaptive path rendering */ @@ -1614,11 +1702,17 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "grid_res"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_range(prop, 1, 46); /* ~100k particles in a cube */ - RNA_def_property_ui_range(prop, 1, 215, 1, 0); /* ~10M particles in a cube */ + RNA_def_property_range(prop, 1, 250); /* ~15M particles in a cube (ouch!), but could be very usable in a plane */ + RNA_def_property_ui_range(prop, 1, 50, 1, 0); /* ~100k particles in a cube */ RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "grid_rand"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations"); + RNA_def_property_update(prop, 0, "rna_Particle_reset"); + /* initial velocity factors */ prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "normfac");//optional if prop names are the same @@ -1700,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); @@ -1821,6 +1922,12 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset"); RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + prop= RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "kink_amp_clump"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump effects kink amplitude"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + prop= RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "kink_freq"); RNA_def_property_range(prop, -100000.0f, 100000.0f); @@ -1833,6 +1940,10 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end"); RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + prop= RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); /* rough */ prop= RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE); @@ -1894,6 +2005,25 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by child path length"); RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + /* parting */ + prop= RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "parting_fac"); + RNA_def_property_range(prop, 0.0f, 1.0f); + RNA_def_property_ui_text(prop, "Parting Factor", "Create parting in the children based on parent strands"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + + prop= RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "parting_min"); + RNA_def_property_range(prop, 0.0f, 180.0f); + RNA_def_property_ui_text(prop, "Parting Minimum", "Minimum root to tip angle (tip distance/root distance for long hair)"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + + prop= RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "parting_max"); + RNA_def_property_range(prop, 0.0f, 180.0f); + RNA_def_property_ui_text(prop, "Parting Maximum", "Maximum root to tip angle (tip distance/root distance for long hair)"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + /* branching */ prop= RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "branch_thres"); @@ -1942,18 +2072,6 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3); RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); - - /* boids */ - prop= RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "BoidSettings"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Boid Settings", ""); - - /* Fluid particles */ - prop= RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "SPHFluidSettings"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "SPH Fluid Settings", ""); /* draw objects & groups */ prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE); @@ -1991,6 +2109,19 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); + /* boids */ + prop= RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "BoidSettings"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Boid Settings", ""); + + /* Fluid particles */ + prop= RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "SPHFluidSettings"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "SPH Fluid Settings", ""); + + /* Effector weights */ 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); @@ -2109,6 +2240,10 @@ static void rna_def_particle_system(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Seed", "Offset in the random number table, to get a different randomized result"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); + prop= RNA_def_property(srna, "child_seed", PROP_INT, PROP_UNSIGNED); + RNA_def_property_ui_text(prop, "Child Seed", "Offset in the random number table for child particles, to get a different randomized result"); + RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + /* hair */ prop= RNA_def_property(srna, "is_global_hair", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_GLOBAL_HAIR); @@ -2136,7 +2271,7 @@ static void rna_def_particle_system(BlenderRNA *brna) prop= RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "target_psys"); - RNA_def_property_range(prop, 1, INT_MAX); + RNA_def_property_range(prop, 1, SHRT_MAX); RNA_def_property_ui_text(prop, "Reactor Target Particle System", "For reactor systems, index of particle system on the target object"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); @@ -2336,15 +2471,17 @@ static void rna_def_particle_system(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_edited_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode"); + + + RNA_def_struct_path_func(srna, "rna_ParticleSystem_path"); } void RNA_def_particle(BlenderRNA *brna) { rna_def_particle_target(brna); - + rna_def_fluid_settings(brna); rna_def_particle_hair_key(brna); rna_def_particle_key(brna); - rna_def_fluid_settings(brna); rna_def_child_particle(brna); rna_def_particle(brna); |