[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37595] branches/soc-2011-tomato: Camera tracking integration
Sergey Sharybin
g.ulairi at gmail.com
Fri Jun 17 16:47:04 CEST 2011
Revision: 37595
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37595
Author: nazgul
Date: 2011-06-17 14:47:04 +0000 (Fri, 17 Jun 2011)
Log Message:
-----------
Camera tracking integration
===========================
- libmv's sources would now be added to qtcreator project.
- Fixed compilation with blenderplayer enabled and cmake.
- Fixed bug when tracking was done from frame different from
initial marker's frame number.
- Implemented backwards tracking.
- Added option to draw track's path. Would be enabled by default
for new scenes. Could be enabled on "Display" panel for
files saved in previous version.
- Added operator to clean track path so it could be
easily tracked form scratch.
- Added hotkeys for tracking, backwards tracking and
cleaning track path (Ctrl-T, Ctrl-Shift-T and Alt-T).
- Fixed crash when setting clip as a footage.
- Small optimization when trying to track without
selected markers.
Modified Paths:
--------------
branches/soc-2011-tomato/build_files/cmake/project_info.py
branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
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/editors/space_clip/clip_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/view3d_draw.c
branches/soc-2011-tomato/source/blender/makesdna/DNA_space_types.h
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_space.c
branches/soc-2011-tomato/source/blenderplayer/CMakeLists.txt
Modified: branches/soc-2011-tomato/build_files/cmake/project_info.py
===================================================================
--- branches/soc-2011-tomato/build_files/cmake/project_info.py 2011-06-17 14:41:44 UTC (rev 37594)
+++ branches/soc-2011-tomato/build_files/cmake/project_info.py 2011-06-17 14:47:04 UTC (rev 37595)
@@ -105,7 +105,7 @@
def is_c(filename):
ext = splitext(filename)[1]
- return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
+ return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc", ".cc"))
def is_c_any(filename):
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-06-17 14:41:44 UTC (rev 37594)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py 2011-06-17 14:47:04 UTC (rev 37595)
@@ -66,7 +66,7 @@
if clip:
ts = context.tool_settings
col = layout.column()
- col.prop(ts.movieclip, 'tool', expand=True)
+ col.prop(ts.movieclip, "tool", expand=True)
class CLIP_PT_footage(bpy.types.Panel):
@@ -95,7 +95,7 @@
if clip:
layout.template_movieclip(sc, "clip", sc.clip_user, compact=True)
else:
- layout.operator('clip.open', icon='FILESEL')
+ layout.operator("clip.open", icon='FILESEL')
class CLIP_PT_tracking_camera(bpy.types.Panel):
@@ -124,7 +124,7 @@
class CLIP_PT_tracking_marker_tools(bpy.types.Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'TOOLS'
- bl_label = 'Marker Tools'
+ bl_label = "Marker Tools"
@classmethod
def poll(cls, context):
@@ -139,14 +139,14 @@
layout = self.layout
clip = context.space_data.clip
- layout.operator('clip.add_marker_move', icon='ZOOMIN')
- layout.operator('clip.delete', icon='X')
+ layout.operator("clip.add_marker_move", icon='ZOOMIN')
+ layout.operator("clip.delete", icon='X')
class CLIP_PT_tracking_marker(bpy.types.Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'TOOLS'
- bl_label = 'Marker'
+ bl_label = "Marker"
@classmethod
def poll(cls, context):
@@ -163,13 +163,13 @@
sc = context.space_data
clip = context.space_data.clip
- layout.template_marker(clip.tracking, 'act_track', sc.clip_user, clip)
+ layout.template_marker(clip.tracking, "act_track", sc.clip_user, clip)
class CLIP_PT_track(bpy.types.Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'TOOLS'
- bl_label = 'Track Tools'
+ bl_label = "Track Tools"
@classmethod
def poll(cls, context):
@@ -184,13 +184,15 @@
layout = self.layout
clip = context.space_data.clip
- layout.operator('clip.track_markers', icon='PLAY')
+ layout.operator("clip.track_markers", icon='PLAY')
+ layout.operator("clip.track_markers", text="Track Backwards", icon='PLAY_REVERSE').backwards=True
+ layout.operator("clip.clear_track_path", icon='X')
class CLIP_PT_track_settings(bpy.types.Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'TOOLS'
- bl_label = 'Tracking Settings'
+ bl_label = "Tracking Settings"
bl_options = {'DEFAULT_CLOSED'}
@classmethod
@@ -207,11 +209,11 @@
clip = context.space_data.clip
settings = clip.tracking.settings
- layout.prop(settings, 'max_iterations')
- layout.prop(settings, 'pyramid_level')
- layout.prop(settings, 'tolerance')
+ layout.prop(settings, "max_iterations")
+ layout.prop(settings, "pyramid_level")
+ layout.prop(settings, "tolerance")
- layout.operator('clip.reset_tracking_settings', \
+ layout.operator("clip.reset_tracking_settings", \
text="Reset To Defaults")
@@ -235,8 +237,13 @@
layout.prop(sc, "show_marker_pattern")
layout.prop(sc, "show_marker_search")
layout.prop(sc, "lock_selection")
+ layout.prop(sc, "show_marker_path")
+ row = layout.row()
+ row.active = sc.show_marker_path
+ row.prop(sc, "path_length")
+
class CLIP_PT_debug(bpy.types.Panel):
bl_space_type = 'CLIP_EDITOR'
bl_region_type = 'TOOLS'
@@ -291,9 +298,9 @@
clip = sc.clip
if clip:
- layout.operator('clip.reload')
+ layout.operator("clip.reload")
- layout.operator('clip.open')
+ layout.operator("clip.open")
class CLIP_MT_edit(bpy.types.Menu):
@@ -304,7 +311,7 @@
sc = context.space_data
- layout.operator('clip.delete')
+ layout.operator("clip.delete")
layout.menu("CLIP_MT_marker")
@@ -316,7 +323,7 @@
sc = context.space_data
- layout.operator('clip.add_marker_move')
+ layout.operator("clip.add_marker_move")
class CLIP_MT_select(bpy.types.Menu):
@@ -327,10 +334,10 @@
sc = context.space_data
- layout.operator('clip.select_border')
- layout.operator('clip.select_circle')
- layout.operator('clip.select_all', text="Select/Deselect all")
- layout.operator('clip.select_all', text="Inverse").action = 'INVERT'
+ layout.operator("clip.select_border")
+ layout.operator("clip.select_circle")
+ layout.operator("clip.select_all", text="Select/Deselect all")
+ layout.operator("clip.select_all", text="Inverse").action = 'INVERT'
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)
Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_tracking.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_tracking.h 2011-06-17 14:41:44 UTC (rev 37594)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_tracking.h 2011-06-17 14:47:04 UTC (rev 37595)
@@ -49,12 +49,13 @@
void BKE_tracking_free_track(struct MovieTrackingTrack *track);
struct MovieTrackingTrack *BKE_tracking_copy_track(struct MovieTrackingTrack *track);
+void BKE_tracking_clear_path(struct MovieTrackingTrack *track, int ref_frame);
void BKE_tracking_free(struct MovieTracking *tracking);
struct ImBuf *BKE_tracking_acquire_pattern_imbuf(struct ImBuf *ibuf, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, int pos[2]);
struct ImBuf *BKE_tracking_acquire_search_imbuf(struct ImBuf *ibuf, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, int pos[2]);
-struct MovieTrackingContext *BKE_tracking_context_new(struct MovieClip *clip, struct MovieClipUser *user);
+struct MovieTrackingContext *BKE_tracking_context_new(struct MovieClip *clip, struct MovieClipUser *user, int backwards);
void BKE_tracking_context_free(struct MovieTrackingContext *context);
void BKE_tracking_sync(struct MovieTrackingContext *context);
int BKE_tracking_next(struct MovieTrackingContext *context);
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c 2011-06-17 14:41:44 UTC (rev 37594)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c 2011-06-17 14:47:04 UTC (rev 37595)
@@ -174,6 +174,9 @@
{
int a= track->markersnr;
+ if(!track->markersnr)
+ return NULL;
+
if((track->flag&TRACK_PROCESSED)==0) {
/* non-precessed tracks contains the only marker
which should be used independelntly from current frame number. */
@@ -229,6 +232,25 @@
return new_track;
}
+void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame)
+{
+ MovieTrackingMarker *marker, new_marker;
+
+ if(track->markersnr==0)
+ return;
+
+ marker= BKE_tracking_get_marker(track, ref_frame);
+ if(marker) new_marker= *marker;
+ else new_marker= track->markers[0];
+
+ MEM_freeN(track->markers);
+ track->markers= NULL;
+ track->markersnr= 0;
+ track->flag&= ~TRACK_PROCESSED;
+
+ BKE_tracking_insert_marker(track, &new_marker);
+}
+
void BKE_tracking_free(MovieTracking *tracking)
{
MovieTrackingTrack *track;
@@ -254,9 +276,11 @@
ListBase tracks;
GHash *hash;
MovieTrackingSettings settings;
+
+ int backwards;
} MovieTrackingContext;
-MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *user)
+MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *user, int backwards)
{
MovieTrackingContext *context= MEM_callocN(sizeof(MovieTrackingContext), "trackingContext");
MovieTracking *tracking= &clip->tracking;
@@ -269,6 +293,7 @@
#endif
context->settings= *settings;
+ context->backwards= backwards;
context->hash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "tracking trackHash");
track= tracking->tracks.first;
@@ -391,7 +416,7 @@
MovieTrackingTrack *track;
ListBase tracks= {NULL, NULL};
ListBase *old_tracks= &context->clip->tracking.tracks;
- int sel_type;
+ int sel_type, newframe;
void *sel;
BKE_movieclip_last_selection(context->clip, &sel_type, &sel);
@@ -453,7 +478,12 @@
}
context->clip->tracking.tracks= tracks;
- context->orig_user->framenr= context->user.framenr-1;
+
+ ;
+ if(context->backwards) newframe= context->user.framenr+1;
+ else newframe= context->user.framenr-1;
+
+ context->orig_user->framenr= newframe;
}
int BKE_tracking_next(MovieTrackingContext *context)
@@ -462,10 +492,16 @@
MovieTrackingTrack *track;
int curfra= context->user.framenr;
+ /* nothing to track, avoid unneeded frames reading to save time and memory */
+ if(!context->tracks.first)
+ return 0;
+
ibuf= BKE_movieclip_acquire_ibuf(context->clip, &context->user);
if(!ibuf) return 0;
- context->user.framenr++;
+ if(context->backwards) context->user.framenr--;
+ else context->user.framenr++;
+
ibuf_new= BKE_movieclip_acquire_ibuf(context->clip, &context->user);
if(!ibuf_new) {
IMB_freeImBuf(ibuf);
@@ -498,8 +534,15 @@
marker_new.pos[0]= marker->pos[0]+track->search_min[0]+x2/ibuf_new->x;
marker_new.pos[1]= marker->pos[1]+track->search_min[1]+y2/ibuf_new->y;
- marker_new.framenr= curfra+1;
+ if(context->backwards) marker_new.framenr= curfra-1;
+ else marker_new.framenr= curfra+1;
+
+ /* happens when current frame was changed after placing marker
+ but before tracking it */
+ if(marker->framenr!=curfra)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list