Anim: Add hotkey for keying set operators

This is in response to feedback to the changes from #113504
While it does simplify inserting keyframes,
sometimes artists want to insert keys only to e.g. Location.
This takes longer to do now, since the option is in a menu.

This PR changes the following:

* new `K` hotkey to bring up the "Keying Set" menu.
This will always show the menu, even if a keying set is active.

* `Shift + K` will open a menu to set the active keying set

* with "Pie Menu on Drag" enabled in the user preferences,
hitting `I` and moving the mouse will bring up a pie menu
to insert only specific transform channels

Conceptually this separates the keying set behavior from the
insert keyframe behavior.
`I` will always add keyframes.
While `K` always shows keying set options.

Pull Request: https://projects.blender.org/blender/blender/pulls/115798
This commit is contained in:
Christoph Lendenfeld
2024-01-25 14:46:04 +01:00
committed by Christoph Lendenfeld
parent 9fdf3bc1f4
commit 87fc8e8ddd
3 changed files with 56 additions and 4 deletions
@@ -4711,9 +4711,9 @@ def km_object_mode(params):
("object.join", {"type": 'J', "value": 'PRESS', "ctrl": True}, None),
("wm.context_toggle", {"type": 'PERIOD', "value": 'PRESS', "ctrl": True},
{"properties": [("data_path", 'tool_settings.use_transform_data_origin')]}),
("anim.keyframe_insert", {"type": 'I', "value": 'PRESS'}, None),
("anim.keyframe_insert_menu", {"type": 'K', "value": 'PRESS'}, {"properties": [("always_prompt", True)]}),
("anim.keyframe_delete_v3d", {"type": 'I', "value": 'PRESS', "alt": True}, None),
("anim.keying_set_active_set", {"type": 'I', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None),
("anim.keying_set_active_set", {"type": 'K', "value": 'PRESS', "shift": True}, None),
("collection.create", {"type": 'G', "value": 'PRESS', "ctrl": True}, None),
("collection.objects_remove", {"type": 'G', "value": 'PRESS', "ctrl": True, "alt": True}, None),
("collection.objects_remove_all",
@@ -4730,6 +4730,16 @@ def km_object_mode(params):
*_template_items_context_menu("VIEW3D_MT_object_context_menu", params.context_menu_event),
])
if params.use_pie_click_drag:
items.extend([
("anim.keyframe_insert", {"type": 'I', "value": 'CLICK'}, None),
op_menu_pie("ANIM_MT_keyframe_insert_pie", {"type": 'I', "value": 'CLICK_DRAG'}),
])
else:
items.extend([
("anim.keyframe_insert", {"type": 'I', "value": 'PRESS'}, None),
])
if params.legacy:
items.extend([
("object.select_mirror", {"type": 'M', "value": 'PRESS', "shift": True, "ctrl": True}, None),
@@ -4850,9 +4860,9 @@ def km_pose(params):
("armature.assign_to_collection", {"type": 'M', "value": 'PRESS', "shift": True}, None),
("armature.move_to_collection", {"type": 'M', "value": 'PRESS'}, None),
("transform.bbone_resize", {"type": 'S', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None),
("anim.keyframe_insert", {"type": 'I', "value": 'PRESS'}, None),
("anim.keyframe_insert_menu", {"type": 'K', "value": 'PRESS'}, {"properties": [("always_prompt", True)]}),
("anim.keyframe_delete_v3d", {"type": 'I', "value": 'PRESS', "alt": True}, None),
("anim.keying_set_active_set", {"type": 'I', "value": 'PRESS', "shift": True, "ctrl": True, "alt": True}, None),
("anim.keying_set_active_set", {"type": 'K', "value": 'PRESS', "shift": True}, None),
("pose.push", {"type": 'E', "value": 'PRESS', "ctrl": True}, None),
("pose.relax", {"type": 'E', "value": 'PRESS', "alt": True}, None),
("pose.breakdown", {"type": 'E', "value": 'PRESS', "shift": True}, None),
@@ -4861,6 +4871,16 @@ def km_pose(params):
*_template_items_context_menu("VIEW3D_MT_pose_context_menu", params.context_menu_event),
])
if params.use_pie_click_drag:
items.extend([
("anim.keyframe_insert", {"type": 'I', "value": 'CLICK'}, None),
op_menu_pie("ANIM_MT_keyframe_insert_pie", {"type": 'I', "value": 'CLICK_DRAG'}),
])
else:
items.extend([
("anim.keyframe_insert", {"type": 'I', "value": 'PRESS'}, None),
])
return keymap
+1
View File
@@ -11,6 +11,7 @@ if "bpy" in locals():
del reload
_modules = [
"anim",
"asset_shelf",
"node_add_menu",
"node_add_menu_compositor",
+31
View File
@@ -0,0 +1,31 @@
from bpy.types import Menu
class ANIM_MT_keyframe_insert_pie(Menu):
bl_label = "Keyframe Insert Pie"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
prop = pie.operator("anim.keyframe_insert_by_name", text="Location")
prop.type = "Location"
prop = pie.operator("anim.keyframe_insert_by_name", text="Scale")
prop.type = "Scaling"
prop = pie.operator("anim.keyframe_insert_by_name", text="Available")
prop.type = "Available"
prop = pie.operator("anim.keyframe_insert_by_name", text="Rotation")
prop.type = "Rotation"
classes = (
ANIM_MT_keyframe_insert_pie,
)
if __name__ == "__main__": # only for live edit.
from bpy.utils import register_class
for cls in classes:
register_class(cls)