I understand that it's possible to keyframe visibility, and that might have to be at least part of the solution. However, I intend to create many objects at once, with a script to generate them, so I can't think how to apply visibility keyframes, when I'd have so many objects which initially don't exist.
If it helps, here's the (messy) code I'm working with:
import bpy
CoList = []
def DeleteExisting():
bpy.ops.object.select_all(action='TOGGLE')
bpy.ops.object.delete(use_global=False)
bpy.ops.object.select_all(action='TOGGLE')
bpy.ops.object.delete(use_global=False)
DeleteExisting()
def Create_List(Width):
for x in range(0,Width):
CoList.append([x])
for i in CoList:
x = i[0]
i.pop(0)
for y in range(0,Width):
i.append([x,y])
return CoList
def Generate_Cubes(CoList):
for x in CoList:
for y in x:
X_Value = y[0]
Y_Value = y[1]
while type(X_Value) == list:
if type(X_Value) == list:
X_Value = X_Value[0]
if type(Y_Value) == list:
Y_Value = Y_Value[0]
bpy.ops.mesh.primitive_cube_add(view_align=False, enter_editmode=False, location=(X_Value, Y_Value, 0), layers=(True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False))
bpy.ops.transform.resize(value=(0.25, 0.25, 0.25), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
for X in range(1,6):
bpy.context.scene.frame_current = X
Width = X+2
DeleteExisting()
CoList = Create_List(Width)
Generate_Cubes(CoList)
bpy.ops.object.select_all(action='TOGGLE')
bpy.ops.object.select_all(action='TOGGLE')
This creates a grid of cubes, which looks like this:
And it also advances the current frame, however once an object is created, it exists on all frames, regardless of any keyframes that I know of. So how would I implement this so that objects only exist on the frame which they are created on?