Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/pointcache.c
| Show First 20 Lines • Show All 1,000 Lines • ▼ Show 20 Lines | void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *clmd) | ||||
| pid->info_types = 0; | pid->info_types = 0; | ||||
| pid->default_step = 1; | pid->default_step = 1; | ||||
| pid->max_step = 1; | pid->max_step = 1; | ||||
| pid->file_type = PTCACHE_FILE_PTCACHE; | pid->file_type = PTCACHE_FILE_PTCACHE; | ||||
| } | } | ||||
| /* The fluid modifier does not actually use this anymore, but some parts of Blender expect that it | /* The fluid modifier does not actually use this anymore, but some parts of Blender expect that it | ||||
| * still has a point cache currently. */ | * still has a point cache currently. For example, the fluid modifier uses | ||||
| * #DEG_add_collision_relations, which internally creates relations with the point cache. */ | |||||
| void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct FluidModifierData *fmd) | void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct FluidModifierData *fmd) | ||||
| { | { | ||||
| FluidDomainSettings *fds = fmd->domain; | FluidDomainSettings *fds = fmd->domain; | ||||
| memset(pid, 0, sizeof(PTCacheID)); | memset(pid, 0, sizeof(PTCacheID)); | ||||
| pid->owner_id = &ob->id; | pid->owner_id = &ob->id; | ||||
| pid->calldata = fmd; | pid->calldata = fmd; | ||||
| ▲ Show 20 Lines • Show All 1,526 Lines • ▼ Show 20 Lines | static int ptcache_write_needed(PTCacheID *pid, int cfra, int *overwrite) | ||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| /* writes cache to disk or memory */ | /* writes cache to disk or memory */ | ||||
| int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra) | int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra) | ||||
| { | { | ||||
| PointCache *cache = pid->cache; | PointCache *cache = pid->cache; | ||||
| if (!pid->totpoint) { | |||||
| /* This happens when `pid->type == PTCACHE_TYPE_SMOKE_DOMAIN`. The fluid system does not | |||||
| * actually use the pointcache anymore for caching. */ | |||||
| return 0; | |||||
| } | |||||
| int totpoint = pid->totpoint(pid->calldata, cfra); | int totpoint = pid->totpoint(pid->calldata, cfra); | ||||
| int overwrite = 0, error = 0; | int overwrite = 0, error = 0; | ||||
| if (totpoint == 0 || (cfra ? pid->data_types == 0 : pid->info_types == 0)) { | if (totpoint == 0 || (cfra ? pid->data_types == 0 : pid->info_types == 0)) { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| if (ptcache_write_needed(pid, cfra, &overwrite) == 0) { | if (ptcache_write_needed(pid, cfra, &overwrite) == 0) { | ||||
| ▲ Show 20 Lines • Show All 1,371 Lines • Show Last 20 Lines | |||||