Last active
February 13, 2023 16:31
-
-
Save amelkor/39e2942838f379b0d0569b2ea65c3690 to your computer and use it in GitHub Desktop.
Blender loop actions which contain specified words by duplicating the first frame
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| actions_to_check = ["Walk", "Wait", "Run"] | |
| def duplicate_frames(action): | |
| start_frame = action.frame_range[0] | |
| end_frame = action.frame_range[1] | |
| new_frame = end_frame + 1 | |
| for fcurve in action.fcurves: | |
| fcurve.keyframe_points.insert(frame=new_frame, value=fcurve.evaluate(start_frame)) | |
| for action in bpy.data.actions: | |
| action_name = action.name.lower() | |
| if any(keyword.lower() in action.name for keyword in actions_to_check): | |
| duplicate_frames(action) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment