Blender  V3.3
Classes | Public Member Functions | List of all members
AnimationImporter Class Reference

#include <AnimationImporter.h>

Inheritance diagram for AnimationImporter:
TransformReader AnimationImporterBase

Public Member Functions

 AnimationImporter (bContext *C, UnitConverter *conv, ArmatureImporter *arm, Scene *scene)
 
 ~AnimationImporter ()
 
void set_import_from_version (std::string import_from_version)
 
bool write_animation (const COLLADAFW::Animation *anim)
 
bool write_animation_list (const COLLADAFW::AnimationList *animlist)
 
void read_node_transform (COLLADAFW::Node *node, Object *ob)
 
void translate_Animations (COLLADAFW::Node *Node, std::map< COLLADAFW::UniqueId, COLLADAFW::Node * > &root_map, std::multimap< COLLADAFW::UniqueId, Object * > &object_map, std::map< COLLADAFW::UniqueId, const COLLADAFW::Object * > FW_object_map, std::map< COLLADAFW::UniqueId, Material * > uid_material_map)
 
AnimMix * get_animation_type (const COLLADAFW::Node *node, std::map< COLLADAFW::UniqueId, const COLLADAFW::Object * > FW_object_map)
 
void apply_matrix_curves (Object *ob, std::vector< FCurve * > &animcurves, COLLADAFW::Node *root, COLLADAFW::Node *node, COLLADAFW::Transformation *tm)
 
void add_bone_animation_sampled (Object *ob, std::vector< FCurve * > &animcurves, COLLADAFW::Node *root, COLLADAFW::Node *node, COLLADAFW::Transformation *tm)
 
void Assign_transform_animations (COLLADAFW::Transformation *transform, const COLLADAFW::AnimationList::AnimationBinding *binding, std::vector< FCurve * > *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, 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< FCurve * > *curves, const char *rna_path, int array_index, int scale=1)
 
void unused_fcurve (std::vector< FCurve * > *curves)
 
Objecttranslate_animation_OLD (COLLADAFW::Node *node, std::map< COLLADAFW::UniqueId, Object * > &object_map, std::map< COLLADAFW::UniqueId, COLLADAFW::Node * > &root_map, COLLADAFW::Transformation::TransformationType tm_type, Object *par_job=NULL)
 
void find_frames (std::vector< float > *frames, std::vector< FCurve * > *curves)
 
void find_frames_old (std::vector< float > *frames, COLLADAFW::Node *node, COLLADAFW::Transformation::TransformationType tm_type)
 
void evaluate_transform_at_frame (float mat[4][4], COLLADAFW::Node *node, float fra)
 
bool evaluate_animation (COLLADAFW::Transformation *tm, float mat[4][4], float fra, const char *node_id)
 
void get_joint_rest_mat (float mat[4][4], COLLADAFW::Node *root, COLLADAFW::Node *node)
 
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 add_bone_fcurve (Object *ob, COLLADAFW::Node *node, FCurve *fcu)
 
void extra_data_importer (std::string elementName)
 

Detailed Description

Definition at line 44 of file AnimationImporter.h.

Constructor & Destructor Documentation

◆ AnimationImporter()

AnimationImporter::AnimationImporter ( bContext C,
UnitConverter conv,
ArmatureImporter arm,
Scene scene 
)
inline

Definition at line 124 of file AnimationImporter.h.

References scene.

◆ ~AnimationImporter()

AnimationImporter::~AnimationImporter ( )

Definition at line 257 of file AnimationImporter.cpp.

References BKE_fcurve_free().

Member Function Documentation

◆ add_bone_animation_sampled()

void AnimationImporter::add_bone_animation_sampled ( Object ob,
std::vector< FCurve * > &  animcurves,
COLLADAFW::Node *  root,
COLLADAFW::Node *  node,
COLLADAFW::Transformation *  tm 
)

◆ add_bone_fcurve()

void AnimationImporter::add_bone_fcurve ( Object ob,
COLLADAFW::Node *  node,
FCurve fcu 
)

◆ apply_matrix_curves()

void AnimationImporter::apply_matrix_curves ( Object ob,
std::vector< FCurve * > &  animcurves,
COLLADAFW::Node *  root,
COLLADAFW::Node *  node,
COLLADAFW::Transformation *  tm 
)

◆ Assign_color_animations()

void AnimationImporter::Assign_color_animations ( const COLLADAFW::UniqueId &  listid,
ListBase AnimCurves,
const char *  anim_type 
)

Creates the rna_paths and array indices of fcurves from animations using color and bound animation class of each animation.

Definition at line 633 of file AnimationImporter.cpp.

References BLI_addtail(), BLI_strncpy(), modify_fcurve(), and unused_fcurve().

Referenced by translate_Animations().

◆ Assign_float_animations()

void AnimationImporter::Assign_float_animations ( const COLLADAFW::UniqueId &  listid,
ListBase AnimCurves,
const char *  anim_type 
)

XXX What About animation-type "rotation" ?

Definition at line 688 of file AnimationImporter.cpp.

References BLI_addtail(), BLI_strcasecmp_natural(), BLI_strncpy(), modify_fcurve(), and STREQ.

Referenced by translate_Animations().

◆ Assign_lens_animations()

void AnimationImporter::Assign_lens_animations ( const COLLADAFW::UniqueId &  listid,
ListBase AnimCurves,
double  aspect,
Camera cam,
const char *  anim_type,
int  fov_type 
)

Lens animations must be stored in COLLADA by using FOV, while blender internally uses focal length. The imported animation curves must be converted appropriately.

Definition at line 742 of file AnimationImporter.cpp.

References FCurve::bezt, BLI_addtail(), BLI_strncpy(), convert_to_focal_length(), modify_fcurve(), Camera::sensor_x, FCurve::totvert, and BezTriple::vec.

Referenced by translate_Animations().

◆ Assign_transform_animations()

void AnimationImporter::Assign_transform_animations ( COLLADAFW::Transformation *  transform,
const COLLADAFW::AnimationList::AnimationBinding *  binding,
std::vector< FCurve * > *  curves,
bool  is_joint,
char *  joint_path 
)

Creates the rna_paths and array indices of fcurves from animations using transformation and bound animation class of each animation.

Definition at line 516 of file AnimationImporter.cpp.

References BLI_snprintf(), BLI_strncpy(), curves, get_animation_axis_index(), mat4, modify_fcurve(), rot, transform(), and unused_fcurve().

Referenced by translate_Animations().

◆ calc_joint_parent_mat_rest()

bool AnimationImporter::calc_joint_parent_mat_rest ( float  mat[4][4],
float  par[4][4],
COLLADAFW::Node *  node,
COLLADAFW::Node *  end 
)

◆ convert_to_focal_length()

float AnimationImporter::convert_to_focal_length ( float  in_xfov,
int  fov_type,
float  aspect,
float  sensorx 
)

Definition at line 730 of file AnimationImporter.cpp.

References atanf, DEG2RADF, fov_to_focallength(), and tanf.

Referenced by Assign_lens_animations().

◆ evaluate_animation()

bool AnimationImporter::evaluate_animation ( COLLADAFW::Transformation *  tm,
float  mat[4][4],
float  fra,
const char *  node_id 
)

◆ evaluate_transform_at_frame()

void AnimationImporter::evaluate_transform_at_frame ( float  mat[4][4],
COLLADAFW::Node *  node,
float  fra 
)

Internal, better make it private WARNING: evaluates only rotation and only assigns matrix transforms now prerequisites: animlist_map, curve_map.

Definition at line 1820 of file AnimationImporter.cpp.

References copy_m4_m4(), TransformReader::dae_matrix_to_mat4(), TransformReader::dae_rotate_to_mat4(), TransformReader::dae_scale_to_mat4(), TransformReader::dae_translate_to_mat4(), evaluate_animation(), mul_m4_m4m4(), node, type, and unit_m4().

Referenced by add_bone_animation_sampled(), apply_matrix_curves(), and translate_animation_OLD().

◆ extra_data_importer()

void AnimationImporter::extra_data_importer ( std::string  elementName)

◆ find_frames()

void AnimationImporter::find_frames ( std::vector< float > *  frames,
std::vector< FCurve * > *  curves 
)

◆ find_frames_old()

void AnimationImporter::find_frames_old ( std::vector< float > *  frames,
COLLADAFW::Node *  node,
COLLADAFW::Transformation::TransformationType  tm_type 
)

Is not used anymore.

Definition at line 1484 of file AnimationImporter.cpp.

References FCurve::bezt, curves, node, FCurve::totvert, transform(), and BezTriple::vec.

Referenced by translate_animation_OLD().

◆ get_animation_type()

AnimationImporter::AnimMix * AnimationImporter::get_animation_type ( const COLLADAFW::Node *  node,
std::map< COLLADAFW::UniqueId, const COLLADAFW::Object * >  FW_object_map 
)

Check if object is animated by checking if animlist_map holds the animlist_id of node transforms.

Definition at line 1375 of file AnimationImporter.cpp.

References camera, node, setAnimType(), transform(), and types.

Referenced by translate_Animations().

◆ get_joint_rest_mat()

void AnimationImporter::get_joint_rest_mat ( float  mat[4][4],
COLLADAFW::Node *  root,
COLLADAFW::Node *  node 
)

◆ modify_fcurve()

void AnimationImporter::modify_fcurve ( std::vector< FCurve * > *  curves,
const char *  rna_path,
int  array_index,
int  scale = 1 
)

Sets the rna_path and array index to curve.

Definition at line 445 of file AnimationImporter.cpp.

References FCurve::array_index, BLI_strdup(), curves, and FCurve::rna_path.

Referenced by Assign_color_animations(), Assign_float_animations(), Assign_lens_animations(), and Assign_transform_animations().

◆ read_node_transform()

void AnimationImporter::read_node_transform ( COLLADAFW::Node *  node,
Object ob 
)
Todo:
refactor read_node_transform to not automatically apply anything, but rather return the transform matrix, so caller can do with it what is necessary. Same for get_node_mat

Definition at line 330 of file AnimationImporter.cpp.

References BKE_object_apply_mat4(), copy_m4_m4(), TransformReader::get_node_mat(), node, and Object::obmat.

Referenced by DocumentImporter::create_instance_node(), and DocumentImporter::write_node().

◆ set_import_from_version()

void AnimationImporter::set_import_from_version ( std::string  import_from_version)

Definition at line 2184 of file AnimationImporter.cpp.

Referenced by DocumentImporter::writeGlobalAsset().

◆ setAnimType()

int AnimationImporter::setAnimType ( const COLLADAFW::Animatable *  prop,
int  type,
int  addition 
)

Definition at line 1470 of file AnimationImporter.cpp.

References types.

Referenced by get_animation_type().

◆ translate_animation_OLD()

Object * AnimationImporter::translate_animation_OLD ( COLLADAFW::Node *  node,
std::map< COLLADAFW::UniqueId, Object * > &  object_map,
std::map< COLLADAFW::UniqueId, COLLADAFW::Node * > &  root_map,
COLLADAFW::Transformation::TransformationType  tm_type,
Object par_job = NULL 
)

◆ translate_Animations()

void AnimationImporter::translate_Animations ( COLLADAFW::Node *  Node,
std::map< COLLADAFW::UniqueId, COLLADAFW::Node * > &  root_map,
std::multimap< COLLADAFW::UniqueId, Object * > &  object_map,
std::map< COLLADAFW::UniqueId, const COLLADAFW::Object * >  FW_object_map,
std::map< COLLADAFW::UniqueId, Material * >  uid_material_map 
)

◆ unused_fcurve()

void AnimationImporter::unused_fcurve ( std::vector< FCurve * > *  curves)

Definition at line 471 of file AnimationImporter.cpp.

References curves.

Referenced by Assign_color_animations(), and Assign_transform_animations().

◆ write_animation()

bool AnimationImporter::write_animation ( const COLLADAFW::Animation *  anim)

Definition at line 269 of file AnimationImporter.cpp.

References curve, interp(), and INTERPOLATION_LINEAR.

Referenced by DocumentImporter::writeAnimation().

◆ write_animation_list()

bool AnimationImporter::write_animation_list ( const COLLADAFW::AnimationList *  animlist)

Called on post-process stage after writeVisualScenes.

Definition at line 311 of file AnimationImporter.cpp.

Referenced by DocumentImporter::writeAnimationList().


The documentation for this class was generated from the following files: