Added sorting by average reprojection error to motion tracking dopesheet.
This commit is contained in:
parent
5e1bbde01d
commit
04766ab071
|
@ -202,5 +202,6 @@ void BKE_tracking_dopesheet_update(struct MovieTracking *tracking, int sort_meth
|
|||
#define TRACK_SORT_NAME 0
|
||||
#define TRACK_SORT_LONGEST 1
|
||||
#define TRACK_SORT_TOTAL 2
|
||||
#define TRACK_SORT_AVERAGE_ERROR 3
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3115,6 +3115,17 @@ static int channels_longest_segment_sort(void *a, void *b)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int channels_average_error_sort(void *a, void *b)
|
||||
{
|
||||
MovieTrackingDopesheetChannel *channel_a = a;
|
||||
MovieTrackingDopesheetChannel *channel_b = b;
|
||||
|
||||
if (channel_a->track->error > channel_b->track->error)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int channels_alpha_inverse_sort(void *a, void *b)
|
||||
{
|
||||
if (channels_alpha_sort(a, b))
|
||||
|
@ -3139,6 +3150,17 @@ static int channels_longest_segment_inverse_sort(void *a, void *b)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int channels_average_error_inverse_sort(void *a, void *b)
|
||||
{
|
||||
MovieTrackingDopesheetChannel *channel_a = a;
|
||||
MovieTrackingDopesheetChannel *channel_b = b;
|
||||
|
||||
if (channel_a->track->error < channel_b->track->error)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void channels_segments_calc(MovieTrackingDopesheetChannel *channel)
|
||||
{
|
||||
MovieTrackingTrack *track = channel->track;
|
||||
|
@ -3234,6 +3256,9 @@ static void tracking_dopesheet_sort(MovieTracking *tracking, int sort_method, i
|
|||
else if (sort_method == TRACK_SORT_TOTAL) {
|
||||
BLI_sortlist(&dopesheet->channels, channels_total_track_inverse_sort);
|
||||
}
|
||||
else if (sort_method == TRACK_SORT_AVERAGE_ERROR) {
|
||||
BLI_sortlist(&dopesheet->channels, channels_average_error_inverse_sort);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (sort_method == TRACK_SORT_NAME) {
|
||||
|
@ -3245,6 +3270,9 @@ static void tracking_dopesheet_sort(MovieTracking *tracking, int sort_method, i
|
|||
else if (sort_method == TRACK_SORT_TOTAL) {
|
||||
BLI_sortlist(&dopesheet->channels, channels_total_track_sort);
|
||||
}
|
||||
else if (sort_method == TRACK_SORT_AVERAGE_ERROR) {
|
||||
BLI_sortlist(&dopesheet->channels, channels_average_error_sort);
|
||||
}
|
||||
}
|
||||
|
||||
dopesheet->sort_method = sort_method;
|
||||
|
|
|
@ -1060,6 +1060,7 @@ typedef enum eSpaceClip_Dopesheet_Sort {
|
|||
SC_DOPE_SORT_NAME = 0,
|
||||
SC_DOPE_SORT_LONGEST,
|
||||
SC_DOPE_SORT_TOTAL,
|
||||
SC_DOPE_SORT_AVERAGE_ERROR,
|
||||
} eSpaceClip_Dopesheet_Sort;
|
||||
|
||||
/* SpaceClip->dope_flag */
|
||||
|
|
|
@ -2999,6 +2999,7 @@ static void rna_def_space_clip(BlenderRNA *brna)
|
|||
{SC_DOPE_SORT_NAME, "NAME", 0, "Name", "Sort channels by their names"},
|
||||
{SC_DOPE_SORT_LONGEST, "LONGEST", 0, "Longest", "Sort channels by longest tracked segment"},
|
||||
{SC_DOPE_SORT_TOTAL, "TOTAL", 0, "Total", "Sort channels by overall amount of tracked segments"},
|
||||
{SC_DOPE_SORT_AVERAGE_ERROR, "AVERAGE_ERROR", 0, "Average Error", "Sort channels by average reprojection error of tracks after solve"},
|
||||
{0, NULL, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue