Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2017-04-12 13:15:32 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2017-04-12 13:21:08 +0300
commit642728b3395a49895526348e7a8b294e72ef6dcf (patch)
treef36e9946884a68701479f54f079d8501dd6b0f6c /source/blender/alembic/intern/abc_transform.cc
parentde3c98d62b1ec8e9ad9ea01cb85d47064751ba24 (diff)
Alembic export: fixed exporting as "flat"
This exports all objects in world coordinates without parenting.
Diffstat (limited to 'source/blender/alembic/intern/abc_transform.cc')
-rw-r--r--source/blender/alembic/intern/abc_transform.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/alembic/intern/abc_transform.cc b/source/blender/alembic/intern/abc_transform.cc
index cad1eae4764..2e626edeb8b 100644
--- a/source/blender/alembic/intern/abc_transform.cc
+++ b/source/blender/alembic/intern/abc_transform.cc
@@ -71,6 +71,9 @@ AbcTransformWriter::AbcTransformWriter(Object *ob,
m_xform = OXform(abc_parent, get_id_name(m_object), time_sampling);
m_schema = m_xform.getSchema();
+
+ /* Blender objects can't have a parent without inheriting the transform. */
+ m_inherits_xform = parent != NULL;
}
void AbcTransformWriter::do_write()
@@ -86,20 +89,18 @@ void AbcTransformWriter::do_write()
}
float yup_mat[4][4];
- create_transform_matrix(m_object, yup_mat);
+ create_transform_matrix(m_object, yup_mat,
+ m_inherits_xform ? ABC_MATRIX_LOCAL : ABC_MATRIX_WORLD);
/* Only apply rotation to root camera, parenting will propagate it. */
- if (m_object->type == OB_CAMERA && !has_parent_camera(m_object)) {
+ if (m_object->type == OB_CAMERA && (!m_inherits_xform || !has_parent_camera(m_object))) {
float rot_mat[4][4];
axis_angle_to_mat4_single(rot_mat, 'X', -M_PI_2);
mul_m4_m4m4(yup_mat, yup_mat, rot_mat);
}
- if (!m_object->parent) {
+ if (!m_object->parent || !m_inherits_xform) {
/* Only apply scaling to root objects, parenting will propagate it. */
- /* TODO Sybren: when we're exporting as "flat", i.e. non-hierarchial,
- * we should apply the scale even when the object has a parent
- * Blender Object. */
float scale_mat[4][4];
scale_m4_fl(scale_mat, m_settings.global_scale);
scale_mat[3][3] = m_settings.global_scale; /* also scale translation */
@@ -108,6 +109,7 @@ void AbcTransformWriter::do_write()
m_matrix = convert_matrix(yup_mat);
m_sample.setMatrix(m_matrix);
+ m_sample.setInheritsXforms(m_inherits_xform);
m_schema.set(m_sample);
}