The 2.8 documentation for the context override is found here: https://docs.blender.org/api/blender2.8/bpy.ops.html?highlight=object_bases
override['selected_bases'] = list(bpy.context.scene.object_bases)
is even listed there, but throwing
bpy.context.scene.object_bases
into the python console throws:
Traceback (most recent call last): File "", line 1, in AttributeError: 'Scene' object has no attribute 'object_bases'
I want to merge objects as described by CodemanX here: How to join objects with Python? It worked in 2.79, doesnt in 2.80 and throws:
AttributeError: 'Scene' object has no attribute 'object_bases'
My code snippet:
proxyname = "ProxyName"
# create empty new object
proxymesh = bpy.data.objects.new(proxyname, bpy.data.meshes.new(proxyname))
bpy.context.collection.objects.link(proxymesh)
proxymesh.matrix_world = bpy.context.active_object.matrix_world
# make new, flattened object from all meshes in selection
duplicants = []
duplicants.append(proxymesh)
for obj in bpy.context.selected_objects:
if obj.type == "MESH":
duplicant = bpy.data.objects.new("duplicant", obj.to_mesh(bpy.context.depsgraph, True, calc_undeformed=False))
bpy.context.collection.objects.link(duplicant)
duplicant.matrix_world = obj.matrix_world
duplicants.append(duplicant)
# attach flattened objects to empty object
ctx = bpy.context.copy()
ctx['active_object'] = proxymesh
ctx['selected_objects'] = duplicants
ctx['selected_editable_bases'] = [bpy.context.scene.object_bases[duplicant.name] for duplicant in duplicants]
So basically, I would like to know how to be able to iterate through the scene's object bases in 2.80?