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-05-26 17:38:47 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-05-26 17:42:01 +0300
commita1c9d425844c5c2299daf9a89438d164f605407c (patch)
treedacd7ddc8fcf4616f8354f45420d739eb2fea51e /source/blender/io/alembic/intern/abc_customdata.cc
parentf3cf29ac96937bec76e6cfeb6b143625a814bc03 (diff)
Fix T77021: Alembic export of animated mesh with multiple UV maps fails
This was caused by a side-effect of our exporting code's memory management (Alembic considers data "written" and "final" when its C++ objects go out of scope) in combination with my change in rB65574463fa2d. I removed an "only export UVs on the first frame" clause because it was unclear why this restriction was there. As it turns out, it breaks the export of the 2nd and subsequent UV maps on an animated mesh. Effectively, on every frame the Alembic library thought we want to create a new UV map, instead of continuing to write a new frame of data to the existing one. This is resolved by keeping a reference to the C++ objects for the UV maps in memory while the exporter is running.
Diffstat (limited to 'source/blender/io/alembic/intern/abc_customdata.cc')
-rw-r--r--source/blender/io/alembic/intern/abc_customdata.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/io/alembic/intern/abc_customdata.cc b/source/blender/io/alembic/intern/abc_customdata.cc
index c5f60ac3e29..b769d00cd9c 100644
--- a/source/blender/io/alembic/intern/abc_customdata.cc
+++ b/source/blender/io/alembic/intern/abc_customdata.cc
@@ -146,7 +146,7 @@ const char *get_uv_sample(UVSample &sample, const CDStreamConfig &config, Custom
* - (optional due to its behavior) tag as UV using Alembic::AbcGeom::SetIsUV
*/
static void write_uv(const OCompoundProperty &prop,
- const CDStreamConfig &config,
+ CDStreamConfig &config,
void *data,
const char *name)
{
@@ -159,13 +159,18 @@ static void write_uv(const OCompoundProperty &prop,
return;
}
- OV2fGeomParam param(prop, name, true, kFacevaryingScope, 1);
+ std::string uv_map_name(name);
+ OV2fGeomParam param = config.abc_uv_maps[uv_map_name];
+ if (!param.valid()) {
+ param = OV2fGeomParam(prop, name, true, kFacevaryingScope, 1);
+ }
OV2fGeomParam::Sample sample(V2fArraySample(&uvs.front(), uvs.size()),
UInt32ArraySample(&indices.front(), indices.size()),
kFacevaryingScope);
-
param.set(sample);
+
+ config.abc_uv_maps[uv_map_name] = param;
}
/* Convention to write Vertex Colors:
@@ -219,7 +224,7 @@ static void write_mcol(const OCompoundProperty &prop,
}
void write_custom_data(const OCompoundProperty &prop,
- const CDStreamConfig &config,
+ CDStreamConfig &config,
CustomData *data,
int data_type)
{