Object tracking integration
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 30 Dec 2011 18:06:02 +0000 (18:06 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 30 Dec 2011 18:06:02 +0000 (18:06 +0000)
This commits merges object tracking implementation from tomato branch.

Summarized changes from branch:

- Added list of objects to be tracked. Default there's only one object called
  "Camera" which is used for solving camera motion. Other objects can be added
  and each of them will have it;s own list of tracks. Only one object can be used
  for camera solving at this moment.
- Added new constraint called "Object Tracking" which makes oriented object be
  moving in the save way as solved object motion.
- Scene orientation tools can be used for orienting object to bundles.
- Object has got scale to define "depth" in camera space.
- All tools which works with list of tracks or reconstruction data now
  gets that lists from active editing object.
- All objects and their tracking data are available via python api.
- Improvements in witness cameras workflow,

1  2 
source/blender/blenkernel/BKE_tracking.h
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/tracking.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/makesdna/DNA_constraint_types.h
source/blender/makesdna/DNA_tracking_types.h

index 3fa7355767ae62ad5f0dbcf5094a70e61167c58e,b75a9ff0037f0beae0b76d31256606273fcb4b4a..6bf9b646c35ca2104259bc1bd9c2f36331cc7215
@@@ -1629,10 -1699,14 +1700,14 @@@ MovieReconstructContext* BKE_tracking_r
        int sfra= INT_MAX, efra= INT_MIN;
        MovieTrackingTrack *track;
  
-       context->tracks_map= tracks_map_new(num_tracks, 0);
-       track= tracking->tracks.first;
+       strcpy(context->object_name, object->name);
+       context->is_camera = object->flag&TRACKING_OBJECT_CAMERA;
+       context->tracks_map= tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
+       track= tracksbase->first;
        while(track) {
 -              int first= 0, last= track->markersnr;
 +              int first= 0, last= track->markersnr-1;
                MovieTrackingMarker *first_marker= &track->markers[0];
                MovieTrackingMarker *last_marker= &track->markers[track->markersnr-1];
  
index d911e68236b09b4bd9b99de06db2ccb476554c0c,918fc5f347dde2a4db5fac026bc07f00bdf8b9a3..3f20ab9ea30d8f4e3b9eeeb492ec813838d488e6
@@@ -2070,25 -2300,30 +2300,30 @@@ static int set_floor_exec(bContext *C, 
        mat[3][1]= orig[1];
        mat[3][2]= orig[2];
  
-       invert_m4(mat);
+       if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
+               invert_m4(mat);
  
-       object_to_mat4(parent, obmat);
-       mult_m4_m4m4(mat, mat, obmat);
-       mult_m4_m4m4(newmat, rot, mat);
-       object_apply_mat4(parent, newmat, 0, 0);
-       /* make camera have positive z-coordinate */
-       if(parent->loc[2]<0) {
-               invert_m4(rot);
+               object_to_mat4(object, obmat);
+               mult_m4_m4m4(mat, mat, obmat);
                mult_m4_m4m4(newmat, rot, mat);
-               object_apply_mat4(parent, newmat, 0, 0);
+               object_apply_mat4(object, newmat, 0, 0);
+               /* make camera have positive z-coordinate */
+               if(object->loc[2]<0) {
 -                invert_m4(rot);
 -                mult_m4_m4m4(newmat, rot, mat);
 -                object_apply_mat4(object, newmat, 0, 0);
++                      invert_m4(rot);
++                      mult_m4_m4m4(newmat, rot, mat);
++                      object_apply_mat4(object, newmat, 0, 0);
+               }
+       }
+       else {
+               object_apply_mat4(object, mat, 0, 0);
        }
  
-       where_is_object(scene, parent);
-       set_axis(scene, parent, axis_track, 'X');
+       where_is_object(scene, object);
+       set_axis(scene, object, clip, tracking_object, axis_track, 'X');
  
        DAG_id_tag_update(&clip->id, 0);
-       DAG_id_tag_update(&parent->id, OB_RECALC_OB);
+       DAG_id_tag_update(&object->id, OB_RECALC_OB);
  
        WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
        WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);