Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-11-07 16:55:18 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-11-07 16:55:18 +0400
commit27d42c63d9b507b1771ed5a7923c389c719b877b (patch)
tree8dd4ca61e197a7053633f62b4a5d8091957724c4 /source/blender/editors/gpencil
parente122dc0748f6a4d77b236e26beba93e2a9a36bf0 (diff)
Camera tracking integration
=========================== Commiting camera tracking integration gsoc project into trunk. This commit includes: - Bundled version of libmv library (with some changes against official repo, re-sync with libmv repo a bit later) - New datatype ID called MovieClip which is optimized to work with movie clips (both of movie files and image sequences) and doing camera/motion tracking operations. - New editor called Clip Editor which is currently used for motion/tracking stuff only, but which can be easily extended to work with masks too. This editor supports: * Loading movie files/image sequences * Build proxies with different size for loaded movie clip, also supports building undistorted proxies to increase speed of playback in undistorted mode. * Manual lens distortion mode calibration using grid and grease pencil * Supervised 2D tracking using two different algorithms KLT and SAD. * Basic algorithm for feature detection * Camera motion solving. scene orientation - New constraints to "link" scene objects with solved motions from clip: * Follow Track (make object follow 2D motion of track with given name or parent object to reconstructed 3D position of track) * Camera Solver to make camera moving in the same way as reconstructed camera This commit NOT includes changes from tomato branch: - New nodes (they'll be commited as separated patch) - Automatic image offset guessing for image input node and image editor (need to do more tests and gather more feedback) - Code cleanup in libmv-capi. It's not so critical cleanup, just increasing readability and understanadability of code. Better to make this chaneg when Keir will finish his current patch. More details about this project can be found on this page: http://wiki.blender.org/index.php/User:Nazg-gul/GSoC-2011 Further development of small features would be done in trunk, bigger/experimental features would first be implemented in tomato branch.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c3
-rw-r--r--source/blender/editors/gpencil/editaction_gpencil.c1
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c14
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c54
4 files changed, 68 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 64da61f8f55..081d604819d 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -693,6 +693,7 @@ void draw_gpencil_2dimage (bContext *C, ImBuf *ibuf)
/* calculate rect */
switch (sa->spacetype) {
case SPACE_IMAGE: /* image */
+ case SPACE_CLIP: /* clip */
{
/* just draw using standard scaling (settings here are currently ignored anyways) */
@@ -766,7 +767,7 @@ void draw_gpencil_view2d (bContext *C, short onlyv2d)
/* special hack for Image Editor */
// FIXME: the opengl poly-strokes don't draw at right thickness when done this way, so disabled
- if (sa->spacetype == SPACE_IMAGE)
+ if (ELEM(sa->spacetype, SPACE_IMAGE, SPACE_CLIP))
dflag |= GP_DRAWDATA_IEDITHACK;
/* draw it! */
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index 56210864593..81a5f6777e7 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -422,6 +422,7 @@ void paste_gpdata (Scene *scene)
case SPACE_NODE: /* Nodes Editor: either screen-aligned or view-aligned */
case SPACE_IMAGE: /* Image Editor: either screen-aligned or view\image-aligned */
+ case SPACE_CLIP: /* Image Editor: either screen-aligned or view\image-aligned */
if ((gps->flag == 0) || (gps->flag & GP_STROKE_2DSPACE))
stroke_ok= 1;
break;
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 7b79384fbb4..65db5e27ed7 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -69,6 +69,7 @@
#include "ED_gpencil.h"
#include "ED_view3d.h"
+#include "ED_clip.h"
#include "gpencil_intern.h"
@@ -137,6 +138,19 @@ bGPdata **gpencil_data_get_pointers (bContext *C, PointerRNA *ptr)
}
break;
+ case SPACE_CLIP: /* Nodes Editor */
+ {
+ SpaceClip *sc= (SpaceClip *)CTX_wm_space_data(C);
+ MovieClip *clip= ED_space_clip(sc);
+
+ if(clip) {
+ /* for now, as long as there's a clip, default to using that in Clip Editor */
+ if (ptr) RNA_id_pointer_create(&clip->id, ptr);
+ return &clip->gpd;
+ }
+ }
+ break;
+
default: /* unsupported space */
return NULL;
}
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 12f03f7341c..b89b0cda451 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -103,6 +103,11 @@ typedef struct tGPsdata {
short radius; /* radius of influence for eraser */
short flags; /* flags that can get set during runtime */
+
+ float imat[4][4]; /* inverted transformation matrix applying when converting coords from screen-space
+ to region space */
+
+ float custom_color[3]; /* custom color for */
} tGPsdata;
/* values for tGPsdata->status */
@@ -277,6 +282,7 @@ static void gp_stroke_convertcoords (tGPsdata *p, const int mval[2], float out[3
/* 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
@@ -997,6 +1003,8 @@ static int gp_session_initdata (bContext *C, tGPsdata *p)
/* 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 */
@@ -1097,6 +1105,33 @@ static int gp_session_initdata (bContext *C, tGPsdata *p)
#endif
}
break;
+ 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);
+
+ /* custom color for new layer */
+ p->custom_color[0]= 1.0f;
+ p->custom_color[1]= 0.0f;
+ p->custom_color[2]= 0.5f;
+ p->custom_color[3]= 0.9f;
+
+ /* check that gpencil data is allowed to be drawn */
+ 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;
+ }
+ }
+ break;
/* unsupported views */
default:
@@ -1182,8 +1217,12 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
{
/* get active layer (or add a new one if non-existent) */
p->gpl= gpencil_layer_getactive(p->gpd);
- if (p->gpl == NULL)
+ if (p->gpl == NULL) {
p->gpl= gpencil_layer_addnew(p->gpd);
+
+ if(p->custom_color[3])
+ copy_v3_v3(p->gpl->color, p->custom_color);
+ }
if (p->gpl->flag & GP_LAYER_LOCKED) {
p->status= GP_STATUS_ERROR;
if (G.f & G_DEBUG)
@@ -1299,6 +1338,12 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE;
}
break;
+
+ case SPACE_CLIP:
+ {
+ p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE;
+ }
+ break;
}
}
}
@@ -1336,9 +1381,12 @@ static void gp_paint_strokeend (tGPsdata *p)
/* 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)