From cf29b701b19644062a1428a64023c3cf9829e2de Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 5 Aug 2024 20:37:03 +0300 Subject: Allow getting the list of floater names, hide top menu items; add demo script --- indra/newview/scripts/lua/test_toolbars.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 indra/newview/scripts/lua/test_toolbars.lua (limited to 'indra/newview/scripts/lua/test_toolbars.lua') diff --git a/indra/newview/scripts/lua/test_toolbars.lua b/indra/newview/scripts/lua/test_toolbars.lua new file mode 100644 index 0000000000..70035db775 --- /dev/null +++ b/indra/newview/scripts/lua/test_toolbars.lua @@ -0,0 +1,27 @@ +popup = require 'popup' +UI = require 'UI' + +local OK = 'OK_okcancelbuttons' +local BUTTONS = UI.getToolbarBtnNames() + +-- Clear the toolbars and then add the toolbar buttons to the random toolbar +response = popup:alertYesCancel('Toolbars will be randomly reshuffled. Proceed?') +if next(response) == OK then + UI.clearToolbars() + math.randomseed(os.time()) + + -- add the buttons to the random toolbar + for i = 1, #BUTTONS do + UI.addToolbarBtn(BUTTONS[i], math.random(3)) + end + + -- remove some of the added buttons from the toolbars + for i = 1, #BUTTONS do + if math.random(100) < 30 then + UI.removeToolbarBtn(BUTTONS[i]) + end + end + popup:tip('Toolbars were reshuffled') +else + popup:tip('Canceled') +end -- cgit v1.2.3