Blender  V3.3
Classes | Macros | Typedefs | Functions | Variables
pointcache.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "DNA_ID.h"
#include "DNA_collection_types.h"
#include "DNA_dynamicpaint_types.h"
#include "DNA_fluid_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_simulation_types.h"
#include "BLI_blenlib.h"
#include "BLI_endian_switch.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "PIL_time.h"
#include "BKE_appdir.h"
#include "BKE_cloth.h"
#include "BKE_collection.h"
#include "BKE_dynamicpaint.h"
#include "BKE_fluid.h"
#include "BKE_global.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_scene.h"
#include "BKE_softbody.h"
#include "BLO_read_write.h"
#include "DEG_depsgraph_query.h"
#include "BIK_api.h"
#include <dirent.h>

Go to the source code of this file.

Classes

struct  PTCacheIDsFromObjectData
 

Macros

#define LZO_OUT_LEN(size)   ((size) + (size) / 16 + 64 + 3)
 
#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)
 

Typedefs

typedef bool(* ForeachPtcacheCb) (PTCacheID *pid, void *userdata)
 
typedef struct PTCacheIDsFromObjectData PTCacheIDsFromObjectData
 

Functions

static int ptcache_file_compressed_read (PTCacheFile *pf, unsigned char *result, unsigned int len)
 
static int ptcache_file_compressed_write (PTCacheFile *pf, unsigned char *in, unsigned int in_len, unsigned char *out, int mode)
 
static int ptcache_file_write (PTCacheFile *pf, const void *f, unsigned int tot, unsigned int size)
 
static int ptcache_file_read (PTCacheFile *pf, void *f, unsigned int tot, unsigned int size)
 
static int ptcache_basic_header_read (PTCacheFile *pf)
 
static int ptcache_basic_header_write (PTCacheFile *pf)
 
static void ptcache_add_extra_data (PTCacheMem *pm, unsigned int type, unsigned int count, void *data)
 
static int ptcache_softbody_write (int index, void *soft_v, void **data, int UNUSED(cfra))
 
static void ptcache_softbody_read (int index, void *soft_v, void **data, float UNUSED(cfra), const float *old_data)
 
static void ptcache_softbody_interpolate (int index, void *soft_v, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
 
static int ptcache_softbody_totpoint (void *soft_v, int UNUSED(cfra))
 
static void ptcache_softbody_error (const ID *UNUSED(owner_id), void *UNUSED(soft_v), const char *UNUSED(message))
 
void BKE_ptcache_make_particle_key (ParticleKey *key, int index, void **data, float time)
 
static int ptcache_particle_write (int index, void *psys_v, void **data, int cfra)
 
static void ptcache_particle_read (int index, void *psys_v, void **data, float cfra, const float *old_data)
 
static void ptcache_particle_interpolate (int index, void *psys_v, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
 
static int ptcache_particle_totpoint (void *psys_v, int UNUSED(cfra))
 
static void ptcache_particle_error (const ID *UNUSED(owner_id), void *UNUSED(psys_v), const char *UNUSED(message))
 
static int ptcache_particle_totwrite (void *psys_v, int cfra)
 
static void ptcache_particle_extra_write (void *psys_v, PTCacheMem *pm, int UNUSED(cfra))
 
static void ptcache_particle_extra_read (void *psys_v, PTCacheMem *pm, float UNUSED(cfra))
 
static int ptcache_cloth_write (int index, void *cloth_v, void **data, int UNUSED(cfra))
 
static void ptcache_cloth_read (int index, void *cloth_v, void **data, float UNUSED(cfra), const float *old_data)
 
static void ptcache_cloth_interpolate (int index, void *cloth_v, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
 
static void ptcache_cloth_extra_write (void *cloth_v, PTCacheMem *pm, int UNUSED(cfra))
 
static void ptcache_cloth_extra_read (void *cloth_v, PTCacheMem *pm, float UNUSED(cfra))
 
static int ptcache_cloth_totpoint (void *cloth_v, int UNUSED(cfra))
 
static void ptcache_cloth_error (const ID *owner_id, void *cloth_v, const char *message)
 
static int ptcache_dynamicpaint_totpoint (void *sd, int UNUSED(cfra))
 
static void ptcache_dynamicpaint_error (const ID *UNUSED(owner_id), void *UNUSED(sd), const char *UNUSED(message))
 
static int ptcache_dynamicpaint_write (PTCacheFile *pf, void *dp_v)
 
static int ptcache_dynamicpaint_read (PTCacheFile *pf, void *dp_v)
 
static int ptcache_rigidbody_write (int index, void *rb_v, void **data, int UNUSED(cfra))
 
static void ptcache_rigidbody_read (int index, void *rb_v, void **data, float UNUSED(cfra), const float *old_data)
 
static void ptcache_rigidbody_interpolate (int index, void *rb_v, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
 
static int ptcache_rigidbody_totpoint (void *rb_v, int UNUSED(cfra))
 
static void ptcache_rigidbody_error (const struct ID *UNUSED(owner_id), void *UNUSED(rb_v), const char *UNUSED(message))
 
void BKE_ptcache_id_from_softbody (PTCacheID *pid, Object *ob, SoftBody *sb)
 
void BKE_ptcache_id_from_particles (PTCacheID *pid, Object *ob, ParticleSystem *psys)
 
void BKE_ptcache_id_from_cloth (PTCacheID *pid, Object *ob, ClothModifierData *clmd)
 
void BKE_ptcache_id_from_smoke (PTCacheID *pid, struct Object *ob, struct FluidModifierData *fmd)
 
void BKE_ptcache_id_from_dynamicpaint (PTCacheID *pid, Object *ob, DynamicPaintSurface *surface)
 
void BKE_ptcache_id_from_rigidbody (PTCacheID *pid, Object *ob, RigidBodyWorld *rbw)
 
PTCacheID BKE_ptcache_id_find (Object *ob, Scene *scene, PointCache *cache)
 
static bool foreach_object_particle_ptcache (Object *object, ForeachPtcacheCb callback, void *callback_user_data)
 
static bool foreach_object_modifier_ptcache (Object *object, ForeachPtcacheCb callback, void *callback_user_data)
 
static bool foreach_object_ptcache (Scene *scene, Object *object, int duplis, ForeachPtcacheCb callback, void *callback_user_data)
 
static bool ptcache_ids_from_object_cb (PTCacheID *pid, void *userdata)
 
void BKE_ptcache_ids_from_object (ListBase *lb, Object *ob, Scene *scene, int duplis)
 
static bool ptcache_object_has_cb (PTCacheID *UNUSED(pid), void *UNUSED(userdata))
 
bool BKE_ptcache_object_has (struct Scene *scene, struct Object *ob, int duplis)
 
static const char * ptcache_file_extension (const PTCacheID *pid)
 
static int ptcache_frame_from_filename (const char *filename, const char *ext)
 
static int ptcache_path (PTCacheID *pid, char *filename)
 
static size_t ptcache_filename_ext_append (PTCacheID *pid, char *filename, const size_t filename_len, const bool use_frame_number, const int cfra)
 
static int ptcache_filename (PTCacheID *pid, char *filename, int cfra, const bool do_path, const bool do_ext)
 
static PTCacheFileptcache_file_open (PTCacheID *pid, int mode, int cfra)
 
static void ptcache_file_close (PTCacheFile *pf)
 
static int ptcache_file_data_read (PTCacheFile *pf)
 
static int ptcache_file_data_write (PTCacheFile *pf)
 
static int ptcache_file_header_begin_read (PTCacheFile *pf)
 
static int ptcache_file_header_begin_write (PTCacheFile *pf)
 
int BKE_ptcache_data_size (int data_type)
 
static void ptcache_file_pointers_init (PTCacheFile *pf)
 
int BKE_ptcache_mem_index_find (PTCacheMem *pm, unsigned int index)
 
void BKE_ptcache_mem_pointers_init (PTCacheMem *pm, void *cur[BPHYS_TOT_DATA])
 
void BKE_ptcache_mem_pointers_incr (void *cur[BPHYS_TOT_DATA])
 
int BKE_ptcache_mem_pointers_seek (int point_index, PTCacheMem *pm, void *cur[BPHYS_TOT_DATA])
 
static void ptcache_data_alloc (PTCacheMem *pm)
 
static void ptcache_data_free (PTCacheMem *pm)
 
static void ptcache_data_copy (void *from[], void *to[])
 
static void ptcache_extra_free (PTCacheMem *pm)
 
static void ptcache_mem_clear (PTCacheMem *pm)
 
static int ptcache_old_elemsize (PTCacheID *pid)
 
static void ptcache_find_frames_around (PTCacheID *pid, unsigned int frame, int *fra1, int *fra2)
 
static PTCacheMemptcache_disk_frame_to_mem (PTCacheID *pid, int cfra)
 
static int ptcache_mem_frame_to_disk (PTCacheID *pid, PTCacheMem *pm)
 
static int ptcache_read_stream (PTCacheID *pid, int cfra)
 
static int ptcache_read (PTCacheID *pid, int cfra)
 
static int ptcache_interpolate (PTCacheID *pid, float cfra, int cfra1, int cfra2)
 
int BKE_ptcache_read (PTCacheID *pid, float cfra, bool no_extrapolate_old)
 
static int ptcache_write_stream (PTCacheID *pid, int cfra, int totpoint)
 
static int ptcache_write (PTCacheID *pid, int cfra, int overwrite)
 
static int ptcache_write_needed (PTCacheID *pid, int cfra, int *overwrite)
 
int BKE_ptcache_write (PTCacheID *pid, unsigned int cfra)
 
void BKE_ptcache_id_clear (PTCacheID *pid, int mode, unsigned int cfra)
 
bool BKE_ptcache_id_exist (PTCacheID *pid, int cfra)
 
void BKE_ptcache_id_time (PTCacheID *pid, Scene *scene, float cfra, int *startframe, int *endframe, float *timescale)
 
int BKE_ptcache_id_reset (Scene *scene, PTCacheID *pid, int mode)
 
int BKE_ptcache_object_reset (Scene *scene, Object *ob, int mode)
 
PointCacheBKE_ptcache_add (ListBase *ptcaches)
 
void BKE_ptcache_free_mem (ListBase *mem_cache)
 
void BKE_ptcache_free (PointCache *cache)
 
void BKE_ptcache_free_list (ListBase *ptcaches)
 
static PointCacheptcache_copy (PointCache *cache, const bool copy_data)
 
PointCacheBKE_ptcache_copy_list (ListBase *ptcaches_new, const ListBase *ptcaches_old, const int flag)
 
void BKE_ptcache_quick_cache_all (Main *bmain, Scene *scene, ViewLayer *view_layer)
 
static void ptcache_dt_to_str (char *str, double dtime)
 
void BKE_ptcache_bake (PTCacheBaker *baker)
 
void BKE_ptcache_disk_to_mem (PTCacheID *pid)
 
void BKE_ptcache_mem_to_disk (PTCacheID *pid)
 
void BKE_ptcache_toggle_disk_cache (PTCacheID *pid)
 
void BKE_ptcache_disk_cache_rename (PTCacheID *pid, const char *name_src, const char *name_dst)
 
void BKE_ptcache_load_external (PTCacheID *pid)
 
void BKE_ptcache_update_info (PTCacheID *pid)
 
void BKE_ptcache_validate (PointCache *cache, int framenr)
 
void BKE_ptcache_invalidate (PointCache *cache)
 
void BKE_ptcache_blend_write (BlendWriter *writer, ListBase *ptcaches)
 
static void direct_link_pointcache_cb (BlendDataReader *reader, void *data)
 
static void direct_link_pointcache (BlendDataReader *reader, PointCache *cache)
 
void BKE_ptcache_blend_read_data (BlendDataReader *reader, ListBase *ptcaches, PointCache **ocache, int force_disk)
 

Variables

static CLG_LogRef LOG = {"bke.pointcache"}
 
static int ptcache_data_size []
 
static int ptcache_extra_datasize []
 
static const char * ptcache_data_struct []
 
static const char * ptcache_extra_struct []
 

Macro Definition Documentation

◆ DPAINT_CACHE_VERSION

#define DPAINT_CACHE_VERSION   "1.01"

Definition at line 676 of file pointcache.c.

◆ DURIAN_POINTCACHE_LIB_OK

#define DURIAN_POINTCACHE_LIB_OK   1

Definition at line 103 of file pointcache.c.

◆ LZO_OUT_LEN

#define LZO_OUT_LEN (   size)    ((size) + (size) / 16 + 64 + 3)

Definition at line 75 of file pointcache.c.

◆ MAX_PTCACHE_FILE

#define MAX_PTCACHE_FILE   (FILE_MAX * 2)

Definition at line 1307 of file pointcache.c.

◆ MAX_PTCACHE_PATH

#define MAX_PTCACHE_PATH   FILE_MAX

Definition at line 1306 of file pointcache.c.

◆ PTCACHE_DATA_FROM

#define PTCACHE_DATA_FROM (   data,
  type,
  from 
)
Value:
if (data[type]) { \
} \
(void)0
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
StackEntry * from
SyclQueue void void size_t num_bytes void
static int ptcache_data_size[]
Definition: pointcache.c:107

Definition at line 88 of file pointcache.c.

◆ 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), \
} \
(void)0

Definition at line 94 of file pointcache.c.

Typedef Documentation

◆ ForeachPtcacheCb

typedef bool(* ForeachPtcacheCb) (PTCacheID *pid, void *userdata)

Definition at line 1121 of file pointcache.c.

◆ PTCacheIDsFromObjectData

Function Documentation

◆ BKE_ptcache_add()

PointCache* BKE_ptcache_add ( ListBase ptcaches)

◆ BKE_ptcache_bake()

void BKE_ptcache_bake ( struct PTCacheBaker baker)

Bake cache or simulate to current frame with settings defined in the baker. if bake is not given run simulations to current frame.

Definition at line 3156 of file pointcache.c.

References PTCacheBaker::anim_init, PTCacheBaker::bake, bake(), PTCacheBaker::bake_job, BKE_ptcache_id_clear(), BKE_ptcache_id_from_particles(), BKE_ptcache_ids_from_object(), BKE_ptcache_write(), BKE_scene_graph_update_for_newframe(), BLI_assert, BLI_freelistN(), PTCacheID::cache, PTCacheID::calldata, RenderData::cfra, DEG_get_evaluated_object(), PTCacheBaker::depsgraph, depsgraph, PointCache::endframe, ListBase::first, PointCache::flag, float(), RenderData::framelen, G, GS, ID_OB, if(), PointCache::last_exact, MAX2, MAX_DUPLI_RECUR, MAXFRAME, MIN2, ID::name, PTCacheID::next, NULL, Base::object, PTCacheID::owner_id, ParticleSystem::part, PART_EMITTER, PART_HAIR, PART_PHYS_KEYED, ParticleSettings::phystype, PTCacheBaker::pid, PIL_check_seconds_timer(), psys_eval_get(), psys_get_pointcache_start_end(), PTCACHE_BAKED, PTCACHE_BAKING, PTCACHE_CLEAR_ALL, PTCACHE_DISK_CACHE, ptcache_dt_to_str(), PTCACHE_OUTDATED, PTCACHE_REDO_NEEDED, PTCACHE_SIMULATION_VALID, PTCACHE_TYPE_PARTICLES, PTCACHE_TYPE_RIGIDBODY, PTCACHE_TYPE_SMOKE_DOMAIN, PTCACHE_TYPE_SMOKE_HIGHRES, PTCacheBaker::quick_step, Scene::r, PTCacheBaker::render, PTCacheBaker::scene, scene, SETLOOPER_VIEW_LAYER, RenderData::sfra, PointCache::startframe, PTCacheID::type, ParticleSettings::type, PTCacheBaker::update_progress, and PTCacheBaker::view_layer.

Referenced by BKE_ptcache_quick_cache_all(), ptcache_bake_exec(), ptcache_job_startjob(), and update_physics_cache().

◆ BKE_ptcache_blend_read_data()

void BKE_ptcache_blend_read_data ( BlendDataReader reader,
ListBase ptcaches,
PointCache **  ocache,
int  force_disk 
)

◆ BKE_ptcache_blend_write()

void BKE_ptcache_blend_write ( BlendWriter writer,
ListBase ptcaches 
)

◆ BKE_ptcache_copy_list()

PointCache* BKE_ptcache_copy_list ( ListBase ptcaches_new,
const ListBase ptcaches_old,
const int  flag 
)

◆ BKE_ptcache_data_size()

int BKE_ptcache_data_size ( int  data_type)

Size of cache data type.

Definition at line 1707 of file pointcache.c.

References ptcache_data_size.

Referenced by direct_link_pointcache_cb().

◆ BKE_ptcache_disk_cache_rename()

void BKE_ptcache_disk_cache_rename ( struct PTCacheID pid,
const char *  name_src,
const char *  name_dst 
)

◆ BKE_ptcache_disk_to_mem()

void BKE_ptcache_disk_to_mem ( struct PTCacheID pid)

◆ BKE_ptcache_free()

void BKE_ptcache_free ( PointCache cache)

◆ BKE_ptcache_free_list()

void BKE_ptcache_free_list ( ListBase ptcaches)

◆ BKE_ptcache_free_mem()

void BKE_ptcache_free_mem ( ListBase mem_cache)

◆ BKE_ptcache_id_clear()

void BKE_ptcache_id_clear ( PTCacheID pid,
int  mode,
unsigned int  cfra 
)

◆ BKE_ptcache_id_exist()

bool BKE_ptcache_id_exist ( PTCacheID pid,
int  cfra 
)

◆ BKE_ptcache_id_find()

PTCacheID BKE_ptcache_id_find ( struct Object ob,
struct Scene scene,
struct PointCache cache 
)
Parameters
obOptional, may be NULL.
sceneOptional may be NULL.

Definition at line 1092 of file pointcache.c.

References BKE_ptcache_ids_from_object(), BLI_freelistN(), LISTBASE_FOREACH, MAX_DUPLI_RECUR, result, and scene.

Referenced by ptcache_add_new_exec(), ptcache_baker_create(), and ptcache_remove_exec().

◆ BKE_ptcache_id_from_cloth()

void BKE_ptcache_id_from_cloth ( PTCacheID pid,
Object ob,
ClothModifierData clmd 
)

◆ BKE_ptcache_id_from_dynamicpaint()

void BKE_ptcache_id_from_dynamicpaint ( PTCacheID pid,
Object ob,
DynamicPaintSurface surface 
)

◆ BKE_ptcache_id_from_particles()

void BKE_ptcache_id_from_particles ( PTCacheID pid,
Object ob,
ParticleSystem psys 
)

Definition at line 900 of file pointcache.c.

References ParticleSettings::avefac, ParticleSettings::avemode, BPHYS_DATA_AVELOCITY, BPHYS_DATA_BOIDS, BPHYS_DATA_INDEX, BPHYS_DATA_LOCATION, BPHYS_DATA_ROTATION, BPHYS_DATA_TIMES, BPHYS_DATA_VELOCITY, PTCacheID::cache, PTCacheID::cache_ptr, PTCacheID::calldata, PTCacheID::data_types, PTCacheID::default_step, PTCacheID::error, PTCacheID::file_type, PTCacheID::flag, SPHFluidSettings::flag, ParticleSettings::flag, ParticleSettings::fluid, Object::id, PointCache::index, PTCacheID::info_types, PTCacheID::interpolate_extra_data, PTCacheID::interpolate_point, PTCacheID::max_step, NULL, PTCacheID::owner_id, ParticleSystem::part, PART_AVE_RAND, PART_HAIR, PART_PHYS_BOIDS, PART_PHYS_FLUID, PART_ROT_VEL, PART_ROTATIONS, ParticleSettings::phystype, ParticleSystem::pointcache, ptcache_basic_header_read(), ptcache_basic_header_write(), PTCACHE_FILE_PTCACHE, ptcache_particle_error(), ptcache_particle_extra_read(), ptcache_particle_extra_write(), ptcache_particle_interpolate(), ptcache_particle_read(), ptcache_particle_totpoint(), ptcache_particle_totwrite(), ptcache_particle_write(), PTCACHE_TYPE_PARTICLES, PTCACHE_VEL_PER_SEC, PTCacheID::ptcaches, ParticleSystem::ptcaches, PTCacheID::read_extra_data, PTCacheID::read_header, PTCacheID::read_point, PTCacheID::read_stream, ParticleSettings::rotmode, SPH_VISCOELASTIC_SPRINGS, PTCacheID::stack_index, PTCacheID::totpoint, PTCacheID::totwrite, PTCacheID::type, ParticleSettings::type, PTCacheID::write_extra_data, PTCacheID::write_header, PTCacheID::write_point, and PTCacheID::write_stream.

Referenced by BKE_ptcache_bake(), BKE_ptcache_object_reset(), foreach_object_particle_ptcache(), free_hair(), psys_changed_type(), psys_make_temp_pointcache(), psys_prepare_physics(), and system_step().

◆ BKE_ptcache_id_from_rigidbody()

void BKE_ptcache_id_from_rigidbody ( PTCacheID pid,
Object ob,
RigidBodyWorld rbw 
)

◆ BKE_ptcache_id_from_smoke()

void BKE_ptcache_id_from_smoke ( PTCacheID pid,
struct Object ob,
struct FluidModifierData fmd 
)

The fluid modifier does not actually use this anymore, but some parts of Blender expect that it still has a point cache currently. For example, the fluid modifier uses DEG_add_collision_relations, which internally creates relations with the point cache.

Definition at line 999 of file pointcache.c.

References PTCacheID::cache, PTCacheID::cache_ptr, PTCacheID::calldata, FluidModifierData::domain, Object::id, PointCache::index, PTCacheID::owner_id, FluidDomainSettings::point_cache, PTCACHE_TYPE_SMOKE_DOMAIN, PTCacheID::ptcaches, FluidDomainSettings::ptcaches, PTCacheID::stack_index, and PTCacheID::type.

Referenced by BKE_ptcache_object_reset(), and foreach_object_modifier_ptcache().

◆ BKE_ptcache_id_from_softbody()

void BKE_ptcache_id_from_softbody ( PTCacheID pid,
Object ob,
SoftBody sb 
)

◆ BKE_ptcache_id_reset()

int BKE_ptcache_id_reset ( Scene scene,
PTCacheID pid,
int  mode 
)

◆ BKE_ptcache_id_time()

void BKE_ptcache_id_time ( PTCacheID pid,
Scene scene,
float  cfra,
int *  startframe,
int *  endframe,
float timescale 
)

◆ BKE_ptcache_ids_from_object()

void BKE_ptcache_ids_from_object ( ListBase lb,
Object ob,
Scene scene,
int  duplis 
)

◆ BKE_ptcache_invalidate()

void BKE_ptcache_invalidate ( struct PointCache cache)

◆ BKE_ptcache_load_external()

void BKE_ptcache_load_external ( struct PTCacheID pid)

◆ BKE_ptcache_make_particle_key()

void BKE_ptcache_make_particle_key ( ParticleKey key,
int  index,
void **  data,
float  time 
)

◆ BKE_ptcache_mem_index_find()

int BKE_ptcache_mem_index_find ( struct PTCacheMem pm,
unsigned int  index 
)

Is point with index in memory cache? Check to see if point number "index" is in pm (uses binary search for index data).

Definition at line 1727 of file pointcache.c.

References BPHYS_DATA_INDEX, data, PTCacheMem::data, high(), low(), and PTCacheMem::totpoint.

Referenced by BKE_ptcache_mem_pointers_seek(), get_pointcache_keys_for_time(), get_pointcache_times_for_particle(), and psys_get_dietime_from_cache().

◆ BKE_ptcache_mem_pointers_incr()

void BKE_ptcache_mem_pointers_incr ( void cur[BPHYS_TOT_DATA])

◆ BKE_ptcache_mem_pointers_init()

void BKE_ptcache_mem_pointers_init ( PTCacheMem pm,
void cur[BPHYS_TOT_DATA] 
)

◆ BKE_ptcache_mem_pointers_seek()

int BKE_ptcache_mem_pointers_seek ( int  point_index,
PTCacheMem pm,
void cur[BPHYS_TOT_DATA] 
)

◆ BKE_ptcache_mem_to_disk()

void BKE_ptcache_mem_to_disk ( struct PTCacheID pid)

◆ BKE_ptcache_object_has()

bool BKE_ptcache_object_has ( struct Scene scene,
struct Object ob,
int  duplis 
)

◆ BKE_ptcache_object_reset()

int BKE_ptcache_object_reset ( Scene scene,
Object ob,
int  mode 
)

◆ BKE_ptcache_quick_cache_all()

void BKE_ptcache_quick_cache_all ( struct Main bmain,
struct Scene scene,
struct ViewLayer view_layer 
)

◆ BKE_ptcache_read()

int BKE_ptcache_read ( PTCacheID pid,
float  cfra,
bool  no_extrapolate_old 
)

◆ BKE_ptcache_toggle_disk_cache()

void BKE_ptcache_toggle_disk_cache ( struct PTCacheID pid)

◆ BKE_ptcache_update_info()

void BKE_ptcache_update_info ( PTCacheID pid)

◆ BKE_ptcache_validate()

void BKE_ptcache_validate ( struct PointCache cache,
int  framenr 
)

Set correct flags after successful simulation step.

Definition at line 3789 of file pointcache.c.

References PointCache::flag, PTCACHE_SIMULATION_VALID, and PointCache::simframe.

Referenced by clothModifier_do(), dynamicPaint_frameUpdate(), sbObjectStep(), and system_step().

◆ BKE_ptcache_write()

int BKE_ptcache_write ( PTCacheID pid,
unsigned int  cfra 
)

◆ direct_link_pointcache()

static void direct_link_pointcache ( BlendDataReader reader,
PointCache cache 
)
static

◆ direct_link_pointcache_cb()

static void direct_link_pointcache_cb ( BlendDataReader reader,
void data 
)
static

◆ foreach_object_modifier_ptcache()

static bool foreach_object_modifier_ptcache ( Object object,
ForeachPtcacheCb  callback,
void callback_user_data 
)
static

◆ foreach_object_particle_ptcache()

static bool foreach_object_particle_ptcache ( Object object,
ForeachPtcacheCb  callback,
void callback_user_data 
)
static

◆ foreach_object_ptcache()

static bool foreach_object_ptcache ( Scene scene,
Object object,
int  duplis,
ForeachPtcacheCb  callback,
void callback_user_data 
)
static

◆ ptcache_add_extra_data()

static void ptcache_add_extra_data ( PTCacheMem pm,
unsigned int  type,
unsigned int  count,
void data 
)
static

◆ ptcache_basic_header_read()

static int ptcache_basic_header_read ( PTCacheFile pf)
static

◆ ptcache_basic_header_write()

static int ptcache_basic_header_write ( PTCacheFile pf)
static

◆ ptcache_cloth_error()

static void ptcache_cloth_error ( const ID owner_id,
void cloth_v,
const char *  message 
)
static

◆ ptcache_cloth_extra_read()

static void ptcache_cloth_extra_read ( void cloth_v,
PTCacheMem pm,
float   UNUSEDcfra 
)
static

◆ ptcache_cloth_extra_write()

static void ptcache_cloth_extra_write ( void cloth_v,
PTCacheMem pm,
int   UNUSEDcfra 
)
static

◆ ptcache_cloth_interpolate()

static void ptcache_cloth_interpolate ( int  index,
void cloth_v,
void **  data,
float  cfra,
float  cfra1,
float  cfra2,
const float old_data 
)
static

◆ ptcache_cloth_read()

static void ptcache_cloth_read ( int  index,
void cloth_v,
void **  data,
float   UNUSEDcfra,
const float old_data 
)
static

◆ ptcache_cloth_totpoint()

static int ptcache_cloth_totpoint ( void cloth_v,
int   UNUSEDcfra 
)
static

Definition at line 642 of file pointcache.c.

References ClothModifierData::clothObject, and Cloth::mvert_num.

Referenced by BKE_ptcache_id_from_cloth().

◆ ptcache_cloth_write()

static int ptcache_cloth_write ( int  index,
void cloth_v,
void **  data,
int   UNUSEDcfra 
)
static

◆ ptcache_copy()

static PointCache* ptcache_copy ( PointCache cache,
const bool  copy_data 
)
static

◆ ptcache_data_alloc()

static void ptcache_data_alloc ( PTCacheMem pm)
static

◆ ptcache_data_copy()

static void ptcache_data_copy ( void from[],
void to[] 
)
static

Definition at line 1825 of file pointcache.c.

References BPHYS_TOT_DATA, from, and ptcache_data_size.

Referenced by ptcache_disk_frame_to_mem(), and ptcache_mem_frame_to_disk().

◆ ptcache_data_free()

static void ptcache_data_free ( PTCacheMem pm)
static

Definition at line 1814 of file pointcache.c.

References BPHYS_TOT_DATA, data, PTCacheMem::data, and MEM_freeN.

Referenced by ptcache_mem_clear().

◆ ptcache_disk_frame_to_mem()

static PTCacheMem* ptcache_disk_frame_to_mem ( PTCacheID pid,
int  cfra 
)
static

◆ ptcache_dt_to_str()

static void ptcache_dt_to_str ( char *  str,
double  dtime 
)
static

Definition at line 3140 of file pointcache.c.

References str.

Referenced by BKE_ptcache_bake().

◆ ptcache_dynamicpaint_error()

static void ptcache_dynamicpaint_error ( const ID UNUSEDowner_id,
void UNUSEDsd,
const char *  UNUSEDmessage 
)
static

Definition at line 669 of file pointcache.c.

Referenced by BKE_ptcache_id_from_dynamicpaint().

◆ ptcache_dynamicpaint_read()

static int ptcache_dynamicpaint_read ( PTCacheFile pf,
void dp_v 
)
static

◆ ptcache_dynamicpaint_totpoint()

static int ptcache_dynamicpaint_totpoint ( void sd,
int   UNUSEDcfra 
)
static

Definition at line 658 of file pointcache.c.

References surface.

Referenced by BKE_ptcache_id_from_dynamicpaint().

◆ ptcache_dynamicpaint_write()

static int ptcache_dynamicpaint_write ( PTCacheFile pf,
void dp_v 
)
static

◆ ptcache_extra_free()

static void ptcache_extra_free ( PTCacheMem pm)
static

◆ ptcache_file_close()

static void ptcache_file_close ( PTCacheFile pf)
static

◆ ptcache_file_compressed_read()

static int ptcache_file_compressed_read ( PTCacheFile pf,
unsigned char *  result,
unsigned int  len 
)
static

◆ ptcache_file_compressed_write()

static int ptcache_file_compressed_write ( PTCacheFile pf,
unsigned char *  in,
unsigned int  in_len,
unsigned char *  out,
int  mode 
)
static

◆ ptcache_file_data_read()

static int ptcache_file_data_read ( PTCacheFile pf)
static

Definition at line 1633 of file pointcache.c.

References BPHYS_TOT_DATA, pf, ptcache_data_size, and ptcache_file_read().

Referenced by ptcache_disk_frame_to_mem().

◆ ptcache_file_data_write()

static int ptcache_file_data_write ( PTCacheFile pf)
static

Definition at line 1646 of file pointcache.c.

References BPHYS_TOT_DATA, pf, ptcache_data_size, and ptcache_file_write().

Referenced by ptcache_mem_frame_to_disk().

◆ ptcache_file_extension()

static const char* ptcache_file_extension ( const PTCacheID pid)
static

◆ ptcache_file_header_begin_read()

static int ptcache_file_header_begin_read ( PTCacheFile pf)
static

◆ ptcache_file_header_begin_write()

static int ptcache_file_header_begin_write ( PTCacheFile pf)
static

Definition at line 1689 of file pointcache.c.

References pf.

Referenced by ptcache_mem_frame_to_disk(), and ptcache_write_stream().

◆ ptcache_file_open()

static PTCacheFile* ptcache_file_open ( PTCacheID pid,
int  mode,
int  cfra 
)
static

◆ ptcache_file_pointers_init()

static void ptcache_file_pointers_init ( PTCacheFile pf)
static

◆ ptcache_file_read()

static int ptcache_file_read ( PTCacheFile pf,
void f,
unsigned int  tot,
unsigned int  size 
)
static

◆ ptcache_file_write()

static int ptcache_file_write ( PTCacheFile pf,
const void f,
unsigned int  tot,
unsigned int  size 
)
static

◆ ptcache_filename()

static int ptcache_filename ( PTCacheID pid,
char *  filename,
int  cfra,
const bool  do_path,
const bool  do_ext 
)
static

◆ ptcache_filename_ext_append()

static size_t ptcache_filename_ext_append ( PTCacheID pid,
char *  filename,
const size_t  filename_len,
const bool  use_frame_number,
const int  cfra 
)
static

◆ ptcache_find_frames_around()

static void ptcache_find_frames_around ( PTCacheID pid,
unsigned int  frame,
int *  fra1,
int *  fra2 
)
static

◆ ptcache_frame_from_filename()

static int ptcache_frame_from_filename ( const char *  filename,
const char *  ext 
)
static

Similar to BLI_path_frame_get, but takes into account the stack-index which is after the frame.

Definition at line 1282 of file pointcache.c.

References BLI_strncpy(), frame_len(), and len.

Referenced by BKE_ptcache_disk_cache_rename(), BKE_ptcache_id_clear(), BKE_ptcache_id_time(), and BKE_ptcache_load_external().

◆ ptcache_ids_from_object_cb()

static bool ptcache_ids_from_object_cb ( PTCacheID pid,
void userdata 
)
static

Definition at line 1241 of file pointcache.c.

References BLI_addtail(), data, and MEM_mallocN.

Referenced by BKE_ptcache_ids_from_object().

◆ ptcache_interpolate()

static int ptcache_interpolate ( PTCacheID pid,
float  cfra,
int  cfra1,
int  cfra2 
)
static

◆ ptcache_mem_clear()

static void ptcache_mem_clear ( PTCacheMem pm)
static

◆ ptcache_mem_frame_to_disk()

static int ptcache_mem_frame_to_disk ( PTCacheID pid,
PTCacheMem pm 
)
static

◆ ptcache_object_has_cb()

static bool ptcache_object_has_cb ( PTCacheID UNUSEDpid,
void UNUSEDuserdata 
)
static

Definition at line 1258 of file pointcache.c.

Referenced by BKE_ptcache_object_has().

◆ ptcache_old_elemsize()

static int ptcache_old_elemsize ( PTCacheID pid)
static

◆ ptcache_particle_error()

static void ptcache_particle_error ( const ID UNUSEDowner_id,
void UNUSEDpsys_v,
const char *  UNUSEDmessage 
)
static

Definition at line 471 of file pointcache.c.

Referenced by BKE_ptcache_id_from_particles().

◆ ptcache_particle_extra_read()

static void ptcache_particle_extra_read ( void psys_v,
PTCacheMem pm,
float   UNUSEDcfra 
)
static

◆ ptcache_particle_extra_write()

static void ptcache_particle_extra_write ( void psys_v,
PTCacheMem pm,
int   UNUSEDcfra 
)
static

◆ ptcache_particle_interpolate()

static void ptcache_particle_interpolate ( int  index,
void psys_v,
void **  data,
float  cfra,
float  cfra1,
float  cfra2,
const float old_data 
)
static

◆ ptcache_particle_read()

static void ptcache_particle_read ( int  index,
void psys_v,
void **  data,
float  cfra,
const float old_data 
)
static

◆ ptcache_particle_totpoint()

static int ptcache_particle_totpoint ( void psys_v,
int   UNUSEDcfra 
)
static

Definition at line 465 of file pointcache.c.

References ParticleSystem::totpart.

Referenced by BKE_ptcache_id_from_particles().

◆ ptcache_particle_totwrite()

static int ptcache_particle_totwrite ( void psys_v,
int  cfra 
)
static

◆ ptcache_particle_write()

static int ptcache_particle_write ( int  index,
void psys_v,
void **  data,
int  cfra 
)
static

◆ ptcache_path()

static int ptcache_path ( PTCacheID pid,
char *  filename 
)
static

◆ ptcache_read()

static int ptcache_read ( PTCacheID pid,
int  cfra 
)
static

◆ ptcache_read_stream()

static int ptcache_read_stream ( PTCacheID pid,
int  cfra 
)
static

◆ ptcache_rigidbody_error()

static void ptcache_rigidbody_error ( const struct ID UNUSEDowner_id,
void UNUSEDrb_v,
const char *  UNUSEDmessage 
)
static

Definition at line 855 of file pointcache.c.

Referenced by BKE_ptcache_id_from_rigidbody().

◆ ptcache_rigidbody_interpolate()

static void ptcache_rigidbody_interpolate ( int  index,
void rb_v,
void **  data,
float  cfra,
float  cfra1,
float  cfra2,
const float old_data 
)
static

◆ ptcache_rigidbody_read()

static void ptcache_rigidbody_read ( int  index,
void rb_v,
void **  data,
float   UNUSEDcfra,
const float old_data 
)
static

◆ ptcache_rigidbody_totpoint()

static int ptcache_rigidbody_totpoint ( void rb_v,
int   UNUSEDcfra 
)
static

Definition at line 848 of file pointcache.c.

References RigidBodyWorld::numbodies.

Referenced by BKE_ptcache_id_from_rigidbody().

◆ ptcache_rigidbody_write()

static int ptcache_rigidbody_write ( int  index,
void rb_v,
void **  data,
int   UNUSEDcfra 
)
static

◆ ptcache_softbody_error()

static void ptcache_softbody_error ( const ID UNUSEDowner_id,
void UNUSEDsoft_v,
const char *  UNUSEDmessage 
)
static

Definition at line 248 of file pointcache.c.

Referenced by BKE_ptcache_id_from_softbody().

◆ ptcache_softbody_interpolate()

static void ptcache_softbody_interpolate ( int  index,
void soft_v,
void **  data,
float  cfra,
float  cfra1,
float  cfra2,
const float old_data 
)
static

◆ ptcache_softbody_read()

static void ptcache_softbody_read ( int  index,
void soft_v,
void **  data,
float   UNUSEDcfra,
const float old_data 
)
static

◆ ptcache_softbody_totpoint()

static int ptcache_softbody_totpoint ( void soft_v,
int   UNUSEDcfra 
)
static

Definition at line 243 of file pointcache.c.

References SoftBody::totpoint.

Referenced by BKE_ptcache_id_from_softbody().

◆ ptcache_softbody_write()

static int ptcache_softbody_write ( int  index,
void soft_v,
void **  data,
int   UNUSEDcfra 
)
static

◆ ptcache_write()

static int ptcache_write ( PTCacheID pid,
int  cfra,
int  overwrite 
)
static

◆ ptcache_write_needed()

static int ptcache_write_needed ( PTCacheID pid,
int  cfra,
int *  overwrite 
)
static

◆ ptcache_write_stream()

static int ptcache_write_stream ( PTCacheID pid,
int  cfra,
int  totpoint 
)
static

Variable Documentation

◆ LOG

CLG_LogRef LOG = {"bke.pointcache"}
static

Definition at line 105 of file pointcache.c.

Referenced by ptcache_dynamicpaint_read().

◆ ptcache_data_size

int ptcache_data_size[]
static
Initial value:
= {
sizeof(unsigned int),
sizeof(float[3]),
sizeof(float[3]),
sizeof(float[4]),
sizeof(float[3]),
sizeof(float),
sizeof(float[3]),
sizeof(BoidData),
}

Definition at line 107 of file pointcache.c.

Referenced by BKE_ptcache_data_size(), BKE_ptcache_mem_pointers_incr(), BKE_ptcache_mem_pointers_seek(), ptcache_data_alloc(), ptcache_data_copy(), ptcache_disk_frame_to_mem(), ptcache_file_data_read(), ptcache_file_data_write(), and ptcache_mem_frame_to_disk().

◆ ptcache_data_struct

const char* ptcache_data_struct[]
static
Initial value:
= {
"",
"",
"",
"",
"",
"",
"",
"BoidData",
}

Definition at line 3805 of file pointcache.c.

Referenced by BKE_ptcache_blend_write(), and direct_link_pointcache_cb().

◆ ptcache_extra_datasize

int ptcache_extra_datasize[]
static
Initial value:
= {
0,
sizeof(ParticleSpring),
sizeof(float[3]),
}
struct ParticleSpring ParticleSpring

Definition at line 118 of file pointcache.c.

Referenced by ptcache_add_extra_data(), ptcache_disk_frame_to_mem(), and ptcache_mem_frame_to_disk().

◆ ptcache_extra_struct

const char* ptcache_extra_struct[]
static
Initial value:
= {
"",
"ParticleSpring",
"vec3f",
}

Definition at line 3815 of file pointcache.c.

Referenced by BKE_ptcache_blend_write().