diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-05-31 15:14:50 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-05-31 15:14:50 +0400 |
commit | 33267f58581ea8f9d89028958c6e64a8d048d4db (patch) | |
tree | 5bd7494f65b9a3914a945926df92d303b659d0d2 /source/blender/blenkernel | |
parent | c42eeddea491d6a79dbcc0b8b28386237085643d (diff) |
NLA SoC: Basic selection operators
* Added click-select/left-right select and deselect all/invert all selection operators. For now, these basic operators will suffice (more advanced selection operators will be coded at a later stage).
* Fixed a few bugs in DopeSheet found while coding the relevant tools for NLA.
* Added custom border-select operator for NLA channels (since the standard one assumes negative direction channel order)
* Added new API-method for NLA strips to check if the strip occurs within a given range, since this test needed to be performed in a few places...
* Tweaked the NLA Editor View2D ranges a bit to give saner default sizing. This still isn't right yet though.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_nla.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/nla.c | 31 |
2 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h index ededd77a92f..3c3abe11da3 100644 --- a/source/blender/blenkernel/BKE_nla.h +++ b/source/blender/blenkernel/BKE_nla.h @@ -59,6 +59,8 @@ void BKE_nlatrack_set_active(ListBase *tracks, struct NlaTrack *nlt); short BKE_nlatrack_has_space(struct NlaTrack *nlt, float start, float end); void BKE_nlatrack_sort_strips(struct NlaTrack *nlt); +short BKE_nlastrip_within_bounds(struct NlaStrip *strip, float min, float max); + void BKE_nla_action_pushdown(struct AnimData *adt); #endif diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 3efa823f9fe..cf115cb6faf 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -455,6 +455,37 @@ void BKE_nlatrack_sort_strips (NlaTrack *nlt) /* NLA Strips -------------------------------------- */ +/* Does the given NLA-strip fall within the given bounds (times)? */ +short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max) +{ + const float stripLen= (strip) ? strip->end - strip->start : 0.0f; + const float boundsLen= (float)fabs(max - min); + + /* sanity checks */ + if ((strip == NULL) || IS_EQ(stripLen, 0.0f) || IS_EQ(boundsLen, 0.0f)) + return 0; + + /* only ok if at least part of the strip is within the bounding window + * - first 2 cases cover when the strip length is less than the bounding area + * - second 2 cases cover when the strip length is greater than the bounding area + */ + if ( (stripLen < boundsLen) && + !(IN_RANGE(strip->start, min, max) || + IN_RANGE(strip->end, min, max)) ) + { + return 0; + } + if ( (stripLen > boundsLen) && + !(IN_RANGE(min, strip->start, strip->end) || + IN_RANGE(max, strip->start, strip->end)) ) + { + return 0; + } + + /* should be ok! */ + return 1; +} + /* Is the given NLA-strip the first one to occur for the given AnimData block */ // TODO: make this an api method if necesary, but need to add prefix first short nlastrip_is_first (AnimData *adt, NlaStrip *strip) |