diff --git a/CHANGELOG.md b/CHANGELOG.md index 723b8b2..6ead9b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +2.3.3 + +- fixed: Bug with animation manager objects data + 2.3.2 - fixed: Bug with animation manager when there is empty object in scene diff --git a/__init__.py b/__init__.py index 61a04c4..2f9c377 100755 --- a/__init__.py +++ b/__init__.py @@ -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, 3, 2), +"version": (2, 3, 3), "blender": (3, 0, 0), "location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "warning": "", diff --git a/utils.py b/utils.py index 16e0c51..c68f286 100644 --- a/utils.py +++ b/utils.py @@ -1193,14 +1193,8 @@ def anim_status(objects) -> tuple((str, str)): on_count = off_count = count = 0 for o in objects: - ## Skip object with no animation - if not (o.animation_data and o.animation_data.action): - if o.type == 'EMPTY': - continue - if not (o.data.animation_data and o.data.animation_data.action): - continue - - ## Also skip hidden objects + + ## Skip hidden objects if o.hide_get() and o.hide_render: continue @@ -1212,32 +1206,37 @@ def anim_status(objects) -> tuple((str, str)): # off_count += 1 ### Consider All channels individually - for grp in o.animation_data.action.groups: - ## Check if groups are muted - if grp.mute: - off_count += 1 - else: - on_count += 1 - count += 1 + if o.animation_data and o.animation_data.action: + for grp in o.animation_data.action.groups: + ## Check if groups are muted + if grp.mute: + off_count += 1 + else: + on_count += 1 + count += 1 - for fcu in o.animation_data.action.fcurves: - ## Check if fcurves are muted - if fcu.mute: - off_count += 1 - else: - on_count += 1 - count += 1 + for fcu in o.animation_data.action.fcurves: + ## Check if fcurves are muted + if fcu.mute: + off_count += 1 + else: + on_count += 1 + count += 1 if o.type in ('GPENCIL', 'CAMERA'): - if o.data.animation_data and o.data.animation_data.action: - ## Check if object data attributes fcurves are muted - for fcu in o.animation_data.action.fcurves: - if fcu.mute: - off_count += 1 - else: - on_count += 1 - count += 1 + 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: + if fcu.mute: + off_count += 1 + else: + on_count += 1 + count += 1 if not on_count and not off_count: return ('BLANK1', 'BLANK1') # 'NONE'