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

Sergey Sharybin g.ulairi at gmail.com
Fri Aug 12 16:55:45 CEST 2011


Revision: 39336
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39336
Author:   nazgul
Date:     2011-08-12 14:55:44 +0000 (Fri, 12 Aug 2011)
Log Message:
-----------
Camera tracking integration
===========================

- Option to hide grease pencil (Display -> Grease Pencil).
- Added grease pencil controls to toolar.
- Fixed display issues when stroke contains one point only
  and Manual Calibration is enabled.

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
    branches/soc-2011-tomato/source/blender/editors/gpencil/gpencil_paint.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c
    branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2011-08-12 14:42:07 UTC (rev 39335)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2011-08-12 14:55:44 UTC (rev 39336)
@@ -197,6 +197,21 @@
             col = layout.column(align=True)
             col.label(text="Clean-up:")
             col.operator("clip.clean_tracks")
+
+            col = layout.column(align=True)
+            col.label(text="Grease Pencil:")
+
+            row = col.row()
+            row.operator("gpencil.draw", text="Draw").mode = 'DRAW'
+            row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT'
+
+            row = col.row()
+            row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY'
+            row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
+
+            row = col.row()
+            row.prop(context.tool_settings, "use_grease_pencil_sessions")
+
         else:
             layout.operator('clip.open')
 
@@ -354,8 +369,11 @@
         row.prop(sc, "show_tiny_markers", text="Tiny Markers")
         row.prop(sc, "show_stable", text="Stable")
 
+        row = layout.row()
+        row.prop(sc, "show_grease_pencil", text="Grease Pencil")
+        row.prop(sc, "use_mute_footage", text="Mute")
+
         layout.prop(sc, "lock_selection")
-        layout.prop(sc, "use_mute_footage")
         layout.prop(sc, "use_manual_calibration")
 
         clip = sc.clip

Modified: branches/soc-2011-tomato/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/gpencil/gpencil_paint.c	2011-08-12 14:42:07 UTC (rev 39335)
+++ branches/soc-2011-tomato/source/blender/editors/gpencil/gpencil_paint.c	2011-08-12 14:55:44 UTC (rev 39336)
@@ -1090,7 +1090,7 @@
 			break;
 		case SPACE_CLIP:
 		{
-			//SpaceClip *sc= curarea->spacedata.first;
+			SpaceClip *sc= curarea->spacedata.first;
 			
 			/* set the current area */
 			p->sa= curarea;
@@ -1098,15 +1098,13 @@
 			p->v2d= &ar->v2d;
 			//p->ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
 			
-#if 0 // XXX disabled for now
 			/* check that gpencil data is allowed to be drawn */
-			if ((sc->flag & SC_DISPGP)==0) {
+			if ((sc->flag & SC_SHOW_GPENCIL)==0) {
 				p->status= GP_STATUS_ERROR;
 				if (G.f & G_DEBUG)
 					printf("Error: In active view, Grease Pencil not shown \n");
 				return 0;
 			}
-#endif
 		}
 			break;
 			
@@ -1356,9 +1354,12 @@
 /* finish off stroke painting operation */
 static void gp_paint_cleanup (tGPsdata *p)
 {
-	/* finish off a stroke */
-	if(p->gpd)
+	/* p->gpd==NULL happens when stroke failed to initialize,
+	      for example. when GP is hidden in current space (sergey) */
+	if (p->gpd) {
+		/* finish off a stroke */
 		gp_paint_strokeend(p);
+	}
 	
 	/* "unlock" frame */
 	if (p->gpf)

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-08-12 14:42:07 UTC (rev 39335)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c	2011-08-12 14:55:44 UTC (rev 39336)
@@ -1050,43 +1050,51 @@
 
 			glColor4fv(layer->color);
 			glLineWidth(layer->thickness);
+			glPointSize((float)(layer->thickness + 2));
 
 			while(frame) {
 				bGPDstroke *stroke= frame->strokes.first;
 
 				while(stroke) {
-					if(stroke->flag&GP_STROKE_2DSPACE && stroke->totpoints>1) {
-						glBegin(GL_LINE_STRIP);
-							for(i= 0; i<stroke->totpoints-1; i++) {
-								float npos[2], dpos[2], len;
-								int steps;
+					if(stroke->flag&GP_STROKE_2DSPACE) {
+						if(stroke->totpoints>1) {
+							glBegin(GL_LINE_STRIP);
+								for(i= 0; i<stroke->totpoints-1; i++) {
+									float npos[2], dpos[2], len;
+									int steps;
 
-								pos[0]= stroke->points[i].x*width;
-								pos[1]= stroke->points[i].y*height;
+									pos[0]= stroke->points[i].x*width;
+									pos[1]= stroke->points[i].y*height;
 
-								npos[0]= stroke->points[i+1].x*width;
-								npos[1]= stroke->points[i+1].y*height;
+									npos[0]= stroke->points[i+1].x*width;
+									npos[1]= stroke->points[i+1].y*height;
 
-								len= len_v2v2(pos, npos);
-								steps= ceil(len/5.f);
+									len= len_v2v2(pos, npos);
+									steps= ceil(len/5.f);
 
-								/* we want to distort only long straight lines */
-								if(stroke->totpoints==2) {
-									BKE_tracking_apply_intrinsics(tracking, pos, pos);
-									BKE_tracking_apply_intrinsics(tracking, npos, npos);
-								}
+									/* we want to distort only long straight lines */
+									if(stroke->totpoints==2) {
+										BKE_tracking_apply_intrinsics(tracking, pos, pos);
+										BKE_tracking_apply_intrinsics(tracking, npos, npos);
+									}
 
-								sub_v2_v2v2(dpos, npos, pos);
-								mul_v2_fl(dpos, 1.f/steps);
+									sub_v2_v2v2(dpos, npos, pos);
+									mul_v2_fl(dpos, 1.f/steps);
 
-								for(j= 0; j<steps; j++) {
-									BKE_tracking_invert_intrinsics(tracking, pos, tpos);
-									glVertex2f(tpos[0]/width, tpos[1]/height);
+									for(j= 0; j<steps; j++) {
+										BKE_tracking_invert_intrinsics(tracking, pos, tpos);
+										glVertex2f(tpos[0]/width, tpos[1]/height);
 
-									add_v2_v2(pos, dpos);
+										add_v2_v2(pos, dpos);
+									}
 								}
-							}
-						glEnd();
+							glEnd();
+						}
+						else if(stroke->totpoints==1) {
+							glBegin(GL_POINTS);
+								glVertex2f(stroke->points[0].x, stroke->points[0].y);
+							glEnd();
+						}
 					}
 
 					stroke= stroke->next;
@@ -1099,6 +1107,7 @@
 		}
 
 		glLineWidth(1.f);
+		glPointSize(1.f);
 	}
 
 	glPopMatrix();
@@ -1147,7 +1156,7 @@
 	MovieClip *clip= ED_space_clip(sc);
 	ImBuf *ibuf;
 
-	if(/*(sc->flag&SI_DISPGP)==0 ||*/! clip)
+	if((sc->flag&SC_SHOW_GPENCIL)==0 || !clip)
 		return;
 
 	if(onlyv2d) {
@@ -1157,7 +1166,7 @@
 			ibuf= ED_space_clip_acquire_buffer(sc);
 
 			if(ibuf) {
-					draw_gpencil_2dimage(C, ibuf);
+				draw_gpencil_2dimage(C, ibuf);
 
 				IMB_freeImBuf(ibuf);
 			}

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-08-12 14:42:07 UTC (rev 39335)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c	2011-08-12 14:55:44 UTC (rev 39336)
@@ -105,7 +105,7 @@
 
 	sc= MEM_callocN(sizeof(SpaceClip), "initclip");
 	sc->spacetype= SPACE_CLIP;
-	sc->flag= SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH;
+	sc->flag= SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_SHOW_GPENCIL;
 	sc->zoom= 1.0f;
 	sc->path_length= 20;
 	sc->scopes.track_preview_height= 120;

Modified: branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h	2011-08-12 14:42:07 UTC (rev 39335)
+++ branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h	2011-08-12 14:55:44 UTC (rev 39336)
@@ -981,6 +981,7 @@
 #define SC_SHOW_GRID			(1<<9)
 #define SC_SHOW_STABLE			(1<<10)
 #define SC_MANUAL_CALIBRATION	(1<<11)
+#define SC_SHOW_GPENCIL			(1<<12)
 
 
 /* space types, moved from DNA_screen_types.h */

Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c	2011-08-12 14:42:07 UTC (rev 39335)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c	2011-08-12 14:55:44 UTC (rev 39336)
@@ -2745,6 +2745,12 @@
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_MANUAL_CALIBRATION);
 	RNA_def_property_ui_text(prop, "Manual Calibration", "Use manual calibration helpers");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+	/* show stable */
+	prop= RNA_def_property(srna, "show_grease_pencil", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GPENCIL);
+	RNA_def_property_ui_text(prop, "Show Grease Pencil", "Show grease pencil strokes over the footage");
+	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 }
 
 




More information about the Bf-blender-cvs mailing list