1
0
mirror of synced 2025-01-19 01:14:08 +01:00

Add better notification for adding/removing shader linked material data.

This commit is contained in:
KillzXGaming 2019-06-07 17:28:06 -04:00
parent 890f5afcf7
commit 7348419be4
6 changed files with 64 additions and 58 deletions

Binary file not shown.

View File

@ -303,46 +303,50 @@ namespace FirstPlugin.Forms
private void btnAdd_Click(object sender, EventArgs e)
{
var tex = new MatTexture();
tex.SamplerName = GetSamplerName("_a0");
tex.FragShaderSampler = "_a0";
tex.Name = "Untitled";
tex.Type = Switch_Toolbox.Library.STGenericMatTexture.TextureType.Unknown;
tex.wrapModeS = 0;
tex.wrapModeT = 0;
tex.wrapModeW = 2;
if (material.GetResFileU() != null)
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 contiue?", "MateraiL Editor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
if (result == DialogResult.OK)
{
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 tex = new MatTexture();
tex.SamplerName = GetSamplerName("_a0");
tex.FragShaderSampler = "_a0";
tex.Name = "Untitled";
tex.Type = Switch_Toolbox.Library.STGenericMatTexture.TextureType.Unknown;
tex.wrapModeS = 0;
tex.wrapModeT = 0;
tex.wrapModeW = 2;
var item = new ListViewItem();
item.Text = "Untitled";
item.SubItems.Add(tex.SamplerName);
item.SubItems.Add(tex.FragShaderSampler);
textureRefListView.Items.Add(item);
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);
}
}
private void btnRemove_Click(object sender, EventArgs e)
@ -351,13 +355,7 @@ namespace FirstPlugin.Forms
{
string FirstSelecteItem = textureRefListView.SelectedItems[0].Text;
DialogResult result;
if (textureRefListView.SelectedIndices.Count == 1)
result = MessageBox.Show($"Are you sure you want to remove texture {FirstSelecteItem}? This could potentially break things!",
"Texture Map Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
else
result = MessageBox.Show("Are you sure you want to remove these textures? This could potentially break things!",
"Texture Map Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
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 contiue?", "MateraiL Editor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
if (result == DialogResult.Yes)
{

View File

@ -108,28 +108,36 @@ namespace FirstPlugin.Forms
private void btnAdd_Click(object sender, EventArgs e)
{
var edtior = new ShaderOptionsEditBox();
edtior.LoadOption("", "");
if (edtior.ShowDialog() == DialogResult.OK)
var result = MessageBox.Show("NOTE! Shader Options are link by shaders. These are not possible to edit yet, do you want to contiue?", "MateraiL Editor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
if (result == DialogResult.OK)
{
shaderOptionsListView.AddObject(new Options()
var edtior = new ShaderOptionsEditBox();
edtior.LoadOption("", "");
if (edtior.ShowDialog() == DialogResult.OK)
{
Name = edtior.textBoxName.Text,
Value = edtior.textBoxValue.Text,
});
material.shaderassign.options.Add(edtior.textBoxName.Text, edtior.textBoxValue.Text);
shaderOptionsListView.AddObject(new Options()
{
Name = edtior.textBoxName.Text,
Value = edtior.textBoxValue.Text,
});
material.shaderassign.options.Add(edtior.textBoxName.Text, edtior.textBoxValue.Text);
}
}
}
private void btnRemove_Click(object sender, EventArgs e)
{
if (shaderOptionsListView.SelectedObject != null)
var result = MessageBox.Show("NOTE! Shader Options are link by shaders. These are not possible to edit yet, do you want to contiue?", "MateraiL Editor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
if (result == DialogResult.OK)
{
var option = (Options)shaderOptionsListView.SelectedObject;
if (shaderOptionsListView.SelectedObject != null)
{
var option = (Options)shaderOptionsListView.SelectedObject;
material.shaderassign.options.Remove(option.Name);
shaderOptionsListView.RemoveObject(option);
material.shaderassign.options.Remove(option.Name);
shaderOptionsListView.RemoveObject(option);
}
}
}
}