From cf5931d2722843cfd209ac49ec26539fa1516085 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Thu, 28 Apr 2022 13:19:48 -0700 Subject: [PATCH] Improving ShowUpdateButton api --- .../DesignTools/Attributes/ShowUpdateButtonAttribute.cs | 6 +++--- MatterControlLib/DesignTools/LithophaneObject3D.cs | 2 +- MatterControlLib/DesignTools/PublicPropertyEditor.cs | 3 ++- .../PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs | 2 +- .../View3D/Actions/IntersectionObject3D_2.cs | 2 +- .../View3D/Actions/SubtractAndReplaceObject3D.cs | 2 +- .../View3D/Actions/SubtractAndReplaceObject3D_2.cs | 2 +- .../PartPreviewWindow/View3D/Actions/SubtractObject3D.cs | 2 +- .../PartPreviewWindow/View3D/Actions/SubtractObject3D_2.cs | 2 +- Submodules/MatterSlice | 2 +- 10 files changed, 13 insertions(+), 12 deletions(-) diff --git a/MatterControlLib/DesignTools/Attributes/ShowUpdateButtonAttribute.cs b/MatterControlLib/DesignTools/Attributes/ShowUpdateButtonAttribute.cs index 4ee3362db..677480ff8 100644 --- a/MatterControlLib/DesignTools/Attributes/ShowUpdateButtonAttribute.cs +++ b/MatterControlLib/DesignTools/Attributes/ShowUpdateButtonAttribute.cs @@ -34,11 +34,11 @@ namespace MatterHackers.MatterControl.DesignTools [AttributeUsage(AttributeTargets.Class)] public class ShowUpdateButtonAttribute : Attribute { - public bool SuppressPropertyChangeUpdates { get; set; } + public bool Show { get; set; } = true; + public bool SuppressPropertyChangeUpdates { get; set; } - public ShowUpdateButtonAttribute(bool suppressPropertyChangeUpdates) + public ShowUpdateButtonAttribute() { - SuppressPropertyChangeUpdates = suppressPropertyChangeUpdates; } } } \ No newline at end of file diff --git a/MatterControlLib/DesignTools/LithophaneObject3D.cs b/MatterControlLib/DesignTools/LithophaneObject3D.cs index dab12d8d1..31d6b1571 100644 --- a/MatterControlLib/DesignTools/LithophaneObject3D.cs +++ b/MatterControlLib/DesignTools/LithophaneObject3D.cs @@ -44,7 +44,7 @@ using Newtonsoft.Json; namespace MatterHackers.MatterControl.Plugins.Lithophane { - [ShowUpdateButton(true)] + [ShowUpdateButton(SuppressPropertyChangeUpdates = true)] public class LithophaneObject3D : Object3D { public LithophaneObject3D() diff --git a/MatterControlLib/DesignTools/PublicPropertyEditor.cs b/MatterControlLib/DesignTools/PublicPropertyEditor.cs index a06e218ce..96755e9e9 100644 --- a/MatterControlLib/DesignTools/PublicPropertyEditor.cs +++ b/MatterControlLib/DesignTools/PublicPropertyEditor.cs @@ -159,7 +159,8 @@ namespace MatterHackers.MatterControl.DesignTools AddWebPageLinkIfRequired(context.item, mainContainer, theme); // add in an Update button if applicable - if (context.item.GetType().GetCustomAttributes(typeof(ShowUpdateButtonAttribute), true).FirstOrDefault() is ShowUpdateButtonAttribute showUpdate) + var showUpdate = context.item.GetType().GetCustomAttributes(typeof(ShowUpdateButtonAttribute), true).FirstOrDefault() as ShowUpdateButtonAttribute; + if (showUpdate?.Show == true) { var updateButton = new TextButton("Update".Localize(), theme) { diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs index b8b264048..e10af18a0 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs @@ -44,7 +44,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { - [ShowUpdateButton(false)] + [ShowUpdateButton] public class CombineObject3D_2 : OperationSourceContainerObject3D, IPropertyGridModifier, IBuildsOnThread { private CancellationTokenSource cancellationToken; diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/IntersectionObject3D_2.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/IntersectionObject3D_2.cs index 24fa8bad2..5c0e3f2ea 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/IntersectionObject3D_2.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/IntersectionObject3D_2.cs @@ -42,7 +42,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { - [ShowUpdateButton(false)] + [ShowUpdateButton] public class IntersectionObject3D_2 : OperationSourceContainerObject3D, IPropertyGridModifier { public IntersectionObject3D_2() diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D.cs index 57ebc46ee..4c1ee578d 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D.cs @@ -49,7 +49,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { [Obsolete("Use SubtractAndReplaceObject3D_2 instead", false)] - [ShowUpdateButton(true)] + [ShowUpdateButton(SuppressPropertyChangeUpdates = 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 bde7577b9..49451015e 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D_2.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractAndReplaceObject3D_2.cs @@ -45,7 +45,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { - [ShowUpdateButton(false)] + [ShowUpdateButton] public class SubtractAndReplaceObject3D_2 : OperationSourceContainerObject3D, ISelectableChildContainer, ICustomEditorDraw, IPropertyGridModifier { public SubtractAndReplaceObject3D_2() diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D.cs index f49eb232d..6b95c7935 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D.cs @@ -47,7 +47,7 @@ using MatterHackers.PolygonMesh.Csg; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { [Obsolete("Use SubtractObject3D_2 instead", false)] - [ShowUpdateButton(true)] + [ShowUpdateButton(SuppressPropertyChangeUpdates = 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 22135eb91..01b7aab02 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D_2.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D_2.cs @@ -44,7 +44,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.PartPreviewWindow.View3D { - [ShowUpdateButton(false)] + [ShowUpdateButton] public class SubtractObject3D_2 : OperationSourceContainerObject3D, ISelectableChildContainer, ICustomEditorDraw, IPropertyGridModifier, IBuildsOnThread { public SubtractObject3D_2() diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index 9578a32e7..d318d70f3 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit 9578a32e7032236c2ff7fc1a588c6d099eec333d +Subproject commit d318d70f3f2772d1b987a63291a1860c7dfc04f9