ID(bpy_struct)

base class — bpy_struct

subclasses — Action, Armature, Brush, CacheFile, Camera, Collection, Curve, Curves, FreestyleLineStyle, GreasePencil, Image, Key, Lattice, Library, Light, LightProbe, Mask, Material, Mesh, MetaBall, MovieClip, NodeTree, Object, PaintCurve, Palette, ParticleSettings, PointCloud, Scene, Screen, Sound, Speaker, Text, Texture, VectorFont, Volume, WindowManager, WorkSpace, World

class bpy.types.ID(bpy_struct)

Base type for data-blocks, defining a unique name, linking from other libraries and garbage collection

asset_data

Additional data for an asset data-block

Type

AssetMetaData, (readonly)

is_embedded_data

This data-block is not an independent one, but is actually a sub-data of another ID (typical example: root node trees or master collections)

Type

boolean, default False, (readonly)

is_evaluated

Whether this ID is runtime-only, evaluated data-block, or actual data from .blend file

Type

boolean, default False, (readonly)

is_library_indirect

Is this ID block linked indirectly

Type

boolean, default False, (readonly)

is_missing

This data-block is a place-holder for missing linked data (i.e. it is [an override of] a linked data that could not be found anymore)

Type

boolean, default False, (readonly)

is_runtime_data

This data-block is runtime data, i.e. it won’t be saved in .blend file. Note that e.g. evaluated IDs are always runtime, so this value is only editable for data-blocks in Main data-base

Type

boolean, default False

library

Library file the data-block is linked from

Type

Library, (readonly)

library_weak_reference

Weak reference to a data-block in another library .blend file (used to re-use already appended data instead of appending new copies)

Type

LibraryWeakReference, (readonly)

name

Unique data-block ID name

Type

string, default “”, (never None)

name_full

Unique data-block ID name, including library one is any

Type

string, default “”, (readonly, never None)

original

Actual data-block from .blend file (Main database) that generated that evaluated one

Type

ID, (readonly)

override_library

Library override data

Type

IDOverrideLibrary, (readonly)

preview

Preview image and icon of this data-block (always None if not supported for this type of data)

Type

ImagePreview, (readonly)

tag

Tools can use this to tag data for their own purposes (initial state is undefined)

Type

boolean, default False

use_extra_user

Indicates whether an extra user is set or not (mainly for internal/debug usages)

Type

boolean, default False

use_fake_user

Save this data-block even if it has no users

Type

boolean, default False

users

Number of times this data-block is referenced

Type

int in [0, inf], default 0, (readonly)

evaluated_get(depsgraph)

Get corresponding evaluated ID from the given dependency graph

Parameters

depsgraph (Depsgraph, (never None)) – Dependency graph to perform lookup in

Returns

New copy of the ID

Return type

ID

copy()

Create a copy of this data-block (not supported for all data-blocks). The result is added to the Blend-File Data (Main database), with all references to other data-blocks ensured to be from within the same Blend-File Data

Returns

New copy of the ID

Return type

ID

asset_mark()

Enable easier reuse of the data-block through the Asset Browser, with the help of customizable metadata (like previews, descriptions and tags)

asset_clear()

Delete all asset metadata and turn the asset data-block back into a normal data-block

asset_generate_preview()

Generate preview image (might be scheduled in a background thread)

override_create(remap_local_usages=False)

Create an overridden local copy of this linked data-block (not supported for all data-blocks)

Parameters

remap_local_usages (boolean, (optional)) – Whether local usages of the linked ID should be remapped to the new library override of it

Returns

New overridden local copy of the ID

Return type

ID

override_hierarchy_create(scene, view_layer, reference=None, do_fully_editable=False)

Create an overridden local copy of this linked data-block, and most of its dependencies when it is a Collection or and Object

Parameters
  • scene (Scene, (never None)) – In which scene the new overrides should be instantiated

  • view_layer (ViewLayer, (never None)) – In which view layer the new overrides should be instantiated

  • reference (ID, (optional)) – Another ID (usually an Object or Collection) used as a hint to decide where to instantiate the new overrides

  • do_fully_editable (boolean, (optional)) – Make all library overrides generated by this call fully editable by the user (none will be ‘system overrides’)

Returns

New overridden local copy of the root ID

Return type

ID

override_template_create()

Create an override template for this ID

user_clear()

Clear the user count of a data-block so its not saved, on reload the data will be removed

This function is for advanced use only, misuse can crash blender since the user count is used to prevent data being removed when it is used.

# This example shows what _not_ to do, and will crash blender.
import bpy

# object which is in the scene.
obj = bpy.data.objects["Cube"]

# without this, removal would raise an error.
obj.user_clear()

# runs without an exception
# but will crash on redraw.
bpy.data.objects.remove(obj)
user_remap(new_id)

Replace all usage in the .blend file of this ID by new given one

Parameters

new_id (ID, (never None)) – New ID to use

make_local(clear_proxy=True)

Make this datablock local, return local one (may be a copy of the original, in case it is also indirectly used)

Parameters

clear_proxy (boolean, (optional)) – Deprecated, has no effect

Returns

This ID, or the new ID if it was copied

Return type

ID

user_of_id(id)

Count the number of times that ID uses/references given one

Parameters

id (ID, (never None)) – ID to count usages

Returns

Number of usages/references of given id by current data-block

Return type

int in [0, inf]

animation_data_create()

Create animation data to this ID, note that not all ID types support this

Returns

New animation data or NULL

Return type

AnimData

animation_data_clear()

Clear animation on this ID

update_tag(refresh={})

Tag the ID to update its display data, e.g. when calling bpy.types.Scene.update

Parameters

refresh (enum set in {'OBJECT', 'DATA', 'TIME'}, (optional)) – Type of updates to perform

preview_ensure()

Ensure that this ID has preview data (if ID type supports it)

Returns

The existing or created preview

Return type

ImagePreview

classmethod bl_rna_get_subclass(id, default=None)
Parameters

id (string) – The RNA type identifier.

Returns

The RNA type or default when not found.

Return type

bpy.types.Struct subclass

classmethod bl_rna_get_subclass_py(id, default=None)
Parameters

id (string) – The RNA type identifier.

Returns

The class or default when not found.

Return type

type

Inherited Properties

Inherited Functions

References