[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41290] branches/soc-2011-tomato: Camera tracking integration

Sergey Sharybin g.ulairi at gmail.com
Wed Oct 26 11:54:11 CEST 2011


Revision: 41290
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41290
Author:   nazgul
Date:     2011-10-26 09:54:10 +0000 (Wed, 26 Oct 2011)
Log Message:
-----------
Camera tracking integration
===========================

Other fixes for issues pointed by Brecht.

Modified Paths:
--------------
    branches/soc-2011-tomato/release/scripts/presets/tracking_track_color/default.py
    branches/soc-2011-tomato/release/scripts/presets/tracking_track_color/far_plane.py
    branches/soc-2011-tomato/release/scripts/presets/tracking_track_color/near_plane.py
    branches/soc-2011-tomato/release/scripts/startup/bl_operators/clip.py
    branches/soc-2011-tomato/release/scripts/startup/bl_operators/presets.py
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py
    branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
    branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c

Modified: branches/soc-2011-tomato/release/scripts/presets/tracking_track_color/default.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/presets/tracking_track_color/default.py	2011-10-26 07:41:56 UTC (rev 41289)
+++ branches/soc-2011-tomato/release/scripts/presets/tracking_track_color/default.py	2011-10-26 09:54:10 UTC (rev 41290)
@@ -1,5 +1,5 @@
 import bpy
-track = bpy.context.edit_movieclip.tracking.active_track
+track = bpy.context.edit_movieclip.tracking.tracks.active
 
 track.color = (0.0, 0.0, 0.0)
 track.use_custom_color = False

Modified: branches/soc-2011-tomato/release/scripts/presets/tracking_track_color/far_plane.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/presets/tracking_track_color/far_plane.py	2011-10-26 07:41:56 UTC (rev 41289)
+++ branches/soc-2011-tomato/release/scripts/presets/tracking_track_color/far_plane.py	2011-10-26 09:54:10 UTC (rev 41290)
@@ -1,5 +1,5 @@
 import bpy
-track = bpy.context.edit_movieclip.tracking.active_track
+track = bpy.context.edit_movieclip.tracking.tracks.active
 
 track.color = (0.0, 0.0, 1.0)
 track.use_custom_color = True

Modified: branches/soc-2011-tomato/release/scripts/presets/tracking_track_color/near_plane.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/presets/tracking_track_color/near_plane.py	2011-10-26 07:41:56 UTC (rev 41289)
+++ branches/soc-2011-tomato/release/scripts/presets/tracking_track_color/near_plane.py	2011-10-26 09:54:10 UTC (rev 41290)
@@ -1,5 +1,5 @@
 import bpy
-track = bpy.context.edit_movieclip.tracking.active_track
+track = bpy.context.edit_movieclip.tracking.tracks.active
 
 track.color = (0.0, 1.0, 0.0)
 track.use_custom_color = True

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_operators/clip.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_operators/clip.py	2011-10-26 07:41:56 UTC (rev 41289)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_operators/clip.py	2011-10-26 09:54:10 UTC (rev 41290)
@@ -25,6 +25,8 @@
 
 
 class CLIP_OT_track_to_empty(Operator):
+    """Create an Empty object which will be copying movement of active track"""
+
     bl_idname = "clip.track_to_empty"
     bl_label = "2D Track to Empty"
     bl_options = {'UNDO', 'REGISTER'}
@@ -67,6 +69,8 @@
 
 
 class CLIP_OT_bundles_to_mesh(Operator):
+    """Create vertex cloud using coordinates of bundles"""
+
     bl_idname = "clip.bundles_to_mesh"
     bl_label = "Bundles to Mesh"
     bl_options = {'UNDO', 'REGISTER'}
@@ -104,6 +108,8 @@
 
 
 class CLIP_OT_delete_proxy(Operator):
+    """Delete movie clip proxy files from the hard drive"""
+
     bl_idname = "clip.delete_proxy"
     bl_label = "Delete Proxy"
     bl_options = {'UNDO', 'REGISTER'}
@@ -172,6 +178,8 @@
 
 
 class CLIP_OT_set_viewport_background(Operator):
+    """Set current movie clip as a camera background in 3D viewport"""
+
     bl_idname = "clip.set_viewport_background"
     bl_label = "Set as Background"
     bl_options = {'UNDO', 'REGISTER'}
@@ -217,6 +225,8 @@
 
 
 class CLIP_OT_constraint_to_fcurve(Operator):
+    """Create F-Curves for object which will copy object's movement caused by this constraint"""
+
     bl_idname = "clip.constraint_to_fcurve"
     bl_label = "Constraint to F-Curve"
     bl_options = {'UNDO', 'REGISTER'}

Modified: branches/soc-2011-tomato/release/scripts/startup/bl_operators/presets.py
===================================================================
--- branches/soc-2011-tomato/release/scripts/startup/bl_operators/presets.py	2011-10-26 07:41:56 UTC (rev 41289)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_operators/presets.py	2011-10-26 09:54:10 UTC (rev 41290)
@@ -347,7 +347,7 @@
     preset_menu = "CLIP_MT_track_color_presets"
 
     preset_defines = [
-        "track = bpy.context.edit_movieclip.tracking.active_track"
+        "track = bpy.context.edit_movieclip.tracking.tracks"
     ]
 
     preset_values = [

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-10-26 07:41:56 UTC (rev 41289)
+++ branches/soc-2011-tomato/release/scripts/startup/bl_ui/space_clip.py	2011-10-26 09:54:10 UTC (rev 41290)
@@ -154,14 +154,14 @@
         settings = clip.tracking.settings
 
         col = layout.column(align=True)
+        col.operator("clip.solve_camera")
+        col.operator("clip.clear_solution")
+
+        col = layout.column(align=True)
         col.prop(settings, "keyframe_a")
         col.prop(settings, "keyframe_b")
 
-        col = layout.column(align=True)
-        col.operator("clip.solve_camera")
-        col.operator("clip.clear_solution")
 
-
 class CLIP_PT_tools_cleanup(Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'TOOLS'
@@ -179,13 +179,13 @@
         clip = context.space_data.clip
         settings = clip.tracking.settings
 
+        layout.operator("clip.clean_tracks")
+
         layout.prop(settings, 'clean_frames', text="Frames")
         layout.prop(settings, 'clean_error', text="Error")
         layout.prop(settings, 'clean_action', text="")
 
-        layout.operator("clip.clean_tracks")
 
-
 class CLIP_PT_tools_geometry(Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'TOOLS'
@@ -231,9 +231,11 @@
         row.operator("clip.set_axis", text="Set X Axis").axis = 'X'
         row.operator("clip.set_axis", text="Set Y Axis").axis = 'Y'
 
+        layout.separator()
+
         col = layout.column()
+        col.operator("clip.set_scale")
         col.prop(settings, "distance")
-        col.operator("clip.set_scale")
 
 
 class CLIP_PT_tools_grease_pencil(Panel):
@@ -300,10 +302,10 @@
 
         layout.template_track(sc, "scopes")
 
-        row = layout.row()
-        row.prop(act_track, "use_red_channel", text="Red")
-        row.prop(act_track, "use_green_channel", text="Green")
-        row.prop(act_track, "use_blue_channel", text="Blue")
+        row = layout.row(align=True)
+        row.prop(act_track, "use_red_channel", text="R", toggle=True)
+        row.prop(act_track, "use_green_channel", text="G", toggle=True)
+        row.prop(act_track, "use_blue_channel", text="B", toggle=True)
 
         layout.separator()
 

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c	2011-10-26 07:41:56 UTC (rev 41289)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c	2011-10-26 09:54:10 UTC (rev 41290)
@@ -1194,7 +1194,7 @@
 	return tracks;
 }
 
-static int retrive_libmv_reconstruct(MovieTracking *tracking, struct libmv_Reconstruction *libmv_reconstruction)
+static int retrieve_libmv_reconstruct(MovieTracking *tracking, struct libmv_Reconstruction *libmv_reconstruction)
 {
 	int tracknr= 0;
 	int sfra= INT_MAX, efra= INT_MIN, a, origin_set= 0;
@@ -1306,7 +1306,7 @@
 
 		tracking->reconstruction.error= error;
 
-		if(!retrive_libmv_reconstruct(tracking, reconstruction))
+		if(!retrieve_libmv_reconstruct(tracking, reconstruction))
 			error= -1.f;
 
 		libmv_destroyReconstruction(reconstruction);
@@ -1546,7 +1546,7 @@
 	return 0;
 }
 
-static void retrive_libmv_features(MovieTracking *tracking, struct libmv_Features *features,
+static void retrieve_libmv_features(MovieTracking *tracking, struct libmv_Features *features,
 			int framenr, int width, int height, bGPDlayer *layer)
 {
 #ifdef WITH_LIBMV
@@ -1588,7 +1588,7 @@
 
 	MEM_freeN(pixels);
 
-	retrive_libmv_features(tracking, features, framenr, ibuf->x, ibuf->y, layer);
+	retrieve_libmv_features(tracking, features, framenr, ibuf->x, ibuf->y, layer);
 
 	libmv_destroyFeatures(features);
 #endif
@@ -1605,7 +1605,7 @@
 
 	MEM_freeN(pixels);
 
-	retrive_libmv_features(tracking, features, framenr, ibuf->x, ibuf->y, layer);
+	retrieve_libmv_features(tracking, features, framenr, ibuf->x, ibuf->y, layer);
 
 	libmv_destroyFeatures(features);
 #endif

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-10-26 07:41:56 UTC (rev 41289)
+++ branches/soc-2011-tomato/source/blender/editors/space_clip/tracking_ops.c	2011-10-26 09:54:10 UTC (rev 41290)
@@ -1225,8 +1225,20 @@
 	}
 }
 
-static void track_markers_initjob(bContext *C, TrackMarkersJob *tmj, int backwards)
+static int track_markers_check_direction(int backwards, int curfra, int efra)
 {
+	if(backwards) {
+		if(curfra<efra) return 0;
+	}
+	else {
+		if(curfra>efra) return 0;
+	}
+
+	return 1;
+}
+
+static int track_markers_initjob(bContext *C, TrackMarkersJob *tmj, int backwards)
+{
 	SpaceClip *sc= CTX_wm_space_clip(C);
 	MovieClip *clip= ED_space_clip(sc);
 	Scene *scene= CTX_data_scene(C);
@@ -1269,6 +1281,8 @@
 	tmj->scene= scene;
 	tmj->main= CTX_data_main(C);
 	tmj->screen= CTX_wm_screen(C);
+
+	return track_markers_check_direction(backwards, tmj->sfra, tmj->efra);
 }
 
 static void track_markers_startjob(void *tmv, short *stop, short *do_update, float *progress)
@@ -1358,6 +1372,9 @@
 		else efra= MIN2(efra, sfra+settings->frames_limit);
 	}
 
+	if(!track_markers_check_direction(backwards, framenr, efra))
+		return OPERATOR_CANCELLED;
+
 	track_init_markers(sc, clip);
 
 	/* do not disable tracks due to threshold when tracking frame-by-frame */
@@ -1406,8 +1423,12 @@
 		return track_markers_exec(C, op);
 
 	tmj= MEM_callocN(sizeof(TrackMarkersJob), "TrackMarkersJob data");
-	track_markers_initjob(C, tmj, backwards);
+	if(!track_markers_initjob(C, tmj, backwards)) {
+		track_markers_freejob(tmj);
 
+		return OPERATOR_CANCELLED;
+	}
+
 	/* setup job */
 	steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Track Markers", WM_JOB_PROGRESS);
 	WM_jobs_customdata(steve, tmj, track_markers_freejob);
@@ -1465,7 +1486,7 @@
 	ot->flag= OPTYPE_UNDO;
 
 	/* properties */
-	RNA_def_boolean(ot->srna, "backwards", 0, "Backwards", "Do backwards tarcking");
+	RNA_def_boolean(ot->srna, "backwards", 0, "Backwards", "Do backwards tracking");

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list