Anim manager alert when anim off and affect groups

2.3.0

- added: Animation manager buttons are colored red when objects have disabled animation
- fixed: Animation manager not enabling/disabling Action Groups
- fixed: Animation manager `List Disabled Anims` list groups as well
This commit is contained in:
pullusb
2023-03-09 14:52:58 +01:00
parent 9a49175859
commit 7e92ae182e
5 changed files with 92 additions and 35 deletions
+28 -33
View File
@@ -1,9 +1,10 @@
# from . import addon_updater_ops
from .utils import get_addon_prefs
from .utils import get_addon_prefs, all_anim_enabled, all_object_modifier_enabled
import bpy
from pathlib import Path
from bpy.types import Panel
## UI in properties
### dataprop_panel not used --> transferred to sidebar
@@ -183,49 +184,41 @@ class GPTB_PT_anim_manager(Panel):
layout.use_property_split = True
col = layout.column()
## Animation enable disable anim (shift click to select) OP_helpers.GPTB_OT_toggle_mute_animation
# import time
# t0 = time.time()
scn = context.scene
objs = [o for o in scn.objects if o.type not in ('GPENCIL', 'CAMERA')] # show_alert
gps = [o for o in scn.objects if o.type == 'GPENCIL'] # show_alert
cams = [o for o in scn.objects if o.type == 'CAMERA'] # show_alert
col.operator('gp.list_disabled_anims')
## Objs
row = col.row(align=True)
row.label(text='Obj anims:')
ops = row.operator('gp.toggle_mute_animation', text = 'ON')
ops.mode = 'OBJECT'
ops.mute = False
ops = row.operator('gp.toggle_mute_animation', text = 'OFF')
ops.mode = 'OBJECT'
ops.mute = True
## Cams
row = col.row(align=True)
row.label(text='Cam anims:')
ops = row.operator('gp.toggle_mute_animation', text = 'ON')
ops.mode = 'CAMERA'
ops.mute = False
ops = row.operator('gp.toggle_mute_animation', text = 'OFF')
ops.mode = 'CAMERA'
ops.mute = True
## GPs
row = col.row(align=True)
row.label(text='Gp anims:')
ops = row.operator('gp.toggle_mute_animation', text = 'ON')
ops.mode = 'GPENCIL'
ops.mute = False
ops = row.operator('gp.toggle_mute_animation', text = 'OFF')
ops.mode = 'GPENCIL'
ops.mute = True
## Show Enable / Disable
for cat, cat_type, tgt in [('Obj anims:', 'OBJECT', objs), ('Cam anims:', 'CAMERA', cams), ('Gp anims:', 'GPENCIL', gps)]:
subcol = col.column()
subcol.alert = not all_anim_enabled(tgt) # show_alert
row = subcol.row(align=True)
row.label(text=cat)
ops = row.operator('gp.toggle_mute_animation', text = 'ON')
ops.mode = cat_type
ops.mute = False
ops = row.operator('gp.toggle_mute_animation', text = 'OFF')
ops.mode = cat_type
ops.mute = True
## GP modifiers
row = col.row(align=True)
subcol = col.column()
subcol.alert = not all_object_modifier_enabled(gps) # show_alert
row = subcol.row(align=True)
row.label(text='Gp modifiers:')
row.operator('gp.toggle_hide_gp_modifier', text = 'ON').show = True
row.operator('gp.toggle_hide_gp_modifier', text = 'OFF').show = False
## Follow curve path
col = col.column()
row = col.row(align=True)
# row.operator('object.create_follow_path_curve', text='Create Curve', icon='CURVE_BEZCURVE')
@@ -254,6 +247,8 @@ class GPTB_PT_anim_manager(Panel):
col.use_property_split = False
text, icon = ('Cursor Follow On', 'PIVOT_CURSOR') if context.scene.gptoolprops.cursor_follow else ('Cursor Follow Off', 'CURSOR')
col.prop(context.scene.gptoolprops, 'cursor_follow', text=text, icon=icon)
# print(f'{time.time() - t0:.6f}s')
class GPTB_PT_toolbox_playblast(Panel):
bl_label = "Playblast"