fix gp layer navigation autofade
2.0.7 - fix: broken auto-fade with gp layer navigation when used with a customized shortcut. - changed: supported version number to 3.0.0gpv2
parent
02d13c6f29
commit
515ba4aa9f
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
2.0.7
|
||||
|
||||
- fix: broken auto-fade with gp layer navigation when used with a customized shortcut.
|
||||
- changed: supported version number to 3.0.0
|
||||
|
||||
2.0.6
|
||||
|
||||
- changed: Use prefixes toggle is enabled by default
|
||||
|
|
|
@ -9,8 +9,8 @@ class GPT_OT_layer_nav(bpy.types.Operator):
|
|||
|
||||
direction : bpy.props.EnumProperty(
|
||||
name='direction',
|
||||
items=(('NONE', 'None', ''),('UP', 'Up', ''),('DOWN', 'Down', '')),
|
||||
default='NONE',
|
||||
items=(('UP', 'Up', ''),('DOWN', 'Down', ''), ('NONE', 'None', '')),
|
||||
default='UP',
|
||||
description='Direction to change layer in active GPencil stack',
|
||||
options={'SKIP_SAVE'})
|
||||
|
||||
|
@ -24,14 +24,24 @@ class GPT_OT_layer_nav(bpy.types.Operator):
|
|||
def invoke(self, context, event):
|
||||
## initialise vvalue from prefs
|
||||
prefs = utils.get_addon_prefs()
|
||||
|
||||
if not prefs.nav_use_fade:
|
||||
if self.direction == 'DOWN' or (event.type == 'PAGE_DOWN' and event.value == 'PRESS'):
|
||||
if self.direction == 'DOWN':
|
||||
utils.iterate_selector(context.object.data.layers, 'active_index', -1, info_attr = 'info')
|
||||
|
||||
if self.direction == 'UP' or (event.type == 'PAGE_UP' and event.value == 'PRESS'):
|
||||
if self.direction == 'UP':
|
||||
utils.iterate_selector(context.object.data.layers, 'active_index', 1, info_attr = 'info')
|
||||
return {'FINISHED'}
|
||||
|
||||
## get up and down keys for use in modal
|
||||
self.up_keys = []
|
||||
self.down_keys = []
|
||||
for km in context.window_manager.keyconfigs.user.keymaps:
|
||||
for kmi in km.keymap_items:
|
||||
if kmi.idname == 'gp.layer_nav':
|
||||
if kmi.properties.direction == 'UP':
|
||||
self.up_keys.append(kmi.type)
|
||||
elif kmi.properties.direction == 'DOWN':
|
||||
self.down_keys.append(kmi.type)
|
||||
|
||||
self.interval = prefs.nav_interval
|
||||
self.limit = prefs.nav_limit
|
||||
|
@ -51,7 +61,7 @@ class GPT_OT_layer_nav(bpy.types.Operator):
|
|||
self.fade_start = self.limit - self.fade_in_time
|
||||
|
||||
self.first = True
|
||||
self._timer = wm.event_timer_add(self.interval, window=context.window) # 0.1
|
||||
self._timer = wm.event_timer_add(self.interval, window=context.window)
|
||||
wm.modal_handler_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
|
@ -79,12 +89,12 @@ class GPT_OT_layer_nav(bpy.types.Operator):
|
|||
fade = utils.transfer_value(self.lapse, self.fade_start, self.limit, self.fade_val, self.fade_target)
|
||||
# print(f'lapse {self.lapse} - fade {fade}')
|
||||
context.space_data.overlay.gpencil_fade_layer = fade
|
||||
|
||||
if self.direction == 'DOWN' or (event.type == 'PAGE_DOWN' and event.value == 'PRESS'):
|
||||
|
||||
if self.direction == 'DOWN' or ((event.type in self.down_keys) and event.value == 'PRESS'):
|
||||
_val = utils.iterate_selector(context.object.data.layers, 'active_index', -1, info_attr = 'info')
|
||||
trigger = True
|
||||
|
||||
if self.direction == 'UP' or (event.type == 'PAGE_UP' and event.value == 'PRESS'):
|
||||
if self.direction == 'UP' or ((event.type in self.up_keys) and event.value == 'PRESS'):
|
||||
_val = utils.iterate_selector(context.object.data.layers, 'active_index', 1, info_attr = 'info')
|
||||
# utils.iterate_selector(bpy.context.scene.grease_pencil.layers, 'active_index', 1, info_attr = 'info')#layers
|
||||
trigger = True
|
||||
|
|
|
@ -4,8 +4,8 @@ bl_info = {
|
|||
"name": "GP toolbox",
|
||||
"description": "Tool set for Grease Pencil in animation production",
|
||||
"author": "Samuel Bernou, Christophe Seux",
|
||||
"version": (2, 0, 6),
|
||||
"blender": (2, 91, 0),
|
||||
"version": (2, 0, 7),
|
||||
"blender": (3, 0, 0),
|
||||
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
|
||||
"warning": "",
|
||||
"doc_url": "https://gitlab.com/autour-de-minuit/blender/gp_toolbox",
|
||||
|
|
Loading…
Reference in New Issue