diff --git a/Library/Interfaces/LibraryExtensionMethods.cs b/Library/Interfaces/LibraryExtensionMethods.cs
index f02843777..a6dd14cec 100644
--- a/Library/Interfaces/LibraryExtensionMethods.cs
+++ b/Library/Interfaces/LibraryExtensionMethods.cs
@@ -53,5 +53,11 @@ namespace MatterHackers.MatterControl.Library
|| (item is ILibraryContentStream contentStream
&& ApplicationController.Instance.Library.IsContentFileType(contentStream.FileName));
}
+
+ public static bool IsMeshFileType(this ILibraryItem item)
+ {
+ return item is ILibraryContentStream contentStream
+ && ApplicationController.Instance.Library.IsMeshFileType(contentStream.FileName);
+ }
}
}
diff --git a/Library/Providers/LibraryConfig.cs b/Library/Providers/LibraryConfig.cs
index 0b44eec9e..5d40f0092 100644
--- a/Library/Providers/LibraryConfig.cs
+++ b/Library/Providers/LibraryConfig.cs
@@ -187,6 +187,13 @@ namespace MatterHackers.MatterControl.Library
|| ApplicationController.Instance.Library.ContentProviders.Keys.Contains(fileExtensionLower));
}
+ public bool IsMeshFileType(string fileName)
+ {
+ string fileExtensionLower = Path.GetExtension(fileName).ToLower().Trim('.');
+ return !string.IsNullOrEmpty(fileExtensionLower)
+ && ApplicationSettings.LibraryMeshFileExtensions.Contains(fileExtensionLower);
+ }
+
///
/// Notifies listeners that the ActiveContainer Changed
///
diff --git a/Library/Widgets/InsertionGroup.cs b/Library/Widgets/InsertionGroup.cs
index ffe34c9b3..8c58a5ced 100644
--- a/Library/Widgets/InsertionGroup.cs
+++ b/Library/Widgets/InsertionGroup.cs
@@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
}
// TODO: Figure out how best to collapse the InsertionGroup after the load task completes
- public InsertionGroup(IEnumerable items, View3DWidget view3DWidget, InteractiveScene scene, Vector2 bedCenter, Func dragOperationActive)
+ public InsertionGroup(IEnumerable items, View3DWidget view3DWidget, InteractiveScene scene, Vector2 bedCenter, Func dragOperationActive, bool trackSourceFiles = false)
{
// Add a temporary placeholder to give us some bounds
this.Mesh = InsertionGroup.placeHolderMesh;
@@ -116,6 +116,14 @@ namespace MatterHackers.MatterControl.PrintLibrary
loadedItem.Matrix = loadedItem.Matrix * Matrix4X4.CreateTranslation((double)-aabb.Center.X, (double)-aabb.Center.Y, (double)-aabb.minXYZ.Z) * placeholderItem.Matrix;
loadedItem.Color = loadedItem.Color;
+ // Set mesh path if tracking requested
+ if (trackSourceFiles
+ && item is FileSystemFileItem fileItem
+ && item.IsMeshFileType())
+ {
+ loadedItem.MeshPath = fileItem.Path;
+ }
+
// Notification should force invalidate and redraw
//progressReporter?.Invoke(1, "");
diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs
index 61d2f1d7b..383018509 100644
--- a/PartPreviewWindow/View3D/View3DWidget.cs
+++ b/PartPreviewWindow/View3D/View3DWidget.cs
@@ -877,7 +877,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
- private void StartDragDrop(IEnumerable items, Vector2 screenSpaceMousePosition)
+ private void StartDragDrop(IEnumerable items, Vector2 screenSpaceMousePosition, bool trackSourceFiles = false)
{
this.DragOperationActive = true;
@@ -904,7 +904,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this,
this.Scene,
sceneContext.BedCenter,
- () => this.DragOperationActive);
+ () => this.DragOperationActive,
+ trackSourceFiles);
// Find intersection position of the mouse with the bed plane
var intersectInfo = GetIntersectPosition(screenSpaceMousePosition);
@@ -1417,8 +1418,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
// Project DragFiles to IEnumerable
this.StartDragDrop(
- mouseEvent.DragFiles.Select(path => new FileSystemFileItem(path)),
- screenSpaceMousePosition: this.TransformToScreenSpace(mouseEvent.Position));
+ mouseEvent.DragFiles.Select(path => new FileSystemFileItem(path)),
+ screenSpaceMousePosition: this.TransformToScreenSpace(mouseEvent.Position),
+ trackSourceFiles: true);
}
}
diff --git a/SettingsManagement/ApplicationSettings.cs b/SettingsManagement/ApplicationSettings.cs
index 37097fa00..4d45f3eca 100644
--- a/SettingsManagement/ApplicationSettings.cs
+++ b/SettingsManagement/ApplicationSettings.cs
@@ -20,7 +20,8 @@ namespace MatterHackers.MatterControl
public class ApplicationSettings
{
- public static string LibraryFilterFileExtensions { get; } = ".stl,.obj,.amf,.gcode,.mcx";
+ public static string LibraryMeshFileExtensions { get; } = ".stl,.obj,.amf,.mcx";
+ public static string LibraryFilterFileExtensions { get; } = LibraryMeshFileExtensions + ",.gcode";
public static string OpenPrintableFileParams { get; } = "STL, AMF, OBJ, ZIP, GCODE, MCX|*.stl;*.amf;*.obj;*.zip;*.gcode;*.mcx";
public static string OpenDesignFileParams { get; } = "STL, AMF, OBJ, ZIP, GCODE, MCX|*.stl;*.amf;*.obj;*.zip;*.gcode;*.mcx";
diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp
index 37dcb2f6f..0e1228349 160000
--- a/Submodules/agg-sharp
+++ b/Submodules/agg-sharp
@@ -1 +1 @@
-Subproject commit 37dcb2f6fed1868eb9e557d82ef7be1b893ff332
+Subproject commit 0e12283490c83827df27ee0caaa10d510b3814c1