Blender V5.0
clip_ops.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cerrno>
10#include <fcntl.h>
11#include <mutex>
12#include <sys/types.h>
13
14#ifndef WIN32
15# include <unistd.h>
16#else
17# include <io.h>
18#endif
19
20#include "MEM_guardedalloc.h"
21
22#include "DNA_defaults.h"
23#include "DNA_scene_types.h" /* min/max frames */
24#include "DNA_userdef_types.h"
25
26#include "BLI_fileops.h"
27#include "BLI_math_vector.h"
28#include "BLI_path_utils.hh"
29#include "BLI_rect.h"
30#include "BLI_string.h"
31#include "BLI_task.h"
32#include "BLI_time.h"
33#include "BLI_utildefines.h"
34
35#include "BLT_translation.hh"
36
37#include "BKE_context.hh"
38#include "BKE_global.hh"
39#include "BKE_lib_id.hh"
40#include "BKE_main.hh"
41#include "BKE_movieclip.h"
42#include "BKE_report.hh"
43#include "BKE_tracking.h"
44
45#include "WM_api.hh"
46#include "WM_types.hh"
47
48#include "IMB_imbuf.hh"
49#include "IMB_imbuf_types.hh"
50
51#include "MOV_read.hh"
52
53#include "ED_clip.hh"
54#include "ED_screen.hh"
55
56#include "UI_interface.hh"
57
58#include "RNA_access.hh"
59#include "RNA_define.hh"
60#include "RNA_enum_types.hh"
61
62#include "UI_view2d.hh"
63
64#include "DEG_depsgraph.hh"
66
67#include "clip_intern.hh" /* own include */
68
69/* -------------------------------------------------------------------- */
72
73static void sclip_zoom_set(const bContext *C,
74 float zoom,
75 const float location[2],
76 const bool zoom_to_pos)
77{
79 ARegion *region = CTX_wm_region(C);
80
81 float oldzoom = sc->zoom;
82 int width, height;
83
84 sc->zoom = zoom;
85
86 if (sc->zoom < 0.1f || sc->zoom > 4.0f) {
87 /* check zoom limits */
88 ED_space_clip_get_size(sc, &width, &height);
89
90 width *= sc->zoom;
91 height *= sc->zoom;
92
93 if ((width < 4) && (height < 4) && sc->zoom < oldzoom) {
94 sc->zoom = oldzoom;
95 }
96 else if (BLI_rcti_size_x(&region->winrct) <= sc->zoom) {
97 sc->zoom = oldzoom;
98 }
99 else if (BLI_rcti_size_y(&region->winrct) <= sc->zoom) {
100 sc->zoom = oldzoom;
101 }
102 }
103
104 if (zoom_to_pos && location) {
105 float aspx, aspy, w, h, dx, dy;
106
107 ED_space_clip_get_size(sc, &width, &height);
108 ED_space_clip_get_aspect(sc, &aspx, &aspy);
109
110 w = width * aspx;
111 h = height * aspy;
112
113 dx = ((location[0] - 0.5f) * w - sc->xof) * (sc->zoom - oldzoom) / sc->zoom;
114 dy = ((location[1] - 0.5f) * h - sc->yof) * (sc->zoom - oldzoom) / sc->zoom;
115
117 sc->xlockof += dx;
118 sc->ylockof += dy;
119 }
120 else {
121 sc->xof += dx;
122 sc->yof += dy;
123 }
124 }
125}
126
128 float zoomfac,
129 const float location[2],
130 const bool zoom_to_pos)
131{
133
134 sclip_zoom_set(C, sc->zoom * zoomfac, location, zoom_to_pos);
135}
136
137static void sclip_zoom_set_factor_exec(bContext *C, const wmEvent *event, float factor)
138{
139 ARegion *region = CTX_wm_region(C);
140
141 float location[2], *mpos = nullptr;
142
143 if (event) {
145
146 ED_clip_mouse_pos(sc, region, event->mval, location);
147 mpos = location;
148 }
149
150 sclip_zoom_set_factor(C, factor, mpos, mpos ? (U.uiflag & USER_ZOOM_TO_MOUSEPOS) : false);
151
152 ED_region_tag_redraw(region);
153}
154
156
157/* -------------------------------------------------------------------- */
160
161static void clip_filesel(bContext *C, wmOperator *op, const char *dirpath)
162{
163 RNA_string_set(op->ptr, "directory", dirpath);
164
166}
167
168static void open_init(bContext *C, wmOperator *op)
169{
170 PropertyPointerRNA *pprop;
171
172 op->customdata = pprop = MEM_new<PropertyPointerRNA>("OpenPropertyPointerRNA");
174}
175
176static void open_cancel(bContext * /*C*/, wmOperator *op)
177{
178 if (op->customdata) {
179 PropertyPointerRNA *pprop = static_cast<PropertyPointerRNA *>(op->customdata);
180 op->customdata = nullptr;
181 MEM_delete(pprop);
182 }
183}
184
186{
188 bScreen *screen = CTX_wm_screen(C);
189 Main *bmain = CTX_data_main(C);
190 PropertyPointerRNA *pprop;
191 MovieClip *clip = nullptr;
192 char filepath[FILE_MAX];
193
194 if (!RNA_collection_is_empty(op->ptr, "files")) {
195 PointerRNA fileptr;
196 PropertyRNA *prop;
197 char dir_only[FILE_MAX], file_only[FILE_MAX];
198 bool relative = RNA_boolean_get(op->ptr, "relative_path");
199
200 RNA_string_get(op->ptr, "directory", dir_only);
201 if (relative) {
202 BLI_path_rel(dir_only, bmain->filepath);
203 }
204
205 prop = RNA_struct_find_property(op->ptr, "files");
206 RNA_property_collection_lookup_int(op->ptr, prop, 0, &fileptr);
207 RNA_string_get(&fileptr, "name", file_only);
208
209 BLI_path_join(filepath, sizeof(filepath), dir_only, file_only);
210 }
211 else {
212 BKE_report(op->reports, RPT_ERROR, "No files selected to be opened");
213
214 return OPERATOR_CANCELLED;
215 }
216
217 /* default to frame 1 if there's no scene in context */
218
219 errno = 0;
220
221 clip = BKE_movieclip_file_add_exists(bmain, filepath);
222
223 if (!clip) {
224 if (op->customdata) {
225 pprop = static_cast<PropertyPointerRNA *>(op->customdata);
226 op->customdata = nullptr;
227 MEM_delete(pprop);
228 }
229
231 RPT_ERROR,
232 "Cannot read '%s': %s",
233 filepath,
234 errno ? strerror(errno) : RPT_("unsupported movie clip format"));
235
236 return OPERATOR_CANCELLED;
237 }
238
239 if (!op->customdata) {
240 open_init(C, op);
241 }
242
243 /* hook into UI */
244 pprop = static_cast<PropertyPointerRNA *>(op->customdata);
245
246 if (pprop->prop) {
247 /* when creating new ID blocks, use is already 1, but RNA
248 * pointer use also increases user, so this compensates it */
249 id_us_min(&clip->id);
250
251 PointerRNA idptr = RNA_id_pointer_create(&clip->id);
252 RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr, nullptr);
253 RNA_property_update(C, &pprop->ptr, pprop->prop);
254 }
255 else if (sc) {
256 ED_space_clip_set_clip(C, screen, sc, clip);
257 }
258
260
262 op->customdata = nullptr;
263 MEM_delete(pprop);
264
265 return OPERATOR_FINISHED;
266}
267
268static wmOperatorStatus open_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
269{
271 char dirpath[FILE_MAX];
272 MovieClip *clip = nullptr;
273
274 if (sc) {
275 clip = ED_space_clip_get_clip(sc);
276 }
277
278 if (clip) {
279 STRNCPY(dirpath, clip->filepath);
280
281 BLI_path_abs(dirpath, ID_BLEND_PATH_FROM_GLOBAL(&clip->id));
282 BLI_path_parent_dir(dirpath);
283 }
284 else {
285 STRNCPY(dirpath, U.textudir);
286 }
287
288 if (RNA_struct_property_is_set(op->ptr, "files")) {
289 return open_exec(C, op);
290 }
291
292 if (!RNA_struct_property_is_set(op->ptr, "relative_path")) {
293 RNA_boolean_set(op->ptr, "relative_path", (U.flag & USER_RELPATHS) != 0);
294 }
295
296 open_init(C, op);
297
298 clip_filesel(C, op, dirpath);
299
301}
302
304{
305 /* identifiers */
306 ot->name = "Open Clip";
307 ot->description = "Load a sequence of frames or a movie file";
308 ot->idname = "CLIP_OT_open";
309
310 /* API callbacks. */
311 ot->exec = open_exec;
312 ot->invoke = open_invoke;
313 ot->cancel = open_cancel;
314
315 /* flags */
317
318 /* properties */
326}
327
329
330/* -------------------------------------------------------------------- */
333
335{
337
338 if (!clip) {
339 return OPERATOR_CANCELLED;
340 }
341
344
346
347 return OPERATOR_FINISHED;
348}
349
351{
352 /* identifiers */
353 ot->name = "Reload Clip";
354 ot->description = "Reload clip";
355 ot->idname = "CLIP_OT_reload";
356
357 /* API callbacks. */
358 ot->exec = reload_exec;
359}
360
362
363/* -------------------------------------------------------------------- */
366
367namespace {
368
369struct ViewPanData {
370 float x, y;
371 float xof, yof, xorig, yorig;
372 int launch_event;
373 bool own_cursor;
374 float *vec;
375};
376
377} // namespace
378
379static void view_pan_init(bContext *C, wmOperator *op, const wmEvent *event)
380{
381 wmWindow *win = CTX_wm_window(C);
383 ViewPanData *vpd;
384
385 op->customdata = vpd = MEM_callocN<ViewPanData>("ClipViewPanData");
386
387 /* Grab will be set when running from gizmo. */
388 vpd->own_cursor = WM_cursor_modal_is_set_ok(win);
389 if (vpd->own_cursor) {
391 }
392
393 vpd->x = event->xy[0];
394 vpd->y = event->xy[1];
395
397 vpd->vec = &sc->xlockof;
398 }
399 else {
400 vpd->vec = &sc->xof;
401 }
402
403 copy_v2_v2(&vpd->xof, vpd->vec);
404 copy_v2_v2(&vpd->xorig, &vpd->xof);
405
406 vpd->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
407
409}
410
411static void view_pan_exit(bContext *C, wmOperator *op, bool cancel)
412{
413 ViewPanData *vpd = static_cast<ViewPanData *>(op->customdata);
414
415 if (cancel) {
416 copy_v2_v2(vpd->vec, &vpd->xorig);
417
419 }
420
421 if (vpd->own_cursor) {
423 }
424 MEM_freeN(vpd);
425}
426
428{
430 float offset[2];
431
432 RNA_float_get_array(op->ptr, "offset", offset);
433
435 sc->xlockof += offset[0];
436 sc->ylockof += offset[1];
437 }
438 else {
439 sc->xof += offset[0];
440 sc->yof += offset[1];
441 }
442
444
445 return OPERATOR_FINISHED;
446}
447
449{
450 if (event->type == MOUSEPAN) {
452 float offset[2];
453
454 offset[0] = (event->prev_xy[0] - event->xy[0]) / sc->zoom;
455 offset[1] = (event->prev_xy[1] - event->xy[1]) / sc->zoom;
456
457 RNA_float_set_array(op->ptr, "offset", offset);
458
459 view_pan_exec(C, op);
460
461 return OPERATOR_FINISHED;
462 }
463
464 view_pan_init(C, op, event);
465
467}
468
470{
472 ViewPanData *vpd = static_cast<ViewPanData *>(op->customdata);
473 float offset[2];
474
475 switch (event->type) {
476 case MOUSEMOVE:
477 copy_v2_v2(vpd->vec, &vpd->xorig);
478 offset[0] = (vpd->x - event->xy[0]) / sc->zoom;
479 offset[1] = (vpd->y - event->xy[1]) / sc->zoom;
480 RNA_float_set_array(op->ptr, "offset", offset);
481 view_pan_exec(C, op);
482 break;
483 case EVT_ESCKEY:
484 view_pan_exit(C, op, true);
485
486 return OPERATOR_CANCELLED;
487 case EVT_SPACEKEY:
488 view_pan_exit(C, op, false);
489
490 return OPERATOR_FINISHED;
491 default:
492 if (event->type == vpd->launch_event && event->val == KM_RELEASE) {
493 view_pan_exit(C, op, false);
494
495 return OPERATOR_FINISHED;
496 }
497 break;
498 }
499
501}
502
504{
505 view_pan_exit(C, op, true);
506}
507
509{
510 /* identifiers */
511 ot->name = "Pan View";
512 ot->idname = "CLIP_OT_view_pan";
513 ot->description = "Pan the view";
514
515 /* API callbacks. */
516 ot->exec = view_pan_exec;
517 ot->invoke = view_pan_invoke;
518 ot->modal = view_pan_modal;
519 ot->cancel = view_pan_cancel;
521
522 /* flags */
524
525 /* properties */
527 "offset",
528 2,
529 nullptr,
530 -FLT_MAX,
531 FLT_MAX,
532 "Offset",
533 "Offset in floating-point units, 1.0 is the width and height of the image",
534 -FLT_MAX,
535 FLT_MAX);
536}
537
539
540/* -------------------------------------------------------------------- */
543
544namespace {
545
546struct ViewZoomData {
547 float x, y;
548 float zoom;
549 int launch_event;
550 float location[2];
551 wmTimer *timer;
552 double timer_lastdraw;
553 bool own_cursor;
554};
555
556} // namespace
557
558static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
559{
560 wmWindow *win = CTX_wm_window(C);
562 ARegion *region = CTX_wm_region(C);
563 ViewZoomData *vpd;
564
565 op->customdata = vpd = MEM_callocN<ViewZoomData>("ClipViewZoomData");
566
567 /* Grab will be set when running from gizmo. */
568 vpd->own_cursor = WM_cursor_modal_is_set_ok(win);
569 if (vpd->own_cursor) {
571 }
572
573 if (U.viewzoom == USER_ZOOM_CONTINUE) {
574 /* needs a timer to continue redrawing */
575 vpd->timer = WM_event_timer_add(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
576 vpd->timer_lastdraw = BLI_time_now_seconds();
577 }
578
579 vpd->x = event->xy[0];
580 vpd->y = event->xy[1];
581 vpd->zoom = sc->zoom;
582 vpd->launch_event = WM_userdef_event_type_from_keymap_type(event->type);
583
584 ED_clip_mouse_pos(sc, region, event->mval, vpd->location);
585
587}
588
589static void view_zoom_exit(bContext *C, wmOperator *op, bool cancel)
590{
592 ViewZoomData *vpd = static_cast<ViewZoomData *>(op->customdata);
593
594 if (cancel) {
595 sc->zoom = vpd->zoom;
597 }
598
599 if (vpd->timer) {
600 WM_event_timer_remove(CTX_wm_manager(C), vpd->timer->win, vpd->timer);
601 }
602
603 if (vpd->own_cursor) {
605 }
606 MEM_freeN(vpd);
607}
608
610{
611 sclip_zoom_set_factor(C, RNA_float_get(op->ptr, "factor"), nullptr, false);
612
614
615 return OPERATOR_FINISHED;
616}
617
619{
620 if (ELEM(event->type, MOUSEZOOM, MOUSEPAN)) {
621 float delta, factor;
622
623 delta = event->prev_xy[0] - event->xy[0] + event->prev_xy[1] - event->xy[1];
624
625 if (U.uiflag & USER_ZOOM_INVERT) {
626 delta *= -1;
627 }
628
629 factor = 1.0f + delta / 300.0f;
630 RNA_float_set(op->ptr, "factor", factor);
631
632 sclip_zoom_set_factor_exec(C, event, factor);
633
634 return OPERATOR_FINISHED;
635 }
636
637 view_zoom_init(C, op, event);
638
640}
641
642static void view_zoom_apply(
643 bContext *C, ViewZoomData *vpd, wmOperator *op, const wmEvent *event, const bool zoom_to_pos)
644{
645 float factor;
646 float delta;
647
648 if (U.viewzoom != USER_ZOOM_SCALE) {
649 if (U.uiflag & USER_ZOOM_HORIZ) {
650 delta = float(event->xy[0] - vpd->x);
651 }
652 else {
653 delta = float(event->xy[1] - vpd->y);
654 }
655 }
656 else {
657 delta = event->xy[0] - vpd->x + event->xy[1] - vpd->y;
658 }
659
660 delta /= U.pixelsize;
661
662 if (U.uiflag & USER_ZOOM_INVERT) {
663 delta = -delta;
664 }
665
666 if (U.viewzoom == USER_ZOOM_CONTINUE) {
667 SpaceClip *sclip = CTX_wm_space_clip(C);
668 double time = BLI_time_now_seconds();
669 float time_step = float(time - vpd->timer_lastdraw);
670 float zfac;
671
672 zfac = 1.0f + ((delta / 20.0f) * time_step);
673 vpd->timer_lastdraw = time;
674 factor = (sclip->zoom * zfac) / vpd->zoom;
675 }
676 else {
677 factor = 1.0f + delta / 300.0f;
678 }
679
680 RNA_float_set(op->ptr, "factor", factor);
681 sclip_zoom_set(C, vpd->zoom * factor, vpd->location, zoom_to_pos);
683}
684
686{
687 ViewZoomData *vpd = static_cast<ViewZoomData *>(op->customdata);
688 const bool use_cursor_init = RNA_boolean_get(op->ptr, "use_cursor_init");
689 switch (event->type) {
690 case TIMER:
691 if (event->customdata == vpd->timer) {
692 view_zoom_apply(C, vpd, op, event, use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS));
693 }
694 break;
695 case MOUSEMOVE:
696 view_zoom_apply(C, vpd, op, event, use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS));
697 break;
698 default:
699 if (event->type == vpd->launch_event && event->val == KM_RELEASE) {
700 view_zoom_exit(C, op, false);
701
702 return OPERATOR_FINISHED;
703 }
704 break;
705 }
706
708}
709
711{
712 view_zoom_exit(C, op, true);
713}
714
716{
717 PropertyRNA *prop;
718
719 /* identifiers */
720 ot->name = "View Zoom";
721 ot->idname = "CLIP_OT_view_zoom";
722 ot->description = "Zoom in/out the view";
723
724 /* API callbacks. */
725 ot->exec = view_zoom_exec;
726 ot->invoke = view_zoom_invoke;
727 ot->modal = view_zoom_modal;
728 ot->cancel = view_zoom_cancel;
730
731 /* flags */
733
734 /* properties */
735 prop = RNA_def_float(ot->srna,
736 "factor",
737 0.0f,
738 -FLT_MAX,
739 FLT_MAX,
740 "Factor",
741 "Zoom factor, values higher than 1.0 zoom in, lower values zoom out",
742 -FLT_MAX,
743 FLT_MAX);
745
747}
748
750
751/* -------------------------------------------------------------------- */
754
756{
757 float location[2];
758
759 RNA_float_get_array(op->ptr, "location", location);
760
761 sclip_zoom_set_factor(C, powf(2.0f, 1.0f / 3.0f), location, U.uiflag & USER_ZOOM_TO_MOUSEPOS);
762
764
765 return OPERATOR_FINISHED;
766}
767
769{
771 ARegion *region = CTX_wm_region(C);
772
773 float location[2];
774
775 ED_clip_mouse_pos(sc, region, event->mval, location);
776 RNA_float_set_array(op->ptr, "location", location);
777
778 return view_zoom_in_exec(C, op);
779}
780
782{
783 PropertyRNA *prop;
784
785 /* identifiers */
786 ot->name = "Zoom In";
787 ot->idname = "CLIP_OT_view_zoom_in";
788 ot->description = "Zoom in the view";
789
790 /* API callbacks. */
791 ot->exec = view_zoom_in_exec;
792 ot->invoke = view_zoom_in_invoke;
794
795 /* flags */
796 ot->flag = OPTYPE_LOCK_BYPASS;
797
798 /* properties */
799 prop = RNA_def_float_vector(ot->srna,
800 "location",
801 2,
802 nullptr,
803 -FLT_MAX,
804 FLT_MAX,
805 "Location",
806 "Cursor location in screen coordinates",
807 -10.0f,
808 10.0f);
810}
811
813{
814 float location[2];
815
816 RNA_float_get_array(op->ptr, "location", location);
817
818 sclip_zoom_set_factor(C, powf(0.5f, 1.0f / 3.0f), location, U.uiflag & USER_ZOOM_TO_MOUSEPOS);
819
821
822 return OPERATOR_FINISHED;
823}
824
826{
828 ARegion *region = CTX_wm_region(C);
829
830 float location[2];
831
832 ED_clip_mouse_pos(sc, region, event->mval, location);
833 RNA_float_set_array(op->ptr, "location", location);
834
835 return view_zoom_out_exec(C, op);
836}
837
839{
840 PropertyRNA *prop;
841
842 /* identifiers */
843 ot->name = "Zoom Out";
844 ot->idname = "CLIP_OT_view_zoom_out";
845 ot->description = "Zoom out the view";
846
847 /* API callbacks. */
848 ot->exec = view_zoom_out_exec;
849 ot->invoke = view_zoom_out_invoke;
851
852 /* flags */
853 ot->flag = OPTYPE_LOCK_BYPASS;
854
855 /* properties */
856 prop = RNA_def_float_vector(ot->srna,
857 "location",
858 2,
859 nullptr,
860 -FLT_MAX,
861 FLT_MAX,
862 "Location",
863 "Cursor location in normalized (0.0 to 1.0) coordinates",
864 -10.0f,
865 10.0f);
867}
868
870
871/* -------------------------------------------------------------------- */
874
876{
878
879 sclip_zoom_set(C, RNA_float_get(op->ptr, "ratio"), nullptr, false);
880
881 /* ensure pixel exact locations for draw */
882 sc->xof = int(sc->xof);
883 sc->yof = int(sc->yof);
884
886
887 return OPERATOR_FINISHED;
888}
889
891{
892 /* identifiers */
893 ot->name = "View Zoom Ratio";
894 ot->idname = "CLIP_OT_view_zoom_ratio";
895 ot->description = "Set the zoom ratio (based on clip size)";
896
897 /* API callbacks. */
898 ot->exec = view_zoom_ratio_exec;
900
901 /* flags */
902 ot->flag = OPTYPE_LOCK_BYPASS;
903
904 /* properties */
905 RNA_def_float(ot->srna,
906 "ratio",
907 0.0f,
908 -FLT_MAX,
909 FLT_MAX,
910 "Ratio",
911 "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out",
912 -FLT_MAX,
913 FLT_MAX);
914}
915
917
918/* -------------------------------------------------------------------- */
921
923{
924 SpaceClip *sc;
925 ARegion *region;
926 int w, h, width, height;
927 float aspx, aspy;
928 bool fit_view = RNA_boolean_get(op->ptr, "fit_view");
929 float zoomx, zoomy;
930
931 /* retrieve state */
932 sc = CTX_wm_space_clip(C);
933 region = CTX_wm_region(C);
934
935 ED_space_clip_get_size(sc, &w, &h);
936 ED_space_clip_get_aspect(sc, &aspx, &aspy);
937
938 w = w * aspx;
939 h = h * aspy;
940
941 /* check if the image will fit in the image with zoom == 1 */
942 width = BLI_rcti_size_x(&region->winrct) + 1;
943 height = BLI_rcti_size_y(&region->winrct) + 1;
944
945 if (fit_view) {
946 const int margin = 5; /* margin from border */
947
948 zoomx = float(width) / (w + 2 * margin);
949 zoomy = float(height) / (h + 2 * margin);
950
951 sclip_zoom_set(C, min_ff(zoomx, zoomy), nullptr, false);
952 }
953 else {
954 if ((w >= width || h >= height) && (width > 0 && height > 0)) {
955 zoomx = float(width) / w;
956 zoomy = float(height) / h;
957
958 /* find the zoom value that will fit the image in the image space */
959 sclip_zoom_set(C, 1.0f / power_of_2(1.0f / min_ff(zoomx, zoomy)), nullptr, false);
960 }
961 else {
962 sclip_zoom_set(C, 1.0f, nullptr, false);
963 }
964 }
965
966 sc->xof = sc->yof = 0.0f;
967
968 ED_region_tag_redraw(region);
969
970 return OPERATOR_FINISHED;
971}
972
974{
975 PropertyRNA *prop;
976
977 /* identifiers */
978 ot->name = "Frame All";
979 ot->idname = "CLIP_OT_view_all";
980 ot->description = "View whole image with markers";
981
982 /* API callbacks. */
983 ot->exec = view_all_exec;
985
986 /* flags */
987 ot->flag = OPTYPE_LOCK_BYPASS;
988
989 /* properties */
990 prop = RNA_def_boolean(ot->srna, "fit_view", false, "Fit View", "Fit frame to the viewport");
992}
993
995
996/* -------------------------------------------------------------------- */
999
1001{
1003 ARegion *region = CTX_wm_region(C);
1004
1005 clip_view_center_to_point(sc, sc->cursor[0], sc->cursor[1]);
1006
1007 ED_region_tag_redraw(region);
1008
1009 return OPERATOR_FINISHED;
1010}
1011
1013{
1014 /* identifiers */
1015 ot->name = "Center View to Cursor";
1016 ot->description = "Center the view so that the cursor is in the middle of the view";
1017 ot->idname = "CLIP_OT_view_center_cursor";
1018
1019 /* API callbacks. */
1022}
1023
1025
1026/* -------------------------------------------------------------------- */
1029
1031{
1033 ARegion *region = CTX_wm_region(C);
1034
1035 sc->xlockof = 0.0f;
1036 sc->ylockof = 0.0f;
1037
1038 ED_clip_view_selection(C, region, true);
1039 ED_region_tag_redraw(region);
1040
1041 return OPERATOR_FINISHED;
1042}
1043
1045{
1046 /* identifiers */
1047 ot->name = "Frame Selected";
1048 ot->idname = "CLIP_OT_view_selected";
1049 ot->description = "View all selected elements";
1050
1051 /* API callbacks. */
1052 ot->exec = view_selected_exec;
1054
1055 /* flags */
1056 ot->flag = OPTYPE_LOCK_BYPASS;
1057}
1058
1060
1061/* -------------------------------------------------------------------- */
1064
1066{
1067 /* prevent changes during render */
1068 if (G.is_rendering) {
1069 return false;
1070 }
1071 SpaceClip *space_clip = CTX_wm_space_clip(C);
1072 return space_clip != nullptr;
1073}
1074
1076{
1077 Scene *scene = CTX_data_scene(C);
1078
1079 /* set the new frame number */
1080 scene->r.cfra = RNA_int_get(op->ptr, "frame");
1082 scene->r.subframe = 0.0f;
1083
1084 /* do updates */
1087}
1088
1090{
1091 change_frame_apply(C, op);
1092
1093 return OPERATOR_FINISHED;
1094}
1095
1096static int frame_from_event(bContext *C, const wmEvent *event)
1097{
1098 ARegion *region = CTX_wm_region(C);
1099 Scene *scene = CTX_data_scene(C);
1100 int framenr = 0;
1101
1102 if (region->regiontype == RGN_TYPE_WINDOW) {
1103 float sfra = scene->r.sfra, efra = scene->r.efra, framelen = region->winx / (efra - sfra + 1);
1104
1105 framenr = sfra + event->mval[0] / framelen;
1106 }
1107 else {
1108 float viewx, viewy;
1109
1110 UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
1111
1112 framenr = round_fl_to_int(viewx);
1113 }
1114
1115 return framenr;
1116}
1117
1119{
1120 ARegion *region = CTX_wm_region(C);
1121
1122 if (region->regiontype == RGN_TYPE_WINDOW) {
1123 if (event->mval[1] > 16 * UI_SCALE_FAC) {
1124 return OPERATOR_PASS_THROUGH;
1125 }
1126 }
1127
1128 RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
1129
1130 change_frame_apply(C, op);
1131
1132 /* add temp handler */
1134
1136}
1137
1139{
1140 switch (event->type) {
1141 case EVT_ESCKEY:
1142 return OPERATOR_FINISHED;
1143
1144 case MOUSEMOVE:
1145 RNA_int_set(op->ptr, "frame", frame_from_event(C, event));
1146 change_frame_apply(C, op);
1147 break;
1148
1149 case LEFTMOUSE:
1150 case RIGHTMOUSE:
1151 if (event->val == KM_RELEASE) {
1152 return OPERATOR_FINISHED;
1153 }
1154 break;
1155 default: {
1156 break;
1157 }
1158 }
1159
1161}
1162
1164{
1165 /* identifiers */
1166 ot->name = "Change Frame";
1167 ot->idname = "CLIP_OT_change_frame";
1168 ot->description = "Interactively change the current frame number";
1169
1170 /* API callbacks. */
1171 ot->exec = change_frame_exec;
1172 ot->invoke = change_frame_invoke;
1173 ot->modal = change_frame_modal;
1174 ot->poll = change_frame_poll;
1175
1176 /* flags */
1177 ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO;
1178
1179 /* rna */
1180 RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
1181}
1182
1184
1185/* -------------------------------------------------------------------- */
1188
1197
1198static void proxy_freejob(void *pjv)
1199{
1200 ProxyJob *pj = static_cast<ProxyJob *>(pjv);
1201
1202 MEM_freeN(pj);
1203}
1204
1205static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undistort)
1206{
1207 int build_count = 0;
1208 const int size_flags[2][4] = {
1214 int size_nr = undistort ? 1 : 0;
1215
1216 if (size_flag & size_flags[size_nr][0]) {
1217 build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_25;
1218 }
1219
1220 if (size_flag & size_flags[size_nr][1]) {
1221 build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_50;
1222 }
1223
1224 if (size_flag & size_flags[size_nr][2]) {
1225 build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_75;
1226 }
1227
1228 if (size_flag & size_flags[size_nr][3]) {
1229 build_sizes[build_count++] = MCLIP_PROXY_RENDER_SIZE_100;
1230 }
1231
1232 return build_count;
1233}
1234
1235/* simple case for movies -- handle frame-by-frame, do threading within single frame */
1236static void do_movie_proxy(void *pjv,
1237 int * /*build_sizes*/,
1238 int /*build_count*/,
1239 const int *build_undistort_sizes,
1240 int build_undistort_count,
1241 bool *stop,
1242 bool *do_update,
1243 float *progress)
1244{
1245 ProxyJob *pj = static_cast<ProxyJob *>(pjv);
1246 MovieClip *clip = pj->clip;
1247 MovieDistortion *distortion = nullptr;
1248
1249 if (pj->proxy_builder) {
1250 MOV_proxy_builder_process(pj->proxy_builder, stop, do_update, progress);
1251 }
1252
1253 if (!build_undistort_count) {
1254 if (*stop) {
1255 pj->stop = true;
1256 }
1257
1258 return;
1259 }
1260
1261 const int sfra = 1;
1262 const int efra = clip->len;
1263
1264 if (build_undistort_count) {
1265 int width, height;
1266
1267 BKE_movieclip_get_size(clip, nullptr, &width, &height);
1268
1269 distortion = BKE_tracking_distortion_new(&clip->tracking, width, height);
1270 }
1271
1272 for (int cfra = sfra; cfra <= efra; cfra++) {
1274 clip, pj->clip_flag, distortion, cfra, build_undistort_sizes, build_undistort_count, true);
1275
1276 if (*stop || G.is_break) {
1277 break;
1278 }
1279
1280 *do_update = true;
1281 *progress = (float(cfra) - sfra) / (efra - sfra);
1282 }
1283
1284 if (distortion) {
1285 BKE_tracking_distortion_free(distortion);
1286 }
1287
1288 if (*stop) {
1289 pj->stop = true;
1290 }
1291}
1292
1293/* *****
1294 * special case for sequences -- handle different frames in different threads,
1295 * loading from disk happens in critical section, decoding frame happens from
1296 * thread for maximal speed
1297 */
1298
1300 int cfra;
1301 int sfra;
1302 int efra;
1303 std::mutex mutex;
1304
1305 const bool *stop;
1307 float *progress;
1308};
1309
1316
1318 MovieClip *clip,
1319 size_t *r_size,
1320 int *r_cfra)
1321{
1322 uchar *mem = nullptr;
1323
1324 std::lock_guard lock(queue->mutex);
1325 if (!*queue->stop && queue->cfra <= queue->efra) {
1327 char filepath[FILE_MAX];
1328 int file;
1329
1330 user.framenr = queue->cfra;
1331
1332 BKE_movieclip_filepath_for_frame(clip, &user, filepath);
1333
1334 file = BLI_open(filepath, O_BINARY | O_RDONLY, 0);
1335 if (file < 0) {
1336 return nullptr;
1337 }
1338
1339 const size_t size = BLI_file_descriptor_size(file);
1340 if (UNLIKELY(ELEM(size, 0, size_t(-1)))) {
1341 close(file);
1342 return nullptr;
1343 }
1344
1345 mem = MEM_calloc_arrayN<uchar>(size, "movieclip proxy memory file");
1346
1347 if (BLI_read(file, mem, size) != size) {
1348 close(file);
1349 MEM_freeN(mem);
1350 return nullptr;
1351 }
1352
1353 *r_size = size;
1354 *r_cfra = queue->cfra;
1355
1356 queue->cfra++;
1357 close(file);
1358
1359 *queue->do_update = true;
1360 *queue->progress = float(queue->cfra - queue->sfra) / (queue->efra - queue->sfra);
1361 }
1362 return mem;
1363}
1364
1365static void proxy_task_func(TaskPool *__restrict pool, void *task_data)
1366{
1367 ProxyThread *data = (ProxyThread *)task_data;
1369 uchar *mem;
1370 size_t size;
1371 int cfra;
1372
1373 while ((mem = proxy_thread_next_frame(queue, data->clip, &size, &cfra))) {
1374 ImBuf *ibuf;
1375
1376 ibuf = IMB_load_image_from_memory(mem,
1377 size,
1379 "proxy frame",
1380 nullptr,
1381 data->clip->colorspace_settings.name);
1382
1384 data->clip, ibuf, nullptr, cfra, data->build_sizes, data->build_count, false);
1385
1387 ibuf,
1388 data->distortion,
1389 cfra,
1390 data->build_undistort_sizes,
1391 data->build_undistort_count,
1392 true);
1393
1394 IMB_freeImBuf(ibuf);
1395
1396 MEM_freeN(mem);
1397 }
1398}
1399
1400static void do_sequence_proxy(void *pjv,
1401 int *build_sizes,
1402 int build_count,
1403 int *build_undistort_sizes,
1404 int build_undistort_count,
1405 /* Cannot be const, because it is assigned to a non-const variable.
1406 * NOLINTNEXTLINE: readability-non-const-parameter. */
1407 bool *stop,
1408 bool *do_update,
1409 float *progress)
1410{
1411 ProxyJob *pj = static_cast<ProxyJob *>(pjv);
1412 MovieClip *clip = pj->clip;
1413 Scene *scene = pj->scene;
1414 int sfra = scene->r.sfra, efra = scene->r.efra;
1416 int tot_thread = BLI_task_scheduler_num_threads();
1417 int width, height;
1418
1419 if (build_undistort_count) {
1420 BKE_movieclip_get_size(clip, nullptr, &width, &height);
1421 }
1422
1423 ProxyQueue queue;
1424 queue.cfra = sfra;
1425 queue.sfra = sfra;
1426 queue.efra = efra;
1427 queue.stop = stop;
1428 queue.do_update = do_update;
1429 queue.progress = progress;
1430
1432 handles = MEM_calloc_arrayN<ProxyThread>(tot_thread, "proxy threaded handles");
1433 for (int i = 0; i < tot_thread; i++) {
1434 ProxyThread *handle = &handles[i];
1435
1436 handle->clip = clip;
1437
1438 handle->build_count = build_count;
1439 handle->build_sizes = build_sizes;
1440
1441 handle->build_undistort_count = build_undistort_count;
1442 handle->build_undistort_sizes = build_undistort_sizes;
1443
1444 if (build_undistort_count) {
1445 handle->distortion = BKE_tracking_distortion_new(&clip->tracking, width, height);
1446 }
1447
1448 BLI_task_pool_push(task_pool, proxy_task_func, handle, false, nullptr);
1449 }
1450
1453
1454 if (build_undistort_count) {
1455 for (int i = 0; i < tot_thread; i++) {
1456 ProxyThread *handle = &handles[i];
1458 }
1459 }
1460
1462}
1463
1464static void proxy_startjob(void *pjv, wmJobWorkerStatus *worker_status)
1465{
1466 ProxyJob *pj = static_cast<ProxyJob *>(pjv);
1467 MovieClip *clip = pj->clip;
1468
1469 short size_flag;
1470 int build_sizes[4], build_count = 0;
1471 int build_undistort_sizes[4], build_undistort_count = 0;
1472
1473 size_flag = clip->proxy.build_size_flag;
1474
1475 build_count = proxy_bitflag_to_array(size_flag, build_sizes, 0);
1476 build_undistort_count = proxy_bitflag_to_array(size_flag, build_undistort_sizes, 1);
1477
1478 if (clip->source == MCLIP_SRC_MOVIE) {
1479 do_movie_proxy(pjv,
1480 build_sizes,
1481 build_count,
1482 build_undistort_sizes,
1483 build_undistort_count,
1484 &worker_status->stop,
1485 &worker_status->do_update,
1486 &worker_status->progress);
1487 }
1488 else {
1490 build_sizes,
1491 build_count,
1492 build_undistort_sizes,
1493 build_undistort_count,
1494 &worker_status->stop,
1495 &worker_status->do_update,
1496 &worker_status->progress);
1497 }
1498}
1499
1500static void proxy_endjob(void *pjv)
1501{
1502 ProxyJob *pj = static_cast<ProxyJob *>(pjv);
1503
1504 if (pj->clip->anim) {
1506 }
1507
1508 if (pj->proxy_builder) {
1510 }
1511
1512 if (pj->clip->source == MCLIP_SRC_MOVIE) {
1513 /* Time-code might have changed, so do a full reload to deal with this. */
1515 }
1516 else {
1517 /* For image sequences we'll preserve original cache. */
1519 }
1520
1522}
1523
1525{
1526 wmJob *wm_job;
1527 ProxyJob *pj;
1528 Scene *scene = CTX_data_scene(C);
1529 ScrArea *area = CTX_wm_area(C);
1532
1533 if ((clip->flag & MCLIP_USE_PROXY) == 0) {
1534 return OPERATOR_CANCELLED;
1535 }
1536
1537 wm_job = WM_jobs_get(CTX_wm_manager(C),
1539 scene,
1540 "Building proxies...",
1543
1544 pj = MEM_callocN<ProxyJob>("proxy rebuild job");
1545 pj->scene = scene;
1546 pj->main = CTX_data_main(C);
1547 pj->clip = clip;
1548 pj->clip_flag = clip->flag & MCLIP_TIMECODE_FLAGS;
1549
1550 if (clip->anim) {
1554 clip->proxy.quality,
1555 true,
1556 nullptr,
1557 false);
1558 }
1559
1561 WM_jobs_timer(wm_job, 0.2, NC_MOVIECLIP | ND_DISPLAY, 0);
1562 WM_jobs_callbacks(wm_job, proxy_startjob, nullptr, nullptr, proxy_endjob);
1563
1564 G.is_break = false;
1565 WM_jobs_start(CTX_wm_manager(C), wm_job);
1566
1567 ED_area_tag_redraw(area);
1568
1569 return OPERATOR_FINISHED;
1570}
1571
1573{
1574 /* identifiers */
1575 ot->name = "Rebuild Proxy and Timecode Indices";
1576 ot->idname = "CLIP_OT_rebuild_proxy";
1577 ot->description = "Rebuild all selected proxies and timecode indices in the background";
1578
1579 /* API callbacks. */
1581 ot->poll = ED_space_clip_poll;
1582
1583 /* flags */
1584 ot->flag = OPTYPE_REGISTER;
1585}
1586
1588
1589/* -------------------------------------------------------------------- */
1592
1594{
1596 int mode = RNA_enum_get(op->ptr, "mode");
1597
1598 sc->mode = mode;
1599
1600 if (sc->mode == SC_MODE_MASKEDIT && sc->view != SC_VIEW_CLIP) {
1601 /* Make sure we are in the right view for mask editing */
1602 sc->view = SC_VIEW_CLIP;
1603 }
1604
1606
1607 return OPERATOR_FINISHED;
1608}
1609
1611{
1612 /* identifiers */
1613 ot->name = "Set Clip Mode";
1614 ot->description = "Set the clip interaction mode";
1615 ot->idname = "CLIP_OT_mode_set";
1616
1617 /* API callbacks. */
1618 ot->exec = mode_set_exec;
1619
1620 ot->poll = ED_space_clip_poll;
1621
1622 /* properties */
1623 ot->prop = RNA_def_enum(
1624 ot->srna, "mode", rna_enum_clip_editor_mode_items, SC_MODE_TRACKING, "Mode", "");
1626}
1627
1629
1630#ifdef WITH_INPUT_NDOF
1631
1632/* -------------------------------------------------------------------- */
1635
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
1642static wmOperatorStatus clip_view_ndof_invoke(bContext *C,
1643 wmOperator * /*op*/,
1644 const wmEvent *event)
1645{
1646 if (event->type != NDOF_MOTION) {
1647 return OPERATOR_CANCELLED;
1648 }
1649
1651 ARegion *region = CTX_wm_region(C);
1652
1653 const wmNDOFMotionData &ndof = *static_cast<wmNDOFMotionData *>(event->customdata);
1654 const float pan_speed = NDOF_PIXELS_PER_SECOND;
1655
1656 blender::float3 pan_vec = ndof.time_delta * WM_event_ndof_translation_get_for_navigation(ndof);
1657 mul_v2_fl(pan_vec, pan_speed / sc->zoom);
1658
1659 sclip_zoom_set_factor(C, max_ff(0.0f, 1.0f - pan_vec[2]), nullptr, false);
1660 sc->xof += pan_vec[0];
1661 sc->yof += pan_vec[1];
1662
1663 ED_region_tag_redraw(region);
1664
1665 return OPERATOR_FINISHED;
1666}
1667
1668void CLIP_OT_view_ndof(wmOperatorType *ot)
1669{
1670 /* identifiers */
1671 ot->name = "NDOF Pan/Zoom";
1672 ot->idname = "CLIP_OT_view_ndof";
1673 ot->description = "Use a 3D mouse device to pan/zoom the view";
1674
1675 /* API callbacks. */
1676 ot->invoke = clip_view_ndof_invoke;
1678
1679 /* flags */
1680 ot->flag = OPTYPE_LOCK_BYPASS;
1681}
1682
1684
1685#endif /* WITH_INPUT_NDOF */
1686
1687/* -------------------------------------------------------------------- */
1690
1692{
1693 /* no running blender, remove handler and pass through */
1696 }
1697
1698 /* running render */
1699 switch (event->type) {
1700 case EVT_ESCKEY:
1702 default: {
1703 break;
1704 }
1705 }
1706
1707 return OPERATOR_PASS_THROUGH;
1708}
1709
1711 wmOperator *op,
1712 const wmEvent * /*_event*/)
1713{
1715
1716 /* add modal handler for ESC */
1718
1720}
1721
1723{
1724 /* identifiers */
1725 ot->name = "Prefetch Frames";
1726 ot->idname = "CLIP_OT_prefetch";
1727 ot->description = "Prefetch frames from disk for faster playback/tracking";
1728
1729 /* API callbacks. */
1731 ot->invoke = clip_prefetch_invoke;
1732 ot->modal = clip_prefetch_modal;
1733}
1734
1736
1737/* -------------------------------------------------------------------- */
1740
1742{
1744 Scene *scene = CTX_data_scene(C);
1745 int clip_length;
1746
1747 if (ELEM(nullptr, scene, clip)) {
1748 return OPERATOR_CANCELLED;
1749 }
1750
1751 clip_length = BKE_movieclip_get_duration(clip);
1752
1753 scene->r.sfra = clip->start_frame;
1754 scene->r.efra = scene->r.sfra + clip_length - 1;
1755
1756 scene->r.efra = max_ii(scene->r.sfra, scene->r.efra);
1757
1759
1760 return OPERATOR_FINISHED;
1761}
1762
1764{
1765 /* identifiers */
1766 ot->name = "Set Scene Frames";
1767 ot->idname = "CLIP_OT_set_scene_frames";
1768 ot->description = "Set scene's start and end frame to match clip's start frame and length";
1769
1770 /* API callbacks. */
1773}
1774
1776
1777/* -------------------------------------------------------------------- */
1780
1782{
1783 SpaceClip *sclip = CTX_wm_space_clip(C);
1784 bool show_cursor = false;
1785
1786 show_cursor |= sclip->mode == SC_MODE_MASKEDIT;
1787 show_cursor |= sclip->around == V3D_AROUND_CURSOR;
1788
1789 if (!show_cursor) {
1790 return OPERATOR_CANCELLED;
1791 }
1792
1793 RNA_float_get_array(op->ptr, "location", sclip->cursor);
1794
1796
1797 /* Use pass-through to allow click-drag to transform the cursor. */
1799}
1800
1802 wmOperator *op,
1803 const wmEvent *event)
1804{
1805 ARegion *region = CTX_wm_region(C);
1806 SpaceClip *sclip = CTX_wm_space_clip(C);
1807 float location[2];
1808
1809 ED_clip_mouse_pos(sclip, region, event->mval, location);
1810 RNA_float_set_array(op->ptr, "location", location);
1811
1812 return clip_set_2d_cursor_exec(C, op);
1813}
1814
1816{
1817 /* identifiers */
1818 ot->name = "Set 2D Cursor";
1819 ot->description = "Set 2D cursor location";
1820 ot->idname = "CLIP_OT_cursor_set";
1821
1822 /* API callbacks. */
1824 ot->invoke = clip_set_2d_cursor_invoke;
1825 ot->poll = ED_space_clip_poll;
1826
1827 /* flags */
1828 ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
1829
1830 /* properties */
1832 "location",
1833 2,
1834 nullptr,
1835 -FLT_MAX,
1836 FLT_MAX,
1837 "Location",
1838 "Cursor location in normalized clip coordinates",
1839 -10.0f,
1840 10.0f);
1841}
1842
1844
1845/* -------------------------------------------------------------------- */
1848
1850{
1851 SpaceClip *space_clip = CTX_wm_space_clip(C);
1852
1853 ClipViewLockState lock_state;
1854 ED_clip_view_lock_state_store(C, &lock_state);
1855
1856 space_clip->flag ^= SC_LOCK_SELECTION;
1857
1859
1861
1862 return OPERATOR_FINISHED;
1863}
1864
1866{
1867 /* identifiers */
1868 ot->name = "Toggle Lock Selection";
1869 ot->description = "Toggle Lock Selection option of the current clip editor";
1870 ot->idname = "CLIP_OT_lock_selection_toggle";
1871
1872 /* API callbacks. */
1873 ot->poll = ED_space_clip_poll;
1875
1876 /* flags */
1877 ot->flag = OPTYPE_LOCK_BYPASS;
1878}
1879
1881
1882/* -------------------------------------------------------------------- */
1885
1887{
1889 wmOperatorTypeMacro *otmacro;
1890
1891 ot = WM_operatortype_append_macro("CLIP_OT_add_marker_move",
1892 "Add Marker and Move",
1893 "Add new marker and move it on movie",
1895 WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
1896 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
1897 RNA_struct_system_idprops_unset(otmacro->ptr, "release_confirm");
1898
1900 "CLIP_OT_add_marker_slide",
1901 "Add Marker and Slide",
1902 "Add new marker and slide it with mouse until mouse button release",
1904 WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
1905 otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
1906 RNA_boolean_set(otmacro->ptr, "release_confirm", true);
1907}
1908
bScreen * CTX_wm_screen(const bContext *C)
MovieClip * CTX_data_edit_movieclip(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
SpaceClip * CTX_wm_space_clip(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
void id_us_min(ID *id)
Definition lib_id.cc:366
void BKE_movieclip_build_proxy_frame(struct MovieClip *clip, int clip_flag, struct MovieDistortion *distortion, int cfra, const int *build_sizes, int build_count, bool undistorted)
void BKE_movieclip_reload(struct Main *bmain, struct MovieClip *clip)
void BKE_movieclip_build_proxy_frame_for_ibuf(struct MovieClip *clip, struct ImBuf *ibuf, struct MovieDistortion *distortion, int cfra, const int *build_sizes, int build_count, bool undistorted)
struct MovieClip * BKE_movieclip_file_add_exists(struct Main *bmain, const char *filepath)
int BKE_movieclip_get_duration(struct MovieClip *clip)
void BKE_movieclip_get_size(struct MovieClip *clip, const struct MovieClipUser *user, int *r_width, int *r_height)
void BKE_movieclip_filepath_for_frame(struct MovieClip *clip, const struct MovieClipUser *user, char *filepath)
void BKE_movieclip_clear_proxy_cache(struct MovieClip *clip)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
void BKE_tracking_distortion_free(struct MovieDistortion *distortion)
Definition tracking.cc:2408
struct MovieDistortion * BKE_tracking_distortion_new(struct MovieTracking *tracking, int calibration_width, int calibration_height)
Definition tracking.cc:2262
File and directory operations.
#define O_BINARY
size_t BLI_file_descriptor_size(int file) ATTR_WARN_UNUSED_RESULT
Definition storage.cc:217
int BLI_open(const char *filepath, int oflag, int pmode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
int64_t BLI_read(int fd, void *buf, size_t nbytes)
Definition fileops_c.cc:96
MINLINE int round_fl_to_int(float a)
MINLINE float max_ff(float a, float b)
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])
bool BLI_path_parent_dir(char *path) ATTR_NONNULL(1)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
#define FILE_MAX
#define BLI_path_join(...)
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.h:198
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:194
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:693
unsigned char uchar
int BLI_task_scheduler_num_threads(void)
@ TASK_PRIORITY_LOW
Definition BLI_task.h:52
void * BLI_task_pool_user_data(TaskPool *pool)
Definition task_pool.cc:550
void BLI_task_pool_work_and_wait(TaskPool *pool)
Definition task_pool.cc:535
TaskPool * BLI_task_pool_create(void *userdata, eTaskPriority priority)
Definition task_pool.cc:484
void BLI_task_pool_free(TaskPool *pool)
Definition task_pool.cc:521
void BLI_task_pool_push(TaskPool *pool, TaskRunFunction run, void *taskdata, bool free_taskdata, TaskFreeFunction freedata)
Definition task_pool.cc:526
Platform independent time functions.
double BLI_time_now_seconds(void)
Definition time.cc:113
#define UNLIKELY(x)
#define ELEM(...)
#define RPT_(msgid)
#define BLT_I18NCONTEXT_ID_MOVIECLIP
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_FRAME_CHANGE
Definition DNA_ID.h:1125
@ ID_RECALC_SOURCE
Definition DNA_ID.h:1143
#define ID_BLEND_PATH_FROM_GLOBAL(_id)
Definition DNA_ID.h:688
#define DNA_struct_default_get(struct_name)
@ MCLIP_TIMECODE_FLAGS
@ MCLIP_USE_PROXY
@ MCLIP_PROXY_RENDER_SIZE_75
@ MCLIP_PROXY_RENDER_SIZE_100
@ MCLIP_PROXY_RENDER_SIZE_50
@ MCLIP_PROXY_RENDER_SIZE_25
@ 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
#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 UI_SCALE_FAC
#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
void ED_space_clip_set_clip(bContext *C, bScreen *screen, SpaceClip *sc, MovieClip *clip)
void ED_clip_view_lock_state_restore_no_jump(const bContext *C, const ClipViewLockState *state)
MovieClip * ED_space_clip_get_clip(const SpaceClip *sc)
void ED_clip_mouse_pos(const SpaceClip *sc, const ARegion *region, const int mval[2], float r_co[2])
void ED_space_clip_get_size(const SpaceClip *sc, int *r_width, int *r_height)
bool ED_space_clip_maskedit_poll(bContext *C)
bool ED_space_clip_view_clip_poll(bContext *C)
void ED_space_clip_get_aspect(const SpaceClip *sc, float *r_aspx, float *r_aspy)
bool ED_space_clip_poll(bContext *C)
void ED_clip_view_lock_state_store(const bContext *C, ClipViewLockState *state)
bool ED_clip_view_selection(const bContext *C, const ARegion *region, bool fit)
void ED_area_tag_redraw(ScrArea *area)
Definition area.cc:693
void ED_region_tag_redraw(ARegion *region)
Definition area.cc:618
ImBuf * IMB_load_image_from_memory(const unsigned char *mem, const size_t size, const int flags, const char *descr, const char *filepath=nullptr, char r_colorspace[IM_MAX_SPACE]=nullptr)
Definition readimage.cc:121
void IMB_freeImBuf(ImBuf *ibuf)
IMB_Proxy_Size
@ IB_byte_data
@ IB_multilayer
@ IB_alphamode_detect
Read Guarded memory(de)allocation.
IMB_Timecode_Type
Definition MOV_enums.hh:44
@ PROP_SKIP_SAVE
Definition RNA_types.hh:344
@ PROP_HIDDEN
Definition RNA_types.hh:338
#define C
Definition RandGen.cpp:29
void UI_context_active_but_prop_get_templateID(const bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop)
void UI_view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
Definition view2d.cc:1668
@ WM_FILESEL_FILES
Definition WM_api.hh:1125
@ WM_FILESEL_DIRECTORY
Definition WM_api.hh:1122
@ WM_FILESEL_RELPATH
Definition WM_api.hh:1121
@ WM_JOB_TYPE_CLIP_BUILD_PROXY
Definition WM_api.hh:1788
@ WM_JOB_TYPE_CLIP_PREFETCH
Definition WM_api.hh:1791
@ WM_JOB_PROGRESS
Definition WM_api.hh:1766
@ FILE_OPENFILE
Definition WM_api.hh:1133
@ KM_RELEASE
Definition WM_types.hh:312
#define ND_DISPLAY
Definition WM_types.hh:491
#define NC_MOVIECLIP
Definition WM_types.hh:397
#define NC_SCENE
Definition WM_types.hh:378
#define NA_ADDED
Definition WM_types.hh:586
@ OPTYPE_BLOCKING
Definition WM_types.hh:184
@ OPTYPE_LOCK_BYPASS
Definition WM_types.hh:205
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_GRAB_CURSOR_XY
Definition WM_types.hh:188
@ OPTYPE_REGISTER
Definition WM_types.hh:180
#define NA_EDITED
Definition WM_types.hh:584
#define ND_SPACE_CLIP
Definition WM_types.hh:539
#define ND_FRAME
Definition WM_types.hh:434
#define NC_SPACE
Definition WM_types.hh:392
static wmOperatorStatus change_frame_exec(bContext *C, wmOperator *op)
Definition anim_ops.cc:590
static wmOperatorStatus change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition anim_ops.cc:750
static wmOperatorStatus change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition anim_ops.cc:677
static float frame_from_event(bContext *C, const wmEvent *event)
Definition anim_ops.cc:600
static bool change_frame_poll(bContext *C)
Definition anim_ops.cc:97
volatile int lock
#define U
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
void clip_start_prefetch_job(const bContext *C)
static wmOperatorStatus view_all_exec(bContext *C, wmOperator *)
void clip_view_center_to_point(SpaceClip *sc, float x, float y)
bool clip_view_has_locked_selection(const bContext *C)
static wmOperatorStatus view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition clip_ops.cc:618
static wmOperatorStatus clip_set_2d_cursor_exec(bContext *C, wmOperator *op)
Definition clip_ops.cc:1781
void CLIP_OT_view_zoom_in(wmOperatorType *ot)
Definition clip_ops.cc:781
static void proxy_freejob(void *pjv)
Definition clip_ops.cc:1198
void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
Definition clip_ops.cc:890
static void sclip_zoom_set_factor_exec(bContext *C, const wmEvent *event, float factor)
Definition clip_ops.cc:137
static wmOperatorStatus view_selected_exec(bContext *C, wmOperator *)
Definition clip_ops.cc:1030
void CLIP_OT_cursor_set(wmOperatorType *ot)
Definition clip_ops.cc:1815
static wmOperatorStatus clip_prefetch_modal(bContext *C, wmOperator *, const wmEvent *event)
Definition clip_ops.cc:1691
static void sclip_zoom_set_factor(const bContext *C, float zoomfac, const float location[2], const bool zoom_to_pos)
Definition clip_ops.cc:127
static void view_pan_exit(bContext *C, wmOperator *op, bool cancel)
Definition clip_ops.cc:411
static void open_cancel(bContext *, wmOperator *op)
Definition clip_ops.cc:176
static void view_zoom_cancel(bContext *C, wmOperator *op)
Definition clip_ops.cc:710
static void view_pan_cancel(bContext *C, wmOperator *op)
Definition clip_ops.cc:503
static void view_zoom_exit(bContext *C, wmOperator *op, bool cancel)
Definition clip_ops.cc:589
static void proxy_startjob(void *pjv, wmJobWorkerStatus *worker_status)
Definition clip_ops.cc:1464
static wmOperatorStatus view_zoom_out_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition clip_ops.cc:825
void CLIP_OT_mode_set(wmOperatorType *ot)
Definition clip_ops.cc:1610
static void view_pan_init(bContext *C, wmOperator *op, const wmEvent *event)
Definition clip_ops.cc:379
static wmOperatorStatus view_zoom_out_exec(bContext *C, wmOperator *op)
Definition clip_ops.cc:812
void CLIP_OT_view_zoom(wmOperatorType *ot)
Definition clip_ops.cc:715
static wmOperatorStatus view_zoom_ratio_exec(bContext *C, wmOperator *op)
Definition clip_ops.cc:875
void CLIP_OT_view_zoom_out(wmOperatorType *ot)
Definition clip_ops.cc:838
static wmOperatorStatus view_zoom_in_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition clip_ops.cc:768
void CLIP_OT_open(wmOperatorType *ot)
Definition clip_ops.cc:303
void CLIP_OT_set_scene_frames(wmOperatorType *ot)
Definition clip_ops.cc:1763
void CLIP_OT_change_frame(wmOperatorType *ot)
Definition clip_ops.cc:1163
static wmOperatorStatus view_zoom_in_exec(bContext *C, wmOperator *op)
Definition clip_ops.cc:755
static wmOperatorStatus reload_exec(bContext *C, wmOperator *)
Definition clip_ops.cc:334
static wmOperatorStatus change_frame_exec(bContext *C, wmOperator *op)
Definition clip_ops.cc:1089
static void proxy_endjob(void *pjv)
Definition clip_ops.cc:1500
static wmOperatorStatus view_pan_exec(bContext *C, wmOperator *op)
Definition clip_ops.cc:427
void CLIP_OT_view_selected(wmOperatorType *ot)
Definition clip_ops.cc:1044
static void sclip_zoom_set(const bContext *C, float zoom, const float location[2], const bool zoom_to_pos)
Definition clip_ops.cc:73
static void open_init(bContext *C, wmOperator *op)
Definition clip_ops.cc:168
static void clip_filesel(bContext *C, wmOperator *op, const char *dirpath)
Definition clip_ops.cc:161
static int frame_from_event(bContext *C, const wmEvent *event)
Definition clip_ops.cc:1096
static wmOperatorStatus clip_rebuild_proxy_exec(bContext *C, wmOperator *)
Definition clip_ops.cc:1524
static wmOperatorStatus view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition clip_ops.cc:448
void ED_operatormacros_clip()
Definition clip_ops.cc:1886
static void proxy_task_func(TaskPool *__restrict pool, void *task_data)
Definition clip_ops.cc:1365
static wmOperatorStatus change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition clip_ops.cc:1138
static wmOperatorStatus view_all_exec(bContext *C, wmOperator *op)
Definition clip_ops.cc:922
void CLIP_OT_prefetch(wmOperatorType *ot)
Definition clip_ops.cc:1722
static wmOperatorStatus clip_prefetch_invoke(bContext *C, wmOperator *op, const wmEvent *)
Definition clip_ops.cc:1710
static uchar * proxy_thread_next_frame(ProxyQueue *queue, MovieClip *clip, size_t *r_size, int *r_cfra)
Definition clip_ops.cc:1317
void CLIP_OT_view_center_cursor(wmOperatorType *ot)
Definition clip_ops.cc:1012
static wmOperatorStatus change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition clip_ops.cc:1118
static wmOperatorStatus clip_set_scene_frames_exec(bContext *C, wmOperator *)
Definition clip_ops.cc:1741
void CLIP_OT_rebuild_proxy(wmOperatorType *ot)
Definition clip_ops.cc:1572
static wmOperatorStatus view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition clip_ops.cc:469
static wmOperatorStatus view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition clip_ops.cc:685
void CLIP_OT_lock_selection_toggle(wmOperatorType *ot)
Definition clip_ops.cc:1865
static wmOperatorStatus mode_set_exec(bContext *C, wmOperator *op)
Definition clip_ops.cc:1593
static wmOperatorStatus open_exec(bContext *C, wmOperator *op)
Definition clip_ops.cc:185
static wmOperatorStatus lock_selection_toggle_exec(bContext *C, wmOperator *)
Definition clip_ops.cc:1849
static bool change_frame_poll(bContext *C)
Definition clip_ops.cc:1065
static wmOperatorStatus view_center_cursor_exec(bContext *C, wmOperator *)
Definition clip_ops.cc:1000
void CLIP_OT_view_pan(wmOperatorType *ot)
Definition clip_ops.cc:508
void CLIP_OT_view_all(wmOperatorType *ot)
Definition clip_ops.cc:973
static void do_movie_proxy(void *pjv, int *, int, const int *build_undistort_sizes, int build_undistort_count, bool *stop, bool *do_update, float *progress)
Definition clip_ops.cc:1236
static void do_sequence_proxy(void *pjv, int *build_sizes, int build_count, int *build_undistort_sizes, int build_undistort_count, bool *stop, bool *do_update, float *progress)
Definition clip_ops.cc:1400
static void view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
Definition clip_ops.cc:558
static wmOperatorStatus view_zoom_exec(bContext *C, wmOperator *op)
Definition clip_ops.cc:609
static void change_frame_apply(bContext *C, wmOperator *op)
Definition clip_ops.cc:1075
void CLIP_OT_reload(wmOperatorType *ot)
Definition clip_ops.cc:350
static void view_zoom_apply(bContext *C, ViewZoomData *vpd, wmOperator *op, const wmEvent *event, const bool zoom_to_pos)
Definition clip_ops.cc:642
static wmOperatorStatus open_invoke(bContext *C, wmOperator *op, const wmEvent *)
Definition clip_ops.cc:268
static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undistort)
Definition clip_ops.cc:1205
static wmOperatorStatus clip_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition clip_ops.cc:1801
nullptr float
#define powf(x, y)
static wmOperatorStatus open_invoke(bContext *C, wmOperator *op, const wmEvent *)
Definition editfont.cc:2467
TaskPool * task_pool
static void open_cancel(bContext *, wmOperator *op)
Definition io_cache.cc:70
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:123
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
#define G(x, y, z)
MovieProxyBuilder * MOV_proxy_builder_start(MovieReader *anim, IMB_Timecode_Type tcs_in_use, int proxy_sizes_in_use, int quality, const bool overwrite, blender::Set< std::string > *processed_paths, bool build_only_on_bad_performance)
void MOV_proxy_builder_process(MovieProxyBuilder *context, bool *stop, bool *do_update, float *progress)
void MOV_close_proxies(MovieReader *anim)
void MOV_proxy_builder_finish(MovieProxyBuilder *context, const bool stop)
VecBase< float, 3 > float3
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
bool RNA_struct_system_idprops_unset(PointerRNA *ptr, const char *identifier)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_collection_is_empty(PointerRNA *ptr, const char *name)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
int RNA_int_get(PointerRNA *ptr, const char *name)
float RNA_float_get(PointerRNA *ptr, const char *name)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
bool RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_id_pointer_create(ID *id)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
const EnumPropertyItem rna_enum_clip_editor_mode_items[]
Definition rna_space.cc:518
#define FLT_MAX
Definition stdcycles.h:14
char filepath[1024]
Definition BKE_main.hh:179
struct MovieReader * anim
char filepath[1024]
struct MovieClipProxy proxy
struct MovieTracking tracking
PropertyRNA * prop
Definition RNA_types.hh:146
MovieClip * clip
Definition clip_ops.cc:1192
int clip_flag
Definition clip_ops.cc:1193
MovieProxyBuilder * proxy_builder
Definition clip_ops.cc:1195
bool stop
Definition clip_ops.cc:1194
Scene * scene
Definition clip_ops.cc:1190
Main * main
Definition clip_ops.cc:1191
float * progress
Definition clip_ops.cc:1307
const bool * stop
Definition clip_ops.cc:1305
std::mutex mutex
Definition clip_ops.cc:1303
bool * do_update
Definition clip_ops.cc:1306
int * build_sizes
Definition clip_ops.cc:1313
MovieClip * clip
Definition clip_ops.cc:1311
MovieDistortion * distortion
Definition clip_ops.cc:1312
int * build_undistort_sizes
Definition clip_ops.cc:1314
int build_undistort_count
Definition clip_ops.cc:1314
struct RenderData r
float cursor[2]
wmEventType type
Definition WM_types.hh:757
short val
Definition WM_types.hh:759
int xy[2]
Definition WM_types.hh:761
int mval[2]
Definition WM_types.hh:763
void * customdata
Definition WM_types.hh:807
struct ReportList * reports
struct PointerRNA * ptr
wmWindow * win
Definition WM_types.hh:956
i
Definition text_draw.cc:230
ParamHandle ** handles
static wmOperatorStatus view_pan_exec(bContext *C, wmOperator *op)
static wmOperatorStatus view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void view_pan_cancel(bContext *, wmOperator *op)
static wmOperatorStatus view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
void WM_cursor_modal_set(wmWindow *win, int val)
void WM_cursor_modal_restore(wmWindow *win)
bool WM_cursor_modal_is_set_ok(const wmWindow *win)
@ WM_CURSOR_NSEW_SCROLL
Definition wm_cursors.hh:52
int WM_userdef_event_type_from_keymap_type(int kmitype)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
void WM_main_add_notifier(uint type, void *reference)
wmEventHandler_Op * WM_event_add_modal_handler(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.cc:4237
void WM_jobs_timer(wmJob *wm_job, double time_step, uint note, uint endnote)
Definition wm_jobs.cc:376
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
Definition wm_jobs.cc:479
void WM_jobs_kill_type(wmWindowManager *wm, const void *owner, int job_type)
Definition wm_jobs.cc:623
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, const eWM_JobFlag flag, const eWM_JobType job_type)
Definition wm_jobs.cc:211
void WM_jobs_callbacks(wmJob *wm_job, wm_jobs_start_callback startjob, void(*initjob)(void *), void(*update)(void *), void(*endjob)(void *))
Definition wm_jobs.cc:388
bool WM_jobs_test(const wmWindowManager *wm, const void *owner, int job_type)
Definition wm_jobs.cc:247
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *customdata))
Definition wm_jobs.cc:360
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)
wmOperatorTypeMacro * WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
wmOperatorType * WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag)
wmTimer * WM_event_timer_add(wmWindowManager *wm, wmWindow *win, const wmEventType event_type, const double time_step)
void WM_event_timer_remove(wmWindowManager *wm, wmWindow *, wmTimer *timer)