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

Sergey Sharybin g.ulairi at gmail.com
Wed Jul 27 11:48:20 CEST 2011


Revision: 38754
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38754
Author:   nazgul
Date:     2011-07-27 09:48:19 +0000 (Wed, 27 Jul 2011)
Log Message:
-----------
Camera tracking integration
===========================

- glog should no flood into logs files now.
- Request from Francois - changes in sliding:
  * Anchor point is for sliding the whole marker.
  * Square on pattern moves pattern and search relative
    to anchor point.
  * Square on search moves search only.
- Bundles in 3d viewport are colored by track custom color.

Modified Paths:
--------------
    branches/soc-2011-tomato/extern/libmv/libmv-capi.cpp
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_buttons.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_editor.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/space_view3d.c

Modified: branches/soc-2011-tomato/extern/libmv/libmv-capi.cpp
===================================================================
--- branches/soc-2011-tomato/extern/libmv/libmv-capi.cpp	2011-07-27 07:42:53 UTC (rev 38753)
+++ branches/soc-2011-tomato/extern/libmv/libmv-capi.cpp	2011-07-27 09:48:19 UTC (rev 38754)
@@ -70,9 +70,10 @@
 void libmv_initLogging(const char *argv0)
 {
 	google::InitGoogleLogging(argv0);
-	google::SetCommandLineOption("logtostderr", "0");
+	google::SetCommandLineOption("logtostderr", "1");
 	google::SetCommandLineOption("v", "0");
 	google::SetCommandLineOption("stderrthreshold", "7");
+	google::SetCommandLineOption("minloglevel", "7");
 	V3D::optimizerVerbosenessLevel = 0;
 }
 
@@ -80,7 +81,8 @@
 {
 	google::SetCommandLineOption("logtostderr", "1");
 	google::SetCommandLineOption("v", "0");
-	google::SetCommandLineOption("stderrthreshold", "2");
+	google::SetCommandLineOption("stderrthreshold", "1");
+	google::SetCommandLineOption("minloglevel", "0");
 	V3D::optimizerVerbosenessLevel = 1;
 }
 

Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/clip_buttons.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/clip_buttons.c	2011-07-27 07:42:53 UTC (rev 38753)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_buttons.c	2011-07-27 09:48:19 UTC (rev 38754)
@@ -45,6 +45,7 @@
 #include "BLI_listbase.h"
 
 #include "BKE_context.h"
+#include "BKE_depsgraph.h"
 #include "BKE_screen.h"
 #include "BKE_movieclip.h"
 #include "BKE_tracking.h"
@@ -171,6 +172,10 @@
 		marker->pos[0]= sc->marker_pos[0]/width;
 		marker->pos[1]= sc->marker_pos[1]/height;
 
+		/* to update position of "parented" objects */
+		DAG_id_tag_update(&clip->id, 0);
+		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
 		ok= 1;
 	}
 	else if(event==B_MARKER_PAT_DIM) {
@@ -238,6 +243,10 @@
 		track->offset[0]= sc->track_offset[0]/width;
 		track->offset[1]= sc->track_offset[1]/height;
 
+		/* to update position of "parented" objects */
+		DAG_id_tag_update(&clip->id, 0);
+		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
 		ok= 1;
 	}
 

Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c	2011-07-27 07:42:53 UTC (rev 38753)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c	2011-07-27 09:48:19 UTC (rev 38754)
@@ -198,7 +198,7 @@
 			break;
 
 		if(marker->framenr==i) {
-			copy_v2_v2(path[--a], marker->pos);
+			add_v2_v2v2(path[--a], marker->pos, track->offset);
 
 			if(marker->framenr==sc->user.framenr)
 				curindex= a;
@@ -220,7 +220,7 @@
 			if(marker->framenr==sc->user.framenr)
 				curindex= b;
 
-			copy_v2_v2(path[b++], marker->pos);
+			add_v2_v2v2(path[b++], marker->pos, track->offset);
 		} else
 			break;
 
@@ -498,7 +498,7 @@
 	glPopMatrix();
 }
 
-static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, int outline, int act, int width, int height)
+static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, int outline, int sel, int act, int width, int height)
 {
 	float x, y, dx, dy, patdx, patdy, searchdx, searchdy, tdx, tdy;
 	int tiny= sc->flag&SC_SHOW_TINY_MARKER;
@@ -523,38 +523,25 @@
 	dx= 6.0f/width/sc->zoom;
 	dy= 6.0f/height/sc->zoom;
 
-	patdx= MIN2(dx, (track->pat_max[0]-track->pat_min[0])/6.f);
-	patdy= MIN2(dy, (track->pat_max[1]-track->pat_min[1])/6.f);
+	patdx= MIN2(dx*2.f/3.f, (track->pat_max[0]-track->pat_min[0])/6.f);
+	patdy= MIN2(dy*2.f/3.f, (track->pat_max[1]-track->pat_min[1])/6.f);
 
 	searchdx= MIN2(dx, (track->search_max[0]-track->search_min[0])/6.f);
 	searchdy= MIN2(dy, (track->search_max[1]-track->search_min[1])/6.f);
 
-	/* position square */
-	if(sc->flag&SC_SHOW_MARKER_SEARCH || sc->flag&SC_SHOW_MARKER_PATTERN) {
-		if(sc->flag&SC_SHOW_MARKER_SEARCH) {
-			if(!outline) {
-				if(track->search_flag&SELECT) glColor3fv(scol);
-				else glColor3fv(col);
-			}
+	if((sc->flag&SC_SHOW_MARKER_SEARCH) && ((track->search_flag&SELECT)==sel || outline)) {
+		if(!outline) {
+			if(track->search_flag&SELECT) glColor3fv(scol);
+			else glColor3fv(col);
+		}
 
-			x= track->search_min[0];
-			y= track->search_max[1];
+		/* search offset square */
+		x= track->search_min[0];
+		y= track->search_max[1];
 
-			tdx= searchdx;
-			tdy= searchdy;
-		} else {
-			if(!outline) {
-				if(track->pat_flag&SELECT) glColor3fv(scol);
-				else glColor3fv(col);
-			}
+		tdx= searchdx;
+		tdy= searchdy;
 
-			x= track->pat_min[0];
-			y= track->pat_max[1];
-
-			tdx= patdx;
-			tdy= patdy;
-		}
-
 		if(outline) {
 			tdx+= 1.0f/sc->zoom/width;
 			tdy+= 1.0f/sc->zoom/height;
@@ -566,15 +553,8 @@
 			glVertex3f(x+tdx, y-tdy, 0);
 			glVertex3f(x-tdx, y-tdy, 0);
 		glEnd();
-	}
 
-	/* search resizing triangle */
-	if(sc->flag&SC_SHOW_MARKER_SEARCH) {
-		if(!outline) {
-			if(track->search_flag&SELECT) glColor3fv(scol);
-			else glColor3fv(col);
-		}
-
+		/* search resizing triangle */
 		x= track->search_max[0];
 		y= track->search_min[1];
 
@@ -582,8 +562,8 @@
 		tdy= searchdy*2.f;
 
 		if(outline) {
-			tdx+= 2.0f/sc->zoom/width;
-			tdy+= 2.0f/sc->zoom/height;
+			tdx+= 1.0f/sc->zoom/width;
+			tdy+= 1.0f/sc->zoom/height;
 		}
 
 		glBegin(GL_TRIANGLES);
@@ -593,13 +573,32 @@
 		glEnd();
 	}
 
-	/* pattern resizing triangle */
-	if(sc->flag&SC_SHOW_MARKER_PATTERN) {
+	if((sc->flag&SC_SHOW_MARKER_PATTERN) && ((track->pat_flag&SELECT)==sel || outline)) {
 		if(!outline) {
 			if(track->pat_flag&SELECT) glColor3fv(scol);
 			else glColor3fv(col);
 		}
 
+		/* pattern offset square */
+		x= track->pat_min[0];
+		y= track->pat_max[1];
+
+		tdx= patdx;
+		tdy= patdy;
+
+		if(outline) {
+			tdx+= 1.0f/sc->zoom/width;
+			tdy+= 1.0f/sc->zoom/height;
+		}
+
+		glBegin(GL_QUADS);
+			glVertex3f(x-tdx, y+tdy, 0);
+			glVertex3f(x+tdx, y+tdy, 0);
+			glVertex3f(x+tdx, y-tdy, 0);
+			glVertex3f(x-tdx, y-tdy, 0);
+		glEnd();
+
+		/* pattern resizing triangle */
 		x= track->pat_max[0];
 		y= track->pat_min[1];
 
@@ -607,8 +606,8 @@
 		tdy= patdy*2.f;
 
 		if(outline) {
-			tdx+= 2.0f/sc->zoom/width;
-			tdy+= 2.0f/sc->zoom/height;
+			tdx+= 1.0f/sc->zoom/width;
+			tdy+= 1.0f/sc->zoom/height;
 		}
 
 		glBegin(GL_TRIANGLES);
@@ -772,7 +771,8 @@
 			if(MARKER_VISIBLE(sc, marker)) {
 				draw_marker_outline(sc, track, marker, width, height);
 				draw_marker_areas(sc, track, marker, width, height, 0, 0);
-				draw_marker_slide_zones(sc, track, marker, 1, 0, width, height);
+				draw_marker_slide_zones(sc, track, marker, 1, 0, 0, width, height);
+				draw_marker_slide_zones(sc, track, marker, 0, 0, 0, width, height);
 			}
 		}
 
@@ -791,7 +791,7 @@
 
 				if(MARKER_VISIBLE(sc, marker)) {
 					draw_marker_areas(sc, track, marker, width, height, 0, 1);
-					draw_marker_slide_zones(sc, track, marker, 0, 0, width, height);
+					draw_marker_slide_zones(sc, track, marker, 0, 1, 0, width, height);
 				}
 			}
 		}
@@ -806,7 +806,7 @@
 
 			if(MARKER_VISIBLE(sc, marker)) {
 				draw_marker_areas(sc, sel, marker, width, height, 1, 1);
-				draw_marker_slide_zones(sc, sel, marker, 0, 1, width, height);
+				draw_marker_slide_zones(sc, sel, marker, 0, 1, 1, width, height);
 			}
 		}
 	}

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-07-27 07:42:53 UTC (rev 38753)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_editor.c	2011-07-27 09:48:19 UTC (rev 38754)
@@ -156,8 +156,8 @@
 			if(marker) {
 				float pos[2];
 
-				pos[0]= marker->pos[0]*width;
-				pos[1]= marker->pos[1]*height;
+				pos[0]= (marker->pos[0]+track->offset[0])*width;
+				pos[1]= (marker->pos[1]+track->offset[1])*height;
 
 				DO_MINMAX2(pos, min, max);
 

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-07-27 07:42:53 UTC (rev 38753)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c	2011-07-27 09:48:19 UTC (rev 38754)
@@ -356,14 +356,21 @@
 		copy_v2_v2(data->spos, marker->pos);
 		copy_v2_v2(data->soff, track->offset);
 	} else if(area==TRACK_AREA_PAT) {
-		data->min= track->pat_min;
-		data->max= track->pat_max;
+		if(action==SLIDE_ACTION_SIZE) {
+			data->min= track->pat_min;
+			data->max= track->pat_max;
+		} else {
+			data->pos= marker->pos;
+			data->offset= track->offset;
+			copy_v2_v2(data->spos, marker->pos);
+			copy_v2_v2(data->soff, track->offset);
+		}
 	} else if(area==TRACK_AREA_SEARCH) {
 		data->min= track->search_min;
 		data->max= track->search_max;
 	}
 
-	if(ELEM(area, TRACK_AREA_PAT, TRACK_AREA_SEARCH)) {
+	if(area==TRACK_AREA_SEARCH || (area==TRACK_AREA_PAT && action!=SLIDE_ACTION_OFFSET)) {
 		copy_v2_v2(data->smin, data->min);
 		copy_v2_v2(data->smax, data->max);
 	}
@@ -482,15 +489,14 @@
 			if((marker->flag&MARKER_DISABLED)==0) {
 				if(sc->flag&SC_SHOW_MARKER_SEARCH) {
 					if(mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 1, width, height))
-						customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_POINT, SLIDE_ACTION_POS, width, height);
+						customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, SLIDE_ACTION_OFFSET, width, height);
 					else if(mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 0, width, height))
 						customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, SLIDE_ACTION_SIZE, width, height);
 				}
 
 				if(!customdata && sc->flag&SC_SHOW_MARKER_PATTERN) {
-					if((sc->flag&SC_SHOW_MARKER_SEARCH)==0)
-						if(mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 1,  width, height))
-							customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_POINT, SLIDE_ACTION_POS, width, height);
+					if(mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 1,  width, height))
+						customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, SLIDE_ACTION_OFFSET, width, height);
 
 					if(!customdata && mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 0, width, height))

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list