Blender  V3.3
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AnimationExporter Class Reference

#include <AnimationExporter.h>

Inheritance diagram for AnimationExporter:

Public Member Functions

 AnimationExporter (COLLADASW::StreamWriter *sw, BCExportSettings &export_settings)
 
bool exportAnimations ()
 
void operator() (Object *ob)
 

Protected Member Functions

void export_object_constraint_animation (Object *ob)
 
void export_morph_animation (Object *ob)
 
void write_bone_animation_matrix (Object *ob_arm, Bone *bone)
 
void write_bone_animation (Object *ob_arm, Bone *bone)
 
void sample_and_write_bone_animation (Object *ob_arm, Bone *bone, int transform_type)
 
void sample_and_write_bone_animation_matrix (Object *ob_arm, Bone *bone)
 
void sample_animation (float *v, std::vector< float > &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pChan)
 
void sample_animation (std::vector< float[4][4]> &mats, std::vector< float > &frames, Bone *bone, Object *ob_arm, bPoseChannel *pChan)
 
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_animation (std::vector< float > &fra, Object *ob_arm, Bone *bone)
 
void dae_baked_object_animation (std::vector< float > &fra, Object *ob)
 
float convert_time (float frame)
 
float convert_angle (float angle)
 
void exportAnimation (Object *ob, BCAnimationSampler &sampler)
 
void export_curve_animation_set (Object *ob, BCAnimationSampler &sampler, bool export_as_matrix)
 
void export_curve_animation (Object *ob, BCAnimationCurve &curve)
 
void export_matrix_animation (Object *ob, BCAnimationSampler &sampler)
 
void export_bone_animations_recursive (Object *ob_arm, Bone *bone, BCAnimationSampler &sampler)
 
void export_bone_animation (Object *ob, Bone *bone, BCFrames &frames, BCMatrixSampleMap &samples)
 
void export_collada_curve_animation (std::string id, std::string name, std::string target, std::string axis, BCAnimationCurve &curve, BC_global_rotation_type global_rotation_type)
 
void export_collada_matrix_animation (std::string id, std::string name, std::string target, BCFrames &frames, BCMatrixSampleMap &samples, BC_global_rotation_type global_rotation_type, Matrix &parentinv)
 
BCAnimationCurveget_modified_export_curve (Object *ob, BCAnimationCurve &curve, BCAnimationCurveMap &curves)
 
void openAnimationWithClip (std::string id, std::string name)
 
bool open_animation_container (bool has_container, Object *ob)
 
void close_animation_container (bool has_container)
 
std::string collada_source_from_values (BC_animation_source_type source_type, COLLADASW::InputSemantic::Semantics semantic, std::vector< float > &values, const std::string &anim_id, const std::string axis_name)
 
std::string collada_source_from_values (BCMatrixSampleMap &samples, const std::string &anim_id, BC_global_rotation_type global_rotation_type, Matrix &parentinv)
 
std::string collada_linear_interpolation_source (int tot, const std::string &anim_id)
 
std::string get_semantic_suffix (COLLADASW::InputSemantic::Semantics semantic)
 
void add_source_parameters (COLLADASW::SourceBase::ParameterNameList &param, COLLADASW::InputSemantic::Semantics semantic, bool is_rot, const std::string axis, bool transform)
 
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)
 
std::string get_collada_name (std::string channel_type) const
 
std::string get_collada_sid (const BCAnimationCurve &curve, const std::string axis_name)
 
bool is_bone_deform_group (Bone *bone)
 

Protected Attributes

std::vector< std::vector< std::string > > anim_meta
 

Detailed Description

Definition at line 74 of file AnimationExporter.h.

Constructor & Destructor Documentation

◆ AnimationExporter()

AnimationExporter::AnimationExporter ( COLLADASW::StreamWriter *  sw,
BCExportSettings &  export_settings 
)
inline

Definition at line 82 of file AnimationExporter.h.

References sw.

Member Function Documentation

◆ add_source_parameters()

void AnimationExporter::add_source_parameters ( COLLADASW::SourceBase::ParameterNameList &  param,
COLLADASW::InputSemantic::Semantics  semantic,
bool  is_rot,
const std::string  axis,
bool  transform 
)
protected

Definition at line 496 of file AnimationExporter.cpp.

References transform().

Referenced by collada_source_from_values(), and collada_tangent_from_curve().

◆ close_animation_container()

void AnimationExporter::close_animation_container ( bool  has_container)
protected

Definition at line 62 of file AnimationExporter.cpp.

Referenced by exportAnimation().

◆ collada_interpolation_source()

std::string AnimationExporter::collada_interpolation_source ( const BCAnimationCurve curve,
const std::string &  anim_id,
std::string  axis_name,
bool has_tangents 
)
protected

◆ collada_linear_interpolation_source()

std::string AnimationExporter::collada_linear_interpolation_source ( int  tot,
const std::string &  anim_id 
)
protected

Interpolation sources.

Definition at line 712 of file AnimationExporter.cpp.

References get_semantic_suffix().

Referenced by export_collada_curve_animation(), and export_collada_matrix_animation().

◆ collada_source_from_values() [1/2]

std::string AnimationExporter::collada_source_from_values ( BC_animation_source_type  source_type,
COLLADASW::InputSemantic::Semantics  semantic,
std::vector< float > &  values,
const std::string &  anim_id,
const std::string  axis_name 
)
protected

◆ collada_source_from_values() [2/2]

std::string AnimationExporter::collada_source_from_values ( BCMatrixSampleMap samples,
const std::string &  anim_id,
BC_global_rotation_type  global_rotation_type,
Matrix &  parentinv 
)
protected

Output sources (matrix data). * Create a collada matrix source for a set of samples.

Definition at line 626 of file AnimationExporter.cpp.

References add_source_parameters(), get_semantic_suffix(), and sample.

◆ collada_tangent_from_curve()

std::string AnimationExporter::collada_tangent_from_curve ( COLLADASW::InputSemantic::Semantics  semantic,
BCAnimationCurve curve,
const std::string &  anim_id,
const std::string  axis_name 
)
protected

◆ convert_angle()

float AnimationExporter::convert_angle ( float  angle)
protected

◆ convert_time()

float AnimationExporter::convert_time ( float  frame)
protected

◆ dae_baked_animation()

void AnimationExporter::dae_baked_animation ( std::vector< float > &  fra,
Object ob_arm,
Bone bone 
)
protected

◆ dae_baked_object_animation()

void AnimationExporter::dae_baked_object_animation ( std::vector< float > &  fra,
Object ob 
)
protected

◆ dae_bone_animation()

void AnimationExporter::dae_bone_animation ( std::vector< float > &  fra,
float v,
int  tm_type,
int  axis,
std::string  ob_name,
std::string  bone_name 
)
protected

◆ export_bone_animation()

void AnimationExporter::export_bone_animation ( Object ob,
Bone bone,
BCFrames frames,
BCMatrixSampleMap samples 
)
protected

◆ export_bone_animations_recursive()

void AnimationExporter::export_bone_animations_recursive ( Object ob_arm,
Bone bone,
BCAnimationSampler sampler 
)
protected

Write bone animations in transform matrix sources (step through the bone hierarchy).

Definition at line 232 of file AnimationExporter.cpp.

References Bone::childbase, export_bone_animation(), ListBase::first, and sampler().

Referenced by exportAnimation().

◆ export_collada_curve_animation()

void AnimationExporter::export_collada_curve_animation ( std::string  id,
std::string  name,
std::string  target,
std::string  axis,
BCAnimationCurve curve,
BC_global_rotation_type  global_rotation_type 
)
protected

◆ export_collada_matrix_animation()

void AnimationExporter::export_collada_matrix_animation ( std::string  id,
std::string  name,
std::string  target,
BCFrames frames,
BCMatrixSampleMap samples,
BC_global_rotation_type  global_rotation_type,
Matrix &  parentinv 
)
protected

◆ export_curve_animation()

void AnimationExporter::export_curve_animation ( Object ob,
BCAnimationCurve curve 
)
protected

◆ export_curve_animation_set()

void AnimationExporter::export_curve_animation_set ( Object ob,
BCAnimationSampler sampler,
bool  export_as_matrix 
)
protected

Export all animation FCurves of an Object.

Note
This uses the keyframes as sample points, and exports "baked keyframes" while keeping the tangent information of the FCurves intact. This works for simple cases, but breaks especially when negative scales are involved in the animation. And when parent inverse matrices are involved (when exporting object hierarchies)

Definition at line 153 of file AnimationExporter.cpp.

References curve, curves, export_curve_animation(), get_modified_export_curve(), and sampler().

Referenced by exportAnimation().

◆ export_matrix_animation()

void AnimationExporter::export_matrix_animation ( Object ob,
BCAnimationSampler sampler 
)
protected

◆ export_morph_animation()

void AnimationExporter::export_morph_animation ( Object ob)
protected

Referenced by exportAnimation().

◆ export_object_constraint_animation()

void AnimationExporter::export_object_constraint_animation ( Object ob)
protected

◆ exportAnimation()

void AnimationExporter::exportAnimation ( Object ob,
BCAnimationSampler sampler 
)
protected

◆ exportAnimations()

bool AnimationExporter::exportAnimations ( )

◆ get_axis_name()

std::string AnimationExporter::get_axis_name ( std::string  channel,
int  id 
)
protected

Definition at line 16 of file AnimationExporter.cpp.

References id.

Referenced by export_curve_animation().

◆ get_collada_name()

std::string AnimationExporter::get_collada_name ( std::string  channel_type) const
protected

Definition at line 737 of file AnimationExporter.cpp.

Referenced by get_collada_sid().

◆ get_collada_sid()

std::string AnimationExporter::get_collada_sid ( const BCAnimationCurve curve,
const std::string  axis_name 
)
protected

Assign sid of the animated parameter or transform for rotation, axis name is always appended and the value of append_axis is ignored.

Definition at line 789 of file AnimationExporter.cpp.

References curve, and get_collada_name().

Referenced by export_curve_animation().

◆ get_modified_export_curve()

BCAnimationCurve * AnimationExporter::get_modified_export_curve ( Object ob,
BCAnimationCurve curve,
BCAnimationCurveMap curves 
)
protected

In some special cases the exported Curve needs to be replaced by a modified curve (for collada purposes) This method checks if a conversion is necessary and if applicable returns a pointer to the modified BCAnimationCurve. IMPORTANT: the modified curve must be deleted by the caller when no longer needed if no conversion is needed this method returns a NULL;

Definition at line 254 of file AnimationExporter.cpp.

References BCAnimationCurve::add_value(), BC_ANIMATION_TYPE_CAMERA, BCAnimationCurve::clean_handles(), curve, curves, Object::data, focallength_to_fov(), BCAnimationCurve::get_value(), and RAD2DEGF.

Referenced by export_curve_animation_set().

◆ get_point_in_curve() [1/2]

int AnimationExporter::get_point_in_curve ( BCBezTriple bezt,
COLLADASW::InputSemantic::Semantics  semantic,
bool  is_angle,
float values 
)
protected

◆ get_point_in_curve() [2/2]

int AnimationExporter::get_point_in_curve ( const BCAnimationCurve curve,
float  sample_frame,
COLLADASW::InputSemantic::Semantics  semantic,
bool  is_angle,
float values 
)
protected

◆ get_semantic_suffix()

std::string AnimationExporter::get_semantic_suffix ( COLLADASW::InputSemantic::Semantics  semantic)
protected

◆ is_bone_deform_group()

bool AnimationExporter::is_bone_deform_group ( Bone bone)
protected

Definition at line 356 of file AnimationExporter.cpp.

References BONE_NO_DEFORM, Bone::childbase, ListBase::first, and Bone::flag.

◆ open_animation_container()

bool AnimationExporter::open_animation_container ( bool  has_container,
Object ob 
)
protected

Definition at line 42 of file AnimationExporter.cpp.

References encode_xml(), id_name(), and translate_id().

Referenced by exportAnimation().

◆ openAnimationWithClip()

void AnimationExporter::openAnimationWithClip ( std::string  id,
std::string  name 
)
protected

Definition at line 52 of file AnimationExporter.cpp.

References anim_meta, and translate_id().

Referenced by export_collada_matrix_animation().

◆ operator()()

void AnimationExporter::operator() ( Object ob)

Called for each exported object.

◆ sample_and_write_bone_animation()

void AnimationExporter::sample_and_write_bone_animation ( Object ob_arm,
Bone bone,
int  transform_type 
)
protected

◆ sample_and_write_bone_animation_matrix()

void AnimationExporter::sample_and_write_bone_animation_matrix ( Object ob_arm,
Bone bone 
)
protected

◆ sample_animation() [1/2]

void AnimationExporter::sample_animation ( float v,
std::vector< float > &  frames,
int  type,
Bone bone,
Object ob_arm,
bPoseChannel pChan 
)
protected

◆ sample_animation() [2/2]

void AnimationExporter::sample_animation ( std::vector< float[4][4]> &  mats,
std::vector< float > &  frames,
Bone bone,
Object ob_arm,
bPoseChannel pChan 
)
protected

◆ write_bone_animation()

void AnimationExporter::write_bone_animation ( Object ob_arm,
Bone bone 
)
protected

◆ write_bone_animation_matrix()

void AnimationExporter::write_bone_animation_matrix ( Object ob_arm,
Bone bone 
)
protected

Member Data Documentation

◆ anim_meta

std::vector<std::vector<std::string> > AnimationExporter::anim_meta
protected

Definition at line 135 of file AnimationExporter.h.

Referenced by exportAnimations(), and openAnimationWithClip().


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