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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-01-26 15:49:38 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-01-26 15:49:38 +0400
commitdb57cbac20bb513ba688c5cfb2655d8753a89aab (patch)
tree3064e8c00b8a17b6d56aeda9bc650f6955a96af8 /source/blender/editors/space_clip
parente19d78178de0eeb8cdadcbbe7b7d78d950d85007 (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/blender/editors/space_clip')
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c22
-rw-r--r--source/blender/editors/space_clip/clip_intern.h4
-rw-r--r--source/blender/editors/space_clip/space_clip.c12
3 files changed, 27 insertions, 11 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);