feat : keyframe jump type filter

1.0.6:

- feat: Keyframe jump filter by type. User can now choose if the shortcut should jump on a specific keyframe type (All by default)
gpv2
Pullusb 2021-05-02 15:25:37 +02:00
parent 6d43064f0b
commit 801235c760
3 changed files with 29 additions and 9 deletions

View File

@ -1,5 +1,6 @@
import bpy import bpy
from .utils import get_addon_prefs from .utils import get_addon_prefs
from bpy.props import BoolProperty ,EnumProperty ,StringProperty
class GPTB_OT_jump_gp_keyframe(bpy.types.Operator): class GPTB_OT_jump_gp_keyframe(bpy.types.Operator):
bl_idname = "screen.gp_keyframe_jump" bl_idname = "screen.gp_keyframe_jump"
@ -11,17 +12,28 @@ class GPTB_OT_jump_gp_keyframe(bpy.types.Operator):
def poll(cls, context): def poll(cls, context):
return context.object and context.object.type == 'GPENCIL' return context.object and context.object.type == 'GPENCIL'
next : bpy.props.BoolProperty( next : BoolProperty(
name="Next GP keyframe", description="Go to next active GP keyframe", default=True) name="Next GP keyframe", description="Go to next active GP keyframe", default=True)
target : bpy.props.EnumProperty( target : EnumProperty(
name="Target layer", description="Choose wich layer to evaluate for keyframe change", default='ACTIVE',# options={'ANIMATABLE'}, update=None, get=None, set=None, name="Target layer", description="Choose wich layer to evaluate for keyframe change", default='ACTIVE',# options={'ANIMATABLE'}, update=None, get=None, set=None,
items=( items=(
('ACTIVE', 'Active and selected', 'jump in keyframes of active and other selected layers ', 0), ('ACTIVE', 'Active and selected', 'jump in keyframes of active and other selected layers ', 0),
('VISIBLE', 'Visibles layers', 'jump in keyframes of visibles layers', 1), ('VISIBLE', 'Visibles layers', 'jump in keyframes of visibles layers', 1),
('ACCESSIBLE', 'Visible and unlocked layers', 'jump in keyframe of all layers', 2), ('ACCESSIBLE', 'Visible and unlocked layers', 'jump in keyframe of all layers', 2),
)) ))
#(key, label, descr, id[, icon])
keyframe_type : EnumProperty(
name="Keyframe Filter", description="Only jump to defined keyframe type",
default='ALL', options={'HIDDEN'},
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),
))
def execute(self, context): def execute(self, context):
if not context.object.data.layers.active: if not context.object.data.layers.active:
@ -47,6 +59,10 @@ class GPTB_OT_jump_gp_keyframe(bpy.types.Operator):
maxs = [] maxs = []
for l in gpl: for l in gpl:
for f in l.frames: for f in l.frames:
# keyframe type filter
if self.keyframe_type != 'ALL' and f.keyframe_type != self.keyframe_type:
continue
if f.frame_number < current: if f.frame_number < current:
p = f.frame_number p = f.frame_number
if f.frame_number > current: if f.frame_number > current:
@ -80,10 +96,10 @@ class KFJ_OT_rebinder(bpy.types.Operator):
bl_label = "rebind keyframe jump shortcut" bl_label = "rebind keyframe jump shortcut"
bl_options = {'REGISTER', 'INTERNAL'} bl_options = {'REGISTER', 'INTERNAL'}
s_keycode: bpy.props.StringProperty() s_keycode: StringProperty()
s_ctrl: bpy.props.StringProperty() s_ctrl: StringProperty()
s_shift: bpy.props.StringProperty() s_shift: StringProperty()
s_alt: bpy.props.StringProperty() s_alt: StringProperty()
def invoke(self, context, event): def invoke(self, context, event):

View File

@ -31,7 +31,7 @@ Note about palette : For now the importer is not working with linked palette as
### Passive action ### Passive action
Add an "on save" Handler that trigger relative remap of all path. Add an "on save" Handler that trigger relative remap of all path (can be disabled in addon prefs).
### function ### function
@ -112,6 +112,10 @@ Panel in sidebar : 3D view > sidebar 'N' > Gpencil
## Changelog: ## Changelog:
1.0.6:
- feat: Keyframe jump filter by type. User can now choose if the shortcut should jump on a specific keyframe type (All by default)
1.0.5: 1.0.5:
- GP copy-paste : Pasted stroke are now selected (allow to use it to quickly rip/split strokes with cut/paste on the same layer) - GP copy-paste : Pasted stroke are now selected (allow to use it to quickly rip/split strokes with cut/paste on the same layer)

View File

@ -15,7 +15,7 @@ bl_info = {
"name": "GP toolbox", "name": "GP toolbox",
"description": "Set of tools for Grease Pencil in animation production", "description": "Set of tools for Grease Pencil in animation production",
"author": "Samuel Bernou", "author": "Samuel Bernou",
"version": (1, 0, 5), "version": (1, 0, 6),
"blender": (2, 91, 0), "blender": (2, 91, 0),
"location": "sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "location": "sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
"warning": "", "warning": "",