BlendData(bpy_struct)¶
base class — bpy_struct
- class bpy.types.BlendData(bpy_struct)¶
Main data structure representing a .blend file and all its data-blocks
- actions¶
Action data-blocks (default None, readonly)
- Type:
- annotations¶
Annotation data-blocks (legacy Grease Pencil) (default None, readonly)
- Type:
- armatures¶
Armature data-blocks (default None, readonly)
- Type:
- brushes¶
Brush data-blocks (default None, readonly)
- Type:
- cache_files¶
Cache Files data-blocks (default None, readonly)
- Type:
- cameras¶
Camera data-blocks (default None, readonly)
- Type:
- collections¶
Collection data-blocks (default None, readonly)
- Type:
- colorspace¶
Information about the color space used for data-blocks in a blend file (readonly, never None)
- Type:
- curves¶
Curve data-blocks (default None, readonly)
- Type:
- filepath¶
Path to the .blend file (default “”, readonly, never None)
- Type:
str
- fonts¶
Vector font data-blocks (default None, readonly)
- Type:
- grease_pencils¶
Grease Pencil data-blocks (default None, readonly)
- hair_curves¶
Hair curve data-blocks (default None, readonly)
- Type:
- images¶
Image data-blocks (default None, readonly)
- Type:
- is_dirty¶
Have recent edits been saved to disk (default False, readonly)
- Type:
bool
- is_saved¶
Has the current session been saved to disk as a .blend file (default False, readonly)
- Type:
bool
- lattices¶
Lattice data-blocks (default None, readonly)
- Type:
- libraries¶
Library data-blocks (default None, readonly)
- Type:
- lightprobes¶
Light Probe data-blocks (default None, readonly)
- Type:
- lights¶
Light data-blocks (default None, readonly)
- Type:
- linestyles¶
Line Style data-blocks (default None, readonly)
- masks¶
Masks data-blocks (default None, readonly)
- Type:
- materials¶
Material data-blocks (default None, readonly)
- Type:
- meshes¶
Mesh data-blocks (default None, readonly)
- Type:
- metaballs¶
Metaball data-blocks (default None, readonly)
- Type:
- movieclips¶
Movie Clip data-blocks (default None, readonly)
- Type:
- node_groups¶
Node group data-blocks (default None, readonly)
- Type:
- objects¶
Object data-blocks (default None, readonly)
- Type:
- paint_curves¶
Paint Curves data-blocks (default None, readonly)
- Type:
- palettes¶
Palette data-blocks (default None, readonly)
- Type:
- particles¶
Particle data-blocks (default None, readonly)
- pointclouds¶
Point cloud data-blocks (default None, readonly)
- Type:
- scenes¶
Scene data-blocks (default None, readonly)
- Type:
- screens¶
Screen data-blocks (default None, readonly)
- Type:
- shape_keys¶
Shape Key data-blocks (default None, readonly)
- Type:
- sounds¶
Sound data-blocks (default None, readonly)
- Type:
- speakers¶
Speaker data-blocks (default None, readonly)
- Type:
- texts¶
Text data-blocks (default None, readonly)
- Type:
- textures¶
Texture data-blocks (default None, readonly)
- Type:
- use_autopack¶
Automatically pack all external data into .blend file (default False)
- Type:
bool
- version¶
File format version the .blend file was saved with (array of 3 items, in [0, inf], default (0, 0, 0), readonly)
- Type:
bpy_prop_array[int]
- volumes¶
Volume data-blocks (default None, readonly)
- Type:
- window_managers¶
Window manager data-blocks (default None, readonly)
- workspaces¶
Workspace data-blocks (default None, readonly)
- Type:
- worlds¶
World data-blocks (default None, readonly)
- Type:
- pack_linked_ids_hierarchy(root_id)¶
Pack the given linked ID and its dependencies into current blendfile
- batch_remove(ids)¶
Remove (delete) several IDs at once.
Note that this function is quicker than individual calls to
remove()(frombpy.types.BlendDataID collections), but less safe/versatile (it can break Blender, e.g. by removing all scenes…).- Parameters:
ids (Sequence[
bpy.types.ID]) – Sequence of IDs (types can be mixed).
- classmethod bl_rna_get_subclass(id, default=None, /)¶
- Parameters:
id (str) – The RNA type identifier.
default (
bpy.types.Struct| None) – The value to return when not found.
- Returns:
The RNA type or default when not found.
- Return type:
- classmethod bl_rna_get_subclass_py(id, default=None, /)¶
- Parameters:
id (str) – The RNA type identifier.
default (type | None) – The value to return when not found.
- Returns:
The class or default when not found.
- Return type:
type
- file_path_foreach(visit_path_fn, *, subset=None, visit_types=None, flags={'SKIP_PACKED', 'SKIP_WEAK_REFERENCES'})¶
Call
visit_path_fnfor the file paths used by all ID data-blocks in currentbpy.data.For list of valid set members for visit_types, see:
bpy.types.KeyingSetPath.id_type.- Parameters:
visit_path_fn (Callable[[
bpy.types.ID, str, Any], str|None]) – function that takes three parameters: the data-block, a file path, and a placeholder for future use. The function should return eitherNoneor astr. In the latter case, the visited file path will be replaced with the returned string.subset (set[str] | None) – When given, only these data-blocks and their used file paths will be visited.
visit_types (set[str] | None) – When given, only visit data-blocks of these types. Ignored if
subsetis also given.flags (set[str]) – Set of flags that influence which data-blocks are visited. See File Path Foreach Flag Items.
- file_path_map(*, subset=None, key_types=None, include_libraries=False)¶
Returns a mapping of all ID data-blocks in current
bpy.datato a set of all file paths used by them.For list of valid set members for key_types, see:
bpy.types.KeyingSetPath.id_type.- Parameters:
subset (Sequence[
bpy.types.ID] | None) – When given, only these data-blocks and their used file paths will be included as keys/values in the map.key_types (set[str] | None) – When given, filter the keys mapped by ID types. Ignored if
subsetis also given.include_libraries (bool) – Include library file paths of linked data. False by default.
- Returns:
dictionary of
bpy.types.IDinstances, with sets of file path strings as their values.- Return type:
dict[
bpy.types.ID, set[str]]
- orphans_purge()¶
Remove (delete) all IDs with no user.
- Parameters:
do_local_ids (bool, optional) – Include unused local IDs in the deletion, defaults to True
do_linked_ids (bool, optional) – Include unused linked IDs in the deletion, defaults to True
do_recursive (bool, optional) – Recursively check for unused IDs, ensuring no orphaned one remain after a single run of that function, defaults to False
- Returns:
The number of deleted IDs.
- Return type:
int
- static temp_data(*, filepath=None)¶
A context manager that temporarily creates blender file data.
- Parameters:
filepath (str | bytes | None) – The file path for the newly temporary data. When None, the path of the currently open file is used.
- Returns:
Blend file data which is freed once the context exits.
- Return type:
- user_map(*, subset=None, key_types=None, value_types=None)¶
Returns a mapping of all ID data-blocks in current
bpy.datato a set of all data-blocks using them.For list of valid set members for key_types & value_types, see:
bpy.types.KeyingSetPath.id_type.- Parameters:
subset (Sequence[
bpy.types.ID] | None) – When passed, only these data-blocks and their users will be included as keys/values in the map.key_types (set[str] | None) – Filter the keys mapped by ID types.
value_types (set[str] | None) – Filter the values in the set by ID types.
- Returns:
dictionary that maps data-blocks ID’s to their users.
- Return type:
dict[
bpy.types.ID, set[bpy.types.ID]]