[Bf-blender-cvs] [62a47f9660c] master: Alembic: cleaned up hack in AbcObjectReader::read_matrix()
Sybren A. Stüvel
noreply at git.blender.org
Thu Apr 6 16:51:47 CEST 2017
Commit: 62a47f9660c18787de4def41dde149c67e416547
Author: Sybren A. Stüvel
Date: Wed Feb 15 15:29:41 2017 +0100
Branches: master
https://developer.blender.org/rB62a47f9660c18787de4def41dde149c67e416547
Alembic: cleaned up hack in AbcObjectReader::read_matrix()
===================================================================
M source/blender/alembic/intern/abc_object.cc
===================================================================
diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index a0cd378ff95..3765e13d585 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -239,35 +239,24 @@ void AbcObjectReader::readObjectMatrix(const float time)
void AbcObjectReader::read_matrix(float mat[4][4], const float time, const float scale, bool &is_constant)
{
IXform ixform;
- bool has_alembic_parent = false;
+ IObject ixform_parent;
/* Check that we have an empty object (locator, bone head/tail...). */
if (IXform::matches(m_iobject.getMetaData())) {
ixform = IXform(m_iobject, Alembic::AbcGeom::kWrapExisting);
-
- /* See comment below. */
- has_alembic_parent = m_iobject.getParent().getParent().valid();
+ ixform_parent = m_iobject.getParent();
}
/* Check that we have an object with actual data. */
else if (IXform::matches(m_iobject.getParent().getMetaData())) {
ixform = IXform(m_iobject.getParent(), Alembic::AbcGeom::kWrapExisting);
-
- /* This is a bit hackish, but we need to make sure that extra
- * transformations added to the matrix (rotation/scale) are only applied
- * to root objects. The way objects and their hierarchy are created will
- * need to be revisited at some point but for now this seems to do the
- * trick.
- *
- * Explanation of the trick:
- * The first getParent() will return this object's transformation matrix.
- * The second getParent() will get the parent of the transform, but this
- * might be the archive root ('/') which is valid, so we go passed it to
- * make sure that there is no parent.
- */
- has_alembic_parent = m_iobject.getParent().getParent().getParent().valid();
+ ixform_parent = m_iobject.getParent().getParent();
}
/* Should not happen. */
else {
+ std::cerr << "AbcObjectReader::read_matrix: "
+ << "unable to find IXform for Alembic object '"
+ << m_iobject.getFullName() << "'\n";
+ BLI_assert(false);
return;
}
@@ -277,6 +266,16 @@ void AbcObjectReader::read_matrix(float mat[4][4], const float time, const float
return;
}
+ bool has_alembic_parent;
+ if (!ixform_parent.getParent()) {
+ /* The archive top object certainly is not a transform itself, so handle
+ * it as "no parent". */
+ has_alembic_parent = false;
+ }
+ else {
+ has_alembic_parent = ixform_parent && schema.getInheritsXforms();
+ }
+
const Imath::M44d matrix = get_matrix(schema, time);
convert_matrix(matrix, m_object, mat, scale, has_alembic_parent);
More information about the Bf-blender-cvs
mailing list