Fix batch replacing for bntx
This commit is contained in:
parent
711889ad26
commit
1ded215e52
@ -1043,15 +1043,22 @@ namespace LayoutBXLYT.Cafe
|
||||
|
||||
}
|
||||
|
||||
[DisplayName("Magnify X"), CategoryAttribute("Parts")]
|
||||
public float MagnifyX { get; set; }
|
||||
|
||||
[DisplayName("Magnify Y"), CategoryAttribute("Parts")]
|
||||
public float MagnifyY { get; set; }
|
||||
|
||||
public List<PartProperty> Properties = new List<PartProperty>();
|
||||
[DisplayName("Properties"), CategoryAttribute("Parts")]
|
||||
public List<PartProperty> Properties { get; set; }
|
||||
|
||||
private string PropertyName;
|
||||
[DisplayName("External Layout File"), CategoryAttribute("Parts")]
|
||||
public string LayoutFile { get; set; }
|
||||
|
||||
public PRT1(FileReader reader, Header header) : base(reader)
|
||||
{
|
||||
Properties = new List<PartProperty>();
|
||||
|
||||
StartPosition = reader.Position - 84;
|
||||
|
||||
uint properyCount = reader.ReadUInt32();
|
||||
@ -1060,7 +1067,7 @@ namespace LayoutBXLYT.Cafe
|
||||
for (int i = 0; i < properyCount; i++)
|
||||
Properties.Add(new PartProperty(reader, header, StartPosition));
|
||||
|
||||
PropertyName = reader.ReadZeroTerminatedString();
|
||||
LayoutFile = reader.ReadZeroTerminatedString();
|
||||
}
|
||||
|
||||
public override void Write(FileWriter writer, BxlytHeader header)
|
||||
@ -1074,7 +1081,7 @@ namespace LayoutBXLYT.Cafe
|
||||
for (int i = 0; i < Properties.Count; i++)
|
||||
Properties[i].Write(writer, header, startPos);
|
||||
|
||||
writer.WriteString(PropertyName);
|
||||
writer.WriteString(LayoutFile);
|
||||
writer.Align(4);
|
||||
|
||||
for (int i = 0; i < Properties.Count; i++)
|
||||
|
@ -72,6 +72,21 @@ namespace LayoutBXLYT
|
||||
ParentOriginY = OriginY.Center;
|
||||
}
|
||||
|
||||
private CustomRectangle rectangle;
|
||||
public CustomRectangle Rectangle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (rectangle == null)
|
||||
UpdateRectangle();
|
||||
return rectangle;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateRectangle() {
|
||||
rectangle = CreateRectangle();
|
||||
}
|
||||
|
||||
public CustomRectangle CreateRectangle()
|
||||
{
|
||||
//Do origin transforms
|
||||
@ -123,6 +138,15 @@ namespace LayoutBXLYT
|
||||
|
||||
return new Vector4(left, right, top, bottom);
|
||||
}
|
||||
|
||||
public bool IsHit(int X, int Y)
|
||||
{
|
||||
if ((X > Rectangle.X) && (X < Rectangle.X + Rectangle.Width) &&
|
||||
(Y > Rectangle.Y) && (Y < Rectangle.Y + Rectangle.Height))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public enum OriginX : byte
|
||||
@ -237,6 +261,26 @@ namespace LayoutBXLYT
|
||||
TopPoint = top;
|
||||
BottomPoint = bottom;
|
||||
}
|
||||
|
||||
public float X
|
||||
{
|
||||
get { return Width / 2; }
|
||||
}
|
||||
|
||||
public float Y
|
||||
{
|
||||
get { return Height / 2; }
|
||||
}
|
||||
|
||||
public float Width
|
||||
{
|
||||
get { return LeftPoint - RightPoint; }
|
||||
}
|
||||
|
||||
public float Height
|
||||
{
|
||||
get { return TopPoint - BottomPoint; }
|
||||
}
|
||||
}
|
||||
|
||||
public class LayoutDocked : DockContent
|
||||
|
@ -875,9 +875,7 @@ namespace FirstPlugin
|
||||
|
||||
string FileName = System.IO.Path.GetFileNameWithoutExtension(file);
|
||||
|
||||
string ext = Utils.GetExtension(FileName);
|
||||
|
||||
Console.WriteLine(ext);
|
||||
string ext = Utils.GetExtension(file);
|
||||
|
||||
foreach (TextureData node in Textures.Values)
|
||||
{
|
||||
@ -888,16 +886,17 @@ namespace FirstPlugin
|
||||
switch (ext)
|
||||
{
|
||||
case ".bftex":
|
||||
node.Texture.Import(FileName);
|
||||
node.Texture.Import(file);
|
||||
node.Texture.Name = Text;
|
||||
node.LoadOpenGLTexture();
|
||||
break;
|
||||
case ".dds":
|
||||
setting.LoadDDS(FileName, null, node);
|
||||
case ".dds2":
|
||||
setting.LoadDDS(file, null, node);
|
||||
node.ApplyImportSettings(setting, STCompressionMode.Normal);
|
||||
break;
|
||||
case ".astc":
|
||||
setting.LoadASTC(FileName);
|
||||
setting.LoadASTC(file);
|
||||
node.ApplyImportSettings(setting, STCompressionMode.Normal);
|
||||
break;
|
||||
case ".png":
|
||||
@ -907,7 +906,7 @@ namespace FirstPlugin
|
||||
case ".jpg":
|
||||
case ".jpeg":
|
||||
TexturesForImportSettings.Add(node);
|
||||
setting.LoadBitMap(FileName);
|
||||
setting.LoadBitMap(file);
|
||||
importer.LoadSetting(setting);
|
||||
if (!STGenericTexture.IsAtscFormat(DefaultFormat))
|
||||
setting.Format = TextureData.GenericToBntxSurfaceFormat(DefaultFormat);
|
||||
|
@ -101,6 +101,7 @@ namespace LayoutBXLYT
|
||||
GL.Enable(EnableCap.Blend);
|
||||
GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
|
||||
|
||||
GL.Enable(EnableCap.ColorMaterial);
|
||||
GL.Enable(EnableCap.Texture2D);
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
|
||||
@ -564,22 +565,56 @@ namespace LayoutBXLYT
|
||||
}
|
||||
|
||||
private bool mouseHeldDown = false;
|
||||
private bool isPicked = false;
|
||||
private Point originMouse;
|
||||
private void glControl1_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
//Pick an object for moving
|
||||
if (Control.ModifierKeys == Keys.Alt && e.Button == MouseButtons.Left)
|
||||
{
|
||||
var hitPane = SearchHit(LayoutFile.RootPane, e.X, e.Y);
|
||||
if (hitPane != null)
|
||||
{
|
||||
SelectedPanes.Add(hitPane);
|
||||
UpdateViewport();
|
||||
|
||||
isPicked = true;
|
||||
}
|
||||
}
|
||||
else if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
mouseHeldDown = true;
|
||||
originMouse = e.Location;
|
||||
|
||||
var hitPane = SearchHit(LayoutFile.RootPane, e.X, e.Y);
|
||||
Console.WriteLine($"Has Hit " + hitPane != null);
|
||||
if (hitPane != null)
|
||||
{
|
||||
SelectedPanes.Add(hitPane);
|
||||
UpdateViewport();
|
||||
}
|
||||
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private BasePane SearchHit(BasePane pane, int X, int Y)
|
||||
{
|
||||
if (pane.IsHit(X, Y))
|
||||
return pane;
|
||||
|
||||
foreach (var childPane in pane.Childern)
|
||||
return SearchHit(childPane, X, Y);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void glControl1_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
mouseHeldDown = false;
|
||||
isPicked = false;
|
||||
glControl1.Invalidate();
|
||||
}
|
||||
}
|
||||
|
@ -170,6 +170,9 @@ namespace Toolbox.Library.Forms
|
||||
|
||||
public void FillEditor(string Text)
|
||||
{
|
||||
if (scintilla1 == null || scintilla1.IsDisposed || scintilla1.Disposing)
|
||||
return;
|
||||
|
||||
InitSyntaxColoring();
|
||||
|
||||
scintilla1.Text = Text;
|
||||
@ -186,9 +189,6 @@ namespace Toolbox.Library.Forms
|
||||
}
|
||||
|
||||
private void InitSyntaxColoring() {
|
||||
if (scintilla1 == null || scintilla1.IsDisposed || scintilla1.Disposing)
|
||||
return;
|
||||
|
||||
scintilla1.StyleResetDefault();
|
||||
scintilla1.Styles[Style.Default].Font = "Consolas";
|
||||
scintilla1.Styles[Style.Default].Size = 10;
|
||||
|
@ -343,6 +343,8 @@ namespace Toolbox.Library.IO
|
||||
}
|
||||
if (Path.GetExtension(FileName) == ".cmp" && CompType == CompressionType.None)
|
||||
{
|
||||
if (stream != null)
|
||||
data = stream.ToArray();
|
||||
if (data == null)
|
||||
data = File.ReadAllBytes(FileName);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user