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
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...
-rw-r--r--release/scripts/ui/space_time.py5
-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
-rw-r--r--source/blender/makesdna/DNA_space_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_space.c14
7 files changed, 19 insertions, 131 deletions
diff --git a/release/scripts/ui/space_time.py b/release/scripts/ui/space_time.py
index 73bfd7f85b7..86347f8c543 100644
--- a/release/scripts/ui/space_time.py
+++ b/release/scripts/ui/space_time.py
@@ -95,6 +95,7 @@ class TIME_MT_view(bpy.types.Menu):
layout.separator()
+ layout.prop(st, "show_cframe_indicator")
layout.prop(st, "only_selected")
@@ -142,10 +143,6 @@ class TIME_MT_playback(bpy.types.Menu):
layout.separator()
- layout.prop(st, "continue_physics")
-
- layout.separator()
-
layout.prop(scene, "sync_audio", text="Realtime Playback", icon='SPEAKER')
layout.prop(scene, "mute_audio")
layout.prop(scene, "scrub_audio")
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);
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 7a76417fe4b..49893e9c015 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -825,7 +825,7 @@ enum {
/* time->flag */
/* show timing in frames instead of in seconds */
#define TIME_DRAWFRAMES 1
- /* temporary flag set when scrubbing time */
+ /* show time indicator box beside the frame number */
#define TIME_CFRA_NUM 2
/* only keyframes from active/selected channels get shown */
#define TIME_ONLYACTSEL 4
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 9f8d5278a27..20ef8519bb2 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1458,7 +1458,6 @@ static void rna_def_space_time(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Space Timeline Editor", "Timeline editor space data.");
/* Define Anim Playback Areas */
-
prop= RNA_def_property(srna, "play_top_left", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_REGION);
RNA_def_property_ui_text(prop, "Top-Left 3D Window", "");
@@ -1494,17 +1493,16 @@ static void rna_def_space_time(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Node Windows", "");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_SpaceTime_redraw_update");
- /* Other options */
-
- prop= RNA_def_property(srna, "continue_physics", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "redraws", TIME_CONTINUE_PHYSICS);
- RNA_def_property_ui_text(prop, "Continue Physics", "During playblack, continue physics simulations regardless of the frame number");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
-
+ /* Other options */
prop= RNA_def_property(srna, "only_selected", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ONLYACTSEL);
RNA_def_property_ui_text(prop, "Only Selected channels", "Show keyframes only from active/selected channels.");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
+
+ prop= RNA_def_property(srna, "show_cframe_indicator", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_CFRA_NUM);
+ RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line.");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
}
static void rna_def_console_line(BlenderRNA *brna)