Files
goo-engine/source/blender/alembic/intern/abc_customdata.h
T
Kévin Dietrich 61050f75b1 Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.

A more in-depth documentation is to be found on the wiki, as well as a
 guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.

Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.

Reviewers: sergey, campbellbarton, mont29

Reviewed By: sergey, campbellbarton, mont29

Differential Revision: https://developer.blender.org/D2060
2016-08-06 10:58:13 +02:00

94 lines
2.5 KiB
C++

/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2016 Kévin Dietrich.
* All rights reserved.
*
* ***** END GPL LICENSE BLOCK *****
*
*/
#ifndef __ABC_CUSTOMDATA_H__
#define __ABC_CUSTOMDATA_H__
#include <Alembic/Abc/All.h>
struct CustomData;
struct MLoop;
struct MLoopUV;
struct MPoly;
struct MVert;
using Alembic::Abc::ICompoundProperty;
using Alembic::Abc::OCompoundProperty;
struct UVSample {
std::vector<Imath::V2f> uvs;
std::vector<uint32_t> indices;
};
struct CDStreamConfig {
MLoop *mloop;
int totloop;
MPoly *mpoly;
int totpoly;
MVert *mvert;
int totvert;
MLoopUV *mloopuv;
CustomData *loopdata;
bool pack_uvs;
/* TODO(kevin): might need a better way to handle adding and/or updating
* custom datas such that it updates the custom data holder and its pointers
* properly. */
void *user_data;
void *(*add_customdata_cb)(void *user_data, const char *name, int data_type);
CDStreamConfig()
: mloop(NULL)
, totloop(0)
, mpoly(NULL)
, totpoly(0)
, totvert(0)
, pack_uvs(false)
, user_data(NULL)
, add_customdata_cb(NULL)
{}
};
/* Get the UVs for the main UV property on a OSchema.
* Returns the name of the UV layer.
*
* For now the active layer is used, maybe needs a better way to choose this. */
const char *get_uv_sample(UVSample &sample, const CDStreamConfig &config, CustomData *data);
void write_custom_data(const OCompoundProperty &prop,
const CDStreamConfig &config,
CustomData *data,
int data_type);
void read_custom_data(const ICompoundProperty &prop,
const CDStreamConfig &config,
const Alembic::Abc::ISampleSelector &iss);
#endif /* __ABC_CUSTOMDATA_H__ */