Tons more bffnt progress. Adjust assimp version to fix issues
This commit is contained in:
parent
92cec3da0b
commit
7dc00e4bf3
@ -59,6 +59,8 @@ namespace FirstPlugin
|
||||
|
||||
public void Load(System.IO.Stream stream)
|
||||
{
|
||||
CanSave = true;
|
||||
|
||||
bffnt = new FFNT();
|
||||
bffnt.Read(new FileReader(stream));
|
||||
|
||||
@ -232,10 +234,13 @@ namespace FirstPlugin
|
||||
reader.Dispose();
|
||||
}
|
||||
|
||||
internal int BlockCounter = 0;
|
||||
public void Write(FileWriter writer)
|
||||
{
|
||||
writer.ByteOrder = Syroot.BinaryData.ByteOrder.BigEndian;
|
||||
|
||||
BlockCounter = 1;
|
||||
|
||||
writer.WriteSignature("FFNT");
|
||||
writer.Write(BOM);
|
||||
writer.CheckByteOrderMark(BOM);
|
||||
@ -243,8 +248,24 @@ namespace FirstPlugin
|
||||
writer.Write(Version);
|
||||
long _ofsFileSize = writer.Position;
|
||||
writer.Write(uint.MaxValue);
|
||||
writer.Write((ushort)Blocks.Count);
|
||||
long _ofsBlockNum = writer.Position;
|
||||
writer.Write((ushort)0); //BlockCount
|
||||
writer.Write((ushort)0);
|
||||
|
||||
writer.SeekBegin(HeaderSize);
|
||||
FontSection.Write(writer, this);
|
||||
|
||||
//Save Block Count
|
||||
using (writer.TemporarySeek(_ofsBlockNum, SeekOrigin.Begin))
|
||||
{
|
||||
writer.Write((ushort)(BlockCounter + 1));
|
||||
}
|
||||
|
||||
//Save File size
|
||||
using (writer.TemporarySeek(_ofsFileSize, SeekOrigin.Begin))
|
||||
{
|
||||
writer.Write((uint)(writer.BaseStream.Length));
|
||||
}
|
||||
}
|
||||
|
||||
private string CheckSignature(FileReader reader)
|
||||
@ -610,6 +631,10 @@ namespace FirstPlugin
|
||||
uint cwdhOffset = reader.ReadUInt32();
|
||||
uint cmapOffset = reader.ReadUInt32();
|
||||
|
||||
//Add counter for TGLP
|
||||
//Note the other counters are inside sections due to recusive setup
|
||||
Header.BlockCounter += 1;
|
||||
|
||||
TextureGlyph = new TGLP();
|
||||
using (reader.TemporarySeek(tglpOffset - 8, SeekOrigin.Begin))
|
||||
TextureGlyph.Read(reader);
|
||||
@ -625,8 +650,10 @@ namespace FirstPlugin
|
||||
CodeMap.Read(reader, Header, CodeMaps);
|
||||
}
|
||||
|
||||
public void Write(FileWriter writer)
|
||||
public void Write(FileWriter writer, FFNT header)
|
||||
{
|
||||
long pos = writer.Position;
|
||||
|
||||
writer.WriteSignature("FINF");
|
||||
writer.Write(uint.MaxValue);
|
||||
writer.Write(Type, true);
|
||||
@ -646,6 +673,26 @@ namespace FirstPlugin
|
||||
writer.Write(uint.MaxValue);
|
||||
long _ofsCMAP = writer.Position;
|
||||
writer.Write(uint.MaxValue);
|
||||
|
||||
|
||||
//Save section size
|
||||
long endPos = writer.Position;
|
||||
using (writer.TemporarySeek(pos + 4, SeekOrigin.Begin))
|
||||
{
|
||||
writer.Write((uint)(endPos - pos));
|
||||
}
|
||||
|
||||
//Save Texture Glyph
|
||||
writer.WriteUint32Offset(_ofsTGLP, -8);
|
||||
TextureGlyph.Write(writer, header);
|
||||
|
||||
//Save Character Widths
|
||||
writer.WriteUint32Offset(_ofsCWDH, -8);
|
||||
CharacterWidth.Write(writer, header);
|
||||
|
||||
//Save Code Maps
|
||||
writer.WriteUint32Offset(_ofsCMAP, -8);
|
||||
CodeMap.Write(writer, header);
|
||||
}
|
||||
|
||||
public CWDH GetCharacterWidth(int index)
|
||||
@ -712,10 +759,11 @@ namespace FirstPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public void Write(FileWriter writer)
|
||||
public void Write(FileWriter writer, FFNT Header)
|
||||
{
|
||||
long pos = writer.Position;
|
||||
|
||||
writer.WriteSignature("TGLP");
|
||||
long _ofsSectionSize = writer.Position;
|
||||
writer.Write(uint.MaxValue);
|
||||
writer.Write(CellWidth);
|
||||
writer.Write(CellHeight);
|
||||
@ -730,7 +778,11 @@ namespace FirstPlugin
|
||||
writer.Write(SheetHeight);
|
||||
long _ofsSheetBlocks = writer.Position;
|
||||
writer.Write(uint.MaxValue);
|
||||
writer.Align(8192);
|
||||
|
||||
if (Header.Platform == FFNT.PlatformType.NX)
|
||||
writer.Align(4096);
|
||||
else
|
||||
writer.Align(8192);
|
||||
|
||||
long DataPosition = writer.Position;
|
||||
using (writer.TemporarySeek(_ofsSheetBlocks, SeekOrigin.Begin))
|
||||
@ -743,13 +795,12 @@ namespace FirstPlugin
|
||||
writer.Write(SheetDataList[i]);
|
||||
}
|
||||
|
||||
|
||||
long SectionEndPosition = writer.Position;
|
||||
|
||||
//End of section. Set the size
|
||||
|
||||
using (writer.TemporarySeek(_ofsSectionSize, SeekOrigin.Begin))
|
||||
using (writer.TemporarySeek(pos + 4, SeekOrigin.Begin))
|
||||
{
|
||||
writer.Write((uint)(SectionEndPosition - _ofsSectionSize - 4));
|
||||
writer.Write((uint)(SectionEndPosition - pos));
|
||||
}
|
||||
}
|
||||
|
||||
@ -882,9 +933,9 @@ namespace FirstPlugin
|
||||
}
|
||||
else
|
||||
{
|
||||
char charCode = reader.ReadChar();
|
||||
ushort charCode = reader.ReadUInt16();
|
||||
short index = reader.ReadInt16();
|
||||
if (index != -1) header.FontSection.CodeMapDictionary[charCode] = index;
|
||||
if (index != -1) header.FontSection.CodeMapDictionary[(char)charCode] = index;
|
||||
|
||||
codes[i] = charCode;
|
||||
indexes[i] = index;
|
||||
@ -908,6 +959,81 @@ namespace FirstPlugin
|
||||
reader.SeekBegin(pos + SectionSize);
|
||||
}
|
||||
|
||||
public void Write(FileWriter writer, FFNT Header)
|
||||
{
|
||||
Header.BlockCounter += 1;
|
||||
|
||||
long pos = writer.Position;
|
||||
|
||||
writer.WriteSignature("CMAP");
|
||||
writer.Write(uint.MaxValue); //Section Size
|
||||
if (Header.Platform == FFNT.PlatformType.NX)
|
||||
{
|
||||
writer.Write((uint)CharacterCodeBegin);
|
||||
writer.Write((uint)CharacterCodeEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write((ushort)CharacterCodeBegin);
|
||||
writer.Write((ushort)CharacterCodeEnd);
|
||||
}
|
||||
|
||||
writer.Write(MappingMethod, true);
|
||||
writer.Seek(2);
|
||||
|
||||
long DataPos = writer.Position;
|
||||
writer.Write(0); //Next Section Offset
|
||||
|
||||
//Write the data
|
||||
switch (MappingMethod)
|
||||
{
|
||||
case Mapping.Direct:
|
||||
writer.Write(((CMAPDirect)MappingData).Offset);
|
||||
break;
|
||||
case Mapping.Table:
|
||||
for (int i = 0; i < ((CMAPIndexTable)MappingData).Table.Length; i++)
|
||||
{
|
||||
writer.Write(((CMAPIndexTable)MappingData).Table[i]);
|
||||
}
|
||||
break;
|
||||
case Mapping.Scan:
|
||||
writer.Write((ushort)((CMAPScanMapping)MappingData).Codes.Length);
|
||||
if (Header.Platform == FFNT.PlatformType.NX)
|
||||
writer.Seek(2); //Padding
|
||||
|
||||
for (int i = 0; i < ((CMAPScanMapping)MappingData).Codes.Length; i++)
|
||||
{
|
||||
if (Header.Platform == FFNT.PlatformType.NX)
|
||||
{
|
||||
writer.Write((uint)((CMAPScanMapping)MappingData).Codes[i]);
|
||||
writer.Write(((CMAPScanMapping)MappingData).Indexes[i]);
|
||||
writer.Seek(2); //Padding
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write((ushort)((CMAPScanMapping)MappingData).Codes[i]);
|
||||
writer.Write(((CMAPScanMapping)MappingData).Indexes[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
writer.Align(4); //Padding
|
||||
|
||||
|
||||
//Save section size
|
||||
long endPos = writer.Position;
|
||||
using (writer.TemporarySeek(pos + 4, SeekOrigin.Begin))
|
||||
{
|
||||
writer.Write((uint)(endPos - pos));
|
||||
}
|
||||
|
||||
if (NextCodeMapSection != null)
|
||||
{
|
||||
writer.WriteUint32Offset(DataPos, -8);
|
||||
NextCodeMapSection.Write(writer, Header);
|
||||
}
|
||||
}
|
||||
|
||||
//From https://github.com/dnasdw/3dsfont/blob/79e6f4ab6676d82fdcd6c0f79d9b0d7a343f82b5/src/bcfnt2charset/bcfnt2charset.cpp#L3
|
||||
//Todo add the rest of the encoding types
|
||||
public char CodeToU16Code(FINF.CharacterCode characterCode, ushort code)
|
||||
@ -925,11 +1051,6 @@ namespace FirstPlugin
|
||||
|
||||
return (char)code;
|
||||
}
|
||||
|
||||
public void Write()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class CWDH
|
||||
@ -954,9 +1075,19 @@ namespace FirstPlugin
|
||||
|
||||
reader.ReadSignature(4, "CWDH");
|
||||
SectionSize = reader.ReadUInt32();
|
||||
EndIndex = reader.ReadUInt16();
|
||||
StartIndex = reader.ReadUInt16();
|
||||
EndIndex = reader.ReadUInt16();
|
||||
uint NextWidthSectionOffset = reader.ReadUInt32();
|
||||
|
||||
for (ushort i = StartIndex; i <= EndIndex; i++)
|
||||
{
|
||||
var entry = new CharacterWidthEntry();
|
||||
entry.LeftWidth = reader.ReadSByte();
|
||||
entry.GlyphWidth = reader.ReadByte();
|
||||
entry.Width = reader.ReadByte();
|
||||
WidthEntries.Add(entry);
|
||||
}
|
||||
|
||||
if (NextWidthSectionOffset != 0)
|
||||
{
|
||||
reader.SeekBegin((int)NextWidthSectionOffset - 8);
|
||||
@ -967,6 +1098,43 @@ namespace FirstPlugin
|
||||
else
|
||||
reader.SeekBegin(pos + SectionSize);
|
||||
}
|
||||
|
||||
public void Write(FileWriter writer, FFNT Header)
|
||||
{
|
||||
Header.BlockCounter += 1;
|
||||
|
||||
long pos = writer.Position;
|
||||
|
||||
writer.WriteSignature("CWDH");
|
||||
writer.Write(uint.MaxValue); //Section Size
|
||||
writer.Write(StartIndex);
|
||||
writer.Write(EndIndex);
|
||||
|
||||
long DataPos = writer.Position;
|
||||
writer.Write(0); //NextOffset
|
||||
|
||||
for (int i = 0; i < WidthEntries.Count; i++)
|
||||
{
|
||||
writer.Write(WidthEntries[i].LeftWidth);
|
||||
writer.Write(WidthEntries[i].GlyphWidth);
|
||||
writer.Write(WidthEntries[i].Width);
|
||||
}
|
||||
|
||||
writer.Align(4);
|
||||
|
||||
if (NextWidthSection != null)
|
||||
{
|
||||
writer.WriteUint32Offset(DataPos, -8);
|
||||
NextWidthSection.Write(writer, Header);
|
||||
}
|
||||
|
||||
//Save section size
|
||||
long endPos = writer.Position;
|
||||
using (writer.TemporarySeek(pos + 4, SeekOrigin.Begin))
|
||||
{
|
||||
writer.Write((uint)(endPos - pos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CharacterWidthEntry
|
||||
|
273
File_Format_Library/GUI/BFFNT/BffntEditor.Designer.cs
generated
273
File_Format_Library/GUI/BFFNT/BffntEditor.Designer.cs
generated
@ -51,25 +51,25 @@
|
||||
this.stLabel4 = new Toolbox.Library.Forms.STLabel();
|
||||
this.stLabel1 = new Toolbox.Library.Forms.STLabel();
|
||||
this.stPanel2 = new Toolbox.Library.Forms.STPanel();
|
||||
this.numericUpDownUint3 = new Toolbox.Library.Forms.NumericUpDownUint();
|
||||
this.stLabel17 = new Toolbox.Library.Forms.STLabel();
|
||||
this.numericUpDownUint2 = new Toolbox.Library.Forms.NumericUpDownUint();
|
||||
this.stLabel16 = new Toolbox.Library.Forms.STLabel();
|
||||
this.numericUpDownUint1 = new Toolbox.Library.Forms.NumericUpDownUint();
|
||||
this.stLabel15 = new Toolbox.Library.Forms.STLabel();
|
||||
this.stLabel14 = new Toolbox.Library.Forms.STLabel();
|
||||
this.characterCodeCB = new Toolbox.Library.Forms.STComboBox();
|
||||
this.stLabel2 = new Toolbox.Library.Forms.STLabel();
|
||||
this.splitter1 = new System.Windows.Forms.Splitter();
|
||||
this.splitter2 = new System.Windows.Forms.Splitter();
|
||||
this.stPanel3 = new Toolbox.Library.Forms.STPanel();
|
||||
this.imagePanel = new Forms.ImagePaenl();
|
||||
this.imagesCB = new Toolbox.Library.Forms.STComboBox();
|
||||
this.stLabel3 = new Toolbox.Library.Forms.STLabel();
|
||||
this.imageMenuStrip = new Toolbox.Library.Forms.STContextMenuStrip(this.components);
|
||||
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.imagesCB = new Toolbox.Library.Forms.STComboBox();
|
||||
this.stLabel3 = new Toolbox.Library.Forms.STLabel();
|
||||
this.stPanel4 = new Toolbox.Library.Forms.STPanel();
|
||||
this.characterCodeCB = new Toolbox.Library.Forms.STComboBox();
|
||||
this.stLabel14 = new Toolbox.Library.Forms.STLabel();
|
||||
this.numericUpDownUint1 = new Toolbox.Library.Forms.NumericUpDownUint();
|
||||
this.stLabel15 = new Toolbox.Library.Forms.STLabel();
|
||||
this.numericUpDownUint2 = new Toolbox.Library.Forms.NumericUpDownUint();
|
||||
this.stLabel16 = new Toolbox.Library.Forms.STLabel();
|
||||
this.numericUpDownUint3 = new Toolbox.Library.Forms.NumericUpDownUint();
|
||||
this.stLabel17 = new Toolbox.Library.Forms.STLabel();
|
||||
this.imagePanel = new Toolbox.Library.Forms.STPanel();
|
||||
this.stPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.lineFeedUD)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.leftSpacingUD)).BeginInit();
|
||||
@ -79,12 +79,12 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.fontWidthUD)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ascentUD)).BeginInit();
|
||||
this.stPanel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint3)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint2)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint1)).BeginInit();
|
||||
this.stPanel3.SuspendLayout();
|
||||
this.imageMenuStrip.SuspendLayout();
|
||||
this.stPanel4.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint2)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint3)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// stPanel1
|
||||
@ -339,6 +339,91 @@
|
||||
this.stPanel2.Size = new System.Drawing.Size(200, 438);
|
||||
this.stPanel2.TabIndex = 1;
|
||||
//
|
||||
// numericUpDownUint3
|
||||
//
|
||||
this.numericUpDownUint3.Location = new System.Drawing.Point(100, 154);
|
||||
this.numericUpDownUint3.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownUint3.Name = "numericUpDownUint3";
|
||||
this.numericUpDownUint3.Size = new System.Drawing.Size(97, 20);
|
||||
this.numericUpDownUint3.TabIndex = 25;
|
||||
//
|
||||
// stLabel17
|
||||
//
|
||||
this.stLabel17.AutoSize = true;
|
||||
this.stLabel17.Location = new System.Drawing.Point(13, 156);
|
||||
this.stLabel17.Name = "stLabel17";
|
||||
this.stLabel17.Size = new System.Drawing.Size(79, 13);
|
||||
this.stLabel17.TabIndex = 24;
|
||||
this.stLabel17.Text = "Effictive Width:";
|
||||
//
|
||||
// numericUpDownUint2
|
||||
//
|
||||
this.numericUpDownUint2.Location = new System.Drawing.Point(100, 80);
|
||||
this.numericUpDownUint2.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownUint2.Name = "numericUpDownUint2";
|
||||
this.numericUpDownUint2.Size = new System.Drawing.Size(97, 20);
|
||||
this.numericUpDownUint2.TabIndex = 23;
|
||||
//
|
||||
// stLabel16
|
||||
//
|
||||
this.stLabel16.AutoSize = true;
|
||||
this.stLabel16.Location = new System.Drawing.Point(13, 82);
|
||||
this.stLabel16.Name = "stLabel16";
|
||||
this.stLabel16.Size = new System.Drawing.Size(73, 13);
|
||||
this.stLabel16.TabIndex = 22;
|
||||
this.stLabel16.Text = "Left Spacing::";
|
||||
//
|
||||
// numericUpDownUint1
|
||||
//
|
||||
this.numericUpDownUint1.Location = new System.Drawing.Point(100, 118);
|
||||
this.numericUpDownUint1.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownUint1.Name = "numericUpDownUint1";
|
||||
this.numericUpDownUint1.Size = new System.Drawing.Size(97, 20);
|
||||
this.numericUpDownUint1.TabIndex = 21;
|
||||
//
|
||||
// stLabel15
|
||||
//
|
||||
this.stLabel15.AutoSize = true;
|
||||
this.stLabel15.Location = new System.Drawing.Point(13, 120);
|
||||
this.stLabel15.Name = "stLabel15";
|
||||
this.stLabel15.Size = new System.Drawing.Size(77, 13);
|
||||
this.stLabel15.TabIndex = 20;
|
||||
this.stLabel15.Text = "Texture Width:";
|
||||
//
|
||||
// stLabel14
|
||||
//
|
||||
this.stLabel14.AutoSize = true;
|
||||
this.stLabel14.Location = new System.Drawing.Point(13, 45);
|
||||
this.stLabel14.Name = "stLabel14";
|
||||
this.stLabel14.Size = new System.Drawing.Size(84, 13);
|
||||
this.stLabel14.TabIndex = 3;
|
||||
this.stLabel14.Text = "Character Code:";
|
||||
//
|
||||
// characterCodeCB
|
||||
//
|
||||
this.characterCodeCB.BorderColor = System.Drawing.Color.Empty;
|
||||
this.characterCodeCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
|
||||
this.characterCodeCB.ButtonColor = System.Drawing.Color.Empty;
|
||||
this.characterCodeCB.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.characterCodeCB.FormattingEnabled = true;
|
||||
this.characterCodeCB.Location = new System.Drawing.Point(103, 27);
|
||||
this.characterCodeCB.Name = "characterCodeCB";
|
||||
this.characterCodeCB.ReadOnly = true;
|
||||
this.characterCodeCB.Size = new System.Drawing.Size(72, 39);
|
||||
this.characterCodeCB.TabIndex = 2;
|
||||
//
|
||||
// stLabel2
|
||||
//
|
||||
this.stLabel2.AutoSize = true;
|
||||
@ -376,27 +461,21 @@
|
||||
this.stPanel3.Size = new System.Drawing.Size(412, 438);
|
||||
this.stPanel3.TabIndex = 4;
|
||||
//
|
||||
// imageMenuStrip
|
||||
// imagePanel
|
||||
//
|
||||
this.imageMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.exportToolStripMenuItem,
|
||||
this.copyToolStripMenuItem});
|
||||
this.imageMenuStrip.Name = "stContextMenuStrip1";
|
||||
this.imageMenuStrip.Size = new System.Drawing.Size(108, 48);
|
||||
//
|
||||
// exportToolStripMenuItem
|
||||
//
|
||||
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
|
||||
this.exportToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
|
||||
this.exportToolStripMenuItem.Text = "Export";
|
||||
this.exportToolStripMenuItem.Click += new System.EventHandler(this.exportToolStripMenuItem_Click);
|
||||
//
|
||||
// copyToolStripMenuItem
|
||||
//
|
||||
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
|
||||
this.copyToolStripMenuItem.Text = "Copy";
|
||||
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
|
||||
this.imagePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.imagePanel.Location = new System.Drawing.Point(6, 33);
|
||||
this.imagePanel.Name = "imagePanel";
|
||||
this.imagePanel.Size = new System.Drawing.Size(400, 402);
|
||||
this.imagePanel.TabIndex = 2;
|
||||
this.imagePanel.Paint += new System.Windows.Forms.PaintEventHandler(this.imagePanel_Paint);
|
||||
this.imagePanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.imagePanel_MouseDown);
|
||||
this.imagePanel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.imagePanel_MouseMove);
|
||||
this.imagePanel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.imagePanel_MouseUp);
|
||||
this.imagePanel.MouseLeave += new System.EventHandler(this.imagePanel_MouseLeave);
|
||||
this.imagePanel.ContextMenuStrip = imageMenuStrip;
|
||||
//
|
||||
// imagesCB
|
||||
//
|
||||
@ -420,6 +499,28 @@
|
||||
this.stLabel3.TabIndex = 0;
|
||||
this.stLabel3.Text = "Images";
|
||||
//
|
||||
// imageMenuStrip
|
||||
//
|
||||
this.imageMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.exportToolStripMenuItem,
|
||||
this.copyToolStripMenuItem});
|
||||
this.imageMenuStrip.Name = "stContextMenuStrip1";
|
||||
this.imageMenuStrip.Size = new System.Drawing.Size(108, 48);
|
||||
//
|
||||
// exportToolStripMenuItem
|
||||
//
|
||||
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
|
||||
this.exportToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
|
||||
this.exportToolStripMenuItem.Text = "Export";
|
||||
this.exportToolStripMenuItem.Click += new System.EventHandler(this.exportToolStripMenuItem_Click);
|
||||
//
|
||||
// copyToolStripMenuItem
|
||||
//
|
||||
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
|
||||
this.copyToolStripMenuItem.Text = "Copy";
|
||||
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
|
||||
//
|
||||
// stPanel4
|
||||
//
|
||||
this.stPanel4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
@ -435,102 +536,6 @@
|
||||
this.stPanel4.Size = new System.Drawing.Size(819, 438);
|
||||
this.stPanel4.TabIndex = 2;
|
||||
//
|
||||
// characterCodeCB
|
||||
//
|
||||
this.characterCodeCB.BorderColor = System.Drawing.Color.Empty;
|
||||
this.characterCodeCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
|
||||
this.characterCodeCB.ButtonColor = System.Drawing.Color.Empty;
|
||||
this.characterCodeCB.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.characterCodeCB.FormattingEnabled = true;
|
||||
this.characterCodeCB.Location = new System.Drawing.Point(103, 27);
|
||||
this.characterCodeCB.Name = "characterCodeCB";
|
||||
this.characterCodeCB.ReadOnly = true;
|
||||
this.characterCodeCB.Size = new System.Drawing.Size(72, 39);
|
||||
this.characterCodeCB.TabIndex = 2;
|
||||
//
|
||||
// stLabel14
|
||||
//
|
||||
this.stLabel14.AutoSize = true;
|
||||
this.stLabel14.Location = new System.Drawing.Point(13, 45);
|
||||
this.stLabel14.Name = "stLabel14";
|
||||
this.stLabel14.Size = new System.Drawing.Size(84, 13);
|
||||
this.stLabel14.TabIndex = 3;
|
||||
this.stLabel14.Text = "Character Code:";
|
||||
//
|
||||
// numericUpDownUint1
|
||||
//
|
||||
this.numericUpDownUint1.Location = new System.Drawing.Point(100, 118);
|
||||
this.numericUpDownUint1.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownUint1.Name = "numericUpDownUint1";
|
||||
this.numericUpDownUint1.Size = new System.Drawing.Size(97, 20);
|
||||
this.numericUpDownUint1.TabIndex = 21;
|
||||
//
|
||||
// stLabel15
|
||||
//
|
||||
this.stLabel15.AutoSize = true;
|
||||
this.stLabel15.Location = new System.Drawing.Point(13, 120);
|
||||
this.stLabel15.Name = "stLabel15";
|
||||
this.stLabel15.Size = new System.Drawing.Size(77, 13);
|
||||
this.stLabel15.TabIndex = 20;
|
||||
this.stLabel15.Text = "Texture Width:";
|
||||
//
|
||||
// numericUpDownUint2
|
||||
//
|
||||
this.numericUpDownUint2.Location = new System.Drawing.Point(100, 80);
|
||||
this.numericUpDownUint2.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownUint2.Name = "numericUpDownUint2";
|
||||
this.numericUpDownUint2.Size = new System.Drawing.Size(97, 20);
|
||||
this.numericUpDownUint2.TabIndex = 23;
|
||||
//
|
||||
// stLabel16
|
||||
//
|
||||
this.stLabel16.AutoSize = true;
|
||||
this.stLabel16.Location = new System.Drawing.Point(13, 82);
|
||||
this.stLabel16.Name = "stLabel16";
|
||||
this.stLabel16.Size = new System.Drawing.Size(73, 13);
|
||||
this.stLabel16.TabIndex = 22;
|
||||
this.stLabel16.Text = "Left Spacing::";
|
||||
//
|
||||
// numericUpDownUint3
|
||||
//
|
||||
this.numericUpDownUint3.Location = new System.Drawing.Point(100, 154);
|
||||
this.numericUpDownUint3.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownUint3.Name = "numericUpDownUint3";
|
||||
this.numericUpDownUint3.Size = new System.Drawing.Size(97, 20);
|
||||
this.numericUpDownUint3.TabIndex = 25;
|
||||
//
|
||||
// stLabel17
|
||||
//
|
||||
this.stLabel17.AutoSize = true;
|
||||
this.stLabel17.Location = new System.Drawing.Point(13, 156);
|
||||
this.stLabel17.Name = "stLabel17";
|
||||
this.stLabel17.Size = new System.Drawing.Size(79, 13);
|
||||
this.stLabel17.TabIndex = 24;
|
||||
this.stLabel17.Text = "Effictive Width:";
|
||||
//
|
||||
// imagePanel
|
||||
//
|
||||
this.imagePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.imagePanel.Location = new System.Drawing.Point(6, 33);
|
||||
this.imagePanel.Name = "imagePanel";
|
||||
this.imagePanel.Size = new System.Drawing.Size(400, 402);
|
||||
this.imagePanel.TabIndex = 2;
|
||||
this.imagePanel.Paint += new System.Windows.Forms.PaintEventHandler(this.imagePanel_Paint);
|
||||
//
|
||||
// BffntEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -549,13 +554,13 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.ascentUD)).EndInit();
|
||||
this.stPanel2.ResumeLayout(false);
|
||||
this.stPanel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint3)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint2)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint1)).EndInit();
|
||||
this.stPanel3.ResumeLayout(false);
|
||||
this.stPanel3.PerformLayout();
|
||||
this.imageMenuStrip.ResumeLayout(false);
|
||||
this.stPanel4.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint2)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownUint3)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -602,6 +607,6 @@
|
||||
private Toolbox.Library.Forms.STLabel stLabel16;
|
||||
private Toolbox.Library.Forms.NumericUpDownUint numericUpDownUint1;
|
||||
private Toolbox.Library.Forms.STLabel stLabel15;
|
||||
private Toolbox.Library.Forms.STPanel imagePanel;
|
||||
private Forms.ImagePaenl imagePanel;
|
||||
}
|
||||
}
|
@ -8,21 +8,43 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Toolbox.Library.Forms;
|
||||
using Toolbox.Library;
|
||||
|
||||
namespace FirstPlugin.Forms
|
||||
{
|
||||
public partial class BffntEditor : STUserControl
|
||||
public class ImagePaenl : STPanel
|
||||
{
|
||||
public ImagePaenl()
|
||||
{
|
||||
this.SetStyle(
|
||||
ControlStyles.AllPaintingInWmPaint |
|
||||
ControlStyles.UserPaint |
|
||||
ControlStyles.DoubleBuffer,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class BffntEditor : STUserControl, IFIleEditor
|
||||
{
|
||||
public BffntEditor()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
public List<IFileFormat> GetFileFormats()
|
||||
{
|
||||
return new List<IFileFormat>() { FileFormat };
|
||||
}
|
||||
|
||||
private Image PanelImage { get; set; }
|
||||
|
||||
private FFNT ActiveFile;
|
||||
private BFFNT FileFormat;
|
||||
|
||||
public void LoadFontFile(BFFNT fontFile)
|
||||
{
|
||||
FileFormat = fontFile;
|
||||
ActiveFile = fontFile.bffnt;
|
||||
|
||||
fontTypeCB.Bind(typeof(FINF.FontType), ActiveFile.FontSection, "Type");
|
||||
@ -79,7 +101,16 @@ namespace FirstPlugin.Forms
|
||||
{
|
||||
PanelImage = image.GetBitmap();
|
||||
}
|
||||
|
||||
if (PanelImage != null)
|
||||
{
|
||||
PanelImage.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
}
|
||||
|
||||
FillCells();
|
||||
}
|
||||
|
||||
imagePanel.Refresh();
|
||||
}
|
||||
|
||||
private void pictureBox1_Paint(object sender, PaintEventArgs e)
|
||||
@ -99,10 +130,15 @@ namespace FirstPlugin.Forms
|
||||
var image = ActiveFile.FontSection.TextureGlyph.GetImageSheet(ImageIndex);
|
||||
bool IsBntx = ActiveFile.FontSection.TextureGlyph.BinaryTextureFile != null;
|
||||
|
||||
if(IsBntx)
|
||||
image.ExportArrayImage(ImageIndex);
|
||||
var args = new STGenericTexture.ImageExportArguments()
|
||||
{
|
||||
FlipY = true,
|
||||
};
|
||||
|
||||
if (IsBntx)
|
||||
image.ExportArrayImage(ImageIndex, args);
|
||||
else
|
||||
image.ExportImage();
|
||||
image.ExportImage(args);
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,10 +152,105 @@ namespace FirstPlugin.Forms
|
||||
{
|
||||
Color = Color.Cyan;
|
||||
}
|
||||
|
||||
public bool IsHit(int X, int Y)
|
||||
{
|
||||
if (DrawnRectangle == null) return false;
|
||||
|
||||
if ((X > DrawnRectangle.X) && (X < DrawnRectangle.X + DrawnRectangle.Width) &&
|
||||
(Y > DrawnRectangle.Y) && (Y < DrawnRectangle.Y + DrawnRectangle.Height))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsSelected { get; private set; }
|
||||
|
||||
public void Select()
|
||||
{
|
||||
Color = Color.Blue;
|
||||
IsSelected = true;
|
||||
}
|
||||
|
||||
public void Unselect()
|
||||
{
|
||||
Color = Color.Cyan;
|
||||
IsSelected = false;
|
||||
}
|
||||
}
|
||||
|
||||
private FontCell[] FontCells;
|
||||
|
||||
private void LoadGlyphs()
|
||||
{
|
||||
var textureGlyph = ActiveFile.FontSection.TextureGlyph;
|
||||
|
||||
for (int c = 0; c < (int)textureGlyph.ColumnCount; c++)
|
||||
{
|
||||
for (int r = 0; r < (int)textureGlyph.RowCount; r++)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GlyphImage[] GlyphImages;
|
||||
|
||||
public class GlyphImage
|
||||
{
|
||||
public Image Image { get; set; }
|
||||
}
|
||||
|
||||
private void FillCells()
|
||||
{
|
||||
List<GlyphImage> images = new List<GlyphImage>();
|
||||
List<FontCell> Cells = new List<FontCell>();
|
||||
|
||||
var textureGlyph = ActiveFile.FontSection.TextureGlyph;
|
||||
var fontSection = ActiveFile.FontSection;
|
||||
|
||||
PanelImage = BitmapExtension.Resize(PanelImage, textureGlyph.SheetWidth, textureGlyph.SheetHeight);
|
||||
|
||||
Console.WriteLine($"ColumnCount {textureGlyph.ColumnCount}");
|
||||
Console.WriteLine($"RowCount {textureGlyph.RowCount}");
|
||||
|
||||
int y = 0;
|
||||
for (int c = 0; c < (int)textureGlyph.RowCount; c++)
|
||||
{
|
||||
int x = 0;
|
||||
for (int r = 0; r < (int)textureGlyph.ColumnCount; r++)
|
||||
{
|
||||
var rect = new Rectangle(x, y, textureGlyph.CellWidth, textureGlyph.CellHeight);
|
||||
|
||||
Cells.Add(new FontCell()
|
||||
{
|
||||
DrawnRectangle = rect,
|
||||
});
|
||||
|
||||
/* var glyphImage = new GlyphImage();
|
||||
glyphImage.Image = CopyRegionIntoImage(bitmap, rect);
|
||||
glyphImage.Image.Save($"Glpyh{c} {r}.png");
|
||||
images.Add(glyphImage);*/
|
||||
|
||||
|
||||
x += (int)textureGlyph.CellWidth;
|
||||
}
|
||||
y += (int)textureGlyph.CellHeight;
|
||||
}
|
||||
|
||||
GlyphImages = images.ToArray();
|
||||
FontCells = Cells.ToArray();
|
||||
}
|
||||
|
||||
private static Bitmap CopyRegionIntoImage(Image srcBitmap, Rectangle srcRegion)
|
||||
{
|
||||
Bitmap destBitmap = new Bitmap(srcRegion.Width, srcRegion.Height);
|
||||
using (Graphics grD = Graphics.FromImage(destBitmap))
|
||||
{
|
||||
grD.DrawImage(srcBitmap, new Rectangle(0,0,destBitmap.Width, destBitmap.Height), srcRegion, GraphicsUnit.Pixel);
|
||||
}
|
||||
return destBitmap;
|
||||
}
|
||||
|
||||
private void imagePanel_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
Graphics graphics = e.Graphics;
|
||||
@ -130,30 +261,20 @@ namespace FirstPlugin.Forms
|
||||
|
||||
var textureGlyph = ActiveFile.FontSection.TextureGlyph;
|
||||
|
||||
FontCells = new FontCell[textureGlyph.ColumnCount * textureGlyph.RowCount];
|
||||
if (FontCells == null)
|
||||
return;
|
||||
|
||||
int CellPosY = 0;
|
||||
for (int c = 0; c < (int)textureGlyph.ColumnCount; c++)
|
||||
{
|
||||
int CellPosX = 0;
|
||||
for (int r = 0; r < (int)textureGlyph.RowCount; r++)
|
||||
for (int i = 0; i < FontCells.Length; i++) {
|
||||
if (FontCells[i].IsSelected)
|
||||
{
|
||||
int Index = c + r;
|
||||
SolidBrush semiTransBrush = new SolidBrush(Color.FromArgb(70, 0, 255, 255));
|
||||
|
||||
FontCells[Index] = new FontCell();
|
||||
FontCells[Index].DrawnRectangle = new Rectangle()
|
||||
{
|
||||
X = CellPosX,
|
||||
Y = CellPosY,
|
||||
Width = (int)textureGlyph.CellWidth,
|
||||
Height = (int)textureGlyph.CellHeight,
|
||||
};
|
||||
|
||||
graphics.DrawRectangle(new Pen(FontCells[Index].Color), FontCells[Index].DrawnRectangle);
|
||||
CellPosX += (int)textureGlyph.CellWidth;
|
||||
graphics.DrawRectangle(new Pen(FontCells[i].Color, 1), FontCells[i].DrawnRectangle);
|
||||
graphics.FillRectangle(semiTransBrush, FontCells[i].DrawnRectangle);
|
||||
}
|
||||
CellPosY += (int)textureGlyph.CellHeight;
|
||||
}
|
||||
|
||||
graphics.ScaleTransform(textureGlyph.SheetWidth, textureGlyph.SheetHeight);
|
||||
}
|
||||
|
||||
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@ -161,5 +282,45 @@ namespace FirstPlugin.Forms
|
||||
if (PanelImage != null)
|
||||
Clipboard.SetImage(PanelImage);
|
||||
}
|
||||
|
||||
bool isMouseDown = false;
|
||||
private void imagePanel_MouseDown(object sender, MouseEventArgs e) {
|
||||
isMouseDown = true;
|
||||
}
|
||||
|
||||
private void imagePanel_MouseUp(object sender, MouseEventArgs e) {
|
||||
isMouseDown = false;
|
||||
}
|
||||
|
||||
private void imagePanel_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (FontCells != null)
|
||||
{
|
||||
for (int i = 0; i < FontCells.Length; i++)
|
||||
{
|
||||
if (FontCells[i] == null) continue;
|
||||
|
||||
if (FontCells[i].IsHit(e.X, e.Y))
|
||||
FontCells[i].Select();
|
||||
else
|
||||
FontCells[i].Unselect();
|
||||
}
|
||||
|
||||
imagePanel.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void imagePanel_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
isMouseDown = false;
|
||||
|
||||
if (FontCells != null)
|
||||
{
|
||||
for (int i = 0; i < FontCells.Length; i++)
|
||||
FontCells[i].Unselect();
|
||||
|
||||
imagePanel.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -666,7 +666,12 @@ namespace Toolbox.Library
|
||||
Export(FileName);
|
||||
}
|
||||
|
||||
public void ExportArrayImage(int ArrayIndex = 0)
|
||||
public class ImageExportArguments
|
||||
{
|
||||
public bool FlipY = false;
|
||||
}
|
||||
|
||||
public void ExportArrayImage(int ArrayIndex = 0, ImageExportArguments Arguments = null)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.FileName = Text;
|
||||
@ -675,11 +680,11 @@ namespace Toolbox.Library
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Export(sfd.FileName, true, false, ArrayIndex);
|
||||
Export(sfd.FileName, true, false, ArrayIndex, 0, Arguments);
|
||||
}
|
||||
}
|
||||
|
||||
public void ExportImage()
|
||||
public void ExportImage(ImageExportArguments Arguments = null)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.FileName = Text;
|
||||
@ -688,12 +693,12 @@ namespace Toolbox.Library
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Export(sfd.FileName);
|
||||
Export(sfd.FileName, false, false, 0,0, Arguments);
|
||||
}
|
||||
}
|
||||
|
||||
public void Export(string FileName, bool ExportSurfaceLevel = false,
|
||||
bool ExportMipMapLevel = false, int SurfaceLevel = 0, int MipLevel = 0)
|
||||
bool ExportMipMapLevel = false, int SurfaceLevel = 0, int MipLevel = 0, ImageExportArguments Arguments = null)
|
||||
{
|
||||
string ext = Path.GetExtension(FileName);
|
||||
ext = ext.ToLower();
|
||||
@ -701,18 +706,19 @@ namespace Toolbox.Library
|
||||
switch (ext)
|
||||
{
|
||||
case ".dds":
|
||||
SaveDDS(FileName, ExportSurfaceLevel, ExportMipMapLevel, SurfaceLevel, MipLevel);
|
||||
SaveDDS(FileName, ExportSurfaceLevel, ExportMipMapLevel, SurfaceLevel, MipLevel, Arguments);
|
||||
break;
|
||||
case ".astc":
|
||||
SaveASTC(FileName, ExportSurfaceLevel, ExportMipMapLevel, SurfaceLevel, MipLevel);
|
||||
SaveASTC(FileName, ExportSurfaceLevel, ExportMipMapLevel, SurfaceLevel, MipLevel, Arguments);
|
||||
break;
|
||||
default:
|
||||
SaveBitMap(FileName, ExportSurfaceLevel, ExportMipMapLevel, SurfaceLevel, MipLevel);
|
||||
SaveBitMap(FileName, ExportSurfaceLevel, ExportMipMapLevel, SurfaceLevel, MipLevel, Arguments);
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void SaveASTC(string FileName, bool ExportSurfaceLevel = false,
|
||||
bool ExportMipMapLevel = false, int SurfaceLevel = 0, int MipLevel = 0)
|
||||
bool ExportMipMapLevel = false, int SurfaceLevel = 0, int MipLevel = 0,
|
||||
ImageExportArguments Arguments = null)
|
||||
{
|
||||
List<Surface> surfaces = null;
|
||||
if (ExportSurfaceLevel)
|
||||
@ -731,12 +737,14 @@ namespace Toolbox.Library
|
||||
File.WriteAllBytes(FileName, atsc.Save());
|
||||
}
|
||||
public void SaveTGA(string FileName, bool ExportSurfaceLevel = false,
|
||||
bool ExportMipMapLevel = false, int SurfaceLevel = 0, int MipLevel = 0)
|
||||
bool ExportMipMapLevel = false, int SurfaceLevel = 0, int MipLevel = 0,
|
||||
ImageExportArguments Arguments = null)
|
||||
{
|
||||
|
||||
}
|
||||
public void SaveBitMap(string FileName, bool ExportSurfaceLevel = false,
|
||||
bool ExportMipMapLevel = false, int SurfaceLevel = 0, int MipLevel = 0)
|
||||
bool ExportMipMapLevel = false, int SurfaceLevel = 0, int MipLevel = 0,
|
||||
ImageExportArguments Arguments = null)
|
||||
{
|
||||
STProgressBar progressBar = new STProgressBar();
|
||||
progressBar.Task = "Exporting Image Data...";
|
||||
@ -785,6 +793,10 @@ namespace Toolbox.Library
|
||||
{
|
||||
BitmapExtension.SetChannel(bitMap, RedChannel, GreenChannel, BlueChannel, AlphaChannel);
|
||||
}
|
||||
|
||||
if (Arguments != null && Arguments.FlipY)
|
||||
bitMap.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
|
||||
bitMap.Save(FileName);
|
||||
bitMap.Dispose();
|
||||
|
||||
@ -792,7 +804,8 @@ namespace Toolbox.Library
|
||||
progressBar.Close();
|
||||
}
|
||||
public void SaveDDS(string FileName, bool ExportSurfaceLevel = false,
|
||||
bool ExportMipMapLevel = false, int SurfaceLevel = 0, int MipLevel = 0)
|
||||
bool ExportMipMapLevel = false, int SurfaceLevel = 0, int MipLevel = 0,
|
||||
ImageExportArguments Arguments = null)
|
||||
{
|
||||
List<Surface> surfaces = null;
|
||||
if (ExportSurfaceLevel)
|
||||
|
@ -39,9 +39,8 @@
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AssimpNet, Version=3.3.2.0, Culture=neutral, PublicKeyToken=3edc10cb77b1bca2, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AssimpNet.3.3.2\lib\net45\AssimpNet.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
<Reference Include="AssimpNet, Version=4.1.0.0, Culture=neutral, PublicKeyToken=0d51b391f59f42a6, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AssimpNet.4.1.0\lib\net40\AssimpNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Be.Windows.Forms.HexBox">
|
||||
<HintPath>..\Toolbox\Lib\Be.Windows.Forms.HexBox.dll</HintPath>
|
||||
@ -1216,13 +1215,13 @@
|
||||
<None Include="Resources\MetaInfo.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\AssimpNet.3.3.2\build\AssimpNet.targets" Condition="Exists('..\packages\AssimpNet.3.3.2\build\AssimpNet.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\AssimpNet.3.3.2\build\AssimpNet.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\AssimpNet.3.3.2\build\AssimpNet.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\DirectXTexNet.1.0.0-rc3\build\DirectXTexNet.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\DirectXTexNet.1.0.0-rc3\build\DirectXTexNet.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\AssimpNet.4.1.0\build\AssimpNet.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\AssimpNet.4.1.0\build\AssimpNet.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\DirectXTexNet.1.0.0-rc3\build\DirectXTexNet.targets" Condition="Exists('..\packages\DirectXTexNet.1.0.0-rc3\build\DirectXTexNet.targets')" />
|
||||
<Import Project="..\packages\AssimpNet.4.1.0\build\AssimpNet.targets" Condition="Exists('..\packages\AssimpNet.4.1.0\build\AssimpNet.targets')" />
|
||||
</Project>
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AssimpNet" version="3.3.2" targetFramework="net462" />
|
||||
<package id="AssimpNet" version="4.1.0" targetFramework="net462" />
|
||||
<package id="CsvHelper" version="8.0.0-beta01" targetFramework="net462" />
|
||||
<package id="DirectXTexNet" version="1.0.0-rc3" targetFramework="net462" />
|
||||
<package id="IonKiwi.lz4.net" version="1.0.11" targetFramework="net462" />
|
||||
|
@ -48,9 +48,6 @@
|
||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AssimpNet, Version=3.3.2.0, Culture=neutral, PublicKeyToken=3edc10cb77b1bca2, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AssimpNet.3.3.2\lib\net45\AssimpNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Octokit, Version=0.31.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
@ -168,7 +165,6 @@
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\app.manifest" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
@ -525,11 +521,4 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\AssimpNet.3.3.2\build\AssimpNet.targets" Condition="Exists('..\packages\AssimpNet.3.3.2\build\AssimpNet.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\AssimpNet.3.3.2\build\AssimpNet.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\AssimpNet.3.3.2\build\AssimpNet.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AssimpNet" version="3.3.2" targetFramework="net462" />
|
||||
</packages>
|
Binary file not shown.
BIN
packages/AssimpNet.3.3.2/AssimpNet.3.3.2.nupkg
vendored
BIN
packages/AssimpNet.3.3.2/AssimpNet.3.3.2.nupkg
vendored
Binary file not shown.
15
packages/AssimpNet.3.3.2/build/AssimpNet.targets
vendored
15
packages/AssimpNet.3.3.2/build/AssimpNet.targets
vendored
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Target Name="CopyNativeAssimp" AfterTargets="BeforeBuild">
|
||||
<ItemGroup>
|
||||
<NativeAssimpLibs Include="$(MSBuildThisFileDirectory)\native\win-x86\Assimp32.dll;
|
||||
$(MSBuildThisFileDirectory)\native\win-x64\Assimp64.dll;"/>
|
||||
</ItemGroup>
|
||||
<Message Text="Copying native Assimp libraries..." Importance="high" />
|
||||
<Copy SourceFiles="@(NativeAssimpLibs)" DestinationFolder="$(OutputPath)" />
|
||||
</Target>
|
||||
<Target Name="CleanAssimp" AfterTargets="Clean">
|
||||
<Message Text="Cleaning native Assimp libraries..." Importance="high" />
|
||||
<Delete Files="$(TargetDir)Assimp32.dll; $(TargetDir)Assimp64.dll" />
|
||||
</Target>
|
||||
</Project>
|
Binary file not shown.
Binary file not shown.
BIN
packages/AssimpNet.3.3.2/lib/net20/AssimpNet.dll
vendored
BIN
packages/AssimpNet.3.3.2/lib/net20/AssimpNet.dll
vendored
Binary file not shown.
BIN
packages/AssimpNet.3.3.2/lib/net45/AssimpNet.dll
vendored
BIN
packages/AssimpNet.3.3.2/lib/net45/AssimpNet.dll
vendored
Binary file not shown.
BIN
packages/AssimpNet.4.1.0/.signature.p7s
vendored
Normal file
BIN
packages/AssimpNet.4.1.0/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
packages/AssimpNet.4.1.0/AssimpNet Documentation (October 2018).chm
vendored
Normal file
BIN
packages/AssimpNet.4.1.0/AssimpNet Documentation (October 2018).chm
vendored
Normal file
Binary file not shown.
BIN
packages/AssimpNet.4.1.0/AssimpNet.4.1.0.nupkg
vendored
Normal file
BIN
packages/AssimpNet.4.1.0/AssimpNet.4.1.0.nupkg
vendored
Normal file
Binary file not shown.
@ -2,6 +2,51 @@
|
||||
CHANGELOG
|
||||
----------------------------------------------------------------------
|
||||
|
||||
4.1.0 (10-28-2018)
|
||||
|
||||
- Updated to target .Net Standard 1.3 (additional .Net 3.5 and .Net 4 targets)
|
||||
- Removed old IL patcher to use new MemoryInterop.ILPatcher build time dependency (allows us to build cross-platform)
|
||||
- Rewrote Sample application to be a .Net Core app that uses the Veldrid low-level graphics library for rendering
|
||||
- Added x64 linux native binary, x64 macOS native binary
|
||||
- Tested on Ubuntu 18.04 and MacOS 10.13 (High Sierra)
|
||||
- Several fixes and updates to target latest Assimp release
|
||||
- Ported over "UnmanagedLibrary" abstract code and refactored AssimpLibrary
|
||||
- Added "ThrowOnLoadFailure" to configure getting back a "false" if native library fails to load or throw an exception (the default). Mono should no longer
|
||||
throw a "NotImplemented" exception because of trying to get the error code from windows.
|
||||
- !!Breaking Change!! Native DLLs are deployed differently and resolved at runtime differently
|
||||
- Removed "DefaultLibraryPathXXBit" properties from AssimpLibrary, they are meaningless now (and probably not used)
|
||||
- Introduced "UnmanagedLibraryResolver" that lets you set the following to completely configure native DLL loading:
|
||||
1. Multiple probing paths
|
||||
2. Multiple fallback library names (e.g. versioned binaries)
|
||||
3. Override name if the default native library name is not good enough for your tastes.
|
||||
- Search order of the native DLL is as follows:
|
||||
1. Search user-specified probing paths
|
||||
2. Search {AppBaseDirectory}/runtimes/{RID}/native/
|
||||
3. Search {AppBaseDirectory}/
|
||||
4. Search nuget cache based on assembly name/informational version ({UserProfile}/.nuget/packages/AssimpNet/{PackageVersion}/runtimes/{RID}/native/)
|
||||
5. If all above failed, return the given name of the DLL (or override name) and let the OS try and find it (different OS' may have different strategies).
|
||||
- The resolver is only used in AssimpLibrary.LoadLibrary(). The other two overloads still take in a user-supplied path/to/your/DLL.
|
||||
- Native DLLs are now deployed in the "runtimes" folder of the nuget package. This means they are now picked up as dependencies by netcore (*.deps.json)
|
||||
and automatically get copied during the "dotnet publish" command. During development, the system will try and locate the native DLLs in the nuget cache
|
||||
(.net framework 3.5/4.0 targets still use the MSBuild targets file to copy the runtime folder to the output folder). The folder structure looks like this:
|
||||
- runtimes/win-x64/native/assimp.dll
|
||||
- runtimes/win-x86/native/assimp.dll
|
||||
- runtimes/osx-x64/native/libassimp.dylib
|
||||
- runtimes/linux-x64/native/libassimp.so
|
||||
- All native binaries are named "assimp" or "libassimp" depending on platform, since we're putting them in "well known" architecture folders, no need to have unique names
|
||||
- [Source Only] Added a Unity script that will make it easier for users to load the native DLLs when running in Editor/Standalone Unity 3D
|
||||
- Build outputs a folder called "UnityPlugin" which you can drag and drop into the Unity Editor. A package will be available in the Asset Store as well.
|
||||
|
||||
|
||||
Targets Assimp 4.1.0
|
||||
|
||||
|
||||
|
||||
======================================================================
|
||||
|
||||
|
||||
|
||||
|
||||
3.3.2 (12-26-2016)
|
||||
|
||||
- Fixed up nuget package build targets.
|
@ -1,5 +1,5 @@
|
||||
|
||||
Copyright (c) 2012-2017 AssimpNet - Nicholas Woodfield
|
||||
Copyright (c) 2012-2018 AssimpNet - Nicholas Woodfield
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@ -24,7 +24,7 @@ THE SOFTWARE.
|
||||
Open Asset Import Library (Assimp)
|
||||
|
||||
|
||||
Copyright (c) 2006-2014, Assimp Development Team
|
||||
Copyright (c) 2006-2018, Assimp Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
24
packages/AssimpNet.4.1.0/build/AssimpNet.targets
vendored
Normal file
24
packages/AssimpNet.4.1.0/build/AssimpNet.targets
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<!-- Copy/clean native dependencies only for projects that don't output a *.deps.json file (netframework projects). Netcore projects will
|
||||
copy out the native dependencies during publish, and during development debugging/running, the binaries will be loaded from the nuget cache.
|
||||
Optionally, the property $(ForceCopyNativeAssimp) can be set to true to always run these targets. -->
|
||||
|
||||
<Target Name="CopyNativeAssimp" AfterTargets="AfterBuild" Condition="'$(ForceCopyNativeAssimp)' == 'true' OR !Exists('$(TargetDir)$(AssemblyName).deps.json')">
|
||||
<ItemGroup>
|
||||
<NativeAssimpLibs Include="$(MSBuildThisFileDirectory)..\runtimes\**\*.*"/>
|
||||
</ItemGroup>
|
||||
<Message Text="Copying native Assimp libraries..." Importance="high" />
|
||||
<Message Text="$(TargetDir)$(AssemblyName).deps.json" Importance="high" />
|
||||
<Copy SourceFiles="@(NativeAssimpLibs)" DestinationFolder="$(OutputPath)\runtimes\%(RecursiveDir)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="CleanNativeAssimp" BeforeTargets="BeforeClean" Condition="'$(ForceCopyNativeAssimp)' == 'true' OR !Exists('$(TargetDir)$(AssemblyName).deps.json')">
|
||||
<Message Text="Cleaning native Assimp libraries..." Importance="high" />
|
||||
<ItemGroup>
|
||||
<NativeAssimpLibsToDelete Include="$(TargetDir)runtimes\**\*assimp*.*;" />
|
||||
</ItemGroup>
|
||||
<Delete Files="@(NativeAssimpLibsToDelete)" />
|
||||
</Target>
|
||||
</Project>
|
BIN
packages/AssimpNet.4.1.0/lib/net35/AssimpNet.dll
vendored
Normal file
BIN
packages/AssimpNet.4.1.0/lib/net35/AssimpNet.dll
vendored
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
packages/AssimpNet.4.1.0/lib/net40/AssimpNet.dll
vendored
Normal file
BIN
packages/AssimpNet.4.1.0/lib/net40/AssimpNet.dll
vendored
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
packages/AssimpNet.4.1.0/lib/netstandard1.3/AssimpNet.dll
vendored
Normal file
BIN
packages/AssimpNet.4.1.0/lib/netstandard1.3/AssimpNet.dll
vendored
Normal file
Binary file not shown.
11454
packages/AssimpNet.4.1.0/lib/netstandard1.3/AssimpNet.xml
vendored
Normal file
11454
packages/AssimpNet.4.1.0/lib/netstandard1.3/AssimpNet.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/AssimpNet.4.1.0/runtimes/linux-x64/native/libassimp.so
vendored
Normal file
BIN
packages/AssimpNet.4.1.0/runtimes/linux-x64/native/libassimp.so
vendored
Normal file
Binary file not shown.
BIN
packages/AssimpNet.4.1.0/runtimes/osx-x64/native/libassimp.dylib
vendored
Normal file
BIN
packages/AssimpNet.4.1.0/runtimes/osx-x64/native/libassimp.dylib
vendored
Normal file
Binary file not shown.
BIN
packages/AssimpNet.4.1.0/runtimes/win-x64/native/assimp.dll
vendored
Normal file
BIN
packages/AssimpNet.4.1.0/runtimes/win-x64/native/assimp.dll
vendored
Normal file
Binary file not shown.
BIN
packages/AssimpNet.4.1.0/runtimes/win-x86/native/assimp.dll
vendored
Normal file
BIN
packages/AssimpNet.4.1.0/runtimes/win-x86/native/assimp.dll
vendored
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user