Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/animation/time_scrub_ui.c
| Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | static void draw_current_frame(const Scene *scene, | |||||||||||
| const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; | const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; | |||||||||||
| int frame_x = UI_view2d_view_to_region_x(v2d, current_frame); | int frame_x = UI_view2d_view_to_region_x(v2d, current_frame); | |||||||||||
| char frame_str[64]; | char frame_str[64]; | |||||||||||
| get_current_time_str(scene, display_seconds, current_frame, sizeof(frame_str), frame_str); | get_current_time_str(scene, display_seconds, current_frame, sizeof(frame_str), frame_str); | |||||||||||
| float text_width = UI_fontstyle_string_width(fstyle, frame_str); | float text_width = UI_fontstyle_string_width(fstyle, frame_str); | |||||||||||
| float box_width = MAX2(text_width + 8 * UI_DPI_FAC, 24 * UI_DPI_FAC); | float box_width = MAX2(text_width + 8 * UI_DPI_FAC, 24 * UI_DPI_FAC); | |||||||||||
| float box_padding = 3 * UI_DPI_FAC; | float box_padding = 3 * UI_DPI_FAC; | |||||||||||
| const int line_outline = 1 * UI_DPI_FAC; | ||||||||||||
campbellbarton: Values below 1 are set to zero, suggest to use a rounding so larger values aren't always… | ||||||||||||
pablovazquezAuthorUnsubmitted Done Inline ActionsOh didn't think of that, good point. Thanks! pablovazquez: Oh didn't think of that, good point. Thanks! | ||||||||||||
| float bg_color[4]; | float bg_color[4]; | |||||||||||
| UI_GetThemeColorShade4fv(TH_CFRAME, -5, bg_color); | UI_GetThemeColorShade4fv(TH_CFRAME, -5, bg_color); | |||||||||||
| /* Draw vertical line from the bottom of the current frame box to the bottom of the screen. */ | /* 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)); | const float subframe_x = UI_view2d_view_to_region_x(v2d, BKE_scene_ctime_get(scene)); | |||||||||||
| GPUVertFormat *format = immVertexFormat(); | GPUVertFormat *format = immVertexFormat(); | |||||||||||
| uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | |||||||||||
| GPU_blend(GPU_BLEND_ALPHA); | ||||||||||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||||||||
| /* Outline. */ | ||||||||||||
| immUniformThemeColorShadeAlpha(TH_BACK, -25, -100); | ||||||||||||
| immRectf(pos, | ||||||||||||
| subframe_x - line_outline - U.pixelsize, | ||||||||||||
| scrub_region_rect->ymax - box_padding, | ||||||||||||
| subframe_x + line_outline + U.pixelsize, | ||||||||||||
campbellbartonUnsubmitted Done Inline Actions
This reads a little more clearly to me. campbellbarton: This reads a little more clearly to me. | ||||||||||||
pablovazquezAuthorUnsubmitted Done Inline ActionsIndeed it reads a lot better! pablovazquez: Indeed it reads a lot better! | ||||||||||||
| 0.0f); | ||||||||||||
| /* Line. */ | ||||||||||||
| immUniformThemeColor(TH_CFRAME); | immUniformThemeColor(TH_CFRAME); | |||||||||||
| immRectf(pos, | immRectf(pos, | |||||||||||
| subframe_x - U.pixelsize, | subframe_x - U.pixelsize, | |||||||||||
| scrub_region_rect->ymax - box_padding, | scrub_region_rect->ymax - box_padding, | |||||||||||
| subframe_x + U.pixelsize, | subframe_x + U.pixelsize, | |||||||||||
| 0.0f); | 0.0f); | |||||||||||
| immUnbindProgram(); | immUnbindProgram(); | |||||||||||
| GPU_blend(GPU_BLEND_NONE); | ||||||||||||
| UI_draw_roundbox_corner_set(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | |||||||||||
| float outline_color[4]; | float outline_color[4]; | |||||||||||
| UI_GetThemeColorShade4fv(TH_CFRAME, 5, outline_color); | UI_GetThemeColorShade4fv(TH_CFRAME, 5, outline_color); | |||||||||||
| UI_draw_roundbox_4fv_ex( | UI_draw_roundbox_4fv_ex( | |||||||||||
| &(const rctf){ | &(const rctf){ | |||||||||||
| ▲ Show 20 Lines • Show All 123 Lines • Show Last 20 Lines | ||||||||||||
Values below 1 are set to zero, suggest to use a rounding so larger values aren't always rounded down.