diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-26 15:49:38 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-26 15:49:38 +0400 |
commit | db57cbac20bb513ba688c5cfb2655d8753a89aab (patch) | |
tree | 3064e8c00b8a17b6d56aeda9bc650f6955a96af8 /source | |
parent | e19d78178de0eeb8cdadcbbe7b7d78d950d85007 (diff) |
More curves view improvements for clip editor:
- Renamed graph_jump_to_current_frame to graph_center_current_frame
which makes more sense.
- Curve view now can be locked to time cursor (Lock to Time Cursor in
Display panel or L button in curve view). Not sure if offset from
locked position will make much sense here.
- Added hotkey for solving -- Shift-S.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_clip/clip_graph_ops.c | 22 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_intern.h | 4 | ||||
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 12 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_space_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 6 |
5 files changed, 35 insertions, 12 deletions
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index 7652e59a9a8..6a56de26689 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -447,30 +447,36 @@ void CLIP_OT_graph_view_all(wmOperatorType *ot) /******************** jump to current frame operator ********************/ -static int jump_to_current_frame_exec(bContext *C, wmOperator *UNUSED(op)) +void ED_clip_graph_center_current_frame(Scene *scene, ARegion *ar) { - Scene *scene = CTX_data_scene(C); - ARegion *ar = CTX_wm_region(C); View2D *v2d = &ar->v2d; float extra = (v2d->cur.xmax - v2d->cur.xmin) / 2.0; /* set extents of view to start/end frames */ v2d->cur.xmin = (float)CFRA - extra; v2d->cur.xmax = (float)CFRA + extra; +} + +static int center_current_frame_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *scene = CTX_data_scene(C); + ARegion *ar = CTX_wm_region(C); + + ED_clip_graph_center_current_frame(scene, ar); ED_region_tag_redraw(ar); return OPERATOR_FINISHED; } -void CLIP_OT_graph_jump_to_current_frame(wmOperatorType *ot) +void CLIP_OT_graph_center_current_frame(wmOperatorType *ot) { /* identifiers */ - ot->name = "Jump to current frame"; - ot->description = "Jump to current frame"; - ot->idname = "CLIP_OT_graph_jump_to_current_frame"; + ot->name = "Center Current Frame"; + ot->description = "Scroll view so current frame would be centered"; + ot->idname = "CLIP_OT_graph_center_current_frame"; /* api callbacks */ - ot->exec = jump_to_current_frame_exec; + ot->exec = center_current_frame_exec; ot->poll = ED_space_clip_graph_poll; } diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h index 3f273b5cd90..9ff58a73ca2 100644 --- a/source/blender/editors/space_clip/clip_intern.h +++ b/source/blender/editors/space_clip/clip_intern.h @@ -55,11 +55,13 @@ void clip_draw_curfra_label(struct SpaceClip *sc, float x, float y); void clip_draw_graph(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene); /* clip_graph_ops.c */ +void ED_clip_graph_center_current_frame(struct Scene *scene, struct ARegion *ar); + void CLIP_OT_graph_select(struct wmOperatorType *ot); void CLIP_OT_graph_delete_curve(struct wmOperatorType *ot); void CLIP_OT_graph_delete_knot(struct wmOperatorType *ot); void CLIP_OT_graph_view_all(struct wmOperatorType *ot); -void CLIP_OT_graph_jump_to_current_frame(struct wmOperatorType *ot); +void CLIP_OT_graph_center_current_frame(struct wmOperatorType *ot); /* clip_ops.c */ void CLIP_OT_open(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index c9b8c7971e5..9eff602fe6b 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -374,7 +374,7 @@ static void clip_operatortypes(void) WM_operatortype_append(CLIP_OT_graph_delete_curve); WM_operatortype_append(CLIP_OT_graph_delete_knot); WM_operatortype_append(CLIP_OT_graph_view_all); - WM_operatortype_append(CLIP_OT_graph_jump_to_current_frame); + WM_operatortype_append(CLIP_OT_graph_center_current_frame); /* object tracking */ WM_operatortype_append(CLIP_OT_tracking_object_new); @@ -425,6 +425,8 @@ static void clip_keymap(struct wmKeyConfig *keyconf) RNA_string_set(kmi->ptr, "value_1", "CLIP"); RNA_string_set(kmi->ptr, "value_2", "GRAPH"); + WM_keymap_add_item(keymap, "CLIP_OT_solve_camera", SKEY, KM_PRESS, KM_SHIFT, 0); + /* ******** Hotkeys avalaible for main region only ******** */ keymap= WM_keymap_find(keyconf, "Clip Editor", SPACE_CLIP, 0); @@ -555,7 +557,10 @@ static void clip_keymap(struct wmKeyConfig *keyconf) /* view */ WM_keymap_add_item(keymap, "CLIP_OT_graph_view_all", HOMEKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "CLIP_OT_graph_jump_to_current_frame", PADPERIOD, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "CLIP_OT_graph_center_current_frame", PADPERIOD, KM_PRESS, 0, 0); + + kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0); + RNA_string_set(kmi->ptr, "data_path", "space_data.lock_time_cursor"); transform_keymap_for_space(keyconf, keymap, SPACE_CLIP); } @@ -778,6 +783,9 @@ static void clip_preview_area_draw(const bContext *C, ARegion *ar) Scene *scene= CTX_data_scene(C); short unitx= V2D_UNIT_FRAMESCALE, unity= V2D_UNIT_VALUES; + if(sc->flag & SC_LOCK_TIMECURSOR) + ED_clip_graph_center_current_frame(scene, ar); + /* clear and setup matrix */ UI_ThemeClearColor(TH_BACK); glClear(GL_COLOR_BUFFER_BIT); diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index d57da31793e..06138bc0757 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -900,7 +900,8 @@ enum { #define SC_SHOW_FILTERS (1<<13) #define SC_SHOW_GRAPH_FRAMES (1<<14) #define SC_SHOW_GRAPH_TRACKS (1<<15) -#define SC_SHOW_PYRAMID_LEVELS (1<<16) +#define SC_SHOW_PYRAMID_LEVELS (1<<16) +#define SC_LOCK_TIMECURSOR (1<<17) /* SpaceClip->mode */ #define SC_MODE_TRACKING 0 diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index ebe698eb5d5..571fe05238d 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -2900,6 +2900,12 @@ static void rna_def_space_clip(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_LOCK_SELECTION); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, "rna_SpaceClipEditor_lock_selection_update"); + /* lock to time cursor */ + prop= RNA_def_property(srna, "lock_time_cursor", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Lock to Time Cursor", "Lock curves view to time cursos during playback and tracking"); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_LOCK_TIMECURSOR); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL); + /* show markers pathes */ prop= RNA_def_property(srna, "show_track_path", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_TRACK_PATH); |