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-07-07 15:30:55 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-07-07 15:30:55 +0300
commit98bee41c8a3f78c612f0c4ee587fceb2730f26b4 (patch)
treeffc85de8b4f8794c6a9e187697b6292db66e668c /source/blender/io/common/intern/abstract_hierarchy_iterator.cc
parent70b1c09d7a40912b5dccc69fc95cbee2e2388eab (diff)
IO: Reversed persistent ID order in exports to Alembic and USD
Each duplicated (a.k.a. instanced) object has a Persistent ID, which identifies a dupli within the context of its duplicator. This ID consists of several numbers when there are nested duplis (for example a mesh instancing empties on its vertices, where each empty instances a collection). When exporting to Alembic/USD, these are used to uniquely name the duplicated objects in the export. This commit reverses the order of the persistent ID numbers, so that the first number identifies the first level of recursion. This produces trees like this: ABC `--Triangle |--Triangle |--Empty-1 | `--Pole-1-0 | |--Pole | `--Block-1-1 | `--Block |--Empty | `--Pole-0 | |--Pole | `--Block-1 | `--Block |--Empty-2 | `--Pole-2-0 | |--Pole | `--Block-2-1 | `--Block `--Empty-0 `--Pole-0-0 |--Pole `--Block-0-1 `--Block It is now clearer that `Pole-2-0` and `Block-2-1` are instanced by `Empty-2`. Before this commit, they would have been named `Pole-0-2` and `Block-1-2`.
Diffstat (limited to 'source/blender/io/common/intern/abstract_hierarchy_iterator.cc')
-rw-r--r--source/blender/io/common/intern/abstract_hierarchy_iterator.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
index c8d916c0950..3622c1eb7cd 100644
--- a/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/io/common/intern/abstract_hierarchy_iterator.cc
@@ -427,10 +427,10 @@ void AbstractHierarchyIterator::visit_dupli_object(DupliObject *dupli_object,
copy_m4_m4(context->matrix_world, dupli_object->mat);
// Construct export name for the dupli-instance.
- std::stringstream suffix_stream;
- suffix_stream << std::hex;
- suffix_stream << "-" << context->persistent_id;
- context->export_name = make_valid_name(get_object_name(context->object) + suffix_stream.str());
+ std::stringstream export_name_stream;
+ export_name_stream << get_object_name(context->object) << "-"
+ << context->persistent_id.as_object_name_suffix();
+ context->export_name = make_valid_name(export_name_stream.str());
ExportGraph::key_type graph_index = determine_graph_index_dupli(
context, dupli_object, dupli_parent_finder);