From c1b6aad3f3e6ba7299cd352999ba1c8f82cf9367 Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Fri, 20 Jan 2012 14:31:13 -0500 Subject: Do not save the BVH when caching the geometry. --- chroma/cache.py | 16 +++++++++++----- 1 file 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 -- cgit