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:
BlendDataActionsbpy_prop_collectionofAction, (readonly)
- annotations
Annotation data-blocks (legacy Grease Pencil)
- Type:
BlendDataAnnotationsbpy_prop_collectionofAnnotation, (readonly)
- armatures
Armature data-blocks
- Type:
BlendDataArmaturesbpy_prop_collectionofArmature, (readonly)
- brushes
Brush data-blocks
- Type:
BlendDataBrushesbpy_prop_collectionofBrush, (readonly)
- cache_files
Cache Files data-blocks
- Type:
BlendDataCacheFilesbpy_prop_collectionofCacheFile, (readonly)
- cameras
Camera data-blocks
- Type:
BlendDataCamerasbpy_prop_collectionofCamera, (readonly)
- collections
Collection data-blocks
- Type:
BlendDataCollectionsbpy_prop_collectionofCollection, (readonly)
- colorspace
Information about the color space used for data-blocks in a blend file
- Type:
BlendFileColorspace, (readonly, never None)
- curves
Curve data-blocks
- Type:
BlendDataCurvesbpy_prop_collectionofCurve, (readonly)
- filepath
Path to the .blend file
- Type:
string, default “”, (readonly, never None)
- fonts
Vector font data-blocks
- Type:
BlendDataFontsbpy_prop_collectionofVectorFont, (readonly)
- grease_pencils
Grease Pencil data-blocks
- Type:
BlendDataGreasePencilsV3bpy_prop_collectionofGreasePencil, (readonly)
- hair_curves
Hair curve data-blocks
- Type:
BlendDataHairCurvesbpy_prop_collectionofCurves, (readonly)
- images
Image data-blocks
- Type:
BlendDataImagesbpy_prop_collectionofImage, (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:
BlendDataLatticesbpy_prop_collectionofLattice, (readonly)
- libraries
Library data-blocks
- Type:
BlendDataLibrariesbpy_prop_collectionofLibrary, (readonly)
- lightprobes
Light Probe data-blocks
- Type:
BlendDataProbesbpy_prop_collectionofLightProbe, (readonly)
- lights
Light data-blocks
- Type:
BlendDataLightsbpy_prop_collectionofLight, (readonly)
- linestyles
Line Style data-blocks
- Type:
BlendDataLineStylesbpy_prop_collectionofFreestyleLineStyle, (readonly)
- masks
Masks data-blocks
- Type:
BlendDataMasksbpy_prop_collectionofMask, (readonly)
- materials
Material data-blocks
- Type:
BlendDataMaterialsbpy_prop_collectionofMaterial, (readonly)
- meshes
Mesh data-blocks
- Type:
BlendDataMeshesbpy_prop_collectionofMesh, (readonly)
- metaballs
Metaball data-blocks
- Type:
BlendDataMetaBallsbpy_prop_collectionofMetaBall, (readonly)
- movieclips
Movie Clip data-blocks
- Type:
BlendDataMovieClipsbpy_prop_collectionofMovieClip, (readonly)
- node_groups
Node group data-blocks
- Type:
BlendDataNodeTreesbpy_prop_collectionofNodeTree, (readonly)
- objects
Object data-blocks
- Type:
BlendDataObjectsbpy_prop_collectionofObject, (readonly)
- paint_curves
Paint Curves data-blocks
- Type:
BlendDataPaintCurvesbpy_prop_collectionofPaintCurve, (readonly)
- palettes
Palette data-blocks
- Type:
BlendDataPalettesbpy_prop_collectionofPalette, (readonly)
- particles
Particle data-blocks
- Type:
BlendDataParticlesbpy_prop_collectionofParticleSettings, (readonly)
- pointclouds
Point cloud data-blocks
- Type:
BlendDataPointCloudsbpy_prop_collectionofPointCloud, (readonly)
- scenes
Scene data-blocks
- Type:
BlendDataScenesbpy_prop_collectionofScene, (readonly)
- screens
Screen data-blocks
- Type:
BlendDataScreensbpy_prop_collectionofScreen, (readonly)
- shape_keys
Shape Key data-blocks
- Type:
bpy_prop_collectionofKey, (readonly)
- sounds
Sound data-blocks
- Type:
BlendDataSoundsbpy_prop_collectionofSound, (readonly)
- speakers
Speaker data-blocks
- Type:
BlendDataSpeakersbpy_prop_collectionofSpeaker, (readonly)
- texts
Text data-blocks
- Type:
BlendDataTextsbpy_prop_collectionofText, (readonly)
- textures
Texture data-blocks
- Type:
BlendDataTexturesbpy_prop_collectionofTexture, (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:
BlendDataVolumesbpy_prop_collectionofVolume, (readonly)
- window_managers
Window manager data-blocks
- Type:
BlendDataWindowManagersbpy_prop_collectionofWindowManager, (readonly)
- workspaces
Workspace data-blocks
- Type:
BlendDataWorkSpacesbpy_prop_collectionofWorkSpace, (readonly)
- worlds
World data-blocks
- Type:
BlendDataWorldsbpy_prop_collectionofWorld, (readonly)
- 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.
- Returns:
The RNA type or default when not found.
- Return type:
bpy.types.Structsubclass
- classmethod bl_rna_get_subclass_py(id, default=None, /)
- Parameters:
id (str) – The RNA type identifier.
- 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]) – When given, only these data-blocks and their used file paths will be visited.
visit_types (set[str]) – 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) – When given, only these data-blocks and their used file paths will be included as keys/values in the map.
key_types (set[str]) – 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
- 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 | 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 exists.
- 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]) – When passed, only these data-blocks and their users will be included as keys/values in the map.key_types (set[str]) – Filter the keys mapped by ID types.
value_types (set[str]) – 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]]