From b27606feca00172cdfd7467ff3e216824f1c9518 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 8 Jul 2024 13:56:46 +0300 Subject: Lua api for Snapshot and demo script --- indra/newview/scripts/lua/require/UI.lua | 15 +++++++++++++++ indra/newview/scripts/lua/test_snapshot.lua | 15 +++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 indra/newview/scripts/lua/test_snapshot.lua (limited to 'indra/newview/scripts') diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua index eb1a4017c7..8fcc446e09 100644 --- a/indra/newview/scripts/lua/require/UI.lua +++ b/indra/newview/scripts/lua/require/UI.lua @@ -122,4 +122,19 @@ 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', ...) + leap.request('LLViewerWindow', {op='saveSnapshot', filename = args.filename, + width=args.width, height=args.height, + showui=args.showui, showhud=args.showhud, + rebuild=args.rebuild, type=args.type}) +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} -- cgit v1.2.3 From 98761798b9a118c46e5482b1f36fef1260c9c5f9 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 10 Jul 2024 12:03:49 +0300 Subject: Simplify passing keys to leap.request --- indra/newview/scripts/lua/require/UI.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/newview/scripts') diff --git a/indra/newview/scripts/lua/require/UI.lua b/indra/newview/scripts/lua/require/UI.lua index 8fcc446e09..1eee4657f4 100644 --- a/indra/newview/scripts/lua/require/UI.lua +++ b/indra/newview/scripts/lua/require/UI.lua @@ -132,9 +132,7 @@ end -- [, rebuild=false]} function UI.snapshot(...) local args = mapargs('filename,width,height,showui,showhud,rebuild,type', ...) - leap.request('LLViewerWindow', {op='saveSnapshot', filename = args.filename, - width=args.width, height=args.height, - showui=args.showui, showhud=args.showhud, - rebuild=args.rebuild, type=args.type}) + args.op = 'saveSnapshot' + return leap.request('LLViewerWindow', args).result end return UI -- cgit v1.2.3