From df2ee9f3417aca53d612e4850d20875d52490318 Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Sat, 30 Mar 2024 00:15:55 +0100 Subject: [PATCH] Fix issue with face template generator double used faces --- js/texturing/texture_generator.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/js/texturing/texture_generator.js b/js/texturing/texture_generator.js index 71eecc8b..4f84a829 100644 --- a/js/texturing/texture_generator.js +++ b/js/texturing/texture_generator.js @@ -711,9 +711,12 @@ const TextureGenerator = { let face = element.faces[fkey]; let tex = face.getTexture(); if (tex !== null) { - let face_old_pos_id = faceOldPositionIdentifier(face); - if (!double_use_faces[face_old_pos_id]) double_use_faces[face_old_pos_id] = []; - double_use_faces[face_old_pos_id].push([element, face]); + let face_old_pos_id; + if (tex instanceof Texture) { + face_old_pos_id = faceOldPositionIdentifier(face); + if (!double_use_faces[face_old_pos_id]) double_use_faces[face_old_pos_id] = []; + double_use_faces[face_old_pos_id].push([element, face]); + } let x = 0; let y = 0; switch (fkey) { @@ -734,10 +737,13 @@ const TextureGenerator = { for (let fkey in mesh.faces) { let face = mesh.faces[fkey]; if (face.vertices.length < 3) continue; - - let face_old_pos_id = faceOldPositionIdentifier(face); - if (!double_use_faces[face_old_pos_id]) double_use_faces[face_old_pos_id] = []; - double_use_faces[face_old_pos_id].push([element, face]); + + let face_old_pos_id; + if (face.getTexture() instanceof Texture) { + face_old_pos_id = faceOldPositionIdentifier(face); + if (!double_use_faces[face_old_pos_id]) double_use_faces[face_old_pos_id] = []; + double_use_faces[face_old_pos_id].push([element, face]); + } if (makeTexture instanceof Texture && BarItems.selection_mode.value !== 'object' && !face.isSelected(fkey)) continue; face_groups.push({