[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40562] branches/soc-2011-tomato/source/ blender: Camera tracking integration
Sergey Sharybin
g.ulairi at gmail.com
Mon Sep 26 12:25:39 CEST 2011
Revision: 40562
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40562
Author: nazgul
Date: 2011-09-26 10:25:38 +0000 (Mon, 26 Sep 2011)
Log Message:
-----------
Camera tracking integration
===========================
Various grease pencil fixes:
- Last segment of distorted poly line wasn't drawing when
manual calibration is enabled.
- Grease pencil+2d stabilization should live together fine now.
Modified Paths:
--------------
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
Modified: branches/soc-2011-tomato/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/gpencil/gpencil_paint.c 2011-09-26 10:16:11 UTC (rev 40561)
+++ branches/soc-2011-tomato/source/blender/editors/gpencil/gpencil_paint.c 2011-09-26 10:25:38 UTC (rev 40562)
@@ -103,6 +103,8 @@
short radius; /* radius of influence for eraser */
short flags; /* flags that can get set during runtime */
+
+ float imat[4][4];
} tGPsdata;
/* values for tGPsdata->status */
@@ -277,6 +279,7 @@
/* 2d - on 'canvas' (assume that p->v2d is set) */
else if ((gpd->sbuffer_sflag & GP_STROKE_2DSPACE) && (p->v2d)) {
UI_view2d_region_to_view(p->v2d, mval[0], mval[1], &out[0], &out[1]);
+ mul_v3_m4v3(out, p->imat, out);
}
#if 0
@@ -995,6 +998,8 @@
/* pass on current scene and window */
p->scene= CTX_data_scene(C);
p->win= CTX_wm_window(C);
+
+ unit_m4(p->imat);
switch (curarea->spacetype) {
/* supported views first */
@@ -1098,13 +1103,15 @@
case SPACE_CLIP:
{
SpaceClip *sc= curarea->spacedata.first;
-
+
/* set the current area */
p->sa= curarea;
p->ar= ar;
p->v2d= &ar->v2d;
//p->ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
-
+
+ invert_m4_m4(p->imat, sc->unistabmat);
+
/* check that gpencil data is allowed to be drawn */
if ((sc->flag & SC_SHOW_GPENCIL)==0) {
p->status= GP_STATUS_ERROR;
@@ -1114,7 +1121,7 @@
}
}
break;
-
+
/* unsupported views */
default:
{
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-09-26 10:16:11 UTC (rev 40561)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c 2011-09-26 10:25:38 UTC (rev 40562)
@@ -1083,7 +1083,7 @@
sub_v2_v2v2(dpos, npos, pos);
mul_v2_fl(dpos, 1.f/steps);
- for(j= 0; j<steps; j++) {
+ for(j= 0; j<=steps; j++) {
BKE_tracking_apply_intrinsics(tracking, pos, tpos);
glVertex2f(tpos[0]/width, tpos[1]/(height*aspy));
@@ -1130,14 +1130,24 @@
ED_space_clip_zoom(sc, ar, &zoomx, &zoomy);
if(sc->flag&SC_SHOW_STABLE) {
+ float smat[4][4], ismat[4][4];
+
ibuf= ED_space_clip_acquire_stable_buffer(sc, sc->loc, &sc->scale, &sc->angle);
BKE_tracking_stabdata_to_mat4(width, height, sc->loc, sc->scale, sc->angle, sc->stabmat);
+
+ unit_m4(smat);
+ smat[0][0]= 1.f/width;
+ smat[1][1]= 1.f/height;
+ invert_m4_m4(ismat, smat);
+
+ mul_serie_m4(sc->unistabmat, smat, sc->stabmat, ismat, NULL, NULL, NULL, NULL, NULL);
} else {
ibuf= ED_space_clip_acquire_buffer(sc);
zero_v2(sc->loc);
sc->scale= 1.f;
unit_m4(sc->stabmat);
+ unit_m4(sc->unistabmat);
}
if(ibuf) {
@@ -1168,9 +1178,12 @@
ibuf= ED_space_clip_acquire_buffer(sc);
if(ibuf) {
+ glPushMatrix();
+ glMultMatrixf(sc->unistabmat);
draw_gpencil_2dimage(C, ibuf);
IMB_freeImBuf(ibuf);
+ glPopMatrix();
}
}
} else {
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-09-26 10:16:11 UTC (rev 40561)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c 2011-09-26 10:25:38 UTC (rev 40562)
@@ -636,9 +636,13 @@
ED_region_tag_redraw(ar);
break;
case NC_SPACE:
- if(wmn->data == ND_SPACE_VIEW3D)
+ if(wmn->data == ND_SPACE_CLIP)
ED_region_tag_redraw(ar);
break;
+ case NC_SCREEN:
+ if(wmn->data == ND_GPENCIL)
+ ED_region_tag_redraw(ar);
+ break;
}
}
@@ -726,6 +730,7 @@
art->regionid= RGN_TYPE_TOOLS;
art->prefsizex= UI_COMPACT_PANEL_WIDTH;
art->keymapflag= ED_KEYMAP_FRAMES|ED_KEYMAP_UI;
+ art->listener= clip_props_area_listener;
art->init= clip_tools_area_init;
art->draw= clip_tools_area_draw;
Modified: branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h 2011-09-26 10:16:11 UTC (rev 40561)
+++ branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h 2011-09-26 10:25:38 UTC (rev 40562)
@@ -585,8 +585,8 @@
/* current stabilization data */
float loc[2], scale, angle; /* pre-composed stabilization data */
int pad;
- float stabmat[4][4]; /* current stabilization matrix, defined when drawing
- and used for mouse position calculation */
+ float stabmat[4][4], unistabmat[4][4]; /* current stabilization matrix and the same matrix in unified space,
+ defined when drawing and used for mouse position calculation */
} SpaceClip;
/* view3d Now in DNA_view3d_types.h */
More information about the Bf-blender-cvs
mailing list