Made the print bed model and texture only get created when the bed size or shape changes.

Made the water mark image get cached.
This commit is contained in:
Lars Brubaker 2015-08-13 16:24:17 -07:00
parent 4f8acd3974
commit 52428f8fdb
4 changed files with 10 additions and 8 deletions

View file

@ -104,18 +104,21 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
base.OnDraw(graphics2D);
}
static ImageBuffer wattermarkImage = null;
protected void PutOemImageOnBed()
{
// this is to add an image to the bed
string imagePathAndFile = Path.Combine("OEMSettings", "bedimage.png");
if (allowAutoRotate && StaticData.Instance.FileExists(imagePathAndFile))
{
ImageBuffer wattermarkImage = StaticData.Instance.LoadImage(imagePathAndFile);
if (wattermarkImage == null)
{
wattermarkImage = StaticData.Instance.LoadImage(imagePathAndFile);
}
ImageBuffer bedImage = meshViewerWidget.BedImage;
ImageBuffer bedImage = MeshViewerWidget.BedImage;
Graphics2D bedGraphics = bedImage.NewGraphics2D();
bedGraphics.Render(wattermarkImage,
new Vector2((bedImage.Width - wattermarkImage.Width) / 2, (bedImage.Height - wattermarkImage.Height) / 2));
bedGraphics.Render(wattermarkImage, new Vector2((bedImage.Width - wattermarkImage.Width) / 2, (bedImage.Height - wattermarkImage.Height) / 2));
}
}

View file

@ -276,7 +276,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// move things into the right place and scale
{
Vector3 bedCenter3D = new Vector3(bedCenter, 0);
meshViewerWidget.PrinterBed.Translate(bedCenter3D);
meshViewerWidget.TrackballTumbleWidget.TrackBallController.Scale = .05;
meshViewerWidget.TrackballTumbleWidget.TrackBallController.Translate(-bedCenter3D);
}

@ -1 +1 @@
Subproject commit 6f9f6e41f011af08ca9df47316b99ae3a19df419
Subproject commit 8e65da62fb98f278c3ea819a0d023585e07cad23

View file

@ -267,7 +267,7 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
for (int i = 0; i < asynchMeshGroups.Count; i++)
{
ScaleRotateTranslate translate = asynchMeshGroupTransforms[i];
translate.translation *= Matrix4X4.CreateTranslation(new Vector3(meshViewerWidget.BedCenter, 0));
translate.translation *= Matrix4X4.CreateTranslation(new Vector3(MeshViewerWidget.BedCenter, 0));
asynchMeshGroupTransforms[i] = translate;
}
@ -478,7 +478,7 @@ namespace MatterHackers.MatterControl.Plugins.TextCreator
Mesh connectionLine = PlatonicSolids.CreateCube(xSize, ySize, zSize);
meshesList.Add(new MeshGroup(connectionLine));
platingDataList.Add(new PlatingMeshGroupData());
meshTransforms.Add(ScaleRotateTranslate.CreateTranslation((bounds.maxXYZ.x + bounds.minXYZ.x) / 2 + meshViewerWidget.BedCenter.x, ySize / 2 - ySize * 2 / 3 + meshViewerWidget.BedCenter.y, zSize / 2));
meshTransforms.Add(ScaleRotateTranslate.CreateTranslation((bounds.maxXYZ.x + bounds.minXYZ.x) / 2 + MeshViewerWidget.BedCenter.x, ySize / 2 - ySize * 2 / 3 + MeshViewerWidget.BedCenter.y, zSize / 2));
PlatingHelper.CreateITraceableForMeshGroup(platingDataList, meshesList, meshesList.Count - 1, null);
}
}