From f36b31e3aaf72383636bf6032c870f1c91e3161b Mon Sep 17 00:00:00 2001 From: Pullusb Date: Sat, 5 Mar 2022 15:36:01 +0100 Subject: [PATCH] completed fix #5 for gp layer data action toggle 1.9.9 - fix: Bug setting GP layers actions on/off - fix: Add GP layers animation datas in `list disabled animation` report --- CHANGELOG.md | 5 +++++ OP_helpers.py | 33 +++++++++++++++++++++++---------- __init__.py | 2 +- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3466cb9..720d1f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +1.9.9 + +- fix: Bug setting GP layers actions on/off +- fix: Add GP layers animation datas in `list disabled animation` report + 1.9.8 - fix: animation manager `GP anim on/off` also toggle layers animation datas diff --git a/OP_helpers.py b/OP_helpers.py index 4007f6f..b1a98f8 100644 --- a/OP_helpers.py +++ b/OP_helpers.py @@ -377,14 +377,13 @@ class GPTB_OT_toggle_mute_animation(bpy.types.Operator): self.selection = event.shift return self.execute(context) - def disable_action(self, act): + def set_action_mute(self, act): for i, fcu in enumerate(act.fcurves): print(i, fcu.data_path, fcu.array_index) # fcu.group don't have mute attribute in api. fcu.mute = self.mute def execute(self, context): - if self.selection: pool = context.selected_objects else: @@ -395,6 +394,12 @@ class GPTB_OT_toggle_mute_animation(bpy.types.Operator): continue if self.skip_obj and o.type != 'GPENCIL': continue + + if o.type == 'GPENCIL' and o.data.animation_data: + gp_act = o.data.animation_data.action + if gp_act: + print(f'\n---{o.name} data:') + self.set_action_mute(gp_act) if not o.animation_data: continue @@ -402,12 +407,9 @@ class GPTB_OT_toggle_mute_animation(bpy.types.Operator): if not act: continue - self.disable_action(act) + print(f'\n---{o.name}:') + self.set_action_mute(act) - if o.type == 'GPENCIL' and o.data.animation_data: - gp_act = o.data.animation_data.action - if gp_act: - self.disable_action(gp_act) return {'FINISHED'} @@ -466,6 +468,18 @@ class GPTB_OT_list_disabled_anims(bpy.types.Operator): # continue # if self.skip_obj and o.type != 'GPENCIL': # continue + + if o.type == 'GPENCIL': + if o.data.animation_data: + gp_act = o.data.animation_data.action + if gp_act: + for i, fcu in enumerate(gp_act.fcurves): + if fcu.mute: + if o not in oblist: + oblist.append(o) + li.append(f'{o.name}:') + li.append(f' - {fcu.data_path} {fcu.array_index}') + if not o.animation_data: continue act = o.animation_data.action @@ -476,9 +490,8 @@ class GPTB_OT_list_disabled_anims(bpy.types.Operator): if fcu.mute: if o not in oblist: oblist.append(o) - li.append(f'{o.name} : {fcu.data_path} {fcu.array_index}') - else: - li.append(f'{" "*len(o.name)} - {fcu.data_path} {fcu.array_index}') + li.append(f'{o.name}:') + li.append(f' - {fcu.data_path} {fcu.array_index}') if li: utils.show_message_box(li) else: diff --git a/__init__.py b/__init__.py index b034a2b..09af306 100755 --- a/__init__.py +++ b/__init__.py @@ -15,7 +15,7 @@ bl_info = { "name": "GP toolbox", "description": "Tool set for Grease Pencil in animation production", "author": "Samuel Bernou, Christophe Seux", -"version": (1, 9, 8), +"version": (1, 9, 9), "blender": (2, 91, 0), "location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "warning": "",