diff options
Diffstat (limited to 'linden')
-rw-r--r-- | linden/indra/newview/llinventorybridge.cpp | 68 | ||||
-rw-r--r-- | linden/indra/newview/llinventorybridge.h | 1 | ||||
-rw-r--r-- | linden/indra/newview/llwlparammanager.cpp | 56 | ||||
-rw-r--r-- | linden/indra/newview/llwlparammanager.h | 12 | ||||
-rw-r--r-- | linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml | 4 |
5 files changed, 137 insertions, 4 deletions
diff --git a/linden/indra/newview/llinventorybridge.cpp b/linden/indra/newview/llinventorybridge.cpp index 41af123..7396eac 100644 --- a/linden/indra/newview/llinventorybridge.cpp +++ b/linden/indra/newview/llinventorybridge.cpp | |||
@@ -86,6 +86,7 @@ | |||
86 | #include "lluictrlfactory.h" | 86 | #include "lluictrlfactory.h" |
87 | #include "llselectmgr.h" | 87 | #include "llselectmgr.h" |
88 | #include "llfloateropenobject.h" | 88 | #include "llfloateropenobject.h" |
89 | #include "llwlparammanager.h" | ||
89 | 90 | ||
90 | // Helpers | 91 | // Helpers |
91 | // bug in busy count inc/dec right now, logic is complex... do we really need it? | 92 | // bug in busy count inc/dec right now, logic is complex... do we really need it? |
@@ -812,6 +813,12 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, | |||
812 | folder_view_itemp->getListener()->pasteFromClipboard(); | 813 | folder_view_itemp->getListener()->pasteFromClipboard(); |
813 | return; | 814 | return; |
814 | } | 815 | } |
816 | else if ("load_windlight" == action) | ||
817 | { | ||
818 | LLInventoryItem* itemp = model->getItem(mUUID); | ||
819 | if(!itemp) return; | ||
820 | LLWLParamManager::instance()->loadPresetNotecard(itemp->getName(), itemp->getAssetUUID(), mUUID); | ||
821 | } | ||
815 | } | 822 | } |
816 | 823 | ||
817 | void LLItemBridge::selectItem() | 824 | void LLItemBridge::selectItem() |
@@ -3059,7 +3066,68 @@ void LLNotecardBridge::openItem() | |||
3059 | open_notecard(item, getPrefix() + item->getName(), LLUUID::null, FALSE); | 3066 | open_notecard(item, getPrefix() + item->getName(), LLUUID::null, FALSE); |
3060 | } | 3067 | } |
3061 | } | 3068 | } |
3069 | |||
3070 | void LLNotecardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) | ||
3071 | { | ||
3072 | // *TODO: Translate | ||
3073 | lldebugs << "LLNotecardBridge::buildContextMenu()" << llendl; | ||
3074 | std::vector<std::string> items; | ||
3075 | std::vector<std::string> disabled_items; | ||
3076 | if(isInTrash()) | ||
3077 | { | ||
3078 | items.push_back(std::string("Purge Item")); | ||
3079 | if (!isItemRemovable()) | ||
3080 | { | ||
3081 | disabled_items.push_back(std::string("Purge Item")); | ||
3082 | } | ||
3083 | |||
3084 | items.push_back(std::string("Restore Item")); | ||
3085 | } | ||
3062 | 3086 | ||
3087 | else | ||
3088 | { | ||
3089 | bool is_windlight = (getName().length() > 2 && getName().compare(getName().length() - 3, 3, ".wl") == 0); | ||
3090 | |||
3091 | if(is_windlight) | ||
3092 | { | ||
3093 | items.push_back(std::string("Use Windlight Settings")); | ||
3094 | } | ||
3095 | items.push_back(std::string("Properties")); | ||
3096 | getClipboardEntries(true, items, disabled_items, flags); | ||
3097 | } | ||
3098 | hideContextEntries(menu, items, disabled_items); | ||
3099 | /* | ||
3100 | -- | ||
3101 | |||
3102 | |||
3103 | |||
3104 | menuentry_vec_t items; | ||
3105 | menuentry_vec_t disabled_items; | ||
3106 | if(isItemInTrash()) | ||
3107 | { | ||
3108 | addTrashContextMenuOptions(items, disabled_items); | ||
3109 | } | ||
3110 | else | ||
3111 | { | ||
3112 | bool is_windlight = (getName().length() > 2 && getName().compare(getName().length() - 3, 3, ".wl") == 0); | ||
3113 | items.push_back(std::string("Share")); | ||
3114 | if (!canShare()) | ||
3115 | { | ||
3116 | disabled_items.push_back(std::string("Share")); | ||
3117 | } | ||
3118 | |||
3119 | addOpenRightClickMenuOption(items); | ||
3120 | if(is_windlight) | ||
3121 | { | ||
3122 | items.push_back(std::string("Use Windlight Settings")); | ||
3123 | } | ||
3124 | items.push_back(std::string("Properties")); | ||
3125 | |||
3126 | getClipboardEntries(true, items, disabled_items, flags); | ||
3127 | } | ||
3128 | hide_context_entries(menu, items, disabled_items); | ||
3129 | */ | ||
3130 | } | ||
3063 | 3131 | ||
3064 | // +=================================================+ | 3132 | // +=================================================+ |
3065 | // | LLGestureBridge | | 3133 | // | LLGestureBridge | |
diff --git a/linden/indra/newview/llinventorybridge.h b/linden/indra/newview/llinventorybridge.h index 53540b0..2ad4b3a 100644 --- a/linden/indra/newview/llinventorybridge.h +++ b/linden/indra/newview/llinventorybridge.h | |||
@@ -476,6 +476,7 @@ public: | |||
476 | 476 | ||
477 | virtual LLUIImagePtr getIcon() const; | 477 | virtual LLUIImagePtr getIcon() const; |
478 | virtual void openItem(); | 478 | virtual void openItem(); |
479 | virtual void buildContextMenu(LLMenuGL& menu, U32 flags); | ||
479 | 480 | ||
480 | protected: | 481 | protected: |
481 | LLNotecardBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : | 482 | LLNotecardBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : |
diff --git a/linden/indra/newview/llwlparammanager.cpp b/linden/indra/newview/llwlparammanager.cpp index 5f80283..8bbff25 100644 --- a/linden/indra/newview/llwlparammanager.cpp +++ b/linden/indra/newview/llwlparammanager.cpp | |||
@@ -60,6 +60,14 @@ | |||
60 | #include "llfloaterdaycycle.h" | 60 | #include "llfloaterdaycycle.h" |
61 | #include "llfloaterenvsettings.h" | 61 | #include "llfloaterenvsettings.h" |
62 | 62 | ||
63 | |||
64 | // For notecard loading | ||
65 | #include "llvfile.h" | ||
66 | #include "llnotecard.h" | ||
67 | #include "llmemorystream.h" | ||
68 | #include "llnotify.h" | ||
69 | #include "llagent.h" | ||
70 | |||
63 | #include "curl/curl.h" | 71 | #include "curl/curl.h" |
64 | 72 | ||
65 | LLWLParamManager * LLWLParamManager::sInstance = NULL; | 73 | LLWLParamManager * LLWLParamManager::sInstance = NULL; |
@@ -159,7 +167,7 @@ void LLWLParamManager::loadPresets(const std::string& file_name) | |||
159 | 167 | ||
160 | } | 168 | } |
161 | 169 | ||
162 | bool LLWLParamManager::loadPresetXML(const std::string& name, std::istream& preset_stream, bool check_if_real /* = false */) | 170 | bool LLWLParamManager::loadPresetXML(const std::string& name, std::istream& preset_stream, bool propagate /* = false */, bool check_if_real /* = false */) |
163 | { | 171 | { |
164 | LLSD paramsData(LLSD::emptyMap()); | 172 | LLSD paramsData(LLSD::emptyMap()); |
165 | 173 | ||
@@ -216,9 +224,28 @@ bool LLWLParamManager::loadPresetXML(const std::string& name, std::istream& pres | |||
216 | { | 224 | { |
217 | setParamSet(name, paramsData); | 225 | setParamSet(name, paramsData); |
218 | } | 226 | } |
227 | |||
228 | if(propagate) | ||
229 | { | ||
230 | getParamSet(name, mCurParams); | ||
231 | propagateParameters(); | ||
232 | } | ||
219 | return true; | 233 | return true; |
220 | } | 234 | } |
221 | 235 | void LLWLParamManager::loadPresetNotecard(const std::string& name, const LLUUID& asset_id, const LLUUID& inv_id) | |
236 | { | ||
237 | gAssetStorage->getInvItemAsset(LLHost::invalid, | ||
238 | gAgent.getID(), | ||
239 | gAgent.getSessionID(), | ||
240 | gAgent.getID(), | ||
241 | LLUUID::null, | ||
242 | inv_id, | ||
243 | asset_id, | ||
244 | LLAssetType::AT_NOTECARD, | ||
245 | &loadWindlightNotecard, | ||
246 | (void*)name.c_str()); | ||
247 | } | ||
248 | |||
222 | void LLWLParamManager::savePresets(const std::string & fileName) | 249 | void LLWLParamManager::savePresets(const std::string & fileName) |
223 | { | 250 | { |
224 | //Nobody currently calls me, but if they did, then its reasonable to write the data out to the user's folder | 251 | //Nobody currently calls me, but if they did, then its reasonable to write the data out to the user's folder |
@@ -620,6 +647,31 @@ LLWLParamManager * LLWLParamManager::instance() | |||
620 | return sInstance; | 647 | return sInstance; |
621 | } | 648 | } |
622 | 649 | ||
650 | void LLWLParamManager::loadWindlightNotecard(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status) | ||
651 | { | ||
652 | std::string name = std::string((char*)user_data); | ||
653 | if(LL_ERR_NOERR == status) | ||
654 | { | ||
655 | LLVFile file(vfs, asset_id, asset_type, LLVFile::READ); | ||
656 | S32 file_length = file.getSize(); | ||
657 | std::vector<char> buffer(file_length + 1); | ||
658 | file.read((U8*)&buffer[0], file_length); | ||
659 | buffer[file_length] = 0; | ||
660 | LLNotecard notecard(LLNotecard::MAX_SIZE); | ||
661 | LLMemoryStream str((U8*)&buffer[0], file_length + 1); | ||
662 | notecard.importStream(str); | ||
663 | std::string settings = notecard.getText(); | ||
664 | LLMemoryStream settings_str((U8*)settings.c_str(), settings.length()); | ||
665 | bool is_real_setting = sInstance->loadPresetXML(name, settings_str, true, true); | ||
666 | if(!is_real_setting) | ||
667 | { | ||
668 | LLSD subs; | ||
669 | subs["NAME"] = name; | ||
670 | LLNotifications::getInstance()->add("KittyInvalidWindlightNotecard", subs); | ||
671 | } | ||
672 | } | ||
673 | } | ||
674 | |||
623 | // static | 675 | // static |
624 | void LLWLParamManager::addObserver(LLWLPresetsObserver* observer) | 676 | void LLWLParamManager::addObserver(LLWLPresetsObserver* observer) |
625 | { | 677 | { |
diff --git a/linden/indra/newview/llwlparammanager.h b/linden/indra/newview/llwlparammanager.h index 141af3c..c506c11 100644 --- a/linden/indra/newview/llwlparammanager.h +++ b/linden/indra/newview/llwlparammanager.h | |||
@@ -40,6 +40,9 @@ | |||
40 | #include "llwldaycycle.h" | 40 | #include "llwldaycycle.h" |
41 | #include "llviewercamera.h" | 41 | #include "llviewercamera.h" |
42 | 42 | ||
43 | #include "llassettype.h" // Ugh. | ||
44 | class LLVFS; | ||
45 | |||
43 | class LLGLSLShader; | 46 | class LLGLSLShader; |
44 | 47 | ||
45 | class LLWLPresetsObserver | 48 | class LLWLPresetsObserver |
@@ -143,11 +146,14 @@ public: | |||
143 | void savePresets(const std::string & fileName); | 146 | void savePresets(const std::string & fileName); |
144 | 147 | ||
145 | /// load an individual preset into the sky | 148 | /// load an individual preset into the sky |
146 | void loadPreset(const std::string & name,bool propogate=true); | 149 | void loadPreset(const std::string & name, bool propogate=true); |
147 | 150 | ||
148 | /// load an individual preset into the sky from an LLSD stream | 151 | /// load an individual preset into the sky from an LLSD stream |
149 | /// Returns whether the stream was actually reasonable XML to load from. | 152 | /// Returns whether the stream was actually reasonable XML to load from. |
150 | bool loadPresetXML(const std::string& name, std::istream& preset_stream, bool check_if_real=false); | 153 | bool loadPresetXML(const std::string& name, std::istream& preset_stream, bool propogate=false, bool check_if_real=false); |
154 | |||
155 | /// Load an individual preset from a notecard. | ||
156 | void loadPresetNotecard(const std::string& name, const LLUUID& asset_id, const LLUUID& inv_id); | ||
151 | 157 | ||
152 | /// save the parameter presets to file | 158 | /// save the parameter presets to file |
153 | void savePreset(const std::string & name); | 159 | void savePreset(const std::string & name); |
@@ -274,6 +280,8 @@ private: | |||
274 | 280 | ||
275 | static std::vector<LLWLPresetsObserver*> sObservers; | 281 | static std::vector<LLWLPresetsObserver*> sObservers; |
276 | 282 | ||
283 | static void loadWindlightNotecard(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status); | ||
284 | |||
277 | }; | 285 | }; |
278 | 286 | ||
279 | inline F32 LLWLParamManager::getDomeOffset(void) const | 287 | inline F32 LLWLParamManager::getDomeOffset(void) const |
diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml b/linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml index ad43c9d..8d5f1fe 100644 --- a/linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml +++ b/linden/indra/newview/skins/default/xui/en-us/menu_inventory.xml | |||
@@ -141,6 +141,10 @@ | |||
141 | name="Open" width="128"> | 141 | name="Open" width="128"> |
142 | <on_click filter="" function="Inventory.DoToSelected" userdata="open" /> | 142 | <on_click filter="" function="Inventory.DoToSelected" userdata="open" /> |
143 | </menu_item_call> | 143 | </menu_item_call> |
144 | <menu_item_call bottom_delta="-18" height="18" label="Use Windlight Settings" left="0" mouse_opaque="true" | ||
145 | name="Use Windlight Settings" width="128"> | ||
146 | <on_click filter="" function="Inventory.DoToSelected" userdata="load_windlight" /> | ||
147 | </menu_item_call> | ||
144 | <menu_item_call bottom_delta="-18" height="18" label="Properties" left="0" mouse_opaque="true" | 148 | <menu_item_call bottom_delta="-18" height="18" label="Properties" left="0" mouse_opaque="true" |
145 | name="Properties" width="128"> | 149 | name="Properties" width="128"> |
146 | <on_click filter="" function="Inventory.DoToSelected" userdata="properties" /> | 150 | <on_click filter="" function="Inventory.DoToSelected" userdata="properties" /> |