Update for blender 5+ with retro-compatibility

- Added version check to keep addon compatible with previous version
- Some feature are still broken (e.g: realign, broken since 4.3's gpv3)
- note: DIR_PATH string property do not accept relative path since Blender 5.0.
preferences brush_path,output_path and playblast_path had "//" by default. those props are turned to stnadard string for now
This commit is contained in:
Pullusb
2025-12-15 23:57:57 +01:00
parent 9fd3b4af83
commit 9d2644eb9f
11 changed files with 153 additions and 107 deletions
+22 -34
View File
@@ -421,12 +421,12 @@ class GPTB_OT_toggle_mute_animation(Operator):
self.selection = event.shift
return self.execute(context)
def set_action_mute(self, act):
for i, fcu in enumerate(act.fcurves):
def set_action_mute(self, bag):
for i, fcu in enumerate(bag.fcurves):
print(i, fcu.data_path, fcu.array_index)
# fcu.group don't have mute attribute in api.
fcu.mute = self.mute
for g in act.groups:
for g in bag.groups:
g.mute = self.mute
def execute(self, context):
@@ -443,22 +443,15 @@ class GPTB_OT_toggle_mute_animation(Operator):
if self.mode == 'CAMERA' and o.type != 'CAMERA':
continue
# mute attribute animation for GP and cameras
## Mute attribute animation for GP and cameras
if o.type in ('GREASEPENCIL', 'CAMERA') and o.data.animation_data:
gp_act = o.data.animation_data.action
if gp_act:
if data_channelbag := utils.get_active_channelbag(o.data):
print(f'\n---{o.name} data:')
self.set_action_mute(gp_act)
self.set_action_mute(data_channelbag)
if not o.animation_data:
continue
act = o.animation_data.action
if not act:
continue
print(f'\n---{o.name}:')
self.set_action_mute(act)
if object_channelbag := utils.get_active_channelbag(o):
print(f'\n---{o.name}:')
self.set_action_mute(object_channelbag)
return {'FINISHED'}
@@ -495,7 +488,7 @@ class GPTB_OT_toggle_hide_gp_modifier(Operator):
class GPTB_OT_list_disabled_anims(Operator):
bl_idname = "gp.list_disabled_anims"
bl_label = "List Disabled Anims"
bl_description = "List disabled animations channels in scene. (shit+clic to list only on seleciton)"
bl_description = "List disabled animations channels in scene. (shit+clic to list only on selection)"
bl_options = {"REGISTER"}
mute : bpy.props.BoolProperty(default=False)
@@ -521,27 +514,22 @@ class GPTB_OT_list_disabled_anims(Operator):
# continue
if o.type == 'GREASEPENCIL':
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
if not act:
continue
if fcurves := utils.get_fcurves(o.data):
for i, fcu in enumerate(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}')
for g in act.groups:
bag = utils.get_active_channelbag(o)
if not bag:
continue
for g in bag.groups:
if g.mute:
li.append(f'{o.name} - group: {g.name}')
for i, fcu in enumerate(act.fcurves):
for i, fcu in enumerate(bag.fcurves):
# print(i, fcu.data_path, fcu.array_index)
if fcu.mute:
if o not in oblist: