Skip to content
Paolo Berto edited this page Jul 24, 2016 · 2 revisions

Multiverse API is 100% backwards compatible with Alembic. Ogawa and HDF5 are still included and enabled as before, with the addition of the shiny new optional Git-based backend. For the Git backend only we provide some simple extensions for history management, such as specifying commit messages and selecting revisions.

Integrating Multiverse

If you do already support Alembic in your renderer/modeler/application the changes you need to do are minimal: just include and link multiverse instead of Alembic, everything will continue to work as before for Ogawa and HDF5.

To save/load a multiverse archive using the Git backend, just follow the directions given below. In this case it's probable you'll want to make some slight modifications to your UI to allow the (optional) selection of a specific commit when loading, and to provide a commit message when saving.

In case you wanted to include multiverse source code directly in your source tree, consider that the Git-backend code is confined in a single directory:

lib/Alembic/AbcCoreGit

while the only other changes to Alembic are to:

lib/Alembic/AbcCoreFactory/IFactory.{h,cpp}`

If you need assistance for the integration, we'll be more than glad to help you. Drop us a line at support@j-cube.jp

loading a Multiverse archive

Just load it as every other Alembic archive. The archive type returned will be:

Alembic::AbcCoreFactory::IFactory::kGit
#include <Alembic/Abc/All.h>
#include <Alembic/AbcCoreFactory/All.h>
#include <Alembic/AbcCoreGit/All.h>
...
void loadMyArchive(const std::string& archivePathname)
{
    Alembic::AbcCoreFactory::IOptions options;
    Alembic::AbcCoreFactory::IFactory factory;
    Alembic::AbcCoreFactory::IFactory::CoreType oType;
    Alembic::Abc::IArchive archive = factory.getArchive(archivePathname, oType, options);
    if (!archive.valid())
    {
        ...
    }
    if (oType != Alembic::AbcCoreFactory::IFactory::kGit)
    {
        // not a multiverse archive (probably an HDF5 or Ogawa one)
    }

    // use the archive data
    ...
}

Saving a multiverse archive

#include <Alembic/Abc/All.h>
#include <Alembic/AbcCoreFactory/All.h>
#include <Alembic/AbcCoreGit/All.h>
...
void saveMyArchive(const std::string& archivePathname, const std::string& commitMessage)
{
    Alembic::Abc::OArchive outArchive;
    Alembic::AbcCoreGit::WriteOptions wOptions;

    if (! commitMessage.empty())
        wOptions.setCommitMessage(commitMessage);

    outArchive = Alembic::Abc::OArchive(
        Alembic::AbcCoreGit::WriteArchive(wOptions),
        archivePathname
    );

    ...
}

or, using CreateArchiveWithInfo():

#include <Alembic/Abc/All.h>
#include <Alembic/AbcCoreFactory/All.h>
#include <Alembic/AbcCoreGit/All.h>
...
void saveMyArchive(const std::string& archivePathname, const std::string& commitMessage)
{
    Alembic::AbcCoreGit::WriteOptions wOptions;

    if (! commitMessage.empty())
        wOptions.setCommitMessage(commitMessage);

    Alembic::Abc::OArchive outArchive = Alembic::Abc::CreateArchiveWithInfo(
        Alembic::AbcCoreGit::WriteArchive(wOptions),
        archivePathname,
        "Application Name",
        "extra user description");

    ...
}
Clone this wiki locally