AnimationType Enum.

This commit is contained in:
2011-07-03 12:33:52 +00:00
parent b6c1490359
commit 9f99e5cc1e
2 changed files with 17 additions and 8 deletions

View File

@@ -680,8 +680,8 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
Object *ob = is_joint ? armature_importer->get_armature_for_joint(root) : object_map[node->getUniqueId()]; Object *ob = is_joint ? armature_importer->get_armature_for_joint(root) : object_map[node->getUniqueId()];
const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL; const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL;
if ( ! is_object_animated(node, FW_object_map) ) return ; AnimationType type = get_animation_type(node, FW_object_map );
char joint_path[200]; char joint_path[200];
@@ -754,9 +754,11 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node ,
} }
//Check if object is animated by checking if animlist_map holds the animlist_id of node transforms //Check if object is animated by checking if animlist_map holds the animlist_id of node transforms
bool AnimationImporter::is_object_animated ( const COLLADAFW::Node * node , std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map ) AnimationImporter::AnimationType AnimationImporter::get_animation_type ( const COLLADAFW::Node * node ,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map)
{ {
bool exists = false; AnimationImporter::AnimationType type = AnimationImporter::INANIMATE ;
//bool exists = false;
const COLLADAFW::TransformationPointerArray& nodeTransforms = node->getTransformations(); const COLLADAFW::TransformationPointerArray& nodeTransforms = node->getTransformations();
//for each transformation in node //for each transformation in node
@@ -768,7 +770,7 @@ bool AnimationImporter::is_object_animated ( const COLLADAFW::Node * node , std:
if (animlist_map.find(listid) == animlist_map.end()) continue ; if (animlist_map.find(listid) == animlist_map.end()) continue ;
else else
{ {
exists = true; type = AnimationImporter::NODE_TRANSFORM;
break; break;
} }
} }
@@ -783,12 +785,12 @@ bool AnimationImporter::is_object_animated ( const COLLADAFW::Node * node , std:
if (animlist_map.find(listid) == animlist_map.end()) continue ; if (animlist_map.find(listid) == animlist_map.end()) continue ;
else else
{ {
exists = true; type = AnimationImporter::LIGHT_COLOR;
break; break;
} }
} }
return exists; return type;
} }
//XXX Is not used anymore. //XXX Is not used anymore.

View File

@@ -80,6 +80,13 @@ private:
void fcurve_deg_to_rad(FCurve *cu); void fcurve_deg_to_rad(FCurve *cu);
void add_fcurves_to_object(Object *ob, std::vector<FCurve*>& curves, char *rna_path, int array_index, Animation *animated); void add_fcurves_to_object(Object *ob, std::vector<FCurve*>& curves, char *rna_path, int array_index, Animation *animated);
enum AnimationType
{
NODE_TRANSFORM,
LIGHT_COLOR,
INANIMATE
};
public: public:
AnimationImporter(UnitConverter *conv, ArmatureImporter *arm, Scene *scene); AnimationImporter(UnitConverter *conv, ArmatureImporter *arm, Scene *scene);
@@ -101,7 +108,7 @@ public:
std::map<COLLADAFW::UniqueId, Object*>& object_map , std::map<COLLADAFW::UniqueId, Object*>& object_map ,
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map); std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map);
bool is_object_animated ( const COLLADAFW::Node * node , std::map<COLLADAFW::UniqueId,const COLLADAFW::Object*> FW_object_map ) ; AnimationType get_animation_type( const COLLADAFW::Node * node , std::map<COLLADAFW::UniqueId,const COLLADAFW::Object*> FW_object_map ) ;
void Assign_transform_animations(COLLADAFW::Transformation* transform , void Assign_transform_animations(COLLADAFW::Transformation* transform ,