Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-07-09 17:14:51 +0400
committerJoshua Leung <aligorith@gmail.com>2009-07-09 17:14:51 +0400
commitc1f3b86f861028c9f1b6e8eedc5d4c07b77205a7 (patch)
treefe2c72072a8d198323daf63b3605449dd4f4d763 /source/blender/editors/space_action/action_draw.c
parentf9749ea2e778165cf6e92cc263f5be3a802247fa (diff)
NLA SoC: Cleanup of Keyframe Drawing code for DopeSheet
* Removed the glaMapping stuff in favour of remapping the keyframes manually. The old code was causing some mess, and not really working well for the DopeSheet with various mappings being used. * Fixed NLA-mapped selection in DopeSheet. Clicking on individual keyframes should now work ok. More testing required though. * Keyframes in DopeSheet are now drawn fully using OpenGL (instead of icons). They look less tactile now, but this may be compensated with in terms of speed? Previously I disabled this type of drawing due to issues with some cards. Enabled again for now, but mainly because I couldn't get the icons to line up nicely in screenspace... * Borderselect in DopeSheet. I've had a look at issues with it selecting the wrong channel's keyframes. The issues don't seem to be solved yet though... will look again tomorrow.
Diffstat (limited to 'source/blender/editors/space_action/action_draw.c')
-rw-r--r--source/blender/editors/space_action/action_draw.c96
1 files changed, 23 insertions, 73 deletions
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index 910b9733bc8..743cc1f128e 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -960,27 +960,8 @@ void draw_channel_names(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
/* ************************************************************************* */
/* Keyframes */
-ActKeysInc *init_aki_data(bAnimContext *ac, bAnimListElem *ale)
-{
- static ActKeysInc aki;
-
- /* no need to set settings if wrong context */
- if ((ac->data == NULL) || ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET)==0)
- return NULL;
-
- /* if strip is mapped, store settings */
- aki.adt= ANIM_nla_mapping_get(ac, ale);
-
- if (ac->datatype == ANIMCONT_DOPESHEET)
- aki.ads= (bDopeSheet *)ac->data;
- else
- aki.ads= NULL;
- aki.actmode= ac->datatype;
-
- /* always return pointer... */
- return &aki;
-}
-
+/* extra padding for lengths (to go under scrollers) */
+#define EXTRA_SCROLL_PAD 100.0f
/* draw keyframes in each channel */
void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
@@ -990,13 +971,11 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
int filter;
View2D *v2d= &ar->v2d;
+ bDopeSheet *ads= &saction->ads;
AnimData *adt= NULL;
- gla2DDrawInfo *di;
- rcti scr_rct;
- int act_start, act_end, dummy;
+ float act_start, act_end, y;
int height, items;
- float y, sta, end;
char col1[3], col2[3];
char col1a[3], col2a[3];
@@ -1006,6 +985,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
/* get theme colors */
UI_GetThemeColor3ubv(TH_BACK, col2);
UI_GetThemeColor3ubv(TH_HILITE, col1);
+
UI_GetThemeColor3ubv(TH_GROUP, col2a);
UI_GetThemeColor3ubv(TH_GROUP_ACTIVE, col1a);
@@ -1013,26 +993,14 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
UI_GetThemeColor3ubv(TH_DOPESHEET_CHANNELSUBOB, col2b);
/* set view-mapping rect (only used for x-axis), for NLA-scaling mapping with less calculation */
- scr_rct.xmin= ar->winrct.xmin + ar->v2d.mask.xmin;
- scr_rct.ymin= ar->winrct.ymin + ar->v2d.mask.ymin;
- scr_rct.xmax= ar->winrct.xmin + ar->v2d.hor.xmax;
- scr_rct.ymax= ar->winrct.ymin + ar->v2d.mask.ymax;
- di= glaBegin2DDraw(&scr_rct, &v2d->cur);
/* if in NLA there's a strip active, map the view */
if (ac->datatype == ANIMCONT_ACTION) {
adt= ANIM_nla_mapping_get(ac, NULL);
- if (adt)
- ANIM_nla_mapping_draw(di, adt, 0);
-
/* start and end of action itself */
- calc_action_range(ac->data, &sta, &end, 0);
- gla2DDrawTranslatePt(di, sta, 0.0f, &act_start, &dummy);
- gla2DDrawTranslatePt(di, end, 0.0f, &act_end, &dummy);
-
- if (adt)
- ANIM_nla_mapping_draw(di, adt, 1);
+ // TODO: this has not had scaling applied
+ calc_action_range(ac->data, &act_start, &act_end, 0);
}
/* build list of channels to draw */
@@ -1063,7 +1031,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
if ( IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax) )
{
- int frame1_x, channel_y, sel=0;
+ int sel=0;
/* determine if any need to draw channel */
if (ale->datatype != ALE_NONE) {
@@ -1102,8 +1070,6 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
}
if (ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET)) {
- gla2DDrawTranslatePt(di, v2d->cur.xmin, y, &frame1_x, &channel_y);
-
switch (ale->type) {
case ANIMTYPE_SCENE:
case ANIMTYPE_OBJECT:
@@ -1139,36 +1105,32 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
}
/* draw region twice: firstly backdrop, then the current range */
- glRectf((float)frame1_x, (float)channel_y-ACHANNEL_HEIGHT_HALF, (float)v2d->hor.xmax, (float)channel_y+ACHANNEL_HEIGHT_HALF);
+ glRectf(v2d->cur.xmin, (float)y-ACHANNEL_HEIGHT_HALF, v2d->cur.xmax+EXTRA_SCROLL_PAD, (float)y+ACHANNEL_HEIGHT_HALF);
if (ac->datatype == ANIMCONT_ACTION)
- glRectf((float)act_start, (float)channel_y-ACHANNEL_HEIGHT_HALF, (float)act_end, (float)channel_y+ACHANNEL_HEIGHT_HALF);
+ glRectf(act_start, (float)y-ACHANNEL_HEIGHT_HALF, act_end, (float)y+ACHANNEL_HEIGHT_HALF);
}
else if (ac->datatype == ANIMCONT_SHAPEKEY) {
- gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y);
-
/* all frames that have a frame number less than one
* get a desaturated orange background
*/
glColor4ub(col2[0], col2[1], col2[2], 0x22);
- glRectf(0.0f, (float)channel_y-ACHANNEL_HEIGHT_HALF, (float)frame1_x, (float)channel_y+ACHANNEL_HEIGHT_HALF);
+ glRectf(0.0f, (float)y-ACHANNEL_HEIGHT_HALF, 1.0f, (float)y+ACHANNEL_HEIGHT_HALF);
/* frames one and higher get a saturated orange background */
glColor4ub(col2[0], col2[1], col2[2], 0x44);
- glRectf((float)frame1_x, (float)channel_y-ACHANNEL_HEIGHT_HALF, (float)v2d->hor.xmax, (float)channel_y+ACHANNEL_HEIGHT_HALF);
+ glRectf(1.0f, (float)y-ACHANNEL_HEIGHT_HALF, v2d->cur.xmax+EXTRA_SCROLL_PAD, (float)y+ACHANNEL_HEIGHT_HALF);
}
else if (ac->datatype == ANIMCONT_GPENCIL) {
- gla2DDrawTranslatePt(di, v2d->cur.xmin, y, &frame1_x, &channel_y);
-
/* frames less than one get less saturated background */
if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22);
else glColor4ub(col2[0], col2[1], col2[2], 0x22);
- glRectf(0.0f, (float)channel_y-ACHANNEL_HEIGHT_HALF, (float)frame1_x, (float)channel_y+ACHANNEL_HEIGHT_HALF);
+ glRectf(0.0f, (float)y-ACHANNEL_HEIGHT_HALF, v2d->cur.xmin, (float)y+ACHANNEL_HEIGHT_HALF);
/* frames one and higher get a saturated background */
if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x44);
else glColor4ub(col2[0], col2[1], col2[2], 0x44);
- glRectf((float)frame1_x, (float)channel_y-ACHANNEL_HEIGHT_HALF, (float)v2d->hor.xmax, (float)channel_y+ACHANNEL_HEIGHT_HALF);
+ glRectf(v2d->cur.xmin, (float)y-ACHANNEL_HEIGHT_HALF, v2d->cur.xmax+EXTRA_SCROLL_PAD, (float)y+ACHANNEL_HEIGHT_HALF);
}
}
}
@@ -1195,36 +1157,29 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
{
/* check if anything to show for this channel */
if (ale->datatype != ALE_NONE) {
- ActKeysInc *aki= init_aki_data(ac, ale);
adt= ANIM_nla_mapping_get(ac, ale);
- if (adt)
- ANIM_nla_mapping_draw(di, adt, 0);
-
/* draw 'keyframes' for each specific datatype */
switch (ale->datatype) {
case ALE_SCE:
- draw_scene_channel(di, aki, ale->key_data, y);
+ draw_scene_channel(v2d, ads, ale->key_data, y);
break;
case ALE_OB:
- draw_object_channel(di, aki, ale->key_data, y);
+ draw_object_channel(v2d, ads, ale->key_data, y);
break;
case ALE_ACT:
- draw_action_channel(di, aki, ale->key_data, y);
+ draw_action_channel(v2d, adt, ale->key_data, y);
break;
case ALE_GROUP:
- draw_agroup_channel(di, aki, ale->data, y);
+ draw_agroup_channel(v2d, adt, ale->data, y);
break;
case ALE_FCURVE:
- draw_fcurve_channel(di, aki, ale->key_data, y);
+ draw_fcurve_channel(v2d, adt, ale->key_data, y);
break;
case ALE_GPFRAME:
- draw_gpl_channel(di, aki, ale->data, y);
+ draw_gpl_channel(v2d, ads, ale->data, y);
break;
}
-
- if (adt)
- ANIM_nla_mapping_draw(di, adt, 1);
}
}
@@ -1236,16 +1191,11 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
/* black line marking 'current frame' for Time-Slide transform mode */
if (saction->flag & SACTION_MOVING) {
- int frame1_x;
-
- gla2DDrawTranslatePt(di, saction->timeslide, 0, &frame1_x, &dummy);
- cpack(0x0);
+ glColor3f(0.0f, 0.0f, 0.0f);
glBegin(GL_LINES);
- glVertex2f((float)frame1_x, (float)v2d->mask.ymin - 100);
- glVertex2f((float)frame1_x, (float)v2d->mask.ymax);
+ glVertex2f(saction->timeslide, v2d->cur.ymin-EXTRA_SCROLL_PAD)
+ glVertex2f(saction->timeslide, v2d->cur.ymax);
glEnd();
}
-
- glaEnd2DDraw(di);
}