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:
@@ -1485,6 +1485,30 @@ def has_fully_enabled_anim(o):
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_fcurves(obj):
|
||||
'''return f-curves of object's active action'''
|
||||
if bpy.app.version >= (5, 0, 0):
|
||||
# action slot
|
||||
if obj.animation_data and obj.animation_data.action_slot:
|
||||
active_slot = obj.animation_data.action_slot
|
||||
return active_slot.id_data.layers[0].strips[0].channelbag(active_slot).fcurves
|
||||
else:
|
||||
if obj.animation_data and obj.animation_data.action:
|
||||
return obj.animation_data.action.fcurves
|
||||
return []
|
||||
|
||||
def get_active_channelbag(obj):
|
||||
'''return active channelbag in blender 5, else action'''
|
||||
if bpy.app.version >= (5, 0, 0):
|
||||
# action slot
|
||||
if obj.animation_data and obj.animation_data.action_slot:
|
||||
active_slot = obj.animation_data.action_slot
|
||||
return active_slot.id_data.layers[0].strips[0].channelbag(active_slot)
|
||||
else:
|
||||
if obj.animation_data and obj.animation_data.action:
|
||||
return obj.animation_data.action
|
||||
|
||||
|
||||
def anim_status(objects) -> tuple((str, str)):
|
||||
'''Return a tutple of icon string status in ('ALL_ON', 'MIXED', 'ALL_OFF', 'NONE')'''
|
||||
|
||||
@@ -1504,8 +1528,9 @@ def anim_status(objects) -> tuple((str, str)):
|
||||
# off_count += 1
|
||||
|
||||
### Consider All channels individually
|
||||
if o.animation_data and o.animation_data.action:
|
||||
for grp in o.animation_data.action.groups:
|
||||
|
||||
if channelbag := get_active_channelbag(o):
|
||||
for grp in channelbag.groups:
|
||||
## Check if groups are muted
|
||||
if grp.mute:
|
||||
off_count += 1
|
||||
@@ -1514,7 +1539,7 @@ def anim_status(objects) -> tuple((str, str)):
|
||||
count += 1
|
||||
|
||||
|
||||
for fcu in o.animation_data.action.fcurves:
|
||||
for fcu in channelbag.fcurves:
|
||||
## Check if fcurves are muted
|
||||
if fcu.mute:
|
||||
off_count += 1
|
||||
@@ -1524,12 +1549,8 @@ def anim_status(objects) -> tuple((str, str)):
|
||||
|
||||
if o.type in ('GREASEPENCIL', 'CAMERA'):
|
||||
datablock = o.data
|
||||
if datablock.animation_data is None:
|
||||
continue
|
||||
if not datablock.animation_data.action:
|
||||
continue
|
||||
## Check if object data attributes fcurves are muted
|
||||
for fcu in datablock.animation_data.action.fcurves:
|
||||
for fcu in get_fcurves(datablock):
|
||||
if fcu.mute:
|
||||
off_count += 1
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user