From 6fc8a74886a30f89562bb542ef3b24cc64b3208a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Jun 2018 17:05:51 +0200 Subject: Cleanup: trailing space for blenkernel --- source/blender/blenkernel/intern/pointcache.c | 224 +++++++++++++------------- 1 file changed, 112 insertions(+), 112 deletions(-) (limited to 'source/blender/blenkernel/intern/pointcache.c') diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index f96868e99ea..104f8482635 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -121,7 +121,7 @@ /* could be made into a pointcache option */ #define DURIAN_POINTCACHE_LIB_OK 1 -static int ptcache_data_size[] = { +static int ptcache_data_size[] = { sizeof(unsigned int), // BPHYS_DATA_INDEX 3 * sizeof(float), // BPHYS_DATA_LOCATION 3 * sizeof(float), // BPHYS_DATA_VELOCITY @@ -151,7 +151,7 @@ static int ptcache_basic_header_read(PTCacheFile *pf) /* Custom functions should read these basic elements too! */ if (!error && !fread(&pf->totpoint, sizeof(unsigned int), 1, pf->fp)) error = 1; - + if (!error && !fread(&pf->data_types, sizeof(unsigned int), 1, pf->fp)) error = 1; @@ -162,7 +162,7 @@ static int ptcache_basic_header_write(PTCacheFile *pf) /* Custom functions should write these basic elements too! */ if (!fwrite(&pf->totpoint, sizeof(unsigned int), 1, pf->fp)) return 0; - + if (!fwrite(&pf->data_types, sizeof(unsigned int), 1, pf->fp)) return 0; @@ -240,7 +240,7 @@ void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, flo { PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, index, key->co); PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, index, key->vel); - + /* no rotation info, so make something nice up */ if (data[BPHYS_DATA_ROTATION]==NULL) { vec_to_quat(key->rot, key->vel, OB_NEGX, OB_POSZ); @@ -316,7 +316,7 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf if (data[BPHYS_DATA_SIZE]) { PTCACHE_DATA_TO(data, BPHYS_DATA_SIZE, 0, &pa->size); } - + if (data[BPHYS_DATA_TIMES]) { float times[3]; PTCACHE_DATA_TO(data, BPHYS_DATA_TIMES, 0, ×); @@ -494,7 +494,7 @@ static void ptcache_cloth_read(int index, void *cloth_v, void **data, float UNUS ClothModifierData *clmd= cloth_v; Cloth *cloth= clmd->clothObject; ClothVertex *vert = cloth->verts + index; - + if (old_data) { memcpy(vert->x, data, 3 * sizeof(float)); memcpy(vert->xconst, data + 3, 3 * sizeof(float)); @@ -560,7 +560,7 @@ static int ptcache_smoke_totpoint(void *smoke_v, int UNUSED(cfra)) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; - + if (sds->fluid) { return sds->base_res[0]*sds->base_res[1]*sds->base_res[2]; } @@ -577,7 +577,7 @@ static void ptcache_smoke_error(void *smoke_v, const char *message) #define SMOKE_CACHE_VERSION "1.04" static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v) -{ +{ SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; int ret = 0; @@ -589,7 +589,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v) ptcache_file_write(pf, &sds->active_fields, 1, sizeof(int)); ptcache_file_write(pf, &sds->res, 3, sizeof(int)); ptcache_file_write(pf, &sds->dx, 1, sizeof(float)); - + if (sds->fluid) { size_t res = sds->res[0]*sds->res[1]*sds->res[2]; float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b; @@ -636,7 +636,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v) ptcache_file_write(pf, &sds->active_color, 3, sizeof(float)); MEM_freeN(out); - + ret = 1; } @@ -679,7 +679,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v) ptcache_file_compressed_write(pf, (unsigned char *)tcv, in_len, out, mode); ptcache_file_compressed_write(pf, (unsigned char *)tcw, in_len, out, mode); MEM_freeN(out); - + ret = 1; } @@ -691,7 +691,7 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; - + if (sds->fluid) { const size_t res = sds->res[0] * sds->res[1] * sds->res[2]; const unsigned int out_len = (unsigned int)res * sizeof(float); @@ -705,7 +705,7 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v) sds->active_color[0] = 0.7f; sds->active_color[1] = 0.7f; sds->active_color[2] = 0.7f; - + smoke_export(sds->fluid, &dt, &dx, &dens, NULL, NULL, NULL, &heat, &heatold, &vx, &vy, &vz, NULL, NULL, NULL, &obstacles); ptcache_file_compressed_read(pf, (unsigned char *)sds->shadow, out_len); @@ -758,7 +758,7 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v) } } - return 1; + return 1; } static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v) @@ -814,13 +814,13 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v) smoke_reallocate_highres_fluid(sds, ch_dx, ch_res, 1); } } - + if (sds->fluid) { size_t res = sds->res[0]*sds->res[1]*sds->res[2]; float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b; unsigned char *obstacles; unsigned int out_len = (unsigned int)res * sizeof(float); - + smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &heatold, &vx, &vy, &vz, &r, &g, &b, &obstacles); ptcache_file_compressed_read(pf, (unsigned char *)sds->shadow, out_len); @@ -1195,7 +1195,7 @@ static void ptcache_dynamicpaint_error(void *UNUSED(sd), const char *UNUSED(mess #define DPAINT_CACHE_VERSION "1.01" static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v) -{ +{ DynamicPaintSurface *surface = (DynamicPaintSurface*)dp_v; int cache_compress = 1; @@ -1237,7 +1237,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v) { DynamicPaintSurface *surface = (DynamicPaintSurface*)dp_v; char version[4]; - + /* version header */ ptcache_file_read(pf, version, 1, sizeof(char) * 4); if (!STREQLEN(version, DPAINT_CACHE_VERSION, 4)) { @@ -1282,13 +1282,13 @@ static int ptcache_rigidbody_write(int index, void *rb_v, void **data, int UNUS { RigidBodyWorld *rbw = rb_v; Object *ob = NULL; - + if (rbw->objects) ob = rbw->objects[index]; - + if (ob && ob->rigidbody_object) { RigidBodyOb *rbo = ob->rigidbody_object; - + if (rbo->type == RBO_TYPE_ACTIVE) { #ifdef WITH_BULLET RB_body_get_position(rbo->physics_object, rbo->pos); @@ -1305,15 +1305,15 @@ static void ptcache_rigidbody_read(int index, void *rb_v, void **data, float UNU { RigidBodyWorld *rbw = rb_v; Object *ob = NULL; - + if (rbw->objects) ob = rbw->objects[index]; - + if (ob && ob->rigidbody_object) { RigidBodyOb *rbo = ob->rigidbody_object; - + if (rbo->type == RBO_TYPE_ACTIVE) { - + if (old_data) { memcpy(rbo->pos, data, 3 * sizeof(float)); memcpy(rbo->orn, data + 3, 4 * sizeof(float)); @@ -1329,23 +1329,23 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl { RigidBodyWorld *rbw = rb_v; Object *ob = NULL; - + if (rbw->objects) ob = rbw->objects[index]; - + if (ob && ob->rigidbody_object) { RigidBodyOb *rbo = ob->rigidbody_object; - + if (rbo->type == RBO_TYPE_ACTIVE) { ParticleKey keys[4]; ParticleKey result; float dfra; - + memset(keys, 0, sizeof(keys)); - + copy_v3_v3(keys[1].co, rbo->pos); copy_qt_qt(keys[1].rot, rbo->orn); - + if (old_data) { memcpy(keys[2].co, data, 3 * sizeof(float)); memcpy(keys[2].rot, data + 3, 4 * sizeof(float)); @@ -1353,13 +1353,13 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl else { BKE_ptcache_make_particle_key(&keys[2], 0, data, cfra2); } - + dfra = cfra2 - cfra1; - + /* note: keys[0] and keys[3] unused for type < 1 (crappy) */ psys_interpolate_particle(-1, keys, (cfra - cfra1) / dfra, &result, true); interp_qt_qtqt(result.rot, keys[1].rot, keys[2].rot, (cfra - cfra1) / dfra); - + copy_v3_v3(rbo->pos, result.co); copy_qt_qt(rbo->orn, result.rot); } @@ -1368,7 +1368,7 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl static int ptcache_rigidbody_totpoint(void *rb_v, int UNUSED(cfra)) { RigidBodyWorld *rbw = rb_v; - + return rbw->numbodies; } @@ -1525,7 +1525,7 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeMo pid->ob= ob; pid->calldata= smd; - + pid->type= PTCACHE_TYPE_SMOKE_DOMAIN; pid->stack_index= sds->point_cache[0]->index; @@ -1609,9 +1609,9 @@ void BKE_ptcache_id_from_dynamicpaint(PTCacheID *pid, Object *ob, DynamicPaintSu void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, Object *ob, RigidBodyWorld *rbw) { - + memset(pid, 0, sizeof(PTCacheID)); - + pid->ob= ob; pid->calldata= rbw; pid->type= PTCACHE_TYPE_RIGIDBODY; @@ -1620,29 +1620,29 @@ void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, Object *ob, RigidBodyWorld *r pid->ptcaches= &rbw->ptcaches; pid->totpoint= pid->totwrite= ptcache_rigidbody_totpoint; pid->error = ptcache_rigidbody_error; - + pid->write_point = ptcache_rigidbody_write; pid->read_point = ptcache_rigidbody_read; pid->interpolate_point = ptcache_rigidbody_interpolate; - + pid->write_stream = NULL; pid->read_stream = NULL; pid->write_openvdb_stream = NULL; pid->read_openvdb_stream = NULL; - + pid->write_extra_data = NULL; pid->read_extra_data = NULL; pid->interpolate_extra_data = NULL; - + pid->write_header = ptcache_basic_header_write; pid->read_header = ptcache_basic_header_read; - + pid->data_types= (1<info_types= 0; - + pid->stack_index = pid->cache->index; - + pid->default_step = 1; pid->max_step = 1; pid->file_type = PTCACHE_FILE_PTCACHE; @@ -1665,7 +1665,7 @@ void BKE_ptcache_ids_from_object(Main *bmain, ListBase *lb, Object *ob, Scene *s for (psys=ob->particlesystem.first; psys; psys=psys->next) { if (psys->part==NULL) continue; - + /* check to make sure point cache is actually used by the particles */ if (ELEM(psys->part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)) continue; @@ -1673,7 +1673,7 @@ void BKE_ptcache_ids_from_object(Main *bmain, ListBase *lb, Object *ob, Scene *s /* hair needs to be included in id-list for cache edit mode to work */ /* if (psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS)==0) */ /* continue; */ - + if (psys->part->type == PART_FLUID) continue; @@ -1709,7 +1709,7 @@ void BKE_ptcache_ids_from_object(Main *bmain, ListBase *lb, Object *ob, Scene *s } } } - + if (scene && ob->rigidbody_object && scene->rigidbody_world) { pid = MEM_callocN(sizeof(PTCacheID), "PTCacheID"); BKE_ptcache_id_from_rigidbody(pid, ob, scene->rigidbody_world); @@ -1799,20 +1799,20 @@ static int ptcache_path(PTCacheID *pid, char *filename) BLI_split_file_part(blendfilename, file, sizeof(file)); i = strlen(file); - + /* remove .blend */ if (i > 6) file[i-6] = '\0'; - + BLI_snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */ BLI_path_abs(filename, blendfilename); return BLI_add_slash(filename); /* new strlen() */ } - + /* use the temp path. this is weak but better then not using point cache at all */ /* temporary directory is assumed to exist and ALWAYS has a trailing slash */ BLI_snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH, BKE_tempdir_session()); - + return BLI_add_slash(filename); /* new strlen() */ } @@ -1823,9 +1823,9 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p char *newname; filename[0] = '\0'; newname = filename; - + if (!G.relbase_valid && (pid->cache->flag & PTCACHE_EXTERNAL)==0) return 0; /* save blend file before using disk pointcache */ - + /* start with temp dir */ if (do_path) { len = ptcache_path(pid, filename); @@ -1841,8 +1841,8 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p } } else { - int temp = (int)strlen(pid->cache->name); - strcpy(newname, pid->cache->name); + int temp = (int)strlen(pid->cache->name); + strcpy(newname, pid->cache->name); newname+=temp; len += temp; } @@ -1864,7 +1864,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p } len += 16; } - + return len; /* make sure the above string is always 16 chars */ } @@ -1881,7 +1881,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra) return NULL; #endif if (!G.relbase_valid && (pid->cache->flag & PTCACHE_EXTERNAL)==0) return NULL; /* save blend file before using disk pointcache */ - + ptcache_filename(pid, filename, cfra, 1, 1); if (mode==PTCACHE_FILE_READ) { @@ -1975,7 +1975,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns out_len= LZO_OUT_LEN(in_len); if (mode == 1) { LZO_HEAP_ALLOC(wrkmem, LZO1X_MEM_COMPRESS); - + r = lzo1x_1_compress(in, (lzo_uint)in_len, out, (lzo_uint *)&out_len, wrkmem); if (!(r == LZO_E_OK) || (out_len >= in_len)) compressed = 0; @@ -1985,7 +1985,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns #endif #ifdef WITH_LZMA if (mode == 2) { - + r = LzmaCompress(out, &out_len, in, in_len, //assume sizeof(char)==1.... props, &sizeOfIt, 5, 1 << 24, 3, 0, 2, 32, 2); @@ -1995,7 +1995,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns compressed = 2; } #endif - + ptcache_file_write(pf, &compressed, 1, sizeof(unsigned char)); if (compressed) { unsigned int size = out_len; @@ -2031,18 +2031,18 @@ static int ptcache_file_data_read(PTCacheFile *pf) if ((pf->data_types & (1<cur[i], 1, ptcache_data_size[i])) return 0; } - + return 1; } static int ptcache_file_data_write(PTCacheFile *pf) -{ +{ int i; for (i=0; idata_types & (1<cur[i], 1, ptcache_data_size[i])) return 0; } - + return 1; } static int ptcache_file_header_begin_read(PTCacheFile *pf) @@ -2050,12 +2050,12 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf) unsigned int typeflag=0; int error=0; char bphysics[8]; - + pf->data_types = 0; - + if (fread(bphysics, sizeof(char), 8, pf->fp) != 8) error = 1; - + if (!error && !STREQLEN(bphysics, "BPHYSICS", 8)) error = 1; @@ -2064,7 +2064,7 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf) pf->type = (typeflag & PTCACHE_TYPEFLAG_TYPEMASK); pf->flag = (typeflag & PTCACHE_TYPEFLAG_FLAGMASK); - + /* if there was an error set file as it was */ if (error) fseek(pf->fp, 0, SEEK_SET); @@ -2075,13 +2075,13 @@ static int ptcache_file_header_begin_write(PTCacheFile *pf) { const char *bphysics = "BPHYSICS"; unsigned int typeflag = pf->type + pf->flag; - + if (fwrite(bphysics, sizeof(char), 8, pf->fp) != 8) return 0; if (!fwrite(&typeflag, sizeof(unsigned int), 1, pf->fp)) return 0; - + return 1; } @@ -2362,14 +2362,14 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra) if (error && G.debug & G_DEBUG) printf("Error reading from disk cache\n"); - + return pm; } static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm) { PTCacheFile *pf = NULL; unsigned int i, error = 0; - + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, pm->frame); pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, pm->frame); @@ -2384,10 +2384,10 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm) pf->totpoint = pm->totpoint; pf->type = pid->type; pf->flag = 0; - + if (pm->extradata.first) pf->flag |= PTCACHE_TYPEFLAG_EXTRADATA; - + if (pid->cache->compression) pf->flag |= PTCACHE_TYPEFLAG_COMPRESS; @@ -2443,7 +2443,7 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm) } ptcache_file_close(pf); - + if (error && G.debug & G_DEBUG) printf("Error writing to disk cache\n"); @@ -2492,7 +2492,7 @@ static int ptcache_read_stream(PTCacheID *pid, int cfra) } ptcache_file_close(pf); - + return error == 0; } @@ -2537,7 +2537,7 @@ static int ptcache_read(PTCacheID *pid, int cfra) } else { pm = pid->cache->mem_cache.first; - + while (pm && pm->frame != cfra) pm = pm->next; } @@ -2562,7 +2562,7 @@ static int ptcache_read(PTCacheID *pid, int cfra) index = pm->cur[BPHYS_DATA_INDEX]; pid->read_point(*index, pid->calldata, pm->cur, (float)pm->frame, NULL); - + BKE_ptcache_mem_pointers_incr(pm); } @@ -2591,7 +2591,7 @@ static int ptcache_interpolate(PTCacheID *pid, float cfra, int cfra1, int cfra2) } else { pm = pid->cache->mem_cache.first; - + while (pm && pm->frame != cfra2) pm = pm->next; } @@ -2729,7 +2729,7 @@ static int ptcache_write_stream(PTCacheID *pid, int cfra, int totpoint) { PTCacheFile *pf = NULL; int error = 0; - + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, cfra); pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, cfra); @@ -2801,7 +2801,7 @@ static int ptcache_write(PTCacheID *pid, int cfra, int overwrite) while (fra >= cache->startframe && !BKE_ptcache_id_exist(pid, fra)) fra--; - + pm2 = ptcache_disk_frame_to_mem(pid, fra); } else @@ -2949,7 +2949,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) unsigned int sta, end; /* mode is same as fopen's modes */ - DIR *dir; + DIR *dir; struct dirent *de; char path[MAX_PTCACHE_PATH]; char filename[MAX_PTCACHE_FILE]; @@ -2982,11 +2982,11 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) case PTCACHE_CLEAR_AFTER: if (pid->cache->flag & PTCACHE_DISK_CACHE) { ptcache_path(pid, path); - + dir = opendir(path); if (dir==NULL) return; - + len = ptcache_filename(pid, filename, cfra, 0, 0); /* no path */ /* append underscore terminator to ensure we don't match similar names * from objects whose names start with the same prefix @@ -2995,9 +2995,9 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) BLI_strncpy(filename + len, "_", sizeof(filename) - 2 - len); len += 1; } - + BLI_snprintf(ext, sizeof(ext), "_%02u%s", pid->stack_index, fext); - + while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */ @@ -3014,7 +3014,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) if ((mode == PTCACHE_CLEAR_BEFORE && frame < cfra) || (mode == PTCACHE_CLEAR_AFTER && frame > cfra)) { - + BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name); BLI_delete(path_full, false, false); if (pid->cache->cached_frames && frame >=sta && frame <= end) @@ -3043,7 +3043,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) } BLI_freelistN(&pid->cache->mem_cache); - if (pid->cache->cached_frames) + if (pid->cache->cached_frames) memset(pid->cache->cached_frames, 0, MEM_allocN_len(pid->cache->cached_frames)); } else { @@ -3065,7 +3065,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) } } break; - + case PTCACHE_CLEAR_FRAME: if (pid->cache->flag & PTCACHE_DISK_CACHE) { if (BKE_ptcache_id_exist(pid, cfra)) { @@ -3102,10 +3102,10 @@ int BKE_ptcache_id_exist(PTCacheID *pid, int cfra) if (pid->cache->cached_frames && pid->cache->cached_frames[cfra-pid->cache->startframe]==0) return 0; - + if (pid->cache->flag & PTCACHE_DISK_CACHE) { char filename[MAX_PTCACHE_FILE]; - + ptcache_filename(pid, filename, cfra, 1, 1); return BLI_exists(filename); @@ -3145,7 +3145,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra if (timescale) { time= BKE_scene_frame_get(scene); nexttime = BKE_scene_frame_get_from_ctime(scene, CFRA + 1.0f); - + *timescale= MAX2(nexttime - time, 0.0f); } @@ -3183,7 +3183,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra if (pid->cache->flag & PTCACHE_DISK_CACHE) { /* mode is same as fopen's modes */ - DIR *dir; + DIR *dir; struct dirent *de; char path[MAX_PTCACHE_PATH]; char filename[MAX_PTCACHE_FILE]; @@ -3191,9 +3191,9 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra unsigned int len; /* store the length of the string */ ptcache_path(pid, path); - + len = ptcache_filename(pid, filename, (int)cfra, 0, 0); /* no path */ - + dir = opendir(path); if (dir==NULL) return; @@ -3201,7 +3201,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra const char *fext = ptcache_file_extension(pid); BLI_snprintf(ext, sizeof(ext), "_%02u%s", pid->stack_index, fext); - + while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */ @@ -3309,7 +3309,7 @@ int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode) /* particles or cloth in that case -jahka */ else if (psys->clmd) { BKE_ptcache_id_from_cloth(&pid, ob, psys->clmd); - if (mode == PSYS_RESET_ALL || !(psys->part->type == PART_HAIR && (pid.cache->flag & PTCACHE_BAKED))) + if (mode == PSYS_RESET_ALL || !(psys->part->type == PART_HAIR && (pid.cache->flag & PTCACHE_BAKED))) reset |= BKE_ptcache_id_reset(scene, &pid, mode); else skip = 1; @@ -3366,19 +3366,19 @@ void BKE_ptcache_remove(void) char path[MAX_PTCACHE_PATH]; char path_full[MAX_PTCACHE_PATH]; int rmdir = 1; - + ptcache_path(NULL, path); if (BLI_exists(path)) { /* The pointcache dir exists? - remove all pointcache */ - DIR *dir; + DIR *dir; struct dirent *de; dir = opendir(path); if (dir==NULL) return; - + while ((de = readdir(dir)) != NULL) { if (FILENAME_IS_CURRPAR(de->d_name)) { /* do nothing */ @@ -3397,7 +3397,7 @@ void BKE_ptcache_remove(void) else { rmdir = 0; /* path dosnt exist */ } - + if (rmdir) { BLI_delete(path, true, false); } @@ -3507,7 +3507,7 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, const ListBase *ptcach return ptcaches_new->first; } -/* Disabled this code; this is being called on scene_update_tagged, and that in turn gets called on +/* Disabled this code; this is being called on scene_update_tagged, and that in turn gets called on * every user action changing stuff, and then it runs a complete bake??? (ton) */ /* Baking */ @@ -3553,7 +3553,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker) int startframe = MAXFRAME, endframe = baker->anim_init ? scene->r.sfra : CFRA; int bake = baker->bake; int render = baker->render; - + G.is_break = false; /* set caches to baking mode and figure out start frame */ @@ -3745,7 +3745,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker) scene->r.framelen = frameleno; CFRA = cfrao; - + if (bake) { /* already on cfra unless baking */ BKE_scene_update_for_newframe(bmain->eval_ctx, bmain, scene, scene->lay); } @@ -3827,7 +3827,7 @@ void BKE_ptcache_toggle_disk_cache(PTCacheID *pid) cache->flag ^= PTCACHE_DISK_CACHE; BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); cache->flag ^= PTCACHE_DISK_CACHE; - + cache->last_exact = last_exact; BKE_ptcache_id_time(pid, NULL, 0.0f, NULL, NULL, NULL); @@ -3847,7 +3847,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c char old_name[80]; int len; /* store the length of the string */ /* mode is same as fopen's modes */ - DIR *dir; + DIR *dir; struct dirent *de; char path[MAX_PTCACHE_PATH]; char old_filename[MAX_PTCACHE_FILE]; @@ -3906,7 +3906,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) int end = -1; /* mode is same as fopen's modes */ - DIR *dir; + DIR *dir; struct dirent *de; char path[MAX_PTCACHE_PATH]; char filename[MAX_PTCACHE_FILE]; @@ -3916,9 +3916,9 @@ void BKE_ptcache_load_external(PTCacheID *pid) return; ptcache_path(pid, path); - + len = ptcache_filename(pid, filename, 1, 0, 0); /* no path */ - + dir = opendir(path); if (dir==NULL) return; @@ -3929,7 +3929,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) BLI_snprintf(ext, sizeof(ext), "_%02d%s", cache->index, fext); else BLI_strncpy(ext, fext, sizeof(ext)); - + while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */ @@ -3985,7 +3985,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) if (pf) { while (ptcache_file_read(pf, old_data, 1, elemsize)) cache->totpoint++; - + ptcache_file_close(pf); } } @@ -4063,7 +4063,7 @@ void BKE_ptcache_update_info(PTCacheID *pid) } bytes += sizeof(PTCacheMem); - + totframes++; } -- cgit v1.2.3