diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-10-16 17:44:06 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-10-16 17:44:06 +0300 |
commit | 5ebdbcafcb2703f14f33738f1e852e5a3e1ab33a (patch) | |
tree | ff46d1a526b675774944444a8a66bdf14c0db549 /release | |
parent | df4a93aca0a7c6f00370b1aad7439526434e30ce (diff) |
Animation: Snap Cursor Value operator
Add operator to snap the 2D Cursor value to selected keyframes. This is
doing almost the same as the "Cursor to Selected" operator, except that
it doesn't affect the current frame, just the Y-coordinate (the value)
of the 2D cursor.
The "snap cursor" operators are added to the Key → Snap menu and to the
Snap pie menu. This means that these menus are now extended in meaning,
to not only mean "snap the selected keyframes to the cursor", but also
for some options "snap the cursor to selected keyframes".
This fixes T76596.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/space_graph.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py index 078b1c9ff38..212a3d5ea2b 100644 --- a/release/scripts/startup/bl_ui/space_graph.py +++ b/release/scripts/startup/bl_ui/space_graph.py @@ -262,8 +262,7 @@ class GRAPH_MT_key(Menu): layout = self.layout layout.menu("GRAPH_MT_key_transform", text="Transform") - - layout.operator_menu_enum("graph.snap", "type", text="Snap") + layout.menu("GRAPH_MT_key_snap", text="Snap") layout.operator_menu_enum("graph.mirror", "type", text="Mirror") layout.separator() @@ -319,6 +318,23 @@ class GRAPH_MT_key_transform(Menu): layout.operator("transform.resize", text="Scale") +class GRAPH_MT_key_snap(Menu): + bl_label = "Snap" + + def draw(self, _context): + layout = self.layout + + layout.operator("graph.snap", text="Current Frame").type = 'CFRA' + layout.operator("graph.snap", text="Cursor Value").type = 'VALUE' + layout.operator("graph.snap", text="Nearest Frame").type = 'NEAREST_FRAME' + layout.operator("graph.snap", text="Nearest Second").type = 'NEAREST_SECOND' + layout.operator("graph.snap", text="Nearest Marker").type = 'NEAREST_MARKER' + layout.operator("graph.snap", text="Flatten Handles").type = 'HORIZONTAL' + layout.separator() + layout.operator("graph.frame_jump", text="Cursor to Selection") + layout.operator("graph.snap_cursor_value", text="Cursor Value to Selection") + + class GRAPH_MT_delete(Menu): bl_label = "Delete" @@ -389,6 +405,8 @@ class GRAPH_MT_snap_pie(Menu): pie.operator("graph.snap", text="Nearest Second").type = 'NEAREST_SECOND' pie.operator("graph.snap", text="Nearest Marker").type = 'NEAREST_MARKER' pie.operator("graph.snap", text="Flatten Handles").type = 'HORIZONTAL' + pie.operator("graph.frame_jump", text="Cursor to Selection") + pie.operator("graph.snap_cursor_value", text="Cursor Value to Selection") class GRAPH_MT_channel_context_menu(Menu): @@ -441,6 +459,7 @@ classes = ( GRAPH_MT_channel, GRAPH_MT_key, GRAPH_MT_key_transform, + GRAPH_MT_key_snap, GRAPH_MT_delete, GRAPH_MT_context_menu, GRAPH_MT_channel_context_menu, |