snnib.blender.utils.collection_utils

functions to deal with bpy.types.Collection

Exceptions

Classes

Functions
  • ensure_collection() – ensures that a collection exists

  • clear_collection() – recursively deletes all object in a collection

  • obj_unlink_all_collections() – unlinks an object from all of it’s current collections

Other Objects

Functions

clear_collection(collection)

recursively deletes all objects in collection

ensure_collection(path[, parent])

returns collection of name

obj_unlink_all_collections(obj)

unlinks object from all of its current collections

register()

unregister()

snnib.blender.utils.collection_utils.clear_collection(collection: bpy.types.Collection)[source]

recursively deletes all objects in collection

  • deletes all objects in collection

  • also unliks them everywhere else

Parameters
  • collection
    • bpy.types.Collection

    • collection to delete all objects contained within

Raises

Returns

Dependencies
  • bpy

  • logging

snnib.blender.utils.collection_utils.ensure_collection(path: str, parent: bpy.types.Collection = None) bpy.types.Collection[source]

returns collection of name

  • returns collection of name

  • creates new collection of name, if non-existent

Parameters
  • path
    • str

    • path to the collection relative to parent

    • path to the collection as Parent0/Parent1/…/Child

  • parent
    • bpy.types.Collection, optional

    • parent collection

    • the default is None
      • uses bpy.context.scene.collection

Raises

Returns
  • current
    • bpy.types.Collection

    • collection of name

Dependencies
  • bpy

  • logging

unlinks object from all of its current collections

Parameters
  • obj
    • bpy.types.Object

    • object to unlink from all collections

Raises

Returns

Dependencies
  • bpy

  • logging