[Bf-blender-cvs] [77cbc67] alembic: Removed the unused particle writer/reader code from Alembic.
Lukas Tönne
noreply at git.blender.org
Thu Apr 16 12:11:16 CEST 2015
Commit: 77cbc6732827e342ae180547b08744b8c00d5052
Author: Lukas Tönne
Date: Wed Apr 15 12:47:44 2015 +0200
Branches: alembic
https://developer.blender.org/rB77cbc6732827e342ae180547b08744b8c00d5052
Removed the unused particle writer/reader code from Alembic.
We only use particles to initialize strands export now.
===================================================================
M source/blender/pointcache/PTC_api.cpp
M source/blender/pointcache/PTC_api.h
M source/blender/pointcache/alembic/abc_particles.cpp
M source/blender/pointcache/alembic/abc_particles.h
M source/blender/pointcache/alembic/alembic.cpp
M source/blender/pointcache/intern/ptc_types.h
===================================================================
diff --git a/source/blender/pointcache/PTC_api.cpp b/source/blender/pointcache/PTC_api.cpp
index abab860..cf4e651 100644
--- a/source/blender/pointcache/PTC_api.cpp
+++ b/source/blender/pointcache/PTC_api.cpp
@@ -385,51 +385,3 @@ PTCReader *PTC_reader_group(const char *name, Group *group)
{
return (PTCReader *)PTC::Factory::alembic->create_writer_group(name, group);
}
-
-
-/* ==== PARTICLES ==== */
-
-PTCWriter *PTC_writer_particles(const char *name, Object *ob, ParticleSystem *psys)
-{
- return (PTCWriter *)PTC::Factory::alembic->create_writer_particles(name, ob, psys);
-}
-
-PTCReader *PTC_reader_particles(const char *name, Object *ob, ParticleSystem *psys)
-{
- return (PTCReader *)PTC::Factory::alembic->create_reader_particles(name, ob, psys);
-}
-
-int PTC_reader_particles_totpoint(PTCReader *_reader)
-{
- return ((PTC::ParticlesReader *)_reader)->totpoint();
-}
-
-PTCWriter *PTC_writer_hair_dynamics(const char *name, Object *ob, ParticleSystem *psys)
-{
- return (PTCWriter *)PTC::Factory::alembic->create_writer_hair_dynamics(name, ob, psys);
-}
-
-PTCReader *PTC_reader_hair_dynamics(const char *name, Object *ob, ParticleSystem *psys)
-{
- return (PTCReader *)PTC::Factory::alembic->create_reader_hair_dynamics(name, ob, psys);
-}
-
-PTCWriter *PTC_writer_particles_pathcache_parents(const char *name, Object *ob, ParticleSystem *psys)
-{
- return (PTCWriter *)PTC::Factory::alembic->create_writer_particles_pathcache_parents(name, ob, psys);
-}
-
-PTCReader *PTC_reader_particles_pathcache_parents(const char *name, Object *ob, ParticleSystem *psys)
-{
- return (PTCReader *)PTC::Factory::alembic->create_reader_particles_pathcache_parents(name, ob, psys);
-}
-
-PTCWriter *PTC_writer_particles_pathcache_children(const char *name, Object *ob, ParticleSystem *psys)
-{
- return (PTCWriter *)PTC::Factory::alembic->create_writer_particles_pathcache_children(name, ob, psys);
-}
-
-PTCReader *PTC_reader_particles_pathcache_children(const char *name, Object *ob, ParticleSystem *psys)
-{
- return (PTCReader *)PTC::Factory::alembic->create_reader_particles_pathcache_children(name, ob, psys);
-}
diff --git a/source/blender/pointcache/PTC_api.h b/source/blender/pointcache/PTC_api.h
index fe90241..6c0ca40 100644
--- a/source/blender/pointcache/PTC_api.h
+++ b/source/blender/pointcache/PTC_api.h
@@ -102,19 +102,6 @@ struct PTCReader *PTC_reader_object(const char *name, struct Object *ob);
struct PTCWriter *PTC_writer_group(const char *name, struct Group *group);
struct PTCReader *PTC_reader_group(const char *name, struct Group *group);
-/* Particles */
-struct PTCWriter *PTC_writer_particles(const char *name, struct Object *ob, struct ParticleSystem *psys);
-struct PTCReader *PTC_reader_particles(const char *name, struct Object *ob, struct ParticleSystem *psys);
-int PTC_reader_particles_totpoint(struct PTCReader *reader);
-
-struct PTCWriter *PTC_writer_hair_dynamics(const char *name, struct Object *ob, struct ParticleSystem *psys);
-struct PTCReader *PTC_reader_hair_dynamics(const char *name, struct Object *ob, struct ParticleSystem *psys);
-
-struct PTCWriter *PTC_writer_particles_pathcache_parents(const char *name, struct Object *ob, struct ParticleSystem *psys);
-struct PTCReader *PTC_reader_particles_pathcache_parents(const char *name, struct Object *ob, struct ParticleSystem *psys);
-struct PTCWriter *PTC_writer_particles_pathcache_children(const char *name, struct Object *ob, struct ParticleSystem *psys);
-struct PTCReader *PTC_reader_particles_pathcache_children(const char *name, struct Object *ob, struct ParticleSystem *psys);
-
/* Cloth */
struct PTCWriter *PTC_writer_cloth(const char *name, struct Object *ob, struct ClothModifierData *clmd);
struct PTCReader *PTC_reader_cloth(const char *name, struct Object *ob, struct ClothModifierData *clmd);
diff --git a/source/blender/pointcache/alembic/abc_particles.cpp b/source/blender/pointcache/alembic/abc_particles.cpp
index 4e43511..648264b 100644
--- a/source/blender/pointcache/alembic/abc_particles.cpp
+++ b/source/blender/pointcache/alembic/abc_particles.cpp
@@ -39,97 +39,6 @@ namespace PTC {
using namespace Abc;
using namespace AbcGeom;
-AbcParticlesWriter::AbcParticlesWriter(const std::string &name, Object *ob, ParticleSystem *psys) :
- ParticlesWriter(ob, psys, name)
-{
-}
-
-AbcParticlesWriter::~AbcParticlesWriter()
-{
-}
-
-void AbcParticlesWriter::init_abc(OObject parent)
-{
- if (m_points)
- return;
- m_points = OPoints(parent, m_name, abc_archive()->frame_sampling_index());
-}
-
-void AbcParticlesWriter::write_sample()
-{
- if (!m_points)
- return;
-
- OPointsSchema &schema = m_points.getSchema();
-
- int totpart = m_psys->totpart;
- ParticleData *pa;
- int i;
-
- /* XXX TODO only needed for the first frame/sample */
- std::vector<Util::uint64_t> ids;
- ids.reserve(totpart);
- for (i = 0, pa = m_psys->particles; i < totpart; ++i, ++pa)
- ids.push_back(i);
-
- std::vector<V3f> positions;
- positions.reserve(totpart);
- for (i = 0, pa = m_psys->particles; i < totpart; ++i, ++pa) {
- float *co = pa->state.co;
- positions.push_back(V3f(co[0], co[1], co[2]));
- }
-
- OPointsSchema::Sample sample = OPointsSchema::Sample(V3fArraySample(positions), UInt64ArraySample(ids));
-
- schema.set(sample);
-}
-
-
-AbcParticlesReader::AbcParticlesReader(const std::string &name, Object *ob, ParticleSystem *psys) :
- ParticlesReader(ob, psys, name)
-{
-}
-
-AbcParticlesReader::~AbcParticlesReader()
-{
-}
-
-void AbcParticlesReader::init_abc(IObject object)
-{
- if (m_points)
- return;
- m_points = IPoints(object, kWrapExisting);
-
- /* XXX TODO read first sample for info on particle count and times */
- m_totpoint = 0;
-}
-
-PTCReadSampleResult AbcParticlesReader::read_sample(float frame)
-{
- ISampleSelector ss = abc_archive()->get_frame_sample_selector(frame);
-
- if (!m_points.valid())
- return PTC_READ_SAMPLE_INVALID;
-
- IPointsSchema &schema = m_points.getSchema();
- if (schema.getNumSamples() == 0)
- return PTC_READ_SAMPLE_INVALID;
-
- IPointsSchema::Sample sample;
- schema.get(sample, ss);
-
- const V3f *positions = sample.getPositions()->get();
- int /*totpart = m_psys->totpart,*/ i;
- ParticleData *pa;
- for (i = 0, pa = m_psys->particles; i < sample.getPositions()->size(); ++i, ++pa) {
- pa->state.co[0] = positions[i].x;
- pa->state.co[1] = positions[i].y;
- pa->state.co[2] = positions[i].z;
- }
-
- return PTC_READ_SAMPLE_EXACT;
-}
-
struct StrandsChildrenSample {
std::vector<int32_t> numverts;
@@ -1066,275 +975,4 @@ void AbcStrandsReader::discard_result()
}
-AbcHairDynamicsWriter::AbcHairDynamicsWriter(const std::string &name, Object *ob, ParticleSystem *psys) :
- ParticlesWriter(ob, psys, name),
- m_cloth_writer(name + "__cloth", ob, psys->clmd)
-{
-}
-
-void AbcHairDynamicsWriter::init_abc(OObject parent)
-{
- m_cloth_writer.init_abc(parent);
-}
-
-void AbcHairDynamicsWriter::write_sample()
-{
- m_cloth_writer.write_sample();
-}
-
-AbcHairDynamicsReader::AbcHairDynamicsReader(const std::string &name, Object *ob, ParticleSystem *psys) :
- ParticlesReader(ob, psys, name),
- m_cloth_reader(name + "__cloth", ob, psys->clmd)
-{
-}
-
-void AbcHairDynamicsReader::init_abc(IObject object)
-{
- m_cloth_reader.init_abc(object);
-}
-
-PTCReadSampleResult AbcHairDynamicsReader::read_sample(float frame)
-{
- return m_cloth_reader.read_sample(frame);
-}
-
-
-struct ParticlePathcacheSample {
- std::vector<int32_t> numkeys;
-
- std::vector<V3f> positions;
- std::vector<V3f> velocities;
- std::vector<Quatf> rotations;
- std::vector<C3f> colors;
- std::vector<float32_t> times;
-};
-
-AbcParticlePathcacheWriter::AbcParticlePathcacheWriter(const std::string &name, Object *ob, ParticleSystem *psys, ParticleCacheKey ***pathcache, int *totpath, const std::string &suffix) :
- ParticlesWriter(ob, psys, name),
- m_pathcache(pathcache),
- m_totpath(totpath),
- m_suffix(suffix)
-{
-}
-
-AbcParticlePathcacheWriter::~AbcParticlePathcacheWriter()
-{
-}
-
-void AbcParticlePathcacheWriter::init_abc(OObject parent)
-{
- if (m_curves)
- return;
-
- /* XXX non-escaped string construction here ... */
- m_curves = OCurves(parent, m_name + m_suffix, abc_archive()->frame_sampling_index());
-
- OCurvesSchema &schema = m_curves.getSchema();
- OCompoundProperty geom_props = schema.getArbGeomParams();
-
- m_param_velocities = OV3fGeomParam(geom_props, "velocities", false, kVertexScope, 1, 0);
- m_param_rotations = OQuatfGeomParam(geom_props, "rotations", false, kVertexScope, 1, 0);
- m_param_colors = OC3fGeomParam(geom_props, "colors", false, kVertexScope, 1, 0);
- m_param_times = OFloatGeomParam(geom_props, "times", false, kVertexScope, 1, 0);
-}
-
-static int paths_count_totkeys(ParticleCacheKey **pathcache, int totpart)
-{
- int p;
- int totkeys = 0;
-
- for (p = 0; p < totpart; ++p) {
- ParticleCacheKey *keys = pathcache[p];
- totkeys += keys->segments + 1;
- }
-
- return totkeys;
-}
-
-static void paths_create_sample(ParticleCacheKey **pathcache, int totpart, int totkeys, ParticlePathcacheSample &sample, bool do_numkeys)
-{
- int p, k;
-
- if (do_numkeys)
- sample.numkeys.reserve(totpart);
- sample.positions.reserve(totkeys);
- sample.velocities.reserve(totkeys);
- sample.rotations.reserve(totkeys);
- sample.colors.reserve(totkeys);
- sample.times.reserve(totkeys);
-
- for (p = 0; p < totpart; ++p) {
- ParticleCacheKey *keys = pathcache[p];
- int numkeys = keys->segments + 1;
-
- if (do_numkeys)
- sample.numkeys.push_back(numkeys);
-
- for (k = 0; k < numkeys; ++k) {
- ParticleCacheKey *key = &keys[k];
-
- sample.positions.push_back(V3f(key->co[0], key->co[1], key->co[2]));
- sample.velocities.push_back(V3f(key->vel[0], key->vel[1], key->vel[2]));
- sample.rotations.push_back(Quatf(key->rot[0], key->rot[1], key->rot[2], key->rot[3]));
- sample.colors.push_back(C3f(key->col[0], key->col[1], key->col[2]));
- sample.times.push_back(key->time);
- }
- }
-}
-
-void AbcParticlePathcacheWriter::write_sample()
-{
- if (!m_curves)
- return;
- if (!(*m_pathcache))
- return;
-
- int totkeys = paths_count_totkeys(*m_pathcache, *m_totpath);
- if (totkeys == 0)
- return;
-
- OCurvesSchema &schema = m_curves.getSchema();
-
- ParticlePathcacheSam
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list