diff --git a/MatterControl.MeshOperations/BooleanProcessing.cs b/MatterControl.MeshOperations/BooleanProcessing.cs index 57a3c8223..14d9616ef 100644 --- a/MatterControl.MeshOperations/BooleanProcessing.cs +++ b/MatterControl.MeshOperations/BooleanProcessing.cs @@ -353,8 +353,15 @@ namespace MatterHackers.PolygonMesh } else { + var preAddCount = resultsMesh.Vertices.Count; // mesh the new polygon and add it to the resultsMesh polygonShape.Vertices().TriangulateFaces(null, resultsMesh, 0, flattenedMatrixInverted); + + // TODO: map all the added vertices that can be back to the original polygon positions + // for (int i = preAddCount; i< resultsMesh.Vertices.Count; i++) + { + + } } if (resultsMesh.Faces.Count - faceCountPreAdd > 0) @@ -395,7 +402,7 @@ namespace MatterHackers.PolygonMesh // check if more than one mesh has this polygons on this plan var flattenedMatrix = CoPlanarFaces.GetFlattenedMatrix(plane); - // depending on the opperation add or remove polygons that are planar + // depending on the operation add or remove polygons that are planar switch (operation) { case CsgModes.Union: diff --git a/MatterControlLib/DesignTools/Attributes/ShowUpdateButtonAttribute.cs b/MatterControlLib/DesignTools/Attributes/ShowUpdateButtonAttribute.cs index 5455a0e5b..4ee3362db 100644 --- a/MatterControlLib/DesignTools/Attributes/ShowUpdateButtonAttribute.cs +++ b/MatterControlLib/DesignTools/Attributes/ShowUpdateButtonAttribute.cs @@ -34,8 +34,11 @@ namespace MatterHackers.MatterControl.DesignTools [AttributeUsage(AttributeTargets.Class)] public class ShowUpdateButtonAttribute : Attribute { - public ShowUpdateButtonAttribute() + public bool SuppressPropertyChangeUpdates { get; set; } + + public ShowUpdateButtonAttribute(bool suppressPropertyChangeUpdates) { + SuppressPropertyChangeUpdates = suppressPropertyChangeUpdates; } } } \ No newline at end of file diff --git a/MatterControlLib/DesignTools/Interfaces/ISelectedEditorDraw.cs b/MatterControlLib/DesignTools/Interfaces/IEditorDraw.cs similarity index 83% rename from MatterControlLib/DesignTools/Interfaces/ISelectedEditorDraw.cs rename to MatterControlLib/DesignTools/Interfaces/IEditorDraw.cs index 3add8f051..7f8d2137f 100644 --- a/MatterControlLib/DesignTools/Interfaces/ISelectedEditorDraw.cs +++ b/MatterControlLib/DesignTools/Interfaces/IEditorDraw.cs @@ -33,12 +33,15 @@ using MatterHackers.MatterControl.PartPreviewWindow; namespace MatterHackers.MatterControl.DesignTools { - public interface ISelectedEditorDraw + public interface IEditorDraw { - void DrawEditor(Object3DControlsLayer object3DControlLayer, List transparentMeshes, DrawEventArgs e); + void DrawEditor(Object3DControlsLayer object3DControlLayer, DrawEventArgs e); } - public interface IAlwaysEditorDraw : ISelectedEditorDraw + public interface ICustomEditorDraw : IEditorDraw { + void AddEditorTransparents(Object3DControlsLayer object3DControlLayer, List transparentMeshes, DrawEventArgs e); + + bool DoEditorDraw(bool isSelected); } } \ No newline at end of file diff --git a/MatterControlLib/DesignTools/LithophaneObject3D.cs b/MatterControlLib/DesignTools/LithophaneObject3D.cs index 164c4a62f..5554f227d 100644 --- a/MatterControlLib/DesignTools/LithophaneObject3D.cs +++ b/MatterControlLib/DesignTools/LithophaneObject3D.cs @@ -43,7 +43,7 @@ using Newtonsoft.Json; namespace MatterHackers.MatterControl.Plugins.Lithophane { - [ShowUpdateButton] + [ShowUpdateButton(true)] public class LithophaneObject3D : Object3D { public LithophaneObject3D() diff --git a/MatterControlLib/DesignTools/Obsolete/CurveObject3D.cs b/MatterControlLib/DesignTools/Obsolete/CurveObject3D.cs index c27e9d102..cffd9de43 100644 --- a/MatterControlLib/DesignTools/Obsolete/CurveObject3D.cs +++ b/MatterControlLib/DesignTools/Obsolete/CurveObject3D.cs @@ -53,7 +53,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools { [Obsolete("Use CurveObject3D_3 instead", false)] - public class CurveObject3D : MeshWrapperObject3D, ISelectedEditorDraw + public class CurveObject3D : MeshWrapperObject3D, IEditorDraw { // holds where we rotate the object private Vector2 rotationCenter; @@ -77,7 +77,7 @@ namespace MatterHackers.MatterControl.DesignTools [Description("Where to start the bend as a percent of the width of the part")] public double StartPercent { get; set; } = 50; - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { if (layer.Scene.SelectedItem != null && layer.Scene.SelectedItem.DescendantsAndSelf().Where((i) => i == this).Any()) diff --git a/MatterControlLib/DesignTools/Obsolete/FitToBoundsObject3D.cs b/MatterControlLib/DesignTools/Obsolete/FitToBoundsObject3D.cs index cd37f8c9a..1aa5ae149 100644 --- a/MatterControlLib/DesignTools/Obsolete/FitToBoundsObject3D.cs +++ b/MatterControlLib/DesignTools/Obsolete/FitToBoundsObject3D.cs @@ -64,7 +64,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations } [Obsolete("Not used anymore. Replaced with FitToBoundsObject3D_3", true)] - public class FitToBoundsObject3D : Object3D, ISelectedEditorDraw, IPropertyGridModifier + public class FitToBoundsObject3D : Object3D, IEditorDraw, IPropertyGridModifier { [Description("Set the shape the part will be fit into.")] public FitType FitType { get; set; } = FitType.Box; @@ -268,7 +268,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations ScaleItem.Matrix = Object3DExtensions.ApplyAtPosition(ScaleItem.Matrix, aabb.Center, Matrix4X4.CreateScale(scale)); } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { if (layer.Scene.SelectedItem != null && layer.Scene.SelectedItem.DescendantsAndSelf().Where((i) => i == this).Any()) diff --git a/MatterControlLib/DesignTools/Operations/ArrayRadialObject3D.cs b/MatterControlLib/DesignTools/Operations/ArrayRadialObject3D.cs index d99128972..62b0b51db 100644 --- a/MatterControlLib/DesignTools/Operations/ArrayRadialObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/ArrayRadialObject3D.cs @@ -42,7 +42,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class ArrayRadialObject3D : ArrayObject3D, ISelectedEditorDraw + public class ArrayRadialObject3D : ArrayObject3D, IEditorDraw { public ArrayRadialObject3D() { @@ -138,7 +138,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations }); } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { layer.World.RenderDirectionAxis(Axis, this.WorldMatrix(), 30); } diff --git a/MatterControlLib/DesignTools/Operations/CurveObject3D_2.cs b/MatterControlLib/DesignTools/Operations/CurveObject3D_2.cs index fe74ae557..212d354e4 100644 --- a/MatterControlLib/DesignTools/Operations/CurveObject3D_2.cs +++ b/MatterControlLib/DesignTools/Operations/CurveObject3D_2.cs @@ -52,7 +52,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools { [Obsolete("Use CurveObject3D_3 instead", false)] - public class CurveObject3D_2 : OperationSourceContainerObject3D, ISelectedEditorDraw + public class CurveObject3D_2 : OperationSourceContainerObject3D, IEditorDraw { public CurveObject3D_2() { @@ -75,7 +75,7 @@ namespace MatterHackers.MatterControl.DesignTools [Description("Split the mesh so it has enough geometry to create a smooth curve")] public bool SplitMesh { get; set; } = true; - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { var sourceAabb = this.SourceContainer.GetAxisAlignedBoundingBox(); var distance = Diameter / 2 + sourceAabb.YSize / 2; diff --git a/MatterControlLib/DesignTools/Operations/CurveObject3D_3.cs b/MatterControlLib/DesignTools/Operations/CurveObject3D_3.cs index de93bc086..d8ebf1974 100644 --- a/MatterControlLib/DesignTools/Operations/CurveObject3D_3.cs +++ b/MatterControlLib/DesignTools/Operations/CurveObject3D_3.cs @@ -46,7 +46,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools { - public class CurveObject3D_3 : OperationSourceContainerObject3D, IPropertyGridModifier, ISelectedEditorDraw + public class CurveObject3D_3 : OperationSourceContainerObject3D, IPropertyGridModifier, IEditorDraw { public CurveObject3D_3() { @@ -102,7 +102,7 @@ namespace MatterHackers.MatterControl.DesignTools [DescriptionImage("https://lh3.googleusercontent.com/p9MyKu3AFP55PnobUKZQPqf6iAx11GzXyX-25f1ddrUnfCt8KFGd1YtHOR5HqfO0mhlX2ZVciZV4Yn0Kzfm43SErOS_xzgsESTu9scux")] public DoubleOrExpression MinSidesPerRotation { get; set; } = 30; - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { var diameter = Diameter.Value(this); var startPercent = StartPercent.Value(this); diff --git a/MatterControlLib/DesignTools/Operations/FitToBoundsObject3D_2.cs b/MatterControlLib/DesignTools/Operations/FitToBoundsObject3D_2.cs index 98876b5ea..2ce6d9310 100644 --- a/MatterControlLib/DesignTools/Operations/FitToBoundsObject3D_2.cs +++ b/MatterControlLib/DesignTools/Operations/FitToBoundsObject3D_2.cs @@ -49,7 +49,7 @@ using System.Threading.Tasks; namespace MatterHackers.MatterControl.DesignTools.Operations { [Obsolete("Not used anymore. Replaced with FitToBoundsObject3D_3", true)] - public class FitToBoundsObject3D_2 : TransformWrapperObject3D, ISelectedEditorDraw + public class FitToBoundsObject3D_2 : TransformWrapperObject3D, IEditorDraw { private Vector3 boundsSize; private InvalidateType additonalInvalidate; @@ -150,7 +150,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations return fitToBounds; } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { var aabb = UntransformedChildren.GetAxisAlignedBoundingBox(); var center = aabb.Center; diff --git a/MatterControlLib/DesignTools/Operations/FitToBoundsObject3D_3.cs b/MatterControlLib/DesignTools/Operations/FitToBoundsObject3D_3.cs index 1352c0779..8b10792ee 100644 --- a/MatterControlLib/DesignTools/Operations/FitToBoundsObject3D_3.cs +++ b/MatterControlLib/DesignTools/Operations/FitToBoundsObject3D_3.cs @@ -43,7 +43,7 @@ using System.Threading.Tasks; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class FitToBoundsObject3D_3 : TransformWrapperObject3D, ISelectedEditorDraw + public class FitToBoundsObject3D_3 : TransformWrapperObject3D, IEditorDraw { private InvalidateType additonalInvalidate; @@ -111,7 +111,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations return fitToBounds; } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { var aabb = UntransformedChildren.GetAxisAlignedBoundingBox(); var center = aabb.Center; diff --git a/MatterControlLib/DesignTools/Operations/FitToCylinderObject3D.cs b/MatterControlLib/DesignTools/Operations/FitToCylinderObject3D.cs index 1ca4b7031..1789ae34b 100644 --- a/MatterControlLib/DesignTools/Operations/FitToCylinderObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/FitToCylinderObject3D.cs @@ -49,7 +49,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class FitToCylinderObject3D : TransformWrapperObject3D, ISelectedEditorDraw + public class FitToCylinderObject3D : TransformWrapperObject3D, IEditorDraw { public FitToCylinderObject3D() { @@ -105,7 +105,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations return fitToBounds; } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { var aabb = this.WorldAxisAlignedBoundingBox(); layer.World.RenderCylinderOutline(Matrix4X4.Identity, aabb.Center, Diameter, aabb.ZSize, 90, Color.Red); diff --git a/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D.cs b/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D.cs index 70a86097c..1be94892f 100644 --- a/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D.cs @@ -57,7 +57,7 @@ using Polygons = System.Collections.Generic.List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { this.DrawPath(); } diff --git a/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D_2.cs b/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D_2.cs index 655cd5d04..628c8c813 100644 --- a/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D_2.cs +++ b/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D_2.cs @@ -52,7 +52,7 @@ using Polygons = System.Collections.Generic.List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { this.DrawPath(); } diff --git a/MatterControlLib/DesignTools/Operations/Image/PathObject3D.cs b/MatterControlLib/DesignTools/Operations/Image/PathObject3D.cs index 4ad4fe97d..e7f7f8b27 100644 --- a/MatterControlLib/DesignTools/Operations/Image/PathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Image/PathObject3D.cs @@ -37,7 +37,7 @@ using System.Collections.Generic; namespace MatterHackers.MatterControl.DesignTools { - public class PathObject3D : Object3D, IPathObject, ISelectedEditorDraw + public class PathObject3D : Object3D, IPathObject, IEditorDraw { [JsonIgnore] private IVertexSource _vertexSource = new VertexStorage(); @@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl.DesignTools } } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { this.DrawPath(); } diff --git a/MatterControlLib/DesignTools/Operations/Path/InflatePathObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/InflatePathObject3D.cs index c3a956b8e..94ae5cc4e 100644 --- a/MatterControlLib/DesignTools/Operations/Path/InflatePathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/InflatePathObject3D.cs @@ -48,7 +48,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations Sharp, } - public class InflatePathObject3D : Object3D, IPathObject, ISelectedEditorDraw, IObject3DControlsProvider + public class InflatePathObject3D : Object3D, IPathObject, IEditorDraw, IObject3DControlsProvider { public IVertexSource VertexSource { get; set; } = new VertexStorage(); @@ -135,7 +135,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations return joinType; } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { this.DrawPath(); } diff --git a/MatterControlLib/DesignTools/Operations/Path/MergePathObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/MergePathObject3D.cs index 50d556667..168325245 100644 --- a/MatterControlLib/DesignTools/Operations/Path/MergePathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/MergePathObject3D.cs @@ -42,7 +42,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class MergePathObject3D : OperationSourceContainerObject3D, IPathObject, ISelectedEditorDraw, IObject3DControlsProvider + public class MergePathObject3D : OperationSourceContainerObject3D, IPathObject, IEditorDraw, IObject3DControlsProvider { private ClipperLib.ClipType clipType; private string operationName; @@ -56,7 +56,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public IVertexSource VertexSource { get; set; } = new VertexStorage(); - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { this.DrawPath(); } diff --git a/MatterControlLib/DesignTools/Operations/Path/OutlinePathObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/OutlinePathObject3D.cs index 91814764e..3561bd8d6 100644 --- a/MatterControlLib/DesignTools/Operations/Path/OutlinePathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/OutlinePathObject3D.cs @@ -43,7 +43,7 @@ using MatterHackers.MatterControl.PartPreviewWindow; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class OutlinePathObject3D : Object3D, IPathObject, ISelectedEditorDraw, IObject3DControlsProvider + public class OutlinePathObject3D : Object3D, IPathObject, IEditorDraw, IObject3DControlsProvider { public IVertexSource VertexSource { get; set; } = new VertexStorage(); @@ -152,7 +152,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations (VertexSource as VertexStorage).Add(0, 0, ShapePath.FlagsAndCommand.Stop); } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { this.DrawPath(); } diff --git a/MatterControlLib/DesignTools/Operations/Path/RevolveObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/RevolveObject3D.cs index 17019dd75..5673353e7 100644 --- a/MatterControlLib/DesignTools/Operations/Path/RevolveObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/RevolveObject3D.cs @@ -46,7 +46,7 @@ using Newtonsoft.Json; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class RevolveObject3D : Object3D, ISelectedEditorDraw + public class RevolveObject3D : Object3D, IEditorDraw { [MaxDecimalPlaces(2)] public DoubleOrExpression AxisPosition { get; set; } = 0; @@ -130,7 +130,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations } } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { var child = this.Children.FirstOrDefault(); if (child is IPathObject pathObject) diff --git a/MatterControlLib/DesignTools/Operations/Path/SmoothPathObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/SmoothPathObject3D.cs index b501c5215..6a187da0d 100644 --- a/MatterControlLib/DesignTools/Operations/Path/SmoothPathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/SmoothPathObject3D.cs @@ -43,7 +43,7 @@ using Polygons = System.Collections.Generic.List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { this.DrawPath(); } diff --git a/MatterControlLib/DesignTools/Operations/RotateObject3D_2.cs b/MatterControlLib/DesignTools/Operations/RotateObject3D_2.cs index e6519c7df..53e1ad050 100644 --- a/MatterControlLib/DesignTools/Operations/RotateObject3D_2.cs +++ b/MatterControlLib/DesignTools/Operations/RotateObject3D_2.cs @@ -42,7 +42,7 @@ using Newtonsoft.Json; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class RotateObject3D_2 : TransformWrapperObject3D, ISelectedEditorDraw + public class RotateObject3D_2 : TransformWrapperObject3D, IEditorDraw { public RotateObject3D_2() { @@ -111,7 +111,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations } } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { if (layer.Scene.SelectedItem != null && layer.Scene.SelectedItem.DescendantsAndSelf().Where((i) => i == this).Any()) diff --git a/MatterControlLib/DesignTools/Operations/ScaleObject3D.cs b/MatterControlLib/DesignTools/Operations/ScaleObject3D.cs index 6c2cb8ad2..36a729741 100644 --- a/MatterControlLib/DesignTools/Operations/ScaleObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/ScaleObject3D.cs @@ -48,7 +48,7 @@ using Newtonsoft.Json; namespace MatterHackers.MatterControl.DesignTools.Operations { [Obsolete("Use ScaleObject3D_3 instead", false)] - public class ScaleObject3D : TransformWrapperObject3D, ISelectedEditorDraw, IPropertyGridModifier + public class ScaleObject3D : TransformWrapperObject3D, IEditorDraw, IPropertyGridModifier { public enum ScaleType { @@ -199,7 +199,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations [Description("This is the position to perform the scale about.")] public Vector3 ScaleAbout { get; set; } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { if (layer.Scene.SelectedItem != null && layer.Scene.SelectedItem.DescendantsAndSelf().Where((i) => i == this).Any()) diff --git a/MatterControlLib/DesignTools/Operations/TwistObject3D.cs b/MatterControlLib/DesignTools/Operations/TwistObject3D.cs index 3f7bd3148..2a7d3db67 100644 --- a/MatterControlLib/DesignTools/Operations/TwistObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/TwistObject3D.cs @@ -48,7 +48,7 @@ using Newtonsoft.Json; namespace MatterHackers.MatterControl.DesignTools { - public class TwistObject3D : OperationSourceContainerObject3D, IPropertyGridModifier, ISelectedEditorDraw + public class TwistObject3D : OperationSourceContainerObject3D, IPropertyGridModifier, IEditorDraw { public TwistObject3D() { @@ -129,7 +129,7 @@ namespace MatterHackers.MatterControl.DesignTools } } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { var sourceAabb = this.SourceContainer.GetAxisAlignedBoundingBox(); var rotationCenter = SourceContainer.GetSmallestEnclosingCircleAlongZ().Center + RotationOffset; diff --git a/MatterControlLib/DesignTools/Primitives/BaseObject3D.cs b/MatterControlLib/DesignTools/Primitives/BaseObject3D.cs index f6f7215b6..0a521e44e 100644 --- a/MatterControlLib/DesignTools/Primitives/BaseObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/BaseObject3D.cs @@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.DesignTools Outline } - public class BaseObject3D : Object3D, IPropertyGridModifier, ISelectedEditorDraw + public class BaseObject3D : Object3D, IPropertyGridModifier, IEditorDraw { public enum CenteringTypes { @@ -454,7 +454,7 @@ namespace MatterHackers.MatterControl.DesignTools } } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { if (OutlineIsFromMesh) { diff --git a/MatterControlLib/DesignTools/Primitives/BoxPathObject3D.cs b/MatterControlLib/DesignTools/Primitives/BoxPathObject3D.cs index d6ab058ea..2c5618cba 100644 --- a/MatterControlLib/DesignTools/Primitives/BoxPathObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/BoxPathObject3D.cs @@ -41,7 +41,7 @@ using Newtonsoft.Json; namespace MatterHackers.MatterControl.DesignTools { - public class BoxPathObject3D : PrimitiveObject3D, IPathObject, IObject3DControlsProvider, ISelectedEditorDraw + public class BoxPathObject3D : PrimitiveObject3D, IPathObject, IObject3DControlsProvider, IEditorDraw { public BoxPathObject3D() { @@ -66,7 +66,7 @@ namespace MatterHackers.MatterControl.DesignTools } } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { this.DrawPath(); } diff --git a/MatterControlLib/DesignTools/Primitives/DescriptionObject3D.cs b/MatterControlLib/DesignTools/Primitives/DescriptionObject3D.cs index 10a438256..393078d62 100644 --- a/MatterControlLib/DesignTools/Primitives/DescriptionObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/DescriptionObject3D.cs @@ -51,7 +51,7 @@ namespace MatterHackers.MatterControl.DesignTools [HideMeterialAndColor] [WebPageLink("Resources", "Markdown Help", "https://guides.github.com/features/mastering-markdown/")] [MarkDownDescription("Used to add description within then scene. The object on the bed will not print.")] - public class DescriptionObject3D : Object3D, IObject3DControlsProvider, IAlwaysEditorDraw, IEditorButtonProvider + public class DescriptionObject3D : Object3D, IObject3DControlsProvider, ICustomEditorDraw, IEditorButtonProvider { private MarkdownWidget markdownWidget; private Object3DControlsLayer controlLayer; @@ -103,7 +103,10 @@ namespace MatterHackers.MatterControl.DesignTools LocalPosition = value.Transform(this.WorldMatrix().Inverted); } } - + + public bool DoEditorDraw(bool isSelected) => true; + + [HideFromEditor] public Vector3 LocalPosition { get; set; } @@ -239,7 +242,9 @@ namespace MatterHackers.MatterControl.DesignTools } } - public void DrawEditor(Object3DControlsLayer controlLayer, List transparentMeshes, DrawEventArgs e) + public void AddEditorTransparents(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) { } + + public void DrawEditor(Object3DControlsLayer controlLayer, DrawEventArgs e) { EnsureTracedPositionControl(controlLayer); diff --git a/MatterControlLib/DesignTools/Primitives/MeasureToolObject3D.cs b/MatterControlLib/DesignTools/Primitives/MeasureToolObject3D.cs index 3c5ce43f0..f01f30492 100644 --- a/MatterControlLib/DesignTools/Primitives/MeasureToolObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/MeasureToolObject3D.cs @@ -49,7 +49,7 @@ namespace MatterHackers.MatterControl.DesignTools { [MarkDownDescription("Drag the spheres to the locations you would like to measure the distance between. The object on the bed will not print.")] [HideMeterialAndColor] - public class MeasureToolObject3D : Object3D, IObject3DControlsProvider, IAlwaysEditorDraw, IEditorButtonProvider + public class MeasureToolObject3D : Object3D, IObject3DControlsProvider, ICustomEditorDraw, IEditorButtonProvider { private static Mesh shape = null; private List editorControls = null; @@ -80,6 +80,8 @@ namespace MatterHackers.MatterControl.DesignTools return item; } + public bool DoEditorDraw(bool isSelected) => true; + [HideFromEditor] private Vector3 worldStartPosition { @@ -226,7 +228,9 @@ namespace MatterHackers.MatterControl.DesignTools return Task.CompletedTask; } - public void DrawEditor(Object3DControlsLayer controlLayer, List transparentMeshes, DrawEventArgs e) + public void AddEditorTransparents(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) { } + + public void DrawEditor(Object3DControlsLayer controlLayer, DrawEventArgs e) { if (!PositionsHaveBeenSet) { diff --git a/MatterControlLib/DesignTools/Primitives/SetTemperatureObject3D.cs b/MatterControlLib/DesignTools/Primitives/SetTemperatureObject3D.cs index 69c68148f..ae483634d 100644 --- a/MatterControlLib/DesignTools/Primitives/SetTemperatureObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/SetTemperatureObject3D.cs @@ -42,7 +42,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools { - public class SetTemperatureObject3D : Object3D, IObject3DControlsProvider, IGCodeTransformer, ISelectedEditorDraw + public class SetTemperatureObject3D : Object3D, IObject3DControlsProvider, IGCodeTransformer, IEditorDraw { private bool hasBeenReached; private double accumulatedLayerHeight; @@ -136,7 +136,7 @@ namespace MatterHackers.MatterControl.DesignTools accumulatedLayerHeight = 0; } - public void DrawEditor(Object3DControlsLayer object3DControlLayer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer object3DControlLayer, DrawEventArgs e) { if (displayInfo.temp == double.MinValue || displayInfo.temp != Temperature diff --git a/MatterControlLib/DesignTools/Primitives/TextPathObject3D.cs b/MatterControlLib/DesignTools/Primitives/TextPathObject3D.cs index bcf9eede6..f77bd4fbf 100644 --- a/MatterControlLib/DesignTools/Primitives/TextPathObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/TextPathObject3D.cs @@ -47,7 +47,7 @@ using Newtonsoft.Json.Converters; namespace MatterHackers.MatterControl.DesignTools { - public class TextPathObject3D : Object3D, IPathObject, ISelectedEditorDraw + public class TextPathObject3D : Object3D, IPathObject, IEditorDraw { public TextPathObject3D() { @@ -193,7 +193,7 @@ namespace MatterHackers.MatterControl.DesignTools return null; } - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { this.DrawPath(); } diff --git a/MatterControlLib/DesignTools/PublicPropertyEditor.cs b/MatterControlLib/DesignTools/PublicPropertyEditor.cs index 7b6cefb89..164f0c848 100644 --- a/MatterControlLib/DesignTools/PublicPropertyEditor.cs +++ b/MatterControlLib/DesignTools/PublicPropertyEditor.cs @@ -585,7 +585,9 @@ namespace MatterHackers.MatterControl.DesignTools if (property.Item is OperationSourceContainerObject3D sourceContainer) { Action selected = null; - if (!(localItem.GetType().GetCustomAttributes(typeof(ShowUpdateButtonAttribute), true).FirstOrDefault() is ShowUpdateButtonAttribute showUpdate)) + var showUpdate = localItem.GetType().GetCustomAttributes(typeof(ShowUpdateButtonAttribute), true).FirstOrDefault() as ShowUpdateButtonAttribute; + if (showUpdate == null + || !showUpdate.SuppressPropertyChangeUpdates) { selected = () => { diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs index e5b32e0bf..9e3b1f12d 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs @@ -43,6 +43,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { + [ShowUpdateButton(false)] public class CombineObject3D_2 : OperationSourceContainerObject3D, IPropertyGridModifier { public CombineObject3D_2() diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/IntersectionObject3D_2.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/IntersectionObject3D_2.cs index a6abc41ea..c8adc6a97 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/IntersectionObject3D_2.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/IntersectionObject3D_2.cs @@ -42,6 +42,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { + [ShowUpdateButton(false)] public class IntersectionObject3D_2 : OperationSourceContainerObject3D, IPropertyGridModifier { public IntersectionObject3D_2() @@ -124,6 +125,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D } var items = participants.Select(i => (i.Mesh, i.WorldMatrix(SourceContainer))); +#if false var resultsMesh = BooleanProcessing.DoArray(items, BooleanProcessing.CsgModes.Intersect, Processing, @@ -131,6 +133,51 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D OutputResolution, reporter, cancellationToken); +#else + var totalOperations = items.Count() - 1; + double amountPerOperation = 1.0 / totalOperations; + double percentCompleted = 0; + + var progressStatus = new ProgressStatus(); + + var resultsMesh = items.First().Item1; + var keepWorldMatrix = items.First().Item2; + + bool first = true; + foreach (var next in items) + { + if (first) + { + first = false; + continue; + } + + resultsMesh = BooleanProcessing.Do(resultsMesh, + keepWorldMatrix, + // other mesh + next.Item1, + next.Item2, + // operation type + BooleanProcessing.CsgModes.Intersect, + Processing, + InputResolution, + OutputResolution, + // reporting + reporter, + amountPerOperation, + percentCompleted, + progressStatus, + cancellationToken); + + // after the first time we get a result the results mesh is in the right coordinate space + keepWorldMatrix = Matrix4X4.Identity; + + // report our progress + percentCompleted += amountPerOperation; + progressStatus.Progress0To1 = percentCompleted; + reporter?.Report(progressStatus); + } +#endif if (resultsMesh != null) { diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D.cs index 0e14d183f..44d5fcb9e 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D.cs @@ -48,7 +48,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { [Obsolete("Use SubtractAndReplaceObject3D_2 instead", false)] - [ShowUpdateButton] + [ShowUpdateButton(true)] public class SubtractAndReplaceObject3D : MeshWrapperObject3D, ISelectableChildContainer { public SubtractAndReplaceObject3D() diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D_2.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D_2.cs index 6b241436f..31971a59a 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D_2.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D_2.cs @@ -45,14 +45,19 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { - [ShowUpdateButton] - public class SubtractAndReplaceObject3D_2 : OperationSourceContainerObject3D, ISelectableChildContainer, ISelectedEditorDraw, IPropertyGridModifier + [ShowUpdateButton(false)] + public class SubtractAndReplaceObject3D_2 : OperationSourceContainerObject3D, ISelectableChildContainer, ICustomEditorDraw, IPropertyGridModifier { public SubtractAndReplaceObject3D_2() { Name = "Subtract and Replace"; } + public bool DoEditorDraw(bool isSelected) + { + return isSelected; + } + [HideFromEditor] public SelectedChildren ComputedChildren { get; set; } = new SelectedChildren(); @@ -77,91 +82,32 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D private BooleanProcessing.ProcessingResolution InputResolution { get; set; } = BooleanProcessing.ProcessingResolution._64; #endif - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void AddEditorTransparents(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) { - var parentOfSourceItems = this.SourceContainer.DescendantsAndSelfMultipleChildrenFirstOrSelf(); - - var sourceItems = parentOfSourceItems.Children.ToList(); - - foreach (var paintItem in sourceItems) + if (layer.Scene.SelectedItem != null + && layer.Scene.SelectedItem == this) { - var paintItemResults = this.Children.Where(i => i.OwnerID == paintItem.ID); - var wasSelected = ComputedChildren.Contains(paintItem.ID); - var currentlySelected = SelectedChildren.Contains(paintItem.ID); + var parentOfSubtractTargets = this.SourceContainer.DescendantsAndSelfMultipleChildrenFirstOrSelf(); - if (currentlySelected) - { - // if this is selected always paint a transparent source - foreach (var item in paintItem.VisibleMeshes()) - { - transparentMeshes.Add(new Object3DView(item, new Color(item.WorldColor(this.SourceContainer), 80))); - } + var removeObjects = parentOfSubtractTargets.Children + .Where(i => SelectedChildren.Contains(i.ID)) + .SelectMany(c => c.VisibleMeshes()) + .ToList(); - // if it was also selected in before (the results are right) - if (wasSelected) - { - // paint solid results - if (paintItemResults != null) - { - foreach (var paintItemResult in paintItemResults) - { - foreach (var item in paintItemResult.VisibleMeshes()) - { - GLHelper.Render(item.Mesh, - item.WorldColor(), - item.WorldMatrix(), - RenderTypes.Outlines, - item.WorldMatrix() * layer.World.ModelviewMatrix); - } - } - } - } - } - else if (wasSelected) + foreach (var item in removeObjects) { - // it is not selected now but was selected before (changed state) - // pant the solid source - foreach (var item in paintItem.VisibleMeshes()) - { - GLHelper.Render(item.Mesh, - item.WorldColor(), - item.WorldMatrix(), - RenderTypes.Outlines, - item.WorldMatrix() * layer.World.ModelviewMatrix); - } - } - else // it is not selected now and was not before (same state) - { - // paint the results - if (paintItemResults != null && paintItemResults.Count() > 0) - { - foreach (var paintItemResult in paintItemResults) - { - foreach (var item in paintItemResult.VisibleMeshes()) - { - GLHelper.Render(item.Mesh, - item.WorldColor(), - item.WorldMatrix(), - RenderTypes.Outlines, - item.WorldMatrix() * layer.World.ModelviewMatrix); - } - } - } - else // we don't have any results yet - { - foreach (var item in paintItem.VisibleMeshes()) - { - GLHelper.Render(item.Mesh, - item.WorldColor(), - item.WorldMatrix(), - RenderTypes.Outlines, - item.WorldMatrix() * layer.World.ModelviewMatrix); - } - } + var color = item.WorldColor(checkOutputType: true); + transparentMeshes.Add(new Object3DView(item, color.WithAlpha(color.Alpha0To1 * .2))); } + } } + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) + { + return; + } + public override async void OnInvalidate(InvalidateArgs invalidateType) { if ((invalidateType.InvalidateType.HasFlag(InvalidateType.Children) diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D.cs index 8e52dbdda..fca8a11a7 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D.cs @@ -46,7 +46,7 @@ using MatterHackers.PolygonMesh; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { [Obsolete("Use SubtractObject3D_2 instead", false)] - [ShowUpdateButton] + [ShowUpdateButton(true)] public class SubtractObject3D : MeshWrapperObject3D, ISelectableChildContainer { public SubtractObject3D() diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D_2.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D_2.cs index e5f8ab97e..aa12a76e5 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D_2.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D_2.cs @@ -45,8 +45,8 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { - [ShowUpdateButton] - public class SubtractObject3D_2 : OperationSourceContainerObject3D, ISelectableChildContainer, ISelectedEditorDraw, IPropertyGridModifier + [ShowUpdateButton(false)] + public class SubtractObject3D_2 : OperationSourceContainerObject3D, ISelectableChildContainer, ICustomEditorDraw, IPropertyGridModifier { public SubtractObject3D_2() { @@ -76,7 +76,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D public bool RemoveSubtractObjects { get; set; } = true; - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public bool DoEditorDraw(bool isSelected) + { + return isSelected; + } + + public void AddEditorTransparents(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) { if (layer.Scene.SelectedItem != null && layer.Scene.SelectedItem == this) @@ -90,32 +95,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D foreach (var item in removeObjects) { - transparentMeshes.Add(new Object3DView(item, new Color(item.WorldColor(this.SourceContainer), 80))); + var color = item.WorldColor(checkOutputType: true); + transparentMeshes.Add(new Object3DView(item, color.WithAlpha(color.Alpha0To1 * .2))); } - var keepItems = parentOfSubtractTargets.Children - .Where(i => !SelectedChildren.Contains(i.ID)) - .ToList(); - - foreach (var keepItem in keepItems) - { - var drawItem = keepItem; - - var keepItemResult = this.Children.Where(i => i.OwnerID == keepItem.ID).FirstOrDefault(); - drawItem = keepItemResult != null ? keepItemResult : drawItem; - - foreach (var item in drawItem.VisibleMeshes()) - { - GLHelper.Render(item.Mesh, - item.WorldColor(), - item.WorldMatrix(), - RenderTypes.Outlines, - item.WorldMatrix() * layer.World.ModelviewMatrix); - } - } } } + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) + { + return; + } + public override async void OnInvalidate(InvalidateArgs invalidateArgs) { if ((invalidateArgs.InvalidateType.HasFlag(InvalidateType.Children) diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractPathObject3D.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractPathObject3D.cs index 6bb582438..e8921d0cd 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractPathObject3D.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractPathObject3D.cs @@ -46,7 +46,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { - public class SubtractPathObject3D : OperationSourceContainerObject3D, IPathObject, ISelectedEditorDraw, IObject3DControlsProvider + public class SubtractPathObject3D : OperationSourceContainerObject3D, IPathObject, IEditorDraw, IObject3DControlsProvider { public SubtractPathObject3D() { @@ -58,7 +58,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D public IVertexSource VertexSource { get; set; } = new VertexStorage(); - public void DrawEditor(Object3DControlsLayer layer, List transparentMeshes, DrawEventArgs e) + public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e) { this.DrawPath(); } diff --git a/MatterControlLib/PartPreviewWindow/View3D/Object3DControlsLayer.cs b/MatterControlLib/PartPreviewWindow/View3D/Object3DControlsLayer.cs index 327ee1fb5..0f757f35f 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Object3DControlsLayer.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Object3DControlsLayer.cs @@ -897,15 +897,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow private Color GetItemColor(IObject3D item, IObject3D selectedItem) { - Color drawColor = item.WorldColor(); - if (item.WorldOutputType() == PrintOutputTypes.Support) - { - drawColor = new Color(Color.Yellow, 120); - } - else if (item.WorldOutputType() == PrintOutputTypes.WipeTower) - { - drawColor = new Color(Color.Cyan, 120); - } + var drawColor = item.WorldColor(); + var drawColorWithOutputType = item.WorldColor(checkOutputType: true); + if (drawColor != drawColorWithOutputType) + { + // color bering set by output type + drawColor = drawColorWithOutputType; + } else if (sceneContext.ViewState.RenderType == RenderTypes.Materials) { // check if we should be rendering materials (this overrides the other colors) @@ -1079,7 +1077,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow } } - foreach (var item in scene.Descendants().Where(i => i is IAlwaysEditorDraw)) + foreach (var item in scene.Descendants().Where(i => i is ICustomEditorDraw customEditorDraw1 && customEditorDraw1.DoEditorDraw(i == selectedItem))) { editorDrawItems.Add(item); } @@ -1138,6 +1136,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow break; } + // Add transparent draws to the editor + foreach (var item in editorDrawItems) + { + // Invoke existing IEditorDraw when iterating items + if (item is ICustomEditorDraw cutomEditorDraw) + { + cutomEditorDraw.AddEditorTransparents(this, transparentMeshes, e); + } + } + // Draw transparent objects foreach (var item in transparentMeshes) { @@ -1163,9 +1171,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow foreach (var item in editorDrawItems) { // Invoke existing IEditorDraw when iterating items - if (item is ISelectedEditorDraw editorDraw) + if (item is IEditorDraw editorDraw) { - editorDraw.DrawEditor(this, transparentMeshes, e); + editorDraw.DrawEditor(this, e); } } diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index f010c985b..d06b8eb8d 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit f010c985ba1978c5b769fc2f8fe8e0766f79838f +Subproject commit d06b8eb8d323ae2c978299a7d665e13cd6cc3833 diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 628760e12..edc43b496 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 628760e12e9a38dce1d8ae6d8b3a4860dad22320 +Subproject commit edc43b496910736bb4b0925ef6f9d865500ec0c4