mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 07:04:36 +00:00
Sarc fixes and more windows 7 fixes
This commit is contained in:
parent
9e1613d946
commit
cd0e3377b4
21 changed files with 516 additions and 145 deletions
|
@ -8,6 +8,7 @@ using SARCExt;
|
|||
using Toolbox.Library;
|
||||
using Toolbox.Library.IO;
|
||||
using Toolbox.Library.Forms;
|
||||
using Toolbox.Library.Security.Cryptography;
|
||||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
|
@ -126,9 +127,13 @@ namespace FirstPlugin
|
|||
foreach (var file in SzsFiles.Files)
|
||||
{
|
||||
string fileName = file.Key;
|
||||
string Hash = string.Empty;
|
||||
if (SzsFiles.HashOnly)
|
||||
{
|
||||
fileName = SARCExt.SARC.TryGetNameFromHashTable(fileName);
|
||||
files.Add(SetupFileEntry(fileName, file.Value));
|
||||
Hash = file.Key;
|
||||
}
|
||||
files.Add(SetupFileEntry(fileName, file.Value, Hash));
|
||||
}
|
||||
|
||||
sarcData.Files.Clear();
|
||||
|
@ -244,8 +249,28 @@ namespace FirstPlugin
|
|||
sarcData.Files.Clear();
|
||||
foreach (var file in files)
|
||||
{
|
||||
Console.WriteLine("sarc file name " + file.FileName);
|
||||
file.SaveFileFormat();
|
||||
sarcData.Files.Add(file.FileName, file.FileData);
|
||||
|
||||
if (sarcData.HashOnly)
|
||||
{
|
||||
sarcData.Files.Add(file.HashName, file.FileData);
|
||||
|
||||
/*
|
||||
uint hash = 0;
|
||||
bool IsHash = uint.TryParse(file.FileName, out hash);
|
||||
if (IsHash && file.FileName.Length == 8)
|
||||
{
|
||||
sarcData.Files.Add(file.FileName, file.FileData);
|
||||
}
|
||||
else
|
||||
{
|
||||
string Hash = Crc32.Compute(file.FileName).ToString();
|
||||
sarcData.Files.Add(Hash, file.FileData);
|
||||
}*/
|
||||
}
|
||||
else
|
||||
sarcData.Files.Add(file.FileName, file.FileData);
|
||||
}
|
||||
|
||||
Tuple<int, byte[]> sarc = SARCExt.SARC.PackN(sarcData);
|
||||
|
@ -258,6 +283,8 @@ namespace FirstPlugin
|
|||
{
|
||||
public SARC sarc; //Sarc file the entry is located in
|
||||
|
||||
public string HashName;
|
||||
|
||||
public SarcEntry()
|
||||
{
|
||||
|
||||
|
@ -279,11 +306,12 @@ namespace FirstPlugin
|
|||
}
|
||||
}
|
||||
|
||||
public SarcEntry SetupFileEntry(string fullName, byte[] data)
|
||||
public SarcEntry SetupFileEntry(string fullName, byte[] data, string HashName)
|
||||
{
|
||||
SarcEntry sarcEntry = new SarcEntry();
|
||||
sarcEntry.FileName = fullName;
|
||||
sarcEntry.FileData = data;
|
||||
sarcEntry.HashName = HashName;
|
||||
return sarcEntry;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,6 +158,7 @@
|
|||
</Reference>
|
||||
<Reference Include="Syroot.NintenTools.MarioKart8">
|
||||
<HintPath>..\Toolbox\Lib\Syroot.NintenTools.MarioKart8.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Syroot.NintenTools.NSW.Bfres">
|
||||
<HintPath>..\Toolbox\Lib\Syroot.NintenTools.NSW.Bfres.dll</HintPath>
|
||||
|
@ -165,6 +166,7 @@
|
|||
</Reference>
|
||||
<Reference Include="Syroot.NintenTools.NSW.Bntx">
|
||||
<HintPath>..\Toolbox\Lib\Syroot.NintenTools.NSW.Bntx.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers">
|
||||
|
|
|
@ -19,7 +19,7 @@ using SF = SFGraphics.GLObjects.Shaders;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class BFRESRender : AbstractGlDrawable
|
||||
public class BFRESRender : AbstractGlDrawable, IMeshContainer
|
||||
{
|
||||
private bool Disposing = false;
|
||||
|
||||
|
@ -38,6 +38,20 @@ namespace FirstPlugin
|
|||
int vbo_position;
|
||||
int ibo_elements;
|
||||
|
||||
public List<STGenericObject> Meshes
|
||||
{
|
||||
get
|
||||
{
|
||||
List<STGenericObject> meshes = new List<STGenericObject>();
|
||||
for (int m =0; m < models.Count; m++)
|
||||
{
|
||||
for (int s = 0; s < models[m].shapes.Count; s++)
|
||||
meshes.Add(models[m].shapes[s]);
|
||||
}
|
||||
return meshes;
|
||||
}
|
||||
}
|
||||
|
||||
private List<FMDL> _models = new List<FMDL>();
|
||||
public List<FMDL> models
|
||||
{
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
this.stTabControl1 = new Toolbox.Library.Forms.STTabControl();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.samplerEditor1 = new Forms.SamplerEditor();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.uvEditor1 = new Toolbox.Library.Forms.UVEditor();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.shaderParamEditor1 = new Forms.ShaderParamEditor();
|
||||
this.tabPage4 = new System.Windows.Forms.TabPage();
|
||||
|
@ -61,7 +59,6 @@
|
|||
this.stLabel4 = new Toolbox.Library.Forms.STLabel();
|
||||
this.stTabControl1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage3.SuspendLayout();
|
||||
this.tabPage4.SuspendLayout();
|
||||
this.tabPage5.SuspendLayout();
|
||||
|
@ -120,7 +117,6 @@
|
|||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.stTabControl1.Controls.Add(this.tabPage2);
|
||||
this.stTabControl1.Controls.Add(this.tabPage1);
|
||||
this.stTabControl1.Controls.Add(this.tabPage3);
|
||||
this.stTabControl1.Controls.Add(this.tabPage4);
|
||||
this.stTabControl1.Controls.Add(this.tabPage5);
|
||||
|
@ -151,27 +147,6 @@
|
|||
this.samplerEditor1.Size = new System.Drawing.Size(524, 504);
|
||||
this.samplerEditor1.TabIndex = 0;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.uvEditor1);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 25);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(530, 510);
|
||||
this.tabPage1.TabIndex = 6;
|
||||
this.tabPage1.Text = "UV View";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// uvEditor1
|
||||
//
|
||||
this.uvEditor1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.uvEditor1.Location = new System.Drawing.Point(3, 3);
|
||||
this.uvEditor1.Name = "uvEditor1";
|
||||
this.uvEditor1.Size = new System.Drawing.Size(524, 504);
|
||||
this.uvEditor1.TabIndex = 0;
|
||||
this.uvEditor1.Load += new System.EventHandler(this.uvEditor1_Load);
|
||||
this.uvEditor1.Click += new System.EventHandler(this.uvEditor1_Click);
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.shaderParamEditor1);
|
||||
|
@ -384,7 +359,6 @@
|
|||
this.Size = new System.Drawing.Size(538, 644);
|
||||
this.stTabControl1.ResumeLayout(false);
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage3.ResumeLayout(false);
|
||||
this.tabPage4.ResumeLayout(false);
|
||||
this.tabPage5.ResumeLayout(false);
|
||||
|
@ -416,8 +390,6 @@
|
|||
private ShaderParamEditor shaderParamEditor1;
|
||||
private RenderInfoEditor renderInfoEditor1;
|
||||
private ShaderOptionsEditor shaderOptionsEditor1;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private Toolbox.Library.Forms.UVEditor uvEditor1;
|
||||
private Toolbox.Library.Forms.STLabel stLabel1;
|
||||
private Toolbox.Library.Forms.STButton btnViotileFlags;
|
||||
private Toolbox.Library.Forms.STButton btnSamplerInputEditor;
|
||||
|
|
|
@ -74,43 +74,6 @@ namespace FirstPlugin.Forms
|
|||
chkboxVisible.Bind(material, "Enabled");
|
||||
|
||||
FillForm();
|
||||
|
||||
uvEditor1.ActiveObjects.Clear();
|
||||
uvEditor1.Textures.Clear();
|
||||
|
||||
foreach (var shp in ((FMDL)material.Parent.Parent).shapes)
|
||||
{
|
||||
if (shp.GetMaterial().Text == material.Text)
|
||||
{
|
||||
uvEditor1.ActiveObjects.Add(shp);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var ftexContainer in PluginRuntime.ftexContainers)
|
||||
{
|
||||
foreach (var texmap in material.TextureMaps)
|
||||
{
|
||||
if (ftexContainer.ResourceNodes.ContainsKey(texmap.Name))
|
||||
{
|
||||
uvEditor1.Textures.Add(LoadTextureUvMap(texmap, (FTEX)ftexContainer.ResourceNodes[texmap.Name]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var bntx in PluginRuntime.bntxContainers)
|
||||
{
|
||||
foreach (var texmap in material.TextureMaps)
|
||||
{
|
||||
if (bntx.Textures.ContainsKey(texmap.Name))
|
||||
{
|
||||
uvEditor1.Textures.Add(LoadTextureUvMap(texmap, bntx.Textures[texmap.Name]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uvEditor1.Reset();
|
||||
uvEditor1.ActiveMaterial = material;
|
||||
uvEditor1.Refresh();
|
||||
}
|
||||
private UVEditor.ActiveTexture LoadTextureUvMap(STGenericMatTexture texmap, STGenericTexture genericTexture)
|
||||
{
|
||||
|
|
|
@ -42,22 +42,27 @@
|
|||
this.comboBox2 = new Toolbox.Library.Forms.STComboBox();
|
||||
this.comboBox1 = new Toolbox.Library.Forms.STComboBox();
|
||||
this.stLabel1 = new Toolbox.Library.Forms.STLabel();
|
||||
this.stPanel2 = new Toolbox.Library.Forms.STPanel();
|
||||
this.stComboBox1 = new Toolbox.Library.Forms.STComboBox();
|
||||
this.splitter1 = new System.Windows.Forms.Splitter();
|
||||
this.stPanel3 = new Toolbox.Library.Forms.STPanel();
|
||||
this.stButton1 = new Toolbox.Library.Forms.STButton();
|
||||
((System.ComponentModel.ISupportInitialize)(this.scaleYUD)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.transYUD)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.transXUD)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.scaleXUD)).BeginInit();
|
||||
this.stPanel1.SuspendLayout();
|
||||
this.stPanel2.SuspendLayout();
|
||||
this.stPanel3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// gL_ControlLegacy2D1
|
||||
//
|
||||
this.gL_ControlLegacy2D1.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.gL_ControlLegacy2D1.BackColor = System.Drawing.Color.Black;
|
||||
this.gL_ControlLegacy2D1.Location = new System.Drawing.Point(0, 70);
|
||||
this.gL_ControlLegacy2D1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gL_ControlLegacy2D1.Location = new System.Drawing.Point(0, 0);
|
||||
this.gL_ControlLegacy2D1.Name = "gL_ControlLegacy2D1";
|
||||
this.gL_ControlLegacy2D1.Size = new System.Drawing.Size(605, 454);
|
||||
this.gL_ControlLegacy2D1.Size = new System.Drawing.Size(443, 454);
|
||||
this.gL_ControlLegacy2D1.TabIndex = 2;
|
||||
this.gL_ControlLegacy2D1.VSync = false;
|
||||
this.gL_ControlLegacy2D1.Paint += new System.Windows.Forms.PaintEventHandler(this.gL_ControlLegacy2D1_Paint);
|
||||
|
@ -74,7 +79,7 @@
|
|||
0,
|
||||
0,
|
||||
196608});
|
||||
this.scaleYUD.Location = new System.Drawing.Point(135, 43);
|
||||
this.scaleYUD.Location = new System.Drawing.Point(75, 32);
|
||||
this.scaleYUD.Maximum = new decimal(new int[] {
|
||||
1000000000,
|
||||
0,
|
||||
|
@ -98,7 +103,7 @@
|
|||
0,
|
||||
0,
|
||||
196608});
|
||||
this.transYUD.Location = new System.Drawing.Point(360, 43);
|
||||
this.transYUD.Location = new System.Drawing.Point(75, 102);
|
||||
this.transYUD.Maximum = new decimal(new int[] {
|
||||
1000000000,
|
||||
0,
|
||||
|
@ -122,7 +127,7 @@
|
|||
0,
|
||||
0,
|
||||
196608});
|
||||
this.transXUD.Location = new System.Drawing.Point(281, 43);
|
||||
this.transXUD.Location = new System.Drawing.Point(5, 102);
|
||||
this.transXUD.Maximum = new decimal(new int[] {
|
||||
1000000000,
|
||||
0,
|
||||
|
@ -141,7 +146,7 @@
|
|||
// stLabel4
|
||||
//
|
||||
this.stLabel4.AutoSize = true;
|
||||
this.stLabel4.Location = new System.Drawing.Point(205, 45);
|
||||
this.stLabel4.Location = new System.Drawing.Point(3, 66);
|
||||
this.stLabel4.Name = "stLabel4";
|
||||
this.stLabel4.Size = new System.Drawing.Size(51, 13);
|
||||
this.stLabel4.TabIndex = 5;
|
||||
|
@ -150,7 +155,7 @@
|
|||
// stLabel3
|
||||
//
|
||||
this.stLabel3.AutoSize = true;
|
||||
this.stLabel3.Location = new System.Drawing.Point(25, 45);
|
||||
this.stLabel3.Location = new System.Drawing.Point(3, 11);
|
||||
this.stLabel3.Name = "stLabel3";
|
||||
this.stLabel3.Size = new System.Drawing.Size(34, 13);
|
||||
this.stLabel3.TabIndex = 4;
|
||||
|
@ -164,7 +169,7 @@
|
|||
0,
|
||||
0,
|
||||
196608});
|
||||
this.scaleXUD.Location = new System.Drawing.Point(65, 43);
|
||||
this.scaleXUD.Location = new System.Drawing.Point(5, 32);
|
||||
this.scaleXUD.Maximum = new decimal(new int[] {
|
||||
1000000000,
|
||||
0,
|
||||
|
@ -182,17 +187,11 @@
|
|||
//
|
||||
// stPanel1
|
||||
//
|
||||
this.stPanel1.Controls.Add(this.btnApplyTransform);
|
||||
this.stPanel1.Controls.Add(this.scaleYUD);
|
||||
this.stPanel1.Controls.Add(this.stComboBox1);
|
||||
this.stPanel1.Controls.Add(this.barSlider1);
|
||||
this.stPanel1.Controls.Add(this.transYUD);
|
||||
this.stPanel1.Controls.Add(this.stLabel2);
|
||||
this.stPanel1.Controls.Add(this.transXUD);
|
||||
this.stPanel1.Controls.Add(this.comboBox2);
|
||||
this.stPanel1.Controls.Add(this.stLabel4);
|
||||
this.stPanel1.Controls.Add(this.comboBox1);
|
||||
this.stPanel1.Controls.Add(this.stLabel3);
|
||||
this.stPanel1.Controls.Add(this.scaleXUD);
|
||||
this.stPanel1.Controls.Add(this.stLabel1);
|
||||
this.stPanel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.stPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
|
@ -203,7 +202,7 @@
|
|||
// btnApplyTransform
|
||||
//
|
||||
this.btnApplyTransform.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btnApplyTransform.Location = new System.Drawing.Point(430, 41);
|
||||
this.btnApplyTransform.Location = new System.Drawing.Point(3, 138);
|
||||
this.btnApplyTransform.Name = "btnApplyTransform";
|
||||
this.btnApplyTransform.Size = new System.Drawing.Size(119, 23);
|
||||
this.btnApplyTransform.TabIndex = 9;
|
||||
|
@ -243,7 +242,8 @@
|
|||
this.barSlider1.TickDivide = 0F;
|
||||
this.barSlider1.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||
this.barSlider1.ValueChanged += new System.EventHandler(this.barSlider1_ValueChanged);
|
||||
this.barSlider1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.barSlider1_Scroll);//
|
||||
this.barSlider1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.barSlider1_Scroll);
|
||||
//
|
||||
// stLabel2
|
||||
//
|
||||
this.stLabel2.AutoSize = true;
|
||||
|
@ -255,13 +255,13 @@
|
|||
//
|
||||
// comboBox2
|
||||
//
|
||||
this.comboBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.comboBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.comboBox2.BorderColor = System.Drawing.Color.Empty;
|
||||
this.comboBox2.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
|
||||
this.comboBox2.ButtonColor = System.Drawing.Color.Empty;
|
||||
this.comboBox2.FormattingEnabled = true;
|
||||
this.comboBox2.Location = new System.Drawing.Point(290, 7);
|
||||
this.comboBox2.Location = new System.Drawing.Point(290, 34);
|
||||
this.comboBox2.Name = "comboBox2";
|
||||
this.comboBox2.ReadOnly = true;
|
||||
this.comboBox2.Size = new System.Drawing.Size(166, 21);
|
||||
|
@ -292,11 +292,70 @@
|
|||
this.stLabel1.TabIndex = 4;
|
||||
this.stLabel1.Text = "Active Channel:";
|
||||
//
|
||||
// stPanel2
|
||||
//
|
||||
this.stPanel2.Controls.Add(this.stButton1);
|
||||
this.stPanel2.Controls.Add(this.btnApplyTransform);
|
||||
this.stPanel2.Controls.Add(this.stLabel3);
|
||||
this.stPanel2.Controls.Add(this.scaleYUD);
|
||||
this.stPanel2.Controls.Add(this.transYUD);
|
||||
this.stPanel2.Controls.Add(this.scaleXUD);
|
||||
this.stPanel2.Controls.Add(this.transXUD);
|
||||
this.stPanel2.Controls.Add(this.stLabel4);
|
||||
this.stPanel2.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.stPanel2.Location = new System.Drawing.Point(0, 70);
|
||||
this.stPanel2.Name = "stPanel2";
|
||||
this.stPanel2.Size = new System.Drawing.Size(159, 454);
|
||||
this.stPanel2.TabIndex = 3;
|
||||
//
|
||||
// stComboBox1
|
||||
//
|
||||
this.stComboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.stComboBox1.BorderColor = System.Drawing.Color.Empty;
|
||||
this.stComboBox1.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
|
||||
this.stComboBox1.ButtonColor = System.Drawing.Color.Empty;
|
||||
this.stComboBox1.FormattingEnabled = true;
|
||||
this.stComboBox1.Location = new System.Drawing.Point(290, 7);
|
||||
this.stComboBox1.Name = "stComboBox1";
|
||||
this.stComboBox1.ReadOnly = true;
|
||||
this.stComboBox1.Size = new System.Drawing.Size(166, 21);
|
||||
this.stComboBox1.TabIndex = 19;
|
||||
//
|
||||
// splitter1
|
||||
//
|
||||
this.splitter1.Location = new System.Drawing.Point(159, 70);
|
||||
this.splitter1.Name = "splitter1";
|
||||
this.splitter1.Size = new System.Drawing.Size(3, 454);
|
||||
this.splitter1.TabIndex = 4;
|
||||
this.splitter1.TabStop = false;
|
||||
//
|
||||
// stPanel3
|
||||
//
|
||||
this.stPanel3.Controls.Add(this.gL_ControlLegacy2D1);
|
||||
this.stPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.stPanel3.Location = new System.Drawing.Point(162, 70);
|
||||
this.stPanel3.Name = "stPanel3";
|
||||
this.stPanel3.Size = new System.Drawing.Size(443, 454);
|
||||
this.stPanel3.TabIndex = 5;
|
||||
//
|
||||
// stButton1
|
||||
//
|
||||
this.stButton1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.stButton1.Location = new System.Drawing.Point(145, 0);
|
||||
this.stButton1.Name = "stButton1";
|
||||
this.stButton1.Size = new System.Drawing.Size(14, 454);
|
||||
this.stButton1.TabIndex = 10;
|
||||
this.stButton1.UseVisualStyleBackColor = false;
|
||||
//
|
||||
// UVEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.gL_ControlLegacy2D1);
|
||||
this.Controls.Add(this.stPanel3);
|
||||
this.Controls.Add(this.splitter1);
|
||||
this.Controls.Add(this.stPanel2);
|
||||
this.Controls.Add(this.stPanel1);
|
||||
this.Name = "UVEditor";
|
||||
this.Size = new System.Drawing.Size(605, 524);
|
||||
|
@ -306,6 +365,9 @@
|
|||
((System.ComponentModel.ISupportInitialize)(this.scaleXUD)).EndInit();
|
||||
this.stPanel1.ResumeLayout(false);
|
||||
this.stPanel1.PerformLayout();
|
||||
this.stPanel2.ResumeLayout(false);
|
||||
this.stPanel2.PerformLayout();
|
||||
this.stPanel3.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -325,5 +387,10 @@
|
|||
private NumericUpDownFloat scaleYUD;
|
||||
private ColorSlider.ColorSlider barSlider1;
|
||||
private STButton btnApplyTransform;
|
||||
private STPanel stPanel2;
|
||||
private STComboBox stComboBox1;
|
||||
private System.Windows.Forms.Splitter splitter1;
|
||||
private STPanel stPanel3;
|
||||
private STButton stButton1;
|
||||
}
|
||||
}
|
|
@ -46,9 +46,9 @@ namespace Toolbox.Library.Forms
|
|||
|
||||
public float brightness = 0.5f; //To see uv maps easier
|
||||
public int UvChannelIndex = 0;
|
||||
public STGenericMaterial ActiveMaterial;
|
||||
|
||||
public List<STGenericObject> ActiveObjects = new List<STGenericObject>();
|
||||
public List<STGenericMaterial> ActiveMaterials = new List<STGenericMaterial>();
|
||||
|
||||
public List<ActiveTexture> Textures = new List<ActiveTexture>();
|
||||
|
||||
|
@ -241,7 +241,7 @@ namespace Toolbox.Library.Forms
|
|||
|
||||
private void gL_ControlLegacy2D1_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
if (ActiveObjects.Count <= 0 || ActiveMaterial == null || Runtime.OpenTKInitialized == false)
|
||||
if (!Runtime.OpenTKInitialized)
|
||||
return;
|
||||
|
||||
gL_ControlLegacy2D1.MakeCurrent();
|
||||
|
@ -289,7 +289,8 @@ namespace Toolbox.Library.Forms
|
|||
//Params include Amount to repeat
|
||||
DrawTexturedPlane(5);
|
||||
|
||||
DrawUVs(ActiveObjects);
|
||||
if (ActiveObjects.Count > 0)
|
||||
DrawUVs(ActiveObjects);
|
||||
|
||||
GL.PopMatrix();
|
||||
|
||||
|
|
68
Switch_Toolbox_Library/Forms/Editors/UV/UVEditorForm.Designer.cs
generated
Normal file
68
Switch_Toolbox_Library/Forms/Editors/UV/UVEditorForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,68 @@
|
|||
namespace Toolbox.Library.Forms
|
||||
{
|
||||
partial class UVEditorForm
|
||||
{
|
||||
/// <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.uvEditor1 = new Toolbox.Library.Forms.UVEditor();
|
||||
this.contentContainer.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// contentContainer
|
||||
//
|
||||
this.contentContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.contentContainer.Controls.Add(this.uvEditor1);
|
||||
this.contentContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.contentContainer.Location = new System.Drawing.Point(0, 0);
|
||||
this.contentContainer.Size = new System.Drawing.Size(595, 468);
|
||||
this.contentContainer.Controls.SetChildIndex(this.uvEditor1, 0);
|
||||
//
|
||||
// uvEditor1
|
||||
//
|
||||
this.uvEditor1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.uvEditor1.Location = new System.Drawing.Point(0, 25);
|
||||
this.uvEditor1.Name = "uvEditor1";
|
||||
this.uvEditor1.Size = new System.Drawing.Size(595, 443);
|
||||
this.uvEditor1.TabIndex = 11;
|
||||
//
|
||||
// UVEditorForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(595, 468);
|
||||
this.Name = "UVEditorForm";
|
||||
this.Text = "UV Editor";
|
||||
this.contentContainer.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private UVEditor uvEditor1;
|
||||
}
|
||||
}
|
38
Switch_Toolbox_Library/Forms/Editors/UV/UVEditorForm.cs
Normal file
38
Switch_Toolbox_Library/Forms/Editors/UV/UVEditorForm.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
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;
|
||||
|
||||
namespace Toolbox.Library.Forms
|
||||
{
|
||||
public partial class UVEditorForm : STForm
|
||||
{
|
||||
public UVEditorForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void LoadEditor(List<STGenericObject> Meshes)
|
||||
{
|
||||
List<STGenericMaterial> materials = new List<STGenericMaterial>();
|
||||
for (int i =0; i < Meshes.Count; i++)
|
||||
{
|
||||
if (Meshes[i].GetMaterial() != null)
|
||||
{
|
||||
materials.Add(Meshes[i].GetMaterial());
|
||||
}
|
||||
}
|
||||
|
||||
uvEditor1.ActiveObjects = Meshes;
|
||||
uvEditor1.ActiveMaterials = materials;
|
||||
uvEditor1.Textures.Clear();
|
||||
uvEditor1.Reset();
|
||||
uvEditor1.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
120
Switch_Toolbox_Library/Forms/Editors/UV/UVEditorForm.resx
Normal file
120
Switch_Toolbox_Library/Forms/Editors/UV/UVEditorForm.resx
Normal 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>
|
86
Switch_Toolbox_Library/Forms/Viewport.Designer.cs
generated
86
Switch_Toolbox_Library/Forms/Viewport.Designer.cs
generated
|
@ -29,6 +29,9 @@
|
|||
private void InitializeComponent()
|
||||
{
|
||||
this.normalsShadingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.stPanel1 = new Toolbox.Library.Forms.STPanel();
|
||||
this.chkDisplayAllModels = new Toolbox.Library.Forms.STCheckBox();
|
||||
this.stLabel1 = new Toolbox.Library.Forms.STLabel();
|
||||
this.drawContainersCB = new Toolbox.Library.Forms.STComboBox();
|
||||
this.panelViewport = new Toolbox.Library.Forms.STPanel();
|
||||
this.stContextMenuStrip1 = new Toolbox.Library.Forms.STMenuStrip();
|
||||
|
@ -51,11 +54,9 @@
|
|||
this.resetPoseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.reloadShadersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.stPanel1 = new Toolbox.Library.Forms.STPanel();
|
||||
this.stLabel1 = new Toolbox.Library.Forms.STLabel();
|
||||
this.chkDisplayAllModels = new Toolbox.Library.Forms.STCheckBox();
|
||||
this.stContextMenuStrip1.SuspendLayout();
|
||||
this.uVViewerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.stPanel1.SuspendLayout();
|
||||
this.stContextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// normalsShadingToolStripMenuItem
|
||||
|
@ -68,6 +69,38 @@
|
|||
this.normalsShadingToolStripMenuItem.Text = "Normals Shading";
|
||||
this.normalsShadingToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
|
||||
//
|
||||
// stPanel1
|
||||
//
|
||||
this.stPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.stPanel1.Controls.Add(this.chkDisplayAllModels);
|
||||
this.stPanel1.Controls.Add(this.stLabel1);
|
||||
this.stPanel1.Controls.Add(this.drawContainersCB);
|
||||
this.stPanel1.Location = new System.Drawing.Point(0, 26);
|
||||
this.stPanel1.Name = "stPanel1";
|
||||
this.stPanel1.Size = new System.Drawing.Size(778, 24);
|
||||
this.stPanel1.TabIndex = 5;
|
||||
//
|
||||
// chkDisplayAllModels
|
||||
//
|
||||
this.chkDisplayAllModels.AutoSize = true;
|
||||
this.chkDisplayAllModels.Location = new System.Drawing.Point(282, 2);
|
||||
this.chkDisplayAllModels.Name = "chkDisplayAllModels";
|
||||
this.chkDisplayAllModels.Size = new System.Drawing.Size(74, 17);
|
||||
this.chkDisplayAllModels.TabIndex = 2;
|
||||
this.chkDisplayAllModels.Text = "Display All";
|
||||
this.chkDisplayAllModels.UseVisualStyleBackColor = true;
|
||||
this.chkDisplayAllModels.CheckedChanged += new System.EventHandler(this.chkDisplayAllModels_CheckedChanged);
|
||||
//
|
||||
// stLabel1
|
||||
//
|
||||
this.stLabel1.AutoSize = true;
|
||||
this.stLabel1.Location = new System.Drawing.Point(3, 3);
|
||||
this.stLabel1.Name = "stLabel1";
|
||||
this.stLabel1.Size = new System.Drawing.Size(83, 13);
|
||||
this.stLabel1.TabIndex = 1;
|
||||
this.stLabel1.Text = "Active Model(s):";
|
||||
//
|
||||
// drawContainersCB
|
||||
//
|
||||
this.drawContainersCB.BorderColor = System.Drawing.Color.Empty;
|
||||
|
@ -99,7 +132,8 @@
|
|||
this.shadingToolStripMenuItem,
|
||||
this.resetCameraToolStripMenuItem,
|
||||
this.resetPoseToolStripMenuItem,
|
||||
this.optionsToolStripMenuItem});
|
||||
this.optionsToolStripMenuItem,
|
||||
this.uVViewerToolStripMenuItem});
|
||||
this.stContextMenuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.stContextMenuStrip1.Name = "stContextMenuStrip1";
|
||||
this.stContextMenuStrip1.Size = new System.Drawing.Size(781, 24);
|
||||
|
@ -249,41 +283,16 @@
|
|||
// reloadShadersToolStripMenuItem
|
||||
//
|
||||
this.reloadShadersToolStripMenuItem.Name = "reloadShadersToolStripMenuItem";
|
||||
this.reloadShadersToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
|
||||
this.reloadShadersToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.reloadShadersToolStripMenuItem.Text = "Reload Shaders";
|
||||
this.reloadShadersToolStripMenuItem.Click += new System.EventHandler(this.reloadShadersToolStripMenuItem_Click);
|
||||
//
|
||||
// stPanel1
|
||||
// uVViewerToolStripMenuItem
|
||||
//
|
||||
this.stPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.stPanel1.Controls.Add(this.chkDisplayAllModels);
|
||||
this.stPanel1.Controls.Add(this.stLabel1);
|
||||
this.stPanel1.Controls.Add(this.drawContainersCB);
|
||||
this.stPanel1.Location = new System.Drawing.Point(0, 26);
|
||||
this.stPanel1.Name = "stPanel1";
|
||||
this.stPanel1.Size = new System.Drawing.Size(778, 24);
|
||||
this.stPanel1.TabIndex = 5;
|
||||
//
|
||||
// stLabel1
|
||||
//
|
||||
this.stLabel1.AutoSize = true;
|
||||
this.stLabel1.Location = new System.Drawing.Point(3, 3);
|
||||
this.stLabel1.Name = "stLabel1";
|
||||
this.stLabel1.Size = new System.Drawing.Size(83, 13);
|
||||
this.stLabel1.TabIndex = 1;
|
||||
this.stLabel1.Text = "Active Model(s):";
|
||||
//
|
||||
// chkDisplayAllModels
|
||||
//
|
||||
this.chkDisplayAllModels.AutoSize = true;
|
||||
this.chkDisplayAllModels.Location = new System.Drawing.Point(282, 2);
|
||||
this.chkDisplayAllModels.Name = "chkDisplayAllModels";
|
||||
this.chkDisplayAllModels.Size = new System.Drawing.Size(74, 17);
|
||||
this.chkDisplayAllModels.TabIndex = 2;
|
||||
this.chkDisplayAllModels.Text = "Display All";
|
||||
this.chkDisplayAllModels.UseVisualStyleBackColor = true;
|
||||
this.chkDisplayAllModels.CheckedChanged += new System.EventHandler(this.chkDisplayAllModels_CheckedChanged);
|
||||
this.uVViewerToolStripMenuItem.Name = "uVViewerToolStripMenuItem";
|
||||
this.uVViewerToolStripMenuItem.Size = new System.Drawing.Size(72, 20);
|
||||
this.uVViewerToolStripMenuItem.Text = "UV Viewer";
|
||||
this.uVViewerToolStripMenuItem.Click += new System.EventHandler(this.uVViewerToolStripMenuItem_Click);
|
||||
//
|
||||
// Viewport
|
||||
//
|
||||
|
@ -295,10 +304,10 @@
|
|||
this.Controls.Add(this.stContextMenuStrip1);
|
||||
this.Name = "Viewport";
|
||||
this.Size = new System.Drawing.Size(781, 522);
|
||||
this.stContextMenuStrip1.ResumeLayout(false);
|
||||
this.stContextMenuStrip1.PerformLayout();
|
||||
this.stPanel1.ResumeLayout(false);
|
||||
this.stPanel1.PerformLayout();
|
||||
this.stContextMenuStrip1.ResumeLayout(false);
|
||||
this.stContextMenuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -331,5 +340,6 @@
|
|||
private Forms.STPanel stPanel1;
|
||||
private Forms.STLabel stLabel1;
|
||||
private Forms.STCheckBox chkDisplayAllModels;
|
||||
private System.Windows.Forms.ToolStripMenuItem uVViewerToolStripMenuItem;
|
||||
}
|
||||
}
|
|
@ -90,6 +90,14 @@ namespace Toolbox.Library
|
|||
}
|
||||
}
|
||||
|
||||
public DrawableContainer GetActiveContainer()
|
||||
{
|
||||
if (drawContainersCB.SelectedIndex - 1 < 0)
|
||||
return null;
|
||||
|
||||
return DrawableContainers[drawContainersCB.SelectedIndex - 1];
|
||||
}
|
||||
|
||||
//Reloads drawable containers with the active container selected
|
||||
public void ReloadDrawables(DrawableContainer ActiveContainer)
|
||||
{
|
||||
|
@ -546,5 +554,33 @@ namespace Toolbox.Library
|
|||
DrawAllActive();
|
||||
}
|
||||
}
|
||||
|
||||
private void uVViewerToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!Runtime.UseOpenGL)
|
||||
return;
|
||||
|
||||
var container = GetActiveContainer();
|
||||
if (container == null) return;
|
||||
|
||||
List<STGenericObject> meshes = new List<STGenericObject>();
|
||||
for (int i = 0; i < container.Drawables.Count; i++)
|
||||
{
|
||||
if (container.Drawables[i] is IMeshContainer)
|
||||
{
|
||||
for (int m = 0; m < ((IMeshContainer)container.Drawables[i]).Meshes.Count; m++)
|
||||
meshes.Add(((IMeshContainer)container.Drawables[i]).Meshes[m]);
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine($"MeshCount " + meshes.Count);
|
||||
|
||||
if (meshes.Count > 0)
|
||||
{
|
||||
UVEditorForm uvEditor1 = new UVEditorForm();
|
||||
uvEditor1.LoadEditor(meshes);
|
||||
uvEditor1.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.Text;
|
|||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Security.Cryptography;
|
||||
using Toolbox.Library.Security.Cryptography;
|
||||
|
||||
namespace Toolbox.Library.IO
|
||||
{
|
||||
|
|
|
@ -251,14 +251,17 @@ namespace Toolbox.Library
|
|||
|
||||
for (int i = 0; i < FileNodes.Count; i++)
|
||||
{
|
||||
FileNodes[i].Item1.FileName = SetFullPath(FileNodes[i].Item2, this);
|
||||
string NewName = SetFullPath(FileNodes[i].Item2, this);
|
||||
if (NewName != string.Empty)
|
||||
FileNodes[i].Item1.FileName = NewName;
|
||||
}
|
||||
}
|
||||
|
||||
private static string SetFullPath(TreeNode node, TreeNode root)
|
||||
{
|
||||
if (node.TreeView == null)
|
||||
return node.Text;
|
||||
if (node.TreeView == null) {
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
string nodePath = node.FullPath;
|
||||
int startIndex = nodePath.IndexOf(root.Text);
|
||||
|
@ -269,7 +272,11 @@ namespace Toolbox.Library
|
|||
string slashAlt = Path.AltDirectorySeparatorChar.ToString();
|
||||
|
||||
string SetPath = nodePath.Replace(root.Text + slash, string.Empty).Replace(slash ?? "", slashAlt);
|
||||
return !(SetPath == string.Empty) ? SetPath : node.Text;
|
||||
|
||||
Console.WriteLine($"FullPath { node.FullPath}");
|
||||
Console.WriteLine($"SetPath {SetPath}");
|
||||
|
||||
return SetPath;
|
||||
}
|
||||
|
||||
private void EnableContextMenu(ToolStripItemCollection Items, string Key, bool Enabled)
|
||||
|
@ -286,7 +293,7 @@ namespace Toolbox.Library
|
|||
Save("", true);
|
||||
}
|
||||
|
||||
public void Save(string FileName, bool UseDialog)
|
||||
private void Save(string FileName, bool UseDialog)
|
||||
{
|
||||
UpdateFileNames();
|
||||
|
||||
|
@ -882,12 +889,13 @@ namespace Toolbox.Library
|
|||
node.Nodes.RemoveAt(index);
|
||||
node.Nodes.Insert(index, NewNode);
|
||||
|
||||
rootNode.FileNodes.RemoveAt(index);
|
||||
rootNode.FileNodes.Insert(index, Tuple.Create(fileInfo, NewNode));
|
||||
|
||||
NewNode.ImageKey = replaceNode.ImageKey;
|
||||
NewNode.SelectedImageKey = replaceNode.SelectedImageKey;
|
||||
NewNode.Text = replaceNode.Text;
|
||||
|
||||
rootNode.FileNodes.RemoveAt(index);
|
||||
rootNode.FileNodes.Insert(index, Tuple.Create(fileInfo, NewNode));
|
||||
}
|
||||
|
||||
private void RenameAction(object sender, EventArgs args)
|
||||
|
|
13
Switch_Toolbox_Library/Interfaces/IMeshContainer.cs
Normal file
13
Switch_Toolbox_Library/Interfaces/IMeshContainer.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Toolbox.Library
|
||||
{
|
||||
public interface IMeshContainer
|
||||
{
|
||||
List<STGenericObject> Meshes { get; }
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
using System.Text;
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
namespace Toolbox.Library.Security.Cryptography
|
||||
{
|
||||
/// <summary>
|
||||
/// Computes a CRC32 checksum.
|
||||
|
|
|
@ -213,6 +213,12 @@
|
|||
<Compile Include="Compression\YAZ0.cs" />
|
||||
<Compile Include="Compression\ZCMP.cs" />
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="Forms\Editors\UV\UVEditorForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Editors\UV\UVEditorForm.Designer.cs">
|
||||
<DependentUpon>UVEditorForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\SizeTables\FileTableViewTPHD.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -225,6 +231,7 @@
|
|||
<Compile Include="Forms\SceneSelector.Designer.cs">
|
||||
<DependentUpon>SceneSelector.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interfaces\IMeshContainer.cs" />
|
||||
<Compile Include="Interfaces\ITextureContainer.cs" />
|
||||
<Compile Include="IO\Extensions\UintExtension.cs" />
|
||||
<Compile Include="Rendering\GenericModelRenderer\GenericModelRenderer.cs" />
|
||||
|
@ -908,6 +915,9 @@
|
|||
<EmbeddedResource Include="Forms\Editors\UV\UVEditor2.resx">
|
||||
<DependentUpon>UVEditor2.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Editors\UV\UVEditorForm.resx">
|
||||
<DependentUpon>UVEditorForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\SizeTables\FileTableViewTPHD.resx">
|
||||
<DependentUpon>FileTableViewTPHD.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -54,6 +54,24 @@ namespace Toolbox
|
|||
Application.Run(form);
|
||||
}
|
||||
|
||||
private static bool TryLoadZSTD()
|
||||
{
|
||||
try
|
||||
{
|
||||
String folder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
String filePath = Path.Combine(folder, Environment.Is64BitProcess ? "x64" : "x86", "libzstd.dll");
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
Assembly assembly = Assembly.LoadFile(filePath);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool TryLoadDirectXTex()
|
||||
{
|
||||
try
|
||||
|
|
|
@ -315,9 +315,6 @@
|
|||
<Content Include="Gl_EditorFramework.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="libzstd.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Lib\AampCommon.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
@ -507,6 +504,12 @@
|
|||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Projects\Recent\DUMMY.txt" />
|
||||
<Content Include="x64\libzstd.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="x86\libzstd.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="Resources\Save.png" />
|
||||
<None Include="Resources\UpdateIcon.png" />
|
||||
<None Include="Shader\Utility\PbrUtility.frag">
|
||||
|
|
BIN
Toolbox/x64/libzstd.dll
Normal file
BIN
Toolbox/x64/libzstd.dll
Normal file
Binary file not shown.
Loading…
Reference in a new issue