From 769c57b38a707397ac7fdda15b1deb561194b66c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 4 Jul 2018 11:22:15 +0200 Subject: SoftBody: share point cache between CoW copies This is the same approach as 98a0bcd4252e952fa5438e9d1b69b0204f8a8746 applied to soft body simulation. In short, CoW copies share the point cache, and treat it as read-only except when the depsgraph is active. --- source/blender/makesdna/DNA_object_force_types.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'source/blender/makesdna/DNA_object_force_types.h') diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h index ac7c969a810..3538abcff1a 100644 --- a/source/blender/makesdna/DNA_object_force_types.h +++ b/source/blender/makesdna/DNA_object_force_types.h @@ -37,6 +37,7 @@ extern "C" { #endif #include "DNA_listBase.h" +#include "DNA_defs.h" /* pd->forcefield: Effector Fields types */ typedef enum ePFieldType { @@ -218,6 +219,15 @@ typedef struct SBVertex { float vec[4]; } SBVertex; +/* Container for data that is shared among CoW copies. + * + * This is placed in a separate struct so that values can be changed + * without having to update all CoW copies. */ +typedef struct SoftBody_Shared { + struct PointCache *pointcache; + struct ListBase ptcaches; +} SoftBody_Shared; + typedef struct SoftBody { /* dynamic data */ int totpoint, totspring; @@ -289,8 +299,9 @@ typedef struct SoftBody { float shearstiff; float inpush; - struct PointCache *pointcache; - struct ListBase ptcaches; + struct SoftBody_Shared *shared; + struct PointCache *pointcache DNA_DEPRECATED; /* Moved to SoftBody_Shared */ + struct ListBase ptcaches DNA_DEPRECATED; /* Moved to SoftBody_Shared */ struct Collection *collision_group; -- cgit v1.2.3