Ignore disabled markers when building keying screen.
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 25 Jun 2012 16:36:22 +0000 (16:36 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 25 Jun 2012 16:36:22 +0000 (16:36 +0000)
source/blender/compositor/operations/COM_KeyingScreenOperation.cpp

index 6fd20b477e76f8323ead152ea4c71b52b873203c..c75762a3f86ceefcf01970ad7770b95b02727abb 100644 (file)
@@ -101,7 +101,14 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
        else
                tracksbase = BKE_tracking_get_active_tracks(tracking);
 
-       sites_total = BLI_countlist(tracksbase);
+       /* count sites */
+       for (track = (MovieTrackingTrack *) tracksbase->first, sites_total = 0; track; track = track->next) {
+               MovieTrackingMarker *marker = BKE_tracking_marker_get(track, clip_frame);
+
+               if ((marker->flag & MARKER_DISABLED) == 0) {
+                       sites_total++;
+               }
+       }
 
        if (!sites_total)
                return NULL;
@@ -117,11 +124,17 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri
        sites = (VoronoiSite *) MEM_callocN(sizeof(VoronoiSite) * sites_total, "keyingscreen voronoi sites");
        track = (MovieTrackingTrack *) tracksbase->first;
        for (track = (MovieTrackingTrack *) tracksbase->first, i = 0; track; track = track->next, i++) {
-               VoronoiSite *site = &sites[i];
                MovieTrackingMarker *marker = BKE_tracking_marker_get(track, clip_frame);
-               ImBuf *pattern_ibuf = BKE_tracking_get_pattern_imbuf(ibuf, track, marker, TRUE, FALSE);
+               VoronoiSite *site;
+               ImBuf *pattern_ibuf;
                int j;
 
+               if (marker->flag & MARKER_DISABLED)
+                       continue;
+
+               site = &sites[i];
+               pattern_ibuf = BKE_tracking_get_pattern_imbuf(ibuf, track, marker, TRUE, FALSE);
+
                zero_v3(site->color);
                for (j = 0; j < pattern_ibuf->x * pattern_ibuf->y; j++) {
                        if (pattern_ibuf->rect_float) {