Took out ActiveEditor property
This commit is contained in:
parent
230aeca9a5
commit
035c6a1922
30 changed files with 85 additions and 64 deletions
|
|
@ -40,24 +40,32 @@ using MatterHackers.PolygonMesh;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||
{
|
||||
public class CombineObject3D : MeshWrapperObject3D
|
||||
{
|
||||
public CombineObject3D()
|
||||
{
|
||||
Name = "Combine";
|
||||
}
|
||||
}
|
||||
|
||||
public class CombineEditor : IObject3DEditor
|
||||
{
|
||||
private MeshWrapperOperation group;
|
||||
private CombineObject3D group;
|
||||
private View3DWidget view3DWidget;
|
||||
public string Name => "Combine";
|
||||
|
||||
public bool Unlocked { get; } = true;
|
||||
|
||||
public IEnumerable<Type> SupportedTypes() => new Type[] { typeof(MeshWrapperOperation) };
|
||||
public IEnumerable<Type> SupportedTypes() => new Type[] { typeof(CombineObject3D) };
|
||||
|
||||
public GuiWidget Create(IObject3D group, View3DWidget view3DWidget, ThemeConfig theme)
|
||||
{
|
||||
this.view3DWidget = view3DWidget;
|
||||
this.group = group as MeshWrapperOperation;
|
||||
this.group = group as CombineObject3D;
|
||||
|
||||
var mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
|
||||
if (group is MeshWrapperOperation operationNode
|
||||
if (group is CombineObject3D operationNode
|
||||
&& operationNode.Descendants().Where((obj) => obj.OwnerID == group.ID).All(c => c.OutputType != PrintOutputTypes.Hole))
|
||||
{
|
||||
bool first = true;
|
||||
|
|
|
|||
|
|
@ -40,24 +40,32 @@ using MatterHackers.PolygonMesh;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||
{
|
||||
public class IntersectionObject3D : MeshWrapperObject3D
|
||||
{
|
||||
public IntersectionObject3D()
|
||||
{
|
||||
Name = "Intersection";
|
||||
}
|
||||
}
|
||||
|
||||
public class IntersectionEditor : IObject3DEditor
|
||||
{
|
||||
private MeshWrapperOperation group;
|
||||
private IntersectionObject3D group;
|
||||
private View3DWidget view3DWidget;
|
||||
public string Name => "Intersection";
|
||||
|
||||
public bool Unlocked { get; } = true;
|
||||
|
||||
public IEnumerable<Type> SupportedTypes() => new Type[] { typeof(MeshWrapperOperation) };
|
||||
public IEnumerable<Type> SupportedTypes() => new Type[] { typeof(IntersectionObject3D) };
|
||||
|
||||
public GuiWidget Create(IObject3D group, View3DWidget view3DWidget, ThemeConfig theme)
|
||||
{
|
||||
this.view3DWidget = view3DWidget;
|
||||
this.group = group as MeshWrapperOperation;
|
||||
this.group = group as IntersectionObject3D;
|
||||
|
||||
var mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
|
||||
if (group is MeshWrapperOperation operationNode
|
||||
if (group is IntersectionObject3D operationNode
|
||||
&& operationNode.Descendants().Where((obj) => obj.OwnerID == group.ID).All(c => c.OutputType != PrintOutputTypes.Hole))
|
||||
{
|
||||
bool first = true;
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ using MatterHackers.PolygonMesh;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||
{
|
||||
public class MeshWrapperOperation : Object3D
|
||||
public class MeshWrapperObject3D : Object3D
|
||||
{
|
||||
public MeshWrapperOperation()
|
||||
public MeshWrapperObject3D()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -86,33 +86,31 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
base.Bake();
|
||||
}
|
||||
|
||||
public static void WrapSelection(InteractiveScene scene, string classDescriptor, string editorName)
|
||||
public static void WrapSelection(MeshWrapperObject3D meshWrapper, InteractiveScene scene)
|
||||
{
|
||||
if (scene.HasSelection && scene.SelectedItem.Children.Count() > 1)
|
||||
{
|
||||
var children = scene.SelectedItem.Children;
|
||||
scene.SelectedItem = null;
|
||||
|
||||
var meshWrapperOperation = new MeshWrapperOperation(new List<IObject3D>(children.Select((i) => i.Clone())))
|
||||
{
|
||||
ActiveEditor = classDescriptor,
|
||||
Name = editorName,
|
||||
};
|
||||
meshWrapper.WrapAndAddAsChildren(new List<IObject3D>(children.Select((i) => i.Clone())));
|
||||
|
||||
scene.UndoBuffer.AddAndDo(
|
||||
new ReplaceCommand(
|
||||
new List<IObject3D>(children),
|
||||
new List<IObject3D> { meshWrapperOperation }));
|
||||
new List<IObject3D> { meshWrapper }));
|
||||
|
||||
meshWrapperOperation.MakeNameNonColliding();
|
||||
scene.SelectedItem = meshWrapperOperation;
|
||||
meshWrapper.MakeNameNonColliding();
|
||||
scene.SelectedItem = meshWrapper;
|
||||
}
|
||||
}
|
||||
|
||||
public MeshWrapperOperation(List<IObject3D> children)
|
||||
public void WrapAndAddAsChildren(List<IObject3D> children)
|
||||
{
|
||||
Children.Modify((list) =>
|
||||
{
|
||||
list.Clear();
|
||||
|
||||
foreach (var child in children)
|
||||
{
|
||||
list.Add(child);
|
||||
|
|
@ -40,9 +40,17 @@ using MatterHackers.PolygonMesh;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||
{
|
||||
public class SubtractAndReplace : IObject3DEditor
|
||||
public class SubtractAndReplaceObject3D : MeshWrapperObject3D
|
||||
{
|
||||
private MeshWrapperOperation group;
|
||||
public SubtractAndReplaceObject3D()
|
||||
{
|
||||
Name = "Subtract and Replace";
|
||||
}
|
||||
}
|
||||
|
||||
public class SubtractAndReplaceEditor : IObject3DEditor
|
||||
{
|
||||
private SubtractAndReplaceObject3D group;
|
||||
private View3DWidget view3DWidget;
|
||||
public string Name => "Subtract & Replace";
|
||||
|
||||
|
|
@ -51,11 +59,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
public GuiWidget Create(IObject3D group, View3DWidget view3DWidget, ThemeConfig theme)
|
||||
{
|
||||
this.view3DWidget = view3DWidget;
|
||||
this.group = group as MeshWrapperOperation;
|
||||
this.group = group as SubtractAndReplaceObject3D;
|
||||
|
||||
var mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
|
||||
if (group is MeshWrapperOperation)
|
||||
if (group is SubtractAndReplaceObject3D)
|
||||
{
|
||||
AddPaintSelector(view3DWidget, mainContainer, theme);
|
||||
}
|
||||
|
|
@ -65,7 +73,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
|
||||
public IEnumerable<Type> SupportedTypes() => new Type[]
|
||||
{
|
||||
typeof(MeshWrapperOperation),
|
||||
typeof(SubtractAndReplaceObject3D),
|
||||
};
|
||||
|
||||
private static FlowLayoutWidget CreateSettingsRow(string labelText)
|
||||
|
|
|
|||
|
|
@ -41,9 +41,17 @@ using MatterHackers.PolygonMesh;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||
{
|
||||
public class SubtractObject3D : MeshWrapperObject3D
|
||||
{
|
||||
public SubtractObject3D()
|
||||
{
|
||||
Name = "Subtract";
|
||||
}
|
||||
}
|
||||
|
||||
public class SubtractEditor : IObject3DEditor
|
||||
{
|
||||
private MeshWrapperOperation group;
|
||||
private SubtractObject3D group;
|
||||
private View3DWidget view3DWidget;
|
||||
public string Name => "Subtract";
|
||||
|
||||
|
|
@ -52,11 +60,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
public GuiWidget Create(IObject3D group, View3DWidget view3DWidget, ThemeConfig theme)
|
||||
{
|
||||
this.view3DWidget = view3DWidget;
|
||||
this.group = group as MeshWrapperOperation;
|
||||
this.group = group as SubtractObject3D;
|
||||
|
||||
var mainContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
|
||||
if (group is MeshWrapperOperation)
|
||||
if (group is SubtractObject3D)
|
||||
{
|
||||
AddSubtractSelector(view3DWidget, mainContainer, theme);
|
||||
}
|
||||
|
|
@ -66,7 +74,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
|
||||
public IEnumerable<Type> SupportedTypes() => new Type[]
|
||||
{
|
||||
typeof(MeshWrapperOperation),
|
||||
typeof(SubtractObject3D),
|
||||
};
|
||||
|
||||
private void AddSubtractSelector(View3DWidget view3DWidget, FlowLayoutWidget tabContainer, ThemeConfig theme)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue