From 65574463fa2d31dc912cf886649c62a7d0ad2450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 12 May 2020 14:48:18 +0200 Subject: Fix T76132: Can't export Alembic with changing UVs In the Alembic exporter, UVs were only exported on the first frame. This is an issue, as when exporting an animated mesh the topology can change, and then the UV coordinates of the first frame are no longer valid. T76132 concerns both exporting and importing changing UVs. This fixes the exporting. --- source/blender/io/alembic/intern/abc_writer_mesh.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/io') diff --git a/source/blender/io/alembic/intern/abc_writer_mesh.cc b/source/blender/io/alembic/intern/abc_writer_mesh.cc index a47fe55750e..f7b575e7b23 100644 --- a/source/blender/io/alembic/intern/abc_writer_mesh.cc +++ b/source/blender/io/alembic/intern/abc_writer_mesh.cc @@ -335,7 +335,7 @@ void AbcGenericMeshWriter::writeMesh(struct Mesh *mesh) V3fArraySample(points), Int32ArraySample(poly_verts), Int32ArraySample(loop_counts)); UVSample sample; - if (m_first_frame && m_settings.export_uvs) { + if (m_settings.export_uvs) { const char *name = get_uv_sample(sample, m_custom_data_config, &mesh->ldata); if (!sample.indices.empty() && !sample.uvs.empty()) { -- cgit v1.2.3 From 94cbfb71bcf4f0499301f7c6f201124d8740cacf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 12 May 2020 15:06:29 +0200 Subject: Fix T76132: Can't import Alembic with changing UVs In the Alembic importer, the animation of UVs and normals was overlooked; when the mesh geometry is not animated, the entire mesh was considered constant. T76132 concerns both the exporting and importing of changing UVs. This commit fixes the importing. --- source/blender/io/alembic/intern/abc_reader_mesh.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/blender/io') diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index b85bce3e10a..b69a5301d76 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -482,6 +482,19 @@ bool AbcMeshReader::valid() const return m_schema.valid(); } +/* Specialisation of has_animations() as defined in abc_reader_object.h. */ +template<> bool has_animations(Alembic::AbcGeom::IPolyMeshSchema &schema, ImportSettings *settings) +{ + if (settings->is_sequence || !schema.isConstant()) { + return true; + } + + IV2fGeomParam uvsParam = schema.getUVsParam(); + IN3fGeomParam normalsParam = schema.getNormalsParam(); + return (uvsParam.valid() && !uvsParam.isConstant()) || + (normalsParam.valid() && !normalsParam.isConstant()); +} + void AbcMeshReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) { Mesh *mesh = BKE_mesh_add(bmain, m_data_name.c_str()); -- cgit v1.2.3