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-09-08 15:16:54 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-09-08 17:19:54 +0300
commit9421d66a1b74f18b1eadbfdff4d8bfc08bd19913 (patch)
tree82134905b579feaf92adcbc80b166a717deafd69
parentc0b4a93faedbbf53761fa86aafcc458f140700a2 (diff)
Cleanup: Alembic export, split `ABCHierarchyIterator::get_alembic_parent()`
Split `ABCHierarchyIterator::get_alembic_parent()` into two functions: - For a given export path, find the Alembic object - Ensure that that object is usable as parent object (Alembic uses a specific 'top' object as parent to indicate "no parent"). The new function is `public` as it will be used in an upcoming feature, and is required to be public then. No functional changes.
-rw-r--r--source/blender/io/alembic/exporter/abc_hierarchy_iterator.cc24
-rw-r--r--source/blender/io/alembic/exporter/abc_hierarchy_iterator.h2
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;