Fixing bug in component packaging
Started work on component editor
This commit is contained in:
parent
7e39592cf9
commit
a37d896edf
15 changed files with 169 additions and 37 deletions
|
|
@ -765,6 +765,32 @@ namespace MatterHackers.MatterControl
|
|||
},
|
||||
iconCollector: (theme) => AggContext.StaticData.LoadIcon(Path.Combine("ViewTransformControls", "rotate.png"), 16, 16, theme.InvertIcons));
|
||||
|
||||
#if DEBUG // when this is working (Component and ComponentPicker work), enable it.
|
||||
this.Graph.RegisterOperation(
|
||||
typeof(IObject3D),
|
||||
typeof(ComponentEditorObject3D),
|
||||
"Make Component".Localize(),
|
||||
(sceneItem, scene) =>
|
||||
{
|
||||
var selectedItem = scene.SelectedItem;
|
||||
scene.SelectedItem = null;
|
||||
var component = new ComponentEditorObject3D();
|
||||
component.Children.Add(selectedItem.Clone());
|
||||
component.MakeNameNonColliding();
|
||||
|
||||
scene.UndoBuffer.AddAndDo(new ReplaceCommand(new List<IObject3D> { selectedItem }, new List<IObject3D> { component }));
|
||||
scene.SelectedItem = component;
|
||||
|
||||
return Task.CompletedTask;
|
||||
},
|
||||
isVisible: (sceneItem) =>
|
||||
{
|
||||
bool noInternalComponents = sceneItem.Descendants().All((d) => !(d is ComponentObject3D) && !(d is ComponentEditorObject3D));
|
||||
return noInternalComponents;
|
||||
},
|
||||
iconCollector: (theme) => AggContext.StaticData.LoadIcon("scale_32x32.png", 16, 16, theme.InvertIcons));
|
||||
#endif
|
||||
|
||||
this.Graph.RegisterOperation(
|
||||
typeof(IObject3D),
|
||||
typeof(ScaleObject3D),
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.CustomWidgets
|
||||
{
|
||||
/// <summary>
|
||||
/// Make this object a terminating leafe in the Design History. Do
|
||||
/// not show any of its children
|
||||
/// </summary>
|
||||
public interface IVisualLeafNode
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,13 +270,18 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
public void UpdateControls(PublicPropertyChange change)
|
||||
{
|
||||
change.Context.GetEditRow(nameof(Diameter)).Visible = FitType != FitType.Box;
|
||||
|
||||
change.Context.GetEditRow(nameof(Width)).Visible = FitType == FitType.Box;
|
||||
change.Context.GetEditRow(nameof(Depth)).Visible = FitType == FitType.Box;
|
||||
change.Context.GetEditRow(nameof(MaintainRatio)).Visible = FitType == FitType.Box;
|
||||
change.Context.GetEditRow(nameof(StretchX)).Visible = FitType == FitType.Box;
|
||||
change.Context.GetEditRow(nameof(StretchY)).Visible = FitType == FitType.Box;
|
||||
var editRow = change.Context.GetEditRow(nameof(Diameter));
|
||||
if(editRow != null) editRow.Visible = FitType != FitType.Box;
|
||||
editRow = change.Context.GetEditRow(nameof(Width));
|
||||
if (editRow != null) editRow.Visible = FitType == FitType.Box;
|
||||
editRow = change.Context.GetEditRow(nameof(Depth));
|
||||
if (editRow != null) editRow.Visible = FitType == FitType.Box;
|
||||
editRow = change.Context.GetEditRow(nameof(MaintainRatio));
|
||||
if (editRow != null) editRow.Visible = FitType == FitType.Box;
|
||||
editRow = change.Context.GetEditRow(nameof(StretchX));
|
||||
if (editRow != null) editRow.Visible = FitType == FitType.Box;
|
||||
editRow = change.Context.GetEditRow(nameof(StretchY));
|
||||
if (editRow != null) editRow.Visible = FitType == FitType.Box;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -386,12 +386,18 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
public void UpdateControls(PublicPropertyChange change)
|
||||
{
|
||||
change.Context.GetEditRow(nameof(XAlignTo)).Visible = Advanced && XAlign != Align.Origin;
|
||||
change.Context.GetEditRow(nameof(XOffset)).Visible = Advanced;
|
||||
change.Context.GetEditRow(nameof(YAlignTo)).Visible = Advanced && YAlign != Align.Origin;
|
||||
change.Context.GetEditRow(nameof(YOffset)).Visible = Advanced;
|
||||
change.Context.GetEditRow(nameof(ZAlignTo)).Visible = Advanced && ZAlign != Align.Origin;
|
||||
change.Context.GetEditRow(nameof(ZOffset)).Visible = Advanced;
|
||||
var editRow = change.Context.GetEditRow(nameof(XAlignTo));
|
||||
if (editRow != null) editRow.Visible = Advanced && XAlign != Align.Origin;
|
||||
editRow = change.Context.GetEditRow(nameof(XOffset));
|
||||
if (editRow != null) editRow.Visible = Advanced;
|
||||
editRow = change.Context.GetEditRow(nameof(YAlignTo));
|
||||
if (editRow != null) editRow.Visible = Advanced && YAlign != Align.Origin;
|
||||
editRow = change.Context.GetEditRow(nameof(YOffset));
|
||||
if (editRow != null) editRow.Visible = Advanced;
|
||||
editRow = change.Context.GetEditRow(nameof(ZAlignTo));
|
||||
if (editRow != null) editRow.Visible = Advanced && ZAlign != Align.Origin;
|
||||
editRow = change.Context.GetEditRow(nameof(ZOffset));
|
||||
if (editRow != null) editRow.Visible = Advanced;
|
||||
}
|
||||
|
||||
private static bool IsSet(FaceAlign variableToCheck, FaceAlign faceToCheckFor, FaceAlign faceToAssertNot)
|
||||
|
|
|
|||
|
|
@ -242,13 +242,19 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
public void UpdateControls(PublicPropertyChange change)
|
||||
{
|
||||
change.Context.GetEditRow(nameof(SizeX)).Visible = Operation == ScaleType.Specify;
|
||||
change.Context.GetEditRow(nameof(SizeY)).Visible = Operation == ScaleType.Specify;
|
||||
change.Context.GetEditRow(nameof(SizeZ)).Visible = Operation == ScaleType.Specify;
|
||||
var editRow = change.Context.GetEditRow(nameof(SizeX));
|
||||
if (editRow != null) editRow.Visible = Operation == ScaleType.Specify;
|
||||
editRow = change.Context.GetEditRow(nameof(SizeY));
|
||||
if (editRow != null) editRow.Visible = Operation == ScaleType.Specify;
|
||||
editRow = change.Context.GetEditRow(nameof(SizeZ));
|
||||
if (editRow != null) editRow.Visible = Operation == ScaleType.Specify;
|
||||
|
||||
change.Context.GetEditRow(nameof(MaitainProportions)).Visible = Operation == ScaleType.Specify;
|
||||
change.Context.GetEditRow(nameof(UsePercentage)).Visible = Operation == ScaleType.Specify;
|
||||
change.Context.GetEditRow(nameof(ScaleAbout)).Visible = Operation == ScaleType.Specify;
|
||||
editRow = change.Context.GetEditRow(nameof(MaitainProportions));
|
||||
if (editRow != null) editRow.Visible = Operation == ScaleType.Specify;
|
||||
editRow = change.Context.GetEditRow(nameof(UsePercentage));
|
||||
if (editRow != null) editRow.Visible = Operation == ScaleType.Specify;
|
||||
editRow = change.Context.GetEditRow(nameof(ScaleAbout));
|
||||
if (editRow != null) editRow.Visible = Operation == ScaleType.Specify;
|
||||
|
||||
if(change.Changed == nameof(Operation))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -334,7 +334,8 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public void UpdateControls(PublicPropertyChange change)
|
||||
{
|
||||
//context.GetEditRow((this.ID, nameof(InfillAmount))).Visible = CurrentBaseType == BaseTypes.Outline;
|
||||
//var editRow = context.GetEditRow((this.ID, nameof(InfillAmount)));
|
||||
//if (editRow != null) editRow.Visible = CurrentBaseType == BaseTypes.Outline;
|
||||
}
|
||||
}
|
||||
}
|
||||
49
DesignTools/Primitives/ComponentEditorObject3D.cs
Normal file
49
DesignTools/Primitives/ComponentEditorObject3D.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
public class ComponentEditorObject3D : Object3D, IVisualLeafNode
|
||||
{
|
||||
public ComponentEditorObject3D()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Apply(UndoBuffer undoBuffer)
|
||||
{
|
||||
// TODO: change this into a Component
|
||||
base.Apply(undoBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.MatterControl.CustomWidgets;
|
||||
|
||||
|
|
@ -45,5 +46,11 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
|
||||
public List<string> SurfacedEditors { get; set; } = new List<string>();
|
||||
|
||||
public override void Remove(UndoBuffer undoBuffer)
|
||||
{
|
||||
// TODO: change this into a ComponentEditorObject3D
|
||||
base.Remove(undoBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -179,9 +179,18 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public void UpdateControls(PublicPropertyChange change)
|
||||
{
|
||||
change.Context.GetEditRow(nameof(DiameterTop)).Visible = Advanced;
|
||||
change.Context.GetEditRow(nameof(StartingAngle)).Visible = Advanced;
|
||||
change.Context.GetEditRow(nameof(EndingAngle)).Visible = Advanced;
|
||||
if (change.Context.GetEditRow(nameof(DiameterTop)) is GuiWidget diameterWidget)
|
||||
{
|
||||
diameterWidget.Visible = Advanced;
|
||||
}
|
||||
if (change.Context.GetEditRow(nameof(StartingAngle)) is GuiWidget startingAngleWidget)
|
||||
{
|
||||
startingAngleWidget.Visible = Advanced;
|
||||
}
|
||||
if (change.Context.GetEditRow(nameof(EndingAngle)) is GuiWidget endingAngleWidget)
|
||||
{
|
||||
endingAngleWidget.Visible = Advanced;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -137,8 +137,10 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public void UpdateControls(PublicPropertyChange change)
|
||||
{
|
||||
change.Context.GetEditRow(nameof(StartingAngle)).Visible = Advanced;
|
||||
change.Context.GetEditRow(nameof(EndingAngle)).Visible = Advanced;
|
||||
var editRow = change.Context.GetEditRow(nameof(StartingAngle));
|
||||
if (editRow != null) editRow.Visible = Advanced;
|
||||
editRow = change.Context.GetEditRow(nameof(EndingAngle));
|
||||
if (editRow != null) editRow.Visible = Advanced;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -140,9 +140,12 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public void UpdateControls(PublicPropertyChange change)
|
||||
{
|
||||
change.Context.GetEditRow(nameof(StartingAngle)).Visible = Advanced;
|
||||
change.Context.GetEditRow(nameof(EndingAngle)).Visible = Advanced;
|
||||
change.Context.GetEditRow(nameof(LatitudeSides)).Visible = Advanced;
|
||||
var editRow = change.Context.GetEditRow(nameof(StartingAngle));
|
||||
if (editRow != null) editRow.Visible = Advanced;
|
||||
editRow = change.Context.GetEditRow(nameof(EndingAngle));
|
||||
if (editRow != null) editRow.Visible = Advanced;
|
||||
editRow = change.Context.GetEditRow(nameof(LatitudeSides));
|
||||
if (editRow != null) editRow.Visible = Advanced;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -137,10 +137,14 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public void UpdateControls(PublicPropertyChange change)
|
||||
{
|
||||
change.Context.GetEditRow(nameof(StartingAngle)).Visible = Advanced;
|
||||
change.Context.GetEditRow(nameof(EndingAngle)).Visible = Advanced;
|
||||
change.Context.GetEditRow(nameof(RingSides)).Visible = Advanced;
|
||||
change.Context.GetEditRow(nameof(RingPhaseAngle)).Visible = Advanced;
|
||||
var editRow = change.Context.GetEditRow(nameof(StartingAngle));
|
||||
if (editRow != null) editRow.Visible = Advanced;
|
||||
editRow = change.Context.GetEditRow(nameof(EndingAngle));
|
||||
if (editRow != null) editRow.Visible = Advanced;
|
||||
editRow = change.Context.GetEditRow(nameof(RingSides));
|
||||
if (editRow != null) editRow.Visible = Advanced;
|
||||
editRow = change.Context.GetEditRow(nameof(RingPhaseAngle));
|
||||
if (editRow != null) editRow.Visible = Advanced;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -118,6 +118,7 @@
|
|||
<Compile Include="DesignTools\Operations\ScaleObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\SetCenterObject3D.cs" />
|
||||
<Compile Include="DesignTools\Operations\TranslateObject3D.cs" />
|
||||
<Compile Include="DesignTools\Primitives\ComponentEditorObject3D.cs" />
|
||||
<Compile Include="DesignTools\Primitives\ComponentObject3D.cs" />
|
||||
<Compile Include="DesignTools\Primitives\CubeObject3D.cs" />
|
||||
<Compile Include="DesignTools\Primitives\HalfCylinderObject3D.cs" />
|
||||
|
|
|
|||
|
|
@ -301,6 +301,10 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
this.InspectedObject3D = e.Node.Tag as IObject3D;
|
||||
this.scene.DebugItem = this.InspectedObject3D;
|
||||
|
||||
var selector = string.Join(".", this.InspectedObject3D.AncestorsAndSelf().Select(o => $"Children<{o.GetType().Name.ToString()}>").Reverse().ToArray());
|
||||
Console.WriteLine(selector);
|
||||
|
||||
view3DWidget.Invalidate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -366,13 +366,16 @@ namespace JsonPath
|
|||
// Separate member and typeFilter from member field
|
||||
(member, typeFilter) = StripTypeFilter(member);
|
||||
|
||||
//if (TryParseInt(member) is int)
|
||||
//{
|
||||
// return true;
|
||||
//}
|
||||
|
||||
// IEnumerable field must be iterated to check
|
||||
if (value is IEnumerable enumerable)
|
||||
if (!string.IsNullOrEmpty(typeFilter)
|
||||
&& GetMemberValue(value, member) is IEnumerable enumerable)
|
||||
{
|
||||
if (TryParseInt(member) is int)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Handle the typeFilter case
|
||||
foreach (var n in enumerable)
|
||||
|
|
@ -382,6 +385,8 @@ namespace JsonPath
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Inline once troubleshooting is complete
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue