Collection(ID)
==============

.. currentmodule:: bpy.types

base classes --- :class:`bpy_struct`, :class:`ID`

.. class:: Collection(ID)

   Collection of Object data-blocks

   .. attribute:: active_exporter_index

      Active index in the exporters list (in [0, inf], default 0)

      :type: int

   .. data:: all_objects

      Objects that are in this collection and its child collections (default None, readonly)

      :type: :class:`bpy_prop_collection`\ [:class:`Object`]

   .. data:: children

      Collections that are immediate children of this collection (default None, readonly)

      :type: :class:`CollectionChildren`\ [:class:`Collection`]

   .. data:: collection_children

      Children collections with their parent-collection-specific settings (default None, readonly)

      :type: :class:`bpy_prop_collection`\ [:class:`CollectionChild`]

   .. data:: collection_objects

      Objects of the collection with their parent-collection-specific settings (default None, readonly)

      :type: :class:`bpy_prop_collection`\ [:class:`CollectionObject`]

   .. attribute:: color_tag

      Color tag for a collection (default ``'COLOR_01'``)

      :type: Literal[:ref:`rna_enum_collection_color_items`]

   .. data:: exporters

      Export Handlers configured for the collection (default None, readonly)

      :type: :class:`CollectionExports`\ [:class:`CollectionExport`]

   .. attribute:: hide_render

      Globally disable in renders (default False)

      :type: bool

   .. attribute:: hide_select

      Disable selection in viewport (default False)

      :type: bool

   .. attribute:: hide_viewport

      Globally disable in viewports (default False)

      :type: bool

   .. attribute:: instance_offset

      Offset from the origin to use when instancing (array of 3 items, in [-inf, inf], default (0.0, 0.0, 0.0))

      :type: :class:`mathutils.Vector`

   .. attribute:: lineart_intersection_mask

      Intersection generated by this collection will have this mask value (array of 8 items, default (False, False, False, False, False, False, False, False))

      :type: :class:`bpy_prop_array`\ [bool]

   .. attribute:: lineart_intersection_priority

      The intersection line will be included into the object with the higher intersection priority value (in [0, 255], default 0)

      :type: int

   .. attribute:: lineart_usage

      How to use this collection in Line Art calculation (default ``'INCLUDE'``)

      - ``INCLUDE``
        Include -- Generate feature lines for this collection.
      - ``OCCLUSION_ONLY``
        Occlusion Only -- Only use the collection to produce occlusion.
      - ``EXCLUDE``
        Exclude -- Don't use this collection in Line Art.
      - ``INTERSECTION_ONLY``
        Intersection Only -- Only generate intersection lines for this collection.
      - ``NO_INTERSECTION``
        No Intersection -- Include this collection but do not generate intersection lines.
      - ``FORCE_INTERSECTION``
        Force Intersection -- Generate intersection lines even with objects that disabled intersection.

      :type: Literal['INCLUDE', 'OCCLUSION_ONLY', 'EXCLUDE', 'INTERSECTION_ONLY', 'NO_INTERSECTION', 'FORCE_INTERSECTION']

   .. attribute:: lineart_use_intersection_mask

      Use custom intersection mask for faces in this collection (default False)

      :type: bool

   .. data:: objects

      Objects that are directly in this collection (default None, readonly)

      :type: :class:`CollectionObjects`\ [:class:`Object`]

   .. attribute:: use_lineart_intersection_priority

      Assign intersection priority value for this collection (default False)

      :type: bool

   .. data:: children_recursive

      A list of all children from this collection.
      
      :type: list[:class:`Collection`]
      
      .. note::
      
          Takes ``O(n)`` time, where ``n`` is the total number of all
          descendant collections.

      (readonly)

   .. data:: users_dupli_group

      The collection instance objects this collection is used in
      
      :type: tuple[:class:`Object`, ...]
      
      .. note:: Takes ``O(len(bpy.data.objects))`` time.

      (readonly)

   .. classmethod:: bl_rna_get_subclass(id, default=None, /)
   
      :param id: The RNA type identifier.
      :type id: str
      :param default: The value to return when not found.
      :type default: :class:`bpy.types.Struct` | None
      :return: The RNA type or default when not found.
      :rtype: :class:`bpy.types.Struct`


   .. classmethod:: bl_rna_get_subclass_py(id, default=None, /)
   
      :param id: The RNA type identifier.
      :type id: str
      :param default: The value to return when not found.
      :type default: type | None
      :return: The class or default when not found.
      :rtype: type


Inherited Properties
--------------------

.. hlist::
   :columns: 2

   - :class:`bpy_struct.id_data`
   - :class:`ID.name`
   - :class:`ID.name_full`
   - :class:`ID.id_type`
   - :class:`ID.session_uid`
   - :class:`ID.is_evaluated`
   - :class:`ID.original`
   - :class:`ID.users`
   - :class:`ID.use_fake_user`
   - :class:`ID.use_extra_user`
   - :class:`ID.is_embedded_data`
   - :class:`ID.is_linked_packed`
   - :class:`ID.is_missing`
   - :class:`ID.is_runtime_data`
   - :class:`ID.is_editable`
   - :class:`ID.tag`
   - :class:`ID.is_library_indirect`
   - :class:`ID.library`
   - :class:`ID.library_weak_reference`
   - :class:`ID.asset_data`
   - :class:`ID.override_library`
   - :class:`ID.preview`

Inherited Functions
-------------------

.. hlist::
   :columns: 2

   - :class:`bpy_struct.as_pointer`
   - :class:`bpy_struct.driver_add`
   - :class:`bpy_struct.driver_remove`
   - :class:`bpy_struct.get`
   - :class:`bpy_struct.id_properties_clear`
   - :class:`bpy_struct.id_properties_ensure`
   - :class:`bpy_struct.id_properties_ui`
   - :class:`bpy_struct.is_property_hidden`
   - :class:`bpy_struct.is_property_overridable_library`
   - :class:`bpy_struct.is_property_readonly`
   - :class:`bpy_struct.is_property_set`
   - :class:`bpy_struct.items`
   - :class:`bpy_struct.keyframe_delete`
   - :class:`bpy_struct.keyframe_insert`
   - :class:`bpy_struct.keys`
   - :class:`bpy_struct.path_from_id`
   - :class:`bpy_struct.path_from_module`
   - :class:`bpy_struct.path_resolve`
   - :class:`bpy_struct.pop`
   - :class:`bpy_struct.property_overridable_library_set`
   - :class:`bpy_struct.property_unset`
   - :class:`bpy_struct.rna_ancestors`
   - :class:`bpy_struct.type_recast`
   - :class:`bpy_struct.values`
   - :class:`ID.bl_system_properties_get`
   - :class:`ID.rename`
   - :class:`ID.evaluated_get`
   - :class:`ID.copy`
   - :class:`ID.asset_mark`
   - :class:`ID.asset_clear`
   - :class:`ID.asset_generate_preview`
   - :class:`ID.override_create`
   - :class:`ID.override_hierarchy_create`
   - :class:`ID.user_clear`
   - :class:`ID.user_remap`
   - :class:`ID.make_local`
   - :class:`ID.user_of_id`
   - :class:`ID.animation_data_create`
   - :class:`ID.animation_data_clear`
   - :class:`ID.update_tag`
   - :class:`ID.preview_ensure`
   - :class:`ID.bl_rna_get_subclass`
   - :class:`ID.bl_rna_get_subclass_py`

References
----------

.. hlist::
   :columns: 2

   - :class:`BlendData.collections`
   - :class:`BlendDataCollections.new`
   - :class:`BlendDataCollections.remove`
   - :class:`BooleanModifier.collection`
   - :class:`ClothCollisionSettings.collection`
   - :class:`Collection.children`
   - :class:`CollectionChildren.link`
   - :class:`CollectionChildren.unlink`
   - :class:`Context.collection`
   - :class:`DopeSheet.filter_collection`
   - :class:`DynamicPaintSurface.brush_collection`
   - :class:`EffectorWeights.collection`
   - :class:`FluidDomainSettings.effector_group`
   - :class:`FluidDomainSettings.fluid_group`
   - :class:`FluidDomainSettings.force_collection`
   - :class:`FreestyleLineSet.collection`
   - :class:`GeometryNodeInputCollection.collection`
   - :class:`GreasePencilLineartModifier.source_collection`
   - :class:`IDOverrideLibrary.resync`
   - :class:`LayerCollection.collection`
   - :class:`LightProbe.visibility_collection`
   - :class:`NodeSocketCollection.default_value`
   - :class:`NodeTreeInterfaceSocketCollection.default_value`
   - :class:`ObjectLightLinking.blocker_collection`
   - :class:`ObjectLightLinking.receiver_collection`
   - :class:`Object.instance_collection`
   - :class:`ParticleSettings.collision_collection`
   - :class:`ParticleSettings.instance_collection`
   - :class:`RigidBodyWorld.collection`
   - :class:`RigidBodyWorld.constraints`
   - :class:`Scene.collection`
   - :class:`SoftBodySettings.collision_collection`

