Armature bake animation export ( not as pose matrices. Still needs fixing )

This commit is contained in:
2011-08-07 18:15:40 +00:00
parent daab78bc61
commit c095397c98
4 changed files with 30 additions and 2 deletions

View File

@@ -367,7 +367,7 @@ void AnimationExporter::exportAnimations(Scene *sce)
if (!pchan)
return;
find_all_frames(ob_arm, fra);
find_frames(ob_arm, fra);
if (flag & ARM_RESTPOS) {
arm->flag &= ~ARM_RESTPOS;
@@ -1119,6 +1119,25 @@ void AnimationExporter::exportAnimations(Scene *sce)
return;
}
void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra)
{
FCurve *fcu= (FCurve*)ob->adt->action->curves.first;
for (; fcu; fcu = fcu->next) {
for (unsigned int i = 0; i < fcu->totvert; i++) {
float f = fcu->bezt[i].vec[1][0]; //
if (std::find(fra.begin(), fra.end(), f) == fra.end())
fra.push_back(f);
}
}
// keep the keys in ascending order
std::sort(fra.begin(), fra.end());
}
void AnimationExporter::find_frames(Object *ob, std::vector<float> &fra, const char *prefix, const char *tm_name)
{
FCurve *fcu= (FCurve*)ob->adt->action->curves.first;

View File

@@ -144,6 +144,7 @@ protected:
std::string get_transform_sid(char *rna_path, int tm_type, const char *axis_name, bool append_axis);
void find_frames(Object *ob, std::vector<float> &fra, const char *prefix, const char *tm_name);
void find_frames(Object *ob, std::vector<float> &fra);
void find_all_frames(Object *ob, std::vector<float> &fra);

View File

@@ -929,6 +929,12 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
Assign_float_animations( listid, AnimCurves , "specular_hardness" );
}
if((animType->material & MATERIAL_IOR) != 0){
const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction());
const COLLADAFW::UniqueId& listid = ior->getAnimationList();
Assign_float_animations( listid, AnimCurves , "raytrace_transparency.ior" );
}
if((animType->material & MATERIAL_SPEC_COLOR) != 0){
const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular());
const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList();
@@ -1010,6 +1016,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR);
types->material = setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR);
// types->material = setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY);
types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR);
}
}
return types;

View File

@@ -111,7 +111,8 @@ private:
MATERIAL_SHININESS = 2,
MATERIAL_SPEC_COLOR = 4,
MATERIAL_DIFF_COLOR = 1 << 3,
MATERIAL_TRANSPARENCY = 1 << 4
MATERIAL_TRANSPARENCY = 1 << 4,
MATERIAL_IOR = 1 << 5
};
enum AnimationType