diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-06-24 06:11:36 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-06-24 06:11:36 +0400 |
commit | db03788ad3ffe3a4c777b70fa5c53f99c5900620 (patch) | |
tree | 6af6952be2ce63b8298e7fb4a62f9ee068034fec | |
parent | 483e9479f73dca77fd3b6db7ede72849b1552859 (diff) |
2.5 - Particle Settings now Animateable
Added AnimData to ParticleSettings so that this will work. This seems to be ok in the brief tests I did, but be warned that this may not be optimal for the Particles System...
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 4 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 5 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_particle_types.h | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 11 |
5 files changed, 18 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 30dcb383ef6..441e17f3318 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -43,6 +43,7 @@ static short id_has_animdata (ID *id) case ID_OB: case ID_CU: case ID_KE: + case ID_PA: case ID_MA: case ID_TE: case ID_NT: case ID_LA: case ID_CA: case ID_WO: case ID_SCE: @@ -883,6 +884,9 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime) /* meshes */ // TODO... + /* particles */ + EVAL_ANIM_IDS(main->particle.first, ADT_RECALC_ANIM); + /* objects */ /* ADT_RECALC_ANIM doesn't need to be supplied here, since object AnimData gets * this tagged by Depsgraph on framechange diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 54caad7f35b..7921740cbe8 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2899,7 +2899,9 @@ static void lib_link_particlesettings(FileData *fd, Main *main) part= main->particle.first; while(part) { if(part->id.flag & LIB_NEEDLINK) { + if (part->adt) lib_link_animdata(fd, &part->id, part->adt); part->ipo= newlibadr_us(fd, part->id.lib, part->ipo); // XXX depreceated - old animation system + part->dup_ob = newlibadr(fd, part->id.lib, part->dup_ob); part->dup_group = newlibadr(fd, part->id.lib, part->dup_group); part->eff_group = newlibadr(fd, part->id.lib, part->eff_group); @@ -2912,6 +2914,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main) static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) { + part->adt= newdataadr(fd, part->adt); part->pd= newdataadr(fd, part->pd); part->pd2= newdataadr(fd, part->pd2); } @@ -9522,6 +9525,8 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting expand_doit(fd, mainvar, part->dup_group); expand_doit(fd, mainvar, part->eff_group); expand_doit(fd, mainvar, part->bb_ob); + + expand_animdata(fd, mainvar, part->adt); } static void expand_group(FileData *fd, Main *mainvar, Group *group) diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 172c081570b..565e8128f8c 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -382,6 +382,7 @@ static void writedata(WriteData *wd, int filecode, int len, void *adr) /* do not /*These functions are used by blender's .blend system for file saving/loading.*/ void IDP_WriteProperty_OnlyData(IDProperty *prop, void *wd); void IDP_WriteProperty(IDProperty *prop, void *wd); +void write_animdata(WriteData *wd, AnimData *adt); // XXX code needs reshuffling, but not before NLA SoC is merged back into 2.5 static void IDP_WriteArray(IDProperty *prop, void *wd) { @@ -575,6 +576,7 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase) /* write LibData */ writestruct(wd, ID_PA, "ParticleSettings", 1, part); if (part->id.properties) IDP_WriteProperty(part->id.properties, wd); + if (part->adt) write_animdata(wd, part->adt); writestruct(wd, DATA, "PartDeflect", 1, part->pd); writestruct(wd, DATA, "PartDeflect", 1, part->pd2); } diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index b10f35b9091..05f1cc1f351 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -34,6 +34,8 @@ #include "DNA_ID.h" +struct AnimData; + typedef struct HairKey { float co[3]; /* location of hair vertex */ float time; /* time along hair, default 0-100 */ @@ -100,6 +102,7 @@ typedef struct ParticleData { typedef struct ParticleSettings { ID id; + struct AnimData *adt; int flag; short type, from, distr; @@ -167,7 +170,7 @@ typedef struct ParticleSettings { struct Group *eff_group; struct Object *dup_ob; struct Object *bb_ob; - struct Ipo *ipo; + struct Ipo *ipo; // xxx depreceated... old animation system struct PartDeflect *pd; struct PartDeflect *pd2; } ParticleSettings; diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index c48c1006588..ae53c815ed9 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1470,14 +1470,9 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)"); RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); - -#if 0 - prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_pointer_sdna(prop, NULL, "ipo"); - RNA_def_property_struct_type(prop, "Ipo"); - RNA_def_property_ui_text(prop, "Ipo", ""); -#endif + + /* animation here? */ + rna_def_animdata_common(srna); // struct PartDeflect *pd; // struct PartDeflect *pd2; |