[Bf-blender-cvs] [63ee3db9610] master: Fix T73228: UI shows settings of wrong marker when movie clip is offset

Jacques Lucke noreply at git.blender.org
Thu Mar 12 15:54:49 CET 2020


Commit: 63ee3db961074beaf68c32ff30a21dfa65c2b122
Author: Jacques Lucke
Date:   Thu Mar 12 15:53:52 2020 +0100
Branches: master
https://developer.blender.org/rB63ee3db961074beaf68c32ff30a21dfa65c2b122

Fix T73228: UI shows settings of wrong marker when movie clip is offset

===================================================================

M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/space_clip/clip_buttons.c

===================================================================

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 833631f871d..3d7378181ad 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -58,6 +58,7 @@
 #include "BKE_unit.h"
 #include "BKE_paint.h"
 #include "BKE_curveprofile.h"
+#include "BKE_movieclip.h"
 
 #include "IMB_colormanagement.h"
 
@@ -7339,8 +7340,10 @@ static bool ui_numedit_but_TRACKPREVIEW(
   }
 
   if (!scopes->track_locked) {
-    if (scopes->marker->framenr != scopes->framenr) {
-      scopes->marker = BKE_tracking_marker_ensure(scopes->track, scopes->framenr);
+    const MovieClip *clip = CTX_data_edit_movieclip(C);
+    int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, scopes->framenr);
+    if (scopes->marker->framenr != clip_framenr) {
+      scopes->marker = BKE_tracking_marker_ensure(scopes->track, clip_framenr);
     }
 
     scopes->marker->flag &= ~(MARKER_DISABLED | MARKER_TRACKED);
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index 34b4967beaf..6b9d3fd054a 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -259,8 +259,6 @@ typedef struct {
   MovieTrackingTrack *track;
   MovieTrackingMarker *marker;
 
-  /** current frame number */
-  int framenr;
   /** position of marker in pixel coords */
   float marker_pos[2];
   /** position and dimensions of marker pattern in pixel coords */
@@ -283,14 +281,12 @@ static void to_pixel_space(float r[2], float a[2], int width, int height)
 static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
 {
   MarkerUpdateCb *cb = (MarkerUpdateCb *)arg_cb;
-  MovieTrackingMarker *marker;
 
   if (!cb->compact) {
     return;
   }
 
-  marker = BKE_tracking_marker_ensure(cb->track, cb->framenr);
-
+  MovieTrackingMarker *marker = cb->marker;
   marker->flag = cb->marker_flag;
 
   WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL);
@@ -299,14 +295,12 @@ static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
 static void marker_block_handler(bContext *C, void *arg_cb, int event)
 {
   MarkerUpdateCb *cb = (MarkerUpdateCb *)arg_cb;
-  MovieTrackingMarker *marker;
   int width, height;
   bool ok = false;
 
   BKE_movieclip_get_size(cb->clip, cb->user, &width, &height);
 
-  marker = BKE_tracking_marker_ensure(cb->track, cb->framenr);
-
+  MovieTrackingMarker *marker = cb->marker;
   if (event == B_MARKER_POS) {
     marker->pos[0] = cb->marker_pos[0] / width;
     marker->pos[1] = cb->marker_pos[1] / height;
@@ -452,7 +446,8 @@ void uiTemplateMarker(uiLayout *layout,
   user = userptr->data;
   track = trackptr->data;
 
-  marker = BKE_tracking_marker_get(track, user->framenr);
+  int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, user->framenr);
+  marker = BKE_tracking_marker_get(track, clip_framenr);
 
   cb = MEM_callocN(sizeof(MarkerUpdateCb), "uiTemplateMarker update_cb");
   cb->compact = compact;
@@ -461,7 +456,6 @@ void uiTemplateMarker(uiLayout *layout,
   cb->track = track;
   cb->marker = marker;
   cb->marker_flag = marker->flag;
-  cb->framenr = user->framenr;
 
   if (compact) {
     block = uiLayoutGetBlock(layout);



More information about the Bf-blender-cvs mailing list