From bf403b923ab4a1e11447b3f81d54d5d0c1124f65 Mon Sep 17 00:00:00 2001 From: sapier Date: Fri, 1 Sep 2017 11:15:12 +0200 Subject: =?UTF-8?q?Fix=20animation=20frame=5Fspeed=20and=20blend=20loosing?= =?UTF-8?q?=20precision=20due=20to=20incorrec=E2=80=A6=20(#6357)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- src/content_sao.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/content_sao.cpp') diff --git a/src/content_sao.cpp b/src/content_sao.cpp index c264473af..ece921472 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -155,6 +155,12 @@ void UnitSAO::getAnimation(v2f *frame_range, float *frame_speed, float *frame_bl *frame_loop = m_animation_loop; } +void UnitSAO::setAnimationSpeed(float frame_speed) +{ + m_animation_speed = frame_speed; + m_animation_speed_sent = false; +} + void UnitSAO::setBonePosition(const std::string &bone, v3f position, v3f rotation) { // store these so they can be updated to clients @@ -440,6 +446,14 @@ void LuaEntitySAO::step(float dtime, bool send_recommended) m_messages_out.push(aom); } + if (!m_animation_speed_sent) { + m_animation_speed_sent = true; + std::string str = gob_cmd_update_animation_speed(m_animation_speed); + // create message and add to list + ActiveObjectMessage aom(getId(), true, str); + m_messages_out.push(aom); + } + if (!m_bone_position_sent) { m_bone_position_sent = true; for (std::unordered_map>::const_iterator -- cgit v1.2.3