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
This commit is contained in:
Pullusb
2022-03-05 15:36:01 +01:00
parent 26c71f7bb3
commit f36b31e3aa
3 changed files with 29 additions and 11 deletions
+23 -10
View File
@@ -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: