diff options
-rw-r--r-- | chroma/cache.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/chroma/cache.py b/chroma/cache.py index 5a00df2..a22f2f8 100644 --- a/chroma/cache.py +++ b/chroma/cache.py @@ -10,6 +10,7 @@ process is present. import os import cPickle as pickle +import copy from chroma.log import logger @@ -100,16 +101,17 @@ class Cache(object): '''Save ``geometry`` in the cache with the name ``name``.''' geo_file = self.get_geometry_filename(name) # exclude saving the BVH - bvh = geometry.bvh - try: - geometry.bvh = None - with open(geo_file, 'wb') as output_file: - pickle.dump(geometry.mesh.md5(), output_file, - pickle.HIGHEST_PROTOCOL) - pickle.dump(geometry, output_file, - pickle.HIGHEST_PROTOCOL) - finally: - geometry.bvh = bvh + reduced_geometry = copy.copy(geometry) + reduced_geometry.bvh = None + reduced_geometry.solids = [] + reduced_geometry.solid_rotations = [] + reduced_geometry.solid_displacements = [] + + with open(geo_file, 'wb') as output_file: + pickle.dump(geometry.mesh.md5(), output_file, + pickle.HIGHEST_PROTOCOL) + pickle.dump(reduced_geometry, output_file, + pickle.HIGHEST_PROTOCOL) def load_geometry(self, name): '''Returns the chroma.geometry.Geometry object associated with |