Bflyt loading fixes
This commit is contained in:
parent
6fdafddfdc
commit
f8d8d0ea30
@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.InteropServices;
|
||||
using Toolbox;
|
||||
using System.Windows.Forms;
|
||||
using Toolbox.Library;
|
||||
@ -101,15 +101,24 @@ namespace FirstPlugin
|
||||
|
||||
public override void OnClick(TreeView treeview)
|
||||
{
|
||||
HexEditor editor = (HexEditor)LibraryGUI.GetActiveContent(typeof(HexEditor));
|
||||
if (editor == null)
|
||||
{
|
||||
editor = new HexEditor();
|
||||
LibraryGUI.LoadEditor(editor);
|
||||
}
|
||||
System.Drawing.Text.PrivateFontCollection privateFonts = new System.Drawing.Text.PrivateFontCollection();
|
||||
|
||||
var fontDataPtr = Marshal.AllocCoTaskMem(DecryptedFont.Length);
|
||||
Marshal.Copy(DecryptedFont, 0, fontDataPtr, DecryptedFont.Length);
|
||||
privateFonts.AddMemoryFont(fontDataPtr, DecryptedFont.Length);
|
||||
|
||||
System.Drawing.Font font = new System.Drawing.Font(privateFonts.Families[0], 12);
|
||||
|
||||
var texbox = new STTextBox() { Multiline = true, Dock = DockStyle.Fill };
|
||||
|
||||
UserControl editor = new UserControl();
|
||||
editor.Controls.Add(texbox);
|
||||
LibraryGUI.LoadEditor(editor);
|
||||
|
||||
editor.Text = Text;
|
||||
editor.Dock = DockStyle.Fill;
|
||||
editor.LoadData(DecryptedFont);
|
||||
editor.Font = font;
|
||||
texbox.Text = "Preview Text!";
|
||||
}
|
||||
|
||||
private static UInt32 GetUInt32(byte[] data, int pos)
|
||||
|
@ -193,6 +193,57 @@ namespace LayoutBXLYT
|
||||
BxlytToGL.DrawRectangle(pane.Rectangle, TexCoords, Colors, false, effectiveAlpha);
|
||||
}
|
||||
|
||||
|
||||
public static void DrawAlignmentPane(BasePane pane, byte effectiveAlpha, List<BasePane> SelectedPanes)
|
||||
{
|
||||
Vector2[] TexCoords = new Vector2[] {
|
||||
new Vector2(1,1),
|
||||
new Vector2(0,1),
|
||||
new Vector2(0,0),
|
||||
new Vector2(1,0)
|
||||
};
|
||||
|
||||
Color color = Color.Orange;
|
||||
if (SelectedPanes.Contains(pane))
|
||||
color = Color.Red;
|
||||
|
||||
color = Color.FromArgb(70, color);
|
||||
|
||||
Color[] Colors = new Color[] {
|
||||
color,
|
||||
color,
|
||||
color,
|
||||
color,
|
||||
};
|
||||
|
||||
BxlytToGL.DrawRectangle(pane.Rectangle, TexCoords, Colors, false, effectiveAlpha);
|
||||
}
|
||||
|
||||
public static void DrawScissorPane(BasePane pane, byte effectiveAlpha, List<BasePane> SelectedPanes)
|
||||
{
|
||||
Vector2[] TexCoords = new Vector2[] {
|
||||
new Vector2(1,1),
|
||||
new Vector2(0,1),
|
||||
new Vector2(0,0),
|
||||
new Vector2(1,0)
|
||||
};
|
||||
|
||||
Color color = Color.Yellow;
|
||||
if (SelectedPanes.Contains(pane))
|
||||
color = Color.Red;
|
||||
|
||||
color = Color.FromArgb(70, color);
|
||||
|
||||
Color[] Colors = new Color[] {
|
||||
color,
|
||||
color,
|
||||
color,
|
||||
color,
|
||||
};
|
||||
|
||||
BxlytToGL.DrawRectangle(pane.Rectangle, TexCoords, Colors, false, effectiveAlpha);
|
||||
}
|
||||
|
||||
public static void DrawWindowPane(BasePane pane, byte effectiveAlpha, Dictionary<string, STGenericTexture> Textures)
|
||||
{
|
||||
uint sizeX = (uint)pane.Width;
|
||||
@ -332,9 +383,26 @@ namespace LayoutBXLYT
|
||||
GL.PopMatrix();
|
||||
}
|
||||
}
|
||||
else if (window.FrameCount == 4)
|
||||
else if (window.FrameCount == 4) //4 corners with specific texture mapping
|
||||
{
|
||||
// _________
|
||||
//|______| |
|
||||
//| | | |
|
||||
//| |___|__|
|
||||
//|__|______|
|
||||
|
||||
var frame1 = window.WindowFrames[0];
|
||||
var frame2 = window.WindowFrames[0];
|
||||
var frame3 = window.WindowFrames[0];
|
||||
var frame4 = window.WindowFrames[0];
|
||||
|
||||
uint contentWidth = sizeX - (uint)window.FrameElementRight - (uint)window.FrameElementLeft;
|
||||
uint contentHeight = sizeY - (uint)window.FrameElementTop - (uint)window.FrameElementBottm;
|
||||
|
||||
RenderWindowContent(pane,
|
||||
contentWidth,
|
||||
contentHeight,
|
||||
window.Content, effectiveAlpha, Textures);
|
||||
}
|
||||
break;
|
||||
case WindowKind.Horizontal:
|
||||
@ -404,19 +472,19 @@ namespace LayoutBXLYT
|
||||
};
|
||||
|
||||
Color[] colors = new Color[] {
|
||||
content.ColorTopLeft.Color,
|
||||
content.ColorTopRight.Color,
|
||||
content.ColorBottomRight.Color,
|
||||
content.ColorBottomLeft.Color,
|
||||
content.ColorBottomRight.Color,
|
||||
content.ColorTopRight.Color,
|
||||
content.ColorTopLeft.Color,
|
||||
};
|
||||
|
||||
if (content.TexCoords.Count > 0)
|
||||
{
|
||||
texCoords = new Vector2[] {
|
||||
content.TexCoords[0].TopLeft.ToTKVector2(),
|
||||
content.TexCoords[0].TopRight.ToTKVector2(),
|
||||
content.TexCoords[0].BottomRight.ToTKVector2(),
|
||||
content.TexCoords[0].BottomLeft.ToTKVector2(),
|
||||
content.TexCoords[0].BottomRight.ToTKVector2(),
|
||||
content.TexCoords[0].TopRight.ToTKVector2(),
|
||||
content.TexCoords[0].TopLeft.ToTKVector2(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,6 @@ namespace LayoutBXLYT.Cafe
|
||||
|
||||
public Dictionary<string, STGenericTexture> GetTextures()
|
||||
{
|
||||
BFLIM test = new BFLIM();
|
||||
Dictionary<string, STGenericTexture> textures = new Dictionary<string, STGenericTexture>();
|
||||
|
||||
if (File.Exists(FilePath))
|
||||
@ -225,7 +224,7 @@ namespace LayoutBXLYT.Cafe
|
||||
if (!textures.ContainsKey(tex.Key))
|
||||
textures.Add(tex.Key, tex.Value);
|
||||
}
|
||||
else if (test.Identify(new MemoryStream(file.FileData)))
|
||||
if (Utils.GetExtension(file.FileName) == ".bflim")
|
||||
{
|
||||
BFLIM bflim = (BFLIM)file.OpenFile();
|
||||
file.FileFormat = bflim;
|
||||
@ -464,6 +463,20 @@ namespace LayoutBXLYT.Cafe
|
||||
SetPane(windowPanel, parentPane);
|
||||
currentPane = windowPanel;
|
||||
break;
|
||||
case "scr1":
|
||||
var scissorPane = new SCR1(reader, this);
|
||||
AddPaneToTable(scissorPane);
|
||||
|
||||
SetPane(scissorPane, parentPane);
|
||||
currentPane = scissorPane;
|
||||
break;
|
||||
case "ali1":
|
||||
var alignmentPane = new ALI1(reader, this);
|
||||
AddPaneToTable(alignmentPane);
|
||||
|
||||
SetPane(alignmentPane, parentPane);
|
||||
currentPane = alignmentPane;
|
||||
break;
|
||||
case "pas1":
|
||||
if (currentPane != null)
|
||||
parentPane = currentPane;
|
||||
@ -1054,6 +1067,46 @@ namespace LayoutBXLYT.Cafe
|
||||
}
|
||||
}
|
||||
|
||||
public class ALI1 : PAN1
|
||||
{
|
||||
public override string Signature { get; } = "ali1";
|
||||
|
||||
public ALI1() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ALI1(FileReader reader, Header header) : base(reader)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
base.Write(writer, header);
|
||||
}
|
||||
}
|
||||
|
||||
public class SCR1 : PAN1
|
||||
{
|
||||
public override string Signature { get; } = "scr1";
|
||||
|
||||
public SCR1() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SCR1(FileReader reader, Header header) : base(reader)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, LayoutHeader header)
|
||||
{
|
||||
base.Write(writer, header);
|
||||
}
|
||||
}
|
||||
|
||||
public class BND1 : PAN1
|
||||
{
|
||||
public override string Signature { get; } = "bnd1";
|
||||
|
@ -28,7 +28,7 @@ namespace LayoutBXLYT
|
||||
SetInt("hasTexture0", 0);
|
||||
SetInt("numTextureMaps", 0);
|
||||
SetInt("flipTexture", 0);
|
||||
|
||||
|
||||
SetVec2("uvScale0", new Vector2(1,1));
|
||||
SetFloat("uvRotate0", 0);
|
||||
SetVec2("uvTranslate0", new Vector2(0, 0));
|
||||
@ -45,8 +45,6 @@ namespace LayoutBXLYT
|
||||
SetVec2("uvTranslate0", new Vector2(0, 0));
|
||||
SetInt("flipTexture", 0);
|
||||
|
||||
Console.WriteLine("debugShading " + (int)Runtime.LayoutEditor.Shading);
|
||||
|
||||
BindTextureUniforms();
|
||||
|
||||
string textureMap0 = "";
|
||||
|
@ -5,13 +5,15 @@ using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Toolbox.Library
|
||||
{
|
||||
public partial class STProgressBar : Form
|
||||
{
|
||||
private Thread Thread;
|
||||
|
||||
public STProgressBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -26,9 +28,10 @@ namespace Toolbox.Library
|
||||
else
|
||||
progressBar1.Value = value;
|
||||
|
||||
progressBar1.Refresh();
|
||||
|
||||
if (value >= 100)
|
||||
Close();
|
||||
progressBar1.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,9 +62,26 @@ namespace Toolbox.Library
|
||||
}
|
||||
}
|
||||
|
||||
private void ProgressBar_FormClosed(object sender, FormClosedEventArgs e)
|
||||
/// <summary>
|
||||
/// Runs an action on another thread. Runs unless the user cancels it or finishes
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
public void RunAction(Action action)
|
||||
{
|
||||
Thread = new Thread(
|
||||
() =>
|
||||
{
|
||||
try { action();}
|
||||
finally
|
||||
{
|
||||
Value = 100;
|
||||
}
|
||||
}) { IsBackground = true };
|
||||
Thread.Start();
|
||||
}
|
||||
|
||||
private void ProgressBar_FormClosed(object sender, FormClosedEventArgs e) {
|
||||
Thread?.Abort();
|
||||
}
|
||||
|
||||
private void ProgressBarWindow_Load(object sender, EventArgs e)
|
@ -768,10 +768,10 @@
|
||||
<Compile Include="Forms\Editors\AssimpMeshSelector.Designer.cs">
|
||||
<DependentUpon>AssimpMeshSelector.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Custom\STProgressBar.cs">
|
||||
<Compile Include="Forms\Custom\ProgressBar\STProgressBar.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Custom\STProgressBar.Designer.cs">
|
||||
<Compile Include="Forms\Custom\ProgressBar\STProgressBar.Designer.cs">
|
||||
<DependentUpon>STProgressBar.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Imaging.cs" />
|
||||
@ -989,7 +989,7 @@
|
||||
<EmbeddedResource Include="Forms\Editors\ObjectList.resx">
|
||||
<DependentUpon>ObjectList.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Custom\STProgressBar.resx">
|
||||
<EmbeddedResource Include="Forms\Custom\ProgressBar\STProgressBar.resx">
|
||||
<DependentUpon>STProgressBar.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Dialogs\RenameDialog.resx">
|
||||
|
Loading…
Reference in New Issue
Block a user