Blender V4.3
sequencer_preview_draw.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cmath>
10#include <cstring>
11
12#include "BLF_api.hh"
13
14#include "BLI_blenlib.h"
15#include "BLI_math_rotation.h"
16#include "BLI_utildefines.h"
17
18#include "IMB_imbuf_types.hh"
19
20#include "DNA_scene_types.h"
21#include "DNA_screen_types.h"
22#include "DNA_space_types.h"
23
24#include "BKE_context.hh"
25#include "BKE_global.hh"
26#include "BKE_scene.hh"
27
29#include "IMB_imbuf.hh"
30
31#include "GPU_framebuffer.hh"
32#include "GPU_immediate.hh"
33#include "GPU_immediate_util.hh"
34#include "GPU_matrix.hh"
35#include "GPU_viewport.hh"
36
37#include "ED_gpencil_legacy.hh"
38#include "ED_screen.hh"
39#include "ED_sequencer.hh"
40#include "ED_space_api.hh"
41#include "ED_util.hh"
42
43#include "BIF_glutil.hh"
44
45#include "SEQ_channels.hh"
46#include "SEQ_iterator.hh"
47#include "SEQ_prefetch.hh"
48#include "SEQ_proxy.hh"
49#include "SEQ_render.hh"
50#include "SEQ_select.hh"
51#include "SEQ_sequencer.hh"
52#include "SEQ_time.hh"
53#include "SEQ_transform.hh"
54
55#include "UI_interface.hh"
56#include "UI_resources.hh"
57#include "UI_view2d.hh"
58
59#include "WM_api.hh"
60#include "WM_types.hh"
61
62#include "sequencer_intern.hh"
64#include "sequencer_scopes.hh"
65
66static Sequence *special_seq_update = nullptr;
67
72
77
79{
80 Scene *scene = CTX_data_scene(C);
81 ARegion *region = CTX_wm_region(C);
82 eSeqHandle hand_dummy;
83 Sequence *seq = find_nearest_seq(scene, &region->v2d, mval, &hand_dummy);
85}
86
91
93 int timeline_frame,
94 int frame_ofs,
95 const char *viewname)
96{
97 Main *bmain = CTX_data_main(C);
98 ARegion *region = CTX_wm_region(C);
100 Scene *scene = CTX_data_scene(C);
101 SpaceSeq *sseq = CTX_wm_space_seq(C);
102 bScreen *screen = CTX_wm_screen(C);
103
104 SeqRenderData context = {nullptr};
105 ImBuf *ibuf;
106 int rectx, recty;
107 double render_size;
108 short is_break = G.is_break;
109
110 if (sseq->render_size == SEQ_RENDER_SIZE_NONE) {
111 return nullptr;
112 }
113
114 if (sseq->render_size == SEQ_RENDER_SIZE_SCENE) {
115 render_size = scene->r.size / 100.0;
116 }
117 else {
118 render_size = SEQ_rendersize_to_scale_factor(sseq->render_size);
119 }
120
121 rectx = roundf(render_size * scene->r.xsch);
122 recty = roundf(render_size * scene->r.ysch);
123
125 bmain, depsgraph, scene, rectx, recty, sseq->render_size, false, &context);
126 context.view_id = BKE_scene_multiview_view_id_get(&scene->r, viewname);
127 context.use_proxies = (sseq->flag & SEQ_USE_PROXIES) != 0;
128 context.is_playing = screen->animtimer != nullptr;
129 context.is_scrubbing = screen->scrubbing;
130
131 /* Sequencer could start rendering, in this case we need to be sure it wouldn't be
132 * canceled by Escape pressed somewhere in the past. */
133 G.is_break = false;
134
136 GPUFrameBuffer *fb = GPU_framebuffer_active_get();
137 if (viewport) {
138 /* Unbind viewport to release the DRW context. */
139 GPU_viewport_unbind(viewport);
140 }
141 else {
142 /* Rendering can change OGL context. Save & Restore frame-buffer. */
144 }
145
148 &context, timeline_frame + frame_ofs, ED_sequencer_special_preview_get());
149 }
150 else {
151 ibuf = SEQ_render_give_ibuf(&context, timeline_frame + frame_ofs, sseq->chanshown);
152 }
153
154 if (viewport) {
155 /* Follows same logic as wm_draw_window_offscreen to make sure to restore the same
156 * viewport. */
157 int view = (sseq->multiview_eye == STEREO_RIGHT_ID) ? 1 : 0;
158 GPU_viewport_bind(viewport, view, &region->winrct);
159 }
160 else if (fb) {
162 }
163
164 /* Restore state so real rendering would be canceled if needed. */
165 G.is_break = is_break;
166
167 return ibuf;
168}
169
171 ImBuf *ibuf,
172 ImBuf *(*make_scope_fn)(const ImBuf *ibuf))
173{
174 ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
175 ImBuf *scope;
176
178 display_ibuf, &scene->view_settings, &scene->display_settings);
179
180 scope = make_scope_fn(display_ibuf);
181 IMB_rectfill_alpha(scope, 1.0f);
182
183 IMB_freeImBuf(display_ibuf);
184
185 return scope;
186}
187
188static void sequencer_display_size(Scene *scene, float r_viewrect[2])
189{
190 r_viewrect[0] = float(scene->r.xsch);
191 r_viewrect[1] = float(scene->r.ysch);
192
193 r_viewrect[0] *= scene->r.xasp / scene->r.yasp;
194}
195
197{
198 /* Draw grease-pencil (image aligned). */
200
201 /* Orthographic at pixel level. */
203
204 /* Draw grease-pencil (screen aligned). */
206}
207
212 const View2D *v2d,
213 const Scene *scene)
214{
215 float x1 = v2d->tot.xmin;
216 float y1 = v2d->tot.ymin;
217 float x2 = v2d->tot.xmax;
218 float y2 = v2d->tot.ymax;
219
220 GPU_line_width(1.0f);
221
222 /* Draw border. */
223 const uint shdr_pos = GPU_vertformat_attr_add(
225
227
228 float viewport_size[4];
229 GPU_viewport_size_get_f(viewport_size);
230 immUniform2f("viewport_size", viewport_size[2] / UI_SCALE_FAC, viewport_size[3] / UI_SCALE_FAC);
231
233 immUniform1i("colors_len", 0); /* Simple dashes. */
234 immUniform1f("dash_width", 6.0f);
235 immUniform1f("udash_factor", 0.5f);
236
237 imm_draw_box_wire_2d(shdr_pos, x1 - 0.5f, y1 - 0.5f, x2 + 0.5f, y2 + 0.5f);
238
239 /* Draw safety border. */
242 rctf rect;
243 rect.xmin = x1;
244 rect.xmax = x2;
245 rect.ymin = y1;
246 rect.ymax = y2;
247 UI_draw_safe_areas(shdr_pos, &rect, scene->safe_areas.title, scene->safe_areas.action);
248
250
252 shdr_pos, &rect, scene->safe_areas.title_center, scene->safe_areas.action_center);
253 }
254 }
255
257}
258
259#if 0
260void sequencer_draw_maskedit(const bContext *C, Scene *scene, ARegion *region, SpaceSeq *sseq)
261{
262 /* NOTE: sequencer mask editing isn't finished, the draw code is working but editing not.
263 * For now just disable drawing since the strip frame will likely be offset. */
264
265 // if (sc->mode == SC_MODE_MASKEDIT)
266 if (0 && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
267 Mask *mask = SEQ_active_mask_get(scene);
268
269 if (mask) {
270 int width, height;
271 float aspx = 1.0f, aspy = 1.0f;
272 // ED_mask_get_size(C, &width, &height);
273
274 // Scene *scene = CTX_data_scene(C);
275 BKE_render_resolution(&scene->r, false, &width, &height);
276
278 region,
279 0,
280 0,
281 0, /* TODO */
282 width,
283 height,
284 aspx,
285 aspy,
286 false,
287 true,
288 nullptr,
289 C);
290 }
291 }
292}
293#endif
294
295/* Force redraw, when prefetching and using cache view. */
296static void seq_prefetch_wm_notify(const bContext *C, Scene *scene)
297{
298 if (SEQ_prefetch_need_redraw(C, scene)) {
300 }
301}
302
304 ImBuf *ibuf,
305 bool *r_glsl_used,
306 eGPUTextureFormat *r_format,
307 eGPUDataFormat *r_data,
308 void **r_buffer_cache_handle)
309{
310 void *display_buffer;
311 bool force_fallback = false;
312 *r_glsl_used = false;
313 force_fallback |= (ED_draw_imbuf_method(ibuf) != IMAGE_DRAW_METHOD_GLSL);
314 force_fallback |= (ibuf->dither != 0.0f);
315
316 /* Default */
317 *r_format = GPU_RGBA8;
318 *r_data = GPU_DATA_UBYTE;
319
320 /* Fallback to CPU based color space conversion. */
321 if (force_fallback) {
322 *r_glsl_used = false;
323 display_buffer = nullptr;
324 }
325 else if (ibuf->float_buffer.data) {
326 display_buffer = ibuf->float_buffer.data;
327
328 *r_data = GPU_DATA_FLOAT;
329 if (ibuf->channels == 4) {
330 *r_format = GPU_RGBA16F;
331 }
332 else if (ibuf->channels == 3) {
333 /* Alpha is implicitly 1. */
334 *r_format = GPU_RGB16F;
335 }
336 else {
337 BLI_assert_msg(0, "Incompatible number of channels for float buffer in sequencer");
338 *r_format = GPU_RGBA16F;
339 display_buffer = nullptr;
340 }
341
342 if (ibuf->float_buffer.colorspace) {
344 C, ibuf->float_buffer.colorspace, ibuf->dither, true);
345 }
346 else {
347 *r_glsl_used = IMB_colormanagement_setup_glsl_draw_ctx(C, ibuf->dither, true);
348 }
349 }
350 else if (ibuf->byte_buffer.data) {
351 display_buffer = ibuf->byte_buffer.data;
352
354 C, ibuf->byte_buffer.colorspace, ibuf->dither, false);
355 }
356 else {
357 display_buffer = nullptr;
358 }
359
360 /* There is data to be displayed, but GLSL is not initialized
361 * properly, in this case we fallback to CPU-based display transform. */
362 if ((ibuf->byte_buffer.data || ibuf->float_buffer.data) && !*r_glsl_used) {
363 display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, r_buffer_cache_handle);
364 *r_format = GPU_RGBA8;
365 *r_data = GPU_DATA_UBYTE;
366 }
367
368 return display_buffer;
369}
370
371static void sequencer_stop_running_jobs(const bContext *C, Scene *scene)
372{
373 if (G.is_rendering == false && (scene->r.seq_prev_type) == OB_RENDER) {
374 /* Stop all running jobs, except screen one. Currently previews frustrate Render.
375 * Need to make so sequencers rendering doesn't conflict with compositor. */
377
378 /* In case of final rendering used for preview, kill all previews,
379 * otherwise threading conflict will happen in rendering module. */
381 }
382}
383
388
389static void sequencer_preview_get_rect(rctf *preview,
390 Scene *scene,
391 ARegion *region,
392 SpaceSeq *sseq,
393 bool draw_overlay,
394 bool draw_backdrop)
395{
396 View2D *v2d = &region->v2d;
397 float viewrect[2];
398
399 sequencer_display_size(scene, viewrect);
400 BLI_rctf_init(preview, -1.0f, 1.0f, -1.0f, 1.0f);
401
402 if (draw_overlay && (sseq->overlay_frame_type == SEQ_OVERLAY_FRAME_TYPE_RECT)) {
403 preview->xmax = v2d->tot.xmin +
405 preview->xmin = v2d->tot.xmin +
407 preview->ymax = v2d->tot.ymin +
409 preview->ymin = v2d->tot.ymin +
411 }
412 else if (draw_backdrop) {
413 float aspect = BLI_rcti_size_x(&region->winrct) / float(BLI_rcti_size_y(&region->winrct));
414 float image_aspect = viewrect[0] / viewrect[1];
415
416 if (aspect >= image_aspect) {
417 preview->xmax = image_aspect / aspect;
418 preview->xmin = -preview->xmax;
419 }
420 else {
421 preview->ymax = aspect / image_aspect;
422 preview->ymin = -preview->ymax;
423 }
424 }
425 else {
426 *preview = v2d->tot;
427 }
428}
429
431 Scene *scene,
432 ARegion *region,
433 SpaceSeq *sseq,
434 ImBuf *ibuf,
435 bool draw_overlay,
436 bool draw_backdrop)
437{
438 void *buffer_cache_handle = nullptr;
439
440 if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) {
442 }
443
444 /* Format needs to be created prior to any #immBindShader call.
445 * Do it here because OCIO binds its own shader. */
448 bool glsl_used = false;
449 GPUVertFormat *imm_format = immVertexFormat();
451 uint texCoord = GPU_vertformat_attr_add(
452 imm_format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
453
454 void *display_buffer = sequencer_OCIO_transform_ibuf(
455 C, ibuf, &glsl_used, &format, &data, &buffer_cache_handle);
456
457 if (draw_backdrop) {
462 }
464 GPUTexture *texture = GPU_texture_create_2d(
465 "seq_display_buf", ibuf->x, ibuf->y, 1, format, usage, nullptr);
466 GPU_texture_update(texture, data, display_buffer);
468
470
471 if (!glsl_used) {
473 immUniformColor3f(1.0f, 1.0f, 1.0f);
474 }
475
477
478 rctf preview;
479 rctf canvas;
480 sequencer_preview_get_rect(&preview, scene, region, sseq, draw_overlay, draw_backdrop);
481
482 if (draw_overlay && (sseq->overlay_frame_type == SEQ_OVERLAY_FRAME_TYPE_RECT)) {
483 canvas = scene->ed->overlay_frame_rect;
484 }
485 else {
486 BLI_rctf_init(&canvas, 0.0f, 1.0f, 0.0f, 1.0f);
487 }
488
489 immAttr2f(texCoord, canvas.xmin, canvas.ymin);
490 immVertex2f(pos, preview.xmin, preview.ymin);
491
492 immAttr2f(texCoord, canvas.xmin, canvas.ymax);
493 immVertex2f(pos, preview.xmin, preview.ymax);
494
495 immAttr2f(texCoord, canvas.xmax, canvas.ymax);
496 immVertex2f(pos, preview.xmax, preview.ymax);
497
498 immAttr2f(texCoord, canvas.xmax, canvas.ymin);
499 immVertex2f(pos, preview.xmax, preview.ymin);
500
501 immEnd();
502
505
506 if (!glsl_used) {
508 }
509 else {
511 }
512
513 if (buffer_cache_handle) {
514 IMB_display_buffer_release(buffer_cache_handle);
515 }
516
517 if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) {
519 }
520
521 if (draw_backdrop) {
524 }
525}
526
527static void draw_histogram(ARegion *region,
529 SeqQuadsBatch &quads,
530 const rctf &area)
531{
532 using namespace blender::ed::seq;
533 if (hist.data.is_empty()) {
534 return;
535 }
536
537 /* Grid lines and labels. */
538 uchar col_grid[4] = {128, 128, 128, 128};
539 float grid_x_0 = area.xmin;
540 float grid_x_1 = area.xmax;
541 /* Float histograms show more than 0..1 range horizontally. */
542 if (hist.is_float_hist()) {
545 grid_x_0 = area.xmin + (area.xmax - area.xmin) * ratio_0;
546 grid_x_1 = area.xmin + (area.xmax - area.xmin) * ratio_1;
547 }
548
549 View2D *v2d = &region->v2d;
550 float text_scale_x, text_scale_y;
551 UI_view2d_scale_get_inverse(v2d, &text_scale_x, &text_scale_y);
552
553 for (int line = 0; line <= 4; line++) {
554 float val = float(line) / 4;
555 float x = grid_x_0 + (grid_x_1 - grid_x_0) * val;
556 quads.add_line(x, area.ymin, x, area.ymax, col_grid);
557
558 /* Label. */
559 char buf[10];
560 const size_t buf_len = SNPRINTF_RLEN(buf, "%.2f", val);
561
562 float text_width, text_height;
563 BLF_width_and_height(BLF_default(), buf, buf_len, &text_width, &text_height);
564 text_width *= text_scale_x;
565 text_height *= text_scale_y;
567 v2d, x - text_width / 2, area.ymax - text_height * 1.3f, buf, buf_len, col_grid);
568 }
569
570 /* Border. */
571 uchar col_border[4] = {64, 64, 64, 128};
572 quads.add_wire_quad(area.xmin, area.ymin, area.xmax, area.ymax, col_border);
573
574 /* Histogram area & line for each R/G/B channels, additively blended. */
575 quads.draw();
577 for (int ch = 0; ch < 3; ++ch) {
578 if (hist.max_value[ch] == 0) {
579 continue;
580 }
581 uchar col_line[4] = {32, 32, 32, 255};
582 uchar col_area[4] = {64, 64, 64, 128};
583 col_line[ch] = 224;
584 col_area[ch] = 224;
585 float y_scale = (area.ymax - area.ymin) / hist.max_value[ch] * 0.95f;
586 float x_scale = (area.xmax - area.xmin) / hist.data.size();
587 float yb = area.ymin;
588 for (int bin = 0; bin < hist.data.size() - 1; bin++) {
589 float x0 = area.xmin + (bin + 0.5f) * x_scale;
590 float x1 = area.xmin + (bin + 1.5f) * x_scale;
591
592 float y0 = area.ymin + hist.data[bin][ch] * y_scale;
593 float y1 = area.ymin + hist.data[bin + 1][ch] * y_scale;
594 quads.add_quad(x0, yb, x0, y0, x1, yb, x1, y1, col_area);
595 quads.add_line(x0, y0, x1, y1, col_line);
596 }
597 }
598 quads.draw();
600
602}
603
605{
606 float y, u, v;
607 rgb_to_yuv(rgb.x, rgb.y, rgb.z, &y, &u, &v, BLI_YUV_ITU_BT709);
608 return blender::float2(u, v);
609}
610
611static void draw_waveform_graticule(ARegion *region, SeqQuadsBatch &quads, const rctf &area)
612{
613 /* Horizontal lines at 10%, 70%, 90%. */
614 const float lines[3] = {0.1f, 0.7f, 0.9f};
615 uchar col_grid[4] = {160, 64, 64, 128};
616 const float x0 = area.xmin;
617 const float x1 = area.xmax;
618
619 for (int i = 0; i < 3; i++) {
620 const float y = area.ymin + (area.ymax - area.ymin) * lines[i];
621 char buf[10];
622 SNPRINTF(buf, "%.1f", lines[i]);
623 quads.add_line(x0, y, x1, y, col_grid);
624 UI_view2d_text_cache_add(&region->v2d, x0 + 8, y + 8, buf, strlen(buf), col_grid);
625 }
626 /* Border. */
627 uchar col_border[4] = {64, 64, 64, 128};
628 quads.add_wire_quad(x0, area.ymin, x1, area.ymax, col_border);
629
630 quads.draw();
632}
633
634static void draw_vectorscope_graticule(ARegion *region, SeqQuadsBatch &quads, const rctf &area)
635{
636 using namespace blender;
637
638 const float skin_rad = DEG2RADF(123.0f); /* angle in radians of the skin tone line */
639
640 const float w = BLI_rctf_size_x(&area);
641 const float h = BLI_rctf_size_y(&area);
642 const float2 center{BLI_rctf_cent_x(&area), BLI_rctf_cent_y(&area)};
643 /* Vector-scope image is scaled over UV range (+/-0.615). */
644 const float radius = ((w < h) ? w : h) * 0.5f * (0.5f / 0.615f);
645
646 /* Precalculate circle points/colors. */
647 constexpr int circle_delta = 6;
648 constexpr int num_circle_points = 360 / circle_delta;
649 float2 circle_pos[num_circle_points];
650 float3 circle_col[num_circle_points];
651 for (int i = 0; i < num_circle_points; i++) {
652 float a = DEG2RADF(i * circle_delta);
653 float u = cosf(a);
654 float v = sinf(a);
655 circle_pos[i] = float2(u, v);
656
657 float3 col;
658 yuv_to_rgb(0.5f, u, v, &col.x, &col.y, &col.z, BLI_YUV_ITU_BT709);
659 circle_col[i] = col;
660 }
661
662 /* Draw colored background and outer ring, additively blended
663 * since vectorscope image is already drawn. */
665
666 constexpr float alpha_f = 0.8f;
667 constexpr uchar alpha_b = uchar(alpha_f * 255.0f);
668 const uchar4 col_center(50, 50, 50, alpha_b);
669
670 uchar4 col1(0, 0, 0, alpha_b);
671 uchar4 col2(0, 0, 0, alpha_b);
672 uchar4 col3(0, 0, 0, alpha_b);
673
674 /* Background: since the quads batch utility draws quads, draw two
675 * segments of the circle (two triangles) in one iteration. */
676 constexpr float mul_background = 0.2f;
677 for (int i = 0; i < num_circle_points; i += 2) {
678 int idx1 = i;
679 int idx2 = (i + 1) % num_circle_points;
680 int idx3 = (i + 2) % num_circle_points;
681 float2 pt1 = center + circle_pos[idx1] * radius;
682 float2 pt2 = center + circle_pos[idx2] * radius;
683 float2 pt3 = center + circle_pos[idx3] * radius;
684 float3 rgb1 = circle_col[idx1] * mul_background;
685 float3 rgb2 = circle_col[idx2] * mul_background;
686 float3 rgb3 = circle_col[idx3] * mul_background;
687 rgb_float_to_uchar(col1, rgb1);
688 rgb_float_to_uchar(col2, rgb2);
689 rgb_float_to_uchar(col3, rgb3);
690 quads.add_quad(pt1.x,
691 pt1.y,
692 pt2.x,
693 pt2.y,
694 center.x,
695 center.y,
696 pt3.x,
697 pt3.y,
698 col1,
699 col2,
700 col_center,
701 col3);
702 }
703
704 /* Outer ring. */
705 const float outer_radius = radius * 1.02f;
706 for (int i = 0; i < num_circle_points; i++) {
707 int idx1 = i;
708 int idx2 = (i + 1) % num_circle_points;
709 float2 pt1a = center + circle_pos[idx1] * radius;
710 float2 pt2a = center + circle_pos[idx2] * radius;
711 float2 pt1b = center + circle_pos[idx1] * outer_radius;
712 float2 pt2b = center + circle_pos[idx2] * outer_radius;
713 float3 rgb1 = circle_col[idx1];
714 float3 rgb2 = circle_col[idx2];
715 rgb_float_to_uchar(col1, rgb1);
716 rgb_float_to_uchar(col2, rgb2);
717 quads.add_quad(
718 pt1a.x, pt1a.y, pt1b.x, pt1b.y, pt2a.x, pt2a.y, pt2b.x, pt2b.y, col1, col1, col2, col2);
719 }
720
721 quads.draw();
722
723 /* Draw grid and other labels using regular alpha blending. */
725 const uchar4 col_grid(128, 128, 128, 128);
726
727 /* Cross. */
728 quads.add_line(center.x - radius, center.y, center.x + radius, center.y, col_grid);
729 quads.add_line(center.x, center.y - radius, center.x, center.y + radius, col_grid);
730
731 /* Inner circles. */
732 for (int j = 1; j < 5; j++) {
733 float r = radius * j * 0.2f;
734 for (int i = 0; i < num_circle_points; i++) {
735 int idx1 = i;
736 int idx2 = (i + 1) % num_circle_points;
737 float2 pt1 = center + circle_pos[idx1] * r;
738 float2 pt2 = center + circle_pos[idx2] * r;
739 quads.add_line(pt1.x, pt1.y, pt2.x, pt2.y, col_grid);
740 }
741 }
742
743 /* "Safe" (0.75 saturation) primary color locations and labels. */
744 const float3 primaries[6] = {
745 {1, 0, 0},
746 {1, 1, 0},
747 {0, 1, 0},
748 {0, 1, 1},
749 {0, 0, 1},
750 {1, 0, 1},
751 };
752 const char *names = "RYGCBM";
753
754 /* Calculate size of single text letter. */
755 char buf[2] = {'M', 0};
756 float text_scale_x, text_scale_y;
757 UI_view2d_scale_get_inverse(&region->v2d, &text_scale_x, &text_scale_y);
758 float text_width, text_height;
759 BLF_width_and_height(BLF_default(), buf, 1, &text_width, &text_height);
760 text_width *= text_scale_x;
761 text_height *= text_scale_y;
762
763 const uchar4 col_target(128, 128, 128, 192);
764 const float delta = radius * 0.01f;
765 for (int i = 0; i < 6; i++) {
766 float3 safe = primaries[i] * 0.75f;
767 float2 pos = center + rgb_to_uv(safe) * (radius * 2);
768 quads.add_wire_quad(pos.x - delta, pos.y - delta, pos.x + delta, pos.y + delta, col_target);
769
770 buf[0] = names[i];
772 pos.x + delta * 1.2f + text_width / 4,
773 pos.y - text_height / 2,
774 buf,
775 1,
776 col_target);
777 }
778
779 /* Skin tone line. */
780 const uchar4 col_tone(255, 102, 0, 128);
781 quads.add_line(center.x,
782 center.y,
783 center.x + cosf(skin_rad) * radius,
784 center.y + sinf(skin_rad) * radius,
785 col_tone);
786
787 quads.draw();
789}
790
791static void sequencer_draw_scopes(Scene *scene, ARegion *region, SpaceSeq *sseq)
792{
793 using namespace blender::ed::seq;
794
795 /* Figure out draw coordinates. */
796 rctf preview;
797 sequencer_preview_get_rect(&preview, scene, region, sseq, false, false);
798
799 rctf uv;
800 BLI_rctf_init(&uv, 0.0f, 1.0f, 0.0f, 1.0f);
801 const bool keep_aspect = sseq->mainb == SEQ_DRAW_IMG_VECTORSCOPE;
802 float vecscope_aspect = 1.0f;
803 if (keep_aspect) {
804 float width = std::max(BLI_rctf_size_x(&preview), 0.1f);
805 float height = std::max(BLI_rctf_size_y(&preview), 0.1f);
806 vecscope_aspect = width / height;
807 if (vecscope_aspect >= 1.0f) {
808 BLI_rctf_resize_x(&uv, vecscope_aspect);
809 }
810 else {
811 BLI_rctf_resize_y(&uv, 1.0f / vecscope_aspect);
812 }
813 }
814
815 SeqQuadsBatch quads;
816 SeqScopes *scopes = &sseq->runtime->scopes;
817
818 bool use_blend = sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA;
819
820 /* Draw opaque black rectangle over whole preview area. The scope texture
821 * with clamp to border extend mode should be enough, but results in
822 * garbage pixels around the actual scope on some GPUs/drivers (#119505).
823 * To fix that, background must be drawn, and then the scopes texture be
824 * blended on top. */
825 if (sseq->mainb != SEQ_DRAW_IMG_IMBUF) {
828 uchar black[4] = {0, 0, 0, 255};
830 immUniformColor4ubv(black);
831 immRectf(pos, preview.xmin, preview.ymin, preview.xmax, preview.ymax);
833 use_blend = true;
834 }
835
836 /* Draw scope image if there is one. */
837 ImBuf *scope_image = nullptr;
838 if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
839 scope_image = scopes->zebra_ibuf;
840 }
841 else if (sseq->mainb == SEQ_DRAW_IMG_WAVEFORM) {
842 scope_image = scopes->waveform_ibuf;
843 }
844 else if (sseq->mainb == SEQ_DRAW_IMG_VECTORSCOPE) {
845 scope_image = scopes->vector_ibuf;
846 }
847 else if (sseq->mainb == SEQ_DRAW_IMG_RGBPARADE) {
848 scope_image = scopes->sep_waveform_ibuf;
849 }
850
851 if (use_blend) {
853 }
854
855 if (scope_image != nullptr) {
856 if (scope_image->float_buffer.data && scope_image->byte_buffer.data == nullptr) {
857 IMB_rect_from_float(scope_image);
858 }
859
863 GPUTexture *texture = GPU_texture_create_2d(
864 "seq_display_buf", scope_image->x, scope_image->y, 1, format, usage, nullptr);
868
870
871 GPUVertFormat *imm_format = immVertexFormat();
873 uint texCoord = GPU_vertformat_attr_add(
874 imm_format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
876 immUniformColor3f(1.0f, 1.0f, 1.0f);
877
879
880 immAttr2f(texCoord, uv.xmin, uv.ymin);
881 immVertex2f(pos, preview.xmin, preview.ymin);
882
883 immAttr2f(texCoord, uv.xmin, uv.ymax);
884 immVertex2f(pos, preview.xmin, preview.ymax);
885
886 immAttr2f(texCoord, uv.xmax, uv.ymax);
887 immVertex2f(pos, preview.xmax, preview.ymax);
888
889 immAttr2f(texCoord, uv.xmax, uv.ymin);
890 immVertex2f(pos, preview.xmax, preview.ymin);
891
892 immEnd();
893
896
898 }
899
900 if (sseq->mainb == SEQ_DRAW_IMG_HISTOGRAM) {
901 draw_histogram(region, scopes->histogram, quads, preview);
902 }
904 use_blend = true;
905 draw_waveform_graticule(region, quads, preview);
906 }
907 if (sseq->mainb == SEQ_DRAW_IMG_VECTORSCOPE) {
908 use_blend = true;
909 draw_vectorscope_graticule(region, quads, preview);
910 }
911
912 quads.draw();
913
914 if (use_blend) {
916 }
917}
918
919static bool sequencer_calc_scopes(Scene *scene, SpaceSeq *sseq, ImBuf *ibuf, bool draw_backdrop)
920{
921 using namespace blender::ed::seq;
922
923 if (draw_backdrop || (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->zebra == 0)) {
924 return false; /* Not drawing any scopes. */
925 }
926
927 SeqScopes *scopes = &sseq->runtime->scopes;
928 if (scopes->reference_ibuf != ibuf) {
929 scopes->cleanup();
930 }
931
932 switch (sseq->mainb) {
934 if (!scopes->zebra_ibuf) {
935
936 if (ibuf->float_buffer.data) {
937 ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
939 display_ibuf, &scene->view_settings, &scene->display_settings);
940 scopes->zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->zebra);
941 IMB_freeImBuf(display_ibuf);
942 }
943 else {
944 scopes->zebra_ibuf = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
945 }
946 }
947 break;
949 if (!scopes->waveform_ibuf) {
951 }
952 break;
954 if (!scopes->vector_ibuf) {
956 }
957 break;
959 ImBuf *display_ibuf = IMB_dupImBuf(ibuf);
961 display_ibuf, &scene->view_settings, &scene->display_settings);
962 scopes->histogram.calc_from_ibuf(display_ibuf);
963 IMB_freeImBuf(display_ibuf);
964 } break;
966 if (!scopes->sep_waveform_ibuf) {
969 }
970 break;
971 default: /* Future files might have scopes we don't know about. */
972 return false;
973 }
974 scopes->reference_ibuf = ibuf;
975 return true;
976}
977
979{
980 Sequence *last_seq = SEQ_select_active_get(scene);
981 if (last_seq == nullptr) {
982 return false;
983 }
984
985 return (G.moving & G_TRANSFORM_SEQ) && (last_seq->flag & SELECT) &&
986 ((last_seq->flag & SEQ_LEFTSEL) || (last_seq->flag & SEQ_RIGHTSEL)) &&
988}
989
991{
992 Sequence *last_seq = SEQ_select_active_get(scene);
993 /* #sequencer_draw_get_transform_preview must already have been called. */
994 BLI_assert(last_seq != nullptr);
995 int preview_frame;
996
997 if (last_seq->flag & SEQ_RIGHTSEL) {
998 preview_frame = SEQ_time_right_handle_frame_get(scene, last_seq) - 1;
999 }
1000 else {
1001 preview_frame = SEQ_time_left_handle_frame_get(scene, last_seq);
1002 }
1003
1004 return preview_frame;
1005}
1006
1007static void seq_draw_image_origin_and_outline(const bContext *C, Sequence *seq, bool is_active_seq)
1008{
1009 SpaceSeq *sseq = CTX_wm_space_seq(C);
1010 const ARegion *region = CTX_wm_region(C);
1012 return;
1013 }
1014 if ((seq->flag & SELECT) == 0) {
1015 return;
1016 }
1018 return;
1019 }
1020 if ((sseq->flag & SEQ_SHOW_OVERLAY) == 0 ||
1022 {
1023 return;
1024 }
1025 if (ELEM(sseq->mainb,
1030 {
1031 return;
1032 }
1033
1034 float origin[2];
1036
1037 /* Origin. */
1041 immUniform1f("outlineWidth", 1.5f);
1042 immUniformColor3f(1.0f, 1.0f, 1.0f);
1043 immUniform4f("outlineColor", 0.0f, 0.0f, 0.0f, 1.0f);
1044 immUniform1f("size", 15.0f * U.pixelsize);
1046 immVertex2f(pos, origin[0], origin[1]);
1047 immEnd();
1049
1050 /* Outline. */
1051 float seq_image_quad[4][2];
1053
1054 GPU_line_smooth(true);
1056 GPU_line_width(2);
1058
1059 float col[3];
1060 if (is_active_seq) {
1062 }
1063 else {
1065 }
1067 immUniform1f("lineWidth", U.pixelsize);
1069 immVertex2f(pos, seq_image_quad[0][0], seq_image_quad[0][1]);
1070 immVertex2f(pos, seq_image_quad[1][0], seq_image_quad[1][1]);
1071 immVertex2f(pos, seq_image_quad[2][0], seq_image_quad[2][1]);
1072 immVertex2f(pos, seq_image_quad[3][0], seq_image_quad[3][1]);
1073 immEnd();
1075 GPU_line_width(1);
1077 GPU_line_smooth(false);
1078}
1079
1081 Scene *scene,
1082 ARegion *region,
1083 SpaceSeq *sseq,
1084 int timeline_frame,
1085 int offset,
1086 bool draw_overlay,
1087 bool draw_backdrop)
1088{
1089 View2D *v2d = &region->v2d;
1090 ImBuf *ibuf = nullptr;
1091 float viewrect[2];
1092 const bool show_imbuf = ED_space_sequencer_check_show_imbuf(sseq);
1093 const bool draw_gpencil = ((sseq->preview_overlay.flag & SEQ_PREVIEW_SHOW_GPENCIL) && sseq->gpd);
1094 const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME};
1095
1097 if (G.is_rendering) {
1098 return;
1099 }
1100
1101 int preview_frame = timeline_frame;
1102 if (sequencer_draw_get_transform_preview(sseq, scene)) {
1103 preview_frame = sequencer_draw_get_transform_preview_frame(scene);
1104 }
1105
1106 /* Get image. */
1107 ibuf = sequencer_ibuf_get(C, preview_frame, offset, names[sseq->multiview_eye]);
1108
1109 /* Setup off-screen buffers. */
1110 GPUViewport *viewport = WM_draw_region_get_viewport(region);
1111 GPUFrameBuffer *framebuffer_overlay = GPU_viewport_framebuffer_overlay_get(viewport);
1112 GPU_framebuffer_bind_no_srgb(framebuffer_overlay);
1114
1115 if (sseq->render_size == SEQ_RENDER_SIZE_NONE) {
1117 return;
1118 }
1119
1120 /* Setup view. */
1121 sequencer_display_size(scene, viewrect);
1122 UI_view2d_totRect_set(v2d, roundf(viewrect[0]), roundf(viewrect[1]));
1125
1126 /* Draw background. */
1127 if (!draw_backdrop &&
1128 (!draw_overlay || (sseq->overlay_frame_type == SEQ_OVERLAY_FRAME_TYPE_REFERENCE)))
1129 {
1131
1132 if (sseq->flag & SEQ_USE_ALPHA) {
1133 imm_draw_box_checker_2d(v2d->tot.xmin, v2d->tot.ymin, v2d->tot.xmax, v2d->tot.ymax);
1134 }
1135 }
1136
1137 if (ibuf) {
1138 bool has_scope = sequencer_calc_scopes(scene, sseq, ibuf, draw_backdrop);
1139 if (has_scope) {
1140 /* Draw scope. */
1141 sequencer_draw_scopes(scene, region, sseq);
1142 }
1143 else {
1144 /* Draw image. */
1145 sequencer_draw_display_buffer(C, scene, region, sseq, ibuf, draw_overlay, draw_backdrop);
1146 }
1147
1148 /* Draw metadata. */
1150 ED_region_image_metadata_draw(0.0, 0.0, ibuf, &v2d->tot, 1.0, 1.0);
1151 }
1152 }
1153
1154 if (show_imbuf && (sseq->flag & SEQ_SHOW_OVERLAY)) {
1155 sequencer_draw_borders_overlay(sseq, v2d, scene);
1156 }
1157
1158 if (!draw_backdrop && scene->ed != nullptr) {
1159 Editing *ed = SEQ_editing_get(scene);
1162 scene, channels, ed->seqbasep, timeline_frame, 0);
1163 Sequence *active_seq = SEQ_select_active_get(scene);
1164 for (Sequence *seq : strips) {
1165 seq_draw_image_origin_and_outline(C, seq, seq == active_seq);
1166 }
1167 }
1168
1169 if (draw_gpencil && show_imbuf && (sseq->flag & SEQ_SHOW_OVERLAY)) {
1171 }
1172
1173#if 0
1174 sequencer_draw_maskedit(C, scene, region, sseq);
1175#endif
1176
1177 /* Draw registered callbacks. */
1178 GPU_framebuffer_bind(framebuffer_overlay);
1180 GPU_framebuffer_bind_no_srgb(framebuffer_overlay);
1181
1182 if (ibuf) {
1183 IMB_freeImBuf(ibuf);
1184 }
1185
1187 seq_prefetch_wm_notify(C, scene);
1188}
int ED_draw_imbuf_method(const ImBuf *ibuf)
Definition glutil.cc:609
Depsgraph * CTX_data_expect_evaluated_depsgraph(const bContext *C)
bScreen * CTX_wm_screen(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
SpaceSeq * CTX_wm_space_seq(const bContext *C)
Main * CTX_data_main(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
@ G_TRANSFORM_SEQ
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
Definition scene.cc:2877
int BKE_scene_multiview_view_id_get(const RenderData *rd, const char *viewname)
Definition scene.cc:3070
void BLF_width_and_height(int fontid, const char *str, size_t str_len, float *r_width, float *r_height) ATTR_NONNULL()
Definition blf.cc:778
int BLF_default()
#define BLI_assert(a)
Definition BLI_assert.h:50
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:57
MINLINE float ratiof(float min, float max, float pos)
#define BLI_YUV_ITU_BT709
void rgb_to_yuv(float r, float g, float b, float *r_y, float *r_u, float *r_v, int colorspace)
Definition math_color.cc:67
void yuv_to_rgb(float y, float u, float v, float *r_r, float *r_g, float *r_b, int colorspace)
Definition math_color.cc:91
void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
#define DEG2RADF(_deg)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.h:193
void BLI_rctf_resize_y(struct rctf *rect, float y)
Definition rct.c:645
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
Definition BLI_rect.h:184
BLI_INLINE float BLI_rctf_cent_x(const struct rctf *rct)
Definition BLI_rect.h:180
void BLI_rctf_resize_x(struct rctf *rect, float x)
Definition rct.c:639
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
Definition rct.c:408
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:189
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition BLI_rect.h:197
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition BLI_rect.h:201
#define SNPRINTF(dst, format,...)
Definition BLI_string.h:597
#define SNPRINTF_RLEN(dst, format,...)
Definition BLI_string.h:598
unsigned char uchar
unsigned int uint
#define ELEM(...)
@ OB_RENDER
#define STEREO_LEFT_NAME
#define STEREO_RIGHT_NAME
@ STEREO_RIGHT_ID
@ RGN_TYPE_PREVIEW
@ SEQ_RIGHTSEL
@ SEQ_LEFTSEL
@ SEQ_RENDER_SIZE_SCENE
@ SEQ_RENDER_SIZE_NONE
@ SEQ_PREVIEW_SHOW_METADATA
@ SEQ_PREVIEW_SHOW_GPENCIL
@ SEQ_PREVIEW_SHOW_SAFE_MARGINS
@ SEQ_PREVIEW_SHOW_OUTLINE_SELECTED
@ SEQ_PREVIEW_SHOW_SAFE_CENTER
@ SEQ_DRAW_TRANSFORM_PREVIEW
@ SEQ_OVERLAY_FRAME_TYPE_RECT
@ SEQ_OVERLAY_FRAME_TYPE_REFERENCE
@ SEQ_DRAW_IMG_VECTORSCOPE
@ SEQ_DRAW_IMG_RGBPARADE
@ SEQ_DRAW_IMG_HISTOGRAM
@ SEQ_DRAW_IMG_IMBUF
@ SEQ_DRAW_IMG_WAVEFORM
@ SEQ_USE_ALPHA
@ SEQ_USE_PROXIES
@ SEQ_SHOW_OVERLAY
@ IMAGE_DRAW_METHOD_GLSL
#define UI_SCALE_FAC
void ED_mask_draw_region(Depsgraph *depsgraph, Mask *mask, ARegion *region, char draw_flag, char draw_type, eMaskOverlayMode overlay_mode, float blend_factor, int width_i, int height_i, float aspx, float aspy, bool do_scale_applied, bool do_draw_cb, float stabmat[4][4], const bContext *C)
Definition mask_draw.cc:640
bScreen * ED_screen_animation_no_scrub(const wmWindowManager *wm)
bool ED_space_sequencer_check_show_imbuf(SpaceSeq *sseq)
eSeqHandle
void ED_region_draw_cb_draw(const bContext *C, ARegion *region, int type)
#define REGION_DRAW_POST_VIEW
void ED_region_image_metadata_draw(int x, int y, ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy)
Definition ed_draw.cc:876
static AppView * view
GPUFrameBuffer * GPU_framebuffer_active_get()
void GPU_framebuffer_restore()
void GPU_framebuffer_bind_no_srgb(GPUFrameBuffer *framebuffer)
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
void immUniformColor4ubv(const unsigned char rgba[4])
void immUniform4f(const char *name, float x, float y, float z, float w)
void immEnd()
void immUnbindProgram()
void immUniform2f(const char *name, float x, float y)
void immVertex2f(uint attr_id, float x, float y)
void immUniformThemeColor(int color_id)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immUniform1i(const char *name, int x)
void immUniform1f(const char *name, float x)
GPUVertFormat * immVertexFormat()
void immUniformThemeColorBlend(int color_id1, int color_id2, float fac)
void immUniformColor3f(float r, float g, float b)
void immAttr2f(uint attr_id, float x, float y)
void immBegin(GPUPrimType, uint vertex_len)
void immUniformColor3fv(const float rgb[3])
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
void imm_draw_box_checker_2d(float x1, float y1, float x2, float y2)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
void GPU_matrix_identity_projection_set()
void GPU_matrix_identity_set()
void GPU_matrix_push()
void GPU_matrix_push_projection()
void GPU_matrix_pop_projection()
void GPU_matrix_pop()
@ GPU_PRIM_TRI_FAN
@ GPU_PRIM_LINE_LOOP
@ GPU_PRIM_POINTS
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA
@ GPU_SHADER_3D_IMAGE_COLOR
@ GPU_BLEND_NONE
Definition GPU_state.hh:85
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:87
@ GPU_BLEND_ADDITIVE
Definition GPU_state.hh:89
void GPU_blend(eGPUBlend blend)
Definition gpu_state.cc:42
void GPU_line_width(float width)
Definition gpu_state.cc:161
void GPU_line_smooth(bool enable)
Definition gpu_state.cc:78
@ GPU_DEPTH_NONE
Definition GPU_state.hh:108
void GPU_depth_test(eGPUDepthTest test)
Definition gpu_state.cc:68
void GPU_viewport_size_get_f(float coords[4])
Definition gpu_state.cc:262
void GPU_texture_bind(GPUTexture *texture, int unit)
GPUTexture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, eGPUTextureFormat format, eGPUTextureUsage usage, const float *data)
void GPU_texture_free(GPUTexture *texture)
void GPU_texture_unbind(GPUTexture *texture)
eGPUDataFormat
@ GPU_DATA_UBYTE
@ GPU_DATA_FLOAT
void GPU_texture_extend_mode(GPUTexture *texture, GPUSamplerExtendMode extend_mode)
eGPUTextureUsage
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_ATTACHMENT
@ GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER
void GPU_texture_filter_mode(GPUTexture *texture, bool use_filter)
eGPUTextureFormat
@ GPU_RGB16F
void GPU_texture_update(GPUTexture *texture, eGPUDataFormat data_format, const void *data)
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
void GPU_viewport_bind(GPUViewport *viewport, int view, const rcti *rect)
GPUFrameBuffer * GPU_viewport_framebuffer_overlay_get(GPUViewport *viewport)
void GPU_viewport_unbind(GPUViewport *viewport)
unsigned char * IMB_display_buffer_acquire_ctx(const bContext *C, ImBuf *ibuf, void **cache_handle)
void IMB_colormanagement_imbuf_make_display_space(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
bool IMB_colormanagement_setup_glsl_draw_ctx(const bContext *C, float dither, bool predivide)
void IMB_display_buffer_release(void *cache_handle)
void IMB_colormanagement_finish_glsl_draw()
bool IMB_colormanagement_setup_glsl_draw_from_space_ctx(const bContext *C, ColorSpace *from_colorspace, float dither, bool predivide)
void IMB_rectfill_alpha(ImBuf *ibuf, float value)
Definition rectop.cc:1259
ImBuf * IMB_dupImBuf(const ImBuf *ibuf1)
void IMB_rect_from_float(ImBuf *ibuf)
Definition divers.cc:694
Contains defines and structs used throughout the imbuf module.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
#define C
Definition RandGen.cpp:29
void UI_draw_safe_areas(uint pos, const rctf *rect, const float title_aspect[2], const float action_aspect[2])
void UI_GetThemeColor3fv(int colorid, float col[3])
@ TH_SEQ_SELECTED
@ TH_BACK
@ TH_SEQ_PREVIEW
@ TH_VIEW_OVERLAY
@ TH_SEQ_ACTIVE
void UI_ThemeClearColor(int colorid)
void UI_view2d_curRect_validate(View2D *v2d)
Definition view2d.cc:824
void UI_view2d_scale_get_inverse(const View2D *v2d, float *r_x, float *r_y)
Definition view2d.cc:1924
char char char char void UI_view2d_text_cache_add(View2D *v2d, float x, float y, const char *str, size_t str_len, const unsigned char col[4])
Definition view2d.cc:2077
void UI_view2d_view_restore(const bContext *C)
Definition view2d.cc:1158
void UI_view2d_text_cache_draw(ARegion *region)
Definition view2d.cc:2137
void UI_view2d_totRect_set(View2D *v2d, int width, int height)
Definition view2d.cc:1032
void UI_view2d_view_ortho(const View2D *v2d)
Definition view2d.cc:1091
@ WM_JOB_TYPE_COMPOSITE
Definition WM_api.hh:1577
@ WM_JOB_TYPE_RENDER_PREVIEW
Definition WM_api.hh:1579
#define ND_SEQUENCER
Definition WM_types.hh:404
#define NC_SCENE
Definition WM_types.hh:345
void ED_annotation_draw_2dimage(const bContext *C)
void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d)
#define U
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
ListBase * SEQ_channels_displayed_get(Editing *ed)
Definition channels.cc:23
void add_line(float x1, float y1, float x2, float y2, const uchar color[4])
void add_wire_quad(float x1, float y1, float x2, float y2, const uchar color[4])
void add_quad(float x1, float y1, float x2, float y2, const uchar color[4])
local_group_size(16, 16) .push_constant(Type texture
#define SELECT
VecBase< float, 2 > float2
#define sinf(x)
#define cosf(x)
#define fabsf(x)
static void draw_backdrop(const int fontid, const rctf *main_line_rect, const uint8_t color_bg[4], const short region_y_size, const float base_tick_height, const std::string &property_label)
Definition ed_draw.cc:227
draw_view in_light_buf[] float
RAYTRACE_GROUP_SIZE additional_info("eevee_shared", "eevee_gbuffer_data", "eevee_global_ubo", "eevee_sampling_data", "eevee_utility_texture", "eevee_hiz_data", "draw_view") .specialization_constant(Type RAYTRACE_GROUP_SIZE in_sh_0_tx in_sh_2_tx screen_normal_tx GPU_RGBA8
uint col
void IMB_freeImBuf(ImBuf *)
BLI_INLINE float fb(float length, float L)
VectorSet< Sequence * > SEQ_query_rendered_strips(const Scene *scene, ListBase *channels, ListBase *seqbase, const int timeline_frame, const int displayed_channel)
Definition iterator.cc:184
format
ccl_device_inline float4 mask(const int4 mask, const float4 a)
#define G(x, y, z)
ImBuf * make_zebra_view_from_ibuf(const ImBuf *ibuf, float perc)
ImBuf * make_waveform_view_from_ibuf(const ImBuf *ibuf)
ImBuf * make_vectorscope_view_from_ibuf(const ImBuf *ibuf)
ImBuf * make_sep_waveform_view_from_ibuf(const ImBuf *ibuf)
VecBase< float, 2 > float2
VecBase< float, 3 > float3
bool SEQ_prefetch_need_redraw(const bContext *C, Scene *scene)
Definition prefetch.cc:583
double SEQ_rendersize_to_scale_factor(int render_size)
Definition proxy.cc:82
ImBuf * SEQ_render_give_ibuf_direct(const SeqRenderData *context, float timeline_frame, Sequence *seq)
Definition render.cc:2144
void SEQ_render_new_render_data(Main *bmain, Depsgraph *depsgraph, Scene *scene, int rectx, int recty, int preview_render_size, int for_render, SeqRenderData *r_context)
Definition render.cc:220
ImBuf * SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, int chanshown)
Definition render.cc:2078
Mask * SEQ_active_mask_get(Scene *scene)
Editing * SEQ_editing_get(const Scene *scene)
Definition sequencer.cc:262
bool sequencer_view_preview_only_poll(const bContext *C)
Sequence * find_nearest_seq(const Scene *scene, const View2D *v2d, const int mval[2], eSeqHandle *r_hand)
static void seq_prefetch_wm_notify(const bContext *C, Scene *scene)
static void sequencer_display_size(Scene *scene, float r_viewrect[2])
static void sequencer_preview_get_rect(rctf *preview, Scene *scene, ARegion *region, SpaceSeq *sseq, bool draw_overlay, bool draw_backdrop)
static void sequencer_draw_scopes(Scene *scene, ARegion *region, SpaceSeq *sseq)
void sequencer_draw_preview(const bContext *C, Scene *scene, ARegion *region, SpaceSeq *sseq, int timeline_frame, int offset, bool draw_overlay, bool draw_backdrop)
static void sequencer_preview_clear()
bool sequencer_draw_get_transform_preview(SpaceSeq *sseq, Scene *scene)
void sequencer_special_update_set(Sequence *seq)
Sequence * ED_sequencer_special_preview_get()
ImBuf * sequencer_ibuf_get(const bContext *C, int timeline_frame, int frame_ofs, const char *viewname)
static void draw_waveform_graticule(ARegion *region, SeqQuadsBatch &quads, const rctf &area)
static void sequencer_draw_gpencil_overlay(const bContext *C)
static void seq_draw_image_origin_and_outline(const bContext *C, Sequence *seq, bool is_active_seq)
static Sequence * special_seq_update
static void sequencer_draw_display_buffer(const bContext *C, Scene *scene, ARegion *region, SpaceSeq *sseq, ImBuf *ibuf, bool draw_overlay, bool draw_backdrop)
static void sequencer_stop_running_jobs(const bContext *C, Scene *scene)
static blender::float2 rgb_to_uv(const blender::float3 &rgb)
void ED_sequencer_special_preview_clear()
static void draw_vectorscope_graticule(ARegion *region, SeqQuadsBatch &quads, const rctf &area)
static ImBuf * sequencer_make_scope(Scene *scene, ImBuf *ibuf, ImBuf *(*make_scope_fn)(const ImBuf *ibuf))
static void sequencer_draw_borders_overlay(const SpaceSeq *sseq, const View2D *v2d, const Scene *scene)
static void * sequencer_OCIO_transform_ibuf(const bContext *C, ImBuf *ibuf, bool *r_glsl_used, eGPUTextureFormat *r_format, eGPUDataFormat *r_data, void **r_buffer_cache_handle)
static bool sequencer_calc_scopes(Scene *scene, SpaceSeq *sseq, ImBuf *ibuf, bool draw_backdrop)
static void draw_histogram(ARegion *region, const blender::ed::seq::ScopeHistogram &hist, SeqQuadsBatch &quads, const rctf &area)
void ED_sequencer_special_preview_set(bContext *C, const int mval[2])
int sequencer_draw_get_transform_preview_frame(Scene *scene)
Sequence * SEQ_select_active_get(const Scene *scene)
int SEQ_time_left_handle_frame_get(const Scene *, const Sequence *seq)
int SEQ_time_right_handle_frame_get(const Scene *scene, const Sequence *seq)
void SEQ_image_transform_origin_offset_pixelspace_get(const Scene *scene, const Sequence *seq, float r_origin[2])
void SEQ_image_transform_final_quad_get(const Scene *scene, const Sequence *seq, float r_quad[4][2])
rctf overlay_frame_rect
ColorSpace * colorspace
ColorSpace * colorspace
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
ColorManagedViewSettings view_settings
struct Editing * ed
struct RenderData r
struct DisplaySafeAreas safe_areas
ColorManagedDisplaySettings display_settings
char overlay_frame_type
struct bGPdata * gpd
short render_size
SpaceSeq_Runtime * runtime
struct SequencerPreviewOverlay preview_overlay
struct wmTimer * animtimer
void calc_from_ibuf(const ImBuf *ibuf)
static constexpr float FLOAT_VAL_MAX
static constexpr float FLOAT_VAL_MIN
float x
float y
float xmax
float xmin
float ymax
float ymin
GPUViewport * WM_draw_region_get_viewport(ARegion *region)
Definition wm_draw.cc:905
GPUViewport * WM_draw_region_get_bound_viewport(ARegion *region)
Definition wm_draw.cc:915
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_jobs_kill_type(wmWindowManager *wm, const void *owner, int job_type)
Definition wm_jobs.cc:597