1
0
mirror of synced 2024-11-30 18:24:39 +01:00

Some fixes

Fixed loading files from clicked on when a single instance of the tool is used.
Fixed the UV editor, which loads materails and texture maps properly.
Adjusted loading archives which produced some duplicate file issues when the archive loads the file, and a tree node is clicked on. Ie bntx clearing, but another one would stay in memory.
Fixed bntx replacing.
This commit is contained in:
KillzXGaming 2019-08-12 15:19:30 -04:00
parent 78c7ecff71
commit cb13c0a00a
15 changed files with 237 additions and 88 deletions

View File

@ -283,6 +283,7 @@ namespace UKing.Actors
entry.Info = info.Value;
entry.Text = info.Value.MessageName;
Categories[catgeory].Nodes.Add(entry);
entry.ReloadActorProperties();
}
}
@ -342,7 +343,30 @@ namespace UKing.Actors
Models = new ActorModel();
Parameters = new ActorParameters();
string bfresName = Info.BfresName;
//Load our texture paths if they exist
string texPathNX = $"{Runtime.BotwGamePath}/Model/{bfresName}.Tex.sbfres";
string tex1Path = $"{Runtime.BotwGamePath}/Model/{bfresName}.Tex1.sbfres";
string tex2Path = $"{Runtime.BotwGamePath}/Model/{bfresName}.Tex2.sbfres";
if (File.Exists(texPathNX))
Textures.FilePathTex1 = texPathNX;
if (File.Exists(tex1Path))
Textures.FilePathTex1 = tex1Path;
if (File.Exists(tex2Path))
Textures.FilePathTex2 = tex2Path;
//Load model and animation paths if they exist
string modelPath = $"{Runtime.BotwGamePath}/Model/{bfresName}.sbfres";
string animationPath = $"{Runtime.BotwGamePath}/Model/{bfresName}_Animation.sbfres";
if (File.Exists(modelPath))
Models.FilePathModel = modelPath;
if (File.Exists(animationPath))
Models.FilePathAnimation = animationPath;
//Load any cached paths
}

View File

@ -769,7 +769,6 @@ namespace FirstPlugin
reader.Position = 0;
}
LoadMenus(IsWiiU);
@ -1783,7 +1782,7 @@ namespace FirstPlugin
public static void SetShaderAssignAttributes(FSHP shape)
{
var shd = shape.GetMaterial().shaderassign;
var shd = shape.GetFMAT().shaderassign;
foreach (var att in shape.vertexAttributes)
{
@ -1913,7 +1912,7 @@ namespace FirstPlugin
if (!IsWiiU)
{
Syroot.NintenTools.NSW.Bfres.VertexBuffer vtx = shp.VertexBuffer;
Syroot.NintenTools.NSW.Bfres.Material mat = shp.GetMaterial().Material;
Syroot.NintenTools.NSW.Bfres.Material mat = shp.GetFMAT().Material;
Syroot.NintenTools.NSW.Bfres.ShaderAssign shdr = mat.ShaderAssign;
for (int att = 0; att < vtx.Attributes.Count; att++)
@ -1930,7 +1929,7 @@ namespace FirstPlugin
else
{
Syroot.NintenTools.Bfres.VertexBuffer vtx = shp.VertexBufferU;
Syroot.NintenTools.Bfres.Material mat = shp.GetMaterial().MaterialU;
Syroot.NintenTools.Bfres.Material mat = shp.GetFMAT().MaterialU;
Syroot.NintenTools.Bfres.ShaderAssign shdr = mat.ShaderAssign;
for (int att = 0; att < vtx.Attributes.Count; att++)

View File

@ -384,8 +384,8 @@ namespace Bfres.Structs
bool UseUVLayer2 = false;
//for BOTW if it uses UV layer 2 for normal maps use second UV map
if (shp.GetMaterial().shaderassign.options.ContainsKey("uking_texture2_texcoord")) {
float value = float.Parse(shp.GetMaterial().shaderassign.options["uking_texture2_texcoord"]);
if (shp.GetFMAT().shaderassign.options.ContainsKey("uking_texture2_texcoord")) {
float value = float.Parse(shp.GetFMAT().shaderassign.options["uking_texture2_texcoord"]);
if (value == 1)
UseUVLayer2 = true;

View File

@ -736,6 +736,19 @@ namespace Bfres.Structs
public float MaxLod;
public float BiasLod;
public override STGenericTexture GetTexture()
{
foreach (var bntx in PluginRuntime.bntxContainers)
if (bntx.Textures.ContainsKey(this.Name))
return bntx.Textures[this.Name];
foreach (var ftexCont in PluginRuntime.ftexContainers)
if (ftexCont.ResourceNodes.ContainsKey(this.Name))
return (FTEX)ftexCont.ResourceNodes[this.Name];
return null;
}
public MatTexture()
{

View File

@ -228,7 +228,12 @@ namespace Bfres.Structs
return ((FMDL)Parent.Parent);
}
public FMAT GetMaterial()
public FMAT GetFMAT()
{
return (FMAT)GetMaterial();
}
public override STGenericMaterial GetMaterial()
{
if (Parent == null)
STErrorDialog.Show($"Error! Shape {Text} has no parent node!", "GetMaterial", "");
@ -611,7 +616,7 @@ namespace Bfres.Structs
//check second UV layer
if (Parent != null) {
UseUVLayer2 = GetMaterial().IsNormalMapTexCoord2();
UseUVLayer2 = GetFMAT().IsNormalMapTexCoord2();
}
CalculateTangentBitangent(UseUVLayer2);
@ -720,9 +725,9 @@ namespace Bfres.Structs
bool UseUVLayer2 = false;
//for BOTW if it uses UV layer 2 for normal maps use second UV map
if (GetMaterial().shaderassign.options.ContainsKey("uking_texture2_texcoord"))
if (GetFMAT().shaderassign.options.ContainsKey("uking_texture2_texcoord"))
{
float value = float.Parse(GetMaterial().shaderassign.options["uking_texture2_texcoord"]);
float value = float.Parse(GetFMAT().shaderassign.options["uking_texture2_texcoord"]);
if (value == 1)
UseUVLayer2 = true;
@ -778,7 +783,7 @@ namespace Bfres.Structs
if (sfd.ShowDialog() == DialogResult.OK)
{
GetMaterial().Material.Export(sfd.FileName, GetResFile());
GetFMAT().Material.Export(sfd.FileName, GetResFile());
}
}
public void ReplaceMaterials(object sender, EventArgs args)
@ -790,7 +795,7 @@ namespace Bfres.Structs
if (ofd.ShowDialog() == DialogResult.OK)
{
GetMaterial().Material.Import(ofd.FileName);
GetFMAT().Material.Import(ofd.FileName);
}
}
public void Export(object sender, EventArgs args)
@ -909,7 +914,7 @@ namespace Bfres.Structs
CreateIndexList(obj, (FMDL)Parent.Parent, settings.LimitSkinCount, ForceSkinInfluenceMax);
BoneIndices = GetIndices(GetParentModel().Skeleton);
ApplyImportSettings(settings, GetMaterial());
ApplyImportSettings(settings, GetFMAT());
OptmizeAttributeFormats();
SaveShape(IsWiiU);

View File

@ -238,7 +238,8 @@ namespace FirstPlugin
if (ContainerArray.Count == 0)
LoadFile(stream, Name);
PluginRuntime.bntxContainers.Add(this);
if (!PluginRuntime.bntxContainers.Contains(this))
PluginRuntime.bntxContainers.Add(this);
}
static bool IsLoadingArray = false;
@ -492,11 +493,20 @@ namespace FirstPlugin
BinaryTexFile = new BntxFile(stream);
Text = BinaryTexFile.Name;
//Dispose previous entries if bntx is being replaced or reloaded
foreach (var tex in Textures.Values)
{
tex.Texture.TextureData.Clear();
tex.Texture = null;
tex.DisposeRenderable();
}
Nodes.Clear();
Textures.Clear();
foreach (Texture tex in BinaryTexFile.Textures)
{
TextureData texData = new TextureData(tex, BinaryTexFile);
Nodes.Add(texData);
Textures.Add(tex.Name, texData);
}
@ -768,8 +778,16 @@ namespace FirstPlugin
if (result == DialogResult.Yes)
{
Nodes.Clear();
foreach (var tex in Textures.Values)
{
tex.DisposeRenderable();
tex.Texture.TextureData.Clear();
tex.Texture = null;
}
Textures.Clear();
Nodes.Clear();
GC.Collect();
}
}
@ -976,6 +994,7 @@ namespace FirstPlugin
private void Import(object sender, EventArgs args)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "BNTX |*.bntx;";
if (ofd.ShowDialog() == DialogResult.OK)
{

View File

@ -332,7 +332,7 @@ namespace FirstPlugin
{
if (models[0].shapes.Count > 0)
{
if (models[0].shapes[0].GetMaterial().shaderassign.ShaderModel == "uking_mat")
if (models[0].shapes[0].GetFMAT().shaderassign.ShaderModel == "uking_mat")
{
shader = OpenTKSharedResources.shaders["BFRES_Botw"];
@ -424,7 +424,7 @@ namespace FirstPlugin
for (int shp = 0; shp < models[m].shapes.Count; shp++)
{
if (models[m].shapes[shp].GetMaterial().isTransparent)
if (models[m].shapes[shp].GetFMAT().isTransparent)
transparent.Add(models[m].shapes[shp]);
else
opaque.Add(models[m].shapes[shp]);
@ -715,7 +715,7 @@ namespace FirstPlugin
if (m.lodMeshes[m.DisplayLODIndex].faces.Count <= 3)
return;
var mat = m.GetMaterial();
var mat = m.GetFMAT();
if (shader != OpenTKSharedResources.shaders["BFRES_Normals"])
{
@ -832,7 +832,7 @@ namespace FirstPlugin
for (int shp = 0; shp < models[m].shapes.Count; shp++)
{
//Update render pass aswell
CheckRenderPass(models[m].shapes[shp].GetMaterial());
CheckRenderPass(models[m].shapes[shp].GetFMAT());
models[m].shapes[shp].Offset = poffset * 4;
List<DisplayVertex> pv = models[m].shapes[shp].CreateDisplayVertices(models[m]);

View File

@ -118,7 +118,6 @@ namespace FirstPlugin.Forms
TextureMap.MinFilter = texmap.MinFilter;
TextureMap.MagFilter = texmap.MagFilter;
TextureMap.texture = genericTexture;
return TextureMap;
}
private void SetActiveGameByShader(string ShaderName, string ShaderMdlName)

View File

@ -36,17 +36,17 @@
this.stLabel3 = new Toolbox.Library.Forms.STLabel();
this.scaleXUD = new Toolbox.Library.Forms.NumericUpDownFloat();
this.stPanel1 = new Toolbox.Library.Forms.STPanel();
this.btnApplyTransform = new Toolbox.Library.Forms.STButton();
this.stComboBox1 = new Toolbox.Library.Forms.STComboBox();
this.barSlider1 = new ColorSlider.ColorSlider();
this.stLabel2 = new Toolbox.Library.Forms.STLabel();
this.comboBox2 = new Toolbox.Library.Forms.STComboBox();
this.comboBox1 = new Toolbox.Library.Forms.STComboBox();
this.stLabel1 = new Toolbox.Library.Forms.STLabel();
this.btnApplyTransform = new Toolbox.Library.Forms.STButton();
this.stPanel2 = new Toolbox.Library.Forms.STPanel();
this.stComboBox1 = new Toolbox.Library.Forms.STComboBox();
this.stButton1 = new Toolbox.Library.Forms.STButton();
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();
@ -199,16 +199,20 @@
this.stPanel1.Size = new System.Drawing.Size(605, 70);
this.stPanel1.TabIndex = 1;
//
// btnApplyTransform
// stComboBox1
//
this.btnApplyTransform.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
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;
this.btnApplyTransform.Text = "Apply Transform";
this.btnApplyTransform.UseVisualStyleBackColor = false;
this.btnApplyTransform.Click += new System.EventHandler(this.btnApplyTransform_Click);
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;
this.stComboBox1.SelectedIndexChanged += new System.EventHandler(this.stComboBox1_SelectedIndexChanged);
//
// barSlider1
//
@ -292,6 +296,17 @@
this.stLabel1.TabIndex = 4;
this.stLabel1.Text = "Active Channel:";
//
// btnApplyTransform
//
this.btnApplyTransform.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
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;
this.btnApplyTransform.Text = "Apply Transform";
this.btnApplyTransform.UseVisualStyleBackColor = false;
this.btnApplyTransform.Click += new System.EventHandler(this.btnApplyTransform_Click);
//
// stPanel2
//
this.stPanel2.Controls.Add(this.stButton1);
@ -308,19 +323,16 @@
this.stPanel2.Size = new System.Drawing.Size(159, 454);
this.stPanel2.TabIndex = 3;
//
// stComboBox1
// stButton1
//
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;
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;
this.stButton1.Click += new System.EventHandler(this.stButton1_Click);
//
// splitter1
//
@ -339,16 +351,6 @@
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);

View File

@ -31,9 +31,8 @@ namespace Toolbox.Library.Forms
public Vector2 UVScale = new Vector2(1);
public Vector2 UVTranslate = new Vector2(0);
public float UVRotate = 0;
public STGenericTexture texture;
public int UvChannelIndex;
public int mapMode = 0;
public int TextureIndex = -1;
public STTextureWrapMode WrapModeS = STTextureWrapMode.Repeat;
public STTextureWrapMode WrapModeT = STTextureWrapMode.Repeat;
@ -42,18 +41,37 @@ namespace Toolbox.Library.Forms
public STTextureMinFilter MinFilter = STTextureMinFilter.Linear;
public STTextureMagFilter MagFilter = STTextureMagFilter.Linear;
public uint texWidth = 0;
public uint texHeight = 0;
public uint Width = 0;
public uint Height = 0;
}
public ActiveTexture activeTexture = new ActiveTexture();
public float brightness = 0.5f; //To see uv maps easier
public int UvChannelIndex = 0;
public List<STGenericObject> ActiveObjects = new List<STGenericObject>();
public List<STGenericMaterial> ActiveMaterials = new List<STGenericMaterial>();
public List<STGenericObject> Objects = new List<STGenericObject>();
public List<ActiveTexture> Textures = new List<ActiveTexture>();
public List<STGenericObject> ActiveObjects
{
get
{
List<STGenericObject> objects = new List<STGenericObject>();
for (int i = 0; i < Objects.Count; i++)
{
if (Objects[i].GetMaterial() == ActiveMaterial)
objects.Add(Objects[i]);
}
return objects;
}
}
public List<STGenericMaterial> Materials = new List<STGenericMaterial>();
public List<STGenericTexture> Textures = new List<STGenericTexture>();
public List<ActiveTexture> ChannelTextures = new List<ActiveTexture>();
public STGenericMaterial ActiveMaterial;
bool IsSRTLoaded = false;
public void Reset()
@ -67,16 +85,18 @@ namespace Toolbox.Library.Forms
IsSRTLoaded = false;
comboBox2.Items.Clear();
stComboBox1.Items.Clear();
if (RenderTools.defaultTex != null)
texid = RenderTools.defaultTex.RenderableTex.TexID;
foreach (var item in Textures)
comboBox2.Items.Add(item.texture.Text);
foreach (var mat in Materials)
{
stComboBox1.Items.Add(mat.Text);
}
if (comboBox2.Items.Count > 0)
comboBox2.SelectedIndex = 0;
if (stComboBox1.Items.Count > 0)
stComboBox1.SelectedIndex = 0;
}
public int texid;
@ -262,10 +282,10 @@ namespace Toolbox.Library.Forms
float PlaneScaleX = 0.5f;
float PlaneScaleY = 0.5f;
if (activeTexture.texWidth != 0 && activeTexture.texHeight != 0)
if (activeTexture.Width != 0 && activeTexture.Height != 0)
{
PlaneScaleX = (float)gL_ControlLegacy2D1.Width / (float)activeTexture.texWidth;
PlaneScaleY = (float)gL_ControlLegacy2D1.Height / (float)activeTexture.texHeight;
PlaneScaleX = (float)gL_ControlLegacy2D1.Width / (float)activeTexture.Width;
PlaneScaleY = (float)gL_ControlLegacy2D1.Height / (float)activeTexture.Height;
}
@ -275,7 +295,7 @@ namespace Toolbox.Library.Forms
GL.Scale(PlaneScaleY * ZoomValue, -PlaneScaleX * ZoomValue, 1);
GL.Translate(PosX, PosY, 0);
if (activeTexture.texture != null)
if (activeTexture.TextureIndex != -1)
{
//Draws a textured plan for our uvs to show on
GL.Enable(EnableCap.Texture2D);
@ -325,8 +345,6 @@ namespace Toolbox.Library.Forms
Positions[2] = Positions[2] * scale;
Positions[3] = Positions[3] * scale;
int brightnessScale = (int)(brightness * 255);
GL.Begin(PrimitiveType.Quads);
GL.Color3(brightness, brightness, brightness);
GL.TexCoord2(TexCoords[0]);
@ -390,7 +408,7 @@ namespace Toolbox.Library.Forms
{
if (comboBox2.SelectedIndex >= 0)
{
activeTexture = Textures[comboBox2.SelectedIndex];
activeTexture = ChannelTextures[comboBox2.SelectedIndex];
UvChannelIndex = activeTexture.UvChannelIndex;
scaleXUD.Value = (decimal)activeTexture.UVScale.X;
@ -398,14 +416,14 @@ namespace Toolbox.Library.Forms
transXUD.Value = (decimal)activeTexture.UVTranslate.X;
transYUD.Value = (decimal)activeTexture.UVTranslate.Y;
var texture = activeTexture.texture;
var texture = Textures[activeTexture.TextureIndex];
if (texture.RenderableTex == null)
texture.LoadOpenGLTexture();
texid = texture.RenderableTex.TexID;
activeTexture.texWidth = texture.Width;
activeTexture.texHeight = texture.Height;
activeTexture.Width = texture.Width;
activeTexture.Height = texture.Height;
gL_ControlLegacy2D1.Invalidate();
@ -460,5 +478,48 @@ namespace Toolbox.Library.Forms
{
gL_ControlLegacy2D1.Invalidate();
}
private void stComboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (stComboBox1.SelectedIndex >= 0)
{
ActiveMaterial = Materials[stComboBox1.SelectedIndex];
ChannelTextures.Clear();
Textures.Clear();
comboBox2.Items.Clear();
foreach (var texMap in ActiveMaterial.TextureMaps)
{
var texture = texMap.GetTexture();
if (texture != null && !Textures.Contains(texture))
{
comboBox2.Items.Add(texture.Text);
Textures.Add(texture);
ActiveTexture tex = new ActiveTexture();
tex.TextureIndex = Textures.IndexOf(texture);
tex.Width = texture.Width;
tex.Height = texture.Height;
tex.MagFilter = texMap.MagFilter;
tex.MinFilter = texMap.MinFilter;
tex.UvChannelIndex = 0;
ChannelTextures.Add(tex);
}
}
comboBox2.SelectedIndex = 0;
}
}
private void barSlider1_Scroll(object sender, ScrollEventArgs e)
{
}
private void stButton1_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -19,18 +19,23 @@ namespace Toolbox.Library.Forms
public void LoadEditor(List<STGenericObject> Meshes)
{
List<STGenericMaterial> materials = new List<STGenericMaterial>();
for (int i =0; i < Meshes.Count; i++)
uvEditor1.Materials.Clear();
uvEditor1.Textures.Clear();
uvEditor1.Objects.Clear();
for (int i = 0; i < Meshes.Count; i++)
{
if (Meshes[i].GetMaterial() != null)
{
materials.Add(Meshes[i].GetMaterial());
var mat = Meshes[i].GetMaterial();
if (!uvEditor1.Materials.Contains(mat))
{
uvEditor1.Materials.Add(mat);
}
}
}
uvEditor1.ActiveObjects = Meshes;
uvEditor1.ActiveMaterials = materials;
uvEditor1.Textures.Clear();
uvEditor1.Objects = Meshes;
uvEditor1.Reset();
uvEditor1.Refresh();
}

View File

@ -398,6 +398,8 @@ namespace Toolbox.Library
{
if (animationPanel1.CurrentAnimation != null)
animationPanel1.ResetModels();
UpdateViewport();
}
}
@ -594,7 +596,7 @@ namespace Toolbox.Library
List<STGenericObject> meshes = new List<STGenericObject>();
for (int i = 0; i < container.Drawables.Count; i++)
{
if (container.Drawables[i] is IMeshContainer)
if (container.Drawables[i] is IMeshContainer && container.Drawables[i].Visible)
{
for (int m = 0; m < ((IMeshContainer)container.Drawables[i]).Meshes.Count; m++)
meshes.Add(((IMeshContainer)container.Drawables[i]).Meshes[m]);
@ -607,7 +609,7 @@ namespace Toolbox.Library
{
UVEditorForm uvEditor1 = new UVEditorForm();
uvEditor1.LoadEditor(meshes);
uvEditor1.Show();
uvEditor1.Show(this);
}
}

View File

@ -55,6 +55,16 @@ namespace Toolbox.Library
Replaced,
}
/// <summary>
/// Gets the texture that links to this material texture map
/// Used for UV editor
/// </summary>
/// <returns></returns>
public virtual STGenericTexture GetTexture()
{
return null;
}
public TextureType Type;
//An enum for the assumed texture type by sampler

View File

@ -849,14 +849,15 @@ namespace Toolbox.Library
if (file == null) //Format not supported so return
return;
ArchiveFileInfo.FileFormat = file;
if (Utils.HasInterface(file.GetType(), typeof(IEditor<>)))
{
OpenFormDialog(file);
}
else if (file is IArchiveFile)
{
if (ArchiveFileInfo.FileFormat != null)
ArchiveFileInfo.FileFormat.Unload();
var FileRoot = new ArchiveRootNodeWrapper(file.FileName, (IArchiveFile)file);
FileRoot.FillTreeNodes();
@ -869,7 +870,16 @@ namespace Toolbox.Library
ReplaceNode(this.Parent, treeview, this, FileRoot, RootNode);
}
else if (file is TreeNode)
{
if (ArchiveFileInfo.FileFormat != null)
ArchiveFileInfo.FileFormat.Unload();
ReplaceNode(this.Parent, treeview, this, (TreeNode)file, RootNode);
}
ArchiveFileInfo.FileFormat = file;
Console.WriteLine("replacedFileFormat ");
}
private void OpenFormDialog(IFileFormat fileFormat)

View File

@ -101,7 +101,7 @@ namespace Toolbox
protected override void OnCreateMainForm()
{
MainForm = new MainForm();
MainForm = Toolbox.MainForm.Instance;
}
}