1
0
mirror of synced 2024-11-28 01:10:51 +01:00

Few more additions

Start to impliment a muunt editor. This plans to use the 2D engine i've been using with layouts mixed with 3d to fully edit object and path placements.
Start to add pane copying.
Brlyt improvements with window pane support.
Add bflyt texture combiner UI.
This commit is contained in:
KillzXGaming 2019-10-16 20:15:36 -04:00
parent 8153975f2e
commit e1fd664112
20 changed files with 837 additions and 85 deletions

View File

@ -634,6 +634,8 @@ namespace Bfres.Structs
case TEX_FORMAT.R32G32B32A32_SINT: return GX2SurfaceFormat.TC_R32_G32_B32_A32_SInt;
case TEX_FORMAT.L8: return GX2SurfaceFormat.TC_R8_UNorm;
case TEX_FORMAT.LA8: return GX2SurfaceFormat.TC_R8_G8_UNorm;
case TEX_FORMAT.RGB565: return GX2SurfaceFormat.TCS_R5_G6_B5_UNorm;
case TEX_FORMAT.R5G5B5_UNORM: return GX2SurfaceFormat.TC_R5_G5_B5_A1_UNorm;
default:
throw new Exception($"Cannot convert format {texFormat}");
}

View File

@ -1089,6 +1089,16 @@ namespace LayoutBXLYT
mat.Shader = new BflytShader((Cafe.BFLYT.Material)mat);
mat.Shader.Compile();
}
else if (mat is BRLYT.Material)
{
mat.Shader = new BrlytShader((BRLYT.Material)mat);
mat.Shader.Compile();
}
else if (mat is BCLYT.Material)
{
mat.Shader = new BclytShader((BCLYT.Material)mat);
mat.Shader.Compile();
}
}
mat.Shader.Enable();

View File

@ -199,6 +199,7 @@ namespace LayoutBXLYT
public class PAT1 : BxlanPAT1
{
private byte[] UnknownData;
private byte flags;
public PAT1()
@ -267,8 +268,6 @@ namespace LayoutBXLYT
public class PAI1 : BxlanPAI1
{
public PAI1()
{
Textures = new List<string>();

View File

@ -1154,7 +1154,7 @@ namespace LayoutBXLYT.Cafe
LoadDefaults();
Name = name;
Content = new WindowContent(header, this.Name);
Content = new BxlytWindowContent(header, this.Name);
UseOneMaterialForAll = true;
UseVertexColorForAll = true;
WindowKind = WindowKind.Around;
@ -1368,7 +1368,7 @@ namespace LayoutBXLYT.Cafe
WindowKind = (WindowKind)((_flag >> 2) & 3);
reader.SeekBegin(pos + contentOffset);
Content = new WindowContent(reader, header);
Content = new BxlytWindowContent(reader, header);
reader.SeekBegin(pos + frameOffsetTbl);
@ -1402,7 +1402,7 @@ namespace LayoutBXLYT.Cafe
writer.Write(0);
writer.WriteUint32Offset(_ofsContentPos, pos);
((WindowContent)Content).Write(writer);
Content.Write(writer);
if (WindowFrames.Count > 0)
{
@ -1417,67 +1417,6 @@ namespace LayoutBXLYT.Cafe
}
}
}
public class WindowContent : BxlytWindowContent
{
private Header LayoutFile;
public WindowContent(Header header, string name) {
LayoutFile = header;
ColorTopLeft = STColor8.White;
ColorTopRight = STColor8.White;
ColorBottomLeft = STColor8.White;
ColorBottomRight = STColor8.White;
TexCoords.Add(new TexCoord());
//Add new material
Material = new Material($"{name}_C", header);
MaterialIndex = (ushort)header.AddMaterial(Material);
}
public WindowContent(FileReader reader, Header header)
{
LayoutFile = header;
ColorTopLeft = reader.ReadColor8RGBA();
ColorTopRight = reader.ReadColor8RGBA();
ColorBottomLeft = reader.ReadColor8RGBA();
ColorBottomRight = reader.ReadColor8RGBA();
MaterialIndex = reader.ReadUInt16();
byte UVCount = reader.ReadByte();
reader.ReadByte(); //padding
for (int i = 0; i < UVCount; i++)
TexCoords.Add(new TexCoord()
{
TopLeft = reader.ReadVec2SY(),
TopRight = reader.ReadVec2SY(),
BottomLeft = reader.ReadVec2SY(),
BottomRight = reader.ReadVec2SY(),
});
Material = LayoutFile.MaterialList.Materials[MaterialIndex];
}
public void Write(FileWriter writer)
{
writer.Write(ColorTopLeft);
writer.Write(ColorTopRight);
writer.Write(ColorBottomLeft);
writer.Write(ColorBottomRight);
writer.Write(MaterialIndex);
writer.Write((byte)TexCoords.Count);
writer.Write((byte)0);
foreach (var texCoord in TexCoords)
{
writer.Write(texCoord.TopLeft);
writer.Write(texCoord.TopRight);
writer.Write(texCoord.BottomLeft);
writer.Write(texCoord.BottomRight);
}
}
}
}
public class ALI1 : PAN1

View File

@ -1118,6 +1118,65 @@ namespace LayoutBXLYT
public virtual BxlytMaterial Material { get; set; }
public List<TexCoord> TexCoords = new List<TexCoord>();
private BxlytHeader LayoutFile;
public BxlytWindowContent(BxlytHeader header, string name)
{
LayoutFile = header;
ColorTopLeft = STColor8.White;
ColorTopRight = STColor8.White;
ColorBottomLeft = STColor8.White;
ColorBottomRight = STColor8.White;
TexCoords.Add(new TexCoord());
//Add new material
Material = header.CreateNewMaterial($"{name}_C");
MaterialIndex = (ushort)header.AddMaterial(Material);
}
public BxlytWindowContent(FileReader reader, BxlytHeader header)
{
LayoutFile = header;
ColorTopLeft = reader.ReadColor8RGBA();
ColorTopRight = reader.ReadColor8RGBA();
ColorBottomLeft = reader.ReadColor8RGBA();
ColorBottomRight = reader.ReadColor8RGBA();
MaterialIndex = reader.ReadUInt16();
byte UVCount = reader.ReadByte();
reader.ReadByte(); //padding
for (int i = 0; i < UVCount; i++)
TexCoords.Add(new TexCoord()
{
TopLeft = reader.ReadVec2SY(),
TopRight = reader.ReadVec2SY(),
BottomLeft = reader.ReadVec2SY(),
BottomRight = reader.ReadVec2SY(),
});
Material = LayoutFile.GetMaterial(MaterialIndex);
}
public void Write(FileWriter writer)
{
writer.Write(ColorTopLeft);
writer.Write(ColorTopRight);
writer.Write(ColorBottomLeft);
writer.Write(ColorBottomRight);
writer.Write(MaterialIndex);
writer.Write((byte)TexCoords.Count);
writer.Write((byte)0);
foreach (var texCoord in TexCoords)
{
writer.Write(texCoord.TopLeft);
writer.Write(texCoord.TopRight);
writer.Write(texCoord.BottomLeft);
writer.Write(texCoord.BottomRight);
}
}
}
public class BxlytWindowFrame

View File

@ -194,6 +194,10 @@ namespace LayoutBXLYT
return panes;
}
public override BxlytMaterial GetMaterial(ushort index) {
return MaterialList.Materials[index];
}
public override List<BxlytMaterial> GetMaterials()
{
List<BxlytMaterial> materials = new List<BxlytMaterial>();
@ -328,7 +332,7 @@ namespace LayoutBXLYT
currentPane = partsPanel;
break;
case "wnd1":
var windowPanel = new WND1(reader);
var windowPanel = new WND1(this, reader);
AddPaneToTable(windowPanel);
SetPane(windowPanel, parentPane);
@ -678,7 +682,7 @@ namespace LayoutBXLYT
LoadDefaults();
Name = name;
Content = new WindowContent(header, this.Name);
Content = new BxlytWindowContent(header, this.Name);
UseOneMaterialForAll = true;
UseVertexColorForAll = true;
WindowKind = WindowKind.Around;
@ -702,9 +706,40 @@ namespace LayoutBXLYT
SetFrames(header);
}
public WND1(FileReader reader) : base(reader)
public WND1(Header header, FileReader reader) : base(reader)
{
layoutHeader = header;
WindowFrames = new List<BxlytWindowFrame>();
long pos = reader.Position - 0x4C;
StretchLeft = reader.ReadUInt16();
StretchRight = reader.ReadUInt16();
StretchTop = reader.ReadUInt16();
StretchBottm = reader.ReadUInt16();
FrameElementLeft = reader.ReadUInt16();
FrameElementRight = reader.ReadUInt16();
FrameElementTop = reader.ReadUInt16();
FrameElementBottm = reader.ReadUInt16();
FrameCount = reader.ReadByte();
_flag = reader.ReadByte();
reader.ReadUInt16();//padding
uint contentOffset = reader.ReadUInt32();
uint frameOffsetTbl = reader.ReadUInt32();
WindowKind = (WindowKind)((_flag >> 2) & 3);
reader.SeekBegin(pos + contentOffset);
Content = new BxlytWindowContent(reader, header);
reader.SeekBegin(pos + frameOffsetTbl);
var offsets = reader.ReadUInt32s(FrameCount);
foreach (int offset in offsets)
{
reader.SeekBegin(pos + offset);
WindowFrames.Add(new BxlytWindowFrame(reader, header));
}
}
public override void Write(FileWriter writer, LayoutHeader header)
@ -713,14 +748,6 @@ namespace LayoutBXLYT
}
}
public class WindowContent : BxlytWindowContent
{
public WindowContent(Header header, string name)
{
}
}
public class BND1 : PAN1, IBoundryPane
{
public BND1() : base()

View File

@ -648,6 +648,16 @@
<Compile Include="GUI\BFRES\SmoothNormalsMultiMeshForm.Designer.cs">
<DependentUpon>SmoothNormalsMultiMeshForm.cs</DependentUpon>
</Compile>
<Compile Include="GUI\Byaml\CourseMuunt2D\MuuntEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\Byaml\CourseMuunt2D\MuuntEditor.Designer.cs">
<DependentUpon>MuuntEditor.cs</DependentUpon>
</Compile>
<Compile Include="GUI\Byaml\CourseMuunt2D\MuuntEditorDocker.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\Byaml\CourseMuunt2D\TrackEditor2D.cs" />
<Compile Include="GUI\Editors\MK8TrackEditor\MapCameraViewer.cs">
<SubType>UserControl</SubType>
</Compile>
@ -1353,6 +1363,9 @@
<EmbeddedResource Include="GUI\BFLYT\Editor\Materials\PaneMatBlending.resx">
<DependentUpon>PaneMatBlending.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\BFLYT\Editor\Materials\PaneMatTextureCombiner.resx">
<DependentUpon>PaneMatTextureCombiner.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\BFLYT\Editor\PaneEditor.resx">
<DependentUpon>PaneEditor.cs</DependentUpon>
</EmbeddedResource>
@ -1587,6 +1600,9 @@
<EmbeddedResource Include="GUI\BotwActorEditorControl.resx">
<DependentUpon>BotwActorEditorControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\Byaml\CourseMuunt2D\MuuntEditor.resx">
<DependentUpon>MuuntEditor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\Byaml\CourseMuunt\TurboMunntEditor.resx">
<DependentUpon>TurboMunntEditor.cs</DependentUpon>
</EmbeddedResource>
@ -1822,5 +1838,8 @@
<ItemGroup>
<None Include="Resources\LayoutAnimation.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\MissingTexture.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -28,10 +28,117 @@
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.tevStageCB = new Toolbox.Library.Forms.STComboBox();
this.stLabel1 = new Toolbox.Library.Forms.STLabel();
this.tevColorModeCB = new Toolbox.Library.Forms.STComboBox();
this.stLabel2 = new Toolbox.Library.Forms.STLabel();
this.stLabel3 = new Toolbox.Library.Forms.STLabel();
this.tevAlphaModeCB = new Toolbox.Library.Forms.STComboBox();
this.tevBasicPanel = new Toolbox.Library.Forms.STPanel();
this.tevBasicPanel.SuspendLayout();
this.SuspendLayout();
//
// tevStageCB
//
this.tevStageCB.BorderColor = System.Drawing.Color.Empty;
this.tevStageCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.tevStageCB.ButtonColor = System.Drawing.Color.Empty;
this.tevStageCB.FormattingEnabled = true;
this.tevStageCB.IsReadOnly = false;
this.tevStageCB.Location = new System.Drawing.Point(53, 17);
this.tevStageCB.Name = "tevStageCB";
this.tevStageCB.Size = new System.Drawing.Size(155, 21);
this.tevStageCB.TabIndex = 1;
this.tevStageCB.SelectedIndexChanged += new System.EventHandler(this.tevStageCB_SelectedIndexChanged);
//
// stLabel1
//
this.stLabel1.AutoSize = true;
this.stLabel1.Location = new System.Drawing.Point(4, 20);
this.stLabel1.Name = "stLabel1";
this.stLabel1.Size = new System.Drawing.Size(43, 13);
this.stLabel1.TabIndex = 2;
this.stLabel1.Text = "Stages:";
//
// tevColorModeCB
//
this.tevColorModeCB.BorderColor = System.Drawing.Color.Empty;
this.tevColorModeCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.tevColorModeCB.ButtonColor = System.Drawing.Color.Empty;
this.tevColorModeCB.FormattingEnabled = true;
this.tevColorModeCB.IsReadOnly = false;
this.tevColorModeCB.Location = new System.Drawing.Point(6, 60);
this.tevColorModeCB.Name = "tevColorModeCB";
this.tevColorModeCB.Size = new System.Drawing.Size(155, 21);
this.tevColorModeCB.TabIndex = 3;
this.tevColorModeCB.SelectedIndexChanged += new System.EventHandler(this.tevColorModeCB_SelectedIndexChanged);
//
// stLabel2
//
this.stLabel2.AutoSize = true;
this.stLabel2.Location = new System.Drawing.Point(3, 33);
this.stLabel2.Name = "stLabel2";
this.stLabel2.Size = new System.Drawing.Size(78, 13);
this.stLabel2.TabIndex = 4;
this.stLabel2.Text = "Color Blending:";
//
// stLabel3
//
this.stLabel3.AutoSize = true;
this.stLabel3.Location = new System.Drawing.Point(3, 110);
this.stLabel3.Name = "stLabel3";
this.stLabel3.Size = new System.Drawing.Size(81, 13);
this.stLabel3.TabIndex = 6;
this.stLabel3.Text = "Alpha Blending:";
//
// tevAlphaModeCB
//
this.tevAlphaModeCB.BorderColor = System.Drawing.Color.Empty;
this.tevAlphaModeCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.tevAlphaModeCB.ButtonColor = System.Drawing.Color.Empty;
this.tevAlphaModeCB.FormattingEnabled = true;
this.tevAlphaModeCB.IsReadOnly = false;
this.tevAlphaModeCB.Location = new System.Drawing.Point(6, 137);
this.tevAlphaModeCB.Name = "tevAlphaModeCB";
this.tevAlphaModeCB.Size = new System.Drawing.Size(155, 21);
this.tevAlphaModeCB.TabIndex = 5;
this.tevAlphaModeCB.SelectedIndexChanged += new System.EventHandler(this.tevAlphaModeCB_SelectedIndexChanged);
//
// tevBasicPanel
//
this.tevBasicPanel.Controls.Add(this.stLabel2);
this.tevBasicPanel.Controls.Add(this.stLabel3);
this.tevBasicPanel.Controls.Add(this.tevColorModeCB);
this.tevBasicPanel.Controls.Add(this.tevAlphaModeCB);
this.tevBasicPanel.Location = new System.Drawing.Point(3, 44);
this.tevBasicPanel.Name = "tevBasicPanel";
this.tevBasicPanel.Size = new System.Drawing.Size(299, 265);
this.tevBasicPanel.TabIndex = 7;
//
// PaneMatTextureCombiner
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tevBasicPanel);
this.Controls.Add(this.stLabel1);
this.Controls.Add(this.tevStageCB);
this.Name = "PaneMatTextureCombiner";
this.Size = new System.Drawing.Size(305, 312);
this.tevBasicPanel.ResumeLayout(false);
this.tevBasicPanel.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Toolbox.Library.Forms.STComboBox tevStageCB;
private Toolbox.Library.Forms.STLabel stLabel1;
private Toolbox.Library.Forms.STComboBox tevColorModeCB;
private Toolbox.Library.Forms.STLabel stLabel2;
private Toolbox.Library.Forms.STLabel stLabel3;
private Toolbox.Library.Forms.STComboBox tevAlphaModeCB;
private Toolbox.Library.Forms.STPanel tevBasicPanel;
}
}

View File

@ -14,6 +14,7 @@ namespace LayoutBXLYT
{
private PaneEditor ParentEditor;
private BxlytMaterial ActiveMaterial;
private bool loaded = false;
public PaneMatTextureCombiner()
{
@ -24,6 +25,56 @@ namespace LayoutBXLYT
{
ActiveMaterial = material;
ParentEditor = paneEditor;
tevStageCB.Items.Clear();
tevColorModeCB.ResetBind();
tevAlphaModeCB.ResetBind();
if (material.TevStages?.Length > 0)
{
tevBasicPanel.Show();
for (int i = 0; i < material.TevStages.Length; i++)
tevStageCB.Items.Add($"Stage [{i}]");
tevStageCB.SelectedIndex = 0;
}
else
{
tevBasicPanel.Hide();
}
}
private void tevStageCB_SelectedIndexChanged(object sender, EventArgs e)
{
if (tevStageCB.SelectedIndex >= 0)
{
int index = tevStageCB.SelectedIndex;
var tevStage = ActiveMaterial.TevStages[index];
tevColorModeCB.Bind(typeof(TevMode), tevStage, "ColorMode");
tevAlphaModeCB.Bind(typeof(TevMode), tevStage, "AlphaMode");
tevColorModeCB.SelectedItem = tevStage.ColorMode;
tevAlphaModeCB.SelectedItem = tevStage.AlphaMode;
}
}
private void tevColorModeCB_SelectedIndexChanged(object sender, EventArgs e) {
UpdateTevStage();
}
private void tevAlphaModeCB_SelectedIndexChanged(object sender, EventArgs e) {
UpdateTevStage();
}
private void UpdateTevStage()
{
if (!loaded || tevStageCB.SelectedIndex < 0) return;
int index = tevStageCB.SelectedIndex;
var tevStage = ActiveMaterial.TevStages[index];
tevStage.ColorMode = (TevMode)tevColorModeCB.SelectedItem;
tevStage.AlphaMode = (TevMode)tevColorModeCB.SelectedItem;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1067,6 +1067,18 @@ namespace LayoutBXLYT
return pane;
}
public void AddNewPastedPane(BasePane pane)
{
string name = pane.Name;
string numberedEnd = pane.Name.Split('_').LastOrDefault().Replace("_", string.Empty);
if (numberedEnd.All(char.IsDigit))
name = name.Replace(numberedEnd, string.Empty);
pane.Name = RenamePane(name);
pane.NodeWrapper = LayoutHierarchy.CreatePaneWrapper(pane);
ActiveLayout.AddPane(pane, pane.Parent);
}
public BasePane AddNewNullPane()
{
BasePane pane = null;
@ -1084,8 +1096,8 @@ namespace LayoutBXLYT
private string RenamePane(string name)
{
List<string> names = ActiveLayout.PaneLookup.Values.ToList().Select(o => o.Name).ToList();
return Utils.RenameDuplicateString(names, name); ;
List<string> names = ActiveLayout.PaneLookup.Keys.ToList();
return Utils.RenameDuplicateString(names, name, 0, 2);
}
#endregion

View File

@ -34,6 +34,8 @@ namespace LayoutBXLYT
private LayoutEditor ParentEditor;
private List<BasePane> CopiedPanes = new List<BasePane>();
private RenderableTex backgroundTex;
public BxlytHeader LayoutFile;
public List<BxlytHeader> LayoutFiles = new List<BxlytHeader>();
@ -840,7 +842,6 @@ namespace LayoutBXLYT
createPanes.DropDownItems.Add(new STToolStripItem("Text Box Pane", CreateTextPaneAction));
createPanes.DropDownItems.Add(new STToolStripItem("Window Pane", CreateWindowPaneAction));
createPanes.DropDownItems.Add(new STToolStripItem("Boundry Pane", CreateBoundryPaneAction));
var hitPanes = GetHitPanes(LayoutFile.RootPane, coords.X, coords.Y, new List<BasePane>());
for (int i = 0; i < hitPanes.Count; i++)
selectOverlapping.DropDownItems.Add(
@ -853,6 +854,8 @@ namespace LayoutBXLYT
if (SelectedPanes.Count > 0)
{
stContextMenuStrip1.Items.Add(new STToolStripSeparator());
stContextMenuStrip1.Items.Add(new STToolStripItem("Copy", CopyPaneAction));
stContextMenuStrip1.Items.Add(new STToolStripItem("Paste", PastePaneAction));
stContextMenuStrip1.Items.Add(new STToolStripItem("Edit Group"));
stContextMenuStrip1.Items.Add(new STToolStripItem("Delete Selected Panes",DeletePaneAction ));
stContextMenuStrip1.Items.Add(new STToolStripItem("Hide Selected Panes", HidePaneAction));
@ -890,6 +893,40 @@ namespace LayoutBXLYT
SetupNewPane(pane, pickOriginMouse);
}
private void CopyPaneAction(object sender, EventArgs e) {
CopyPanes();
}
private void PastePaneAction(object sender, EventArgs e) {
PastePanes();
}
private void CopyPanes()
{
return;
CopiedPanes.Clear();
foreach (var pane in SelectedPanes)
{
var copiedPane = pane.Copy();
CopiedPanes.Add(copiedPane);
}
}
private void PastePanes()
{
return;
SelectedPanes.Clear();
foreach (var pane in CopiedPanes)
{
ParentEditor.AddNewPastedPane(pane);
SelectedPanes.Add(pane);
}
glControl1.Invalidate();
}
private void SetupNewPane(BasePane pane, Point point)
{
if (pane == null) return;
@ -1343,6 +1380,16 @@ namespace LayoutBXLYT
ParentEditor.UpdateUndo();
glControl1.Invalidate();
}
else if (e.Control && e.KeyCode == Keys.C) // Ctrl + C copy
{
CopyPanes();
glControl1.Invalidate();
}
else if (e.Control && e.KeyCode == Keys.V) // Ctrl + V paste
{
PastePanes();
glControl1.Invalidate();
}
else if (e.KeyCode == Keys.Delete)
{
DeleteSelectedPanes();

View File

@ -0,0 +1,171 @@
namespace FirstPlugin.Forms
{
partial class MuuntEditor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dockPanel1 = new WeifenLuo.WinFormsUI.Docking.DockPanel();
this.stMenuStrip1 = new Toolbox.Library.Forms.STMenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toggle3DViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stToolStrip1 = new Toolbox.Library.Forms.STToolStrip();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.stMenuStrip1.SuspendLayout();
this.stToolStrip1.SuspendLayout();
this.SuspendLayout();
//
// dockPanel1
//
this.dockPanel1.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.dockPanel1.Location = new System.Drawing.Point(0, 52);
this.dockPanel1.Name = "dockPanel1";
this.dockPanel1.Size = new System.Drawing.Size(471, 363);
this.dockPanel1.TabIndex = 0;
//
// stMenuStrip1
//
this.stMenuStrip1.HighlightSelectedTab = false;
this.stMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.editToolStripMenuItem,
this.viewToolStripMenuItem});
this.stMenuStrip1.Location = new System.Drawing.Point(0, 0);
this.stMenuStrip1.Name = "stMenuStrip1";
this.stMenuStrip1.Size = new System.Drawing.Size(471, 24);
this.stMenuStrip1.TabIndex = 2;
this.stMenuStrip1.Text = "stMenuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.openToolStripMenuItem,
this.saveToolStripMenuItem,
this.saveAsToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File";
//
// editToolStripMenuItem
//
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
this.editToolStripMenuItem.Text = "Edit";
//
// viewToolStripMenuItem
//
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toggle3DViewToolStripMenuItem});
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "View";
//
// toggle3DViewToolStripMenuItem
//
this.toggle3DViewToolStripMenuItem.Name = "toggle3DViewToolStripMenuItem";
this.toggle3DViewToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.toggle3DViewToolStripMenuItem.Text = "Toggle 3D View";
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.openToolStripMenuItem.Text = "Open";
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveToolStripMenuItem.Text = "Save";
//
// saveAsToolStripMenuItem
//
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveAsToolStripMenuItem.Text = "Save As";
//
// stToolStrip1
//
this.stToolStrip1.HighlightSelectedTab = false;
this.stToolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButton1});
this.stToolStrip1.Location = new System.Drawing.Point(0, 24);
this.stToolStrip1.Name = "stToolStrip1";
this.stToolStrip1.Size = new System.Drawing.Size(471, 25);
this.stToolStrip1.TabIndex = 3;
this.stToolStrip1.Text = "stToolStrip1";
//
// toolStripButton1
//
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton1.Image = global::FirstPlugin.Properties.Resources.ViewportIconDisable;
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(23, 22);
this.toolStripButton1.Text = "toolStripButton1";
//
// MuuntEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(471, 412);
this.Controls.Add(this.stToolStrip1);
this.Controls.Add(this.dockPanel1);
this.Controls.Add(this.stMenuStrip1);
this.MainMenuStrip = this.stMenuStrip1;
this.Name = "MuuntEditor";
this.Text = "MarioKartMuuntEditor";
this.stMenuStrip1.ResumeLayout(false);
this.stMenuStrip1.PerformLayout();
this.stToolStrip1.ResumeLayout(false);
this.stToolStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private WeifenLuo.WinFormsUI.Docking.DockPanel dockPanel1;
private Toolbox.Library.Forms.STMenuStrip stMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toggle3DViewToolStripMenuItem;
private Toolbox.Library.Forms.STToolStrip stToolStrip1;
private System.Windows.Forms.ToolStripButton toolStripButton1;
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Toolbox.Library.Forms;
using WeifenLuo.WinFormsUI.Docking;
namespace FirstPlugin.Forms
{
public partial class MuuntEditor : Form
{
public MuuntEditor()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="stMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="stToolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>141, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeifenLuo.WinFormsUI.Docking;
namespace FirstPlugin.Forms
{
public class MuuntEditorDocker : DockContent
{
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Toolbox.Library.Forms;
using Toolbox.Library;
using OpenTK;
using OpenTK.Graphics.OpenGL;
namespace FirstPlugin.Turbo
{
public class MuuntEditor2D
{
}
}

View File

@ -340,6 +340,8 @@ namespace Toolbox.Library
{ TEX_FORMAT.B5G5R5A1_UNORM, new FormatInfo(2, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.B8G8R8A8_UNORM, new FormatInfo(4, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.B8G8R8A8_UNORM_SRGB, new FormatInfo(4, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.R5G5B5_UNORM, new FormatInfo(2, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.R10G10B10A2_UINT, new FormatInfo(4, 1, 1, 1, TargetBuffer.Color) },
{ TEX_FORMAT.R10G10B10A2_UNORM, new FormatInfo(4, 1, 1, 1, TargetBuffer.Color) },

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
namespace System
@ -26,6 +26,12 @@ namespace System
return normalizedPath.StartsWith(normalizedBaseDirPath, StringComparison.OrdinalIgnoreCase);
}
public static string RemoveNumbersAtEnd(this string str)
{
Regex rgx = new Regex(@"\d+$");
return rgx.Replace(str, string.Empty);
}
/// <summary>
/// Returns <paramref name="str"/> with the minimal concatenation of <paramref name="ending"/> (starting from end) that
/// results in satisfying .EndsWith(ending).

View File

@ -178,14 +178,17 @@ namespace Toolbox.Library
return data.Skip((int)offset).Take((int)length).ToArray();
}
public static string RenameDuplicateString(List<string> strings, string oldString, int index = 0)
public static string RenameDuplicateString(List<string> strings, string oldString, int index = 0, int numDigits = 1)
{
if (strings.Contains(oldString))
{
string NewString = $"{oldString}_{index++}";
string key = $"{index++}";
if (numDigits == 2)
key = string.Format("{0:00}", key);
string NewString = $"{oldString}_{key}";
if (strings.Contains(NewString))
return RenameDuplicateString(strings, oldString, index);
return RenameDuplicateString(strings, oldString, index, numDigits);
else
return NewString;
}