diff options
author | Joshua Leung <aligorith@gmail.com> | 2015-10-10 08:26:09 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2015-10-26 10:18:10 +0300 |
commit | 65072499c65affaf26e2e6912129387ba54211f1 (patch) | |
tree | 9be728f60cb29e26e980123177235a9d022f6250 /source/blender/editors/space_graph/space_graph.c | |
parent | 2092056745064f8ce41863f1856d902588dc39f9 (diff) |
Graph Editor: Allow "cursor x" to have fractional values when working with Drivers (T46004)
When working is the Graph Editor it can be very important to be able to work with fractions
(sub integers), especially when working with Drivers. Currently the "Cursor Y" is hooked up
to "cursor_position_y" which allows fractions but "Cursor X" is directly hooked up to
"frame_current" which is an integer.
This commit adds initial support for this feature.
* When in Drivers mode, the x-part of the cursor is mapped to a new "cursor_position_x"
value which can have fractional values. Animation mode however remains mapped to frame_current
* This commit only adds the UI/property/drawing tweaks needed to support this.
Many operators still need to be modified to consider this value instead of the
current frame, for this to be more useful.
Diffstat (limited to 'source/blender/editors/space_graph/space_graph.c')
-rw-r--r-- | source/blender/editors/space_graph/space_graph.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index ea5cd56b1da..7cbd310301c 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -286,10 +286,33 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar) glDisable(GL_BLEND); } - /* current frame */ - if (sipo->flag & SIPO_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS; - if ((sipo->flag & SIPO_NODRAWCFRANUM) == 0) flag |= DRAWCFRA_SHOW_NUMBOX; - ANIM_draw_cfra(C, v2d, flag); + /* current frame or vertical component of vertical component of the cursor */ + if (sipo->mode == SIPO_MODE_DRIVERS) { + /* cursor x-value */ + float vec[2]; + + vec[0] = sipo->cursorTime; + + /* to help differentiate this from the current frame, draw slightly darker like the horizontal one */ + UI_ThemeColorShadeAlpha(TH_CFRAME, -40, -50); + glLineWidth(2.0); + + glEnable(GL_BLEND); + glBegin(GL_LINE_STRIP); + vec[1] = v2d->cur.ymin; + glVertex2fv(vec); + + vec[1] = v2d->cur.ymax; + glVertex2fv(vec); + glEnd(); // GL_LINE_STRIP + glDisable(GL_BLEND); + } + else { + /* current frame */ + if (sipo->flag & SIPO_DRAWTIME) flag |= DRAWCFRA_UNIT_SECONDS; + if ((sipo->flag & SIPO_NODRAWCFRANUM) == 0) flag |= DRAWCFRA_SHOW_NUMBOX; + ANIM_draw_cfra(C, v2d, flag); + } /* markers */ UI_view2d_view_orthoSpecial(ar, v2d, 1); |