def loadPolyDataMeshes(geom):

        filename = Geometry.resolvePackageFilename(geom.string_data)
        basename, ext = os.path.splitext(filename)

        preferredExtensions = ['.vtm', '.vtp', '.obj']

        for x in preferredExtensions:
            if os.path.isfile(basename + x):
                filename = basename + x
                break

        if not os.path.isfile(filename):
            print 'warning, cannot find file:', filename
            return []

        if filename.endswith('vtm'):
            polyDataList = ioUtils.readMultiBlock(filename)
        else:
            polyDataList = [ioUtils.readPolyData(filename)]

        if USE_TEXTURE_MESHES:
            for polyData in polyDataList:
                Geometry.loadTextureForMesh(polyData, filename)

        return polyDataList
Ejemplo n.º 2
0
    def loadPolyDataMeshes(geom):

        filename = Geometry.resolvePackageFilename(geom.string_data)
        basename, ext = os.path.splitext(filename)

        preferredExtensions = [".vtm", ".vtp", ".obj"]

        for x in preferredExtensions:
            if os.path.isfile(basename + x):
                filename = basename + x
                break

        if not os.path.isfile(filename):
            print "warning, cannot find file:", filename
            return []

        if filename.endswith("vtm"):
            polyDataList = ioUtils.readMultiBlock(filename)
        else:
            polyDataList = [ioUtils.readPolyData(filename)]

        if USE_TEXTURE_MESHES:
            for polyData in polyDataList:
                Geometry.loadTextureForMesh(polyData, filename)

        return polyDataList
Ejemplo n.º 3
0
    def createPolyDataFromFiles(geom):

        filename = Geometry.resolvePackageFilename(geom.string_data)
        basename, ext = os.path.splitext(filename)

        if filename in Geometry.MeshCache:
            return Geometry.MeshCache[filename]

        preferredExtensions = ['.vtm', '.vtp', '.obj']

        for x in preferredExtensions:
            if os.path.isfile(basename + x):
                filename = basename + x
                break

        if not os.path.isfile(filename):
            print 'warning, cannot find file:', filename
            return []

        visInfo = None

        if filename.endswith('vtm'):
            polyDataList = ioUtils.readMultiBlock(filename)
        else:
            if filename.endswith('obj'):
                polyDataList, actors = ioUtils.readObjMtl(geom.string_data)
                if actors:
                    visInfo = Geometry.makeVisInfoFromActors(actors)
            else:
                polyDataList = [ioUtils.readPolyData(filename)]

        for polyData in polyDataList:
            Geometry.loadTextureForMesh(polyData, filename)

        result = (polyDataList, visInfo)
        Geometry.MeshCache[filename] = result
        return result
Ejemplo n.º 4
0
    def createPolyDataFromFiles(geom):

        filename = Geometry.resolvePackageFilename(geom.string_data)
        basename, ext = os.path.splitext(filename)

        if filename in Geometry.MeshCache:
            return Geometry.MeshCache[filename]

        preferredExtensions = ['.vtm', '.vtp', '.obj']

        for x in preferredExtensions:
            if os.path.isfile(basename + x):
                filename = basename + x
                break

        if not os.path.isfile(filename):
            print 'warning, cannot find file:', filename
            return []

        visInfo = None

        if filename.endswith('vtm'):
            polyDataList = ioUtils.readMultiBlock(filename)
        else:
            if filename.endswith('obj'):
                polyDataList, actors = ioUtils.readObjMtl(filename)
                if actors:
                    visInfo = Geometry.makeVisInfoFromActors(actors)
            else:
                polyDataList = [ioUtils.readPolyData(filename)]

        for polyData in polyDataList:
            Geometry.loadTextureForMesh(polyData, filename)

        result = (polyDataList, visInfo)
        Geometry.MeshCache[filename] = result
        return result