From c25ba86b684b2963bdf00389b44ee51785eff17d Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 22 Jun 2022 18:10:33 -0700 Subject: [PATCH 1/3] Working on a rebuild selection operation --- .../ApplicationView/SceneOperations.cs | 39 +++++++++++++++++++ .../DesignTools/Operations/ArrayObject3D.cs | 2 +- .../DesignTools/Sheets/SheetObject3D.cs | 22 ++++++----- Submodules/agg-sharp | 2 +- 4 files changed, 54 insertions(+), 11 deletions(-) diff --git a/MatterControlLib/ApplicationView/SceneOperations.cs b/MatterControlLib/ApplicationView/SceneOperations.cs index e97516c40..0627282fb 100644 --- a/MatterControlLib/ApplicationView/SceneOperations.cs +++ b/MatterControlLib/ApplicationView/SceneOperations.cs @@ -754,6 +754,9 @@ namespace MatterHackers.MatterControl ArrangeAllPartsOperation(), new SceneSelectionSeparator(), LayFlatOperation(), +#if DEBUG + RebuildOperation(), +#endif GroupOperation(), UngroupOperation(), new SceneSelectionSeparator(), @@ -1174,6 +1177,42 @@ namespace MatterHackers.MatterControl }; } + private static SceneOperation RebuildOperation() + { + return new SceneOperation("Rebuild") + { + TitleGetter = () => "Rebuild".Localize(), + Action = (sceneContext) => + { + var scene = sceneContext.Scene; + var selectedItem = scene.SelectedItem; + if (selectedItem != null) + { + try + { + var updateItems = SheetObject3D.SortAndLockUpdateItems(selectedItem.Parent, (item) => + { + if (item == selectedItem || item.Parent == selectedItem) + { + // don't process this + return false; + } + return true; + }, false); + + SheetObject3D.SendInvalidateInRebuildOrder(updateItems, InvalidateType.Properties, null); + } + catch + { + } + } + }, + HelpTextGetter = () => "At least 1 part must be selected".Localize().Stars(), + IsEnabled = (sceneContext) => sceneContext.Scene.SelectedItem != null, + Icon = (theme) => StaticData.Instance.LoadIcon("update.png", 16, 16).SetToColor(theme.TextColor).SetPreMultiply(), + }; + } + private static SceneOperation LinearArrayOperation() { return new SceneOperation("Linear Array") diff --git a/MatterControlLib/DesignTools/Operations/ArrayObject3D.cs b/MatterControlLib/DesignTools/Operations/ArrayObject3D.cs index 628e66fa0..3e807d75e 100644 --- a/MatterControlLib/DesignTools/Operations/ArrayObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/ArrayObject3D.cs @@ -111,7 +111,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations // process everything else return true; - }); + }, true); var runningInterval = SheetObject3D.SendInvalidateInRebuildOrder(updateItems, InvalidateType.Properties); diff --git a/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs b/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs index 56f94a184..d121ce648 100644 --- a/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs +++ b/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs @@ -132,7 +132,7 @@ namespace MatterHackers.MatterControl.DesignTools } } - public static List SortAndLockUpdateItems(IObject3D root, Func includeObject) + public static List SortAndLockUpdateItems(IObject3D root, Func includeObject, bool checkForExpression) { var requiredUpdateItems = new Dictionary(); foreach (var child in root.Descendants()) @@ -146,8 +146,8 @@ namespace MatterHackers.MatterControl.DesignTools depthToThis++; parent = parent.Parent; } - - AddItemsRequiringUpdateToDictionary(child, requiredUpdateItems, depthToThis, includeObject); + + AddItemsRequiringUpdateToDictionary(child, requiredUpdateItems, depthToThis, includeObject, checkForExpression); } } @@ -181,13 +181,13 @@ namespace MatterHackers.MatterControl.DesignTools } return true; - }); + }, true); SendInvalidateInRebuildOrder(updateItems, InvalidateType.SheetUpdated, this); } public static RunningInterval SendInvalidateInRebuildOrder(List updateItems, - InvalidateType sheetUpdated, + InvalidateType invalidateType, IObject3D sender = null) { // and send the invalidate @@ -214,7 +214,7 @@ namespace MatterHackers.MatterControl.DesignTools updateItem.rebuildLock.Dispose(); updateItem.rebuildLock = null; var updateSender = sender == null ? updateItem.item : sender; - updateItem.item.Invalidate(new InvalidateArgs(updateSender, sheetUpdated)); + updateItem.item.Invalidate(new InvalidateArgs(updateSender, invalidateType)); } } } @@ -250,17 +250,21 @@ namespace MatterHackers.MatterControl.DesignTools return runningInterval; } - private static void AddItemsRequiringUpdateToDictionary(IObject3D inItem, Dictionary updatedItems, int inDepth, Func includeObject) + private static void AddItemsRequiringUpdateToDictionary(IObject3D inItem, + Dictionary updatedItems, + int inDepth, + Func includeObject, + bool checkForExpression) { // process depth first foreach(var child in inItem.Children) { - AddItemsRequiringUpdateToDictionary(child, updatedItems, inDepth + 1, includeObject); + AddItemsRequiringUpdateToDictionary(child, updatedItems, inDepth + 1, includeObject, checkForExpression); } var depth2 = inDepth; if (includeObject(inItem) - && HasExpressionWithString(inItem, "=", true)) + && (!checkForExpression || HasExpressionWithString(inItem, "=", true))) { var itemToAdd = inItem; while (itemToAdd != null diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 338231d1f..86dc328a5 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 338231d1f1bafe87d200435b065035846e75ca60 +Subproject commit 86dc328a559f0fe025d1ccb9cee42cc9e2951549 From b8720215610f0cfb4663ff5b022fd7182edf8685 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Thu, 23 Jun 2022 09:50:43 -0700 Subject: [PATCH 2/3] upgrading json from @dependabot work --- MatterControlLib/MatterControlLib.csproj | 2 +- Submodules/MatterSlice | 2 +- Submodules/agg-sharp | 2 +- .../MatterControl.AutomationTests.csproj | 2 +- Tests/MatterControl.Tests/MatterControl.Tests.csproj | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MatterControlLib/MatterControlLib.csproj b/MatterControlLib/MatterControlLib.csproj index 2b666df40..7d2a8b1db 100644 --- a/MatterControlLib/MatterControlLib.csproj +++ b/MatterControlLib/MatterControlLib.csproj @@ -98,7 +98,7 @@ - + diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index cce755cd9..a8b75c577 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit cce755cd9c356a96edb641ed515113caa6bf6ad3 +Subproject commit a8b75c5777f9298462380d1ba13d524693078fde diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 86dc328a5..4acc7078e 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 86dc328a559f0fe025d1ccb9cee42cc9e2951549 +Subproject commit 4acc7078efc0e21eeb7168f2a6530fd460f12a6e diff --git a/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj b/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj index c03586734..79fcd5d89 100644 --- a/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj +++ b/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj @@ -42,7 +42,7 @@ AnyCPU - + diff --git a/Tests/MatterControl.Tests/MatterControl.Tests.csproj b/Tests/MatterControl.Tests/MatterControl.Tests.csproj index 50845c69d..4c4eeceb7 100644 --- a/Tests/MatterControl.Tests/MatterControl.Tests.csproj +++ b/Tests/MatterControl.Tests/MatterControl.Tests.csproj @@ -157,7 +157,7 @@ - + From e66ed1e29d4652c134a620e009edb1911fa27f35 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Thu, 23 Jun 2022 10:07:52 -0700 Subject: [PATCH 3/3] upgrading nuget packages --- .../Community.CsharpSqlite.csproj | 2 +- .../MatterControl.Printing.csproj | 2 +- MatterControl.SLA/MatterControl.SLA.csproj | 2 +- MatterControl.csproj | 6 +++--- MatterControlLib/MatterControlLib.csproj | 16 ++++++++-------- Submodules/MatterSlice | 2 +- Submodules/agg-sharp | 2 +- .../MatterControl.AutomationTests.csproj | 6 +++--- .../MatterControl.Tests.csproj | 8 ++++---- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Community.CsharpSqlite/Community.CsharpSqlite.csproj b/Community.CsharpSqlite/Community.CsharpSqlite.csproj index 3e709e6b5..367becdcb 100644 --- a/Community.CsharpSqlite/Community.CsharpSqlite.csproj +++ b/Community.CsharpSqlite/Community.CsharpSqlite.csproj @@ -16,7 +16,7 @@ - + diff --git a/MatterControl.Printing/MatterControl.Printing.csproj b/MatterControl.Printing/MatterControl.Printing.csproj index 68103a912..f76342677 100644 --- a/MatterControl.Printing/MatterControl.Printing.csproj +++ b/MatterControl.Printing/MatterControl.Printing.csproj @@ -12,7 +12,7 @@ - + diff --git a/MatterControl.SLA/MatterControl.SLA.csproj b/MatterControl.SLA/MatterControl.SLA.csproj index e01aa291d..e3955a7d3 100644 --- a/MatterControl.SLA/MatterControl.SLA.csproj +++ b/MatterControl.SLA/MatterControl.SLA.csproj @@ -12,7 +12,7 @@ - + diff --git a/MatterControl.csproj b/MatterControl.csproj index a6629da9d..14760918c 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -135,13 +135,13 @@ - 18.0.0 + 27.2.1 - 5.2.7 + 5.2.9 - 5.12.0 + 5.13.0 1.0.2-beta1 diff --git a/MatterControlLib/MatterControlLib.csproj b/MatterControlLib/MatterControlLib.csproj index 7d2a8b1db..ad004c2b0 100644 --- a/MatterControlLib/MatterControlLib.csproj +++ b/MatterControlLib/MatterControlLib.csproj @@ -88,27 +88,27 @@ - - + + - - + + - - + + - + - + diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index a8b75c577..d30433b04 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit a8b75c5777f9298462380d1ba13d524693078fde +Subproject commit d30433b04424d0af57fa22e0bf8cec077ac41b2a diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 4acc7078e..4af60a982 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 4acc7078efc0e21eeb7168f2a6530fd460f12a6e +Subproject commit 4af60a9822345f3bf6800ede7d5b6c6948ea0dc9 diff --git a/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj b/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj index 79fcd5d89..bdcc92c7d 100644 --- a/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj +++ b/Tests/MatterControl.AutomationTests/MatterControl.AutomationTests.csproj @@ -43,10 +43,10 @@ - - + + - 3.12.0 + 4.2.1 diff --git a/Tests/MatterControl.Tests/MatterControl.Tests.csproj b/Tests/MatterControl.Tests/MatterControl.Tests.csproj index 4c4eeceb7..3af225a86 100644 --- a/Tests/MatterControl.Tests/MatterControl.Tests.csproj +++ b/Tests/MatterControl.Tests/MatterControl.Tests.csproj @@ -156,11 +156,11 @@ - + - - - + + +