2 * ***** BEGIN GPL LICENSE BLOCK *****
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.
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.
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.
18 * Contributor(s): Esteban Tovagliari, Cedric Paille, Kevin Dietrich
20 * ***** END GPL LICENSE BLOCK *****
23 #ifndef __ABC_EXPORTER_H__
24 #define __ABC_EXPORTER_H__
26 #include <Alembic/Abc/All.h>
33 class AbcObjectWriter;
34 class AbcTransformWriter;
37 struct EvaluationContext;
42 struct ExportSettings {
49 bool visible_layers_only;
52 double frame_start, frame_end;
53 double frame_step_xform;
54 double frame_step_shape;
59 bool flatten_hierarchy;
64 bool export_face_sets;
67 bool export_particles;
70 bool use_subdiv_schema;
71 bool export_child_hairs;
80 float convert_matrix[3][3];
84 ExportSettings &m_settings;
86 const char *m_filename;
88 unsigned int m_trans_sampling_index, m_shape_sampling_index;
92 ArchiveWriter *m_writer;
94 /* mapping from name to transform writer */
95 typedef std::map<std::string, AbcTransformWriter *> m_xforms_type;
96 m_xforms_type m_xforms;
98 std::vector<AbcObjectWriter *> m_shapes;
101 AbcExporter(Scene *scene, const char *filename, ExportSettings &settings);
104 void operator()(Main *bmain, float &progress, bool &was_canceled);
107 void getShutterSamples(double step, bool time_relative, std::vector<double> &samples);
109 Alembic::Abc::TimeSamplingPtr createTimeSampling(double step);
111 void getFrameSet(double step, std::set<double> &frames);
113 void createTransformWritersHierarchy(EvaluationContext *eval_ctx);
114 AbcTransformWriter * createTransformWriter(Object *ob, Object *parent, Object *dupliObParent);
115 void exploreTransform(EvaluationContext *eval_ctx, Object *ob, Object *parent, Object *dupliObParent = NULL);
116 void exploreObject(EvaluationContext *eval_ctx, Object *ob, Object *dupliObParent);
117 void createShapeWriters(EvaluationContext *eval_ctx);
118 void createShapeWriter(Object *ob, Object *dupliObParent);
119 void createParticleSystemsWriters(Object *ob, AbcTransformWriter *xform);
121 AbcTransformWriter *getXForm(const std::string &name);
123 void setCurrentFrame(Main *bmain, double t);
126 #endif /* __ABC_EXPORTER_H__ */