diff --git a/io_scene_psk_psa/psa/builder.py b/io_scene_psk_psa/psa/builder.py index d2f50a5..f219df9 100644 --- a/io_scene_psk_psa/psa/builder.py +++ b/io_scene_psk_psa/psa/builder.py @@ -224,6 +224,10 @@ def build_psa(context: bpy.types.Context, options: PsaBuildOptions) -> Psa: export_sequence.name = f'{options.sequence_name_prefix}{export_sequence.name}{options.sequence_name_suffix}' export_sequence.name = export_sequence.name.strip() + # Save the current action and frame so that we can restore the state once we are done. + saved_frame_current = context.scene.frame_current + saved_action = animation_data.action + # Now build the PSA sequences. # We actually alter the timeline frame and simply record the resultant pose bone matrices. frame_start_index = 0 @@ -284,4 +288,8 @@ def build_psa(context: bpy.types.Context, options: PsaBuildOptions) -> Psa: psa.sequences[export_sequence.name] = psa_sequence + # Restore the previous action & frame. + animation_data.action = saved_action + context.scene.frame_set(saved_frame_current) + return psa