[Bf-blender-cvs] [36aad47] alembic: Cleanup: Removed unused writer/reader classes for Alembic.

Lukas Tönne noreply at git.blender.org
Thu Apr 16 12:11:21 CEST 2015


Commit: 36aad476dc02c49cceaedd9a030edfee43ce051f
Author: Lukas Tönne
Date:   Thu Apr 16 12:07:28 2015 +0200
Branches: alembic
https://developer.blender.org/rB36aad476dc02c49cceaedd9a030edfee43ce051f

Cleanup: Removed unused writer/reader classes for Alembic.

These classes were used previously to write parts of the Blender DNA
directly to Alembic. Their code is shared with other classes that are
still in use, so none of the really substantial parts have been deleted.

===================================================================

M	source/blender/pointcache/alembic/abc_group.cpp
M	source/blender/pointcache/alembic/abc_group.h
M	source/blender/pointcache/alembic/abc_mesh.cpp
M	source/blender/pointcache/alembic/abc_mesh.h
M	source/blender/pointcache/alembic/abc_object.cpp
M	source/blender/pointcache/alembic/abc_object.h
M	source/blender/pointcache/alembic/abc_particles.cpp
M	source/blender/pointcache/alembic/abc_particles.h

===================================================================

diff --git a/source/blender/pointcache/alembic/abc_group.cpp b/source/blender/pointcache/alembic/abc_group.cpp
index 0d367e5..5121eda 100644
--- a/source/blender/pointcache/alembic/abc_group.cpp
+++ b/source/blender/pointcache/alembic/abc_group.cpp
@@ -49,101 +49,6 @@ namespace PTC {
 using namespace Abc;
 using namespace AbcGeom;
 
-AbcGroupWriter::AbcGroupWriter(const std::string &name, Group *group) :
-    GroupWriter(group, name)
-{
-}
-
-void AbcGroupWriter::init_abc()
-{
-	if (m_abc_object)
-		return;
-	
-	m_abc_object = abc_archive()->add_id_object<OObject>((ID *)m_group);
-}
-
-void AbcGroupWriter::create_refs()
-{
-	GroupObject *gob = (GroupObject *)m_group->gobject.first;
-	int i = 0;
-	for (; gob; gob = gob->next, ++i) {
-		OObject abc_object = abc_archive()->get_id_object((ID *)gob->ob);
-		if (abc_object) {
-			std::stringstream ss;
-			ss << i;
-			m_abc_object.addChildInstance(abc_object, std::string("group_object") + ss.str());
-		}
-	}
-}
-
-void AbcGroupWriter::write_sample()
-{
-	if (!m_abc_object)
-		return;
-}
-
-
-AbcGroupReader::AbcGroupReader(const std::string &name, Group *group) :
-    GroupReader(group, name)
-{
-}
-
-void AbcGroupReader::init_abc(IObject object)
-{
-	if (m_abc_object)
-		return;
-	m_abc_object = object;
-}
-
-PTCReadSampleResult AbcGroupReader::read_sample(float frame)
-{
-	if (!m_abc_object)
-		return PTC_READ_SAMPLE_INVALID;
-	
-	return PTC_READ_SAMPLE_EXACT;
-}
-
-/* ========================================================================= */
-
-AbcDupligroupWriter::AbcDupligroupWriter(const std::string &name, EvaluationContext *eval_ctx, Scene *scene, Group *group, CacheLibrary *cachelib) :
-    GroupWriter(group, name),
-    m_eval_ctx(eval_ctx),
-    m_scene(scene),
-    m_cachelib(cachelib)
-{
-}
-
-AbcDupligroupWriter::~AbcDupligroupWriter()
-{
-	for (IDWriterMap::iterator it = m_id_writers.begin(); it != m_id_writers.end(); ++it) {
-		if (it->second)
-			delete it->second;
-	}
-}
-
-void AbcDupligroupWriter::init_abc()
-{
-	if (m_abc_group)
-		return;
-	
-	m_abc_group = abc_archive()->add_id_object<OObject>((ID *)m_group);
-}
-
-void AbcDupligroupWriter::write_sample_object(Object *ob)
-{
-	AbcWriter *ob_writer = find_id_writer((ID *)ob);
-	if (!ob_writer) {
-		bool do_mesh = (m_cachelib->data_types & CACHE_TYPE_DERIVED_MESH);
-		bool do_hair = (m_cachelib->data_types & CACHE_TYPE_HAIR);
-		
-		ob_writer = new AbcObjectWriter(ob->id.name, m_scene, ob, do_mesh, do_hair);
-		ob_writer->init(abc_archive());
-		m_id_writers.insert(IDWriterPair((ID *)ob, ob_writer));
-	}
-	
-	ob_writer->write_sample();
-}
-
 static bool object_visible(Object *ob, PTCPass pass)
 {
 	switch (pass) {
@@ -153,88 +58,6 @@ static bool object_visible(Object *ob, PTCPass pass)
 	return true;
 }
 
-void AbcDupligroupWriter::write_sample_dupli(DupliObject *dob, int index)
-{
-	OObject abc_object = abc_archive()->get_id_object((ID *)dob->ob);
-	if (!abc_object)
-		return;
-	
-	std::stringstream ss;
-	ss << "DupliObject" << index;
-	std::string name = ss.str();
-	
-	OObject abc_dupli = m_abc_group.getChild(name);
-	OCompoundProperty props;
-	OM44fProperty prop_matrix;
-	OBoolProperty prop_visible;
-	if (!abc_dupli) {
-		abc_dupli = OObject(m_abc_group, name, 0);
-		m_object_writers.push_back(abc_dupli.getPtr());
-		props = abc_dupli.getProperties();
-		
-		abc_dupli.addChildInstance(abc_object, "object");
-		
-		prop_matrix = OM44fProperty(props, "matrix", abc_archive()->frame_sampling());
-		m_property_writers.push_back(prop_matrix.getPtr());
-		prop_visible = OBoolProperty(props, "visible", abc_archive()->frame_sampling());
-		m_property_writers.push_back(prop_visible.getPtr());
-	}
-	else {
-		props = abc_dupli.getProperties();
-		
-		prop_matrix = OM44fProperty(props.getProperty("matrix").getPtr()->asScalarPtr(), kWrapExisting);
-		prop_visible = OBoolProperty(props.getProperty("visible").getPtr()->asScalarPtr(), kWrapExisting);
-	}
-	
-	prop_matrix.set(M44f(dob->mat));
-	
-	bool visible = object_visible(dob->ob, abc_archive()->get_pass()) && (!dob->no_draw);
-	prop_visible.set(visible);
-}
-
-void AbcDupligroupWriter::write_sample()
-{
-	if (!m_abc_group)
-		return;
-	
-	ListBase *duplilist = group_duplilist_ex(m_eval_ctx, m_scene, m_group, true);
-	DupliObject *dob;
-	int i;
-	
-	/* LIB_DOIT is used to mark handled objects, clear first */
-	for (dob = (DupliObject *)duplilist->first; dob; dob = dob->next) {
-		if (dob->ob)
-			dob->ob->id.flag &= ~LIB_DOIT;
-	}
-	
-	/* write actual object data: duplicator itself + all instanced objects */
-	for (dob = (DupliObject *)duplilist->first; dob; dob = dob->next) {
-		if (dob->ob->id.flag & LIB_DOIT)
-			continue;
-		dob->ob->id.flag |= LIB_DOIT;
-		
-		write_sample_object(dob->ob);
-	}
-	
-	/* write dupli instances */
-	for (dob = (DupliObject *)duplilist->first, i = 0; dob; dob = dob->next, ++i) {
-		write_sample_dupli(dob, i);
-	}
-	
-	free_object_duplilist(duplilist);
-}
-
-AbcWriter *AbcDupligroupWriter::find_id_writer(ID *id) const
-{
-	IDWriterMap::const_iterator it = m_id_writers.find(id);
-	if (it == m_id_writers.end())
-		return NULL;
-	else
-		return it->second;
-}
-
-/* ------------------------------------------------------------------------- */
-
 AbcDupliCacheWriter::AbcDupliCacheWriter(const std::string &name, Group *group, DupliCache *dupcache, int data_types, bool do_sim_debug) :
     GroupWriter(group, name),
     m_dupcache(dupcache),
diff --git a/source/blender/pointcache/alembic/abc_group.h b/source/blender/pointcache/alembic/abc_group.h
index bea9b27..0331894 100644
--- a/source/blender/pointcache/alembic/abc_group.h
+++ b/source/blender/pointcache/alembic/abc_group.h
@@ -40,63 +40,8 @@ class AbcStrandsWriter;
 class AbcSimDebugWriter;
 class AbcSimDebugReader;
 
-class AbcGroupWriter : public GroupWriter, public AbcWriter {
-public:
-	AbcGroupWriter(const std::string &name, Group *group);
-	
-	void init_abc();
-	void create_refs();
-	
-	void write_sample();
-	
-private:
-	Abc::OObject m_abc_object;
-};
-
-class AbcGroupReader : public GroupReader, public AbcReader {
-public:
-	AbcGroupReader(const std::string &name, Group *group);
-	
-	void init_abc(Abc::IObject object);
-	
-	PTCReadSampleResult read_sample(float frame);
-	
-private:
-	Abc::IObject m_abc_object;
-};
-
 /* ========================================================================= */
 
-class AbcDupligroupWriter : public GroupWriter, public AbcWriter {
-public:
-	typedef std::vector<Abc::ObjectWriterPtr> ObjectWriterList;
-	typedef std::vector<Abc::BasePropertyWriterPtr> PropertyWriterList;
-	
-	typedef std::map<ID *, AbcWriter *> IDWriterMap;
-	typedef std::pair<ID *, AbcWriter *> IDWriterPair;
-	
-	AbcDupligroupWriter(const std::string &name, EvaluationContext *eval_ctx, Scene *scene, Group *group, CacheLibrary *cachelib);
-	~AbcDupligroupWriter();
-	
-	void init_abc();
-	
-	void write_sample();
-	void write_sample_object(Object *ob);
-	void write_sample_dupli(DupliObject *dob, int index);
-	
-	AbcWriter *find_id_writer(ID *id) const;
-	
-private:
-	EvaluationContext *m_eval_ctx;
-	Scene *m_scene;
-	CacheLibrary *m_cachelib;
-	
-	Abc::OObject m_abc_group;
-	ObjectWriterList m_object_writers;
-	PropertyWriterList m_property_writers;
-	IDWriterMap m_id_writers;
-};
-
 class AbcDupliCacheWriter : public GroupWriter, public AbcWriter {
 public:
 	typedef std::vector<Abc::ObjectWriterPtr> ObjectWriterList;
diff --git a/source/blender/pointcache/alembic/abc_mesh.cpp b/source/blender/pointcache/alembic/abc_mesh.cpp
index aa6a0c6a..6024824 100644
--- a/source/blender/pointcache/alembic/abc_mesh.cpp
+++ b/source/blender/pointcache/alembic/abc_mesh.cpp
@@ -601,19 +601,4 @@ PTCReadSampleResult AbcDerivedMeshReader::read_sample(float frame)
 	return PTC_READ_SAMPLE_EXACT;
 }
 
-/* ========================================================================= */
-
-AbcDerivedFinalRealtimeWriter::AbcDerivedFinalRealtimeWriter(const std::string &name, Object *ob) :
-    AbcDerivedMeshWriter(name, ob, &ob->derivedFinal)
-{
-}
-
-
-AbcDerivedFinalRenderWriter::AbcDerivedFinalRenderWriter(const std::string &name, Scene *scene, Object *ob, DerivedMesh **render_dm_ptr) :
-    AbcDerivedMeshWriter(name, ob, render_dm_ptr),
-    m_scene(scene)
-{
-}
-
-
 } /* namespace PTC */
diff --git a/source/blender/pointcache/alembic/abc_mesh.h b/source/blender/pointcache/alembic/abc_mesh.h
index 5caaf6e..0e5b433 100644
--- a/source/blender/pointcache/alembic/abc_mesh.h
+++ b/source/blender/pointcache/alembic/abc_mesh.h
@@ -116,38 +116,6 @@ private:
 	CustomDataReader m_loop_data_reader;
 };
 
-
-/* -------------------------------------------------------------------------
- * Writing derived mesh results requires different variants
- * depending on viewport/render output and whether a cache modifier is used.
- * 
- * Render DMs are constructed on-the-fly for each sample write, since they
- * are not constructed immediately during scene frame updates. The writer is
- * expected to only be called once per frame and object.
- * 
- * If a cache modifier is used it must be have be activate at the time when
- * the DM is built. For viewport output this means it should activate the
- * modifier during it's whole lifetime, so that it caches meshes during the
- * scene frame update. For render output the modifier should only be active
- * during the render DM construction.
- * ------------------------------------------------------------------------- */
-
-
-class AbcDerivedFinalRealtimeWriter : public AbcDerivedMeshWriter {
-public:
-	AbcDerivedFinalRealtimeWriter(const std::string &name, Object *ob);
-};
-
-
-class AbcDerivedFinalRenderWriter : public AbcDerivedMeshWriter {
-public:
-	AbcDerivedFinalRenderWriter(const std::string &name, Scene *scene, Object *ob, DerivedMesh **render_dm_ptr);
-	
-private:
-	Scene *m_scene;
-};
-
-
 } /* namespace PTC */
 
 #endif  /* PTC_MESH_H */
diff --git a/source/blender/pointcache/alembic/abc_object.cpp b/source/blender/pointcache/alembic/abc_object.cpp
index 6363f40..787140a 100644
--- a/source/blender/pointcache/alembic/abc_object.cpp
+++ b/source/blender/pointcache/alembic/abc_object.cpp
@@ -33,125 +33,5 @@ namespace PTC {
 using namespace Abc;
 using namespace AbcGeom;
 
-AbcObjectWriter::AbcO

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list