diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2024-07-10 16:10:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-10 16:10:10 +0300 |
commit | 89e7ca66cbadd9b5a3b31e6d12e310b1c7a3c5c1 (patch) | |
tree | 101de52bbbc548d61e864e86347decc4ad503916 /indra/newview/scripts | |
parent | e2122fcb60ceef5273f4f51fa3c53228ddc56ff5 (diff) | |
parent | 98761798b9a118c46e5482b1f36fef1260c9c5f9 (diff) |
Merge pull request #1939 from secondlife/lua-snapshot
Lua api for Snapshot and demo script
Diffstat (limited to 'indra/newview/scripts')
-rw-r--r-- | indra/newview/scripts/lua/require/UI.lua | 13 | ||||
-rw-r--r-- | indra/newview/scripts/lua/test_snapshot.lua | 15 |
2 files changed, 28 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua index eb1a4017c7..1eee4657f4 100644 --- a/indra/newview/scripts/lua/require/UI.lua +++ b/indra/newview/scripts/lua/require/UI.lua @@ -122,4 +122,17 @@ function UI.type(...) end end +-- *************************************************************************** +-- Snapshot +-- *************************************************************************** +-- UI.snapshot{filename=filename -- extension may be specified: bmp, jpeg, png +-- [, type='COLOR' | 'DEPTH'] +-- [, width=width][, height=height] -- uses current window size if not specified +-- [, showui=true][, showhud=true] +-- [, rebuild=false]} +function UI.snapshot(...) + local args = mapargs('filename,width,height,showui,showhud,rebuild,type', ...) + args.op = 'saveSnapshot' + return leap.request('LLViewerWindow', args).result +end return UI diff --git a/indra/newview/scripts/lua/test_snapshot.lua b/indra/newview/scripts/lua/test_snapshot.lua new file mode 100644 index 0000000000..d7c878833b --- /dev/null +++ b/indra/newview/scripts/lua/test_snapshot.lua @@ -0,0 +1,15 @@ +local UI = require 'UI' + +PATH = 'E:\\' +-- 'png', 'jpeg' or 'bmp' +EXT = '.png' + +NAME_SIMPLE = 'Snapshot_simple' .. '_' .. os.date("%Y-%m-%d_%H-%M-%S") +UI.snapshot(PATH .. NAME_SIMPLE .. EXT) + +NAME_ARGS = 'Snapshot_args' .. '_' .. os.date("%Y-%m-%d_%H-%M-%S") + +-- 'COLOR' or 'DEPTH' +TYPE = 'COLOR' +UI.snapshot{PATH .. NAME_ARGS .. EXT, width = 700, height = 400, + type = TYPE, showui = false, showhud = false} |