Blender  V2.93
abc_reader_mesh.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 #pragma once
17 
22 #include "abc_customdata.h"
23 #include "abc_reader_object.h"
24 
25 struct Mesh;
26 
27 namespace blender::io::alembic {
28 
30  Alembic::AbcGeom::IPolyMeshSchema m_schema;
31 
32  CDStreamConfig m_mesh_data;
33 
34  public:
35  AbcMeshReader(const Alembic::Abc::IObject &object, ImportSettings &settings);
36 
37  bool valid() const override;
38  bool accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header,
39  const Object *const ob,
40  const char **err_str) const override;
41  void readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) override;
42 
43  struct Mesh *read_mesh(struct Mesh *existing_mesh,
44  const Alembic::Abc::ISampleSelector &sample_sel,
45  int read_flag,
46  const char **err_str) override;
47  bool topology_changed(Mesh *existing_mesh,
48  const Alembic::Abc::ISampleSelector &sample_sel) override;
49 
50  private:
51  void readFaceSetsSample(Main *bmain,
52  Mesh *mesh,
53  const Alembic::AbcGeom::ISampleSelector &sample_sel);
54 
55  void assign_facesets_to_mpoly(const Alembic::Abc::ISampleSelector &sample_sel,
56  MPoly *mpoly,
57  int totpoly,
58  std::map<std::string, int> &r_mat_map);
59 };
60 
62  Alembic::AbcGeom::ISubDSchema m_schema;
63 
64  CDStreamConfig m_mesh_data;
65 
66  public:
67  AbcSubDReader(const Alembic::Abc::IObject &object, ImportSettings &settings);
68 
69  bool valid() const;
70  bool accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header,
71  const Object *const ob,
72  const char **err_str) const;
73  void readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel);
74  struct Mesh *read_mesh(struct Mesh *existing_mesh,
75  const Alembic::Abc::ISampleSelector &sample_sel,
76  int read_flag,
77  const char **err_str);
78 };
79 
80 void read_mverts(MVert *mverts,
81  const Alembic::AbcGeom::P3fArraySamplePtr positions,
82  const Alembic::AbcGeom::N3fArraySamplePtr normals);
83 
84 CDStreamConfig get_config(struct Mesh *mesh, bool use_vertex_interpolation);
85 
86 } // namespace blender::io::alembic
struct Mesh * read_mesh(struct Mesh *existing_mesh, const Alembic::Abc::ISampleSelector &sample_sel, int read_flag, const char **err_str) override
void readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) override
bool accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header, const Object *const ob, const char **err_str) const override
bool topology_changed(Mesh *existing_mesh, const Alembic::Abc::ISampleSelector &sample_sel) override
AbcMeshReader(const Alembic::Abc::IObject &object, ImportSettings &settings)
void readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel)
bool accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header, const Object *const ob, const char **err_str) const
struct Mesh * read_mesh(struct Mesh *existing_mesh, const Alembic::Abc::ISampleSelector &sample_sel, int read_flag, const char **err_str)
AbcSubDReader(const Alembic::Abc::IObject &object, ImportSettings &settings)
static float normals[][3]
CDStreamConfig get_config(Mesh *mesh, const bool use_vertex_interpolation)
static void read_mverts(CDStreamConfig &config, const AbcMeshData &mesh_data)
Definition: BKE_main.h:116
int totpoly
struct MPoly * mpoly