2
$\begingroup$

I can find only active collection with bpy.context.collection, there should be bpy.context.selected_collections similar to bpy.context.selected_objects.

How to get a list of selected collections?

enter image description here

$\endgroup$
2

1 Answer 1

1
$\begingroup$

This answer is based on https://blender.stackexchange.com/a/293231/123423

import bpy
from bpy import context


def selected_collections(context):
    for area in context.screen.areas:
        if area.type == 'OUTLINER':
            with context.temp_override(area=area):
                return [item for item in context.selected_ids if isinstance(item, bpy.types.Collection)]


print(selected_collections(context))
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .