enbable msgbus at first activation
2.1.4 - fixed: layer change msgbus not working at first activation of the addongpv2
parent
b370dd7344
commit
5d55afcf4d
|
@ -1,6 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
|
||||
2.1.4
|
||||
|
||||
- fixed: layer change msgbus not working at first activation of the addon
|
||||
|
||||
2.1.3
|
||||
|
||||
- fixed: decoralate Prefix and Suffix UI_lists scroll
|
||||
|
|
|
@ -675,8 +675,8 @@ def obj_layer_name_callback():
|
|||
# print('inc:', res.group('inc'))
|
||||
bpy.context.scene.gptoolprops['layer_name'] = res.group('name')
|
||||
|
||||
@persistent
|
||||
def subscribe_handler(dummy):
|
||||
|
||||
def subscribe_layer_change():
|
||||
subscribe_to = (bpy.types.GreasePencilLayers, "active_index")
|
||||
bpy.msgbus.subscribe_rna(
|
||||
key=subscribe_to,
|
||||
|
@ -690,6 +690,9 @@ def subscribe_handler(dummy):
|
|||
options={'PERSISTENT'},
|
||||
)
|
||||
|
||||
@persistent
|
||||
def subscribe_layer_change_handler(dummy):
|
||||
subscribe_layer_change()
|
||||
|
||||
##--- Add layers
|
||||
|
||||
|
@ -813,12 +816,15 @@ def register():
|
|||
bpy.types.DATA_PT_gpencil_layers.prepend(layer_name_builder_ui)
|
||||
bpy.types.DOPESHEET_HT_header.append(gpencil_dopesheet_header)
|
||||
bpy.types.GPENCIL_MT_layer_context_menu.append(gpencil_layer_dropdown_menu)
|
||||
bpy.app.handlers.load_post.append(subscribe_handler) # need to restart after first activation
|
||||
bpy.app.handlers.load_post.append(subscribe_layer_change_handler)
|
||||
register_keymaps()
|
||||
|
||||
# Directly set msgbus to work at first addon activation
|
||||
bpy.app.timers.register(subscribe_layer_change, first_interval=1)
|
||||
|
||||
def unregister():
|
||||
unregister_keymaps()
|
||||
bpy.app.handlers.load_post.remove(subscribe_handler)
|
||||
bpy.app.handlers.load_post.remove(subscribe_layer_change_handler)
|
||||
bpy.types.GPENCIL_MT_layer_context_menu.remove(gpencil_layer_dropdown_menu)
|
||||
bpy.types.DOPESHEET_HT_header.remove(gpencil_dopesheet_header)
|
||||
bpy.types.DATA_PT_gpencil_layers.remove(layer_name_builder_ui)
|
||||
|
|
|
@ -4,7 +4,7 @@ bl_info = {
|
|||
"name": "GP toolbox",
|
||||
"description": "Tool set for Grease Pencil in animation production",
|
||||
"author": "Samuel Bernou, Christophe Seux",
|
||||
"version": (2, 1, 3),
|
||||
"version": (2, 1, 4),
|
||||
"blender": (3, 0, 0),
|
||||
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
|
||||
"warning": "",
|
||||
|
|
Loading…
Reference in New Issue