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:
authorJanne Karhu <jhkarh@gmail.com>2009-07-04 07:50:12 +0400
committerJanne Karhu <jhkarh@gmail.com>2009-07-04 07:50:12 +0400
commit66918b3add4dfc90a8074f4bdc1c797ae9bf1371 (patch)
treeb1cae9c0532cac2288b157034a3fa83c699bbbfb /source/blender/makesrna
parent2c71b12998e380ff191b9cb94de22685595afaac (diff)
A bunch of fun stuff now possible because of new pointcache code:
* Baked normal particles can now use the "Path" visualization. * Path "max length" & "abs length" are now history: - New option to set path start & end times + random variation to length. - Much more flexible (and calculated better) than previous options. - This works with parents, children, hair & normal particles unlike old length option. - Only known issue for now is that children from faces don't get calculated correctly when using path start time. * New option "trails" for "halo", "line" and "billboard" visualizations: - Draws user controllable number of particle instances along particles path backwards from current position. - Works with children too for cool/weird visualizations that weren't possible before. * Normal particle children's velocities are now approximated better when needed so that "line" visualization trails will look nice. * New particle instance modifier options: - "path"-option works better and has controllable (max)position along path (with random variation possible). - "keep shape"-option for hair, keyed, or baked particles allows to place the instances to a single point (with random variation possible) along particle path. - "axis" option to make rotation handling better (still not perfect, but will have to do for now). Some fixes & cleanup done along the way: * Random path length didn't work for non-child particles. * Cached & unborn particles weren't reset to emit locations. * Particle numbers weren't drawn in the correct place. * Setting proper render & draw visualizations was lost somewhere when initializing new particle settings. * Changing child mode wasn't working correctly. * Some cleanup & modularization of particle child effector code and particle drawing & rendering code. * Object & group visualizations didn't work. * Child simplification didn't work.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c30
-rw-r--r--source/blender/makesrna/intern/rna_particle.c73
2 files changed, 86 insertions, 17 deletions
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 48bfdf70171..f4c14a51b13 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -1300,6 +1300,13 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
+ static EnumPropertyItem particleinstance_axis[] = {
+ {0, "X", 0, "X", ""},
+ {1, "Y", 0, "Y", ""},
+ {2, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
srna= RNA_def_struct(brna, "ParticleInstanceModifier", "Modifier");
RNA_def_struct_ui_text(srna, "ParticleInstance Modifier", "Particle system instancing modifier.");
RNA_def_struct_sdna(srna, "ParticleInstanceModifierData");
@@ -1316,6 +1323,12 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
RNA_def_property_range(prop, 1, 10);
RNA_def_property_ui_text(prop, "Particle System Number", "");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "axis");
+ RNA_def_property_enum_items(prop, particleinstance_axis);
+ RNA_def_property_ui_text(prop, "Axis", "Pole axis for rotation");
+ RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
prop= RNA_def_property(srna, "normal", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Parents);
@@ -1346,6 +1359,23 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Dead);
RNA_def_property_ui_text(prop, "Dead", "Show instances when particles are dead.");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "keep_shape", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_KeepShape);
+ RNA_def_property_ui_text(prop, "Keep Shape", "Don't stretch the object.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "position");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Position", "Position along path.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
+
+ prop= RNA_def_property(srna, "random_position", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "random_position");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Random Position", "Randomize position along path.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
}
static void rna_def_modifier_explode(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index d60a215b498..5c94c81da1f 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -151,6 +151,20 @@ static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
if(psys->part)
psys->part->id.us++;
}
+static void rna_Particle_abspathtime_update(bContext *C, PointerRNA *ptr)
+{
+ ParticleSettings *settings = (ParticleSettings*)ptr->data;
+ float delta = settings->end + settings->lifetime - settings->sta;
+ if(settings->draw & PART_ABS_PATH_TIME) {
+ settings->path_start = settings->sta + settings->path_start * delta;
+ settings->path_end = settings->sta + settings->path_end * delta;
+ }
+ else {
+ settings->path_start = (settings->path_start - settings->sta)/delta;
+ settings->path_end = (settings->path_end - settings->sta)/delta;
+ }
+ rna_Particle_redo(C, ptr);
+}
static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value)
{
ParticleSettings *settings = (ParticleSettings*)ptr->data;
@@ -189,7 +203,19 @@ static float rna_PartSetting_linelentail_get(struct PointerRNA *ptr)
ParticleSettings *settings = (ParticleSettings*)ptr->data;
return settings->draw_line[0];
}
+static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max)
+{
+ ParticleSettings *settings = (ParticleSettings*)ptr->data;
+ if(settings->type==PART_HAIR) {
+ *min = 0.0f;
+ *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0;
+ }
+ else {
+ *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
+ *max= (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
+ }
+}
static void rna_PartSetting_linelenhead_set(struct PointerRNA *ptr, float value)
{
ParticleSettings *settings = (ParticleSettings*)ptr->data;
@@ -702,15 +728,15 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Abs Length", "Use maximum length for children");
RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
- prop= RNA_def_property(srna, "absolute_time", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ABS_TIME);
- RNA_def_property_ui_text(prop, "Absolute Time", "Set all ipos that work on particles to be calculated in absolute/relative time.");
- RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
+ //prop= RNA_def_property(srna, "absolute_time", PROP_BOOLEAN, PROP_NONE);
+ //RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ABS_TIME);
+ //RNA_def_property_ui_text(prop, "Absolute Time", "Set all ipos that work on particles to be calculated in absolute/relative time.");
+ //RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
- prop= RNA_def_property(srna, "global_time", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GLOB_TIME);
- RNA_def_property_ui_text(prop, "Global Time", "Set all ipos that work on particles to be calculated in global/object time.");
- RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
+ //prop= RNA_def_property(srna, "global_time", PROP_BOOLEAN, PROP_NONE);
+ //RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GLOB_TIME);
+ //RNA_def_property_ui_text(prop, "Global Time", "Set all ipos that work on particles to be calculated in global/object time.");
+ //RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "boids_2d", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D);
@@ -836,15 +862,10 @@ static void rna_def_particle_settings(BlenderRNA *brna)
//RNA_def_property_ui_text(prop, "Health", "Draw boid health");
//RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
- //prop= RNA_def_property(srna, "timed_path", PROP_BOOLEAN, PROP_NONE);
- //RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_TIMED_PATH);
- //RNA_def_property_ui_text(prop, "Clip with time", "Clip path based on time");
- //RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
-
- //prop= RNA_def_property(srna, "draw_cached_path", PROP_BOOLEAN, PROP_NONE);
- //RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_CACHED_PATH);
- //RNA_def_property_ui_text(prop, "Path", "Draw particle path if the path is baked");
- //RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
+ prop= RNA_def_property(srna, "abs_path_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_ABS_PATH_TIME);
+ RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_abspathtime_update");
prop= RNA_def_property(srna, "billboard_lock", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK);
@@ -1410,6 +1431,24 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
+ prop= RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "path_start");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
+ RNA_def_property_ui_text(prop, "Path Start", "Starting time of drawn path.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
+
+ prop= RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "path_end");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
+ RNA_def_property_ui_text(prop, "Path End", "End time of drawn path.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
+
+ prop= RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "trail_count");
+ RNA_def_property_range(prop, 1.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
+
/* boids */
prop= RNA_def_property(srna, "max_velocity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "max_vel");