Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorishbosamiya <ishbosamiya@gmail.com>2019-08-17 09:34:41 +0300
committerishbosamiya <ishbosamiya@gmail.com>2019-08-17 12:46:32 +0300
commit64bdb89abab57c1696accd1989f3213b5e47e841 (patch)
tree003123e885028fa7420fa6f093ce990c7b1a52cc
parentb000354226f2a21b178d9a429a95fe13bb42461d (diff)
Cloth: cache read check for adaptive cloth
-rw-r--r--source/blender/blenkernel/intern/cloth.c9
-rw-r--r--source/blender/blenkernel/intern/pointcache.c63
2 files changed, 38 insertions, 34 deletions
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 09e16ffe0fe..50b591949c0 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -425,9 +425,16 @@ Mesh *clothModifier_do(
clmd->sim_parms->timescale = 1.0f;
#endif
+ if (!(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_ADAPTIVE_REMESHING)) {
+ printf("Currently no remeshing\n");
+ }
+ else {
+ printf("Currently remeshing\n");
+ }
+
if (clmd->sim_parms->reset ||
(clmd->clothObject && mesh_result->totvert != clmd->clothObject->mvert_num &&
- clmd->sim_parms->flags & ~CLOTH_SIMSETTINGS_FLAG_ADAPTIVE_REMESHING)) {
+ !(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_ADAPTIVE_REMESHING))) {
printf("this is called\n");
clmd->sim_parms->reset = 0;
clmd->sim_parms->remeshing_reset = 1;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 3d8c6a924e4..c8887b2b5bd 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2951,46 +2951,43 @@ static int ptcache_read(PTCacheID *pid, int cfra)
if ((pid->data_types & (1 << BPHYS_DATA_INDEX)) == 0) {
if (pid->type == PTCACHE_TYPE_CLOTH) {
ClothModifierData *clmd = pid->calldata;
- Object *ob = clmd->ob;
- Depsgraph *depsgraph = clmd->depsgraph;
- Mesh *mesh = clmd->mesh;
- printf("mesh in %s before remeshing has totvert: %d totedge: %d totface %d\n",
- __func__,
- mesh->totvert,
- mesh->totedge,
- mesh->totpoly);
+ if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_ADAPTIVE_REMESHING) {
+ Object *ob = clmd->ob;
+ Depsgraph *depsgraph = clmd->depsgraph;
+ Mesh *mesh = clmd->mesh;
+ printf("mesh in %s before remeshing has totvert: %d totedge: %d totface %d\n",
+ __func__,
+ mesh->totvert,
+ mesh->totedge,
+ mesh->totpoly);
#if 1
- if (clmd->flags & MOD_CLOTH_FLAG_PREV_FRAME_READ_CACHE) {
- }
- else {
- clmd->sim_parms->remeshing_reset = 1;
- }
+ if (clmd->flags & MOD_CLOTH_FLAG_PREV_FRAME_READ_CACHE) {
+ }
+ else {
+ clmd->sim_parms->remeshing_reset = 1;
+ }
#else
- printf("reset: %d\n", clmd->sim_parms->reset);
- printf("remeshing_reset: %d\n", clmd->sim_parms->remeshing_reset);
- clmd->sim_parms->remeshing_reset = 1;
+ printf("reset: %d\n", clmd->sim_parms->reset);
+ printf("remeshing_reset: %d\n", clmd->sim_parms->remeshing_reset);
+ clmd->sim_parms->remeshing_reset = 1;
#endif
- Mesh *mesh_result = cloth_remeshing_step(depsgraph, ob, clmd, mesh);
- if (clmd->mesh && mesh_result) {
- /* BKE_mesh_free(clmd->mesh); */
- BKE_id_copy_ex(NULL, (ID *)mesh_result, (ID **)&clmd->mesh, LIB_ID_COPY_LOCALIZE);
- printf("mesh in %s after remeshing has totvert: %d totedge: %d totface %d\n",
- __func__,
- clmd->mesh->totvert,
- clmd->mesh->totedge,
- clmd->mesh->totpoly);
+ Mesh *mesh_result = cloth_remeshing_step(depsgraph, ob, clmd, mesh);
+ if (clmd->mesh && mesh_result) {
+ /* BKE_mesh_free(clmd->mesh); */
+ BKE_id_copy_ex(NULL, (ID *)mesh_result, (ID **)&clmd->mesh, LIB_ID_COPY_LOCALIZE);
+ printf("mesh in %s after remeshing has totvert: %d totedge: %d totface %d\n",
+ __func__,
+ clmd->mesh->totvert,
+ clmd->mesh->totedge,
+ clmd->mesh->totpoly);
+ }
}
}
int pid_totpoint = pid->totpoint(pid->calldata, cfra);
if (totpoint != pid_totpoint) {
-#if 0
- char *em = NULL;
- sprintf(em,
- "%s memory_cache_totpoint: %d pid_totpoint: %d",
- "Number of points in cache does not match mesh",
- totpoint,
- pid_totpoint);
- pid->error(pid->calldata, em);
+#if 1
+ printf("memory_cache_totpoint: %d pid_totpoint: %d\n", totpoint, pid_totpoint);
+ pid->error(pid->calldata, "Number of points in cache does not match mesh");
#else
pid->error(pid->calldata, "Number of points in cache does not match mesh");
#endif