Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_nla/nla_draw.c
| Show First 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | if (key_len > 0) { | ||||
| immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); | immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); | ||||
| immUniform1f("outline_scale", 1.0f); | immUniform1f("outline_scale", 1.0f); | ||||
| immUniform2f("ViewportSize", BLI_rcti_size_x(&v2d->mask) + 1, BLI_rcti_size_y(&v2d->mask) + 1); | immUniform2f("ViewportSize", BLI_rcti_size_x(&v2d->mask) + 1, BLI_rcti_size_y(&v2d->mask) + 1); | ||||
| immBegin(GPU_PRIM_POINTS, key_len); | immBegin(GPU_PRIM_POINTS, key_len); | ||||
| /* - disregard the selection status of keyframes so they draw a certain way | /* - disregard the selection status of keyframes so they draw a certain way | ||||
| * - size is 6.0f which is smaller than the editable keyframes, so that there is a distinction | * - size is 6.0f which is smaller than the editable keyframes, so that there is a distinction | ||||
| */ | */ | ||||
| for (ActKeyColumn *ak = keys.first; ak; ak = ak->next) { | LISTBASE_FOREACH (ActKeyColumn *, ak, &keys) { | ||||
| draw_keyframe_shape(ak->cfra, | draw_keyframe_shape(ak->cfra, | ||||
| y, | y, | ||||
| 6.0f, | 6.0f, | ||||
| false, | false, | ||||
| ak->key_type, | ak->key_type, | ||||
| KEYFRAME_SHAPE_FRAME, | KEYFRAME_SHAPE_FRAME, | ||||
| 1.0f, | 1.0f, | ||||
| pos_id, | pos_id, | ||||
| Show All 40 Lines | if (dashed) { | ||||
| immUniform1f("dash_factor", 0.5f); | immUniform1f("dash_factor", 0.5f); | ||||
| } | } | ||||
| else { | else { | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_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); | ||||
| for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) { | 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); | ||||
| /* just a simple line for now */ | /* just a simple line for now */ | ||||
| /* XXX: draw a triangle instead... */ | /* XXX: draw a triangle instead... */ | ||||
| immVertex2f(shdr_pos, frame, yminc + 1); | immVertex2f(shdr_pos, frame, yminc + 1); | ||||
| immVertex2f(shdr_pos, frame, ymaxc - 1); | immVertex2f(shdr_pos, frame, ymaxc - 1); | ||||
| } | } | ||||
| Show All 14 Lines | if (strip->type == NLASTRIP_TYPE_CLIP) { | ||||
| /* just draw the markers in this clip */ | /* just draw the markers in this clip */ | ||||
| nla_actionclip_draw_markers(strip, yminc, ymaxc, shade, true); | nla_actionclip_draw_markers(strip, yminc, ymaxc, shade, true); | ||||
| } | } | ||||
| else if (strip->flag & NLASTRIP_FLAG_TEMP_META) { | else if (strip->flag & NLASTRIP_FLAG_TEMP_META) { | ||||
| /* just a solid color, so that it is very easy to spot */ | /* just a solid color, so that it is very easy to spot */ | ||||
| int shade = 20; | int shade = 20; | ||||
| /* draw the markers in the first level of strips only (if they are actions) */ | /* draw the markers in the first level of strips only (if they are actions) */ | ||||
| for (NlaStrip *nls = strip->strips.first; nls; nls = nls->next) { | LISTBASE_FOREACH (NlaStrip *, nls, &strip->strips) { | ||||
| if (nls->type == NLASTRIP_TYPE_CLIP) { | if (nls->type == NLASTRIP_TYPE_CLIP) { | ||||
| nla_actionclip_draw_markers(nls, yminc, ymaxc, shade, false); | nla_actionclip_draw_markers(nls, yminc, ymaxc, shade, false); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| GPU_line_width(1.0f); | GPU_line_width(1.0f); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 310 Lines • ▼ Show 20 Lines | static void nla_draw_strip(SpaceNla *snla, | ||||
| * (in same color as outline, if more than 1 exists) */ | * (in same color as outline, if more than 1 exists) */ | ||||
| else if ((strip->type == NLASTRIP_TYPE_META) && (strip->strips.first != strip->strips.last)) { | else if ((strip->type == NLASTRIP_TYPE_META) && (strip->strips.first != strip->strips.last)) { | ||||
| const float y = (ymaxc - yminc) * 0.5f + yminc; | const float y = (ymaxc - yminc) * 0.5f + yminc; | ||||
| /* up to 2 lines per strip */ | /* up to 2 lines per strip */ | ||||
| immBeginAtMost(GPU_PRIM_LINES, 4 * BLI_listbase_count(&strip->strips)); | immBeginAtMost(GPU_PRIM_LINES, 4 * BLI_listbase_count(&strip->strips)); | ||||
| /* only draw first-level of child-strips, but don't draw any lines on the endpoints */ | /* only draw first-level of child-strips, but don't draw any lines on the endpoints */ | ||||
| for (NlaStrip *cs = strip->strips.first; cs; cs = cs->next) { | LISTBASE_FOREACH (NlaStrip *, cs, &strip->strips) { | ||||
| /* draw start-line if not same as end of previous (and only if not the first strip) | /* draw start-line if not same as end of previous (and only if not the first strip) | ||||
| * - on upper half of strip | * - on upper half of strip | ||||
| */ | */ | ||||
| if ((cs->prev) && IS_EQF(cs->prev->end, cs->start) == 0) { | if ((cs->prev) && IS_EQF(cs->prev->end, cs->start) == 0) { | ||||
| immVertex2f(shdr_pos, cs->start, y); | immVertex2f(shdr_pos, cs->start, y); | ||||
| immVertex2f(shdr_pos, cs->start, ymaxc); | immVertex2f(shdr_pos, cs->start, ymaxc); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 309 Lines • Show Last 20 Lines | |||||