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
+47
View File
@@ -1104,6 +1104,11 @@ def create_follow_path_constraint(ob, curve, follow_curve=False, use_fixed_locat
# const.use_curve_follow = True
# return curve, const
# -----------------
### Object
# -----------------
def go_edit_mode(ob, context=None):
'''set mode to object, set passed obhject as active and go Edit'''
@@ -1113,3 +1118,45 @@ def go_edit_mode(ob, context=None):
context.view_layer.objects.active = ob
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
def all_anim_enabled(objects) -> bool:
'''return False if at least one fcurve/group has disabled animation in passed object anim'''
for o in objects:
if o.animation_data and o.animation_data.action:
## Skip hided object ?
# if o.hide_get():
# continue
## Check if groups are muted
for grp in o.animation_data.action.groups:
if grp.mute:
return False
## Check if fcurves are muted
for fcu in o.animation_data.action.fcurves:
if fcu.mute:
return False
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:
return False
return True
def all_object_modifier_enabled(objects) -> bool:
'''Return False if one modifier of one object has GP modifier disabled in viewport but enabled in render'''
for o in objects:
if o.type != 'GPENCIL':
continue
for m in o.grease_pencil_modifiers:
if m.show_render and not m.show_viewport:
return False
## return False when viewport but no render ?
# if not m.show_render and m.show_viewport:
# return False
return True