From 8e7bbe66ddc402fccf05defc109e6dced74b567b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Wed, 17 Aug 2016 22:20:15 +0200 Subject: Alembic import: fix scene min/max time computation to take objects with transform animations into account. --- source/blender/alembic/intern/abc_camera.cc | 2 +- source/blender/alembic/intern/abc_curves.cc | 2 +- source/blender/alembic/intern/abc_mesh.cc | 6 ++++-- source/blender/alembic/intern/abc_nurbs.cc | 2 +- source/blender/alembic/intern/abc_points.cc | 2 +- source/blender/alembic/intern/abc_transform.cc | 2 +- source/blender/alembic/intern/abc_util.h | 11 ++++++++++- 7 files changed, 19 insertions(+), 8 deletions(-) (limited to 'source/blender/alembic') diff --git a/source/blender/alembic/intern/abc_camera.cc b/source/blender/alembic/intern/abc_camera.cc index 38a6d3d33cf..5c34ec1391f 100644 --- a/source/blender/alembic/intern/abc_camera.cc +++ b/source/blender/alembic/intern/abc_camera.cc @@ -109,7 +109,7 @@ AbcCameraReader::AbcCameraReader(const Alembic::Abc::IObject &object, ImportSett ICamera abc_cam(m_iobject, kWrapExisting); m_schema = abc_cam.getSchema(); - get_min_max_time(m_schema, m_min_time, m_max_time); + get_min_max_time(m_iobject, m_schema, m_min_time, m_max_time); } bool AbcCameraReader::valid() const diff --git a/source/blender/alembic/intern/abc_curves.cc b/source/blender/alembic/intern/abc_curves.cc index 4e1e4e7e490..2b54741a5c5 100644 --- a/source/blender/alembic/intern/abc_curves.cc +++ b/source/blender/alembic/intern/abc_curves.cc @@ -190,7 +190,7 @@ AbcCurveReader::AbcCurveReader(const Alembic::Abc::IObject &object, ImportSettin ICurves abc_curves(object, kWrapExisting); m_curves_schema = abc_curves.getSchema(); - get_min_max_time(m_curves_schema, m_min_time, m_max_time); + get_min_max_time(m_iobject, m_curves_schema, m_min_time, m_max_time); } bool AbcCurveReader::valid() const diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc index f1c7b6b3aa3..b80b7c0c4c8 100644 --- a/source/blender/alembic/intern/abc_mesh.cc +++ b/source/blender/alembic/intern/abc_mesh.cc @@ -968,7 +968,8 @@ AbcMeshReader::AbcMeshReader(const IObject &object, ImportSettings &settings) IPolyMesh ipoly_mesh(m_iobject, kWrapExisting); m_schema = ipoly_mesh.getSchema(); - get_min_max_time(m_schema, m_min_time, m_max_time); + + get_min_max_time(m_iobject, m_schema, m_min_time, m_max_time); } bool AbcMeshReader::valid() const @@ -1120,7 +1121,8 @@ AbcSubDReader::AbcSubDReader(const IObject &object, ImportSettings &settings) ISubD isubd_mesh(m_iobject, kWrapExisting); m_schema = isubd_mesh.getSchema(); - get_min_max_time(m_schema, m_min_time, m_max_time); + + get_min_max_time(m_iobject, m_schema, m_min_time, m_max_time); } bool AbcSubDReader::valid() const diff --git a/source/blender/alembic/intern/abc_nurbs.cc b/source/blender/alembic/intern/abc_nurbs.cc index a3c18ad6301..4f57dfdae9e 100644 --- a/source/blender/alembic/intern/abc_nurbs.cc +++ b/source/blender/alembic/intern/abc_nurbs.cc @@ -201,7 +201,7 @@ AbcNurbsReader::AbcNurbsReader(const IObject &object, ImportSettings &settings) : AbcObjectReader(object, settings) { getNurbsPatches(m_iobject); - get_min_max_time(m_schemas[0].first, m_min_time, m_max_time); + get_min_max_time(m_iobject, m_schemas[0].first, m_min_time, m_max_time); } bool AbcNurbsReader::valid() const diff --git a/source/blender/alembic/intern/abc_points.cc b/source/blender/alembic/intern/abc_points.cc index fa5b71ac094..758d4827b8a 100644 --- a/source/blender/alembic/intern/abc_points.cc +++ b/source/blender/alembic/intern/abc_points.cc @@ -141,7 +141,7 @@ AbcPointsReader::AbcPointsReader(const Alembic::Abc::IObject &object, ImportSett { IPoints ipoints(m_iobject, kWrapExisting); m_schema = ipoints.getSchema(); - get_min_max_time(m_schema, m_min_time, m_max_time); + get_min_max_time(m_iobject, m_schema, m_min_time, m_max_time); } bool AbcPointsReader::valid() const diff --git a/source/blender/alembic/intern/abc_transform.cc b/source/blender/alembic/intern/abc_transform.cc index 3326ae0ed84..7f8984f9970 100644 --- a/source/blender/alembic/intern/abc_transform.cc +++ b/source/blender/alembic/intern/abc_transform.cc @@ -137,7 +137,7 @@ AbcEmptyReader::AbcEmptyReader(const Alembic::Abc::IObject &object, ImportSettin Alembic::AbcGeom::IXform xform(object, Alembic::AbcGeom::kWrapExisting); m_schema = xform.getSchema(); - get_min_max_time(m_schema, m_min_time, m_max_time); + get_min_max_time(m_iobject, m_schema, m_min_time, m_max_time); } bool AbcEmptyReader::valid() const diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h index 688a25d85f6..8cdfe21e43f 100644 --- a/source/blender/alembic/intern/abc_util.h +++ b/source/blender/alembic/intern/abc_util.h @@ -64,7 +64,7 @@ void create_input_transform(const Alembic::AbcGeom::ISampleSelector &sample_sel, float r_mat[4][4], float scale, bool has_alembic_parent = false); template -void get_min_max_time(const Schema &schema, chrono_t &min, chrono_t &max) +void get_min_max_time_ex(const Schema &schema, chrono_t &min, chrono_t &max) { const Alembic::Abc::TimeSamplingPtr &time_samp = schema.getTimeSampling(); @@ -81,6 +81,15 @@ void get_min_max_time(const Schema &schema, chrono_t &min, chrono_t &max) } } +template +void get_min_max_time(const Alembic::AbcGeom::IObject &object, const Schema &schema, chrono_t &min, chrono_t &max) +{ + get_min_max_time_ex(schema, min, max); + + Alembic::AbcGeom::IXform parent(object.getParent(), Alembic::AbcGeom::kWrapExisting); + get_min_max_time_ex(parent.getSchema(), min, max); +} + bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string &name); /* ************************** */ -- cgit v1.2.3