Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAras Pranckevicius <aras_p>2022-03-13 19:04:52 +0300
committerHoward Trickey <howard.trickey@gmail.com>2022-03-13 19:04:52 +0300
commit70720c42c21265d88e2182eebfe5d6544d197424 (patch)
tree509ef24dfbea05d5d78ba77267494dbf410c2031 /source/blender/io/wavefront_obj
parent91dbc28363e5450f241eb9696aaca29075c01d20 (diff)
Fix T96303: C++ OBJ exporter needs presets and skip modifiers.
This patch, D14303, from Aras Pranckevicius adds presets to the OBJ exporter, and also adds a checkbox (default on) to apply modifiers before export.
Diffstat (limited to 'source/blender/io/wavefront_obj')
-rw-r--r--source/blender/io/wavefront_obj/IO_wavefront_obj.h1
-rw-r--r--source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc4
-rw-r--r--source/blender/io/wavefront_obj/tests/obj_exporter_tests.hh1
3 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/io/wavefront_obj/IO_wavefront_obj.h b/source/blender/io/wavefront_obj/IO_wavefront_obj.h
index 2a35fbdb7ad..289e37b3885 100644
--- a/source/blender/io/wavefront_obj/IO_wavefront_obj.h
+++ b/source/blender/io/wavefront_obj/IO_wavefront_obj.h
@@ -55,6 +55,7 @@ struct OBJExportParams {
/* File Write Options. */
bool export_selected_objects;
+ bool apply_modifiers;
eEvaluationMode export_eval_mode;
bool export_uv;
bool export_normals;
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index 17176a235c2..b730c93bb7b 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@ -33,7 +33,9 @@ OBJMesh::OBJMesh(Depsgraph *depsgraph, const OBJExportParams &export_params, Obj
/* We need to copy the object because it may be in temporary space. */
Object *obj_eval = DEG_get_evaluated_object(depsgraph, mesh_object);
export_object_eval_ = *obj_eval;
- export_mesh_eval_ = BKE_object_get_evaluated_mesh(&export_object_eval_);
+ export_mesh_eval_ = export_params.apply_modifiers ?
+ BKE_object_get_evaluated_mesh(&export_object_eval_) :
+ BKE_object_get_pre_modified_mesh(&export_object_eval_);
mesh_eval_needs_free_ = false;
if (!export_mesh_eval_) {
diff --git a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.hh b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.hh
index e4339a289a8..42660bbbe56 100644
--- a/source/blender/io/wavefront_obj/tests/obj_exporter_tests.hh
+++ b/source/blender/io/wavefront_obj/tests/obj_exporter_tests.hh
@@ -86,6 +86,7 @@ struct OBJExportParamsDefault {
params.up_axis = OBJ_AXIS_Y_UP;
params.scaling_factor = 1.f;
+ params.apply_modifiers = true;
params.export_eval_mode = DAG_EVAL_VIEWPORT;
params.export_selected_objects = false;
params.export_uv = true;