Extract drawing from PPE to InteractionLayer

- Eliminate event bindings, invoke DrawEditor directly
This commit is contained in:
John Lewin 2019-02-01 11:58:19 -08:00
parent 0d895258aa
commit 316c15a844
3 changed files with 8 additions and 14 deletions

View file

@ -49,8 +49,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public InteractiveScene Scene { get; }
public event EventHandler<DrawEventArgs> DrawGlOpaqueContent;
public bool DoOpenGlDrawing { get; set; } = true;
// TODO: Collapse into auto-property
@ -118,7 +116,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
GLHelper.SetGlContext(this.World, renderSource.TransformToScreenSpace(renderSource.LocalBounds), lighting);
// Draw Gl Content
DrawGlOpaqueContent?.Invoke(this, e);
this.DrawGlTransparentContent(e);
GLHelper.UnsetGlContext();

View file

@ -442,6 +442,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
DrawObject(object3D, transparentMeshes, e);
}
// Invoke existing IEditorDraw when iterating items
if (object3D is IEditorDraw editorDraw)
{
// TODO: Putting the drawing code in the IObject3D means almost certain bindings to MatterControl in IObject3D. If instead
// we had a UI layer object that used binding to register scene drawing hooks for specific types, we could avoid the bindings
editorDraw.DrawEditor(this, e);
}
}
transparentMeshes.Sort(BackToFrontXY);