diff --git a/File_Format_Library/GUI/BFRES/Materials/SamplerEditor.cs b/File_Format_Library/GUI/BFRES/Materials/SamplerEditor.cs index 2d374336..a66d7a69 100644 --- a/File_Format_Library/GUI/BFRES/Materials/SamplerEditor.cs +++ b/File_Format_Library/GUI/BFRES/Materials/SamplerEditor.cs @@ -376,50 +376,46 @@ namespace FirstPlugin.Forms private void btnAdd_Click(object sender, EventArgs e) { - var result = MessageBox.Show("NOTE! Texture maps are adjusted by shader options which link by shaders. These are not possible to edit yet, do you want to continue?", "Material Editor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); - if (result == DialogResult.OK) + var tex = new MatTexture(); + tex.SamplerName = GetSamplerName("_a0"); + tex.FragShaderSampler = "_a0"; + tex.Name = "Untitled"; + tex.Type = Toolbox.Library.STGenericMatTexture.TextureType.Unknown; + tex.WrapModeS = STTextureWrapMode.Repeat; + tex.WrapModeT = STTextureWrapMode.Repeat; + tex.WrapModeW = STTextureWrapMode.Clamp; + + if (material.GetResFileU() != null) { - var tex = new MatTexture(); - tex.SamplerName = GetSamplerName("_a0"); - tex.FragShaderSampler = "_a0"; - tex.Name = "Untitled"; - tex.Type = Toolbox.Library.STGenericMatTexture.TextureType.Unknown; - tex.WrapModeS = STTextureWrapMode.Repeat; - tex.WrapModeT = STTextureWrapMode.Repeat; - tex.WrapModeW = STTextureWrapMode.Clamp; - - if (material.GetResFileU() != null) - { - var texSampler = new ResUGX2.TexSampler(); - texSampler.BorderType = ResUGX2.GX2TexBorderType.ClearBlack; - texSampler.ClampX = ResUGX2.GX2TexClamp.Wrap; - texSampler.ClampY = ResUGX2.GX2TexClamp.Wrap; - texSampler.ClampZ = ResUGX2.GX2TexClamp.Clamp; - texSampler.DepthCompareEnabled = false; - texSampler.DepthCompareFunc = ResUGX2.GX2CompareFunction.Never; - texSampler.MagFilter = ResUGX2.GX2TexXYFilterType.Point; - texSampler.MaxAnisotropicRatio = ResUGX2.GX2TexAnisoRatio.Ratio_1_1; - texSampler.MinFilter = ResUGX2.GX2TexXYFilterType.Point; - texSampler.MipFilter = ResUGX2.GX2TexMipFilterType.Linear; - texSampler.ZFilter = 0; - texSampler.MaxLod = 13; - texSampler.MinLod = 0; - texSampler.LodBias = 0; - tex.wiiUSampler = texSampler; - } - else - { - var texSampler = new ResNX.Sampler(); - tex.switchSampler = texSampler; - } - material.TextureMaps.Add(tex); - - var item = new ListViewItem(); - item.Text = "Untitled"; - item.SubItems.Add(tex.SamplerName); - item.SubItems.Add(tex.FragShaderSampler); - textureRefListView.Items.Add(item); + var texSampler = new ResUGX2.TexSampler(); + texSampler.BorderType = ResUGX2.GX2TexBorderType.ClearBlack; + texSampler.ClampX = ResUGX2.GX2TexClamp.Wrap; + texSampler.ClampY = ResUGX2.GX2TexClamp.Wrap; + texSampler.ClampZ = ResUGX2.GX2TexClamp.Clamp; + texSampler.DepthCompareEnabled = false; + texSampler.DepthCompareFunc = ResUGX2.GX2CompareFunction.Never; + texSampler.MagFilter = ResUGX2.GX2TexXYFilterType.Point; + texSampler.MaxAnisotropicRatio = ResUGX2.GX2TexAnisoRatio.Ratio_1_1; + texSampler.MinFilter = ResUGX2.GX2TexXYFilterType.Point; + texSampler.MipFilter = ResUGX2.GX2TexMipFilterType.Linear; + texSampler.ZFilter = 0; + texSampler.MaxLod = 13; + texSampler.MinLod = 0; + texSampler.LodBias = 0; + tex.wiiUSampler = texSampler; } + else + { + var texSampler = new ResNX.Sampler(); + tex.switchSampler = texSampler; + } + material.TextureMaps.Add(tex); + + var item = new ListViewItem(); + item.Text = "Untitled"; + item.SubItems.Add(tex.SamplerName); + item.SubItems.Add(tex.FragShaderSampler); + textureRefListView.Items.Add(item); } private void btnRemove_Click(object sender, EventArgs e) @@ -428,7 +424,7 @@ namespace FirstPlugin.Forms { string FirstSelecteItem = textureRefListView.SelectedItems[0].Text; - var result = MessageBox.Show("NOTE! Texture maps are adjusted by shader options which link by shaders. These are not possible to edit yet, do you want to continue?", "Material Editor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); + var result = MessageBox.Show("NOTE! Removing texture maps could cause issues with shaders, do you want to continue?", "Material Editor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); if (result == DialogResult.Yes) {