From 9bcb02db5b2558e7ad1fa8a61b98620a924429df Mon Sep 17 00:00:00 2001 From: John Lewin Date: Thu, 21 Jun 2018 21:52:01 -0700 Subject: [PATCH] Create content and library thumbnails on raytrace success --- Library/ContentProviders/MeshContentProvider.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Library/ContentProviders/MeshContentProvider.cs b/Library/ContentProviders/MeshContentProvider.cs index a30d6612c..716197578 100644 --- a/Library/ContentProviders/MeshContentProvider.cs +++ b/Library/ContentProviders/MeshContentProvider.cs @@ -127,7 +127,21 @@ namespace MatterHackers.MatterControl string thumbnailId = libraryItem.ID; - return GetThumbnail(object3D, thumbnailId, width, height); + var thumbnail = GetThumbnail(object3D, thumbnailId, width, height); + if (thumbnail != null) + { + // Cache content thumbnail + AggContext.ImageIO.SaveImageData( + ApplicationController.Instance.Thumbnails.CachePath(object3D.MeshRenderId().ToString(), width, height), + thumbnail); + + // Cache library thumbnail + AggContext.ImageIO.SaveImageData( + ApplicationController.Instance.Thumbnails.CachePath(libraryItem, width, height), + thumbnail); + } + + return thumbnail ?? DefaultImage; } // Limit to private scope until need returns