1
0
mirror of synced 2024-11-12 02:00:50 +01:00

Make placeholder textures optional on import

This commit is contained in:
KillzXGaming 2019-05-14 20:27:14 -04:00
parent 9d1d7fd7b2
commit 85cd8dcafc
10 changed files with 116 additions and 86 deletions

Binary file not shown.

View File

@ -727,92 +727,98 @@ namespace Bfres.Structs
}
fmat.Text = mat.Text;
//Setup placeholder textures
//Note we can't add/remove samplers so we must fill these slots
foreach (var t in fmat.TextureMaps)
{
t.wrapModeS = 0;
t.wrapModeT = 0;
switch (t.Type)
{
case STGenericMatTexture.TextureType.Diffuse:
t.Name = "Basic_Alb";
break;
case STGenericMatTexture.TextureType.Emission:
t.Name = "Basic_Emm";
break;
case STGenericMatTexture.TextureType.Normal:
t.Name = "Basic_Nrm";
break;
case STGenericMatTexture.TextureType.Specular:
t.Name = "Basic_Spm";
break;
case STGenericMatTexture.TextureType.SphereMap:
t.Name = "Basic_Sphere";
break;
case STGenericMatTexture.TextureType.Metalness:
t.Name = "Basic_Mtl";
break;
case STGenericMatTexture.TextureType.Roughness:
t.Name = "Basic_Rgh";
break;
case STGenericMatTexture.TextureType.MRA:
t.Name = "Basic_MRA";
break;
case STGenericMatTexture.TextureType.Shadow:
t.Name = "Basic_Bake_st0";
break;
case STGenericMatTexture.TextureType.Light:
t.Name = "Basic_Bake_st1";
break;
}
}
if (PluginRuntime.bntxContainers.Count > 0 && Parent != null)
if (settings.GeneratePlaceholderTextures)
{
foreach (var node in Parent.Parent.Nodes)
//Setup placeholder textures
//Note we can't add/remove samplers so we must fill these slots
foreach (var t in fmat.TextureMaps)
{
if (node is BNTX)
t.wrapModeS = 0;
t.wrapModeT = 0;
switch (t.Type)
{
var bntx = (BNTX)node;
bntx.ImportBasicTextures("Basic_Alb");
bntx.ImportBasicTextures("Basic_Nrm");
bntx.ImportBasicTextures("Basic_Spm");
bntx.ImportBasicTextures("Basic_Sphere");
bntx.ImportBasicTextures("Basic_Mtl");
bntx.ImportBasicTextures("Basic_Rgh");
bntx.ImportBasicTextures("Basic_MRA");
bntx.ImportBasicTextures("Basic_Bake_st0");
bntx.ImportBasicTextures("Basic_Bake_st1");
bntx.ImportBasicTextures("Basic_Emm");
case STGenericMatTexture.TextureType.Diffuse:
t.Name = "Basic_Alb";
break;
case STGenericMatTexture.TextureType.Emission:
t.Name = "Basic_Emm";
break;
case STGenericMatTexture.TextureType.Normal:
t.Name = "Basic_Nrm";
break;
case STGenericMatTexture.TextureType.Specular:
t.Name = "Basic_Spm";
break;
case STGenericMatTexture.TextureType.SphereMap:
t.Name = "Basic_Sphere";
break;
case STGenericMatTexture.TextureType.Metalness:
t.Name = "Basic_Mtl";
break;
case STGenericMatTexture.TextureType.Roughness:
t.Name = "Basic_Rgh";
break;
case STGenericMatTexture.TextureType.MRA:
t.Name = "Basic_MRA";
break;
case STGenericMatTexture.TextureType.Shadow:
t.Name = "Basic_Bake_st0";
break;
case STGenericMatTexture.TextureType.Light:
t.Name = "Basic_Bake_st1";
break;
}
}
}
if (PluginRuntime.ftexContainers.Count > 0 && Parent != null)
{
foreach (var node in Parent.Parent.Nodes)
{
if (node is BFRESGroupNode)
{
if (((BFRESGroupNode)node).Type == BRESGroupType.Textures)
{
var ftexCont = (BFRESGroupNode)node;
ftexCont.ImportBasicTextures("Basic_Alb");
ftexCont.ImportBasicTextures("Basic_Nrm");
ftexCont.ImportBasicTextures("Basic_Spm");
ftexCont.ImportBasicTextures("Basic_Sphere");
ftexCont.ImportBasicTextures("Basic_Mtl");
ftexCont.ImportBasicTextures("Basic_Rgh");
ftexCont.ImportBasicTextures("Basic_MRA");
ftexCont.ImportBasicTextures("Basic_Bake_st0");
ftexCont.ImportBasicTextures("Basic_Bake_st1");
ftexCont.ImportBasicTextures("Basic_Emm");
if (PluginRuntime.bntxContainers.Count > 0 && Parent != null)
{
foreach (var node in Parent.Parent.Nodes)
{
if (node is BNTX)
{
var bntx = (BNTX)node;
bntx.ImportBasicTextures("Basic_Alb");
bntx.ImportBasicTextures("Basic_Nrm");
bntx.ImportBasicTextures("Basic_Spm");
bntx.ImportBasicTextures("Basic_Sphere");
bntx.ImportBasicTextures("Basic_Mtl");
bntx.ImportBasicTextures("Basic_Rgh");
bntx.ImportBasicTextures("Basic_MRA");
bntx.ImportBasicTextures("Basic_Bake_st0");
bntx.ImportBasicTextures("Basic_Bake_st1");
bntx.ImportBasicTextures("Basic_Emm");
}
}
}
if (PluginRuntime.ftexContainers.Count > 0 && Parent != null)
{
foreach (var node in Parent.Parent.Nodes)
{
if (node is BFRESGroupNode)
{
if (((BFRESGroupNode)node).Type == BRESGroupType.Textures)
{
var ftexCont = (BFRESGroupNode)node;
ftexCont.ImportBasicTextures("Basic_Alb");
ftexCont.ImportBasicTextures("Basic_Nrm");
ftexCont.ImportBasicTextures("Basic_Spm");
ftexCont.ImportBasicTextures("Basic_Sphere");
ftexCont.ImportBasicTextures("Basic_Mtl");
ftexCont.ImportBasicTextures("Basic_Rgh");
ftexCont.ImportBasicTextures("Basic_MRA");
ftexCont.ImportBasicTextures("Basic_Bake_st0");
ftexCont.ImportBasicTextures("Basic_Bake_st1");
ftexCont.ImportBasicTextures("Basic_Emm");
}
}
}
}
}
foreach (var tex in mat.TextureMaps)

View File

@ -61,6 +61,7 @@
this.chkBoxFlipUvsY = new Switch_Toolbox.Library.Forms.STCheckBox();
this.chkBoxImportBones = new Switch_Toolbox.Library.Forms.STCheckBox();
this.panel8 = new Switch_Toolbox.Library.Forms.STPanel();
this.chkPlaceHolderTextures = new Switch_Toolbox.Library.Forms.STCheckBox();
this.chkBoxImportMat = new Switch_Toolbox.Library.Forms.STCheckBox();
this.chkBoxParamDefaults = new Switch_Toolbox.Library.Forms.STCheckBox();
this.chkBoxRotNegative90Y = new Switch_Toolbox.Library.Forms.STCheckBox();
@ -439,6 +440,7 @@
//
// panel8
//
this.panel8.Controls.Add(this.chkPlaceHolderTextures);
this.panel8.Controls.Add(this.chkBoxImportMat);
this.panel8.Controls.Add(this.chkBoxParamDefaults);
this.panel8.Controls.Add(this.chkBoxRotNegative90Y);
@ -464,12 +466,24 @@
this.panel8.Size = new System.Drawing.Size(524, 327);
this.panel8.TabIndex = 11;
//
// chkPlaceHolderTextures
//
this.chkPlaceHolderTextures.AutoSize = true;
this.chkPlaceHolderTextures.Location = new System.Drawing.Point(3, 204);
this.chkPlaceHolderTextures.Name = "chkPlaceHolderTextures";
this.chkPlaceHolderTextures.Size = new System.Drawing.Size(160, 17);
this.chkPlaceHolderTextures.TabIndex = 32;
this.chkPlaceHolderTextures.Text = "Create Placeholder Textures";
this.chkPlaceHolderTextures.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.chkPlaceHolderTextures.UseVisualStyleBackColor = true;
this.chkPlaceHolderTextures.CheckedChanged += new System.EventHandler(this.chkPlaceHolderTextures_CheckedChanged);
//
// chkBoxImportMat
//
this.chkBoxImportMat.AutoSize = true;
this.chkBoxImportMat.Checked = true;
this.chkBoxImportMat.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkBoxImportMat.Location = new System.Drawing.Point(3, 218);
this.chkBoxImportMat.Location = new System.Drawing.Point(3, 240);
this.chkBoxImportMat.Name = "chkBoxImportMat";
this.chkBoxImportMat.Size = new System.Drawing.Size(88, 17);
this.chkBoxImportMat.TabIndex = 31;
@ -503,7 +517,7 @@
// textBoxMaterialPath
//
this.textBoxMaterialPath.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBoxMaterialPath.Location = new System.Drawing.Point(3, 241);
this.textBoxMaterialPath.Location = new System.Drawing.Point(3, 263);
this.textBoxMaterialPath.Name = "textBoxMaterialPath";
this.textBoxMaterialPath.ReadOnly = true;
this.textBoxMaterialPath.Size = new System.Drawing.Size(162, 20);
@ -730,7 +744,7 @@
this.tabPageAdvanced.Location = new System.Drawing.Point(4, 25);
this.tabPageAdvanced.Name = "tabPageAdvanced";
this.tabPageAdvanced.Padding = new System.Windows.Forms.Padding(3);
this.tabPageAdvanced.Size = new System.Drawing.Size(530, 333);
this.tabPageAdvanced.Size = new System.Drawing.Size(192, 71);
this.tabPageAdvanced.TabIndex = 0;
this.tabPageAdvanced.Text = "Advanced Settings";
//
@ -747,7 +761,7 @@
this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stPanel1.Location = new System.Drawing.Point(3, 3);
this.stPanel1.Name = "stPanel1";
this.stPanel1.Size = new System.Drawing.Size(524, 327);
this.stPanel1.Size = new System.Drawing.Size(186, 65);
this.stPanel1.TabIndex = 17;
//
// BfresModelImportSettings
@ -844,5 +858,6 @@
private Switch_Toolbox.Library.Forms.STCheckBox chkBoxParamDefaults;
private Switch_Toolbox.Library.Forms.STCheckBox chkBoxImportMat;
private Switch_Toolbox.Library.Forms.STPanel stPanel1;
private Switch_Toolbox.Library.Forms.STCheckBox chkPlaceHolderTextures;
}
}

View File

@ -51,6 +51,8 @@ namespace FirstPlugin
public bool SetDefaultParamData;
public int SkinCountLimit;
public bool GeneratePlaceholderTextures = true;
public void DisableMaterialEdits()
{
textBoxMaterialPath.Visible = false;
@ -200,6 +202,8 @@ namespace FirstPlugin
//Thanks Wexos!
private void BfresModelImportSettings_Load(object sender, EventArgs e)
{
chkPlaceHolderTextures.Checked = GeneratePlaceholderTextures;
comboBoxFormatPositions.Items.Add(AttribFormat.Format_32_32_32_Single);
comboBoxFormatPositions.Items.Add(AttribFormat.Format_16_16_16_16_Single);
comboBoxFormatPositions.Items.Add(AttribFormat.Format_16_16_16_16_SNorm);
@ -330,5 +334,10 @@ namespace FirstPlugin
else
EnableMaterialEdits();
}
private void chkPlaceHolderTextures_CheckedChanged(object sender, EventArgs e)
{
GeneratePlaceholderTextures = chkPlaceHolderTextures.Checked;
}
}
}

View File

@ -15,12 +15,12 @@ namespace Switch_Toolbox.Library
{
public enum STChannelType
{
Red,
Green,
Blue,
Alpha,
One,
Zero
Red = 0,
Green = 1,
Blue = 2,
Alpha = 3,
One = 4,
Zero = 5,
}
public enum PlatformSwizzle