0
$\begingroup$

I'm working on a Blender addon that will render multiple versions of a scene by altering node input parameters. To leave the scene unchanged, I want to render a copy of the current scene, which I successfully do. The problem is that when doing a full copy of a scene using ops.scene.new(type="FULL_COPY") it creates a copy of everything that existed in the original scene. When I later delete the new scene using bpy.ops.scene.delete() all those copied objects and materials still exists! How do I remove a scene and everything that was contained in it?

$\endgroup$
1
$\begingroup$

Maybe you can consider starting with a new blend file (empty), then you pass to addon the source blend file. The addon can link the scene/collection from the source file, render and remove linked. Then repeat the process.

Or, to follow your initial setup, you could put the whole scene in a "root" collection and then call bpy.ops.outliner.collection_delete (hierarchy = True). In theory with hierarchy = True it should delete all the objects contained.

$\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.