diff options
author | sapier <sapier@users.noreply.github.com> | 2017-09-01 11:15:12 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-09-01 11:15:12 +0200 |
commit | bf403b923ab4a1e11447b3f81d54d5d0c1124f65 (patch) | |
tree | 8c8f73e07051d8de8d5eb5c488bfdbc4377de3b3 /src/content_cao.cpp | |
parent | b8f06ad37e142004335e8c2ffaec5fe73b620196 (diff) | |
download | minetest-bf403b923ab4a1e11447b3f81d54d5d0c1124f65.tar.gz minetest-bf403b923ab4a1e11447b3f81d54d5d0c1124f65.tar.bz2 minetest-bf403b923ab4a1e11447b3f81d54d5d0c1124f65.zip |
Fix animation frame_speed and blend loosing precision due to incorrec… (#6357)
* Fix animation frame_speed and blend loosing precision due to incorrect data type
Add lua function set_animation_frame_speed to update the frame speed without resetting the animation to start
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r-- | src/content_cao.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/content_cao.cpp b/src/content_cao.cpp index 42f4e22a6..7659871b6 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -1150,9 +1150,17 @@ void GenericCAO::updateAnimation() #endif } +void GenericCAO::updateAnimationSpeed() +{ + if (!m_animated_meshnode) + return; + + m_animated_meshnode->setAnimationSpeed(m_animation_speed); +} + void GenericCAO::updateBonePosition() { - if(m_bone_position.empty() || !m_animated_meshnode) + if (m_bone_position.empty() || !m_animated_meshnode) return; m_animated_meshnode->setJointMode(irr::scene::EJUOR_CONTROL); // To write positions to the mesh on render @@ -1351,6 +1359,9 @@ void GenericCAO::processMessage(const std::string &data) updateAnimation(); } } + } else if (cmd == GENERIC_CMD_SET_ANIMATION_SPEED) { + m_animation_speed = readF1000(is); + updateAnimationSpeed(); } else if (cmd == GENERIC_CMD_SET_BONE_POSITION) { std::string bone = deSerializeString(is); v3f position = readV3F1000(is); |