diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-05-08 14:42:39 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-06-19 11:24:51 +0300 |
commit | f106369ce8577aa9115fead1eff3acd34273a86b (patch) | |
tree | d75e24ce75af91a8a6c81ed7797c62cf6d265534 /source/blender/io/alembic/intern/abc_util.cc | |
parent | 0d744cf673e893bd1e44fa7fd91e916935a3ff45 (diff) |
Alembic: prevent spaces in names of exported particle systems
Other types already had spaces, periods, and colons replaced by
underscores. The upcoming Alembic exporter (based on the
`AbstractHierarcyIterator` class) will be more consistent and apply the
same naming rules everywhere. This is in preparation for that change.
The `get_…_name()` functions in `abc_util.{cc,h}` will be removed then.
Diffstat (limited to 'source/blender/io/alembic/intern/abc_util.cc')
-rw-r--r-- | source/blender/io/alembic/intern/abc_util.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/io/alembic/intern/abc_util.cc b/source/blender/io/alembic/intern/abc_util.cc index 1f3bd2a1aaa..92f4b9532a1 100644 --- a/source/blender/io/alembic/intern/abc_util.cc +++ b/source/blender/io/alembic/intern/abc_util.cc @@ -49,12 +49,16 @@ std::string get_id_name(const Object *const ob) std::string get_id_name(const ID *const id) { - std::string name(id->name + 2); - std::replace(name.begin(), name.end(), ' ', '_'); - std::replace(name.begin(), name.end(), '.', '_'); - std::replace(name.begin(), name.end(), ':', '_'); + return get_valid_abc_name(id->name + 2); +} - return name; +std::string get_valid_abc_name(const char *name) +{ + std::string name_string(name); + std::replace(name_string.begin(), name_string.end(), ' ', '_'); + std::replace(name_string.begin(), name_string.end(), '.', '_'); + std::replace(name_string.begin(), name_string.end(), ':', '_'); + return name_string; } /** |