From e6b0987a52ac3e48e1e9ffe9d6fea6b8ba486b41 Mon Sep 17 00:00:00 2001 From: doakey3 Date: Wed, 28 Mar 2018 10:55:03 -0600 Subject: [PATCH] Allow alpha keyframing for nontransforms, hide non-applicable keyframe options --- __init__.py | 2 +- operators/call_menu/insert_keyframe.py | 4 ++ operators/call_menu/menu_insert_keyframe.py | 53 ++++++++++++--------- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/__init__.py b/__init__.py index 91dce7b..54a1cb3 100755 --- a/__init__.py +++ b/__init__.py @@ -14,7 +14,7 @@ "name": "VSE Transform tool", "description": "", "author": "kgeogeo, DoubleZ, doakey3", - "version": (1, 1, 7), + "version": (1, 1, 8), "blender": (2, 7, 9), "wiki_url": "", "tracker_url": "", diff --git a/operators/call_menu/insert_keyframe.py b/operators/call_menu/insert_keyframe.py index 187214c..f2957e7 100755 --- a/operators/call_menu/insert_keyframe.py +++ b/operators/call_menu/insert_keyframe.py @@ -54,6 +54,10 @@ def execute(self, context): seq.input_1.crop.keyframe_insert( data_path="max_y", frame=cf) + elif seq.select and not seq.type == "SOUND": + seq.keyframe_insert( + data_path="blend_alpha", frame=cf) + # Apparently redrawing is bad... # bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1) # https://docs.blender.org/api/blender_python_api_2_78_release/info_gotcha.html diff --git a/operators/call_menu/menu_insert_keyframe.py b/operators/call_menu/menu_insert_keyframe.py index 95dd176..c4865e9 100755 --- a/operators/call_menu/menu_insert_keyframe.py +++ b/operators/call_menu/menu_insert_keyframe.py @@ -6,40 +6,47 @@ class MenuInsertKeyframe(bpy.types.Menu): bl_idname = "VSE_MT_Insert_keyframe_Menu" def draw(self, context): + types = [] + for strip in bpy.context.selected_sequences: + types.append(strip.type) + layout = self.layout - layout.operator("vse_transform_tools.insert_keyframe", - text="Location").ch = (1, 0, 0, 0, 0) + if "TRANSFORM" in types: + layout.operator("vse_transform_tools.insert_keyframe", + text="Location").ch = (1, 0, 0, 0, 0) - layout.operator("vse_transform_tools.insert_keyframe", - text="Rotation").ch = (0, 1, 0, 0, 0) + layout.operator("vse_transform_tools.insert_keyframe", + text="Rotation").ch = (0, 1, 0, 0, 0) - layout.operator("vse_transform_tools.insert_keyframe", - text="Scale").ch = (0, 0, 1, 0, 0) + layout.operator("vse_transform_tools.insert_keyframe", + text="Scale").ch = (0, 0, 1, 0, 0) - layout.operator("vse_transform_tools.insert_keyframe", - text="LocRot").ch = (1, 1, 0, 0, 0) + layout.operator("vse_transform_tools.insert_keyframe", + text="LocRot").ch = (1, 1, 0, 0, 0) - layout.operator("vse_transform_tools.insert_keyframe", - text="LocScale").ch =(1, 0, 1, 0, 0) + layout.operator("vse_transform_tools.insert_keyframe", + text="LocScale").ch =(1, 0, 1, 0, 0) - layout.operator("vse_transform_tools.insert_keyframe", - text="RotScale").ch = (0, 1, 1, 0, 0) + layout.operator("vse_transform_tools.insert_keyframe", + text="RotScale").ch = (0, 1, 1, 0, 0) - layout.operator("vse_transform_tools.insert_keyframe", - text="LocRotScale").ch = (1, 1, 1, 0, 0) + layout.operator("vse_transform_tools.insert_keyframe", + text="LocRotScale").ch = (1, 1, 1, 0, 0) - layout.separator() + layout.separator() - layout.operator("vse_transform_tools.insert_keyframe", - text="Alpha").ch = (0, 0, 0, 1, 0) + layout.operator("vse_transform_tools.insert_keyframe", + text="Crop").ch = (0, 0, 0, 0, 1) - layout.separator() + layout.separator() - layout.operator("vse_transform_tools.insert_keyframe", - text="CropScale").ch = (0, 0, 1, 0, 1) + if not all(elem == "SOUND" for elem in types): + layout.operator("vse_transform_tools.insert_keyframe", + text="Alpha").ch = (0, 0, 0, 1, 0) - layout.separator() + if "TRANSFORM" in types: + layout.separator() - layout.operator("vse_transform_tools.insert_keyframe", - text="All").ch = (1, 1, 1, 1, 1) + layout.operator("vse_transform_tools.insert_keyframe", + text="All").ch = (1, 1, 1, 1, 1)