Blender  V3.3
clip_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 <errno.h>
9 #include <fcntl.h>
10 #include <sys/types.h>
11 
12 #ifndef WIN32
13 # include <unistd.h>
14 #else
15 # include <io.h>
16 #endif
17 
18 #include "MEM_guardedalloc.h"
19 
20 #include "DNA_defaults.h"
21 #include "DNA_scene_types.h" /* min/max frames */
22 #include "DNA_userdef_types.h"
23 
24 #include "BLI_fileops.h"
25 #include "BLI_math.h"
26 #include "BLI_path_util.h"
27 #include "BLI_rect.h"
28 #include "BLI_string.h"
29 #include "BLI_task.h"
30 #include "BLI_utildefines.h"
31 
32 #include "BLT_translation.h"
33 
34 #include "BKE_context.h"
35 #include "BKE_global.h"
36 #include "BKE_lib_id.h"
37 #include "BKE_main.h"
38 #include "BKE_movieclip.h"
39 #include "BKE_report.h"
40 #include "BKE_tracking.h"
41 
42 #include "WM_api.h"
43 #include "WM_types.h"
44 
45 #include "IMB_imbuf.h"
46 #include "IMB_imbuf_types.h"
47 
48 #include "ED_clip.h"
49 #include "ED_screen.h"
50 
51 #include "UI_interface.h"
52 
53 #include "RNA_access.h"
54 #include "RNA_define.h"
55 #include "RNA_enum_types.h"
56 
57 #include "UI_view2d.h"
58 
59 #include "PIL_time.h"
60 
61 #include "DEG_depsgraph.h"
62 #include "DEG_depsgraph_build.h"
63 
64 #include "clip_intern.h" /* own include */
65 
66 /* -------------------------------------------------------------------- */
70 static void sclip_zoom_set(const bContext *C,
71  float zoom,
72  const float location[2],
73  const bool zoom_to_pos)
74 {
76  ARegion *region = CTX_wm_region(C);
77 
78  float oldzoom = sc->zoom;
79  int width, height;
80 
81  sc->zoom = zoom;
82 
83  if (sc->zoom < 0.1f || sc->zoom > 4.0f) {
84  /* check zoom limits */
86 
87  width *= sc->zoom;
88  height *= sc->zoom;
89 
90  if ((width < 4) && (height < 4) && sc->zoom < oldzoom) {
91  sc->zoom = oldzoom;
92  }
93  else if (BLI_rcti_size_x(&region->winrct) <= sc->zoom) {
94  sc->zoom = oldzoom;
95  }
96  else if (BLI_rcti_size_y(&region->winrct) <= sc->zoom) {
97  sc->zoom = oldzoom;
98  }
99  }
100 
101  if (zoom_to_pos && location) {
102  float aspx, aspy, w, h, dx, dy;
103 
105  ED_space_clip_get_aspect(sc, &aspx, &aspy);
106 
107  w = width * aspx;
108  h = height * aspy;
109 
110  dx = ((location[0] - 0.5f) * w - sc->xof) * (sc->zoom - oldzoom) / sc->zoom;
111  dy = ((location[1] - 0.5f) * h - sc->yof) * (sc->zoom - oldzoom) / sc->zoom;
112 
114  sc->xlockof += dx;
115  sc->ylockof += dy;
116  }
117  else {
118  sc->xof += dx;
119  sc->yof += dy;
120  }
121  }
122 }
123 
124 static void sclip_zoom_set_factor(const bContext *C,
125  float zoomfac,
126  const float location[2],
127  const bool zoom_to_pos)
128 {
130 
131  sclip_zoom_set(C, sc->zoom * zoomfac, location, zoom_to_pos);
132 }
133 
134 static void sclip_zoom_set_factor_exec(bContext *C, const wmEvent *event, float factor)
135 {
136  ARegion *region = CTX_wm_region(C);
137 
138  float location[2], *mpos = NULL;
139 
140  if (event) {
142 
143  ED_clip_mouse_pos(sc, region, event->mval, location);
144  mpos = location;
145  }
146 
147  sclip_zoom_set_factor(C, factor, mpos, mpos ? (U.uiflag & USER_ZOOM_TO_MOUSEPOS) : false);
148 
149  ED_region_tag_redraw(region);
150 }
151 
154 /* -------------------------------------------------------------------- */
158 static void clip_filesel(bContext *C, wmOperator *op, const char *path)
159 {
160  RNA_string_set(op->ptr, "directory", path);
161 
163 }
164 
165 static void open_init(bContext *C, wmOperator *op)
166 {
167  PropertyPointerRNA *pprop;
168 
169  op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
171 }
172 
174 {
175  MEM_freeN(op->customdata);
176  op->customdata = NULL;
177 }
178 
179 static int open_exec(bContext *C, wmOperator *op)
180 {
182  bScreen *screen = CTX_wm_screen(C);
183  Main *bmain = CTX_data_main(C);
184  PropertyPointerRNA *pprop;
185  PointerRNA idptr;
186  MovieClip *clip = NULL;
187  char str[FILE_MAX];
188 
189  if (!RNA_collection_is_empty(op->ptr, "files")) {
190  PointerRNA fileptr;
191  PropertyRNA *prop;
192  char dir_only[FILE_MAX], file_only[FILE_MAX];
193  bool relative = RNA_boolean_get(op->ptr, "relative_path");
194 
195  RNA_string_get(op->ptr, "directory", dir_only);
196  if (relative) {
197  BLI_path_rel(dir_only, bmain->filepath);
198  }
199 
200  prop = RNA_struct_find_property(op->ptr, "files");
201  RNA_property_collection_lookup_int(op->ptr, prop, 0, &fileptr);
202  RNA_string_get(&fileptr, "name", file_only);
203 
204  BLI_join_dirfile(str, sizeof(str), dir_only, file_only);
205  }
206  else {
207  BKE_report(op->reports, RPT_ERROR, "No files selected to be opened");
208 
209  return OPERATOR_CANCELLED;
210  }
211 
212  /* default to frame 1 if there's no scene in context */
213 
214  errno = 0;
215 
216  clip = BKE_movieclip_file_add_exists(bmain, str);
217 
218  if (!clip) {
219  if (op->customdata) {
220  MEM_freeN(op->customdata);
221  }
222 
223  BKE_reportf(op->reports,
224  RPT_ERROR,
225  "Cannot read '%s': %s",
226  str,
227  errno ? strerror(errno) : TIP_("unsupported movie clip format"));
228 
229  return OPERATOR_CANCELLED;
230  }
231 
232  if (!op->customdata) {
233  open_init(C, op);
234  }
235 
236  /* hook into UI */
237  pprop = op->customdata;
238 
239  if (pprop->prop) {
240  /* when creating new ID blocks, use is already 1, but RNA
241  * pointer use also increases user, so this compensates it */
242  id_us_min(&clip->id);
243 
244  RNA_id_pointer_create(&clip->id, &idptr);
245  RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr, NULL);
246  RNA_property_update(C, &pprop->ptr, pprop->prop);
247  }
248  else if (sc) {
249  ED_space_clip_set_clip(C, screen, sc, clip);
250  }
251 
253 
255  MEM_freeN(op->customdata);
256 
257  return OPERATOR_FINISHED;
258 }
259 
260 static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
261 {
263  char path[FILE_MAX];
264  MovieClip *clip = NULL;
265 
266  if (sc) {
267  clip = ED_space_clip_get_clip(sc);
268  }
269 
270  if (clip) {
271  BLI_strncpy(path, clip->filepath, sizeof(path));
272 
273  BLI_path_abs(path, CTX_data_main(C)->filepath);
274  BLI_path_parent_dir(path);
275  }
276  else {
277  BLI_strncpy(path, U.textudir, sizeof(path));
278  }
279 
280  if (RNA_struct_property_is_set(op->ptr, "files")) {
281  return open_exec(C, op);
282  }
283 
284  if (!RNA_struct_property_is_set(op->ptr, "relative_path")) {
285  RNA_boolean_set(op->ptr, "relative_path", (U.flag & USER_RELPATHS) != 0);
286  }
287 
288  open_init(C, op);
289 
290  clip_filesel(C, op, path);
291 
292  return OPERATOR_RUNNING_MODAL;
293 }
294 
296 {
297  /* identifiers */
298  ot->name = "Open Clip";
299  ot->description = "Load a sequence of frames or a movie file";
300  ot->idname = "CLIP_OT_open";
301 
302  /* api callbacks */
303  ot->exec = open_exec;
304  ot->invoke = open_invoke;
305  ot->cancel = open_cancel;
306 
307  /* flags */
309 
310  /* properties */
313  FILE_SPECIAL,
318 }
319 
322 /* -------------------------------------------------------------------- */
327 {
329 
330  if (!clip) {
331  return OPERATOR_CANCELLED;
332  }
333 
336 
338 
339  return OPERATOR_FINISHED;
340 }
341 
343 {
344  /* identifiers */
345  ot->name = "Reload Clip";
346  ot->description = "Reload clip";
347  ot->idname = "CLIP_OT_reload";
348 
349  /* api callbacks */
350  ot->exec = reload_exec;
351 }
352 
355 /* -------------------------------------------------------------------- */
359 typedef struct ViewPanData {
360  float x, y;
361  float xof, yof, xorig, yorig;
364  float *vec;
366 
367 static void view_pan_init(bContext *C, wmOperator *op, const wmEvent *event)
368 {
369  wmWindow *win = CTX_wm_window(C);
371  ViewPanData *vpd;
372 
373  op->customdata = vpd = MEM_callocN(sizeof(ViewPanData), "ClipViewPanData");
374 
375  /* Grab will be set when running from gizmo. */
376  vpd->own_cursor = (win->grabcursor == 0);
377  if (vpd->own_cursor) {
379  }
380 
381  vpd->x = event->xy[0];
382  vpd->y = event->xy[1];
383 
385  vpd->vec = &sc->xlockof;
386  }
387  else {
388  vpd->vec = &sc->xof;
389  }
390 
391  copy_v2_v2(&vpd->xof, vpd->vec);
392  copy_v2_v2(&vpd->xorig, &vpd->xof);
393 
395 
397 }
398 
399 static void view_pan_exit(bContext *C, wmOperator *op, bool cancel)
400 {
401  ViewPanData *vpd = op->customdata;
402 
403  if (cancel) {
404  copy_v2_v2(vpd->vec, &vpd->xorig);
405 
407  }
408 
409  if (vpd->own_cursor) {
411  }
412  MEM_freeN(op->customdata);
413 }
414 
416 {
418  float offset[2];
419 
420  RNA_float_get_array(op->ptr, "offset", offset);
421 
423  sc->xlockof += offset[0];
424  sc->ylockof += offset[1];
425  }
426  else {
427  sc->xof += offset[0];
428  sc->yof += offset[1];
429  }
430 
432 
433  return OPERATOR_FINISHED;
434 }
435 
436 static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
437 {
438  if (event->type == MOUSEPAN) {
440  float offset[2];
441 
442  offset[0] = (event->prev_xy[0] - event->xy[0]) / sc->zoom;
443  offset[1] = (event->prev_xy[1] - event->xy[1]) / sc->zoom;
444 
445  RNA_float_set_array(op->ptr, "offset", offset);
446 
447  view_pan_exec(C, op);
448 
449  return OPERATOR_FINISHED;
450  }
451 
452  view_pan_init(C, op, event);
453 
454  return OPERATOR_RUNNING_MODAL;
455 }
456 
457 static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
458 {
460  ViewPanData *vpd = op->customdata;
461  float offset[2];
462 
463  switch (event->type) {
464  case MOUSEMOVE:
465  copy_v2_v2(vpd->vec, &vpd->xorig);
466  offset[0] = (vpd->x - event->xy[0]) / sc->zoom;
467  offset[1] = (vpd->y - event->xy[1]) / sc->zoom;
468  RNA_float_set_array(op->ptr, "offset", offset);
469  view_pan_exec(C, op);
470  break;
471  case EVT_ESCKEY:
472  view_pan_exit(C, op, 1);
473 
474  return OPERATOR_CANCELLED;
475  case EVT_SPACEKEY:
476  view_pan_exit(C, op, 0);
477 
478  return OPERATOR_FINISHED;
479  default:
480  if (event->type == vpd->launch_event && event->val == KM_RELEASE) {
481  view_pan_exit(C, op, 0);
482 
483  return OPERATOR_FINISHED;
484  }
485  break;
486  }
487 
488  return OPERATOR_RUNNING_MODAL;
489 }
490 
492 {
493  view_pan_exit(C, op, true);
494 }
495 
497 {
498  /* identifiers */
499  ot->name = "Pan View";
500  ot->idname = "CLIP_OT_view_pan";
501  ot->description = "Pan the view";
502 
503  /* api callbacks */
504  ot->exec = view_pan_exec;
509 
510  /* flags */
512 
513  /* properties */
515  "offset",
516  2,
517  NULL,
518  -FLT_MAX,
519  FLT_MAX,
520  "Offset",
521  "Offset in floating-point units, 1.0 is the width and height of the image",
522  -FLT_MAX,
523  FLT_MAX);
524 }
525 
528 /* -------------------------------------------------------------------- */
532 typedef struct ViewZoomData {
533  float x, y;
534  float zoom;
536  float location[2];
541 
542 static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
543 {
544  wmWindow *win = CTX_wm_window(C);
546  ARegion *region = CTX_wm_region(C);
547  ViewZoomData *vpd;
548 
549  op->customdata = vpd = MEM_callocN(sizeof(ViewZoomData), "ClipViewZoomData");
550 
551  /* Grab will be set when running from gizmo. */
552  vpd->own_cursor = (win->grabcursor == 0);
553  if (vpd->own_cursor) {
555  }
556 
557  if (U.viewzoom == USER_ZOOM_CONTINUE) {
558  /* needs a timer to continue redrawing */
561  }
562 
563  vpd->x = event->xy[0];
564  vpd->y = event->xy[1];
565  vpd->zoom = sc->zoom;
567 
568  ED_clip_mouse_pos(sc, region, event->mval, vpd->location);
569 
571 }
572 
573 static void view_zoom_exit(bContext *C, wmOperator *op, bool cancel)
574 {
576  ViewZoomData *vpd = op->customdata;
577 
578  if (cancel) {
579  sc->zoom = vpd->zoom;
581  }
582 
583  if (vpd->timer) {
585  }
586 
587  if (vpd->own_cursor) {
589  }
590  MEM_freeN(op->customdata);
591 }
592 
594 {
595  sclip_zoom_set_factor(C, RNA_float_get(op->ptr, "factor"), NULL, false);
596 
598 
599  return OPERATOR_FINISHED;
600 }
601 
602 static int view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
603 {
604  if (ELEM(event->type, MOUSEZOOM, MOUSEPAN)) {
605  float delta, factor;
606 
607  delta = event->prev_xy[0] - event->xy[0] + event->prev_xy[1] - event->xy[1];
608 
609  if (U.uiflag & USER_ZOOM_INVERT) {
610  delta *= -1;
611  }
612 
613  factor = 1.0f + delta / 300.0f;
614  RNA_float_set(op->ptr, "factor", factor);
615 
616  sclip_zoom_set_factor_exec(C, event, factor);
617 
618  return OPERATOR_FINISHED;
619  }
620 
621  view_zoom_init(C, op, event);
622 
623  return OPERATOR_RUNNING_MODAL;
624 }
625 
626 static void view_zoom_apply(
627  bContext *C, ViewZoomData *vpd, wmOperator *op, const wmEvent *event, const bool zoom_to_pos)
628 {
629  float factor;
630  float delta;
631 
632  if (U.viewzoom != USER_ZOOM_SCALE) {
633  if (U.uiflag & USER_ZOOM_HORIZ) {
634  delta = (float)(event->xy[0] - vpd->x);
635  }
636  else {
637  delta = (float)(event->xy[1] - vpd->y);
638  }
639  }
640  else {
641  delta = event->xy[0] - vpd->x + event->xy[1] - vpd->y;
642  }
643 
644  delta /= U.pixelsize;
645 
646  if (U.uiflag & USER_ZOOM_INVERT) {
647  delta = -delta;
648  }
649 
650  if (U.viewzoom == USER_ZOOM_CONTINUE) {
651  SpaceClip *sclip = CTX_wm_space_clip(C);
652  double time = PIL_check_seconds_timer();
653  float time_step = (float)(time - vpd->timer_lastdraw);
654  float zfac;
655 
656  zfac = 1.0f + ((delta / 20.0f) * time_step);
657  vpd->timer_lastdraw = time;
658  factor = (sclip->zoom * zfac) / vpd->zoom;
659  }
660  else {
661  factor = 1.0f + delta / 300.0f;
662  }
663 
664  RNA_float_set(op->ptr, "factor", factor);
665  sclip_zoom_set(C, vpd->zoom * factor, vpd->location, zoom_to_pos);
667 }
668 
669 static int view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
670 {
671  ViewZoomData *vpd = op->customdata;
672  const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
673  switch (event->type) {
674  case TIMER:
675  if (event->customdata == vpd->timer) {
676  view_zoom_apply(C, vpd, op, event, use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS));
677  }
678  break;
679  case MOUSEMOVE:
680  view_zoom_apply(C, vpd, op, event, use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS));
681  break;
682  default:
683  if (event->type == vpd->launch_event && event->val == KM_RELEASE) {
684  view_zoom_exit(C, op, 0);
685 
686  return OPERATOR_FINISHED;
687  }
688  break;
689  }
690 
691  return OPERATOR_RUNNING_MODAL;
692 }
693 
695 {
696  view_zoom_exit(C, op, true);
697 }
698 
700 {
701  PropertyRNA *prop;
702 
703  /* identifiers */
704  ot->name = "View Zoom";
705  ot->idname = "CLIP_OT_view_zoom";
706  ot->description = "Zoom in/out the view";
707 
708  /* api callbacks */
714 
715  /* flags */
717 
718  /* properties */
719  prop = RNA_def_float(ot->srna,
720  "factor",
721  0.0f,
722  -FLT_MAX,
723  FLT_MAX,
724  "Factor",
725  "Zoom factor, values higher than 1.0 zoom in, lower values zoom out",
726  -FLT_MAX,
727  FLT_MAX);
729 
731 }
732 
735 /* -------------------------------------------------------------------- */
740 {
741  float location[2];
742 
743  RNA_float_get_array(op->ptr, "location", location);
744 
745  sclip_zoom_set_factor(C, powf(2.0f, 1.0f / 3.0f), location, U.uiflag & USER_ZOOM_TO_MOUSEPOS);
746 
748 
749  return OPERATOR_FINISHED;
750 }
751 
752 static int view_zoom_in_invoke(bContext *C, wmOperator *op, const wmEvent *event)
753 {
755  ARegion *region = CTX_wm_region(C);
756 
757  float location[2];
758 
759  ED_clip_mouse_pos(sc, region, event->mval, location);
760  RNA_float_set_array(op->ptr, "location", location);
761 
762  return view_zoom_in_exec(C, op);
763 }
764 
766 {
767  PropertyRNA *prop;
768 
769  /* identifiers */
770  ot->name = "Zoom In";
771  ot->idname = "CLIP_OT_view_zoom_in";
772  ot->description = "Zoom in the view";
773 
774  /* api callbacks */
778 
779  /* flags */
781 
782  /* properties */
783  prop = RNA_def_float_vector(ot->srna,
784  "location",
785  2,
786  NULL,
787  -FLT_MAX,
788  FLT_MAX,
789  "Location",
790  "Cursor location in screen coordinates",
791  -10.0f,
792  10.0f);
794 }
795 
797 {
798  float location[2];
799 
800  RNA_float_get_array(op->ptr, "location", location);
801 
802  sclip_zoom_set_factor(C, powf(0.5f, 1.0f / 3.0f), location, U.uiflag & USER_ZOOM_TO_MOUSEPOS);
803 
805 
806  return OPERATOR_FINISHED;
807 }
808 
809 static int view_zoom_out_invoke(bContext *C, wmOperator *op, const wmEvent *event)
810 {
812  ARegion *region = CTX_wm_region(C);
813 
814  float location[2];
815 
816  ED_clip_mouse_pos(sc, region, event->mval, location);
817  RNA_float_set_array(op->ptr, "location", location);
818 
819  return view_zoom_out_exec(C, op);
820 }
821 
823 {
824  PropertyRNA *prop;
825 
826  /* identifiers */
827  ot->name = "Zoom Out";
828  ot->idname = "CLIP_OT_view_zoom_out";
829  ot->description = "Zoom out the view";
830 
831  /* api callbacks */
835 
836  /* flags */
838 
839  /* properties */
840  prop = RNA_def_float_vector(ot->srna,
841  "location",
842  2,
843  NULL,
844  -FLT_MAX,
845  FLT_MAX,
846  "Location",
847  "Cursor location in normalized (0.0 to 1.0) coordinates",
848  -10.0f,
849  10.0f);
851 }
852 
855 /* -------------------------------------------------------------------- */
860 {
862 
863  sclip_zoom_set(C, RNA_float_get(op->ptr, "ratio"), NULL, false);
864 
865  /* ensure pixel exact locations for draw */
866  sc->xof = (int)sc->xof;
867  sc->yof = (int)sc->yof;
868 
870 
871  return OPERATOR_FINISHED;
872 }
873 
875 {
876  /* identifiers */
877  ot->name = "View Zoom Ratio";
878  ot->idname = "CLIP_OT_view_zoom_ratio";
879  ot->description = "Set the zoom ratio (based on clip size)";
880 
881  /* api callbacks */
884 
885  /* flags */
887 
888  /* properties */
890  "ratio",
891  0.0f,
892  -FLT_MAX,
893  FLT_MAX,
894  "Ratio",
895  "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out",
896  -FLT_MAX,
897  FLT_MAX);
898 }
899 
902 /* -------------------------------------------------------------------- */
907 {
908  SpaceClip *sc;
909  ARegion *region;
910  int w, h, width, height;
911  float aspx, aspy;
912  bool fit_view = RNA_boolean_get(op->ptr, "fit_view");
913  float zoomx, zoomy;
914 
915  /* retrieve state */
916  sc = CTX_wm_space_clip(C);
917  region = CTX_wm_region(C);
918 
919  ED_space_clip_get_size(sc, &w, &h);
920  ED_space_clip_get_aspect(sc, &aspx, &aspy);
921 
922  w = w * aspx;
923  h = h * aspy;
924 
925  /* check if the image will fit in the image with zoom == 1 */
926  width = BLI_rcti_size_x(&region->winrct) + 1;
927  height = BLI_rcti_size_y(&region->winrct) + 1;
928 
929  if (fit_view) {
930  const int margin = 5; /* margin from border */
931 
932  zoomx = (float)width / (w + 2 * margin);
933  zoomy = (float)height / (h + 2 * margin);
934 
935  sclip_zoom_set(C, min_ff(zoomx, zoomy), NULL, false);
936  }
937  else {
938  if ((w >= width || h >= height) && (width > 0 && height > 0)) {
939  zoomx = (float)width / w;
940  zoomy = (float)height / h;
941 
942  /* find the zoom value that will fit the image in the image space */
943  sclip_zoom_set(C, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), NULL, false);
944  }
945  else {
946  sclip_zoom_set(C, 1.0f, NULL, false);
947  }
948  }
949 
950  sc->xof = sc->yof = 0.0f;
951 
952  ED_region_tag_redraw(region);
953 
954  return OPERATOR_FINISHED;
955 }
956 
958 {
959  PropertyRNA *prop;
960 
961  /* identifiers */
962  ot->name = "Frame All";
963  ot->idname = "CLIP_OT_view_all";
964  ot->description = "View whole image with markers";
965 
966  /* api callbacks */
967  ot->exec = view_all_exec;
969 
970  /* flags */
972 
973  /* properties */
974  prop = RNA_def_boolean(ot->srna, "fit_view", 0, "Fit View", "Fit frame to the viewport");
976 }
977 
980 /* -------------------------------------------------------------------- */
985 {
987  ARegion *region = CTX_wm_region(C);
988 
989  clip_view_center_to_point(sc, sc->cursor[0], sc->cursor[1]);
990 
991  ED_region_tag_redraw(region);
992 
993  return OPERATOR_FINISHED;
994 }
995 
997 {
998  /* identifiers */
999  ot->name = "Center View to Cursor";
1000  ot->description = "Center the view so that the cursor is in the middle of the view";
1001  ot->idname = "CLIP_OT_view_center_cursor";
1002 
1003  /* api callbacks */
1006 }
1007 
1010 /* -------------------------------------------------------------------- */
1015 {
1016  SpaceClip *sc = CTX_wm_space_clip(C);
1017  ARegion *region = CTX_wm_region(C);
1018 
1019  sc->xlockof = 0.0f;
1020  sc->ylockof = 0.0f;
1021 
1022  ED_clip_view_selection(C, region, 1);
1023  ED_region_tag_redraw(region);
1024 
1025  return OPERATOR_FINISHED;
1026 }
1027 
1029 {
1030  /* identifiers */
1031  ot->name = "Frame Selected";
1032  ot->idname = "CLIP_OT_view_selected";
1033  ot->description = "View all selected elements";
1034 
1035  /* api callbacks */
1038 
1039  /* flags */
1041 }
1042 
1045 /* -------------------------------------------------------------------- */
1050 {
1051  /* prevent changes during render */
1052  if (G.is_rendering) {
1053  return false;
1054  }
1055  SpaceClip *space_clip = CTX_wm_space_clip(C);
1056  return space_clip != NULL;
1057 }
1058 
1060 {
1062 
1063  /* set the new frame number */
1064  scene->r.cfra = RNA_int_get(op->ptr, "frame");
1066  scene->r.subframe = 0.0f;
1067 
1068  /* do updates */
1071 }
1072 
1074 {
1075  change_frame_apply(C, op);
1076 
1077  return OPERATOR_FINISHED;
1078 }
1079 
1080 static int frame_from_event(bContext *C, const wmEvent *event)
1081 {
1082  ARegion *region = CTX_wm_region(C);
1084  int framenr = 0;
1085 
1086  if (region->regiontype == RGN_TYPE_WINDOW) {
1087  float sfra = scene->r.sfra, efra = scene->r.efra, framelen = region->winx / (efra - sfra + 1);
1088 
1089  framenr = sfra + event->mval[0] / framelen;
1090  }
1091  else {
1092  float viewx, viewy;
1093 
1094  UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
1095 
1096  framenr = round_fl_to_int(viewx);
1097  }
1098 
1099  return framenr;
1100 }
1101 
1102 static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1103 {
1104  ARegion *region = CTX_wm_region(C);
1105 
1106  if (region->regiontype == RGN_TYPE_WINDOW) {
1107  if (event->mval[1] > 16 * UI_DPI_FAC) {
1108  return OPERATOR_PASS_THROUGH;
1109  }
1110  }
1111 
1112  RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
1113 
1114  change_frame_apply(C, op);
1115 
1116  /* add temp handler */
1118 
1119  return OPERATOR_RUNNING_MODAL;
1120 }
1121 
1122 static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
1123 {
1124  switch (event->type) {
1125  case EVT_ESCKEY:
1126  return OPERATOR_FINISHED;
1127 
1128  case MOUSEMOVE:
1129  RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
1130  change_frame_apply(C, op);
1131  break;
1132 
1133  case LEFTMOUSE:
1134  case RIGHTMOUSE:
1135  if (event->val == KM_RELEASE) {
1136  return OPERATOR_FINISHED;
1137  }
1138  break;
1139  }
1140 
1141  return OPERATOR_RUNNING_MODAL;
1142 }
1143 
1145 {
1146  /* identifiers */
1147  ot->name = "Change Frame";
1148  ot->idname = "CLIP_OT_change_frame";
1149  ot->description = "Interactively change the current frame number";
1150 
1151  /* api callbacks */
1156 
1157  /* flags */
1159 
1160  /* rna */
1161  RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
1162 }
1163 
1166 /* -------------------------------------------------------------------- */
1170 typedef struct ProxyBuildJob {
1172  struct Main *main;
1175  bool stop;
1178 
1179 static void proxy_freejob(void *pjv)
1180 {
1181  ProxyJob *pj = pjv;
1182 
1183  MEM_freeN(pj);
1184 }
1185 
1186 static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undistort)
1187 {
1188  int build_count = 0;
1189  const int size_flags[2][4] = {
1195  int size_nr = undistort ? 1 : 0;
1196 
1197  if (size_flag & size_flags[size_nr][0]) {
1198  build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_25;
1199  }
1200 
1201  if (size_flag & size_flags[size_nr][1]) {
1202  build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_50;
1203  }
1204 
1205  if (size_flag & size_flags[size_nr][2]) {
1206  build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_75;
1207  }
1208 
1209  if (size_flag & size_flags[size_nr][3]) {
1210  build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_100;
1211  }
1212 
1213  return build_count;
1214 }
1215 
1216 /* simple case for movies -- handle frame-by-frame, do threading within single frame */
1217 static void do_movie_proxy(void *pjv,
1218  int *UNUSED(build_sizes),
1219  int UNUSED(build_count),
1220  int *build_undistort_sizes,
1221  int build_undistort_count,
1222  short *stop,
1223  short *do_update,
1224  float *progress)
1225 {
1226  ProxyJob *pj = pjv;
1227  MovieClip *clip = pj->clip;
1228  struct MovieDistortion *distortion = NULL;
1229 
1230  if (pj->index_context) {
1231  IMB_anim_index_rebuild(pj->index_context, stop, do_update, progress);
1232  }
1233 
1234  if (!build_undistort_count) {
1235  if (*stop) {
1236  pj->stop = 1;
1237  }
1238 
1239  return;
1240  }
1241 
1242  const int sfra = 1;
1243  const int efra = clip->len;
1244 
1245  if (build_undistort_count) {
1247  int width, height;
1248 
1250 
1251  distortion = BKE_tracking_distortion_new(&clip->tracking, width, height);
1253  }
1254 
1255  for (int cfra = sfra; cfra <= efra; cfra++) {
1257  clip, pj->clip_flag, distortion, cfra, build_undistort_sizes, build_undistort_count, 1);
1258 
1259  if (*stop || G.is_break) {
1260  break;
1261  }
1262 
1263  *do_update = true;
1264  *progress = ((float)cfra - sfra) / (efra - sfra);
1265  }
1266 
1267  if (distortion) {
1268  BKE_tracking_distortion_free(distortion);
1269  }
1270 
1271  if (*stop) {
1272  pj->stop = 1;
1273  }
1274 }
1275 
1276 /* *****
1277  * special case for sequences -- handle different frames in different threads,
1278  * loading from disk happens in critical section, decoding frame happens from
1279  * thread for maximal speed
1280  */
1281 
1282 typedef struct ProxyQueue {
1283  int cfra;
1284  int sfra;
1285  int efra;
1287 
1288  const short *stop;
1289  short *do_update;
1290  float *progress;
1292 
1293 typedef struct ProxyThread {
1299 
1301  MovieClip *clip,
1302  size_t *r_size,
1303  int *r_cfra)
1304 {
1305  uchar *mem = NULL;
1306 
1307  BLI_spin_lock(&queue->spin);
1308  if (!*queue->stop && queue->cfra <= queue->efra) {
1310  char name[FILE_MAX];
1311  size_t size;
1312  int file;
1313 
1314  user.framenr = queue->cfra;
1315 
1316  BKE_movieclip_filename_for_frame(clip, &user, name);
1317 
1318  file = BLI_open(name, O_BINARY | O_RDONLY, 0);
1319  if (file < 0) {
1320  BLI_spin_unlock(&queue->spin);
1321  return NULL;
1322  }
1323 
1325  if (size < 1) {
1326  close(file);
1327  BLI_spin_unlock(&queue->spin);
1328  return NULL;
1329  }
1330 
1331  mem = MEM_mallocN(size, "movieclip proxy memory file");
1332 
1333  if (read(file, mem, size) != size) {
1334  close(file);
1335  BLI_spin_unlock(&queue->spin);
1336  MEM_freeN(mem);
1337  return NULL;
1338  }
1339 
1340  *r_size = size;
1341  *r_cfra = queue->cfra;
1342 
1343  queue->cfra++;
1344  close(file);
1345 
1346  *queue->do_update = 1;
1347  *queue->progress = (float)(queue->cfra - queue->sfra) / (queue->efra - queue->sfra);
1348  }
1349  BLI_spin_unlock(&queue->spin);
1350 
1351  return mem;
1352 }
1353 
1354 static void proxy_task_func(TaskPool *__restrict pool, void *task_data)
1355 {
1356  ProxyThread *data = (ProxyThread *)task_data;
1358  uchar *mem;
1359  size_t size;
1360  int cfra;
1361 
1362  while ((mem = proxy_thread_next_frame(queue, data->clip, &size, &cfra))) {
1363  ImBuf *ibuf;
1364 
1365  ibuf = IMB_ibImageFromMemory(mem,
1366  size,
1368  data->clip->colorspace_settings.name,
1369  "proxy frame");
1370 
1372  data->clip, ibuf, NULL, cfra, data->build_sizes, data->build_count, false);
1373 
1375  ibuf,
1376  data->distortion,
1377  cfra,
1378  data->build_undistort_sizes,
1379  data->build_undistort_count,
1380  true);
1381 
1382  IMB_freeImBuf(ibuf);
1383 
1384  MEM_freeN(mem);
1385  }
1386 }
1387 
1388 static void do_sequence_proxy(void *pjv,
1389  int *build_sizes,
1390  int build_count,
1391  int *build_undistort_sizes,
1392  int build_undistort_count,
1393  /* Cannot be const, because it is assigned to a non-const variable.
1394  * NOLINTNEXTLINE: readability-non-const-parameter. */
1395  short *stop,
1396  short *do_update,
1397  float *progress)
1398 {
1399  ProxyJob *pj = pjv;
1400  MovieClip *clip = pj->clip;
1401  Scene *scene = pj->scene;
1402  int sfra = scene->r.sfra, efra = scene->r.efra;
1404  int tot_thread = BLI_task_scheduler_num_threads();
1405  int width, height;
1406 
1407  if (build_undistort_count) {
1409  }
1410 
1411  ProxyQueue queue;
1412  BLI_spin_init(&queue.spin);
1413 
1414  queue.cfra = sfra;
1415  queue.sfra = sfra;
1416  queue.efra = efra;
1417  queue.stop = stop;
1418  queue.do_update = do_update;
1419  queue.progress = progress;
1420 
1422  handles = MEM_callocN(sizeof(ProxyThread) * tot_thread, "proxy threaded handles");
1423  for (int i = 0; i < tot_thread; i++) {
1424  ProxyThread *handle = &handles[i];
1425 
1426  handle->clip = clip;
1427 
1428  handle->build_count = build_count;
1429  handle->build_sizes = build_sizes;
1430 
1431  handle->build_undistort_count = build_undistort_count;
1432  handle->build_undistort_sizes = build_undistort_sizes;
1433 
1434  if (build_undistort_count) {
1436  }
1437 
1439  }
1440 
1443 
1444  if (build_undistort_count) {
1445  for (int i = 0; i < tot_thread; i++) {
1446  ProxyThread *handle = &handles[i];
1448  }
1449  }
1450 
1451  BLI_spin_end(&queue.spin);
1452  MEM_freeN(handles);
1453 }
1454 
1455 static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress)
1456 {
1457  ProxyJob *pj = pjv;
1458  MovieClip *clip = pj->clip;
1459 
1460  short size_flag;
1461  int build_sizes[4], build_count = 0;
1462  int build_undistort_sizes[4], build_undistort_count = 0;
1463 
1464  size_flag = clip->proxy.build_size_flag;
1465 
1466  build_count = proxy_bitflag_to_array(size_flag, build_sizes, 0);
1467  build_undistort_count = proxy_bitflag_to_array(size_flag, build_undistort_sizes, 1);
1468 
1469  if (clip->source == MCLIP_SRC_MOVIE) {
1470  do_movie_proxy(pjv,
1471  build_sizes,
1472  build_count,
1473  build_undistort_sizes,
1474  build_undistort_count,
1475  stop,
1476  do_update,
1477  progress);
1478  }
1479  else {
1480  do_sequence_proxy(pjv,
1481  build_sizes,
1482  build_count,
1483  build_undistort_sizes,
1484  build_undistort_count,
1485  stop,
1486  do_update,
1487  progress);
1488  }
1489 }
1490 
1491 static void proxy_endjob(void *pjv)
1492 {
1493  ProxyJob *pj = pjv;
1494 
1495  if (pj->clip->anim) {
1497  }
1498 
1499  if (pj->index_context) {
1501  }
1502 
1503  if (pj->clip->source == MCLIP_SRC_MOVIE) {
1504  /* Time-code might have changed, so do a full reload to deal with this. */
1506  }
1507  else {
1508  /* For image sequences we'll preserve original cache. */
1510  }
1511 
1513 }
1514 
1516 {
1517  wmJob *wm_job;
1518  ProxyJob *pj;
1520  ScrArea *area = CTX_wm_area(C);
1521  SpaceClip *sc = CTX_wm_space_clip(C);
1522  MovieClip *clip = ED_space_clip_get_clip(sc);
1523 
1524  if ((clip->flag & MCLIP_USE_PROXY) == 0) {
1525  return OPERATOR_CANCELLED;
1526  }
1527 
1528  wm_job = WM_jobs_get(CTX_wm_manager(C),
1529  CTX_wm_window(C),
1530  scene,
1531  "Building Proxies",
1534 
1535  pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
1536  pj->scene = scene;
1537  pj->main = CTX_data_main(C);
1538  pj->clip = clip;
1539  pj->clip_flag = clip->flag & MCLIP_TIMECODE_FLAGS;
1540 
1541  if (clip->anim) {
1543  clip->proxy.build_tc_flag,
1544  clip->proxy.build_size_flag,
1545  clip->proxy.quality,
1546  true,
1547  NULL,
1548  false);
1549  }
1550 
1552  WM_jobs_timer(wm_job, 0.2, NC_MOVIECLIP | ND_DISPLAY, 0);
1554 
1555  G.is_break = false;
1556  WM_jobs_start(CTX_wm_manager(C), wm_job);
1557 
1559 
1560  return OPERATOR_FINISHED;
1561 }
1562 
1564 {
1565  /* identifiers */
1566  ot->name = "Rebuild Proxy and Timecode Indices";
1567  ot->idname = "CLIP_OT_rebuild_proxy";
1568  ot->description = "Rebuild all selected proxies and timecode indices in the background";
1569 
1570  /* api callbacks */
1573 
1574  /* flags */
1575  ot->flag = OPTYPE_REGISTER;
1576 }
1577 
1580 /* -------------------------------------------------------------------- */
1585 {
1586  SpaceClip *sc = CTX_wm_space_clip(C);
1587  int mode = RNA_enum_get(op->ptr, "mode");
1588 
1589  sc->mode = mode;
1590 
1591  if (sc->mode == SC_MODE_MASKEDIT && sc->view != SC_VIEW_CLIP) {
1592  /* Make sure we are in the right view for mask editing */
1593  sc->view = SC_VIEW_CLIP;
1594  }
1595 
1597 
1598  return OPERATOR_FINISHED;
1599 }
1600 
1602 {
1603  /* identifiers */
1604  ot->name = "Set Clip Mode";
1605  ot->description = "Set the clip interaction mode";
1606  ot->idname = "CLIP_OT_mode_set";
1607 
1608  /* api callbacks */
1609  ot->exec = mode_set_exec;
1610 
1612 
1613  /* properties */
1615 }
1616 
1619 #ifdef WITH_INPUT_NDOF
1620 
1621 /* -------------------------------------------------------------------- */
1625 /* Combined pan/zoom from a 3D mouse device.
1626  * Z zooms, XY pans
1627  * "view" (not "paper") control -- user moves the viewpoint, not the image being viewed
1628  * that explains the negative signs in the code below
1629  */
1630 
1631 static int clip_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
1632 {
1633  if (event->type != NDOF_MOTION) {
1634  return OPERATOR_CANCELLED;
1635  }
1636 
1637  SpaceClip *sc = CTX_wm_space_clip(C);
1638  ARegion *region = CTX_wm_region(C);
1639  float pan_vec[3];
1640 
1641  const wmNDOFMotionData *ndof = event->customdata;
1642  const float speed = NDOF_PIXELS_PER_SECOND;
1643 
1644  WM_event_ndof_pan_get(ndof, pan_vec, true);
1645 
1646  mul_v2_fl(pan_vec, (speed * ndof->dt) / sc->zoom);
1647  pan_vec[2] *= -ndof->dt;
1648 
1649  sclip_zoom_set_factor(C, 1.0f + pan_vec[2], NULL, false);
1650  sc->xof += pan_vec[0];
1651  sc->yof += pan_vec[1];
1652 
1653  ED_region_tag_redraw(region);
1654 
1655  return OPERATOR_FINISHED;
1656 }
1657 
1658 void CLIP_OT_view_ndof(wmOperatorType *ot)
1659 {
1660  /* identifiers */
1661  ot->name = "NDOF Pan/Zoom";
1662  ot->idname = "CLIP_OT_view_ndof";
1663  ot->description = "Use a 3D mouse device to pan/zoom the view";
1664 
1665  /* api callbacks */
1666  ot->invoke = clip_view_ndof_invoke;
1668 
1669  /* flags */
1671 }
1672 
1675 #endif /* WITH_INPUT_NDOF */
1676 
1677 /* -------------------------------------------------------------------- */
1681 static int clip_prefetch_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
1682 {
1683  /* no running blender, remove handler and pass through */
1686  }
1687 
1688  /* running render */
1689  switch (event->type) {
1690  case EVT_ESCKEY:
1691  return OPERATOR_RUNNING_MODAL;
1692  }
1693 
1694  return OPERATOR_PASS_THROUGH;
1695 }
1696 
1697 static int clip_prefetch_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(_event))
1698 {
1700 
1701  /* add modal handler for ESC */
1703 
1704  return OPERATOR_RUNNING_MODAL;
1705 }
1706 
1708 {
1709  /* identifiers */
1710  ot->name = "Prefetch Frames";
1711  ot->idname = "CLIP_OT_prefetch";
1712  ot->description = "Prefetch frames from disk for faster playback/tracking";
1713 
1714  /* api callbacks */
1718 }
1719 
1722 /* -------------------------------------------------------------------- */
1727 {
1730  int clip_length;
1731 
1732  if (ELEM(NULL, scene, clip)) {
1733  return OPERATOR_CANCELLED;
1734  }
1735 
1736  clip_length = BKE_movieclip_get_duration(clip);
1737 
1738  scene->r.sfra = clip->start_frame;
1739  scene->r.efra = scene->r.sfra + clip_length - 1;
1740 
1741  scene->r.efra = max_ii(scene->r.sfra, scene->r.efra);
1742 
1744 
1745  return OPERATOR_FINISHED;
1746 }
1747 
1749 {
1750  /* identifiers */
1751  ot->name = "Set Scene Frames";
1752  ot->idname = "CLIP_OT_set_scene_frames";
1753  ot->description = "Set scene's start and end frame to match clip's start frame and length";
1754 
1755  /* api callbacks */
1758 }
1759 
1762 /* -------------------------------------------------------------------- */
1767 {
1768  SpaceClip *sclip = CTX_wm_space_clip(C);
1769  bool show_cursor = false;
1770 
1771  show_cursor |= sclip->mode == SC_MODE_MASKEDIT;
1772  show_cursor |= sclip->around == V3D_AROUND_CURSOR;
1773 
1774  if (!show_cursor) {
1775  return OPERATOR_CANCELLED;
1776  }
1777 
1778  RNA_float_get_array(op->ptr, "location", sclip->cursor);
1779 
1781 
1782  /* Use pass-through to allow click-drag to transform the cursor. */
1784 }
1785 
1786 static int clip_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1787 {
1788  ARegion *region = CTX_wm_region(C);
1789  SpaceClip *sclip = CTX_wm_space_clip(C);
1790  float location[2];
1791 
1792  ED_clip_mouse_pos(sclip, region, event->mval, location);
1793  RNA_float_set_array(op->ptr, "location", location);
1794 
1795  return clip_set_2d_cursor_exec(C, op);
1796 }
1797 
1799 {
1800  /* identifiers */
1801  ot->name = "Set 2D Cursor";
1802  ot->description = "Set 2D cursor location";
1803  ot->idname = "CLIP_OT_cursor_set";
1804 
1805  /* api callbacks */
1809 
1810  /* flags */
1812 
1813  /* properties */
1815  "location",
1816  2,
1817  NULL,
1818  -FLT_MAX,
1819  FLT_MAX,
1820  "Location",
1821  "Cursor location in normalized clip coordinates",
1822  -10.0f,
1823  10.0f);
1824 }
1825 
1828 /* -------------------------------------------------------------------- */
1833 {
1834  SpaceClip *space_clip = CTX_wm_space_clip(C);
1835 
1836  ClipViewLockState lock_state;
1837  ED_clip_view_lock_state_store(C, &lock_state);
1838 
1839  space_clip->flag ^= SC_LOCK_SELECTION;
1840 
1842 
1844 
1845  return OPERATOR_FINISHED;
1846 }
1847 
1849 {
1850  /* identifiers */
1851  ot->name = "Toggle Lock Selection";
1852  ot->description = "Toggle Lock Selection option of the current clip editor";
1853  ot->idname = "CLIP_OT_lock_selection_toggle";
1854 
1855  /* api callbacks */
1858 
1859  /* flags */
1861 }
1862 
1865 /* -------------------------------------------------------------------- */
1870 {
1871  wmOperatorType *ot;
1872  wmOperatorTypeMacro *otmacro;
1873 
1874  ot = WM_operatortype_append_macro("CLIP_OT_add_marker_move",
1875  "Add Marker and Move",
1876  "Add new marker and move it on movie",
1878  WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
1879  otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
1880  RNA_struct_idprops_unset(otmacro->ptr, "release_confirm");
1881 
1883  "CLIP_OT_add_marker_slide",
1884  "Add Marker and Slide",
1885  "Add new marker and slide it with mouse until mouse button release",
1887  WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
1888  otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
1889  RNA_boolean_set(otmacro->ptr, "release_confirm", true);
1890 }
1891 
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
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 wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:713
struct MovieClip * CTX_data_edit_movieclip(const bContext *C)
Definition: context.c:1385
struct bScreen * CTX_wm_screen(const bContext *C)
Definition: context.c:733
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
void id_us_min(struct ID *id)
Definition: lib_id.c:313
struct MovieClip * BKE_movieclip_file_add_exists(struct Main *bmain, const char *filepath)
Definition: movieclip.c:1031
void BKE_movieclip_reload(struct Main *bmain, struct MovieClip *clip)
Definition: movieclip.c:1667
int BKE_movieclip_get_duration(struct MovieClip *clip)
Definition: movieclip.c:1562
void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, int *width, int *height)
Definition: movieclip.c:1520
void BKE_movieclip_filename_for_frame(struct MovieClip *clip, struct MovieClipUser *user, char *name)
Definition: movieclip.c:1909
void BKE_movieclip_clear_proxy_cache(struct MovieClip *clip)
Definition: movieclip.c:1660
void BKE_movieclip_build_proxy_frame_for_ibuf(struct MovieClip *clip, struct ImBuf *ibuf, struct MovieDistortion *distortion, int cfra, int *build_sizes, int build_count, bool undistorted)
Definition: movieclip.c:1864
void BKE_movieclip_build_proxy_frame(struct MovieClip *clip, int clip_flag, struct MovieDistortion *distortion, int cfra, int *build_sizes, int build_count, bool undistorted)
Definition: movieclip.c:1823
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
struct MovieDistortion * BKE_tracking_distortion_new(struct MovieTracking *tracking, int calibration_width, int calibration_height)
Definition: tracking.c:2303
void BKE_tracking_distortion_set_threads(struct MovieDistortion *distortion, int threads)
Definition: tracking.c:2342
void BKE_tracking_distortion_free(struct MovieDistortion *distortion)
Definition: tracking.c:2450
File and directory operations.
#define O_BINARY
Definition: BLI_fileops.h:319
size_t BLI_file_descriptor_size(int file) ATTR_WARN_UNUSED_RESULT
Definition: storage.c:178
int BLI_open(const char *filepath, int oflag, int pmode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: fileops.c:920
MINLINE int round_fl_to_int(float a)
MINLINE float min_ff(float a, float b)
MINLINE int max_ii(int a, int b)
MINLINE float power_of_2(float f)
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
#define FILE_MAX
void BLI_path_rel(char *file, const char *relfile) ATTR_NONNULL()
Definition: path_util.c:450
bool BLI_path_parent_dir(char *path) ATTR_NONNULL()
Definition: path_util.c:623
bool BLI_path_abs(char *path, const char *basepath) ATTR_NONNULL()
Definition: path_util.c:897
void BLI_join_dirfile(char *__restrict dst, size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL()
Definition: path_util.c:1531
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:190
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:186
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
unsigned char uchar
Definition: BLI_sys_types.h:70
int BLI_task_scheduler_num_threads(void)
@ TASK_PRIORITY_LOW
Definition: BLI_task.h:56
void * BLI_task_pool_user_data(TaskPool *pool)
Definition: task_pool.cc:525
void BLI_task_pool_work_and_wait(TaskPool *pool)
Definition: task_pool.cc:480
TaskPool * BLI_task_pool_create(void *userdata, eTaskPriority priority)
Definition: task_pool.cc:390
void BLI_task_pool_free(TaskPool *pool)
Definition: task_pool.cc:440
void BLI_task_pool_push(TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata)
Definition: task_pool.cc:459
pthread_spinlock_t SpinLock
Definition: BLI_threads.h:110
int BLI_system_thread_count(void)
Definition: threads.cc:281
void BLI_spin_init(SpinLock *spin)
Definition: threads.cc:419
void BLI_spin_unlock(SpinLock *spin)
Definition: threads.cc:452
void BLI_spin_lock(SpinLock *spin)
Definition: threads.cc:433
void BLI_spin_end(SpinLock *spin)
Definition: threads.cc:467
#define UNUSED(x)
#define ELEM(...)
#define TIP_(msgid)
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_FRAME_CHANGE
Definition: DNA_ID.h:841
@ ID_RECALC_SOURCE
Definition: DNA_ID.h:859
#define DNA_struct_default_get(struct_name)
Definition: DNA_defaults.h:29
@ MCLIP_PROXY_SIZE_75
@ MCLIP_PROXY_UNDISTORTED_SIZE_100
@ MCLIP_PROXY_UNDISTORTED_SIZE_75
@ MCLIP_PROXY_SIZE_25
@ MCLIP_PROXY_SIZE_100
@ MCLIP_PROXY_UNDISTORTED_SIZE_50
@ MCLIP_PROXY_SIZE_50
@ MCLIP_PROXY_UNDISTORTED_SIZE_25
@ MCLIP_PROXY_RENDER_SIZE_75
@ MCLIP_PROXY_RENDER_SIZE_100
@ MCLIP_PROXY_RENDER_SIZE_50
@ MCLIP_PROXY_RENDER_SIZE_25
@ MCLIP_SRC_MOVIE
@ MCLIP_TIMECODE_FLAGS
@ MCLIP_USE_PROXY
#define MINAFRAME
#define MAXFRAME
@ RGN_TYPE_WINDOW
@ FILE_SORT_DEFAULT
@ FILE_SPECIAL
@ FILE_TYPE_MOVIE
@ FILE_TYPE_FOLDER
@ FILE_TYPE_IMAGE
@ SC_VIEW_CLIP
@ SC_MODE_TRACKING
@ SC_MODE_MASKEDIT
@ SC_LOCK_SELECTION
@ FILE_DEFAULTDISPLAY
#define FRAMENUMBER_MIN_CLAMP(cfra)
@ USER_ZOOM_INVERT
@ USER_ZOOM_TO_MOUSEPOS
@ USER_ZOOM_HORIZ
#define NDOF_PIXELS_PER_SECOND
@ USER_RELPATHS
@ USER_ZOOM_SCALE
@ USER_ZOOM_CONTINUE
@ V3D_AROUND_CURSOR
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
bool ED_space_clip_poll(struct bContext *C)
Definition: clip_editor.c:61
bool ED_clip_view_selection(const struct bContext *C, struct ARegion *region, bool fit)
void ED_space_clip_set_clip(struct bContext *C, struct bScreen *screen, struct SpaceClip *sc, struct MovieClip *clip)
Definition: clip_editor.c:575
bool ED_space_clip_maskedit_poll(struct bContext *C)
Definition: clip_editor.c:94
void ED_space_clip_get_aspect(struct SpaceClip *sc, float *aspx, float *aspy)
Definition: clip_editor.c:176
void ED_clip_view_lock_state_restore_no_jump(const struct bContext *C, const ClipViewLockState *state)
void ED_space_clip_get_size(struct SpaceClip *sc, int *width, int *height)
Definition: clip_editor.c:146
bool ED_space_clip_view_clip_poll(struct bContext *C)
Definition: clip_editor.c:72
void ED_clip_mouse_pos(struct SpaceClip *sc, struct ARegion *region, const int mval[2], float co[2])
Definition: clip_editor.c:541
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_area_tag_redraw(ScrArea *area)
Definition: area.c:729
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:655
_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 GLsizei width
struct IndexBuildContext * IMB_anim_index_rebuild_context(struct anim *anim, IMB_Timecode_Type tcs_in_use, IMB_Proxy_Size proxy_sizes_in_use, int quality, const bool overwrite, struct GSet *file_list, bool build_only_on_bad_performance)
Definition: indexer.c:1377
void IMB_anim_index_rebuild(struct IndexBuildContext *context, short *stop, short *do_update, float *progress)
Definition: indexer.c:1460
void IMB_close_anim_proxies(struct anim *anim)
Definition: anim_movie.c:224
void IMB_anim_index_rebuild_finish(struct IndexBuildContext *context, short stop)
Definition: indexer.c:1486
struct ImBuf * IMB_ibImageFromMemory(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE], const char *descr)
Definition: readimage.c:84
Contains defines and structs used throughout the imbuf module.
@ IB_multilayer
@ IB_alphamode_detect
@ IB_rect
Read Guarded memory(de)allocation.
Platform independent time functions.
@ PROP_SKIP_SAVE
Definition: RNA_types.h:218
@ PROP_HIDDEN
Definition: RNA_types.h:216
#define C
Definition: RandGen.cpp:25
void UI_context_active_but_prop_get_templateID(struct bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop)
#define UI_DPI_FAC
Definition: UI_interface.h:305
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
@ WM_FILESEL_FILES
Definition: WM_api.h:756
@ WM_FILESEL_DIRECTORY
Definition: WM_api.h:753
@ WM_FILESEL_RELPATH
Definition: WM_api.h:752
@ WM_JOB_PROGRESS
Definition: WM_api.h:1339
@ FILE_OPENFILE
Definition: WM_api.h:764
@ WM_JOB_TYPE_CLIP_BUILD_PROXY
Definition: WM_api.h:1358
@ WM_JOB_TYPE_CLIP_PREFETCH
Definition: WM_api.h:1361
@ KM_RELEASE
Definition: WM_types.h:268
@ OPTYPE_BLOCKING
Definition: WM_types.h:150
@ OPTYPE_LOCK_BYPASS
Definition: WM_types.h:171
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_GRAB_CURSOR_XY
Definition: WM_types.h:154
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#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_ADDED
Definition: WM_types.h:525
#define NA_EDITED
Definition: WM_types.h:523
#define ND_SPACE_CLIP
Definition: WM_types.h:482
#define ND_FRAME
Definition: WM_types.h:382
#define NC_SPACE
Definition: WM_types.h:342
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
unsigned int U
Definition: btGjkEpa3.h:78
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
void clip_start_prefetch_job(const bContext *C)
Definition: clip_editor.c:1103
void clip_view_center_to_point(SpaceClip *sc, float x, float y)
Definition: clip_utils.c:398
bool clip_view_has_locked_selection(const struct bContext *C)
static int view_zoom_ratio_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:859
void CLIP_OT_view_zoom_in(wmOperatorType *ot)
Definition: clip_ops.c:765
static int lock_selection_toggle_exec(bContext *C, wmOperator *UNUSED(op))
Definition: clip_ops.c:1832
static void proxy_freejob(void *pjv)
Definition: clip_ops.c:1179
static int open_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:179
void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
Definition: clip_ops.c:874
struct ProxyThread ProxyThread
static void sclip_zoom_set_factor_exec(bContext *C, const wmEvent *event, float factor)
Definition: clip_ops.c:134
void CLIP_OT_cursor_set(wmOperatorType *ot)
Definition: clip_ops.c:1798
static void sclip_zoom_set_factor(const bContext *C, float zoomfac, const float location[2], const bool zoom_to_pos)
Definition: clip_ops.c:124
static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
Definition: clip_ops.c:260
static void view_pan_exit(bContext *C, wmOperator *op, bool cancel)
Definition: clip_ops.c:399
static void view_zoom_cancel(bContext *C, wmOperator *op)
Definition: clip_ops.c:694
static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:1102
static void view_pan_cancel(bContext *C, wmOperator *op)
Definition: clip_ops.c:491
static void view_zoom_exit(bContext *C, wmOperator *op, bool cancel)
Definition: clip_ops.c:573
static int view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:602
void CLIP_OT_mode_set(wmOperatorType *ot)
Definition: clip_ops.c:1601
static void view_pan_init(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:367
static int view_zoom_in_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:739
static int view_zoom_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:593
void CLIP_OT_view_zoom(wmOperatorType *ot)
Definition: clip_ops.c:699
static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
Definition: clip_ops.c:1515
void CLIP_OT_view_zoom_out(wmOperatorType *ot)
Definition: clip_ops.c:822
void CLIP_OT_open(wmOperatorType *ot)
Definition: clip_ops.c:295
void CLIP_OT_set_scene_frames(wmOperatorType *ot)
Definition: clip_ops.c:1748
void CLIP_OT_change_frame(wmOperatorType *ot)
Definition: clip_ops.c:1144
static void do_sequence_proxy(void *pjv, int *build_sizes, int build_count, int *build_undistort_sizes, int build_undistort_count, short *stop, short *do_update, float *progress)
Definition: clip_ops.c:1388
static void proxy_endjob(void *pjv)
Definition: clip_ops.c:1491
static int clip_prefetch_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
Definition: clip_ops.c:1681
struct ProxyBuildJob ProxyJob
void CLIP_OT_view_selected(wmOperatorType *ot)
Definition: clip_ops.c:1028
static void sclip_zoom_set(const bContext *C, float zoom, const float location[2], const bool zoom_to_pos)
Definition: clip_ops.c:70
void ED_operatormacros_clip(void)
Definition: clip_ops.c:1869
static void open_init(bContext *C, wmOperator *op)
Definition: clip_ops.c:165
static int view_pan_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:415
static int view_zoom_in_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:752
static int frame_from_event(bContext *C, const wmEvent *event)
Definition: clip_ops.c:1080
struct ViewZoomData ViewZoomData
static void proxy_task_func(TaskPool *__restrict pool, void *task_data)
Definition: clip_ops.c:1354
static int change_frame_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:1073
static int clip_set_scene_frames_exec(bContext *C, wmOperator *UNUSED(op))
Definition: clip_ops.c:1726
struct ProxyQueue ProxyQueue
void CLIP_OT_prefetch(wmOperatorType *ot)
Definition: clip_ops.c:1707
static int view_zoom_out_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:809
static int clip_set_2d_cursor_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:1766
void CLIP_OT_view_center_cursor(wmOperatorType *ot)
Definition: clip_ops.c:996
static int view_zoom_out_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:796
static int mode_set_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:1584
static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
Definition: clip_ops.c:1014
void CLIP_OT_rebuild_proxy(wmOperatorType *ot)
Definition: clip_ops.c:1563
void CLIP_OT_lock_selection_toggle(wmOperatorType *ot)
Definition: clip_ops.c:1848
static int clip_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:1786
struct ViewPanData ViewPanData
static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:1122
static int view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:669
static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:436
static int view_center_cursor_exec(bContext *C, wmOperator *UNUSED(op))
Definition: clip_ops.c:984
static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:457
static int clip_prefetch_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(_event))
Definition: clip_ops.c:1697
static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress)
Definition: clip_ops.c:1455
static int reload_exec(bContext *C, wmOperator *UNUSED(op))
Definition: clip_ops.c:326
static int view_all_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:906
static void open_cancel(bContext *UNUSED(C), wmOperator *op)
Definition: clip_ops.c:173
static bool change_frame_poll(bContext *C)
Definition: clip_ops.c:1049
static void clip_filesel(bContext *C, wmOperator *op, const char *path)
Definition: clip_ops.c:158
static void do_movie_proxy(void *pjv, int *UNUSED(build_sizes), int UNUSED(build_count), int *build_undistort_sizes, int build_undistort_count, short *stop, short *do_update, float *progress)
Definition: clip_ops.c:1217
void CLIP_OT_view_pan(wmOperatorType *ot)
Definition: clip_ops.c:496
void CLIP_OT_view_all(wmOperatorType *ot)
Definition: clip_ops.c:957
static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:542
static uchar * proxy_thread_next_frame(ProxyQueue *queue, MovieClip *clip, size_t *r_size, int *r_cfra)
Definition: clip_ops.c:1300
static void change_frame_apply(bContext *C, wmOperator *op)
Definition: clip_ops.c:1059
void CLIP_OT_reload(wmOperatorType *ot)
Definition: clip_ops.c:342
static void view_zoom_apply(bContext *C, ViewZoomData *vpd, wmOperator *op, const wmEvent *event, const bool zoom_to_pos)
Definition: clip_ops.c:626
static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undistort)
Definition: clip_ops.c:1186
#define powf(x, y)
Definition: cuda/compat.h:103
FILE * file
double time
Scene scene
SyclQueue * queue
TaskPool * task_pool
#define str(s)
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
#define G(x, y, z)
static void area(int d1, int d2, int e1, int e2, float weights[2])
ListBase threads
list of all thread for every CPUDevice in cpudevices a thread exists.
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:5155
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
Definition: rna_access.c:112
bool RNA_collection_is_empty(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5250
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
Definition: rna_access.c:3532
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
Definition: rna_access.c:4874
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
int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
Definition: rna_access.c:4097
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
Definition: rna_access.c:4980
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2138
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:5116
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
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_struct_idprops_unset(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:680
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
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
const EnumPropertyItem rna_enum_clip_editor_mode_items[]
Definition: rna_space.c:465
short regiontype
Definition: BKE_main.h:121
char filepath[1024]
Definition: BKE_main.h:124
char filepath[1024]
struct anim * anim
struct MovieClipProxy proxy
struct MovieTracking tracking
struct PropertyRNA * prop
Definition: RNA_types.h:43
PointerRNA ptr
Definition: RNA_types.h:42
Scene * scene
Definition: clip_ops.c:1171
struct IndexBuildContext * index_context
Definition: clip_ops.c:1176
struct Main * main
Definition: clip_ops.c:1172
MovieClip * clip
Definition: clip_ops.c:1173
short * do_update
Definition: clip_ops.c:1289
float * progress
Definition: clip_ops.c:1290
const short * stop
Definition: clip_ops.c:1288
SpinLock spin
Definition: clip_ops.c:1286
int build_count
Definition: clip_ops.c:1296
int * build_sizes
Definition: clip_ops.c:1296
struct MovieDistortion * distortion
Definition: clip_ops.c:1295
MovieClip * clip
Definition: clip_ops.c:1294
int * build_undistort_sizes
Definition: clip_ops.c:1297
int build_undistort_count
Definition: clip_ops.c:1297
struct RenderData r
float cursor[2]
int launch_event
Definition: clip_ops.c:362
float y
Definition: clip_ops.c:360
float xof
Definition: clip_ops.c:361
float * vec
Definition: clip_ops.c:364
float x
Definition: clip_ops.c:360
float yorig
Definition: clip_ops.c:361
float yof
Definition: clip_ops.c:361
bool own_cursor
Definition: clip_ops.c:363
float xorig
Definition: clip_ops.c:361
float location[2]
Definition: clip_ops.c:536
double timer_lastdraw
Definition: clip_ops.c:538
int launch_event
Definition: clip_ops.c:535
wmTimer * timer
Definition: clip_ops.c:537
float zoom
Definition: clip_ops.c:534
bool own_cursor
Definition: clip_ops.c:539
short val
Definition: WM_types.h:680
int xy[2]
Definition: WM_types.h:682
int mval[2]
Definition: WM_types.h:684
int prev_xy[2]
Definition: WM_types.h:728
short type
Definition: WM_types.h:678
void * customdata
Definition: WM_types.h:715
Definition: wm_jobs.c:57
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
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:927
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
struct wmWindow * win
Definition: WM_types.h:860
double PIL_check_seconds_timer(void)
Definition: time.c:64
ParamHandle ** handles
void WM_cursor_modal_set(wmWindow *win, int val)
Definition: wm_cursors.c:191
void WM_cursor_modal_restore(wmWindow *win)
Definition: wm_cursors.c:200
@ WM_CURSOR_NSEW_SCROLL
Definition: wm_cursors.h:51
int WM_userdef_event_type_from_keymap_type(int kmitype)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
@ MOUSEPAN
@ RIGHTMOUSE
@ TIMER
@ MOUSEZOOM
@ EVT_SPACEKEY
@ MOUSEMOVE
@ LEFTMOUSE
@ NDOF_MOTION
@ EVT_ESCKEY
wmOperatorType * ot
Definition: wm_files.c:3479
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
Definition: wm_jobs.c:437
void WM_jobs_kill_type(struct wmWindowManager *wm, const void *owner, int job_type)
Definition: wm_jobs.c:572
void WM_jobs_callbacks(wmJob *wm_job, wm_jobs_start_callback startjob, void(*initjob)(void *), void(*update)(void *), void(*endjob)(void *))
Definition: wm_jobs.c:351
bool WM_jobs_test(const wmWindowManager *wm, const void *owner, int job_type)
Definition: wm_jobs.c:214
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *))
Definition: wm_jobs.c:323
void WM_jobs_timer(wmJob *wm_job, double timestep, unsigned int note, unsigned int endnote)
Definition: wm_jobs.c:339
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, int flag, int job_type)
Definition: wm_jobs.c:184
void WM_operator_properties_filesel(wmOperatorType *ot, const int filter, const short type, const eFileSel_Action action, const eFileSel_Flag flag, const short display, const short sort)
void WM_operator_properties_use_cursor_init(wmOperatorType *ot)
wmOperatorType * WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag)
wmOperatorTypeMacro * WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer)
Definition: wm_window.c:1682
wmTimer * WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
Definition: wm_window.c:1630