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
|
# 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
|
2.0.6
|
||||||
|
|
||||||
- changed: Use prefixes toggle is enabled by default
|
- changed: Use prefixes toggle is enabled by default
|
||||||
|
|
|
@ -9,8 +9,8 @@ class GPT_OT_layer_nav(bpy.types.Operator):
|
||||||
|
|
||||||
direction : bpy.props.EnumProperty(
|
direction : bpy.props.EnumProperty(
|
||||||
name='direction',
|
name='direction',
|
||||||
items=(('NONE', 'None', ''),('UP', 'Up', ''),('DOWN', 'Down', '')),
|
items=(('UP', 'Up', ''),('DOWN', 'Down', ''), ('NONE', 'None', '')),
|
||||||
default='NONE',
|
default='UP',
|
||||||
description='Direction to change layer in active GPencil stack',
|
description='Direction to change layer in active GPencil stack',
|
||||||
options={'SKIP_SAVE'})
|
options={'SKIP_SAVE'})
|
||||||
|
|
||||||
|
@ -24,14 +24,24 @@ class GPT_OT_layer_nav(bpy.types.Operator):
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
## initialise vvalue from prefs
|
## initialise vvalue from prefs
|
||||||
prefs = utils.get_addon_prefs()
|
prefs = utils.get_addon_prefs()
|
||||||
|
|
||||||
if not prefs.nav_use_fade:
|
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')
|
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')
|
utils.iterate_selector(context.object.data.layers, 'active_index', 1, info_attr = 'info')
|
||||||
return {'FINISHED'}
|
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.interval = prefs.nav_interval
|
||||||
self.limit = prefs.nav_limit
|
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.fade_start = self.limit - self.fade_in_time
|
||||||
|
|
||||||
self.first = True
|
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)
|
wm.modal_handler_add(self)
|
||||||
return {'RUNNING_MODAL'}
|
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)
|
fade = utils.transfer_value(self.lapse, self.fade_start, self.limit, self.fade_val, self.fade_target)
|
||||||
# print(f'lapse {self.lapse} - fade {fade}')
|
# print(f'lapse {self.lapse} - fade {fade}')
|
||||||
context.space_data.overlay.gpencil_fade_layer = 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')
|
_val = utils.iterate_selector(context.object.data.layers, 'active_index', -1, info_attr = 'info')
|
||||||
trigger = True
|
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')
|
_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
|
# utils.iterate_selector(bpy.context.scene.grease_pencil.layers, 'active_index', 1, info_attr = 'info')#layers
|
||||||
trigger = True
|
trigger = True
|
||||||
|
|
|
@ -4,8 +4,8 @@ bl_info = {
|
||||||
"name": "GP toolbox",
|
"name": "GP toolbox",
|
||||||
"description": "Tool set for Grease Pencil in animation production",
|
"description": "Tool set for Grease Pencil in animation production",
|
||||||
"author": "Samuel Bernou, Christophe Seux",
|
"author": "Samuel Bernou, Christophe Seux",
|
||||||
"version": (2, 0, 6),
|
"version": (2, 0, 7),
|
||||||
"blender": (2, 91, 0),
|
"blender": (3, 0, 0),
|
||||||
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
|
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
"doc_url": "https://gitlab.com/autour-de-minuit/blender/gp_toolbox",
|
"doc_url": "https://gitlab.com/autour-de-minuit/blender/gp_toolbox",
|
||||||
|
|
Loading…
Reference in New Issue