diff options
Diffstat (limited to 'source/blender/modifiers/intern/MOD_cloth.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_cloth.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 0b99aa55c8d..d15a6fcb1c8 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -37,7 +37,6 @@ #include "DNA_cloth_types.h" #include "DNA_key_types.h" #include "DNA_scene_types.h" -#include "DNA_object_force.h" #include "DNA_object_types.h" #include "MEM_guardedalloc.h" @@ -52,6 +51,7 @@ #include "BKE_key.h" #include "BKE_library_query.h" #include "BKE_modifier.h" +#include "BKE_pointcache.h" #include "depsgraph_private.h" @@ -63,9 +63,10 @@ static void initData(ModifierData *md) clmd->sim_parms = MEM_callocN(sizeof(ClothSimSettings), "cloth sim parms"); clmd->coll_parms = MEM_callocN(sizeof(ClothCollSettings), "cloth coll parms"); + clmd->point_cache = BKE_ptcache_add(&clmd->ptcaches); /* check for alloc failing */ - if (!clmd->sim_parms || !clmd->coll_parms) + if (!clmd->sim_parms || !clmd->coll_parms || !clmd->point_cache) return; cloth_init(clmd); @@ -173,10 +174,15 @@ static void copyData(ModifierData *md, ModifierData *target) if (tclmd->coll_parms) MEM_freeN(tclmd->coll_parms); + BKE_ptcache_free_list(&tclmd->ptcaches); + tclmd->point_cache = NULL; + tclmd->sim_parms = MEM_dupallocN(clmd->sim_parms); if (clmd->sim_parms->effector_weights) tclmd->sim_parms->effector_weights = MEM_dupallocN(clmd->sim_parms->effector_weights); tclmd->coll_parms = MEM_dupallocN(clmd->coll_parms); + tclmd->point_cache = BKE_ptcache_add(&tclmd->ptcaches); + tclmd->point_cache->step = 1; tclmd->clothObject = NULL; tclmd->hairdata = NULL; tclmd->solver_result = NULL; @@ -205,6 +211,9 @@ static void freeData(ModifierData *md) if (clmd->coll_parms) MEM_freeN(clmd->coll_parms); + BKE_ptcache_free_list(&clmd->ptcaches); + clmd->point_cache = NULL; + if (clmd->hairdata) MEM_freeN(clmd->hairdata); |