Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/animation/anim_draw.c
| Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const bool time) | ||||
| * but power = 1 is required for frames (to get integer frames) | * but power = 1 is required for frames (to get integer frames) | ||||
| */ | */ | ||||
| if (time) { | if (time) { | ||||
| BLI_timecode_string_from_time(&numstr[4], sizeof(numstr) - 4, 0, FRA2TIME(cfra), FPS, U.timecode_style); | BLI_timecode_string_from_time(&numstr[4], sizeof(numstr) - 4, 0, FRA2TIME(cfra), FPS, U.timecode_style); | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_timecode_string_from_time_simple(&numstr[4], sizeof(numstr) - 4, 1, cfra); | BLI_timecode_string_from_time_simple(&numstr[4], sizeof(numstr) - 4, 1, cfra); | ||||
| } | } | ||||
| slen = (short)UI_GetStringWidth(numstr) - 1; | slen = (short)UI_fontstyle_string_width(numstr) - 1; | ||||
| /* get starting coordinates for drawing */ | /* get starting coordinates for drawing */ | ||||
| x = cfra * xscale; | x = cfra * xscale; | ||||
| y = 0.9f * U.widget_unit; | y = 0.9f * U.widget_unit; | ||||
| /* draw green box around/behind text */ | /* draw green box around/behind text */ | ||||
| UI_ThemeColorShade(TH_CFRAME, 0); | UI_ThemeColorShade(TH_CFRAME, 0); | ||||
| glRectf(x, y, x + slen, y + 0.75f * U.widget_unit); | glRectf(x, y, x + slen, y + 0.75f * U.widget_unit); | ||||
| /* draw current frame number - black text */ | /* draw current frame number - black text */ | ||||
| UI_ThemeColor(TH_TEXT); | UI_ThemeColor(TH_TEXT); | ||||
| UI_DrawString(x - 0.25f * U.widget_unit, y + 0.15f * U.widget_unit, numstr); | UI_draw_string(x - 0.25f * U.widget_unit, y + 0.15f * U.widget_unit, numstr); | ||||
| /* restore view transform */ | /* restore view transform */ | ||||
| glScalef(xscale, 1.0, 1.0); | glScalef(xscale, 1.0, 1.0); | ||||
| } | } | ||||
| /* General call for drawing current frame indicator in animation editor */ | /* General call for drawing current frame indicator in animation editor */ | ||||
| void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag) | void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 236 Lines • Show Last 20 Lines | |||||