diff options
Diffstat (limited to 'source/blender/io/alembic')
-rw-r--r-- | source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc | 24 | ||||
-rw-r--r-- | source/blender/io/alembic/exporter/abc_hierarchy_iterator.h | 2 |
2 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc b/source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc index e8ca06d75fc..5fc5c47d4b9 100644 --- a/source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc +++ b/source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc @@ -126,17 +126,27 @@ AbstractHierarchyIterator::ExportGraph::key_type ABCHierarchyIterator::determine context, dupli_object, dupli_parent_finder); } -Alembic::Abc::OObject ABCHierarchyIterator::get_alembic_parent( - const HierarchyContext *context) const +Alembic::Abc::OObject ABCHierarchyIterator::get_alembic_object( + const std::string &export_path) const { - Alembic::Abc::OObject parent; + if (export_path.empty()) { + return Alembic::Abc::OObject(); + } - if (!context->higher_up_export_path.empty()) { - AbstractHierarchyWriter *writer = get_writer(context->higher_up_export_path); - ABCAbstractWriter *abc_writer = static_cast<ABCAbstractWriter *>(writer); - parent = abc_writer->get_alembic_object(); + AbstractHierarchyWriter *writer = get_writer(export_path); + if (writer == nullptr) { + return Alembic::Abc::OObject(); } + ABCAbstractWriter *abc_writer = static_cast<ABCAbstractWriter *>(writer); + return abc_writer->get_alembic_object(); +} + +Alembic::Abc::OObject ABCHierarchyIterator::get_alembic_parent( + const HierarchyContext *context) const +{ + Alembic::Abc::OObject parent = get_alembic_object(context->higher_up_export_path); + if (!parent.valid()) { /* An invalid parent object means "no parent", which should be translated to Alembic's top * archive object. */ diff --git a/source/blender/io/alembic/exporter/abc_hierarchy_iterator.h b/source/blender/io/alembic/exporter/abc_hierarchy_iterator.h index b8abfd74c4c..5bc82564cdb 100644 --- a/source/blender/io/alembic/exporter/abc_hierarchy_iterator.h +++ b/source/blender/io/alembic/exporter/abc_hierarchy_iterator.h @@ -62,6 +62,8 @@ class ABCHierarchyIterator : public AbstractHierarchyIterator { virtual void iterate_and_write() override; virtual std::string make_valid_name(const std::string &name) const override; + Alembic::Abc::OObject get_alembic_object(const std::string &export_path) const; + protected: virtual bool mark_as_weak_export(const Object *object) const override; |