diff options
Diffstat (limited to 'indra/newview/scripts')
-rw-r--r-- | indra/newview/scripts/lua/LLAppearance.lua | 25 | ||||
-rw-r--r-- | indra/newview/scripts/lua/luafloater_outfits_list.xml | 21 | ||||
-rw-r--r-- | indra/newview/scripts/lua/test_outfits_list.lua | 27 |
3 files changed, 73 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/LLAppearance.lua b/indra/newview/scripts/lua/LLAppearance.lua new file mode 100644 index 0000000000..ec7a25197f --- /dev/null +++ b/indra/newview/scripts/lua/LLAppearance.lua @@ -0,0 +1,25 @@ +leap = require 'leap' + +local LLAppearance = {} + +function LLAppearance.addOutfit(folder) + leap.request('LLAppearance', {op='wearOutfit', append = true, folder_id=folder}) +end + +function LLAppearance.replaceOutfit(folder) + leap.request('LLAppearance', {op='wearOutfit', append = false, folder_id=folder}) +end + +function LLAppearance.addOutfitByName(folder) + leap.request('LLAppearance', {op='wearOutfitByName', append = true, folder_name=folder}) +end + +function LLAppearance.replaceOutfitByName(folder) + leap.request('LLAppearance', {op='wearOutfitByName', append = false, folder_name=folder}) +end + +function LLAppearance.getOutfitsList() + return leap.request('LLAppearance', {op='getOutfitsList'})['outfits'] +end + +return LLAppearance diff --git a/indra/newview/scripts/lua/luafloater_outfits_list.xml b/indra/newview/scripts/lua/luafloater_outfits_list.xml new file mode 100644 index 0000000000..1f6505cb8d --- /dev/null +++ b/indra/newview/scripts/lua/luafloater_outfits_list.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + legacy_header_height="18" + height="185" + layout="topleft" + name="lua_outfits" + title="Outfits" + width="320"> + <scroll_list + draw_heading="false" + left="5" + width="310" + height="150" + top_pad ="25" + follows="all" + name="outfits_list"> + <scroll_list.columns + name="outfit_name" + label="Name"/> + </scroll_list> +</floater> diff --git a/indra/newview/scripts/lua/test_outfits_list.lua b/indra/newview/scripts/lua/test_outfits_list.lua new file mode 100644 index 0000000000..5875fd51da --- /dev/null +++ b/indra/newview/scripts/lua/test_outfits_list.lua @@ -0,0 +1,27 @@ +local Floater = require 'Floater' +local LLAppearance = require 'LLAppearance' +local startup = require 'startup' + +local flt = Floater:new( + "luafloater_outfits_list.xml", + {outfits_list = {"double_click"}}) + +function flt:post_build(event_data) + local outfits_map = LLAppearance.getOutfitsList() + local action_data = {} + action_data.action = "add_list_element" + action_data.ctrl_name = "outfits_list" + local outfits = {} + for uuid, name in pairs(outfits_map) do + table.insert(outfits, {value = uuid, columns={column = "outfit_name", value = name}}) + end + action_data.value = outfits + self:post(action_data) +end + +function flt:double_click_outfits_list(event_data) + LLAppearance.replaceOutfit(event_data.value) +end + +startup.wait('STATE_STARTED') +flt:show() |