From 58fe38af9f0b4826acbacd7ccfdc39abc111f65c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 12 May 2022 10:42:23 +0200 Subject: Cleanup: Remove redundant marker clamping code path Pattern is expected to be freely resized to any size, and the search area s to become bigger when needed. Remove confusing pattern size clamping which was actually clamping search area. There should be no functional changes. --- source/blender/blenkernel/BKE_tracking.h | 1 - source/blender/blenkernel/intern/tracking.c | 9 +-------- source/blender/editors/space_clip/clip_buttons.c | 2 +- source/blender/editors/space_clip/tracking_ops.c | 6 +++--- source/blender/editors/transform/transform_convert_tracking.c | 2 +- source/blender/makesrna/intern/rna_tracking.c | 2 +- 6 files changed, 7 insertions(+), 15 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index 516e20d1d5d..1d4ff06703d 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -33,7 +33,6 @@ struct rcti; */ enum { - CLAMP_PAT_DIM = 1, CLAMP_PAT_POS = 2, CLAMP_SEARCH_DIM = 3, CLAMP_SEARCH_POS = 4, diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 7bb99551264..307e9eca8cb 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1373,14 +1373,7 @@ void BKE_tracking_marker_clamp(MovieTrackingMarker *marker, int event) BKE_tracking_marker_pattern_minmax(marker, pat_min, pat_max); - if (event == CLAMP_PAT_DIM) { - for (int a = 0; a < 2; a++) { - /* search shouldn't be resized smaller than pattern */ - marker->search_min[a] = min_ff(pat_min[a], marker->search_min[a]); - marker->search_max[a] = max_ff(pat_max[a], marker->search_max[a]); - } - } - else if (event == CLAMP_PAT_POS) { + if (event == CLAMP_PAT_POS) { float dim[2]; sub_v2_v2v2(dim, pat_max, pat_min); diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index e24d461019b..ab3d1e73d62 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -303,7 +303,7 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event) cb->marker->pattern_corners[a][1] *= scale_y; } - BKE_tracking_marker_clamp(cb->marker, CLAMP_PAT_DIM); + BKE_tracking_marker_clamp(cb->marker, CLAMP_SEARCH_DIM); ok = true; } diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 8e0dde9d2d1..015a8d2210f 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -849,7 +849,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event) } } - BKE_tracking_marker_clamp(data->marker, CLAMP_PAT_DIM); + BKE_tracking_marker_clamp(data->marker, CLAMP_SEARCH_DIM); } else if (data->action == SLIDE_ACTION_OFFSET) { const float d[2] = {dx, dy}; @@ -873,7 +873,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event) /* Currently only patterns are allowed to have such * combination of event and data. */ - BKE_tracking_marker_clamp(data->marker, CLAMP_PAT_DIM); + BKE_tracking_marker_clamp(data->marker, CLAMP_SEARCH_DIM); } else if (data->action == SLIDE_ACTION_TILT_SIZE) { const float mouse_delta[2] = {dx, dy}; @@ -917,7 +917,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event) data->corners[a][1] = (vec[1] * cosf(angle) + vec[0] * sinf(angle)) / data->height; } - BKE_tracking_marker_clamp(data->marker, CLAMP_PAT_DIM); + BKE_tracking_marker_clamp(data->marker, CLAMP_SEARCH_DIM); } } else if (data->area == TRACK_AREA_SEARCH) { diff --git a/source/blender/editors/transform/transform_convert_tracking.c b/source/blender/editors/transform/transform_convert_tracking.c index 45f17512c09..6b8a6f0a215 100644 --- a/source/blender/editors/transform/transform_convert_tracking.c +++ b/source/blender/editors/transform/transform_convert_tracking.c @@ -720,7 +720,7 @@ void recalcData_tracking(TransInfo *t) } else if (t->mode == TFM_RESIZE) { if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT)) { - BKE_tracking_marker_clamp(marker, CLAMP_PAT_DIM); + BKE_tracking_marker_clamp(marker, CLAMP_SEARCH_DIM); } if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH)) { BKE_tracking_marker_clamp(marker, CLAMP_SEARCH_DIM); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index e604469e3fd..b20ba490aad 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -557,7 +557,7 @@ static void rna_tracking_markerPattern_update(Main *UNUSED(bmain), { MovieTrackingMarker *marker = (MovieTrackingMarker *)ptr->data; - BKE_tracking_marker_clamp(marker, CLAMP_PAT_DIM); + BKE_tracking_marker_clamp(marker, CLAMP_SEARCH_DIM); } static void rna_tracking_markerSearch_update(Main *UNUSED(bmain), -- cgit v1.2.3