I have a script that creates a bunch of objects and at the end joins all the objects in the scene into one big object using this piece of code:

bpy.context.view_layer.objects.active = bpy.data.objects["Base"]

This works fine if I start with an empty scene, and then copy the final object into my main scene. However, I would like to have a script that creates a new object in the main scene, so I need a way to join all the objects created with the script, and not the ones already in the scene.

I thought of adding some unique prefix to all the created objects, then selecting all the objects with that prefix, join them, and finally remove the prefix from the final object, but that solution seems very tedious and wrong.

How would you solve this?

  • 1
    $\begingroup$ Hello, could you post the rest of your script ? You could store a reference to all the objects you created in a list and instead of selecting everything, only select the objects in this list $\endgroup$ – Gorgious Sep 3 '20 at 14:57

Browse other questions tagged or ask your own question.