diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-06-18 19:10:19 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-06-19 11:17:41 +0300 |
commit | 0d744cf673e893bd1e44fa7fd91e916935a3ff45 (patch) | |
tree | 2b4363a95be2b5745c7e604e65e979bc7671517a /source/blender/io/alembic/intern | |
parent | 0ae7883d7d34bb2553407a028e9510e407a36d00 (diff) |
Alembic: export object data with object data name
Previously the Alembic exporter exported a mesh object to
`{object.name}/{object.name}Shape`. Now it exports to
`{object.name}/{mesh.name}` instead. The same change also applies to
other object data types.
Note that the code now is a bit hackish, as `m_name` is set even in
cases where it isn't used. This hackishness was already there, though,
but it's now just more visible. This will all be cleaned up when the
Alembic exporter is ported to use the `AbstractHierarchyImporter`
structure of the Universal Scene Description (USD) exporter.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D7672
Diffstat (limited to 'source/blender/io/alembic/intern')
-rw-r--r-- | source/blender/io/alembic/intern/abc_writer_object.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/io/alembic/intern/abc_writer_object.cc b/source/blender/io/alembic/intern/abc_writer_object.cc index f4a3587f54d..3d280d9f0a4 100644 --- a/source/blender/io/alembic/intern/abc_writer_object.cc +++ b/source/blender/io/alembic/intern/abc_writer_object.cc @@ -30,7 +30,17 @@ AbcObjectWriter::AbcObjectWriter(Object *ob, AbcObjectWriter *parent) : m_object(ob), m_settings(settings), m_time_sampling(time_sampling), m_first_frame(true) { - m_name = get_id_name(m_object) + "Shape"; + /* This class is used as superclass for objects themselves (i.e. transforms) and for object + * data (meshes, curves, cameras, etc.). However, when writing transforms, the m_name field is + * ignored. This is a temporary tweak to get the exporter to write object data with the data + * name instead of the object name in a safe way. */ + if (m_object->data == nullptr) { + m_name = get_id_name(m_object); + } + else { + ID *ob_data = static_cast<ID *>(m_object->data); + m_name = get_id_name(ob_data); + } if (parent) { parent->addChild(this); |