From b193c673582bf9daca7b5e01902fd674eb470d6c Mon Sep 17 00:00:00 2001 From: Pullusb Date: Sun, 2 May 2021 23:14:38 +0200 Subject: [PATCH] keyframe jump global UI filter 1.0.8: - feat: Keyframe jump filter added in UI to change general behavior. Keymap own jump filter can override this new global settings if specified --- OP_keyframe_jump.py | 24 +++++++++++++++--------- README.md | 3 +++ UI_tools.py | 4 ++++ __init__.py | 4 ++-- properties.py | 12 ++++++++++++ 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/OP_keyframe_jump.py b/OP_keyframe_jump.py index bae241c..c689c6b 100644 --- a/OP_keyframe_jump.py +++ b/OP_keyframe_jump.py @@ -26,15 +26,16 @@ class GPTB_OT_jump_gp_keyframe(bpy.types.Operator): )) keyframe_type : EnumProperty( - name="Keyframe Filter", description="Only jump to defined keyframe type", - default='ALL', options={'HIDDEN', 'SKIP_SAVE'}, + name="Keyframe Filter", description="Jump to choosen keyframe type, else use the UI jump filter", + default='NONE', options={'HIDDEN', 'SKIP_SAVE'}, items=( - ('ALL', 'All', '', 0), # 'KEYFRAME' - ('KEYFRAME', 'Keyframe', '', 'KEYTYPE_KEYFRAME_VEC', 1), - ('BREAKDOWN', 'Breakdown', '', 'KEYTYPE_BREAKDOWN_VEC', 2), - ('MOVING_HOLD', 'Moving Hold', '', 'KEYTYPE_MOVING_HOLD_VEC', 3), - ('EXTREME', 'Extreme', '', 'KEYTYPE_EXTREME_VEC', 4), - ('JITTER', 'Jitter', '', 'KEYTYPE_JITTER_VEC', 5), + ('NONE', 'Use UI Filter', '', 0), # 'KEYFRAME' + ('ALL', 'All', '', 1), + ('KEYFRAME', 'Keyframe', '', 'KEYTYPE_KEYFRAME_VEC', 2), + ('BREAKDOWN', 'Breakdown', '', 'KEYTYPE_BREAKDOWN_VEC', 3), + ('MOVING_HOLD', 'Moving Hold', '', 'KEYTYPE_MOVING_HOLD_VEC', 4), + ('EXTREME', 'Extreme', '', 'KEYTYPE_EXTREME_VEC', 5), + ('JITTER', 'Jitter', '', 'KEYTYPE_JITTER_VEC', 6), )) def execute(self, context): @@ -53,6 +54,11 @@ class GPTB_OT_jump_gp_keyframe(bpy.types.Operator): elif self.target == 'ACCESSIBLE': gpl = [l for l in context.object.data.layers if not l.hide and not l.lock] + if self.keyframe_type != 'NONE': + # use shortcut choice override + kftype = self.keyframe_type + else: + kftype = context.scene.gptoolprops.keyframe_type current = context.scene.frame_current p = n = None @@ -62,7 +68,7 @@ class GPTB_OT_jump_gp_keyframe(bpy.types.Operator): for l in gpl: for f in l.frames: # keyframe type filter - if self.keyframe_type != 'ALL' and f.keyframe_type != self.keyframe_type: + if kftype != 'ALL' and f.keyframe_type != kftype: continue if f.frame_number < current: diff --git a/README.md b/README.md index 2ff790f..46cb4ea 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,9 @@ Panel in sidebar : 3D view > sidebar 'N' > Gpencil ## Changelog: +1.0.8: + +- feat: Keyframe jump filter added in UI to change general behavior. Keymap own jump filter can override this new global settings if specified 1.0.7: diff --git a/UI_tools.py b/UI_tools.py index c6bc510..ef96a5e 100644 --- a/UI_tools.py +++ b/UI_tools.py @@ -132,6 +132,10 @@ class GPTB_PT_sidebar_panel(bpy.types.Panel): ## Options layout.separator() layout.label(text = 'Options:') + + ## Kf Jump filter + layout.prop(context.scene.gptoolprops, 'keyframe_type', text='Jump On') # Keyframe Jump + # row = layout.row(align=False) ## maybe remove cursor_follow icon that look like text, icon = ('Cursor Follow On', 'PIVOT_CURSOR') if context.scene.gptoolprops.cursor_follow else ('Cursor Follow Off', 'CURSOR') diff --git a/__init__.py b/__init__.py index fd7f683..ad7f8f8 100644 --- a/__init__.py +++ b/__init__.py @@ -15,7 +15,7 @@ bl_info = { "name": "GP toolbox", "description": "Set of tools for Grease Pencil in animation production", "author": "Samuel Bernou", -"version": (1, 0, 7), +"version": (1, 0, 8), "blender": (2, 91, 0), "location": "sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "warning": "", @@ -235,7 +235,7 @@ class GPTB_prefs(bpy.types.AddonPreferences): ## KF jumper kfj_use_shortcut: BoolProperty( name = "Use Keyframe Jump Shortcut", - description = "Auto bind shotcut for keyframe jump (else you can bien manually using 'screen.gp_keyframe_jump' id_name)", + description = "Auto bind shotcut for keyframe jump (else you can bind manually using 'screen.gp_keyframe_jump' id_name)", default = True) kfj_prev_keycode : StringProperty( diff --git a/properties.py b/properties.py index 5480a66..e1fa08c 100644 --- a/properties.py +++ b/properties.py @@ -4,6 +4,7 @@ from bpy.props import ( BoolProperty, StringProperty, FloatProperty, + EnumProperty, ) from .OP_cursor_snap_canvas import cursor_follow_update @@ -44,6 +45,17 @@ class GP_PG_ToolsSettings(bpy.types.PropertyGroup) : name="Render_name", description="Name use for render current", default="") + keyframe_type : EnumProperty( + name="Keyframe Filter", description="Only jump to defined keyframe type", + default='ALL', options={'HIDDEN', 'SKIP_SAVE'}, + items=( + ('ALL', 'All', '', 0), # 'KEYFRAME' + ('KEYFRAME', 'Keyframe', '', 'KEYTYPE_KEYFRAME_VEC', 1), + ('BREAKDOWN', 'Breakdown', '', 'KEYTYPE_BREAKDOWN_VEC', 2), + ('MOVING_HOLD', 'Moving Hold', '', 'KEYTYPE_MOVING_HOLD_VEC', 3), + ('EXTREME', 'Extreme', '', 'KEYTYPE_EXTREME_VEC', 4), + ('JITTER', 'Jitter', '', 'KEYTYPE_JITTER_VEC', 5), + )) """ reconnect_parent = bpy.props.PointerProperty(type =bpy.types.Object,poll=poll_armature)