diff --git a/MatterControlLib/ApplicationView/ApplicationController.cs b/MatterControlLib/ApplicationView/ApplicationController.cs index 59d46223e..3f01a613b 100644 --- a/MatterControlLib/ApplicationView/ApplicationController.cs +++ b/MatterControlLib/ApplicationView/ApplicationController.cs @@ -423,7 +423,17 @@ namespace MatterHackers.MatterControl { TitleResolver = () => "Ungroup".Localize(), Action = (scene) => scene.UngroupSelection(), - IsEnabled = (scene) => scene.SelectedItem != null, + IsEnabled = (scene) => + { + var selectedItem = scene.SelectedItem; + if(selectedItem != null) + { + var hasSingleMesh = selectedItem.Mesh != null && selectedItem.Children.Count == 0; + return hasSingleMesh || selectedItem is GroupObject3D; + } + + return false; + }, Icon = AggContext.StaticData.LoadIcon("ungroup.png", 16, 16).SetPreMultiply(), }, new SceneSelectionSeparator(), diff --git a/MatterControlLib/DesignTools/Operations/GroupObject3D.cs b/MatterControlLib/DesignTools/Operations/GroupObject3D.cs index 722e95392..ba3f088b0 100644 --- a/MatterControlLib/DesignTools/Operations/GroupObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/GroupObject3D.cs @@ -34,6 +34,8 @@ namespace MatterHackers.MatterControl.DesignTools.Operations { public class GroupObject3D : Object3D { + public override bool CanApply => true; + public GroupObject3D() { Name = "Group".Localize(); diff --git a/MatterControlLib/DesignTools/Operations/Object3DExtensions.cs b/MatterControlLib/DesignTools/Operations/Object3DExtensions.cs index 347d32ec9..8525e5b6b 100644 --- a/MatterControlLib/DesignTools/Operations/Object3DExtensions.cs +++ b/MatterControlLib/DesignTools/Operations/Object3DExtensions.cs @@ -108,34 +108,6 @@ namespace MatterHackers.MatterControl.DesignTools.Operations } } - public static void CopyProperties(this IObject3D copyTo, IObject3D copyFrom, Object3DPropertyFlags flags) - { - if (flags.HasFlag(Object3DPropertyFlags.Matrix)) - { - copyTo.Matrix = copyFrom.Matrix; - } - if (flags.HasFlag(Object3DPropertyFlags.Color)) - { - copyTo.Color = copyFrom.Color; - } - if (flags.HasFlag(Object3DPropertyFlags.MaterialIndex)) - { - copyTo.MaterialIndex = copyFrom.MaterialIndex; - } - if (flags.HasFlag(Object3DPropertyFlags.Name)) - { - copyTo.Name = copyFrom.Name; - } - if (flags.HasFlag(Object3DPropertyFlags.OutputType)) - { - copyTo.OutputType = copyFrom.OutputType; - } - if (flags.HasFlag(Object3DPropertyFlags.Visible)) - { - copyTo.Visible = copyFrom.Visible; - } - } - public static IObject3D Translate(this IObject3D objectToTranslate, double x = 0, double y = 0, double z = 0, string name = "") { return objectToTranslate.Translate(new Vector3(x, y, z), name); diff --git a/MatterControlLib/DesignTools/Primitives/TextObject3D.cs b/MatterControlLib/DesignTools/Primitives/TextObject3D.cs index 2471c0ce8..ee5ba855e 100644 --- a/MatterControlLib/DesignTools/Primitives/TextObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/TextObject3D.cs @@ -77,7 +77,7 @@ namespace MatterHackers.MatterControl.DesignTools public override void Apply(UndoBuffer undoBuffer) { // change this from a text object to a group - var newContainer = new Object3D(); + var newContainer = new GroupObject3D(); newContainer.CopyProperties(this, Object3DPropertyFlags.All); foreach (var child in this.Children) { diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 53d38d57d..c5fc89ec5 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 53d38d57d01d8bf08a8e79a8313a4137293c628e +Subproject commit c5fc89ec56e43e7e01ce1458364e400b678e5073