[Bf-blender-cvs] [49398e6] alembic_basic_io: Cleanup: de-duplicate modifier addition.
Kévin Dietrich
noreply at git.blender.org
Wed Jun 1 17:28:26 CEST 2016
Commit: 49398e6e50ec8e9c548c584edb708f815ca80538
Author: Kévin Dietrich
Date: Wed Jun 1 15:55:48 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB49398e6e50ec8e9c548c584edb708f815ca80538
Cleanup: de-duplicate modifier addition.
===================================================================
M source/blender/alembic/intern/abc_hair.cc
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_hair.cc b/source/blender/alembic/intern/abc_hair.cc
index 84cfe6f..1fd6de6 100644
--- a/source/blender/alembic/intern/abc_hair.cc
+++ b/source/blender/alembic/intern/abc_hair.cc
@@ -35,13 +35,11 @@ extern "C" {
#include "BLI_listbase.h"
#include "BLI_math_geom.h"
-#include "BLI_string.h"
#include "BKE_curve.h"
#include "BKE_DerivedMesh.h"
#include "BKE_object.h"
#include "BKE_particle.h"
-#include "BKE_modifier.h"
#include "ED_curve.h"
}
@@ -364,13 +362,6 @@ void AbcHairReader::readObjectData(Main *bmain, Scene *scene, float time)
cu->actvert = CU_ACT_NONE;
if (m_settings->is_sequence || !m_curves_schema.isConstant()) {
- ModifierData *md = modifier_new(eModifierType_MeshSequenceCache);
- BLI_addtail(&m_object->modifiers, md);
-
- MeshSeqCacheModifierData *mcmd = reinterpret_cast<MeshSeqCacheModifierData *>(md);
-
- BLI_strncpy(mcmd->filepath, m_iobject.getArchive().getName().c_str(), 1024);
- BLI_strncpy(mcmd->abc_object_path, m_iobject.getFullName().c_str(), 1024);
- mcmd->is_sequence = m_settings->is_sequence;
+ addDefaultModifier();
}
}
diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index 7dbd698..95c6816 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -34,7 +34,6 @@ 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"
@@ -1154,17 +1153,8 @@ void AbcMeshReader::readObjectData(Main *bmain, Scene *scene, float time)
readFaceSetsSample(bmain, mesh, poly_start, sample_sel);
}
- /* Add a default mesh cache modifier */
-
if (m_settings->is_sequence || !is_constant) {
- ModifierData *md = modifier_new(eModifierType_MeshSequenceCache);
- BLI_addtail(&m_object->modifiers, md);
-
- MeshSeqCacheModifierData *mcmd = reinterpret_cast<MeshSeqCacheModifierData *>(md);
-
- BLI_strncpy(mcmd->filepath, m_iobject.getArchive().getName().c_str(), 1024);
- BLI_strncpy(mcmd->abc_object_path, m_iobject.getFullName().c_str(), 1024);
- mcmd->is_sequence = m_settings->is_sequence;
+ addDefaultModifier();
}
}
diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index 14803cf..054707a 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -28,12 +28,15 @@
extern "C" {
#include "DNA_constraint_types.h"
+#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "BKE_constraint.h"
#include "BKE_idprop.h"
+#include "BKE_modifier.h"
#include "BKE_object.h"
+#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_string.h"
@@ -372,3 +375,15 @@ void AbcObjectReader::readObjectMatrix(const float time)
BLI_strncpy(data->abc_object_path, m_iobject.getFullName().c_str(), 1024);
}
}
+
+void AbcObjectReader::addDefaultModifier() const
+{
+ ModifierData *md = modifier_new(eModifierType_MeshSequenceCache);
+ BLI_addtail(&m_object->modifiers, md);
+
+ MeshSeqCacheModifierData *mcmd = reinterpret_cast<MeshSeqCacheModifierData *>(md);
+
+ BLI_strncpy(mcmd->filepath, m_iobject.getArchive().getName().c_str(), 1024);
+ BLI_strncpy(mcmd->abc_object_path, m_iobject.getFullName().c_str(), 1024);
+ mcmd->is_sequence = m_settings->is_sequence;
+}
diff --git a/source/blender/alembic/intern/abc_object.h b/source/blender/alembic/intern/abc_object.h
index df74a05..e8efd2d 100644
--- a/source/blender/alembic/intern/abc_object.h
+++ b/source/blender/alembic/intern/abc_object.h
@@ -106,6 +106,8 @@ public:
virtual void readObjectData(Main *bmain, Scene *scene, float time) = 0;
void readObjectMatrix(const float time);
+
+ void addDefaultModifier() const;
};
#endif
More information about the Bf-blender-cvs
mailing list