def testUVConversionFromMayaMesh(self):

        mayaMesh = maya.cmds.ls(maya.cmds.polyPlane(), dag=True,
                                type="mesh")[0]
        coreMesh = IECoreMaya.FromMayaMeshConverter(mayaMesh).convert()

        transform = maya.cmds.createNode("transform")
        self.failUnless(
            IECoreMaya.ToMayaMeshConverter(coreMesh).convert(transform))
        mayaMesh2 = maya.cmds.listRelatives(transform, shapes=True)[0]

        l = OpenMaya.MSelectionList()
        l.add(mayaMesh)
        l.add(mayaMesh2)
        p = OpenMaya.MDagPath()
        p2 = OpenMaya.MDagPath()
        l.getDagPath(0, p)
        l.getDagPath(1, p2)

        uvSets = []
        fnMesh = OpenMaya.MFnMesh(p)
        fnMesh.getUVSetNames(uvSets)

        uvSets2 = []
        fnMesh2 = OpenMaya.MFnMesh(p2)
        fnMesh2.getUVSetNames(uvSets2)

        self.assertEqual(uvSets, uvSets2)

        # Check uvIndices
        coreMesh2 = IECoreMaya.FromMayaMeshConverter(mayaMesh2).convert()
        # self.assertEqual( coreMesh["uv"].data, coreMesh2["uv"].data )
        self.assertEqual(coreMesh["uv"].indices, coreMesh2["uv"].indices)
示例#2
0
	def testConstructor( self ) :
	
		coreMesh = IECore.MeshPrimitive.createBox( IECore.Box3f( IECore.V3f( -10 ), IECore.V3f( 10 ) ) )
		
		converter = IECoreMaya.ToMayaMeshConverter( coreMesh )
		transform = maya.cmds.createNode( "transform" )
		converter.convert( transform )
		self.assertEqual( maya.cmds.nodeType( maya.cmds.listRelatives( transform, shapes=True )[0] ), "mesh" )