369a802d763caecbf236441c1eab9e4ba0ee633a
[blender.git] / source / blender / alembic / intern / abc_points.h
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software  Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2016 K√©vin Dietrich.
19  * All rights reserved.
20  *
21  * ***** END GPL LICENSE BLOCK *****
22  *
23  */
24
25 #ifndef __ABC_POINTS_H__
26 #define __ABC_POINTS_H__
27
28 #include "abc_object.h"
29 #include "abc_customdata.h"
30
31 struct ParticleSystem;
32
33 /* ************************************************************************** */
34
35 class AbcPointsWriter : public AbcObjectWriter {
36         Alembic::AbcGeom::OPointsSchema m_schema;
37         Alembic::AbcGeom::OPointsSchema::Sample m_sample;
38         ParticleSystem *m_psys;
39
40 public:
41         AbcPointsWriter(Scene *scene,
42                         Object *ob,
43                         AbcTransformWriter *parent,
44                         uint32_t time_sampling,
45                         ExportSettings &settings,
46                         ParticleSystem *psys);
47
48         void do_write();
49 };
50
51 /* ************************************************************************** */
52
53 class AbcPointsReader : public AbcObjectReader {
54         Alembic::AbcGeom::IPointsSchema m_schema;
55         Alembic::AbcGeom::IPointsSchema::Sample m_sample;
56
57 public:
58         AbcPointsReader(const Alembic::Abc::IObject &object, ImportSettings &settings);
59
60         bool valid() const;
61         bool accepts_object_type(const Alembic::AbcCoreAbstract::ObjectHeader &alembic_header,
62                                  const Object *const ob,
63                                  const char **err_str) const;
64
65         void readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel);
66
67         DerivedMesh *read_derivedmesh(DerivedMesh *dm,
68                                       const Alembic::Abc::ISampleSelector &sample_sel,
69                                       int read_flag,
70                                       const char **err_str);
71 };
72
73 void read_points_sample(const Alembic::AbcGeom::IPointsSchema &schema,
74                         const Alembic::AbcGeom::ISampleSelector &selector,
75                         CDStreamConfig &config);
76
77 #endif  /* __ABC_POINTS_H__ */