summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/auto/menus.lua
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-09-06 15:14:59 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-09-06 15:14:59 -0400
commit8c68abb2f63d54aeb4614c63a109b838ed8d0656 (patch)
tree6e6b12716d9b48c7a50e57a7f2dd6e7abaeb787f /indra/newview/scripts/lua/auto/menus.lua
parent782a898efadadf2747cc3310749f34a8dde8dd60 (diff)
Remove Lua floaters from menu_viewer.xml; re-add if Lua enabled.
Add a menus.lua autorun script that waits until login, then adds the Lua floaters back into the Develop->Consoles menu where they were originally. Extend UI.addMenuItem() and addMenuSeparator() to support pos argument.
Diffstat (limited to 'indra/newview/scripts/lua/auto/menus.lua')
-rw-r--r--indra/newview/scripts/lua/auto/menus.lua51
1 files changed, 51 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/auto/menus.lua b/indra/newview/scripts/lua/auto/menus.lua
new file mode 100644
index 0000000000..b2f54d83df
--- /dev/null
+++ b/indra/newview/scripts/lua/auto/menus.lua
@@ -0,0 +1,51 @@
+-- Inject Lua-related menus into the top menu structure. Run this as a Lua
+-- script so that turning off the Lua feature also disables these menus.
+
+-- Under Develop -> Consoles, want to present the equivalent of:
+-- <menu_item_separator/>
+-- <menu_item_check
+-- label="LUA Debug Console"
+-- name="LUA Debug Console">
+-- <menu_item_check.on_check
+-- function="Floater.Visible"
+-- parameter="lua_debug" />
+-- <menu_item_check.on_click
+-- function="Floater.Toggle"
+-- parameter="lua_debug" />
+-- </menu_item_check>
+-- <menu_item_check
+-- label="LUA Scripts Info"
+-- name="LUA Scripts">
+-- <menu_item_check.on_check
+-- function="Floater.Visible"
+-- parameter="lua_scripts" />
+-- <menu_item_check.on_click
+-- function="Floater.Toggle"
+-- parameter="lua_scripts" />
+-- </menu_item_check>
+
+local startup = require 'startup'
+local UI = require 'UI'
+
+-- Don't mess with the viewer's menu structure until we've logged in.
+startup.wait('STATE_STARTED')
+
+-- Add LUA Debug Console to Develop->Consoles
+local pos = 9
+UI.addMenuSeparator{
+ parent_menu='Consoles', pos=pos,
+}
+pos += 1
+UI.addMenuItem{
+ parent_menu='Consoles', pos=pos,
+ name='lua_debug', label='LUA Debug Console',
+ func='Floater.ToggleOrBringToFront', param='lua_debug',
+}
+pos += 1
+
+-- Add LUA Scripts Info to Develop->Consoles
+UI.addMenuItem{
+ parent_menu='Consoles', pos=pos,
+ name='lua_scripts', label='LUA Scripts Info',
+ func='Floater.ToggleOrBringToFront', param='lua_scripts',
+}