Fix error message with 0 faces

This commit is contained in:
JannisX11 2020-10-07 19:59:55 +02:00
parent 2d796348a6
commit 8a2df4501a

View File

@ -458,8 +458,8 @@ const Canvas = {
adaptObjectFaceGeo(cube) {
let {mesh} = cube;
let {geometry} = mesh;
if (!mesh.geometry.all_faces) mesh.geometry.all_faces = mesh.geometry.faces.slice();
mesh.geometry.faces.empty()
if (!geometry.all_faces) geometry.all_faces = geometry.faces.slice();
geometry.faces.empty()
geometry.all_faces.forEach(face => {
let bb_face = cube.faces[Canvas.face_order[face.materialIndex]];
@ -471,6 +471,10 @@ const Canvas = {
geometry.faces.push(face);
}
})
if (geometry.faces.length == 0) {
// Keek down face if no faces enabled
geometry.faces.push(geometry.all_faces[6], geometry.all_faces[7]);
}
geometry.elementsNeedUpdate = true;
},
ascendElementPosition(el, elmesh) {