Revision: 41414
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41414
Author:   nazgul
Date:     2011-10-31 14:01:40 +0000 (Mon, 31 Oct 2011)
Log Message:
-----------
Camera tracking integration
===========================

- Changed 3D viewport reconstruction settings to more usable defaults
- Some code clean-up
- Option to place markers for detected features across the whole frame,
  inside grease pencil areas or outside of grease pencil areas.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_tracking.h
    branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
    branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_graph_draw.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/clip_intern.h
    branches/soc-2011-tomato/source/blender/editors/space_clip/space_clip.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/space_view3d.c

Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_tracking.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_tracking.h   
2011-10-31 13:18:14 UTC (rev 41413)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_tracking.h   
2011-10-31 14:01:40 UTC (rev 41414)
@@ -87,10 +87,12 @@
 void BKE_tracking_invert_intrinsics(struct MovieTracking *tracking, float 
co[2], float nco[2]);
 
 void BKE_tracking_detect_fast(struct MovieTracking *tracking, struct ImBuf 
*imbuf,
-                       int framenr, int margin, int min_trackness, int 
min_distance, struct bGPDlayer *layer);
+                       int framenr, int margin, int min_trackness, int 
min_distance, struct bGPDlayer *layer,
+                       int place_outside_layer);
 
 void BKE_tracking_detect_moravec(struct MovieTracking *tracking, struct ImBuf 
*imbuf,
-                       int framenr, int margin, int count, int min_distance, 
struct bGPDlayer *layer);
+                       int framenr, int margin, int count, int min_distance, 
struct bGPDlayer *layer,
+                       int place_outside_layer);
 
 struct MovieTrackingTrack *BKE_tracking_indexed_bundle(struct MovieTracking 
*tracking, int bundlenr);
 

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c        
2011-10-31 13:18:14 UTC (rev 41413)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c        
2011-10-31 14:01:40 UTC (rev 41414)
@@ -1609,7 +1609,7 @@
 }
 
 static void retrieve_libmv_features(MovieTracking *tracking, struct 
libmv_Features *features,
-                       int framenr, int width, int height, bGPDlayer *layer)
+                       int framenr, int width, int height, bGPDlayer *layer, 
int place_outside_layer)
 {
 #ifdef WITH_LIBMV
        int a;
@@ -1627,7 +1627,7 @@
                yu= y/height;
 
                if(layer)
-                       ok= point_in_layer(layer, xu, yu);
+                       ok= point_in_layer(layer, xu, yu)!=place_outside_layer;
 
                if(ok) {
                        track= BKE_tracking_add_track(tracking, xu, yu, 
framenr, width, height);
@@ -1640,7 +1640,8 @@
 }
 
 void BKE_tracking_detect_fast(MovieTracking *tracking, ImBuf *ibuf,
-                       int framenr, int margin, int min_trackness, int 
min_distance, bGPDlayer *layer)
+                       int framenr, int margin, int min_trackness, int 
min_distance, bGPDlayer *layer,
+                       int place_outside_layer)
 {
 #ifdef WITH_LIBMV
        struct libmv_Features *features;
@@ -1650,14 +1651,14 @@
 
        MEM_freeN(pixels);
 
-       retrieve_libmv_features(tracking, features, framenr, ibuf->x, ibuf->y, 
layer);
+       retrieve_libmv_features(tracking, features, framenr, ibuf->x, ibuf->y, 
layer, place_outside_layer);
 
        libmv_destroyFeatures(features);
 #endif
 }
 
 void BKE_tracking_detect_moravec(MovieTracking *tracking, ImBuf *ibuf,
-                       int framenr, int margin, int count, int min_distance, 
bGPDlayer *layer)
+                       int framenr, int margin, int count, int min_distance, 
bGPDlayer *layer, int place_outside_layer)
 {
 #ifdef WITH_LIBMV
        struct libmv_Features *features;
@@ -1667,7 +1668,7 @@
 
        MEM_freeN(pixels);
 
-       retrieve_libmv_features(tracking, features, framenr, ibuf->x, ibuf->y, 
layer);
+       retrieve_libmv_features(tracking, features, framenr, ibuf->x, ibuf->y, 
layer, place_outside_layer);
 
        libmv_destroyFeatures(features);
 #endif

Modified: branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c        
2011-10-31 13:18:14 UTC (rev 41413)
+++ branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c        
2011-10-31 14:01:40 UTC (rev 41414)
@@ -12343,12 +12343,12 @@
                                                if(sl->spacetype==SPACE_VIEW3D) 
{
                                                        View3D *v3d= (View3D 
*)sl;
                                                        
if(v3d->bundle_size==0.0f) {
-                                                               
v3d->bundle_size= 0.1f;
+                                                               
v3d->bundle_size= 0.2f;
                                                                v3d->flag2 |= 
V3D_SHOW_RECONSTRUCTION;
                                                        }
 
                                                        
if(v3d->bundle_drawtype==0)
-                                                               
v3d->bundle_drawtype= OB_EMPTY_SPHERE;
+                                                               
v3d->bundle_drawtype= OB_PLAINAXES;
                                                }
                                                else 
if(sl->spacetype==SPACE_CLIP) {
                                                        SpaceClip *sc= 
(SpaceClip *)sl;

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-10-31 13:18:14 UTC (rev 41413)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c      
2011-10-31 14:01:40 UTC (rev 41414)
@@ -71,15 +71,32 @@
 
 /*********************** main area drawing *************************/
 
-static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, 
Scene *scene)
+void clip_draw_curfra_label(SpaceClip *sc, float x, float y)
 {
-       float x;
-       int *points, totseg, i, a;
-       float sfra= SFRA, efra= EFRA, framelen= ar->winx/(efra-sfra+1), 
fontsize, fontwidth;
        uiStyle *style= UI_GetStyle();
        int fontid= style->widget.uifont_id;
        char str[32];
+       float fontsize, fontwidth;
 
+       /* frame number */
+       BLF_size(fontid, 11.0f, U.dpi);
+       BLI_snprintf(str, sizeof(str), "%d", sc->user.framenr);
+       fontsize= BLF_height(fontid, str);
+       fontwidth= BLF_width(fontid, str);
+
+       glRecti(x, y, x+fontwidth+6, y+fontsize+4);
+
+       UI_ThemeColor(TH_TEXT);
+       BLF_position(fontid, x+2.0f, y+2.0f, 0.0f);
+       BLF_draw(fontid, str, strlen(str));
+}
+
+static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, 
Scene *scene)
+{
+       float x;
+       int *points, totseg, i, a;
+       float sfra= SFRA, efra= EFRA, framelen= ar->winx/(efra-sfra+1);
+
        glEnable(GL_BLEND);
 
        /* cache background */
@@ -169,17 +186,7 @@
        UI_ThemeColor(TH_CFRAME);
        glRecti(x, 0, x+framelen, 8);
 
-       /* frame number */
-       BLF_size(fontid, 11.0f, U.dpi);
-       BLI_snprintf(str, sizeof(str), "%d", sc->user.framenr);
-       fontsize= BLF_height(fontid, str);
-       fontwidth= BLF_width(fontid, str);
-
-       glRecti(x, 8, x+fontwidth+6, 12+fontsize);
-
-       UI_ThemeColor(TH_TEXT);
-       BLF_position(fontid, x+2.0f, 10.0f, 0.0f);
-       BLF_draw(fontid, str, strlen(str));
+       clip_draw_curfra_label(sc, x, 8.0f);
 }
 
 static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar)
@@ -1240,7 +1247,7 @@
        glPopMatrix();
 }
 
-void draw_clip_main(SpaceClip *sc, ARegion *ar, Scene *scene)
+void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene)
 {
        MovieClip *clip= ED_space_clip(sc);
        ImBuf *ibuf;
@@ -1288,7 +1295,7 @@
 }
 
 /* draw grease pencil */
-void draw_clip_grease_pencil(bContext *C, int onlyv2d)
+void clip_draw_grease_pencil(bContext *C, int onlyv2d)
 {
        SpaceClip *sc= CTX_wm_space_clip(C);
        MovieClip *clip= ED_space_clip(sc);

Modified: 
branches/soc-2011-tomato/source/blender/editors/space_clip/clip_graph_draw.c
===================================================================
--- 
branches/soc-2011-tomato/source/blender/editors/space_clip/clip_graph_draw.c    
    2011-10-31 13:18:14 UTC (rev 41413)
+++ 
branches/soc-2011-tomato/source/blender/editors/space_clip/clip_graph_draw.c    
    2011-10-31 14:01:40 UTC (rev 41414)
@@ -89,11 +89,7 @@
 static void draw_graph_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
 {
        View2D *v2d= &ar->v2d;
-       uiStyle *style= UI_GetStyle();
-       int fontid= style->widget.uifont_id, fontsize;
-       float xscale, yscale, x, y;
-       char str[32];
-       short slen;
+       float xscale, yscale;
        float vec[2];
 
        /* Draw a light green line to indicate current frame */
@@ -118,24 +114,8 @@
        UI_view2d_getscale(v2d, &xscale, &yscale);
        glScalef(1.0f/xscale, 1.0f, 1.0f);
 
-       BLI_snprintf(str, sizeof(str), "    %d", sc->user.framenr);
-       BLF_size(fontid, 11.0f, U.dpi);
-       slen= BLF_width(fontid, str);
-       fontsize= BLF_height(fontid, str);
+       clip_draw_curfra_label(sc, (float)sc->user.framenr * xscale, 18);
 
-       /* get starting coordinates for drawing */
-       x= (float)sc->user.framenr * xscale;
-       y= 18;
-
-       /* draw green box around/behind text */
-       UI_ThemeColorShade(TH_CFRAME, 0);
-       glRectf(x, y,  x+slen,  y+fontsize+4);
-
-       /* draw current frame number - black text */
-       UI_ThemeColor(TH_TEXT);
-       BLF_position(fontid, x-5, y+2, 0.0f);
-       BLF_draw(fontid, str, strlen(str));
-
        /* restore view transform */
        glScalef(xscale, 1.0, 1.0);
 }
@@ -193,7 +173,7 @@
        }
 }
 
-static void draw_clip_tracks_curves(View2D *v2d, SpaceClip *sc)
+static void draw_tracks_curves(View2D *v2d, SpaceClip *sc)
 {
        MovieClip *clip= ED_space_clip(sc);
        MovieTracking *tracking= &clip->tracking;
@@ -222,7 +202,7 @@
        clip_graph_tracking_values_iterate(sc, &userdata, 
tracking_segment_knot_cb, NULL, NULL);
 }
 
-static void draw_clip_frame_curves(SpaceClip *sc)
+static void draw_frame_curves(SpaceClip *sc)
 {
        MovieClip *clip= ED_space_clip(sc);
        MovieTracking *tracking= &clip->tracking;
@@ -253,7 +233,7 @@
                glEnd();
 }
 
-void draw_clip_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
+void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
 {
        View2D *v2d= &ar->v2d;
        View2DGrid *grid;
@@ -265,10 +245,10 @@
        UI_view2d_grid_free(grid);
 
        if(sc->flag&SC_SHOW_GRAPH_TRACKS)
-               draw_clip_tracks_curves(v2d, sc);
+               draw_tracks_curves(v2d, sc);
 
        if(sc->flag&SC_SHOW_GRAPH_FRAMES)
-               draw_clip_frame_curves(sc);
+               draw_frame_curves(sc);
 
        /* current frame */
        draw_graph_cfra(sc, ar, scene);

Modified: 
branches/soc-2011-tomato/source/blender/editors/space_clip/clip_intern.h
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/clip_intern.h    
2011-10-31 13:18:14 UTC (rev 41413)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_intern.h    
2011-10-31 14:01:40 UTC (rev 41414)
@@ -47,11 +47,12 @@
 void ED_clip_buttons_register(struct ARegionType *art);
 
 /* clip_draw.c */
-void draw_clip_main(struct SpaceClip *sc, struct ARegion *ar, struct Scene 
*scene);
-void draw_clip_grease_pencil(struct bContext *C, int onlyv2d);
+void clip_draw_main(struct SpaceClip *sc, struct ARegion *ar, struct Scene 
*scene);
+void clip_draw_grease_pencil(struct bContext *C, int onlyv2d);
+void clip_draw_curfra_label(struct SpaceClip *sc, float x, float y);
 
 /* clip_graph_draw.c */
-void draw_clip_graph(struct SpaceClip *sc, struct ARegion *ar, struct Scene 
*scene);
+void clip_draw_graph(struct SpaceClip *sc, struct ARegion *ar, struct Scene 
*scene);
 
 /* clip_graph_ops.c */
 void CLIP_OT_graph_select(struct wmOperatorType *ot);
@@ -61,7 +62,6 @@
 /* clip_ops.c */
 void CLIP_OT_open(struct wmOperatorType *ot);
 void CLIP_OT_reload(struct wmOperatorType *ot);
-// void CLIP_OT_unlink(struct wmOperatorType *ot);

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to