@@ -56,52 +56,54 @@ def set_rotation(bone, frame, value):
5656 bone .keyframe_insert (data_path = 'rotation_quaternion' , frame = frame )
5757
5858
59- def set_visibility (bone , frame , value ):
59+ def set_visibility (context , bone , frame , value ):
6060 if isinstance (bone , bpy .types .Bone ):
6161 if bpy .app .version != (4 , 4 , 3 ): #TODO fix 4.4.3
6262 bone .visibility = value
6363 bone .keyframe_insert (data_path = 'visibility' , frame = frame , options = creation_options )
64+ else :
65+ context .warning (f'bone visibility channels are currently not supported for blender 4.4.3!' )
6466 else :
6567 bone .hide_viewport = bool (value )
6668 bone .keyframe_insert (data_path = 'hide_viewport' , frame = frame , options = creation_options )
6769
6870
69- def set_keyframe (bone , channel , frame , value ):
71+ def set_keyframe (context , bone , channel , frame , value ):
7072 if is_visibility (channel ):
71- set_visibility (bone , frame , value )
73+ set_visibility (context , bone , frame , value )
7274 elif is_translation (channel ):
7375 set_translation (bone , channel .type , frame , value )
7476 else :
7577 set_rotation (bone , frame , value )
7678
7779
78- def apply_timecoded (bone , channel ):
80+ def apply_timecoded (context , bone , channel ):
7981 for key in channel .time_codes :
80- set_keyframe (bone , channel , key .time_code , key .value )
82+ set_keyframe (context , bone , channel , key .time_code , key .value )
8183
8284
83- def apply_motion_channel_time_coded (bone , channel ):
85+ def apply_motion_channel_time_coded (context , bone , channel ):
8486 for datum in channel .data :
85- set_keyframe (bone , channel , datum .time_code , datum .value )
87+ set_keyframe (context , bone , channel , datum .time_code , datum .value )
8688
8789
88- def apply_motion_channel_adaptive_delta (bone , channel ):
90+ def apply_motion_channel_adaptive_delta (context , bone , channel ):
8991 data = decode (channel .type , channel .vector_len , channel .num_time_codes , channel .data .scale , channel .data .data )
9092 for i in range (channel .num_time_codes ):
91- set_keyframe (bone , channel , i , data [i ])
93+ set_keyframe (context , bone , channel , i , data [i ])
9294
9395
94- def apply_adaptive_delta (bone , channel ):
96+ def apply_adaptive_delta (context , bone , channel ):
9597 data = decode (channel .type , channel .vector_len , channel .num_time_codes , channel .scale , channel .data )
9698 for i in range (channel .num_time_codes ):
97- set_keyframe (bone , channel , i , data [i ])
99+ set_keyframe (context , bone , channel , i , data [i ])
98100
99101
100- def apply_uncompressed (bone , channel ):
102+ def apply_uncompressed (context , bone , channel ):
101103 for index in range (channel .last_frame - channel .first_frame + 1 ):
102104 data = channel .data [index ]
103105 frame = index + channel .first_frame
104- set_keyframe (bone , channel , frame , data )
106+ set_keyframe (context , bone , channel , frame , data )
105107
106108
107109def process_channels (context , hierarchy , channels , rig , apply_func ):
@@ -110,7 +112,7 @@ def process_channels(context, hierarchy, channels, rig, apply_func):
110112 if obj is None :
111113 continue
112114
113- apply_func (obj , channel )
115+ apply_func (context , obj , channel )
114116
115117
116118def process_motion_channels (context , hierarchy , channels , rig ):
@@ -120,9 +122,9 @@ def process_motion_channels(context, hierarchy, channels, rig):
120122 continue
121123
122124 if channel .delta_type == 0 :
123- apply_motion_channel_time_coded (obj , channel )
125+ apply_motion_channel_time_coded (context , obj , channel )
124126 else :
125- apply_motion_channel_adaptive_delta (obj , channel )
127+ apply_motion_channel_adaptive_delta (context , obj , channel )
126128
127129
128130def create_animation (context , rig , animation , hierarchy ):
0 commit comments