Blender  V2.93
clip_ops.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 <errno.h>
25 #include <fcntl.h>
26 #include <sys/types.h>
27 
28 #ifndef WIN32
29 # include <unistd.h>
30 #else
31 # include <io.h>
32 #endif
33 
34 #include "MEM_guardedalloc.h"
35 
36 #include "DNA_scene_types.h" /* min/max frames */
37 #include "DNA_userdef_types.h"
38 
39 #include "BLI_fileops.h"
40 #include "BLI_math.h"
41 #include "BLI_path_util.h"
42 #include "BLI_rect.h"
43 #include "BLI_string.h"
44 #include "BLI_task.h"
45 #include "BLI_utildefines.h"
46 
47 #include "BLT_translation.h"
48 
49 #include "BKE_context.h"
50 #include "BKE_global.h"
51 #include "BKE_lib_id.h"
52 #include "BKE_main.h"
53 #include "BKE_movieclip.h"
54 #include "BKE_report.h"
55 #include "BKE_tracking.h"
56 
57 #include "WM_api.h"
58 #include "WM_types.h"
59 
60 #include "IMB_imbuf.h"
61 #include "IMB_imbuf_types.h"
62 
63 #include "ED_clip.h"
64 #include "ED_screen.h"
65 
66 #include "UI_interface.h"
67 
68 #include "RNA_access.h"
69 #include "RNA_define.h"
70 #include "RNA_enum_types.h"
71 
72 #include "UI_view2d.h"
73 
74 #include "PIL_time.h"
75 
76 #include "DEG_depsgraph.h"
77 #include "DEG_depsgraph_build.h"
78 
79 #include "clip_intern.h" /* own include */
80 
81 /* -------------------------------------------------------------------- */
85 static void sclip_zoom_set(const bContext *C,
86  float zoom,
87  const float location[2],
88  const bool zoom_to_pos)
89 {
91  ARegion *region = CTX_wm_region(C);
92 
93  float oldzoom = sc->zoom;
94  int width, height;
95 
96  sc->zoom = zoom;
97 
98  if (sc->zoom < 0.1f || sc->zoom > 4.0f) {
99  /* check zoom limits */
101 
102  width *= sc->zoom;
103  height *= sc->zoom;
104 
105  if ((width < 4) && (height < 4) && sc->zoom < oldzoom) {
106  sc->zoom = oldzoom;
107  }
108  else if (BLI_rcti_size_x(&region->winrct) <= sc->zoom) {
109  sc->zoom = oldzoom;
110  }
111  else if (BLI_rcti_size_y(&region->winrct) <= sc->zoom) {
112  sc->zoom = oldzoom;
113  }
114  }
115 
116  if (zoom_to_pos && location) {
117  float aspx, aspy, w, h, dx, dy;
118 
120  ED_space_clip_get_aspect(sc, &aspx, &aspy);
121 
122  w = width * aspx;
123  h = height * aspy;
124 
125  dx = ((location[0] - 0.5f) * w - sc->xof) * (sc->zoom - oldzoom) / sc->zoom;
126  dy = ((location[1] - 0.5f) * h - sc->yof) * (sc->zoom - oldzoom) / sc->zoom;
127 
129  sc->xlockof += dx;
130  sc->ylockof += dy;
131  }
132  else {
133  sc->xof += dx;
134  sc->yof += dy;
135  }
136  }
137 }
138 
139 static void sclip_zoom_set_factor(const bContext *C,
140  float zoomfac,
141  const float location[2],
142  const bool zoom_to_pos)
143 {
145 
146  sclip_zoom_set(C, sc->zoom * zoomfac, location, zoom_to_pos);
147 }
148 
149 static void sclip_zoom_set_factor_exec(bContext *C, const wmEvent *event, float factor)
150 {
151  ARegion *region = CTX_wm_region(C);
152 
153  float location[2], *mpos = NULL;
154 
155  if (event) {
157 
158  ED_clip_mouse_pos(sc, region, event->mval, location);
159  mpos = location;
160  }
161 
162  sclip_zoom_set_factor(C, factor, mpos, mpos ? (U.uiflag & USER_ZOOM_TO_MOUSEPOS) : false);
163 
164  ED_region_tag_redraw(region);
165 }
166 
169 /* -------------------------------------------------------------------- */
173 static void clip_filesel(bContext *C, wmOperator *op, const char *path)
174 {
175  RNA_string_set(op->ptr, "directory", path);
176 
178 }
179 
180 static void open_init(bContext *C, wmOperator *op)
181 {
182  PropertyPointerRNA *pprop;
183 
184  op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
186 }
187 
189 {
190  MEM_freeN(op->customdata);
191  op->customdata = NULL;
192 }
193 
194 static int open_exec(bContext *C, wmOperator *op)
195 {
197  bScreen *screen = CTX_wm_screen(C);
198  Main *bmain = CTX_data_main(C);
199  PropertyPointerRNA *pprop;
200  PointerRNA idptr;
201  MovieClip *clip = NULL;
202  char str[FILE_MAX];
203 
204  if (RNA_collection_length(op->ptr, "files")) {
205  PointerRNA fileptr;
206  PropertyRNA *prop;
207  char dir_only[FILE_MAX], file_only[FILE_MAX];
208  bool relative = RNA_boolean_get(op->ptr, "relative_path");
209 
210  RNA_string_get(op->ptr, "directory", dir_only);
211  if (relative) {
212  BLI_path_rel(dir_only, bmain->name);
213  }
214 
215  prop = RNA_struct_find_property(op->ptr, "files");
216  RNA_property_collection_lookup_int(op->ptr, prop, 0, &fileptr);
217  RNA_string_get(&fileptr, "name", file_only);
218 
219  BLI_join_dirfile(str, sizeof(str), dir_only, file_only);
220  }
221  else {
222  BKE_report(op->reports, RPT_ERROR, "No files selected to be opened");
223 
224  return OPERATOR_CANCELLED;
225  }
226 
227  /* default to frame 1 if there's no scene in context */
228 
229  errno = 0;
230 
231  clip = BKE_movieclip_file_add_exists(bmain, str);
232 
233  if (!clip) {
234  if (op->customdata) {
235  MEM_freeN(op->customdata);
236  }
237 
238  BKE_reportf(op->reports,
239  RPT_ERROR,
240  "Cannot read '%s': %s",
241  str,
242  errno ? strerror(errno) : TIP_("unsupported movie clip format"));
243 
244  return OPERATOR_CANCELLED;
245  }
246 
247  if (!op->customdata) {
248  open_init(C, op);
249  }
250 
251  /* hook into UI */
252  pprop = op->customdata;
253 
254  if (pprop->prop) {
255  /* when creating new ID blocks, use is already 1, but RNA
256  * pointer use also increases user, so this compensates it */
257  id_us_min(&clip->id);
258 
259  RNA_id_pointer_create(&clip->id, &idptr);
260  RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr, NULL);
261  RNA_property_update(C, &pprop->ptr, pprop->prop);
262  }
263  else if (sc) {
264  ED_space_clip_set_clip(C, screen, sc, clip);
265  }
266 
268 
270  MEM_freeN(op->customdata);
271 
272  return OPERATOR_FINISHED;
273 }
274 
275 static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
276 {
278  char path[FILE_MAX];
279  MovieClip *clip = NULL;
280 
281  if (sc) {
282  clip = ED_space_clip_get_clip(sc);
283  }
284 
285  if (clip) {
286  BLI_strncpy(path, clip->filepath, sizeof(path));
287 
288  BLI_path_abs(path, CTX_data_main(C)->name);
289  BLI_path_parent_dir(path);
290  }
291  else {
292  BLI_strncpy(path, U.textudir, sizeof(path));
293  }
294 
295  if (RNA_struct_property_is_set(op->ptr, "files")) {
296  return open_exec(C, op);
297  }
298 
299  if (!RNA_struct_property_is_set(op->ptr, "relative_path")) {
300  RNA_boolean_set(op->ptr, "relative_path", (U.flag & USER_RELPATHS) != 0);
301  }
302 
303  open_init(C, op);
304 
305  clip_filesel(C, op, path);
306 
307  return OPERATOR_RUNNING_MODAL;
308 }
309 
311 {
312  /* identifiers */
313  ot->name = "Open Clip";
314  ot->description = "Load a sequence of frames or a movie file";
315  ot->idname = "CLIP_OT_open";
316 
317  /* api callbacks */
318  ot->exec = open_exec;
319  ot->invoke = open_invoke;
320  ot->cancel = open_cancel;
321 
322  /* flags */
324 
325  /* properties */
328  FILE_SPECIAL,
333 }
334 
337 /* -------------------------------------------------------------------- */
342 {
344 
345  if (!clip) {
346  return OPERATOR_CANCELLED;
347  }
348 
351 
353 
354  return OPERATOR_FINISHED;
355 }
356 
358 {
359  /* identifiers */
360  ot->name = "Reload Clip";
361  ot->description = "Reload clip";
362  ot->idname = "CLIP_OT_reload";
363 
364  /* api callbacks */
365  ot->exec = reload_exec;
366 }
367 
370 /* -------------------------------------------------------------------- */
374 typedef struct ViewPanData {
375  float x, y;
376  float xof, yof, xorig, yorig;
379  float *vec;
381 
382 static void view_pan_init(bContext *C, wmOperator *op, const wmEvent *event)
383 {
384  wmWindow *win = CTX_wm_window(C);
386  ViewPanData *vpd;
387 
388  op->customdata = vpd = MEM_callocN(sizeof(ViewPanData), "ClipViewPanData");
389 
390  /* Grab will be set when running from gizmo. */
391  vpd->own_cursor = (win->grabcursor == 0);
392  if (vpd->own_cursor) {
394  }
395 
396  vpd->x = event->x;
397  vpd->y = event->y;
398 
400  vpd->vec = &sc->xlockof;
401  }
402  else {
403  vpd->vec = &sc->xof;
404  }
405 
406  copy_v2_v2(&vpd->xof, vpd->vec);
407  copy_v2_v2(&vpd->xorig, &vpd->xof);
408 
410 
412 }
413 
414 static void view_pan_exit(bContext *C, wmOperator *op, bool cancel)
415 {
416  ViewPanData *vpd = op->customdata;
417 
418  if (cancel) {
419  copy_v2_v2(vpd->vec, &vpd->xorig);
420 
422  }
423 
424  if (vpd->own_cursor) {
426  }
427  MEM_freeN(op->customdata);
428 }
429 
431 {
433  float offset[2];
434 
435  RNA_float_get_array(op->ptr, "offset", offset);
436 
438  sc->xlockof += offset[0];
439  sc->ylockof += offset[1];
440  }
441  else {
442  sc->xof += offset[0];
443  sc->yof += offset[1];
444  }
445 
447 
448  return OPERATOR_FINISHED;
449 }
450 
451 static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
452 {
453  if (event->type == MOUSEPAN) {
455  float offset[2];
456 
457  offset[0] = (event->prevx - event->x) / sc->zoom;
458  offset[1] = (event->prevy - event->y) / sc->zoom;
459 
460  RNA_float_set_array(op->ptr, "offset", offset);
461 
462  view_pan_exec(C, op);
463 
464  return OPERATOR_FINISHED;
465  }
466 
467  view_pan_init(C, op, event);
468 
469  return OPERATOR_RUNNING_MODAL;
470 }
471 
472 static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
473 {
475  ViewPanData *vpd = op->customdata;
476  float offset[2];
477 
478  switch (event->type) {
479  case MOUSEMOVE:
480  copy_v2_v2(vpd->vec, &vpd->xorig);
481  offset[0] = (vpd->x - event->x) / sc->zoom;
482  offset[1] = (vpd->y - event->y) / sc->zoom;
483  RNA_float_set_array(op->ptr, "offset", offset);
484  view_pan_exec(C, op);
485  break;
486  case EVT_ESCKEY:
487  view_pan_exit(C, op, 1);
488 
489  return OPERATOR_CANCELLED;
490  case EVT_SPACEKEY:
491  view_pan_exit(C, op, 0);
492 
493  return OPERATOR_FINISHED;
494  default:
495  if (event->type == vpd->launch_event && event->val == KM_RELEASE) {
496  view_pan_exit(C, op, 0);
497 
498  return OPERATOR_FINISHED;
499  }
500  break;
501  }
502 
503  return OPERATOR_RUNNING_MODAL;
504 }
505 
507 {
508  view_pan_exit(C, op, true);
509 }
510 
512 {
513  /* identifiers */
514  ot->name = "Pan View";
515  ot->idname = "CLIP_OT_view_pan";
516  ot->description = "Pan the view";
517 
518  /* api callbacks */
519  ot->exec = view_pan_exec;
524 
525  /* flags */
527 
528  /* properties */
530  "offset",
531  2,
532  NULL,
533  -FLT_MAX,
534  FLT_MAX,
535  "Offset",
536  "Offset in floating-point units, 1.0 is the width and height of the image",
537  -FLT_MAX,
538  FLT_MAX);
539 }
540 
543 /* -------------------------------------------------------------------- */
547 typedef struct ViewZoomData {
548  float x, y;
549  float zoom;
551  float location[2];
556 
557 static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
558 {
559  wmWindow *win = CTX_wm_window(C);
561  ARegion *region = CTX_wm_region(C);
562  ViewZoomData *vpd;
563 
564  op->customdata = vpd = MEM_callocN(sizeof(ViewZoomData), "ClipViewZoomData");
565 
566  /* Grab will be set when running from gizmo. */
567  vpd->own_cursor = (win->grabcursor == 0);
568  if (vpd->own_cursor) {
570  }
571 
572  if (U.viewzoom == USER_ZOOM_CONTINUE) {
573  /* needs a timer to continue redrawing */
576  }
577 
578  vpd->x = event->x;
579  vpd->y = event->y;
580  vpd->zoom = sc->zoom;
582 
583  ED_clip_mouse_pos(sc, region, event->mval, vpd->location);
584 
586 }
587 
588 static void view_zoom_exit(bContext *C, wmOperator *op, bool cancel)
589 {
591  ViewZoomData *vpd = op->customdata;
592 
593  if (cancel) {
594  sc->zoom = vpd->zoom;
596  }
597 
598  if (vpd->timer) {
600  }
601 
602  if (vpd->own_cursor) {
604  }
605  MEM_freeN(op->customdata);
606 }
607 
609 {
610  sclip_zoom_set_factor(C, RNA_float_get(op->ptr, "factor"), NULL, false);
611 
613 
614  return OPERATOR_FINISHED;
615 }
616 
617 static int view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
618 {
619  if (ELEM(event->type, MOUSEZOOM, MOUSEPAN)) {
620  float delta, factor;
621 
622  delta = event->prevx - event->x + event->prevy - event->y;
623 
624  if (U.uiflag & USER_ZOOM_INVERT) {
625  delta *= -1;
626  }
627 
628  factor = 1.0f + delta / 300.0f;
629  RNA_float_set(op->ptr, "factor", factor);
630 
631  sclip_zoom_set_factor_exec(C, event, factor);
632 
633  return OPERATOR_FINISHED;
634  }
635 
636  view_zoom_init(C, op, event);
637 
638  return OPERATOR_RUNNING_MODAL;
639 }
640 
641 static void view_zoom_apply(
642  bContext *C, ViewZoomData *vpd, wmOperator *op, const wmEvent *event, const bool zoom_to_pos)
643 {
644  float factor;
645  float delta;
646 
647  if (U.viewzoom != USER_ZOOM_SCALE) {
648  if (U.uiflag & USER_ZOOM_HORIZ) {
649  delta = (float)(event->x - vpd->x);
650  }
651  else {
652  delta = (float)(event->y - vpd->y);
653  }
654  }
655  else {
656  delta = event->x - vpd->x + event->y - vpd->y;
657  }
658 
659  delta /= U.pixelsize;
660 
661  if (U.uiflag & USER_ZOOM_INVERT) {
662  delta = -delta;
663  }
664 
665  if (U.viewzoom == USER_ZOOM_CONTINUE) {
666  SpaceClip *sclip = CTX_wm_space_clip(C);
667  double time = PIL_check_seconds_timer();
668  float time_step = (float)(time - vpd->timer_lastdraw);
669  float zfac;
670 
671  zfac = 1.0f + ((delta / 20.0f) * time_step);
672  vpd->timer_lastdraw = time;
673  factor = (sclip->zoom * zfac) / vpd->zoom;
674  }
675  else {
676  factor = 1.0f + delta / 300.0f;
677  }
678 
679  RNA_float_set(op->ptr, "factor", factor);
680  sclip_zoom_set(C, vpd->zoom * factor, vpd->location, zoom_to_pos);
682 }
683 
684 static int view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
685 {
686  ViewZoomData *vpd = op->customdata;
687  const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
688  switch (event->type) {
689  case TIMER:
690  if (event->customdata == vpd->timer) {
691  view_zoom_apply(C, vpd, op, event, use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS));
692  }
693  break;
694  case MOUSEMOVE:
695  view_zoom_apply(C, vpd, op, event, use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS));
696  break;
697  default:
698  if (event->type == vpd->launch_event && event->val == KM_RELEASE) {
699  view_zoom_exit(C, op, 0);
700 
701  return OPERATOR_FINISHED;
702  }
703  break;
704  }
705 
706  return OPERATOR_RUNNING_MODAL;
707 }
708 
710 {
711  view_zoom_exit(C, op, true);
712 }
713 
715 {
716  PropertyRNA *prop;
717 
718  /* identifiers */
719  ot->name = "View Zoom";
720  ot->idname = "CLIP_OT_view_zoom";
721  ot->description = "Zoom in/out the view";
722 
723  /* api callbacks */
729 
730  /* flags */
732 
733  /* properties */
734  prop = RNA_def_float(ot->srna,
735  "factor",
736  0.0f,
737  -FLT_MAX,
738  FLT_MAX,
739  "Factor",
740  "Zoom factor, values higher than 1.0 zoom in, lower values zoom out",
741  -FLT_MAX,
742  FLT_MAX);
744 
746 }
747 
750 /* -------------------------------------------------------------------- */
755 {
756  float location[2];
757 
758  RNA_float_get_array(op->ptr, "location", location);
759 
760  sclip_zoom_set_factor(C, powf(2.0f, 1.0f / 3.0f), location, U.uiflag & USER_ZOOM_TO_MOUSEPOS);
761 
763 
764  return OPERATOR_FINISHED;
765 }
766 
767 static int view_zoom_in_invoke(bContext *C, wmOperator *op, const wmEvent *event)
768 {
770  ARegion *region = CTX_wm_region(C);
771 
772  float location[2];
773 
774  ED_clip_mouse_pos(sc, region, event->mval, location);
775  RNA_float_set_array(op->ptr, "location", location);
776 
777  return view_zoom_in_exec(C, op);
778 }
779 
781 {
782  PropertyRNA *prop;
783 
784  /* identifiers */
785  ot->name = "Zoom In";
786  ot->idname = "CLIP_OT_view_zoom_in";
787  ot->description = "Zoom in the view";
788 
789  /* api callbacks */
793 
794  /* flags */
796 
797  /* properties */
798  prop = RNA_def_float_vector(ot->srna,
799  "location",
800  2,
801  NULL,
802  -FLT_MAX,
803  FLT_MAX,
804  "Location",
805  "Cursor location in screen coordinates",
806  -10.0f,
807  10.0f);
809 }
810 
812 {
813  float location[2];
814 
815  RNA_float_get_array(op->ptr, "location", location);
816 
817  sclip_zoom_set_factor(C, powf(0.5f, 1.0f / 3.0f), location, U.uiflag & USER_ZOOM_TO_MOUSEPOS);
818 
820 
821  return OPERATOR_FINISHED;
822 }
823 
824 static int view_zoom_out_invoke(bContext *C, wmOperator *op, const wmEvent *event)
825 {
827  ARegion *region = CTX_wm_region(C);
828 
829  float location[2];
830 
831  ED_clip_mouse_pos(sc, region, event->mval, location);
832  RNA_float_set_array(op->ptr, "location", location);
833 
834  return view_zoom_out_exec(C, op);
835 }
836 
838 {
839  PropertyRNA *prop;
840 
841  /* identifiers */
842  ot->name = "Zoom Out";
843  ot->idname = "CLIP_OT_view_zoom_out";
844  ot->description = "Zoom out the view";
845 
846  /* api callbacks */
850 
851  /* flags */
853 
854  /* properties */
855  prop = RNA_def_float_vector(ot->srna,
856  "location",
857  2,
858  NULL,
859  -FLT_MAX,
860  FLT_MAX,
861  "Location",
862  "Cursor location in normalized (0.0 to 1.0) coordinates",
863  -10.0f,
864  10.0f);
866 }
867 
870 /* -------------------------------------------------------------------- */
875 {
877 
878  sclip_zoom_set(C, RNA_float_get(op->ptr, "ratio"), NULL, false);
879 
880  /* ensure pixel exact locations for draw */
881  sc->xof = (int)sc->xof;
882  sc->yof = (int)sc->yof;
883 
885 
886  return OPERATOR_FINISHED;
887 }
888 
890 {
891  /* identifiers */
892  ot->name = "View Zoom Ratio";
893  ot->idname = "CLIP_OT_view_zoom_ratio";
894  ot->description = "Set the zoom ratio (based on clip size)";
895 
896  /* api callbacks */
899 
900  /* flags */
902 
903  /* properties */
905  "ratio",
906  0.0f,
907  -FLT_MAX,
908  FLT_MAX,
909  "Ratio",
910  "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out",
911  -FLT_MAX,
912  FLT_MAX);
913 }
916 /* -------------------------------------------------------------------- */
921 {
922  SpaceClip *sc;
923  ARegion *region;
924  int w, h, width, height;
925  float aspx, aspy;
926  bool fit_view = RNA_boolean_get(op->ptr, "fit_view");
927  float zoomx, zoomy;
928 
929  /* retrieve state */
930  sc = CTX_wm_space_clip(C);
931  region = CTX_wm_region(C);
932 
933  ED_space_clip_get_size(sc, &w, &h);
934  ED_space_clip_get_aspect(sc, &aspx, &aspy);
935 
936  w = w * aspx;
937  h = h * aspy;
938 
939  /* check if the image will fit in the image with zoom == 1 */
940  width = BLI_rcti_size_x(&region->winrct) + 1;
941  height = BLI_rcti_size_y(&region->winrct) + 1;
942 
943  if (fit_view) {
944  const int margin = 5; /* margin from border */
945 
946  zoomx = (float)width / (w + 2 * margin);
947  zoomy = (float)height / (h + 2 * margin);
948 
949  sclip_zoom_set(C, min_ff(zoomx, zoomy), NULL, false);
950  }
951  else {
952  if ((w >= width || h >= height) && (width > 0 && height > 0)) {
953  zoomx = (float)width / w;
954  zoomy = (float)height / h;
955 
956  /* find the zoom value that will fit the image in the image space */
957  sclip_zoom_set(C, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), NULL, false);
958  }
959  else {
960  sclip_zoom_set(C, 1.0f, NULL, false);
961  }
962  }
963 
964  sc->xof = sc->yof = 0.0f;
965 
966  ED_region_tag_redraw(region);
967 
968  return OPERATOR_FINISHED;
969 }
970 
972 {
973  PropertyRNA *prop;
974 
975  /* identifiers */
976  ot->name = "Frame All";
977  ot->idname = "CLIP_OT_view_all";
978  ot->description = "View whole image with markers";
979 
980  /* api callbacks */
981  ot->exec = view_all_exec;
983 
984  /* flags */
986 
987  /* properties */
988  prop = RNA_def_boolean(ot->srna, "fit_view", 0, "Fit View", "Fit frame to the viewport");
990 }
993 /* -------------------------------------------------------------------- */
998 {
1000  ARegion *region = CTX_wm_region(C);
1001 
1002  clip_view_center_to_point(sc, sc->cursor[0], sc->cursor[1]);
1003 
1004  ED_region_tag_redraw(region);
1005 
1006  return OPERATOR_FINISHED;
1007 }
1008 
1010 {
1011  /* identifiers */
1012  ot->name = "Center View to Cursor";
1013  ot->description = "Center the view so that the cursor is in the middle of the view";
1014  ot->idname = "CLIP_OT_view_center_cursor";
1015 
1016  /* api callbacks */
1019 }
1020 
1023 /* -------------------------------------------------------------------- */
1028 {
1029  SpaceClip *sc = CTX_wm_space_clip(C);
1030  ARegion *region = CTX_wm_region(C);
1031 
1032  sc->xlockof = 0.0f;
1033  sc->ylockof = 0.0f;
1034 
1035  ED_clip_view_selection(C, region, 1);
1036  ED_region_tag_redraw(region);
1037 
1038  return OPERATOR_FINISHED;
1039 }
1040 
1042 {
1043  /* identifiers */
1044  ot->name = "Frame Selected";
1045  ot->idname = "CLIP_OT_view_selected";
1046  ot->description = "View all selected elements";
1047 
1048  /* api callbacks */
1051 
1052  /* flags */
1054 }
1057 /* -------------------------------------------------------------------- */
1062 {
1063  /* prevent changes during render */
1064  if (G.is_rendering) {
1065  return false;
1066  }
1067  SpaceClip *space_clip = CTX_wm_space_clip(C);
1068  return space_clip != NULL;
1069 }
1070 
1072 {
1074 
1075  /* set the new frame number */
1076  CFRA = RNA_int_get(op->ptr, "frame");
1078  SUBFRA = 0.0f;
1079 
1080  /* do updates */
1083 }
1084 
1086 {
1087  change_frame_apply(C, op);
1088 
1089  return OPERATOR_FINISHED;
1090 }
1091 
1092 static int frame_from_event(bContext *C, const wmEvent *event)
1093 {
1094  ARegion *region = CTX_wm_region(C);
1096  int framenr = 0;
1097 
1098  if (region->regiontype == RGN_TYPE_WINDOW) {
1099  float sfra = SFRA, efra = EFRA, framelen = region->winx / (efra - sfra + 1);
1100 
1101  framenr = sfra + event->mval[0] / framelen;
1102  }
1103  else {
1104  float viewx, viewy;
1105 
1106  UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
1107 
1108  framenr = round_fl_to_int(viewx);
1109  }
1110 
1111  return framenr;
1112 }
1113 
1114 static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1115 {
1116  ARegion *region = CTX_wm_region(C);
1117 
1118  if (region->regiontype == RGN_TYPE_WINDOW) {
1119  if (event->mval[1] > 16 * UI_DPI_FAC) {
1120  return OPERATOR_PASS_THROUGH;
1121  }
1122  }
1123 
1124  RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
1125 
1126  change_frame_apply(C, op);
1127 
1128  /* add temp handler */
1130 
1131  return OPERATOR_RUNNING_MODAL;
1132 }
1133 
1134 static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
1135 {
1136  switch (event->type) {
1137  case EVT_ESCKEY:
1138  return OPERATOR_FINISHED;
1139 
1140  case MOUSEMOVE:
1141  RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
1142  change_frame_apply(C, op);
1143  break;
1144 
1145  case LEFTMOUSE:
1146  case RIGHTMOUSE:
1147  if (event->val == KM_RELEASE) {
1148  return OPERATOR_FINISHED;
1149  }
1150  break;
1151  }
1152 
1153  return OPERATOR_RUNNING_MODAL;
1154 }
1155 
1157 {
1158  /* identifiers */
1159  ot->name = "Change Frame";
1160  ot->idname = "CLIP_OT_change_frame";
1161  ot->description = "Interactively change the current frame number";
1162 
1163  /* api callbacks */
1168 
1169  /* flags */
1171 
1172  /* rna */
1173  RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
1174 }
1177 /* -------------------------------------------------------------------- */
1181 typedef struct ProxyBuildJob {
1183  struct Main *main;
1186  bool stop;
1189 
1190 static void proxy_freejob(void *pjv)
1191 {
1192  ProxyJob *pj = pjv;
1193 
1194  MEM_freeN(pj);
1195 }
1196 
1197 static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undistort)
1198 {
1199  int build_count = 0;
1200  const int size_flags[2][4] = {
1206  int size_nr = undistort ? 1 : 0;
1207 
1208  if (size_flag & size_flags[size_nr][0]) {
1209  build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_25;
1210  }
1211 
1212  if (size_flag & size_flags[size_nr][1]) {
1213  build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_50;
1214  }
1215 
1216  if (size_flag & size_flags[size_nr][2]) {
1217  build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_75;
1218  }
1219 
1220  if (size_flag & size_flags[size_nr][3]) {
1221  build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_100;
1222  }
1223 
1224  return build_count;
1225 }
1226 
1227 /* simple case for movies -- handle frame-by-frame, do threading within single frame */
1228 static void do_movie_proxy(void *pjv,
1229  int *UNUSED(build_sizes),
1230  int UNUSED(build_count),
1231  int *build_undistort_sizes,
1232  int build_undistort_count,
1233  short *stop,
1234  short *do_update,
1235  float *progress)
1236 {
1237  ProxyJob *pj = pjv;
1238  Scene *scene = pj->scene;
1239  MovieClip *clip = pj->clip;
1240  struct MovieDistortion *distortion = NULL;
1241  int cfra, sfra = SFRA, efra = EFRA;
1242 
1243  if (pj->index_context) {
1244  IMB_anim_index_rebuild(pj->index_context, stop, do_update, progress);
1245  }
1246 
1247  if (!build_undistort_count) {
1248  if (*stop) {
1249  pj->stop = 1;
1250  }
1251 
1252  return;
1253  }
1254 
1255  sfra = 1;
1256  efra = clip->len;
1257 
1258  if (build_undistort_count) {
1260  int width, height;
1261 
1263 
1264  distortion = BKE_tracking_distortion_new(&clip->tracking, width, height);
1266  }
1267 
1268  for (cfra = sfra; cfra <= efra; cfra++) {
1270  clip, pj->clip_flag, distortion, cfra, build_undistort_sizes, build_undistort_count, 1);
1271 
1272  if (*stop || G.is_break) {
1273  break;
1274  }
1275 
1276  *do_update = true;
1277  *progress = ((float)cfra - sfra) / (efra - sfra);
1278  }
1279 
1280  if (distortion) {
1281  BKE_tracking_distortion_free(distortion);
1282  }
1283 
1284  if (*stop) {
1285  pj->stop = 1;
1286  }
1287 }
1288 
1289 /* *****
1290  * special case for sequences -- handle different frames in different threads,
1291  * loading from disk happens in critical section, decoding frame happens from
1292  * thread for maximal speed
1293  */
1294 
1295 typedef struct ProxyQueue {
1296  int cfra;
1297  int sfra;
1298  int efra;
1300 
1301  const short *stop;
1302  short *do_update;
1303  float *progress;
1305 
1306 typedef struct ProxyThread {
1312 
1314  MovieClip *clip,
1315  size_t *r_size,
1316  int *r_cfra)
1317 {
1318  uchar *mem = NULL;
1319 
1320  BLI_spin_lock(&queue->spin);
1321  if (!*queue->stop && queue->cfra <= queue->efra) {
1322  MovieClipUser user = {0};
1323  char name[FILE_MAX];
1324  size_t size;
1325  int file;
1326 
1327  user.framenr = queue->cfra;
1328 
1329  BKE_movieclip_filename_for_frame(clip, &user, name);
1330 
1331  file = BLI_open(name, O_BINARY | O_RDONLY, 0);
1332  if (file < 0) {
1333  BLI_spin_unlock(&queue->spin);
1334  return NULL;
1335  }
1336 
1338  if (size < 1) {
1339  close(file);
1340  BLI_spin_unlock(&queue->spin);
1341  return NULL;
1342  }
1343 
1344  mem = MEM_mallocN(size, "movieclip proxy memory file");
1345 
1346  if (read(file, mem, size) != size) {
1347  close(file);
1348  BLI_spin_unlock(&queue->spin);
1349  MEM_freeN(mem);
1350  return NULL;
1351  }
1352 
1353  *r_size = size;
1354  *r_cfra = queue->cfra;
1355 
1356  queue->cfra++;
1357  close(file);
1358 
1359  *queue->do_update = 1;
1360  *queue->progress = (float)(queue->cfra - queue->sfra) / (queue->efra - queue->sfra);
1361  }
1362  BLI_spin_unlock(&queue->spin);
1363 
1364  return mem;
1365 }
1366 
1367 static void proxy_task_func(TaskPool *__restrict pool, void *task_data)
1368 {
1369  ProxyThread *data = (ProxyThread *)task_data;
1371  uchar *mem;
1372  size_t size;
1373  int cfra;
1374 
1375  while ((mem = proxy_thread_next_frame(queue, data->clip, &size, &cfra))) {
1376  ImBuf *ibuf;
1377 
1378  ibuf = IMB_ibImageFromMemory(mem,
1379  size,
1381  data->clip->colorspace_settings.name,
1382  "proxy frame");
1383 
1385  data->clip, ibuf, NULL, cfra, data->build_sizes, data->build_count, false);
1386 
1388  ibuf,
1389  data->distortion,
1390  cfra,
1391  data->build_undistort_sizes,
1392  data->build_undistort_count,
1393  true);
1394 
1395  IMB_freeImBuf(ibuf);
1396 
1397  MEM_freeN(mem);
1398  }
1399 }
1400 
1401 static void do_sequence_proxy(void *pjv,
1402  int *build_sizes,
1403  int build_count,
1404  int *build_undistort_sizes,
1405  int build_undistort_count,
1406  /* Cannot be const, because it is assigned to a non-const variable.
1407  * NOLINTNEXTLINE: readability-non-const-parameter. */
1408  short *stop,
1409  short *do_update,
1410  float *progress)
1411 {
1412  ProxyJob *pj = pjv;
1413  MovieClip *clip = pj->clip;
1414  Scene *scene = pj->scene;
1415  int sfra = SFRA, efra = EFRA;
1417  int tot_thread = BLI_task_scheduler_num_threads();
1418  int width, height;
1419 
1420  if (build_undistort_count) {
1422  }
1423 
1424  ProxyQueue queue;
1425  BLI_spin_init(&queue.spin);
1426 
1427  queue.cfra = sfra;
1428  queue.sfra = sfra;
1429  queue.efra = efra;
1430  queue.stop = stop;
1431  queue.do_update = do_update;
1432  queue.progress = progress;
1433 
1435  handles = MEM_callocN(sizeof(ProxyThread) * tot_thread, "proxy threaded handles");
1436  for (int i = 0; i < tot_thread; i++) {
1437  ProxyThread *handle = &handles[i];
1438 
1439  handle->clip = clip;
1440 
1441  handle->build_count = build_count;
1442  handle->build_sizes = build_sizes;
1443 
1444  handle->build_undistort_count = build_undistort_count;
1445  handle->build_undistort_sizes = build_undistort_sizes;
1446 
1447  if (build_undistort_count) {
1449  }
1450 
1452  }
1453 
1456 
1457  if (build_undistort_count) {
1458  for (int i = 0; i < tot_thread; i++) {
1459  ProxyThread *handle = &handles[i];
1461  }
1462  }
1463 
1464  BLI_spin_end(&queue.spin);
1465  MEM_freeN(handles);
1466 }
1467 
1468 static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress)
1469 {
1470  ProxyJob *pj = pjv;
1471  MovieClip *clip = pj->clip;
1472 
1473  short size_flag;
1474  int build_sizes[4], build_count = 0;
1475  int build_undistort_sizes[4], build_undistort_count = 0;
1476 
1477  size_flag = clip->proxy.build_size_flag;
1478 
1479  build_count = proxy_bitflag_to_array(size_flag, build_sizes, 0);
1480  build_undistort_count = proxy_bitflag_to_array(size_flag, build_undistort_sizes, 1);
1481 
1482  if (clip->source == MCLIP_SRC_MOVIE) {
1483  do_movie_proxy(pjv,
1484  build_sizes,
1485  build_count,
1486  build_undistort_sizes,
1487  build_undistort_count,
1488  stop,
1489  do_update,
1490  progress);
1491  }
1492  else {
1493  do_sequence_proxy(pjv,
1494  build_sizes,
1495  build_count,
1496  build_undistort_sizes,
1497  build_undistort_count,
1498  stop,
1499  do_update,
1500  progress);
1501  }
1502 }
1503 
1504 static void proxy_endjob(void *pjv)
1505 {
1506  ProxyJob *pj = pjv;
1507 
1508  if (pj->clip->anim) {
1510  }
1511 
1512  if (pj->index_context) {
1514  }
1515 
1516  if (pj->clip->source == MCLIP_SRC_MOVIE) {
1517  /* Time-code might have changed, so do a full reload to deal with this. */
1519  }
1520  else {
1521  /* For image sequences we'll preserve original cache. */
1523  }
1524 
1526 }
1527 
1529 {
1530  wmJob *wm_job;
1531  ProxyJob *pj;
1533  ScrArea *area = CTX_wm_area(C);
1534  SpaceClip *sc = CTX_wm_space_clip(C);
1535  MovieClip *clip = ED_space_clip_get_clip(sc);
1536 
1537  if ((clip->flag & MCLIP_USE_PROXY) == 0) {
1538  return OPERATOR_CANCELLED;
1539  }
1540 
1541  wm_job = WM_jobs_get(CTX_wm_manager(C),
1542  CTX_wm_window(C),
1543  scene,
1544  "Building Proxies",
1547 
1548  pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
1549  pj->scene = scene;
1550  pj->main = CTX_data_main(C);
1551  pj->clip = clip;
1552  pj->clip_flag = clip->flag & MCLIP_TIMECODE_FLAGS;
1553 
1554  if (clip->anim) {
1556  clip->proxy.build_tc_flag,
1557  clip->proxy.build_size_flag,
1558  clip->proxy.quality,
1559  true,
1560  NULL);
1561  }
1562 
1564  WM_jobs_timer(wm_job, 0.2, NC_MOVIECLIP | ND_DISPLAY, 0);
1566 
1567  G.is_break = false;
1568  WM_jobs_start(CTX_wm_manager(C), wm_job);
1569 
1571 
1572  return OPERATOR_FINISHED;
1573 }
1574 
1576 {
1577  /* identifiers */
1578  ot->name = "Rebuild Proxy and Timecode Indices";
1579  ot->idname = "CLIP_OT_rebuild_proxy";
1580  ot->description = "Rebuild all selected proxies and timecode indices in the background";
1581 
1582  /* api callbacks */
1585 
1586  /* flags */
1587  ot->flag = OPTYPE_REGISTER;
1588 }
1591 /* -------------------------------------------------------------------- */
1596 {
1597  SpaceClip *sc = CTX_wm_space_clip(C);
1598  int mode = RNA_enum_get(op->ptr, "mode");
1599 
1600  sc->mode = mode;
1601 
1602  if (sc->mode == SC_MODE_MASKEDIT && sc->view != SC_VIEW_CLIP) {
1603  /* Make sure we are in the right view for mask editing */
1604  sc->view = SC_VIEW_CLIP;
1605  }
1606 
1608 
1609  return OPERATOR_FINISHED;
1610 }
1611 
1613 {
1614  /* identifiers */
1615  ot->name = "Set Clip Mode";
1616  ot->description = "Set the clip interaction mode";
1617  ot->idname = "CLIP_OT_mode_set";
1618 
1619  /* api callbacks */
1620  ot->exec = mode_set_exec;
1621 
1623 
1624  /* properties */
1626 }
1627 
1628 #ifdef WITH_INPUT_NDOF
1629 
1632 /* -------------------------------------------------------------------- */
1636 /* Combined pan/zoom from a 3D mouse device.
1637  * Z zooms, XY pans
1638  * "view" (not "paper") control -- user moves the viewpoint, not the image being viewed
1639  * that explains the negative signs in the code below
1640  */
1641 
1642 static int clip_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
1643 {
1644  if (event->type != NDOF_MOTION) {
1645  return OPERATOR_CANCELLED;
1646  }
1647 
1648  SpaceClip *sc = CTX_wm_space_clip(C);
1649  ARegion *region = CTX_wm_region(C);
1650  float pan_vec[3];
1651 
1652  const wmNDOFMotionData *ndof = event->customdata;
1653  const float speed = NDOF_PIXELS_PER_SECOND;
1654 
1655  WM_event_ndof_pan_get(ndof, pan_vec, true);
1656 
1657  mul_v2_fl(pan_vec, (speed * ndof->dt) / sc->zoom);
1658  pan_vec[2] *= -ndof->dt;
1659 
1660  sclip_zoom_set_factor(C, 1.0f + pan_vec[2], NULL, false);
1661  sc->xof += pan_vec[0];
1662  sc->yof += pan_vec[1];
1663 
1664  ED_region_tag_redraw(region);
1665 
1666  return OPERATOR_FINISHED;
1667 }
1668 
1669 void CLIP_OT_view_ndof(wmOperatorType *ot)
1670 {
1671  /* identifiers */
1672  ot->name = "NDOF Pan/Zoom";
1673  ot->idname = "CLIP_OT_view_ndof";
1674  ot->description = "Use a 3D mouse device to pan/zoom the view";
1675 
1676  /* api callbacks */
1677  ot->invoke = clip_view_ndof_invoke;
1679 
1680  /* flags */
1682 }
1683 
1686 #endif /* WITH_INPUT_NDOF */
1687 
1688 /* -------------------------------------------------------------------- */
1692 static int clip_prefetch_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
1693 {
1694  /* no running blender, remove handler and pass through */
1697  }
1698 
1699  /* running render */
1700  switch (event->type) {
1701  case EVT_ESCKEY:
1702  return OPERATOR_RUNNING_MODAL;
1703  }
1704 
1705  return OPERATOR_PASS_THROUGH;
1706 }
1707 
1708 static int clip_prefetch_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(_event))
1709 {
1711 
1712  /* add modal handler for ESC */
1714 
1715  return OPERATOR_RUNNING_MODAL;
1716 }
1717 
1719 {
1720  /* identifiers */
1721  ot->name = "Prefetch Frames";
1722  ot->idname = "CLIP_OT_prefetch";
1723  ot->description = "Prefetch frames from disk for faster playback/tracking";
1724 
1725  /* api callbacks */
1729 }
1732 /* -------------------------------------------------------------------- */
1737 {
1740  int clip_length;
1741 
1742  if (ELEM(NULL, scene, clip)) {
1743  return OPERATOR_CANCELLED;
1744  }
1745 
1746  clip_length = BKE_movieclip_get_duration(clip);
1747 
1748  scene->r.sfra = clip->start_frame;
1749  scene->r.efra = scene->r.sfra + clip_length - 1;
1750 
1751  scene->r.efra = max_ii(scene->r.sfra, scene->r.efra);
1752 
1754 
1755  return OPERATOR_FINISHED;
1756 }
1757 
1759 {
1760  /* identifiers */
1761  ot->name = "Set Scene Frames";
1762  ot->idname = "CLIP_OT_set_scene_frames";
1763  ot->description = "Set scene's start and end frame to match clip's start frame and length";
1764 
1765  /* api callbacks */
1768 }
1771 /* -------------------------------------------------------------------- */
1776 {
1777  SpaceClip *sclip = CTX_wm_space_clip(C);
1778  bool show_cursor = false;
1779 
1780  show_cursor |= sclip->mode == SC_MODE_MASKEDIT;
1781  show_cursor |= sclip->around == V3D_AROUND_CURSOR;
1782 
1783  if (!show_cursor) {
1784  return OPERATOR_CANCELLED;
1785  }
1786 
1787  RNA_float_get_array(op->ptr, "location", sclip->cursor);
1788 
1790 
1791  return OPERATOR_FINISHED;
1792 }
1793 
1794 static int clip_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1795 {
1796  ARegion *region = CTX_wm_region(C);
1797  SpaceClip *sclip = CTX_wm_space_clip(C);
1798  float location[2];
1799 
1800  ED_clip_mouse_pos(sclip, region, event->mval, location);
1801  RNA_float_set_array(op->ptr, "location", location);
1802 
1803  return clip_set_2d_cursor_exec(C, op);
1804 }
1805 
1807 {
1808  /* identifiers */
1809  ot->name = "Set 2D Cursor";
1810  ot->description = "Set 2D cursor location";
1811  ot->idname = "CLIP_OT_cursor_set";
1812 
1813  /* api callbacks */
1817 
1818  /* flags */
1820 
1821  /* properties */
1823  "location",
1824  2,
1825  NULL,
1826  -FLT_MAX,
1827  FLT_MAX,
1828  "Location",
1829  "Cursor location in normalized clip coordinates",
1830  -10.0f,
1831  10.0f);
1832 }
1833 
1836 /* -------------------------------------------------------------------- */
1841 {
1842  SpaceClip *space_clip = CTX_wm_space_clip(C);
1843 
1844  ClipViewLockState lock_state;
1845  ED_clip_view_lock_state_store(C, &lock_state);
1846 
1847  space_clip->flag ^= SC_LOCK_SELECTION;
1848 
1850 
1852 
1853  return OPERATOR_FINISHED;
1854 }
1855 
1857 {
1858  /* identifiers */
1859  ot->name = "Toggle Lock Selection";
1860  ot->description = "Toggle Lock Selection option of the current clip editor";
1861  ot->idname = "CLIP_OT_lock_selection_toggle";
1862 
1863  /* api callbacks */
1866 
1867  /* flags */
1869 }
1870 
1873 /* -------------------------------------------------------------------- */
1878 {
1879  wmOperatorType *ot;
1880  wmOperatorTypeMacro *otmacro;
1881 
1882  ot = WM_operatortype_append_macro("CLIP_OT_add_marker_move",
1883  "Add Marker and Move",
1884  "Add new marker and move it on movie",
1886  WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
1887  otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
1888  RNA_struct_idprops_unset(otmacro->ptr, "release_confirm");
1889 
1891  "CLIP_OT_add_marker_slide",
1892  "Add Marker and Slide",
1893  "Add new marker and slide it with mouse until mouse button release",
1895  WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
1896  otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
1897  RNA_boolean_set(otmacro->ptr, "release_confirm", true);
1898 }
1899 
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:714
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct SpaceClip * CTX_wm_space_clip(const bContext *C)
Definition: context.c:899
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:689
struct MovieClip * CTX_data_edit_movieclip(const bContext *C)
Definition: context.c:1311
struct bScreen * CTX_wm_screen(const bContext *C)
Definition: context.c:709
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:725
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:699
void id_us_min(struct ID *id)
Definition: lib_id.c:297
struct MovieClip * BKE_movieclip_file_add_exists(struct Main *bmain, const char *filepath)
Definition: movieclip.c:1051
void BKE_movieclip_reload(struct Main *bmain, struct MovieClip *clip)
Definition: movieclip.c:1686
int BKE_movieclip_get_duration(struct MovieClip *clip)
Definition: movieclip.c:1582
void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, int *width, int *height)
Definition: movieclip.c:1540
void BKE_movieclip_filename_for_frame(struct MovieClip *clip, struct MovieClipUser *user, char *name)
Definition: movieclip.c:1939
void BKE_movieclip_clear_proxy_cache(struct MovieClip *clip)
Definition: movieclip.c:1679
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:1899
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:1855
void BKE_report(ReportList *reports, ReportType type, const char *message)
Definition: report.c:104
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
struct MovieDistortion * BKE_tracking_distortion_new(struct MovieTracking *tracking, int calibration_width, int calibration_height)
Definition: tracking.c:2406
void BKE_tracking_distortion_set_threads(struct MovieDistortion *distortion, int threads)
Definition: tracking.c:2445
void BKE_tracking_distortion_free(struct MovieDistortion *distortion)
Definition: tracking.c:2553
File and directory operations.
int BLI_open(const char *filename, int oflag, int pmode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: fileops.c:1017
#define O_BINARY
Definition: BLI_fileops.h:182
size_t BLI_file_descriptor_size(int file) ATTR_WARN_UNUSED_RESULT
Definition: storage.c:207
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_join_dirfile(char *__restrict dst, const size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL()
Definition: path_util.c:1737
void BLI_path_rel(char *file, const char *relfile) ATTR_NONNULL()
Definition: path_util.c:519
bool BLI_path_parent_dir(char *path) ATTR_NONNULL()
Definition: path_util.c:708
bool BLI_path_abs(char *path, const char *basepath) ATTR_NONNULL()
Definition: path_util.c:1016
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
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
unsigned char uchar
Definition: BLI_sys_types.h:86
int BLI_task_scheduler_num_threads(void)
void * BLI_task_pool_user_data(TaskPool *pool)
Definition: task_pool.cc:541
void BLI_task_pool_work_and_wait(TaskPool *pool)
Definition: task_pool.cc:496
TaskPool * BLI_task_pool_create(void *userdata, TaskPriority priority)
Definition: task_pool.cc:406
void BLI_task_pool_free(TaskPool *pool)
Definition: task_pool.cc:456
@ TASK_PRIORITY_LOW
Definition: BLI_task.h:66
void BLI_task_pool_push(TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata)
Definition: task_pool.cc:475
pthread_spinlock_t SpinLock
Definition: BLI_threads.h:111
int BLI_system_thread_count(void)
Definition: threads.cc:309
void BLI_spin_init(SpinLock *spin)
Definition: threads.cc:447
void BLI_spin_unlock(SpinLock *spin)
Definition: threads.cc:480
void BLI_spin_lock(SpinLock *spin)
Definition: threads.cc:461
void BLI_spin_end(SpinLock *spin)
Definition: threads.cc:495
#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_SOURCE
Definition: DNA_ID.h:673
@ ID_RECALC_AUDIO_SEEK
Definition: DNA_ID.h:660
@ MCLIP_TIMECODE_FLAGS
@ MCLIP_USE_PROXY
@ 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_SRC_MOVIE
@ MCLIP_PROXY_RENDER_SIZE_75
@ MCLIP_PROXY_RENDER_SIZE_100
@ MCLIP_PROXY_RENDER_SIZE_50
@ MCLIP_PROXY_RENDER_SIZE_25
#define SUBFRA
#define MINAFRAME
#define CFRA
#define SFRA
#define EFRA
#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_OPENFILE
@ 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:76
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:577
bool ED_space_clip_maskedit_poll(struct bContext *C)
Definition: clip_editor.c:109
void ED_space_clip_get_aspect(struct SpaceClip *sc, float *aspx, float *aspy)
Definition: clip_editor.c:171
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:141
bool ED_space_clip_view_clip_poll(struct bContext *C)
Definition: clip_editor.c:87
void ED_clip_mouse_pos(struct SpaceClip *sc, struct ARegion *region, const int mval[2], float co[2])
Definition: clip_editor.c:543
struct MovieClip * ED_space_clip_get_clip(struct SpaceClip *sc)
Definition: clip_editor.c:572
void ED_clip_view_lock_state_store(const struct bContext *C, ClipViewLockState *state)
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:745
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:667
_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
void IMB_anim_index_rebuild(struct IndexBuildContext *context, short *stop, short *do_update, float *progress)
Definition: indexer.c:1352
void IMB_close_anim_proxies(struct anim *anim)
Definition: anim_movie.c:238
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)
Definition: indexer.c:1274
void IMB_freeImBuf(struct ImBuf *ibuf)
Definition: allocimbuf.c:211
void IMB_anim_index_rebuild_finish(struct IndexBuildContext *context, short stop)
Definition: indexer.c:1376
struct ImBuf * IMB_ibImageFromMemory(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE], const char *descr)
Definition: readimage.c:99
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:204
@ PROP_HIDDEN
Definition: RNA_types.h:202
#define C
Definition: RandGen.cpp:39
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:309
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
#define WM_FILESEL_DIRECTORY
Definition: WM_api.h:535
@ WM_JOB_TYPE_CLIP_BUILD_PROXY
Definition: WM_api.h:743
@ WM_JOB_TYPE_CLIP_PREFETCH
Definition: WM_api.h:746
#define WM_FILESEL_RELPATH
Definition: WM_api.h:533
#define WM_FILESEL_FILES
Definition: WM_api.h:538
@ WM_JOB_PROGRESS
Definition: WM_api.h:726
@ OPTYPE_BLOCKING
Definition: WM_types.h:157
@ OPTYPE_LOCK_BYPASS
Definition: WM_types.h:178
@ OPTYPE_UNDO
Definition: WM_types.h:155
@ OPTYPE_GRAB_CURSOR_XY
Definition: WM_types.h:161
@ OPTYPE_REGISTER
Definition: WM_types.h:153
#define ND_DISPLAY
Definition: WM_types.h:391
#define NC_MOVIECLIP
Definition: WM_types.h:298
#define NC_SCENE
Definition: WM_types.h:279
#define NA_ADDED
Definition: WM_types.h:464
#define NA_EDITED
Definition: WM_types.h:462
#define ND_SPACE_CLIP
Definition: WM_types.h:433
#define ND_FRAME
Definition: WM_types.h:334
#define NC_SPACE
Definition: WM_types.h:293
#define KM_RELEASE
Definition: WM_types.h:243
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:1105
void clip_view_center_to_point(SpaceClip *sc, float x, float y)
Definition: clip_utils.c:415
bool clip_view_has_locked_selection(const struct bContext *C)
static int view_zoom_ratio_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:874
void CLIP_OT_view_zoom_in(wmOperatorType *ot)
Definition: clip_ops.c:780
static int lock_selection_toggle_exec(bContext *C, wmOperator *UNUSED(op))
Definition: clip_ops.c:1840
static void proxy_freejob(void *pjv)
Definition: clip_ops.c:1190
static int open_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:194
void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
Definition: clip_ops.c:889
struct ProxyThread ProxyThread
static void sclip_zoom_set_factor_exec(bContext *C, const wmEvent *event, float factor)
Definition: clip_ops.c:149
void CLIP_OT_cursor_set(wmOperatorType *ot)
Definition: clip_ops.c:1806
static void sclip_zoom_set_factor(const bContext *C, float zoomfac, const float location[2], const bool zoom_to_pos)
Definition: clip_ops.c:139
static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
Definition: clip_ops.c:275
static void view_pan_exit(bContext *C, wmOperator *op, bool cancel)
Definition: clip_ops.c:414
static void view_zoom_cancel(bContext *C, wmOperator *op)
Definition: clip_ops.c:709
static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:1114
static void view_pan_cancel(bContext *C, wmOperator *op)
Definition: clip_ops.c:506
static void view_zoom_exit(bContext *C, wmOperator *op, bool cancel)
Definition: clip_ops.c:588
static int view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:617
void CLIP_OT_mode_set(wmOperatorType *ot)
Definition: clip_ops.c:1612
static void view_pan_init(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:382
static int view_zoom_in_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:754
static int view_zoom_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:608
void CLIP_OT_view_zoom(wmOperatorType *ot)
Definition: clip_ops.c:714
static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
Definition: clip_ops.c:1528
void CLIP_OT_view_zoom_out(wmOperatorType *ot)
Definition: clip_ops.c:837
void CLIP_OT_open(wmOperatorType *ot)
Definition: clip_ops.c:310
void CLIP_OT_set_scene_frames(wmOperatorType *ot)
Definition: clip_ops.c:1758
void CLIP_OT_change_frame(wmOperatorType *ot)
Definition: clip_ops.c:1156
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:1401
static void proxy_endjob(void *pjv)
Definition: clip_ops.c:1504
static int clip_prefetch_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
Definition: clip_ops.c:1692
struct ProxyBuildJob ProxyJob
void CLIP_OT_view_selected(wmOperatorType *ot)
Definition: clip_ops.c:1041
static void sclip_zoom_set(const bContext *C, float zoom, const float location[2], const bool zoom_to_pos)
Definition: clip_ops.c:85
void ED_operatormacros_clip(void)
Definition: clip_ops.c:1877
static void open_init(bContext *C, wmOperator *op)
Definition: clip_ops.c:180
static int view_pan_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:430
static int view_zoom_in_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:767
static int frame_from_event(bContext *C, const wmEvent *event)
Definition: clip_ops.c:1092
struct ViewZoomData ViewZoomData
static void proxy_task_func(TaskPool *__restrict pool, void *task_data)
Definition: clip_ops.c:1367
static int change_frame_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:1085
static int clip_set_scene_frames_exec(bContext *C, wmOperator *UNUSED(op))
Definition: clip_ops.c:1736
struct ProxyQueue ProxyQueue
void CLIP_OT_prefetch(wmOperatorType *ot)
Definition: clip_ops.c:1718
static int view_zoom_out_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:824
static int clip_set_2d_cursor_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:1775
void CLIP_OT_view_center_cursor(wmOperatorType *ot)
Definition: clip_ops.c:1009
static int view_zoom_out_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:811
static int mode_set_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:1595
static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
Definition: clip_ops.c:1027
void CLIP_OT_rebuild_proxy(wmOperatorType *ot)
Definition: clip_ops.c:1575
void CLIP_OT_lock_selection_toggle(wmOperatorType *ot)
Definition: clip_ops.c:1856
static int clip_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:1794
struct ViewPanData ViewPanData
static int change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:1134
static int view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:684
static int view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:451
static int view_center_cursor_exec(bContext *C, wmOperator *UNUSED(op))
Definition: clip_ops.c:997
static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:472
static int clip_prefetch_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(_event))
Definition: clip_ops.c:1708
static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress)
Definition: clip_ops.c:1468
static int reload_exec(bContext *C, wmOperator *UNUSED(op))
Definition: clip_ops.c:341
static int view_all_exec(bContext *C, wmOperator *op)
Definition: clip_ops.c:920
static void open_cancel(bContext *UNUSED(C), wmOperator *op)
Definition: clip_ops.c:188
static bool change_frame_poll(bContext *C)
Definition: clip_ops.c:1061
static void clip_filesel(bContext *C, wmOperator *op, const char *path)
Definition: clip_ops.c:173
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:1228
void CLIP_OT_view_pan(wmOperatorType *ot)
Definition: clip_ops.c:511
void CLIP_OT_view_all(wmOperatorType *ot)
Definition: clip_ops.c:971
static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
Definition: clip_ops.c:557
static uchar * proxy_thread_next_frame(ProxyQueue *queue, MovieClip *clip, size_t *r_size, int *r_cfra)
Definition: clip_ops.c:1313
static void change_frame_apply(bContext *C, wmOperator *op)
Definition: clip_ops.c:1071
void CLIP_OT_reload(wmOperatorType *ot)
Definition: clip_ops.c:357
static void view_zoom_apply(bContext *C, ViewZoomData *vpd, wmOperator *op, const wmEvent *event, const bool zoom_to_pos)
Definition: clip_ops.c:641
static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undistort)
Definition: clip_ops.c:1197
FILE * file
double time
Scene scene
TaskPool * task_pool
#define str(s)
#define powf(x, y)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
static void area(int d1, int d2, int e1, int e2, float weights[2])
ThreadQueue * queue
all scheduled work for the cpu
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:6550
int RNA_collection_length(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6634
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
Definition: rna_access.c:122
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
Definition: rna_access.c:3673
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
Definition: rna_access.c:6272
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:6319
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:866
int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
Definition: rna_access.c:4212
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
Definition: rna_access.c:6378
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2317
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:6514
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6308
float RNA_float_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6355
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
Definition: rna_access.c:6366
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:6685
bool RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:829
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6261
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
Definition: rna_access.c:6390
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6402
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:3825
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
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:3851
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
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:3585
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:3771
const EnumPropertyItem rna_enum_clip_editor_mode_items[]
Definition: rna_space.c:447
short regiontype
Definition: BKE_main.h:116
char name[1024]
Definition: BKE_main.h:118
char filepath[1024]
struct anim * anim
struct MovieClipProxy proxy
struct MovieTracking tracking
struct PropertyRNA * prop
Definition: RNA_types.h:57
PointerRNA ptr
Definition: RNA_types.h:56
Scene * scene
Definition: clip_ops.c:1182
struct IndexBuildContext * index_context
Definition: clip_ops.c:1187
struct Main * main
Definition: clip_ops.c:1183
MovieClip * clip
Definition: clip_ops.c:1184
short * do_update
Definition: clip_ops.c:1302
float * progress
Definition: clip_ops.c:1303
const short * stop
Definition: clip_ops.c:1301
SpinLock spin
Definition: clip_ops.c:1299
int build_count
Definition: clip_ops.c:1309
int * build_sizes
Definition: clip_ops.c:1309
struct MovieDistortion * distortion
Definition: clip_ops.c:1308
MovieClip * clip
Definition: clip_ops.c:1307
int * build_undistort_sizes
Definition: clip_ops.c:1310
int build_undistort_count
Definition: clip_ops.c:1310
struct RenderData r
float cursor[2]
int launch_event
Definition: clip_ops.c:377
float y
Definition: clip_ops.c:375
float xof
Definition: clip_ops.c:376
float * vec
Definition: clip_ops.c:379
float x
Definition: clip_ops.c:375
float yorig
Definition: clip_ops.c:376
float yof
Definition: clip_ops.c:376
bool own_cursor
Definition: clip_ops.c:378
float xorig
Definition: clip_ops.c:376
float location[2]
Definition: clip_ops.c:551
double timer_lastdraw
Definition: clip_ops.c:553
int launch_event
Definition: clip_ops.c:550
wmTimer * timer
Definition: clip_ops.c:552
float zoom
Definition: clip_ops.c:549
bool own_cursor
Definition: clip_ops.c:554
int y
Definition: WM_types.h:581
short val
Definition: WM_types.h:579
int mval[2]
Definition: WM_types.h:583
int prevy
Definition: WM_types.h:614
int x
Definition: WM_types.h:581
short type
Definition: WM_types.h:577
void * customdata
Definition: WM_types.h:631
Definition: wm_jobs.c:73
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:752
const char * name
Definition: WM_types.h:721
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:768
const char * idname
Definition: WM_types.h:723
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:776
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:760
struct StructRNA * srna
Definition: WM_types.h:802
const char * description
Definition: WM_types.h:726
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:736
struct ReportList * reports
struct PointerRNA * ptr
struct wmWindow * win
Definition: WM_types.h:693
double PIL_check_seconds_timer(void)
Definition: time.c:80
#define G(x, y, z)
ParamHandle ** handles
void WM_cursor_modal_set(wmWindow *win, int val)
Definition: wm_cursors.c:207
void WM_cursor_modal_restore(wmWindow *win)
Definition: wm_cursors.c:216
@ WM_CURSOR_NSEW_SCROLL
Definition: wm_cursors.h:67
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:3156
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
Definition: wm_jobs.c:450
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag, int job_type)
Definition: wm_jobs.c:196
bool WM_jobs_test(wmWindowManager *wm, void *owner, int job_type)
Definition: wm_jobs.c:223
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:372
void WM_jobs_kill_type(struct wmWindowManager *wm, void *owner, int job_type)
Definition: wm_jobs.c:572
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *))
Definition: wm_jobs.c:344
void WM_jobs_timer(wmJob *wm_job, double timestep, unsigned int note, unsigned int endnote)
Definition: wm_jobs.c:360
void WM_operator_properties_use_cursor_init(wmOperatorType *ot)
void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, short action, short flag, short display, short sort)
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:1669
wmTimer * WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
Definition: wm_window.c:1632