Skip to content

Instantly share code, notes, and snippets.

@TheBlizWiz
Created July 14, 2021 15:54
Show Gist options
  • Save TheBlizWiz/17183139f06cc04df2226beca2feabea to your computer and use it in GitHub Desktop.
Save TheBlizWiz/17183139f06cc04df2226beca2feabea to your computer and use it in GitHub Desktop.
Blender script to take each of your keyframes in your timeline/dope sheet and turn them into pose library poses. Since it scans one frame at a time, tweening is preserved.
import bpy
start = bpy.context.scene.frame_start
end = bpy.context.scene.frame_end
# Corrects the name so that every action starts on frame 1
# If anim starts on keyframe 1, enter 0
# If anim starts on keyframe 0, enter -1
# Otherwise type in start - 1
offset = start - 1
# Enter the scene name inbetween the ""
# You can see it at the very top right, to the left of RenderLayer
# By default it just says Scene so type that in the ""
scene_name = ""
for x in range(start, end + 1):
bpy.data.scenes[scene_name].frame_set(x)
bpy.context.view_layer.update()
bpy.ops.poselib.pose_add(frame=(x))
bpy.context.view_layer.update()
bpy.types.ActionPoseMarkers.active_index = x
bpy.ops.poselib.pose_rename(name="F" + str(x - offset) + " Pose", pose="Pose")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment