Blender  V3.3
tracking_ops.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. All rights reserved. */
3 
8 #include "MEM_guardedalloc.h"
9 
10 #include "DNA_screen_types.h"
11 #include "DNA_space_types.h"
12 
13 #include "BLI_blenlib.h"
14 #include "BLI_ghash.h"
15 #include "BLI_math.h"
16 #include "BLI_utildefines.h"
17 
18 #include "BKE_context.h"
19 #include "BKE_image.h"
20 #include "BKE_movieclip.h"
21 #include "BKE_report.h"
22 #include "BKE_tracking.h"
23 
24 #include "DEG_depsgraph.h"
25 
26 #include "WM_api.h"
27 #include "WM_types.h"
28 
29 #include "ED_clip.h"
30 #include "ED_screen.h"
31 
32 #include "RNA_access.h"
33 #include "RNA_define.h"
34 
35 #include "BLT_translation.h"
36 
37 #include "IMB_imbuf.h"
38 #include "IMB_imbuf_types.h"
39 
40 #include "clip_intern.h"
41 #include "tracking_ops_intern.h"
42 
43 /* -------------------------------------------------------------------- */
47 static bool add_marker(const bContext *C, float x, float y)
48 {
51  MovieTracking *tracking = &clip->tracking;
52  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
53  ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
54  MovieTrackingTrack *track;
55  int width, height;
56  int framenr = ED_space_clip_get_clip_frame_number(sc);
57 
59 
60  if (width == 0 || height == 0) {
61  return false;
62  }
63 
64  track = BKE_tracking_track_add(tracking, tracksbase, x, y, framenr, width, height);
65 
66  BKE_tracking_track_select(tracksbase, track, TRACK_AREA_ALL, 0);
67  BKE_tracking_plane_tracks_deselect_all(plane_tracks_base);
68 
69  clip->tracking.act_track = track;
71 
72  return true;
73 }
74 
76 {
79  float pos[2];
80 
81  ClipViewLockState lock_state;
82  ED_clip_view_lock_state_store(C, &lock_state);
83 
84  RNA_float_get_array(op->ptr, "location", pos);
85 
86  if (!add_marker(C, pos[0], pos[1])) {
87  return OPERATOR_CANCELLED;
88  }
89 
91 
93 
94  return OPERATOR_FINISHED;
95 }
96 
97 static int add_marker_invoke(bContext *C, wmOperator *op, const wmEvent *event)
98 {
100  ARegion *region = CTX_wm_region(C);
101 
102  if (!RNA_struct_property_is_set(op->ptr, "location")) {
103  /* If location is not set, use mouse position as default. */
104  float co[2];
105  ED_clip_mouse_pos(sc, region, event->mval, co);
106  RNA_float_set_array(op->ptr, "location", co);
107  }
108 
109  return add_marker_exec(C, op);
110 }
111 
113 {
114  /* identifiers */
115  ot->name = "Add Marker";
116  ot->idname = "CLIP_OT_add_marker";
117  ot->description = "Place new marker at specified location";
118 
119  /* api callbacks */
123 
124  /* flags */
126 
127  /* properties */
129  "location",
130  2,
131  NULL,
132  -FLT_MAX,
133  FLT_MAX,
134  "Location",
135  "Location of marker on frame",
136  -1.0f,
137  1.0f);
138 }
139 
142 /* -------------------------------------------------------------------- */
147 {
148  ED_workspace_status_text(C, TIP_("Use LMB click to define location where place the marker"));
149 
150  /* Add modal handler for ESC. */
152 
153  return OPERATOR_RUNNING_MODAL;
154 }
155 
157 {
158  switch (event->type) {
159  case MOUSEMOVE:
160  return OPERATOR_RUNNING_MODAL;
161 
162  case LEFTMOUSE: {
164  MovieClip *clip = ED_space_clip_get_clip(sc);
165  ARegion *region = CTX_wm_region(C);
166  float pos[2];
167 
169 
171  region,
172  event->xy[0] - region->winrct.xmin,
173  event->xy[1] - region->winrct.ymin,
174  &pos[0],
175  &pos[1]);
176 
177  if (!add_marker(C, pos[0], pos[1])) {
178  return OPERATOR_CANCELLED;
179  }
180 
182  return OPERATOR_FINISHED;
183  }
184 
185  case EVT_ESCKEY:
187  return OPERATOR_CANCELLED;
188  }
189 
190  return OPERATOR_PASS_THROUGH;
191 }
192 
194 {
195  /* identifiers */
196  ot->name = "Add Marker at Click";
197  ot->idname = "CLIP_OT_add_marker_at_click";
198  ot->description = "Place new marker at the desired (clicked) position";
199 
200  /* api callbacks */
204 
205  /* flags */
207 }
208 
211 /* -------------------------------------------------------------------- */
216 {
218  MovieClip *clip = ED_space_clip_get_clip(sc);
219  MovieTracking *tracking = &clip->tracking;
220  bool changed = false;
221  /* Delete selected plane tracks. */
222  ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
223  for (MovieTrackingPlaneTrack *plane_track = plane_tracks_base->first, *next_plane_track;
224  plane_track != NULL;
225  plane_track = next_plane_track) {
226  next_plane_track = plane_track->next;
227  if (PLANE_TRACK_VIEW_SELECTED(plane_track)) {
228  clip_delete_plane_track(C, clip, plane_track);
229  changed = true;
230  }
231  }
232  /* Remove selected point tracks (they'll also be removed from planes which
233  * uses them).
234  */
235  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
236  for (MovieTrackingTrack *track = tracksbase->first, *next_track; track != NULL;
237  track = next_track) {
238  next_track = track->next;
239  if (TRACK_VIEW_SELECTED(sc, track)) {
240  clip_delete_track(C, clip, track);
241  changed = true;
242  }
243  }
244  if (changed) {
246  }
247  return OPERATOR_FINISHED;
248 }
249 
251 {
252  /* identifiers */
253  ot->name = "Delete Track";
254  ot->idname = "CLIP_OT_delete_track";
255  ot->description = "Delete selected tracks";
256 
257  /* api callbacks */
261 
262  /* flags */
264 }
265 
268 /* -------------------------------------------------------------------- */
273 {
275  MovieClip *clip = ED_space_clip_get_clip(sc);
276  MovieTracking *tracking = &clip->tracking;
277  const int framenr = ED_space_clip_get_clip_frame_number(sc);
278  bool changed = false;
279 
280  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
281  for (MovieTrackingTrack *track = tracksbase->first, *next_track; track != NULL;
282  track = next_track) {
283  next_track = track->next;
284  if (TRACK_VIEW_SELECTED(sc, track)) {
285  MovieTrackingMarker *marker = BKE_tracking_marker_get_exact(track, framenr);
286  if (marker != NULL) {
287  clip_delete_marker(C, clip, track, marker);
288  changed = true;
289  }
290  }
291  }
292 
293  ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
294  for (MovieTrackingPlaneTrack *plane_track = plane_tracks_base->first, *plane_track_next;
295  plane_track != NULL;
296  plane_track = plane_track_next) {
297  plane_track_next = plane_track->next;
298  if (PLANE_TRACK_VIEW_SELECTED(plane_track)) {
300  framenr);
301  if (plane_marker != NULL) {
302  if (plane_track->markersnr == 1) {
303  BKE_tracking_plane_track_free(plane_track);
304  BLI_freelinkN(plane_tracks_base, plane_track);
305  }
306  else {
307  BKE_tracking_plane_marker_delete(plane_track, framenr);
308  }
309  changed = true;
310  }
311  }
312  }
313 
314  if (!changed) {
315  return OPERATOR_CANCELLED;
316  }
317 
318  return OPERATOR_FINISHED;
319 }
320 
322 {
323  /* identifiers */
324  ot->name = "Delete Marker";
325  ot->idname = "CLIP_OT_delete_marker";
326  ot->description = "Delete marker for current frame from selected tracks";
327 
328  /* api callbacks */
332 
333  /* flags */
335 }
336 
339 /* -------------------------------------------------------------------- */
343 typedef enum eSlideAction {
345 
351 
352 typedef struct {
353  short area;
357 
358  int mval[2];
359  int width, height;
360  float *min, *max, *pos, (*corners)[2];
361 
362  bool lock, accurate;
363 
364  /* Data to restore on cancel. */
365  float old_search_min[2], old_search_max[2], old_pos[2];
366  float old_corners[4][2];
367  float (*old_markers)[2];
369 
370 static void slide_marker_tilt_slider_relative(const float pattern_corners[4][2], float r_slider[2])
371 {
372  add_v2_v2v2(r_slider, pattern_corners[1], pattern_corners[2]);
373 }
374 
375 static void slide_marker_tilt_slider(const float marker_pos[2],
376  const float pattern_corners[4][2],
377  float r_slider[2])
378 {
379  slide_marker_tilt_slider_relative(pattern_corners, r_slider);
380  add_v2_v2(r_slider, marker_pos);
381 }
382 
384  MovieTrackingTrack *track,
385  MovieTrackingMarker *marker,
386  const wmEvent *event,
387  int area,
388  int corner,
389  eSlideAction action,
390  int width,
391  int height)
392 {
393  SlideMarkerData *data = MEM_callocN(sizeof(SlideMarkerData), "slide marker data");
394  int framenr = ED_space_clip_get_clip_frame_number(sc);
395 
396  marker = BKE_tracking_marker_ensure(track, framenr);
397 
398  data->area = area;
399  data->action = action;
400  data->track = track;
401  data->marker = marker;
402 
403  if (area == TRACK_AREA_POINT) {
404  data->pos = marker->pos;
405  }
406  else if (area == TRACK_AREA_PAT) {
407  if (action == SLIDE_ACTION_POS) {
408  data->corners = marker->pattern_corners;
409  data->pos = marker->pattern_corners[corner];
410  }
411  else if (action == SLIDE_ACTION_TILT_SIZE) {
412  data->corners = marker->pattern_corners;
413  }
414  }
415  else if (area == TRACK_AREA_SEARCH) {
416  data->min = marker->search_min;
417  data->max = marker->search_max;
418  }
419 
420  data->mval[0] = event->mval[0];
421  data->mval[1] = event->mval[1];
422 
423  data->width = width;
424  data->height = height;
425 
426  if (action == SLIDE_ACTION_SIZE) {
427  data->lock = true;
428  }
429 
430  /* Backup marker's settings. */
431  memcpy(data->old_corners, marker->pattern_corners, sizeof(data->old_corners));
432  copy_v2_v2(data->old_search_min, marker->search_min);
433  copy_v2_v2(data->old_search_max, marker->search_max);
434  copy_v2_v2(data->old_pos, marker->pos);
435 
436  return data;
437 }
438 
439 static float mouse_to_slide_zone_distance_squared(const float co[2],
440  const float slide_zone[2],
441  int width,
442  int height)
443 {
444  const float pixel_co[2] = {co[0] * width, co[1] * height},
445  pixel_slide_zone[2] = {slide_zone[0] * width, slide_zone[1] * height};
446  return square_f(pixel_co[0] - pixel_slide_zone[0]) + square_f(pixel_co[1] - pixel_slide_zone[1]);
447 }
448 
450  const MovieTrackingMarker *marker, const float co[2], int corner, int width, int height)
451 {
452  float side_zone[2];
453  if (corner == 0) {
454  side_zone[0] = marker->pos[0] + marker->search_max[0];
455  side_zone[1] = marker->pos[1] + marker->search_min[1];
456  }
457  else {
458  side_zone[0] = marker->pos[0] + marker->search_min[0];
459  side_zone[1] = marker->pos[1] + marker->search_max[1];
460  }
461  return mouse_to_slide_zone_distance_squared(co, side_zone, width, height);
462 }
463 
465  const MovieTrackingMarker *marker, const float co[2], int width, int height, int *r_corner)
466 {
467  float min_distance_squared = FLT_MAX;
468  for (int i = 0; i < 4; i++) {
469  float corner_co[2];
470  add_v2_v2v2(corner_co, marker->pattern_corners[i], marker->pos);
472  if (distance_squared < min_distance_squared) {
473  min_distance_squared = distance_squared;
474  *r_corner = i;
475  }
476  }
477  return min_distance_squared;
478 }
479 
481  const MovieTrackingMarker *marker,
482  const float co[2],
483  int width,
484  int height)
485 {
486  float pos[2];
487  add_v2_v2v2(pos, marker->pos, track->offset);
489 }
490 
492  const float co[2],
493  int width,
494  int height)
495 {
496  float slider[2];
497  slide_marker_tilt_slider(marker->pos, marker->pattern_corners, slider);
499 }
500 
501 static bool slide_check_corners(float (*corners)[2])
502 {
503  float cross = 0.0f;
504  const float p[2] = {0.0f, 0.0f};
505 
506  if (!isect_point_quad_v2(p, corners[0], corners[1], corners[2], corners[3])) {
507  return false;
508  }
509 
510  for (int i = 0; i < 4; i++) {
511  float v1[2], v2[2];
512 
513  int next = (i + 1) % 4;
514  int prev = (4 + i - 1) % 4;
515 
516  sub_v2_v2v2(v1, corners[i], corners[prev]);
517  sub_v2_v2v2(v2, corners[next], corners[i]);
518 
519  float cur_cross = cross_v2v2(v1, v2);
520 
521  if (fabsf(cur_cross) > FLT_EPSILON) {
522  if (cross == 0.0f) {
523  cross = cur_cross;
524  }
525  else if (cross * cur_cross < 0.0f) {
526  return false;
527  }
528  }
529  }
530 
531  return true;
532 }
533 
535  bContext *C, const float co[2], int *r_area, eSlideAction *r_action, int *r_corner)
536 {
537  const float distance_clip_squared = 12.0f * 12.0f;
539  MovieClip *clip = ED_space_clip_get_clip(sc);
540  ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
541  const int framenr = ED_space_clip_get_clip_frame_number(sc);
542  float global_min_distance_squared = FLT_MAX;
543 
544  /* Sliding zone designator which is the closest to the mouse across all the tracks. */
545  eSlideAction min_action;
546  int min_area = 0, min_corner = -1;
547  MovieTrackingTrack *min_track = NULL;
548 
549  int width, height;
551  if (width == 0 || height == 0) {
552  return NULL;
553  }
554 
555  LISTBASE_FOREACH (MovieTrackingTrack *, track, tracksbase) {
556  if (!TRACK_VIEW_SELECTED(sc, track) || (track->flag & TRACK_LOCKED)) {
557  continue;
558  }
559 
560  const MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
561  if (marker->flag & MARKER_DISABLED) {
562  continue;
563  }
564 
565  /* We start checking with whether the mouse is close enough to the pattern offset area. */
566  float distance_squared = mouse_to_offset_distance_squared(track, marker, co, width, height);
567 
568  /* Sliding zone designator which is the closest to the mouse for the current tracks.
569  *
570  * NOTE: All checks here are assuming there's no maximum distance limit, so checks are quite
571  * simple here. Actual distance clipping happens later once all the sliding zones are checked.
572  */
573  float min_distance_squared = distance_squared;
574  int area = TRACK_AREA_POINT;
575  int action = SLIDE_ACTION_POS;
576  int corner = -1;
577 
578  /* If search area is visible, check how close to its sliding zones mouse is. */
579  if (sc->flag & SC_SHOW_MARKER_SEARCH) {
581  if (distance_squared < min_distance_squared) {
583  action = SLIDE_ACTION_OFFSET;
584  min_distance_squared = distance_squared;
585  }
586 
588  if (distance_squared < min_distance_squared) {
590  action = SLIDE_ACTION_SIZE;
591  min_distance_squared = distance_squared;
592  }
593  }
594 
595  /* If pattern area is visible, check which corner is closest to the mouse. */
596  if (sc->flag & SC_SHOW_MARKER_PATTERN) {
597  int current_corner = -1;
599  marker, co, width, height, &current_corner);
600  if (distance_squared < min_distance_squared) {
602  action = SLIDE_ACTION_POS;
603  corner = current_corner;
604  min_distance_squared = distance_squared;
605  }
606 
607  /* Here we also check whether the mouse is actually closer to the widget which controls scale
608  * and tilt. */
610  if (distance_squared < min_distance_squared) {
612  action = SLIDE_ACTION_TILT_SIZE;
613  min_distance_squared = distance_squared;
614  }
615  }
616 
617  if (min_distance_squared < global_min_distance_squared) {
618  min_area = area;
619  min_action = action;
620  min_corner = corner;
621  min_track = track;
622  global_min_distance_squared = min_distance_squared;
623  }
624  }
625 
626  if (global_min_distance_squared < distance_clip_squared / sc->zoom) {
627  if (r_area) {
628  *r_area = min_area;
629  }
630  if (r_action) {
631  *r_action = min_action;
632  }
633  if (r_corner) {
634  *r_corner = min_corner;
635  }
636  return min_track;
637  }
638 
639  return NULL;
640 }
641 
643  const float co[2])
644 {
645  return tracking_marker_check_slide(C, co, NULL, NULL, NULL);
646 }
647 
648 static void *slide_marker_customdata(bContext *C, const wmEvent *event)
649 {
651  ARegion *region = CTX_wm_region(C);
652 
653  MovieTrackingTrack *track;
654  int width, height;
655  float co[2];
656  void *customdata = NULL;
657  int framenr = ED_space_clip_get_clip_frame_number(sc);
658  eSlideAction action;
659  int area, corner;
660 
662 
663  if (width == 0 || height == 0) {
664  return NULL;
665  }
666 
667  ED_clip_mouse_pos(sc, region, event->mval, co);
668 
669  track = tracking_marker_check_slide(C, co, &area, &action, &corner);
670  if (track != NULL) {
671  MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
672  customdata = create_slide_marker_data(
673  sc, track, marker, event, area, corner, action, width, height);
674  }
675 
676  return customdata;
677 }
678 
679 static int slide_marker_invoke(bContext *C, wmOperator *op, const wmEvent *event)
680 {
681  SlideMarkerData *slidedata = slide_marker_customdata(C, event);
682  if (slidedata != NULL) {
684  MovieClip *clip = ED_space_clip_get_clip(sc);
685  MovieTracking *tracking = &clip->tracking;
686 
687  tracking->act_track = slidedata->track;
688  tracking->act_plane_track = NULL;
689 
690  op->customdata = slidedata;
691 
694 
696 
697  return OPERATOR_RUNNING_MODAL;
698  }
699 
700  return OPERATOR_PASS_THROUGH;
701 }
702 
704 {
705  MovieTrackingMarker *marker = data->marker;
706 
707  memcpy(marker->pattern_corners, data->old_corners, sizeof(marker->pattern_corners));
708  copy_v2_v2(marker->search_min, data->old_search_min);
709  copy_v2_v2(marker->search_max, data->old_search_max);
710  copy_v2_v2(marker->pos, data->old_pos);
711 
712  if (data->old_markers != NULL) {
713  for (int a = 0; a < data->track->markersnr; a++) {
714  copy_v2_v2(data->track->markers[a].pos, data->old_markers[a]);
715  }
716  }
717 }
718 
720 {
721  if (data->area == TRACK_AREA_POINT) {
723  MovieClip *clip = ED_space_clip_get_clip(sc);
724  MovieTracking *tracking = &clip->tracking;
725  ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
726  int framenr = ED_space_clip_get_clip_frame_number(sc);
727 
728  for (MovieTrackingPlaneTrack *plane_track = plane_tracks_base->first; plane_track != NULL;
729  plane_track = plane_track->next) {
730  if ((plane_track->flag & PLANE_TRACK_AUTOKEY) == 0) {
731  if (BKE_tracking_plane_track_has_point_track(plane_track, data->track)) {
732  BKE_tracking_track_plane_from_existing_motion(plane_track, framenr);
733  }
734  }
735  }
736  }
737 }
738 
740 {
741  if (data->old_markers != NULL) {
742  MEM_freeN(data->old_markers);
743  }
744  MEM_freeN(data);
745 }
746 
747 static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event)
748 {
750 
752  float dx, dy, mdelta[2];
753 
754  switch (event->type) {
755  case EVT_LEFTCTRLKEY:
756  case EVT_RIGHTCTRLKEY:
757  case EVT_LEFTSHIFTKEY:
758  case EVT_RIGHTSHIFTKEY:
759  if (data->action == SLIDE_ACTION_SIZE) {
760  if (ELEM(event->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY)) {
761  data->lock = event->val == KM_RELEASE;
762  }
763  }
764 
766  data->accurate = event->val == KM_PRESS;
767  }
769  case MOUSEMOVE:
770  mdelta[0] = event->mval[0] - data->mval[0];
771  mdelta[1] = event->mval[1] - data->mval[1];
772 
773  dx = mdelta[0] / data->width / sc->zoom;
774 
775  if (data->lock) {
776  dy = -dx / data->height * data->width;
777  }
778  else {
779  dy = mdelta[1] / data->height / sc->zoom;
780  }
781 
782  if (data->accurate) {
783  dx /= 5.0f;
784  dy /= 5.0f;
785  }
786 
787  if (data->area == TRACK_AREA_POINT) {
788  data->pos[0] += dx;
789  data->pos[1] += dy;
790 
792  DEG_id_tag_update(&sc->clip->id, 0);
793  }
794  else if (data->area == TRACK_AREA_PAT) {
795  if (data->action == SLIDE_ACTION_POS) {
796  float prev_pos[2];
797  copy_v2_v2(prev_pos, data->pos);
798 
799  data->pos[0] += dx;
800  data->pos[1] += dy;
801 
802  if (!slide_check_corners(data->corners)) {
803  copy_v2_v2(data->pos, prev_pos);
804  }
805 
806  /* Allow pattern to be arbitrary size and resize search area if needed. */
808  }
809  else if (data->action == SLIDE_ACTION_TILT_SIZE) {
810  const float delta[2] = {dx, dy};
811 
812  /* Slider position relative to the marker position using current state of pattern
813  * corners. */
814  float slider[2];
815  slide_marker_tilt_slider_relative(data->corners, slider);
816 
817  /* Vector which connects marker position with the slider state at the current corners
818  * state.
819  * The coordinate is in the pixel space. */
820  float start_px[2];
821  copy_v2_v2(start_px, slider);
822  start_px[0] *= data->width;
823  start_px[1] *= data->height;
824 
825  /* Vector which connects marker position with the slider state with the new mouse delta
826  * taken into account.
827  * The coordinate is in the pixel space. */
828  float end_px[2];
829  add_v2_v2v2(end_px, slider, delta);
830  end_px[0] *= data->width;
831  end_px[1] *= data->height;
832 
833  float scale = 1.0f;
834  if (len_squared_v2(start_px) != 0.0f) {
835  scale = len_v2(end_px) / len_v2(start_px);
836 
837  if (scale < 0.0f) {
838  scale = 0.0;
839  }
840  }
841 
842  const float angle = -angle_signed_v2v2(start_px, end_px);
843 
844  for (int a = 0; a < 4; a++) {
845  float vec[2];
846 
847  mul_v2_fl(data->corners[a], scale);
848 
849  copy_v2_v2(vec, data->corners[a]);
850  vec[0] *= data->width;
851  vec[1] *= data->height;
852 
853  data->corners[a][0] = (vec[0] * cosf(angle) - vec[1] * sinf(angle)) / data->width;
854  data->corners[a][1] = (vec[1] * cosf(angle) + vec[0] * sinf(angle)) / data->height;
855  }
856 
858  }
859  }
860  else if (data->area == TRACK_AREA_SEARCH) {
861  if (data->action == SLIDE_ACTION_SIZE) {
862  data->min[0] -= dx;
863  data->min[1] += dy;
864 
865  data->max[0] += dx;
866  data->max[1] -= dy;
867 
869  }
870  else if (data->action == SLIDE_ACTION_OFFSET) {
871  const float delta[2] = {dx, dy};
872  add_v2_v2(data->min, delta);
873  add_v2_v2(data->max, delta);
874 
876  }
877  }
878 
879  data->marker->flag &= ~MARKER_TRACKED;
880 
881  copy_v2_v2_int(data->mval, event->mval);
882 
884 
885  break;
886 
887  case LEFTMOUSE:
888  if (event->val == KM_RELEASE) {
891 
893 
894  return OPERATOR_FINISHED;
895  }
896 
897  break;
898 
899  case EVT_ESCKEY:
901 
903 
905 
907 
908  return OPERATOR_CANCELLED;
909  }
910 
911  return OPERATOR_RUNNING_MODAL;
912 }
913 
915 {
916  /* identifiers */
917  ot->name = "Slide Marker";
918  ot->description = "Slide marker areas";
919  ot->idname = "CLIP_OT_slide_marker";
920 
921  /* api callbacks */
925 
926  /* flags */
928 
929  /* properties */
931  "offset",
932  2,
933  NULL,
934  -FLT_MAX,
935  FLT_MAX,
936  "Offset",
937  "Offset in floating-point units, 1.0 is the width and height of the image",
938  -FLT_MAX,
939  FLT_MAX);
940 }
941 
944 /* -------------------------------------------------------------------- */
949 {
951  MovieClip *clip = ED_space_clip_get_clip(sc);
952  MovieTracking *tracking = &clip->tracking;
953  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
954  const eTrackClearAction action = RNA_enum_get(op->ptr, "action");
955  const bool clear_active = RNA_boolean_get(op->ptr, "clear_active");
956  const int framenr = ED_space_clip_get_clip_frame_number(sc);
957 
958  if (clear_active) {
960  if (track != NULL) {
961  BKE_tracking_track_path_clear(track, framenr, action);
962  }
963  }
964  else {
965  for (MovieTrackingTrack *track = tracksbase->first; track != NULL; track = track->next) {
966  if (TRACK_VIEW_SELECTED(sc, track)) {
967  BKE_tracking_track_path_clear(track, framenr, action);
968  }
969  }
970  }
971 
974 
975  return OPERATOR_FINISHED;
976 }
977 
979 {
980  static const EnumPropertyItem clear_path_actions[] = {
981  {TRACK_CLEAR_UPTO, "UPTO", 0, "Clear Up To", "Clear path up to current frame"},
983  "REMAINED",
984  0,
985  "Clear Remained",
986  "Clear path at remaining frames (after current)"},
987  {TRACK_CLEAR_ALL, "ALL", 0, "Clear All", "Clear the whole path"},
988  {0, NULL, 0, NULL, NULL},
989  };
990 
991  /* identifiers */
992  ot->name = "Clear Track Path";
993  ot->description = "Clear tracks after/before current position or clear the whole track";
994  ot->idname = "CLIP_OT_clear_track_path";
995 
996  /* api callbacks */
999 
1000  /* flags */
1002 
1003  /* properties */
1004  RNA_def_enum(ot->srna,
1005  "action",
1006  clear_path_actions,
1008  "Action",
1009  "Clear action to execute");
1011  "clear_active",
1012  0,
1013  "Clear Active",
1014  "Clear active track only instead of all selected tracks");
1015 }
1016 
1019 /* -------------------------------------------------------------------- */
1023 enum {
1027 };
1028 
1030 {
1031  SpaceClip *sc = CTX_wm_space_clip(C);
1032  MovieClip *clip = ED_space_clip_get_clip(sc);
1033  MovieTracking *tracking = &clip->tracking;
1034  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
1035  int action = RNA_enum_get(op->ptr, "action");
1036  int framenr = ED_space_clip_get_clip_frame_number(sc);
1037 
1038  for (MovieTrackingTrack *track = tracksbase->first; track != NULL; track = track->next) {
1039  if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) {
1040  MovieTrackingMarker *marker = BKE_tracking_marker_ensure(track, framenr);
1041  switch (action) {
1042  case MARKER_OP_DISABLE:
1043  marker->flag |= MARKER_DISABLED;
1044  break;
1045  case MARKER_OP_ENABLE:
1046  marker->flag &= ~MARKER_DISABLED;
1047  break;
1048  case MARKER_OP_TOGGLE:
1049  marker->flag ^= MARKER_DISABLED;
1050  break;
1051  }
1052  }
1053  }
1054 
1055  DEG_id_tag_update(&clip->id, 0);
1056 
1058 
1059  return OPERATOR_FINISHED;
1060 }
1061 
1063 {
1064  static const EnumPropertyItem actions_items[] = {
1065  {MARKER_OP_DISABLE, "DISABLE", 0, "Disable", "Disable selected markers"},
1066  {MARKER_OP_ENABLE, "ENABLE", 0, "Enable", "Enable selected markers"},
1067  {MARKER_OP_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"},
1068  {0, NULL, 0, NULL, NULL},
1069  };
1070 
1071  /* identifiers */
1072  ot->name = "Disable Markers";
1073  ot->description = "Disable/enable selected markers";
1074  ot->idname = "CLIP_OT_disable_markers";
1075 
1076  /* api callbacks */
1079 
1080  /* flags */
1082 
1083  /* properties */
1084  RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Disable action to execute");
1085 }
1086 
1089 /* -------------------------------------------------------------------- */
1094 {
1095  SpaceClip *sc = CTX_wm_space_clip(C);
1096  MovieClip *clip = ED_space_clip_get_clip(sc);
1097  int width, height;
1098 
1099  BKE_movieclip_get_size(clip, &sc->user, &width, &height);
1100 
1101  if (width == 0 || height == 0) {
1102  return OPERATOR_CANCELLED;
1103  }
1104 
1105  clip->tracking.camera.principal[0] = ((float)width) / 2.0f;
1106  clip->tracking.camera.principal[1] = ((float)height) / 2.0f;
1107 
1109 
1110  return OPERATOR_FINISHED;
1111 }
1112 
1114 {
1115  /* identifiers */
1116  ot->name = "Set Principal to Center";
1117  ot->description = "Set optical center to center of footage";
1118  ot->idname = "CLIP_OT_set_center_principal";
1119 
1120  /* api callbacks */
1123 
1124  /* flags */
1126 }
1127 
1130 /* -------------------------------------------------------------------- */
1135 {
1136  SpaceClip *sc = CTX_wm_space_clip(C);
1137  MovieClip *clip = ED_space_clip_get_clip(sc);
1138  MovieTracking *tracking = &clip->tracking;
1139  int unselected;
1140 
1141  unselected = RNA_boolean_get(op->ptr, "unselected");
1142 
1143  /* Hide point tracks. */
1144  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
1145  MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
1146  for (MovieTrackingTrack *track = tracksbase->first; track != NULL; track = track->next) {
1147  if (unselected == 0 && TRACK_VIEW_SELECTED(sc, track)) {
1148  track->flag |= TRACK_HIDDEN;
1149  }
1150  else if (unselected == 1 && !TRACK_VIEW_SELECTED(sc, track)) {
1151  track->flag |= TRACK_HIDDEN;
1152  }
1153  }
1154 
1155  if (act_track != NULL && act_track->flag & TRACK_HIDDEN) {
1156  clip->tracking.act_track = NULL;
1157  }
1158 
1159  /* Hide place tracks. */
1160  ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
1161  MovieTrackingPlaneTrack *act_plane_track = BKE_tracking_plane_track_get_active(tracking);
1162  for (MovieTrackingPlaneTrack *plane_track = plane_tracks_base->first; plane_track != NULL;
1163  plane_track = plane_track->next) {
1164  if (unselected == 0 && plane_track->flag & SELECT) {
1165  plane_track->flag |= PLANE_TRACK_HIDDEN;
1166  }
1167  else if (unselected == 1 && (plane_track->flag & SELECT) == 0) {
1168  plane_track->flag |= PLANE_TRACK_HIDDEN;
1169  }
1170  }
1171  if (act_plane_track != NULL && act_plane_track->flag & TRACK_HIDDEN) {
1172  clip->tracking.act_plane_track = NULL;
1173  }
1174 
1177 
1178  return OPERATOR_FINISHED;
1179 }
1180 
1182 {
1183  /* identifiers */
1184  ot->name = "Hide Tracks";
1185  ot->description = "Hide selected tracks";
1186  ot->idname = "CLIP_OT_hide_tracks";
1187 
1188  /* api callbacks */
1191 
1192  /* flags */
1194 
1195  /* properties */
1196  RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected tracks");
1197 }
1198 
1201 /* -------------------------------------------------------------------- */
1206 {
1207  SpaceClip *sc = CTX_wm_space_clip(C);
1208  MovieClip *clip = ED_space_clip_get_clip(sc);
1209  MovieTracking *tracking = &clip->tracking;
1210 
1211  /* Unhide point tracks. */
1212  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
1213  for (MovieTrackingTrack *track = tracksbase->first; track != NULL; track = track->next) {
1214  track->flag &= ~TRACK_HIDDEN;
1215  }
1216 
1217  /* Unhide plane tracks. */
1218  ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
1219  for (MovieTrackingPlaneTrack *plane_track = plane_tracks_base->first; plane_track != NULL;
1220  plane_track = plane_track->next) {
1221  plane_track->flag &= ~PLANE_TRACK_HIDDEN;
1222  }
1223 
1225 
1227 
1228  return OPERATOR_FINISHED;
1229 }
1230 
1232 {
1233  /* identifiers */
1234  ot->name = "Hide Tracks Clear";
1235  ot->description = "Clear hide selected tracks";
1236  ot->idname = "CLIP_OT_hide_tracks_clear";
1237 
1238  /* api callbacks */
1241 
1242  /* flags */
1244 }
1245 
1248 /* -------------------------------------------------------------------- */
1253 {
1254  SpaceClip *space_clip = CTX_wm_space_clip(C);
1255  return space_clip != NULL;
1256 }
1257 
1259 {
1261  SpaceClip *sc = CTX_wm_space_clip(C);
1262  MovieClip *clip = ED_space_clip_get_clip(sc);
1263  MovieTracking *tracking = &clip->tracking;
1264  int pos = RNA_enum_get(op->ptr, "position");
1265  int delta;
1266 
1267  if (pos <= 1) { /* jump to path */
1269  if (track == NULL) {
1270  return OPERATOR_CANCELLED;
1271  }
1272 
1273  delta = pos == 1 ? 1 : -1;
1274  while (sc->user.framenr + delta >= scene->r.sfra &&
1275  sc->user.framenr + delta <= scene->r.efra) {
1276  int framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, sc->user.framenr + delta);
1277  MovieTrackingMarker *marker = BKE_tracking_marker_get_exact(track, framenr);
1278 
1279  if (marker == NULL || marker->flag & MARKER_DISABLED) {
1280  break;
1281  }
1282 
1283  sc->user.framenr += delta;
1284  }
1285  }
1286  else { /* to failed frame */
1287  if (tracking->reconstruction.flag & TRACKING_RECONSTRUCTED) {
1288  int framenr = ED_space_clip_get_clip_frame_number(sc);
1290 
1291  delta = pos == 3 ? 1 : -1;
1292  framenr += delta;
1293 
1294  while (framenr + delta >= scene->r.sfra && framenr + delta <= scene->r.efra) {
1296  tracking, object, framenr);
1297 
1298  if (cam == NULL) {
1300  break;
1301  }
1302 
1303  framenr += delta;
1304  }
1305  }
1306  }
1307 
1308  if (scene->r.cfra != sc->user.framenr) {
1309  scene->r.cfra = sc->user.framenr;
1311 
1313  }
1314 
1316 
1317  return OPERATOR_FINISHED;
1318 }
1319 
1321 {
1322  static const EnumPropertyItem position_items[] = {
1323  {0, "PATHSTART", 0, "Path Start", "Jump to start of current path"},
1324  {1, "PATHEND", 0, "Path End", "Jump to end of current path"},
1325  {2, "FAILEDPREV", 0, "Previous Failed", "Jump to previous failed frame"},
1326  {2, "FAILNEXT", 0, "Next Failed", "Jump to next failed frame"},
1327  {0, NULL, 0, NULL, NULL},
1328  };
1329 
1330  /* identifiers */
1331  ot->name = "Jump to Frame";
1332  ot->description = "Jump to special frame";
1333  ot->idname = "CLIP_OT_frame_jump";
1334 
1335  /* api callbacks */
1336  ot->exec = frame_jump_exec;
1337  ot->poll = frame_jump_poll;
1338 
1339  /* flags */
1341 
1342  /* properties */
1343  RNA_def_enum(ot->srna, "position", position_items, 0, "Position", "Position to jump to");
1344 }
1345 
1348 /* -------------------------------------------------------------------- */
1353 {
1354  SpaceClip *sc = CTX_wm_space_clip(C);
1355  MovieClip *clip = ED_space_clip_get_clip(sc);
1356  MovieTracking *tracking = &clip->tracking;
1357  MovieTrackingStabilization *stab = &tracking->stabilization;
1358  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
1359  ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
1360  bool update_stabilization = false;
1361 
1362  MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
1363  if (act_track == NULL) {
1364  BKE_report(op->reports, RPT_ERROR, "No active track to join to");
1365  return OPERATOR_CANCELLED;
1366  }
1367 
1368  GSet *point_tracks = BLI_gset_ptr_new(__func__);
1369 
1370  for (MovieTrackingTrack *track = tracksbase->first, *next_track; track != NULL;
1371  track = next_track) {
1372  next_track = track->next;
1373  if (TRACK_VIEW_SELECTED(sc, track) && track != act_track) {
1374  BKE_tracking_tracks_join(tracking, act_track, track);
1375 
1376  if (track->flag & TRACK_USE_2D_STAB) {
1377  update_stabilization = true;
1378  if ((act_track->flag & TRACK_USE_2D_STAB) == 0) {
1379  act_track->flag |= TRACK_USE_2D_STAB;
1380  }
1381  else {
1382  stab->tot_track--;
1383  }
1384  BLI_assert(0 <= stab->tot_track);
1385  }
1386  if (track->flag & TRACK_USE_2D_STAB_ROT) {
1387  update_stabilization = true;
1388  if ((act_track->flag & TRACK_USE_2D_STAB_ROT) == 0) {
1389  act_track->flag |= TRACK_USE_2D_STAB_ROT;
1390  }
1391  else {
1392  stab->tot_rot_track--;
1393  }
1394  BLI_assert(0 <= stab->tot_rot_track);
1395  }
1396 
1397  for (MovieTrackingPlaneTrack *plane_track = plane_tracks_base->first; plane_track != NULL;
1398  plane_track = plane_track->next) {
1399  if (BKE_tracking_plane_track_has_point_track(plane_track, track)) {
1400  BKE_tracking_plane_track_replace_point_track(plane_track, track, act_track);
1401  if ((plane_track->flag & PLANE_TRACK_AUTOKEY) == 0) {
1402  BLI_gset_insert(point_tracks, plane_track);
1403  }
1404  }
1405  }
1406 
1407  BKE_tracking_track_free(track);
1408  BLI_freelinkN(tracksbase, track);
1409  }
1410  }
1411 
1412  if (update_stabilization) {
1414  }
1415 
1416  GSetIterator gs_iter;
1417  int framenr = ED_space_clip_get_clip_frame_number(sc);
1418  GSET_ITER (gs_iter, point_tracks) {
1419  MovieTrackingPlaneTrack *plane_track = BLI_gsetIterator_getKey(&gs_iter);
1420  BKE_tracking_track_plane_from_existing_motion(plane_track, framenr);
1421  }
1422 
1423  BLI_gset_free(point_tracks, NULL);
1424  DEG_id_tag_update(&clip->id, 0);
1425 
1427 
1428  return OPERATOR_FINISHED;
1429 }
1430 
1432 {
1433  /* identifiers */
1434  ot->name = "Join Tracks";
1435  ot->description = "Join selected tracks";
1436  ot->idname = "CLIP_OT_join_tracks";
1437 
1438  /* api callbacks */
1441 
1442  /* flags */
1444 }
1445 
1448 /* -------------------------------------------------------------------- */
1453 {
1454  SpaceClip *space_clip = CTX_wm_space_clip(C);
1455  MovieClip *clip = ED_space_clip_get_clip(space_clip);
1456  MovieTracking *tracking = &clip->tracking;
1457 
1458  /* Collect source tracks. */
1459  int num_source_tracks;
1461  tracking, &num_source_tracks);
1462  if (num_source_tracks == 0) {
1463  return OPERATOR_CANCELLED;
1464  }
1465 
1466  /* Create new empty track, which will be the averaged result.
1467  * Makes it simple to average all selection to it. */
1468  ListBase *tracks_list = BKE_tracking_get_active_tracks(tracking);
1469  MovieTrackingTrack *result_track = BKE_tracking_track_add_empty(tracking, tracks_list);
1470 
1471  /* Perform averaging. */
1472  BKE_tracking_tracks_average(result_track, source_tracks, num_source_tracks);
1473 
1474  const bool keep_original = RNA_boolean_get(op->ptr, "keep_original");
1475  if (!keep_original) {
1476  for (int i = 0; i < num_source_tracks; i++) {
1477  clip_delete_track(C, clip, source_tracks[i]);
1478  }
1479  }
1480 
1481  /* Update selection, making the result track active and selected. */
1482  /* TODO(sergey): Should become some sort of utility function available for all operators. */
1483 
1484  BKE_tracking_track_select(tracks_list, result_track, TRACK_AREA_ALL, 0);
1485  ListBase *plane_tracks_list = BKE_tracking_get_active_plane_tracks(tracking);
1486  BKE_tracking_plane_tracks_deselect_all(plane_tracks_list);
1487 
1488  clip->tracking.act_track = result_track;
1489  clip->tracking.act_plane_track = NULL;
1490 
1491  /* Inform the dependency graph and interface about changes. */
1492  DEG_id_tag_update(&clip->id, 0);
1494 
1495  /* Free memory. */
1496  MEM_freeN(source_tracks);
1497 
1498  return OPERATOR_FINISHED;
1499 }
1500 
1501 static int average_tracks_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
1502 {
1503  PropertyRNA *prop_keep_original = RNA_struct_find_property(op->ptr, "keep_original");
1504  if (!RNA_property_is_set(op->ptr, prop_keep_original)) {
1505  SpaceClip *space_clip = CTX_wm_space_clip(C);
1506  MovieClip *clip = ED_space_clip_get_clip(space_clip);
1507  MovieTracking *tracking = &clip->tracking;
1508 
1509  const int num_selected_tracks = BKE_tracking_count_selected_tracks_in_active_object(tracking);
1510 
1511  if (num_selected_tracks == 1) {
1512  RNA_property_boolean_set(op->ptr, prop_keep_original, false);
1513  }
1514  }
1515 
1516  return average_tracks_exec(C, op);
1517 }
1518 
1520 {
1521  /* Identifiers. */
1522  ot->name = "Average Tracks";
1523  ot->description = "Average selected tracks into active";
1524  ot->idname = "CLIP_OT_average_tracks";
1525 
1526  /* API callbacks. */
1530 
1531  /* Flags. */
1533 
1534  /* Properties. */
1535  PropertyRNA *prop;
1536 
1537  prop = RNA_def_boolean(ot->srna, "keep_original", 1, "Keep Original", "Keep original tracks");
1539 }
1540 
1543 /* -------------------------------------------------------------------- */
1547 enum {
1551 };
1552 
1554 {
1555  SpaceClip *sc = CTX_wm_space_clip(C);
1556  MovieClip *clip = ED_space_clip_get_clip(sc);
1557  MovieTracking *tracking = &clip->tracking;
1558  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
1559  int action = RNA_enum_get(op->ptr, "action");
1560 
1561  for (MovieTrackingTrack *track = tracksbase->first; track != NULL; track = track->next) {
1562  if (TRACK_VIEW_SELECTED(sc, track)) {
1563  switch (action) {
1564  case TRACK_ACTION_LOCK:
1565  track->flag |= TRACK_LOCKED;
1566  break;
1567  case TRACK_ACTION_UNLOCK:
1568  track->flag &= ~TRACK_LOCKED;
1569  break;
1570  case TRACK_ACTION_TOGGLE:
1571  track->flag ^= TRACK_LOCKED;
1572  break;
1573  }
1574  }
1575  }
1576 
1578 
1579  return OPERATOR_FINISHED;
1580 }
1581 
1583 {
1584  static const EnumPropertyItem actions_items[] = {
1585  {TRACK_ACTION_LOCK, "LOCK", 0, "Lock", "Lock selected tracks"},
1586  {TRACK_ACTION_UNLOCK, "UNLOCK", 0, "Unlock", "Unlock selected tracks"},
1587  {TRACK_ACTION_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle locked flag for selected tracks"},
1588  {0, NULL, 0, NULL, NULL},
1589  };
1590 
1591  /* identifiers */
1592  ot->name = "Lock Tracks";
1593  ot->description = "Lock/unlock selected tracks";
1594  ot->idname = "CLIP_OT_lock_tracks";
1595 
1596  /* api callbacks */
1599 
1600  /* flags */
1602 
1603  /* properties */
1604  RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Lock action to execute");
1605 }
1606 
1609 /* -------------------------------------------------------------------- */
1613 enum {
1616 };
1617 
1619 {
1620  SpaceClip *sc = CTX_wm_space_clip(C);
1621  MovieClip *clip = ED_space_clip_get_clip(sc);
1622  MovieTracking *tracking = &clip->tracking;
1624  int keyframe = RNA_enum_get(op->ptr, "keyframe");
1625  int framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, sc->user.framenr);
1626 
1627  if (keyframe == SOLVER_KEYFRAME_A) {
1628  object->keyframe1 = framenr;
1629  }
1630  else {
1631  object->keyframe2 = framenr;
1632  }
1633 
1635 
1636  return OPERATOR_FINISHED;
1637 }
1638 
1640 {
1641  static const EnumPropertyItem keyframe_items[] = {
1642  {SOLVER_KEYFRAME_A, "KEYFRAME_A", 0, "Keyframe A", ""},
1643  {SOLVER_KEYFRAME_B, "KEYFRAME_B", 0, "Keyframe B", ""},
1644  {0, NULL, 0, NULL, NULL},
1645  };
1646 
1647  /* identifiers */
1648  ot->name = "Set Solver Keyframe";
1649  ot->description = "Set keyframe used by solver";
1650  ot->idname = "CLIP_OT_set_solver_keyframe";
1651 
1652  /* api callbacks */
1655 
1656  /* flags */
1658 
1659  /* properties */
1660  RNA_def_enum(ot->srna, "keyframe", keyframe_items, 0, "Keyframe", "Keyframe to set");
1661 }
1662 
1665 /* -------------------------------------------------------------------- */
1670 {
1671  SpaceClip *sc = CTX_wm_space_clip(C);
1672  MovieClip *clip = ED_space_clip_get_clip(sc);
1673  MovieTracking *tracking = &clip->tracking;
1674  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
1675 
1676  MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
1677  if (act_track == NULL) {
1678  return OPERATOR_CANCELLED;
1679  }
1680 
1681  for (MovieTrackingTrack *track = tracksbase->first; track != NULL; track = track->next) {
1682  if (TRACK_VIEW_SELECTED(sc, track) && track != act_track) {
1683  track->flag &= ~TRACK_CUSTOMCOLOR;
1684  if (act_track->flag & TRACK_CUSTOMCOLOR) {
1685  copy_v3_v3(track->color, act_track->color);
1686  track->flag |= TRACK_CUSTOMCOLOR;
1687  }
1688  }
1689  }
1690 
1691  DEG_id_tag_update(&clip->id, 0);
1693 
1694  return OPERATOR_FINISHED;
1695 }
1696 
1698 {
1699  /* identifiers */
1700  ot->name = "Copy Color";
1701  ot->description = "Copy color to all selected tracks";
1702  ot->idname = "CLIP_OT_track_copy_color";
1703 
1704  /* api callbacks */
1707 
1708  /* flags */
1710 }
1711 
1714 /* -------------------------------------------------------------------- */
1718 static bool is_track_clean(MovieTrackingTrack *track, int frames, int del)
1719 {
1720  bool ok = true;
1721  int prev = -1, count = 0;
1722  MovieTrackingMarker *markers = track->markers, *new_markers = NULL;
1723  int start_disabled = 0;
1724  int markersnr = track->markersnr;
1725 
1726  if (del) {
1727  new_markers = MEM_callocN(markersnr * sizeof(MovieTrackingMarker), "track cleaned markers");
1728  }
1729 
1730  for (int a = 0; a < markersnr; a++) {
1731  int end = 0;
1732 
1733  if (prev == -1) {
1734  if ((markers[a].flag & MARKER_DISABLED) == 0) {
1735  prev = a;
1736  }
1737  else {
1738  start_disabled = 1;
1739  }
1740  }
1741 
1742  if (prev >= 0) {
1743  end = a == markersnr - 1;
1744  end |= (a < markersnr - 1) && (markers[a].framenr != markers[a + 1].framenr - 1 ||
1746  }
1747 
1748  if (end) {
1749  int segok = 1, len = 0;
1750 
1751  if (a != prev && markers[a].framenr != markers[a - 1].framenr + 1) {
1752  len = a - prev;
1753  }
1754  else if (markers[a].flag & MARKER_DISABLED) {
1755  len = a - prev;
1756  }
1757  else {
1758  len = a - prev + 1;
1759  }
1760 
1761  if (frames) {
1762  if (len < frames) {
1763  segok = 0;
1764  ok = 0;
1765 
1766  if (!del) {
1767  break;
1768  }
1769  }
1770  }
1771 
1772  if (del) {
1773  if (segok) {
1774  int t = len;
1775 
1776  if (markers[a].flag & MARKER_DISABLED) {
1777  t++;
1778  }
1779 
1780  /* Place disabled marker in front of current segment. */
1781  if (start_disabled) {
1782  memcpy(new_markers + count, markers + prev, sizeof(MovieTrackingMarker));
1783  new_markers[count].framenr--;
1784  new_markers[count].flag |= MARKER_DISABLED;
1785 
1786  count++;
1787  start_disabled = 0;
1788  }
1789 
1790  memcpy(new_markers + count, markers + prev, t * sizeof(MovieTrackingMarker));
1791  count += t;
1792  }
1793  else if (markers[a].flag & MARKER_DISABLED) {
1794  /* Current segment which would be deleted was finished by
1795  * disabled marker, so next segment should be started from
1796  * disabled marker.
1797  */
1798  start_disabled = 1;
1799  }
1800  }
1801 
1802  prev = -1;
1803  }
1804  }
1805 
1806  if (del && count == 0) {
1807  ok = 0;
1808  }
1809 
1810  if (del) {
1811  MEM_freeN(track->markers);
1812 
1813  if (count) {
1814  track->markers = new_markers;
1815  }
1816  else {
1817  track->markers = NULL;
1818  MEM_freeN(new_markers);
1819  }
1820 
1821  track->markersnr = count;
1822  }
1823 
1824  return ok;
1825 }
1826 
1828 {
1829  SpaceClip *sc = CTX_wm_space_clip(C);
1830  MovieClip *clip = ED_space_clip_get_clip(sc);
1831  MovieTracking *tracking = &clip->tracking;
1832  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
1833  MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
1834  int frames = RNA_int_get(op->ptr, "frames");
1835  int action = RNA_enum_get(op->ptr, "action");
1836  float error = RNA_float_get(op->ptr, "error");
1837 
1838  if (error && action == TRACKING_CLEAN_DELETE_SEGMENT) {
1839  action = TRACKING_CLEAN_DELETE_TRACK;
1840  }
1841 
1842  for (MovieTrackingTrack *track = tracksbase->first, *next_track; track != NULL;
1843  track = next_track) {
1844  next_track = track->next;
1845 
1846  if ((track->flag & TRACK_HIDDEN) == 0 && (track->flag & TRACK_LOCKED) == 0) {
1847  bool ok;
1848 
1849  ok = (is_track_clean(track, frames, action == TRACKING_CLEAN_DELETE_SEGMENT)) &&
1850  ((error == 0.0f) || (track->flag & TRACK_HAS_BUNDLE) == 0 || (track->error < error));
1851 
1852  if (!ok) {
1853  if (action == TRACKING_CLEAN_SELECT) {
1855  }
1856  else if (action == TRACKING_CLEAN_DELETE_TRACK) {
1857  if (track == act_track) {
1858  clip->tracking.act_track = NULL;
1859  }
1860  BKE_tracking_track_free(track);
1861  BLI_freelinkN(tracksbase, track);
1862  track = NULL;
1863  }
1864 
1865  /* Happens when all tracking segments are not long enough. */
1866  if (track && track->markersnr == 0) {
1867  if (track == act_track) {
1868  clip->tracking.act_track = NULL;
1869  }
1870  BKE_tracking_track_free(track);
1871  BLI_freelinkN(tracksbase, track);
1872  }
1873  }
1874  }
1875  }
1876 
1877  DEG_id_tag_update(&clip->id, 0);
1879 
1881 
1882  return OPERATOR_FINISHED;
1883 }
1884 
1885 static int clean_tracks_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
1886 {
1887  SpaceClip *sc = CTX_wm_space_clip(C);
1888  MovieClip *clip = ED_space_clip_get_clip(sc);
1889 
1890  if (!RNA_struct_property_is_set(op->ptr, "frames")) {
1891  RNA_int_set(op->ptr, "frames", clip->tracking.settings.clean_frames);
1892  }
1893 
1894  if (!RNA_struct_property_is_set(op->ptr, "error")) {
1895  RNA_float_set(op->ptr, "error", clip->tracking.settings.clean_error);
1896  }
1897 
1898  if (!RNA_struct_property_is_set(op->ptr, "action")) {
1899  RNA_enum_set(op->ptr, "action", clip->tracking.settings.clean_action);
1900  }
1901 
1902  return clean_tracks_exec(C, op);
1903 }
1904 
1906 {
1907  static const EnumPropertyItem actions_items[] = {
1908  {TRACKING_CLEAN_SELECT, "SELECT", 0, "Select", "Select unclean tracks"},
1909  {TRACKING_CLEAN_DELETE_TRACK, "DELETE_TRACK", 0, "Delete Track", "Delete unclean tracks"},
1911  "DELETE_SEGMENTS",
1912  0,
1913  "Delete Segments",
1914  "Delete unclean segments of tracks"},
1915  {0, NULL, 0, NULL, NULL},
1916  };
1917 
1918  /* identifiers */
1919  ot->name = "Clean Tracks";
1920  ot->description = "Clean tracks with high error values or few frames";
1921  ot->idname = "CLIP_OT_clean_tracks";
1922 
1923  /* api callbacks */
1927 
1928  /* flags */
1930 
1931  /* properties */
1932  RNA_def_int(ot->srna,
1933  "frames",
1934  0,
1935  0,
1936  INT_MAX,
1937  "Tracked Frames",
1938  "Effect on tracks which are tracked less than "
1939  "specified amount of frames",
1940  0,
1941  INT_MAX);
1943  "error",
1944  0.0f,
1945  0.0f,
1946  FLT_MAX,
1947  "Reprojection Error",
1948  "Effect on tracks which have got larger reprojection error",
1949  0.0f,
1950  100.0f);
1951  RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Cleanup action to execute");
1952 }
1953 
1956 /* -------------------------------------------------------------------- */
1961 {
1962  SpaceClip *sc = CTX_wm_space_clip(C);
1963  MovieClip *clip = ED_space_clip_get_clip(sc);
1964  MovieTracking *tracking = &clip->tracking;
1965 
1966  BKE_tracking_object_add(tracking, "Object");
1967 
1970 
1971  return OPERATOR_FINISHED;
1972 }
1973 
1975 {
1976  /* identifiers */
1977  ot->name = "Add Tracking Object";
1978  ot->description = "Add new object for tracking";
1979  ot->idname = "CLIP_OT_tracking_object_new";
1980 
1981  /* api callbacks */
1984 
1985  /* flags */
1987 }
1988 
1991 /* -------------------------------------------------------------------- */
1996 {
1997  SpaceClip *sc = CTX_wm_space_clip(C);
1998  MovieClip *clip = ED_space_clip_get_clip(sc);
1999  MovieTracking *tracking = &clip->tracking;
2000  MovieTrackingObject *object;
2001 
2002  object = BKE_tracking_object_get_active(tracking);
2003 
2004  if (object->flag & TRACKING_OBJECT_CAMERA) {
2005  BKE_report(op->reports, RPT_WARNING, "Object used for camera tracking cannot be deleted");
2006  return OPERATOR_CANCELLED;
2007  }
2008 
2009  BKE_tracking_object_delete(tracking, object);
2010 
2013 
2014  return OPERATOR_FINISHED;
2015 }
2016 
2018 {
2019  /* identifiers */
2020  ot->name = "Remove Tracking Object";
2021  ot->description = "Remove object for tracking";
2022  ot->idname = "CLIP_OT_tracking_object_remove";
2023 
2024  /* api callbacks */
2027 
2028  /* flags */
2030 }
2031 
2034 /* -------------------------------------------------------------------- */
2039 {
2040  SpaceClip *sc = CTX_wm_space_clip(C);
2041  MovieClip *clip = ED_space_clip_get_clip(sc);
2042  MovieTracking *tracking = &clip->tracking;
2044 
2046 
2047  BKE_tracking_clipboard_copy_tracks(tracking, object);
2048 
2049  return OPERATOR_FINISHED;
2050 }
2051 
2053 {
2054  /* identifiers */
2055  ot->name = "Copy Tracks";
2056  ot->description = "Copy selected tracks to clipboard";
2057  ot->idname = "CLIP_OT_copy_tracks";
2058 
2059  /* api callbacks */
2062 
2063  /* flags */
2064  ot->flag = OPTYPE_REGISTER;
2065 }
2066 
2069 /* -------------------------------------------------------------------- */
2074 {
2077  }
2078 
2079  return 0;
2080 }
2081 
2083 {
2084  SpaceClip *sc = CTX_wm_space_clip(C);
2085  MovieClip *clip = ED_space_clip_get_clip(sc);
2086  MovieTracking *tracking = &clip->tracking;
2088  ListBase *tracks_base = BKE_tracking_object_get_tracks(tracking, object);
2089 
2090  BKE_tracking_tracks_deselect_all(tracks_base);
2091  BKE_tracking_clipboard_paste_tracks(tracking, object);
2092 
2094 
2095  return OPERATOR_FINISHED;
2096 }
2097 
2099 {
2100  /* identifiers */
2101  ot->name = "Paste Tracks";
2102  ot->description = "Paste tracks from clipboard";
2103  ot->idname = "CLIP_OT_paste_tracks";
2104 
2105  /* api callbacks */
2108 
2109  /* flags */
2111 }
2112 
2115 /* -------------------------------------------------------------------- */
2119 static void keyframe_set_flag(bContext *C, bool set)
2120 {
2121  SpaceClip *sc = CTX_wm_space_clip(C);
2122  MovieClip *clip = ED_space_clip_get_clip(sc);
2123  MovieTracking *tracking = &clip->tracking;
2124  int framenr = ED_space_clip_get_clip_frame_number(sc);
2125 
2126  ListBase *tracks_base = BKE_tracking_get_active_tracks(tracking);
2127  for (MovieTrackingTrack *track = tracks_base->first; track != NULL; track = track->next) {
2128  if (TRACK_VIEW_SELECTED(sc, track)) {
2129  if (set) {
2130  MovieTrackingMarker *marker = BKE_tracking_marker_ensure(track, framenr);
2131  marker->flag &= ~MARKER_TRACKED;
2132  }
2133  else {
2134  MovieTrackingMarker *marker = BKE_tracking_marker_get_exact(track, framenr);
2135  if (marker != NULL) {
2136  marker->flag |= MARKER_TRACKED;
2137  }
2138  }
2139  }
2140  }
2141 
2142  ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
2143  for (MovieTrackingPlaneTrack *plane_track = plane_tracks_base->first; plane_track != NULL;
2144  plane_track = plane_track->next) {
2145  if (PLANE_TRACK_VIEW_SELECTED(plane_track)) {
2146  if (set) {
2147  MovieTrackingPlaneMarker *plane_marker = BKE_tracking_plane_marker_ensure(plane_track,
2148  framenr);
2149  if (plane_marker->flag & PLANE_MARKER_TRACKED) {
2150  plane_marker->flag &= ~PLANE_MARKER_TRACKED;
2151  BKE_tracking_track_plane_from_existing_motion(plane_track, plane_marker->framenr);
2152  }
2153  }
2154  else {
2156  framenr);
2157  if (plane_marker) {
2158  if ((plane_marker->flag & PLANE_MARKER_TRACKED) == 0) {
2159  plane_marker->flag |= PLANE_MARKER_TRACKED;
2161  plane_marker->framenr);
2162  }
2163  }
2164  }
2165  }
2166  }
2167 
2169 }
2170 
2172 {
2173  keyframe_set_flag(C, true);
2174  return OPERATOR_FINISHED;
2175 }
2176 
2178 {
2179  /* identifiers */
2180  ot->name = "Insert Keyframe";
2181  ot->description = "Insert a keyframe to selected tracks at current frame";
2182  ot->idname = "CLIP_OT_keyframe_insert";
2183 
2184  /* api callbacks */
2187 
2188  /* flags */
2190 }
2191 
2194 /* -------------------------------------------------------------------- */
2199 {
2200  keyframe_set_flag(C, false);
2201  return OPERATOR_FINISHED;
2202 }
2203 
2205 {
2206  /* identifiers */
2207  ot->name = "Delete Keyframe";
2208  ot->description = "Delete a keyframe from selected tracks at current frame";
2209  ot->idname = "CLIP_OT_keyframe_delete";
2210 
2211  /* api callbacks */
2214 
2215  /* flags */
2217 }
2218 
2221 /* -------------------------------------------------------------------- */
2226 {
2227  SpaceClip *space_clip = CTX_wm_space_clip(C);
2228  const int clip_frame_number = ED_space_clip_get_clip_frame_number(space_clip);
2229 
2230  MovieClip *clip = ED_space_clip_get_clip(space_clip);
2231 
2232  MovieTracking *tracking = &clip->tracking;
2233  MovieTrackingPlaneTrack *plane_track = tracking->act_plane_track;
2234  const MovieTrackingPlaneMarker *plane_marker = BKE_tracking_plane_marker_get(plane_track,
2235  clip_frame_number);
2236 
2237  ImBuf *frame_ibuf = ED_space_clip_get_buffer(space_clip);
2238  if (frame_ibuf == NULL) {
2239  return NULL;
2240  }
2241 
2242  ImBuf *plane_ibuf = BKE_tracking_get_plane_imbuf(frame_ibuf, plane_marker);
2243 
2244  IMB_freeImBuf(frame_ibuf);
2245 
2246  return plane_ibuf;
2247 }
2248 
2250 {
2252  return false;
2253  }
2254 
2255  SpaceClip *space_clip = CTX_wm_space_clip(C);
2256  MovieClip *clip = ED_space_clip_get_clip(space_clip);
2257  const MovieTracking *tracking = &clip->tracking;
2258 
2259  if (tracking->act_plane_track == NULL) {
2260  return false;
2261  }
2262 
2263  return true;
2264 }
2265 
2267 {
2268  SpaceClip *space_clip = CTX_wm_space_clip(C);
2269  MovieClip *clip = ED_space_clip_get_clip(space_clip);
2270  MovieTracking *tracking = &clip->tracking;
2271  MovieTrackingPlaneTrack *plane_track = tracking->act_plane_track;
2272 
2274  if (plane_ibuf == NULL) {
2275  return OPERATOR_CANCELLED;
2276  }
2277 
2278  plane_track->image = BKE_image_add_from_imbuf(CTX_data_main(C), plane_ibuf, plane_track->name);
2279 
2280  IMB_freeImBuf(plane_ibuf);
2281 
2283 
2284  return OPERATOR_FINISHED;
2285 }
2286 
2288 {
2289  /* identifiers */
2290  ot->name = "New Image from Plane Marker";
2291  ot->description = "Create new image from the content of the plane marker";
2292  ot->idname = "CLIP_OT_new_image_from_plane_marker";
2293 
2294  /* api callbacks */
2297 
2298  /* flags */
2300 }
2301 
2303 {
2305  return false;
2306  }
2307 
2308  SpaceClip *space_clip = CTX_wm_space_clip(C);
2309  MovieClip *clip = ED_space_clip_get_clip(space_clip);
2310  const MovieTracking *tracking = &clip->tracking;
2311 
2312  if (tracking->act_plane_track == NULL || tracking->act_plane_track->image == NULL) {
2313  return false;
2314  }
2315 
2316  const Image *image = tracking->act_plane_track->image;
2317  return image->type == IMA_TYPE_IMAGE && ELEM(image->source, IMA_SRC_FILE, IMA_SRC_GENERATED);
2318 }
2319 
2321 {
2322  SpaceClip *space_clip = CTX_wm_space_clip(C);
2323  MovieClip *clip = ED_space_clip_get_clip(space_clip);
2324  MovieTracking *tracking = &clip->tracking;
2325  MovieTrackingPlaneTrack *plane_track = tracking->act_plane_track;
2326 
2328  if (plane_ibuf == NULL) {
2329  return OPERATOR_CANCELLED;
2330  }
2331 
2332  BKE_image_replace_imbuf(plane_track->image, plane_ibuf);
2333 
2334  IMB_freeImBuf(plane_ibuf);
2335 
2337  WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, plane_track->image);
2338 
2340 
2341  return OPERATOR_FINISHED;
2342 }
2343 
2345 {
2346  /* identifiers */
2347  ot->name = "Update Image from Plane Marker";
2348  ot->description =
2349  "Update current image used by plane marker from the content of the plane marker";
2350  ot->idname = "CLIP_OT_update_image_from_plane_marker";
2351 
2352  /* api callbacks */
2355 
2356  /* flags */
2358 }
2359 
typedef float(TangentPoint)[2]
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct SpaceClip * CTX_wm_space_clip(const bContext *C)
Definition: context.c:923
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
void BKE_image_replace_imbuf(struct Image *image, struct ImBuf *ibuf)
void BKE_image_partial_update_mark_full_update(struct Image *image)
Mark the whole image to be updated.
struct Image * BKE_image_add_from_imbuf(struct Main *bmain, struct ImBuf *ibuf, const char *name)
float BKE_movieclip_remap_scene_to_clip_frame(const struct MovieClip *clip, float framenr)
void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, int *width, int *height)
Definition: movieclip.c:1520
float BKE_movieclip_remap_clip_to_scene_frame(const struct MovieClip *clip, float framenr)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
void BKE_tracking_track_path_clear(struct MovieTrackingTrack *track, int ref_frame, eTrackClearAction action)
Definition: tracking.c:789
void BKE_tracking_plane_track_free(struct MovieTrackingPlaneTrack *plane_track)
Definition: tracking.c:1694
void BKE_tracking_plane_track_replace_point_track(struct MovieTrackingPlaneTrack *plane_track, struct MovieTrackingTrack *old_track, struct MovieTrackingTrack *new_track)
Definition: tracking.c:1790
struct MovieTrackingPlaneTrack * BKE_tracking_plane_track_get_active(struct MovieTracking *tracking)
Definition: tracking.c:1718
struct MovieTrackingPlaneMarker * BKE_tracking_plane_marker_ensure(struct MovieTrackingPlaneTrack *plane_track, int framenr)
Definition: tracking.c:1950
void BKE_tracking_plane_marker_delete(struct MovieTrackingPlaneTrack *plane_track, int framenr)
Definition: tracking.c:1859
void BKE_tracking_clipboard_paste_tracks(struct MovieTracking *tracking, struct MovieTrackingObject *object)
Definition: tracking.c:489
bool BKE_tracking_object_delete(struct MovieTracking *tracking, struct MovieTrackingObject *object)
Definition: tracking.c:2027
struct ListBase * BKE_tracking_get_active_tracks(struct MovieTracking *tracking)
Definition: tracking.c:346
void BKE_tracking_retrack_plane_from_existing_motion_at_segment(struct MovieTrackingPlaneTrack *plane_track, int start_frame)
#define PLANE_TRACK_VIEW_SELECTED(plane_track)
Definition: BKE_tracking.h:837
void BKE_tracking_tracks_average(struct MovieTrackingTrack *dst_track, struct MovieTrackingTrack **src_tracks, int num_src_tracks)
Definition: tracking.c:1026
struct MovieTrackingObject * BKE_tracking_object_add(struct MovieTracking *tracking, const char *name)
Definition: tracking.c:1998
void BKE_tracking_plane_tracks_deselect_all(struct ListBase *plane_tracks_base)
Definition: tracking.c:1734
struct MovieReconstructedCamera * BKE_tracking_camera_get_reconstructed(struct MovieTracking *tracking, struct MovieTrackingObject *object, int framenr)
Definition: tracking.c:2252
@ TRACK_AREA_POINT
Definition: BKE_tracking.h:38
@ TRACK_AREA_ALL
Definition: BKE_tracking.h:43
@ TRACK_AREA_PAT
Definition: BKE_tracking.h:39
@ TRACK_AREA_SEARCH
Definition: BKE_tracking.h:40
void BKE_tracking_track_flag_set(struct MovieTrackingTrack *track, int area, int flag)
Definition: tracking.c:688
struct MovieTrackingMarker * BKE_tracking_marker_ensure(struct MovieTrackingTrack *track, int framenr)
Definition: tracking.c:1468
void BKE_tracking_tracks_join(struct MovieTracking *tracking, struct MovieTrackingTrack *dst_track, struct MovieTrackingTrack *src_track)
Definition: tracking.c:806
void BKE_tracking_marker_clamp_search_position(struct MovieTrackingMarker *marker)
Definition: tracking.c:1404
struct MovieTrackingPlaneMarker * BKE_tracking_plane_marker_get(struct MovieTrackingPlaneTrack *plane_track, int framenr)
Definition: tracking.c:1890
struct MovieTrackingTrack * BKE_tracking_track_get_active(struct MovieTracking *tracking)
Definition: tracking.c:1089
void BKE_tracking_dopesheet_tag_update(struct MovieTracking *tracking)
Definition: tracking.c:3411
struct MovieTrackingMarker * BKE_tracking_marker_get_exact(struct MovieTrackingTrack *track, int framenr)
Definition: tracking.c:1457
void BKE_tracking_track_free(struct MovieTrackingTrack *track)
Definition: tracking.c:606
struct ImBuf * BKE_tracking_get_plane_imbuf(const struct ImBuf *frame_ibuf, const struct MovieTrackingPlaneMarker *plane_marker)
void BKE_tracking_track_plane_from_existing_motion(struct MovieTrackingPlaneTrack *plane_track, int start_frame)
void BKE_tracking_tracks_deselect_all(struct ListBase *tracksbase)
Definition: tracking.c:1289
void BKE_tracking_track_select(struct ListBase *tracksbase, struct MovieTrackingTrack *track, int area, bool extend)
Definition: tracking.c:1257
eTrackClearAction
Definition: BKE_tracking.h:231
@ TRACK_CLEAR_ALL
Definition: BKE_tracking.h:237
@ TRACK_CLEAR_REMAINED
Definition: BKE_tracking.h:235
@ TRACK_CLEAR_UPTO
Definition: BKE_tracking.h:233
struct ListBase * BKE_tracking_get_active_plane_tracks(struct MovieTracking *tracking)
Definition: tracking.c:357
struct MovieTrackingTrack * BKE_tracking_track_add_empty(struct MovieTracking *tracking, struct ListBase *tracks_list)
Definition: tracking.c:511
struct MovieTrackingPlaneMarker * BKE_tracking_plane_marker_get_exact(struct MovieTrackingPlaneTrack *plane_track, int framenr)
Definition: tracking.c:1938
void BKE_tracking_clipboard_copy_tracks(struct MovieTracking *tracking, struct MovieTrackingObject *object)
Definition: tracking.c:464
void BKE_tracking_marker_clamp_search_size(struct MovieTrackingMarker *marker)
Definition: tracking.c:1393
#define TRACK_VIEW_SELECTED(sc, track)
Definition: BKE_tracking.h:831
int BKE_tracking_count_selected_tracks_in_active_object(struct MovieTracking *tracking)
Definition: tracking.c:650
struct ListBase * BKE_tracking_object_get_tracks(struct MovieTracking *tracking, struct MovieTrackingObject *object)
Definition: tracking.c:2112
bool BKE_tracking_clipboard_has_tracks(void)
Definition: tracking.c:484
bool BKE_tracking_plane_track_has_point_track(struct MovieTrackingPlaneTrack *plane_track, struct MovieTrackingTrack *track)
Definition: tracking.c:1741
struct MovieTrackingTrack * BKE_tracking_track_add(struct MovieTracking *tracking, struct ListBase *tracksbase, float x, float y, int framenr, int width, int height)
Definition: tracking.c:535
struct MovieTrackingMarker * BKE_tracking_marker_get(struct MovieTrackingTrack *track, int framenr)
Definition: tracking.c:1424
struct MovieTrackingTrack ** BKE_tracking_selected_tracks_in_active_object(struct MovieTracking *tracking, int *r_num_tracks)
Definition: tracking.c:656
struct MovieTrackingObject * BKE_tracking_object_get_active(struct MovieTracking *tracking)
Definition: tracking.c:2092
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define ATTR_FALLTHROUGH
struct GSet GSet
Definition: BLI_ghash.h:340
GSet * BLI_gset_ptr_new(const char *info)
void BLI_gset_insert(GSet *gs, void *key)
Definition: BLI_ghash.c:962
#define GSET_ITER(gs_iter_, gset_)
Definition: BLI_ghash.h:471
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
Definition: BLI_ghash.c:1037
BLI_INLINE void * BLI_gsetIterator_getKey(GSetIterator *gsi)
Definition: BLI_ghash.h:458
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:239
MINLINE float square_f(float a)
int isect_point_quad_v2(const float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2])
Definition: math_geom.c:1536
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v2_v2(float r[2], const float a[2])
float angle_signed_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
Definition: math_vector.c:439
MINLINE float cross_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
#define UNUSED(x)
#define ELEM(...)
#define TIP_(msgid)
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:834
@ ID_RECALC_FRAME_CHANGE
Definition: DNA_ID.h:841
@ IMA_SRC_FILE
@ IMA_SRC_GENERATED
@ IMA_TYPE_IMAGE
@ SC_SHOW_MARKER_SEARCH
@ SC_SHOW_MARKER_PATTERN
@ PLANE_MARKER_TRACKED
@ TRACKING_CLEAN_DELETE_SEGMENT
@ TRACKING_CLEAN_SELECT
@ TRACKING_CLEAN_DELETE_TRACK
@ TRACKING_OBJECT_CAMERA
@ TRACKING_RECONSTRUCTED
@ PLANE_TRACK_HIDDEN
@ PLANE_TRACK_AUTOKEY
@ MARKER_TRACKED
@ MARKER_DISABLED
@ TRACK_CUSTOMCOLOR
@ TRACK_HIDDEN
@ TRACK_LOCKED
@ TRACK_USE_2D_STAB
@ TRACK_HAS_BUNDLE
@ TRACK_USE_2D_STAB_ROT
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
int ED_space_clip_get_clip_frame_number(struct SpaceClip *sc)
Definition: clip_editor.c:231
void ED_clip_view_lock_state_restore_no_jump(const struct bContext *C, const ClipViewLockState *state)
struct ImBuf * ED_space_clip_get_buffer(struct SpaceClip *sc)
Definition: clip_editor.c:239
void ED_space_clip_get_size(struct SpaceClip *sc, int *width, int *height)
Definition: clip_editor.c:146
void ED_clip_mouse_pos(struct SpaceClip *sc, struct ARegion *region, const int mval[2], float co[2])
Definition: clip_editor.c:541
bool ED_space_clip_tracking_poll(struct bContext *C)
Definition: clip_editor.c:83
void ED_clip_point_stable_pos(struct SpaceClip *sc, struct ARegion *region, float x, float y, float *xr, float *yr)
Definition: clip_editor.c:483
struct MovieClip * ED_space_clip_get_clip(struct SpaceClip *sc)
Definition: clip_editor.c:570
void ED_clip_view_lock_state_store(const struct bContext *C, ClipViewLockState *state)
void ED_workspace_status_text(struct bContext *C, const char *str)
Definition: area.c:816
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
@ PROP_SKIP_SAVE
Definition: RNA_types.h:218
#define C
Definition: RandGen.cpp:25
@ KM_PRESS
Definition: WM_types.h:267
@ KM_RELEASE
Definition: WM_types.h:268
@ OPTYPE_BLOCKING
Definition: WM_types.h:150
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_GRAB_CURSOR_XY
Definition: WM_types.h:154
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define NC_GEOM
Definition: WM_types.h:343
#define NA_EVALUATED
Definition: WM_types.h:524
#define ND_DISPLAY
Definition: WM_types.h:439
#define NC_MOVIECLIP
Definition: WM_types.h:347
#define NC_SCENE
Definition: WM_types.h:328
#define NA_EDITED
Definition: WM_types.h:523
#define NC_IMAGE
Definition: WM_types.h:334
#define ND_FRAME
Definition: WM_types.h:382
#define ND_SELECT
Definition: WM_types.h:455
#define ND_TRANSFORM
Definition: WM_types.h:405
#define NC_OBJECT
Definition: WM_types.h:329
volatile int lock
ATTR_WARN_UNUSED_RESULT const BMVert * v2
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
void clip_delete_marker(struct bContext *C, struct MovieClip *clip, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker)
Definition: clip_utils.c:350
void clip_delete_track(struct bContext *C, struct MovieClip *clip, struct MovieTrackingTrack *track)
Definition: clip_utils.c:311
void clip_delete_plane_track(struct bContext *C, struct MovieClip *clip, struct MovieTrackingPlaneTrack *plane_track)
Definition: clip_utils.c:365
#define sinf(x)
Definition: cuda/compat.h:102
#define cosf(x)
Definition: cuda/compat.h:101
#define SELECT
Scene scene
int len
Definition: draw_manager.c:108
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
uint pos
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
const vector< Marker > & markers
int count
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
static ulong * next
static void error(const char *str)
Definition: meshlaplacian.c:51
#define fabsf(x)
Definition: metal/compat.h:219
static unsigned a[3]
Definition: RandGen.cpp:78
static void area(int d1, int d2, int e1, int e2, float weights[2])
T distance_squared(const vec_base< T, Size > &a, const vec_base< T, Size > &b)
vec_base< T, 3 > cross(const vec_base< T, 3 > &a, const vec_base< T, 3 > &b)
SymEdge< T > * prev(const SymEdge< T > *se)
Definition: delaunay_2d.cc:105
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:5271
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:4921
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
Definition: rna_access.c:4980
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
Definition: rna_access.c:2180
float RNA_float_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4957
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
Definition: rna_access.c:4968
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:5301
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:5015
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
Definition: rna_access.c:4992
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3836
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3493
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3862
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
#define min(a, b)
Definition: sort.c:35
void * first
Definition: DNA_listBase.h:31
struct MovieTracking tracking
MovieTrackingMarker * markers
MovieTrackingReconstruction reconstruction
MovieTrackingPlaneTrack * act_plane_track
MovieTrackingTrack * act_track
MovieTrackingStabilization stabilization
MovieTrackingCamera camera
MovieTrackingSettings settings
struct RenderData r
MovieTrackingTrack * track
Definition: tracking_ops.c:355
MovieTrackingMarker * marker
Definition: tracking_ops.c:356
eSlideAction action
Definition: tracking_ops.c:354
struct MovieClipUser user
struct MovieClip * clip
int ymin
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
short val
Definition: WM_types.h:680
int xy[2]
Definition: WM_types.h:682
int mval[2]
Definition: WM_types.h:684
short type
Definition: WM_types.h:678
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:935
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
struct StructRNA * srna
Definition: WM_types.h:969
const char * description
Definition: WM_types.h:893
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
struct ReportList * reports
struct PointerRNA * ptr
void CLIP_OT_paste_tracks(wmOperatorType *ot)
static int disable_markers_exec(bContext *C, wmOperator *op)
void CLIP_OT_delete_marker(wmOperatorType *ot)
Definition: tracking_ops.c:321
static bool update_image_from_plane_marker_poll(bContext *C)
static float mouse_to_offset_distance_squared(const MovieTrackingTrack *track, const MovieTrackingMarker *marker, const float co[2], int width, int height)
Definition: tracking_ops.c:480
static int frame_jump_exec(bContext *C, wmOperator *op)
static int tracking_object_remove_exec(bContext *C, wmOperator *op)
static bool add_marker(const bContext *C, float x, float y)
Definition: tracking_ops.c:47
static bool slide_check_corners(float(*corners)[2])
Definition: tracking_ops.c:501
static int hide_tracks_exec(bContext *C, wmOperator *op)
void CLIP_OT_track_copy_color(wmOperatorType *ot)
static float mouse_to_slide_zone_distance_squared(const float co[2], const float slide_zone[2], int width, int height)
Definition: tracking_ops.c:439
void CLIP_OT_hide_tracks_clear(wmOperatorType *ot)
void CLIP_OT_keyframe_delete(wmOperatorType *ot)
void CLIP_OT_set_center_principal(wmOperatorType *ot)
static int add_marker_at_click_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
Definition: tracking_ops.c:156
static float mouse_to_closest_pattern_corner_distance_squared(const MovieTrackingMarker *marker, const float co[2], int width, int height, int *r_corner)
Definition: tracking_ops.c:464
static int join_tracks_exec(bContext *C, wmOperator *op)
static int keyframe_delete_exec(bContext *C, wmOperator *UNUSED(op))
static bool frame_jump_poll(bContext *C)
static int slide_marker_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: tracking_ops.c:679
static SlideMarkerData * create_slide_marker_data(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, const wmEvent *event, int area, int corner, eSlideAction action, int width, int height)
Definition: tracking_ops.c:383
static bool new_image_from_plane_marker_poll(bContext *C)
void CLIP_OT_hide_tracks(wmOperatorType *ot)
static void free_slide_data(SlideMarkerData *data)
Definition: tracking_ops.c:739
static float mouse_to_search_corner_distance_squared(const MovieTrackingMarker *marker, const float co[2], int corner, int width, int height)
Definition: tracking_ops.c:449
void CLIP_OT_set_solver_keyframe(wmOperatorType *ot)
static MovieTrackingTrack * tracking_marker_check_slide(bContext *C, const float co[2], int *r_area, eSlideAction *r_action, int *r_corner)
Definition: tracking_ops.c:534
void CLIP_OT_lock_tracks(wmOperatorType *ot)
static ImBuf * sample_plane_marker_image_for_operator(bContext *C)
static void * slide_marker_customdata(bContext *C, const wmEvent *event)
Definition: tracking_ops.c:648
static void keyframe_set_flag(bContext *C, bool set)
void CLIP_OT_average_tracks(wmOperatorType *ot)
static int mouse_to_tilt_distance_squared(const MovieTrackingMarker *marker, const float co[2], int width, int height)
Definition: tracking_ops.c:491
static int track_copy_color_exec(bContext *C, wmOperator *UNUSED(op))
static int new_image_from_plane_marker_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_tracking_object_new(wmOperatorType *ot)
void CLIP_OT_keyframe_insert(wmOperatorType *ot)
static int clean_tracks_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
void CLIP_OT_copy_tracks(wmOperatorType *ot)
static void apply_mouse_slide(bContext *C, SlideMarkerData *data)
Definition: tracking_ops.c:719
static int average_tracks_exec(bContext *C, wmOperator *op)
@ TRACK_ACTION_TOGGLE
@ TRACK_ACTION_UNLOCK
@ TRACK_ACTION_LOCK
static void cancel_mouse_slide(SlideMarkerData *data)
Definition: tracking_ops.c:703
void CLIP_OT_slide_marker(wmOperatorType *ot)
Definition: tracking_ops.c:914
@ MARKER_OP_TOGGLE
@ MARKER_OP_DISABLE
@ MARKER_OP_ENABLE
static int add_marker_exec(bContext *C, wmOperator *op)
Definition: tracking_ops.c:75
void CLIP_OT_add_marker_at_click(wmOperatorType *ot)
Definition: tracking_ops.c:193
static int clear_track_path_exec(bContext *C, wmOperator *op)
Definition: tracking_ops.c:948
void CLIP_OT_clean_tracks(wmOperatorType *ot)
static int add_marker_at_click_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
Definition: tracking_ops.c:146
void CLIP_OT_join_tracks(wmOperatorType *ot)
@ SOLVER_KEYFRAME_B
@ SOLVER_KEYFRAME_A
static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: tracking_ops.c:747
static int lock_tracks_exec(bContext *C, wmOperator *op)
static int set_center_principal_exec(bContext *C, wmOperator *UNUSED(op))
void CLIP_OT_delete_track(wmOperatorType *ot)
Definition: tracking_ops.c:250
void CLIP_OT_add_marker(wmOperatorType *ot)
Definition: tracking_ops.c:112
static int set_solver_keyframe_exec(bContext *C, wmOperator *op)
static bool paste_tracks_poll(bContext *C)
static int tracking_object_new_exec(bContext *C, wmOperator *UNUSED(op))
static int delete_track_exec(bContext *C, wmOperator *UNUSED(op))
Definition: tracking_ops.c:215
static int add_marker_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: tracking_ops.c:97
void CLIP_OT_update_image_from_plane_marker(wmOperatorType *ot)
static int paste_tracks_exec(bContext *C, wmOperator *UNUSED(op))
static int average_tracks_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static int clean_tracks_exec(bContext *C, wmOperator *op)
static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op))
Definition: tracking_ops.c:272
void CLIP_OT_tracking_object_remove(wmOperatorType *ot)
void CLIP_OT_disable_markers(wmOperatorType *ot)
static int copy_tracks_exec(bContext *C, wmOperator *UNUSED(op))
static int update_image_from_plane_marker_exec(bContext *C, wmOperator *UNUSED(op))
static void slide_marker_tilt_slider(const float marker_pos[2], const float pattern_corners[4][2], float r_slider[2])
Definition: tracking_ops.c:375
static int keyframe_insert_exec(bContext *C, wmOperator *UNUSED(op))
struct MovieTrackingTrack * tracking_find_slidable_track_in_proximity(struct bContext *C, const float co[2])
Definition: tracking_ops.c:642
eSlideAction
Definition: tracking_ops.c:343
@ SLIDE_ACTION_NONE
Definition: tracking_ops.c:344
@ SLIDE_ACTION_TILT_SIZE
Definition: tracking_ops.c:349
@ SLIDE_ACTION_POS
Definition: tracking_ops.c:346
@ SLIDE_ACTION_OFFSET
Definition: tracking_ops.c:348
@ SLIDE_ACTION_SIZE
Definition: tracking_ops.c:347
static int hide_tracks_clear_exec(bContext *C, wmOperator *UNUSED(op))
static bool is_track_clean(MovieTrackingTrack *track, int frames, int del)
void CLIP_OT_new_image_from_plane_marker(wmOperatorType *ot)
void CLIP_OT_clear_track_path(wmOperatorType *ot)
Definition: tracking_ops.c:978
static void slide_marker_tilt_slider_relative(const float pattern_corners[4][2], float r_slider[2])
Definition: tracking_ops.c:370
void CLIP_OT_frame_jump(wmOperatorType *ot)
void clip_tracking_hide_cursor(struct bContext *C)
void clip_tracking_show_cursor(struct bContext *C)
void clip_tracking_clear_invisible_track_selection(struct SpaceClip *sc, struct MovieClip *clip)
float max
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
@ EVT_RIGHTCTRLKEY
@ EVT_LEFTCTRLKEY
@ MOUSEMOVE
@ LEFTMOUSE
@ EVT_ESCKEY
@ EVT_RIGHTSHIFTKEY
@ EVT_LEFTSHIFTKEY
wmOperatorType * ot
Definition: wm_files.c:3479
int WM_operator_confirm(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))