Blender  V2.93
clip_utils.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2011 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include "DNA_scene_types.h"
25 
26 #include "MEM_guardedalloc.h"
27 
28 #include "BLI_listbase.h"
29 #include "BLI_math.h"
30 #include "BLI_rect.h"
31 #include "BLI_utildefines.h"
32 
33 #include "BKE_animsys.h"
34 #include "BKE_context.h"
35 #include "BKE_mask.h"
36 #include "BKE_movieclip.h"
37 #include "BKE_tracking.h"
38 
39 #include "DEG_depsgraph.h"
40 #include "DEG_depsgraph_build.h"
41 
42 #include "GPU_immediate.h"
43 #include "GPU_state.h"
44 
45 #include "WM_api.h"
46 #include "WM_types.h"
47 
48 #include "ED_clip.h"
49 #include "ED_mask.h"
50 #include "ED_screen.h"
51 
52 #include "UI_interface.h"
53 #include "UI_resources.h"
54 #include "UI_view2d.h"
55 
56 #include "clip_intern.h" /* own include */
57 
59 {
61  if ((sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) == 0) {
62  return false;
63  }
64  }
65  else if (value_source == CLIP_VALUE_SOURCE_REPROJECTION_ERROR) {
66  if ((sc->flag & SC_SHOW_GRAPH_TRACKS_ERROR) == 0) {
67  return false;
68  }
69  }
70  return true;
71 }
72 
74  SpaceClip *sc,
75  MovieTrackingTrack *track,
76  void *userdata,
80 {
82  int width, height, coord;
83 
84  BKE_movieclip_get_size(clip, &sc->user, &width, &height);
85 
86  for (coord = 0; coord < 2; coord++) {
87  eClipCurveValueSource value_source = (coord == 0) ? CLIP_VALUE_SOURCE_SPEED_X :
89  int i, prevfra = track->markers[0].framenr;
90  bool open = false;
91  float prevval = 0.0f;
92 
93  for (i = 0; i < track->markersnr; i++) {
94  MovieTrackingMarker *marker = &track->markers[i];
95  float val;
96 
97  if (marker->flag & MARKER_DISABLED) {
98  if (open) {
99  if (segment_end) {
100  segment_end(userdata, value_source);
101  }
102 
103  open = false;
104  }
105 
106  continue;
107  }
108 
109  if (!open) {
110  if (segment_start) {
111  if ((i + 1) == track->markersnr) {
112  segment_start(userdata, track, value_source, true);
113  }
114  else {
115  segment_start(
116  userdata, track, value_source, (track->markers[i + 1].flag & MARKER_DISABLED));
117  }
118  }
119 
120  open = true;
121  prevval = marker->pos[coord];
122  }
123 
124  /* value is a pixels per frame speed */
125  val = (marker->pos[coord] - prevval) * ((coord == 0) ? (width) : (height));
126  val /= marker->framenr - prevfra;
127 
128  if (func) {
129  int scene_framenr = BKE_movieclip_remap_clip_to_scene_frame(clip, marker->framenr);
130 
131  func(userdata, track, marker, value_source, scene_framenr, val);
132  }
133 
134  prevval = marker->pos[coord];
135  prevfra = marker->framenr;
136  }
137 
138  if (open) {
139  if (segment_end) {
140  segment_end(userdata, value_source);
141  }
142  }
143  }
144 }
145 
147  MovieTracking *tracking,
148  MovieTrackingObject *tracking_object,
149  MovieTrackingTrack *track,
150  MovieTrackingMarker *marker,
151  const int clip_width,
152  const int clip_height,
153  const int scene_framenr)
154 {
155  float reprojected_position[4], bundle_position[4], marker_position[2], delta[2];
156  float weight = BKE_tracking_track_get_weight_for_marker(clip, track, marker);
157  const float aspy = 1.0f / tracking->camera.pixel_aspect;
158 
159  float projection_matrix[4][4];
161  tracking, tracking_object, scene_framenr, clip_width, clip_height, projection_matrix);
162 
163  copy_v3_v3(bundle_position, track->bundle_pos);
164  bundle_position[3] = 1;
165 
166  mul_v4_m4v4(reprojected_position, projection_matrix, bundle_position);
167  reprojected_position[0] = (reprojected_position[0] / (reprojected_position[3] * 2.0f) + 0.5f) *
168  clip_width;
169  reprojected_position[1] = (reprojected_position[1] / (reprojected_position[3] * 2.0f) + 0.5f) *
170  clip_height * aspy;
171 
173  tracking, clip_width, clip_height, reprojected_position, reprojected_position);
174 
175  marker_position[0] = (marker->pos[0] + track->offset[0]) * clip_width;
176  marker_position[1] = (marker->pos[1] + track->offset[1]) * clip_height * aspy;
177 
178  sub_v2_v2v2(delta, reprojected_position, marker_position);
179  return len_v2(delta) * weight;
180 }
181 
183  SpaceClip *sc,
184  MovieTrackingTrack *track,
185  void *userdata,
189 {
190  /* Tracks without bundle can not have any reprojection error curve. */
191  if ((track->flag & TRACK_HAS_BUNDLE) == 0) {
192  return;
193  }
194 
195  MovieClip *clip = ED_space_clip_get_clip(sc);
196  MovieTracking *tracking = &clip->tracking;
197  MovieTrackingObject *tracking_object = BKE_tracking_object_get_active(tracking);
198 
199  int clip_width, clip_height;
200  BKE_movieclip_get_size(clip, &sc->user, &clip_width, &clip_height);
201 
202  /* Iterate over segments. */
203  bool is_segment_open = false;
204  for (int marker_index = 0; marker_index < track->markersnr; marker_index++) {
205  MovieTrackingMarker *marker = &track->markers[marker_index];
206 
207  /* End of tracked segment, no reprojection error can be calculated here since the ground truth
208  * 2D position is not known. */
209  if (marker->flag & MARKER_DISABLED) {
210  if (is_segment_open) {
211  if (segment_end != NULL) {
212  segment_end(userdata, CLIP_VALUE_SOURCE_REPROJECTION_ERROR);
213  }
214  is_segment_open = false;
215  }
216  continue;
217  }
218 
219  /* Begin new segment if it is not open yet. */
220  if (!is_segment_open) {
221  if (segment_start != NULL) {
222  if ((marker_index + 1) == track->markersnr) {
223  segment_start(userdata, track, CLIP_VALUE_SOURCE_REPROJECTION_ERROR, true);
224  }
225  else {
226  segment_start(userdata,
227  track,
229  (track->markers[marker_index + 1].flag & MARKER_DISABLED));
230  }
231  }
232  is_segment_open = true;
233  }
234 
235  if (func != NULL) {
236  const int scene_framenr = BKE_movieclip_remap_clip_to_scene_frame(clip, marker->framenr);
237  const float reprojection_error = calculate_reprojection_error_at_marker(
238  clip, tracking, tracking_object, track, marker, clip_width, clip_height, scene_framenr);
239  func(userdata,
240  track,
241  marker,
243  scene_framenr,
244  reprojection_error);
245  }
246  }
247 
248  if (is_segment_open && segment_end != NULL) {
249  segment_end(userdata, CLIP_VALUE_SOURCE_REPROJECTION_ERROR);
250  }
251 }
252 
254  MovieTrackingTrack *track,
255  void *userdata,
259 {
261  sc, track, userdata, func, segment_start, segment_end);
262 
264  sc, track, userdata, func, segment_start, segment_end);
265 }
266 
268  bool selected_only,
269  bool include_hidden,
270  void *userdata,
274 {
275  MovieClip *clip = ED_space_clip_get_clip(sc);
276  MovieTracking *tracking = &clip->tracking;
277  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
278  MovieTrackingTrack *track;
279 
280  for (track = tracksbase->first; track; track = track->next) {
281  if (!include_hidden && (track->flag & TRACK_HIDDEN) != 0) {
282  continue;
283  }
284 
285  if (selected_only && !TRACK_SELECTED(track)) {
286  continue;
287  }
288 
290  sc, track, userdata, func, segment_start, segment_end);
291  }
292 }
293 
295  bool selected_only,
296  bool include_hidden,
297  void *userdata,
298  void (*func)(void *userdata, MovieTrackingMarker *marker))
299 {
300  MovieClip *clip = ED_space_clip_get_clip(sc);
301  MovieTracking *tracking = &clip->tracking;
302  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
303 
304  LISTBASE_FOREACH (MovieTrackingTrack *, track, tracksbase) {
305  if (!include_hidden && (track->flag & TRACK_HIDDEN) != 0) {
306  continue;
307  }
308 
309  if (selected_only && !TRACK_SELECTED(track)) {
310  continue;
311  }
312 
313  for (int i = 0; i < track->markersnr; i++) {
314  MovieTrackingMarker *marker = &track->markers[i];
315 
316  if (marker->flag & MARKER_DISABLED) {
317  continue;
318  }
319 
320  if (func) {
321  func(userdata, marker);
322  }
323  }
324  }
325 }
326 
328 {
329  MovieTracking *tracking = &clip->tracking;
330  MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
331  ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
332  bool has_bundle = false;
333  const bool used_for_stabilization = (track->flag &
335  if (track == act_track) {
336  tracking->act_track = NULL;
337  }
338  /* Handle reconstruction display in 3d viewport. */
339  if (track->flag & TRACK_HAS_BUNDLE) {
340  has_bundle = true;
341  }
342  /* Make sure no plane will use freed track */
344  /* Delete f-curves associated with the track (such as weight, i.e.) */
345  /* Escaped object name, escaped track name, rest of the path. */
346  char rna_path[MAX_NAME * 4 + 64];
347  BKE_tracking_get_rna_path_for_track(tracking, track, rna_path, sizeof(rna_path));
348  if (BKE_animdata_fix_paths_remove(&clip->id, rna_path)) {
350  }
351  /* Delete track itself. */
353  BLI_freelinkN(tracksbase, track);
354  /* Send notifiers. */
356  if (used_for_stabilization) {
358  }
359  /* Inform dependency graph. */
360  DEG_id_tag_update(&clip->id, 0);
361  if (has_bundle) {
363  }
364 }
365 
367  MovieClip *clip,
368  MovieTrackingTrack *track,
369  MovieTrackingMarker *marker)
370 {
371  if (track->markersnr == 1) {
372  clip_delete_track(C, clip, track);
373  }
374  else {
375  BKE_tracking_marker_delete(track, marker->framenr);
376 
378  }
379 }
380 
382 {
383  MovieTracking *tracking = &clip->tracking;
384  ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(tracking);
385  /* Delete f-curves associated with the track (such as weight, i.e.) */
386  /* Escaped object name, escaped track name, rest of the path. */
387  char rna_path[MAX_NAME * 4 + 64];
388  BKE_tracking_get_rna_path_for_plane_track(tracking, plane_track, rna_path, sizeof(rna_path));
389  if (BKE_animdata_fix_paths_remove(&clip->id, rna_path)) {
391  }
392  /* Delete the plane track itself. */
393  BKE_tracking_plane_track_free(plane_track);
394  BLI_freelinkN(plane_tracks_base, plane_track);
395  /* TODO(sergey): Any notifiers to be sent here? */
396  (void)C;
397  /* Inform dependency graph. */
398  DEG_id_tag_update(&clip->id, 0);
399 }
400 
401 /* Calculate space clip offset to be centered at the given point. */
403  SpaceClip *sc, const float x, const float y, float *r_offset_x, float *r_offset_y)
404 {
405  int width, height;
407 
408  float aspx, aspy;
409  ED_space_clip_get_aspect(sc, &aspx, &aspy);
410 
411  *r_offset_x = (x - 0.5f) * width * aspx;
412  *r_offset_y = (y - 0.5f) * height * aspy;
413 }
414 
415 void clip_view_center_to_point(SpaceClip *sc, float x, float y)
416 {
417  clip_view_offset_for_center_to_point(sc, x, y, &sc->xof, &sc->yof);
418 }
419 
420 static bool selected_tracking_boundbox(SpaceClip *sc, float min[2], float max[2])
421 {
422  MovieClip *clip = ED_space_clip_get_clip(sc);
423  MovieTrackingTrack *track;
424  int width, height;
425  bool ok = false;
426  ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
427  int framenr = ED_space_clip_get_clip_frame_number(sc);
428 
429  INIT_MINMAX2(min, max);
430 
432 
433  track = tracksbase->first;
434  while (track) {
435  if (TRACK_VIEW_SELECTED(sc, track)) {
436  MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
437 
438  if (marker) {
439  float pos[3];
440 
441  pos[0] = marker->pos[0] + track->offset[0];
442  pos[1] = marker->pos[1] + track->offset[1];
443  pos[2] = 0.0f;
444 
445  /* undistortion happens for normalized coords */
447  /* undistortion happens for normalized coords */
449  }
450 
451  pos[0] *= width;
452  pos[1] *= height;
453 
454  mul_v3_m4v3(pos, sc->stabmat, pos);
455 
457 
458  ok = true;
459  }
460  }
461 
462  track = track->next;
463  }
464 
465  return ok;
466 }
467 
468 static bool tracking_has_selection(SpaceClip *space_clip)
469 {
470  MovieClip *clip = ED_space_clip_get_clip(space_clip);
471  ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
472  const int framenr = ED_space_clip_get_clip_frame_number(space_clip);
473 
474  LISTBASE_FOREACH (MovieTrackingTrack *, track, tracksbase) {
475  if (!TRACK_VIEW_SELECTED(space_clip, track)) {
476  continue;
477  }
478  const MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
479  if (marker != NULL) {
480  return true;
481  }
482  }
483 
484  return false;
485 }
486 
487 static bool mask_has_selection(const bContext *C)
488 {
490  if (mask == NULL) {
491  return false;
492  }
493 
494  LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
495  if (mask_layer->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
496  continue;
497  }
498  LISTBASE_FOREACH (MaskSpline *, spline, &mask_layer->splines) {
499  for (int i = 0; i < spline->tot_point; i++) {
500  const MaskSplinePoint *point = &spline->points[i];
501  const BezTriple *bezt = &point->bezt;
502  if (!MASKPOINT_ISSEL_ANY(point)) {
503  continue;
504  }
505  if (bezt->f2 & SELECT) {
506  return true;
507  }
508 
510  return true;
511  }
512 
513  if ((bezt->f1 & SELECT) && (bezt->h1 != HD_VECT)) {
514  return true;
515  }
516  if ((bezt->f3 & SELECT) && (bezt->h2 != HD_VECT)) {
517  return true;
518  }
519  }
520  }
521  }
522 
523  return false;
524 }
525 
526 static bool selected_boundbox(const bContext *C,
527  float min[2],
528  float max[2],
529  bool handles_as_control_point)
530 {
532  if (sc->mode == SC_MODE_TRACKING) {
533  return selected_tracking_boundbox(sc, min, max);
534  }
535 
536  if (ED_mask_selected_minmax(C, min, max, handles_as_control_point)) {
537  MovieClip *clip = ED_space_clip_get_clip(sc);
538  int width, height;
540  BKE_mask_coord_to_movieclip(clip, &sc->user, min, min);
541  BKE_mask_coord_to_movieclip(clip, &sc->user, max, max);
542  min[0] *= width;
543  min[1] *= height;
544  max[0] *= width;
545  max[1] *= height;
546  return true;
547  }
548  return false;
549 }
550 
552  const bContext *C, bool fit, float *r_offset_x, float *r_offset_y, float *r_zoom)
553 {
555 
556  int frame_width, frame_height;
557  ED_space_clip_get_size(sc, &frame_width, &frame_height);
558 
559  if ((frame_width == 0) || (frame_height == 0) || (sc->clip == NULL)) {
560  return false;
561  }
562 
563  /* NOTE: The `fit` argument is set to truth when doing "View to Selected" operator, and it set to
564  * false when this function is used for Lock-to-Selection functionality. When locking to
565  * selection the handles are to use control point position. So we can derive the
566  * `handles_as_control_point` from `fit`.
567  *
568  * TODO(sergey): Make such decision more explicit. Maybe pass use-case for the calculation to
569  * tell operator from lock-to-selection apart. */
570  float min[2], max[2];
571  if (!selected_boundbox(C, min, max, !fit)) {
572  return false;
573  }
574 
575  /* center view */
577  (max[0] + min[0]) / (2 * frame_width),
578  (max[1] + min[1]) / (2 * frame_height),
579  r_offset_x,
580  r_offset_y);
581 
582  const int w = max[0] - min[0];
583  const int h = max[1] - min[1];
584 
585  /* set zoom to see all selection */
586  *r_zoom = sc->zoom;
587  if (w > 0 && h > 0) {
588  ARegion *region = CTX_wm_region(C);
589 
590  int width, height;
591  float zoomx, zoomy, newzoom, aspx, aspy;
592 
593  ED_space_clip_get_aspect(sc, &aspx, &aspy);
594 
595  width = BLI_rcti_size_x(&region->winrct) + 1;
596  height = BLI_rcti_size_y(&region->winrct) + 1;
597 
598  zoomx = (float)width / w / aspx;
599  zoomy = (float)height / h / aspy;
600 
601  newzoom = 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy));
602 
603  if (fit) {
604  *r_zoom = newzoom;
605  }
606  }
607 
608  return true;
609 }
610 
611 /* Returns truth if lock-to-selection is enabled and possible.
612  * Locking to selection is not possible if there is no selection. */
614 {
615  SpaceClip *space_clip = CTX_wm_space_clip(C);
616 
617  if ((space_clip->flag & SC_LOCK_SELECTION) == 0) {
618  return false;
619  }
620 
621  if (space_clip->mode == SC_MODE_TRACKING) {
622  return tracking_has_selection(space_clip);
623  }
624 
625  return mask_has_selection(C);
626 }
627 
629 {
631 
632  /* currently clip editor supposes that editing clip length is equal to scene frame range */
634 
637 
638  immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f);
639  immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
640  immRectf(pos, (float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
641 
643 
645 
646  /* thin lines where the actual frames are */
647  GPU_line_width(1.0f);
648 
650  immVertex2f(pos, (float)SFRA, v2d->cur.ymin);
651  immVertex2f(pos, (float)SFRA, v2d->cur.ymax);
652  immVertex2f(pos, (float)EFRA, v2d->cur.ymin);
653  immVertex2f(pos, (float)EFRA, v2d->cur.ymax);
654  immEnd();
655 
657 }
typedef float(TangentPoint)[2]
bool BKE_animdata_fix_paths_remove(struct ID *id, const char *path)
Definition: anim_data.c:1188
struct SpaceClip * CTX_wm_space_clip(const bContext *C)
Definition: context.c:899
struct Mask * CTX_data_edit_mask(const bContext *C)
Definition: context.c:1316
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:725
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
@ MASK_HANDLE_MODE_STICK
Definition: BKE_mask.h:55
#define MASKPOINT_ISSEL_ANY(p)
Definition: BKE_mask.h:232
void BKE_mask_coord_to_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2])
Definition: mask.c:1266
eMaskhandleMode BKE_mask_point_handles_mode_get(const struct MaskSplinePoint *point)
void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, int *width, int *height)
Definition: movieclip.c:1540
float BKE_movieclip_remap_clip_to_scene_frame(const struct MovieClip *clip, float framenr)
void BKE_tracking_plane_tracks_remove_point_track(struct MovieTracking *tracking, struct MovieTrackingTrack *track)
Definition: tracking.c:1878
void BKE_tracking_plane_track_free(struct MovieTrackingPlaneTrack *plane_track)
Definition: tracking.c:1797
struct ListBase * BKE_tracking_get_active_tracks(struct MovieTracking *tracking)
Definition: tracking.c:365
void BKE_tracking_get_rna_path_for_track(const struct MovieTracking *tracking, const struct MovieTrackingTrack *track, char *rna_path, size_t rna_path_len)
Definition: tracking.c:3408
#define TRACK_SELECTED(track)
Definition: BKE_tracking.h:489
float BKE_tracking_track_get_weight_for_marker(struct MovieClip *clip, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker)
Definition: tracking.c:1321
struct MovieTrackingTrack * BKE_tracking_track_get_active(struct MovieTracking *tracking)
Definition: tracking.c:1170
void BKE_tracking_track_free(struct MovieTrackingTrack *track)
Definition: tracking.c:661
struct ListBase * BKE_tracking_get_active_plane_tracks(struct MovieTracking *tracking)
Definition: tracking.c:377
void BKE_tracking_distort_v2(struct MovieTracking *tracking, int image_width, int image_height, const float co[2], float r_co[2])
Definition: tracking.c:2560
void BKE_tracking_get_rna_path_for_plane_track(const struct MovieTracking *tracking, const struct MovieTrackingPlaneTrack *plane_track, char *rna_path, size_t rna_path_len)
Definition: tracking.c:3446
#define TRACK_VIEW_SELECTED(sc, track)
Definition: BKE_tracking.h:497
void BKE_tracking_get_projection_matrix(struct MovieTracking *tracking, struct MovieTrackingObject *object, int framenr, int winx, int winy, float mat[4][4])
Definition: tracking.c:420
struct MovieTrackingMarker * BKE_tracking_marker_get(struct MovieTrackingTrack *track, int framenr)
Definition: tracking.c:1523
struct MovieTrackingObject * BKE_tracking_object_get_active(struct MovieTracking *tracking)
Definition: tracking.c:2198
void BKE_tracking_marker_delete(struct MovieTrackingTrack *track, int framenr)
Definition: tracking.c:1428
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:281
MINLINE float min_ff(float a, float b)
MINLINE float power_of_2(float f)
void mul_v4_m4v4(float r[4], const float M[4][4], const float v[4])
Definition: math_matrix.c:854
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
Definition: math_matrix.c:742
MINLINE void copy_v3_v3(float r[3], const float a[3])
void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
Definition: math_vector.c:1043
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
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:157
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:153
unsigned int uint
Definition: BLI_sys_types.h:83
#define INIT_MINMAX2(min, max)
#define ELEM(...)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ HD_VECT
#define MAX_NAME
Definition: DNA_defs.h:62
#define MASK_RESTRICT_SELECT
#define MASK_RESTRICT_VIEW
@ MCLIP_PROXY_RENDER_UNDISTORT
#define SFRA
#define EFRA
@ SC_MODE_TRACKING
@ SC_LOCK_SELECTION
@ SC_SHOW_GRAPH_TRACKS_MOTION
@ SC_SHOW_GRAPH_TRACKS_ERROR
@ TRACK_HIDDEN
@ TRACK_USE_2D_STAB
@ TRACK_HAS_BUNDLE
@ TRACK_USE_2D_STAB_ROT
@ MARKER_DISABLED
int ED_space_clip_get_clip_frame_number(struct SpaceClip *sc)
Definition: clip_editor.c:227
void ED_clip_point_undistorted_pos(struct SpaceClip *sc, const float co[2], float r_co[2])
Definition: clip_editor.c:459
void ED_space_clip_get_aspect(struct SpaceClip *sc, float *aspx, float *aspy)
Definition: clip_editor.c:171
void ED_space_clip_get_size(struct SpaceClip *sc, int *width, int *height)
Definition: clip_editor.c:141
struct MovieClip * ED_space_clip_get_clip(struct SpaceClip *sc)
Definition: clip_editor.c:572
bool ED_mask_selected_minmax(const struct bContext *C, float min[2], float max[2], bool handles_as_control_point)
void immUniformColor4f(float r, float g, float b, float a)
void immUnbindProgram(void)
void immVertex2f(uint attr_id, float x, float y)
void immUniformThemeColorShade(int color_id, int offset)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
GPUVertFormat * immVertexFormat(void)
void immBegin(GPUPrimType, uint vertex_len)
void immEnd(void)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
_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 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
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:36
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:171
@ GPU_BLEND_NONE
Definition: GPU_state.h:55
@ GPU_BLEND_ALPHA
Definition: GPU_state.h:57
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:55
void GPU_line_width(float width)
Definition: gpu_state.cc:173
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
Read Guarded memory(de)allocation.
#define C
Definition: RandGen.cpp:39
@ TH_BACK
Definition: UI_resources.h:55
void UI_view2d_view_ortho(const struct View2D *v2d)
#define ND_DISPLAY
Definition: WM_types.h:391
#define NC_MOVIECLIP
Definition: WM_types.h:298
#define NA_EDITED
Definition: WM_types.h:462
#define ND_SPACE_VIEW3D
Definition: WM_types.h:423
#define NC_SPACE
Definition: WM_types.h:293
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
void(* ClipTrackValueSegmentStartCallback)(void *userdata, struct MovieTrackingTrack *track, eClipCurveValueSource value_source, bool is_point)
Definition: clip_intern.h:131
void(* ClipTrackValueSegmentEndCallback)(void *userdata, eClipCurveValueSource value_source)
Definition: clip_intern.h:136
eClipCurveValueSource
Definition: clip_intern.h:118
@ CLIP_VALUE_SOURCE_REPROJECTION_ERROR
Definition: clip_intern.h:121
@ CLIP_VALUE_SOURCE_SPEED_Y
Definition: clip_intern.h:120
@ CLIP_VALUE_SOURCE_SPEED_X
Definition: clip_intern.h:119
void(* ClipTrackValueCallback)(void *userdata, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, eClipCurveValueSource value_source, int scene_framenr, float val)
Definition: clip_intern.h:124
static bool mask_has_selection(const bContext *C)
Definition: clip_utils.c:487
void clip_graph_tracking_values_iterate_track(SpaceClip *sc, MovieTrackingTrack *track, void *userdata, ClipTrackValueCallback func, ClipTrackValueSegmentStartCallback segment_start, ClipTrackValueSegmentEndCallback segment_end)
Definition: clip_utils.c:253
bool clip_graph_value_visible(SpaceClip *sc, eClipCurveValueSource value_source)
Definition: clip_utils.c:58
static float calculate_reprojection_error_at_marker(MovieClip *clip, MovieTracking *tracking, MovieTrackingObject *tracking_object, MovieTrackingTrack *track, MovieTrackingMarker *marker, const int clip_width, const int clip_height, const int scene_framenr)
Definition: clip_utils.c:146
void clip_delete_marker(bContext *C, MovieClip *clip, MovieTrackingTrack *track, MovieTrackingMarker *marker)
Definition: clip_utils.c:366
static bool tracking_has_selection(SpaceClip *space_clip)
Definition: clip_utils.c:468
void clip_delete_plane_track(bContext *C, MovieClip *clip, MovieTrackingPlaneTrack *plane_track)
Definition: clip_utils.c:381
void clip_view_center_to_point(SpaceClip *sc, float x, float y)
Definition: clip_utils.c:415
static bool selected_tracking_boundbox(SpaceClip *sc, float min[2], float max[2])
Definition: clip_utils.c:420
void clip_draw_sfra_efra(View2D *v2d, Scene *scene)
Definition: clip_utils.c:628
static void clip_graph_tracking_values_iterate_track_reprojection_error_values(SpaceClip *sc, MovieTrackingTrack *track, void *userdata, ClipTrackValueCallback func, ClipTrackValueSegmentStartCallback segment_start, ClipTrackValueSegmentEndCallback segment_end)
Definition: clip_utils.c:182
bool clip_view_calculate_view_selection(const bContext *C, bool fit, float *r_offset_x, float *r_offset_y, float *r_zoom)
Definition: clip_utils.c:551
bool clip_view_has_locked_selection(const bContext *C)
Definition: clip_utils.c:613
void clip_graph_tracking_values_iterate(SpaceClip *sc, bool selected_only, bool include_hidden, void *userdata, ClipTrackValueCallback func, ClipTrackValueSegmentStartCallback segment_start, ClipTrackValueSegmentEndCallback segment_end)
Definition: clip_utils.c:267
void clip_graph_tracking_iterate(SpaceClip *sc, bool selected_only, bool include_hidden, void *userdata, void(*func)(void *userdata, MovieTrackingMarker *marker))
Definition: clip_utils.c:294
static void clip_graph_tracking_values_iterate_track_speed_values(SpaceClip *sc, MovieTrackingTrack *track, void *userdata, ClipTrackValueCallback func, ClipTrackValueSegmentStartCallback segment_start, ClipTrackValueSegmentEndCallback segment_end)
Definition: clip_utils.c:73
void clip_delete_track(bContext *C, MovieClip *clip, MovieTrackingTrack *track)
Definition: clip_utils.c:327
void clip_view_offset_for_center_to_point(SpaceClip *sc, const float x, const float y, float *r_offset_x, float *r_offset_y)
Definition: clip_utils.c:402
static bool selected_boundbox(const bContext *C, float min[2], float max[2], bool handles_as_control_point)
Definition: clip_utils.c:526
#define SELECT
Scene scene
uint pos
#define min(a, b)
Definition: sort.c:51
void * first
Definition: DNA_listBase.h:47
struct MovieTracking tracking
MovieTrackingMarker * markers
struct MovieTrackingTrack * next
MovieTrackingTrack * act_track
MovieTrackingCamera camera
struct MovieClipUser user
float stabmat[4][4]
struct MovieClip * clip
float xmax
Definition: DNA_vec_types.h:85
float xmin
Definition: DNA_vec_types.h:85
float ymax
Definition: DNA_vec_types.h:86
float ymin
Definition: DNA_vec_types.h:86
float max
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)