diff options
Diffstat (limited to 'source/blender/io/wavefront_obj/exporter/obj_exporter.cc')
-rw-r--r-- | source/blender/io/wavefront_obj/exporter/obj_exporter.cc | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/source/blender/io/wavefront_obj/exporter/obj_exporter.cc b/source/blender/io/wavefront_obj/exporter/obj_exporter.cc index 584d8ae4ec0..78b709c884a 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_exporter.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_exporter.cc @@ -68,6 +68,17 @@ static void print_exception_error(const std::system_error &ex) << std::endl; } +static bool is_curve_nurbs_compatible(const Nurb *nurb) +{ + while (nurb) { + if (nurb->type == CU_BEZIER || nurb->pntsv != 1) { + return false; + } + nurb = nurb->next; + } + return true; +} + /** * Filter supported objects from the Scene. * @@ -104,27 +115,13 @@ filter_supported_objects(Depsgraph *depsgraph, const OBJExportParams &export_par } break; } - switch (nurb->type) { - case CU_NURBS: - if (export_params.export_curves_as_nurbs) { - /* Export in parameter form: control points. */ - r_exportable_nurbs.append( - std::make_unique<OBJCurve>(depsgraph, export_params, object)); - } - else { - /* Export in mesh form: edges and vertices. */ - r_exportable_meshes.append( - std::make_unique<OBJMesh>(depsgraph, export_params, object)); - } - break; - case CU_BEZIER: - /* Always export in mesh form: edges and vertices. */ - r_exportable_meshes.append( - std::make_unique<OBJMesh>(depsgraph, export_params, object)); - break; - default: - /* Other curve types are not supported. */ - break; + if (export_params.export_curves_as_nurbs && is_curve_nurbs_compatible(nurb)) { + /* Export in parameter form: control points. */ + r_exportable_nurbs.append(std::make_unique<OBJCurve>(depsgraph, export_params, object)); + } + else { + /* Export in mesh form: edges and vertices. */ + r_exportable_meshes.append(std::make_unique<OBJMesh>(depsgraph, export_params, object)); } break; } |