Skip to content

Commit 0add1b5

Browse files
Merge pull request #1464 from johnhaddon/alembicFix
Alembic MeshReader : Don't load invalid UVs
2 parents 1c3c660 + f7f32bd commit 0add1b5

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Changes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
10.5.x.x (relative to 10.5.13.1)
22
========
33

4+
Fixes
5+
-----
46

7+
- Alembic : Fixed crashes caused by invalid UVs.
58

69
10.5.13.1 (relative to 10.5.13.0)
710
=========

contrib/IECoreAlembic/src/IECoreAlembic/MeshReader.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,23 @@ class MeshReader : public PrimitiveReader
150150
}
151151
}
152152

153-
PrimitiveVariable::Interpolation interpolation = PrimitiveReader::interpolation( uvs.getScope() );
154-
primitive->variables["uv"] = PrimitiveVariable( interpolation, uvData, indexData );
153+
const PrimitiveVariable primitiveVariable( PrimitiveReader::interpolation( uvs.getScope() ), uvData, indexData );
154+
if( primitive->isPrimitiveVariableValid( primitiveVariable ) )
155+
{
156+
primitive->variables["uv"] = primitiveVariable;
157+
}
158+
else
159+
{
160+
IECore::msg(
161+
IECore::Msg::Warning, "PrimitiveReader::readGeomParam",
162+
boost::format(
163+
"Ignoring invalid \"uv\" property on object \"%1%\" (size %2%, expected %3%)"
164+
)
165+
% uvs.getParent().getObject().getFullName()
166+
% ( indexData ? indexData->readable().size() : uvData->readable().size() )
167+
% primitive->variableSize( primitiveVariable.interpolation )
168+
);
169+
}
155170
}
156171

157172
};

0 commit comments

Comments
 (0)