Make sure we still center things when adding to bed

This commit is contained in:
Lars Brubaker 2018-09-26 13:23:03 -07:00
parent 3f30c44da5
commit 43272c5d26
3 changed files with 3 additions and 13 deletions

View file

@ -182,24 +182,13 @@ namespace MatterHackers.MatterControl
itemsToAdd,
context.View3DWidget,
scene,
(Printer != null) ? Printer.Bed.BedCenter : Vector2.Zero,
(item, itemsToAvoid) =>
{
PlatingHelper.MoveToOpenPositionRelativeGroup(item, itemsToAvoid);
}));
});
// Get the bounds of the loaded InsertionGroup with all of its content
//var aabb = injector.GetAxisAlignedBoundingBox(Matrix4X4.Identity);
// Remove position
//injector.Matrix *= Matrix4X4.CreateTranslation(new Vector3(-aabb.minXYZ.X, -aabb.minXYZ.Y, -aabb.minXYZ.Z));
// Recenter
//injector.Matrix *= Matrix4X4.CreateTranslation(new Vector3(bedCenter.X - aabb.XSize / 2, (double)(bedCenter.Y - aabb.YSize / 2), 0));
// Move again after content loaded
//PlatingHelper.MoveToOpenPosition(injector, scene.Children.ToList());
return insertionGroup;
}

View file

@ -62,6 +62,7 @@ namespace MatterHackers.MatterControl.Library
public InsertionGroupObject3D(IEnumerable<ILibraryItem> items,
View3DWidget view3DWidget,
InteractiveScene scene,
Vector2 newItemOffset,
Action<IObject3D, IEnumerable<IObject3D>> layoutParts,
bool trackSourceFiles = false)
{
@ -78,7 +79,6 @@ namespace MatterHackers.MatterControl.Library
this.LoadingItemsTask = Task.Run((Func<Task>)(async () =>
{
var newItemOffset = Vector2.Zero;
var offset = Matrix4X4.Identity;
// Add the placeholder 'Loading...' object

View file

@ -550,6 +550,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
items,
this,
Scene,
sceneContext.BedCenter,
null,
trackSourceFiles);