[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41363] branches/soc-2011-tomato/source/ blender/editors: Camera tracking integration

Sergey Sharybin g.ulairi at gmail.com
Sat Oct 29 13:34:26 CEST 2011


Revision: 41363
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41363
Author:   nazgul
Date:     2011-10-29 11:34:26 +0000 (Sat, 29 Oct 2011)
Log Message:
-----------
Camera tracking integration
===========================

- Fixed jump when sliding movie clip with lock to selection enabled and nothing selected.
- Reset offset from locked position when adding new marker.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/editors/include/ED_clip.h
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_editor.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c

Modified: branches/soc-2011-tomato/source/blender/editors/include/ED_clip.h
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/include/ED_clip.h	2011-10-29 11:23:37 UTC (rev 41362)
+++ branches/soc-2011-tomato/source/blender/editors/include/ED_clip.h	2011-10-29 11:34:26 UTC (rev 41363)
@@ -52,7 +52,7 @@
 struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc, float loc[2], float *scale, float *angle);
 
 void ED_clip_update_frame(const struct Main *mainp, int cfra);
-void ED_clip_view_selection(struct SpaceClip *sc, struct ARegion *ar, int fit);
+int ED_clip_view_selection(struct SpaceClip *sc, struct ARegion *ar, int fit);
 
 void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2]);
 void ED_clip_point_stable_pos(struct bContext *C, float x, float y, float *xr, float *yr);

Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/clip_editor.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/clip_editor.c	2011-10-29 11:23:37 UTC (rev 41362)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_editor.c	2011-10-29 11:34:26 UTC (rev 41363)
@@ -202,17 +202,17 @@
 	return ok;
 }
 
-void ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
+int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
 {
 	int w, h, frame_width, frame_height;
 	float min[2], max[2];
 
 	ED_space_clip_size(sc, &frame_width, &frame_height);
 
-	if(frame_width==0 || frame_height==0) return;
+	if(frame_width==0 || frame_height==0) return 0;
 
 	if(!selected_boundbox(sc, min, max))
-		return;
+		return 0;
 
 	/* center view */
 	clip_view_center_to_point(sc, (max[0]+min[0])/(2*frame_width), (max[1]+min[1])/(2*frame_height));
@@ -238,6 +238,8 @@
 		if(fit || sc->zoom>newzoom)
 			sc->zoom= newzoom;
 	}
+
+	return 1;
 }
 
 void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2])

Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c	2011-10-29 11:23:37 UTC (rev 41362)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c	2011-10-29 11:34:26 UTC (rev 41363)
@@ -684,11 +684,11 @@
 			tmpibuf= ED_space_clip_get_stable_buffer(sc, NULL, NULL, NULL);
 		}
 
-		ED_clip_view_selection(sc, ar, 0);
+		if(ED_clip_view_selection(sc, ar, 0)) {
+			sc->xof+= sc->xlockof;
+			sc->yof+= sc->ylockof;
+		}
 
-		sc->xof+= sc->xlockof;
-		sc->yof+= sc->ylockof;
-
 		if(tmpibuf)
 			IMB_freeImBuf(tmpibuf);
 	}

Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c	2011-10-29 11:23:37 UTC (rev 41362)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c	2011-10-29 11:34:26 UTC (rev 41363)
@@ -143,6 +143,10 @@
 
 	add_marker(sc, pos[0], pos[1]);
 
+	/* reset offset from locked position, so frame jumping wouldn't be so confusing */
+	sc->xlockof= 0;
+	sc->ylockof= 0;
+
 	WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
 
 	return OPERATOR_FINISHED;




More information about the Bf-blender-cvs mailing list