From fb0c43186422ad985e70f73bc70eeb07cc194909 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Thu, 25 Oct 2012 23:29:07 +0300 Subject: Allow the LUA API to set animations to meshes as well as the animation speed. Also update animations only when needed. Support for animation blending, though for some reason it doesn't work. Don't enable animation transitions by default for many reaosons Object property to store individual bone positions. LUA can specify a bone name followed by a bone position. No functionality yet. Bone rotation to be added in the following commit Same system for bone rotation, plus a few other things I missed --- src/object_properties.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'src/object_properties.cpp') diff --git a/src/object_properties.cpp b/src/object_properties.cpp index c91384ada..eb26db8d3 100644 --- a/src/object_properties.cpp +++ b/src/object_properties.cpp @@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "object_properties.h" #include "util/serialize.h" #include +#include #define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")" #define PP2(x) "("<<(x).X<<","<<(x).Y<<")" @@ -31,6 +32,9 @@ ObjectProperties::ObjectProperties(): collisionbox(-0.5,-0.5,-0.5, 0.5,0.5,0.5), visual("sprite"), mesh(""), + animation_frames(1,1), + animation_speed(15), + animation_blend(0), visual_size(1,1), spritediv(1,1), initial_sprite_basepos(0,0), @@ -38,6 +42,8 @@ ObjectProperties::ObjectProperties(): makes_footstep_sound(false), automatic_rotate(0) { + animation_bone_position[""] = v3f(0,0,0); + animation_bone_rotation[""] = v3f(0,0,0); textures.push_back("unknown_object.png"); } @@ -50,7 +56,26 @@ std::string ObjectProperties::dump() os<<", collisionbox="<::const_iterator ii = animation_bone_position.begin(); ii != animation_bone_position.end(); ++ii){ + std::string bone_name = (*ii).first; + v3f bone_pos = (*ii).second; + os<::const_iterator ii = animation_bone_rotation.begin(); ii != animation_bone_rotation.end(); ++ii){ + std::string bone_name = (*ii).first; + v3f bone_rot = (*ii).second; + os<::const_iterator ii = animation_bone_position.begin(); ii != animation_bone_position.end(); ++ii){ + os<::const_iterator ii = animation_bone_rotation.begin(); ii != animation_bone_rotation.end(); ++ii){ + os<