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:
Diffstat (limited to 'source/blender/alembic/intern/abc_exporter.cc')
-rw-r--r--source/blender/alembic/intern/abc_exporter.cc57
1 files changed, 27 insertions, 30 deletions
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index ddbbf27392d..391f3fe79af 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -290,13 +290,7 @@ void AbcExporter::operator()(Main *bmain, float &progress, bool &was_canceled)
OBox3dProperty archive_bounds_prop = Alembic::AbcGeom::CreateOArchiveBounds(m_writer->archive(), m_trans_sampling_index);
- if (m_settings.flatten_hierarchy) {
- createTransformWritersFlat();
- }
- else {
- createTransformWritersHierarchy(bmain->eval_ctx);
- }
-
+ createTransformWritersHierarchy(bmain->eval_ctx);
createShapeWriters(bmain->eval_ctx);
/* Make a list of frames to export. */
@@ -381,20 +375,6 @@ void AbcExporter::createTransformWritersHierarchy(EvaluationContext *eval_ctx)
}
}
-void AbcExporter::createTransformWritersFlat()
-{
- for (Base *base = static_cast<Base *>(m_settings.sl->object_bases.first); base; base = base->next) {
- Object *ob = base->object;
-
- if (export_object(&m_settings, base, false) && object_is_shape(ob)) {
- std::string name = get_id_name(ob);
- m_xforms[name] = new AbcTransformWriter(
- ob, m_writer->archive().getTop(), NULL,
- m_trans_sampling_index, m_settings);
- }
- }
-}
-
void AbcExporter::exploreTransform(EvaluationContext *eval_ctx, Base *ob_base, Object *parent, Object *dupliObParent)
{
Object *ob = ob_base->object;
@@ -440,12 +420,18 @@ void AbcExporter::exploreTransform(EvaluationContext *eval_ctx, Base *ob_base, O
AbcTransformWriter * AbcExporter::createTransformWriter(Object *ob, Object *parent, Object *dupliObParent)
{
- const std::string name = get_object_dag_path_name(ob, dupliObParent);
-
/* An object should not be its own parent, or we'll get infinite loops. */
BLI_assert(ob != parent);
BLI_assert(ob != dupliObParent);
+ std::string name;
+ if (m_settings.flatten_hierarchy) {
+ name = get_id_name(ob);
+ }
+ else {
+ name = get_object_dag_path_name(ob, dupliObParent);
+ }
+
/* check if we have already created a transform writer for this object */
AbcTransformWriter *my_writer = getXForm(name);
if (my_writer != NULL){
@@ -455,13 +441,23 @@ AbcTransformWriter * AbcExporter::createTransformWriter(Object *ob, Object *pare
AbcTransformWriter *parent_writer = NULL;
Alembic::Abc::OObject alembic_parent;
- if (parent) {
+ if (m_settings.flatten_hierarchy || parent == NULL) {
+ /* Parentless objects still have the "top object" as parent
+ * in Alembic. */
+ alembic_parent = m_writer->archive().getTop();
+ }
+ else {
/* Since there are so many different ways to find parents (as evident
* in the number of conditions below), we can't really look up the
* parent by name. We'll just call createTransformWriter(), which will
* return the parent's AbcTransformWriter pointer. */
if (parent->parent) {
- parent_writer = createTransformWriter(parent, parent->parent, dupliObParent);
+ if (parent == dupliObParent) {
+ parent_writer = createTransformWriter(parent, parent->parent, NULL);
+ }
+ else {
+ parent_writer = createTransformWriter(parent, parent->parent, dupliObParent);
+ }
}
else if (parent == dupliObParent) {
if (dupliObParent->parent == NULL) {
@@ -478,14 +474,15 @@ AbcTransformWriter * AbcExporter::createTransformWriter(Object *ob, Object *pare
BLI_assert(parent_writer);
alembic_parent = parent_writer->alembicXform();
}
- else {
- /* Parentless objects still have the "top object" as parent
- * in Alembic. */
- alembic_parent = m_writer->archive().getTop();
- }
my_writer = new AbcTransformWriter(ob, alembic_parent, parent_writer,
m_trans_sampling_index, m_settings);
+
+ /* When flattening, the matrix of the dupliobject has to be added. */
+ if (m_settings.flatten_hierarchy && dupliObParent) {
+ my_writer->m_proxy_from = dupliObParent;
+ }
+
m_xforms[name] = my_writer;
return my_writer;
}