[Bf-blender-cvs] [3edda14] alembic_basic_io: Add a default mesh cache modifier to the imported mesh objects.

Kévin Dietrich noreply at git.blender.org
Mon May 23 12:52:39 CEST 2016


Commit: 3edda14985fd86a33cd3a6a52a6d4e0beaf15803
Author: Kévin Dietrich
Date:   Mon May 23 11:57:58 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB3edda14985fd86a33cd3a6a52a6d4e0beaf15803

Add a default mesh cache modifier to the imported mesh objects.

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

M	source/blender/alembic/intern/abc_mesh.cc
M	source/blender/alembic/intern/abc_object.cc
M	source/blender/alembic/intern/abc_object.h

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

diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index 43867b6..275d575 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -34,7 +34,9 @@ extern "C" {
 #include "DNA_object_fluidsim.h"
 #include "DNA_object_types.h"
 
+#include "BLI_listbase.h"
 #include "BLI_math_geom.h"
+#include "BLI_string.h"
 
 #include "BKE_DerivedMesh.h"
 #include "BKE_depsgraph.h"
@@ -1250,7 +1252,21 @@ void AbcMeshReader::readObjectData(Main *bmain, Scene *scene, float time)
 	m_object = BKE_object_add(bmain, scene, OB_MESH, m_object_name.c_str());
 	m_object->data = blender_mesh;
 
-	/* TODO */
+	/* Add a default mesh cache modifier */
+
+	ModifierData *md = modifier_new(eModifierType_MeshCache);
+	BLI_addtail(&m_object->modifiers, md);
+
+	MeshCacheModifierData *mcmd = reinterpret_cast<MeshCacheModifierData *>(md);
+	mcmd->type = MOD_MESHCACHE_TYPE_ABC;
+	mcmd->time_mode = MOD_MESHCACHE_TIME_SECONDS;
+	mcmd->forward_axis = m_from_forward;
+	mcmd->up_axis = m_from_up;
+
+	BLI_strncpy(mcmd->filepath, m_iobject.getArchive().getName().c_str(), 1024);
+	BLI_strncpy(mcmd->sub_object, m_iobject.getFullName().c_str(), 1024);
+
+	/* TODO: add materials */
 #if 0
 	if (apply_materials) {
 		ABC_apply_materials(m_object, NULL);
diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index 078d9fb..8bb5b55 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -309,6 +309,8 @@ AbcObjectReader::AbcObjectReader(const IObject &object, int from_forward, int fr
     , m_object(NULL)
     , m_iobject(object)
     , m_do_convert_mat(false)
+    , m_from_up(from_up)
+    , m_from_forward(from_forward)
 {
 	m_name = object.getFullName();
 	std::vector<std::string> parts;
diff --git a/source/blender/alembic/intern/abc_object.h b/source/blender/alembic/intern/abc_object.h
index 4e05a8e..2ad88a8 100644
--- a/source/blender/alembic/intern/abc_object.h
+++ b/source/blender/alembic/intern/abc_object.h
@@ -85,6 +85,9 @@ protected:
 	bool m_do_convert_mat;
 	float m_conversion_mat[3][3];
 
+	int m_from_up;
+	int m_from_forward;
+
 public:
 	explicit AbcObjectReader(const Alembic::Abc::IObject &object, int from_forward, int from_up);




More information about the Bf-blender-cvs mailing list