diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_action.h | 23 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_animsys.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_fcurve.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_main.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 72 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 189 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 47 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/key.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 23 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/world.c | 5 |
15 files changed, 243 insertions, 152 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 444a97364ab..9ef91d60e89 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -40,7 +40,7 @@ * The following structures are defined in DNA_action_types.h, and DNA_anim_types.h */ -struct nAction; +struct bAction; struct bPose; struct bPoseChannel; struct Object; @@ -52,23 +52,28 @@ struct ID; extern "C" { #endif -struct nAction *add_empty_action(const char name[]); +struct bAction *add_empty_action(const char name[]); /** * Allocate a new bAction on the heap and copy * the contents of src into it. If src is NULL NULL is returned. */ -struct nAction *copy_action(struct nAction *src); +struct bAction *copy_action(struct bAction *src); /** * Deallocate the action's channels including constraint channels. * does not free the action structure. */ -void free_action(struct nAction *act); +void free_action(struct bAction *act); // XXX is this needed? -void make_local_action(struct nAction *act); +void make_local_action(struct bAction *act); + +/** + * Some kind of bounding box operation on the action. + */ +void calc_action_range(const struct bAction *act, float *start, float *end, int incl_hidden); /** * Removes and deallocates all channels from a pose. @@ -115,21 +120,19 @@ struct bPoseChannel *verify_pose_channel(struct bPose* pose, void update_pose_constraint_flags(struct bPose *pose); /* clears BONE_UNKEYED flags for frame changing */ +// XXX to be depreceated for a more general solution in animsys... void framechange_poses_clear_unkeyed(void); /** - * Some kind of bounding box operation on the action. - */ -void calc_action_range(const struct bAction *act, float *start, float *end, int incl_hidden); - -/** * Set the pose channels from the given action. */ +// XXX old crap void extract_pose_from_action(struct bPose *pose, struct bAction *act, float ctime); /** * Get the effects of the given action using a workob */ +// XXX old crap, used for action constraint though! void what_does_obaction(struct Scene *scene, struct Object *ob, struct Object *workob, struct bAction *act, float cframe); /* exported for game engine */ diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index f8a5d91bfa5..3b6b01a2341 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -19,6 +19,12 @@ struct AnimData *BKE_animdata_from_id(struct ID *id); /* Add AnimData to the given ID-block */ struct AnimData *BKE_id_add_animdata(struct ID *id); +/* Free AnimData */ +void BKE_free_animdata(struct ID *id); + +/* Copy AnimData */ +struct AnimData *BKE_copy_animdata(struct AnimData *adt); + /* ************************************* */ // TODO: overrides, remapping, and path-finding api's diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 82914cbfd59..7a71168684e 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -79,6 +79,9 @@ void fcurve_bake_modifiers(struct FCurve *fcu, int start, int end); void free_fcurve(struct FCurve *fcu); struct FCurve *copy_fcurve(struct FCurve *fcu); +void free_fcurves(ListBase *list); +void copy_fcurves(ListBase *dst, ListBase *src); + /* find matching F-Curve in the given list of F-Curves */ struct FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_index); diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index 34ecb2bbba1..30cf800a3d8 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -62,7 +62,7 @@ typedef struct Main { ListBase latt; ListBase lamp; ListBase camera; - ListBase ipo; + ListBase ipo; // XXX depreceated ListBase key; ListBase world; ListBase screen; diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index a7427b1b306..eb68b1f3a6a 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -81,9 +81,9 @@ /* ***************** Library data level operations on action ************** */ -nAction *add_empty_action(const char name[]) +bAction *add_empty_action(const char name[]) { - nAction *act; + bAction *act; act= alloc_libblock(&G.main->action, ID_AC, name); act->id.flag |= LIB_FAKEUSER; // XXX this is nasty for new users... maybe we don't want this anymore @@ -93,10 +93,10 @@ nAction *add_empty_action(const char name[]) } // does copy_fcurve... -void make_local_action(nAction *act) +void make_local_action(bAction *act) { // Object *ob; - nAction *actn; + bAction *actn; int local=0, lib=0; if (act->id.lib==0) return; @@ -147,19 +147,14 @@ void make_local_action(nAction *act) } -void free_action (nAction *act) +void free_action (bAction *act) { - FCurve *fcu; - /* sanity check */ if (act == NULL) return; /* Free F-Curves */ - while ((fcu= act->curves.first)) { - BLI_remlink(&act->curves, fcu); - free_fcurve(fcu); - } + free_fcurves(&act->curves); /* Free groups */ if (act->groups.first) @@ -170,39 +165,20 @@ void free_action (nAction *act) BLI_freelistN(&act->markers); } -nAction *copy_action (nAction *src) +bAction *copy_action (bAction *src) { - nAction *dst = NULL; - //bActionChannel *dchan, *schan; - // bActionGroup *dgrp, *sgrp; - - if (!src) return NULL; + bAction *dst = NULL; + //bActionGroup *dgrp, *sgrp; // XXX not used yet + if (src == NULL) + return NULL; dst= copy_libblock(src); - BLI_duplicatelist(&(dst->chanbase), &(src->chanbase)); - BLI_duplicatelist(&(dst->groups), &(src->groups)); - BLI_duplicatelist(&(dst->markers), &(src->markers)); + BLI_duplicatelist(&dst->groups, &src->groups); // XXX not used yet + BLI_duplicatelist(&dst->markers, &src->markers); -#if 0 // XXX old animation system - for (dchan=dst->chanbase.first, schan=src->chanbase.first; dchan; dchan=dchan->next, schan=schan->next) { - for (dgrp=dst->groups.first, sgrp=src->groups.first; dgrp && sgrp; dgrp=dgrp->next, sgrp=sgrp->next) { - if (dchan->grp == sgrp) { - dchan->grp= dgrp; - - if (dgrp->channels.first == schan) - dgrp->channels.first= dchan; - if (dgrp->channels.last == schan) - dgrp->channels.last= dchan; - - break; - } - } - - dchan->ipo = copy_ipo(dchan->ipo); - copy_constraint_channels(&dchan->constraintChannels, &schan->constraintChannels); - } -#endif // XXX old animation system + /* copy f-curves */ + copy_fcurves(&dst->curves, &src->curves); dst->id.flag |= LIB_FAKEUSER; // XXX this is nasty for new users... maybe we don't want this anymore dst->id.us++; @@ -219,12 +195,13 @@ bPoseChannel *get_pose_channel(const bPose *pose, const char *name) { bPoseChannel *chan; - if(pose==NULL) return NULL; + if (pose==NULL) return NULL; for (chan=pose->chanbase.first; chan; chan=chan->next) { - if(chan->name[0] == name[0]) + if (chan->name[0] == name[0]) { if (!strcmp (chan->name, name)) return chan; + } } return NULL; @@ -236,11 +213,10 @@ bPoseChannel *verify_pose_channel(bPose* pose, const char* name) { bPoseChannel *chan; - if (!pose) { + if (pose == NULL) return NULL; - } - /* See if this channel exists */ + /* See if this channel exists */ for (chan=pose->chanbase.first; chan; chan=chan->next) { if (!strcmp (name, chan->name)) return chan; @@ -249,10 +225,10 @@ bPoseChannel *verify_pose_channel(bPose* pose, const char* name) /* If not, create it and add it */ chan = MEM_callocN(sizeof(bPoseChannel), "verifyPoseChannel"); - strncpy (chan->name, name, 31); + strncpy(chan->name, name, 31); /* init vars to prevent math errors */ - chan->quat[0] = 1.0F; - chan->size[0] = chan->size[1] = chan->size[2] = 1.0F; + chan->quat[0] = 1.0f; + chan->size[0] = chan->size[1] = chan->size[2] = 1.0f; chan->limitmin[0]= chan->limitmin[1]= chan->limitmin[2]= -180.0f; chan->limitmax[0]= chan->limitmax[1]= chan->limitmax[2]= 180.0f; @@ -285,7 +261,7 @@ bPoseChannel *get_active_posechannel (Object *ob) /* dst should be freed already, makes entire duplicate */ -void copy_pose(bPose **dst, bPose *src, int copycon) +void copy_pose (bPose **dst, bPose *src, int copycon) { bPose *outPose; bPoseChannel *pchan; diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 18172488908..fb2a9731a40 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -12,6 +12,7 @@ #include "BLI_dynstr.h" #include "BKE_animsys.h" +#include "BKE_action.h" #include "BKE_fcurve.h" #include "BKE_main.h" #include "BKE_utildefines.h" @@ -24,36 +25,52 @@ /* ***************************************** */ /* AnimData API */ -/* Get AnimData from the given ID-block. In order for this to work, we assume that - * the AnimData pointer is stored immediately after the given ID-block in the struct, - * as per IdAdtTemplate. - */ -AnimData *BKE_animdata_from_id (ID *id) +/* Getter/Setter -------------------------------------------- */ + +/* Internal utility to check if ID can have AnimData */ +static short id_has_animdata (ID *id) { /* sanity check */ if (id == NULL) - return NULL; + return 0; - /* only some ID-blocks have this info for now, so we cast the - * types that do to be of type IdAdtTemplate, and extract the - * AnimData that way - */ + /* Only some ID-blocks have this info for now */ // TODO: finish adding this for the other blocktypes switch (GS(id->name)) { + /* has AnimData */ case ID_OB: + case ID_CU: case ID_KE: - case ID_MA: case ID_TE: + case ID_MA: case ID_TE: case ID_NT: case ID_LA: case ID_CA: case ID_WO: case ID_SCE: { - IdAdtTemplate *iat= (IdAdtTemplate *)id; - return iat->adt; + return 1; } - break; + + /* no AnimData */ + default: + return 0; } - - /* no AnimData (ID-block does not contain this data) */ - return NULL; +} + + +/* Get AnimData from the given ID-block. In order for this to work, we assume that + * the AnimData pointer is stored immediately after the given ID-block in the struct, + * as per IdAdtTemplate. + */ +AnimData *BKE_animdata_from_id (ID *id) +{ + /* only some ID-blocks have this info for now, so we cast the + * types that do to be of type IdAdtTemplate, and extract the + * AnimData that way + */ + if (id_has_animdata(id)) { + IdAdtTemplate *iat= (IdAdtTemplate *)id; + return iat->adt; + } + else + return NULL; } /* Add AnimData to the given ID-block. In order for this to work, we assume that @@ -62,47 +79,82 @@ AnimData *BKE_animdata_from_id (ID *id) */ AnimData *BKE_id_add_animdata (ID *id) { - /* sanity check */ - if (id == NULL) - return NULL; + /* Only some ID-blocks have this info for now, so we cast the + * types that do to be of type IdAdtTemplate, and add the AnimData + * to it using the template + */ + if (id_has_animdata(id)) { + IdAdtTemplate *iat= (IdAdtTemplate *)id; - /* only some ID-blocks have this info for now, so we cast the - * types that do to be of type IdAdtTemplate, and add AnimData that - * way + iat->adt= MEM_callocN(sizeof(AnimData), "AnimData"); + return iat->adt; + } + else + return NULL; +} + +/* Freeing -------------------------------------------- */ + +/* Free AnimData used by the nominated ID-block, and clear ID-block's AnimData pointer */ +void BKE_free_animdata (ID *id) +{ + /* Only some ID-blocks have this info for now, so we cast the + * types that do to be of type IdAdtTemplate */ - // TODO: finish adding this for the other blocktypes - switch (GS(id->name)) { - case ID_OB: - case ID_KE: - case ID_MA: case ID_TE: - case ID_LA: case ID_CA: case ID_WO: - case ID_SCE: - { - IdAdtTemplate *iat= (IdAdtTemplate *)id; + if (id_has_animdata(id)) { + IdAdtTemplate *iat= (IdAdtTemplate *)id; + AnimData *adt= iat->adt; + + /* check if there's any AnimData to start with */ + if (adt) { + /* unlink action (don't free, as it's in its own list) */ + if (adt->action) + adt->action->id.us--; + + /* free drivers - stored as a list of F-Curves */ + free_fcurves(&adt->drivers); + + /* free overrides */ + // TODO... - iat->adt= MEM_callocN(sizeof(AnimData), "AnimData"); - return iat->adt; + /* free animdata now */ + MEM_freeN(adt); + iat->adt= NULL; } - break; } - - /* no AnimData (ID-block does not contain this data) */ - return NULL; } +/* Freeing -------------------------------------------- */ -/* Obtain an RNA-Path from the given ID-block to the property of interest - * - id: ID block that will be used as the 'root' of the path - * - ptr: pointer to struct where setting is stored - * - prop: property to get path for - */ -// TODO: should this be part of RNA Access API instead? or through editors only? -char *BKE_animsys_get_rnapath (ID *id, PointerRNA *ptr, PropertyRNA *prop) +/* Make a copy of the given AnimData - to be used when copying datablocks */ +AnimData *BKE_copy_animdata (AnimData *adt) { - // FIXME: this could be quite messy to do right :/ - return NULL; + AnimData *dadt; + + /* sanity check before duplicating struct */ + if (adt == NULL) + return NULL; + dadt= MEM_dupallocN(adt); + + /* make a copy of action - at worst, user has to delete copies... */ + // XXX review this... it might not be optimal behaviour yet... + //id_us_plus((ID *)dadt->action); + dadt->action= copy_action(adt->action); + + /* duplicate NLA data */ + // XXX todo... + + /* duplicate drivers (F-Curves) */ + copy_fcurves(&dadt->drivers, &adt->drivers); + + /* don't copy overrides */ + dadt->overrides.first= dadt->overrides.last= NULL; + + /* return */ + return dadt; } + /* ***************************************** */ /* Evaluation Data-Setting Backend */ @@ -138,8 +190,7 @@ static void animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_in if (RNA_path_resolve(ptr, path, &new_ptr, &prop)) { /* set value - only for animatable numerical values */ - // FIXME: probably 'editable' might not be enough in future... - if (RNA_property_editable(&new_ptr, prop)) + if (RNA_property_animateable(&new_ptr, prop)) { switch (RNA_property_type(&new_ptr, prop)) { @@ -244,7 +295,7 @@ static void animsys_evaluate_drivers (PointerRNA *ptr, AnimData *adt, float ctim /* Actions Evaluation */ /* Evaluate Action (F-Curve Bag) */ -static void animsys_evaluate_action (PointerRNA *ptr, nAction *act, AnimMapper *remap, float ctime) +static void animsys_evaluate_action (PointerRNA *ptr, bAction *act, AnimMapper *remap, float ctime) { /* check if mapper is appropriate for use here (we set to NULL if it's inappropriate) */ if (act == NULL) return; @@ -565,20 +616,46 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime) ID *id; //printf("Evaluate all animation - %f \n", ctime); - - /* cameras */ + + /* macro for less typing */ +#define EVAL_ANIM_IDS(first) \ + for (id= first; id; id= id->next) { \ + AnimData *adt= BKE_animdata_from_id(id); \ + BKE_animsys_evaluate_animdata(id, adt, ctime, ADT_RECALC_ANIM); \ + } + + /* nodes */ + // TODO... /* textures */ + EVAL_ANIM_IDS(main->tex.first); /* lamps */ + EVAL_ANIM_IDS(main->lamp.first); /* materials */ + EVAL_ANIM_IDS(main->mat.first); + + /* cameras */ + EVAL_ANIM_IDS(main->camera.first); + + /* shapekeys */ + // TODO... + + /* curves */ + // TODO... + + /* meshes */ + // TODO... /* objects */ - for (id= main->object.first; id; id= id->next) { - AnimData *adt= BKE_animdata_from_id(id); - BKE_animsys_evaluate_animdata(id, adt, ctime, ADT_RECALC_ANIM); - } + EVAL_ANIM_IDS(main->object.first); + + /* worlds */ + EVAL_ANIM_IDS(main->world.first); + + /* scenes */ + EVAL_ANIM_IDS(main->scene.first); } /* ***************************************** */ diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index d52d91e40e9..91189fc7d3a 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -52,6 +52,7 @@ #include "DNA_scene_types.h" #include "DNA_vfont_types.h" +#include "BKE_animsys.h" #include "BKE_anim.h" #include "BKE_curve.h" #include "BKE_displist.h" @@ -83,10 +84,6 @@ void unlink_curve(Curve *cu) cu->vfont= 0; if(cu->key) cu->key->id.us--; cu->key= 0; -#if 0 // XXX old animation system - if(cu->ipo) cu->ipo->id.us--; - cu->ipo= 0; -#endif // XXX old animation system } @@ -105,6 +102,7 @@ void free_curve(Curve *cu) } unlink_curve(cu); + BKE_free_animdata((ID *)cu); if(cu->mat) MEM_freeN(cu->mat); if(cu->str) MEM_freeN(cu->str); diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 0e94faf0c4d..a7d375cb955 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -37,7 +37,7 @@ /* ---------------------- Freeing --------------------------- */ -/* Frees the F-Curve itself too */ +/* Frees the F-Curve itself too, so make sure BLI_remlink is called before calling this... */ void free_fcurve (FCurve *fcu) { if (fcu == NULL) @@ -61,6 +61,28 @@ void free_fcurve (FCurve *fcu) MEM_freeN(fcu); } +/* Frees a list of F-Curves */ +void free_fcurves (ListBase *list) +{ + FCurve *fcu, *fcn; + + /* sanity check */ + if (list == NULL) + return; + + /* free data - no need to call remlink before freeing each curve, + * as we store reference to next, and freeing only touches the curve + * it's given + */ + for (fcu= list->first; fcu; fcu= fcn) { + fcn= fcu->next; + free_fcurve(fcu); + } + + /* clear pointers just in case */ + list->first= list->last= NULL; +} + /* ---------------------- Copy --------------------------- */ /* duplicate an F-Curve */ @@ -74,6 +96,7 @@ FCurve *copy_fcurve (FCurve *fcu) /* make a copy */ fcu_d= MEM_dupallocN(fcu); + fcu_d->next= fcu_d->prev= NULL; /* copy curve data */ fcu_d->bezt= MEM_dupallocN(fcu_d->bezt); @@ -92,6 +115,25 @@ FCurve *copy_fcurve (FCurve *fcu) return fcu_d; } +/* duplicate a list of F-Curves */ +void copy_fcurves (ListBase *dst, ListBase *src) +{ + FCurve *dfcu, *sfcu; + + /* sanity checks */ + if ELEM(NULL, dst, src) + return; + + /* clear destination list first */ + dst->first= dst->last= NULL; + + /* copy one-by-one */ + for (sfcu= src->first; sfcu; sfcu= sfcu->next) { + dfcu= copy_fcurve(sfcu); + BLI_addtail(dst, dfcu); + } +} + /* ---------------------- Relink --------------------------- */ #if 0 @@ -1395,7 +1437,7 @@ void fcurve_free_modifiers (FCurve *fcu) if (fcu == NULL) return; - /* free each modifier in order */ + /* free each modifier in order - modifier is unlinked from list and freed */ for (fcm= fcu->modifiers.first; fcm; fcm= fmn) { fmn= fcm->next; fcurve_remove_modifier(fcu, fcm); @@ -1472,6 +1514,7 @@ float evaluate_fcurve (FCurve *fcu, float evaltime) FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm); /* only evaluate if there's a callback for this */ + // TODO: implement the 'influence' control feature... if (fmi && fmi->evaluate_modifier) { if ((fcm->flag & FMODIFIER_FLAG_DISABLED) == 0) fmi->evaluate_modifier(fcu, fcm, &cvalue, evaltime); diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index f06583a6ace..718ddf2dc96 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -43,6 +43,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" +#include "BKE_animsys.h" #include "BKE_action.h" #include "BKE_blender.h" #include "BKE_curve.h" @@ -77,9 +78,7 @@ void free_key(Key *key) { KeyBlock *kb; -#if 0 // XXX old animation system - if(key->ipo) key->ipo->id.us--; -#endif // XXX old animation system + BKE_free_animdata((ID *)key); while( (kb= key->block.first) ) { diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index d0e5da5f936..ecd6e22c3ef 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -359,7 +359,7 @@ static ID *alloc_libblock_notest(short type) id = MEM_callocN(sizeof(bArmature), "armature"); break; case ID_AC: - id = MEM_callocN(sizeof(nAction), "action"); // XXX animation system + id = MEM_callocN(sizeof(bAction), "action"); break; case ID_NT: id = MEM_callocN(sizeof(bNodeTree), "nodetree"); @@ -520,7 +520,7 @@ void free_libblock(ListBase *lb, void *idv) free_armature((bArmature *)id); break; case ID_AC: - free_action((nAction *)id); // XXX animation system... + free_action((bAction *)id); break; case ID_NT: ntreeFreeTree((bNodeTree *)id); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 66339cd977d..b410c521dea 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -47,6 +47,7 @@ #include "BLI_blenlib.h" #include "BLI_arithb.h" +#include "BKE_animsys.h" #include "BKE_blender.h" #include "BKE_displist.h" #include "BKE_global.h" @@ -92,6 +93,8 @@ void free_material(Material *ma) if(ma->ramp_col) MEM_freeN(ma->ramp_col); if(ma->ramp_spec) MEM_freeN(ma->ramp_spec); + BKE_free_animdata((ID *)ma); + BKE_previewimg_free(&ma->preview); BKE_icon_delete((struct ID*)ma); ma->id.icon_id = 0; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 28cf5e84d89..8b3f495e495 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -248,10 +248,7 @@ void free_object(Object *ob) ob->bb= 0; if(ob->path) free_path(ob->path); ob->path= 0; -#if 0 // XXX old animation system - if(ob->ipo) ob->ipo->id.us--; - if(ob->action) ob->action->id.us--; -#endif // XXX old animation system + if(ob->adt) BKE_free_animdata((ID *)ob); if(ob->poselib) ob->poselib->id.us--; if(ob->dup_group) ob->dup_group->id.us--; if(ob->defbase.first) @@ -266,9 +263,6 @@ void free_object(Object *ob) free_actuators(&ob->actuators); free_constraints(&ob->constraints); -#if 0 // XXX old animation system - free_nlastrips(&ob->nlastrips); -#endif #ifndef DISABLE_PYTHON BPY_free_scriptlink(&ob->scriptlink); @@ -559,11 +553,6 @@ void unlink_object(Scene *scene, Object *ob) if(v3d->localvd->persp==V3D_CAMOB) v3d->localvd->persp= V3D_PERSP; } } - else if(sl->spacetype==SPACE_IPO) { - // XXX animsys this is likely to change... - SpaceIpo *sipo= (SpaceIpo *)sl; - if(sipo->from == (ID *)ob) sipo->from= NULL; - } else if(sl->spacetype==SPACE_OOPS) { SpaceOops *so= (SpaceOops *)sl; Oops *oops; @@ -643,10 +632,7 @@ Camera *copy_camera(Camera *cam) Camera *camn; camn= copy_libblock(cam); - -#if 0 // XXX old animation system - id_us_plus((ID *)camn->ipo); -#endif // XXX old animation system + camn->adt= BKE_copy_animdata(cam->adt); #ifndef DISABLE_PYTHON BPY_copy_scriptlink(&camn->scriptlink); @@ -862,6 +848,7 @@ void free_camera(Camera *ca) #ifndef DISABLE_PYTHON BPY_free_scriptlink(&ca->scriptlink); #endif + BKE_free_animdata((ID *)ca); } void free_lamp(Lamp *la) @@ -880,9 +867,7 @@ void free_lamp(Lamp *la) if(mtex) MEM_freeN(mtex); } -#if 0 // XXX old animation system - la->ipo= 0; -#endif // XXX old animation system + BKE_free_animdata((ID *)la); curvemapping_free(la->curfalloff); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index cfd88d3d438..3247c963644 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -148,6 +148,8 @@ void free_scene(Scene *sce) #ifndef DISABLE_PYTHON BPY_free_scriptlink(&sce->scriptlink); #endif + + BKE_free_animdata((ID *)sce); if (sce->r.avicodecdata) { free_avicodecdata(sce->r.avicodecdata); @@ -611,10 +613,6 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay) Scene *scene= sce; float ctime = frame_to_float(sce, sce->r.cfra); - /* clears all BONE_UNKEYED flags for every pose's pchans */ - // xxx old animation system - //framechange_poses_clear_unkeyed(); - /* clear animation overrides */ // XXX TODO... diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 495d50725d0..66f7fe8a44b 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -74,6 +74,7 @@ #include "BKE_icons.h" #include "BKE_brush.h" #include "BKE_node.h" +#include "BKE_animsys.h" /* ------------------------------------------------------------------------- */ diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index bd747bc1b61..7278460c61c 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -48,6 +48,7 @@ #include "BKE_utildefines.h" #include "BKE_library.h" +#include "BKE_animsys.h" #include "BKE_world.h" #include "BKE_global.h" #include "BKE_main.h" @@ -76,9 +77,7 @@ void free_world(World *wrld) } BKE_previewimg_free(&wrld->preview); -#if 0 // XXX old animation system - wrld->ipo= 0; -#endif // XXX old animation system + BKE_free_animdata((ID *)wrld); BKE_icon_delete((struct ID*)wrld); wrld->id.icon_id = 0; |