Merge branch 'blender-v5.0-release'
This commit is contained in:
@@ -84,27 +84,55 @@ static void draw_current_frame(const Scene *scene,
|
||||
bool display_stalk = true)
|
||||
{
|
||||
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
|
||||
int frame_x = UI_view2d_view_to_region_x(v2d, current_frame);
|
||||
|
||||
const int frame_x = UI_view2d_view_to_region_x(v2d, current_frame);
|
||||
const float subframe_x = UI_view2d_view_to_region_x(v2d, BKE_scene_ctime_get(scene));
|
||||
char frame_str[64];
|
||||
get_current_time_str(scene, display_seconds, current_frame, frame_str, sizeof(frame_str));
|
||||
|
||||
const float box_min_width = 24.0f * UI_SCALE_FAC;
|
||||
const float text_padding = 4.0f * UI_SCALE_FAC;
|
||||
const float text_width = UI_fontstyle_string_width(fstyle, frame_str);
|
||||
const float text_padding = 4.0f * UI_SCALE_FAC;
|
||||
const float box_min_width = 24.0f * UI_SCALE_FAC;
|
||||
const float box_width = std::max(text_width + (2.0f * text_padding), box_min_width);
|
||||
const float box_margin = 2.0f * UI_SCALE_FAC;
|
||||
const float shadow_width = UI_SCALE_FAC;
|
||||
const float tri_top = floor(scrub_region_rect->ymin + box_margin);
|
||||
const float tri_half_width = 6.0f * UI_SCALE_FAC;
|
||||
const float tri_height = 6.0f * UI_SCALE_FAC;
|
||||
rctf rect{};
|
||||
uint pos;
|
||||
|
||||
float fg_color[4];
|
||||
UI_GetThemeColor4fv(TH_CFRAME, fg_color);
|
||||
float bg_color[4];
|
||||
UI_GetThemeColorShade4fv(TH_BACK, -20, bg_color);
|
||||
|
||||
if (display_stalk) {
|
||||
/* Shadow for triangle below frame box. */
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
pos = GPU_vertformat_attr_add(format, "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
GPU_polygon_smooth(true);
|
||||
immUniformColor4fv(bg_color);
|
||||
immBegin(GPU_PRIM_TRIS, 3);
|
||||
const float diag_offset = 0.4f * UI_SCALE_FAC;
|
||||
immVertex2f(pos, floor(frame_x - tri_half_width - shadow_width - diag_offset), tri_top);
|
||||
immVertex2f(pos, floor(frame_x + tri_half_width + shadow_width + 1.0f + diag_offset), tri_top);
|
||||
immVertex2f(pos, frame_x + 0.5f, tri_top - tri_height - diag_offset - shadow_width);
|
||||
GPU_polygon_smooth(false);
|
||||
immEnd();
|
||||
immUnbindProgram();
|
||||
|
||||
/* Vertical line. */
|
||||
rect.xmin = floor(subframe_x - U.pixelsize - shadow_width);
|
||||
rect.xmax = floor(subframe_x + U.pixelsize + 1.0f + shadow_width);
|
||||
rect.ymin = 0.0f;
|
||||
rect.ymax = ceil(scrub_region_rect->ymax - box_margin + shadow_width);
|
||||
UI_draw_roundbox_4fv_ex(&rect, fg_color, nullptr, 1.0f, bg_color, shadow_width, 0.0f);
|
||||
}
|
||||
|
||||
/* Box. */
|
||||
UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
||||
const float box_corner_radius = 4.0f * UI_SCALE_FAC;
|
||||
rctf rect{};
|
||||
rect.xmin = frame_x - (box_width / 2.0f);
|
||||
rect.xmax = frame_x + (box_width / 2.0f) + 1.0f;
|
||||
rect.ymin = floor(scrub_region_rect->ymin + (box_margin - shadow_width));
|
||||
@@ -119,52 +147,11 @@ static void draw_current_frame(const Scene *scene,
|
||||
UI_fontstyle_draw_simple(fstyle, frame_x - (text_width / 2.0f), y, frame_str, text_color);
|
||||
|
||||
if (display_stalk) {
|
||||
/* Draw vertical line from the bottom of the current frame box to the bottom of the screen. */
|
||||
const float subframe_x = UI_view2d_view_to_region_x(v2d, BKE_scene_ctime_get(scene));
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
/* Triangular base under frame number. */
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
/* There are two usages of "1.0f" below that are not scaled. This is
|
||||
* used to force an odd width (but still pixel-aligned) to better
|
||||
* line up with the odd widths of the keyframe icons. #98089. */
|
||||
|
||||
const float tri_top = floor(scrub_region_rect->ymin + box_margin);
|
||||
const float tri_half_width = 6.0f * UI_SCALE_FAC;
|
||||
const float tri_height = 6.0f * UI_SCALE_FAC;
|
||||
|
||||
/* Shadow. */
|
||||
GPU_polygon_smooth(true);
|
||||
immUniformColor4fv(bg_color);
|
||||
immBegin(GPU_PRIM_TRI_STRIP, 6);
|
||||
immVertex2f(pos, floor(subframe_x + U.pixelsize + 1.0f + shadow_width), 0.0f);
|
||||
immVertex2f(pos, floor(subframe_x - U.pixelsize - shadow_width), 0.0f);
|
||||
|
||||
float diag_offset = 0.4f * UI_SCALE_FAC;
|
||||
immVertex2f(pos,
|
||||
floor(subframe_x + U.pixelsize + 1.0f + shadow_width),
|
||||
tri_top - tri_height + shadow_width - diag_offset);
|
||||
immVertex2f(pos,
|
||||
floor(subframe_x - U.pixelsize - shadow_width),
|
||||
tri_top - tri_height + shadow_width - diag_offset);
|
||||
immVertex2f(pos, floor(frame_x + tri_half_width + shadow_width + 1.0f + diag_offset), tri_top);
|
||||
immVertex2f(pos, floor(frame_x - tri_half_width - shadow_width - diag_offset), tri_top);
|
||||
immEnd();
|
||||
GPU_polygon_smooth(false);
|
||||
|
||||
/* Line. */
|
||||
immUniformColor4fv(fg_color);
|
||||
immRectf(pos,
|
||||
floor(subframe_x - U.pixelsize),
|
||||
scrub_region_rect->ymin,
|
||||
floor(subframe_x + U.pixelsize + 1.0f),
|
||||
0.0f);
|
||||
|
||||
/* Triangular base. */
|
||||
GPU_polygon_smooth(true);
|
||||
immUniformColor4fv(fg_color);
|
||||
immBegin(GPU_PRIM_TRIS, 3);
|
||||
immUniformColor4fv(fg_color);
|
||||
immVertex2f(pos, frame_x - tri_half_width, tri_top);
|
||||
immVertex2f(pos, frame_x + tri_half_width + 1, tri_top);
|
||||
immVertex2f(pos, frame_x + 0.5f, tri_top - tri_height);
|
||||
|
||||
Reference in New Issue
Block a user