aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
authorJacek Antonelli2011-06-09 22:45:52 -0500
committerJacek Antonelli2011-06-09 22:45:52 -0500
commitf2a1a8f6de2a6ce4c2fca35330c5d12d0107243c (patch)
tree77eba7d563fee2a9a28203fe91b3e9d21a2815be /linden/indra
parentMerge branch 'view-history' into next (diff)
parentFixed inventory count being reset when the inventory window's closed/reopened (diff)
downloadmeta-impy-f2a1a8f6de2a6ce4c2fca35330c5d12d0107243c.zip
meta-impy-f2a1a8f6de2a6ce4c2fca35330c5d12d0107243c.tar.gz
meta-impy-f2a1a8f6de2a6ce4c2fca35330c5d12d0107243c.tar.bz2
meta-impy-f2a1a8f6de2a6ce4c2fca35330c5d12d0107243c.tar.xz
Merge remote-tracking branch 'mccabe/1.4-fbeta-inv_loading_and_ao' into next
Diffstat (limited to 'linden/indra')
-rw-r--r--linden/indra/llui/llbutton.cpp18
-rw-r--r--linden/indra/llui/llbutton.h6
-rw-r--r--linden/indra/newview/aoremotectrl.cpp13
-rw-r--r--linden/indra/newview/app_settings/logcontrol.xml2
-rw-r--r--linden/indra/newview/app_settings/settings.xml4
-rw-r--r--linden/indra/newview/floaterao.cpp846
-rw-r--r--linden/indra/newview/floaterao.h73
-rw-r--r--linden/indra/newview/llinventorymodel.cpp369
-rw-r--r--linden/indra/newview/llinventorymodel.h5
-rw-r--r--linden/indra/newview/llinventoryview.cpp24
-rw-r--r--linden/indra/newview/llinventoryview.h2
-rw-r--r--linden/indra/newview/llstartup.cpp58
-rw-r--r--linden/indra/newview/llviewermenu.cpp2
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml9
14 files changed, 951 insertions, 480 deletions
diff --git a/linden/indra/llui/llbutton.cpp b/linden/indra/llui/llbutton.cpp
index 702e34e..58c1dbc 100644
--- a/linden/indra/llui/llbutton.cpp
+++ b/linden/indra/llui/llbutton.cpp
@@ -115,7 +115,9 @@ LLButton::LLButton(const std::string& name, const LLRect& rect,
115 void *callback_data, 115 void *callback_data,
116 const LLFontGL *font, 116 const LLFontGL *font,
117 const std::string& unselected_label, 117 const std::string& unselected_label,
118 const std::string& selected_label ) 118 const std::string& selected_label,
119 const std::string& disabled_label,
120 const std::string& disabled_selected_label)
119: LLUICtrl(name, rect, TRUE, NULL, NULL), 121: LLUICtrl(name, rect, TRUE, NULL, NULL),
120 mClickedCallback( click_callback ), 122 mClickedCallback( click_callback ),
121 mMouseDownCallback( NULL ), 123 mMouseDownCallback( NULL ),
@@ -148,6 +150,8 @@ LLButton::LLButton(const std::string& name, const LLRect& rect,
148{ 150{
149 mUnselectedLabel = unselected_label; 151 mUnselectedLabel = unselected_label;
150 mSelectedLabel = selected_label; 152 mSelectedLabel = selected_label;
153 mDisabledLabel = disabled_label;
154 mDisabledSelectedLabel = disabled_selected_label;
151 155
152 // by default, disabled color is same as enabled 156 // by default, disabled color is same as enabled
153 mImageColor = LLUI::sColorsGroup->getColor( "ButtonImageColor" ); 157 mImageColor = LLUI::sColorsGroup->getColor( "ButtonImageColor" );
@@ -989,6 +993,8 @@ LLXMLNodePtr LLButton::getXML(bool save_children) const
989 993
990 node->createChild("label", TRUE)->setStringValue(getLabelUnselected()); 994 node->createChild("label", TRUE)->setStringValue(getLabelUnselected());
991 node->createChild("label_selected", TRUE)->setStringValue(getLabelSelected()); 995 node->createChild("label_selected", TRUE)->setStringValue(getLabelSelected());
996 node->createChild("label_disabled", TRUE)->setStringValue(getLabelDisabled());
997 node->createChild("label_selected_disabled", TRUE)->setStringValue(getLabelDisabledSelected());
992 node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont)); 998 node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont));
993 node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign)); 999 node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign));
994 1000
@@ -1029,6 +1035,12 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa
1029 std::string label_selected = label; 1035 std::string label_selected = label;
1030 node->getAttributeString("label_selected", label_selected); 1036 node->getAttributeString("label_selected", label_selected);
1031 1037
1038 std::string label_disabled = label;
1039 node->getAttributeString("label_disabled", label_disabled);
1040
1041 std::string label_disabled_selected = label_selected;
1042 node->getAttributeString("label_disabled_selected", label_disabled_selected);
1043
1032 LLFontGL* font = selectFont(node); 1044 LLFontGL* font = selectFont(node);
1033 1045
1034 std::string image_unselected; 1046 std::string image_unselected;
@@ -1070,7 +1082,9 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa
1070 parent, 1082 parent,
1071 font, 1083 font,
1072 label, 1084 label,
1073 label_selected); 1085 label_selected,
1086 label_disabled,
1087 label_disabled_selected);
1074 1088
1075 node->getAttributeS32("pad_right", button->mRightHPad); 1089 node->getAttributeS32("pad_right", button->mRightHPad);
1076 node->getAttributeS32("pad_left", button->mLeftHPad); 1090 node->getAttributeS32("pad_left", button->mLeftHPad);
diff --git a/linden/indra/llui/llbutton.h b/linden/indra/llui/llbutton.h
index 2174d95..73ac446 100644
--- a/linden/indra/llui/llbutton.h
+++ b/linden/indra/llui/llbutton.h
@@ -84,7 +84,9 @@ public:
84 void *callback_data = NULL, 84 void *callback_data = NULL,
85 const LLFontGL* mGLFont = NULL, 85 const LLFontGL* mGLFont = NULL,
86 const std::string& unselected_label = LLStringUtil::null, 86 const std::string& unselected_label = LLStringUtil::null,
87 const std::string& selected_label = LLStringUtil::null ); 87 const std::string& selected_label = LLStringUtil::null,
88 const std::string& disabled_label = LLStringUtil::null,
89 const std::string& disabled_selected_label = LLStringUtil::null);
88 90
89 virtual ~LLButton(); 91 virtual ~LLButton();
90 void init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const std::string& control_name); 92 void init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const std::string& control_name);
@@ -133,6 +135,8 @@ public:
133 135
134 const std::string getLabelUnselected() const { return wstring_to_utf8str(mUnselectedLabel); } 136 const std::string getLabelUnselected() const { return wstring_to_utf8str(mUnselectedLabel); }
135 const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); } 137 const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); }
138 const std::string getLabelDisabled() const { return wstring_to_utf8str(mDisabledLabel); }
139 const std::string getLabelDisabledSelected() const { return wstring_to_utf8str(mDisabledSelectedLabel); }
136 140
137 void setImageColor(const std::string& color_control); 141 void setImageColor(const std::string& color_control);
138 void setImageColor(const LLColor4& c); 142 void setImageColor(const LLColor4& c);
diff --git a/linden/indra/newview/aoremotectrl.cpp b/linden/indra/newview/aoremotectrl.cpp
index 781f1b3..6595835 100644
--- a/linden/indra/newview/aoremotectrl.cpp
+++ b/linden/indra/newview/aoremotectrl.cpp
@@ -88,15 +88,22 @@ BOOL AORemoteCtrl::postBuild()
88 childSetAction("ao_show_btn", onClickShowAO, this); 88 childSetAction("ao_show_btn", onClickShowAO, this);
89 childSetAction("popup_btn", onClickPopupBtn, this); 89 childSetAction("popup_btn", onClickPopupBtn, this);
90 90
91 childSetEnabled("ao_sit_btn", gSavedSettings.getBOOL("AOEnabled"));
92
91 return TRUE; 93 return TRUE;
92} 94}
93 95
94// static 96// static
95void AORemoteCtrl::onClickToggleAO(void* data) 97void AORemoteCtrl::onClickToggleAO(void* data)
96{ 98{
97 BOOL ao_enable = gSavedSettings.getBOOL("AOEnabled"); 99 AORemoteCtrl* self = (AORemoteCtrl*)data;
98 gSavedSettings.setBOOL("AOEnabled", !ao_enable); 100 if (self)
99 LLFloaterAO::run(); 101 {
102 BOOL ao_enable = gSavedSettings.getBOOL("AOEnabled");
103 gSavedSettings.setBOOL("AOEnabled", !ao_enable);
104 self->childSetEnabled("ao_sit_btn", !ao_enable);
105 LLFloaterAO::run();
106 }
100} 107}
101 108
102//static 109//static
diff --git a/linden/indra/newview/app_settings/logcontrol.xml b/linden/indra/newview/app_settings/logcontrol.xml
index 92d477f..50f8ba5 100644
--- a/linden/indra/newview/app_settings/logcontrol.xml
+++ b/linden/indra/newview/app_settings/logcontrol.xml
@@ -53,8 +53,8 @@
53 <!--<string>AudioEngine</string>--> 53 <!--<string>AudioEngine</string>-->
54 <!--<string>BodyPhysics</string>--> 54 <!--<string>BodyPhysics</string>-->
55 <!--<string>InitInfo</string>--> 55 <!--<string>InitInfo</string>-->
56 <string>Inventory</string>
56 <!--<string>isOwnedSelf</string>--> 57 <!--<string>isOwnedSelf</string>-->
57 <!--<string>Inventory</string>-->
58 <!--<string>HUDEffect</string>--> 58 <!--<string>HUDEffect</string>-->
59 <!--<string>MarkerFile</string>--> 59 <!--<string>MarkerFile</string>-->
60 <!--<string>Media</string>--> 60 <!--<string>Media</string>-->
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index e571988..57c2065 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -512,7 +512,7 @@
512 <key>Value</key> 512 <key>Value</key>
513 <integer>1</integer> 513 <integer>1</integer>
514 </map> 514 </map>
515 <key>FetchInventoryOnLogin</key> 515 <key>FetchInventoryOnLogin2</key>
516 <map> 516 <map>
517 <key>Comment</key> 517 <key>Comment</key>
518 <string>Automatically fetch the inventory in the background after login (has issues)</string> 518 <string>Automatically fetch the inventory in the background after login (has issues)</string>
@@ -521,7 +521,7 @@
521 <key>Type</key> 521 <key>Type</key>
522 <string>Boolean</string> 522 <string>Boolean</string>
523 <key>Value</key> 523 <key>Value</key>
524 <integer>0</integer> 524 <integer>1</integer>
525 </map> 525 </map>
526 <key>FloaterAnimationListRect</key> 526 <key>FloaterAnimationListRect</key>
527 <map> 527 <map>
diff --git a/linden/indra/newview/floaterao.cpp b/linden/indra/newview/floaterao.cpp
index df88d6f..843cb3a 100644
--- a/linden/indra/newview/floaterao.cpp
+++ b/linden/indra/newview/floaterao.cpp
@@ -34,6 +34,8 @@
34#include "llboost.h" 34#include "llboost.h"
35#include <boost/regex.hpp> 35#include <boost/regex.hpp>
36 36
37static LLFrameTimer sInitTimer;
38
37void cmdline_printchat(std::string message); 39void cmdline_printchat(std::string message);
38 40
39AOInvTimer* gAOInvTimer = NULL; 41AOInvTimer* gAOInvTimer = NULL;
@@ -72,6 +74,11 @@ public:
72 text->insertText(line); 74 text->insertText(line);
73 } 75 }
74 file.close(); 76 file.close();
77
78 if (line.empty())
79 {
80 llwarns << "Can't open ao_template.ini at << " << mFileName << llendl;
81 }
75 82
76 nc->saveIfNeeded(); 83 nc->saveIfNeeded();
77 } 84 }
@@ -113,37 +120,71 @@ BOOL AOStandTimer::tick()
113 120
114// ------------------------------------------------------- 121// -------------------------------------------------------
115 122
123BOOL AOInvTimer::sInitialized = FALSE;
124
116AOInvTimer::AOInvTimer() : LLEventTimer( (F32)1.0 ) 125AOInvTimer::AOInvTimer() : LLEventTimer( (F32)1.0 )
117{ 126{
127 // if we can't find the item we need, start the init timer
128 // background inventory fetching has already begun in llstartup -- MC
129 if (LLStartUp::getStartupState() == STATE_STARTED)
130 {
131 LLUUID ao_notecard = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID");
132 if (ao_notecard.notNull())
133 {
134 const LLInventoryItem* item = gInventory.getItem(ao_notecard);
135 if (!item)
136 {
137 sInitTimer.start();
138 sInitTimer.setTimerExpirySec(10.0f);
139 }
140 else
141 {
142 sInitialized = LLFloaterAO::init();
143 if (!sInitialized) // should never happen, but just in case -- MC
144 {
145 sInitTimer.start();
146 sInitTimer.setTimerExpirySec(10.0f);
147 }
148 }
149 }
150 }
118} 151}
152
119AOInvTimer::~AOInvTimer() 153AOInvTimer::~AOInvTimer()
120{ 154{
121} 155}
122 156
123BOOL AOInvTimer::fullfetch = FALSE;
124
125BOOL AOInvTimer::tick() 157BOOL AOInvTimer::tick()
126{ 158{
127 if (!(gSavedSettings.getBOOL("AOEnabled"))) return TRUE; 159 /*if (!(gSavedSettings.getBOOL("AOEnabled")))
128 if(LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) 160 {
161 return TRUE;
162 }*/
163
164 if (gInventory.isEverythingFetched())
129 { 165 {
130 if(gInventory.isEverythingFetched()) 166 if (!sInitialized)
131 { 167 {
132// cmdline_printchat("Inventory fetched, loading AO.");
133 LLFloaterAO::init(); 168 LLFloaterAO::init();
134 return TRUE; 169 sInitialized = TRUE; // this can happen even if we can't initialize the AO -- MC
135 }else 170 }
171
172 if (sInitTimer.getStarted())
136 { 173 {
137 //static BOOL startedfetch = FALSE; 174 sInitTimer.stop();
138 if(fullfetch == FALSE)
139 {
140 fullfetch = TRUE;
141 //no choice, can't move the AO till we find it, should only have to happen once
142 gInventory.startBackgroundFetch();
143 }
144 } 175 }
145 } 176 }
146 return FALSE; 177
178 if (!sInitialized && LLStartUp::getStartupState() == STATE_STARTED)
179 {
180 if (sInitTimer.hasExpired())
181 {
182 sInitTimer.start();
183 sInitTimer.setTimerExpirySec(10.0f);
184 sInitialized = LLFloaterAO::init();
185 }
186 }
187 return sInitialized;
147} 188}
148// NC DROP ------------------------------------------------------- 189// NC DROP -------------------------------------------------------
149 190
@@ -210,40 +251,40 @@ BOOL AONoteCardDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
210 return handled; 251 return handled;
211} 252}
212 253
213AONoteCardDropTarget * LLFloaterAO::mAOItemDropTarget; 254AONoteCardDropTarget * LLFloaterAO::sAOItemDropTarget;
214 255
215 256
216// STUFF ------------------------------------------------------- 257// STUFF -------------------------------------------------------
217 258
218int LLFloaterAO::mAnimationState = 0; 259S32 LLFloaterAO::sAnimationState = 0;
219int LLFloaterAO::stand_iterator = 0; 260S32 LLFloaterAO::stand_iterator = 0;
220 261
221LLUUID LLFloaterAO::invfolderid = LLUUID::null; 262LLUUID LLFloaterAO::invfolderid = LLUUID::null;
222LLUUID LLFloaterAO::mCurrentStandId = LLUUID::null; 263LLUUID LLFloaterAO::sCurrentStandId = LLUUID::null;
223 264
224LLComboBox* mcomboBox_stands; 265LLComboBox* mComboBox_stands;
225LLComboBox* mcomboBox_walks; 266LLComboBox* mComboBox_walks;
226LLComboBox* mcomboBox_runs; 267LLComboBox* mComboBox_runs;
227LLComboBox* mcomboBox_jumps; 268LLComboBox* mComboBox_jumps;
228LLComboBox* mcomboBox_sits; 269LLComboBox* mComboBox_sits;
229LLComboBox* mcomboBox_gsits; 270LLComboBox* mComboBox_gsits;
230LLComboBox* mcomboBox_crouchs; 271LLComboBox* mComboBox_crouchs;
231LLComboBox* mcomboBox_cwalks; 272LLComboBox* mComboBox_cwalks;
232LLComboBox* mcomboBox_falls; 273LLComboBox* mComboBox_falls;
233LLComboBox* mcomboBox_hovers; 274LLComboBox* mComboBox_hovers;
234LLComboBox* mcomboBox_flys; 275LLComboBox* mComboBox_flys;
235LLComboBox* mcomboBox_flyslows; 276LLComboBox* mComboBox_flyslows;
236LLComboBox* mcomboBox_flyups; 277LLComboBox* mComboBox_flyups;
237LLComboBox* mcomboBox_flydowns; 278LLComboBox* mComboBox_flydowns;
238LLComboBox* mcomboBox_lands; 279LLComboBox* mComboBox_lands;
239LLComboBox* mcomboBox_standups; 280LLComboBox* mComboBox_standups;
240LLComboBox* mcomboBox_prejumps; 281LLComboBox* mComboBox_prejumps;
241 282
242struct struct_overrides 283struct struct_overrides
243{ 284{
244 LLUUID orig_id; 285 LLUUID orig_id;
245 LLUUID ao_id; 286 LLUUID ao_id;
246 int state; 287 S32 state;
247}; 288};
248std::vector<struct_overrides> mAOOverrides; 289std::vector<struct_overrides> mAOOverrides;
249 290
@@ -257,14 +298,16 @@ std::vector<struct_stands> mAOStands;
257struct struct_tokens 298struct struct_tokens
258{ 299{
259 std::string token; 300 std::string token;
260 int state; 301 S32 state;
261}; 302};
262std::vector<struct_tokens> mAOTokens; 303std::vector<struct_tokens> mAOTokens;
263 304
264LLFloaterAO* LLFloaterAO::sInstance = NULL; 305LLFloaterAO* LLFloaterAO::sInstance = NULL;
265 306
266LLFloaterAO::LLFloaterAO() 307LLFloaterAO::LLFloaterAO()
267:LLFloater(std::string("floater_ao")) 308 :
309 LLFloater(std::string("floater_ao")),
310 mDirty(FALSE)
268{ 311{
269// init(); 312// init();
270 llassert_always(sInstance == NULL); 313 llassert_always(sInstance == NULL);
@@ -275,80 +318,55 @@ LLFloaterAO::LLFloaterAO()
275LLFloaterAO::~LLFloaterAO() 318LLFloaterAO::~LLFloaterAO()
276{ 319{
277 sInstance=NULL; 320 sInstance=NULL;
278 mcomboBox_stands = 0; 321 mComboBox_stands = 0;
279 mcomboBox_walks = 0; 322 mComboBox_walks = 0;
280 mcomboBox_runs = 0; 323 mComboBox_runs = 0;
281 mcomboBox_jumps = 0; 324 mComboBox_jumps = 0;
282 mcomboBox_sits = 0; 325 mComboBox_sits = 0;
283 mcomboBox_gsits = 0; 326 mComboBox_gsits = 0;
284 mcomboBox_crouchs = 0; 327 mComboBox_crouchs = 0;
285 mcomboBox_cwalks = 0; 328 mComboBox_cwalks = 0;
286 mcomboBox_falls = 0; 329 mComboBox_falls = 0;
287 mcomboBox_hovers = 0; 330 mComboBox_hovers = 0;
288 mcomboBox_flys = 0; 331 mComboBox_flys = 0;
289 mcomboBox_flyslows = 0; 332 mComboBox_flyslows = 0;
290 mcomboBox_flyups = 0; 333 mComboBox_flyups = 0;
291 mcomboBox_flydowns = 0; 334 mComboBox_flydowns = 0;
292 mcomboBox_lands = 0; 335 mComboBox_lands = 0;
293 mcomboBox_standups = 0; 336 mComboBox_standups = 0;
294 mcomboBox_prejumps = 0; 337 mComboBox_prejumps = 0;
295 delete mAOItemDropTarget; 338 delete sAOItemDropTarget;
296 mAOItemDropTarget = NULL; 339 sAOItemDropTarget = NULL;
297// llinfos << "floater destroyed" << llendl; 340// llinfos << "floater destroyed" << llendl;
298} 341}
299 342
300void LLFloaterAO::show(void*)
301{
302 if (!sInstance)
303 {
304 sInstance = new LLFloaterAO();
305 updateLayout(sInstance);
306 init();
307
308 sInstance->open();
309 }
310 else
311 {
312 sInstance->close();
313 }
314 LLFirstUse::useAO();
315}
316
317bool LLFloaterAO::getInstance()
318{
319 if (sInstance)
320 return true;
321 else
322 return false;
323}
324
325BOOL LLFloaterAO::postBuild() 343BOOL LLFloaterAO::postBuild()
326{ 344{
327 LLView *target_view = getChild<LLView>("ao_notecard"); 345 LLView *target_view = getChild<LLView>("ao_notecard");
328 if(target_view) 346 if (target_view)
329 { 347 {
330 if (mAOItemDropTarget) 348 if (sAOItemDropTarget)
331 { 349 {
332 delete mAOItemDropTarget; 350 delete sAOItemDropTarget;
333 } 351 }
334 mAOItemDropTarget = new AONoteCardDropTarget("drop target", target_view->getRect(), AOItemDrop);//, mAvatarID); 352 sAOItemDropTarget = new AONoteCardDropTarget("drop target", target_view->getRect(), AOItemDrop);//, mAvatarID);
335 addChild(mAOItemDropTarget); 353 addChild(sAOItemDropTarget);
336 } 354 }
337 if(LLStartUp::getStartupState() == STATE_STARTED) 355 if (LLStartUp::getStartupState() == STATE_STARTED)
338 { 356 {
339 LLUUID itemidimport = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); 357 LLUUID itemidimport = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID");
340 LLViewerInventoryItem* itemimport = gInventory.getItem(itemidimport); 358 LLViewerInventoryItem* itemimport = gInventory.getItem(itemidimport);
341 if(itemimport) 359 if (itemimport)
342 { 360 {
343 childSetValue("ao_nc_text","Currently set to: "+itemimport->getName()); 361 childSetValue("ao_nc_text","Currently set to: "+itemimport->getName());
344 } 362 }
345 else if(itemidimport.isNull()) 363 else if (itemidimport.isNull())
346 { 364 {
347 childSetValue("ao_nc_text","Currently not set"); 365 childSetValue("ao_nc_text","Currently not set");
348 } 366 }
349 else 367 else
350 { 368 {
351 childSetValue("ao_nc_text","Currently set to a item not on this account"); 369 childSetValue("ao_nc_text","Currently not loaded");
352 } 370 }
353 } 371 }
354 else 372 else
@@ -366,23 +384,23 @@ BOOL LLFloaterAO::postBuild()
366 childSetCommitCallback("AOEnabled",onClickToggleAO); 384 childSetCommitCallback("AOEnabled",onClickToggleAO);
367 childSetCommitCallback("AOSitsEnabled",onClickToggleSits); 385 childSetCommitCallback("AOSitsEnabled",onClickToggleSits);
368 childSetCommitCallback("standtime",onSpinnerCommit); 386 childSetCommitCallback("standtime",onSpinnerCommit);
369 mcomboBox_stands = getChild<LLComboBox>("stands"); 387 mComboBox_stands = getChild<LLComboBox>("stands");
370 mcomboBox_walks = getChild<LLComboBox>("walks"); 388 mComboBox_walks = getChild<LLComboBox>("walks");
371 mcomboBox_runs = getChild<LLComboBox>("runs"); 389 mComboBox_runs = getChild<LLComboBox>("runs");
372 mcomboBox_jumps = getChild<LLComboBox>("jumps"); 390 mComboBox_jumps = getChild<LLComboBox>("jumps");
373 mcomboBox_sits = getChild<LLComboBox>("sits"); 391 mComboBox_sits = getChild<LLComboBox>("sits");
374 mcomboBox_gsits = getChild<LLComboBox>("gsits"); 392 mComboBox_gsits = getChild<LLComboBox>("gsits");
375 mcomboBox_crouchs = getChild<LLComboBox>("crouchs"); 393 mComboBox_crouchs = getChild<LLComboBox>("crouchs");
376 mcomboBox_cwalks = getChild<LLComboBox>("cwalks"); 394 mComboBox_cwalks = getChild<LLComboBox>("cwalks");
377 mcomboBox_falls = getChild<LLComboBox>("falls"); 395 mComboBox_falls = getChild<LLComboBox>("falls");
378 mcomboBox_hovers = getChild<LLComboBox>("hovers"); 396 mComboBox_hovers = getChild<LLComboBox>("hovers");
379 mcomboBox_flys = getChild<LLComboBox>("flys"); 397 mComboBox_flys = getChild<LLComboBox>("flys");
380 mcomboBox_flyslows = getChild<LLComboBox>("flyslows"); 398 mComboBox_flyslows = getChild<LLComboBox>("flyslows");
381 mcomboBox_flyups = getChild<LLComboBox>("flyups"); 399 mComboBox_flyups = getChild<LLComboBox>("flyups");
382 mcomboBox_flydowns = getChild<LLComboBox>("flydowns"); 400 mComboBox_flydowns = getChild<LLComboBox>("flydowns");
383 mcomboBox_lands = getChild<LLComboBox>("lands"); 401 mComboBox_lands = getChild<LLComboBox>("lands");
384 mcomboBox_standups = getChild<LLComboBox>("standups"); 402 mComboBox_standups = getChild<LLComboBox>("standups");
385 mcomboBox_prejumps = getChild<LLComboBox>("prejumps"); 403 mComboBox_prejumps = getChild<LLComboBox>("prejumps");
386 getChild<LLComboBox>("stands")->setCommitCallback(onComboBoxCommit); 404 getChild<LLComboBox>("stands")->setCommitCallback(onComboBoxCommit);
387 getChild<LLComboBox>("walks")->setCommitCallback(onComboBoxCommit); 405 getChild<LLComboBox>("walks")->setCommitCallback(onComboBoxCommit);
388 getChild<LLComboBox>("runs")->setCommitCallback(onComboBoxCommit); 406 getChild<LLComboBox>("runs")->setCommitCallback(onComboBoxCommit);
@@ -404,10 +422,49 @@ BOOL LLFloaterAO::postBuild()
404 return TRUE; 422 return TRUE;
405} 423}
406 424
425// static
426void LLFloaterAO::show(void*)
427{
428 if (!sInstance)
429 {
430 sInstance = new LLFloaterAO();
431 updateLayout(sInstance);
432 init();
433
434 sInstance->open();
435 }
436 else
437 {
438 sInstance->close();
439 }
440 LLFirstUse::useAO();
441}
442
443// static
444LLFloaterAO* LLFloaterAO::getInstance()
445{
446 if (!sInstance)
447 {
448 sInstance = new LLFloaterAO();
449 }
450 return sInstance;
451}
452
453// static
454bool LLFloaterAO::getVisible()
455{
456 if (sInstance)
457 {
458 return true;
459 }
460 return false;
461}
462
463// static
407void LLFloaterAO::onSpinnerCommit(LLUICtrl* ctrl, void* userdata) 464void LLFloaterAO::onSpinnerCommit(LLUICtrl* ctrl, void* userdata)
408{ 465{
409 LLSpinCtrl* spin = (LLSpinCtrl*) ctrl; 466 LLSpinCtrl* spin = (LLSpinCtrl*)ctrl;
410 if(spin) 467 if (spin)
411 { 468 {
412 if (spin->getName() == "standtime") 469 if (spin->getName() == "standtime")
413 { 470 {
@@ -416,10 +473,11 @@ void LLFloaterAO::onSpinnerCommit(LLUICtrl* ctrl, void* userdata)
416 } 473 }
417} 474}
418 475
476// static
419void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) 477void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata)
420{ 478{
421 LLComboBox* box = (LLComboBox*)ctrl; 479 LLComboBox* box = (LLComboBox*)ctrl;
422 if(box) 480 if (box)
423 { 481 {
424 if (box->getName() == "stands") 482 if (box->getName() == "stands")
425 { 483 {
@@ -429,7 +487,7 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata)
429 } 487 }
430 else 488 else
431 { 489 {
432 int state = STATE_AGENT_IDLE; 490 S32 state = STATE_AGENT_IDLE;
433 std::string stranim = box->getValue().asString(); 491 std::string stranim = box->getValue().asString();
434// llinfos << "state " << (gAgent.getAvatarObject()->mIsSitting) << " - " << getAnimationState() << llendl; 492// llinfos << "state " << (gAgent.getAvatarObject()->mIsSitting) << " - " << getAnimationState() << llendl;
435 if (box->getName() == "walks") 493 if (box->getName() == "walks")
@@ -556,6 +614,7 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata)
556 } 614 }
557} 615}
558 616
617// static
559void LLFloaterAO::updateLayout(LLFloaterAO* floater) 618void LLFloaterAO::updateLayout(LLFloaterAO* floater)
560{ 619{
561 if (floater) 620 if (floater)
@@ -613,8 +672,10 @@ void LLFloaterAO::updateLayout(LLFloaterAO* floater)
613 } 672 }
614} 673}
615 674
616void LLFloaterAO::init() 675// static
676bool LLFloaterAO::init()
617{ 677{
678 //cmdline_printchat("init() called");
618 mAOStands.clear(); 679 mAOStands.clear();
619 mAOTokens.clear(); 680 mAOTokens.clear();
620 mAOOverrides.clear(); 681 mAOOverrides.clear();
@@ -673,82 +734,87 @@ void LLFloaterAO::init()
673 overrideloader.orig_id = ANIM_AGENT_FLY; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FLY; mAOOverrides.push_back(overrideloader); 734 overrideloader.orig_id = ANIM_AGENT_FLY; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FLY; mAOOverrides.push_back(overrideloader);
674 overrideloader.orig_id = ANIM_AGENT_FLYSLOW; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FLYSLOW; mAOOverrides.push_back(overrideloader); 735 overrideloader.orig_id = ANIM_AGENT_FLYSLOW; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FLYSLOW; mAOOverrides.push_back(overrideloader);
675 736
676 BOOL success = TRUE; 737 BOOL success = FALSE;
677 738
678 if(LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) 739 if (LLStartUp::getStartupState() >= STATE_INVENTORY_SEND)
679 { 740 {
680 if(gInventory.isEverythingFetched()) 741 LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID");
742 if (configncitem.notNull())
681 { 743 {
682 LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); 744 const LLInventoryItem* item = gInventory.getItem(configncitem);
683 if (configncitem.notNull()) 745 if (item)
684 { 746 {
685 success = FALSE; 747 if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike())
686 const LLInventoryItem* item = gInventory.getItem(configncitem);
687 if(item)
688 { 748 {
689 if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) 749 if (!item->getAssetUUID().isNull())
690 { 750 {
691 if(!item->getAssetUUID().isNull()) 751 LLUUID* new_uuid = new LLUUID(configncitem);
692 { 752 LLHost source_sim = LLHost::invalid;
693 LLUUID* new_uuid = new LLUUID(configncitem); 753 invfolderid = item->getParentUUID();
694 LLHost source_sim = LLHost::invalid; 754 gAssetStorage->getInvItemAsset(source_sim,
695 invfolderid = item->getParentUUID(); 755 gAgent.getID(),
696 gAssetStorage->getInvItemAsset(source_sim, 756 gAgent.getSessionID(),
697 gAgent.getID(), 757 item->getPermissions().getOwner(),
698 gAgent.getSessionID(), 758 LLUUID::null,
699 item->getPermissions().getOwner(), 759 item->getUUID(),
700 LLUUID::null, 760 item->getAssetUUID(),
701 item->getUUID(), 761 item->getType(),
702 item->getAssetUUID(), 762 &onNotecardLoadComplete,
703 item->getType(), 763 (void*)new_uuid,
704 &onNotecardLoadComplete, 764 TRUE);
705 (void*)new_uuid, 765 success = TRUE;
706 TRUE);
707 success = TRUE;
708 }
709 } 766 }
710 } 767 }
711 } 768 }
769 else // item
770 {
771 //cmdline_printchat("no item (notecard)");
772 }
712 } 773 }
713 } 774 }
714 775 else // notecard null
715 if (!success)
716 { 776 {
717 cmdline_printchat("Could not read the specified Config Notecard"); 777 //cmdline_printchat("Config Notecard set to a null UUID!");
718 } 778 }
719 779
720// mAnimationState = 0; 780// sAnimationState = 0;
721// mCurrentStandId = LLUUID::null; 781// sCurrentStandId = LLUUID::null;
722// setAnimationState(STATE_AGENT_IDLE); 782// setAnimationState(STATE_AGENT_IDLE);
723 783
784 return success;
724} 785}
725 786
787// static
726void LLFloaterAO::onClickMore(void* data) 788void LLFloaterAO::onClickMore(void* data)
727{ 789{
728 gSavedSettings.setBOOL( "AOAdvanced", TRUE ); 790 gSavedSettings.setBOOL( "AOAdvanced", TRUE );
729 updateLayout(sInstance); 791 updateLayout(sInstance);
730} 792}
793
794// static
731void LLFloaterAO::onClickLess(void* data) 795void LLFloaterAO::onClickLess(void* data)
732{ 796{
733 gSavedSettings.setBOOL( "AOAdvanced", FALSE ); 797 gSavedSettings.setBOOL( "AOAdvanced", FALSE );
734 updateLayout(sInstance); 798 updateLayout(sInstance);
735} 799}
736 800
801// static
737void LLFloaterAO::onClickToggleAO(LLUICtrl *, void*) 802void LLFloaterAO::onClickToggleAO(LLUICtrl *, void*)
738{ 803{
739 run(); 804 run();
740} 805}
741 806
807// static
742void LLFloaterAO::onClickToggleSits(LLUICtrl *, void*) 808void LLFloaterAO::onClickToggleSits(LLUICtrl *, void*)
743{ 809{
744 run(); 810 run();
745} 811}
746 812
747 813// static
748void LLFloaterAO::run() 814void LLFloaterAO::run()
749{ 815{
750 setAnimationState(STATE_AGENT_IDLE); // reset state 816 setAnimationState(STATE_AGENT_IDLE); // reset state
751 int state = getAnimationState(); // check if sitting or hovering 817 S32 state = getAnimationState(); // check if sitting or hovering
752 if ((state == STATE_AGENT_IDLE) || (state == STATE_AGENT_STAND)) 818 if ((state == STATE_AGENT_IDLE) || (state == STATE_AGENT_STAND))
753 { 819 {
754 if (gSavedSettings.getBOOL("AOEnabled")) 820 if (gSavedSettings.getBOOL("AOEnabled"))
@@ -771,98 +837,158 @@ void LLFloaterAO::run()
771 } 837 }
772 else 838 else
773 { 839 {
774 if (state == STATE_AGENT_SIT) gAgent.sendAnimationRequest(GetAnimIDFromState(state), (gSavedSettings.getBOOL("AOEnabled") && gSavedSettings.getBOOL("AOSitsEnabled")) ? ANIM_REQUEST_START : ANIM_REQUEST_STOP); 840 if (state == STATE_AGENT_SIT)
775 else gAgent.sendAnimationRequest(GetAnimIDFromState(state), gSavedSettings.getBOOL("AOEnabled") ? ANIM_REQUEST_START : ANIM_REQUEST_STOP); 841 {
842 gAgent.sendAnimationRequest(GetAnimIDFromState(state), (gSavedSettings.getBOOL("AOEnabled") && gSavedSettings.getBOOL("AOSitsEnabled")) ? ANIM_REQUEST_START : ANIM_REQUEST_STOP);
843 }
844 else
845 {
846 gAgent.sendAnimationRequest(GetAnimIDFromState(state), gSavedSettings.getBOOL("AOEnabled") ? ANIM_REQUEST_START : ANIM_REQUEST_STOP);
847 }
776 } 848 }
777} 849}
778 850
779int LLFloaterAO::getAnimationState() 851// static
852S32 LLFloaterAO::getAnimationState()
780{ 853{
781 if (gAgent.getAvatarObject()) 854 if (gAgent.getAvatarObject())
782 { 855 {
783 if (gAgent.getAvatarObject()->mIsSitting) setAnimationState(STATE_AGENT_SIT); 856 if (gAgent.getAvatarObject()->mIsSitting)
784 else if (gAgent.getFlying()) setAnimationState(STATE_AGENT_HOVER); 857 {
858 setAnimationState(STATE_AGENT_SIT);
859 }
860 else if (gAgent.getFlying())
861 {
862 setAnimationState(STATE_AGENT_HOVER);
863 }
785 } 864 }
786 return mAnimationState; 865 return sAnimationState;
787} 866}
788 867
789void LLFloaterAO::setAnimationState(const int state) 868// static
869void LLFloaterAO::setAnimationState(const S32 state)
790{ 870{
791 mAnimationState = state; 871 sAnimationState = state;
792} 872}
793 873
874// static
794LLUUID LLFloaterAO::getCurrentStandId() 875LLUUID LLFloaterAO::getCurrentStandId()
795{ 876{
796 return mCurrentStandId; 877 return sCurrentStandId;
797} 878}
798 879
880// static
799void LLFloaterAO::setCurrentStandId(const LLUUID& id) 881void LLFloaterAO::setCurrentStandId(const LLUUID& id)
800{ 882{
801 mCurrentStandId = id; 883 sCurrentStandId = id;
802} 884}
803 885
886// static
804void LLFloaterAO::AOItemDrop(LLViewerInventoryItem* item) 887void LLFloaterAO::AOItemDrop(LLViewerInventoryItem* item)
805{ 888{
806 gSavedPerAccountSettings.setString("AOConfigNotecardID", item->getUUID().asString()); 889 gSavedPerAccountSettings.setString("AOConfigNotecardID", item->getUUID().asString());
807 sInstance->childSetValue("ao_nc_text","Currently set to: "+item->getName()); 890 sInstance->childSetValue("ao_nc_text","Currently set to: "+item->getName());
808} 891}
809 892
893// static
810LLUUID LLFloaterAO::GetAnimID(const LLUUID& id) 894LLUUID LLFloaterAO::GetAnimID(const LLUUID& id)
811{ 895{
812 for (std::vector<struct_overrides>::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) 896 for (std::vector<struct_overrides>::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter)
813 { 897 {
814 if (iter->orig_id == id) return iter->ao_id; 898 if (iter->orig_id == id)
899 {
900 return iter->ao_id;
901 }
815 } 902 }
816 return LLUUID::null; 903 return LLUUID::null;
817} 904}
818 905
819int LLFloaterAO::GetStateFromAnimID(const LLUUID& id) 906// static
907S32 LLFloaterAO::GetStateFromAnimID(const LLUUID& id)
820{ 908{
821 for (std::vector<struct_overrides>::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) 909 for (std::vector<struct_overrides>::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter)
822 { 910 {
823 if (iter->orig_id == id) return iter->state; 911 if (iter->orig_id == id)
912 {
913 return iter->state;
914 }
824 } 915 }
825 return STATE_AGENT_IDLE; 916 return STATE_AGENT_IDLE;
826} 917}
827 918
828LLUUID LLFloaterAO::GetAnimIDFromState(const int state) 919// static
920LLUUID LLFloaterAO::GetAnimIDFromState(const S32 state)
829{ 921{
830 for (std::vector<struct_overrides>::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) 922 for (std::vector<struct_overrides>::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter)
831 { 923 {
832 if (iter->state == state) return iter->ao_id; 924 if (iter->state == state)
925 {
926 return iter->ao_id;
927 }
833 } 928 }
834 return LLUUID::null; 929 return LLUUID::null;
835} 930}
836 931
837int LLFloaterAO::GetStateFromToken(std::string strtoken) 932// static
933S32 LLFloaterAO::GetStateFromToken(std::string strtoken)
838{ 934{
839 for (std::vector<struct_tokens>::iterator iter = mAOTokens.begin(); iter != mAOTokens.end(); ++iter) 935 for (std::vector<struct_tokens>::iterator iter = mAOTokens.begin(); iter != mAOTokens.end(); ++iter)
840 { 936 {
841 if (iter->token == strtoken) return iter->state; 937 if (iter->token == strtoken)
938 {
939 return iter->state;
940 }
842 } 941 }
843 return STATE_AGENT_IDLE; 942 return STATE_AGENT_IDLE;
844} 943}
845 944
945// static
846void LLFloaterAO::onClickPrevStand(void* user_data) 946void LLFloaterAO::onClickPrevStand(void* user_data)
847{ 947{
848 if (!(mAOStands.size() > 0)) return; 948 if (!(mAOStands.size() > 0))
849 stand_iterator=stand_iterator-1; 949 {
850 if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); 950 return;
851 if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0; 951 }
952
953 stand_iterator = stand_iterator-1;
954
955 if (stand_iterator < 0)
956 {
957 stand_iterator = S32( mAOStands.size()-stand_iterator);
958 }
959 if (stand_iterator > S32( mAOStands.size()-1))
960 {
961 stand_iterator = 0;
962 }
963
852 cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str())); 964 cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str()));
853 ChangeStand(); 965 ChangeStand();
854} 966}
855 967
968// static
856void LLFloaterAO::onClickNextStand(void* user_data) 969void LLFloaterAO::onClickNextStand(void* user_data)
857{ 970{
858 if (!(mAOStands.size() > 0)) return; 971 if (!(mAOStands.size() > 0))
859 stand_iterator=stand_iterator+1; 972 {
860 if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); 973 return;
861 if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0; 974 }
975
976 stand_iterator = stand_iterator+1;
977
978 if (stand_iterator < 0)
979 {
980 stand_iterator = S32( mAOStands.size()-stand_iterator);
981 }
982 if (stand_iterator > S32( mAOStands.size()-1))
983 {
984 stand_iterator = 0;
985 }
986
862 cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str())); 987 cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str()));
863 ChangeStand(); 988 ChangeStand();
864} 989}
865 990
991// static
866BOOL LLFloaterAO::ChangeStand() 992BOOL LLFloaterAO::ChangeStand()
867{ 993{
868 if (gSavedSettings.getBOOL("AOEnabled")) 994 if (gSavedSettings.getBOOL("AOEnabled"))
@@ -881,17 +1007,32 @@ BOOL LLFloaterAO::ChangeStand()
881 } 1007 }
882 if ((getAnimationState() == STATE_AGENT_IDLE) || (getAnimationState() == STATE_AGENT_STAND))// stands have lowest priority 1008 if ((getAnimationState() == STATE_AGENT_IDLE) || (getAnimationState() == STATE_AGENT_STAND))// stands have lowest priority
883 { 1009 {
884 if (!(mAOStands.size() > 0)) return TRUE; 1010 if (!(mAOStands.size() > 0))
1011 {
1012 return TRUE;
1013 }
1014
885 if (gSavedSettings.getBOOL("AOStandRandomize")) 1015 if (gSavedSettings.getBOOL("AOStandRandomize"))
886 { 1016 {
887 stand_iterator = ll_rand(mAOStands.size()-1); 1017 stand_iterator = ll_rand(mAOStands.size()-1);
888 } 1018 }
889 if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator);
890 if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0;
891 1019
892 int stand_iterator_previous = stand_iterator -1; 1020 if (stand_iterator < 0)
1021 {
1022 stand_iterator = S32( mAOStands.size()-stand_iterator);
1023 }
1024
1025 if (stand_iterator > S32( mAOStands.size()-1))
1026 {
1027 stand_iterator = 0;
1028 }
1029
1030 S32 stand_iterator_previous = stand_iterator -1;
893 1031
894 if (stand_iterator_previous < 0) stand_iterator_previous = int( mAOStands.size()-1); 1032 if (stand_iterator_previous < 0)
1033 {
1034 stand_iterator_previous = S32( mAOStands.size()-1);
1035 }
895 1036
896 if (mAOStands[stand_iterator].ao_id.notNull()) 1037 if (mAOStands[stand_iterator].ao_id.notNull())
897 { 1038 {
@@ -900,7 +1041,10 @@ BOOL LLFloaterAO::ChangeStand()
900 1041
901 setAnimationState(STATE_AGENT_STAND); 1042 setAnimationState(STATE_AGENT_STAND);
902 setCurrentStandId(mAOStands[stand_iterator].ao_id); 1043 setCurrentStandId(mAOStands[stand_iterator].ao_id);
903 if ((sInstance)&&(mcomboBox_stands)) mcomboBox_stands->selectNthItem(stand_iterator); 1044 if (sInstance && mComboBox_stands)
1045 {
1046 mComboBox_stands->selectNthItem(stand_iterator);
1047 }
904// llinfos << "changing stand to " << mAOStands[stand_iterator].anim_name << llendl; 1048// llinfos << "changing stand to " << mAOStands[stand_iterator].anim_name << llendl;
905 return FALSE; 1049 return FALSE;
906 } 1050 }
@@ -926,7 +1070,10 @@ BOOL LLFloaterAO::startMotion(const LLUUID& id, F32 time_offset, BOOL stand)
926 { 1070 {
927 sitting = gAgent.getAvatarObject()->mIsSitting; 1071 sitting = gAgent.getAvatarObject()->mIsSitting;
928 } 1072 }
929 if (sitting) return FALSE; 1073 if (sitting)
1074 {
1075 return FALSE;
1076 }
930 gAgent.sendAnimationRequest(id, ANIM_REQUEST_START); 1077 gAgent.sendAnimationRequest(id, ANIM_REQUEST_START);
931 return TRUE; 1078 return TRUE;
932 } 1079 }
@@ -939,7 +1086,10 @@ BOOL LLFloaterAO::startMotion(const LLUUID& id, F32 time_offset, BOOL stand)
939 setAnimationState(GetStateFromAnimID(id)); 1086 setAnimationState(GetStateFromAnimID(id));
940 1087
941// llinfos << " state " << getAnimationState() << " start anim " << id << " overriding with " << GetAnimID(id) << llendl; 1088// llinfos << " state " << getAnimationState() << " start anim " << id << " overriding with " << GetAnimID(id) << llendl;
942 if ((GetStateFromAnimID(id) == STATE_AGENT_SIT) && !(gSavedSettings.getBOOL("AOSitsEnabled"))) return TRUE; 1089 if ((GetStateFromAnimID(id) == STATE_AGENT_SIT) && !(gSavedSettings.getBOOL("AOSitsEnabled")))
1090 {
1091 return TRUE;
1092 }
943 gAgent.sendAnimationRequest(GetAnimID(id), ANIM_REQUEST_START); 1093 gAgent.sendAnimationRequest(GetAnimID(id), ANIM_REQUEST_START);
944 return TRUE; 1094 return TRUE;
945 } 1095 }
@@ -972,35 +1122,36 @@ BOOL LLFloaterAO::stopMotion(const LLUUID& id, BOOL stop_immediate, BOOL stand)
972 return FALSE; 1122 return FALSE;
973} 1123}
974 1124
1125// static
975void LLFloaterAO::onClickReloadCard(void* user_data) 1126void LLFloaterAO::onClickReloadCard(void* user_data)
976{ 1127{
977 if(gInventory.isEverythingFetched()) 1128 LLFloaterAO::init();
978 {
979 LLFloaterAO::init();
980 }
981} 1129}
982 1130
1131// static
983void LLFloaterAO::onClickOpenCard(void* user_data) 1132void LLFloaterAO::onClickOpenCard(void* user_data)
984{ 1133{
985 if(gInventory.isEverythingFetched()) 1134 LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID");
1135 if (configncitem.notNull())
986 { 1136 {
987 LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); 1137 const LLInventoryItem* item = gInventory.getItem(configncitem);
988 if (configncitem.notNull()) 1138 if (item)
989 { 1139 {
990 const LLInventoryItem* item = gInventory.getItem(configncitem); 1140 if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike())
991 if(item)
992 { 1141 {
993 if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) 1142 if(!item->getAssetUUID().isNull())
994 { 1143 open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE);
995 if(!item->getAssetUUID().isNull()) 1144// open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE, LLUUID::null, FALSE);
996 open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE);
997 // open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE, LLUUID::null, FALSE);
998 }
999 } 1145 }
1000 } 1146 }
1147 else
1148 {
1149 cmdline_printchat("Could not find notecard UUID " + configncitem.asString() + " in your inventory. Make sure your inventory is fully loaded and try again.");
1150 }
1001 } 1151 }
1002} 1152}
1003 1153
1154// static
1004void LLFloaterAO::onClickNewCard(void* user_data) 1155void LLFloaterAO::onClickNewCard(void* user_data)
1005{ 1156{
1006 // load the template file from app_settings/ao_template.ini then 1157 // load the template file from app_settings/ao_template.ini then
@@ -1026,15 +1177,16 @@ struct AOAssetInfo
1026 std::string name; 1177 std::string name;
1027}; 1178};
1028 1179
1180// static
1029void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status) 1181void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status)
1030{ 1182{
1031 if(status == LL_ERR_NOERR) 1183 if (status == LL_ERR_NOERR)
1032 { 1184 {
1033 S32 size = vfs->getSize(asset_uuid, type); 1185 S32 size = vfs->getSize(asset_uuid, type);
1034 U8* buffer = new U8[size]; 1186 U8* buffer = new U8[size];
1035 vfs->getData(asset_uuid, type, buffer, 0, size); 1187 vfs->getData(asset_uuid, type, buffer, 0, size);
1036 1188
1037 if(type == LLAssetType::AT_NOTECARD) 1189 if (type == LLAssetType::AT_NOTECARD)
1038 { 1190 {
1039 LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,""); 1191 LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,"");
1040 if(edit->importBuffer((char*)buffer, (S32)size)) 1192 if(edit->importBuffer((char*)buffer, (S32)size))
@@ -1043,27 +1195,43 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA
1043 std::string card = edit->getText(); 1195 std::string card = edit->getText();
1044 edit->die(); 1196 edit->die();
1045 1197
1046 if (mcomboBox_stands) 1198 if (sInstance && mComboBox_stands)
1047 { 1199 {
1048 mcomboBox_stands->clear(); 1200 mComboBox_stands->clear();
1049 mcomboBox_stands->removeall(); 1201 mComboBox_stands->removeall();
1050 } 1202 }
1051 if (mcomboBox_walks) mcomboBox_walks->clear(); 1203 if (sInstance && mComboBox_walks)
1052 if (mcomboBox_runs) mcomboBox_runs->clear(); 1204 mComboBox_walks->clear();
1053 if (mcomboBox_jumps) mcomboBox_jumps->clear(); 1205 if (sInstance && mComboBox_runs)
1054 if (mcomboBox_sits) mcomboBox_sits->clear(); 1206 mComboBox_runs->clear();
1055 if (mcomboBox_gsits) mcomboBox_gsits->clear(); 1207 if (sInstance && mComboBox_jumps)
1056 if (mcomboBox_crouchs) mcomboBox_cwalks->clear(); 1208 mComboBox_jumps->clear();
1057 if (mcomboBox_cwalks) mcomboBox_cwalks->clear(); 1209 if (sInstance && mComboBox_sits)
1058 if (mcomboBox_falls) mcomboBox_falls->clear(); 1210 mComboBox_sits->clear();
1059 if (mcomboBox_hovers) mcomboBox_hovers->clear(); 1211 if (sInstance && mComboBox_gsits)
1060 if (mcomboBox_flys) mcomboBox_flys->clear(); 1212 mComboBox_gsits->clear();
1061 if (mcomboBox_flyslows) mcomboBox_flyslows->clear(); 1213 if (sInstance && mComboBox_crouchs)
1062 if (mcomboBox_flyups) mcomboBox_flyups->clear(); 1214 mComboBox_cwalks->clear();
1063 if (mcomboBox_flydowns) mcomboBox_flydowns->clear(); 1215 if (sInstance && mComboBox_cwalks)
1064 if (mcomboBox_lands) mcomboBox_lands->clear(); 1216 mComboBox_cwalks->clear();
1065 if (mcomboBox_standups) mcomboBox_standups->clear(); 1217 if (sInstance && mComboBox_falls)
1066 if (mcomboBox_prejumps) mcomboBox_prejumps->clear(); 1218 mComboBox_falls->clear();
1219 if (sInstance && mComboBox_hovers)
1220 mComboBox_hovers->clear();
1221 if (sInstance && mComboBox_flys)
1222 mComboBox_flys->clear();
1223 if (sInstance && mComboBox_flyslows)
1224 mComboBox_flyslows->clear();
1225 if (sInstance && mComboBox_flyups)
1226 mComboBox_flyups->clear();
1227 if (sInstance && mComboBox_flydowns)
1228 mComboBox_flydowns->clear();
1229 if (sInstance && mComboBox_lands)
1230 mComboBox_lands->clear();
1231 if (sInstance && mComboBox_standups)
1232 mComboBox_standups->clear();
1233 if (sInstance && mComboBox_prejumps)
1234 mComboBox_prejumps->clear();
1067 1235
1068 1236
1069 struct_stands loader; 1237 struct_stands loader;
@@ -1106,134 +1274,185 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA
1106 { 1274 {
1107 case STATE_AGENT_STAND: 1275 case STATE_AGENT_STAND:
1108 loader.ao_id = animid; loader.anim_name = stranim.c_str(); mAOStands.push_back(loader); 1276 loader.ao_id = animid; loader.anim_name = stranim.c_str(); mAOStands.push_back(loader);
1109 if(mcomboBox_stands != NULL) mcomboBox_stands->add(stranim.c_str(), ADD_BOTTOM, TRUE); 1277 if (sInstance && mComboBox_stands != NULL)
1278 {
1279 mComboBox_stands->add(stranim.c_str(), ADD_BOTTOM, TRUE);
1280 }
1110 break; 1281 break;
1111 case STATE_AGENT_WALK: 1282 case STATE_AGENT_WALK:
1112 { 1283 {
1113 if (sInstance && (mcomboBox_walks != NULL)) 1284 if (sInstance && mComboBox_walks != NULL)
1114 { 1285 {
1115 //llinfos << "1 anim: " << stranim.c_str() << " assetid: " << animid << llendl; 1286 //llinfos << "1 anim: " << stranim.c_str() << " assetid: " << animid << llendl;
1116 if (!(mcomboBox_walks->selectByValue(stranim.c_str()))) mcomboBox_walks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1287 if (!(mComboBox_walks->selectByValue(stranim.c_str())))
1288 {
1289 mComboBox_walks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1290 }
1117 } 1291 }
1118 } 1292 }
1119 break; 1293 break;
1120 case STATE_AGENT_RUN: 1294 case STATE_AGENT_RUN:
1121 { 1295 {
1122 if (sInstance && (mcomboBox_runs != NULL)) 1296 if (sInstance && mComboBox_runs != NULL)
1123 { 1297 {
1124 if (!(mcomboBox_runs->selectByValue(stranim.c_str()))) mcomboBox_runs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1298 if (!(mComboBox_runs->selectByValue(stranim.c_str())))
1299 {
1300 mComboBox_runs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1301 }
1125 } 1302 }
1126 } 1303 }
1127 break; 1304 break;
1128 case STATE_AGENT_JUMP: 1305 case STATE_AGENT_JUMP:
1129 { 1306 {
1130 if (sInstance && (mcomboBox_jumps != NULL)) 1307 if (sInstance && mComboBox_jumps != NULL)
1131 { 1308 {
1132 if (!(mcomboBox_jumps->selectByValue(stranim.c_str()))) mcomboBox_jumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1309 if (!(mComboBox_jumps->selectByValue(stranim.c_str())))
1310 {
1311 mComboBox_jumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1312 }
1133 } 1313 }
1134 } 1314 }
1135 break; 1315 break;
1136 case STATE_AGENT_SIT: 1316 case STATE_AGENT_SIT:
1137 { 1317 {
1138 if (sInstance && (mcomboBox_sits != NULL)) 1318 if (sInstance && mComboBox_sits != NULL)
1139 { 1319 {
1140 if (!(mcomboBox_sits->selectByValue(stranim.c_str()))) mcomboBox_sits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1320 if (!(mComboBox_sits->selectByValue(stranim.c_str())))
1321 {
1322 mComboBox_sits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1323 }
1141 } 1324 }
1142 } 1325 }
1143 break; 1326 break;
1144 case STATE_AGENT_GROUNDSIT: 1327 case STATE_AGENT_GROUNDSIT:
1145 { 1328 {
1146 if (sInstance && (mcomboBox_gsits != NULL)) 1329 if (sInstance && mComboBox_gsits != NULL)
1147 { 1330 {
1148 if (!(mcomboBox_gsits->selectByValue(stranim.c_str()))) mcomboBox_gsits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1331 if (!(mComboBox_gsits->selectByValue(stranim.c_str())))
1332 {
1333 mComboBox_gsits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1334 }
1149 } 1335 }
1150 } 1336 }
1151 break; 1337 break;
1152 case STATE_AGENT_CROUCH: 1338 case STATE_AGENT_CROUCH:
1153 { 1339 {
1154 if (sInstance && (mcomboBox_crouchs != NULL)) 1340 if (sInstance && mComboBox_crouchs != NULL)
1155 { 1341 {
1156 if (!(mcomboBox_crouchs->selectByValue(stranim.c_str()))) mcomboBox_crouchs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1342 if (!(mComboBox_crouchs->selectByValue(stranim.c_str())))
1343 {
1344 mComboBox_crouchs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1345 }
1157 } 1346 }
1158 } 1347 }
1159 break; 1348 break;
1160 case STATE_AGENT_CROUCHWALK: 1349 case STATE_AGENT_CROUCHWALK:
1161 { 1350 {
1162 if (sInstance && (mcomboBox_cwalks != NULL)) 1351 if (sInstance && mComboBox_cwalks != NULL)
1163 { 1352 {
1164 if (!(mcomboBox_cwalks->selectByValue(stranim.c_str()))) mcomboBox_cwalks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1353 if (!(mComboBox_cwalks->selectByValue(stranim.c_str())))
1354 {
1355 mComboBox_cwalks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1356 }
1165 } 1357 }
1166 } 1358 }
1167 break; 1359 break;
1168 case STATE_AGENT_FALLDOWN: 1360 case STATE_AGENT_FALLDOWN:
1169 { 1361 {
1170 if (sInstance && (mcomboBox_falls != NULL)) 1362 if (sInstance && mComboBox_falls != NULL)
1171 { 1363 {
1172 if (!(mcomboBox_falls->selectByValue(stranim.c_str()))) mcomboBox_falls->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1364 if (!(mComboBox_falls->selectByValue(stranim.c_str())))
1365 {
1366 mComboBox_falls->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1367 }
1173 } 1368 }
1174 } 1369 }
1175 break; 1370 break;
1176 case STATE_AGENT_HOVER: 1371 case STATE_AGENT_HOVER:
1177 { 1372 {
1178 if (sInstance && (mcomboBox_hovers != NULL)) 1373 if (sInstance && mComboBox_hovers != NULL)
1179 { 1374 {
1180 if (!(mcomboBox_hovers->selectByValue(stranim.c_str()))) mcomboBox_hovers->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1375 if (!(mComboBox_hovers->selectByValue(stranim.c_str())))
1376 {
1377 mComboBox_hovers->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1378 }
1181 } 1379 }
1182 } 1380 }
1183 break; 1381 break;
1184 case STATE_AGENT_FLY: 1382 case STATE_AGENT_FLY:
1185 { 1383 {
1186 if (sInstance && (mcomboBox_flys != NULL)) 1384 if (sInstance && mComboBox_flys != NULL)
1187 { 1385 {
1188 if (!(mcomboBox_flys->selectByValue(stranim.c_str()))) mcomboBox_flys->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1386 if (!(mComboBox_flys->selectByValue(stranim.c_str())))
1387 {
1388 mComboBox_flys->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1389 }
1189 } 1390 }
1190 } 1391 }
1191 break; 1392 break;
1192 case STATE_AGENT_FLYSLOW: 1393 case STATE_AGENT_FLYSLOW:
1193 { 1394 {
1194 if (sInstance && (mcomboBox_flyslows != NULL)) 1395 if (sInstance && mComboBox_flyslows != NULL)
1195 { 1396 {
1196 if (!(mcomboBox_flyslows->selectByValue(stranim.c_str()))) mcomboBox_flyslows->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1397 if (!(mComboBox_flyslows->selectByValue(stranim.c_str())))
1398 {
1399 mComboBox_flyslows->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1400 }
1197 } 1401 }
1198 } 1402 }
1199 break; 1403 break;
1200 case STATE_AGENT_HOVER_UP: 1404 case STATE_AGENT_HOVER_UP:
1201 { 1405 {
1202 if (sInstance && (mcomboBox_flyups != NULL)) 1406 if (sInstance && mComboBox_flyups != NULL)
1203 { 1407 {
1204 if (!(mcomboBox_flyups->selectByValue(stranim.c_str()))) mcomboBox_flyups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1408 if (!(mComboBox_flyups->selectByValue(stranim.c_str())))
1409 {
1410 mComboBox_flyups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1411 }
1205 } 1412 }
1206 } 1413 }
1207 break; 1414 break;
1208 case STATE_AGENT_HOVER_DOWN: 1415 case STATE_AGENT_HOVER_DOWN:
1209 { 1416 {
1210 if (sInstance && (mcomboBox_flydowns != NULL)) 1417 if (sInstance && mComboBox_flydowns != NULL)
1211 { 1418 {
1212 if (!(mcomboBox_flydowns->selectByValue(stranim.c_str()))) mcomboBox_flydowns->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1419 if (!(mComboBox_flydowns->selectByValue(stranim.c_str())))
1420 {
1421 mComboBox_flydowns->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1422 }
1213 } 1423 }
1214 } 1424 }
1215 break; 1425 break;
1216 case STATE_AGENT_LAND: 1426 case STATE_AGENT_LAND:
1217 { 1427 {
1218 if (sInstance && (mcomboBox_lands != NULL)) 1428 if (sInstance && mComboBox_lands != NULL)
1219 { 1429 {
1220 if (!(mcomboBox_lands->selectByValue(stranim.c_str()))) mcomboBox_lands->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1430 if (!(mComboBox_lands->selectByValue(stranim.c_str())))
1431 {
1432 mComboBox_lands->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1433 }
1221 } 1434 }
1222 } 1435 }
1223 break; 1436 break;
1224 case STATE_AGENT_STANDUP: 1437 case STATE_AGENT_STANDUP:
1225 { 1438 {
1226 if (sInstance && (mcomboBox_standups != NULL)) 1439 if (sInstance && mComboBox_standups != NULL)
1227 { 1440 {
1228 if (!(mcomboBox_standups->selectByValue(stranim.c_str()))) mcomboBox_standups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1441 if (!(mComboBox_standups->selectByValue(stranim.c_str())))
1442 {
1443 mComboBox_standups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1444 }
1229 } 1445 }
1230 } 1446 }
1231 break; 1447 break;
1232 case STATE_AGENT_PRE_JUMP: 1448 case STATE_AGENT_PRE_JUMP:
1233 { 1449 {
1234 if (sInstance && (mcomboBox_prejumps != NULL)) 1450 if (sInstance && mComboBox_prejumps != NULL)
1235 { 1451 {
1236 if (!(mcomboBox_prejumps->selectByValue(stranim.c_str()))) mcomboBox_prejumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist 1452 if (!(mComboBox_prejumps->selectByValue(stranim.c_str())))
1453 {
1454 mComboBox_prejumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist
1455 }
1237 } 1456 }
1238 } 1457 }
1239 break; 1458 break;
@@ -1259,113 +1478,161 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA
1259 case STATE_AGENT_WALK: 1478 case STATE_AGENT_WALK:
1260 { 1479 {
1261 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultWalk"); 1480 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultWalk");
1262 SetDefault(mcomboBox_walks,iter->ao_id,defaultanim); 1481 setDefault(mComboBox_walks, iter->ao_id,defaultanim);
1263 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1482 if (getAssetIDByName(defaultanim) != LLUUID::null)
1483 {
1484 iter->ao_id = getAssetIDByName(defaultanim);
1485 }
1264 } 1486 }
1265 break; 1487 break;
1266 case STATE_AGENT_RUN: 1488 case STATE_AGENT_RUN:
1267 { 1489 {
1268 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultRun"); 1490 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultRun");
1269 SetDefault(mcomboBox_runs,iter->ao_id,defaultanim); 1491 setDefault(mComboBox_runs, iter->ao_id,defaultanim);
1270 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1492 if (getAssetIDByName(defaultanim) != LLUUID::null)
1493 {
1494 iter->ao_id = getAssetIDByName(defaultanim);
1495 }
1271 } 1496 }
1272 break; 1497 break;
1273 case STATE_AGENT_JUMP: 1498 case STATE_AGENT_JUMP:
1274 { 1499 {
1275 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultJump"); 1500 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultJump");
1276 SetDefault(mcomboBox_jumps,iter->ao_id,defaultanim); 1501 setDefault(mComboBox_jumps, iter->ao_id,defaultanim);
1277 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1502 if (getAssetIDByName(defaultanim) != LLUUID::null)
1503 {
1504 iter->ao_id = getAssetIDByName(defaultanim);
1505 }
1278 } 1506 }
1279 break; 1507 break;
1280 case STATE_AGENT_SIT: 1508 case STATE_AGENT_SIT:
1281 { 1509 {
1282 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultSit"); 1510 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultSit");
1283 SetDefault(mcomboBox_sits,iter->ao_id,defaultanim); 1511 setDefault(mComboBox_sits, iter->ao_id,defaultanim);
1284 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1512 if (getAssetIDByName(defaultanim) != LLUUID::null)
1513 {
1514 iter->ao_id = getAssetIDByName(defaultanim);
1515 }
1285 } 1516 }
1286 break; 1517 break;
1287 case STATE_AGENT_CROUCH: 1518 case STATE_AGENT_CROUCH:
1288 { 1519 {
1289 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouch"); 1520 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouch");
1290 SetDefault(mcomboBox_crouchs,iter->ao_id,defaultanim); 1521 setDefault(mComboBox_crouchs,iter->ao_id,defaultanim);
1291 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1522 if (getAssetIDByName(defaultanim) != LLUUID::null)
1523 {
1524 iter->ao_id = getAssetIDByName(defaultanim);
1525 }
1292 } 1526 }
1293 break; 1527 break;
1294 case STATE_AGENT_GROUNDSIT: 1528 case STATE_AGENT_GROUNDSIT:
1295 { 1529 {
1296 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultGroundSit"); 1530 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultGroundSit");
1297 SetDefault(mcomboBox_gsits,iter->ao_id,defaultanim); 1531 setDefault(mComboBox_gsits,iter->ao_id,defaultanim);
1298 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1532 if (getAssetIDByName(defaultanim) != LLUUID::null)
1533 {
1534 iter->ao_id = getAssetIDByName(defaultanim);
1535 }
1299 } 1536 }
1300 break; 1537 break;
1301 case STATE_AGENT_CROUCHWALK: 1538 case STATE_AGENT_CROUCHWALK:
1302 { 1539 {
1303 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouchWalk"); 1540 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouchWalk");
1304 SetDefault(mcomboBox_cwalks,iter->ao_id,defaultanim); 1541 setDefault(mComboBox_cwalks,iter->ao_id,defaultanim);
1305 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1542 if (getAssetIDByName(defaultanim) != LLUUID::null)
1543 {
1544 iter->ao_id = getAssetIDByName(defaultanim);
1545 }
1306 } 1546 }
1307 break; 1547 break;
1308 case STATE_AGENT_FALLDOWN: 1548 case STATE_AGENT_FALLDOWN:
1309 { 1549 {
1310 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFall"); 1550 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFall");
1311 SetDefault(mcomboBox_falls,iter->ao_id,defaultanim); 1551 setDefault(mComboBox_falls,iter->ao_id,defaultanim);
1312 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1552 if (getAssetIDByName(defaultanim) != LLUUID::null)
1553 {
1554 iter->ao_id = getAssetIDByName(defaultanim);
1555 }
1313 } 1556 }
1314 break; 1557 break;
1315 case STATE_AGENT_HOVER: 1558 case STATE_AGENT_HOVER:
1316 { 1559 {
1317 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultHover"); 1560 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultHover");
1318 SetDefault(mcomboBox_hovers,iter->ao_id,defaultanim); 1561 setDefault(mComboBox_hovers,iter->ao_id,defaultanim);
1319 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1562 if (getAssetIDByName(defaultanim) != LLUUID::null)
1563 {
1564 iter->ao_id = getAssetIDByName(defaultanim);
1565 }
1320 } 1566 }
1321 break; 1567 break;
1322 case STATE_AGENT_FLY: 1568 case STATE_AGENT_FLY:
1323 { 1569 {
1324 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFly"); 1570 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFly");
1325 SetDefault(mcomboBox_flys,iter->ao_id,defaultanim); 1571 setDefault(mComboBox_flys,iter->ao_id,defaultanim);
1326 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1572 if (getAssetIDByName(defaultanim) != LLUUID::null)
1573 {
1574 iter->ao_id = getAssetIDByName(defaultanim);
1575 }
1327 } 1576 }
1328 break; 1577 break;
1329 case STATE_AGENT_HOVER_UP: 1578 case STATE_AGENT_HOVER_UP:
1330 { 1579 {
1331 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyUp"); 1580 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyUp");
1332 SetDefault(mcomboBox_flyups,iter->ao_id,defaultanim); 1581 setDefault(mComboBox_flyups,iter->ao_id,defaultanim);
1333 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1582 if (getAssetIDByName(defaultanim) != LLUUID::null)
1583 {
1584 iter->ao_id = getAssetIDByName(defaultanim);
1585 }
1334 } 1586 }
1335 break; 1587 break;
1336 case STATE_AGENT_FLYSLOW: 1588 case STATE_AGENT_FLYSLOW:
1337 { 1589 {
1338 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlySlow"); 1590 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlySlow");
1339 SetDefault(mcomboBox_flyslows,iter->ao_id,defaultanim); 1591 setDefault(mComboBox_flyslows,iter->ao_id,defaultanim);
1340 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1592 if (getAssetIDByName(defaultanim) != LLUUID::null)
1593 {
1594 iter->ao_id = getAssetIDByName(defaultanim);
1595 }
1341 } 1596 }
1342 break; 1597 break;
1343 case STATE_AGENT_HOVER_DOWN: 1598 case STATE_AGENT_HOVER_DOWN:
1344 { 1599 {
1345 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyDown"); 1600 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyDown");
1346 SetDefault(mcomboBox_flydowns,iter->ao_id,defaultanim); 1601 setDefault(mComboBox_flydowns,iter->ao_id,defaultanim);
1347 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1602 if (getAssetIDByName(defaultanim) != LLUUID::null)
1603 {
1604 iter->ao_id = getAssetIDByName(defaultanim);
1605 }
1348 } 1606 }
1349 break; 1607 break;
1350 case STATE_AGENT_LAND: 1608 case STATE_AGENT_LAND:
1351 { 1609 {
1352 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultLand"); 1610 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultLand");
1353 SetDefault(mcomboBox_lands,iter->ao_id,defaultanim); 1611 setDefault(mComboBox_lands,iter->ao_id,defaultanim);
1354 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1612 if (getAssetIDByName(defaultanim) != LLUUID::null)
1613 {
1614 iter->ao_id = getAssetIDByName(defaultanim);
1615 }
1355 } 1616 }
1356 break; 1617 break;
1357 case STATE_AGENT_STANDUP: 1618 case STATE_AGENT_STANDUP:
1358 { 1619 {
1359 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultStandUp"); 1620 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultStandUp");
1360 SetDefault(mcomboBox_standups,iter->ao_id,defaultanim); 1621 setDefault(mComboBox_standups,iter->ao_id,defaultanim);
1361 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1622 if (getAssetIDByName(defaultanim) != LLUUID::null)
1623 {
1624 iter->ao_id = getAssetIDByName(defaultanim);
1625 }
1362 } 1626 }
1363 break; 1627 break;
1364 case STATE_AGENT_PRE_JUMP: 1628 case STATE_AGENT_PRE_JUMP:
1365 { 1629 {
1366 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultPreJump"); 1630 std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultPreJump");
1367 SetDefault(mcomboBox_prejumps,iter->ao_id,defaultanim); 1631 setDefault(mComboBox_prejumps,iter->ao_id,defaultanim);
1368 if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); 1632 if (getAssetIDByName(defaultanim) != LLUUID::null)
1633 {
1634 iter->ao_id = getAssetIDByName(defaultanim);
1635 }
1369 } 1636 }
1370 break; 1637 break;
1371 } 1638 }
@@ -1384,7 +1651,8 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA
1384 } 1651 }
1385} 1652}
1386 1653
1387BOOL LLFloaterAO::SetDefault(void* userdata, LLUUID ao_id, std::string defaultanim) 1654// static
1655bool LLFloaterAO::setDefault(void* userdata, LLUUID ao_id, std::string defaultanim)
1388{ 1656{
1389 if (sInstance && (userdata)) 1657 if (sInstance && (userdata))
1390 { 1658 {
@@ -1427,14 +1695,18 @@ private:
1427 std::string sName; 1695 std::string sName;
1428}; 1696};
1429 1697
1698// static
1430const LLUUID& LLFloaterAO::getAssetIDByName(const std::string& name) 1699const LLUUID& LLFloaterAO::getAssetIDByName(const std::string& name)
1431{ 1700{
1432 if (name.empty() || !(gInventory.isEverythingFetched())) return LLUUID::null; 1701 if (name.empty())
1702 {
1703 return LLUUID::null;
1704 }
1433 1705
1434 LLViewerInventoryCategory::cat_array_t cats; 1706 LLViewerInventoryCategory::cat_array_t cats;
1435 LLViewerInventoryItem::item_array_t items; 1707 LLViewerInventoryItem::item_array_t items;
1436 ObjectNameMatches objectnamematches(name); 1708 ObjectNameMatches objectnamematches(name);
1437 gInventory.collectDescendentsIf(LLUUID::null,cats,items,FALSE,objectnamematches); 1709 gInventory.collectDescendentsIf(LLUUID::null, cats, items, FALSE, objectnamematches);
1438 1710
1439 if (items.count()) 1711 if (items.count())
1440 { 1712 {
diff --git a/linden/indra/newview/floaterao.h b/linden/indra/newview/floaterao.h
index 465f32e..45fd7af 100644
--- a/linden/indra/newview/floaterao.h
+++ b/linden/indra/newview/floaterao.h
@@ -9,35 +9,35 @@
9 9
10class AONoteCardDropTarget; 10class AONoteCardDropTarget;
11 11
12const int STATE_AGENT_IDLE = 0; 12const S32 STATE_AGENT_IDLE = 0;
13const int STATE_AGENT_WALK = 1; 13const S32 STATE_AGENT_WALK = 1;
14const int STATE_AGENT_RUN = 2; 14const S32 STATE_AGENT_RUN = 2;
15const int STATE_AGENT_STAND = 3; 15const S32 STATE_AGENT_STAND = 3;
16 16
17const int STATE_AGENT_PRE_JUMP = 4; 17const S32 STATE_AGENT_PRE_JUMP = 4;
18const int STATE_AGENT_JUMP = 5; 18const S32 STATE_AGENT_JUMP = 5;
19const int STATE_AGENT_TURNLEFT = 6; 19const S32 STATE_AGENT_TURNLEFT = 6;
20const int STATE_AGENT_TURNRIGHT = 7; 20const S32 STATE_AGENT_TURNRIGHT = 7;
21 21
22const int STATE_AGENT_SIT = 8; 22const S32 STATE_AGENT_SIT = 8;
23const int STATE_AGENT_GROUNDSIT = 9; 23const S32 STATE_AGENT_GROUNDSIT = 9;
24 24
25const int STATE_AGENT_HOVER = 10; 25const S32 STATE_AGENT_HOVER = 10;
26const int STATE_AGENT_HOVER_DOWN = 11; 26const S32 STATE_AGENT_HOVER_DOWN = 11;
27const int STATE_AGENT_HOVER_UP = 12; 27const S32 STATE_AGENT_HOVER_UP = 12;
28
29const int STATE_AGENT_CROUCH = 13;
30const int STATE_AGENT_CROUCHWALK = 14;
31const int STATE_AGENT_FALLDOWN = 15;
32const int STATE_AGENT_STANDUP = 16;
33const int STATE_AGENT_LAND = 17;
34
35const int STATE_AGENT_FLY = 18;
36const int STATE_AGENT_FLYSLOW = 19;
37 28
29const S32 STATE_AGENT_CROUCH = 13;
30const S32 STATE_AGENT_CROUCHWALK = 14;
31const S32 STATE_AGENT_FALLDOWN = 15;
32const S32 STATE_AGENT_STANDUP = 16;
33const S32 STATE_AGENT_LAND = 17;
38 34
35const S32 STATE_AGENT_FLY = 18;
36const S32 STATE_AGENT_FLYSLOW = 19;
39 37
40 38
39class LLFrameTimer;
40class LLComboBox;
41 41
42class AOStandTimer : public LLEventTimer 42class AOStandTimer : public LLEventTimer
43{ 43{
@@ -51,10 +51,12 @@ public:
51class AOInvTimer : public LLEventTimer 51class AOInvTimer : public LLEventTimer
52{ 52{
53public: 53public:
54 static BOOL fullfetch;
55 AOInvTimer(); 54 AOInvTimer();
56 ~AOInvTimer(); 55 ~AOInvTimer();
57 BOOL tick(); 56 BOOL tick();
57
58private:
59 static BOOL sInitialized;
58}; 60};
59 61
60class LLFloaterAO : public LLFloater 62class LLFloaterAO : public LLFloater
@@ -66,7 +68,7 @@ public:
66 virtual ~LLFloaterAO(); 68 virtual ~LLFloaterAO();
67 69
68 static void show(void*); 70 static void show(void*);
69 static void init(); 71 static bool init();
70 72
71 static void onClickToggleAO(LLUICtrl *, void*); 73 static void onClickToggleAO(LLUICtrl *, void*);
72 static void onClickToggleSits(LLUICtrl *, void*); 74 static void onClickToggleSits(LLUICtrl *, void*);
@@ -75,13 +77,13 @@ public:
75 77
76 static BOOL loadAnims(); 78 static BOOL loadAnims();
77 79
78 static int getAnimationState(); 80 static S32 getAnimationState();
79 static void setAnimationState(int state); 81 static void setAnimationState(S32 state);
80 static void setStates(const LLUUID& id, BOOL start); 82 static void setStates(const LLUUID& id, BOOL start);
81 83
82 static LLUUID getCurrentStandId(); 84 static LLUUID getCurrentStandId();
83 static void setCurrentStandId(const LLUUID& id); 85 static void setCurrentStandId(const LLUUID& id);
84 static int stand_iterator; 86 static S32 stand_iterator;
85 static BOOL ChangeStand(); 87 static BOOL ChangeStand();
86 88
87 static BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f, BOOL stand = FALSE); 89 static BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f, BOOL stand = FALSE);
@@ -89,9 +91,9 @@ public:
89 91
90 static LLUUID GetAnimID(const LLUUID& id); 92 static LLUUID GetAnimID(const LLUUID& id);
91 93
92 static int GetStateFromAnimID(const LLUUID& id); 94 static S32 GetStateFromAnimID(const LLUUID& id);
93 static LLUUID GetAnimIDFromState(const int state); 95 static LLUUID GetAnimIDFromState(const S32 state);
94 static int GetStateFromToken(std::string strtoken); 96 static S32 GetStateFromToken(std::string strtoken);
95 97
96 static void onClickLess(void* data) ; 98 static void onClickLess(void* data) ;
97 static void onClickMore(void* data) ; 99 static void onClickMore(void* data) ;
@@ -105,19 +107,20 @@ public:
105 static LLUUID invfolderid; 107 static LLUUID invfolderid;
106 static const LLUUID& getAssetIDByName(const std::string& name); 108 static const LLUUID& getAssetIDByName(const std::string& name);
107 109
108 static bool getInstance(); 110 static LLFloaterAO* getInstance();
111 static bool getVisible();
109 112
110private: 113private:
111 114
112 static LLFloaterAO* sInstance; 115 static LLFloaterAO* sInstance;
113 static int mAnimationState; 116 static S32 sAnimationState;
114 static LLUUID mCurrentStandId; 117 static LLUUID sCurrentStandId;
115 118
116 static AONoteCardDropTarget* mAOItemDropTarget; 119 static AONoteCardDropTarget* sAOItemDropTarget;
117 static void AOItemDrop(LLViewerInventoryItem* item); 120 static void AOItemDrop(LLViewerInventoryItem* item);
118 static void onSpinnerCommit(LLUICtrl* ctrl, void* userdata); 121 static void onSpinnerCommit(LLUICtrl* ctrl, void* userdata);
119 static void onComboBoxCommit(LLUICtrl* ctrl, void* userdata); 122 static void onComboBoxCommit(LLUICtrl* ctrl, void* userdata);
120 static BOOL SetDefault(void *userdata, LLUUID ao_id, std::string defaultanim); 123 static bool setDefault(void *userdata, LLUUID ao_id, std::string defaultanim);
121 124
122 BOOL mDirty; 125 BOOL mDirty;
123 126
diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp
index 1c7a049..58a2bdc 100644
--- a/linden/indra/newview/llinventorymodel.cpp
+++ b/linden/indra/newview/llinventorymodel.cpp
@@ -186,7 +186,16 @@ LLInventoryModel gInventory;
186// Default constructor 186// Default constructor
187LLInventoryModel::LLInventoryModel() : 187LLInventoryModel::LLInventoryModel() :
188 mModifyMask(LLInventoryObserver::ALL), 188 mModifyMask(LLInventoryObserver::ALL),
189 mChangedItemIDs(),
190 mCategoryMap(),
191 mItemMap(),
192 mCategoryLock(),
193 mItemLock(),
189 mLastItem(NULL), 194 mLastItem(NULL),
195 mAnimationsFolderUUID(LLUUID::null),
196 mParentChildCategoryTree(),
197 mParentChildItemTree(),
198 mObservers(),
190 mIsAgentInvUsable(false) 199 mIsAgentInvUsable(false)
191{ 200{
192} 201}
@@ -404,7 +413,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
404 413
405 if(preferred_type == LLAssetType::AT_SIMSTATE) 414 if(preferred_type == LLAssetType::AT_SIMSTATE)
406 { 415 {
407 lldebugs << "Attempt to create simstate category." << llendl; 416 LL_DEBUGS("Inventory") << "Attempt to create simstate category." << LL_ENDL;
408 return id; 417 return id;
409 } 418 }
410 419
@@ -761,7 +770,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat)
761 770
762void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id) 771void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id)
763{ 772{
764 lldebugs << "LLInventoryModel::moveObject()" << llendl; 773 LL_DEBUGS("Inventory") << "LLInventoryModel::moveObject()" << LL_ENDL;
765 if(!isInventoryUsable()) 774 if(!isInventoryUsable())
766 { 775 {
767 llwarns << "Inventory is broken." << llendl; 776 llwarns << "Inventory is broken." << llendl;
@@ -803,11 +812,11 @@ void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id)
803// Delete a particular inventory object by ID. 812// Delete a particular inventory object by ID.
804void LLInventoryModel::deleteObject(const LLUUID& id) 813void LLInventoryModel::deleteObject(const LLUUID& id)
805{ 814{
806 lldebugs << "LLInventoryModel::deleteObject()" << llendl; 815 LL_DEBUGS("Inventory") << "LLInventoryModel::deleteObject()" << LL_ENDL;
807 LLPointer<LLInventoryObject> obj = getObject(id); 816 LLPointer<LLInventoryObject> obj = getObject(id);
808 if(obj) 817 if(obj)
809 { 818 {
810 lldebugs << "Deleting inventory object " << id << llendl; 819 LL_DEBUGS("Inventory") << "Deleting inventory object " << id << LL_ENDL;
811 mLastItem = NULL; 820 mLastItem = NULL;
812 LLUUID parent_id = obj->getParentUUID(); 821 LLUUID parent_id = obj->getParentUUID();
813 mCategoryMap.erase(id); 822 mCategoryMap.erase(id);
@@ -1103,8 +1112,8 @@ void LLInventoryModel::fetchInventoryResponder::result(const LLSD& content)
1103 LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; 1112 LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
1104 titem->unpackMessage(content["items"][i]); 1113 titem->unpackMessage(content["items"][i]);
1105 1114
1106 lldebugs << "LLInventoryModel::messageUpdateCore() item id:" 1115 LL_DEBUGS("Inventory") << "LLInventoryModel::messageUpdateCore() item id:"
1107 << titem->getUUID() << llendl; 1116 << titem->getUUID() << LL_ENDL;
1108 items.push_back(titem); 1117 items.push_back(titem);
1109 // examine update for changes. 1118 // examine update for changes.
1110 LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID()); 1119 LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID());
@@ -1673,8 +1682,8 @@ void LLInventoryModel::cache(
1673 const LLUUID& parent_folder_id, 1682 const LLUUID& parent_folder_id,
1674 const LLUUID& agent_id) 1683 const LLUUID& agent_id)
1675{ 1684{
1676 lldebugs << "Caching " << parent_folder_id << " for " << agent_id 1685 LL_DEBUGS("Inventory") << "Caching " << parent_folder_id << " for " << agent_id
1677 << llendl; 1686 << LL_ENDL;
1678 LLViewerInventoryCategory* root_cat = getCategory(parent_folder_id); 1687 LLViewerInventoryCategory* root_cat = getCategory(parent_folder_id);
1679 if(!root_cat) return; 1688 if(!root_cat) return;
1680 cat_array_t categories; 1689 cat_array_t categories;
@@ -1699,7 +1708,7 @@ void LLInventoryModel::cache(
1699 gzip_filename.append(".gz"); 1708 gzip_filename.append(".gz");
1700 if(gzip_file(inventory_filename, gzip_filename)) 1709 if(gzip_file(inventory_filename, gzip_filename))
1701 { 1710 {
1702 lldebugs << "Successfully compressed " << inventory_filename << llendl; 1711 LL_DEBUGS("Inventory") << "Successfully compressed " << inventory_filename << LL_ENDL;
1703 LLFile::remove(inventory_filename); 1712 LLFile::remove(inventory_filename);
1704 } 1713 }
1705 else 1714 else
@@ -1781,8 +1790,8 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update)
1781 } 1790 }
1782 if(!accounted) 1791 if(!accounted)
1783 { 1792 {
1784 lldebugs << "No accounting for: '" << cat->getName() << "' " 1793 LL_DEBUGS("Inventory") << "No accounting for: '" << cat->getName() << "' "
1785 << version << llendl; 1794 << version << LL_ENDL;
1786 } 1795 }
1787 } 1796 }
1788 else 1797 else
@@ -1914,40 +1923,72 @@ bool LLInventoryModel::isCategoryComplete(const LLUUID& cat_id) const
1914 return false; 1923 return false;
1915} 1924}
1916 1925
1917bool LLInventoryModel::loadSkeleton( 1926bool LLInventoryModel::loadSkeleton(const LLInventoryModel::options_t& options,
1918 const LLInventoryModel::options_t& options, 1927 const LLUUID& owner_id)
1919 const LLUUID& owner_id)
1920{ 1928{
1921 lldebugs << "importing inventory skeleton for " << owner_id << llendl; 1929 LL_DEBUGS("Inventory") << "importing inventory skeleton for " << owner_id << LL_ENDL;
1922 1930
1923 typedef std::set<LLPointer<LLViewerInventoryCategory>, InventoryIDPtrLess> cat_set_t; 1931 typedef std::set<LLPointer<LLViewerInventoryCategory>, InventoryIDPtrLess> cat_set_t;
1924 cat_set_t temp_cats; 1932 cat_set_t temp_cats;
1925 1933
1926 update_map_t child_counts; 1934 update_map_t child_counts;
1927
1928 LLUUID id; 1935 LLUUID id;
1929 LLAssetType::EType preferred_type; 1936 LLAssetType::EType preferred_type;
1930 bool rv = true; 1937 bool rv = true;
1931 for(options_t::const_iterator it = options.begin(); it < options.end(); ++it) 1938 bool clean_cat = false;
1939
1940 for (options_t::const_iterator it = options.begin(); it < options.end(); ++it)
1932 { 1941 {
1933 LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(owner_id); 1942 LLPointer<LLViewerInventoryCategory> cat = new LLViewerInventoryCategory(owner_id);
1943
1934 response_t::const_iterator no_response = (*it).end(); 1944 response_t::const_iterator no_response = (*it).end();
1935 response_t::const_iterator skel; 1945 response_t::const_iterator skel;
1936 skel = (*it).find("name"); 1946
1937 if(skel == no_response) goto clean_cat; 1947 clean_cat = false;
1938 cat->rename(std::string((*skel).second)); 1948
1939 skel = (*it).find("folder_id"); 1949 skel = (*it).find("folder_id");
1940 if(skel == no_response) goto clean_cat; 1950 if (skel == no_response)
1941 id.set((*skel).second); 1951 {
1952 clean_cat = true;
1953 }
1954 else
1955 {
1956 id.set((*skel).second);
1957 }
1958
1942 // if an id is null, it locks the viewer. 1959 // if an id is null, it locks the viewer.
1943 if(id.isNull()) goto clean_cat; 1960 if (id.isNull())
1944 cat->setUUID(id); 1961 {
1962 clean_cat = true;
1963 }
1964 else
1965 {
1966 cat->setUUID(id);
1967 }
1968
1945 skel = (*it).find("parent_id"); 1969 skel = (*it).find("parent_id");
1946 if(skel == no_response) goto clean_cat; 1970 if (skel == no_response)
1947 id.set((*skel).second); 1971 {
1948 cat->setParent(id); 1972 clean_cat = true;
1973 }
1974 else
1975 {
1976 id.set((*skel).second);
1977 cat->setParent(id);
1978 }
1979
1980 skel = (*it).find("name");
1981 if (skel == no_response)
1982 {
1983 clean_cat = true;
1984 }
1985 else
1986 {
1987 cat->rename(std::string((*skel).second));
1988 }
1989
1949 skel = (*it).find("type_default"); 1990 skel = (*it).find("type_default");
1950 if(skel == no_response) 1991 if (skel == no_response)
1951 { 1992 {
1952 preferred_type = LLAssetType::AT_NONE; 1993 preferred_type = LLAssetType::AT_NONE;
1953 } 1994 }
@@ -1955,40 +1996,71 @@ bool LLInventoryModel::loadSkeleton(
1955 { 1996 {
1956 S32 t = atoi((*skel).second.c_str()); 1997 S32 t = atoi((*skel).second.c_str());
1957 preferred_type = (LLAssetType::EType)t; 1998 preferred_type = (LLAssetType::EType)t;
1999
2000 // This UUID is different for each avatar and "Animations" is hardcoded into the skeleton -- MC
2001 if (LLAssetType::AT_ANIMATION == preferred_type && cat->getName() == "Animations")
2002 {
2003 //llinfos << "Animations folder uuid from skeleton: " << cat->getUUID() << llendl;
2004 mAnimationsFolderUUID = id;
2005 }
1958 } 2006 }
1959 cat->setPreferredType(preferred_type); 2007 cat->setPreferredType(preferred_type);
2008
1960 skel = (*it).find("version"); 2009 skel = (*it).find("version");
1961 if(skel == no_response) goto clean_cat; 2010 if (skel == no_response)
1962 cat->setVersion(atoi((*skel).second.c_str())); 2011 {
1963 temp_cats.insert(cat); 2012 clean_cat = true;
1964 continue; 2013 }
1965 clean_cat: 2014 else
1966 llwarns << "Unable to import near " << cat->getName() << llendl; 2015 {
1967 rv = false; 2016 cat->setVersion(atoi((*skel).second.c_str()));
1968 //delete cat; // automatic when cat is reasigned or destroyed 2017 }
2018
2019 if (clean_cat)
2020 {
2021 llwarns << "Unable to import near " << cat->getName() << llendl;
2022 rv = false;
2023 //delete cat; // automatic when cat is reasigned or destroyed
2024 temp_cats.clear();
2025 break;
2026 }
2027 else
2028 {
2029 temp_cats.insert(cat);
2030 }
1969 } 2031 }
1970 2032
1971 S32 cached_category_count = 0; 2033 S32 cached_category_count = 0;
1972 S32 cached_item_count = 0; 2034 S32 cached_item_count = 0;
1973 if(!temp_cats.empty()) 2035 if (temp_cats.empty())
2036 {
2037 LL_WARNS("Inventory") << "No categories found! Cannot continue!" << LL_ENDL;
2038 }
2039 else
1974 { 2040 {
1975 cat_array_t categories; 2041 cat_array_t categories;
1976 item_array_t items; 2042 item_array_t items;
1977 std::string owner_id_str; 2043 std::string owner_id_str;
1978 owner_id.toString(owner_id_str); 2044 owner_id.toString(owner_id_str);
2045
1979 std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str)); 2046 std::string path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, owner_id_str));
1980 std::string inventory_filename; 2047 std::string inventory_filename;
1981 inventory_filename = llformat(CACHE_FORMAT_STRING, path.c_str()); 2048 inventory_filename = llformat(CACHE_FORMAT_STRING, path.c_str());
2049
1982 const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN; 2050 const S32 NO_VERSION = LLViewerInventoryCategory::VERSION_UNKNOWN;
2051
1983 std::string gzip_filename(inventory_filename); 2052 std::string gzip_filename(inventory_filename);
1984 gzip_filename.append(".gz"); 2053 gzip_filename.append(".gz");
1985 LLFILE* fp = LLFile::fopen(gzip_filename, "rb"); 2054 LLFILE* fp = LLFile::fopen(gzip_filename, "rb");
2055
1986 bool remove_inventory_file = false; 2056 bool remove_inventory_file = false;
1987 if(fp) 2057
2058 // try to ungzip the inventory -- MC
2059 if (fp)
1988 { 2060 {
1989 fclose(fp); 2061 fclose(fp);
1990 fp = NULL; 2062 fp = NULL;
1991 if(gunzip_file(gzip_filename, inventory_filename)) 2063 if (gunzip_file(gzip_filename, inventory_filename))
1992 { 2064 {
1993 // we only want to remove the inventory file if it was 2065 // we only want to remove the inventory file if it was
1994 // gzipped before we loaded, and we successfully 2066 // gzipped before we loaded, and we successfully
@@ -2000,7 +2072,9 @@ bool LLInventoryModel::loadSkeleton(
2000 llinfos << "Unable to gunzip " << gzip_filename << llendl; 2072 llinfos << "Unable to gunzip " << gzip_filename << llendl;
2001 } 2073 }
2002 } 2074 }
2003 if(loadFromFile(inventory_filename, categories, items)) 2075
2076 // begin cache loading -- MC
2077 if (loadFromFile(inventory_filename, categories, items))
2004 { 2078 {
2005 // We were able to find a cache of files. So, use what we 2079 // We were able to find a cache of files. So, use what we
2006 // found to generate a set of categories we should add. We 2080 // found to generate a set of categories we should add. We
@@ -2009,10 +2083,11 @@ bool LLInventoryModel::loadSkeleton(
2009 S32 count = categories.count(); 2083 S32 count = categories.count();
2010 cat_set_t::iterator not_cached = temp_cats.end(); 2084 cat_set_t::iterator not_cached = temp_cats.end();
2011 std::set<LLUUID> cached_ids; 2085 std::set<LLUUID> cached_ids;
2012 for(S32 i = 0; i < count; ++i) 2086 for (S32 i = 0; i < count; ++i)
2013 { 2087 {
2014 LLViewerInventoryCategory* cat = categories[i]; 2088 LLViewerInventoryCategory* cat = categories[i];
2015 cat_set_t::iterator cit = temp_cats.find(cat); 2089 cat_set_t::iterator cit = temp_cats.find(cat);
2090
2016 if (cit == temp_cats.end()) 2091 if (cit == temp_cats.end())
2017 { 2092 {
2018 continue; // cache corruption?? not sure why this happens -SJB 2093 continue; // cache corruption?? not sure why this happens -SJB
@@ -2021,18 +2096,23 @@ bool LLInventoryModel::loadSkeleton(
2021 2096
2022 // we can safely ignore anything loaded from file, but 2097 // we can safely ignore anything loaded from file, but
2023 // not sent down in the skeleton. 2098 // not sent down in the skeleton.
2024 if(cit == not_cached) 2099 if (cit == not_cached)
2025 { 2100 {
2026 continue; 2101 continue;
2027 } 2102 }
2028 if(cat->getVersion() != tcat->getVersion()) 2103
2104 // We insert them anyway to keep the cache from breaking.
2105 // If we delete or add a folder (aka "category") then the server
2106 // increments the version and we reload the items on next login anyway
2107 // this *may* result in duplicates that are cleared on relog-- MC
2108 /*if (cat->getVersion() != tcat->getVersion())
2029 { 2109 {
2030 // if the cached version does not match the server version, 2110 // if the cached version does not match the server version,
2031 // throw away the version we have so we can fetch the 2111 // throw away the version we have so we can fetch the
2032 // correct contents the next time the viewer opens the folder. 2112 // correct contents the next time the viewer opens the folder.
2033 tcat->setVersion(NO_VERSION); 2113 tcat->setVersion(NO_VERSION);
2034 } 2114 }
2035 else 2115 else*/
2036 { 2116 {
2037 cached_ids.insert(tcat->getUUID()); 2117 cached_ids.insert(tcat->getUUID());
2038 } 2118 }
@@ -2041,9 +2121,9 @@ bool LLInventoryModel::loadSkeleton(
2041 // go ahead and add the cats returned during the download 2121 // go ahead and add the cats returned during the download
2042 std::set<LLUUID>::iterator not_cached_id = cached_ids.end(); 2122 std::set<LLUUID>::iterator not_cached_id = cached_ids.end();
2043 cached_category_count = cached_ids.size(); 2123 cached_category_count = cached_ids.size();
2044 for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) 2124 for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
2045 { 2125 {
2046 if(cached_ids.find((*it)->getUUID()) == not_cached_id) 2126 if (cached_ids.find((*it)->getUUID()) == not_cached_id)
2047 { 2127 {
2048 // this check is performed so that we do not 2128 // this check is performed so that we do not
2049 // mark new folders in the skeleton (and not in cache) 2129 // mark new folders in the skeleton (and not in cache)
@@ -2058,15 +2138,14 @@ bool LLInventoryModel::loadSkeleton(
2058 // Add all the items loaded which are parented to a 2138 // Add all the items loaded which are parented to a
2059 // category with a correctly cached parent 2139 // category with a correctly cached parent
2060 count = items.count(); 2140 count = items.count();
2061 cat_map_t::iterator unparented = mCategoryMap.end(); 2141 for (int i = 0; i < count; ++i)
2062 for(int i = 0; i < count; ++i)
2063 { 2142 {
2064 cat_map_t::iterator cit = mCategoryMap.find(items[i]->getParentUUID()); 2143 cat_map_t::iterator cit = mCategoryMap.find(items[i]->getParentUUID());
2065 2144
2066 if(cit != unparented) 2145 if (cit != mCategoryMap.end())
2067 { 2146 {
2068 LLViewerInventoryCategory* cat = cit->second; 2147 LLViewerInventoryCategory* cat = cit->second;
2069 if(cat->getVersion() != NO_VERSION) 2148 if (cat->getVersion() != NO_VERSION)
2070 { 2149 {
2071 addItem(items[i]); 2150 addItem(items[i]);
2072 cached_item_count += 1; 2151 cached_item_count += 1;
@@ -2079,7 +2158,7 @@ bool LLInventoryModel::loadSkeleton(
2079 { 2158 {
2080 // go ahead and add everything after stripping the version 2159 // go ahead and add everything after stripping the version
2081 // information. 2160 // information.
2082 for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) 2161 for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
2083 { 2162 {
2084 LLViewerInventoryCategory *llvic = (*it); 2163 LLViewerInventoryCategory *llvic = (*it);
2085 llvic->setVersion(NO_VERSION); 2164 llvic->setVersion(NO_VERSION);
@@ -2092,13 +2171,13 @@ bool LLInventoryModel::loadSkeleton(
2092 // needlessly fetch descendents for categories which we have. 2171 // needlessly fetch descendents for categories which we have.
2093 update_map_t::iterator no_child_counts = child_counts.end(); 2172 update_map_t::iterator no_child_counts = child_counts.end();
2094 update_map_t::iterator the_count; 2173 update_map_t::iterator the_count;
2095 for(cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it) 2174 for (cat_set_t::iterator it = temp_cats.begin(); it != temp_cats.end(); ++it)
2096 { 2175 {
2097 LLViewerInventoryCategory* cat = (*it); 2176 LLViewerInventoryCategory* cat = (*it);
2098 if(cat->getVersion() != NO_VERSION) 2177 if (cat->getVersion() != NO_VERSION)
2099 { 2178 {
2100 the_count = child_counts.find(cat->getUUID()); 2179 the_count = child_counts.find(cat->getUUID());
2101 if(the_count != no_child_counts) 2180 if (the_count != no_child_counts)
2102 { 2181 {
2103 cat->setDescendentCount((*the_count).second.mValue); 2182 cat->setDescendentCount((*the_count).second.mValue);
2104 } 2183 }
@@ -2109,7 +2188,7 @@ bool LLInventoryModel::loadSkeleton(
2109 } 2188 }
2110 } 2189 }
2111 2190
2112 if(remove_inventory_file) 2191 if (remove_inventory_file)
2113 { 2192 {
2114 // clean up the gunzipped file. 2193 // clean up the gunzipped file.
2115 LLFile::remove(inventory_filename); 2194 LLFile::remove(inventory_filename);
@@ -2118,53 +2197,98 @@ bool LLInventoryModel::loadSkeleton(
2118 } 2197 }
2119 2198
2120 LL_DEBUGS("Inventory") << "Successfully loaded " << cached_category_count 2199 LL_DEBUGS("Inventory") << "Successfully loaded " << cached_category_count
2121 << " categories and " << cached_item_count << " items from cache." 2200 << " categories and " << cached_item_count << " items from cache skeleton."
2122 << LL_ENDL; 2201 << LL_ENDL;
2123 2202
2124 return rv; 2203 return rv;
2125} 2204}
2126 2205
2127bool LLInventoryModel::loadMeat( 2206bool LLInventoryModel::loadMeat(const LLInventoryModel::options_t& options,
2128 const LLInventoryModel::options_t& options, const LLUUID& owner_id) 2207 const LLUUID& owner_id)
2129{ 2208{
2130 llinfos << "importing inventory for " << owner_id << llendl; 2209 llinfos << "importing inventory for " << owner_id << llendl;
2131 LLPermissions default_perm; 2210 LLPermissions default_perm;
2132 default_perm.init(LLUUID::null, owner_id, LLUUID::null, LLUUID::null); 2211 default_perm.init(LLUUID::null, owner_id, LLUUID::null, LLUUID::null);
2133 LLPointer<LLViewerInventoryItem> item; 2212 LLPointer<LLViewerInventoryItem> item;
2134 LLUUID id; 2213 LLUUID id;
2135 LLAssetType::EType type; 2214 LLAssetType::EType type = LLAssetType::AT_NONE;
2136 LLInventoryType::EType inv_type; 2215 LLInventoryType::EType inv_type;
2216
2137 bool rv = true; 2217 bool rv = true;
2138 for(options_t::const_iterator it = options.begin(); it < options.end(); ++it) 2218 bool clean_item = false;
2219 static S32 cached_meat_count = 0;
2220
2221 for (options_t::const_iterator it = options.begin(); it < options.end(); ++it)
2139 { 2222 {
2140 item = new LLViewerInventoryItem; 2223 item = new LLViewerInventoryItem;
2224
2141 response_t::const_iterator no_response = (*it).end(); 2225 response_t::const_iterator no_response = (*it).end();
2142 response_t::const_iterator meat; 2226 response_t::const_iterator meat;
2227
2228 clean_item = false;
2229
2143 meat = (*it).find("name"); 2230 meat = (*it).find("name");
2144 if(meat == no_response) goto clean_item; 2231 if (meat == no_response)
2145 item->rename(std::string((*meat).second)); 2232 {
2233 clean_item = true;
2234 }
2235 else
2236 {
2237 item->rename(std::string((*meat).second));
2238 }
2239
2146 meat = (*it).find("item_id"); 2240 meat = (*it).find("item_id");
2147 if(meat == no_response) goto clean_item; 2241 if (meat == no_response)
2148 id.set((*meat).second); 2242 {
2149 item->setUUID(id); 2243 clean_item = true;
2244 }
2245 else
2246 {
2247 id.set((*meat).second);
2248 item->setUUID(id);
2249 }
2250
2150 meat = (*it).find("parent_id"); 2251 meat = (*it).find("parent_id");
2151 if(meat == no_response) goto clean_item; 2252 if (meat == no_response)
2152 id.set((*meat).second); 2253 {
2153 item->setParent(id); 2254 clean_item = true;
2255 }
2256 else
2257 {
2258 id.set((*meat).second);
2259 item->setParent(id);
2260 }
2261
2154 meat = (*it).find("type"); 2262 meat = (*it).find("type");
2155 if(meat == no_response) goto clean_item; 2263 if (meat == no_response)
2156 type = (LLAssetType::EType)atoi((*meat).second.c_str()); 2264 {
2157 item->setType(type); 2265 clean_item = true;
2266 }
2267 else
2268 {
2269 type = (LLAssetType::EType)atoi((*meat).second.c_str());
2270 item->setType(type);
2271 }
2272
2273 // Do we want to clean if there's no inv_type too? -- MC
2158 meat = (*it).find("inv_type"); 2274 meat = (*it).find("inv_type");
2159 if(meat != no_response) 2275 if (meat != no_response)
2160 { 2276 {
2161 inv_type = (LLInventoryType::EType)atoi((*meat).second.c_str()); 2277 inv_type = (LLInventoryType::EType)atoi((*meat).second.c_str());
2162 item->setInventoryType(inv_type); 2278 item->setInventoryType(inv_type);
2163 } 2279 }
2280
2164 meat = (*it).find("data_id"); 2281 meat = (*it).find("data_id");
2165 if(meat == no_response) goto clean_item; 2282 if (meat == no_response)
2166 id.set((*meat).second); 2283 {
2167 if(LLAssetType::AT_CALLINGCARD == type) 2284 clean_item = true;
2285 }
2286 else
2287 {
2288 id.set((*meat).second);
2289 }
2290
2291 if (LLAssetType::AT_CALLINGCARD == type)
2168 { 2292 {
2169 LLPermissions perm; 2293 LLPermissions perm;
2170 perm.init(id, owner_id, LLUUID::null, LLUUID::null); 2294 perm.init(id, owner_id, LLUUID::null, LLUUID::null);
@@ -2173,37 +2297,48 @@ bool LLInventoryModel::loadMeat(
2173 else 2297 else
2174 { 2298 {
2175 meat = (*it).find("perm_mask"); 2299 meat = (*it).find("perm_mask");
2176 if(meat != no_response) 2300 if (meat != no_response)
2177 { 2301 {
2178 PermissionMask perm_mask = atoi((*meat).second.c_str()); 2302 PermissionMask perm_mask = atoi((*meat).second.c_str());
2179 default_perm.initMasks( 2303 default_perm.initMasks(perm_mask, perm_mask, perm_mask, perm_mask, perm_mask);
2180 perm_mask, perm_mask, perm_mask, perm_mask, perm_mask);
2181 } 2304 }
2182 else 2305 else
2183 { 2306 {
2184 default_perm.initMasks( 2307 default_perm.initMasks(PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE);
2185 PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE, PERM_NONE);
2186 } 2308 }
2187 item->setPermissions(default_perm); 2309 item->setPermissions(default_perm);
2188 item->setAssetUUID(id); 2310 item->setAssetUUID(id);
2189 } 2311 }
2312
2190 meat = (*it).find("flags"); 2313 meat = (*it).find("flags");
2191 if(meat != no_response) 2314 if (meat != no_response)
2192 { 2315 {
2193 item->setFlags(strtoul((*meat).second.c_str(), NULL, 0)); 2316 item->setFlags(strtoul((*meat).second.c_str(), NULL, 0));
2194 } 2317 }
2318
2195 meat = (*it).find("time"); 2319 meat = (*it).find("time");
2196 if(meat != no_response) 2320 if (meat != no_response)
2197 { 2321 {
2198 item->setCreationDate(atoi((*meat).second.c_str())); 2322 item->setCreationDate(atoi((*meat).second.c_str()));
2199 } 2323 }
2200 addItem(item); 2324
2201 continue; 2325 if (clean_item)
2202 clean_item: 2326 {
2203 llwarns << "Unable to import near " << item->getName() << llendl; 2327 llwarns << "Unable to import near " << item->getName() << llendl;
2204 rv = false; 2328 rv = false;
2205 //delete item; // automatic when item is reassigned or destroyed 2329 //delete item; // automatic when item is reassigned or destroyed
2330 break;
2331 }
2332 else
2333 {
2334 addItem(item);
2335 cached_meat_count++;
2336 }
2206 } 2337 }
2338
2339 LL_DEBUGS("Inventory") << "Successfully added " << cached_meat_count << " items from cache."
2340 << LL_ENDL;
2341
2207 return rv; 2342 return rv;
2208} 2343}
2209 2344
@@ -2528,6 +2663,7 @@ bool LLInventoryModel::loadFromFile(const std::string& filename,
2528 // *NOTE: This buffer size is hard coded into scanf() below. 2663 // *NOTE: This buffer size is hard coded into scanf() below.
2529 char buffer[MAX_STRING]; /*Flawfinder: ignore*/ 2664 char buffer[MAX_STRING]; /*Flawfinder: ignore*/
2530 char keyword[MAX_STRING]; /*Flawfinder: ignore*/ 2665 char keyword[MAX_STRING]; /*Flawfinder: ignore*/
2666 static S32 item_count_total = 0;
2531 while(!feof(file) && fgets(buffer, MAX_STRING, file)) 2667 while(!feof(file) && fgets(buffer, MAX_STRING, file))
2532 { 2668 {
2533 sscanf(buffer, " %254s", keyword); /* Flawfinder: ignore */ 2669 sscanf(buffer, " %254s", keyword); /* Flawfinder: ignore */
@@ -2552,16 +2688,17 @@ bool LLInventoryModel::loadFromFile(const std::string& filename,
2552 // *FIX: Need a better solution, this prevents the 2688 // *FIX: Need a better solution, this prevents the
2553 // application from freezing, but breaks inventory 2689 // application from freezing, but breaks inventory
2554 // caching. 2690 // caching.
2555 if(inv_item->getUUID().isNull()) 2691 //if(inv_item->getUUID().isNull())MCCABE
2556 { 2692 //{
2557 //delete inv_item; // automatic when inv_cat is reassigned or destroyed 2693 // //delete inv_item; // automatic when inv_cat is reassigned or destroyed
2558 llwarns << "Ignoring inventory with null item id: " 2694 // llwarns << "Ignoring inventory with null item id: "
2559 << inv_item->getName() << llendl; 2695 // << inv_item->getName() << llendl;
2560 2696 //
2561 } 2697 //}
2562 else 2698 //else
2563 { 2699 {
2564 items.put(inv_item); 2700 items.put(inv_item);
2701 item_count_total++;
2565 } 2702 }
2566 } 2703 }
2567 else 2704 else
@@ -2576,6 +2713,7 @@ bool LLInventoryModel::loadFromFile(const std::string& filename,
2576 << llendl; 2713 << llendl;
2577 } 2714 }
2578 } 2715 }
2716 LL_DEBUGS("Inventory") << "Inventory items loaded from file: " << item_count_total << LL_ENDL;
2579 fclose(file); 2717 fclose(file);
2580 return true; 2718 return true;
2581} 2719}
@@ -2598,6 +2736,9 @@ bool LLInventoryModel::saveToFile(const std::string& filename,
2598 return false; 2736 return false;
2599 } 2737 }
2600 2738
2739 static S32 count_total = 0;
2740 static S32 category_total = 0;
2741
2601 S32 count = categories.count(); 2742 S32 count = categories.count();
2602 S32 i; 2743 S32 i;
2603 for(i = 0; i < count; ++i) 2744 for(i = 0; i < count; ++i)
@@ -2606,6 +2747,7 @@ bool LLInventoryModel::saveToFile(const std::string& filename,
2606 if(cat->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) 2747 if(cat->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN)
2607 { 2748 {
2608 cat->exportFileLocal(file); 2749 cat->exportFileLocal(file);
2750 category_total++;
2609 } 2751 }
2610 } 2752 }
2611 2753
@@ -2613,8 +2755,11 @@ bool LLInventoryModel::saveToFile(const std::string& filename,
2613 for(i = 0; i < count; ++i) 2755 for(i = 0; i < count; ++i)
2614 { 2756 {
2615 items[i]->exportFile(file); 2757 items[i]->exportFile(file);
2758 count_total++;
2616 } 2759 }
2617 2760
2761 LL_DEBUGS("Inventory") << "Cached " << category_total << " categories and " << count_total << " inventory items" << LL_ENDL;
2762
2618 fclose(file); 2763 fclose(file);
2619 return true; 2764 return true;
2620} 2765}
@@ -2709,8 +2854,8 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account)
2709 { 2854 {
2710 LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; 2855 LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
2711 titem->unpackMessage(msg, _PREHASH_InventoryData, i); 2856 titem->unpackMessage(msg, _PREHASH_InventoryData, i);
2712 lldebugs << "LLInventoryModel::messageUpdateCore() item id:" 2857 LL_DEBUGS("Inventory") << "LLInventoryModel::messageUpdateCore() item id:"
2713 << titem->getUUID() << llendl; 2858 << titem->getUUID() << LL_ENDL;
2714 items.push_back(titem); 2859 items.push_back(titem);
2715 // examine update for changes. 2860 // examine update for changes.
2716 LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID()); 2861 LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID());
@@ -2759,7 +2904,7 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account)
2759// static 2904// static
2760void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) 2905void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**)
2761{ 2906{
2762 lldebugs << "LLInventoryModel::processRemoveInventoryItem()" << llendl; 2907 LL_DEBUGS("Inventory") << "LLInventoryModel::processRemoveInventoryItem()" << LL_ENDL;
2763 LLUUID agent_id, item_id; 2908 LLUUID agent_id, item_id;
2764 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); 2909 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
2765 if(agent_id != gAgent.getID()) 2910 if(agent_id != gAgent.getID())
@@ -2796,7 +2941,7 @@ void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**)
2796void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg, 2941void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg,
2797 void**) 2942 void**)
2798{ 2943{
2799 lldebugs << "LLInventoryModel::processUpdateInventoryFolder()" << llendl; 2944 LL_DEBUGS("Inventory") << "LLInventoryModel::processUpdateInventoryFolder()" << LL_ENDL;
2800 LLUUID agent_id, folder_id, parent_id; 2945 LLUUID agent_id, folder_id, parent_id;
2801 //char name[DB_INV_ITEM_NAME_BUF_SIZE]; 2946 //char name[DB_INV_ITEM_NAME_BUF_SIZE];
2802 msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id); 2947 msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id);
@@ -2856,7 +3001,7 @@ void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg,
2856void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, 3001void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg,
2857 void**) 3002 void**)
2858{ 3003{
2859 lldebugs << "LLInventoryModel::processRemoveInventoryFolder()" << llendl; 3004 LL_DEBUGS("Inventory") << "LLInventoryModel::processRemoveInventoryFolder()" << LL_ENDL;
2860 LLUUID agent_id, folder_id; 3005 LLUUID agent_id, folder_id;
2861 msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id); 3006 msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id);
2862 if(agent_id != gAgent.getID()) 3007 if(agent_id != gAgent.getID())
@@ -2905,8 +3050,8 @@ void LLInventoryModel::processSaveAssetIntoInventory(LLMessageSystem* msg,
2905 // The viewer ignores the asset id because this message is only 3050 // The viewer ignores the asset id because this message is only
2906 // used for attachments/objects, so the asset id is not used in 3051 // used for attachments/objects, so the asset id is not used in
2907 // the viewer anyway. 3052 // the viewer anyway.
2908 lldebugs << "LLInventoryModel::processSaveAssetIntoInventory itemID=" 3053 LL_DEBUGS("Inventory") << "LLInventoryModel::processSaveAssetIntoInventory itemID="
2909 << item_id << llendl; 3054 << item_id << LL_ENDL;
2910 LLViewerInventoryItem* item = gInventory.getItem( item_id ); 3055 LLViewerInventoryItem* item = gInventory.getItem( item_id );
2911 if( item ) 3056 if( item )
2912 { 3057 {
@@ -3173,7 +3318,7 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**)
3173// static 3318// static
3174void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) 3319void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**)
3175{ 3320{
3176 lldebugs << "LLInventoryModel::processMoveInventoryItem()" << llendl; 3321 LL_DEBUGS("Inventory") << "LLInventoryModel::processMoveInventoryItem()" << LL_ENDL;
3177 LLUUID agent_id; 3322 LLUUID agent_id;
3178 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); 3323 msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
3179 if(agent_id != gAgent.getID()) 3324 if(agent_id != gAgent.getID())
@@ -3198,8 +3343,8 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**)
3198 msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_FolderID, folder_id, i); 3343 msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_FolderID, folder_id, i);
3199 msg->getString("InventoryData", "NewName", new_name, i); 3344 msg->getString("InventoryData", "NewName", new_name, i);
3200 3345
3201 lldebugs << "moving item " << item_id << " to folder " 3346 LL_DEBUGS("Inventory") << "moving item " << item_id << " to folder "
3202 << folder_id << llendl; 3347 << folder_id << LL_ENDL;
3203 update_list_t update; 3348 update_list_t update;
3204 LLCategoryUpdate old_folder(item->getParentUUID(), -1); 3349 LLCategoryUpdate old_folder(item->getParentUUID(), -1);
3205 update.push_back(old_folder); 3350 update.push_back(old_folder);
@@ -3759,7 +3904,7 @@ void LLInventoryFetchComboObserver::fetch(
3759 const folder_ref_t& folder_ids, 3904 const folder_ref_t& folder_ids,
3760 const item_ref_t& item_ids) 3905 const item_ref_t& item_ids)
3761{ 3906{
3762 lldebugs << "LLInventoryFetchComboObserver::fetch()" << llendl; 3907 LL_DEBUGS("Inventory") << "LLInventoryFetchComboObserver::fetch()" << LL_ENDL;
3763 for(folder_ref_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit) 3908 for(folder_ref_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit)
3764 { 3909 {
3765 LLViewerInventoryCategory* cat = gInventory.getCategory(*fit); 3910 LLViewerInventoryCategory* cat = gInventory.getCategory(*fit);
@@ -3767,13 +3912,13 @@ void LLInventoryFetchComboObserver::fetch(
3767 if(!gInventory.isCategoryComplete(*fit)) 3912 if(!gInventory.isCategoryComplete(*fit))
3768 { 3913 {
3769 cat->fetchDescendents(); 3914 cat->fetchDescendents();
3770 lldebugs << "fetching folder " << *fit <<llendl; 3915 LL_DEBUGS("Inventory") << "fetching folder " << *fit << LL_ENDL;
3771 mIncompleteFolders.push_back(*fit); 3916 mIncompleteFolders.push_back(*fit);
3772 } 3917 }
3773 else 3918 else
3774 { 3919 {
3775 mCompleteFolders.push_back(*fit); 3920 mCompleteFolders.push_back(*fit);
3776 lldebugs << "completing folder " << *fit <<llendl; 3921 LL_DEBUGS("Inventory") << "completing folder " << *fit << LL_ENDL;
3777 } 3922 }
3778 } 3923 }
3779 3924
@@ -3788,14 +3933,14 @@ void LLInventoryFetchComboObserver::fetch(
3788 LLViewerInventoryItem* item = gInventory.getItem(*iit); 3933 LLViewerInventoryItem* item = gInventory.getItem(*iit);
3789 if(!item) 3934 if(!item)
3790 { 3935 {
3791 lldebugs << "uanble to find item " << *iit << llendl; 3936 LL_DEBUGS("Inventory") << "uanble to find item " << *iit << LL_ENDL;
3792 continue; 3937 continue;
3793 } 3938 }
3794 if(item->isComplete()) 3939 if(item->isComplete())
3795 { 3940 {
3796 // It's complete, so put it on the complete container. 3941 // It's complete, so put it on the complete container.
3797 mCompleteItems.push_back(*iit); 3942 mCompleteItems.push_back(*iit);
3798 lldebugs << "completing item " << *iit << llendl; 3943 LL_DEBUGS("Inventory") << "completing item " << *iit << LL_ENDL;
3799 continue; 3944 continue;
3800 } 3945 }
3801 else 3946 else
@@ -3812,7 +3957,7 @@ void LLInventoryFetchComboObserver::fetch(
3812 } 3957 }
3813 else 3958 else
3814 { 3959 {
3815 lldebugs << "not worrying about " << *iit << llendl; 3960 LL_DEBUGS("Inventory") << "not worrying about " << *iit << LL_ENDL;
3816 } 3961 }
3817 } 3962 }
3818 fetch_items_from_llsd(items_llsd); 3963 fetch_items_from_llsd(items_llsd);
diff --git a/linden/indra/newview/llinventorymodel.h b/linden/indra/newview/llinventorymodel.h
index fee509b..7222c60 100644
--- a/linden/indra/newview/llinventorymodel.h
+++ b/linden/indra/newview/llinventorymodel.h
@@ -452,6 +452,9 @@ protected:
452 // cache recent lookups 452 // cache recent lookups
453 mutable LLPointer<LLViewerInventoryItem> mLastItem; 453 mutable LLPointer<LLViewerInventoryItem> mLastItem;
454 454
455 // UUID of the 'Animations' folder in 'My Inventory'
456 LLUUID mAnimationsFolderUUID;
457
455 // This last set of indices is used to map parents to children. 458 // This last set of indices is used to map parents to children.
456 typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t; 459 typedef std::map<LLUUID, cat_array_t*> parent_cat_map_t;
457 typedef std::map<LLUUID, item_array_t*> parent_item_map_t; 460 typedef std::map<LLUUID, item_array_t*> parent_item_map_t;
@@ -474,6 +477,8 @@ protected:
474 bool mIsAgentInvUsable; 477 bool mIsAgentInvUsable;
475 478
476public: 479public:
480 // Returns the UUID of the 'Animations' folder in 'My Inventory' sent from the server at startup
481 LLUUID getAnimationsFolderUUID() const { return mAnimationsFolderUUID; }
477 // *NOTE: DEBUG functionality 482 // *NOTE: DEBUG functionality
478 void dumpInventory(); 483 void dumpInventory();
479 static bool isBulkFetchProcessingComplete(); 484 static bool isBulkFetchProcessingComplete();
diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp
index f8fb439..927d05c 100644
--- a/linden/indra/newview/llinventoryview.cpp
+++ b/linden/indra/newview/llinventoryview.cpp
@@ -491,7 +491,10 @@ LLInventoryView::LLInventoryView(const std::string& name,
491 LLFloater(name, rect, std::string("Inventory"), RESIZE_YES, 491 LLFloater(name, rect, std::string("Inventory"), RESIZE_YES,
492 INV_MIN_WIDTH, INV_MIN_HEIGHT, DRAG_ON_TOP, 492 INV_MIN_WIDTH, INV_MIN_HEIGHT, DRAG_ON_TOP,
493 MINIMIZE_NO, CLOSE_YES), 493 MINIMIZE_NO, CLOSE_YES),
494 mActivePanel(NULL) 494 mActivePanel(NULL),
495 mOldItemCount(-1),
496 mOldFilterText(""),
497 mFilterText("")
495 //LLHandle<LLFloater> mFinderHandle takes care of its own initialization 498 //LLHandle<LLFloater> mFinderHandle takes care of its own initialization
496{ 499{
497 init(inventory); 500 init(inventory);
@@ -681,12 +684,12 @@ LLInventoryView::~LLInventoryView( void )
681 684
682void LLInventoryView::draw() 685void LLInventoryView::draw()
683{ 686{
684 if (LLInventoryModel::isEverythingFetched()) 687 if (!LLInventoryModel::backgroundFetchActive())
685 { 688 {
686 S32 item_count = gInventory.getItemCount(); 689 S32 item_count = gInventory.getItemCount();
687 690
688 //don't let llfloater work more than necessary 691 //don't let llfloater work more than necessary
689 if (item_count != mOldItemCount || mOldFilterText != mFilterText) 692 if (item_count > mOldItemCount || mOldFilterText != mFilterText)
690 { 693 {
691 LLLocale locale(LLLocale::USER_LOCALE); 694 LLLocale locale(LLLocale::USER_LOCALE);
692 std::ostringstream title; 695 std::ostringstream title;
@@ -696,11 +699,10 @@ void LLInventoryView::draw()
696 title << " (" << item_count_string << " items)"; 699 title << " (" << item_count_string << " items)";
697 title << mFilterText; 700 title << mFilterText;
698 setTitle(title.str()); 701 setTitle(title.str());
699 }
700
701 mOldFilterText = mFilterText;
702 mOldItemCount = item_count;
703 702
703 mOldFilterText = mFilterText;
704 mOldItemCount = item_count;
705 }
704 } 706 }
705 if (mActivePanel && mSearchEditor) 707 if (mActivePanel && mSearchEditor)
706 { 708 {
@@ -798,6 +800,8 @@ void LLInventoryView::setVisible( BOOL visible )
798// Destroy all but the last floater, which is made invisible. 800// Destroy all but the last floater, which is made invisible.
799void LLInventoryView::onClose(bool app_quitting) 801void LLInventoryView::onClose(bool app_quitting)
800{ 802{
803 mOldItemCount = 0;
804 mOldFilterText = "";
801// S32 count = sActiveViews.count(); 805// S32 count = sActiveViews.count();
802// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) 806// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g)
803 // See LLInventoryView::closeAll() on why we're doing it this way 807 // See LLInventoryView::closeAll() on why we're doing it this way
@@ -889,6 +893,12 @@ void LLInventoryView::changed(U32 mask)
889 } 893 }
890 else 894 else
891 { 895 {
896 // This is here because it gets called on login even when it shouldn't -- MC
897 LLLocale locale(LLLocale::USER_LOCALE);
898 std::string item_count_string;
899 LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount());
900 title << " (" << item_count_string << " items)";
901
892 gSavedPerAccountSettings.setS32("InventoryPreviousCount", gInventory.getItemCount()); 902 gSavedPerAccountSettings.setS32("InventoryPreviousCount", gInventory.getItemCount());
893 } 903 }
894 title << mFilterText; 904 title << mFilterText;
diff --git a/linden/indra/newview/llinventoryview.h b/linden/indra/newview/llinventoryview.h
index 3ec1e73..cc5106d 100644
--- a/linden/indra/newview/llinventoryview.h
+++ b/linden/indra/newview/llinventoryview.h
@@ -315,7 +315,7 @@ protected:
315 std::string mOldFilterText; 315 std::string mOldFilterText;
316 316
317 S32 mItemCount; 317 S32 mItemCount;
318 S32 mOldItemCount; 318 S32 mOldItemCount;
319 319
320 // This container is used to hold all active inventory views. This 320 // This container is used to hold all active inventory views. This
321 // is here to support the inventory toggle show button. 321 // is here to support the inventory toggle show button.
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index 083a082..08e12ce 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -2450,6 +2450,22 @@ bool idle_startup()
2450 } 2450 }
2451 } 2451 }
2452 2452
2453 // start background fetching for animations here in case the cache is empty.
2454 // We do this to improve AO support (that's Animatoni Overrider, not LL's
2455 // silly "AO" acronym -- MC
2456 if (gSavedSettings.getBOOL("FetchInventoryOnLogin2"))
2457 {
2458 // Start loading inventory
2459 if (gInventory.getAnimationsFolderUUID() != LLUUID::null)
2460 {
2461 gInventory.startBackgroundFetch(gInventory.getAnimationsFolderUUID());
2462 }
2463 else
2464 {
2465 gInventory.startBackgroundFetch();
2466 }
2467 }
2468
2453 options.clear(); 2469 options.clear();
2454 if(LLUserAuth::getInstance()->getOptions("buddy-list", options)) 2470 if(LLUserAuth::getInstance()->getOptions("buddy-list", options))
2455 { 2471 {
@@ -2576,19 +2592,6 @@ bool idle_startup()
2576 llinfos << "Requesting Agent Data" << llendl; 2592 llinfos << "Requesting Agent Data" << llendl;
2577 gAgent.sendAgentDataUpdateRequest(); 2593 gAgent.sendAgentDataUpdateRequest();
2578 2594
2579 bool shown_at_exit = gSavedSettings.getBOOL("ShowInventory");
2580
2581 // Create the inventory views
2582 llinfos << "Creating Inventory Views" << llendl;
2583 LLInventoryView::showAgentInventory();
2584 llinfos << "Inventory Views Created" << llendl;
2585
2586 // Hide the inventory if it wasn't shown at exit
2587 if(!shown_at_exit)
2588 {
2589 LLInventoryView::toggleVisibility(NULL);
2590 }
2591
2592// [RLVa:KB] - Checked: 2009-11-27 (RLVa-1.1.0f) | Added: RLVa-1.1.0f 2595// [RLVa:KB] - Checked: 2009-11-27 (RLVa-1.1.0f) | Added: RLVa-1.1.0f
2593 if (rlv_handler_t::isEnabled()) 2596 if (rlv_handler_t::isEnabled())
2594 { 2597 {
@@ -2910,12 +2913,6 @@ bool idle_startup()
2910 gStatusBar->updateElements(); 2913 gStatusBar->updateElements();
2911 } 2914 }
2912 2915
2913 // Start the AO now that settings have loaded and login successful -- MC
2914 if (!gAOInvTimer)
2915 {
2916 gAOInvTimer = new AOInvTimer();
2917 }
2918
2919 LLFirstUse::ClientTags(); 2916 LLFirstUse::ClientTags();
2920 2917
2921 // Add login location to teleport history 'teleported-into' 2918 // Add login location to teleport history 'teleported-into'
@@ -2949,12 +2946,6 @@ bool idle_startup()
2949 // Have the agent start watching the friends list so we can update proxies 2946 // Have the agent start watching the friends list so we can update proxies
2950 gAgent.observeFriends(); 2947 gAgent.observeFriends();
2951 2948
2952 if (gSavedSettings.getBOOL("FetchInventoryOnLogin"))
2953 {
2954 // Start loading inventory
2955 gInventory.startBackgroundFetch();
2956 }
2957
2958 if (gSavedSettings.getBOOL("LoginAsGod")) 2949 if (gSavedSettings.getBOOL("LoginAsGod"))
2959 { 2950 {
2960 gAgent.requestEnterGodMode(); 2951 gAgent.requestEnterGodMode();
@@ -2979,6 +2970,23 @@ bool idle_startup()
2979 // Clean up the userauth stuff. 2970 // Clean up the userauth stuff.
2980 LLUserAuth::getInstance()->reset(); 2971 LLUserAuth::getInstance()->reset();
2981 2972
2973 // Show the inventory if it was shown at exit
2974 // Don't do this before here or we screw up inv loading -- MC
2975 if (gSavedSettings.getBOOL("ShowInventory"))
2976 {
2977 // Create the inventory views
2978 llinfos << "Creating Inventory Views" << llendl;
2979 LLInventoryView::showAgentInventory();
2980 llinfos << "Inventory Views Created" << llendl;
2981 //LLInventoryView::toggleVisibility(NULL);
2982 }
2983
2984 // Init the AO now that settings have loaded and login successful -- MC
2985 if (!gAOInvTimer)
2986 {
2987 gAOInvTimer = new AOInvTimer();
2988 }
2989
2982 LLStartUp::setStartupState( STATE_STARTED ); 2990 LLStartUp::setStartupState( STATE_STARTED );
2983 LLStartUp::setStartedOnce(true); 2991 LLStartUp::setStartedOnce(true);
2984 LLStartUp::setLoginFailed(false); 2992 LLStartUp::setLoginFailed(false);
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp
index ac16dbc..8aed3e0 100644
--- a/linden/indra/newview/llviewermenu.cpp
+++ b/linden/indra/newview/llviewermenu.cpp
@@ -8329,7 +8329,7 @@ class LLViewCheckAO: public view_listener_t
8329{ 8329{
8330 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 8330 bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
8331 { 8331 {
8332 gMenuHolder->findControl(userdata["control"].asString())->setValue(LLFloaterAO::getInstance()); 8332 gMenuHolder->findControl(userdata["control"].asString())->setValue(LLFloaterAO::getVisible());
8333 return true; 8333 return true;
8334 } 8334 }
8335}; 8335};
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml b/linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml
index 29c34fb..2d71add 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_ao_remote_expanded.xml
@@ -3,8 +3,11 @@
3 enabled="true" follows="right|bottom" height="45" left="0" mouse_opaque="true" 3 enabled="true" follows="right|bottom" height="45" left="0" mouse_opaque="true"
4 name="ao_remote" use_bounding_rect="true" width="96"> 4 name="ao_remote" use_bounding_rect="true" width="96">
5 <panel bottom="1" filename="panel_bg_tab.xml" name="panel_bg_tab" height="47" left="0" width="96" /> 5 <panel bottom="1" filename="panel_bg_tab.xml" name="panel_bg_tab" height="47" left="0" width="96" />
6 <button bottom="-20" control_name="AOSitsEnabled" enabled="true" 6 <button bottom="-20" control_name="AOSitsEnabled" enabled="true" tool_tip="Toggles AO sit animation"
7 follows="left|top" font="SansSerif" height="22" label="AO Sits Off" label_selected="AO Sits On" 7 follows="left|top" font="SansSerif" height="22" label="Sits Off" label_selected="Sits On"
8 mouse_opaque="true" name="ao_sit_btn" width="92" left="3" /> 8 mouse_opaque="true" name="ao_sit_btn" width="66" left="3" label_selected_disabled="Sits Off" />
9 <button bottom="-20" enabled="true" tool_tip="Toggle AO window"
10 follows="left|top" font="SansSerif" height="22" label="" image_overlay="arrow_up.tga"
11 mouse_opaque="true" name="ao_show_btn" width="22" left_delta="68" />
9 <panel bottom="13" filename="panel_ao_remote_controls.xml" name="panel_ao_controls" left="0" width="96" /> 12 <panel bottom="13" filename="panel_ao_remote_controls.xml" name="panel_ao_controls" left="0" width="96" />
10</panel> 13</panel>