@@ -56,51 +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 ):
61- bone .visibility = value
62- bone .keyframe_insert (data_path = 'visibility' , frame = frame , options = creation_options )
61+ if bpy .app .version != (4 , 4 , 3 ): #TODO fix 4.4.3
62+ bone .visibility = value
63+ 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!' )
6366 else :
6467 bone .hide_viewport = bool (value )
6568 bone .keyframe_insert (data_path = 'hide_viewport' , frame = frame , options = creation_options )
6669
6770
68- def set_keyframe (bone , channel , frame , value ):
71+ def set_keyframe (context , bone , channel , frame , value ):
6972 if is_visibility (channel ):
70- set_visibility (bone , frame , value )
73+ set_visibility (context , bone , frame , value )
7174 elif is_translation (channel ):
7275 set_translation (bone , channel .type , frame , value )
7376 else :
7477 set_rotation (bone , frame , value )
7578
7679
77- def apply_timecoded (bone , channel ):
80+ def apply_timecoded (context , bone , channel ):
7881 for key in channel .time_codes :
79- set_keyframe (bone , channel , key .time_code , key .value )
82+ set_keyframe (context , bone , channel , key .time_code , key .value )
8083
8184
82- def apply_motion_channel_time_coded (bone , channel ):
85+ def apply_motion_channel_time_coded (context , bone , channel ):
8386 for datum in channel .data :
84- set_keyframe (bone , channel , datum .time_code , datum .value )
87+ set_keyframe (context , bone , channel , datum .time_code , datum .value )
8588
8689
87- def apply_motion_channel_adaptive_delta (bone , channel ):
90+ def apply_motion_channel_adaptive_delta (context , bone , channel ):
8891 data = decode (channel .type , channel .vector_len , channel .num_time_codes , channel .data .scale , channel .data .data )
8992 for i in range (channel .num_time_codes ):
90- set_keyframe (bone , channel , i , data [i ])
93+ set_keyframe (context , bone , channel , i , data [i ])
9194
9295
93- def apply_adaptive_delta (bone , channel ):
96+ def apply_adaptive_delta (context , bone , channel ):
9497 data = decode (channel .type , channel .vector_len , channel .num_time_codes , channel .scale , channel .data )
9598 for i in range (channel .num_time_codes ):
96- set_keyframe (bone , channel , i , data [i ])
99+ set_keyframe (context , bone , channel , i , data [i ])
97100
98101
99- def apply_uncompressed (bone , channel ):
102+ def apply_uncompressed (context , bone , channel ):
100103 for index in range (channel .last_frame - channel .first_frame + 1 ):
101104 data = channel .data [index ]
102105 frame = index + channel .first_frame
103- set_keyframe (bone , channel , frame , data )
106+ set_keyframe (context , bone , channel , frame , data )
104107
105108
106109def process_channels (context , hierarchy , channels , rig , apply_func ):
@@ -109,7 +112,7 @@ def process_channels(context, hierarchy, channels, rig, apply_func):
109112 if obj is None :
110113 continue
111114
112- apply_func (obj , channel )
115+ apply_func (context , obj , channel )
113116
114117
115118def process_motion_channels (context , hierarchy , channels , rig ):
@@ -119,9 +122,9 @@ def process_motion_channels(context, hierarchy, channels, rig):
119122 continue
120123
121124 if channel .delta_type == 0 :
122- apply_motion_channel_time_coded (obj , channel )
125+ apply_motion_channel_time_coded (context , obj , channel )
123126 else :
124- apply_motion_channel_adaptive_delta (obj , channel )
127+ apply_motion_channel_adaptive_delta (context , obj , channel )
125128
126129
127130def create_animation (context , rig , animation , hierarchy ):
0 commit comments