diff options
-rw-r--r-- | chroma/cache.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/chroma/cache.py b/chroma/cache.py index 392e434..5a00df2 100644 --- a/chroma/cache.py +++ b/chroma/cache.py @@ -99,11 +99,17 @@ class Cache(object): def save_geometry(self, name, geometry): '''Save ``geometry`` in the cache with the name ``name``.''' geo_file = self.get_geometry_filename(name) - 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) + # 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 def load_geometry(self, name): '''Returns the chroma.geometry.Geometry object associated with |