diff --git a/MatterControlLib/DesignTools/Operations/Object3DExtensions.cs b/MatterControlLib/DesignTools/Operations/Object3DExtensions.cs
index af339cf20..d80c8d2c4 100644
--- a/MatterControlLib/DesignTools/Operations/Object3DExtensions.cs
+++ b/MatterControlLib/DesignTools/Operations/Object3DExtensions.cs
@@ -380,7 +380,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
///
/// Union a and b together. This can either return a single item with a mesh on it
- /// or a group item that has the a and be items as children
+ /// or a group item that has the a and b items as children
///
///
///
diff --git a/MatterControlLib/PartPreviewWindow/SelectedObjectPanel.cs b/MatterControlLib/PartPreviewWindow/SelectedObjectPanel.cs
index 6b9d8206d..04ebea4ef 100644
--- a/MatterControlLib/PartPreviewWindow/SelectedObjectPanel.cs
+++ b/MatterControlLib/PartPreviewWindow/SelectedObjectPanel.cs
@@ -310,13 +310,29 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
};
- // color row
- var row = new SettingsRow("Color".Localize(), null, colorField.Content, theme);
+ editorPanel.AddChild(new SettingsRow("Color".Localize(), null, colorField.Content, theme)
+ {
+ // Special top border style for first item in editor
+ Border = new BorderDouble(0, 1)
+ });
- // Special top border style for first item in editor
- row.Border = new BorderDouble(0, 1);
+ // put in a hole edit field
+ var holeField = new ToggleboxField(theme);
+ holeField.Initialize(0);
+ holeField.Checked = selectedItem.WorldOutputType() == PrintOutputTypes.Hole;
+ holeField.ValueChanged += (s, e) =>
+ {
+ if (selectedItem.OutputType == PrintOutputTypes.Hole)
+ {
+ undoBuffer.AddAndDo(new ChangeColor(selectedItem, colorField.Color));
+ }
+ else
+ {
+ undoBuffer.AddAndDo(new MakeHole(selectedItem));
+ }
+ };
- editorPanel.AddChild(row);
+ editorPanel.AddChild(new SettingsRow("Hole".Localize(), null, holeField.Content, theme));
// put in a material edit field
var materialField = new MaterialIndexField(sceneContext.Printer, theme, selectedItem.MaterialIndex);
@@ -339,8 +355,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
// material row
- editorPanel.AddChild(
- new SettingsRow("Material".Localize(), null, materialField.Content, theme));
+ editorPanel.AddChild(new SettingsRow("Material".Localize(), null, materialField.Content, theme));
}
var rows = new SafeList();
diff --git a/MatterControlLib/PartPreviewWindow/View3D/Object3DControlsLayer.cs b/MatterControlLib/PartPreviewWindow/View3D/Object3DControlsLayer.cs
index 836833144..6211acc2a 100644
--- a/MatterControlLib/PartPreviewWindow/View3D/Object3DControlsLayer.cs
+++ b/MatterControlLib/PartPreviewWindow/View3D/Object3DControlsLayer.cs
@@ -92,17 +92,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
floorDrawable = new FloorDrawable(editorType, sceneContext, this.BuildVolumeColor, theme);
- if (viewOnlyTexture == null)
+ if (stripeTexture == null)
{
- // TODO: What is the ViewOnlyTexture???
+ // open gl can only be run on the ui thread so make sure it is on it by using RunOnIdle
UiThread.RunOnIdle(() =>
{
- viewOnlyTexture = new ImageBuffer(32, 32, 32);
- var graphics2D = viewOnlyTexture.NewGraphics2D();
+ stripeTexture = new ImageBuffer(32, 32, 32);
+ var graphics2D = stripeTexture.NewGraphics2D();
graphics2D.Clear(Color.White);
- graphics2D.FillRectangle(0, 0, viewOnlyTexture.Width / 2, viewOnlyTexture.Height, Color.LightGray);
+ graphics2D.FillRectangle(0, 0, stripeTexture.Width / 2, stripeTexture.Height, Color.LightGray);
// request the texture so we can set it to repeat
- ImageGlPlugin.GetImageGlPlugin(viewOnlyTexture, true, true, false);
+ ImageGlPlugin.GetImageGlPlugin(stripeTexture, true, true, false);
});
}
@@ -329,7 +329,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
foreach (var bvhIterator in allResults)
{
- Object3DControlsLayer.RenderBounds(e, world, bvhIterator.TransformToWorld, bvhIterator.Bvh, bvhIterator.Depth);
+ RenderBounds(e, world, bvhIterator.TransformToWorld, bvhIterator.Bvh, bvhIterator.Depth);
}
}
@@ -635,7 +635,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public GuiWidget GuiSurface => this;
- private static ImageBuffer viewOnlyTexture;
+ private static ImageBuffer stripeTexture;
private Color lightWireframe = new Color("#aaa4");
private Color darkWireframe = new Color("#3334");
@@ -807,8 +807,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
foreach (var item in object3D.VisibleMeshes())
{
- // check for correct protection rendering
- ValidateViewOnlyTexturing(item);
+ // check if the object should have a stripe texture
+ ValidateStripeTexturing(item);
Color drawColor = this.GetItemColor(item, selectedItem);
@@ -849,12 +849,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
- private static void ValidateViewOnlyTexturing(IObject3D item)
+ private static void ValidateStripeTexturing(IObject3D item)
{
- // if there is no view only texture or the item is locked
- if (Object3DControlsLayer.viewOnlyTexture == null
+ // if there is no stripe texture built or the item is locked
+ if (stripeTexture == null
|| item.Mesh.Faces.Count == 0)
{
+ // exit and wait for a later time
return;
}
@@ -864,33 +865,35 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
item.Mesh.FaceTextures.TryGetValue(0, out FaceTextureData faceTexture);
bool faceIsTextured = faceTexture?.image != null;
- // if not persistable and has view only texture, remove the view only texture if it has it
- if (item.WorldPersistable()
- && faceIsTextured)
+ // if persistable and has a stripe texture, remove the stripe texture
+ if (faceIsTextured
+ && item.WorldPersistable()
+ && item.WorldOutputType() != PrintOutputTypes.Hole)
{
- // make sure it does not have the view only texture
+ // make sure it does not have a stripe texture
using (item.RebuildLock())
{
- item.Mesh.RemoveTexture(Object3DControlsLayer.viewOnlyTexture, 0);
+ item.Mesh.RemoveTexture(stripeTexture, 0);
}
}
- else if (!item.WorldPersistable()
- && !faceIsTextured
- && !item.RebuildLocked)
+ else if (!faceIsTextured
+ && !item.RebuildLocked
+ // and it is protected or a hole
+ && (!item.WorldPersistable() || item.WorldOutputType() == PrintOutputTypes.Hole))
{
- // add a view only texture if it does not have one
- // make a copy of the mesh and texture it
+ // add a stripe texture if it does not have one
Task.Run(() =>
{
- // make sure it does have the view only texture
+ // put on the stripe texture
var aabb = item.Mesh.GetAxisAlignedBoundingBox();
var matrix = Matrix4X4.CreateScale(.5, .5, 1);
matrix *= Matrix4X4.CreateRotationZ(MathHelper.Tau / 8);
// make sure it has it's own copy of the mesh
using (item.RebuildLock())
{
+ // we make a copy so that we don't modify the global instance of a mesh
item.Mesh = item.Mesh.Copy(CancellationToken.None);
- item.Mesh.PlaceTexture(Object3DControlsLayer.viewOnlyTexture, matrix);
+ item.Mesh.PlaceTexture(stripeTexture, matrix);
}
});
}
@@ -1167,7 +1170,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
RenderTypes.Outlines,
object3D.WorldMatrix() * World.ModelviewMatrix,
wireColor,
- allowBspRendering: transparentMeshes.Count < 1000);
+ allowBspRendering: transparentMeshes.Count < 1000,
+ forceCullBackFaces: false);
}
if (!lookingDownOnBed)
diff --git a/MatterControlLib/PartPreviewWindow/View3D/UndoCommands/ChangeColor.cs b/MatterControlLib/PartPreviewWindow/View3D/UndoCommands/ChangeColor.cs
index b9344e575..09547b1f2 100644
--- a/MatterControlLib/PartPreviewWindow/View3D/UndoCommands/ChangeColor.cs
+++ b/MatterControlLib/PartPreviewWindow/View3D/UndoCommands/ChangeColor.cs
@@ -35,7 +35,7 @@ using MatterHackers.DataConverters3D;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
- public class ChangeColor : IUndoRedoCommand
+ public class ChangeColor : IUndoRedoCommand
{
private List itemsPrintOutputType = new List();
private List itemsColor = new List();
diff --git a/MatterControlLib/PartPreviewWindow/View3D/UndoCommands/MakeHole.cs b/MatterControlLib/PartPreviewWindow/View3D/UndoCommands/MakeHole.cs
new file mode 100644
index 000000000..a2937f75c
--- /dev/null
+++ b/MatterControlLib/PartPreviewWindow/View3D/UndoCommands/MakeHole.cs
@@ -0,0 +1,79 @@
+/*
+Copyright (c) 2022, 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.Collections.Generic;
+using System.Linq;
+using MatterHackers.Agg.UI;
+using MatterHackers.DataConverters3D;
+
+namespace MatterHackers.MatterControl.PartPreviewWindow
+{
+ public class MakeHole : IUndoRedoCommand
+ {
+ private List itemsPrintOutputType = new List();
+ private List itemsToChange = new List();
+
+ public MakeHole(IObject3D selectedItem)
+ {
+ if (selectedItem is SelectionGroupObject3D)
+ {
+ SetData(selectedItem.Children.ToList());
+ }
+ else
+ {
+ SetData(new List { selectedItem });
+ }
+ }
+
+ void SetData(List itemsToChange)
+ {
+ foreach (var item in itemsToChange)
+ {
+ this.itemsToChange.Add(item);
+ this.itemsPrintOutputType.Add(item.OutputType);
+ }
+ }
+
+ void IUndoRedoCommand.Do()
+ {
+ foreach (var item in this.itemsToChange)
+ {
+ item.OutputType = PrintOutputTypes.Hole;
+ }
+ }
+
+ void IUndoRedoCommand.Undo()
+ {
+ for (int i = 0; i < this.itemsToChange.Count; i++)
+ {
+ itemsToChange[i].OutputType = itemsPrintOutputType[i];
+ }
+ }
+ }
+}
diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt
index ee244daed..11b153341 100644
--- a/StaticData/Translations/Master.txt
+++ b/StaticData/Translations/Master.txt
@@ -2155,6 +2155,9 @@ Translated:Hold 'Shift' to scale proportionally, Type 'Esc' to cancel
English:Holding Temperature
Translated:Holding Temperature
+English:Hole
+Translated:Hole
+
English:Hollow
Translated:Hollow
diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice
index e754c8142..bc96dac61 160000
--- a/Submodules/MatterSlice
+++ b/Submodules/MatterSlice
@@ -1 +1 @@
-Subproject commit e754c81428db89bb94fadac23f026de7579bff8f
+Subproject commit bc96dac612a6cb3bff321b96657d5cdaef5b28d6
diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp
index 303fb1cf3..a1708b040 160000
--- a/Submodules/agg-sharp
+++ b/Submodules/agg-sharp
@@ -1 +1 @@
-Subproject commit 303fb1cf3baada642aaa46eb4d2e9fd546045bf7
+Subproject commit a1708b04012fe859f1e42cabd8a23234f7912ef7