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-05-08 14:42:39 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-06-19 11:24:51 +0300
commitf106369ce8577aa9115fead1eff3acd34273a86b (patch)
treed75e24ce75af91a8a6c81ed7797c62cf6d265534 /source/blender
parent0d744cf673e893bd1e44fa7fd91e916935a3ff45 (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')
-rw-r--r--source/blender/io/alembic/intern/abc_util.cc14
-rw-r--r--source/blender/io/alembic/intern/abc_util.h1
-rw-r--r--source/blender/io/alembic/intern/abc_writer_hair.cc3
-rw-r--r--source/blender/io/alembic/intern/abc_writer_points.cc3
4 files changed, 14 insertions, 7 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;
}
/**
diff --git a/source/blender/io/alembic/intern/abc_util.h b/source/blender/io/alembic/intern/abc_util.h
index 57b4d9800a5..8a5763bb38b 100644
--- a/source/blender/io/alembic/intern/abc_util.h
+++ b/source/blender/io/alembic/intern/abc_util.h
@@ -49,6 +49,7 @@ struct Object;
std::string get_id_name(const ID *const id);
std::string get_id_name(const Object *const ob);
+std::string get_valid_abc_name(const char *name);
std::string get_object_dag_path_name(const Object *const ob, Object *dupli_parent);
/* Convert from float to Alembic matrix representations. Does NOT convert from Z-up to Y-up. */
diff --git a/source/blender/io/alembic/intern/abc_writer_hair.cc b/source/blender/io/alembic/intern/abc_writer_hair.cc
index ed62889b03d..43c05627130 100644
--- a/source/blender/io/alembic/intern/abc_writer_hair.cc
+++ b/source/blender/io/alembic/intern/abc_writer_hair.cc
@@ -53,7 +53,8 @@ AbcHairWriter::AbcHairWriter(Object *ob,
{
m_psys = psys;
- OCurves curves(parent->alembicXform(), psys->name, m_time_sampling);
+ std::string psys_name = get_valid_abc_name(psys->name);
+ OCurves curves(parent->alembicXform(), psys_name, m_time_sampling);
m_schema = curves.getSchema();
}
diff --git a/source/blender/io/alembic/intern/abc_writer_points.cc b/source/blender/io/alembic/intern/abc_writer_points.cc
index ac663b62693..6be4bcfdbe7 100644
--- a/source/blender/io/alembic/intern/abc_writer_points.cc
+++ b/source/blender/io/alembic/intern/abc_writer_points.cc
@@ -51,7 +51,8 @@ AbcPointsWriter::AbcPointsWriter(Object *ob,
{
m_psys = psys;
- OPoints points(parent->alembicXform(), psys->name, m_time_sampling);
+ std::string psys_name = get_valid_abc_name(psys->name);
+ OPoints points(parent->alembicXform(), psys_name, m_time_sampling);
m_schema = points.getSchema();
}