diff options
Diffstat (limited to 'source/blender/alembic')
-rw-r--r-- | source/blender/alembic/intern/abc_exporter.cc | 17 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_hair.cc | 18 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_hair.h | 10 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_mesh.cc | 2 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_points.cc | 10 | ||||
-rw-r--r-- | source/blender/alembic/intern/abc_points.h | 6 |
6 files changed, 38 insertions, 25 deletions
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc index 92fee170e29..ff8b0442ab6 100644 --- a/source/blender/alembic/intern/abc_exporter.cc +++ b/source/blender/alembic/intern/abc_exporter.cc @@ -55,6 +55,7 @@ extern "C" { #include "BKE_idprop.h" #include "BKE_main.h" #include "BKE_modifier.h" +#include "BKE_particle.h" #include "BKE_scene.h" } @@ -501,6 +502,22 @@ void AbcExporter::createShapeWriter(Object *ob, Object *dupliObParent) return; } + ParticleSystem *psys = static_cast<ParticleSystem *>(ob->particlesystem.first); + + for (; psys; psys = psys->next) { + if (!psys_check_enabled(ob, psys, G.is_rendering) || !psys->part) { + continue; + } + + if (psys->part->type == PART_HAIR) { + m_settings.export_child_hairs = true; + m_shapes.push_back(new AbcHairWriter(m_scene, ob, xform, m_shape_sampling_index, m_settings, psys)); + } + else if (psys->part->type == PART_EMITTER) { + m_shapes.push_back(new AbcPointsWriter(m_scene, ob, xform, m_shape_sampling_index, m_settings, psys)); + } + } + switch(ob->type) { case OB_MESH: { diff --git a/source/blender/alembic/intern/abc_hair.cc b/source/blender/alembic/intern/abc_hair.cc index f10cfbadda8..14bcf6731ea 100644 --- a/source/blender/alembic/intern/abc_hair.cc +++ b/source/blender/alembic/intern/abc_hair.cc @@ -37,6 +37,7 @@ extern "C" { #include "BKE_DerivedMesh.h" #include "BKE_object.h" +#include "BKE_particle.h" } using Alembic::Abc::P3fArraySamplePtr; @@ -53,15 +54,13 @@ AbcHairWriter::AbcHairWriter(Scene *scene, AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings, - void *UNUSED(psys)) + ParticleSystem *psys) : AbcObjectWriter(scene, ob, time_sampling, settings, parent) { - m_psys = NULL; // = psys; + m_psys = psys; -#if 0 OCurves curves(parent->alembicXform(), psys->name, m_time_sampling); m_schema = curves.getSchema(); -#endif } void AbcHairWriter::do_write() @@ -69,7 +68,7 @@ void AbcHairWriter::do_write() if (!m_psys) { return; } -#if 0 + ParticleSystemModifierData *psmd = psys_get_modifier(m_object, m_psys); if (!psmd->dm_final) { @@ -117,17 +116,15 @@ void AbcHairWriter::do_write() m_sample.setSelfBounds(bounds()); m_schema.set(m_sample); -#endif } void AbcHairWriter::write_hair_sample(DerivedMesh *dm, - void *part, + ParticleSettings *part, std::vector<Imath::V3f> &verts, std::vector<Imath::V3f> &norm_values, std::vector<Imath::V2f> &uv_values, std::vector<int32_t> &hvertices) { -#if 0 /* Get untransformed vertices, there's a xform under the hair. */ float inv_mat[4][4]; invert_m4_m4_safe(inv_mat, m_object->obmat); @@ -228,17 +225,15 @@ void AbcHairWriter::write_hair_sample(DerivedMesh *dm, ++path; } } -#endif } void AbcHairWriter::write_hair_child_sample(DerivedMesh *dm, - void *part, + ParticleSettings *part, std::vector<Imath::V3f> &verts, std::vector<Imath::V3f> &norm_values, std::vector<Imath::V2f> &uv_values, std::vector<int32_t> &hvertices) { -#if 0 /* Get untransformed vertices, there's a xform under the hair. */ float inv_mat[4][4]; invert_m4_m4_safe(inv_mat, m_object->obmat); @@ -292,5 +287,4 @@ void AbcHairWriter::write_hair_child_sample(DerivedMesh *dm, ++path; } } -#endif } diff --git a/source/blender/alembic/intern/abc_hair.h b/source/blender/alembic/intern/abc_hair.h index bbd5f2c4361..d132b60be12 100644 --- a/source/blender/alembic/intern/abc_hair.h +++ b/source/blender/alembic/intern/abc_hair.h @@ -26,11 +26,13 @@ #include "abc_object.h" struct DerivedMesh; +struct ParticleSettings; +struct ParticleSystem; /* ************************************************************************** */ class AbcHairWriter : public AbcObjectWriter { - /*ParticleSystem*/ void *m_psys; + ParticleSystem *m_psys; Alembic::AbcGeom::OCurvesSchema m_schema; Alembic::AbcGeom::OCurvesSchema::Sample m_sample; @@ -41,20 +43,20 @@ public: AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings, - /*ParticleSystem*/void *psys); + ParticleSystem *psys); private: virtual void do_write(); void write_hair_sample(DerivedMesh *dm, - /*ParticleSettings*/ void *part, + ParticleSettings *part, std::vector<Imath::V3f> &verts, std::vector<Imath::V3f> &norm_values, std::vector<Imath::V2f> &uv_values, std::vector<int32_t> &hvertices); void write_hair_child_sample(DerivedMesh *dm, - /*ParticleSettings*/ void *part, + ParticleSettings *part, std::vector<Imath::V3f> &verts, std::vector<Imath::V3f> &norm_values, std::vector<Imath::V2f> &uv_values, diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index ad0d0a430c1..bdd75f93189 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -262,7 +262,7 @@ static ModifierData *get_subsurf_modifier(Scene *scene, Object *ob) } /* mesh is not a subsurf. break */ - if ((md->type != eModifierType_Displace) /*&& (md->type != eModifierType_ParticleSystem)*/) { + if ((md->type != eModifierType_Displace) && (md->type != eModifierType_ParticleSystem)) { return NULL; } } diff --git a/source/blender/alembic/intern/abc_points.cc b/source/blender/alembic/intern/abc_points.cc index 6602c7e5a85..4c78f3e83c7 100644 --- a/source/blender/alembic/intern/abc_points.cc +++ b/source/blender/alembic/intern/abc_points.cc @@ -36,6 +36,7 @@ extern "C" { #include "BKE_lattice.h" #include "BKE_mesh.h" #include "BKE_object.h" +#include "BKE_particle.h" #include "BKE_scene.h" #include "BLI_math.h" @@ -62,15 +63,13 @@ AbcPointsWriter::AbcPointsWriter(Scene *scene, AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings, - void *UNUSED(psys)) + ParticleSystem *psys) : AbcObjectWriter(scene, ob, time_sampling, settings, parent) { - m_psys = NULL; // = psys; + m_psys = psys; -#if 0 OPoints points(parent->alembicXform(), psys->name, m_time_sampling); m_schema = points.getSchema(); -#endif } void AbcPointsWriter::do_write() @@ -78,7 +77,7 @@ void AbcPointsWriter::do_write() if (!m_psys) { return; } -#if 0 + std::vector<Imath::V3f> points; std::vector<Imath::V3f> velocities; std::vector<float> widths; @@ -135,7 +134,6 @@ void AbcPointsWriter::do_write() m_sample.setSelfBounds(bounds()); m_schema.set(m_sample); -#endif } /* ************************************************************************** */ diff --git a/source/blender/alembic/intern/abc_points.h b/source/blender/alembic/intern/abc_points.h index 9864917f477..cb68dbca4d5 100644 --- a/source/blender/alembic/intern/abc_points.h +++ b/source/blender/alembic/intern/abc_points.h @@ -28,12 +28,14 @@ #include "abc_object.h" #include "abc_customdata.h" +struct ParticleSystem; + /* ************************************************************************** */ class AbcPointsWriter : public AbcObjectWriter { Alembic::AbcGeom::OPointsSchema m_schema; Alembic::AbcGeom::OPointsSchema::Sample m_sample; - /*ParticleSystem*/ void *m_psys; + ParticleSystem *m_psys; public: AbcPointsWriter(Scene *scene, @@ -41,7 +43,7 @@ public: AbcTransformWriter *parent, uint32_t time_sampling, ExportSettings &settings, - /*ParticleSystem*/ void *psys); + ParticleSystem *psys); void do_write(); }; |