[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39055] branches/soc-2011-tomato/source/ blender/blenkernel/intern/tracking.c: Camera tracking integration
Sergey Sharybin
g.ulairi at gmail.com
Fri Aug 5 09:54:26 CEST 2011
Revision: 39055
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39055
Author: nazgul
Date: 2011-08-05 07:54:25 +0000 (Fri, 05 Aug 2011)
Log Message:
-----------
Camera tracking integration
===========================
Fixed possible errors with non-unique naming when syncking
currently tracking tracks with list of tracks used in clip.
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c 2011-08-05 07:12:55 UTC (rev 39054)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c 2011-08-05 07:54:25 UTC (rev 39055)
@@ -702,14 +702,16 @@
{
TrackContext *track_context;
MovieTrackingTrack *track;
- ListBase tracks= {NULL, NULL};
+ ListBase tracks= {NULL, NULL}, new_tracks= {NULL, NULL};
ListBase *old_tracks= &context->clip->tracking.tracks;
int a, sel_type, newframe;
void *sel;
BKE_movieclip_last_selection(context->clip, &sel_type, &sel);
- /* duplicate currently tracking tracks to list of displaying tracks */
+ /* 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) */
for(a= 0, track_context= context->track_context; a<context->num_tracks; a++, track_context++) {
int replace_sel= 0;
MovieTrackingTrack *new_track, *old;
@@ -753,19 +755,34 @@
BLI_addtail(&tracks, new_track);
}
- /* move tracks, which could be added by user during tracking */
+ /* move all tracks, which aren't tracking */
track= old_tracks->first;
while(track) {
MovieTrackingTrack *next= track->next;
track->next= track->prev= NULL;
- BLI_addtail(&tracks, track);
+ BLI_addtail(&new_tracks, track);
track= next;
}
- context->clip->tracking.tracks= tracks;
+ /* now move all tracks which are currently tracking and keep their names unique */
+ track= tracks.first;
+ while(track) {
+ MovieTrackingTrack *next= track->next;
+ BLI_remlink(&tracks, track);
+
+ track->next= track->prev= NULL;
+ BLI_addtail(&new_tracks, track);
+
+ BLI_uniquename(&new_tracks, track, "Track", '.', offsetof(MovieTrackingTrack, name), sizeof(track->name));
+
+ track= next;
+ }
+
+ context->clip->tracking.tracks= new_tracks;
+
if(context->backwards) newframe= context->user.framenr+1;
else newframe= context->user.framenr-1;
More information about the Bf-blender-cvs
mailing list