Last active
September 30, 2023 17:10
-
-
Save bandinopla/4b8990c8e8e954712e727b572de588b6 to your computer and use it in GitHub Desktop.
Blender's F5 Flash equivalent
This file contains 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 | |
# Get the selected object | |
selected_object = bpy.context.object | |
# Check if an object is selected and it has an active action | |
if selected_object and selected_object.animation_data and selected_object.animation_data.action: | |
# Get the current frame marker position | |
current_frame = bpy.context.scene.frame_current | |
# Get the action and iterate through the F-Curves | |
action = selected_object.animation_data.action | |
for fcurve in action.fcurves: | |
# Iterate through the keyframes and move keyframes to the right by 1 frame | |
for keyframe in fcurve.keyframe_points: | |
if keyframe.co.x > current_frame: | |
keyframe.co.x += 1 | |
# Update the UI to reflect the changes | |
bpy.context.scene.update() | |
print("Keyframes moved to the right by 1 frame after the marker.") | |
else: | |
print("No valid object or active action found.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment