Is it possible to instantiate a secondary scene object?


I am currently working on a script that extends the Khronos glTF exporter with a batch-export functionality.
I thought that one way of doing that would be by creating a new scene object, copy everything that needs to be exported for each batch into it and then pass that new scene object to the glTF exporter.

Soooo… is that possible? If so how?

1 Like

it’s certainly possible, though I’m not entirely sure why you’d want to do it. copying a scene object is as simple as calling[0].copy(). just remember that all of the data will be linked to the original scene, so you’ll have to manually unlink and re-create relevant blocks of data for the scene. scenes have four major things to keep track of (in terms of data): thew view layer, world, scene collection, and objects.

if you’re just exporting geometry you probably don’t care about the view layer or world, so you’d just need to clear out the collection and create a new one that’s linked to the new scene, then add whatever objects you care about to that collection.

relevant “how?” snippets:

# create a copy of a scene
my_new_scene =[0].copy()
# clear out the collection in your new scene
for c in 
# create a new collection and link it to your new scene
my_new_collection ="my new collection")
# populate the new collection with objects you care about. 
# in this example, only meshes
for o in
    if hasattr(o, "data") and isinstance(, bpy.types.Mesh):

Thank you, I’ll give that a shot. Looks like this is exactly what I need :slight_smile: