improve primary operations
This commit is contained in:
parent
3f8eeda65b
commit
0416a941d7
14 changed files with 83 additions and 121 deletions
|
|
@ -68,8 +68,6 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private static Dictionary<string, SceneOperation> OperationsById { get; } = new Dictionary<string, SceneOperation>();
|
||||
|
||||
private static Dictionary<Type, List<SceneOperation>> PrimaryOperations { get; } = new Dictionary<Type, List<SceneOperation>>();
|
||||
|
||||
public static SceneOperation AddBaseOperation()
|
||||
{
|
||||
return new SceneOperation("AddBase")
|
||||
|
|
@ -264,16 +262,6 @@ namespace MatterHackers.MatterControl
|
|||
return null;
|
||||
}
|
||||
|
||||
public static IEnumerable<SceneOperation> GetPrimaryOperations(Type type)
|
||||
{
|
||||
if (PrimaryOperations.ContainsKey(type))
|
||||
{
|
||||
return PrimaryOperations[type];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PopupMenu GetToolbarOverflowMenu(ThemeConfig theme, ISceneContext sceneContext, Func<SceneOperation, bool> includeInToolbarOverflow = null)
|
||||
{
|
||||
var popupMenu = new PopupMenu(theme);
|
||||
|
|
@ -712,7 +700,6 @@ namespace MatterHackers.MatterControl
|
|||
return true;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
// path items
|
||||
if (includePaths
|
||||
&& selectedItem.VisiblePaths().Count() > 1
|
||||
|
|
@ -720,7 +707,6 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -742,9 +728,7 @@ namespace MatterHackers.MatterControl
|
|||
ArrangeAllPartsOperation(),
|
||||
new SceneSelectionSeparator(),
|
||||
LayFlatOperation(),
|
||||
#if DEBUG
|
||||
RebuildOperation(),
|
||||
#endif
|
||||
GroupOperation(),
|
||||
UngroupOperation(),
|
||||
new SceneSelectionSeparator(),
|
||||
|
|
@ -886,42 +870,6 @@ namespace MatterHackers.MatterControl
|
|||
// register legacy types so they still show, they don't have ui to create so they don't have icons set dynamically
|
||||
Icons.Add(typeof(AlignObject3D), (theme) => StaticData.Instance.LoadIcon("align_left_dark.png", 16, 16).SetToColor(theme.TextColor).SetPreMultiply());
|
||||
|
||||
// image operations
|
||||
PrimaryOperations.Add(typeof(ImageObject3D), new List<SceneOperation> { SceneOperations.ById("ImageConverter"), SceneOperations.ById("ImageToPath"), });
|
||||
|
||||
// path operations
|
||||
PrimaryOperations.Add(typeof(ImageToPathObject3D_2), new List<SceneOperation>
|
||||
{
|
||||
SceneOperations.ById("LinearExtrude"), SceneOperations.ById("Revolve"), SceneOperations.ById("SmoothPath")
|
||||
});
|
||||
PrimaryOperations.Add(typeof(SmoothPathObject3D), new List<SceneOperation>
|
||||
{
|
||||
SceneOperations.ById("LinearExtrude"), SceneOperations.ById("Revolve"), SceneOperations.ById("InflatePath"), SceneOperations.ById("OutlinePath")
|
||||
});
|
||||
PrimaryOperations.Add(typeof(TextObject3D), new List<SceneOperation>
|
||||
{
|
||||
SceneOperations.ById("LinearExtrude"), SceneOperations.ById("Revolve"), SceneOperations.ById("InflatePath"), SceneOperations.ById("OutlinePath")
|
||||
});
|
||||
PrimaryOperations.Add(typeof(BoxPathObject3D), new List<SceneOperation>
|
||||
{
|
||||
SceneOperations.ById("LinearExtrude"), SceneOperations.ById("Revolve"), SceneOperations.ById("InflatePath"), SceneOperations.ById("OutlinePath")
|
||||
});
|
||||
PrimaryOperations.Add(typeof(InflatePathObject3D), new List<SceneOperation>
|
||||
{
|
||||
SceneOperations.ById("LinearExtrude"), SceneOperations.ById("Revolve"), SceneOperations.ById("OutlinePath")
|
||||
});
|
||||
PrimaryOperations.Add(typeof(OutlinePathObject3D), new List<SceneOperation>
|
||||
{
|
||||
SceneOperations.ById("LinearExtrude"), SceneOperations.ById("Revolve"), SceneOperations.ById("InflatePath")
|
||||
});
|
||||
PrimaryOperations.Add(typeof(LinearExtrudeObject3D), new List<SceneOperation>
|
||||
{
|
||||
SceneOperations.ById("AddBase")
|
||||
});
|
||||
|
||||
// default operations
|
||||
PrimaryOperations.Add(typeof(Object3D), new List<SceneOperation> { SceneOperations.ById("Scale") });
|
||||
|
||||
Icons.Add(typeof(ImageObject3D), (theme) => StaticData.Instance.LoadIcon("image_converter.png", 16, 16).SetToColor(theme.TextColor).SetPreMultiply());
|
||||
}
|
||||
|
||||
|
|
@ -933,13 +881,11 @@ namespace MatterHackers.MatterControl
|
|||
TitleGetter = () => "Combine".Localize(),
|
||||
Action = (sceneContext) =>
|
||||
{
|
||||
#if DEBUG
|
||||
if (sceneContext.Scene.SelectedItem.VisiblePaths().Count() > 1)
|
||||
{
|
||||
new MergePathObject3D("Combine".Localize(), ClipperLib.ClipType.ctUnion).WrapSelectedItemAndSelect(sceneContext.Scene);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
new CombineObject3D_2().WrapSelectedItemAndSelect(sceneContext.Scene);
|
||||
}
|
||||
|
|
@ -1102,13 +1048,11 @@ namespace MatterHackers.MatterControl
|
|||
TitleGetter = () => "Intersect".Localize(),
|
||||
Action = (sceneContext) =>
|
||||
{
|
||||
#if DEBUG
|
||||
if (sceneContext.Scene.SelectedItem.VisiblePaths().Count() > 1)
|
||||
{
|
||||
new MergePathObject3D("Intersect".Localize(), ClipperLib.ClipType.ctIntersection).WrapSelectedItemAndSelect(sceneContext.Scene);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
new IntersectionObject3D_2().WrapSelectedItemAndSelect(sceneContext.Scene);
|
||||
}
|
||||
|
|
@ -1382,13 +1326,11 @@ namespace MatterHackers.MatterControl
|
|||
TitleGetter = () => "Subtract".Localize(),
|
||||
Action = (sceneContext) =>
|
||||
{
|
||||
#if DEBUG
|
||||
if (sceneContext.Scene.SelectedItem.VisiblePaths().Count() > 1)
|
||||
{
|
||||
new SubtractPathObject3D().WrapSelectedItemAndSelect(sceneContext.Scene);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
var subtractItem = new SubtractObject3D_2();
|
||||
subtractItem.WrapSelectedItemAndSelect(sceneContext.Scene);
|
||||
|
|
@ -1539,5 +1481,4 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
IEnumerable<SceneOperation> GetOperations();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue