[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39453] branches/soc-2011-tomato: Camera tracking integration
Sergey Sharybin
g.ulairi at gmail.com
Tue Aug 16 16:58:38 CEST 2011
Revision: 39453
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39453
Author: nazgul
Date: 2011-08-16 14:58:38 +0000 (Tue, 16 Aug 2011)
Log Message:
-----------
Camera tracking integration
===========================
- Remove unused DNA properties from SpaceClip.
- Split selected and active tracks. Now track can be active
but not selected. Prevents unwanted interface flippering
when working in Tracking mode.
Modified Paths:
--------------
branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_view3d.py
branches/soc-2011-tomato/source/blender/blenkernel/BKE_movieclip.h
branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c
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/tracking_ops.c
branches/soc-2011-tomato/source/blender/makesdna/DNA_movieclip_types.h
branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h
branches/soc-2011-tomato/source/blender/makesdna/DNA_tracking_types.h
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.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-16 14:58:24 UTC (rev 39452)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py 2011-08-16 14:58:38 UTC (rev 39453)
@@ -662,7 +662,7 @@
clip = sc.clip
if clip:
- layout.template_movieclip(sc, "clip", sc.clip_user, compact=True)
+ layout.template_movieclip(sc, "clip", compact=True)
else:
layout.operator("clip.open", icon='FILESEL')
Modified: branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_view3d.py 2011-08-16 14:58:24 UTC (rev 39452)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_view3d.py 2011-08-16 14:58:38 UTC (rev 39453)
@@ -2318,7 +2318,7 @@
row.template_ID(bg, "clip", open="clip.open")
if bg.clip:
- box.template_movieclip(bg, "clip", bg.clip_user, compact=True)
+ box.template_movieclip(bg, "clip", compact=True)
hasbg = True
if hasbg:
Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_movieclip.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_movieclip.h 2011-08-16 14:58:24 UTC (rev 39452)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_movieclip.h 2011-08-16 14:58:38 UTC (rev 39453)
@@ -57,8 +57,6 @@
void BKE_movieclip_select_track(struct MovieClip *clip, struct MovieTrackingTrack *track, int area, int extend);
void BKE_movieclip_deselect_track(struct MovieClip *clip, struct MovieTrackingTrack *track, int area);
-void BKE_movieclip_set_selection(struct MovieClip *clip, int type, void *sel);
-void BKE_movieclip_last_selection(struct MovieClip *clip, int *type, void **sel);
void BKE_movieclip_update_scopes(struct MovieClip *clip, struct MovieClipUser *user, struct MovieClipScopes *scopes);
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c 2011-08-16 14:58:24 UTC (rev 39452)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c 2011-08-16 14:58:38 UTC (rev 39453)
@@ -672,40 +672,15 @@
cur= cur->next;
}
}
-
- if(!TRACK_SELECTED(track))
- BKE_movieclip_set_selection(clip, MCLIP_SEL_NONE, NULL);
}
void BKE_movieclip_deselect_track(MovieClip *clip, MovieTrackingTrack *track, int area)
{
BKE_tracking_track_flag(track, area, SELECT, 1);
-
- if(!TRACK_SELECTED(track))
- BKE_movieclip_set_selection(clip, MCLIP_SEL_NONE, NULL);
}
-void BKE_movieclip_set_selection(MovieClip *clip, int type, void *sel)
-{
- clip->sel_type= type;
-
- if(type == MCLIP_SEL_NONE) clip->last_sel= NULL;
- else clip->last_sel= sel;
-}
-
-void BKE_movieclip_last_selection(MovieClip *clip, int *type, void **sel)
-{
- *type= clip->sel_type;
-
- if(clip->sel_type == MCLIP_SEL_NONE) *sel= NULL;
- else *sel= clip->last_sel;
-}
-
void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClipScopes *scopes)
{
- void *sel;
- int sel_type;
-
if(scopes->ok) return;
if(scopes->track_preview) {
@@ -717,10 +692,8 @@
scopes->track= NULL;
if(clip) {
- BKE_movieclip_last_selection(clip, &sel_type, &sel);
-
- if(sel_type==MCLIP_SEL_TRACK) {
- MovieTrackingTrack *track= (MovieTrackingTrack*)sel;
+ if(clip->tracking.act_track) {
+ MovieTrackingTrack *track= clip->tracking.act_track;
MovieTrackingMarker *marker= BKE_tracking_get_marker(track, user->framenr);
if(marker->flag&MARKER_DISABLED) {
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c 2011-08-16 14:58:24 UTC (rev 39452)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c 2011-08-16 14:58:38 UTC (rev 39453)
@@ -704,11 +704,8 @@
MovieTrackingTrack *track;
ListBase tracks= {NULL, NULL}, new_tracks= {NULL, NULL};
ListBase *old_tracks= &context->clip->tracking.tracks;
- int a, sel_type, newframe;
- void *sel;
+ int a, newframe;
- BKE_movieclip_last_selection(context->clip, &sel_type, &sel);
-
/* duplicate currently tracking tracks to temporary list.
this is needed to keep names in unique state and it's faster to change names
of currently tracking tracks (if needed) */
@@ -732,7 +729,7 @@
/* original track was found, re-use flags and remove this track */
if(cur) {
- if(sel_type==MCLIP_SEL_TRACK && sel==cur)
+ if(cur==context->clip->tracking.act_track)
replace_sel= 1;
track->flag= cur->flag;
@@ -750,7 +747,7 @@
BLI_ghash_insert(context->hash, track, new_track);
if(replace_sel) /* update current selection in clip */
- BKE_movieclip_set_selection(context->clip, MCLIP_SEL_TRACK, new_track);
+ context->clip->tracking.act_track= new_track;
BLI_addtail(&tracks, new_track);
}
Modified: branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c 2011-08-16 14:58:24 UTC (rev 39452)
+++ branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c 2011-08-16 14:58:38 UTC (rev 39453)
@@ -5719,9 +5719,7 @@
track= track->next;
}
- clip->last_sel= newdataadr(fd, clip->last_sel);
- if(clip->last_sel==NULL)
- clip->sel_type= MCLIP_SEL_NONE;
+ clip->tracking.act_track= newdataadr(fd, clip->tracking.act_track);
clip->anim= NULL;
clip->tracking_context= NULL;
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-16 14:58:24 UTC (rev 39452)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/clip_draw.c 2011-08-16 14:58:38 UTC (rev 39453)
@@ -75,15 +75,12 @@
static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Scene *scene)
{
float x;
- int *points, totseg, sel_type, i, a;
+ int *points, totseg, i, a;
float sfra= SFRA, efra= EFRA, framelen= ar->winx/(efra-sfra+1), fontsize, fontwidth;
- void *sel;
uiStyle *style= U.uistyles.first;
int fontid= style->widget.uifont_id;
char str[32];
- BKE_movieclip_last_selection(clip, &sel_type, &sel);
-
glEnable(GL_BLEND);
/* cache background */
@@ -106,8 +103,8 @@
}
/* track */
- if(sel_type==MCLIP_SEL_TRACK) {
- MovieTrackingTrack *track= (MovieTrackingTrack *)sel;
+ if(clip->tracking.act_track) {
+ MovieTrackingTrack *track= clip->tracking.act_track;
for(i= sfra, a= 0; i <= efra; i++) {
int framenr;
@@ -250,20 +247,17 @@
glPixelZoom(1.f, 1.f);
}
-static void draw_track_path(SpaceClip *sc, MovieClip *clip, MovieTrackingTrack *track)
+static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackingTrack *track)
{
int count= sc->path_length;
- int i, a, b, sel_type, curindex= -1;
+ int i, a, b, curindex= -1;
float path[102][2];
int tiny= sc->flag&SC_SHOW_TINY_MARKER, framenr;
MovieTrackingMarker *marker;
- void *sel;
if(count==0)
return;
- BKE_movieclip_last_selection(clip, &sel_type, &sel);
-
marker= BKE_tracking_get_marker(track, sc->user.framenr);
if(marker->framenr!=sc->user.framenr || marker->flag&MARKER_DISABLED)
return;
@@ -784,9 +778,8 @@
float x, y;
MovieTracking* tracking= &clip->tracking;
MovieTrackingMarker *marker;
- MovieTrackingTrack *track;
- int sel_type, framenr= sc->user.framenr;
- void *sel;
+ MovieTrackingTrack *track, *act_track;
+ int framenr= sc->user.framenr;
/* ** find window pixel coordinates of origin ** */
@@ -805,7 +798,7 @@
glMultMatrixf(sc->stabmat);
glScalef(width, height, 0);
- BKE_movieclip_last_selection(clip, &sel_type, &sel);
+ act_track= clip->tracking.act_track;
if(sc->flag&SC_SHOW_TRACK_PATH) {
track= tracking->tracks.first;
@@ -839,7 +832,7 @@
track= tracking->tracks.first;
while(track) {
if((track->flag&TRACK_HIDDEN)==0) {
- int act= sel_type==MCLIP_SEL_TRACK && sel==track;
+ int act= track==act_track;
if(!act) {
marker= BKE_tracking_get_marker(track, framenr);
@@ -855,13 +848,13 @@
}
/* active marker would be displayed on top of everything else */
- if(sel_type==MCLIP_SEL_TRACK) {
- if((((MovieTrackingTrack *)sel)->flag&TRACK_HIDDEN)==0) {
- marker= BKE_tracking_get_marker(sel, framenr);
+ if(act_track) {
+ if((act_track->flag&TRACK_HIDDEN)==0) {
+ marker= BKE_tracking_get_marker(act_track, framenr);
if(MARKER_VISIBLE(sc, marker)) {
- draw_marker_areas(sc, sel, marker, width, height, 1, 1);
- draw_marker_slide_zones(sc, sel, marker, 0, 1, 1, width, height);
+ draw_marker_areas(sc, act_track, marker, width, height, 1, 1);
+ draw_marker_slide_zones(sc, act_track, marker, 0, 1, 1, width, height);
}
}
}
@@ -921,7 +914,7 @@
marker= BKE_tracking_get_marker(track, framenr);
if(MARKER_VISIBLE(sc, marker)) {
- int act= sel_type==MCLIP_SEL_TRACK && sel==track;
+ int act= track==act_track;
draw_marker_texts(sc, track, marker, act, width, height, zoomx, zoomy);
}
Modified: branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c 2011-08-16 14:58:24 UTC (rev 39452)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c 2011-08-16 14:58:38 UTC (rev 39453)
@@ -125,7 +125,8 @@
track= BKE_tracking_add_track(&clip->tracking, x, y, sc->user.framenr, width, height);
BKE_movieclip_select_track(clip, track, TRACK_AREA_ALL, 0);
- BKE_movieclip_set_selection(clip, MCLIP_SEL_TRACK, track);
+
+ clip->tracking.act_track= track;
}
static int add_marker_exec(bContext *C, wmOperator *op)
@@ -192,6 +193,9 @@
next= track->next;
if(TRACK_VIEW_SELECTED(sc, track)) {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list