Graph Editor: Added 2D Cursor

I've finally given in, and implemented a '2d-cursor' for the Graph Editor. This is simply represented as an additional horizontal line that meets with the current frame indicator, forming a cross-hair. It can be disabled from the View menu.

Currently, the only tool which takes this into account is the Snapping tools (Shift-S), where I've hooked up a tool I added some time ago. 

TODO:
- expose this cursor to the transform tools for scaling/rotation options...
This commit is contained in:
2009-10-20 12:04:56 +00:00
parent ec6bccfad1
commit 00f3d83b6a
10 changed files with 204 additions and 77 deletions

View File

@@ -1450,7 +1450,8 @@ void GRAPH_OT_frame_jump (wmOperatorType *ot)
/* defines for snap keyframes tool */
EnumPropertyItem prop_graphkeys_snap_types[] = {
{GRAPHKEYS_SNAP_CFRA, "CFRA", 0, "Current frame", ""},
{GRAPHKEYS_SNAP_CFRA, "CFRA", 0, "Current Frame", ""},
{GRAPHKEYS_SNAP_VALUE, "VALUE", 0, "Cursor Value", ""},
{GRAPHKEYS_SNAP_NEAREST_FRAME, "NEAREST_FRAME", 0, "Nearest Frame", ""}, // XXX as single entry?
{GRAPHKEYS_SNAP_NEAREST_SECOND, "NEAREST_SECOND", 0, "Nearest Second", ""}, // XXX as single entry?
{GRAPHKEYS_SNAP_NEAREST_MARKER, "NEAREST_MARKER", 0, "Nearest Marker", ""},
@@ -1481,6 +1482,10 @@ static void snap_graph_keys(bAnimContext *ac, short mode)
bed.list.first= (ac->markers) ? ac->markers->first : NULL;
bed.list.last= (ac->markers) ? ac->markers->last : NULL;
}
else if (mode == GRAPHKEYS_SNAP_VALUE) {
SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
bed.f1= (sipo) ? sipo->cursorVal : 0.0f;
}
/* snap keyframes */
for (ale= anim_data.first; ale; ale= ale->next) {