Skip to content

Commit 1d3ae4f

Browse files
authored
Merge pull request #353 from yabab/fix/animation-events-support
Fix/animation events support
2 parents 6301115 + 1c8434e commit 1d3ae4f

File tree

8 files changed

+1378
-19
lines changed

8 files changed

+1378
-19
lines changed

i_scene_cp77_gltf/animtools/__init__.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from bpy.props import (StringProperty, BoolProperty, IntProperty, CollectionProperty, FloatProperty)
99
from typing import Optional, Tuple
1010
import mathutils
11+
from .compat import get_action_fcurves
1112
from ..main.bartmoss_functions import *
1213
from ..cyber_props import cp77riglist
1314
from ..icons.cp77_icons import get_icon
@@ -21,6 +22,7 @@
2122
#from .jali_integration import *
2223
from .draw import (_handle, _running, _draw_callback)
2324
from . import root_motion
25+
from . import anim_events
2426

2527
def CP77AnimsList(self, context):
2628
for action in bpy.data.actions:
@@ -944,9 +946,13 @@ def execute(self, context):
944946
return {'CANCELLED'}
945947

946948
# Remove all F-curves
947-
fcurves_to_remove = list(action.fcurves)
949+
fcurves = get_action_fcurves(action)
950+
if fcurves is None:
951+
self.report({'INFO'}, 'No F-curves found (action has no fcurves collection).')
952+
return {'CANCELLED'}
953+
fcurves_to_remove = list(fcurves)
948954
for fc in fcurves_to_remove:
949-
action.fcurves.remove(fc)
955+
fcurves.remove(fc)
950956

951957
self.report({'INFO'}, f'Cleared {len(fcurves_to_remove)} F-curves.')
952958
return {'FINISHED'}
@@ -1677,6 +1683,9 @@ def register_animtools():
16771683
# Register root motion tools
16781684
root_motion.register_rm()
16791685

1686+
# Register animation events UI
1687+
anim_events.register_anim_events()
1688+
16801689
def unregister_animtools():
16811690
"""Unregister all animation tool classes"""
16821691

@@ -1690,6 +1699,9 @@ def unregister_animtools():
16901699
pass
16911700
_handle = None
16921701

1702+
# Unregister animation events UI
1703+
anim_events.unregister_anim_events()
1704+
16931705
# Unregister root motion tools
16941706
root_motion.unregister_rm()
16951707

0 commit comments

Comments
 (0)