Skip to content

Commit 83094cf

Browse files
authored
add secondary lowercase test when looking for material property by name (#1075)
1 parent 561712a commit 83094cf

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

3ds Max/Max2Babylon/Exporter/BabylonExporter.Material.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ protected ITexmap _getTexMapWithCache(IIGameMaterial materialNode, string name)
5757
{
5858
return texmap;
5959
}
60+
61+
// sometime the name of the material changed - plugin side effect with script material
62+
// so give a second chance with lowercase to be more resilient
63+
if (_mapCaches.TryGetValue(name.ToLower(), out texmap))
64+
{
65+
return texmap;
66+
}
67+
6068
// max 2022 maj introduce a change into the naming of the map.
6169
// the SDK do not return the name of the map anymore but a display name with camel style and space
6270
// Here a fix which maintain the old style and transform the name for a second try if failed.
@@ -75,7 +83,10 @@ protected ITexmap _getTexMap(IIGameMaterial materialNode, string name, bool cach
7583
{
7684
for (int i = 0; i < materialNode.MaxMaterial.NumSubTexmaps; i++)
7785
{
78-
if (materialNode.MaxMaterial.GetSubTexmapSlotName(i) == name)
86+
var slotName = materialNode.MaxMaterial.GetSubTexmapSlotName(i);
87+
// sometime the name of the material changed - plugin side effect with script material
88+
// so give a second chance with lowercase to be more resilient
89+
if (slotName == name || slotName == name.ToLower())
7990
{
8091
return materialNode.MaxMaterial.GetSubTexmap(i);
8192
}
@@ -90,6 +101,7 @@ protected ITexmap _getTexMap(IIGameMaterial materialNode, string name, bool cach
90101

91102
}
92103

104+
93105
/// <summary>
94106
/// Babylon custom attribute decorator
95107
/// </summary>

0 commit comments

Comments
 (0)