Added options to display only selected tracks and show hidden tracks
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 12 Jun 2012 17:10:47 +0000 (17:10 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 12 Jun 2012 17:10:47 +0000 (17:10 +0000)
in motion tracking dopesheet view.

By default all channels are displaying now.

release/scripts/startup/bl_ui/space_clip.py
source/blender/blenkernel/intern/tracking.c
source/blender/makesdna/DNA_tracking_types.h
source/blender/makesrna/intern/rna_tracking.c

index cef2a20710acdec98b7a198756eb0d0cad79f7d3..5c98cafb732b964c9b15d4126232fd28b966b97e 100644 (file)
@@ -85,6 +85,10 @@ class CLIP_HT_header(Header):
                 dopesheet = tracking.dopesheet
                 layout.prop(sc, "view", text="", expand=True)
 
+                row = layout.row(align=True)
+                row.prop(dopesheet, "show_only_selected", text="")
+                row.prop(dopesheet, "show_hidden", text="")
+
                 layout.label(text="Sort by:")
                 layout.prop(dopesheet, "sort_method", text="")
                 layout.prop(dopesheet, "use_invert_sort", text="Invert")
index 33f7b22f64a9bb12ac48a79bdb90ad34794437c0..f1b251f54ddf4a8311aff233ce4a87139cc1f14d 100644 (file)
@@ -3590,6 +3590,8 @@ void BKE_tracking_dopesheet_update(MovieTracking *tracking)
        ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
        short sort_method = dopesheet->sort_method;
        short inverse = dopesheet->flag & TRACKING_DOPE_SORT_INVERSE;
+       short sel_only = dopesheet->flag & TRACKING_DOPE_SELECTED_ONLY;
+       short show_hidden = dopesheet->flag & TRACKING_DOPE_SHOW_HIDDEN;
 
        if (dopesheet->ok)
                return;
@@ -3597,17 +3599,21 @@ void BKE_tracking_dopesheet_update(MovieTracking *tracking)
        tracking_dopesheet_free(dopesheet);
 
        for (track = tracksbase->first; track; track = track->next) {
-               if (TRACK_SELECTED(track) && (track->flag & TRACK_HIDDEN) == 0) {
-                       MovieTrackingDopesheetChannel *channel;
+               MovieTrackingDopesheetChannel *channel;
 
-                       channel = MEM_callocN(sizeof(MovieTrackingDopesheetChannel), "tracking dopesheet channel");
-                       channel->track = track;
+               if (!show_hidden && (track->flag & TRACK_HIDDEN) != 0)
+                       continue;
 
-                       channels_segments_calc(channel);
+               if (sel_only && !TRACK_SELECTED(track))
+                       continue;
 
-                       BLI_addtail(&dopesheet->channels, channel);
-                       dopesheet->tot_channel++;
-               }
+               channel = MEM_callocN(sizeof(MovieTrackingDopesheetChannel), "tracking dopesheet channel");
+               channel->track = track;
+
+               channels_segments_calc(channel);
+
+               BLI_addtail(&dopesheet->channels, channel);
+               dopesheet->tot_channel++;
        }
 
        tracking_dopesheet_sort(tracking, sort_method, inverse);
index 850d4361ab7a10e0c240b0f7ff9bd175332cb9c4..4eb1626f1cb73c08d1c61f22e9271de617eb2a8d 100644 (file)
@@ -358,5 +358,7 @@ enum {
 
 /* MovieTrackingDopesheet->flag */
 #define TRACKING_DOPE_SORT_INVERSE    (1 << 0)
+#define TRACKING_DOPE_SELECTED_ONLY   (1 << 1)
+#define TRACKING_DOPE_SHOW_HIDDEN     (1 << 2)
 
 #endif
index a2869a842ee19569447b7ff13259113d62a8236b..337f13b5af824f0476da8f9a01603fc8839fb8ec 100644 (file)
@@ -1432,6 +1432,20 @@ static void rna_def_trackingDopesheet(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_DOPE_SORT_INVERSE);
        RNA_def_property_ui_text(prop, "Invert Dopesheet Sort", "Invert sort order of dopesheet channels");
        RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingDopesheet_tagUpdate");
+
+       /* show_only_selected */
+       prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_DOPE_SELECTED_ONLY);
+       RNA_def_property_ui_text(prop, "Only Selected", "Only include channels relating to selected objects and data");
+       RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0);
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_trackingDopesheet_tagUpdate");
+
+       /* show_hidden */
+       prop = RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_DOPE_SHOW_HIDDEN);
+       RNA_def_property_ui_text(prop, "Display Hidden", "Include channels from objects/bone that aren't visible");
+       RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_trackingDopesheet_tagUpdate");
 }
 
 static void rna_def_tracking(BlenderRNA *brna)