Merge pull request #2878 from larsbrubaker/design_tools
Made update button work better on subtract
This commit is contained in:
commit
d145789d31
3 changed files with 29 additions and 9 deletions
|
|
@ -358,7 +358,6 @@ namespace MatterHackers.MatterControl
|
|||
Icon = AggContext.StaticData.LoadIcon("intersect.png"),
|
||||
IsEnabled = (scene) => scene.SelectedItem is SelectionGroup,
|
||||
},
|
||||
#if DEBUG // keep this work in progress to the editor for now
|
||||
new SceneSelectionOperation()
|
||||
{
|
||||
TitleResolver = () => "Subtract & Replace".Localize(),
|
||||
|
|
@ -366,6 +365,7 @@ namespace MatterHackers.MatterControl
|
|||
Icon = AggContext.StaticData.LoadIcon("paint.png").SetPreMultiply(),
|
||||
IsEnabled = (scene) => scene.SelectedItem is SelectionGroup,
|
||||
},
|
||||
#if DEBUG // keep this work in progress to the editor for now
|
||||
new SceneSelectionOperation()
|
||||
{
|
||||
TitleResolver = () => "Make Support".Localize(),
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ using MatterHackers.PolygonMesh;
|
|||
|
||||
namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
||||
{
|
||||
#if DEBUG // keep this work in progress to the editor for now
|
||||
public class SubtractAndReplace : IObject3DEditor
|
||||
{
|
||||
private MeshWrapperOperation group;
|
||||
|
|
@ -108,10 +107,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
{
|
||||
// make sure the mesh on the group is not visible
|
||||
group.ResetMeshWrappers();
|
||||
updateButton.Enabled = false;
|
||||
ProcessBooleans(group);
|
||||
};
|
||||
|
||||
int checkedCount = 0;
|
||||
List<GuiWidget> radioSiblings = new List<GuiWidget>();
|
||||
for (int i = 0; i < children.Count; i++)
|
||||
{
|
||||
|
|
@ -161,10 +160,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
};
|
||||
|
||||
tabContainer.AddChild(rowContainer);
|
||||
checkedCount += checkBox.Checked ? 1 : 0;
|
||||
}
|
||||
|
||||
if(checkedCount == 0) // no items selected
|
||||
bool opperationApplied = group.Descendants()
|
||||
.Where((obj) => obj.OwnerID == group.ID)
|
||||
.Where((objId) => objId.Mesh != objId.Children.First().Mesh).Count() > 0;
|
||||
|
||||
bool selectionHasBeenMade = group.Descendants()
|
||||
.Where((obj) => obj.OwnerID == group.ID)
|
||||
.Where((objId) => objId.OutputType == PrintOutputTypes.Hole).Count() > 0;
|
||||
|
||||
if (!opperationApplied && !selectionHasBeenMade)
|
||||
{
|
||||
// select the last item
|
||||
if (tabContainer.Decendants().Where((d) => d is ICheckbox).Last() is ICheckbox firstCheckBox)
|
||||
|
|
@ -172,6 +178,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
firstCheckBox.Checked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
updateButton.Enabled = opperationApplied;
|
||||
}
|
||||
|
||||
// add this last so it is at the bottom
|
||||
tabContainer.AddChild(updateButton);
|
||||
|
|
@ -248,5 +258,4 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
});
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -88,10 +88,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
{
|
||||
// make sure the mesh on the group is not visible
|
||||
group.ResetMeshWrappers();
|
||||
updateButton.Enabled = false;
|
||||
ProcessBooleans(group);
|
||||
};
|
||||
|
||||
int checkedCount = 0;
|
||||
List<GuiWidget> radioSiblings = new List<GuiWidget>();
|
||||
for (int i = 0; i < children.Count; i++)
|
||||
{
|
||||
|
|
@ -141,10 +141,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
};
|
||||
|
||||
tabContainer.AddChild(rowContainer);
|
||||
checkedCount += checkBox.Checked ? 1 : 0;
|
||||
}
|
||||
|
||||
if (checkedCount == 0) // no items selected
|
||||
bool opperationApplied = group.Descendants()
|
||||
.Where((obj) => obj.OwnerID == group.ID)
|
||||
.Where((objId) => objId.Mesh != objId.Children.First().Mesh).Count() > 0;
|
||||
|
||||
bool selectionHasBeenMade = group.Descendants()
|
||||
.Where((obj) => obj.OwnerID == group.ID)
|
||||
.Where((objId) => objId.OutputType == PrintOutputTypes.Hole).Count() > 0;
|
||||
|
||||
if (!opperationApplied && !selectionHasBeenMade)
|
||||
{
|
||||
// select the last item
|
||||
if (tabContainer.Decendants().Where((d) => d is ICheckbox).Last() is ICheckbox firstCheckBox)
|
||||
|
|
@ -152,6 +159,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
firstCheckBox.Checked = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
updateButton.Enabled = !opperationApplied;
|
||||
}
|
||||
|
||||
// add this last so it is at the bottom
|
||||
tabContainer.AddChild(updateButton);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue