1
0
mirror of synced 2024-12-11 23:36:01 +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(); return ((FMDL)Parent.Parent).GetResFileU();
} }
public bool Enabled = true; public bool Enabled { get; set; } = true;
public bool isTransparent = false; public bool isTransparent = false;
public override void OnClick(TreeView treeView) public override void OnClick(TreeView treeView)

View File

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

View File

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

View File

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