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

Type:

BlendDataActions bpy_prop_collection of Action, (readonly)

armatures

Armature data-blocks

Type:

BlendDataArmatures bpy_prop_collection of Armature, (readonly)

brushes

Brush data-blocks

Type:

BlendDataBrushes bpy_prop_collection of Brush, (readonly)

cache_files

Cache Files data-blocks

Type:

BlendDataCacheFiles bpy_prop_collection of CacheFile, (readonly)

cameras

Camera data-blocks

Type:

BlendDataCameras bpy_prop_collection of Camera, (readonly)

collections

Collection data-blocks

Type:

BlendDataCollections bpy_prop_collection of Collection, (readonly)

curves

Curve data-blocks

Type:

BlendDataCurves bpy_prop_collection of Curve, (readonly)

filepath

Path to the .blend file

Type:

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

fonts

Vector font data-blocks

Type:

BlendDataFonts bpy_prop_collection of VectorFont, (readonly)

grease_pencils

Grease Pencil (legacy) data-blocks

Type:

BlendDataGreasePencils bpy_prop_collection of GreasePencil, (readonly)

grease_pencils_v3

Grease Pencil data-blocks

Type:

BlendDataGreasePencilsV3 bpy_prop_collection of GreasePencilv3, (readonly)

hair_curves

Hair curve data-blocks

Type:

BlendDataHairCurves bpy_prop_collection of Curves, (readonly)

images

Image data-blocks

Type:

BlendDataImages bpy_prop_collection of Image, (readonly)

is_dirty

Have recent edits been saved to disk

Type:

boolean, default False, (readonly)

is_saved

Has the current session been saved to disk as a .blend file

Type:

boolean, default False, (readonly)

lattices

Lattice data-blocks

Type:

BlendDataLattices bpy_prop_collection of Lattice, (readonly)

libraries

Library data-blocks

Type:

BlendDataLibraries bpy_prop_collection of Library, (readonly)

lightprobes

Light Probe data-blocks

Type:

BlendDataProbes bpy_prop_collection of LightProbe, (readonly)

lights

Light data-blocks

Type:

BlendDataLights bpy_prop_collection of Light, (readonly)

linestyles

Line Style data-blocks

Type:

BlendDataLineStyles bpy_prop_collection of FreestyleLineStyle, (readonly)

masks

Masks data-blocks

Type:

BlendDataMasks bpy_prop_collection of Mask, (readonly)

materials

Material data-blocks

Type:

BlendDataMaterials bpy_prop_collection of Material, (readonly)

meshes

Mesh data-blocks

Type:

BlendDataMeshes bpy_prop_collection of Mesh, (readonly)

metaballs

Metaball data-blocks

Type:

BlendDataMetaBalls bpy_prop_collection of MetaBall, (readonly)

movieclips

Movie Clip data-blocks

Type:

BlendDataMovieClips bpy_prop_collection of MovieClip, (readonly)

node_groups

Node group data-blocks

Type:

BlendDataNodeTrees bpy_prop_collection of NodeTree, (readonly)

objects

Object data-blocks

Type:

BlendDataObjects bpy_prop_collection of Object, (readonly)

paint_curves

Paint Curves data-blocks

Type:

BlendDataPaintCurves bpy_prop_collection of PaintCurve, (readonly)

palettes

Palette data-blocks

Type:

BlendDataPalettes bpy_prop_collection of Palette, (readonly)

particles

Particle data-blocks

Type:

BlendDataParticles bpy_prop_collection of ParticleSettings, (readonly)

pointclouds

Point cloud data-blocks

Type:

BlendDataPointClouds bpy_prop_collection of PointCloud, (readonly)

scenes

Scene data-blocks

Type:

BlendDataScenes bpy_prop_collection of Scene, (readonly)

screens

Screen data-blocks

Type:

BlendDataScreens bpy_prop_collection of Screen, (readonly)

shape_keys

Shape Key data-blocks

Type:

bpy_prop_collection of Key, (readonly)

sounds

Sound data-blocks

Type:

BlendDataSounds bpy_prop_collection of Sound, (readonly)

speakers

Speaker data-blocks

Type:

BlendDataSpeakers bpy_prop_collection of Speaker, (readonly)

texts

Text data-blocks

Type:

BlendDataTexts bpy_prop_collection of Text, (readonly)

textures

Texture data-blocks

Type:

BlendDataTextures bpy_prop_collection of Texture, (readonly)

use_autopack

Automatically pack all external data into .blend file

Type:

boolean, default False

version

File format version the .blend file was saved with

Type:

int array of 3 items in [0, inf], default (0, 0, 0), (readonly)

volumes

Volume data-blocks

Type:

BlendDataVolumes bpy_prop_collection of Volume, (readonly)

window_managers

Window manager data-blocks

Type:

BlendDataWindowManagers bpy_prop_collection of WindowManager, (readonly)

workspaces

Workspace data-blocks

Type:

BlendDataWorkSpaces bpy_prop_collection of WorkSpace, (readonly)

worlds

World data-blocks

Type:

BlendDataWorlds bpy_prop_collection of World, (readonly)

batch_remove(ids)

Remove (delete) several IDs at once.

WARNING: Considered experimental feature currently.

Note that this function is quicker than individual calls to remove() (from bpy.types.BlendData ID collections), but less safe/versatile (it can break Blender, e.g. by removing all scenes…).

Parameters:

ids – Iterables of IDs (types can be mixed).

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

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.

temp_data(filepath=None)

A context manager that temporarily creates blender file data.

Parameters:

filepath (str, bytes or NoneType) – 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 exists.

Return type:

bpy.types.BlendData

user_map(subset, key_types, value_types)

Returns a mapping of all ID data-blocks in current bpy.data to a set of all datablocks using them.

For list of valid set members for key_types & value_types, see: bpy.types.KeyingSetPath.id_type.

Parameters:
  • subset (sequence) – When passed, only these data-blocks and their users will be included as keys/values in the map.

  • key_types (set of strings) – Filter the keys mapped by ID types.

  • value_types (set of strings) – Filter the values in the set by ID types.

Returns:

dictionary of bpy.types.ID instances, with sets of ID’s as their values.

Return type:

dict

Inherited Properties

Inherited Functions

References