Skip to content

Commit

Permalink
Fix major oversight
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeTwentyThree committed Dec 18, 2024
1 parent 3bf437a commit 1f7b165
Showing 1 changed file with 35 additions and 30 deletions.
65 changes: 35 additions & 30 deletions Nautilus/Utility/ThunderkitUtilities/ApplyMaterialModification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,51 +149,56 @@ public void ApplyMaterialModifications()
{
var useFilter = materialFilter.Length > 0;
string materialNameForFilter = null;

if (useFilter)
{
// Removes the "(Instance)" string from the end of the material name
materialNameForFilter = gameMaterial.name.EndsWith(" (Instance)") ?
gameMaterial.name.Substring(0, gameMaterial.name.Length - 11) : gameMaterial.name;
}

foreach (var searchMat in materialFilter)
if (useFilter)
{
if (useFilter && !materialNameForFilter.Equals(searchMat.name, StringComparison.OrdinalIgnoreCase))
continue;

for (var i = 0; i < texturePropertyNames.Length; i++)
var materialExistsInFilter = false;
foreach (var filterEntry in materialFilter)
{
gameMaterial.SetTexture(texturePropertyNames[i], texturePropertyValues[i]);
if (!materialNameForFilter.Equals(filterEntry.name, StringComparison.OrdinalIgnoreCase))
materialExistsInFilter = true;
}
if (!materialExistsInFilter) continue;
}

for (var i = 0; i < texturePropertyNames.Length; i++)
{
gameMaterial.SetTexture(texturePropertyNames[i], texturePropertyValues[i]);
}

for (var i = 0; i < colorPropertyNames.Length; i++)
{
gameMaterial.SetColor(colorPropertyNames[i], colorPropertyValues[i]);
}
for (var i = 0; i < colorPropertyNames.Length; i++)
{
gameMaterial.SetColor(colorPropertyNames[i], colorPropertyValues[i]);
}

for (var i = 0; i < floatPropertyNames.Length; i++)
{
gameMaterial.SetFloat(floatPropertyNames[i], floatPropertyValues[i]);
}
for (var i = 0; i < floatPropertyNames.Length; i++)
{
gameMaterial.SetFloat(floatPropertyNames[i], floatPropertyValues[i]);
}

for (var i = 0; i < enablePropertyNames.Length; i++)
{
gameMaterial.SetFloat(enablePropertyNames[i], enablePropertyValues[i] ? 1f : 0f);
}
for (var i = 0; i < enablePropertyNames.Length; i++)
{
gameMaterial.SetFloat(enablePropertyNames[i], enablePropertyValues[i] ? 1f : 0f);
}

for (var i = 0; i < keywordPropertyNames.Length; i++)
{
if (keywordPropertyValues[i])
gameMaterial.EnableKeyword(keywordPropertyNames[i]);
else
gameMaterial.DisableKeyword(keywordPropertyNames[i]);
}
for (var i = 0; i < keywordPropertyNames.Length; i++)
{
if (keywordPropertyValues[i])
gameMaterial.EnableKeyword(keywordPropertyNames[i]);
else
gameMaterial.DisableKeyword(keywordPropertyNames[i]);
}

for (var i = 0; i < vectorPropertyNames.Length; i++)
{
gameMaterial.SetVector(vectorPropertyNames[i], vectorPropertyValues[i]);
}
break;
for (var i = 0; i < vectorPropertyNames.Length; i++)
{
gameMaterial.SetVector(vectorPropertyNames[i], vectorPropertyValues[i]);
}
}
}
Expand Down

0 comments on commit 1f7b165

Please sign in to comment.