Blender V5.3
blender::bke::bake Namespace Reference

Namespaces

namespace  tests

Classes

struct  BakeDataBlockID
struct  BakeDataBlockMap
struct  BakeMaterialsList
struct  BakeNodeCache
struct  BakePath
class  BakeToRuntimeValue
class  BakeValues
class  BlobReader
class  BlobReadSharing
struct  BlobSlice
class  BlobWriter
class  BlobWriteSharing
class  DeferredTypeAttributeFieldInput
class  DiskBlobReader
class  DiskBlobWriter
struct  FrameCache
class  MemoryBlobReader
class  MemoryBlobWriter
struct  MetaFile
struct  ModifierCache
struct  NodeBakeCache
struct  PrevCache
class  RuntimeToBakeValue
struct  SimulationNodeCache

Typedefs

using DictionaryValuePtr = std::shared_ptr<DictionaryValue>

Enumerations

enum class  CacheStatus { Valid , Invalid , Baked }
enum class  PackGeometryNodesBakeResult { NoDataFound , PackedAlready , Success }
enum class  UnpackGeometryNodesBakeResult { BlendFileNotSaved , NoPackedData , Error , Success }

Functions

void scene_simulation_states_reset (Scene &scene)
std::optional< NodesModifierBakeTarget > get_node_bake_target (const Object &object, const NodesModifierData &nmd, int node_id)
std::optional< BakePath > get_node_bake_path (const Main &bmain, const Object &object, const NodesModifierData &nmd, int node_id)
std::optional< IndexRange > get_node_bake_frame_range (const Scene &scene, const Object &object, const NodesModifierData &nmd, int node_id)
std::optional< std::string > get_modifier_bake_path (const Main &bmain, const Object &object, const NodesModifierData &nmd)
std::string get_default_modifier_bake_directory (const Main &bmain, const Object &object, const NodesModifierData &nmd)
std::string get_default_node_bake_directory (const Main &bmain, const Object &object, const NodesModifierData &nmd, int node_id)
NodesModifierPackedBake * pack_bake_from_disk (const BakePath &bake_path, ReportList *reports)
bool unpack_bake_to_disk (const NodesModifierPackedBake &packed_bake, const BakePath &bake_path, ReportList *reports)
PackGeometryNodesBakeResult pack_geometry_nodes_bake (Main &bmain, ReportList *reports, Object &object, NodesModifierData &nmd, NodesModifierBake &bake)
UnpackGeometryNodesBakeResult unpack_geometry_nodes_bake (Main &bmain, ReportList *reports, Object &object, NodesModifierData &nmd, NodesModifierBake &bake, ePF_FileStatus how)
std::string frame_to_file_name (const SubFrame &frame)
std::optional< SubFrame > file_name_to_frame (StringRef file_name)
Vector< MetaFile > find_sorted_meta_files (StringRefNull meta_dir)
void serialize_bake (const BakeValues &bake_values, BlobWriter &blob_writer, BlobWriteSharing &blob_sharing, std::ostream &r_stream)
std::optional< BakeValues > deserialize_bake (std::istream &stream, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
std::ostream & operator<< (std::ostream &stream, const BakeDataBlockID &id)
static std::optional< std::string > resolve_bake_directory (const Main &bmain, const Object &object, const StringRef directory)
static IndexRange fix_frame_range (const int start, const int end)
static std::string escape_name (const StringRef name)
static std::string get_blend_file_name (const Main &bmain)
static std::string get_modifier_directory_name (const Object &object, const ModifierData &md)
static Vector< NodesModifierBakeFile > pack_files_from_directory (const StringRefNull directory, ReportList *reports)
static bool directory_is_empty (const StringRefNull path)
static bool disk_bake_exists (const bke::bake::BakePath &path)
static std::optional< SocketValueVariant > deserialize_bake_item (const DictionaryValue &io_item, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
static void serialize_socket_value_variant (const SocketValueVariant &value_variant, BlobWriter &blob_writer, BlobWriteSharing &blob_sharing, DictionaryValue &r_io_item)
static void serialize_bundle_items (const nodes::Bundle &bundle, ArrayValue &r_io_items, BlobWriter &blob_writer, BlobWriteSharing &blob_sharing)
static bool deserialize_bundle_items (const io::serialize::ArrayValue &io_bundle_items, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing, nodes::Bundle &r_bundle)
static std::string make_independent_file_name (const StringRef base_name, const int file_index, const StringRef extension)
static StringRefNull get_domain_io_name (const AttrDomain domain)
static StringRefNull get_data_type_io_name (const eCustomDataType data_type)
static StringRefNull get_storage_type_io_name (const AttrStorageType storage_type)
static std::optional< AttrDomain > get_domain_from_io_name (const StringRefNull io_name)
static std::optional< eCustomDataType > get_data_type_from_io_name (const StringRefNull io_name)
static std::optional< AttrStorageType > get_storage_type_from_io_name (const StringRefNull io_name)
static std::shared_ptr< DictionaryValue > write_blob_raw_bytes (BlobWriter &blob_writer, BlobWriteSharing &blob_sharing, const void *data, const int64_t size_in_bytes)
static bool read_blob_raw_bytes (const BlobReader &blob_reader, const DictionaryValue &io_data, const int64_t bytes_num, void *r_data)
static std::shared_ptr< DictionaryValue > write_blob_simple_gspan (BlobWriter &blob_writer, BlobWriteSharing &blob_sharing, const GSpan data)
static bool read_blob_simple_gspan (const BlobReader &blob_reader, const DictionaryValue &io_data, GMutableSpan r_data)
static std::shared_ptr< DictionaryValue > write_blob_shared_simple_gspan (BlobWriter &blob_writer, BlobWriteSharing &blob_sharing, const GSpan data, const ImplicitSharingInfo *sharing_info)
static const void * read_blob_shared_simple_gspan (const DictionaryValue &io_data, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing, const CPPType &cpp_type, const int size, const ImplicitSharingInfo **r_sharing_info)
template<typename T>
static bool read_blob_shared_simple_span (const DictionaryValue &io_data, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing, const int size, T **r_data, const ImplicitSharingInfo **r_sharing_info)
static bool load_materials (const io::serialize::ArrayValue &io_materials, std::unique_ptr< BakeMaterialsList > &materials)
static bool load_attributes (const io::serialize::ArrayValue &io_attributes, MutableAttributeAccessor &attributes, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
static PointCloud * try_load_pointcloud (const DictionaryValue &io_geometry, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
static std::optional< CurvesGeometry > try_load_curves_geometry (const DictionaryValue &io_curves, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
static Curves * try_load_curves (const DictionaryValue &io_geometry, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
static GreasePencil * try_load_grease_pencil (const DictionaryValue &io_geometry, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
static void load_texspace (const DictionaryValue *io_mesh, Mesh *mesh)
static Mesh * try_load_mesh (const DictionaryValue &io_geometry, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
static GeometrySet load_geometry (const DictionaryValue &io_geometry, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
static std::unique_ptr< Instances > try_load_instances (const DictionaryValue &io_geometry, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
static nodes::BundlePtr try_load_geometry_bundle (const DictionaryValue &io_geometry, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
static std::shared_ptr< io::serialize::ArrayValue > serialize_materials (const std::unique_ptr< BakeMaterialsList > &materials)
static std::shared_ptr< io::serialize::ArrayValue > serialize_attributes (const AttributeAccessor &attributes, BlobWriter &blob_writer, BlobWriteSharing &blob_sharing, const Set< std::string > &attributes_to_ignore)
static void serialize_curves_geometry (DictionaryValue &io_curves, const CurvesGeometry &curves, BlobWriter &blob_writer, BlobWriteSharing &blob_sharing)
static void serialize_texture_space (const Mesh &mesh, std::shared_ptr< DictionaryValue > io_mesh)
static std::shared_ptr< DictionaryValue > serialize_geometry_set (const GeometrySet &geometry, BlobWriter &blob_writer, BlobWriteSharing &blob_sharing)
static std::shared_ptr< io::serialize::ArrayValue > serialize_float_array (const Span< float > values)
static std::shared_ptr< io::serialize::ArrayValue > serialize_int_array (const Span< int > values)
static std::shared_ptr< io::serialize::Value > serialize_primitive_value (const eCustomDataType data_type, const void *value_ptr)
template<typename T>
static bool deserialize_typed_array (const io::serialize::Value &io_value, FunctionRef< std::optional< T >(const io::serialize::Value &io_element)> fn, MutableSpan< T > r_values)
template<typename T>
static std::optional< T > deserialize_int (const io::serialize::Value &io_value)
static std::optional< float > deserialize_float (const io::serialize::Value &io_value)
static bool deserialize_float_array (const io::serialize::Value &io_value, MutableSpan< float > r_values)
template<typename T>
static bool deserialize_int_array (const io::serialize::Value &io_value, MutableSpan< T > r_values)
static bool deserialize_primitive_value (const io::serialize::Value &io_value, const eCustomDataType type, void *r_value)
static void serialize_single_value (const GPointer value, BlobWriter &blob_writer, BlobWriteSharing &blob_sharing, DictionaryValue &r_io_item)
static void serialize_field (const fn::GField &field, BlobWriter &, BlobWriteSharing &, DictionaryValue &r_io_item)
static void serialize_list (const nodes::GListPtr &list_ptr, BlobWriter &blob_writer, BlobWriteSharing &blob_sharing, DictionaryValue &r_io_item)
template<typename T>
static std::optional< T > deserialize_list_item (const DictionaryValue &io_value, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
template<typename T>
static std::optional< SocketValueVariant > deserialize_value_list (const DictionaryValue &io_item, const int num_items, const BlobReader &blob_reader, const BlobReadSharing &blob_sharing)
static void serialize_bake_item (const BakeValues::Item &item, BlobWriter &blob_writer, BlobWriteSharing &blob_sharing, DictionaryValue &r_io_item)
static std::unique_ptr< BakeMaterialsList > materials_to_weak_references (Material ***materials, short *materials_num, BakeDataBlockMap *data_block_map)
static void restore_materials (Material ***materials, short *materials_num, std::unique_ptr< BakeMaterialsList > materials_list, BakeDataBlockMap *data_block_map)
static bool value_variant_valid_for_socket (const SocketValueVariant &value, const CPPType &base_cpp_type)

Variables

static constexpr int bake_file_version = 3
static constexpr StringRef anonymous_bake_attribute_prefix = ".bake_"

Typedef Documentation

◆ DictionaryValuePtr

Definition at line 55 of file bake_items_serialize.cc.

Enumeration Type Documentation

◆ CacheStatus

Enumerator
Valid 

The cache is up-to-date with the inputs.

Invalid 

Nodes or input values have changed since the cache was created, i.e. the output would be different if the simulation was run again.

Baked 

The cache has been baked and will not be invalidated by changing inputs.

Definition at line 32 of file BKE_bake_geometry_nodes_modifier.hh.

◆ PackGeometryNodesBakeResult

Enumerator
NoDataFound 
PackedAlready 
Success 

Definition at line 29 of file BKE_bake_geometry_nodes_modifier_pack.hh.

◆ UnpackGeometryNodesBakeResult

Enumerator
BlendFileNotSaved 
NoPackedData 
Error 
Success 

Definition at line 41 of file BKE_bake_geometry_nodes_modifier_pack.hh.

Function Documentation

◆ deserialize_bake()

◆ deserialize_bake_item()

◆ deserialize_bundle_items()

◆ deserialize_float()

std::optional< float > blender::bke::bake::deserialize_float ( const io::serialize::Value & io_value)
static

◆ deserialize_float_array()

bool blender::bke::bake::deserialize_float_array ( const io::serialize::Value & io_value,
MutableSpan< float > r_values )
staticnodiscard

◆ deserialize_int()

template<typename T>
std::optional< T > blender::bke::bake::deserialize_int ( const io::serialize::Value & io_value)
static

◆ deserialize_int_array()

template<typename T>
bool blender::bke::bake::deserialize_int_array ( const io::serialize::Value & io_value,
MutableSpan< T > r_values )
staticnodiscard

◆ deserialize_list_item()

template<typename T>
std::optional< T > blender::bke::bake::deserialize_list_item ( const DictionaryValue & io_value,
const BlobReader & blob_reader,
const BlobReadSharing & blob_sharing )
static

◆ deserialize_primitive_value()

◆ deserialize_typed_array()

template<typename T>
bool blender::bke::bake::deserialize_typed_array ( const io::serialize::Value & io_value,
FunctionRef< std::optional< T >(const io::serialize::Value &io_element)> fn,
MutableSpan< T > r_values )
staticnodiscard

◆ deserialize_value_list()

◆ directory_is_empty()

◆ disk_bake_exists()

bool blender::bke::bake::disk_bake_exists ( const bke::bake::BakePath & path)
static

◆ escape_name()

std::string blender::bke::bake::escape_name ( const StringRef name)
static

Turn the name into something that can be used as file name. It does not necessarily have to be human readable, but it can help if it is at least partially readable.

Definition at line 218 of file bake_geometry_nodes_modifier.cc.

References escape_name().

Referenced by escape_name(), and get_modifier_directory_name().

◆ file_name_to_frame()

◆ find_sorted_meta_files()

◆ fix_frame_range()

IndexRange blender::bke::bake::fix_frame_range ( const int start,
const int end )
static

◆ frame_to_file_name()

std::string blender::bke::bake::frame_to_file_name ( const SubFrame & frame)

◆ get_blend_file_name()

◆ get_data_type_from_io_name()

◆ get_data_type_io_name()

◆ get_default_modifier_bake_directory()

std::string blender::bke::bake::get_default_modifier_bake_directory ( const Main & bmain,
const Object & object,
const NodesModifierData & nmd )

◆ get_default_node_bake_directory()

std::string blender::bke::bake::get_default_node_bake_directory ( const Main & bmain,
const Object & object,
const NodesModifierData & nmd,
int node_id )

◆ get_domain_from_io_name()

std::optional< AttrDomain > blender::bke::bake::get_domain_from_io_name ( const StringRefNull io_name)
static

◆ get_domain_io_name()

StringRefNull blender::bke::bake::get_domain_io_name ( const AttrDomain domain)
static

◆ get_modifier_bake_path()

◆ get_modifier_directory_name()

std::string blender::bke::bake::get_modifier_directory_name ( const Object & object,
const ModifierData & md )
static

◆ get_node_bake_frame_range()

◆ get_node_bake_path()

◆ get_node_bake_target()

◆ get_storage_type_from_io_name()

std::optional< AttrStorageType > blender::bke::bake::get_storage_type_from_io_name ( const StringRefNull io_name)
static

◆ get_storage_type_io_name()

StringRefNull blender::bke::bake::get_storage_type_io_name ( const AttrStorageType storage_type)
static

◆ load_attributes()

◆ load_geometry()

GeometrySet blender::bke::bake::load_geometry ( const DictionaryValue & io_geometry,
const BlobReader & blob_reader,
const BlobReadSharing & blob_sharing )
static

◆ load_materials()

◆ load_texspace()

◆ make_independent_file_name()

std::string blender::bke::bake::make_independent_file_name ( const StringRef base_name,
const int file_index,
const StringRef extension )
static

◆ materials_to_weak_references()

std::unique_ptr< BakeMaterialsList > blender::bke::bake::materials_to_weak_references ( Material *** materials,
short * materials_num,
BakeDataBlockMap * data_block_map )
static

◆ operator<<()

std::ostream & blender::bke::bake::operator<< ( std::ostream & stream,
const BakeDataBlockID & id )

Definition at line 41 of file bake_data_block_map.cc.

◆ pack_bake_from_disk()

◆ pack_files_from_directory()

◆ pack_geometry_nodes_bake()

◆ read_blob_raw_bytes()

bool blender::bke::bake::read_blob_raw_bytes ( const BlobReader & blob_reader,
const DictionaryValue & io_data,
const int64_t bytes_num,
void * r_data )
staticnodiscard

◆ read_blob_shared_simple_gspan()

const void * blender::bke::bake::read_blob_shared_simple_gspan ( const DictionaryValue & io_data,
const BlobReader & blob_reader,
const BlobReadSharing & blob_sharing,
const CPPType & cpp_type,
const int size,
const ImplicitSharingInfo ** r_sharing_info )
staticnodiscard

◆ read_blob_shared_simple_span()

template<typename T>
bool blender::bke::bake::read_blob_shared_simple_span ( const DictionaryValue & io_data,
const BlobReader & blob_reader,
const BlobReadSharing & blob_sharing,
const int size,
T ** r_data,
const ImplicitSharingInfo ** r_sharing_info )
staticnodiscard

◆ read_blob_simple_gspan()

bool blender::bke::bake::read_blob_simple_gspan ( const BlobReader & blob_reader,
const DictionaryValue & io_data,
GMutableSpan r_data )
staticnodiscard

◆ resolve_bake_directory()

◆ restore_materials()

void blender::bke::bake::restore_materials ( Material *** materials,
short * materials_num,
std::unique_ptr< BakeMaterialsList > materials_list,
BakeDataBlockMap * data_block_map )
static

◆ scene_simulation_states_reset()

void blender::bke::bake::scene_simulation_states_reset ( Scene & scene)

Reset all simulation caches in the scene, for use when some fundamental change made them impossible to reuse.

Definition at line 89 of file bake_geometry_nodes_modifier.cc.

References blender::NodesModifierRuntime::cache, blender::eModifierType_Nodes, FOREACH_SCENE_OBJECT_BEGIN, FOREACH_SCENE_OBJECT_END, blender::NodesModifierData::runtime, scene_simulation_states_reset(), and blender::ModifierData::type.

Referenced by scene_simulation_states_reset().

◆ serialize_attributes()

◆ serialize_bake()

◆ serialize_bake_item()

◆ serialize_bundle_items()

◆ serialize_curves_geometry()

◆ serialize_field()

◆ serialize_float_array()

std::shared_ptr< io::serialize::ArrayValue > blender::bke::bake::serialize_float_array ( const Span< float > values)
static

◆ serialize_geometry_set()

std::shared_ptr< DictionaryValue > blender::bke::bake::serialize_geometry_set ( const GeometrySet & geometry,
BlobWriter & blob_writer,
BlobWriteSharing & blob_sharing )
static

◆ serialize_int_array()

std::shared_ptr< io::serialize::ArrayValue > blender::bke::bake::serialize_int_array ( const Span< int > values)
static

Definition at line 1360 of file bake_items_serialize.cc.

References serialize_int_array().

Referenced by serialize_int_array(), and serialize_primitive_value().

◆ serialize_list()

◆ serialize_materials()

std::shared_ptr< io::serialize::ArrayValue > blender::bke::bake::serialize_materials ( const std::unique_ptr< BakeMaterialsList > & materials)
static

Definition at line 1074 of file bake_items_serialize.cc.

References serialize_materials().

Referenced by serialize_geometry_set(), and serialize_materials().

◆ serialize_primitive_value()

◆ serialize_single_value()

◆ serialize_socket_value_variant()

◆ serialize_texture_space()

void blender::bke::bake::serialize_texture_space ( const Mesh & mesh,
std::shared_ptr< DictionaryValue > io_mesh )
static

◆ try_load_curves()

◆ try_load_curves_geometry()

◆ try_load_geometry_bundle()

◆ try_load_grease_pencil()

◆ try_load_instances()

◆ try_load_mesh()

◆ try_load_pointcloud()

◆ unpack_bake_to_disk()

◆ unpack_geometry_nodes_bake()

◆ value_variant_valid_for_socket()

◆ write_blob_raw_bytes()

std::shared_ptr< DictionaryValue > blender::bke::bake::write_blob_raw_bytes ( BlobWriter & blob_writer,
BlobWriteSharing & blob_sharing,
const void * data,
const int64_t size_in_bytes )
static

◆ write_blob_shared_simple_gspan()

std::shared_ptr< DictionaryValue > blender::bke::bake::write_blob_shared_simple_gspan ( BlobWriter & blob_writer,
BlobWriteSharing & blob_sharing,
const GSpan data,
const ImplicitSharingInfo * sharing_info )
static

◆ write_blob_simple_gspan()

std::shared_ptr< DictionaryValue > blender::bke::bake::write_blob_simple_gspan ( BlobWriter & blob_writer,
BlobWriteSharing & blob_sharing,
const GSpan data )
static

Variable Documentation

◆ anonymous_bake_attribute_prefix

StringRef blender::bke::bake::anonymous_bake_attribute_prefix = ".bake_"
staticconstexpr

Anonymous attributes are renamed before they are written to the bake. This simplifies the names written to the bake and ensures that anonymous attributes are always handled explicitly.

Definition at line 48 of file bake_values.cc.

Referenced by blender::bke::bake::BakeToRuntimeValue::scan().

◆ bake_file_version

int blender::bke::bake::bake_file_version = 3
staticconstexpr

Definition at line 2031 of file bake_items_serialize.cc.

Referenced by deserialize_bake(), and serialize_bake().