Blender V5.3
abc_reader_archive.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2016 Kévin Dietrich. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#pragma once
5
9
10#include <Alembic/Abc/IArchive.h>
11#include <Alembic/Abc/IObject.h>
12
13#include <fstream>
14#include <vector>
15
16namespace blender {
17
18struct Main;
19
20namespace io::alembic {
21
22/* Represents the time range in seconds for animated data inside of an Alembic archive. The time
23 * range is [min, max]. */
24struct TimeInfo {
25 Alembic::Abc::chrono_t min_time = std::numeric_limits<Alembic::Abc::chrono_t>::max();
26 Alembic::Abc::chrono_t max_time = -std::numeric_limits<Alembic::Abc::chrono_t>::max();
27
28 bool is_valid() const
29 {
30 return min_time <= max_time &&
31 min_time != std::numeric_limits<Alembic::Abc::chrono_t>::max() &&
32 max_time != -std::numeric_limits<Alembic::Abc::chrono_t>::max();
33 }
34};
35
41class ArchiveReader {
42 Alembic::Abc::IArchive m_archive;
43 std::ifstream m_infile;
44 std::vector<std::istream *> m_streams;
45
46 std::vector<ArchiveReader *> m_readers;
47
48 ArchiveReader(const std::vector<ArchiveReader *> &readers);
49
50 ArchiveReader(const struct Main *bmain, const char *filename);
51
52 public:
53 static ArchiveReader *get(const struct Main *bmain, const std::vector<const char *> &filenames);
54
55 ~ArchiveReader();
56
57 bool valid() const;
58
59 Alembic::Abc::IObject getTop();
60
61 /* Detect if the Archive was written by Blender prior to 4.4. */
63
65};
66
67} // namespace io::alembic
68} // namespace blender
static ArchiveReader * get(const struct Main *bmain, const std::vector< const char * > &filenames)
std::string filename(const std::string_view &str, size_t pos)
BMesh Iterators.
Alembic::Abc::chrono_t max_time
Alembic::Abc::chrono_t min_time