[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31971] trunk/blender: Tiny addition to boids functionality: pitch value
Janne Karhu
jhkarh at gmail.com
Thu Sep 16 22:06:10 CEST 2010
Revision: 31971
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31971
Author: jhk
Date: 2010-09-16 22:06:10 +0200 (Thu, 16 Sep 2010)
Log Message:
-----------
Tiny addition to boids functionality: pitch value
* Controls maximum rotation around side vector (as opposed to banking, which controls rotation around forward vector)
Modified Paths:
--------------
trunk/blender/release/scripts/ui/properties_particle.py
trunk/blender/source/blender/blenkernel/intern/boids.c
trunk/blender/source/blender/blenloader/intern/readfile.c
trunk/blender/source/blender/makesdna/DNA_boid_types.h
trunk/blender/source/blender/makesrna/intern/rna_boid.c
Modified: trunk/blender/release/scripts/ui/properties_particle.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_particle.py 2010-09-16 20:00:30 UTC (rev 31970)
+++ trunk/blender/release/scripts/ui/properties_particle.py 2010-09-16 20:06:10 UTC (rev 31971)
@@ -512,6 +512,7 @@
col = row.column()
col.label(text="Misc:")
col.prop(boids, "bank", slider=True)
+ col.prop(boids, "pitch", slider=True)
col.prop(boids, "height", slider=True)
if part.physics_type == 'KEYED' or part.physics_type == 'BOIDS' or part.physics_type == 'FLUID':
Modified: trunk/blender/source/blender/blenkernel/intern/boids.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/boids.c 2010-09-16 20:00:30 UTC (rev 31970)
+++ trunk/blender/source/blender/blenkernel/intern/boids.c 2010-09-16 20:06:10 UTC (rev 31971)
@@ -1386,7 +1386,9 @@
/* save direction to state.ave unless the boid is falling */
/* (boids can't effect their direction when falling) */
if(bpa->data.mode!=eBoidMode_Falling && len_v3(pa->state.vel) > 0.1*pa->size) {
- normalize_v3_v3(pa->state.ave, pa->state.vel);
+ copy_v3_v3(pa->state.ave, pa->state.vel);
+ pa->state.ave[2] *= bbd->part->boids->pitch;
+ normalize_v3(pa->state.ave);
}
/* apply damping */
@@ -1471,6 +1473,7 @@
boids->landing_smoothness = 3.0f;
boids->banking = 1.0f;
+ boids->pitch = 1.0f;
boids->height = 1.0f;
boids->health = 1.0f;
Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c 2010-09-16 20:00:30 UTC (rev 31970)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c 2010-09-16 20:06:10 UTC (rev 31971)
@@ -11107,6 +11107,13 @@
}
}
+ {
+ ParticleSettings *part;
+ for(part = main->particle.first; part; part = part->id.next) {
+ if(part->boids)
+ part->boids->pitch = 1.0f;
+ }
+ }
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
Modified: trunk/blender/source/blender/makesdna/DNA_boid_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_boid_types.h 2010-09-16 20:00:30 UTC (rev 31970)
+++ trunk/blender/source/blender/makesdna/DNA_boid_types.h 2010-09-16 20:06:10 UTC (rev 31971)
@@ -187,8 +187,8 @@
typedef struct BoidSettings {
int options, last_state_id;
- float landing_smoothness, rt;
- float banking, height;
+ float landing_smoothness, height;
+ float banking, pitch;
float health, aggression;
float strength, accuracy, range;
Modified: trunk/blender/source/blender/makesrna/intern/rna_boid.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_boid.c 2010-09-16 20:00:30 UTC (rev 31970)
+++ trunk/blender/source/blender/makesrna/intern/rna_boid.c 2010-09-16 20:06:10 UTC (rev 31971)
@@ -480,6 +480,12 @@
RNA_def_property_ui_text(prop, "Banking", "Amount of rotation around velocity vector on turns");
RNA_def_property_update(prop, 0, "rna_Boids_reset");
+ prop= RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pitch");
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_text(prop, "Pitch", "Amount of rotation around side vector");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 2.0);
RNA_def_property_ui_text(prop, "Height", "Boid height relative to particle size");
More information about the Bf-blender-cvs
mailing list