Hey guys, I want to make a delay system for my python script which makes the armature move locations based on what it receives and I saw that python in blender does it all in one go and I can’t seem to find a way to make it run one loop at a time. Does anyone know how to add a delay/timer into a python script that works with blender?
Here is the code that I wish to delay:
index = 0
while index < (limit + 1):
bpy.ops.transform.translate(value=(listX[index], listY[index], listZ[index]), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1.61051)
index += 1
if index == limit:
break
I hope I made this question clear this is my first time posting on this website
By the way Is it wrong for me to use Cycle Render for armature movement or is it ok to use cycle renderer? - I have been using it for a few weeks now and It hasn’t cause many problems.
Oh and also the Blender Version I am using is 2.79 not 2.8
Update: I was able to solve after slaving away and thanks Secrop pointing in me the right direction it was simple as getting a keyframe gen to make a key frame with each iteration of the loop. Thanks Secrop!
Here is the code (Silly me) :
# This part moves the LArm bone using the variables from the lists (listX, listY, listZ)
index = 0
frame = 5
while index < (limit + 1):
bpy.ops.transform.translate(value=(listX[index], listY[index], listZ[index]), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1.61051)
index += 1
# Recirds the keyframe of the location of the armature moving in a plane (2D movement with a 3D model)
bpy.ops.anim.keyframe_insert_menu(type='Location')
# Sets the frame to always go up by two to make a smoother animation
frame = frame + 2
bpy.context.scene.frame_current = frame
# Breaks the loop and also is the end of the program
if index == limit:
break