In order to better interop with the broader Alembic/USD ecosystem, align the crease values we export with what we believe is expected by native OpenSubdiv, a 0-10 range. On import we will translate the native OpenSubdiv range back into Blender's 0-1 range. To account for SubD assets produced by Blender before this change, a compat check is put in place for both Alembic and USD to use the old methodology when encountering such files. The compat check makes use of the Blender version we place inside the format's metadata fields. Old assets loaded into a new Blender will look ok. New assets loaded into an old Blender would need to be reworked. Pull Request: https://projects.blender.org/blender/blender/pulls/132582
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
/* SPDX-FileCopyrightText: 2016 Kévin Dietrich. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
#pragma once
|
|
|
|
/** \file
|
|
* \ingroup balembic
|
|
*/
|
|
|
|
#include <Alembic/Abc/IArchive.h>
|
|
#include <Alembic/Abc/IObject.h>
|
|
|
|
#include <fstream>
|
|
#include <vector>
|
|
|
|
struct Main;
|
|
|
|
namespace blender::io::alembic {
|
|
|
|
/**
|
|
* Wrappers around input and output archives. The goal is to be able to use
|
|
* streams so that unicode paths work on Windows (#49112), and to make sure that
|
|
* the stream objects remain valid as long as the archives are open.
|
|
*/
|
|
class ArchiveReader {
|
|
Alembic::Abc::IArchive m_archive;
|
|
std::ifstream m_infile;
|
|
std::vector<std::istream *> m_streams;
|
|
|
|
std::vector<ArchiveReader *> m_readers;
|
|
|
|
ArchiveReader(const std::vector<ArchiveReader *> &readers);
|
|
|
|
ArchiveReader(const struct Main *bmain, const char *filename);
|
|
|
|
public:
|
|
static ArchiveReader *get(const struct Main *bmain, const std::vector<const char *> &filenames);
|
|
|
|
~ArchiveReader();
|
|
|
|
bool valid() const;
|
|
|
|
Alembic::Abc::IObject getTop();
|
|
|
|
/* Detect if the Archive was written by Blender prior to 4.4. */
|
|
bool is_blender_archive_version_prior_44();
|
|
};
|
|
|
|
} // namespace blender::io::alembic
|