summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/test_animation.lua
diff options
context:
space:
mode:
authornat-goodspeed <nat@lindenlab.com>2024-09-13 09:20:57 -0400
committerGitHub <noreply@github.com>2024-09-13 09:20:57 -0400
commit7ced89435d702b8a6bc02908769bed47e20d6ec0 (patch)
treebb4735ba807f4d4caf7cf6161462557cfc9864bd /indra/newview/scripts/lua/test_animation.lua
parent3d191c09b1b1eb6726fe67f6fdf5445d83536578 (diff)
parentd6f3f20af6cccf53746cbf1fdf39bc4e235c4f0d (diff)
Merge pull request #2548 from secondlife/lua-frame-profile
Make Develop->Render Tests->Frame Profile dump JSON to a file too (#2412)
Diffstat (limited to 'indra/newview/scripts/lua/test_animation.lua')
-rw-r--r--indra/newview/scripts/lua/test_animation.lua28
1 files changed, 16 insertions, 12 deletions
diff --git a/indra/newview/scripts/lua/test_animation.lua b/indra/newview/scripts/lua/test_animation.lua
index c16fef4918..37e7254a6c 100644
--- a/indra/newview/scripts/lua/test_animation.lua
+++ b/indra/newview/scripts/lua/test_animation.lua
@@ -11,18 +11,22 @@ for key in pairs(anims) do
table.insert(anim_ids, key)
end
--- 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)
+if #anim_ids == 0 then
+ print("No animations found")
+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)
-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: " .. 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}
--- 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
- LL.sleep(3)
- print("Stop animation.")
- LLAgent.stopAnimation(random_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
+ LL.sleep(3)
+ print("Stop animation.")
+ LLAgent.stopAnimation(random_id)
+ end
end