Fix #121459: STL / Alembic / PLY export empty meshes in editmode

Export would also assert in debug builds.

Similar to f8b11528b2, this now ensures we have mesh data in editmode.

Pull Request: https://projects.blender.org/blender/blender/pulls/121512
This commit is contained in:
Philipp Oeser
2024-05-07 15:20:03 +02:00
committed by Philipp Oeser
parent 238ee9683a
commit 3dd08beab3
3 changed files with 12 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
#include "BKE_lib_id.hh"
#include "BKE_material.h"
#include "BKE_mesh.hh"
#include "BKE_mesh_wrapper.hh"
#include "BKE_object.hh"
#include "bmesh.hh"
@@ -142,6 +143,9 @@ void ABCGenericMeshWriter::do_write(HierarchyContext &context)
return;
}
/* Ensure data exists if currently in edit mode. */
BKE_mesh_wrapper_ensure_mdata(mesh);
if (args_.export_params->triangulate) {
const bool tag_only = false;
const int quad_method = args_.export_params->quad_method;

View File

@@ -13,6 +13,7 @@
#include "BKE_attribute.hh"
#include "BKE_lib_id.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_wrapper.hh"
#include "BKE_object.hh"
#include "BLI_color.hh"
#include "BLI_hash.hh"
@@ -359,6 +360,9 @@ void load_plydata(PlyData &plyData, Depsgraph *depsgraph, const PLYExportParams
Mesh *mesh = export_params.apply_modifiers ? BKE_object_get_evaluated_mesh(obj_eval) :
BKE_object_get_pre_modified_mesh(obj_eval);
/* Ensure data exists if currently in edit mode. */
BKE_mesh_wrapper_ensure_mdata(mesh);
bool force_triangulation = false;
OffsetIndices faces = mesh->faces();
for (const int i : faces.index_range()) {

View File

@@ -11,6 +11,7 @@
#include "BKE_context.hh"
#include "BKE_lib_id.hh"
#include "BKE_mesh_wrapper.hh"
#include "BKE_object.hh"
#include "BKE_report.hh"
#include "BKE_scene.hh"
@@ -105,6 +106,9 @@ void export_frame(Depsgraph *depsgraph,
Mesh *mesh = export_params.apply_modifiers ? BKE_object_get_evaluated_mesh(obj_eval) :
BKE_object_get_pre_modified_mesh(obj_eval);
/* Ensure data exists if currently in edit mode. */
BKE_mesh_wrapper_ensure_mdata(mesh);
/* Calculate transform. */
float global_scale = export_params.global_scale * scene_unit_scale;
float axes_transform[3][3];