[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43720] trunk/blender: More curves view improvements for clip editor:

Sergey Sharybin sergey.vfx at gmail.com
Thu Jan 26 12:49:50 CET 2012


Revision: 43720
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43720
Author:   nazgul
Date:     2012-01-26 11:49:38 +0000 (Thu, 26 Jan 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_clip.py
    trunk/blender/source/blender/editors/space_clip/clip_graph_ops.c
    trunk/blender/source/blender/editors/space_clip/clip_intern.h
    trunk/blender/source/blender/editors/space_clip/space_clip.c
    trunk/blender/source/blender/makesdna/DNA_space_types.h
    trunk/blender/source/blender/makesrna/intern/rna_space.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_clip.py	2012-01-26 11:16:49 UTC (rev 43719)
+++ trunk/blender/release/scripts/startup/bl_ui/space_clip.py	2012-01-26 11:49:38 UTC (rev 43720)
@@ -559,6 +559,9 @@
 
         col.prop(sc, "lock_selection")
 
+        if sc.view == 'GRAPH':
+            col.prop(sc, "lock_time_cursor")
+
         clip = sc.clip
         if clip:
             col.label(text="Display Aspect Ratio:")

Modified: trunk/blender/source/blender/editors/space_clip/clip_graph_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_clip/clip_graph_ops.c	2012-01-26 11:16:49 UTC (rev 43719)
+++ trunk/blender/source/blender/editors/space_clip/clip_graph_ops.c	2012-01-26 11:49:38 UTC (rev 43720)
@@ -447,30 +447,36 @@
 
 /******************** 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;
 }

Modified: trunk/blender/source/blender/editors/space_clip/clip_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_clip/clip_intern.h	2012-01-26 11:16:49 UTC (rev 43719)
+++ trunk/blender/source/blender/editors/space_clip/clip_intern.h	2012-01-26 11:49:38 UTC (rev 43720)
@@ -55,11 +55,13 @@
 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);

Modified: trunk/blender/source/blender/editors/space_clip/space_clip.c
===================================================================
--- trunk/blender/source/blender/editors/space_clip/space_clip.c	2012-01-26 11:16:49 UTC (rev 43719)
+++ trunk/blender/source/blender/editors/space_clip/space_clip.c	2012-01-26 11:49:38 UTC (rev 43720)
@@ -374,7 +374,7 @@
 	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 @@
 	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,8 +557,11 @@
 
 	/* 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 @@
 	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);

Modified: trunk/blender/source/blender/makesdna/DNA_space_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_space_types.h	2012-01-26 11:16:49 UTC (rev 43719)
+++ trunk/blender/source/blender/makesdna/DNA_space_types.h	2012-01-26 11:49:38 UTC (rev 43720)
@@ -900,7 +900,8 @@
 #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

Modified: trunk/blender/source/blender/makesrna/intern/rna_space.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_space.c	2012-01-26 11:16:49 UTC (rev 43719)
+++ trunk/blender/source/blender/makesrna/intern/rna_space.c	2012-01-26 11:49:38 UTC (rev 43720)
@@ -2900,6 +2900,12 @@
 	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);



More information about the Bf-blender-cvs mailing list