diff --git a/MatterControlLib/DesignTools/Operations/ArrayLinearObject3D.cs b/MatterControlLib/DesignTools/Operations/ArrayLinearObject3D.cs index 3ce128f07..eb3865667 100644 --- a/MatterControlLib/DesignTools/Operations/ArrayLinearObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/ArrayLinearObject3D.cs @@ -96,6 +96,11 @@ namespace MatterHackers.MatterControl.DesignTools.Operations var updateItems = SheetObject3D.SortAndLockUpdateItems(this, (item) => { + if (!SheetObject3D.HasExpressionWithString(item, "[index]", false)) + { + return false; + } + // WIP if (item.Parent == this) { @@ -108,6 +113,12 @@ namespace MatterHackers.MatterControl.DesignTools.Operations // Only process its children that are the source container (they will be replicated and modified correctly by the source container) return item is OperationSourceObject3D; } + else if (item.Parent is OperationSourceObject3D operationSourceObject3D + && operationSourceObject3D.Parent == this) + { + // we don't need to rebuild our source object + return false; + } // process everything else return true; diff --git a/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs b/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs index d62e4016b..dc79bf180 100644 --- a/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs +++ b/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs @@ -152,7 +152,15 @@ namespace MatterHackers.MatterControl.DesignTools { if (includeObject(child)) { - AddItemsRequiringUpdateToDictionary(child, requiredUpdateItems, 0); + var parent = child; + var depthToThis = 0; + while(parent.Parent != root) + { + depthToThis++; + parent = parent.Parent; + } + + AddItemsRequiringUpdateToDictionary(child, requiredUpdateItems, depthToThis, includeObject); } } @@ -171,7 +179,22 @@ namespace MatterHackers.MatterControl.DesignTools private void SendInvalidateToAll(object s, EventArgs e) { - var updateItems = SortAndLockUpdateItems(this.Parent, (item) => item != this); + var updateItems = SortAndLockUpdateItems(this.Parent, (item) => + { + if (item == this || item.Parent == this) + { + // don't process this + return false; + } + else if (item.Parent is ArrayObject3D arrayObject3D + && arrayObject3D.SourceContainer != item) + { + // don't process the copied children of an array object + return false; + } + + return true; + }); SendInvalidateInRebuildOrder(updateItems, InvalidateType.SheetUpdated, this); } @@ -198,12 +221,13 @@ namespace MatterHackers.MatterControl.DesignTools var depthToBuild = lastUpdateItem.depth; for (int i = 0; i < updateItems.Count; i++) { - if (updateItems[i].depth == lastUpdateItem.depth) + var updateItem = updateItems[i]; + if (updateItem.depth == lastUpdateItem.depth) { - updateItems[i].rebuildLock.Dispose(); - updateItems[i].rebuildLock = null; - var updateSender = sender == null ? updateItems[i].item : sender; - updateItems[i].item.Invalidate(new InvalidateArgs(updateSender, sheetUpdated)); + updateItem.rebuildLock.Dispose(); + updateItem.rebuildLock = null; + var updateSender = sender == null ? updateItem.item : sender; + updateItem.item.Invalidate(new InvalidateArgs(updateSender, sheetUpdated)); } } } @@ -226,7 +250,6 @@ namespace MatterHackers.MatterControl.DesignTools } } } - } else { @@ -240,16 +263,17 @@ namespace MatterHackers.MatterControl.DesignTools return runningInterval; } - private static void AddItemsRequiringUpdateToDictionary(IObject3D inItem, Dictionary updatedItems, int inDepth) + private static void AddItemsRequiringUpdateToDictionary(IObject3D inItem, Dictionary updatedItems, int inDepth, Func includeObject) { // process depth first foreach(var child in inItem.Children) { - AddItemsRequiringUpdateToDictionary(child, updatedItems, inDepth + 1); + AddItemsRequiringUpdateToDictionary(child, updatedItems, inDepth + 1, includeObject); } var depth2 = inDepth; - if (HasExpressionWithString(inItem, "=", true)) + if (includeObject(inItem) + && HasExpressionWithString(inItem, "=", true)) { var itemToAdd = inItem; while (itemToAdd != null diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index eab4b2974..139698f36 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit eab4b2974bfd9c8cf5f3e9543f108ff53e20248d +Subproject commit 139698f3617abadb82b14a0442d668a17d43089c