1
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ you can do this in the graph editor ...but this is also manually. There is AFAIK no automatic thing for this. Or you do it with python. Some add-ons maybe could do that. $\endgroup$
    – Chris
    Commented Apr 28, 2021 at 9:20
  • $\begingroup$ This isn't a response to your question but you can do this by adding a mask modifier on the object and adding a driver to the visibility of the modifier with an expression set to 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$
    – Gorgious
    Commented Apr 28, 2021 at 10:29

1 Answer 1

1
$\begingroup$

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.

enter image description here

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)    
    
$\endgroup$
1
  • 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$
    – Chris
    Commented Apr 28, 2021 at 12:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .