I am struggling about a week figuring out how to do this. For example i have 5 objects, for the object1 I put visibility on 1 frame and invisible on 2 frame. then i need all other objects to have the same keyframes but with the 1 framestep from previous 1-frame we see object 1, 2-frame we see object 2 and further.
1 Answer
$\begingroup$
$\endgroup$
1
ok, here is a python solution:
result looks like this: https://youtu.be/HsVNCyuWyDY
what you have to do:
Create a collection with the name "Automatic_frame_visibility" and put all your objects in there. After running the script and starting your animation, each object will be visible in the order of the collection with one frame visibility.
python script:
import bpy
def frame_handler(scene, depsgraph):
counter = 0
for eachObject in list:
if scene.frame_current - 1 == counter:
eachObject.hide_render = False
eachObject.hide_viewport = False
else:
eachObject.hide_render = True
eachObject.hide_viewport = True
counter += 1
print ("-------- Script started")
bpy.app.handlers.frame_change_pre.clear()
bpy.app.handlers.frame_change_pre.append(frame_handler)
list = []
for eachObject in bpy.data.collections['Automatic_frame_visibility'].objects:
list.append(eachObject)
-
1$\begingroup$ moonboots will come with a much more elegant solution, and Robin will solve this procedurally. And of course - batFinger will have a perfect python solution for all cases - mine just works for your case - and nothing else. $\endgroup$– ChrisCommented Apr 28, 2021 at 12:29
frame != 1
to hide the object on all frames but the first one. Tell me if that would do I'll post this as an answer $\endgroup$