+ ObjectSlot &obj_slot = get_slot(obj);
+ obj_slot.animations.clear();
+ obj_slot.base_matrix = Matrix();
+ obj_slot.stacked = false;
+ obj_slot.armature = anim.get_armature();
+ obj_slot.animations.push_back(AnimationSlot(anim));
+}
+
+void AnimationPlayer::play_stacked(AnimatedObject &obj, const Animation &anim)
+{
+ ObjectSlot &obj_slot = get_slot(obj);
+ if(obj_slot.animations.empty())
+ obj_slot.base_matrix = *obj.get_matrix();
+ // TODO check for incompatible armature
+ obj_slot.stacked = true;
+ obj_slot.armature = anim.get_armature();
+ obj_slot.animations.push_back(AnimationSlot(anim));
+}
+
+unsigned AnimationPlayer::get_n_active_animations(const AnimatedObject &obj) const
+{
+ ObjectMap::const_iterator i = objects.find(&obj);
+ return (i!=objects.end() ? i->second.animations.size() : 0);
+}
+
+void AnimationPlayer::stop(AnimatedObject &obj)
+{
+ objects.erase(&obj);
+}
+
+void AnimationPlayer::stop(AnimatedObject &obj, const Animation &anim)
+{
+ ObjectMap::iterator i = objects.find(&obj);
+ if(i==objects.end())
+ return;
+
+ for(AnimationList::iterator j=i->second.animations.begin(); j!=i->second.animations.end(); ++j)
+ if(&j->animation==&anim)
+ {
+ i->second.animations.erase(j);
+ break;
+ }
+
+ if(i->second.animations.empty())
+ objects.erase(i);