diff --git a/MatterControlLib/DesignTools/Primitives/ComponentObject3D.cs b/MatterControlLib/DesignTools/Primitives/ComponentObject3D.cs index 551d4f5d1..05d861312 100644 --- a/MatterControlLib/DesignTools/Primitives/ComponentObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/ComponentObject3D.cs @@ -58,7 +58,24 @@ namespace MatterHackers.MatterControl.DesignTools public override bool Persistable => ApplicationController.Instance.UserHasPermission(this); - public bool Finalized { get; set; } = true; + private bool _finalizade = true; + public bool Finalized + { + get => _finalizade; + + set + { + _finalizade = value; + // on any invalidate ensure that the visibility setting are correct for embedded sheet objects + foreach (var child in this.Descendants()) + { + if (child is SheetObject3D) + { + child.Visible = !this.Finalized; + } + } + } + } public List SurfacedEditors { get; set; } = new List(); diff --git a/MatterControlLib/DesignTools/PublicPropertyEditor.cs b/MatterControlLib/DesignTools/PublicPropertyEditor.cs index 459ccaf95..7b6cefb89 100644 --- a/MatterControlLib/DesignTools/PublicPropertyEditor.cs +++ b/MatterControlLib/DesignTools/PublicPropertyEditor.cs @@ -153,7 +153,7 @@ namespace MatterHackers.MatterControl.DesignTools } } - AddWebPageLinkIfRequired(context, mainContainer, theme); + AddWebPageLinkIfRequired(context.item, mainContainer, theme); // add in an Update button if applicable if (context.item.GetType().GetCustomAttributes(typeof(ShowUpdateButtonAttribute), true).FirstOrDefault() is ShowUpdateButtonAttribute showUpdate) @@ -1463,9 +1463,9 @@ namespace MatterHackers.MatterControl.DesignTools return new SettingsRow("Demo Mode".Localize(), null, detailsLink, theme); } - private void AddWebPageLinkIfRequired(PPEContext context, FlowLayoutWidget editControlsContainer, ThemeConfig theme) + public static void AddWebPageLinkIfRequired(IObject3D item, FlowLayoutWidget editControlsContainer, ThemeConfig theme) { - if (context.item.GetType().GetCustomAttributes(typeof(WebPageLinkAttribute), true).FirstOrDefault() is WebPageLinkAttribute unlockLink) + if (item.GetType().GetCustomAttributes(typeof(WebPageLinkAttribute), true).FirstOrDefault() is WebPageLinkAttribute unlockLink) { var detailsLink = new TextIconButton(unlockLink.ButtonName.Localize(), StaticData.Instance.LoadIcon("internet.png", 16, 16).SetToColor(theme.TextColor), theme) { diff --git a/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs b/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs index 706cff68c..50e08767d 100644 --- a/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs +++ b/MatterControlLib/DesignTools/Sheets/SheetObject3D.cs @@ -50,7 +50,7 @@ namespace MatterHackers.MatterControl.DesignTools { [HideChildrenFromTreeView] [HideMeterialAndColor] - [WebPageLink("Documentation", "Open", "https://matterhackers.com/support/mattercontrol-variable-support")] + [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 { diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/SheetEditor.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/SheetEditor.cs index 33615dad8..8cff1a2d7 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/SheetEditor.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/SheetEditor.cs @@ -48,7 +48,7 @@ namespace MatterHackers.MatterControl.DesignTools public MHTextEditWidget EditSelectedExpression { get; private set; } private GridWidget gridWidget; - public SheetEditorWidget(SheetData sheetData, UndoBuffer undoBuffer, ThemeConfig theme) + public SheetEditorWidget(SheetData sheetData, SheetObject3D sheetObject, UndoBuffer undoBuffer, ThemeConfig theme) : base(FlowDirection.TopToBottom) { this.theme = theme; @@ -125,6 +125,11 @@ namespace MatterHackers.MatterControl.DesignTools gridWidget.ExpandToFitContent(); } + + if (sheetObject != null) + { + PublicPropertyEditor.AddWebPageLinkIfRequired(sheetObject, this, theme); + } } private void ActualTextEditWidget_EditComplete1(object sender, EventArgs e) @@ -225,7 +230,7 @@ namespace MatterHackers.MatterControl.DesignTools { if (item is SheetObject3D sheetObject) { - return new SheetEditorWidget(sheetObject.SheetData, undoBuffer, theme); + return new SheetEditorWidget(sheetObject.SheetData, sheetObject, undoBuffer, theme); } return null; diff --git a/Tests/MatterControl.AutomationTests/DesignTools/SheetTests.cs b/Tests/MatterControl.AutomationTests/DesignTools/SheetTests.cs index 617dd5340..ab4336e9c 100644 --- a/Tests/MatterControl.AutomationTests/DesignTools/SheetTests.cs +++ b/Tests/MatterControl.AutomationTests/DesignTools/SheetTests.cs @@ -40,7 +40,7 @@ namespace MatterHackers.MatterControl.Tests.Automation var sheetData = new SheetData(5, 5); var undoBuffer = new UndoBuffer(); var theme = ApplicationController.Instance.Theme; - var sheetEditor = new SheetEditorWidget(sheetData, undoBuffer, theme); + var sheetEditor = new SheetEditorWidget(sheetData, null, undoBuffer, theme); systemWindow.AddChild(sheetEditor); @@ -187,7 +187,7 @@ namespace MatterHackers.MatterControl.Tests.Automation var sheetData = new SheetData(5, 5); var undoBuffer = new UndoBuffer(); - var sheetEditorWidget = new SheetEditorWidget(sheetData, undoBuffer, theme); + var sheetEditorWidget = new SheetEditorWidget(sheetData, null, undoBuffer, theme); container.AddChild(sheetEditorWidget);