diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_action.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_nla.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 24 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/nla.c | 61 |
4 files changed, 89 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 214b5a32cd6..4d3f000c863 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -105,6 +105,9 @@ struct bActionGroup *get_active_actiongroup(struct bAction *act); /* Make the given Action Group the active one */ void set_active_action_group(struct bAction *act, struct bActionGroup *agrp, short select); +/* Add a new action group with the given name to the action */ +struct bActionGroup *action_groups_add_new(struct bAction *act, const char name[]); + /* Add given channel into (active) group */ void action_groups_add_channel(struct bAction *act, struct bActionGroup *agrp, struct FCurve *fcurve); diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h index 5b842965225..30bce613dbe 100644 --- a/source/blender/blenkernel/BKE_nla.h +++ b/source/blender/blenkernel/BKE_nla.h @@ -77,6 +77,8 @@ void BKE_nlatrack_sort_strips(struct NlaTrack *nlt); short BKE_nlatrack_add_strip(struct NlaTrack *nlt, struct NlaStrip *strip); +short BKE_nlatrack_get_bounds(struct NlaTrack *nlt, float bounds[2]); + /* ............ */ struct NlaStrip *BKE_nlastrip_find_active(struct NlaTrack *nlt); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 2d52d6061b9..7f8ae06a848 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -238,6 +238,30 @@ void set_active_action_group (bAction *act, bActionGroup *agrp, short select) } } +/* Add a new action group with the given name to the action */ +bActionGroup *action_groups_add_new (bAction *act, const char name[]) +{ + bActionGroup *agrp; + + /* sanity check: must have action and name */ + if (ELEM(NULL, act, name) || (name[0] == 0)) + return NULL; + + /* allocate a new one */ + agrp = MEM_callocN(sizeof(bActionGroup), "bActionGroup"); + + /* make it selected, with default name */ + agrp->flag = AGRP_SELECTED; + strncpy(agrp->name, name, sizeof(agrp->name)); + + /* add to action, and validate */ + BLI_addtail(&act->groups, agrp); + BLI_uniquename(&act->groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); + + /* return the new group */ + return agrp; +} + /* Add given channel into (active) group * - assumes that channel is not linked to anything anymore * - always adds at the end of the group diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 4af007a5f91..4b6a3a7e8e4 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -39,10 +39,12 @@ #include "BLI_ghash.h" #include "DNA_anim_types.h" +#include "DNA_scene_types.h" #include "BKE_action.h" #include "BKE_fcurve.h" #include "BKE_nla.h" +#include "BKE_global.h" #include "BKE_library.h" #include "BKE_utildefines.h" @@ -956,6 +958,35 @@ short BKE_nlatrack_add_strip (NlaTrack *nlt, NlaStrip *strip) return BKE_nlastrips_add_strip(&nlt->strips, strip); } +/* Get the extents of the given NLA-Track including gaps between strips, + * returning whether this succeeded or not + */ +short BKE_nlatrack_get_bounds (NlaTrack *nlt, float bounds[2]) +{ + NlaStrip *strip; + + /* initialise bounds */ + if (bounds) + bounds[0] = bounds[1] = 0.0f; + else + return 0; + + /* sanity checks */ + if ELEM(NULL, nlt, nlt->strips.first) + return 0; + + /* lower bound is first strip's start frame */ + strip = nlt->strips.first; + bounds[0] = strip->start; + + /* upper bound is last strip's end frame */ + strip = nlt->strips.last; + bounds[1] = strip->end; + + /* done */ + return 1; +} + /* NLA Strips -------------------------------------- */ /* Find the active NLA-strip within the given track */ @@ -1474,7 +1505,10 @@ short BKE_nla_tweakmode_enter (AnimData *adt) } } if ELEM3(NULL, activeTrack, activeStrip, activeStrip->act) { - printf("NLA tweakmode enter - neither active requirement found \n"); + if (G.f & G_DEBUG) { + printf("NLA tweakmode enter - neither active requirement found \n"); + printf("\tactiveTrack = %p, activeStrip = %p \n", activeTrack, activeStrip); + } return 0; } @@ -1553,4 +1587,29 @@ void BKE_nla_tweakmode_exit (AnimData *adt) adt->flag &= ~ADT_NLA_EDIT_ON; } +/* Baking Tools ------------------------------------------- */ + +void BKE_nla_bake (Scene *scene, ID *id, AnimData *adt, int flag) +{ + + /* verify that data is valid + * 1) Scene and AnimData must be provided + * 2) there must be tracks to merge... + */ + if ELEM3(NULL, scene, adt, adt->nla_tracks.first) + return; + + /* if animdata currently has an action, 'push down' this onto the stack first */ + if (adt->action) + BKE_nla_action_pushdown(adt); + + /* get range of motion to bake, and the channels involved... */ + + /* temporarily mute the action, and start keying to it */ + + /* start keying... */ + + /* unmute the action */ +} + /* *************************************************** */ |