diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-01-26 14:29:44 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-01-26 14:29:44 +0300 |
commit | d677e30a04f4983441119acdaa560c93227ed7ef (patch) | |
tree | f939fa42362a58db37e31ceb1f5d3ef2160d500c /source | |
parent | dbefdd34cae2e9a006639964bcad50228c89d927 (diff) |
== Action Editor Drawing - Optimisations (Part 1 out of ?) ==
Now the Action Editor doesn't bother drawing channels which are out of view. This should give some performance improvements when there are many channels with heaps of keyframes, as the keyframes that occur in that channel don't need to be sampled (which is a major performance bottleneck).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/src/drawaction.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c index a169af6cf93..3339385d565 100644 --- a/source/blender/src/drawaction.c +++ b/source/blender/src/drawaction.c @@ -813,19 +813,32 @@ static void draw_channel_strips(void) if (NLA_ACTION_SCALED) map_active_strip(di, OBACT, 0); - /* draw keyframes */ + /* Draw keyframes + * 1) Only channels that are visible in the Action Editor get drawn/evaluated. + * This is to try to optimise this for heavier data sets + * 2) Keyframes which are out of view horizontally could be disregarded (probably as + * option - 'drop-frames' or so). Todo... + */ y = 0.0; for (ale= act_data.first; ale; ale= ale->next) { - switch (ale->datatype) { - case ALE_GROUP: - draw_agroup_channel(di, ale->data, y); - break; - case ALE_IPO: - draw_ipo_channel(di, ale->key_data, y); - break; - case ALE_ICU: - draw_icu_channel(di, ale->key_data, y); - break; + float yminc= y-CHANNELHEIGHT/2; + float ymaxc= y+CHANNELHEIGHT/2; + + /* check if visible */ + if ( IN_RANGE(yminc, G.v2d->cur.ymin, G.v2d->cur.ymax) || + IN_RANGE(ymaxc, G.v2d->cur.ymin, G.v2d->cur.ymax) ) + { + switch (ale->datatype) { + case ALE_GROUP: + draw_agroup_channel(di, ale->data, y); + break; + case ALE_IPO: + draw_ipo_channel(di, ale->key_data, y); + break; + case ALE_ICU: + draw_icu_channel(di, ale->key_data, y); + break; + } } y-=CHANNELHEIGHT+CHANNELSKIP; |