Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/animation/anim_draw.c
| Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag) | ||||
| const float time = scene->r.cfra + scene->r.subframe; | const float time = scene->r.cfra + scene->r.subframe; | ||||
| const float x = (float)(time * scene->r.framelen); | const float x = (float)(time * scene->r.framelen); | ||||
| GPU_line_width((flag & DRAWCFRA_WIDE) ? 3.0 : 2.0); | GPU_line_width((flag & DRAWCFRA_WIDE) ? 3.0 : 2.0); | ||||
| 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); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| /* Draw a light green line to indicate current frame */ | /* Draw a light green line to indicate current frame */ | ||||
| immUniformThemeColor(TH_CFRAME); | immUniformThemeColor(TH_CFRAME); | ||||
| immBegin(GPU_PRIM_LINES, 2); | immBegin(GPU_PRIM_LINES, 2); | ||||
| immVertex2f(pos, x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */ | immVertex2f(pos, x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */ | ||||
| immVertex2f(pos, x, v2d->cur.ymax); | immVertex2f(pos, x, v2d->cur.ymax); | ||||
| immEnd(); | immEnd(); | ||||
| Show All 10 Lines | void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width) | ||||
| /* only draw this if preview range is set */ | /* only draw this if preview range is set */ | ||||
| if (PRVRANGEON) { | if (PRVRANGEON) { | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| 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); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColorShadeAlpha(TH_ANIM_PREVIEW_RANGE, -25, -30); | immUniformThemeColorShadeAlpha(TH_ANIM_PREVIEW_RANGE, -25, -30); | ||||
| /* XXX: Fix this hardcoded color (anim_active) */ | /* XXX: Fix this hardcoded color (anim_active) */ | ||||
| // immUniformColor4f(0.8f, 0.44f, 0.1f, 0.2f); | // immUniformColor4f(0.8f, 0.44f, 0.1f, 0.2f); | ||||
| /* only draw two separate 'curtains' if there's no overlap between them */ | /* only draw two separate 'curtains' if there's no overlap between them */ | ||||
| if (PSFRA < PEFRA + end_frame_width) { | if (PSFRA < PEFRA + end_frame_width) { | ||||
| immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax); | immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax); | ||||
| immRectf(pos, (float)(PEFRA + end_frame_width), v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); | immRectf(pos, (float)(PEFRA + end_frame_width), v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); | ||||
| Show All 14 Lines | |||||
| void ANIM_draw_framerange(Scene *scene, View2D *v2d) | void ANIM_draw_framerange(Scene *scene, View2D *v2d) | ||||
| { | { | ||||
| /* draw darkened area outside of active timeline frame range */ | /* draw darkened area outside of active timeline frame range */ | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| 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); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColorShadeAlpha(TH_BACK, -25, -100); | immUniformThemeColorShadeAlpha(TH_BACK, -25, -100); | ||||
| if (scene->r.sfra < scene->r.efra) { | if (scene->r.sfra < scene->r.efra) { | ||||
| immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)scene->r.sfra, v2d->cur.ymax); | immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)scene->r.sfra, v2d->cur.ymax); | ||||
| immRectf(pos, (float)scene->r.efra, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); | immRectf(pos, (float)scene->r.efra, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); | ||||
| } | } | ||||
| else { | else { | ||||
| immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); | immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); | ||||
| ▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | else { | ||||
| immRectf(pos, v2d->cur.xmin, ymin, v2d->cur.xmax, ymax); | immRectf(pos, v2d->cur.xmin, ymin, v2d->cur.xmax, ymax); | ||||
| } | } | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| GPU_blend(GPU_BLEND_NONE); | GPU_blend(GPU_BLEND_NONE); | ||||
| /* Thin lines where the actual frames are. */ | /* Thin lines where the actual frames are. */ | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| immUniformThemeColorShade(TH_BACK, -60); | immUniformThemeColorShade(TH_BACK, -60); | ||||
| GPU_line_width(1.0f); | GPU_line_width(1.0f); | ||||
| immBegin(GPU_PRIM_LINES, 4); | immBegin(GPU_PRIM_LINES, 4); | ||||
| immVertex2f(pos, sfra, ymin); | immVertex2f(pos, sfra, ymin); | ||||
| immVertex2f(pos, sfra, ymax); | immVertex2f(pos, sfra, ymax); | ||||
| ▲ Show 20 Lines • Show All 456 Lines • Show Last 20 Lines | |||||