From bf23d0e53cfb593995e6591862cdfb1fe9f78499 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Thu, 28 Sep 2023 14:21:23 +0300 Subject: [PATCH] Fix #112011: PLY export broken when mesh contains faces with >255 vertices MPoly -> offset indices refactor (7966cd16d6dc4) did not realize that due to forced triangulation the mesh changes, so we need to re-fetch the faces array after triangulating. Fixes #112011 --- source/blender/io/ply/exporter/ply_export_load_plydata.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/io/ply/exporter/ply_export_load_plydata.cc b/source/blender/io/ply/exporter/ply_export_load_plydata.cc index 570ffd755c6..b00101bfe35 100644 --- a/source/blender/io/ply/exporter/ply_export_load_plydata.cc +++ b/source/blender/io/ply/exporter/ply_export_load_plydata.cc @@ -174,7 +174,7 @@ void load_plydata(PlyData &plyData, Depsgraph *depsgraph, const PLYExportParams BKE_object_get_pre_modified_mesh(&export_object_eval_); bool force_triangulation = false; - const OffsetIndices faces = mesh->faces(); + OffsetIndices faces = mesh->faces(); for (const int i : faces.index_range()) { if (faces[i].size() > 255) { force_triangulation = true; @@ -186,6 +186,7 @@ void load_plydata(PlyData &plyData, Depsgraph *depsgraph, const PLYExportParams bool manually_free_mesh = false; if (export_params.export_triangulated_mesh || force_triangulation) { mesh = do_triangulation(mesh, export_params.export_triangulated_mesh); + faces = mesh->faces(); manually_free_mesh = true; }