ddg.blender.collection module
Collection of functions to manage blender collections
- ddg.blender.collection.collection(name, parent=None, children=None)[source]
Creates a new collection or uses an existing one if a collection with given name exists. If the collection already exists the remaining parameters are ignored.
- Parameters:
- namestr
.nameof the collection.- parentbpy.types.Collection (default=None)
Parent collection to link newly generated collection to. If
None, collections get linked tobpy.context.scene.collection.- children: list of str or lists (default=None)
.nameof children that will be generated when generating a new collection. If an entry is a list, the first string will be the child’s.nameand the others the child’s children’s.names.
- Returns:
- bpy.types.Collection
Reference to the created Blender collection.
Examples
>>> import ddg >>> ddg.blender.collection.collection( ... "parent", ... children=[ ... "1", ... "2", ... ["3", "3.1", "3.2", "3.3"], ... ["4", ["4.1", "4.1.1", "4.1.2"]], ... ], ... ) bpy.data.collections['parent']
- ddg.blender.collection.clear(collections=None, deep=False, remove_collections=False)[source]
Unlink all the objects contained in the given collection.
- Parameters:
- collectionsIterable of bpy.types.Collection (default=None)
Collection(s) to clear. If the argument is not provided or
None,bpy.context.scenewill be used.- deepbool (default=False)
Delete the data corresponding to the objects.
- remove_collectionsbool (default=False)
Deletes the given collections and children. If
bpy.context.scene.collectionwas given it deletes all children of this collection (bpy.context.scene.collectioncan’t be removed).