108 short is_break =
G.is_break;
115 render_size = scene->r.size / 100.0;
121 rectx = roundf(render_size * scene->r.xsch);
122 recty = roundf(render_size * scene->r.ysch);
128 context.is_playing = screen->animtimer !=
nullptr;
129 context.is_scrubbing = screen->scrubbing;
165 G.is_break = is_break;
178 display_ibuf, &scene->view_settings, &scene->display_settings);
180 scope = make_scope_fn(display_ibuf);
190 r_viewrect[0] =
float(scene->r.xsch);
191 r_viewrect[1] =
float(scene->r.ysch);
193 r_viewrect[0] *= scene->r.xasp / scene->r.yasp;
228 float viewport_size[4];
247 UI_draw_safe_areas(shdr_pos, &rect, scene->safe_areas.title, scene->safe_areas.action);
252 shdr_pos, &rect, scene->safe_areas.title_center, scene->safe_areas.action_center);
271 float aspx = 1.0f, aspy = 1.0f;
308 void **r_buffer_cache_handle)
310 void *display_buffer;
311 bool force_fallback =
false;
312 *r_glsl_used =
false;
314 force_fallback |= (ibuf->
dither != 0.0f);
321 if (force_fallback) {
322 *r_glsl_used =
false;
323 display_buffer =
nullptr;
337 BLI_assert_msg(0,
"Incompatible number of channels for float buffer in sequencer");
339 display_buffer =
nullptr;
357 display_buffer =
nullptr;
368 return display_buffer;
373 if (
G.is_rendering ==
false && (scene->r.seq_prev_type) ==
OB_RENDER) {
396 View2D *v2d = ®ion->v2d;
414 float image_aspect = viewrect[0] / viewrect[1];
416 if (aspect >= image_aspect) {
417 preview->
xmax = image_aspect / aspect;
421 preview->
ymax = aspect / image_aspect;
438 void *buffer_cache_handle =
nullptr;
448 bool glsl_used =
false;
455 C, ibuf, &glsl_used, &
format, &data, &buffer_cache_handle);
465 "seq_display_buf", ibuf->
x, ibuf->
y, 1,
format, usage,
nullptr);
483 canvas = scene->ed->overlay_frame_rect;
513 if (buffer_cache_handle) {
533 if (hist.
data.is_empty()) {
538 uchar col_grid[4] = {128, 128, 128, 128};
539 float grid_x_0 = area.xmin;
540 float grid_x_1 = area.xmax;
543 float ratio_0 =
ratiof(ScopeHistogram::FLOAT_VAL_MIN, ScopeHistogram::FLOAT_VAL_MAX, 0.0f);
544 float ratio_1 =
ratiof(ScopeHistogram::FLOAT_VAL_MIN, ScopeHistogram::FLOAT_VAL_MAX, 1.0f);
545 grid_x_0 = area.xmin + (area.xmax - area.xmin) * ratio_0;
546 grid_x_1 = area.xmin + (area.xmax - area.xmin) * ratio_1;
549 View2D *v2d = ®ion->v2d;
550 float text_scale_x, text_scale_y;
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);
562 float 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);
571 uchar col_border[4] = {64, 64, 64, 128};
572 quads.add_wire_quad(area.xmin, area.ymin, area.xmax, area.ymax, col_border);
577 for (
int ch = 0; ch < 3; ++ch) {
581 uchar col_line[4] = {32, 32, 32, 255};
582 uchar col_area[4] = {64, 64, 64, 128};
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;
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);
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;
619 for (
int i = 0; i < 3; i++) {
620 const float y = area.ymin + (area.ymax - area.ymin) * lines[i];
623 quads.add_line(x0, y, x1, y, col_grid);
627 uchar col_border[4] = {64, 64, 64, 128};
628 quads.add_wire_quad(x0, area.ymin, x1, area.ymax, col_border);
638 const float skin_rad =
DEG2RADF(123.0f);
644 const float radius = ((
w < h) ?
w : h) * 0.5f * (0.5f / 0.615f);
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);
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);
670 uchar4 col1(0, 0, 0, alpha_b);
671 uchar4 col2(0, 0, 0, alpha_b);
672 uchar4 col3(0, 0, 0, alpha_b);
676 constexpr float mul_background = 0.2f;
677 for (
int i = 0; i < num_circle_points; i += 2) {
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;
690 quads.add_quad(pt1.
x,
705 const float outer_radius = radius * 1.02f;
706 for (
int i = 0; i < num_circle_points; 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];
718 pt1a.
x, pt1a.
y, pt1b.
x, pt1b.
y, pt2a.
x, pt2a.
y, pt2b.
x, pt2b.
y, col1, col1, col2, col2);
725 const uchar4 col_grid(128, 128, 128, 128);
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);
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++) {
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);
744 const float3 primaries[6] = {
752 const char *names =
"RYGCBM";
755 char buf[2] = {
'M', 0};
756 float text_scale_x, text_scale_y;
758 float text_width, text_height;
760 text_width *= text_scale_x;
761 text_height *= text_scale_y;
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;
768 quads.add_wire_quad(
pos.x - delta,
pos.y - delta,
pos.x + delta,
pos.y + delta, col_target);
772 pos.x + delta * 1.2f + text_width / 4,
773 pos.y - text_height / 2,
780 const uchar4 col_tone(255, 102, 0, 128);
781 quads.add_line(center.x,
783 center.x +
cosf(skin_rad) * radius,
784 center.y +
sinf(skin_rad) * radius,
802 float vecscope_aspect = 1.0f;
806 vecscope_aspect = width / height;
807 if (vecscope_aspect >= 1.0f) {
828 uchar black[4] = {0, 0, 0, 255};
837 ImBuf *scope_image =
nullptr;
855 if (scope_image !=
nullptr) {
864 "seq_display_buf", scope_image->
x, scope_image->
y, 1,
format, usage,
nullptr);
932 switch (sseq->
mainb) {
939 display_ibuf, &scene->view_settings, &scene->display_settings);
940 scopes->
zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->
zebra);
961 display_ibuf, &scene->view_settings, &scene->display_settings);
968 scene, ibuf, make_sep_waveform_view_from_ibuf);
981 if (last_seq ==
nullptr) {
1004 return preview_frame;
1051 float seq_image_quad[4][2];
1060 if (is_active_seq) {
1089 View2D *v2d = ®ion->v2d;
1090 ImBuf *ibuf =
nullptr;
1097 if (
G.is_rendering) {
1101 int preview_frame = timeline_frame;
1162 scene, channels, ed->
seqbasep, timeline_frame, 0);
1174 sequencer_draw_maskedit(C, scene, region, sseq);
int ED_draw_imbuf_method(const ImBuf *ibuf)
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)
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
int BKE_scene_multiview_view_id_get(const RenderData *rd, const char *viewname)
void BLF_width_and_height(int fontid, const char *str, size_t str_len, float *r_width, float *r_height) ATTR_NONNULL()
#define BLI_assert_msg(a, msg)
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)
void yuv_to_rgb(float y, float u, float v, float *r_r, float *r_g, float *r_b, int colorspace)
void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
void BLI_rctf_resize_y(struct rctf *rect, float y)
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
BLI_INLINE float BLI_rctf_cent_x(const struct rctf *rct)
void BLI_rctf_resize_x(struct rctf *rect, float x)
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
#define SNPRINTF(dst, format,...)
#define SNPRINTF_RLEN(dst, format,...)
#define STEREO_RIGHT_NAME
@ 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
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)
bScreen * ED_screen_animation_no_scrub(const wmWindowManager *wm)
bool ED_space_sequencer_check_show_imbuf(SpaceSeq *sseq)
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)
GPUFrameBuffer * GPU_framebuffer_active_get()
void GPU_framebuffer_restore()
void GPU_framebuffer_bind_no_srgb(GPUFrameBuffer *framebuffer)
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
void GPU_matrix_identity_projection_set()
void GPU_matrix_identity_set()
void GPU_matrix_push_projection()
void GPU_matrix_pop_projection()
@ 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
void GPU_blend(eGPUBlend blend)
void GPU_line_width(float width)
void GPU_line_smooth(bool enable)
void GPU_depth_test(eGPUDepthTest test)
void GPU_viewport_size_get_f(float coords[4])
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)
void GPU_texture_extend_mode(GPUTexture *texture, GPUSamplerExtendMode extend_mode)
@ 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)
void GPU_texture_update(GPUTexture *texture, eGPUDataFormat data_format, const void *data)
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)
ImBuf * IMB_dupImBuf(const ImBuf *ibuf1)
void IMB_rect_from_float(ImBuf *ibuf)
Contains defines and structs used throughout the imbuf module.
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])
void UI_ThemeClearColor(int colorid)
void UI_view2d_curRect_validate(View2D *v2d)
void UI_view2d_scale_get_inverse(const View2D *v2d, float *r_x, float *r_y)
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])
void UI_view2d_view_restore(const bContext *C)
void UI_view2d_text_cache_draw(ARegion *region)
void UI_view2d_totRect_set(View2D *v2d, int width, int height)
void UI_view2d_view_ortho(const View2D *v2d)
@ WM_JOB_TYPE_RENDER_PREVIEW
void ED_annotation_draw_2dimage(const bContext *C)
void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d)
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
ListBase * SEQ_channels_displayed_get(Editing *ed)
const Depsgraph * depsgraph
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)
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
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)
VecBase< float, 2 > float2
bool SEQ_prefetch_need_redraw(const bContext *C, Scene *scene)
double SEQ_rendersize_to_scale_factor(int render_size)
ImBuf * SEQ_render_give_ibuf_direct(const SeqRenderData *context, float timeline_frame, Sequence *seq)
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)
ImBuf * SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, int chanshown)
Mask * SEQ_active_mask_get(Scene *scene)
Editing * SEQ_editing_get(const Scene *scene)
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)
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer
SpaceSeq_Runtime * runtime
struct SequencerPreviewOverlay preview_overlay
void calc_from_ibuf(const ImBuf *ibuf)
bool is_float_hist() const
ImBuf * sep_waveform_ibuf
GPUViewport * WM_draw_region_get_viewport(ARegion *region)
GPUViewport * WM_draw_region_get_bound_viewport(ARegion *region)
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)