File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,12 +33,12 @@ namespace our {
3333 channels[nodeName] = BoneAnimation (nodeName, channel);
3434 }
3535 }
36- BoneAnimation& findBone (const std::string& name) {
36+ const BoneAnimation* findBone (const std::string& name) const {
3737 auto it = channels.find (name);
3838 if (it != channels.end ()) {
39- return it->second ;
39+ return & it->second ;
4040 }
41- throw std::runtime_error ( " BoneAnimation not found: " + name) ;
41+ return nullptr ;
4242 }
4343 };
4444} // namespace our
Original file line number Diff line number Diff line change @@ -36,9 +36,8 @@ namespace our {
3636
3737 // animated local transform, fallback to bind pose
3838 glm::mat4 localTransform = node.localTransform ;
39- auto it = currentAnimation->channels .find (node.name );
40- if (it != currentAnimation->channels .end ()) {
41- localTransform = it->second .interpolate (currentTime);
39+ if (const BoneAnimation* boneAnim = currentAnimation->findBone (node.name ); boneAnim) {
40+ localTransform = boneAnim->interpolate (currentTime);
4241 }
4342
4443 // accumulate from parent
You can’t perform that action at this time.
0 commit comments