35#include "RNA_prototypes.hh"
69 const Scene *scene,
bool display_seconds,
const float frame,
char *r_str,
uint str_maxncpy)
71 if (display_seconds) {
73 const float seconds = (frame /
float(scene->frames_per_second())) / frame_len;
75 r_str, str_maxncpy, -1, seconds, scene->frames_per_second(),
U.timecode_style);
99 const rcti *scrub_region_rect,
100 const float current_frame,
101 const bool display_seconds,
102 const float region_x)
105 constexpr int max_frame_string_len = 64;
106 char frame_str[max_frame_string_len];
108 scene, display_seconds, current_frame, frame_str, max_frame_string_len);
116 const float box_width = std::max(dimensions.
text_width + (2.0f * text_padding), box_min_width);
132 dimensions.
box_rect.
xmin = region_x - (box_width / 2.0f);
133 dimensions.
box_rect.
xmax = region_x + (box_width / 2.0f) + 1.0f;
148 const float fg_color[4],
149 const float bg_color[4])
172 &dimensions.
stalk_rect, fg_color,
nullptr, 1.0f, bg_color, outline_width, 0.0f);
176 const char frame_str[64],
177 const rcti *scrub_region_rect,
179 const float fg_color[4],
180 const float bg_color[4])
199 fstyle, region_x - (dimensions.
text_width / 2.0f),
y, frame_str, text_color);
205 const float fg_color[4])
231 const rcti *scrub_region_rect,
232 const bool display_seconds,
233 const bool display_stalk)
238 scene, scrub_region_rect, frame, display_seconds, region_x);
249 constexpr int max_frame_string_len = 64;
250 char frame_str[max_frame_string_len];
252 draw_playhead_box(region_x, frame_str, scrub_region_rect, dimensions, fg_color, bg_color);
260 bool display_seconds,
262 const rcti *scrub_region_rect,
263 bool display_stalk =
true,
264 bool clamp_playhead =
false)
269 constexpr int max_frame_string_len = 64;
270 char frame_str[max_frame_string_len];
272 scene, display_seconds, current_frame, frame_str, max_frame_string_len);
275 scene, scrub_region_rect, current_frame, display_seconds, region_x);
277 if (clamp_playhead) {
278 const float bound_left = scrub_region_rect->
xmin + dimensions.
text_width / 2.0f;
279 const float bound_right = scrub_region_rect->
xmax - dimensions.
text_width / 2.0f;
281 if (bound_left > bound_right) {
284 region_x = bound_right;
287 region_x =
math::clamp(region_x, bound_left, bound_right);
291 scene, scrub_region_rect, current_frame, display_seconds, region_x);
299 float stalk_color[4];
308 draw_playhead_box(region_x, frame_str, scrub_region_rect, dimensions, fg_color, bg_color);
317 bool display_seconds,
325 rcti scrub_region_rect;
332 draw_playhead_ghost(ctime, scene, v2d, &scrub_region_rect, display_seconds, display_stalk);
336 scene, display_seconds, v2d, &scrub_region_rect, display_stalk, clamp_playhead);
342 bool display_seconds,
343 bool discrete_frames,
351 rcti scrub_region_rect;
356 rcti numbers_rect = scrub_region_rect;
372 rcti clamped_mask = scroller_mask;
419 rect.
xmin + padding_x,
427 block_align_begin(block);
429 layout.
prop(&ptr,
"use_filter_invert",
UI_ITEM_NONE,
"", ICON_ARROW_LEFTRIGHT);
430 block_align_end(block);
436 block_bounds_set_normal(block, 0);
438 block_draw(
C, block);
#define UI_TIME_SCRUB_MARGIN_Y
T clamp(const T &a, const T &min, const T &max)
void get_color_4ubv(int colorid, unsigned char col[4])
void get_color_4fv(int colorid, float col[4])
void get_color_shade_4fv(int colorid, int offset, float col[4])
void view2d_draw_scale_x(const ARegion *region, const View2D *v2d, const rcti *rect, const Scene *scene, bool display_seconds, bool show_fractions, int colorid, int base)
int fontstyle_string_width(const uiFontStyle *fs, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
const uiStyle * style_get_dpi()
void fontstyle_draw_simple(const uiFontStyle *fs, float x, float y, const char *str, const uchar col[4])
void draw_roundbox_4fv_ex(const rctf *rect, const float inner1[4], const float inner2[4], float shade_dir, const float outline[4], float outline_width, float rad)
int2 block_layout_resolve(Block *block)
Layout & block_layout(Block *block, LayoutDirection direction, LayoutType type, int x, int y, int size, int em, int padding, const uiStyle *style)
void block_layout_set_current(Block *block, Layout *layout)
float view2d_view_to_region_x(const View2D *v2d, float x)
static void draw_playhead_box(const float region_x, const char frame_str[64], const rcti *scrub_region_rect, const PlayheadDimensions &dimensions, const float fg_color[4], const float bg_color[4])
size_t size_t size_t BLI_snprintf_utf8(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
void ED_time_scrub_draw_current_frame(const ARegion *region, const Scene *scene, bool display_seconds, bool display_stalk, bool clamp_playhead)
void ED_time_scrub_draw(const ARegion *region, const Scene *scene, bool display_seconds, bool discrete_frames, const int base)
void wmOrtho2_region_pixelspace(const ARegion *region)
void GPU_polygon_smooth(bool enable)
static int get_centered_text_y(const rcti *rect)
GPUVertFormat * immVertexFormat()
bool ED_time_scrub_event_in_region(const ARegion *region, const wmEvent *event)
void immBegin(GPUPrimType, uint vertex_len)
@ TH_TIME_SCRUB_BACKGROUND
void immUniformColor4fv(const float rgba[4])
static PlayheadDimensions get_playhead_dimensions(const Scene *scene, const rcti *scrub_region_rect, const float current_frame, const bool display_seconds, const float region_x)
void ED_time_scrub_frame_str_get(const Scene *scene, bool display_seconds, const float frame, char *r_str, uint str_maxncpy)
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void immUniformThemeColor(int color_id)
void immVertex2f(uint attr_id, float x, float y)
static void draw_playhead_tip(const float region_x, const PlayheadDimensions &dimensions, const float fg_color[4])
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
float BKE_scene_frame_get(const Scene *scene)
@ GPU_SHADER_3D_UNIFORM_COLOR
bool ED_time_scrub_event_in_region_poll(const wmWindow *, const ScrArea *, const ARegion *region, const wmEvent *event)
rcti ED_time_scrub_clamp_scroller_mask(const rcti &scroller_mask)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
static void draw_current_frame(const Scene *scene, bool display_seconds, const View2D *v2d, const rcti *scrub_region_rect, bool display_stalk=true, bool clamp_playhead=false)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
size_t BLI_timecode_string_from_time(char *str, size_t maxncpy, int brevity_level, float time_seconds, double fps, short timecode_style) ATTR_NONNULL()
float BKE_scene_ctime_get(const Scene *scene)
void GPU_matrix_pop_projection()
bScreen * CTX_wm_screen(const bContext *C)
bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2])
void GPU_blend(GPUBlend blend)
static void draw_background(const rcti *rect)
void ED_time_scrub_channel_search_draw(const bContext *C, ARegion *region, bDopeSheet *dopesheet)
void GPU_matrix_push_projection()
void immRectf(uint pos, float x1, float y1, float x2, float y2)
void ED_time_scrub_region_rect_get(const ARegion *region, rcti *r_rect)
static void draw_playhead_stalk(const float region_x, const PlayheadDimensions &dimensions, const float fg_color[4], const float bg_color[4])
static void draw_playhead_ghost(const float frame, const Scene *scene, const View2D *v2d, const rcti *scrub_region_rect, const bool display_seconds, const bool display_stalk)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
void scale_y_set(float scale)