Blender Git Commit Log

Git Commits -> Revision ee97add

Revision ee97add by Sybren A. Stüvel (master)
September 14, 2020, 10:49 (GMT)
Alembic export: write custom properties

Write custom properties (aka ID properties) to Alembic, to the
`.userProperties` compound property.

Manifest Task: https://developer.blender.org/T50725

Scalar properties (so single-value/non-array properties) are written as
single-element array properties to Alembic. This is also what's done by
Houdini and Maya exporters, so it seems to be the standard way of doing
things. It also simplifies the implementation.

Two-dimensional arrays are flattened by concatenating all the numbers
into a single array. This is because ID properties have a limited type
system. This means that a 3x3 "matrix" could just as well be a list of
three 3D vectors.

Alembic has two container properties to store custom data:
- `.userProperties`, which is meant for properties that aren't
necessarily understood by other software packages, and
- `.arbGeomParams`, which can contain the same kind of data as
`.userProperties`, but can also specify that these vary per face of a
mesh. This property is mostly intended for renderers.

Most industry packages write their custom data to `.arbGeomParams`.
However, given their goals I feel that `.userProperties` is the more
appropriate one for Blender's ID Properties.

The code is a bit more involved than I would have liked. An
`ABCAbstractWriter` has a `uniqueptr` to its `CustomPropertiesExporter`,
but the `CustomPropertiesExporter` also has a pointer back to its owning
`ABCAbstractWriter`. It's the latter pointer that I'm not too happy
with, but it has a reason. Getting the aforementioned `.userProperties`
from the Alembic library will automatically create it if it doesn't
exist already. If it's not used to actually add custom properties to, it
will crash the Alembic CLI tools (and maybe others too). This is what
the pointer back to the `ABCAbstractWriter` is used for: to get the
`.userProperties` at the last moment, when it's 100% sure at least one
custom property will be written.

Differential Revision: https://developer.blender.org/D8869

Reviewed by: sergey, dbystedt

Commit Details:

Full Hash: ee97add4c404a414addab5cbb6107fac002da77a
Parent Commit: b8a25bb
Lines Changed: +594, -0

2 Added Paths:

/source/blender/io/alembic/exporter/abc_custom_props.cc (+268, -0) (View)
/source/blender/io/alembic/exporter/abc_custom_props.h (+96, -0) (View)

22 Modified Paths:

/source/blender/editors/io/io_alembic.c (+9, -0) (Diff)
/source/blender/io/alembic/ABC_alembic.h (+1, -0) (Diff)
/source/blender/io/alembic/CMakeLists.txt (+2, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_abstract.cc (+41, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_abstract.h (+41, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_camera.cc (+5, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_camera.h (+1, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_curves.cc (+5, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_curves.h (+1, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_hair.cc (+5, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_hair.h (+1, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_instance.cc (+10, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_instance.h (+2, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_mesh.cc (+8, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_mesh.h (+1, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_nurbs.cc (+11, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_nurbs.h (+1, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_points.cc (+5, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_points.h (+1, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_transform.cc (+11, -0) (Diff)
/source/blender/io/alembic/exporter/abc_writer_transform.h (+4, -0) (Diff)
/tests/python/alembic_export_tests.py (+64, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021