bugfix animation data ui

2.3.3

- fixed: Bug with animation manager objects data
gpv2
pullusb 2023-05-03 12:16:15 +02:00
parent 990b18f665
commit 2191be97cb
3 changed files with 34 additions and 31 deletions

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
2.3.3
- fixed: Bug with animation manager objects data
2.3.2 2.3.2
- fixed: Bug with animation manager when there is empty object in scene - fixed: Bug with animation manager when there is empty object in scene

View File

@ -4,7 +4,7 @@ bl_info = {
"name": "GP toolbox", "name": "GP toolbox",
"description": "Tool set for Grease Pencil in animation production", "description": "Tool set for Grease Pencil in animation production",
"author": "Samuel Bernou, Christophe Seux", "author": "Samuel Bernou, Christophe Seux",
"version": (2, 3, 2), "version": (2, 3, 3),
"blender": (3, 0, 0), "blender": (3, 0, 0),
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
"warning": "", "warning": "",

View File

@ -1193,14 +1193,8 @@ def anim_status(objects) -> tuple((str, str)):
on_count = off_count = count = 0 on_count = off_count = count = 0
for o in objects: 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: if o.hide_get() and o.hide_render:
continue continue
@ -1212,32 +1206,37 @@ def anim_status(objects) -> tuple((str, str)):
# off_count += 1 # off_count += 1
### Consider All channels individually ### Consider All channels individually
for grp in o.animation_data.action.groups: if o.animation_data and o.animation_data.action:
## Check if groups are muted for grp in o.animation_data.action.groups:
if grp.mute: ## Check if groups are muted
off_count += 1 if grp.mute:
else: off_count += 1
on_count += 1 else:
count += 1 on_count += 1
count += 1
for fcu in o.animation_data.action.fcurves: for fcu in o.animation_data.action.fcurves:
## Check if fcurves are muted ## Check if fcurves are muted
if fcu.mute: if fcu.mute:
off_count += 1 off_count += 1
else: else:
on_count += 1 on_count += 1
count += 1 count += 1
if o.type in ('GPENCIL', 'CAMERA'): if o.type in ('GPENCIL', 'CAMERA'):
if o.data.animation_data and o.data.animation_data.action: datablock = o.data
## Check if object data attributes fcurves are muted if datablock.animation_data is None:
for fcu in o.animation_data.action.fcurves: continue
if fcu.mute: if not datablock.animation_data.action:
off_count += 1 continue
else: ## Check if object data attributes fcurves are muted
on_count += 1 for fcu in datablock.animation_data.action.fcurves:
count += 1 if fcu.mute:
off_count += 1
else:
on_count += 1
count += 1
if not on_count and not off_count: if not on_count and not off_count:
return ('BLANK1', 'BLANK1') # 'NONE' return ('BLANK1', 'BLANK1') # 'NONE'