Merge pull request #5342 from larsbrubaker/main

Make clearing the solid color also clear the output type
This commit is contained in:
Lars Brubaker 2022-05-30 07:53:02 -07:00 committed by GitHub
commit 039c0a0710
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 6 deletions

View file

@ -302,7 +302,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
if (selectedItem.Color != colorField.Color)
{
undoBuffer.AddAndDo(new ChangeColor(selectedItem, colorField.Color));
if (colorField.Color == Color.Transparent)
{
undoBuffer.AddAndDo(new ChangeColor(selectedItem, colorField.Color, PrintOutputTypes.Default));
}
else
{
undoBuffer.AddAndDo(new ChangeColor(selectedItem, colorField.Color, PrintOutputTypes.Solid));
}
}
};
@ -384,7 +391,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
var currentOutputType = selectedItem.OutputType;
if (currentOutputType != PrintOutputTypes.Solid && currentOutputType != PrintOutputTypes.Default)
{
undoBuffer.AddAndDo(new ChangeColor(selectedItem, colorField.Color));
undoBuffer.AddAndDo(new ChangeColor(selectedItem, colorField.Color, PrintOutputTypes.Solid));
}
SetButtonStates();

View file

@ -41,10 +41,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private List<Color> itemsColor = new List<Color>();
private List<IObject3D> itemsToChange = new List<IObject3D>();
private Color color;
private PrintOutputTypes outputTypeToSet;
public ChangeColor(IObject3D selectedItem, Color color)
public ChangeColor(IObject3D selectedItem, Color color, PrintOutputTypes outputType)
{
this.color = color;
this.outputTypeToSet = outputType;
if (selectedItem is SelectionGroupObject3D)
{
SetData(selectedItem.Children.ToList());
@ -69,7 +71,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
foreach(var item in this.itemsToChange)
{
item.OutputType = PrintOutputTypes.Solid;
item.OutputType = outputTypeToSet;
item.Color = color;
}
}

View file

@ -324,7 +324,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
if (supportObjects.Any())
{
// add a flag to the merge rules to let us know there was support
mergeRules += "S" + AddObjectsForExtruder(supportObjects, holes, outputOptions, ref savedStlCount);
mergeRules += "S" + AddObjectsForExtruder(supportObjects, null, outputOptions, ref savedStlCount);
}
var wipeTowerObjects = meshItemsOnBuildPlate.Where((item) => item.WorldOutputType() == PrintOutputTypes.WipeTower);
@ -639,7 +639,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
}
if (holes.Any())
if (holes?.Any() == true)
{
bool firstHole = true;