Make UngroupSelection into a Scene extension method
This commit is contained in:
parent
ef9982cdc5
commit
5a5db8de83
3 changed files with 22 additions and 22 deletions
|
|
@ -231,7 +231,7 @@
|
|||
<Compile Include="PartPreviewWindow\View3D\View3DAutoArange.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\View3DCopyGroup.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\View3DGroup.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\View3DUngroup.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\SceneActions.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\SideBar\MirrorControls.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\IObject3DEditor.cs" />
|
||||
<Compile Include="PartPreviewWindow\View3D\View3DWidget.cs" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014, Lars Brubaker
|
||||
Copyright (c) 2017, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -27,23 +27,23 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using MatterHackers.DataConverters3D;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.PolygonMesh;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.MeshVisualizer;
|
||||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||
{
|
||||
public partial class View3DWidget
|
||||
public static class SceneActions
|
||||
{
|
||||
private async void UngroupSelection()
|
||||
public static async void UngroupSelection(this InteractiveScene Scene, View3DWidget view3DWidget)
|
||||
{
|
||||
if (Scene.HasSelection)
|
||||
{
|
||||
processingProgressControl.PercentComplete = 0;
|
||||
processingProgressControl.Visible = true;
|
||||
LockEditControls();
|
||||
viewIsInEditModePreLock = true;
|
||||
view3DWidget.processingProgressControl.PercentComplete = 0;
|
||||
view3DWidget.processingProgressControl.Visible = true;
|
||||
view3DWidget.LockEditControls();
|
||||
view3DWidget.viewIsInEditModePreLock = true;
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
|
|
@ -57,7 +57,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
var discreetMeshes = CreateDiscreteMeshes.SplitVolumesIntoMeshes(Scene.SelectedItem.Mesh, (double progress0To1, string processingState, out bool continueProcessing) =>
|
||||
{
|
||||
ReportProgressChanged(progress0To1 * .5, processingState, out continueProcessing);
|
||||
view3DWidget.ReportProgressChanged(progress0To1 * .5, processingState, out continueProcessing);
|
||||
});
|
||||
|
||||
if (discreetMeshes.Count == 1)
|
||||
|
|
@ -82,15 +82,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (isGroupItemType)
|
||||
{
|
||||
// Create and perform the delete operation
|
||||
var operation = new UngroupCommand(this, Scene.SelectedItem);
|
||||
var operation = new UngroupCommand(view3DWidget, Scene.SelectedItem);
|
||||
operation.Do();
|
||||
|
||||
// Store the operation for undo/redo
|
||||
UndoBuffer.Add(operation);
|
||||
view3DWidget.UndoBuffer.Add(operation);
|
||||
}
|
||||
});
|
||||
|
||||
if (HasBeenClosed)
|
||||
if (view3DWidget.HasBeenClosed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -98,11 +98,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
// our selection changed to the mesh we just added which is at the end
|
||||
Scene.SelectLastChild();
|
||||
|
||||
UnlockEditControls();
|
||||
view3DWidget.UnlockEditControls();
|
||||
|
||||
PartHasBeenChanged();
|
||||
view3DWidget.PartHasBeenChanged();
|
||||
|
||||
Invalidate();
|
||||
view3DWidget.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
private OpenMode openMode;
|
||||
internal bool partHasBeenEdited = false;
|
||||
private PrintItemWrapper printItemWrapper { get; set; }
|
||||
private ProgressControl processingProgressControl;
|
||||
internal ProgressControl processingProgressControl;
|
||||
private SaveAsWindow saveAsWindow = null;
|
||||
private SplitButton saveButtons;
|
||||
private bool saveSucceded = true;
|
||||
|
|
@ -200,7 +200,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
private Matrix4X4 transformOnMouseDown = Matrix4X4.Identity;
|
||||
private EventHandler unregisterEvents;
|
||||
|
||||
private bool viewIsInEditModePreLock = false;
|
||||
internal bool viewIsInEditModePreLock = false;
|
||||
|
||||
private bool wasInSelectMode = false;
|
||||
|
||||
|
|
@ -355,7 +355,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
doEdittingButtonsContainer.AddChild(ungroupButton);
|
||||
ungroupButton.Click += (sender, e) =>
|
||||
{
|
||||
UngroupSelection();
|
||||
this.Scene.UngroupSelection(this);
|
||||
};
|
||||
|
||||
Button groupButton = smallMarginButtonFactory.Generate("Group".Localize());
|
||||
|
|
@ -1699,7 +1699,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ReportProgressChanged(progress0To1, processingState, out continueProcessing);
|
||||
}
|
||||
|
||||
private void ReportProgressChanged(double progress0To1, string processingState, out bool continueProcessing)
|
||||
internal void ReportProgressChanged(double progress0To1, string processingState, out bool continueProcessing)
|
||||
{
|
||||
if (!timeSinceReported.IsRunning || timeSinceReported.ElapsedMilliseconds > 100
|
||||
|| processingState != processingProgressControl.ProgressMessage)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue