Merge pull request #3175 from larsbrubaker/design_tools
Created a new animation object
This commit is contained in:
commit
d13dc7144e
22 changed files with 101 additions and 45 deletions
|
|
@ -69,18 +69,11 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
logoMesh.Transform(Matrix4X4.CreateScale(scale / aabb.XSize));
|
||||
|
||||
var loadTime = Stopwatch.StartNew();
|
||||
var anglePerDraw = 1 / MathHelper.Tau * spinSpeed;
|
||||
var angle = 0.0;
|
||||
|
||||
widget.BeforeDraw += (s, e) =>
|
||||
{
|
||||
if (this.SpinLogo)
|
||||
{
|
||||
var thisAngle = Math.Min(anglePerDraw, loadTime.Elapsed.TotalSeconds * MathHelper.Tau);
|
||||
angle += thisAngle;
|
||||
loadTime.Restart();
|
||||
}
|
||||
var screenSpaceBounds = widget.TransformToScreenSpace(widget.LocalBounds);
|
||||
WorldView world = new WorldView(screenSpaceBounds.Width, screenSpaceBounds.Height);
|
||||
world.Translate(new Vector3(0, yOffset, 0));
|
||||
|
|
@ -91,7 +84,14 @@ namespace MatterHackers.MatterControl
|
|||
GLHelper.UnsetGlContext();
|
||||
};
|
||||
|
||||
UiThread.SetInterval(widget.Invalidate, .05, () => !widget.HasBeenClosed);
|
||||
Animation spinAnimation = new Animation(widget, (time) =>
|
||||
{
|
||||
if (this.SpinLogo)
|
||||
{
|
||||
angle += anglePerDraw;
|
||||
}
|
||||
},
|
||||
.05);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,33 @@
|
|||
using System;
|
||||
/*
|
||||
Copyright (c) 2018, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2018, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2018, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2018, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2018, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2018, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -45,11 +45,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
protected PrinterConfig printer;
|
||||
ThemeConfig theme;
|
||||
LevelWizardBase levelWizard;
|
||||
|
||||
public ProbeWizardControl(PrinterConfig printer, ThemeConfig theme)
|
||||
{
|
||||
this.levelWizard = levelWizard;
|
||||
this.theme = theme;
|
||||
this.printer = printer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2018, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2018, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2018, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2018, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2018, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
});
|
||||
buttonView.AfterDraw += (s, e) =>
|
||||
{
|
||||
e.graphics2D.Render(rotatedLabel, ActiveTheme.Instance.PrimaryTextColor);
|
||||
e.Graphics2D.Render(rotatedLabel, ActiveTheme.Instance.PrimaryTextColor);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,33 @@
|
|||
using MatterHackers.Agg;
|
||||
/*
|
||||
Copyright (c) 2018, Lars Brubaker
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
leadingTabAdornment.AfterDraw += (s, e) =>
|
||||
{
|
||||
var firstItem = this.AllTabs.OfType<ChromeTab>().FirstOrDefault();
|
||||
ChromeTab.DrawTabLowerRight(e.graphics2D, leadingTabAdornment.LocalBounds, (firstItem == this.ActiveTab) ? theme.ActiveTabColor : theme.InactiveTabColor);
|
||||
ChromeTab.DrawTabLowerRight(e.Graphics2D, leadingTabAdornment.LocalBounds, (firstItem == this.ActiveTab) ? theme.ActiveTabColor : theme.InactiveTabColor);
|
||||
};
|
||||
this.TabBar.ActionArea.AddChild(leadingTabAdornment);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,19 +65,19 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Vector3 renderPosition = bounds.GetBottomCorner(2);
|
||||
Vector2 cornerScreenSpace = view3DWidget.InteractionLayer.World.GetScreenPosition(renderPosition) - new Vector2(20, 0);
|
||||
|
||||
e.graphics2D.PushTransform();
|
||||
Affine currentGraphics2DTransform = e.graphics2D.GetTransform();
|
||||
e.Graphics2D.PushTransform();
|
||||
Affine currentGraphics2DTransform = e.Graphics2D.GetTransform();
|
||||
Affine accumulatedTransform = currentGraphics2DTransform * Affine.NewTranslation(cornerScreenSpace.X, cornerScreenSpace.Y);
|
||||
e.graphics2D.SetTransform(accumulatedTransform);
|
||||
e.Graphics2D.SetTransform(accumulatedTransform);
|
||||
|
||||
progressBar.OnDraw(e.graphics2D);
|
||||
progressBar.OnDraw(e.Graphics2D);
|
||||
|
||||
if (!string.IsNullOrEmpty(this.State))
|
||||
{
|
||||
e.graphics2D.DrawString(this.State, 0, -20, 11);
|
||||
e.Graphics2D.DrawString(this.State, 0, -20, 11);
|
||||
}
|
||||
|
||||
e.graphics2D.PopTransform();
|
||||
e.Graphics2D.PopTransform();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -298,12 +298,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
for (int i = 0; i < lines.Count; i += 2)
|
||||
{
|
||||
// draw the measure line
|
||||
drawEvent.graphics2D.Line(lines[i], lines[i + 1], Color.Black);
|
||||
drawEvent.Graphics2D.Line(lines[i], lines[i + 1], Color.Black);
|
||||
}
|
||||
|
||||
for (int i = 0; i < lines.Count; i += 4)
|
||||
{
|
||||
DrawMeasureLine(drawEvent.graphics2D, (lines[i] + lines[i + 1]) / 2, (lines[i + 2] + lines[i + 3]) / 2, Color.Black, LineArrows.Both);
|
||||
DrawMeasureLine(drawEvent.Graphics2D, (lines[i] + lines[i + 1]) / 2, (lines[i + 2] + lines[i + 3]) / 2, Color.Black, LineArrows.Both);
|
||||
}
|
||||
|
||||
AxisAlignedBoundingBox selectedBounds = selectedItem.GetAxisAlignedBoundingBox(Matrix4X4.Identity);
|
||||
|
|
|
|||
|
|
@ -123,8 +123,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (drawEvent != null)
|
||||
{
|
||||
// draw the line that is on the ground
|
||||
drawEvent.graphics2D.Line(lines[0], lines[1], Color.Red);
|
||||
drawEvent.graphics2D.Line(lines[2], lines[3], Color.Red);
|
||||
drawEvent.Graphics2D.Line(lines[0], lines[1], Color.Red);
|
||||
drawEvent.Graphics2D.Line(lines[2], lines[3], Color.Red);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,9 +131,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
Vector3 topEndPosition = Vector3.Transform(x.Bvh.GetAxisAlignedBoundingBox().GetTopCorner((i + 1) % 4), x.TransformToWorld);
|
||||
var topEndScreenPos = World.GetScreenPosition(topEndPosition);
|
||||
|
||||
e.graphics2D.Line(bottomStartScreenPos, bottomEndScreenPos, Color.Black);
|
||||
e.graphics2D.Line(topStartScreenPos, topEndScreenPos, Color.Black);
|
||||
e.graphics2D.Line(topStartScreenPos, bottomStartScreenPos, Color.Black);
|
||||
e.Graphics2D.Line(bottomStartScreenPos, bottomEndScreenPos, Color.Black);
|
||||
e.Graphics2D.Line(topStartScreenPos, topEndScreenPos, Color.Black);
|
||||
e.Graphics2D.Line(topStartScreenPos, bottomStartScreenPos, Color.Black);
|
||||
}
|
||||
|
||||
TriangleShape tri = x.Bvh as TriangleShape;
|
||||
|
|
@ -145,7 +145,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
var screenCenter = Vector3.Transform(vertexPos, x.TransformToWorld);
|
||||
var screenPos = World.GetScreenPosition(screenCenter);
|
||||
|
||||
e.graphics2D.Circle(screenPos, 3, Color.Red);
|
||||
e.Graphics2D.Circle(screenPos, 3, Color.Red);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -153,8 +153,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
var center = x.Bvh.GetCenter();
|
||||
var worldCenter = Vector3.Transform(center, x.TransformToWorld);
|
||||
var screenPos2 = World.GetScreenPosition(worldCenter);
|
||||
e.graphics2D.Circle(screenPos2, 3, Color.Yellow);
|
||||
e.graphics2D.DrawString($"{x.Depth},", screenPos2.X + 12 * x.Depth, screenPos2.Y);
|
||||
e.Graphics2D.Circle(screenPos2, 3, Color.Yellow);
|
||||
e.Graphics2D.DrawString($"{x.Depth},", screenPos2.X + 12 * x.Depth, screenPos2.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace MatterHackers.MeshVisualizer
|
|||
public bool ZBuffered { get; }
|
||||
|
||||
public DrawGlContentEventArgs(bool zBuffered, DrawEventArgs e)
|
||||
: base(e.graphics2D)
|
||||
: base(e.Graphics2D)
|
||||
{
|
||||
ZBuffered = zBuffered;
|
||||
}
|
||||
|
|
@ -223,8 +223,8 @@ namespace MatterHackers.MeshVisualizer
|
|||
{
|
||||
foreach (var child in scene.Children)
|
||||
{
|
||||
this.World.RenderDebugAABB(e.graphics2D, child.TraceData().GetAxisAlignedBoundingBox());
|
||||
this.World.RenderDebugAABB(e.graphics2D, child.GetAxisAlignedBoundingBox(Matrix4X4.Identity));
|
||||
this.World.RenderDebugAABB(e.Graphics2D, child.TraceData().GetAxisAlignedBoundingBox());
|
||||
this.World.RenderDebugAABB(e.Graphics2D, child.GetAxisAlignedBoundingBox(Matrix4X4.Identity));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -643,7 +643,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (DragSelectionInProgress)
|
||||
{
|
||||
var selectionRectangle = new RectangleDouble(DragSelectionStartPosition, DragSelectionEndPosition);
|
||||
e.graphics2D.Rectangle(selectionRectangle, Color.Red);
|
||||
e.Graphics2D.Rectangle(selectionRectangle, Color.Red);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 6e1cea81b37d3e30ce31a7f0e62fc13740b8ae17
|
||||
Subproject commit fa422c60d59bd77009a30303b58ecb5ebc07ee8e
|
||||
Loading…
Add table
Add a link
Reference in a new issue