diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2019-01-15 17:16:39 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2019-01-16 12:43:45 +0300 |
commit | 2bb6028d1a64bec0ec83c14483e1d06c802989de (patch) | |
tree | 10da993b9adf98b53bd5880e5be80f58981470f7 /source/blender/alembic/intern/abc_mesh.h | |
parent | 45042f6a035dd8f2c21512af567a10db0b052a3c (diff) |
Alembic export: separated "writing Alembic mesh" from "writing mesh object"
I moved most of the `AbcMeshWriter` code to a new class
`AbcGenericMeshWriter`. The latter is an abstract class and does not
make any assumptions about the type of Blender object being written.
This makes it possible to write metaballs, curves, nurbs surfaces, etc.
as mesh to Alembic files.
The `AbcMeshWriter` class now is the concrete implementation of
`AbcGenericMeshWriter` for writing mesh objects.
Reviewers: sergey
Differential Revision: https://developer.blender.org/D4213
Diffstat (limited to 'source/blender/alembic/intern/abc_mesh.h')
-rw-r--r-- | source/blender/alembic/intern/abc_mesh.h | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/source/blender/alembic/intern/abc_mesh.h b/source/blender/alembic/intern/abc_mesh.h index dd7e9c7adf0..953c15e5eaf 100644 --- a/source/blender/alembic/intern/abc_mesh.h +++ b/source/blender/alembic/intern/abc_mesh.h @@ -31,7 +31,9 @@ struct ModifierData; /* ************************************************************************** */ -class AbcMeshWriter : public AbcObjectWriter { +/* Writer for Alembic meshes. Does not assume the object is a mesh object. */ +class AbcGenericMeshWriter : public AbcObjectWriter { +protected: Alembic::AbcGeom::OPolyMeshSchema m_mesh_schema; Alembic::AbcGeom::OPolyMeshSchema::Sample m_mesh_sample; @@ -49,24 +51,24 @@ class AbcMeshWriter : public AbcObjectWriter { bool m_is_subd; public: - AbcMeshWriter(Object *ob, + AbcGenericMeshWriter(Object *ob, AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings); - ~AbcMeshWriter(); + ~AbcGenericMeshWriter(); void setIsAnimated(bool is_animated); -private: +protected: virtual void do_write(); + virtual bool isAnimated() const; + virtual struct Mesh *getEvaluatedMesh(struct Scene *scene_eval, struct Object *ob_eval, bool &r_needsfree) = 0; - bool isAnimated() const; + struct Mesh *getFinalMesh(bool &r_needsfree); void writeMesh(struct Mesh *mesh); void writeSubD(struct Mesh *mesh); - struct Mesh *getFinalMesh(bool &r_needsfree); - void writeArbGeoParams(struct Mesh *mesh); void getGeoGroups(struct Mesh *mesh, std::map<std::string, std::vector<int32_t> > &geoGroups); @@ -77,6 +79,21 @@ private: void writeFaceSets(struct Mesh *mesh, Schema &schema); }; + +class AbcMeshWriter : public AbcGenericMeshWriter { +public: + AbcMeshWriter(Object *ob, + AbcTransformWriter *parent, + uint32_t time_sampling, + ExportSettings &settings); + + ~AbcMeshWriter(); +protected: + bool isAnimated() const override; + virtual struct Mesh *getEvaluatedMesh(struct Scene *scene_eval, struct Object *ob_eval, bool &r_needsfree) override; +}; + + /* ************************************************************************** */ class AbcMeshReader : public AbcObjectReader { |