diff options
author | MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com> | 2012-10-25 23:29:07 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-11-25 18:14:15 +0200 |
commit | fb0c43186422ad985e70f73bc70eeb07cc194909 (patch) | |
tree | 2e02bdbe9e9abb6d2ee392ee895fa0b73f000f03 /src/content_cao.cpp | |
parent | 9c8ba427503cbf73f0263495a791656b905c2efc (diff) | |
download | minetest-fb0c43186422ad985e70f73bc70eeb07cc194909.tar.gz minetest-fb0c43186422ad985e70f73bc70eeb07cc194909.tar.bz2 minetest-fb0c43186422ad985e70f73bc70eeb07cc194909.zip |
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
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r-- | src/content_cao.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/content_cao.cpp b/src/content_cao.cpp index cd822cb33..4df238b24 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -42,6 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "map.h" #include <IMeshManipulator.h> #include <IAnimatedMeshSceneNode.h> +#include <IBoneSceneNode.h> class Settings; struct ToolCapabilities; @@ -805,7 +806,8 @@ public: if(mesh) { m_animated_meshnode = smgr->addAnimatedMeshSceneNode(mesh, NULL); - + m_animated_meshnode->setMD2Animation(scene::EMAT_STAND); + m_animated_meshnode->animateJoints(); // Needed for some animations m_animated_meshnode->setScale(v3f(m_prop.visual_size.X, m_prop.visual_size.Y, m_prop.visual_size.X)); @@ -922,6 +924,7 @@ public: m_visuals_expired = false; removeFromScene(); addToScene(m_smgr, m_gamedef->tsrc(), m_irr); + updateAnimations(); } if(m_prop.physical){ @@ -979,8 +982,6 @@ public: updateTexturePos(); - updateAnimations(); - if(m_reset_textures_timer >= 0){ m_reset_textures_timer -= dtime; if(m_reset_textures_timer <= 0){ @@ -1141,7 +1142,18 @@ public: if(!m_animated_meshnode) return; - m_animated_meshnode->setFrameLoop(0, 50); + m_animated_meshnode->setFrameLoop(m_prop.animation_frames.X, m_prop.animation_frames.Y); + m_animated_meshnode->setAnimationSpeed(m_prop.animation_speed); + m_animated_meshnode->setTransitionTime(m_prop.animation_blend); + + for(std::map<std::string, v3f>::const_iterator ii = m_prop.animation_bone_position.begin(); ii != m_prop.animation_bone_position.end(); ++ii){ + if((*ii).second.X || (*ii).second.Y || (*ii).second.Z) { } + // Bone positioning code will go here + } + for(std::map<std::string, v3f>::const_iterator ii = m_prop.animation_bone_rotation.begin(); ii != m_prop.animation_bone_rotation.end(); ++ii){ + if((*ii).second.X || (*ii).second.Y || (*ii).second.Z) { } + // Bone rotation code will go here + } } void processMessage(const std::string &data) |