Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-06-15 12:06:46 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-06-15 12:12:24 +0300
commit0c384362272637a3e55b480ac03527a1d1df7a90 (patch)
treed26c0414f6cea902b96e22daae5251db6e6a63c8 /source/blender/io/alembic/intern
parentece7ebb3a8b880b45977db7c1915c671c90f2817 (diff)
Alembic: remove support for HDF5 archive format
Alembic is not a single file format, it can be stored in two different ways: Ogawa and HDF5. Ogawa replaced HDF5 and is smaller and much faster (4-25x) to read ([source](http://exocortex.com/blog/alembic_is_about_to_get_really_fast)). As long as Blender has had Alembic support, it has never supported the HDF5 format in any release. There is a build option `WITH_ALEMBIC_HDF5` that can be used to enable HDF5 support in your own build. This commit removes this build option and the code that it manages. In the years that I have been maintainer of Blender's Alembic code, I only remember getting a request to support HDF5 once, and that was to support very old software that has likely since then been updated to support Ogawa. Ubuntu and Fedora also seem to bundle Blender without HDF5 support. This decision was discussed on [DevTalk](https://devtalk.blender.org/t/alembic-hdf5-support-completely-remove) where someone also mentioned that there is a tool available that can convert HDF5 files to the Ogawa format.
Diffstat (limited to 'source/blender/io/alembic/intern')
-rw-r--r--source/blender/io/alembic/intern/abc_exporter.cc4
-rw-r--r--source/blender/io/alembic/intern/abc_exporter.h1
-rw-r--r--source/blender/io/alembic/intern/abc_reader_archive.cc39
-rw-r--r--source/blender/io/alembic/intern/abc_reader_archive.h14
-rw-r--r--source/blender/io/alembic/intern/abc_writer_archive.cc31
-rw-r--r--source/blender/io/alembic/intern/abc_writer_archive.h10
-rw-r--r--source/blender/io/alembic/intern/alembic_capi.cc9
7 files changed, 13 insertions, 95 deletions
diff --git a/source/blender/io/alembic/intern/abc_exporter.cc b/source/blender/io/alembic/intern/abc_exporter.cc
index dbf24452b78..8dad8dff199 100644
--- a/source/blender/io/alembic/intern/abc_exporter.cc
+++ b/source/blender/io/alembic/intern/abc_exporter.cc
@@ -93,7 +93,6 @@ ExportSettings::ExportSettings()
apply_subdiv(false),
use_subdiv_schema(false),
export_child_hairs(true),
- export_ogawa(true),
pack_uv(false),
triangulate(false),
quad_method(0),
@@ -276,8 +275,7 @@ void AbcExporter::operator()(short *do_update, float *progress, bool *was_cancel
abc_scene_name = "untitled";
}
- m_writer = new ArchiveWriter(
- m_filename, abc_scene_name, m_settings.scene, m_settings.export_ogawa);
+ m_writer = new ArchiveWriter(m_filename, abc_scene_name, m_settings.scene);
/* Create time samplings for transforms and shapes. */
diff --git a/source/blender/io/alembic/intern/abc_exporter.h b/source/blender/io/alembic/intern/abc_exporter.h
index 398004d2ec5..049ccb291bd 100644
--- a/source/blender/io/alembic/intern/abc_exporter.h
+++ b/source/blender/io/alembic/intern/abc_exporter.h
@@ -73,7 +73,6 @@ struct ExportSettings {
bool curves_as_mesh;
bool use_subdiv_schema;
bool export_child_hairs;
- bool export_ogawa;
bool pack_uv;
bool triangulate;
diff --git a/source/blender/io/alembic/intern/abc_reader_archive.cc b/source/blender/io/alembic/intern/abc_reader_archive.cc
index 563466d81bc..d55736f732a 100644
--- a/source/blender/io/alembic/intern/abc_reader_archive.cc
+++ b/source/blender/io/alembic/intern/abc_reader_archive.cc
@@ -40,11 +40,8 @@ using Alembic::Abc::IArchive;
using Alembic::Abc::kWrapExisting;
static IArchive open_archive(const std::string &filename,
- const std::vector<std::istream *> &input_streams,
- bool &is_hdf5)
+ const std::vector<std::istream *> &input_streams)
{
- is_hdf5 = false;
-
try {
Alembic::AbcCoreOgawa::ReadArchive archive_reader(input_streams);
@@ -53,22 +50,7 @@ static IArchive open_archive(const std::string &filename,
catch (const Exception &e) {
std::cerr << e.what() << '\n';
-#ifdef WITH_ALEMBIC_HDF5
- try {
- is_hdf5 = true;
- Alembic::AbcCoreAbstract::ReadArraySampleCachePtr cache_ptr;
-
- return IArchive(Alembic::AbcCoreHDF5::ReadArchive(),
- filename.c_str(),
- ErrorHandler::kThrowPolicy,
- cache_ptr);
- }
- catch (const Exception &) {
- std::cerr << e.what() << '\n';
- return IArchive();
- }
-#else
- /* Inspect the file to see whether it's really a HDF5 file. */
+ /* Inspect the file to see whether it's actually a HDF5 file. */
char header[4]; /* char(0x89) + "HDF" */
std::ifstream the_file(filename.c_str(), std::ios::in | std::ios::binary);
if (!the_file) {
@@ -81,16 +63,12 @@ static IArchive open_archive(const std::string &filename,
std::cerr << filename << " has an unknown file format, unable to read." << std::endl;
}
else {
- is_hdf5 = true;
std::cerr << filename << " is in the obsolete HDF5 format, unable to read." << std::endl;
}
if (the_file.is_open()) {
the_file.close();
}
-
- return IArchive();
-#endif
}
return IArchive();
@@ -113,18 +91,7 @@ ArchiveReader::ArchiveReader(struct Main *bmain, const char *filename)
m_streams.push_back(&m_infile);
- m_archive = open_archive(abs_filename, m_streams, m_is_hdf5);
-
- /* We can't open an HDF5 file from a stream, so close it. */
- if (m_is_hdf5) {
- m_infile.close();
- m_streams.clear();
- }
-}
-
-bool ArchiveReader::is_hdf5() const
-{
- return m_is_hdf5;
+ m_archive = open_archive(abs_filename, m_streams);
}
bool ArchiveReader::valid() const
diff --git a/source/blender/io/alembic/intern/abc_reader_archive.h b/source/blender/io/alembic/intern/abc_reader_archive.h
index 35273e10108..304c876adce 100644
--- a/source/blender/io/alembic/intern/abc_reader_archive.h
+++ b/source/blender/io/alembic/intern/abc_reader_archive.h
@@ -25,11 +25,6 @@
#define __ABC_READER_ARCHIVE_H__
#include <Alembic/Abc/All.h>
-
-#ifdef WITH_ALEMBIC_HDF5
-# include <Alembic/AbcCoreHDF5/All.h>
-#endif
-
#include <Alembic/AbcCoreOgawa/All.h>
#include <fstream>
@@ -46,21 +41,12 @@ class ArchiveReader {
Alembic::Abc::IArchive m_archive;
std::ifstream m_infile;
std::vector<std::istream *> m_streams;
- bool m_is_hdf5;
public:
ArchiveReader(struct Main *bmain, const char *filename);
bool valid() const;
- /**
- * Returns true when either Blender is compiled with HDF5 support and
- * the archive was successfully opened (valid() will also return true),
- * or when Blender was built without HDF5 support but a HDF5 file was
- * detected (valid() will return false).
- */
- bool is_hdf5() const;
-
Alembic::Abc::IObject getTop();
};
diff --git a/source/blender/io/alembic/intern/abc_writer_archive.cc b/source/blender/io/alembic/intern/abc_writer_archive.cc
index e7dee536cb9..40926532f85 100644
--- a/source/blender/io/alembic/intern/abc_writer_archive.cc
+++ b/source/blender/io/alembic/intern/abc_writer_archive.cc
@@ -43,10 +43,8 @@ using Alembic::Abc::OArchive;
/* This kinda duplicates CreateArchiveWithInfo, but Alembic does not seem to
* have a version supporting streams. */
static OArchive create_archive(std::ostream *ostream,
- const std::string &filename,
const std::string &scene_name,
- double scene_fps,
- bool ogawa)
+ double scene_fps)
{
Alembic::Abc::MetaData abc_metadata;
@@ -73,38 +71,25 @@ static OArchive create_archive(std::ostream *ostream,
abc_metadata.set(Alembic::Abc::kDateWrittenKey, buffer);
ErrorHandler::Policy policy = ErrorHandler::kThrowPolicy;
-
-#ifdef WITH_ALEMBIC_HDF5
- if (!ogawa) {
- return OArchive(Alembic::AbcCoreHDF5::WriteArchive(), filename, abc_metadata, policy);
- }
-#else
- static_cast<void>(filename);
- static_cast<void>(ogawa);
-#endif
-
Alembic::AbcCoreOgawa::WriteArchive archive_writer;
return OArchive(archive_writer(ostream, abc_metadata), kWrapExisting, policy);
}
ArchiveWriter::ArchiveWriter(const char *filename,
const std::string &abc_scene_name,
- const Scene *scene,
- bool do_ogawa)
+ const Scene *scene)
{
/* Use stream to support unicode character paths on Windows. */
- if (do_ogawa) {
#ifdef WIN32
- UTF16_ENCODE(filename);
- std::wstring wstr(filename_16);
- m_outfile.open(wstr.c_str(), std::ios::out | std::ios::binary);
- UTF16_UN_ENCODE(filename);
+ UTF16_ENCODE(filename);
+ std::wstring wstr(filename_16);
+ m_outfile.open(wstr.c_str(), std::ios::out | std::ios::binary);
+ UTF16_UN_ENCODE(filename);
#else
- m_outfile.open(filename, std::ios::out | std::ios::binary);
+ m_outfile.open(filename, std::ios::out | std::ios::binary);
#endif
- }
- m_archive = create_archive(&m_outfile, filename, abc_scene_name, FPS, do_ogawa);
+ m_archive = create_archive(&m_outfile, abc_scene_name, FPS);
}
OArchive &ArchiveWriter::archive()
diff --git a/source/blender/io/alembic/intern/abc_writer_archive.h b/source/blender/io/alembic/intern/abc_writer_archive.h
index 82b0e98b376..737717c1710 100644
--- a/source/blender/io/alembic/intern/abc_writer_archive.h
+++ b/source/blender/io/alembic/intern/abc_writer_archive.h
@@ -25,11 +25,6 @@
#define __ABC_WRITER_ARCHIVE_H__
#include <Alembic/Abc/All.h>
-
-#ifdef WITH_ALEMBIC_HDF5
-# include <Alembic/AbcCoreHDF5/All.h>
-#endif
-
#include <Alembic/AbcCoreOgawa/All.h>
#include <fstream>
@@ -47,10 +42,7 @@ class ArchiveWriter {
Alembic::Abc::OArchive m_archive;
public:
- ArchiveWriter(const char *filename,
- const std::string &abc_scene_name,
- const Scene *scene,
- bool do_ogawa);
+ ArchiveWriter(const char *filename, const std::string &abc_scene_name, const Scene *scene);
Alembic::Abc::OArchive &archive();
};
diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc
index 6ca9e82a26c..a30b15fee5f 100644
--- a/source/blender/io/alembic/intern/alembic_capi.cc
+++ b/source/blender/io/alembic/intern/alembic_capi.cc
@@ -373,7 +373,6 @@ bool ABC_export(Scene *scene,
job->settings.renderable_only = params->renderable_only;
job->settings.use_subdiv_schema = params->use_subdiv_schema;
- job->settings.export_ogawa = (params->compression_type == ABC_ARCHIVE_OGAWA);
job->settings.pack_uv = params->packuv;
job->settings.global_scale = params->global_scale;
job->settings.triangulate = params->triangulate;
@@ -620,7 +619,6 @@ static std::pair<bool, AbcObjectReader *> visit_object(
enum {
ABC_NO_ERROR = 0,
ABC_ARCHIVE_FAIL,
- ABC_UNSUPPORTED_HDF5,
};
struct ImportJobData {
@@ -659,11 +657,7 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa
ArchiveReader *archive = new ArchiveReader(data->bmain, data->filename);
if (!archive->valid()) {
-#ifndef WITH_ALEMBIC_HDF5
- data->error_code = archive->is_hdf5() ? ABC_UNSUPPORTED_HDF5 : ABC_ARCHIVE_FAIL;
-#else
data->error_code = ABC_ARCHIVE_FAIL;
-#endif
delete archive;
return;
}
@@ -850,9 +844,6 @@ static void import_endjob(void *user_data)
case ABC_ARCHIVE_FAIL:
WM_report(RPT_ERROR, "Could not open Alembic archive for reading! See console for detail.");
break;
- case ABC_UNSUPPORTED_HDF5:
- WM_report(RPT_ERROR, "Alembic archive in obsolete HDF5 format is not supported.");
- break;
}
WM_main_add_notifier(NC_SCENE | ND_FRAME, data->scene);