summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2024-10-10 16:03:48 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2024-10-10 16:03:48 +0300
commit3091985d31e1ccf9aba159dec4f2d5ea31723ce0 (patch)
treeb1b0ef4984f89a1cb6506a2b60c5a79ffa2e7d26 /indra/newview/scripts/lua
parent6ccae2d0ae977965202ecb45de77e46f8d0312b3 (diff)
Update test_animation.lua demo script
Diffstat (limited to 'indra/newview/scripts/lua')
-rw-r--r--indra/newview/scripts/lua/test_animation.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/indra/newview/scripts/lua/test_animation.lua b/indra/newview/scripts/lua/test_animation.lua
index 37e7254a6c..ae5eabe148 100644
--- a/indra/newview/scripts/lua/test_animation.lua
+++ b/indra/newview/scripts/lua/test_animation.lua
@@ -7,8 +7,8 @@ animations_id = LLInventory.getBasicFolderID('animatn')
anims = LLInventory.collectDescendentsIf{folder_id=animations_id, type="animatn"}.items
local anim_ids = {}
-for key in pairs(anims) do
- table.insert(anim_ids, key)
+for _, key in pairs(anims) do
+ table.insert(anim_ids, {id = key.id, name = key.name})
end
if #anim_ids == 0 then
@@ -16,17 +16,17 @@ if #anim_ids == 0 then
else
-- Start playing a random animation
math.randomseed(os.time())
- local random_id = anim_ids[math.random(#anim_ids)]
- local anim_info = LLAgent.getAnimationInfo(random_id)
+ local random_anim = anim_ids[math.random(#anim_ids)]
+ local anim_info = LLAgent.getAnimationInfo(random_anim.id)
- print("Starting animation locally: " .. anims[random_id].name)
- print("Loop: " .. anim_info.is_loop .. " Joints: " .. anim_info.num_joints .. " Duration " .. tonumber(string.format("%.2f", anim_info.duration)))
- LLAgent.playAnimation{item_id=random_id}
+ print("Starting animation locally: " .. random_anim.name)
+ print("Loop: " .. tostring(anim_info.is_loop) .. " Joints: " .. anim_info.num_joints .. " Duration " .. tonumber(string.format("%.2f", anim_info.duration)))
+ LLAgent.playAnimation{item_id=random_anim.id}
-- Stop animation after 3 sec if it's looped or longer than 3 sec
- if anim_info.is_loop == 1 or anim_info.duration > 3 then
+ if anim_info.is_loop or anim_info.duration > 3 then
LL.sleep(3)
print("Stop animation.")
- LLAgent.stopAnimation(random_id)
+ LLAgent.stopAnimation(random_anim.id)
end
end