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:44:35 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-05-26 17:44:35 +0300
commit78eae89c390601b1533c99cefb34ad91be15f63d (patch)
tree1f8766b00bda46fff0764a0880300b291df82723 /source/blender/io
parent4102e7ed81cb2c98dc0ade362f47843c7c13b5a7 (diff)
parenta1c9d425844c5c2299daf9a89438d164f605407c (diff)
Merge remote-tracking branch 'origin/blender-v2.83-release'
Diffstat (limited to 'source/blender/io')
-rw-r--r--source/blender/io/alembic/intern/abc_customdata.cc13
-rw-r--r--source/blender/io/alembic/intern/abc_customdata.h10
2 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/io/alembic/intern/abc_customdata.cc b/source/blender/io/alembic/intern/abc_customdata.cc
index 40a057f9a20..62f6a52f7cf 100644
--- a/source/blender/io/alembic/intern/abc_customdata.cc
+++ b/source/blender/io/alembic/intern/abc_customdata.cc
@@ -144,7 +144,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)
{
@@ -157,13 +157,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:
@@ -217,7 +222,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)
{
diff --git a/source/blender/io/alembic/intern/abc_customdata.h b/source/blender/io/alembic/intern/abc_customdata.h
index 04572c736af..c8fc821cb2d 100644
--- a/source/blender/io/alembic/intern/abc_customdata.h
+++ b/source/blender/io/alembic/intern/abc_customdata.h
@@ -27,6 +27,8 @@
#include <Alembic/Abc/All.h>
#include <Alembic/AbcGeom/All.h>
+#include <map>
+
struct CustomData;
struct MLoop;
struct MLoopUV;
@@ -70,6 +72,12 @@ struct CDStreamConfig {
const char **modifier_error_message;
+ /* Alembic needs Blender to keep references to C++ objects (the destructors
+ * finalise the writing to ABC). This map stores OV2fGeomParam objects for the
+ * 2nd and subsequent UV maps; the primary UV map is kept alive by the Alembic
+ * mesh sample itself. */
+ std::map<std::string, Alembic::AbcGeom::OV2fGeomParam> abc_uv_maps;
+
CDStreamConfig()
: mloop(NULL),
totloop(0),
@@ -95,7 +103,7 @@ struct CDStreamConfig {
const char *get_uv_sample(UVSample &sample, const CDStreamConfig &config, CustomData *data);
void write_custom_data(const OCompoundProperty &prop,
- const CDStreamConfig &config,
+ CDStreamConfig &config,
CustomData *data,
int data_type);