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-02-14 17:41:02 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-02-14 17:41:17 +0300
commitfb2f100d8949463358fbb3a1ae64c425198fb033 (patch)
treee9d9edf52b36a2a131179e8fef44c6df502a5bf3 /source/blender/alembic
parent451bd5fd7918fe8d2c2f88cb4134e08e46c17eb0 (diff)
Cleanup: Alembic, renamed and moved convert_matrix function
The `convert_matrix()` function just converts between the Alembic and Blender matrix data types, and doesn't do any coordinate system conversion. To clarify this, the function has now been renamed to `convert_matrix_datatype()`. I also moved the implementations next to each other in the source file, so that it's visible that there are actually two of them. No functional changes.
Diffstat (limited to 'source/blender/alembic')
-rw-r--r--source/blender/alembic/intern/abc_object.cc2
-rw-r--r--source/blender/alembic/intern/abc_transform.cc2
-rw-r--r--source/blender/alembic/intern/abc_util.cc20
-rw-r--r--source/blender/alembic/intern/abc_util.h7
4 files changed, 15 insertions, 16 deletions
diff --git a/source/blender/alembic/intern/abc_object.cc b/source/blender/alembic/intern/abc_object.cc
index 4799ed557c8..76aec9ad998 100644
--- a/source/blender/alembic/intern/abc_object.cc
+++ b/source/blender/alembic/intern/abc_object.cc
@@ -339,7 +339,7 @@ void AbcObjectReader::read_matrix(float r_mat[4][4] /* local matrix */,
}
const Imath::M44d matrix = get_matrix(schema, time);
- convert_matrix(matrix, r_mat);
+ convert_matrix_datatype(matrix, r_mat);
copy_m44_axis_swap(r_mat, r_mat, ABC_ZUP_FROM_YUP);
/* Convert from Maya to Blender camera orientation. Children of this camera
diff --git a/source/blender/alembic/intern/abc_transform.cc b/source/blender/alembic/intern/abc_transform.cc
index 838e657fee9..5135af131b1 100644
--- a/source/blender/alembic/intern/abc_transform.cc
+++ b/source/blender/alembic/intern/abc_transform.cc
@@ -105,7 +105,7 @@ void AbcTransformWriter::do_write()
yup_mat[3][3] /= m_settings.global_scale; /* normalise the homogeneous component */
}
- m_matrix = convert_matrix(yup_mat);
+ m_matrix = convert_matrix_datatype(yup_mat);
m_sample.setMatrix(m_matrix);
m_sample.setInheritsXforms(m_inherits_xform);
m_schema.set(m_sample);
diff --git a/source/blender/alembic/intern/abc_util.cc b/source/blender/alembic/intern/abc_util.cc
index 56978374512..9a4d4e1a8cc 100644
--- a/source/blender/alembic/intern/abc_util.cc
+++ b/source/blender/alembic/intern/abc_util.cc
@@ -86,7 +86,7 @@ std::string get_object_dag_path_name(const Object *const ob, Object *dupli_paren
return name;
}
-Imath::M44d convert_matrix(float mat[4][4])
+Imath::M44d convert_matrix_datatype(float mat[4][4])
{
Imath::M44d m;
@@ -99,6 +99,15 @@ Imath::M44d convert_matrix(float mat[4][4])
return m;
}
+void convert_matrix_datatype(const Imath::M44d &xform, float r_mat[4][4])
+{
+ for (int i = 0; i < 4; i++) {
+ for (int j = 0; j < 4; j++) {
+ r_mat[i][j] = static_cast<float>(xform[i][j]);
+ }
+ }
+}
+
void split(const std::string &s, const char delim, std::vector<std::string> &tokens)
{
tokens.clear();
@@ -224,15 +233,6 @@ void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], AbcAxisSwapMod
mul_m4_m4m4(dst_mat, dst_mat, dst_scale_mat);
}
-void convert_matrix(const Imath::M44d &xform, float r_mat[4][4])
-{
- for (int i = 0; i < 4; i++) {
- for (int j = 0; j < 4; j++) {
- r_mat[i][j] = static_cast<float>(xform[i][j]);
- }
- }
-}
-
/* Recompute transform matrix of object in new coordinate system
* (from Z-Up to Y-Up). */
void create_transform_matrix(Object *obj,
diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h
index bfeded37c12..0b3462c2132 100644
--- a/source/blender/alembic/intern/abc_util.h
+++ b/source/blender/alembic/intern/abc_util.h
@@ -52,7 +52,9 @@ std::string get_id_name(const Object *const ob);
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. */
-Imath::M44d convert_matrix(float mat[4][4]);
+Imath::M44d convert_matrix_datatype(float mat[4][4]);
+/* Convert from Alembic to float matrix representations. Does NOT convert from Y-up to Z-up. */
+void convert_matrix_datatype(const Imath::M44d &xform, float r_mat[4][4]);
typedef enum {
ABC_MATRIX_WORLD = 1,
@@ -70,9 +72,6 @@ template<class TContainer> bool begins_with(const TContainer &input, const TCont
return input.size() >= match.size() && std::equal(match.begin(), match.end(), input.begin());
}
-/* Convert from Alembic to float matrix representations. Does NOT convert from Y-up to Z-up. */
-void convert_matrix(const Imath::M44d &xform, float r_mat[4][4]);
-
template<typename Schema>
void get_min_max_time_ex(const Schema &schema, chrono_t &min, chrono_t &max)
{