diff options
author | Sukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com> | 2011-07-03 15:07:34 +0400 |
---|---|---|
committer | Sukhitha Prabhath Jayathilake <pr.jayathilake@gmail.com> | 2011-07-03 15:07:34 +0400 |
commit | a6320911765c65e87d492c48a0facdb1ca99b8ea (patch) | |
tree | f6bf6ca813004ade4c25478f16ae93800982ef7a /source/blender | |
parent | 46d12b480e8531d89511998222bc8143e592d010 (diff) |
Light Animation Identification.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/collada/AnimationImporter.cpp | 24 | ||||
-rw-r--r-- | source/blender/collada/AnimationImporter.h | 6 | ||||
-rw-r--r-- | source/blender/collada/DocumentImporter.cpp | 3 | ||||
-rw-r--r-- | source/blender/collada/DocumentImporter.h | 2 |
4 files changed, 26 insertions, 9 deletions
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index bb11f815b40..b260ef971ac 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -675,7 +675,8 @@ void AnimationImporter:: Assign_transform_animations(std::vector<float>* frames, void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map, - std::map<COLLADAFW::UniqueId, Object*>& object_map ) + std::map<COLLADAFW::UniqueId, Object*>& object_map, + std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map) { bool is_joint = node->getType() == COLLADAFW::Node::JOINT; @@ -684,7 +685,7 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL; - if ( ! is_object_animated(node) ) return ; + if ( ! is_object_animated(node, FW_object_map) ) return ; char joint_path[200]; @@ -776,13 +777,11 @@ void AnimationImporter::translate_Animations_NEW ( COLLADAFW::Node * node , ob->rotmode = ROT_MODE_EUL; } } - } - } //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 ) +bool AnimationImporter::is_object_animated ( const COLLADAFW::Node * node , std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map ) { bool exists = false; const COLLADAFW::TransformationPointerArray& nodeTransforms = node->getTransformations(); @@ -800,7 +799,22 @@ bool AnimationImporter::is_object_animated ( const COLLADAFW::Node * node ) break; } } + const COLLADAFW::InstanceLightPointerArray& nodeLights = node->getInstanceLights(); + + for (unsigned int i = 0; i < nodeLights.getCount(); i++) { + const COLLADAFW::Light *light = (COLLADAFW::Light *) FW_object_map[nodeLights[i]->getInstanciatedObjectId()]; + const COLLADAFW::Color *col = &(light->getColor()); + const COLLADAFW::UniqueId& listid = col->getAnimationList(); + //check if color has animations + if (animlist_map.find(listid) == animlist_map.end()) continue ; + else + { + exists = true; + break; + } + } + return exists; } diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h index 1e005b5c341..6d66d219e40 100644 --- a/source/blender/collada/AnimationImporter.h +++ b/source/blender/collada/AnimationImporter.h @@ -37,6 +37,7 @@ #include "COLLADAFWAnimationList.h" #include "COLLADAFWNode.h" #include "COLLADAFWUniqueId.h" +#include "COLLADAFWLight.h" #include "DNA_anim_types.h" #include "DNA_object_types.h" @@ -97,9 +98,10 @@ public: void translate_Animations_NEW ( COLLADAFW::Node * Node , std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& root_map, - std::map<COLLADAFW::UniqueId, Object*>& object_map ); + std::map<COLLADAFW::UniqueId, Object*>& object_map , + std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map); - bool is_object_animated ( const COLLADAFW::Node * node ) ; + bool is_object_animated ( const COLLADAFW::Node * node , std::map<COLLADAFW::UniqueId,const COLLADAFW::Object*> FW_object_map ) ; void Assign_transform_animations(std::vector<float>* frames, diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 14ce9a9b417..2815d8703ed 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -252,7 +252,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW //for (i = 0; i < 4; i++) //ob = - anim_importer.translate_Animations_NEW(node, root_map, object_map); + anim_importer.translate_Animations_NEW(node, root_map, object_map, FW_object_map); COLLADAFW::NodePointerArray &children = node->getChildNodes(); for (i = 0; i < children.getCount(); i++) { @@ -1051,6 +1051,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) } this->uid_lamp_map[light->getUniqueId()] = lamp; + this->FW_object_map[light->getUniqueId()] = light; return true; } diff --git a/source/blender/collada/DocumentImporter.h b/source/blender/collada/DocumentImporter.h index 5ccec534680..ce7a64a600d 100644 --- a/source/blender/collada/DocumentImporter.h +++ b/source/blender/collada/DocumentImporter.h @@ -157,7 +157,7 @@ private: std::vector<Object*> libnode_ob; std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> root_map; // find root joint by child joint uid, for bone tree evaluation during resampling - + std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map; }; #endif |