From 0d465c84d4ab5de94aea5a60451cc64240934a75 Mon Sep 17 00:00:00 2001 From: Pullusb Date: Thu, 5 May 2022 15:39:23 +0200 Subject: [PATCH] Update key set with world pose paste 1.5.2 - changed: key and jump now use keying set `LocRotScale` instead of `Available` - changed: paste always add a key (`LocRotScale`) even if not in auto-key --- CHANGELOG.md | 6 ++++++ OP_world_copy_paste.py | 43 ++++++++++++++++++++++++++++++++---------- __init__.py | 2 +- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26cecb9..5968392 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog + +1.5.2 + +- changed: key and jump now use keying set `LocRotScale` instead of `Available` +- changed: paste always add a key (`LocRotScale`) even if not in autokey + 1.5.1 - fixed: also key rotation when creating curve diff --git a/OP_world_copy_paste.py b/OP_world_copy_paste.py index a1dad7e..d14fc42 100644 --- a/OP_world_copy_paste.py +++ b/OP_world_copy_paste.py @@ -20,7 +20,7 @@ class AW_OT_world_space_copy(bpy.types.Operator): class AW_OT_world_space_paste(bpy.types.Operator): bl_idname = "pose.world_space_paste" bl_label = "World Paste" - bl_description = "Paste world space transforms. Apply stored matrix to active bone" + bl_description = "Paste world space transforms. Apply stored matrix to active bone and key LocRotScale" bl_options = {"REGISTER", "UNDO"} @classmethod @@ -34,15 +34,22 @@ class AW_OT_world_space_paste(bpy.types.Operator): def execute(self, context): context.active_pose_bone.matrix = context.object.matrix_world.inverted() @ bpy.context.view_layer.world_space_store - if context.scene.tool_settings.use_keyframe_insert_auto: - bpy.ops.anim.keyframe_insert_menu(type='Available') + ## only if autokey is On + # if context.scene.tool_settings.use_keyframe_insert_auto: + # bpy.ops.anim.keyframe_insert_menu(type='LocRotScale') # Available + + ## always paste location rotation scale + bpy.ops.anim.keyframe_insert(type='LocRotScale') + return {"FINISHED"} class AW_OT_world_space_paste_next(bpy.types.Operator): bl_idname = "pose.world_space_paste_next" bl_label = "World Paste Jump" - bl_description = "Paste world space transforms and keyframe available chanels\nThen jump to prev/next key" + bl_description = "Paste world space transforms and keyframe available chanels\ + \nThen jump to prev/next key\ + \nKey Loc rot scale only" bl_options = {"REGISTER", "UNDO"} @classmethod @@ -59,8 +66,7 @@ class AW_OT_world_space_paste_next(bpy.types.Operator): context.active_pose_bone.matrix = context.object.matrix_world.inverted() @ bpy.context.view_layer.world_space_store # insert keyframe at value - # context.object.keyframe_insert(data_path, index=-1, frame=bpy.context.scene.frame_current, group="", options={'INSERTKEY_AVAILABLE'}) - bpy.ops.anim.keyframe_insert_menu(type='Available') + bpy.ops.anim.keyframe_insert(type='LocRotScale') # delete args to use default # jump to next key act = fn.get_obj_action(context.object) @@ -94,7 +100,9 @@ class AW_OT_world_space_paste_next(bpy.types.Operator): class AW_OT_world_space_paste_next_frame(bpy.types.Operator): bl_idname = "pose.world_space_paste_next_frame" bl_label = "World Paste Jump Frame" - bl_description = "Paste world space transforms and keyframe available chanels\nThen jump to prev/next frame" + bl_description = "Paste world space transforms and keyframe available chanels\ + \nThen jump to prev/next frame\ + \nKey Loc rot scale only" bl_options = {"REGISTER", "UNDO"} @classmethod @@ -109,10 +117,25 @@ class AW_OT_world_space_paste_next_frame(bpy.types.Operator): def execute(self, context): # apply matrix context.active_pose_bone.matrix = context.object.matrix_world.inverted() @ bpy.context.view_layer.world_space_store - - # insert keyframe at value + # context.object.keyframe_insert(data_path, index=-1, frame=bpy.context.scene.frame_current, group="", options={'INSERTKEY_AVAILABLE'}) - bpy.ops.anim.keyframe_insert_menu(type='Available') + + ## bpy.ops.anim.keyframe_insert(type='DEFAULT') + + ## possible type : + # 'Location', 'Rotation', 'Scaling', 'BUILTIN_KSI_LocRot', 'LocRotScale', 'LocRotScaleCProp', + # 'BUILTIN_KSI_LocScale', 'BUILTIN_KSI_RotScale', + # 'BUILTIN_KSI_DeltaLocation', 'BUILTIN_KSI_DeltaRotation', 'BUILTIN_KSI_DeltaScale', + # 'BUILTIN_KSI_VisualLoc', 'BUILTIN_KSI_VisualRot', 'BUILTIN_KSI_VisualScaling', + # 'BUILTIN_KSI_VisualLocRot', 'BUILTIN_KSI_VisualLocRotScale', 'BUILTIN_KSI_VisualLocScale', 'BUILTIN_KSI_VisualRotScale' + + + ## insert keyframe at value + ## Insert Keyframes for specified Keying Set, with menu of available Keying Sets if undefined + # bpy.ops.anim.keyframe_insert_menu(type='Available', always_prompt=False) + + ## Insert keyframes on the current frame for all properties in the specified Keying Set + bpy.ops.anim.keyframe_insert(type='LocRotScale') # jump to next frame act = fn.get_obj_action(context.object) diff --git a/__init__.py b/__init__.py index 2e6511d..1d69e90 100644 --- a/__init__.py +++ b/__init__.py @@ -4,7 +4,7 @@ bl_info = { "name": "Auto Walk", "description": "Develop a walk/run cycles along a curve and pin feets", "author": "Samuel Bernou", - "version": (1, 5, 1), + "version": (1, 5, 2), "blender": (3, 0, 0), "location": "View3D", "warning": "",