BPY plus – collections module

A BPY plus module to simplify work with collections.

Collections class

set_active(name, context=bpy.context)

Set collection active by name

Parameters:

name: collection name to set active

context: context pointer


layer_collection(name, context=bpy.context)

Get LayerCollection by collection name

Parameters:

name: collection name

context: context pointer


selected()

Returns the list of selected collections


active(context=bpy.context)

Returns the active collection

Parameters:

context: context pointer


all(context=bpy.context)

Returns the all scene collection list.

Parameters:

context: context pointer


parent(context=bpy.context, collection=None)

Returns parent collection for collection.

Parameters:

context: context pointer

collection: collection to get paretn for. If None – for currently active collection.


move(collection, to)

Move the “collection” collection to the “to” collection.

Parameters:

collection : collection to move

to: move to collection


0 0 votes
Article Rating
Subscribe
Notify of
guest

2 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Rombout Versluijs
Rombout
1 year ago

IM looking for code to move a complete collection and children with objects to another object. Doing the link/unlink approach is tedious. If the outliner has the drop function, why isnt there a move function?!