diff --git a/Library/Interfaces/ILibraryContainer.cs b/Library/Interfaces/ILibraryContainer.cs index 6cac49ee8..5ab0fb3d1 100644 --- a/Library/Interfaces/ILibraryContainer.cs +++ b/Library/Interfaces/ILibraryContainer.cs @@ -31,6 +31,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; using MatterHackers.Agg.Image; +using MatterHackers.DataConverters3D; namespace MatterHackers.MatterControl.Library { @@ -67,6 +68,8 @@ namespace MatterHackers.MatterControl.Library void Rename(ILibraryItem item, string revisedName); void Move(IEnumerable items, ILibraryContainer targetContainer); + void Save(ILibraryItem item, IObject3D content); + void SetThumbnail(ILibraryItem item, int width, int height, ImageBuffer imageBuffer); bool AllowAction(ContainerActions containerActions); } diff --git a/Library/Providers/FileSystem/FileSystemContainer.cs b/Library/Providers/FileSystem/FileSystemContainer.cs index 12fde2c70..32a5d186b 100644 --- a/Library/Providers/FileSystem/FileSystemContainer.cs +++ b/Library/Providers/FileSystem/FileSystemContainer.cs @@ -36,6 +36,9 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using MatterHackers.Agg.Platform; using MatterHackers.Agg.UI; +using MatterHackers.DataConverters3D; +using MatterHackers.MatterControl.DataStorage; +using MatterHackers.MeshVisualizer; namespace MatterHackers.MatterControl.Library { @@ -327,6 +330,17 @@ namespace MatterHackers.MatterControl.Library } } + public override void Save(ILibraryItem item, IObject3D content) + { + if (item is FileSystemFileItem fileItem) + { + if (content is InteractiveScene scene) + { + scene.Save(fileItem.Path, ApplicationDataStorage.Instance.ApplicationLibraryDataPath); + } + } + } + public class DirectoryContainerLink : FileSystemItem, ILibraryContainerLink { public DirectoryContainerLink(string path) diff --git a/Library/Providers/WritableContainer.cs b/Library/Providers/WritableContainer.cs index 1cc75699e..1edd43c56 100644 --- a/Library/Providers/WritableContainer.cs +++ b/Library/Providers/WritableContainer.cs @@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project. using System; using System.Collections.Generic; using MatterHackers.Agg.Image; +using MatterHackers.DataConverters3D; namespace MatterHackers.MatterControl.Library { @@ -54,6 +55,10 @@ namespace MatterHackers.MatterControl.Library { } + public virtual void Save(ILibraryItem item, IObject3D content) + { + } + public virtual void Move(IEnumerable items, ILibraryContainer targetContainer) { }