Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/IECoreMaya/ToMayaMeshConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,25 +273,27 @@ bool ToMayaMeshConverter::doConversion( IECore::ConstObjectPtr from, MObject &to
IECore::ConstV3fVectorDataPtr n = IECore::runTimeCast<const IECore::V3fVectorData>(it->second.data);
if (n)
{
int numVertexNormals = n->readable().size();
IECoreScene::PrimitiveVariable::IndexedView<Imath::V3f> normalView = IECoreScene::PrimitiveVariable::IndexedView<Imath::V3f>( it->second );
vertexNormalsArray.setLength( normalView.size() );

vertexNormalsArray.setLength( numVertexNormals );
for (int i = 0; i < numVertexNormals; i++)
size_t i = 0;
for(const auto& normal : normalView)
{
vertexNormalsArray[i] = IECore::convert<MVector, Imath::V3f>( n->readable()[i] );
vertexNormalsArray[i++] = IECore::convert<MVector, Imath::V3f>( normal );
}
}
else
{
IECore::ConstV3dVectorDataPtr n = IECore::runTimeCast<const IECore::V3dVectorData>(it->second.data);
if (n)
{
int numVertexNormals = n->readable().size();
IECoreScene::PrimitiveVariable::IndexedView<Imath::V3d> normalView = IECoreScene::PrimitiveVariable::IndexedView<Imath::V3d>( it->second );
vertexNormalsArray.setLength( normalView.size() );

vertexNormalsArray.setLength( numVertexNormals );
for (int i = 0; i < numVertexNormals; i++)
size_t i = 0;
for(const auto& normal : normalView)
{
vertexNormalsArray[i] = IECore::convert<MVector, Imath::V3d>( n->readable()[i] );
vertexNormalsArray[i++] = IECore::convert<MVector, Imath::V3d>( normal );
}
}
else
Expand Down
8 changes: 4 additions & 4 deletions test/IECoreMaya/ParameterisedHolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,12 @@ def testNonStorableObjectParameter( self ) :

def testMeshParameterIOProblem( self ) :

fnOP = IECoreMaya.FnOpHolder.create( "merge", "meshMerge", 1 )
fnOP = IECoreMaya.FnOpHolder.create( "merge", "meshMerge" )
op = fnOP.getOp()

mesh = IECoreScene.MeshPrimitive.createBox( imath.Box3f( imath.V3f( -2, -2, -2 ), imath.V3f( 2, 3, 4 ) ) )
op.parameters()["input"].setValue( mesh )
mesh[ "N" ] = IECoreScene.PrimitiveVariable( mesh[ "N" ].interpolation, mesh[ "N" ].expandedData() )
op.parameters()[ "input" ].setValue( mesh )
fnOP.setNodeValues()

cmds.file( rename = os.getcwd() + "/test/IECoreMaya/meshParameterIO.ma" )
Expand All @@ -300,8 +301,7 @@ def testMeshParameterIOProblem( self ) :
op = fnOP.getOp()

mesh2 = op.parameters()["input"].getValue()
self.failUnless( mesh2.arePrimitiveVariablesValid() )
del mesh2["N"]
self.assertTrue( mesh2.arePrimitiveVariablesValid() )
self.assertEqual( mesh2, mesh )

def testOpHolder( self ) :
Expand Down