System Information
Operating system: Linux-5.19.0-2-amd64-x86_64-with-glibc2.35 64 Bits
Graphics card: NVIDIA GeForce RTX 3070/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.141.03
Blender Version
Broken: version: 3.3.0, branch: master, commit date: 2022-09-06 15:39, hash: rB0759f671ce1f
Worked: (newest version of Blender that worked as expected)
Short description of error
When I try to duplicate a collection from python it tells me that there is no active collection and in fact there is.
Here is my example script:
context = bpy.context
coll_name = "test1"
def recurLayerCollection(context, layerColl, collName):
found = None
if (layerColl.name == collName):
return layerColl
#
for layer in layerColl.children:
found = recurLayerCollection(context, layer, collName)
if found:
return found
root_layerColl = context.view_layer.layer_collection
to_coll = recurLayerCollection(context, root_layerColl, coll_name)
bpy.data.scenes[context.scene.name].view_layers[context.view_layer.name].active_layer_collection = to_coll
print('Active collection:', context.view_layer.active_layer_collection.collection.name)
for window in context.window_manager.windows:
screen = window.screen
for area in screen.areas:
if area.type == 'OUTLINER':
override = {'window': window, 'screen': screen, 'area': area}
bpy.ops.outliner.collection_duplicate(override)
breakExact steps for others to reproduce the error