1
$\begingroup$

I want to create a python script that will add objects at a fixed time intervals. So for example, when I run my script, I want to add a cube, and 1 second later I want to add another cube at a different location and another second later I want to add another object. I tried using the time.sleep() function, but I found out that I can't use that in Blender, because when I do that, the script adds all the objects instantly after the time has elapsed. This means that the interface of blender can not be updated to accommodate for the time.sleep() delay. Is there a method where I can visually see each object being added to the scene and after a certain time another object and so on, and not all simultaneously?

What is another approach that I can use to accomplish this?

$\endgroup$
  • 2
    $\begingroup$ Why do you want this? If you want to create an animation that shows objects appearing, you want to use fcurves. If you want to add an object every second while someone is using Blender, use a modal operator with a one-second timer. $\endgroup$ – dr. Sybren Nov 28 '17 at 7:08
2
$\begingroup$

I found a potential solution here: https://blenderartists.org/forum/showthread.php?246876-Python-time-delay-within-script Based off what I see, it looks like blender only has one thread which is why your script wasn't working the way you expected

(Note: I found it via Are there any other script delays besides sleep?)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.