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-12-11 14:18:55 +0300
committerJoshua Leung <aligorith@gmail.com>2009-12-11 14:18:55 +0300
commitfba99b627b001177590e73471f0b0f29a832bc14 (patch)
tree48b8a7b369ad94c35c2d66f43873c9f369a3d21c /source/blender/editors
parent7e7e1018acfb23f0e10d4ae051d002a6516b8d83 (diff)
Timeline Drawing Tweaks:
* Made the TimeLine current frame indicator get drawn using the standard frame-indicator code. Also, it is now possible to show the frame indicator box beside the line as in the other animation editors, although this is disabled in the timeline due to the closeness of the frame number field. * Removed some old (unnecessary) code -> "Continue Physics" option in TimeLine, which is now obsolete with the current physics options. Feel free to restore if this is not the case. -> Already commented out hacks to create "speed ipo" for curves. There are easy alternatives that are better integrated. -> Unused init/exit callbacks for scrubbing time, since those were only used to set an obsolete flag for timeline drawing that is now used for the indicator. * Switched long-keyframe optimisation code to use constants instead of some magic numbers + fancy trickery...
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_ops.c54
-rw-r--r--source/blender/editors/animation/keyframes_draw.c8
-rw-r--r--source/blender/editors/curve/editcurve.c39
-rw-r--r--source/blender/editors/space_time/space_time.c28
4 files changed, 11 insertions, 118 deletions
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 6c8a982b323..6aa638b1ada 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -74,25 +74,6 @@ static int change_frame_poll(bContext *C)
return ((curarea) && (curarea->spacetype != SPACE_IPO));
}
-/* Set any flags that are necessary to indicate modal time-changing operation */
-static int change_frame_init(bContext *C, wmOperator *op)
-{
- ScrArea *curarea= CTX_wm_area(C);
-
- if (curarea == NULL)
- return 0;
-
- if (curarea->spacetype == SPACE_TIME) {
- SpaceTime *stime= CTX_wm_space_time(C);
-
- /* timeline displays frame number only when dragging indicator */
- // XXX make this more in line with other anim editors?
- stime->flag |= TIME_CFRA_NUM;
- }
-
- return 1;
-}
-
/* Set the new frame number */
static void change_frame_apply(bContext *C, wmOperator *op)
{
@@ -106,33 +87,12 @@ static void change_frame_apply(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
}
-/* Clear any temp flags */
-static void change_frame_exit(bContext *C, wmOperator *op)
-{
- ScrArea *curarea= CTX_wm_area(C);
-
- if (curarea == NULL)
- return;
-
- if (curarea->spacetype == SPACE_TIME) {
- SpaceTime *stime= CTX_wm_space_time(C);
-
- /* timeline displays frame number only when dragging indicator */
- // XXX make this more in line with other anim editors?
- stime->flag &= ~TIME_CFRA_NUM;
- }
-}
-
/* ---- */
/* Non-modal callback for running operator without user input */
static int change_frame_exec(bContext *C, wmOperator *op)
{
- if (!change_frame_init(C, op))
- return OPERATOR_CANCELLED;
-
change_frame_apply(C, op);
- change_frame_exit(C, op);
return OPERATOR_FINISHED;
}
@@ -166,7 +126,6 @@ static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event)
*/
RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
- change_frame_init(C, op);
change_frame_apply(C, op);
/* add temp handler */
@@ -175,20 +134,12 @@ static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
-/* In case modal operator is cancelled */
-static int change_frame_cancel(bContext *C, wmOperator *op)
-{
- change_frame_exit(C, op);
- return OPERATOR_CANCELLED;
-}
-
/* Modal event handling of frame changing */
static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
{
/* execute the events */
switch (event->type) {
case ESCKEY:
- change_frame_exit(C, op);
return OPERATOR_FINISHED;
case MOUSEMOVE:
@@ -201,10 +152,8 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
/* we check for either mouse-button to end, as checking for ACTIONMOUSE (which is used to init
* the modal op) doesn't work for some reason
*/
- if (event->val==KM_RELEASE) {
- change_frame_exit(C, op);
+ if (event->val==KM_RELEASE)
return OPERATOR_FINISHED;
- }
break;
}
@@ -221,7 +170,6 @@ void ANIM_OT_change_frame(wmOperatorType *ot)
/* api callbacks */
ot->exec= change_frame_exec;
ot->invoke= change_frame_invoke;
- ot->cancel= change_frame_cancel;
ot->modal= change_frame_modal;
ot->poll= change_frame_poll;
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 4fd9295792b..b19ee5d1dab 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -170,6 +170,9 @@ static void add_bezt_to_keycolumns_list(DLRBT_Tree *keys, BezTriple *bezt)
/* ActBeztColumns (Helpers for Long Keyframes) ------------------------------ */
+/* maximum size of default buffer for BezTriple columns */
+#define MAX_ABK_BUFSIZE 4
+
/* BezTriple Container Node */
// NOTE: only used internally while building Long Keyframes for now, but may be useful externally?
typedef struct ActBeztColumn {
@@ -187,7 +190,7 @@ typedef struct ActBeztColumn {
short numBezts; /* number of BezTriples on this frame */
float cfra; /* frame that the BezTriples occur on */
- BezTriple *bezts[4]; /* buffer of pointers to BezTriples on the same frame */
+ BezTriple *bezts[MAX_ABK_BUFSIZE]; /* buffer of pointers to BezTriples on the same frame */
//BezTriple **bezts_extra; /* secondary buffer of pointers if need be */
} ActBeztColumn;
@@ -227,9 +230,8 @@ static void nupdate_abk_bezt (void *node, void *data)
BezTriple *bezt= (BezTriple *)data;
/* just add the BezTriple to the buffer if there's space, or allocate a new one */
- if (abk->numBezts >= sizeof(abk->bezts)/sizeof(BezTriple)) {
+ if (abk->numBezts >= MAX_ABK_BUFSIZE) {
// TODO: need to allocate new array to cater...
- // FIXME: urgent... is a problem when working with duplicate keyframes
//bezts_extra= MEM_callocN(...);
if(G.f & G_DEBUG)
printf("FIXME: nupdate_abk_bezt() missing case for too many overlapping BezTriples \n");
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index aeeb8dffa28..a109e9149cf 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -5285,42 +5285,3 @@ void undo_push_curve(bContext *C, char *name)
{
undo_editmode_push(C, name, get_data, free_undoCurve, undoCurve_to_editCurve, editCurve_to_undoCurve, NULL);
}
-
-/***************** XXX old cruft ********************/
-
-void default_curve_ipo(Scene *scene, Curve *cu)
-{
-#if 0 // XXX old animation system
- IpoCurve *icu;
- BezTriple *bezt;
-
- if(cu->ipo) return;
-
- cu->ipo= add_ipo(scene, "CurveIpo", ID_CU);
-
- icu= MEM_callocN(sizeof(IpoCurve), "ipocurve");
-
- icu->blocktype= ID_CU;
- icu->adrcode= CU_SPEED;
- icu->flag= IPO_VISIBLE|IPO_SELECT|IPO_AUTO_HORIZ;
- set_icu_vars(icu);
-
- BLI_addtail( &(cu->ipo->curve), icu);
-
- icu->bezt= bezt= MEM_callocN(2*sizeof(BezTriple), "defaultipo");
- icu->totvert= 2;
-
- bezt->hide= IPO_BEZ;
- bezt->f1=bezt->f2= bezt->f3= SELECT;
- bezt->h1= bezt->h2= HD_AUTO;
- bezt++;
- bezt->vec[1][0]= 100.0;
- bezt->vec[1][1]= 1.0;
- bezt->hide= IPO_BEZ;
- bezt->f1=bezt->f2= bezt->f3= SELECT;
- bezt->h1= bezt->h2= HD_AUTO;
-
- calchandles_ipocurve(icu);
-#endif // XXX old animation system
-}
-
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index 59314fba48e..eea5891a720 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -45,6 +45,7 @@
#include "BKE_screen.h"
#include "BKE_utildefines.h"
+#include "ED_anim_api.h"
#include "ED_keyframes_draw.h"
#include "ED_space_api.h"
#include "ED_screen.h"
@@ -66,27 +67,6 @@
/* ************************ main time area region *********************** */
-/* draws a current frame indicator for the TimeLine */
-static void time_draw_cfra_time(const bContext *C, SpaceTime *stime, ARegion *ar)
-{
- Scene *scene= CTX_data_scene(C);
- float vec[2];
-
- vec[0]= scene->r.cfra*scene->r.framelen;
-
- UI_ThemeColor(TH_CFRAME); // no theme, should be global color once...
- glLineWidth(3.0);
-
- glBegin(GL_LINES);
- vec[1]= ar->v2d.cur.ymin;
- glVertex2fv(vec);
- vec[1]= ar->v2d.cur.ymax;
- glVertex2fv(vec);
- glEnd();
-
- glLineWidth(1.0);
-}
-
static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar)
{
View2D *v2d= UI_view2d_fromcontext(C);
@@ -218,8 +198,8 @@ static void time_main_area_draw(const bContext *C, ARegion *ar)
View2D *v2d= &ar->v2d;
View2DGrid *grid;
View2DScrollers *scrollers;
+ int unit, flag=0;
float col[3];
- int unit;
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
@@ -241,7 +221,9 @@ static void time_main_area_draw(const bContext *C, ARegion *ar)
time_draw_keyframes(C, stime, ar);
/* current frame */
- time_draw_cfra_time(C, stime, ar);
+ if ((stime->flag & TIME_DRAWFRAMES)==0) flag |= DRAWCFRA_UNIT_SECONDS;
+ if (stime->flag & TIME_CFRA_NUM) flag |= DRAWCFRA_SHOW_NUMBOX;
+ ANIM_draw_cfra(C, v2d, flag);
/* markers */
UI_view2d_view_orthoSpecial(C, v2d, 1);