Better filtering of update sets for sheet and array
This commit is contained in:
parent
a1eb53ecfa
commit
e9b2001eff
3 changed files with 47 additions and 12 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<IObject3D, UpdateItem> updatedItems, int inDepth)
|
||||
private static void AddItemsRequiringUpdateToDictionary(IObject3D inItem, Dictionary<IObject3D, UpdateItem> updatedItems, int inDepth, Func<IObject3D, bool> 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
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit eab4b2974bfd9c8cf5f3e9543f108ff53e20248d
|
||||
Subproject commit 139698f3617abadb82b14a0442d668a17d43089c
|
||||
Loading…
Add table
Add a link
Reference in a new issue