Merge pull request #5300 from larsbrubaker/main

main
This commit is contained in:
Lars Brubaker 2022-04-12 22:08:16 -07:00 committed by GitHub
commit 9c40370cc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 401 additions and 194 deletions

View file

@ -45,40 +45,30 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public enum BedShape
{
Rectangular,
Circular
}
[JsonConverter(typeof(StringEnumConverter))]
public enum LevelingSystem
{
Probe3Points,
Probe7PointRadial,
Probe13PointRadial,
Probe100PointRadial,
Probe3x3Mesh,
Probe5x5Mesh,
Probe10x10Mesh,
ProbeCustom
}
public enum NamedSettingsLayers
{
MHBaseSettings,
OEMSettings,
Quality,
Material,
Scene,
User,
All
}
@ -427,6 +417,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
yield return this.UserLayer;
}
var sceneLayer = this.GetSceneLayer?.Invoke();
if (sceneLayer != null)
{
yield return sceneLayer;
}
if (this.MaterialLayer != null)
{
yield return this.MaterialLayer;
@ -479,7 +475,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public List<PrinterSettingsLayer> MaterialLayers { get; set; } = new List<PrinterSettingsLayer>();
public PrinterSettingsLayer OemLayer { get; set; }
public PrinterSettingsLayer OemLayer { get; set; } = new PrinterSettingsLayer();
[JsonIgnore]
public bool PrinterSelected => OemLayer?.Keys.Count > 0;
@ -506,6 +502,25 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
}
[JsonIgnore]
public IEnumerable<PrinterSettingsLayer> SceneLayerCascade
{
get
{
if (this.SceneLayer != null)
{
yield return this.SceneLayer;
}
if (this.OemLayer != null)
{
yield return this.OemLayer;
}
yield return this.BaseLayer;
}
}
public List<PrinterSettingsLayer> QualityLayers { get; private set; } = new List<PrinterSettingsLayer>();
[JsonIgnore]
@ -546,6 +561,21 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
/// </summary>
public PrinterSettingsLayer UserLayer { get; private set; } = new PrinterSettingsLayer();
[JsonIgnore]
public PrinterSettingsLayer SceneLayer
{
get
{
return GetSceneLayer?.Invoke();
}
}
/// <summary>
/// Scene settings override (this comes from a SliceSettingsObject3D being in the scene
/// </summary>
[JsonIgnore]
public Func<PrinterSettingsLayer> GetSceneLayer;
public static PrinterSettings LoadFile(string printerProfilePath, bool performMigrations = false)
{
if (performMigrations)
@ -891,6 +921,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
return layer[sliceSetting];
}
else if (layer == this.SceneLayer
&& layer.ContainsKey(sliceSetting))
{
return layer[sliceSetting];
}
}
return null;
@ -1002,6 +1037,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
var value = this.ResolveValue(setting);
if (setting == SettingsKey.bed_temperature)
{
value = this.Helpers.ActiveBedTemperature.ToString();
}
if(string.IsNullOrEmpty(value))
{
return inputString;
@ -1327,7 +1367,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
else if (typeof(T) == typeof(BedShape))
{
switch (GetValue(settingsKey))
switch (GetValue(settingsKey, layerCascade))
{
case "rectangular":
return (T)(object)BedShape.Rectangular;
@ -1337,7 +1377,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
default:
#if DEBUG
throw new NotImplementedException("{0} is not a known bed_shape.".FormatWith(GetValue(SettingsKey.bed_shape)));
throw new NotImplementedException("{0} is not a known bed_shape.".FormatWith(GetValue(SettingsKey.bed_shape, layerCascade)));
#else
return (T)(object)BedShape.Rectangular;
#endif
@ -1373,6 +1413,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
case NamedSettingsLayers.Material:
return MaterialLayer?.ContainsKey(sliceSetting) == true;
case NamedSettingsLayers.Scene:
return SceneLayer?.ContainsKey(sliceSetting) == true;
case NamedSettingsLayers.User:
return UserLayer?.ContainsKey(sliceSetting) == true;

View file

@ -553,9 +553,8 @@ namespace MatterHackers.MatterControl
// Returns the authentication dialog from the authentication plugin
public static Func<AuthenticationContext, DialogPage> GetAuthPage;
public SlicePresetsPage EditMaterialPresetsPage { get; set; }
public SlicePresetsPage AcitveSlicePresetsPage { get; set; }
public SlicePresetsPage EditQualityPresetsWindow { get; set; }
public MainViewWidget MainView;

View file

@ -38,6 +38,8 @@ using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.VectorMath;
using Newtonsoft.Json;
using System.Linq;
using MatterHackers.DataConverters3D;
using MatterHackers.MatterControl.DesignTools.Operations;
namespace MatterHackers.MatterControl
{
@ -65,10 +67,26 @@ namespace MatterHackers.MatterControl
return !printingOrPause && !errors.Any(err => err.ErrorLevel == ValidationErrorLevel.Error);
}
private PrinterSettingsLayer GetSceneLayer()
{
var scene = Bed?.Scene;
if (scene != null)
{
if (scene.DescendantsAndSelf().Where(c => c is PartSettingsObject3D).FirstOrDefault() is PartSettingsObject3D partSettingsObject3D)
{
return partSettingsObject3D.Overrides;
}
}
return null;
}
public PrinterConfig(PrinterSettings settings)
{
this.Settings = settings;
settings.GetSceneLayer = GetSceneLayer;
this.Bed = new BedConfig(ApplicationController.Instance.Library.PlatingHistory, this);
this.ViewState = new PrinterViewState();

View file

@ -81,6 +81,7 @@ namespace MatterHackers.MatterControl
// Check to see if current OEM layer matches downloaded OEM layer
{
if (settingsContext.GetValue(SettingsKey.make) != "Other"
&& settingsContext.GetValue(SettingsKey.make) != "Undefined"
&& ProfileManager.GetOemSettingsNeedingUpdate(printer).Any())
{
errors.Add(new ValidationError(ValidationErrors.SettingsUpdateAvailable)

View file

@ -733,6 +733,8 @@ namespace MatterHackers.MatterControl
{
public Color MaterialPreset { get; set; } = Color.Orange;
public Color ScenePreset { get; set; } = Color.Green;
public Color QualityPreset { get; set; } = Color.Yellow;
public Color UserOverride { get; set; } = new Color(68, 95, 220, 150);

View file

@ -100,7 +100,7 @@ namespace MatterHackers.MatterControl
{
return theme.DropList.Open.BackgroundColor;
}
else if (this.mouseInBounds)
else if (this.ContainsFirstUnderMouseRecursive())
{
return theme.DropList.Hovered.BackgroundColor;
}

View file

@ -0,0 +1,136 @@
/*
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 MatterHackers.Agg.Platform;
using MatterHackers.DataConverters3D;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.PolygonMesh;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace MatterHackers.MatterControl.DesignTools.Operations
{
[HideChildrenFromTreeView]
[RequiresPermissions]
[HideMeterialAndColor]
public class PartSettingsObject3D : Object3D, IEditorButtonProvider, IStaticThumbnail
{
public PartSettingsObject3D()
{
Name = "Part Settings".Localize();
}
public PrinterSettingsLayer Overrides { get; set; } = new PrinterSettingsLayer();
public static async Task<PartSettingsObject3D> Create()
{
var item = new PartSettingsObject3D();
await item.Rebuild();
return item;
}
private static object loadLock = new object();
private static IObject3D sliceSettingsObject;
public override Mesh Mesh
{
get
{
if (this.Children.Count == 0)
{
lock (loadLock)
{
if (sliceSettingsObject == null)
{
sliceSettingsObject = MeshContentProvider.LoadMCX(StaticData.Instance.OpenStream(Path.Combine("Stls", "part_settings.mcx")));
}
this.Children.Modify((list) =>
{
list.Clear();
list.Add(sliceSettingsObject.Clone());
});
}
}
return null;
}
set => base.Mesh = value;
}
public override bool Printable => false;
public string ThumbnailName => nameof(PartSettingsObject3D);
public IEnumerable<EditorButtonData> GetEditorButtonsData()
{
if (ApplicationController.Instance.UserHasPermission(this))
{
yield return new EditorButtonData()
{
Action = () =>
{
var settings = new PrinterSettings();
var printer = new PrinterConfig(settings);
// set this after the PrinterConfig is constructed to change it to overrides
settings.GetSceneLayer = () => Overrides;
var presetsContext = new PresetsContext(null, printer.Settings.SceneLayer)
{
LayerType = NamedSettingsLayers.Scene,
};
var editMaterialPresetsPage = new SlicePresetsPage(printer, presetsContext, false);
editMaterialPresetsPage.Closed += (s, e2) =>
{
ApplicationController.Instance.AcitveSlicePresetsPage = null;
var containingPrinter = this.ContainingPrinter();
if (containingPrinter != null)
{
this.Invalidate(InvalidateType.DisplayValues);
ApplicationController.Instance.ReloadSettings(containingPrinter);
// refresh the properties pannel by unselecting and selecting
containingPrinter.Bed.Scene.SelectedItem = null;
containingPrinter.Bed.Scene.SelectedItem = this;
}
};
ApplicationController.Instance.AcitveSlicePresetsPage = editMaterialPresetsPage;
DialogWindow.Show(editMaterialPresetsPage);
},
Name = "Edit".Localize(),
};
}
}
}
}

View file

@ -1,108 +0,0 @@
/*
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 MatterHackers.DataConverters3D;
using MatterHackers.DataConverters3D.UndoCommands;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.SlicerConfiguration;
using System.Linq;
using static MatterHackers.DataConverters3D.Object3DExtensions;
namespace MatterHackers.MatterControl.DesignTools.Operations
{
public class SliceSettingsObject3D : Object3D
{
public SliceSettingsObject3D()
{
Name = "Slice Settings".Localize();
}
public PrinterSettingsLayer Overrides { get; set; }
public void WrapSelectedItemAndSelect(InteractiveScene scene)
{
var items = scene.GetSelectedItems();
var parent = items.First().Parent;
RebuildLocks parentLock = (parent == null) ? null : parent.RebuilLockAll();
var firstChild = new Object3D();
this.Children.Add(firstChild);
// if the items we are replacing are already in a list
if (parent != null)
{
if (scene.UndoBuffer != null)
{
foreach (var item in items)
{
firstChild.Children.Add(item.Clone());
}
var replace = new ReplaceCommand(items, new[] { this });
scene.UndoBuffer.AddAndDo(replace);
}
else
{
parent.Children.Modify(list =>
{
foreach (var item in items)
{
list.Remove(item);
firstChild.Children.Add(item);
}
list.Add(this);
});
}
}
else // just add them
{
firstChild.Children.Modify(list =>
{
list.AddRange(items);
});
}
parentLock?.Dispose();
// and select this
var rootItem = this.Parents().Where(i => scene.Children.Contains(i)).FirstOrDefault();
if (rootItem != null)
{
scene.SelectedItem = rootItem;
}
scene.SelectedItem = this;
this.CancelAllParentBuilding();
parent?.Invalidate(new InvalidateArgs(parent, InvalidateType.Children));
}
}
}

View file

@ -72,7 +72,9 @@ namespace MatterHackers.MatterControl.DesignTools
typeof(SelectedChildren),
typeof(ImageBuffer),
typeof(Histogram),
typeof(List<string>)
typeof(List<string>),
typeof(PrinterSettingsLayer),
};
public const BindingFlags OwnedPropertiesOnly = BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly;
@ -564,6 +566,93 @@ namespace MatterHackers.MatterControl.DesignTools
rowContainer.AddChild(row2);
}
else if (propertyValue is PrinterSettingsLayer printerSettingsLayer)
{
var settingsBackground = new GuiWidget()
{
Name = "Background",
HAnchor = HAnchor.Stretch,
VAnchor = VAnchor.Fit,
Margin = 7,
};
var settingsHolder = settingsBackground.AddChild(new FlowLayoutWidget(FlowDirection.TopToBottom)
{
Name = "Holder",
HAnchor = HAnchor.Stretch,
});
settingsHolder.AddChild(new HorizontalLine(Color.Green)
{
Height = 4 * GuiWidget.DeviceScale
});
var settingsCover = settingsBackground.AddChild(new GuiWidget()
{
Name = "Cover",
HAnchor = HAnchor.Stretch,
BackgroundColor = theme.BackgroundColor.WithAlpha(100),
});
settingsHolder.SizeChanged += (s5, e5) =>
{
settingsCover.Height = settingsHolder.Height;
};
rowContainer = settingsBackground;
var printerProfile = new PrinterSettings();
printerProfile.OemLayer = new PrinterSettingsLayer();
// move all the settings to the oem layer
var layout = new List<(int index, string category, string group, string key)>();
foreach (var kvp in printerSettingsLayer)
{
printerProfile.OemLayer[kvp.Key] = kvp.Value;
layout.Add(SliceSettingsLayouts.GetLayout(kvp.Key));
}
var printer = new PrinterConfig(printerProfile);
var settingsContext = new SettingsContext(printer, null, NamedSettingsLayers.All);
var tabIndex = 0;
var orderedSettings = layout.OrderBy(i => i.index).Select(i => (i.category, i.key));
var lastCategory = "";
foreach ((string category, string key) setting in orderedSettings)
{
if (setting.category == "")
{
continue;
}
if (setting.category != lastCategory)
{
lastCategory = setting.category;
// add a new setting header
settingsHolder.AddChild(new TextWidget(setting.category.Localize() + " " + "Settings".Localize() + ":", 0, 0, bold: true)
{
TextColor = theme.TextColor,
Margin = new BorderDouble(0, 5, 0, 7)
});
}
var settingsData = PrinterSettings.SettingsData[setting.key];
var row = SliceSettingsTabView.CreateItemRow(settingsData, settingsContext, printer, theme, ref tabIndex);
if (row is SliceSettingsRow settingsRow)
{
settingsRow.ArrowDirection = ArrowDirection.Left;
settingsRow.Enabled = true;
}
settingsHolder.AddChild(row);
}
settingsHolder.AddChild(new HorizontalLine(Color.Green)
{
Height = 4 * GuiWidget.DeviceScale
});
}
else if (propertyValue is SelectedChildren childSelector)
{
if (property.PropertyInfo.GetCustomAttributes(true).OfType<ShowAsListAttribute>().FirstOrDefault() is ShowAsListAttribute showAsList)
@ -625,7 +714,7 @@ namespace MatterHackers.MatterControl.DesignTools
{
imageWidget = new ImageWidget(imageBuffer);
}
if (imageDisplayAttribute != null)
{
imageWidget.MaximumSize = new Vector2(imageDisplayAttribute.MaxXSize * GuiWidget.DeviceScale, int.MaxValue);
@ -643,7 +732,7 @@ namespace MatterHackers.MatterControl.DesignTools
{
image = imageObject2.Image;
}
// Show image load error if needed
if (image == null)
{
@ -960,7 +1049,7 @@ namespace MatterHackers.MatterControl.DesignTools
{
rowContainer = NewImageSearchWidget(theme);
}
else if(object3D is AssetObject3D assetObject
else if (object3D is AssetObject3D assetObject
&& property.PropertyInfo.Name == "AssetPath")
{
// This is the AssetPath property of an asset object, add a button to set the AssetPath from a file
@ -1095,7 +1184,7 @@ namespace MatterHackers.MatterControl.DesignTools
rowContainer = CreateSettingsColumn(property, field, fullWidth: true);
}
else
{
{
// create a string editor
var field = new TextField(theme);
field.Initialize(0);

View file

@ -33,26 +33,21 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using MatterHackers.Agg;
using MatterHackers.Agg.Platform;
using MatterHackers.Agg.UI;
using MatterHackers.DataConverters3D;
using MatterHackers.MatterControl.DesignTools.Operations;
using MatterHackers.MatterControl.PartPreviewWindow;
using MatterHackers.PolygonMesh;
using MatterHackers.PolygonMesh.Processors;
using MatterHackers.VectorMath;
using org.mariuszgromada.math.mxparser;
namespace MatterHackers.MatterControl.DesignTools
{
[HideChildrenFromTreeView]
[HideChildrenFromTreeView]
[HideMeterialAndColor]
[WebPageLink("Documentation", "Open", "https://www.matterhackers.com/support/mattercontrol-variable-support")]
[MarkDownDescription("[BETA] - Experimental support for variables and equations with a sheets like interface.")]
public class SheetObject3D : Object3D, IObject3DControlsProvider, IStaticThumbnail
public class SheetObject3D : Object3D, IStaticThumbnail
{
private SheetData _sheetData;
public SheetData SheetData
@ -605,9 +600,5 @@ namespace MatterHackers.MatterControl.DesignTools
return (T)(object)default(T);
}
public void AddObject3DControls(Object3DControlsLayer object3DControlsLayer)
{
}
}
}

View file

@ -36,6 +36,7 @@ using MatterHackers.Agg.Platform;
using MatterHackers.DataConverters3D;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.DesignTools;
using MatterHackers.MatterControl.DesignTools.Operations;
namespace MatterHackers.MatterControl.Library
{

View file

@ -114,7 +114,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
if (layerType == NamedSettingsLayers.Material)
{
if (ApplicationController.Instance.EditMaterialPresetsPage == null)
if (ApplicationController.Instance.AcitveSlicePresetsPage == null)
{
string presetsID = printer.Settings.ActiveMaterialKey;
if (string.IsNullOrEmpty(presetsID))
@ -145,21 +145,21 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
var editMaterialPresetsPage = new SlicePresetsPage(printer, presetsContext, true);
editMaterialPresetsPage.Closed += (s, e2) =>
{
ApplicationController.Instance.EditMaterialPresetsPage = null;
ApplicationController.Instance.AcitveSlicePresetsPage = null;
};
ApplicationController.Instance.EditMaterialPresetsPage = editMaterialPresetsPage;
ApplicationController.Instance.AcitveSlicePresetsPage = editMaterialPresetsPage;
DialogWindow.Show(editMaterialPresetsPage);
}
else
{
ApplicationController.Instance.EditMaterialPresetsPage.DialogWindow.BringToFront();
ApplicationController.Instance.AcitveSlicePresetsPage.DialogWindow.BringToFront();
}
}
if (layerType == NamedSettingsLayers.Quality)
{
if (ApplicationController.Instance.EditQualityPresetsWindow == null)
if (ApplicationController.Instance.AcitveSlicePresetsPage == null)
{
string presetsID = printer.Settings.ActiveQualityKey;
if (string.IsNullOrEmpty(presetsID))
@ -192,15 +192,15 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
var editQualityPresetsWindow = new SlicePresetsPage(printer, presetsContext, false);
editQualityPresetsWindow.Closed += (s, e2) =>
{
ApplicationController.Instance.EditQualityPresetsWindow = null;
ApplicationController.Instance.AcitveSlicePresetsPage = null;
};
ApplicationController.Instance.EditQualityPresetsWindow = editQualityPresetsWindow;
ApplicationController.Instance.AcitveSlicePresetsPage = editQualityPresetsWindow;
DialogWindow.Show(editQualityPresetsWindow);
}
else
{
ApplicationController.Instance.EditQualityPresetsWindow.DialogWindow.BringToFront();
ApplicationController.Instance.AcitveSlicePresetsPage.DialogWindow.BringToFront();
}
}
};

View file

@ -65,44 +65,49 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
contentRow.BackgroundColor = Color.Transparent;
var inlineNameEdit = new InlineStringEdit(presetsContext.PersistenceLayer.Name,
theme,
presetsContext.LayerType.ToString() + " Name",
boldFont: true,
emptyText: "Setting Name".Localize());
inlineNameEdit.ValueChanged += (s, e) =>
{
printer.Settings.SetValue(SettingsKey.layer_name, inlineNameEdit.Text, presetsContext.PersistenceLayer);
};
inlineNameEdit.Closed += (s, e) =>
{
printer.Settings.SetValue(SettingsKey.layer_name, inlineNameEdit.Text, presetsContext.PersistenceLayer);
};
contentRow.AddChild(inlineNameEdit);
var sliceSettingsWidget = CreateSliceSettingsWidget(printer, presetsContext.PersistenceLayer);
contentRow.AddChild(sliceSettingsWidget);
var duplicateButton = theme.CreateDialogButton("Duplicate".Localize());
duplicateButton.Click += (s, e) =>
GuiWidget duplicateButton = null;
if (presetsContext.SetAsActive != null)
{
string sanitizedName = numberMatch.Replace(inlineNameEdit.Text, "").Trim();
string newProfileName = agg_basics.GetNonCollidingName(sanitizedName, new HashSet<string>(presetsContext.PresetLayers.Select(preset => preset.ValueOrDefault(SettingsKey.layer_name))));
var inlineNameEdit = new InlineStringEdit(presetsContext.PersistenceLayer.Name,
theme,
presetsContext.LayerType.ToString() + " Name",
boldFont: true,
emptyText: "Setting Name".Localize());
var clonedLayer = presetsContext.PersistenceLayer.Clone();
clonedLayer.Name = newProfileName;
presetsContext.PresetLayers.Add(clonedLayer);
inlineNameEdit.ValueChanged += (s, e) =>
{
printer.Settings.SetValue(SettingsKey.layer_name, inlineNameEdit.Text, presetsContext.PersistenceLayer);
};
inlineNameEdit.Closed += (s, e) =>
{
printer.Settings.SetValue(SettingsKey.layer_name, inlineNameEdit.Text, presetsContext.PersistenceLayer);
};
contentRow.AddChild(inlineNameEdit);
presetsContext.SetAsActive(clonedLayer.LayerID);
presetsContext.PersistenceLayer = clonedLayer;
duplicateButton = theme.CreateDialogButton("Duplicate".Localize());
duplicateButton.Click += (s, e) =>
{
string sanitizedName = numberMatch.Replace(inlineNameEdit.Text, "").Trim();
string newProfileName = agg_basics.GetNonCollidingName(sanitizedName, new HashSet<string>(presetsContext.PresetLayers.Select(preset => preset.ValueOrDefault(SettingsKey.layer_name))));
sliceSettingsWidget.Close();
sliceSettingsWidget = CreateSliceSettingsWidget(printer, clonedLayer);
contentRow.AddChild(sliceSettingsWidget);
var clonedLayer = presetsContext.PersistenceLayer.Clone();
clonedLayer.Name = newProfileName;
presetsContext.PresetLayers.Add(clonedLayer);
inlineNameEdit.Text = newProfileName;
};
presetsContext.SetAsActive(clonedLayer.LayerID);
presetsContext.PersistenceLayer = clonedLayer;
sliceSettingsWidget.Close();
sliceSettingsWidget = CreateSliceSettingsWidget(printer, clonedLayer);
contentRow.AddChild(sliceSettingsWidget);
inlineNameEdit.Text = newProfileName;
};
}
if (showExport)
{
@ -143,16 +148,22 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
this.AddPageAction(exportButton, false);
}
var deleteButton = theme.CreateDialogButton("Delete".Localize());
deleteButton.Click += (s, e) =>
if (presetsContext.DeleteLayer != null)
{
presetsContext.DeleteLayer();
this.DialogWindow.Close();
};
var deleteButton = theme.CreateDialogButton("Delete".Localize());
deleteButton.Click += (s, e) =>
{
presetsContext.DeleteLayer();
this.DialogWindow.Close();
};
this.AddPageAction(deleteButton, false);
this.AddPageAction(deleteButton, false);
}
this.AddPageAction(duplicateButton, false);
if (duplicateButton != null)
{
this.AddPageAction(duplicateButton, false);
}
AcceptButton = CancelButton;
}

View file

@ -540,6 +540,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
highlightColor = theme.PresetColors.QualityPreset;
showRestoreButton = true;
break;
case NamedSettingsLayers.Scene:
highlightColor = theme.PresetColors.ScenePreset;
showRestoreButton = true;
break;
}
}
else if (settingsContext.IsPrimarySettingsView)
@ -555,6 +559,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
highlightColor = theme.PresetColors.UserOverride;
}
else if (settings.SettingExistsInLayer(key, NamedSettingsLayers.Scene))
{
highlightColor = theme.PresetColors.ScenePreset;
}
else if (settings.SettingExistsInLayer(key, NamedSettingsLayers.Material))
{
highlightColor = theme.PresetColors.MaterialPreset;

View file

@ -244,7 +244,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
foreach (var category in settingsSection.Categories)
{
if (category.Name == "Printer"
&& (settingsContext.ViewFilter == NamedSettingsLayers.Material || settingsContext.ViewFilter == NamedSettingsLayers.Quality))
&& (settingsContext.ViewFilter == NamedSettingsLayers.Material
|| settingsContext.ViewFilter == NamedSettingsLayers.Quality))
{
continue;
}
@ -391,6 +392,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
case NamedSettingsLayers.Quality:
this.FilterToOverrides(printer.Settings.QualityLayerCascade);
break;
case NamedSettingsLayers.Scene:
this.FilterToOverrides(printer.Settings.SceneLayerCascade);
break;
}
};
@ -473,7 +477,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
bool firstRow = true;
GuiWidget settingsRow = null;
var presetsView = settingsContext.ViewFilter == NamedSettingsLayers.Material || settingsContext.ViewFilter == NamedSettingsLayers.Quality;
var presetsView = settingsContext.ViewFilter == NamedSettingsLayers.Material
|| settingsContext.ViewFilter == NamedSettingsLayers.Quality
|| settingsContext.ViewFilter == NamedSettingsLayers.Scene;
var ignoredPresets = new HashSet<string> { SettingsKey.temperature2, SettingsKey.temperature3 };
using (groupPanel.LayoutLock())
@ -527,7 +533,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
private static bool CheckIfShouldBeShown(SliceSettingData settingData, SettingsContext settingsContext)
{
bool settingShouldBeShown = settingData.Show?.Invoke(settingsContext.Printer.Settings) != false;
if (settingsContext.ViewFilter == NamedSettingsLayers.Material || settingsContext.ViewFilter == NamedSettingsLayers.Quality)
if (settingsContext.ViewFilter == NamedSettingsLayers.Material || settingsContext.ViewFilter == NamedSettingsLayers.Quality || NamedSettingsLayers.Scene == settingsContext.ViewFilter)
{
if (!settingData.ShowAsOverride)
{
@ -885,7 +891,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
bool settingEnabled = settingData.Show?.Invoke(settingsContext.Printer.Settings) != false;
if (settingEnabled
|| settingsContext.ViewFilter == NamedSettingsLayers.Material
|| settingsContext.ViewFilter == NamedSettingsLayers.Quality)
|| settingsContext.ViewFilter == NamedSettingsLayers.Quality
|| settingsContext.ViewFilter == NamedSettingsLayers.Scene)
{
if (placeFieldInDedicatedRow)
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

View file

@ -3340,6 +3340,9 @@ Translated:Part Cooling Fan
English:Part Cooling Fan {i}
Translated:Part Cooling Fan {i}
English:Part Settings
Translated:Part Settings
English:Part(s) to Subtract
Translated:Part(s) to Subtract

@ -1 +1 @@
Subproject commit ad52673251380ee8c1e8910c380118008abed881
Subproject commit e754c81428db89bb94fadac23f026de7579bff8f

@ -1 +1 @@
Subproject commit 5f8b9d518d71c559bca4711611bf92de46a3ffb0
Subproject commit 7ea2bbbf3634ab37698640cc184ac2d2755cffbe

View file

@ -111,6 +111,12 @@ namespace MatterControl.Tests.MatterControl
TestMacroReplacement("{infill_speed}", "3600");
TestMacroReplacement("{min_print_speed}", "600");
TestMacroReplacement("{travel_speed}", "7800");
// make sure we pick up the right temp when there is a bed surface change
settings.SetValue(SettingsKey.has_swappable_bed, "1");
settings.SetValue(SettingsKey.bed_temperature_blue_tape, "84.2");
settings.SetValue(SettingsKey.bed_surface, "Blue Tape");
TestMacroReplacement("[bed_temperature]", "84.2");
}
}
}