Remove ModifyChildren from scene
This commit is contained in:
parent
d1f9c04613
commit
3cba62e3c2
12 changed files with 51 additions and 56 deletions
|
|
@ -275,16 +275,16 @@ namespace MatterHackers.MeshVisualizer
|
|||
}
|
||||
|
||||
// SetMeshAfterLoad
|
||||
scene.ModifyChildren(children =>
|
||||
scene.Children.Modify(list =>
|
||||
{
|
||||
if (loadedItem.Mesh != null)
|
||||
{
|
||||
// STLs currently load directly into the mesh rather than as a group like AMF
|
||||
children.Add(loadedItem);
|
||||
list.Add(loadedItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
children.AddRange(loadedItem.Children);
|
||||
list.AddRange(loadedItem.Children);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -67,11 +67,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
scene.ClearSelection();
|
||||
|
||||
scene.ModifyChildren(children =>
|
||||
scene.Children.Modify(list =>
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
children.Remove(item);
|
||||
list.Remove(item);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -82,15 +82,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public void Undo()
|
||||
{
|
||||
scene.ModifyChildren(children =>
|
||||
scene.Children.Modify(list =>
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
children.Add(item);
|
||||
list.Add(item);
|
||||
}
|
||||
});
|
||||
|
||||
scene.ClearSelection();
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
scene.AddToSelection(item);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
else
|
||||
{
|
||||
// This the undo -> redo() case. The original Selection group has been collapsed and we need to rebuild it
|
||||
interactiveScene.ModifyChildren(children =>
|
||||
interactiveScene.Children.Modify(children =>
|
||||
{
|
||||
// Remove all children from the scene
|
||||
foreach (var child in item.Children)
|
||||
|
|
@ -83,13 +83,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
return;
|
||||
}
|
||||
|
||||
interactiveScene.ModifyChildren(children =>
|
||||
interactiveScene.Children.Modify(list =>
|
||||
{
|
||||
// Remove the group
|
||||
children.Remove(item);
|
||||
list.Remove(item);
|
||||
|
||||
// Add all children from the group
|
||||
children.AddRange(item.Children);
|
||||
list.AddRange(item.Children);
|
||||
});
|
||||
|
||||
interactiveScene.SelectLastChild();
|
||||
|
|
|
|||
|
|
@ -59,10 +59,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
firstPass = false;
|
||||
}
|
||||
|
||||
scene.ModifyChildren(children =>
|
||||
{
|
||||
children.Add(item);
|
||||
});
|
||||
scene.Children.Modify(list => list.Add(item));
|
||||
|
||||
scene.SelectedItem = item;
|
||||
|
||||
|
|
@ -71,10 +68,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public void Undo()
|
||||
{
|
||||
scene.ModifyChildren(children =>
|
||||
{
|
||||
children.Remove(item);
|
||||
});
|
||||
scene.Children.Modify(list => list.Remove(item));
|
||||
|
||||
scene.SelectLastChild();
|
||||
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
return;
|
||||
}
|
||||
|
||||
scene.ModifyChildren(children =>
|
||||
scene.Children.Modify(list =>
|
||||
{
|
||||
// Remove the group
|
||||
children.Remove(originalItem);
|
||||
list.Remove(originalItem);
|
||||
|
||||
// Apply transform
|
||||
foreach(var child in originalItem.Children)
|
||||
|
|
@ -66,7 +66,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
|
||||
// Add all children from the group
|
||||
children.AddRange(originalItem.Children);
|
||||
list.AddRange(originalItem.Children);
|
||||
});
|
||||
|
||||
scene.SelectLastChild();
|
||||
|
|
@ -76,13 +76,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
public void Undo()
|
||||
{
|
||||
// Remove the children from the Scene root, add the original item back into the root
|
||||
scene.ModifyChildren(children =>
|
||||
scene.Children.Modify(list =>
|
||||
{
|
||||
foreach(var child in originalItem.Children)
|
||||
{
|
||||
if (children.Contains(child))
|
||||
if (list.Contains(child))
|
||||
{
|
||||
children.Remove(child);
|
||||
list.Remove(child);
|
||||
}
|
||||
|
||||
Matrix4X4 inverseMatrix = originalItem.Matrix;
|
||||
|
|
@ -91,7 +91,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
child.Matrix = inverseMatrix * child.Matrix;
|
||||
}
|
||||
|
||||
children.Add(originalItem);
|
||||
list.Add(originalItem);
|
||||
});
|
||||
|
||||
scene.SelectLastChild();
|
||||
|
|
|
|||
|
|
@ -726,9 +726,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
rotCurrent += rotChange;
|
||||
scaleCurrent += scaleChange;
|
||||
|
||||
Scene.ModifyChildren(children =>
|
||||
this.Scene.Children.Modify(list =>
|
||||
{
|
||||
children.Add(booleanGroup);
|
||||
list.Add(booleanGroup);
|
||||
});
|
||||
}
|
||||
catch (Exception e2)
|
||||
|
|
@ -930,9 +930,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
this.deferEditorTillMouseUp = true;
|
||||
|
||||
// Add item to scene and select it
|
||||
this.Scene.ModifyChildren(children =>
|
||||
this.Scene.Children.Modify(list =>
|
||||
{
|
||||
children.Add(this.DragDropObject);
|
||||
list.Add(this.DragDropObject);
|
||||
});
|
||||
Scene.SelectedItem = this.DragDropObject;
|
||||
|
||||
|
|
@ -952,7 +952,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
else
|
||||
{
|
||||
Scene.ModifyChildren(children => children.Remove(this.DragDropObject));
|
||||
Scene.Children.Modify(list => list.Remove(this.DragDropObject));
|
||||
Scene.ClearSelection();
|
||||
}
|
||||
|
||||
|
|
@ -1992,7 +1992,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
if (contentResult != null && contentResult.Object3D != null)
|
||||
{
|
||||
Scene.ModifyChildren(children => children.Add(contentResult.Object3D));
|
||||
Scene.Children.Modify(list => list.Add(contentResult.Object3D));
|
||||
|
||||
PlatingHelper.MoveToOpenPosition(contentResult.Object3D, this.Scene.Children);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue