[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28765] branches/render25/source/blender: version patch for 2.49 boids; be warned: this is not really at all correct , but hey at least no more crashing :)
Joseph Eagar
joeedh at gmail.com
Fri May 14 13:09:35 CEST 2010
Revision: 28765
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28765
Author: joeedh
Date: 2010-05-14 13:09:35 +0200 (Fri, 14 May 2010)
Log Message:
-----------
version patch for 2.49 boids; be warned: this is not really at all correct, but hey at least no more crashing :)
Modified Paths:
--------------
branches/render25/source/blender/blenloader/intern/readfile.c
branches/render25/source/blender/makesdna/DNA_particle_types.h
Modified: branches/render25/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/render25/source/blender/blenloader/intern/readfile.c 2010-05-14 10:50:43 UTC (rev 28764)
+++ branches/render25/source/blender/blenloader/intern/readfile.c 2010-05-14 11:09:35 UTC (rev 28765)
@@ -138,6 +138,7 @@
#include "BKE_sequencer.h"
#include "BKE_texture.h" // for open_plugin_tex
#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
+#include "BKE_boids.h"
#include "BKE_sound.h"
@@ -3057,6 +3058,41 @@
link_list(fd, &state->conditions);
link_list(fd, &state->actions);
}
+ } else if (part->phystype == PART_PHYS_BOIDS) {
+ /*not: this may not be a very good map. in fact, this whole bit of conversion code
+ is likely not very correct, but oh well at least it's better than nothing - joeedh*/
+ int typemap[] = {
+ eBoidRuleType_AvoidCollision, /* manoeuver to avoid collisions with other boids and deflector object in near future */
+ eBoidRuleType_Avoid, /* get away from assigned object or loudest assigned signal source */
+ eBoidRuleType_Separate, /* keep from going through other boids */
+ eBoidRuleType_Flock, /* move to center of neighbors and match their velocity */
+ eBoidRuleType_AverageSpeed, /* maintain speed, flight level or wander*/
+ eBoidRuleType_FollowLeader, /* follow a boid or assigned object */
+ eBoidRuleType_Goal, /* go to goal assigned object or loudest assigned signal source */
+ };
+ BoidState *state;
+ int tot = sizeof(typemap) / sizeof(*typemap);
+ int i, j;
+
+ /*missing boid data, probably from an older file; do version patch*/
+ part->boids = MEM_callocN(sizeof(BoidSettings), "BoidSettings in readfile.c");
+ boid_default_settings(part->boids);
+ state = boid_new_state(part->boids);
+ state->flag |= BOIDSTATE_CURRENT;
+
+ BLI_addtail(&part->boids->states, state);
+
+ for (i=0; i<tot; i++) {
+ for (j=0; j<tot; j++) {
+ if (part->boidrule[i] & (1<<j)) {
+ BoidRule *rule = boid_new_rule(typemap[i]);
+
+ BLI_addtail(&state->rules, rule);
+ //state->rule_fuzziness = part->boidfac[j];
+ break;
+ }
+ }
+ }
}
}
Modified: branches/render25/source/blender/makesdna/DNA_particle_types.h
===================================================================
--- branches/render25/source/blender/makesdna/DNA_particle_types.h 2010-05-14 10:50:43 UTC (rev 28764)
+++ branches/render25/source/blender/makesdna/DNA_particle_types.h 2010-05-14 11:09:35 UTC (rev 28765)
@@ -202,6 +202,10 @@
struct Ipo *ipo; // xxx depreceated... old animation system
struct PartDeflect *pd;
struct PartDeflect *pd2;
+
+ /*used for file patching*/
+ char boidrule[8];
+ float boidfac[8];
} ParticleSettings;
typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in copy_particlesystem */
More information about the Bf-blender-cvs
mailing list