1
0
mirror of synced 2024-12-02 19:17:24 +01:00

Bind material enabling and hide properly in viewport

This commit is contained in:
KillzXGaming 2019-04-13 12:44:47 -04:00
parent 9940c6f10d
commit 8bfa2293a8
11 changed files with 11 additions and 14 deletions

Binary file not shown.

View File

@ -174,7 +174,7 @@ namespace Bfres.Structs
return ((FMDL)Parent.Parent).GetResFileU();
}
public bool Enabled = true;
public bool Enabled { get; set; } = true;
public bool isTransparent = false;
public override void OnClick(TreeView treeView)

View File

@ -602,11 +602,13 @@ namespace FirstPlugin
if (m.lodMeshes[m.DisplayLODIndex].faces.Count <= 3)
return;
var mat = m.GetMaterial();
if (shader != normalsShaderProgram)
{
SetRenderPass(m.GetMaterial(), shader, m, m.DisplayId);
SetUniforms(m.GetMaterial(), shader, m, m.DisplayId);
SetTextureUniforms(m.GetMaterial(), m, shader);
SetRenderPass(mat, shader, m, m.DisplayId);
SetUniforms(mat, shader, m, m.DisplayId);
SetTextureUniforms(mat, m, shader);
}
SetBoneUniforms(shader, mdl, m);
ApplyTransformFix(mdl, m, shader);
@ -616,7 +618,7 @@ namespace FirstPlugin
// if (!mdl.Skeleton.bones[m.boneIndx].Visible)
// m.Checked = false;
if (m.Checked && mdl.Skeleton.bones.Count > 0 && mdl.Skeleton.bones[m.BoneIndex].Visible)
if (m.Checked && mdl.Skeleton.bones.Count > 0 && mdl.Skeleton.bones[m.BoneIndex].Visible && mat.Enabled)
{
shader.SetVector3("materialSelectColor", new Vector3(0));
if (m.GetMaterial().IsSelected)

View File

@ -92,7 +92,7 @@
this.chkboxVisible.TabIndex = 43;
this.chkboxVisible.Text = "Visible";
this.chkboxVisible.UseVisualStyleBackColor = true;
this.chkboxVisible.CheckedChanged += new System.EventHandler(this.chkboxVisible_CheckedChanged_1);
this.chkboxVisible.CheckedChanged += new System.EventHandler(this.chkboxVisible_CheckedChanged);
//
// label3
//

View File

@ -64,7 +64,7 @@ namespace FirstPlugin.Forms
SetActiveGameByShader(material.shaderassign.ShaderArchive, material.shaderassign.ShaderModel);
chkboxVisible.Checked = mat.Enabled;
chkboxVisible.Bind(material, "Enabled");
FillForm();
@ -235,9 +235,8 @@ namespace FirstPlugin.Forms
}
}
private void chkboxVisible_CheckedChanged(object sender, EventArgs e)
{
material.Enabled = chkboxVisible.Checked;
private void chkboxVisible_CheckedChanged(object sender, EventArgs e) {
LibraryGUI.Instance.UpdateViewport();
}
private void textureRefListView_SelectedIndexChanged(object sender, EventArgs e)
@ -314,9 +313,5 @@ namespace FirstPlugin.Forms
private void textBoxShaderModel_TextChanged(object sender, EventArgs e) {
material.shaderassign.ShaderModel = textBoxShaderModel.Text;
}
private void chkboxVisible_CheckedChanged_1(object sender, EventArgs e) {
material.Enabled = chkboxVisible.Enabled;
}
}
}