74# ifdef WITH_SYSTEM_LZO
75# include <lzo/lzo1x.h>
79# define LZO_HEAP_ALLOC(var, size) \
80 lzo_align_t __LZO_MMODEL var[((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t)]
83#define LZO_OUT_LEN(size) ((size) + (size) / 16 + 64 + 3)
89#define PTCACHE_DATA_FROM(data, type, from) \
91 memcpy(data[type], from, ptcache_data_size[type]); \
95#define PTCACHE_DATA_TO(data, type, index, to) \
98 (char *)(data)[type] + ((index) ? (index) * ptcache_data_size[type] : 0), \
99 ptcache_data_size[type]); \
104#define DURIAN_POINTCACHE_LIB_OK 1
138 if (!
error && !fread(&
pf->totpoint,
sizeof(
uint), 1,
pf->fp)) {
142 if (!
error && !fread(&
pf->data_types,
sizeof(
uint), 1,
pf->fp)) {
151 if (!fwrite(&
pf->totpoint,
sizeof(
uint), 1,
pf->fp)) {
155 if (!fwrite(&
pf->data_types,
sizeof(
uint), 1,
pf->fp)) {
172 memcpy(extra->
data, data, size);
188 int index,
void *soft_v,
void **data,
float ,
const float *old_data)
194 memcpy(bp->
pos, data,
sizeof(
float[3]));
195 memcpy(bp->
vec, data + 3,
sizeof(
float[3]));
208 const float *old_data)
215 if (cfra1 == cfra2) {
223 memcpy(keys[2].co, old_data,
sizeof(
float[3]));
224 memcpy(keys[2].vel, old_data + 3,
sizeof(
float[3]));
230 dfra = cfra2 - cfra1;
284 if (cfra < pa->time - step) {
290 const int pa_sfra =
int(pa->
time) - step;
291 const int pa_efra = (
int(pa->
dietime) - 1) + step;
292 if (!(cfra >= pa_sfra && cfra <= pa_efra)) {
319 int index,
void *psys_v,
void **data,
float cfra,
const float *old_data)
346 if (cfra < pa->time) {
392 const float *old_data)
410 if (!(cfra1 >= pa_sfra && cfra1 <= pa_efra)) {
414 cfra = std::min(cfra, pa->
dietime);
415 cfra1 = std::min(cfra1, pa->
dietime);
416 cfra2 = std::min(cfra2, pa->
dietime);
418 if (cfra1 == cfra2) {
432 if (keys[1].time > keys[2].time) {
434 mul_v3_fl(keys[2].vel, (keys[1].time - keys[2].time) * timestep);
438 mul_v3_fl(keys[2].vel, (keys[2].time - keys[1].time) * timestep);
447 if (cfra > pa->
time) {
448 cfra1 = std::max(cfra1, pa->
time);
451 dfra = cfra2 - cfra1;
490 for (p = 0; p < psys->
totpart; p++, pa++) {
491 const int pa_sfra =
int(pa->
time) - step;
492 totwrite += (cfra >= pa_sfra);
496 for (p = 0; p < psys->
totpart; p++, pa++) {
498 const int pa_sfra =
int(pa->
time) - step;
499 const int pa_efra = (
int(pa->
dietime) - 1) + step;
500 totwrite += (cfra >= pa_sfra) && (cfra <= pa_efra);
525 for (; extra; extra = extra->
next) {
526 switch (extra->
type) {
554 int index,
void *cloth_v,
void **data,
float ,
const float *old_data)
561 memcpy(vert->
x, data,
sizeof(
float[3]));
562 memcpy(vert->
xconst, data + 3,
sizeof(
float[3]));
563 memcpy(vert->
v, data + 6,
sizeof(
float[3]));
577 const float *old_data)
585 if (cfra1 == cfra2) {
593 memcpy(keys[2].co, old_data,
sizeof(
float[3]));
594 memcpy(keys[2].vel, old_data + 6,
sizeof(
float[3]));
600 dfra = cfra2 - cfra1;
620 if (!
is_zero_v3(cloth->average_acceleration)) {
630 zero_v3(cloth->average_acceleration);
632 for (; extra; extra = extra->
next) {
633 switch (extra->
type) {
635 copy_v3_v3(cloth->average_acceleration,
static_cast<const float *
>(extra->
data));
662 if (!surface->data) {
676#define DPAINT_CACHE_VERSION "1.01"
687 int total_points = surface->data->total_points;
698 in_len =
sizeof(
float) * total_points;
710 pf, (
uchar *)surface->data->type_data, in_len, out, cache_compress);
734 if (surface_type != surface->type) {
743 data_len =
sizeof(
float);
753 pf, (
uchar *)surface->data->type_data, data_len * surface->data->total_points);
784 int index,
void *rb_v,
void **data,
float ,
const float *old_data)
799 memcpy(rbo->
pos, data,
sizeof(
float[3]));
800 memcpy(rbo->
orn, data + 3,
sizeof(
float[4]));
815 const float *old_data)
831 float pos[3], orn[4];
834 memcpy(
pos, data,
sizeof(
float[3]));
835 memcpy(orn, data + 3,
sizeof(
float[4]));
842 const float t = (cfra - cfra1) / (cfra2 - cfra1);
1026 pid->
cache = surface->pointcache;
1028 pid->
ptcaches = &surface->ptcaches;
1061 pid->
owner_id = ob !=
nullptr ? &ob->
id :
nullptr;
1102 if (pid->cache == cache) {
1131 if (psys->part ==
nullptr) {
1182 for (; surface; surface = surface->next) {
1202 if (
object !=
nullptr) {
1204 if (object->soft !=
nullptr) {
1221 if (scene !=
nullptr && (duplis-- > 0) && (object->instance_collection !=
nullptr)) {
1223 if (current_object ==
object) {
1233 if (scene !=
nullptr && (
object ==
nullptr || object->rigidbody_object !=
nullptr) &&
1234 scene->rigidbody_world !=
nullptr)
1262 bool has_point_cache =
false;
1264 has_point_cache =
true;
1267 return has_point_cache;
1287 const int ext_len =
frame_len + strlen(ext);
1288 const int len = strlen(filename);
1291 if (
len > ext_len) {
1308#define MAX_PTCACHE_PATH FILE_MAX
1309#define MAX_PTCACHE_FILE (FILE_MAX * 2)
1316 lib->runtime.filepath_abs :
1328 if ((blendfile_path[0] !=
'\0') ||
lib) {
1351 const size_t filepath_len,
1352 const bool use_frame_number,
1355 size_t len = filepath_len;
1357 filename_ext = filepath + filepath_len;
1358 *filename_ext =
'\0';
1367 if (use_frame_number) {
1415 if (blendfile_path[0] ==
'\0') {
1428 while (
'\0' != *idname) {
1458#ifndef DURIAN_POINTCACHE_LIB_OK
1466 if (blendfile_path[0] ==
'\0') {
1507 uchar compressed = 0;
1510 size_t out_len =
len;
1519 in_len = size_t(size);
1527 if (compressed == 1) {
1528 r = lzo1x_decompress_safe(in, (lzo_uint)in_len, result, (lzo_uint *)&out_len,
nullptr);
1532 if (compressed == 2) {
1534 size_t leni = in_len, leno =
len;
1536 sizeOfIt = size_t(size);
1538 r = LzmaUncompress(result, &leno, in, &leni, props, sizeOfIt);
1556 uchar compressed = 0;
1559 size_t sizeOfIt = 5;
1566 LZO_HEAP_ALLOC(wrkmem, LZO1X_MEM_COMPRESS);
1568 r = lzo1x_1_compress(in, (lzo_uint)in_len, out, (lzo_uint *)&out_len, wrkmem);
1569 if (!(r == LZO_E_OK) || (out_len >= in_len)) {
1580 r = LzmaCompress(out,
1594 if (!(r == SZ_OK) || (out_len >= in_len)) {
1605 uint size = out_len;
1613 if (compressed == 2) {
1614 uint size = sizeOfIt;
1625 return (fread(f, size, tot,
pf->fp) == tot);
1629 return (fwrite(f, size, tot,
pf->fp) == tot);
1649 if ((
pf->data_types & (1 << i)) &&
1666 if (fread(bphysics,
sizeof(
char), 8,
pf->fp) != 8) {
1674 if (!
error && !fread(&typeflag,
sizeof(
uint), 1,
pf->fp)) {
1690 const char *bphysics =
"BPHYSICS";
1691 uint typeflag =
pf->type +
pf->flag;
1693 if (fwrite(bphysics,
sizeof(
char), 8,
pf->fp) != 8) {
1697 if (!fwrite(&typeflag,
sizeof(
uint), 1,
pf->fp)) {
1713 int data_types =
pf->data_types;
1735 if (index < *data || index > *(data + high)) {
1740 if (index - *data < high && data[index - *data] == index) {
1741 return index - *
data;
1744 while (low <= high) {
1745 mid = (low + high) / 2;
1747 if (data[mid] > index) {
1750 else if (data[mid] < index) {
1761 return (index < pm->totpoint ? index : -1);
1770 cur[i] = ((data_types & (1 << i)) ? pm->
data[i] :
nullptr);
1812 if (data_types & (1 << i)) {
1819 void **data = pm->
data;
1834 if (from[i] && to[i]) {
1845 for (; extra; extra = extra->
next) {
1864 return sizeof(
float[6]);
1870 return sizeof(
float[9]);
1879 int cfra1 = frame, cfra2 = frame + 1;
1885 if (cfra1 < pid->cache->startframe) {
1897 if (cfra1 && !cfra2) {
1914 if (pm2->
frame < frame) {
1925 *r_fra2 = pm->
frame;
1928 *r_fra1 = pm->
frame;
1929 *r_fra2 = pm2->
frame;
1940 if (
pf ==
nullptr) {
1964 if (
pf->data_types & (1 << i)) {
1974 for (i = 0; i < pm->
totpoint; i++) {
1992 extra->
type = extratype;
1997 "Pointcache extradata->data");
2020 printf(
"Error reading from disk cache\n");
2034 if (
pf ==
nullptr) {
2036 printf(
"Error opening disk cache file for writing\n");
2075 for (i = 0; i < pm->
totpoint; i++) {
2089 for (; extra; extra = extra->
next) {
2090 if (extra->
data ==
nullptr || extra->
totdata == 0) {
2113 printf(
"Error writing to disk cache\n");
2128 if (
pf ==
nullptr) {
2130 printf(
"Error opening disk cache file for reading\n");
2139 else if (
pf->type != pid->
type) {
2180 while (pm && pm->
frame != cfra) {
2192 if (totpoint != pid_totpoint) {
2194 totpoint = std::min(totpoint, pid_totpoint);
2201 for (i = 0; i < totpoint; i++) {
2237 while (pm && pm->
frame != cfra2) {
2249 if (totpoint != pid_totpoint) {
2251 totpoint = std::min(totpoint, pid_totpoint);
2258 for (i = 0; i < totpoint; i++) {
2264 *index, pid->
calldata, cur, cfra,
float(cfra1),
float(cfra2),
nullptr);
2284 int cfrai =
int(
floor(cfra)), cfra1 = 0, cfra2 = 0;
2307 if (cfra1 == 0 && cfra2 == 0) {
2312 if (no_extrapolate_old) {
2313 if (cfra1 == 0 && cfra2 && cfra2 <= pid->cache->simframe) {
2316 if (cfra1 && cfra1 == cfra2) {
2322 if (cfra1 && cfra1 == cfra2) {
2368 if (cfra <= pid->cache->last_exact) {
2369 pid->
cache->
flag &= ~PTCACHE_FRAMES_SKIPPED;
2386 if (
pf ==
nullptr) {
2388 printf(
"Error opening disk cache file for writing\n");
2394 pf->totpoint = totpoint;
2409 printf(
"Error writing to disk cache\n");
2447 for (i = 0; i < totpoint; i++) {
2491 int ofra = 0, efra = cache->
endframe;
2496 cache->
flag &= ~PTCACHE_REDO_NEEDED;
2523 if (pm ==
nullptr) {
2531 if (efra >= cache->
startframe && cfra > efra) {
2532 if (ofra >= cache->
startframe && efra - ofra < cache->step) {
2552 int overwrite = 0,
error = 0;
2572 cache->
flag &= ~PTCACHE_FRAMES_SKIPPED;
2618#ifndef DURIAN_POINTCACHE_LIB_OK
2634 if (dir ==
nullptr) {
2642 if (
len <
sizeof(filepath) - 2) {
2649 while ((de =
readdir(dir)) !=
nullptr) {
2650 if (strstr(de->
d_name, ext)) {
2689 for (; pm; pm = pm->
next) {
2729 for (; pm; pm = pm->
next) {
2730 if (pm->
frame == cfra) {
2752 if (cfra < pid->cache->startframe || cfra > pid->
cache->
endframe) {
2770 for (; pm; pm = pm->
next) {
2771 if (pm->
frame == cfra) {
2778 PTCacheID *pid,
Scene *scene,
float cfra,
int *startframe,
int *endframe,
float *timescale)
2783 float time, nexttime;
2803 *timescale = std::max(nexttime - time, 0.0f);
2806 if (startframe && endframe) {
2842 if (dir ==
nullptr) {
2848 while ((de =
readdir(dir)) !=
nullptr) {
2849 if (strstr(de->
d_name, ext)) {
2854 if ((frame != -1) && (frame >= sta && frame <= end)) {
2904 cache->
flag &= ~PTCACHE_OUTDATED;
2910 cache->
flag &= ~PTCACHE_REDO_NEEDED;
2954 else if (psys->clmd) {
2966 if (skip == 0 && psys->part) {
2983 for (; surface; surface = surface->next) {
3039 for (; pm; pm = pm->
next) {
3100 ncache->
edit =
nullptr;
3113 for (; cache; cache = cache->
next) {
3129 memset(&baker, 0,
sizeof(baker));
3130 baker.
bmain = bmain;
3136 baker.
quick_step = scene->physics_settings.quick_cache_step;
3144 if (dtime > 3600.0) {
3149 int(dtime / 60) % 60,
3153 BLI_snprintf(
str, str_maxncpy,
"%im %is",
int(dtime / 60) % 60,
int(dtime) % 60);
3171 float frameleno = scene->r.framelen;
3172 int cfrao = scene->r.cfra;
3173 int startframe =
MAXFRAME, endframe = baker->
anim_init ? scene->r.sfra : scene->r.cfra;
3175 int render = baker->
render;
3208 pid2->cache->flag &= ~PTCACHE_BAKED;
3227 endframe = std::min(endframe, cache->
endframe);
3230 cache->
flag &= ~PTCACHE_BAKED;
3267 startframe = std::min(startframe, cache->
startframe);
3269 if (
bake || render) {
3273 endframe = std::max(endframe, cache->
endframe);
3277 cache->
flag &= ~PTCACHE_BAKED;
3284 scene->r.cfra = startframe;
3285 scene->r.framelen = 1.0;
3289 bool use_timer =
false;
3290 double stime, ptime, ctime, fetd;
3291 char run[32], cur[32], etd[32];
3296 for (
int fr = scene->r.cfra; fr <= endframe; fr += baker->
quick_step, scene->r.cfra = fr) {
3300 float progress = (
float(scene->r.cfra - startframe) /
float(endframe - startframe));
3305 printf(
"bake: frame %d :: %d\n", scene->r.cfra, endframe);
3310 fetd = (ctime - ptime) * (endframe - scene->r.cfra) / baker->
quick_step;
3312 if (use_timer || fetd > 60.0) {
3319 printf(
"Baked for %s, current frame: %i/%i (%.3fs), ETC: %s\r",
3321 scene->r.cfra - startframe + 1,
3322 endframe - startframe + 1,
3331 if (cancel ||
G.is_break) {
3341 printf(
"\nBake %s %s (%i frames simulated).\n",
3342 (cancel ?
"canceled after" :
"finished in"),
3344 scene->r.cfra - startframe);
3419 scene->r.framelen = frameleno;
3420 scene->r.cfra = cfrao;
3439 cache->
flag &= ~PTCACHE_BAKED;
3445 cache->
flag |= baked;
3447 for (cfra = sfra; cfra <= efra; cfra++) {
3462 cache->
flag &= ~PTCACHE_BAKED;
3468 cache->
flag |= baked;
3470 for (; pm; pm = pm->
next) {
3472 cache->
flag &= ~PTCACHE_DISK_CACHE;
3488 if (blendfile_path[0] ==
'\0') {
3489 cache->
flag &= ~PTCACHE_DISK_CACHE;
3491 printf(
"File must be saved before using disk cache!\n");
3541 if (
STREQ(name_src, name_dst)) {
3555 if (dir ==
nullptr) {
3565 while ((de =
readdir(dir)) !=
nullptr) {
3566 if (strstr(de->
d_name, ext)) {
3609 if (dir ==
nullptr) {
3615 if (cache->
index >= 0) {
3622 while ((de =
readdir(dir)) !=
nullptr) {
3623 if (strstr(de->
d_name, ext)) {
3630 start = std::min(start, frame);
3631 end = std::max(end, frame);
3703 cache->
flag &= ~PTCACHE_FLAG_INFO_DIRTY;
3708 for (; cfra <= cache->
endframe; cfra++) {
3718 else if (totframes && cache->
totpoint) {
3732 SNPRINTF(mem_info,
RPT_(
"%i cells + High Resolution cached"), totpoint);
3741 for (; cfra <= cache->
endframe; cfra++) {
3747 SNPRINTF(mem_info,
RPT_(
"%i frames on disk"), totframes);
3754 long long int bytes = 0.0f;
3757 for (; pm; pm = pm->
next) {
3775 SNPRINTF(mem_info,
RPT_(
"%s frames in memory (%s)"), formatted_tot, formatted_mem);
3799 cache->
flag &= ~PTCACHE_SIMULATION_VALID;
3815 if (pm->data[i] && pm->data_types & (1 << i)) {
3821 writer, pm->totpoint,
reinterpret_cast<uint32_t *
>(pm->data[i]));
3839 else if (extra->data) {
3873 else if (extra->data) {
3874 extra->data =
nullptr;
3891 cache->
flag &= ~PTCACHE_SIMULATION_VALID;
3893 cache->
edit =
nullptr;
3904 if (ptcaches->
first) {
3922 (*ocache)->step = 1;
3925 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)
struct PaintPoint PaintPoint
struct PaintWavePoint PaintWavePoint
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
#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()
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)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct 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])
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 STRNCPY(dst, src)
#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
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_uint32_array(BlendWriter *writer, uint num, const uint32_t *data_ptr)
void BLO_read_float_array(BlendDataReader *reader, int array_size, float **ptr_p)
#define BLO_write_struct(writer, struct_name, data_ptr)
void BLO_read_uint32_array(BlendDataReader *reader, int array_size, uint32_t **ptr_p)
void BLO_write_float_array(BlendWriter *writer, uint num, const float *data_ptr)
#define BLO_write_struct_array(writer, struct_name, array_size, data_ptr)
#define BLO_read_struct_list(reader, struct_name, list)
#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,...)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
ID and Library types, which are fundamental for SDNA.
Object groups, one object can be in many groups at once.
@ MOD_DPAINT_SURFACE_T_WEIGHT
@ MOD_DPAINT_SURFACE_T_PAINT
@ MOD_DPAINT_SURFACE_T_DISPLACE
@ MOD_DPAINT_SURFACE_T_WAVE
@ MOD_DPAINT_SURFACE_F_IMAGESEQ
@ FLUID_DOMAIN_CACHE_REPLAY
@ eModifierType_DynamicPaint
Object is a sort of wrapper for general info.
struct ParticleKey ParticleKey
struct ParticleSpring ParticleSpring
@ SPH_VISCOELASTIC_SPRINGS
struct PTCacheMem PTCacheMem
@ PTCACHE_FLAG_INFO_DIRTY
@ PTCACHE_SIMULATION_VALID
@ BPHYS_EXTRA_FLUID_SPRINGS
@ BPHYS_EXTRA_CLOTH_ACCELERATION
struct PTCacheExtra PTCacheExtra
@ 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.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void reset()
clear internal cached data and reset random seed
const Depsgraph * depsgraph
DEGForeachIDComponentCallback callback
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
#define pf(_x, _i)
Prefetch 64.
void *(* MEM_mallocN)(size_t len, const char *str)
size_t(* MEM_allocN_len)(const void *vmemh)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_dupallocN)(const void *vmemh)
ccl_device_inline float2 floor(const float2 a)
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
struct DynamicPaintCanvasSettings * canvas
struct PaintSurfaceData * data
struct ListBase ptcaches[2]
struct PointCache * point_cache[2]
struct FluidDomainSettings * domain
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 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 PointCache * pointcache
struct SoftBody_Shared * shared
struct BodyPoint * bpoint
void * BKE_tempdir_session
static DynamicLibrary lib