Fix #2045 OBJ mtl export can have incorrect texture file name

This commit is contained in:
JannisX11 2024-01-02 23:22:43 +01:00
parent 2a2134c85c
commit 32bfa3273f

View File

@ -375,11 +375,15 @@ var codec = new Codec('obj', {
var mtlOutput = '# Made in Blockbench '+appVersion+'\n';;
for (var key in materials) {
for (let key in materials) {
if (materials.hasOwnProperty(key) && materials[key]) {
var tex = materials[key];
let tex = materials[key];
let name = tex.name;
if (name.substr(-4) !== '.png') {
name += '.png';
}
mtlOutput += 'newmtl m_' +key+ '\n'
mtlOutput += `map_Kd ${tex.name}\n`;
mtlOutput += `map_Kd ${name}\n`;
}
}
mtlOutput += 'newmtl none'