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-10-31 18:01:40 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-10-31 18:01:40 +0400
commit8e42433f0234cf60dc509ba3cfc8ecb4d00548fa (patch)
tree627636ec7fed65a3d713adf66a53d11d8e7b2f70 /source/blender/editors
parent6de5c38e7397c9e82125f32b1f62b35d25afe0b4 (diff)
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_clip/clip_draw.c41
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c34
-rw-r--r--source/blender/editors/space_clip/clip_intern.h11
-rw-r--r--source/blender/editors/space_clip/space_clip.c8
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c20
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c4
6 files changed, 56 insertions, 62 deletions
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 9010ba47375..0da68953593 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -71,14 +71,31 @@
/*********************** 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);
@@ -169,17 +186,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
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 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
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 @@ void draw_clip_main(SpaceClip *sc, ARegion *ar, Scene *scene)
}
/* 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);
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index c85ea7a4791..7b14783d4ca 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -89,11 +89,7 @@ static void draw_curve_knot(float x, float y, float xscale, float yscale, float
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,23 +114,7 @@ static void draw_graph_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
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);
-
- /* 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));
+ clip_draw_curfra_label(sc, (float)sc->user.framenr * xscale, 18);
/* restore view transform */
glScalef(xscale, 1.0, 1.0);
@@ -193,7 +173,7 @@ static void tracking_segment_knot_cb(void *userdata, MovieTrackingTrack *track,
}
}
-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 @@ static void draw_clip_tracks_curves(View2D *v2d, SpaceClip *sc)
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 @@ static void draw_clip_frame_curves(SpaceClip *sc)
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 @@ void draw_clip_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
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);
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index 1a775ef03ae..da0b589652e 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -47,11 +47,12 @@ struct wmOperatorType;
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 @@ void CLIP_OT_graph_delete_knot(struct wmOperatorType *ot);
/* clip_ops.c */
void CLIP_OT_open(struct wmOperatorType *ot);
void CLIP_OT_reload(struct wmOperatorType *ot);
-// void CLIP_OT_unlink(struct wmOperatorType *ot);
void CLIP_OT_view_pan(struct wmOperatorType *ot);
void CLIP_OT_view_zoom(wmOperatorType *ot);
void CLIP_OT_view_zoom_in(struct wmOperatorType *ot);
@@ -98,9 +98,6 @@ void clip_delete_marker(struct bContext *C, struct MovieClip *clip, struct Movie
void clip_view_center_to_point(struct SpaceClip *sc, float x, float y);
/* tracking_ops.c */
-void clip_delete_track(struct bContext *C, struct MovieClip *clip, struct MovieTrackingTrack *track);
-void clip_delete_marker(struct bContext *C, struct MovieClip *clip, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker);
-
void CLIP_OT_select(struct wmOperatorType *ot);
void CLIP_OT_select_all(struct wmOperatorType *ot);
void CLIP_OT_select_border(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 78cf98886a6..c8577f7760e 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -700,16 +700,16 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
/* data... */
movieclip_main_area_set_view2d(sc, ar);
- draw_clip_main(sc, ar, scene);
+ clip_draw_main(sc, ar, scene);
/* Grease Pencil */
- draw_clip_grease_pencil((bContext *)C, 1);
+ clip_draw_grease_pencil((bContext *)C, 1);
/* reset view matrix */
UI_view2d_view_restore(C);
/* draw Grease Pencil - screen space only */
- draw_clip_grease_pencil((bContext *)C, 0);
+ clip_draw_grease_pencil((bContext *)C, 0);
}
static void clip_main_area_listener(ARegion *ar, wmNotifier *wmn)
@@ -754,7 +754,7 @@ static void clip_preview_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(v2d);
/* data... */
- draw_clip_graph(sc, ar, scene);
+ clip_draw_graph(sc, ar, scene);
/* reset view matrix */
UI_view2d_view_restore(C);
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 765f93b569a..7dbec04f449 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -2245,15 +2245,18 @@ static int detect_features_exec(bContext *C, wmOperator *op)
ImBuf *ibuf= BKE_movieclip_get_ibuf_flag(clip, &sc->user, 0);
MovieTrackingTrack *track= clip->tracking.tracks.first;
int detector= RNA_enum_get(op->ptr, "detector");
- int use_grease_pencil= RNA_boolean_get(op->ptr, "use_grease_pencil");
+ int placement= RNA_enum_get(op->ptr, "placement");
int margin= RNA_int_get(op->ptr, "margin");
int min_trackness= RNA_int_get(op->ptr, "min_trackness");
int count= RNA_int_get(op->ptr, "count");
int min_distance= RNA_int_get(op->ptr, "min_distance");
+ int place_outside_layer= 0;
bGPDlayer *layer= NULL;
- if(use_grease_pencil)
+ if(placement!=0) {
layer= detect_get_layer(clip);
+ place_outside_layer= placement==2;
+ }
/* deselect existing tracks */
while(track) {
@@ -2265,9 +2268,9 @@ static int detect_features_exec(bContext *C, wmOperator *op)
}
if(detector==0)
- BKE_tracking_detect_fast(&clip->tracking, ibuf, sc->user.framenr, margin, min_trackness, min_distance, layer);
+ BKE_tracking_detect_fast(&clip->tracking, ibuf, sc->user.framenr, margin, min_trackness, min_distance, layer, place_outside_layer);
else
- BKE_tracking_detect_moravec(&clip->tracking, ibuf, sc->user.framenr, margin, count, min_distance, layer);
+ BKE_tracking_detect_moravec(&clip->tracking, ibuf, sc->user.framenr, margin, count, min_distance, layer, place_outside_layer);
IMB_freeImBuf(ibuf);
@@ -2310,6 +2313,13 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem placement_items[] = {
+ {0, "FRAME", 0, "Whole Frame", "Place markers across the whole frame"},
+ {1, "INSIDE_GPENCIL", 0, "Inside grease pencil", "Place markers only inside areas oulined with grease pencil"},
+ {2, "OUTSIDE_GPENCIL", 0, "Outside grease pencil", "Place markers only outside areas oulined with grease pencil"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
/* identifiers */
ot->name= "Detect Features";
ot->description= "Automatically detect features to track";
@@ -2325,7 +2335,7 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
/* properties */
RNA_def_enum(ot->srna, "detector", detector_items, 0, "Detector", "Detector using for detecting features");
- RNA_def_boolean(ot->srna, "use_grease_pencil", 0, "Use Grease Pencil", "Use grease pencil strokes from active layer to define zones where detection should happen");
+ RNA_def_enum(ot->srna, "placement", placement_items, 0, "Placement", "Placement for detected features");
RNA_def_int(ot->srna, "margin", 16, 0, INT_MAX, "Margin", "Only corners further than margin pixels from the image edges are considered", 0, 300);
RNA_def_int(ot->srna, "min_trackness", 16, 0, INT_MAX, "Trackness", "Minimum score to add a corner", 0, 300);
RNA_def_int(ot->srna, "count", 50, 1, INT_MAX, "Count", "Count of corners to detect", 0, 300);
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 211457c27db..007b58cd4d5 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -259,8 +259,8 @@ static SpaceLink *view3d_new(const bContext *C)
v3d->twtype= V3D_MANIP_TRANSLATE;
v3d->around= V3D_CENTROID;
- v3d->bundle_size= 0.1f;
- v3d->bundle_drawtype= OB_EMPTY_SPHERE;
+ v3d->bundle_size= 0.2f;
+ v3d->bundle_drawtype= OB_PLAINAXES;
/* header */
ar= MEM_callocN(sizeof(ARegion), "header for view3d");