diff options
author | Hans Goudey <h.goudey@me.com> | 2022-02-18 18:50:29 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-02-18 18:50:29 +0300 |
commit | ddf189892c596d939228cc531b775bfd6708bb2d (patch) | |
tree | cb3b28527696ef5a6a3eec581a55e6141c2e686d /source/blender/io | |
parent | 48b17da1d9fe4d559c5b0fa58029df05a45d3960 (diff) |
Cleanup: Rename original curve object type enum
This commit renames enums related the "Curve" object type and ID type
to add `_LEGACY` to the end. The idea is to make our aspirations clearer
in the code and to avoid ambiguities between `CURVE` and `CURVES`.
Ref T95355
To summarize for the record, the plans are:
- In the short/medium term, replace the `Curve` object data type with
`Curves`
- In the longer term (no immediate plans), use a proper data block for
3D text and surfaces.
Differential Revision: https://developer.blender.org/D14114
Diffstat (limited to 'source/blender/io')
9 files changed, 18 insertions, 17 deletions
diff --git a/source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc b/source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc index 4723b89de08..d33adfdb4b9 100644 --- a/source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc +++ b/source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc @@ -190,7 +190,7 @@ ABCAbstractWriter *ABCHierarchyIterator::create_data_writer_for_object_type( return new ABCMeshWriter(writer_args); case OB_CAMERA: return new ABCCameraWriter(writer_args); - case OB_CURVE: + case OB_CURVES_LEGACY: if (params_.curves_as_mesh) { return new ABCCurveMeshWriter(writer_args); } diff --git a/source/blender/io/alembic/exporter/abc_writer_nurbs.cc b/source/blender/io/alembic/exporter/abc_writer_nurbs.cc index 5e307d59ed4..89ed7c5ce06 100644 --- a/source/blender/io/alembic/exporter/abc_writer_nurbs.cc +++ b/source/blender/io/alembic/exporter/abc_writer_nurbs.cc @@ -84,7 +84,7 @@ bool ABCNurbsWriter::check_is_animated(const HierarchyContext &context) const bool ABCNurbsWriter::is_supported(const HierarchyContext *context) const { - return ELEM(context->object->type, OB_SURF, OB_CURVE); + return ELEM(context->object->type, OB_SURF, OB_CURVES_LEGACY); } static void get_knots(std::vector<float> &knots, const int num_knots, float *nu_knots) diff --git a/source/blender/io/alembic/intern/abc_reader_curves.cc b/source/blender/io/alembic/intern/abc_reader_curves.cc index a6400dc6f6c..d8859acdf5f 100644 --- a/source/blender/io/alembic/intern/abc_reader_curves.cc +++ b/source/blender/io/alembic/intern/abc_reader_curves.cc @@ -66,7 +66,7 @@ bool AbcCurveReader::accepts_object_type( return false; } - if (ob->type != OB_CURVE) { + if (ob->type != OB_CURVES_LEGACY) { *err_str = "Object type mismatch, Alembic object path points to Curves."; return false; } @@ -76,7 +76,7 @@ bool AbcCurveReader::accepts_object_type( void AbcCurveReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) { - Curve *cu = BKE_curve_add(bmain, m_data_name.c_str(), OB_CURVE); + Curve *cu = BKE_curve_add(bmain, m_data_name.c_str(), OB_CURVES_LEGACY); cu->flag |= CU_3D; cu->actvert = CU_ACT_NONE; @@ -91,7 +91,7 @@ void AbcCurveReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSele } } - m_object = BKE_object_add_only_object(bmain, OB_CURVE, m_object_name.c_str()); + m_object = BKE_object_add_only_object(bmain, OB_CURVES_LEGACY, m_object_name.c_str()); m_object->data = cu; read_curve_sample(cu, m_curves_schema, sample_sel); diff --git a/source/blender/io/alembic/intern/abc_reader_nurbs.cc b/source/blender/io/alembic/intern/abc_reader_nurbs.cc index b744106ff95..78f9c0a85b4 100644 --- a/source/blender/io/alembic/intern/abc_reader_nurbs.cc +++ b/source/blender/io/alembic/intern/abc_reader_nurbs.cc @@ -69,7 +69,7 @@ bool AbcNurbsReader::accepts_object_type( return false; } - if (ob->type != OB_CURVE) { + if (ob->type != OB_CURVES_LEGACY) { *err_str = "Object type mismatch, Alembic object path points to NURBS."; return false; } diff --git a/source/blender/io/usd/intern/usd_hierarchy_iterator.cc b/source/blender/io/usd/intern/usd_hierarchy_iterator.cc index a86deb7c9f0..7a0d896fb3e 100644 --- a/source/blender/io/usd/intern/usd_hierarchy_iterator.cc +++ b/source/blender/io/usd/intern/usd_hierarchy_iterator.cc @@ -95,7 +95,7 @@ AbstractHierarchyWriter *USDHierarchyIterator::create_data_writer(const Hierarch break; case OB_EMPTY: - case OB_CURVE: + case OB_CURVES_LEGACY: case OB_SURF: case OB_FONT: case OB_SPEAKER: diff --git a/source/blender/io/usd/intern/usd_reader_curve.cc b/source/blender/io/usd/intern/usd_reader_curve.cc index e331030164e..0d3c2feb8f3 100644 --- a/source/blender/io/usd/intern/usd_reader_curve.cc +++ b/source/blender/io/usd/intern/usd_reader_curve.cc @@ -26,13 +26,13 @@ namespace blender::io::usd { void USDCurvesReader::create_object(Main *bmain, const double /* motionSampleTime */) { - curve_ = BKE_curve_add(bmain, name_.c_str(), OB_CURVE); + curve_ = BKE_curve_add(bmain, name_.c_str(), OB_CURVES_LEGACY); curve_->flag |= CU_3D; curve_->actvert = CU_ACT_NONE; curve_->resolu = 2; - object_ = BKE_object_add_only_object(bmain, OB_CURVE, name_.c_str()); + object_ = BKE_object_add_only_object(bmain, OB_CURVES_LEGACY, name_.c_str()); object_->data = curve_; } diff --git a/source/blender/io/usd/intern/usd_reader_nurbs.cc b/source/blender/io/usd/intern/usd_reader_nurbs.cc index c7fd788e072..d0a5dc1c4b4 100644 --- a/source/blender/io/usd/intern/usd_reader_nurbs.cc +++ b/source/blender/io/usd/intern/usd_reader_nurbs.cc @@ -43,13 +43,13 @@ namespace blender::io::usd { void USDNurbsReader::create_object(Main *bmain, const double /* motionSampleTime */) { - curve_ = BKE_curve_add(bmain, name_.c_str(), OB_CURVE); + curve_ = BKE_curve_add(bmain, name_.c_str(), OB_CURVES_LEGACY); curve_->flag |= CU_3D; curve_->actvert = CU_ACT_NONE; curve_->resolu = 2; - object_ = BKE_object_add_only_object(bmain, OB_CURVE, name_.c_str()); + object_ = BKE_object_add_only_object(bmain, OB_CURVES_LEGACY, name_.c_str()); object_->data = curve_; } diff --git a/source/blender/io/wavefront_obj/exporter/obj_exporter.cc b/source/blender/io/wavefront_obj/exporter/obj_exporter.cc index 9ea75e6eb4c..2cef5192337 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_exporter.cc +++ b/source/blender/io/wavefront_obj/exporter/obj_exporter.cc @@ -93,7 +93,7 @@ filter_supported_objects(Depsgraph *depsgraph, const OBJExportParams &export_par case OB_MESH: r_exportable_meshes.append(std::make_unique<OBJMesh>(depsgraph, export_params, object)); break; - case OB_CURVE: { + case OB_CURVES_LEGACY: { Curve *curve = static_cast<Curve *>(object->data); Nurb *nurb{static_cast<Nurb *>(curve->nurb.first)}; if (!nurb) { diff --git a/source/blender/io/wavefront_obj/exporter/obj_exporter.hh b/source/blender/io/wavefront_obj/exporter/obj_exporter.hh index 9f9ec5a6083..676b1f3598c 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_exporter.hh +++ b/source/blender/io/wavefront_obj/exporter/obj_exporter.hh @@ -64,11 +64,12 @@ void export_frame(Depsgraph *depsgraph, * Find the objects to be exported in the `view_layer` of the dependency graph`depsgraph`, * and return them in vectors `unique_ptr`s of `OBJMesh` and `OBJCurve`. * If `export_params.export_selected_objects` is set, then only selected objects are to be - * exported, else all objects are to be exported. But only objects of type `OB_MESH`, `OB_CURVE`, - * and `OB_SURF` are supported; the rest will be ignored. If `export_params.export_curves_as_nurbs` - * is set, then curves of type `CU_NURBS` are exported in curve form in the .obj file, otherwise - * they are converted to mesh and returned in the `OBJMesh` vector. All other exportable types are - * always converted to mesh and returned in the `OBJMesh` vector. + * exported, else all objects are to be exported. But only objects of type `OB_MESH`, + * `OB_CURVES_LEGACY`, and `OB_SURF` are supported; the rest will be ignored. If + * `export_params.export_curves_as_nurbs` is set, then curves of type `CU_NURBS` are exported in + * curve form in the .obj file, otherwise they are converted to mesh and returned in the `OBJMesh` + * vector. All other exportable types are always converted to mesh and returned in the `OBJMesh` + * vector. */ std::pair<Vector<std::unique_ptr<OBJMesh>>, Vector<std::unique_ptr<OBJCurve>>> filter_supported_objects(Depsgraph *depsgraph, const OBJExportParams &export_params); |