77# ifdef WITH_SYSTEM_LZO
78# include <lzo/lzo1x.h>
82# define LZO_HEAP_ALLOC(var, size) \
83 lzo_align_t __LZO_MMODEL var[((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t)]
86#define LZO_OUT_LEN(size) ((size) + (size) / 16 + 64 + 3)
92#define PTCACHE_DATA_FROM(data, type, from) \
94 memcpy(data[type], from, ptcache_data_size[type]); \
98#define PTCACHE_DATA_TO(data, type, index, to) \
101 (char *)(data)[type] + ((index) ? (index) * ptcache_data_size[type] : 0), \
102 ptcache_data_size[type]); \
107#define DURIAN_POINTCACHE_LIB_OK 1
141 if (!
error && !fread(&
pf->totpoint,
sizeof(
uint), 1,
pf->fp)) {
145 if (!
error && !fread(&
pf->data_types,
sizeof(
uint), 1,
pf->fp)) {
154 if (!fwrite(&
pf->totpoint,
sizeof(
uint), 1,
pf->fp)) {
158 if (!fwrite(&
pf->data_types,
sizeof(
uint), 1,
pf->fp)) {
190 int index,
void *soft_v,
void **
data,
float ,
const float *old_data)
196 memcpy(bp->
pos,
data,
sizeof(
float[3]));
197 memcpy(bp->
vec,
data + 3,
sizeof(
float[3]));
210 const float *old_data)
217 if (cfra1 == cfra2) {
225 memcpy(keys[2].co, old_data,
sizeof(
float[3]));
226 memcpy(keys[2].vel, old_data + 3,
sizeof(
float[3]));
232 dfra = cfra2 - cfra1;
286 if (cfra < pa->time -
step) {
292 const int pa_sfra = int(pa->
time) -
step;
294 if (!(cfra >= pa_sfra && cfra <= pa_efra)) {
321 int index,
void *psys_v,
void **
data,
float cfra,
const float *old_data)
348 if (cfra < pa->time) {
394 const float *old_data)
412 if (!(cfra1 >= pa_sfra && cfra1 <= pa_efra)) {
416 cfra = std::min(cfra, pa->
dietime);
417 cfra1 = std::min(cfra1, pa->
dietime);
418 cfra2 = std::min(cfra2, pa->
dietime);
420 if (cfra1 == cfra2) {
426 keys[2] = *
reinterpret_cast<const ParticleKey *
>(old_data);
434 if (keys[1].time > keys[2].time) {
436 mul_v3_fl(keys[2].vel, (keys[1].time - keys[2].time) * timestep);
440 mul_v3_fl(keys[2].vel, (keys[2].time - keys[1].time) * timestep);
449 if (cfra > pa->
time) {
450 cfra1 = std::max(cfra1, pa->
time);
453 dfra = cfra2 - cfra1;
492 for (p = 0; p < psys->
totpart; p++, pa++) {
493 const int pa_sfra = int(pa->
time) -
step;
494 totwrite += (cfra >= pa_sfra);
498 for (p = 0; p < psys->
totpart; p++, pa++) {
500 const int pa_sfra = int(pa->
time) -
step;
502 totwrite += (cfra >= pa_sfra) && (cfra <= pa_efra);
527 for (; extra; extra = extra->
next) {
528 switch (extra->
type) {
556 int index,
void *cloth_v,
void **
data,
float ,
const float *old_data)
563 memcpy(vert->
x,
data,
sizeof(
float[3]));
564 memcpy(vert->
xconst,
data + 3,
sizeof(
float[3]));
565 memcpy(vert->
v,
data + 6,
sizeof(
float[3]));
579 const float *old_data)
587 if (cfra1 == cfra2) {
595 memcpy(keys[2].co, old_data,
sizeof(
float[3]));
596 memcpy(keys[2].vel, old_data + 6,
sizeof(
float[3]));
602 dfra = cfra2 - cfra1;
634 for (; extra; extra = extra->
next) {
635 switch (extra->
type) {
664 if (!surface->
data) {
678#define DPAINT_CACHE_VERSION "1.01"
700 in_len =
sizeof(float) * total_points;
736 if (surface_type != surface->
type) {
745 data_len =
sizeof(float);
786 int index,
void *rb_v,
void **
data,
float ,
const float *old_data)
801 memcpy(rbo->
pos,
data,
sizeof(
float[3]));
802 memcpy(rbo->
orn,
data + 3,
sizeof(
float[4]));
817 const float *old_data)
833 float pos[3], orn[4];
836 memcpy(
pos,
data,
sizeof(
float[3]));
837 memcpy(orn,
data + 3,
sizeof(
float[4]));
844 const float t = (cfra - cfra1) / (cfra2 - cfra1);
1063 pid->
owner_id = ob !=
nullptr ? &ob->
id :
nullptr;
1104 if (pid->cache == cache) {
1133 if (psys->part ==
nullptr) {
1151 if (!callback(pid,
nullptr)) {
1166 if (!callback(pid, md)) {
1174 if (!callback(pid, md)) {
1184 for (; surface; surface = surface->
next) {
1186 if (!callback(pid, md)) {
1204 if (
object !=
nullptr) {
1206 if (object->
soft !=
nullptr) {
1208 if (!callback(pid,
nullptr)) {
1225 if (current_object ==
object) {
1235 if (scene !=
nullptr && (
object ==
nullptr || object->
rigidbody_object !=
nullptr) &&
1239 if (!callback(pid,
nullptr)) {
1264 bool has_point_cache =
false;
1266 has_point_cache =
true;
1269 return has_point_cache;
1289 const int ext_len =
frame_len + strlen(ext);
1290 const int len = strlen(filename);
1293 if (
len > ext_len) {
1310#define MAX_PTCACHE_PATH FILE_MAX
1311#define MAX_PTCACHE_FILE (FILE_MAX * 2)
1318 lib->runtime->filepath_abs :
1330 if ((blendfile_path[0] !=
'\0') ||
lib) {
1353 const size_t filepath_len,
1354 const bool use_frame_number,
1357 size_t len = filepath_len;
1359 filename_ext = filepath + filepath_len;
1360 *filename_ext =
'\0';
1369 if (use_frame_number) {
1417 if (blendfile_path[0] ==
'\0') {
1430 while (
'\0' != *idname) {
1460#ifndef DURIAN_POINTCACHE_LIB_OK
1468 if (blendfile_path[0] ==
'\0') {
1509 uchar compressed = 0;
1512 size_t out_len =
len;
1521 in_len = size_t(
size);
1529 if (compressed == 1) {
1530 r = lzo1x_decompress_safe(
in, (lzo_uint)in_len,
result, (lzo_uint *)&out_len,
nullptr);
1534 if (compressed == 2) {
1536 size_t leni = in_len, leno =
len;
1538 sizeOfIt = size_t(
size);
1540 r = LzmaUncompress(
result, &leno,
in, &leni, props, sizeOfIt);
1558 uchar compressed = 0;
1561 size_t sizeOfIt = 5;
1568 LZO_HEAP_ALLOC(wrkmem, LZO1X_MEM_COMPRESS);
1570 r = lzo1x_1_compress(
in, (lzo_uint)in_len,
out, (lzo_uint *)&out_len, wrkmem);
1571 if (!(r == LZO_E_OK) || (out_len >= in_len)) {
1582 r = LzmaCompress(
out,
1596 if (!(r == SZ_OK) || (out_len >= in_len)) {
1615 if (compressed == 2) {
1627 return (fread(f,
size, tot,
pf->fp) == tot);
1631 return (fwrite(f,
size, tot,
pf->fp) == tot);
1651 if ((
pf->data_types & (1 <<
i)) &&
1668 if (fread(bphysics,
sizeof(
char), 8,
pf->fp) != 8) {
1676 if (!
error && !fread(&typeflag,
sizeof(
uint), 1,
pf->fp)) {
1692 const char *bphysics =
"BPHYSICS";
1693 uint typeflag =
pf->type +
pf->flag;
1695 if (fwrite(bphysics,
sizeof(
char), 8,
pf->fp) != 8) {
1699 if (!fwrite(&typeflag,
sizeof(
uint), 1,
pf->fp)) {
1715 int data_types =
pf->data_types;
1737 if (index < *data || index > *(
data + high)) {
1742 if (index - *
data < high &&
data[index - *
data] == index) {
1743 return index - *
data;
1746 while (low <= high) {
1747 mid = (low + high) / 2;
1749 if (
data[mid] > index) {
1752 else if (
data[mid] < index) {
1763 return (index < pm->totpoint ? index : -1);
1772 cur[
i] = ((data_types & (1 <<
i)) ? pm->
data[
i] :
nullptr);
1814 if (data_types & (1 <<
i)) {
1836 if (from[
i] && to[
i]) {
1847 for (; extra; extra = extra->
next) {
1866 return sizeof(
float[6]);
1872 return sizeof(
float[9]);
1881 int cfra1 = frame, cfra2 = frame + 1;
1887 if (cfra1 < pid->cache->startframe) {
1899 if (cfra1 && !cfra2) {
1916 if (pm2->
frame < frame) {
1927 *r_fra2 = pm->
frame;
1930 *r_fra1 = pm->
frame;
1931 *r_fra2 = pm2->
frame;
1942 if (
pf ==
nullptr) {
1966 if (
pf->data_types & (1 <<
i)) {
1993 extra->
type = extratype;
1998 "Pointcache extradata->data");
2021 printf(
"Error reading from disk cache\n");
2035 if (
pf ==
nullptr) {
2037 printf(
"Error opening disk cache file for writing\n");
2090 for (; extra; extra = extra->
next) {
2091 if (extra->
data ==
nullptr || extra->
totdata == 0) {
2114 printf(
"Error writing to disk cache\n");
2129 if (
pf ==
nullptr) {
2131 printf(
"Error opening disk cache file for reading\n");
2140 else if (
pf->type != pid->
type) {
2181 while (pm && pm->
frame != cfra) {
2193 if (totpoint != pid_totpoint) {
2195 totpoint = std::min(totpoint, pid_totpoint);
2202 for (
i = 0;
i < totpoint;
i++) {
2238 while (pm && pm->
frame != cfra2) {
2250 if (totpoint != pid_totpoint) {
2252 totpoint = std::min(totpoint, pid_totpoint);
2259 for (
i = 0;
i < totpoint;
i++) {
2265 *index, pid->
calldata, cur, cfra,
float(cfra1),
float(cfra2),
nullptr);
2285 int cfrai = int(
floor(cfra)), cfra1 = 0, cfra2 = 0;
2308 if (cfra1 == 0 && cfra2 == 0) {
2313 if (no_extrapolate_old) {
2314 if (cfra1 == 0 && cfra2 && cfra2 <= pid->cache->simframe) {
2317 if (cfra1 && cfra1 == cfra2) {
2323 if (cfra1 && cfra1 == cfra2) {
2369 if (cfra <= pid->cache->last_exact) {
2387 if (
pf ==
nullptr) {
2389 printf(
"Error opening disk cache file for writing\n");
2395 pf->totpoint = totpoint;
2410 printf(
"Error writing to disk cache\n");
2448 for (
i = 0;
i < totpoint;
i++) {
2492 int ofra = 0, efra = cache->
endframe;
2524 if (pm ==
nullptr) {
2532 if (efra >= cache->
startframe && cfra > efra) {
2553 int overwrite = 0,
error = 0;
2619#ifndef DURIAN_POINTCACHE_LIB_OK
2635 if (dir ==
nullptr) {
2643 if (
len <
sizeof(filepath) - 2) {
2650 while ((de =
readdir(dir)) !=
nullptr) {
2651 if (strstr(de->
d_name, ext)) {
2690 for (; pm; pm = pm->
next) {
2730 for (; pm; pm = pm->
next) {
2731 if (pm->
frame == cfra) {
2753 if (cfra < pid->cache->startframe || cfra > pid->
cache->
endframe) {
2771 for (; pm; pm = pm->
next) {
2772 if (pm->
frame == cfra) {
2779 PTCacheID *pid,
Scene *scene,
float cfra,
int *startframe,
int *endframe,
float *timescale)
2784 float time, nexttime;
2804 *timescale = std::max(nexttime - time, 0.0f);
2807 if (startframe && endframe) {
2827 "cached frames array");
2843 if (dir ==
nullptr) {
2849 while ((de =
readdir(dir)) !=
nullptr) {
2850 if (strstr(de->
d_name, ext)) {
2855 if ((frame != -1) && (frame >= sta && frame <= end)) {
2955 else if (psys->clmd) {
2967 if (skip == 0 && psys->part) {
2984 for (; surface; surface = surface->
next) {
3040 for (; pm; pm = pm->
next) {
3101 ncache->
edit =
nullptr;
3114 for (; cache; cache = cache->
next) {
3130 memset(&baker, 0,
sizeof(baker));
3131 baker.
bmain = bmain;
3132 baker.
scene = scene;
3145 if (dtime > 3600.0) {
3150 int(dtime / 60) % 60,
3154 BLI_snprintf(
str, str_maxncpy,
"%im %is",
int(dtime / 60) % 60,
int(dtime) % 60);
3173 int cfrao = scene->
r.
cfra;
3176 int render = baker->
render;
3228 endframe = std::min(endframe, cache->
endframe);
3268 startframe = std::min(startframe, cache->
startframe);
3270 if (
bake || render) {
3274 endframe = std::max(endframe, cache->
endframe);
3285 scene->
r.
cfra = startframe;
3290 bool use_timer =
false;
3291 double stime, ptime, ctime, fetd;
3292 char run[32], cur[32], etd[32];
3297 for (
int fr = scene->
r.
cfra; fr <= endframe; fr += baker->quick_step, scene->
r.
cfra = fr) {
3301 float progress = (float(scene->
r.
cfra - startframe) / float(endframe - startframe));
3306 printf(
"bake: frame %d :: %d\n", scene->
r.
cfra, endframe);
3311 fetd = (ctime - ptime) * (endframe - scene->
r.
cfra) / baker->
quick_step;
3313 if (use_timer || fetd > 60.0) {
3320 printf(
"Baked for %s, current frame: %i/%i (%.3fs), ETC: %s\r",
3322 scene->
r.
cfra - startframe + 1,
3323 endframe - startframe + 1,
3332 if (cancel ||
G.is_break) {
3342 printf(
"\nBake %s %s (%i frames simulated).\n",
3343 (cancel ?
"canceled after" :
"finished in"),
3345 scene->
r.
cfra - startframe);
3421 scene->
r.
cfra = cfrao;
3446 cache->
flag |= baked;
3448 for (cfra = sfra; cfra <= efra; cfra++) {
3469 cache->
flag |= baked;
3471 for (; pm; pm = pm->
next) {
3489 if (blendfile_path[0] ==
'\0') {
3492 printf(
"File must be saved before using disk cache!\n");
3542 if (
STREQ(name_src, name_dst)) {
3556 if (dir ==
nullptr) {
3566 while ((de =
readdir(dir)) !=
nullptr) {
3567 if (strstr(de->
d_name, ext)) {
3610 if (dir ==
nullptr) {
3616 if (cache->
index >= 0) {
3623 while ((de =
readdir(dir)) !=
nullptr) {
3624 if (strstr(de->
d_name, ext)) {
3631 start = std::min(start, frame);
3632 end = std::max(end, frame);
3709 for (; cfra <= cache->
endframe; cfra++) {
3719 else if (totframes && cache->
totpoint) {
3733 SNPRINTF(mem_info,
RPT_(
"%i cells + High Resolution cached"), totpoint);
3742 for (; cfra <= cache->
endframe; cfra++) {
3748 SNPRINTF(mem_info,
RPT_(
"%i frames on disk"), totframes);
3755 long long int bytes = 0.0f;
3758 for (; pm; pm = pm->
next) {
3776 SNPRINTF(mem_info,
RPT_(
"%s frames in memory (%s)"), formatted_tot, formatted_mem);
3816 if (pm->data[
i] && pm->data_types & (1 <<
i)) {
3822 writer, pm->totpoint,
reinterpret_cast<uint32_t *
>(pm->data[
i]));
3840 else if (extra->data) {
3874 else if (extra->data) {
3875 extra->data =
nullptr;
3894 cache->
edit =
nullptr;
3905 if (ptcaches->
first) {
3923 (*ocache)->step = 1;
3926 ptcaches->
first = ptcaches->
last = *ocache;
void BIK_clear_cache(struct bPose *pose)
void cloth_free_modifier(ClothModifierData *clmd)
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_END
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(_collection, _object)
constexpr int MAX_DUPLI_RECUR
void dynamicPaint_clearSurface(const struct Scene *scene, struct DynamicPaintSurface *surface)
const char * BKE_main_blendfile_path_from_global()
void BKE_modifier_set_error(const Object *ob, ModifierData *md, const char *format,...) ATTR_PRINTF_FORMAT(3
General operations, lookup, etc. for blender objects.
int BKE_object_insert_ptcache(Object *ob)
void BKE_object_delete_ptcache(Object *ob, int index)
void psys_get_pointcache_start_end(struct Scene *scene, ParticleSystem *psys, int *sfra, int *efra)
void psys_interpolate_particle(short type, struct ParticleKey keys[4], float dt, struct ParticleKey *result, bool velocity)
void psys_reset(struct ParticleSystem *psys, int mode)
struct ParticleSystem * psys_eval_get(struct Depsgraph *depsgraph, struct Object *object, struct ParticleSystem *psys)
#define PSYS_RESET_DEPSGRAPH
#define PTCACHE_TYPEFLAG_TYPEMASK
#define PTCACHE_FILE_READ
#define PTCACHE_TYPE_SMOKE_HIGHRES
#define PTCACHE_VEL_PER_SEC
#define PTCACHE_FILE_WRITE
#define PTCACHE_CLEAR_BEFORE
#define PTCACHE_CLEAR_AFTER
#define PTCACHE_TYPE_CLOTH
#define PTCACHE_TYPE_DYNAMICPAINT
bool BKE_ptcache_id_exist(PTCacheID *pid, int cfra)
blender::FunctionRef< bool(PTCacheID &pid, ModifierData *md)> PointCacheIdFn
#define PTCACHE_CLEAR_ALL
#define PTCACHE_READ_INTERPOLATED
#define PTCACHE_TYPE_PARTICLES
#define PTCACHE_TYPEFLAG_FLAGMASK
#define PTCACHE_TYPE_SOFTBODY
#define PTCACHE_TYPEFLAG_COMPRESS
#define PTCACHE_FILE_UPDATE
#define PTCACHE_CLEAR_FRAME
#define PTCACHE_TYPE_SMOKE_DOMAIN
#define PTCACHE_RESET_OUTDATED
#define PTCACHE_TYPE_RIGIDBODY
#define PTCACHE_RESET_DEPSGRAPH
#define PTCACHE_RESET_BAKED
#define PTCACHE_READ_EXACT
#define PTCACHE_TYPEFLAG_EXTRADATA
float BKE_scene_ctime_get(const Scene *scene)
#define SETLOOPER_VIEW_LAYER(_sce_basis, _view_layer, _sce_iter, _base)
void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph)
float BKE_scene_frame_to_ctime(const Scene *scene, int frame)
void sbFreeSimulation(struct SoftBody *sb)
#define BLI_assert_unreachable()
File and directory operations.
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
int BLI_delete(const char *path, bool dir, bool recursive) ATTR_NONNULL()
int BLI_rename_overwrite(const char *from, const char *to) ATTR_NONNULL()
int BLI_fseek(FILE *stream, int64_t offset, int whence)
bool BLI_file_ensure_parent_dir_exists(const char *filepath) ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
void interp_qt_qtqt(float q[4], const float a[4], const float b[4], float t)
void vec_to_quat(float q[4], const float vec[3], short axis, short upflag)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void zero_v3(float r[3])
ATTR_WARN_UNUSED_RESULT const size_t num
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
bool bool BLI_path_extension_strip(char *path) ATTR_NONNULL(1)
#define BLI_path_join(...)
void void void BLI_path_split_file_part(const char *filepath, char *file, size_t file_maxncpy) ATTR_NONNULL(1
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
int BLI_path_slash_ensure(char *path, size_t path_maxncpy) ATTR_NONNULL(1)
size_t BLI_str_format_int_grouped(char dst[BLI_STR_FORMAT_INT32_GROUPED_SIZE], int num) ATTR_NONNULL(1)
#define BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE
#define SNPRINTF(dst, format,...)
#define BLI_STR_FORMAT_INT32_GROUPED_SIZE
void BLI_str_format_byte_unit(char dst[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE], long long int bytes, bool base_10) ATTR_NONNULL(1)
size_t BLI_snprintf_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * STRNCPY(char(&dst)[N], const char *src)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char char size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
Platform independent time functions.
double BLI_time_now_seconds(void)
#define STREQLEN(a, b, n)
Compatibility-like things for windows.
struct dirent * readdir(DIR *dp)
const char * dirname(char *path)
DIR * opendir(const char *path)
void BLO_write_float_array(BlendWriter *writer, int64_t num, const float *data_ptr)
void BLO_read_uint32_array(BlendDataReader *reader, int64_t array_size, uint32_t **ptr_p)
void BLO_read_float_array(BlendDataReader *reader, int64_t array_size, float **ptr_p)
#define BLO_write_struct(writer, struct_name, data_ptr)
#define BLO_write_struct_array(writer, struct_name, array_size, data_ptr)
#define BLO_read_struct_list(reader, struct_name, list)
void BLO_write_uint32_array(BlendWriter *writer, int64_t num, const uint32_t *data_ptr)
#define BLO_read_struct_array(reader, struct_name, array_size, ptr_p)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define CLOG_ERROR(clg_ref,...)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
ID and Library types, which are fundamental for SDNA.
@ MOD_DPAINT_SURFACE_F_IMAGESEQ
@ MOD_DPAINT_SURFACE_T_WEIGHT
@ MOD_DPAINT_SURFACE_T_PAINT
@ MOD_DPAINT_SURFACE_T_DISPLACE
@ MOD_DPAINT_SURFACE_T_WAVE
@ FLUID_DOMAIN_CACHE_REPLAY
@ eModifierType_DynamicPaint
Object is a sort of wrapper for general info.
@ SPH_VISCOELASTIC_SPRINGS
@ BPHYS_EXTRA_FLUID_SPRINGS
@ BPHYS_EXTRA_CLOTH_ACCELERATION
@ PTCACHE_FLAG_INFO_DIRTY
@ PTCACHE_SIMULATION_VALID
@ BPHYS_DATA_DYNAMICPAINT
Types and defines for representing Rigid Body entities.
Read Guarded memory(de)allocation.
static void copy_data(const ModifierData *md, ModifierData *target, const int flag)
static float frame_len(const Frame *frame)
Rigid Body API for interfacing with external Physics Engines.
BMesh const char void * data
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void reset()
clear internal cached data and reset random seed
#define pf(_x, _i)
Prefetch 64.
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
void * MEM_mallocN(size_t len, const char *str)
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
size_t(* MEM_allocN_len)(const void *vmemh)
void MEM_freeN(void *vmemh)
static void error(const char *str)
static void clear(Message &msg)
static int ptcache_rigidbody_totpoint(void *rb_v, int)
int BKE_ptcache_data_size(int data_type)
static int ptcache_file_write(PTCacheFile *pf, const void *f, uint tot, uint size)
#define PTCACHE_DATA_FROM(data, type, from)
int BKE_ptcache_mem_index_find(PTCacheMem *pm, uint index)
static int ptcache_basic_header_read(PTCacheFile *pf)
static void ptcache_data_copy(void *from[], void *to[])
void BKE_ptcache_disk_to_mem(PTCacheID *pid)
void BKE_ptcache_mem_pointers_incr(void *cur[BPHYS_TOT_DATA])
static int ptcache_cloth_totpoint(void *cloth_v, int)
static int ptcache_softbody_totpoint(void *soft_v, int)
static PTCacheFile * ptcache_file_open(PTCacheID *pid, int mode, int cfra)
static int ptcache_particle_totwrite(void *psys_v, int cfra)
static int ptcache_file_compressed_write(PTCacheFile *pf, uchar *in, uint in_len, uchar *out, int mode)
static void ptcache_particle_interpolate(int index, void *psys_v, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
static void ptcache_add_extra_data(PTCacheMem *pm, uint type, uint count, void *data)
PTCacheID BKE_ptcache_id_find(Object *ob, Scene *scene, PointCache *cache)
void BKE_ptcache_invalidate(PointCache *cache)
void BKE_ptcache_load_external(PTCacheID *pid)
static void ptcache_file_close(PTCacheFile *pf)
static int ptcache_filepath(PTCacheID *pid, char filepath[MAX_PTCACHE_FILE], int cfra, const bool do_path, const bool do_ext)
static int ptcache_read(PTCacheID *pid, int cfra)
static int ptcache_dynamicpaint_totpoint(void *sd, int)
static void ptcache_cloth_extra_write(void *cloth_v, PTCacheMem *pm, int)
void BKE_ptcache_mem_to_disk(PTCacheID *pid)
static const char * ptcache_file_extension(const PTCacheID *pid)
void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, float time)
static void ptcache_softbody_read(int index, void *soft_v, void **data, float, const float *old_data)
static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v)
static int ptcache_data_size[]
void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, Object *ob, RigidBodyWorld *rbw)
void BKE_ptcache_id_from_dynamicpaint(PTCacheID *pid, Object *ob, DynamicPaintSurface *surface)
static void direct_link_pointcache_mem(BlendDataReader *reader, PTCacheMem *pm)
static void ptcache_data_alloc(PTCacheMem *pm)
static void ptcache_cloth_extra_read(void *cloth_v, PTCacheMem *pm, float)
void BKE_ptcache_foreach_object_cache(Object &ob, Scene &scene, bool duplis, PointCacheIdFn fn)
static int ptcache_write(PTCacheID *pid, int cfra, int overwrite)
void BKE_ptcache_update_info(PTCacheID *pid)
static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
void BKE_ptcache_id_clear(PTCacheID *pid, int mode, uint cfra)
static int ptcache_write_stream(PTCacheID *pid, int cfra, int totpoint)
static int ptcache_cloth_write(int index, void *cloth_v, void **data, int)
void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startframe, int *endframe, float *timescale)
static void direct_link_pointcache(BlendDataReader *reader, PointCache *cache)
static PTCacheMem * ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
static int ptcache_particle_totpoint(void *psys_v, int)
static int ptcache_file_data_write(PTCacheFile *pf)
static void ptcache_file_pointers_init(PTCacheFile *pf)
bool BKE_ptcache_id_exist(PTCacheID *pid, int cfra)
void BKE_ptcache_free_mem(ListBase *mem_cache)
void BKE_ptcache_free_list(ListBase *ptcaches)
static int ptcache_read_stream(PTCacheID *pid, int cfra)
static void ptcache_cloth_interpolate(int index, void *cloth_v, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
void BKE_ptcache_quick_cache_all(Main *bmain, Scene *scene, ViewLayer *view_layer)
static int ptcache_rigidbody_write(int index, void *rb_v, void **data, int)
static int ptcache_path(PTCacheID *pid, char dirname[MAX_PTCACHE_PATH])
static void ptcache_particle_extra_write(void *psys_v, PTCacheMem *pm, int)
void BKE_ptcache_mem_pointers_init(PTCacheMem *pm, void *cur[BPHYS_TOT_DATA])
PointCache * BKE_ptcache_copy_list(ListBase *ptcaches_new, const ListBase *ptcaches_old, const int flag)
static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
void BKE_ptcache_id_from_smoke(PTCacheID *pid, Object *ob, FluidModifierData *fmd)
void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *clmd)
static bool foreach_object_ptcache(Scene *scene, Object *object, int duplis, PointCacheIdFn callback)
static int ptcache_extra_datasize[]
static size_t 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 ptcache_frame_from_filename(const char *filename, const char *ext)
void BKE_ptcache_blend_read_data(BlendDataReader *reader, ListBase *ptcaches, PointCache **ocache, int force_disk)
bool BKE_ptcache_object_has(Scene *scene, Object *ob, int duplis)
int BKE_ptcache_mem_pointers_seek(int point_index, PTCacheMem *pm, void *cur[BPHYS_TOT_DATA])
void BKE_ptcache_bake(PTCacheBaker *baker)
int BKE_ptcache_read(PTCacheID *pid, float cfra, bool no_extrapolate_old)
static int ptcache_file_compressed_read(PTCacheFile *pf, uchar *result, uint len)
static void ptcache_softbody_error(const ID *, void *, const char *)
void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int duplis)
static void ptcache_cloth_read(int index, void *cloth_v, void **data, float, const float *old_data)
static void ptcache_particle_read(int index, void *psys_v, void **data, float cfra, const float *old_data)
static PointCache * ptcache_copy(PointCache *cache, const bool copy_data)
int BKE_ptcache_write(PTCacheID *pid, uint cfra)
static void ptcache_cloth_error(const ID *owner_id, void *cloth_v, const char *message)
static void ptcache_rigidbody_error(const ID *, void *, const char *)
void BKE_ptcache_free(PointCache *cache)
static int ptcache_old_elemsize(PTCacheID *pid)
static bool foreach_object_modifier_ptcache(Object *object, PointCacheIdFn callback)
void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const char *name_dst)
static int ptcache_interpolate(PTCacheID *pid, float cfra, int cfra1, int cfra2)
void BKE_ptcache_id_from_softbody(PTCacheID *pid, Object *ob, SoftBody *sb)
void BKE_ptcache_toggle_disk_cache(PTCacheID *pid)
int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
#define PTCACHE_DATA_TO(data, type, index, to)
static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
#define LZO_OUT_LEN(size)
static int ptcache_particle_write(int index, void *psys_v, void **data, int cfra)
static bool foreach_object_particle_ptcache(Object *object, PointCacheIdFn callback)
static void ptcache_particle_extra_read(void *psys_v, PTCacheMem *pm, float)
#define DPAINT_CACHE_VERSION
static void ptcache_dynamicpaint_error(const ID *, void *, const char *)
static int ptcache_file_header_begin_write(PTCacheFile *pf)
void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *psys)
static int ptcache_softbody_write(int index, void *soft_v, void **data, int)
static void ptcache_softbody_interpolate(int index, void *soft_v, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
static void ptcache_find_frames_around(PTCacheID *pid, uint frame, int *r_fra1, int *r_fra2)
PointCache * BKE_ptcache_add(ListBase *ptcaches)
static void ptcache_mem_clear(PTCacheMem *pm)
static int ptcache_write_needed(PTCacheID *pid, int cfra, int *overwrite)
void BKE_ptcache_validate(PointCache *cache, int framenr)
static void ptcache_data_free(PTCacheMem *pm)
static int ptcache_file_header_begin_read(PTCacheFile *pf)
static void ptcache_extra_free(PTCacheMem *pm)
static void ptcache_rigidbody_read(int index, void *rb_v, void **data, float, const float *old_data)
static int ptcache_file_read(PTCacheFile *pf, void *f, uint tot, uint size)
int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode)
static void ptcache_dt_to_str(char *str, size_t str_maxncpy, double dtime)
static int ptcache_basic_header_write(PTCacheFile *pf)
static void ptcache_particle_error(const ID *, void *, const char *)
void BKE_ptcache_blend_write(BlendWriter *writer, ListBase *ptcaches)
static int ptcache_file_data_read(PTCacheFile *pf)
void RB_body_get_orientation(rbRigidBody *object, float v_out[4])
void RB_body_get_position(rbRigidBody *object, float v_out[3])
struct ClothHairData * hairdata
struct Cloth * clothObject
struct PointCache * point_cache
float average_acceleration[3]
struct DynamicPaintCanvasSettings * canvas
struct PaintSurfaceData * data
struct DynamicPaintSurface * next
struct PointCache * pointcache
struct ListBase ptcaches[2]
struct PointCache * point_cache[2]
struct FluidDomainSettings * domain
struct ModifierData * next
struct Collection * instance_collection
struct RigidBodyOb * rigidbody_object
struct RigidBodyCon * rigidbody_constraint
void(* update_progress)(void *data, float progress, int *cancel)
struct Depsgraph * depsgraph
struct ViewLayer * view_layer
struct PointCache ** cache_ptr
int(* write_stream)(PTCacheFile *pf, void *calldata)
int(* write_point)(int index, void *calldata, void **data, int cfra)
int(* write_header)(PTCacheFile *pf)
void(* read_point)(int index, void *calldata, void **data, float cfra, const float *old_data)
void(* interpolate_extra_data)(void *calldata, struct PTCacheMem *pm, float cfra, float cfra1, float cfra2)
struct ListBase * ptcaches
void(* read_extra_data)(void *calldata, struct PTCacheMem *pm, float cfra)
void(* interpolate_point)(int index, void *calldata, void **data, float cfra, float cfra1, float cfra2, const float *old_data)
unsigned int default_step
int(* totpoint)(void *calldata, int cfra)
int(* totwrite)(void *calldata, int cfra)
void(* write_extra_data)(void *calldata, struct PTCacheMem *pm, int cfra)
int(* read_stream)(PTCacheFile *pf, void *calldata)
void(* error)(const struct ID *owner_id, void *calldata, const char *message)
int(* read_header)(PTCacheFile *pf)
struct PointCache * cache
struct ListBase extradata
struct SPHFluidSettings * fluid
ParticleSpring * fluid_springs
struct ParticleSystem * next
struct PointCache * pointcache
struct ListBase mem_cache
struct PTCacheEdit * edit
void(* free_edit)(struct PTCacheEdit *edit)
struct RigidBodyOb_Shared * shared
struct PointCache * pointcache
struct RigidBodyWorld_Shared * shared
struct PhysicsSettings physics_settings
struct RigidBodyWorld * rigidbody_world
struct PointCache * pointcache
struct SoftBody_Shared * shared
struct BodyPoint * bpoint
void * BKE_tempdir_session
static DynamicLibrary lib