diff options
author | Joshua Leung <aligorith@gmail.com> | 2013-01-08 05:00:59 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2013-01-08 05:00:59 +0400 |
commit | 35b187e2834f552e2e319c0ead03395d966d153b (patch) | |
tree | 670d1224f06e91275da53b80dda1f1935cd88a8c /source/blender/editors/space_view3d/drawanimviz.c | |
parent | 44ab30caf6b7e412ce89bc0eb02a12dab1da3515 (diff) |
Motion Path drawing tweaks and fixes
* Green (current frame) color now extends to the segments on either side of the
current frame point. This is so that the path is more visible (especially on the
black/dark side), as those segments were prone to being interpolated such that
they became invisible
* Added padding for frame number strings so that they do not overlap the dots
anymore
* Fixed off-by-one error, which meant that the frame number for the first frame
step (white dot) didn't get shown
Diffstat (limited to 'source/blender/editors/space_view3d/drawanimviz.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawanimviz.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index 0649edc1ac4..57864854734 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -139,35 +139,38 @@ void draw_motion_path_instance(Scene *scene, short sel = (pchan) ? (pchan->bone->flag & BONE_SELECTED) : (ob->flag & SELECT); float intensity; /* how faint */ + int frame = sfra + i; + int blend_base = (abs(frame - CFRA) == 1) ? TH_CFRAME : TH_BACK; /* "bleed" cframe color to ease color blending */ + /* set color * - more intense for active/selected bones, less intense for unselected bones * - black for before current frame, green for current frame, blue for after current frame * - intensity decreases as distance from current frame increases */ #define SET_INTENSITY(A, B, C, min, max) (((1.0f - ((C - B) / (C - A))) * (max - min)) + min) - if ((sfra + i) < CFRA) { + if (frame < CFRA) { /* black - before cfra */ if (sel) { - // intensity = 0.5f; + /* intensity = 0.5f; */ intensity = SET_INTENSITY(sfra, i, CFRA, 0.25f, 0.75f); } else { - //intensity = 0.8f; + /* intensity = 0.8f; */ intensity = SET_INTENSITY(sfra, i, CFRA, 0.68f, 0.92f); } - UI_ThemeColorBlend(TH_WIRE, TH_BACK, intensity); + UI_ThemeColorBlend(TH_WIRE, blend_base, intensity); } - else if ((sfra + i) > CFRA) { + else if (frame > CFRA) { /* blue - after cfra */ if (sel) { - //intensity = 0.5f; + /* intensity = 0.5f; */ intensity = SET_INTENSITY(CFRA, i, efra, 0.25f, 0.75f); } else { - //intensity = 0.8f; + /* intensity = 0.8f; */ intensity = SET_INTENSITY(CFRA, i, efra, 0.68f, 0.92f); } - UI_ThemeColorBlend(TH_BONE_POSE, TH_BACK, intensity); + UI_ThemeColorBlend(TH_BONE_POSE, blend_base, intensity); } else { /* green - on cfra */ @@ -232,21 +235,22 @@ void draw_motion_path_instance(Scene *scene, col[3] = 255; for (i = 0, mpv = mpv_start; i < len; i += stepsize, mpv += stepsize) { + int frame = sfra + i; char numstr[32]; float co[3]; /* only draw framenum if several consecutive highlighted points don't occur on same point */ if (i == 0) { - sprintf(numstr, "%d", (i + sfra)); + sprintf(numstr, " %d", frame); mul_v3_m4v3(co, ob->imat, mpv->co); view3d_cached_text_draw_add(co, numstr, 0, V3D_CACHE_TEXT_WORLDSPACE | V3D_CACHE_TEXT_ASCII, col); } - else if ((i > stepsize) && (i < len - stepsize)) { + else if ((i >= stepsize) && (i < len - stepsize)) { bMotionPathVert *mpvP = (mpv - stepsize); bMotionPathVert *mpvN = (mpv + stepsize); if ((equals_v3v3(mpv->co, mpvP->co) == 0) || (equals_v3v3(mpv->co, mpvN->co) == 0)) { - sprintf(numstr, "%d", (sfra + i)); + sprintf(numstr, " %d", frame); mul_v3_m4v3(co, ob->imat, mpv->co); view3d_cached_text_draw_add(co, numstr, 0, V3D_CACHE_TEXT_WORLDSPACE | V3D_CACHE_TEXT_ASCII, col); } @@ -286,12 +290,13 @@ void draw_motion_path_instance(Scene *scene, UI_GetThemeColor3ubv(TH_VERTEX_SELECT, col); col[3] = 255; - glPointSize(4.0f); // XXX perhaps a bit too big + glPointSize(4.0f); glColor3ubv(col); glBegin(GL_POINTS); for (i = 0, mpv = mpv_start; i < len; i++, mpv++) { - float mframe = (float)(sfra + i); + int frame = sfra + i; + float mframe = (float)(frame); if (BLI_dlrbTree_search_exact(&keys, compare_ak_cfraPtr, &mframe)) glVertex3fv(mpv->co); @@ -309,7 +314,7 @@ void draw_motion_path_instance(Scene *scene, if (BLI_dlrbTree_search_exact(&keys, compare_ak_cfraPtr, &mframe)) { char numstr[32]; - sprintf(numstr, "%d", (sfra + i)); + sprintf(numstr, " %d", (sfra + i)); mul_v3_m4v3(co, ob->imat, mpv->co); view3d_cached_text_draw_add(co, numstr, 0, V3D_CACHE_TEXT_WORLDSPACE | V3D_CACHE_TEXT_ASCII, col); } |