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/collada/AnimationExporter.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/collada/AnimationExporter.h')
-rw-r--r-- | source/blender/collada/AnimationExporter.h | 267 |
1 files changed, 133 insertions, 134 deletions
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h index fa0640c73e8..71d7d14a112 100644 --- a/source/blender/collada/AnimationExporter.h +++ b/source/blender/collada/AnimationExporter.h @@ -23,8 +23,7 @@ #include "BCAnimationCurve.h" -extern "C" -{ +extern "C" { #include "DNA_scene_types.h" #include "DNA_object_types.h" #include "DNA_anim_types.h" @@ -45,7 +44,7 @@ extern "C" #include "BKE_fcurve.h" #include "BKE_animsys.h" #include "BKE_scene.h" -#include "BKE_action.h" // pose functions +#include "BKE_action.h" // pose functions #include "BKE_armature.h" #include "BKE_object.h" #include "BKE_constraint.h" @@ -77,185 +76,185 @@ extern "C" #include <vector> #include <map> -#include <algorithm> // std::find +#include <algorithm> // std::find struct Depsgraph; typedef enum BC_animation_source_type { - BC_SOURCE_TYPE_VALUE, - BC_SOURCE_TYPE_ANGLE, - BC_SOURCE_TYPE_TIMEFRAME, + BC_SOURCE_TYPE_VALUE, + BC_SOURCE_TYPE_ANGLE, + BC_SOURCE_TYPE_TIMEFRAME, } BC_animation_source_type; -class AnimationExporter: COLLADASW::LibraryAnimations -{ -private: - BlenderContext &blender_context; - COLLADASW::StreamWriter *sw; - const ExportSettings *export_settings; +class AnimationExporter : COLLADASW::LibraryAnimations { + private: + BlenderContext &blender_context; + COLLADASW::StreamWriter *sw; + const ExportSettings *export_settings; -public: + public: + AnimationExporter(BlenderContext &blender_context, + COLLADASW::StreamWriter *sw, + const ExportSettings *export_settings) + : COLLADASW::LibraryAnimations(sw), + blender_context(blender_context), + sw(sw), + export_settings(export_settings) + { + } - AnimationExporter(BlenderContext &blender_context, COLLADASW::StreamWriter *sw, const ExportSettings *export_settings): - COLLADASW::LibraryAnimations(sw), - blender_context(blender_context), - sw(sw), - export_settings(export_settings) - {} + bool exportAnimations(); - bool exportAnimations(); + // called for each exported object + void operator()(Object *ob); - // called for each exported object - void operator() (Object *ob); + protected: + void export_object_constraint_animation(Object *ob); -protected: + void export_morph_animation(Object *ob); - void export_object_constraint_animation(Object *ob); + void write_bone_animation_matrix(Object *ob_arm, Bone *bone); - void export_morph_animation(Object *ob); + void write_bone_animation(Object *ob_arm, Bone *bone); - void write_bone_animation_matrix(Object *ob_arm, Bone *bone); + void sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type); - void write_bone_animation(Object *ob_arm, Bone *bone); + void sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone); - void sample_and_write_bone_animation(Object *ob_arm, Bone *bone, int transform_type); + void sample_animation(float *v, + std::vector<float> &frames, + int type, + Bone *bone, + Object *ob_arm, + bPoseChannel *pChan); - void sample_and_write_bone_animation_matrix(Object *ob_arm, Bone *bone); + void sample_animation(std::vector<float[4][4]> &mats, + std::vector<float> &frames, + Bone *bone, + Object *ob_arm, + bPoseChannel *pChan); - void sample_animation(float *v, std::vector<float> &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pChan); + // dae_bone_animation -> add_bone_animation + // (blend this into dae_bone_animation) + void dae_bone_animation(std::vector<float> &fra, + float *v, + int tm_type, + int axis, + std::string ob_name, + std::string bone_name); - void sample_animation(std::vector<float[4][4]> &mats, std::vector<float> &frames, Bone *bone, Object *ob_arm, bPoseChannel *pChan); + void dae_baked_animation(std::vector<float> &fra, Object *ob_arm, Bone *bone); - // dae_bone_animation -> add_bone_animation - // (blend this into dae_bone_animation) - void dae_bone_animation(std::vector<float> &fra, float *v, int tm_type, int axis, std::string ob_name, std::string bone_name); + void dae_baked_object_animation(std::vector<float> &fra, Object *ob); - void dae_baked_animation(std::vector<float> &fra, Object *ob_arm, Bone *bone); + float convert_time(float frame); - void dae_baked_object_animation(std::vector<float> &fra, Object *ob); + float convert_angle(float angle); - float convert_time(float frame); + std::vector<std::vector<std::string>> anim_meta; - float convert_angle(float angle); + /* Main entry point into Animation export (called for each exported object) */ + void exportAnimation(Object *ob, BCAnimationSampler &sampler); - std::vector<std::vector<std::string>> anim_meta; + /* export animation as separate trans/rot/scale curves */ + void export_curve_animation_set(Object *ob, BCAnimationSampler &sampler, bool export_tm_curves); - /* Main entry point into Animation export (called for each exported object) */ - void exportAnimation(Object *ob, BCAnimationSampler &sampler); + /* export one single curve */ + void export_curve_animation(Object *ob, BCAnimationCurve &curve); - /* export animation as separate trans/rot/scale curves */ - void export_curve_animation_set( - Object *ob, - BCAnimationSampler &sampler, - bool export_tm_curves); + /* export animation as matrix data */ + void export_matrix_animation(Object *ob, BCAnimationSampler &sampler); - /* export one single curve */ - void export_curve_animation( - Object *ob, - BCAnimationCurve &curve); + /* step through the bone hierarchy */ + void export_bone_animations_recursive(Object *ob_arm, Bone *bone, BCAnimationSampler &sampler); - /* export animation as matrix data */ - void export_matrix_animation( - Object *ob, - BCAnimationSampler &sampler); + /* Export for one bone */ + void export_bone_animation(Object *ob, Bone *bone, BCFrames &frames, BCMatrixSampleMap &outmats); - /* step through the bone hierarchy */ - void export_bone_animations_recursive( - Object *ob_arm, - Bone *bone, - BCAnimationSampler &sampler); + /* call to the low level collada exporter */ + void export_collada_curve_animation(std::string id, + std::string name, + std::string target, + std::string axis, + BCAnimationCurve &curve); - /* Export for one bone */ - void export_bone_animation( - Object *ob, - Bone *bone, - BCFrames &frames, - BCMatrixSampleMap &outmats); + /* call to the low level collada exporter */ + void export_collada_matrix_animation(std::string id, + std::string name, + std::string target, + BCFrames &frames, + BCMatrixSampleMap &outmats); - /* call to the low level collada exporter */ - void export_collada_curve_animation( - std::string id, - std::string name, - std::string target, - std::string axis, - BCAnimationCurve &curve); + BCAnimationCurve *get_modified_export_curve(Object *ob, + BCAnimationCurve &curve, + BCAnimationCurveMap &curves); - /* call to the low level collada exporter */ - void export_collada_matrix_animation( - std::string id, - std::string name, - std::string target, - BCFrames &frames, - BCMatrixSampleMap &outmats); + /* Helper functions */ + void openAnimationWithClip(std::string id, std::string name); + bool open_animation_container(bool has_container, Object *ob); + void close_animation_container(bool has_container); - BCAnimationCurve *get_modified_export_curve(Object *ob, BCAnimationCurve &curve, BCAnimationCurveMap &curves); + /* Input and Output sources (single valued) */ + std::string collada_source_from_values(BC_animation_source_type tm_channel, + COLLADASW::InputSemantic::Semantics semantic, + std::vector<float> &values, + const std::string &anim_id, + const std::string axis_name); - /* Helper functions */ - void openAnimationWithClip(std::string id, std::string name); - bool open_animation_container(bool has_container, Object *ob); - void close_animation_container(bool has_container); + /* Output sources (matrix data) */ + std::string collada_source_from_values(BCMatrixSampleMap &samples, const std::string &anim_id); - /* Input and Output sources (single valued) */ - std::string collada_source_from_values( - BC_animation_source_type tm_channel, - COLLADASW::InputSemantic::Semantics semantic, - std::vector<float> &values, - const std::string& anim_id, - const std::string axis_name); + /* Interpolation sources */ + std::string collada_linear_interpolation_source(int tot, const std::string &anim_id); - /* Output sources (matrix data) */ - std::string collada_source_from_values( - BCMatrixSampleMap &samples, - const std::string& anim_id); + /* source ID = animation_name + semantic_suffix */ - /* Interpolation sources */ - std::string collada_linear_interpolation_source( - int tot, - const std::string& anim_id); + std::string get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic); - /* source ID = animation_name + semantic_suffix */ + void add_source_parameters(COLLADASW::SourceBase::ParameterNameList ¶m, + COLLADASW::InputSemantic::Semantics semantic, + bool is_rot, + const std::string axis, + bool transform); - std::string get_semantic_suffix(COLLADASW::InputSemantic::Semantics semantic); + int get_point_in_curve(BCBezTriple &bezt, + COLLADASW::InputSemantic::Semantics semantic, + bool is_angle, + float *values); + int get_point_in_curve(const BCAnimationCurve &curve, + float sample_frame, + COLLADASW::InputSemantic::Semantics semantic, + bool is_angle, + float *values); - void add_source_parameters( - COLLADASW::SourceBase::ParameterNameList& param, - COLLADASW::InputSemantic::Semantics semantic, - bool is_rot, - const std::string axis, - bool transform); + std::string collada_tangent_from_curve(COLLADASW::InputSemantic::Semantics semantic, + BCAnimationCurve &curve, + const std::string &anim_id, + const std::string axis_name); - int get_point_in_curve(BCBezTriple &bezt, COLLADASW::InputSemantic::Semantics semantic, bool is_angle, float *values); - int get_point_in_curve(const BCAnimationCurve &curve, float sample_frame, COLLADASW::InputSemantic::Semantics semantic, bool is_angle, float *values); - - std::string collada_tangent_from_curve( - COLLADASW::InputSemantic::Semantics semantic, - BCAnimationCurve &curve, - const std::string& anim_id, - const std::string axis_name); - - std::string collada_interpolation_source(const BCAnimationCurve &curve, const std::string& anim_id, std::string axis_name, bool *has_tangents); - - std::string get_axis_name(std::string channel, int id); - const std::string get_collada_name(std::string channel_target) const; - std::string get_collada_sid(const BCAnimationCurve &curve, const std::string axis_name); - - /* ===================================== */ - /* Currently unused or not (yet?) needed */ - /* ===================================== */ - - bool is_bone_deform_group(Bone * bone); + std::string collada_interpolation_source(const BCAnimationCurve &curve, + const std::string &anim_id, + std::string axis_name, + bool *has_tangents); + + std::string get_axis_name(std::string channel, int id); + const std::string get_collada_name(std::string channel_target) const; + std::string get_collada_sid(const BCAnimationCurve &curve, const std::string axis_name); + + /* ===================================== */ + /* Currently unused or not (yet?) needed */ + /* ===================================== */ + + bool is_bone_deform_group(Bone *bone); #if 0 - BC_animation_transform_type _get_transform_type(const std::string path); - void get_eul_source_for_quat(std::vector<float> &cache, Object *ob); + BC_animation_transform_type _get_transform_type(const std::string path); + void get_eul_source_for_quat(std::vector<float> &cache, Object *ob); #endif #ifdef WITH_MORPH_ANIMATION - void export_morph_animation( - Object *ob, - BCAnimationSampler &sampler); + void export_morph_animation(Object *ob, BCAnimationSampler &sampler); #endif - }; #endif |