From 3b526cdc98b49fdd82c0951e699581fec041b2ea Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 7 Dec 2016 17:04:35 -0800 Subject: [PATCH] Fixed merge error in test Make sure we don't ref a null mesh on rebuild bed --- PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs | 11 +++++++---- .../MatterControl/MatterControlUtilities.cs | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs b/PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs index 976830941..f7342955c 100644 --- a/PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs +++ b/PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs @@ -106,11 +106,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if(ActiveSliceSettings.Instance.GetValue(SettingsKey.center_part_on_bed) && !InEditMode) { - var bounds = meshViewerWidget.MeshGroups[0].GetAxisAlignedBoundingBox(); - Vector3 boundsCenter = (bounds.maxXYZ + bounds.minXYZ) / 2; - for (int i = 0; i < meshViewerWidget.MeshGroups.Count; i++) + if (meshViewerWidget.MeshGroups.Count > 0) { - meshViewerWidget.MeshGroupTransforms[i] = Matrix4X4.CreateTranslation(-boundsCenter + new Vector3(0, 0, bounds.ZSize / 2) + new Vector3(bedCenter)); + var bounds = meshViewerWidget.MeshGroups[0].GetAxisAlignedBoundingBox(); + Vector3 boundsCenter = (bounds.maxXYZ + bounds.minXYZ) / 2; + for (int i = 0; i < meshViewerWidget.MeshGroups.Count; i++) + { + meshViewerWidget.MeshGroupTransforms[i] = Matrix4X4.CreateTranslation(-boundsCenter + new Vector3(0, 0, bounds.ZSize / 2) + new Vector3(bedCenter)); + } } } })); diff --git a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs index 971691c84..87f887ee0 100644 --- a/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs +++ b/Tests/MatterControl.Tests/MatterControl/MatterControlUtilities.cs @@ -256,7 +256,6 @@ namespace MatterHackers.MatterControl.Tests.Automation testRunner.ClickByName("Select Model", 5, delayBeforeReturn: .5); testRunner.ClickByName(model + " Menu Item", 5, delayBeforeReturn: .5); - testRunner.ClickByName("Save & Continue Button", 5, delayBeforeReturn: 1); // wait for this window to close // An unpredictable period of time will pass between Clicking Save, everything reloading and us returning to the caller. // Block until ReloadAll has completed then close and return to the caller, at which point hopefully everything is reloaded.