Blender V5.3
pointcache.cc File Reference
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
#include "DNA_dynamicpaint_types.h"
#include "DNA_fluid_types.h"
#include "DNA_layer_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_force_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "BLI_compression.hh"
#include "BLI_fileops.hh"
#include "BLI_listbase.hh"
#include "BLI_math_rotation_c.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_path_utils.hh"
#include "BLI_string.hh"
#include "BLI_string_utf8.hh"
#include "BLI_time.hh"
#include "BLI_utildefines.hh"
#include "BLT_translation.hh"
#include "BKE_appdir.hh"
#include "BKE_cloth.hh"
#include "BKE_collection.hh"
#include "BKE_duplilist.hh"
#include "BKE_dynamicpaint.h"
#include "BKE_fluid.h"
#include "BKE_global.hh"
#include "BKE_lib_id.hh"
#include "BKE_library.hh"
#include "BKE_main.hh"
#include "BKE_modifier.hh"
#include "BKE_object.hh"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_scene.hh"
#include "BKE_softbody.h"
#include "BLO_read_write.hh"
#include "DEG_depsgraph_query.hh"
#include "BIK_api.h"
#include <zstd.h>

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define PTCACHE_DATA_FROM(data, type, from)
#define PTCACHE_DATA_TO(data, type, index, to)
#define DURIAN_POINTCACHE_LIB_OK   1
#define DPAINT_CACHE_VERSION   "1.01"
#define MAX_PTCACHE_PATH   FILE_MAX
#define MAX_PTCACHE_FILE   (FILE_MAX * 2)

Functions

static bool blender::ptcache_file_compressed_read (PTCacheFile *pf, uchar *result, size_t items_num, size_t item_size)
static bool blender::ptcache_file_compressed_write (PTCacheFile *pf, const void *data, size_t items_num, size_t item_size)
static bool blender::ptcache_file_write (PTCacheFile *pf, const void *data, size_t items_num, size_t item_size)
static bool blender::ptcache_file_read (PTCacheFile *pf, void *f, size_t items_num, size_t item_size)
static int blender::ptcache_basic_header_read (PTCacheFile *pf)
static int blender::ptcache_basic_header_write (PTCacheFile *pf)
static void blender::ptcache_add_extra_data (PTCacheMem *pm, ePointCache_ExtraDataType type, uint count, void *data)
static int blender::ptcache_softbody_write (int index, void *soft_v, void **data, int)
static void blender::ptcache_softbody_read (int index, void *soft_v, void **data, float, const float *old_data)
static void blender::ptcache_softbody_interpolate (int index, void *soft_v, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
static int blender::ptcache_softbody_totpoint (void *soft_v, int)
static void blender::ptcache_softbody_error (const ID *, void *, const char *)
void blender::BKE_ptcache_make_particle_key (struct ParticleKey *key, int index, void **data, float time)
static int blender::ptcache_particle_write (int index, void *psys_v, void **data, int cfra)
static void blender::ptcache_particle_read (int index, void *psys_v, void **data, float cfra, const float *old_data)
static void blender::ptcache_particle_interpolate (int index, void *psys_v, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
static int blender::ptcache_particle_totpoint (void *psys_v, int)
static void blender::ptcache_particle_error (const ID *, void *, const char *)
static int blender::ptcache_particle_totwrite (void *psys_v, int cfra)
static void blender::ptcache_particle_extra_write (void *psys_v, PTCacheMem *pm, int)
static void blender::ptcache_particle_extra_read (void *psys_v, PTCacheMem *pm, float)
static int blender::ptcache_cloth_write (int index, void *cloth_v, void **data, int)
static void blender::ptcache_cloth_read (int index, void *cloth_v, void **data, float, const float *old_data)
static void blender::ptcache_cloth_interpolate (int index, void *cloth_v, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
static void blender::ptcache_cloth_extra_write (void *cloth_v, PTCacheMem *pm, int)
static void blender::ptcache_cloth_extra_read (void *cloth_v, PTCacheMem *pm, float)
static int blender::ptcache_cloth_totpoint (void *cloth_v, int)
static void blender::ptcache_cloth_error (const ID *owner_id, void *cloth_v, const char *message)
static int blender::ptcache_dynamicpaint_totpoint (void *sd, int)
static void blender::ptcache_dynamicpaint_error (const ID *, void *, const char *)
static int blender::ptcache_dynamicpaint_write (PTCacheFile *pf, void *dp_v)
static int blender::ptcache_dynamicpaint_read (PTCacheFile *pf, void *dp_v)
static int blender::ptcache_rigidbody_write (int index, void *rb_v, void **data, int)
static void blender::ptcache_rigidbody_read (int index, void *rb_v, void **data, float, const float *old_data)
static void blender::ptcache_rigidbody_interpolate (int index, void *rb_v, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
static int blender::ptcache_rigidbody_totpoint (void *rb_v, int)
static void blender::ptcache_rigidbody_error (const ID *, void *, const char *)
void blender::BKE_ptcache_id_from_softbody (PTCacheID *pid, struct Object *ob, struct SoftBody *sb)
void blender::BKE_ptcache_id_from_particles (PTCacheID *pid, struct Object *ob, struct ParticleSystem *psys)
void blender::BKE_ptcache_id_from_cloth (PTCacheID *pid, struct Object *ob, struct ClothModifierData *clmd)
void blender::BKE_ptcache_id_from_smoke (PTCacheID *pid, struct Object *ob, struct FluidModifierData *fmd)
void blender::BKE_ptcache_id_from_dynamicpaint (PTCacheID *pid, struct Object *ob, struct DynamicPaintSurface *surface)
void blender::BKE_ptcache_id_from_rigidbody (PTCacheID *pid, struct Object *ob, struct RigidBodyWorld *rbw)
PTCacheID blender::BKE_ptcache_id_find (struct Object *ob, struct Scene *scene, struct PointCache *cache)
static bool blender::foreach_object_particle_ptcache (Object *object, PointCacheIdFn callback)
static bool blender::foreach_object_modifier_ptcache (Object *object, PointCacheIdFn callback)
static bool blender::foreach_object_ptcache (Scene *scene, Object *object, int duplis, PointCacheIdFn callback)
void blender::BKE_ptcache_ids_from_object (ListBaseT< PTCacheID > *lb, struct Object *ob, struct Scene *scene, int duplis)
void blender::BKE_ptcache_foreach_object_cache (struct Object &ob, struct Scene &scene, bool duplis, PointCacheIdFn fn)
bool blender::BKE_ptcache_object_has (struct Scene *scene, struct Object *ob, int duplis)
static const char * blender::ptcache_file_extension (const PTCacheID *pid)
static int blender::ptcache_frame_from_filename (const char *filename, const char *ext)
int blender::BKE_ptcache_path (PTCacheID *pid, char dirname[MAX_PTCACHE_PATH])
static size_t blender::ptcache_filepath_ext_append (PTCacheID *pid, char filepath[MAX_PTCACHE_FILE], const size_t filepath_len, const bool use_frame_number, const int cfra)
static int blender::ptcache_filepath (PTCacheID *pid, char filepath[MAX_PTCACHE_FILE], int cfra, const bool do_path, const bool do_ext)
static PTCacheFile * blender::ptcache_file_open (PTCacheID *pid, int mode, int cfra)
static void blender::ptcache_file_close (PTCacheFile *pf)
static int blender::ptcache_file_header_begin_read (PTCacheFile *pf)
static int blender::ptcache_file_header_begin_write (PTCacheFile *pf)
int blender::BKE_ptcache_data_size (int data_type)
static void blender::ptcache_file_pointers_init (PTCacheFile *pf)
int blender::BKE_ptcache_mem_index_find (struct PTCacheMem *pm, unsigned int index)
void blender::BKE_ptcache_mem_pointers_init (struct PTCacheMem *pm, void *cur[BPHYS_TOT_DATA])
void blender::BKE_ptcache_mem_pointers_incr (void *cur[BPHYS_TOT_DATA])
int blender::BKE_ptcache_mem_pointers_seek (int point_index, struct PTCacheMem *pm, void *cur[BPHYS_TOT_DATA])
static bool blender::ptcache_data_alloc (PTCacheMem *pm, const bool zero_init)
static void blender::ptcache_data_free (PTCacheMem *pm)
static void blender::ptcache_extra_free (PTCacheMem *pm)
static void blender::ptcache_mem_clear (PTCacheMem *pm)
static int blender::ptcache_old_elemsize (PTCacheID *pid)
static void blender::ptcache_find_frames_around (PTCacheID *pid, uint frame, int *r_fra1, int *r_fra2)
static bool blender::ptcache_file_points_read (PTCacheFile *pf, PTCacheMem *pm)
static PTCacheMem * blender::ptcache_disk_frame_to_mem (PTCacheID *pid, int cfra)
static int blender::ptcache_mem_frame_to_disk (PTCacheID *pid, PTCacheMem *pm)
static int blender::ptcache_read_stream (PTCacheID *pid, int cfra)
static int blender::ptcache_read (PTCacheID *pid, int cfra)
static int blender::ptcache_interpolate (PTCacheID *pid, float cfra, int cfra1, int cfra2)
int blender::BKE_ptcache_read (PTCacheID *pid, float cfra, bool no_extrapolate_old)
static int blender::ptcache_write_stream (PTCacheID *pid, int cfra, int totpoint)
static int blender::ptcache_write (PTCacheID *pid, int cfra, int overwrite)
static int blender::ptcache_write_needed (PTCacheID *pid, int cfra, int *overwrite)
int blender::BKE_ptcache_write (PTCacheID *pid, unsigned int cfra)
void blender::BKE_ptcache_id_clear (PTCacheID *pid, int mode, unsigned int cfra)
bool blender::BKE_ptcache_id_exist (PTCacheID *pid, int cfra)
void blender::BKE_ptcache_id_time (PTCacheID *pid, struct Scene *scene, float cfra, int *startframe, int *endframe, float *timescale)
int blender::BKE_ptcache_id_reset (struct Scene *scene, PTCacheID *pid, int mode)
int blender::BKE_ptcache_object_reset (struct Scene *scene, struct Object *ob, int mode)
struct PointCache * blender::BKE_ptcache_add (ListBaseT< PointCache > *ptcaches)
void blender::BKE_ptcache_free_mem (ListBaseT< PTCacheMem > *mem_cache)
void blender::BKE_ptcache_free (struct PointCache *cache)
void blender::BKE_ptcache_free_list (ListBaseT< PointCache > *ptcaches)
static PointCache * blender::ptcache_copy (PointCache *cache, const bool copy_data)
struct PointCache * blender::BKE_ptcache_copy_list (ListBaseT< PointCache > *ptcaches_new, const ListBaseT< PointCache > *ptcaches_old, int flag)
void blender::BKE_ptcache_quick_cache_all (struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer)
static void blender::ptcache_dt_to_str (char *str, size_t str_maxncpy, double dtime)
void blender::BKE_ptcache_bake (struct PTCacheBaker *baker)
void blender::BKE_ptcache_disk_to_mem (struct PTCacheID *pid)
void blender::BKE_ptcache_mem_to_disk (struct PTCacheID *pid)
void blender::BKE_ptcache_toggle_disk_cache (struct PTCacheID *pid)
void blender::BKE_ptcache_disk_cache_rename (struct PTCacheID *pid, const char *name_src, const char *name_dst)
void blender::BKE_ptcache_load_external (struct PTCacheID *pid)
void blender::BKE_ptcache_update_info (PTCacheID *pid)
void blender::BKE_ptcache_validate (struct PointCache *cache, int framenr)
void blender::BKE_ptcache_invalidate (struct PointCache *cache)
void blender::BKE_ptcache_blend_write (struct BlendWriter *writer, ListBaseT< PointCache > *ptcaches)
static void blender::direct_link_pointcache_mem (BlendDataReader *reader, PTCacheMem *pm)
static void blender::direct_link_pointcache (BlendDataReader *reader, PointCache *cache)
void blender::BKE_ptcache_blend_read_data (struct BlendDataReader *reader, ListBaseT< PointCache > *ptcaches, struct PointCache **ocache, int force_disk)

Variables

static CLG_LogRef blender::LOG = {"physics.pointcache"}
static int blender::ptcache_data_size []
static int blender::ptcache_extra_datasize []

Macro Definition Documentation

◆ DPAINT_CACHE_VERSION

#define DPAINT_CACHE_VERSION   "1.01"

◆ DURIAN_POINTCACHE_LIB_OK

#define DURIAN_POINTCACHE_LIB_OK   1

Definition at line 99 of file pointcache.cc.

◆ MAX_PTCACHE_FILE

◆ MAX_PTCACHE_PATH

◆ PTCACHE_DATA_FROM

#define PTCACHE_DATA_FROM ( data,
type,
from )
Value:
if (data[type]) { \
memcpy(data[type], from, ptcache_data_size[type]); \
} \
(void)0

Definition at line 84 of file pointcache.cc.

Referenced by blender::ptcache_cloth_write(), blender::ptcache_particle_write(), blender::ptcache_rigidbody_write(), and blender::ptcache_softbody_write().

◆ PTCACHE_DATA_TO

#define PTCACHE_DATA_TO ( data,
type,
index,
to )
Value:
if (data[type]) { \
memcpy(to, \
(char *)(data)[type] + ((index) ? (index) * ptcache_data_size[type] : 0), \
ptcache_data_size[type]); \
} \
(void)0
#define index(i)

Definition at line 90 of file pointcache.cc.

Referenced by blender::BKE_ptcache_make_particle_key(), blender::ptcache_cloth_read(), blender::ptcache_particle_read(), blender::ptcache_rigidbody_interpolate(), blender::ptcache_rigidbody_read(), and blender::ptcache_softbody_read().