Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_nla/nla_draw.c
| Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | static void nla_action_draw_keyframes( | ||||
| */ | */ | ||||
| float color[4]; | float color[4]; | ||||
| nla_action_get_color(adt, act, color); | nla_action_get_color(adt, act, color); | ||||
| color[3] = min_ff(0.7f, color[3] * 2.5f); | color[3] = min_ff(0.7f, color[3] * 2.5f); | ||||
| GPUVertFormat *format = immVertexFormat(); | GPUVertFormat *format = immVertexFormat(); | ||||
| uint pos_id = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos_id = 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); | ||||
| immUniformColor4fv(color); | immUniformColor4fv(color); | ||||
| /* - draw a rect from the first to the last frame (no extra overlaps for now) | /* - draw a rect from the first to the last frame (no extra overlaps for now) | ||||
| * that is slightly stumpier than the track background (hardcoded 2-units here) | * that is slightly stumpier than the track background (hardcoded 2-units here) | ||||
| */ | */ | ||||
| Range2f frame_range; | Range2f frame_range; | ||||
| ▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | if (dashed) { | ||||
| GPU_viewport_size_get_f(viewport_size); | GPU_viewport_size_get_f(viewport_size); | ||||
| immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); | immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); | ||||
| immUniform1i("colors_len", 0); /* "simple" mode */ | immUniform1i("colors_len", 0); /* "simple" mode */ | ||||
| immUniform1f("dash_width", 6.0f); | immUniform1f("dash_width", 6.0f); | ||||
| immUniform1f("dash_factor", 0.5f); | immUniform1f("dash_factor", 0.5f); | ||||
| } | } | ||||
| else { | else { | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| } | } | ||||
| immUniformThemeColorShade(TH_STRIP_SELECT, shade); | immUniformThemeColorShade(TH_STRIP_SELECT, shade); | ||||
| immBeginAtMost(GPU_PRIM_LINES, BLI_listbase_count(&act->markers) * 2); | immBeginAtMost(GPU_PRIM_LINES, BLI_listbase_count(&act->markers) * 2); | ||||
| LISTBASE_FOREACH (TimeMarker *, marker, &act->markers) { | LISTBASE_FOREACH (TimeMarker *, marker, &act->markers) { | ||||
| if ((marker->frame > strip->actstart) && (marker->frame < strip->actend)) { | if ((marker->frame > strip->actstart) && (marker->frame < strip->actend)) { | ||||
| float frame = nlastrip_get_frame(strip, marker->frame, NLATIME_CONVERT_MAP); | float frame = nlastrip_get_frame(strip, marker->frame, NLATIME_CONVERT_MAP); | ||||
| ▲ Show 20 Lines • Show All 235 Lines • ▼ Show 20 Lines | static void nla_draw_strip(SpaceNla *snla, | ||||
| const bool muted = ((nlt->flag & NLATRACK_MUTED) || (strip->flag & NLASTRIP_FLAG_MUTED)); | const bool muted = ((nlt->flag & NLATRACK_MUTED) || (strip->flag & NLASTRIP_FLAG_MUTED)); | ||||
| float color[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | float color[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | ||||
| uint shdr_pos; | uint shdr_pos; | ||||
| /* get color of strip */ | /* get color of strip */ | ||||
| nla_strip_get_color_inside(adt, strip, color); | nla_strip_get_color_inside(adt, strip, color); | ||||
| shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| /* draw extrapolation info first (as backdrop) | /* draw extrapolation info first (as backdrop) | ||||
| * - but this should only be drawn if track has some contribution | * - but this should only be drawn if track has some contribution | ||||
| */ | */ | ||||
| if ((strip->extendmode != NLASTRIP_EXTEND_NOTHING) && (non_solo == 0)) { | if ((strip->extendmode != NLASTRIP_EXTEND_NOTHING) && (non_solo == 0)) { | ||||
| /* enable transparency... */ | /* enable transparency... */ | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | UI_draw_roundbox_4fv( | ||||
| .ymax = ymaxc, | .ymax = ymaxc, | ||||
| }, | }, | ||||
| true, | true, | ||||
| 0.0f, | 0.0f, | ||||
| color); | color); | ||||
| /* restore current vertex format & program (roundbox trashes it) */ | /* restore current vertex format & program (roundbox trashes it) */ | ||||
| shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| } | } | ||||
| else { | else { | ||||
| /* strip is in disabled track - make less visible */ | /* strip is in disabled track - make less visible */ | ||||
| immUniformColor3fvAlpha(color, 0.1f); | immUniformColor3fvAlpha(color, 0.1f); | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| immRectf(shdr_pos, strip->start, yminc, strip->end, ymaxc); | immRectf(shdr_pos, strip->start, yminc, strip->end, ymaxc); | ||||
| GPU_blend(GPU_BLEND_NONE); | GPU_blend(GPU_BLEND_NONE); | ||||
| ▲ Show 20 Lines • Show All 335 Lines • ▼ Show 20 Lines | if (IN_RANGE(ymin, v2d->cur.ymin, v2d->cur.ymax) || | ||||
| /* Draw the manually set intended playback frame range highlight. */ | /* Draw the manually set intended playback frame range highlight. */ | ||||
| if (ale->data) { | if (ale->data) { | ||||
| ANIM_draw_action_framerange(adt, ale->data, v2d, ymin, ymax); | ANIM_draw_action_framerange(adt, ale->data, v2d, ymin, ymax); | ||||
| } | } | ||||
| uint pos = GPU_vertformat_attr_add( | uint pos = GPU_vertformat_attr_add( | ||||
| immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
| /* just draw a semi-shaded rect spanning the width of the viewable area if there's data, | /* just draw a semi-shaded rect spanning the width of the viewable area if there's data, | ||||
| * and a second darker rect within which we draw keyframe indicator dots if there's data | * and a second darker rect within which we draw keyframe indicator dots if there's data | ||||
| */ | */ | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| /* get colors for drawing */ | /* get colors for drawing */ | ||||
| float color[4]; | float color[4]; | ||||
| ▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines | |||||