Made it so that you can add fonts and (open with 'system file')
Fixed BaseObject
This commit is contained in:
parent
74db968eee
commit
c2bf2ad5a5
8 changed files with 43 additions and 14 deletions
|
|
@ -130,7 +130,7 @@ namespace MatterHackers.MatterControl
|
||||||
|
|
||||||
public event EventHandler AnyPrintComplete;
|
public event EventHandler AnyPrintComplete;
|
||||||
|
|
||||||
public static string[] ShellFileExtensions => new string[] { ".stl", ".amf", ".3mf", ".obj", ".mcx", ".png", ".jpg", ".jpeg" };
|
public static string[] ShellFileExtensions => new string[] { ".stl", ".amf", ".3mf", ".obj", ".mcx", ".png", ".jpg", ".jpeg", ".ttf", ".otf" };
|
||||||
|
|
||||||
public bool IsMatterControlPro()
|
public bool IsMatterControlPro()
|
||||||
{
|
{
|
||||||
|
|
@ -1380,10 +1380,9 @@ namespace MatterHackers.MatterControl
|
||||||
{
|
{
|
||||||
addedWindowsFonts = true;
|
addedWindowsFonts = true;
|
||||||
|
|
||||||
// add all the windows fonts
|
// add all the fonts from user data "Fonts" folder
|
||||||
// get all the files with the extension .ttf in the windows/fonts directory
|
var ttfs = Directory.GetFiles(ApplicationDataStorage.Instance.ApplicationFontsDataPath, "*.ttf");
|
||||||
var ttfs = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "*.ttf");
|
var otf = Directory.GetFiles(ApplicationDataStorage.Instance.ApplicationFontsDataPath, "*.otf");
|
||||||
var otf = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "*.otf");
|
|
||||||
var fonts = ttfs.Concat(otf);
|
var fonts = ttfs.Concat(otf);
|
||||||
// add all the fonts to the cache
|
// add all the fonts to the cache
|
||||||
foreach (var font in fonts)
|
foreach (var font in fonts)
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,9 @@ namespace MatterHackers.MatterControl.DataStorage
|
||||||
|
|
||||||
private static string _applicationUserDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ApplicationDataFolderName);
|
private static string _applicationUserDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ApplicationDataFolderName);
|
||||||
|
|
||||||
private static string _applicationLibraryDataPath => Path.Combine(_applicationUserDataPath, "Library");
|
private static string _applicationLibraryDataPath => Path.Combine(_applicationUserDataPath, "Library");
|
||||||
|
|
||||||
|
private static string _applicationFontsDataPath => Path.Combine(_applicationUserDataPath, "Fonts");
|
||||||
|
|
||||||
private static string _libraryAssetPath => Path.Combine(_applicationLibraryDataPath, "Assets");
|
private static string _libraryAssetPath => Path.Combine(_applicationLibraryDataPath, "Assets");
|
||||||
|
|
||||||
|
|
@ -96,6 +98,8 @@ namespace MatterHackers.MatterControl.DataStorage
|
||||||
|
|
||||||
public string ApplicationLibraryDataPath => EnsurePath(_applicationLibraryDataPath);
|
public string ApplicationLibraryDataPath => EnsurePath(_applicationLibraryDataPath);
|
||||||
|
|
||||||
|
public string ApplicationFontsDataPath => EnsurePath(_applicationFontsDataPath);
|
||||||
|
|
||||||
public string CloudLibraryPath => EnsurePath(_cloudLibraryPath);
|
public string CloudLibraryPath => EnsurePath(_cloudLibraryPath);
|
||||||
|
|
||||||
public string LibraryAssetsPath => EnsurePath(_libraryAssetPath);
|
public string LibraryAssetsPath => EnsurePath(_libraryAssetPath);
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MatterControlLib.DesignTools.Operations.Path;
|
using MatterControlLib.DesignTools.Operations.Path;
|
||||||
using MatterHackers.Agg.UI;
|
using MatterHackers.Agg.UI;
|
||||||
|
using MatterHackers.Agg.VertexSource;
|
||||||
using MatterHackers.DataConverters3D;
|
using MatterHackers.DataConverters3D;
|
||||||
using MatterHackers.DataConverters3D.UndoCommands;
|
using MatterHackers.DataConverters3D.UndoCommands;
|
||||||
using MatterHackers.Localizations;
|
using MatterHackers.Localizations;
|
||||||
|
|
@ -44,7 +45,7 @@ using MatterHackers.VectorMath;
|
||||||
|
|
||||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||||
{
|
{
|
||||||
public class LinearExtrudeObject3D : PathObject3DAbstract, IPrimaryOperationsSpecifier, IPropertyGridModifier
|
public class LinearExtrudeObject3D : Object3D, IPrimaryOperationsSpecifier, IPropertyGridModifier, IPathProvider
|
||||||
{
|
{
|
||||||
[Description("The height of the extrusion")]
|
[Description("The height of the extrusion")]
|
||||||
[Slider(.1, 50, Easing.EaseType.Quadratic, useSnappingGrid: true)]
|
[Slider(.1, 50, Easing.EaseType.Quadratic, useSnappingGrid: true)]
|
||||||
|
|
@ -65,7 +66,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||||
|
|
||||||
public override bool CanApply => true;
|
public override bool CanApply => true;
|
||||||
|
|
||||||
public override bool MeshIsSolidObject => true;
|
public bool MeshIsSolidObject => true;
|
||||||
|
|
||||||
public override void Apply(UndoBuffer undoBuffer)
|
public override void Apply(UndoBuffer undoBuffer)
|
||||||
{
|
{
|
||||||
|
|
@ -195,5 +196,10 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||||
{
|
{
|
||||||
yield return SceneOperations.ById("AddBase");
|
yield return SceneOperations.ById("AddBase");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IVertexSource GetRawPath()
|
||||||
|
{
|
||||||
|
return this.CombinedVisibleChildrenPaths();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -231,10 +231,10 @@ namespace MatterHackers.MatterControl.DesignTools
|
||||||
});
|
});
|
||||||
|
|
||||||
// and create the base
|
// and create the base
|
||||||
var vertexSource = GetRawPath();
|
var vertexSource = this.CombinedVisibleChildrenPaths();
|
||||||
|
|
||||||
// Convert VertexSource into expected Polygons
|
// Convert VertexSource into expected Polygons
|
||||||
Polygons polygonShape = (vertexSource == null) ? null : vertexSource.CreatePolygons();
|
Polygons polygonShape = (vertexSource == null) ? null : vertexSource.CreatePolygons();
|
||||||
GenerateBase(polygonShape, firstChild.GetAxisAlignedBoundingBox().MinXYZ.Z);
|
GenerateBase(polygonShape, firstChild.GetAxisAlignedBoundingBox().MinXYZ.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ using MatterHackers.DataConverters3D;
|
||||||
using MatterHackers.ImageProcessing;
|
using MatterHackers.ImageProcessing;
|
||||||
using MatterHackers.Localizations;
|
using MatterHackers.Localizations;
|
||||||
using MatterHackers.MatterControl.CustomWidgets;
|
using MatterHackers.MatterControl.CustomWidgets;
|
||||||
|
using MatterHackers.MatterControl.DataStorage;
|
||||||
using MatterHackers.MatterControl.Library;
|
using MatterHackers.MatterControl.Library;
|
||||||
using MatterHackers.MatterControl.Library.Widgets;
|
using MatterHackers.MatterControl.Library.Widgets;
|
||||||
using MatterHackers.MatterControl.PartPreviewWindow.PlusTab;
|
using MatterHackers.MatterControl.PartPreviewWindow.PlusTab;
|
||||||
|
|
@ -510,7 +511,23 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case ".ttf":
|
||||||
|
case ".otf":
|
||||||
|
{
|
||||||
|
// check if the file is already in the fonts directory
|
||||||
|
if (!File.Exists(Path.Combine(ApplicationDataStorage.Instance.ApplicationFontsDataPath, Path.GetFileName(filePath))))
|
||||||
|
{
|
||||||
|
// make sure the directory exists
|
||||||
|
Directory.CreateDirectory(ApplicationDataStorage.Instance.ApplicationFontsDataPath);
|
||||||
|
|
||||||
|
// copy the file to the fonts directory
|
||||||
|
var newFilePath = Path.Combine(ApplicationDataStorage.Instance.ApplicationFontsDataPath, Path.GetFileName(filePath));
|
||||||
|
File.Copy(filePath, newFilePath, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
{
|
{
|
||||||
var workspace = await CreateNewDesignTab(false);
|
var workspace = await CreateNewDesignTab(false);
|
||||||
workspace.SceneContext.AddToPlate(new string[] { filePath }, false);
|
workspace.SceneContext.AddToPlate(new string[] { filePath }, false);
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl
|
||||||
|
|
||||||
public static string LibraryFilterFileExtensions { get; } = ValidFileExtensions + ",.gcode";
|
public static string LibraryFilterFileExtensions { get; } = ValidFileExtensions + ",.gcode";
|
||||||
|
|
||||||
public static string OpenDesignFileParams { get; } = "STL, AMF, OBJ, 3MF, GCODE, MCX|*.stl;*.amf;*.obj;*.gcode;*.mcx";
|
public static string OpenDesignFileParams { get; } = "STL, AMF, OBJ, 3MF, MCX, TTF, OTF|*.stl;*.amf;*.obj;*.mcx;*.ttf;*.otf";
|
||||||
|
|
||||||
private static ApplicationSettings globalInstance = null;
|
private static ApplicationSettings globalInstance = null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2434,6 +2434,9 @@ Translated:Image Converter
|
||||||
English:Image Missing
|
English:Image Missing
|
||||||
Translated:Image Missing
|
Translated:Image Missing
|
||||||
|
|
||||||
|
English:Image Search
|
||||||
|
Translated:Image Search
|
||||||
|
|
||||||
English:Image to Path
|
English:Image to Path
|
||||||
Translated:Image to Path
|
Translated:Image to Path
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4a3185d8d49855cf6ade9d2bf2ada19e101d731f
|
Subproject commit 2f0d725538c880d740ed516d6eb9d3d261f68c58
|
||||||
Loading…
Add table
Add a link
Reference in a new issue