diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/alembic/intern/abc_util.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/alembic/intern/abc_util.h')
-rw-r--r-- | source/blender/alembic/intern/abc_util.h | 172 |
1 files changed, 88 insertions, 84 deletions
diff --git a/source/blender/alembic/intern/abc_util.h b/source/blender/alembic/intern/abc_util.h index d21fe7a78ce..44ad4bca2f7 100644 --- a/source/blender/alembic/intern/abc_util.h +++ b/source/blender/alembic/intern/abc_util.h @@ -36,7 +36,7 @@ * pointers to AbcObjectReader (or subclasses thereof). */ struct CacheReader { - int unused; + int unused; }; using Alembic::Abc::chrono_t; @@ -48,58 +48,61 @@ struct Base; struct ID; struct Object; -std::string get_id_name(const ID * const id); -std::string get_id_name(const Object * const ob); -std::string get_object_dag_path_name(const Object * const ob, Object *dupli_parent); +std::string get_id_name(const ID *const id); +std::string get_id_name(const Object *const ob); +std::string get_object_dag_path_name(const Object *const ob, Object *dupli_parent); Imath::M44d convert_matrix(float mat[4][4]); typedef enum { - ABC_MATRIX_WORLD = 1, - ABC_MATRIX_LOCAL = 2, + ABC_MATRIX_WORLD = 1, + ABC_MATRIX_LOCAL = 2, } AbcMatrixMode; -void create_transform_matrix(Object *obj, float r_transform_mat[4][4], - AbcMatrixMode mode, Object *proxy_from); +void create_transform_matrix(Object *obj, + float r_transform_mat[4][4], + AbcMatrixMode mode, + Object *proxy_from); void split(const std::string &s, const char delim, std::vector<std::string> &tokens); -template<class TContainer> -bool begins_with(const TContainer &input, const TContainer &match) +template<class TContainer> bool begins_with(const TContainer &input, const TContainer &match) { - return input.size() >= match.size() - && std::equal(match.begin(), match.end(), input.begin()); + return input.size() >= match.size() && std::equal(match.begin(), match.end(), input.begin()); } void convert_matrix(const Imath::M44d &xform, Object *ob, float r_mat[4][4]); -template <typename Schema> +template<typename Schema> void get_min_max_time_ex(const Schema &schema, chrono_t &min, chrono_t &max) { - const Alembic::Abc::TimeSamplingPtr &time_samp = schema.getTimeSampling(); + const Alembic::Abc::TimeSamplingPtr &time_samp = schema.getTimeSampling(); - if (!schema.isConstant()) { - const size_t num_samps = schema.getNumSamples(); + if (!schema.isConstant()) { + const size_t num_samps = schema.getNumSamples(); - if (num_samps > 0) { - const chrono_t min_time = time_samp->getSampleTime(0); - min = std::min(min, min_time); + if (num_samps > 0) { + const chrono_t min_time = time_samp->getSampleTime(0); + min = std::min(min, min_time); - const chrono_t max_time = time_samp->getSampleTime(num_samps - 1); - max = std::max(max, max_time); - } - } + const chrono_t max_time = time_samp->getSampleTime(num_samps - 1); + max = std::max(max, max_time); + } + } } -template <typename Schema> -void get_min_max_time(const Alembic::AbcGeom::IObject &object, const Schema &schema, chrono_t &min, chrono_t &max) +template<typename Schema> +void get_min_max_time(const Alembic::AbcGeom::IObject &object, + const Schema &schema, + chrono_t &min, + chrono_t &max) { - get_min_max_time_ex(schema, min, max); + get_min_max_time_ex(schema, min, max); - const Alembic::AbcGeom::IObject &parent = object.getParent(); - if (parent.valid() && Alembic::AbcGeom::IXform::matches(parent.getMetaData())) { - Alembic::AbcGeom::IXform xform(parent, Alembic::AbcGeom::kWrapExisting); - get_min_max_time_ex(xform.getSchema(), min, max); - } + const Alembic::AbcGeom::IObject &parent = object.getParent(); + if (parent.valid() && Alembic::AbcGeom::IXform::matches(parent.getMetaData())) { + Alembic::AbcGeom::IXform xform(parent, Alembic::AbcGeom::kWrapExisting); + get_min_max_time_ex(xform.getSchema(), min, max); + } } bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string &name); @@ -123,51 +126,52 @@ AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSe ABC_INLINE void copy_zup_from_yup(float zup[3], const float yup[3]) { - const float old_yup1 = yup[1]; /* in case zup == yup */ - zup[0] = yup[0]; - zup[1] = -yup[2]; - zup[2] = old_yup1; + const float old_yup1 = yup[1]; /* in case zup == yup */ + zup[0] = yup[0]; + zup[1] = -yup[2]; + zup[2] = old_yup1; } ABC_INLINE void copy_zup_from_yup(short zup[3], const short yup[3]) { - const short old_yup1 = yup[1]; /* in case zup == yup */ - zup[0] = yup[0]; - zup[1] = -yup[2]; - zup[2] = old_yup1; + const short old_yup1 = yup[1]; /* in case zup == yup */ + zup[0] = yup[0]; + zup[1] = -yup[2]; + zup[2] = old_yup1; } /* Copy from Z-up to Y-up. */ ABC_INLINE void copy_yup_from_zup(float yup[3], const float zup[3]) { - const float old_zup1 = zup[1]; /* in case yup == zup */ - yup[0] = zup[0]; - yup[1] = zup[2]; - yup[2] = -old_zup1; + const float old_zup1 = zup[1]; /* in case yup == zup */ + yup[0] = zup[0]; + yup[1] = zup[2]; + yup[2] = -old_zup1; } ABC_INLINE void copy_yup_from_zup(short yup[3], const short zup[3]) { - const short old_zup1 = zup[1]; /* in case yup == zup */ - yup[0] = zup[0]; - yup[1] = zup[2]; - yup[2] = -old_zup1; + const short old_zup1 = zup[1]; /* in case yup == zup */ + yup[0] = zup[0]; + yup[1] = zup[2]; + yup[2] = -old_zup1; } /* Names are given in (dst, src) order, just like * the parameters of copy_m44_axis_swap() */ typedef enum { - ABC_ZUP_FROM_YUP = 1, - ABC_YUP_FROM_ZUP = 2, + ABC_ZUP_FROM_YUP = 1, + ABC_YUP_FROM_ZUP = 2, } AbcAxisSwapMode; /* Create a rotation matrix for each axis from euler angles. * Euler angles are swapped to change coordinate system. */ -void create_swapped_rotation_matrix( - float rot_x_mat[3][3], float rot_y_mat[3][3], - float rot_z_mat[3][3], const float euler[3], - AbcAxisSwapMode mode); +void create_swapped_rotation_matrix(float rot_x_mat[3][3], + float rot_y_mat[3][3], + float rot_z_mat[3][3], + const float euler[3], + AbcAxisSwapMode mode); void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], AbcAxisSwapMode mode); @@ -176,18 +180,18 @@ void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], AbcAxisSwapMod #undef ABC_DEBUG_TIME class ScopeTimer { - const char *m_message; - double m_start; + const char *m_message; + double m_start; -public: - ScopeTimer(const char *message); - ~ScopeTimer(); + public: + ScopeTimer(const char *message); + ~ScopeTimer(); }; #ifdef ABC_DEBUG_TIME -# define SCOPE_TIMER(message) ScopeTimer prof(message) +# define SCOPE_TIMER(message) ScopeTimer prof(message) #else -# define SCOPE_TIMER(message) +# define SCOPE_TIMER(message) #endif /* *************************** */ @@ -202,29 +206,29 @@ public: * conditions. */ class SimpleLogger { - std::ostringstream m_stream; - -public: - /** - * Check whether or not the SimpleLogger's stream is empty. - */ - bool empty(); - - /** - * Return a copy of the string contained in the SimpleLogger's stream. - */ - std::string str() const; - - /** - * Remove the bits set on the SimpleLogger's stream and clear its string. - */ - void clear(); - - /** - * Return a reference to the SimpleLogger's stream, in order to e.g. push - * content into it. - */ - std::ostringstream &stream(); + std::ostringstream m_stream; + + public: + /** + * Check whether or not the SimpleLogger's stream is empty. + */ + bool empty(); + + /** + * Return a copy of the string contained in the SimpleLogger's stream. + */ + std::string str() const; + + /** + * Remove the bits set on the SimpleLogger's stream and clear its string. + */ + void clear(); + + /** + * Return a reference to the SimpleLogger's stream, in order to e.g. push + * content into it. + */ + std::ostringstream &stream(); }; #define ABC_LOG(logger) logger.stream() @@ -234,4 +238,4 @@ public: */ std::ostream &operator<<(std::ostream &os, const SimpleLogger &logger); -#endif /* __ABC_UTIL_H__ */ +#endif /* __ABC_UTIL_H__ */ |