From e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 17 Apr 2019 06:17:24 +0200 Subject: 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 --- source/blender/collada/AnimationImporter.h | 334 ++++++++++++++++------------- 1 file changed, 180 insertions(+), 154 deletions(-) (limited to 'source/blender/collada/AnimationImporter.h') diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index dfb3f5cfe33..65e9974aec1 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -51,173 +51,199 @@ extern "C" { class ArmatureImporter; -class AnimationImporterBase -{ -public: - // virtual void change_eul_to_quat(Object *ob, bAction *act) = 0; +class AnimationImporterBase { + public: + // virtual void change_eul_to_quat(Object *ob, bAction *act) = 0; }; -class AnimationImporter : private TransformReader, public AnimationImporterBase -{ -private: - bContext *mContext; - ArmatureImporter *armature_importer; - Scene *scene; - - std::map > curve_map; - std::map uid_animated_map; - // std::map > fcurves_actionGroup_map; - std::map animlist_map; - std::vector unused_curves; - std::map joint_objects; - - FCurve *create_fcurve(int array_index, const char *rna_path); - - void add_bezt(FCurve *fcu, float frame, float value, eBezTriple_Interpolation ipo=BEZT_IPO_LIN); - - // create one or several fcurves depending on the number of parameters being animated - void animation_to_fcurves(COLLADAFW::AnimationCurve *curve); - - void fcurve_deg_to_rad(FCurve *cu); - - void fcurve_is_used(FCurve *fcu); - - void add_fcurves_to_object(Main *bmain, Object *ob, std::vector& curves, char *rna_path, int array_index, Animation *animated); - - - int typeFlag; - - std::string import_from_version; - - enum lightAnim - { -// INANIMATE = 0, - LIGHT_COLOR = 2, - LIGHT_FOA = 4, - LIGHT_FOE = 8, - }; - - enum cameraAnim - { -// INANIMATE = 0, - CAMERA_XFOV = 2, - CAMERA_XMAG = 4, - CAMERA_YFOV = 8, - CAMERA_YMAG = 16, - CAMERA_ZFAR = 32, - CAMERA_ZNEAR = 64, - }; - - enum matAnim - { - MATERIAL_SHININESS = 2, - MATERIAL_SPEC_COLOR = 4, - MATERIAL_DIFF_COLOR = 1 << 3, - MATERIAL_TRANSPARENCY = 1 << 4, - MATERIAL_IOR = 1 << 5, - }; - - enum AnimationType - { - BC_INANIMATE = 0, - BC_NODE_TRANSFORM = 1, - }; - - struct AnimMix - { - int transform; - int light; - int camera; - int material; - int texture; - }; -public: - - AnimationImporter(bContext *C, UnitConverter *conv, ArmatureImporter *arm, Scene *scene) : - TransformReader(conv), - mContext(C), - armature_importer(arm), - scene(scene) {} - - ~AnimationImporter(); - - void set_import_from_version(std::string import_from_version); - bool write_animation(const COLLADAFW::Animation* anim); - - // called on post-process stage after writeVisualScenes - bool write_animation_list(const COLLADAFW::AnimationList* animlist); - - void read_node_transform(COLLADAFW::Node *node, Object *ob); +class AnimationImporter : private TransformReader, public AnimationImporterBase { + private: + bContext *mContext; + ArmatureImporter *armature_importer; + Scene *scene; + + std::map> curve_map; + std::map uid_animated_map; + // std::map > fcurves_actionGroup_map; + std::map animlist_map; + std::vector unused_curves; + std::map joint_objects; + + FCurve *create_fcurve(int array_index, const char *rna_path); + + void add_bezt(FCurve *fcu, + float frame, + float value, + eBezTriple_Interpolation ipo = BEZT_IPO_LIN); + + // create one or several fcurves depending on the number of parameters being animated + void animation_to_fcurves(COLLADAFW::AnimationCurve *curve); + + void fcurve_deg_to_rad(FCurve *cu); + + void fcurve_is_used(FCurve *fcu); + + void add_fcurves_to_object(Main *bmain, + Object *ob, + std::vector &curves, + char *rna_path, + int array_index, + Animation *animated); + + int typeFlag; + + std::string import_from_version; + + enum lightAnim { + // INANIMATE = 0, + LIGHT_COLOR = 2, + LIGHT_FOA = 4, + LIGHT_FOE = 8, + }; + + enum cameraAnim { + // INANIMATE = 0, + CAMERA_XFOV = 2, + CAMERA_XMAG = 4, + CAMERA_YFOV = 8, + CAMERA_YMAG = 16, + CAMERA_ZFAR = 32, + CAMERA_ZNEAR = 64, + }; + + enum matAnim { + MATERIAL_SHININESS = 2, + MATERIAL_SPEC_COLOR = 4, + MATERIAL_DIFF_COLOR = 1 << 3, + MATERIAL_TRANSPARENCY = 1 << 4, + MATERIAL_IOR = 1 << 5, + }; + + enum AnimationType { + BC_INANIMATE = 0, + BC_NODE_TRANSFORM = 1, + }; + + struct AnimMix { + int transform; + int light; + int camera; + int material; + int texture; + }; + + public: + AnimationImporter(bContext *C, UnitConverter *conv, ArmatureImporter *arm, Scene *scene) + : TransformReader(conv), mContext(C), armature_importer(arm), scene(scene) + { + } + + ~AnimationImporter(); + + void set_import_from_version(std::string import_from_version); + bool write_animation(const COLLADAFW::Animation *anim); + + // called on post-process stage after writeVisualScenes + bool write_animation_list(const COLLADAFW::AnimationList *animlist); + + void read_node_transform(COLLADAFW::Node *node, Object *ob); #if 0 - virtual void change_eul_to_quat(Object *ob, bAction *act); + virtual void change_eul_to_quat(Object *ob, bAction *act); #endif - void translate_Animations(COLLADAFW::Node * Node, - std::map& root_map, - std::multimap& object_map, - std::map FW_object_map, - std::map uid_material_map); - - AnimMix* get_animation_type( const COLLADAFW::Node * node, std::map FW_object_map ); - - void apply_matrix_curves(Object *ob, std::vector& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node, - COLLADAFW::Transformation * tm ); - - void add_bone_animation_sampled(Object *ob, std::vector& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node, COLLADAFW::Transformation * tm); - - void Assign_transform_animations(COLLADAFW::Transformation* transform, - const COLLADAFW::AnimationList::AnimationBinding *binding, - std::vector* curves, bool is_joint, char *joint_path); - - void Assign_color_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char * anim_type); - void Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char * anim_type); - void Assign_lens_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const double aspect, Camera *cam, const char *anim_type, int fov_type); - - int setAnimType ( const COLLADAFW::Animatable * prop, int type, int addition); - - void modify_fcurve(std::vector* curves, const char *rna_path, int array_index ); - void unused_fcurve(std::vector* curves ); - // prerequisites: - // animlist_map - map animlist id -> animlist - // curve_map - map anim id -> curve(s) - Object *translate_animation_OLD( - COLLADAFW::Node *node, - std::map& object_map, - std::map& root_map, - COLLADAFW::Transformation::TransformationType tm_type, - Object *par_job = NULL); - - void find_frames( std::vector* frames, std::vector* curves ); - void find_frames_old( std::vector* frames, COLLADAFW::Node * node, COLLADAFW::Transformation::TransformationType tm_type ); - // internal, better make it private - // warning: evaluates only rotation - // prerequisites: animlist_map, curve_map - void evaluate_transform_at_frame(float mat[4][4], COLLADAFW::Node *node, float fra); - - // return true to indicate that mat contains a sane value - bool evaluate_animation(COLLADAFW::Transformation *tm, float mat[4][4], float fra, const char *node_id); - - // gives a world-space mat of joint at rest position - void get_joint_rest_mat(float mat[4][4], COLLADAFW::Node *root, COLLADAFW::Node *node); - - // gives a world-space mat, end's mat not included - bool calc_joint_parent_mat_rest(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end); - - float convert_to_focal_length(float in_xfov, int fov_type, float aspect, float sensorx); + void translate_Animations(COLLADAFW::Node *Node, + std::map &root_map, + std::multimap &object_map, + std::map FW_object_map, + std::map uid_material_map); + + AnimMix *get_animation_type( + const COLLADAFW::Node *node, + std::map FW_object_map); + + void apply_matrix_curves(Object *ob, + std::vector &animcurves, + COLLADAFW::Node *root, + COLLADAFW::Node *node, + COLLADAFW::Transformation *tm); + + void add_bone_animation_sampled(Object *ob, + std::vector &animcurves, + COLLADAFW::Node *root, + COLLADAFW::Node *node, + COLLADAFW::Transformation *tm); + + void Assign_transform_animations(COLLADAFW::Transformation *transform, + const COLLADAFW::AnimationList::AnimationBinding *binding, + std::vector *curves, + bool is_joint, + char *joint_path); + + void Assign_color_animations(const COLLADAFW::UniqueId &listid, + ListBase *AnimCurves, + const char *anim_type); + void Assign_float_animations(const COLLADAFW::UniqueId &listid, + ListBase *AnimCurves, + const char *anim_type); + void Assign_lens_animations(const COLLADAFW::UniqueId &listid, + ListBase *AnimCurves, + const double aspect, + Camera *cam, + const char *anim_type, + int fov_type); + + int setAnimType(const COLLADAFW::Animatable *prop, int type, int addition); + + void modify_fcurve(std::vector *curves, const char *rna_path, int array_index); + void unused_fcurve(std::vector *curves); + // prerequisites: + // animlist_map - map animlist id -> animlist + // curve_map - map anim id -> curve(s) + Object *translate_animation_OLD(COLLADAFW::Node *node, + std::map &object_map, + std::map &root_map, + COLLADAFW::Transformation::TransformationType tm_type, + Object *par_job = NULL); + + void find_frames(std::vector *frames, std::vector *curves); + void find_frames_old(std::vector *frames, + COLLADAFW::Node *node, + COLLADAFW::Transformation::TransformationType tm_type); + // internal, better make it private + // warning: evaluates only rotation + // prerequisites: animlist_map, curve_map + void evaluate_transform_at_frame(float mat[4][4], COLLADAFW::Node *node, float fra); + + // return true to indicate that mat contains a sane value + bool evaluate_animation(COLLADAFW::Transformation *tm, + float mat[4][4], + float fra, + const char *node_id); + + // gives a world-space mat of joint at rest position + void get_joint_rest_mat(float mat[4][4], COLLADAFW::Node *root, COLLADAFW::Node *node); + + // gives a world-space mat, end's mat not included + bool calc_joint_parent_mat_rest(float mat[4][4], + float par[4][4], + COLLADAFW::Node *node, + COLLADAFW::Node *end); + + float convert_to_focal_length(float in_xfov, int fov_type, float aspect, float sensorx); #ifdef ARMATURE_TEST - Object *get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job); + Object *get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job); #endif #if 0 - // recursively evaluates joint tree until end is found, mat then is world-space matrix of end - // mat must be identity on enter, node must be root - bool evaluate_joint_world_transform_at_frame(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end, float fra); + // recursively evaluates joint tree until end is found, mat then is world-space matrix of end + // mat must be identity on enter, node must be root + bool evaluate_joint_world_transform_at_frame(float mat[4][4], float par[4][4], COLLADAFW::Node *node, COLLADAFW::Node *end, float fra); #endif - void add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurve *fcu); + void add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurve *fcu); - void extra_data_importer(std::string elementName); + void extra_data_importer(std::string elementName); }; #endif -- cgit v1.2.3