return s0.getMatrix();
}
-void AbcObjectReader::readObjectMatrix(const float time)
+void AbcObjectReader::setupObjectTransform(const float time)
{
bool is_constant = false;
const Imath::M44d matrix = get_matrix(schema, time);
convert_matrix(matrix, m_object, mat, scale, has_alembic_parent);
+ if (has_alembic_parent) {
+ /* In this case, the matrix in Alembic is in local coordinates, so
+ * convert to world matrix. To prevent us from reading and accumulating
+ * all parent matrices in the Alembic file, we assume that the Blender
+ * parent object is already updated for the current timekey, and use its
+ * world matrix. */
+ BLI_assert(m_object->parent);
+ mul_m4_m4m4(mat, m_object->parent->obmat, mat);
+ }
+
is_constant = schema.isConstant();
}
if (reader->valid()) {
reader->readObjectData(data->bmain, 0.0f);
- reader->readObjectMatrix(0.0f);
min_time = std::min(min_time, reader->minTime());
max_time = std::max(max_time, reader->maxTime());
return;
}
}
+
+ /* Setup transformations and constraints. */
+ for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) {
+ AbcObjectReader *reader = *iter;
+ reader->setupObjectTransform(0.0f);
+ }
}
static void import_endjob(void *user_data)