I am currently using blender 2.8 and I am trying to make a scripted animation where I move a set of cubes from one end to the other on the x-axis with delays in between animations. This isn't really a real animation because I am not using the timeline. I am trying to create a real-time demo of a personal project. If you look below I want to make the collection of cubes to travel to the right in delayed steps. My current script is like this:
import time collection = bpy.data.collections["layer_1_filters"].objects # I grouped the 5x5 cube grid to the collection called "layer_1_filters" for steps in range(23): #steps to the right 23 times for cube in collection: # loop each cube cube.location = cube.location + 3 # move all the cubes to the right by 3 on the x-axis time.sleep(0.3) # pause 0.3 seconds before start moving right again. #THIS HANGS and BREAKS BLENDER!
If I use time.sleep to delay the actions blender hangs then crashes, if I don't use some sort of delay the cubes would just immediately teleport to the end. How can I slove this?