Object3DControls are dynamically added for a given part

This commit is contained in:
LarsBrubaker 2020-09-12 19:44:18 -07:00
parent 77ec3d5909
commit a35347df4a
17 changed files with 143 additions and 197 deletions

View file

@ -36,6 +36,7 @@ using MatterHackers.Agg.VertexSource;
using MatterHackers.DataConverters3D;
using MatterHackers.MatterControl;
using MatterHackers.MatterControl.DesignTools;
using MatterHackers.MatterControl.PartPreviewWindow;
using MatterHackers.MeshVisualizer;
using MatterHackers.RayTracer;
using MatterHackers.RenderOpenGl;
@ -44,7 +45,7 @@ using MatterHackers.VectorMath;
namespace MatterHackers.Plugins.EditorTools
{
public class PathControl : IObject3DControl
public class PathControl : IObject3DControl, IObject3DControlsProvider
{
private readonly IObject3DControlContext context;
@ -160,11 +161,6 @@ namespace MatterHackers.Plugins.EditorTools
}
}
public void LostFocus()
{
this.Reset();
}
private void Reset()
{
// Clear and close selection targets
@ -178,7 +174,7 @@ namespace MatterHackers.Plugins.EditorTools
lastItem = null;
}
public void SetPosition(IObject3D selectedItem)
public void SetPosition(IObject3D selectedItem, MeshSelectInfo selectInfo)
{
if (selectedItem != lastItem)
{
@ -290,6 +286,21 @@ namespace MatterHackers.Plugins.EditorTools
throw new NotImplementedException();
}
public IEnumerable<IObject3DControl> CreateObject3DControls(IObject3DControlContext context)
{
return new List<IObject3DControl> { new PathControl(context) };
}
public void Dispose()
{
Reset();
}
public List<IObject3DControl> GetObject3DControls(Object3DControlsLayer object3DControlsLayer)
{
throw new NotImplementedException();
}
private class CurveControlPoint : VertexPointWidget
{
public CurveControlPoint(IObject3DControlContext context, PathControl pathControl, VertexStorage vertexStorage, Vector3 point, ShapePath.FlagsAndCommand flagsandCommand, int index)