diff options
author | McCabe Maxsted | 2011-05-10 18:43:21 -0700 |
---|---|---|
committer | McCabe Maxsted | 2011-06-08 23:26:43 -0700 |
commit | 372b1a5a432320ab4770a4eeb5cdc59a6332aab7 (patch) | |
tree | 5c6568d55919efff41517764241f069633c91ef2 /linden/indra/newview/floaterao.cpp | |
parent | Added some log info when ao_template.ini can't be found (diff) | |
download | meta-impy-372b1a5a432320ab4770a4eeb5cdc59a6332aab7.zip meta-impy-372b1a5a432320ab4770a4eeb5cdc59a6332aab7.tar.gz meta-impy-372b1a5a432320ab4770a4eeb5cdc59a6332aab7.tar.bz2 meta-impy-372b1a5a432320ab4770a4eeb5cdc59a6332aab7.tar.xz |
Fixed AO loading on startup and did some light cleanup for readability's sake. The AO now checks for the notecard every 10 seconds until it's loaded. This whole feature could really use a major refactor
Diffstat (limited to 'linden/indra/newview/floaterao.cpp')
-rw-r--r-- | linden/indra/newview/floaterao.cpp | 841 |
1 files changed, 554 insertions, 287 deletions
diff --git a/linden/indra/newview/floaterao.cpp b/linden/indra/newview/floaterao.cpp index 444e395..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 | ||
37 | static LLFrameTimer sInitTimer; | ||
38 | |||
37 | void cmdline_printchat(std::string message); | 39 | void cmdline_printchat(std::string message); |
38 | 40 | ||
39 | AOInvTimer* gAOInvTimer = NULL; | 41 | AOInvTimer* gAOInvTimer = NULL; |
@@ -118,37 +120,71 @@ BOOL AOStandTimer::tick() | |||
118 | 120 | ||
119 | // ------------------------------------------------------- | 121 | // ------------------------------------------------------- |
120 | 122 | ||
123 | BOOL AOInvTimer::sInitialized = FALSE; | ||
124 | |||
121 | AOInvTimer::AOInvTimer() : LLEventTimer( (F32)1.0 ) | 125 | AOInvTimer::AOInvTimer() : LLEventTimer( (F32)1.0 ) |
122 | { | 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 | } | ||
123 | } | 151 | } |
152 | |||
124 | AOInvTimer::~AOInvTimer() | 153 | AOInvTimer::~AOInvTimer() |
125 | { | 154 | { |
126 | } | 155 | } |
127 | 156 | ||
128 | BOOL AOInvTimer::fullfetch = FALSE; | ||
129 | |||
130 | BOOL AOInvTimer::tick() | 157 | BOOL AOInvTimer::tick() |
131 | { | 158 | { |
132 | if (!(gSavedSettings.getBOOL("AOEnabled"))) return TRUE; | 159 | /*if (!(gSavedSettings.getBOOL("AOEnabled"))) |
133 | if(LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) | 160 | { |
161 | return TRUE; | ||
162 | }*/ | ||
163 | |||
164 | if (gInventory.isEverythingFetched()) | ||
134 | { | 165 | { |
135 | if(gInventory.isEverythingFetched()) | 166 | if (!sInitialized) |
136 | { | 167 | { |
137 | // cmdline_printchat("Inventory fetched, loading AO."); | ||
138 | LLFloaterAO::init(); | 168 | LLFloaterAO::init(); |
139 | return TRUE; | 169 | sInitialized = TRUE; // this can happen even if we can't initialize the AO -- MC |
140 | }else | 170 | } |
171 | |||
172 | if (sInitTimer.getStarted()) | ||
141 | { | 173 | { |
142 | //static BOOL startedfetch = FALSE; | 174 | sInitTimer.stop(); |
143 | if(fullfetch == FALSE) | ||
144 | { | ||
145 | fullfetch = TRUE; | ||
146 | //no choice, can't move the AO till we find it, should only have to happen once | ||
147 | gInventory.startBackgroundFetch(); | ||
148 | } | ||
149 | } | 175 | } |
150 | } | 176 | } |
151 | 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; | ||
152 | } | 188 | } |
153 | // NC DROP ------------------------------------------------------- | 189 | // NC DROP ------------------------------------------------------- |
154 | 190 | ||
@@ -215,40 +251,40 @@ BOOL AONoteCardDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, | |||
215 | return handled; | 251 | return handled; |
216 | } | 252 | } |
217 | 253 | ||
218 | AONoteCardDropTarget * LLFloaterAO::mAOItemDropTarget; | 254 | AONoteCardDropTarget * LLFloaterAO::sAOItemDropTarget; |
219 | 255 | ||
220 | 256 | ||
221 | // STUFF ------------------------------------------------------- | 257 | // STUFF ------------------------------------------------------- |
222 | 258 | ||
223 | int LLFloaterAO::mAnimationState = 0; | 259 | S32 LLFloaterAO::sAnimationState = 0; |
224 | int LLFloaterAO::stand_iterator = 0; | 260 | S32 LLFloaterAO::stand_iterator = 0; |
225 | 261 | ||
226 | LLUUID LLFloaterAO::invfolderid = LLUUID::null; | 262 | LLUUID LLFloaterAO::invfolderid = LLUUID::null; |
227 | LLUUID LLFloaterAO::mCurrentStandId = LLUUID::null; | 263 | LLUUID LLFloaterAO::sCurrentStandId = LLUUID::null; |
228 | 264 | ||
229 | LLComboBox* mcomboBox_stands; | 265 | LLComboBox* mComboBox_stands; |
230 | LLComboBox* mcomboBox_walks; | 266 | LLComboBox* mComboBox_walks; |
231 | LLComboBox* mcomboBox_runs; | 267 | LLComboBox* mComboBox_runs; |
232 | LLComboBox* mcomboBox_jumps; | 268 | LLComboBox* mComboBox_jumps; |
233 | LLComboBox* mcomboBox_sits; | 269 | LLComboBox* mComboBox_sits; |
234 | LLComboBox* mcomboBox_gsits; | 270 | LLComboBox* mComboBox_gsits; |
235 | LLComboBox* mcomboBox_crouchs; | 271 | LLComboBox* mComboBox_crouchs; |
236 | LLComboBox* mcomboBox_cwalks; | 272 | LLComboBox* mComboBox_cwalks; |
237 | LLComboBox* mcomboBox_falls; | 273 | LLComboBox* mComboBox_falls; |
238 | LLComboBox* mcomboBox_hovers; | 274 | LLComboBox* mComboBox_hovers; |
239 | LLComboBox* mcomboBox_flys; | 275 | LLComboBox* mComboBox_flys; |
240 | LLComboBox* mcomboBox_flyslows; | 276 | LLComboBox* mComboBox_flyslows; |
241 | LLComboBox* mcomboBox_flyups; | 277 | LLComboBox* mComboBox_flyups; |
242 | LLComboBox* mcomboBox_flydowns; | 278 | LLComboBox* mComboBox_flydowns; |
243 | LLComboBox* mcomboBox_lands; | 279 | LLComboBox* mComboBox_lands; |
244 | LLComboBox* mcomboBox_standups; | 280 | LLComboBox* mComboBox_standups; |
245 | LLComboBox* mcomboBox_prejumps; | 281 | LLComboBox* mComboBox_prejumps; |
246 | 282 | ||
247 | struct struct_overrides | 283 | struct struct_overrides |
248 | { | 284 | { |
249 | LLUUID orig_id; | 285 | LLUUID orig_id; |
250 | LLUUID ao_id; | 286 | LLUUID ao_id; |
251 | int state; | 287 | S32 state; |
252 | }; | 288 | }; |
253 | std::vector<struct_overrides> mAOOverrides; | 289 | std::vector<struct_overrides> mAOOverrides; |
254 | 290 | ||
@@ -262,14 +298,16 @@ std::vector<struct_stands> mAOStands; | |||
262 | struct struct_tokens | 298 | struct struct_tokens |
263 | { | 299 | { |
264 | std::string token; | 300 | std::string token; |
265 | int state; | 301 | S32 state; |
266 | }; | 302 | }; |
267 | std::vector<struct_tokens> mAOTokens; | 303 | std::vector<struct_tokens> mAOTokens; |
268 | 304 | ||
269 | LLFloaterAO* LLFloaterAO::sInstance = NULL; | 305 | LLFloaterAO* LLFloaterAO::sInstance = NULL; |
270 | 306 | ||
271 | LLFloaterAO::LLFloaterAO() | 307 | LLFloaterAO::LLFloaterAO() |
272 | :LLFloater(std::string("floater_ao")) | 308 | : |
309 | LLFloater(std::string("floater_ao")), | ||
310 | mDirty(FALSE) | ||
273 | { | 311 | { |
274 | // init(); | 312 | // init(); |
275 | llassert_always(sInstance == NULL); | 313 | llassert_always(sInstance == NULL); |
@@ -280,80 +318,55 @@ LLFloaterAO::LLFloaterAO() | |||
280 | LLFloaterAO::~LLFloaterAO() | 318 | LLFloaterAO::~LLFloaterAO() |
281 | { | 319 | { |
282 | sInstance=NULL; | 320 | sInstance=NULL; |
283 | mcomboBox_stands = 0; | 321 | mComboBox_stands = 0; |
284 | mcomboBox_walks = 0; | 322 | mComboBox_walks = 0; |
285 | mcomboBox_runs = 0; | 323 | mComboBox_runs = 0; |
286 | mcomboBox_jumps = 0; | 324 | mComboBox_jumps = 0; |
287 | mcomboBox_sits = 0; | 325 | mComboBox_sits = 0; |
288 | mcomboBox_gsits = 0; | 326 | mComboBox_gsits = 0; |
289 | mcomboBox_crouchs = 0; | 327 | mComboBox_crouchs = 0; |
290 | mcomboBox_cwalks = 0; | 328 | mComboBox_cwalks = 0; |
291 | mcomboBox_falls = 0; | 329 | mComboBox_falls = 0; |
292 | mcomboBox_hovers = 0; | 330 | mComboBox_hovers = 0; |
293 | mcomboBox_flys = 0; | 331 | mComboBox_flys = 0; |
294 | mcomboBox_flyslows = 0; | 332 | mComboBox_flyslows = 0; |
295 | mcomboBox_flyups = 0; | 333 | mComboBox_flyups = 0; |
296 | mcomboBox_flydowns = 0; | 334 | mComboBox_flydowns = 0; |
297 | mcomboBox_lands = 0; | 335 | mComboBox_lands = 0; |
298 | mcomboBox_standups = 0; | 336 | mComboBox_standups = 0; |
299 | mcomboBox_prejumps = 0; | 337 | mComboBox_prejumps = 0; |
300 | delete mAOItemDropTarget; | 338 | delete sAOItemDropTarget; |
301 | mAOItemDropTarget = NULL; | 339 | sAOItemDropTarget = NULL; |
302 | // llinfos << "floater destroyed" << llendl; | 340 | // llinfos << "floater destroyed" << llendl; |
303 | } | 341 | } |
304 | 342 | ||
305 | void LLFloaterAO::show(void*) | ||
306 | { | ||
307 | if (!sInstance) | ||
308 | { | ||
309 | sInstance = new LLFloaterAO(); | ||
310 | updateLayout(sInstance); | ||
311 | init(); | ||
312 | |||
313 | sInstance->open(); | ||
314 | } | ||
315 | else | ||
316 | { | ||
317 | sInstance->close(); | ||
318 | } | ||
319 | LLFirstUse::useAO(); | ||
320 | } | ||
321 | |||
322 | bool LLFloaterAO::getInstance() | ||
323 | { | ||
324 | if (sInstance) | ||
325 | return true; | ||
326 | else | ||
327 | return false; | ||
328 | } | ||
329 | |||
330 | BOOL LLFloaterAO::postBuild() | 343 | BOOL LLFloaterAO::postBuild() |
331 | { | 344 | { |
332 | LLView *target_view = getChild<LLView>("ao_notecard"); | 345 | LLView *target_view = getChild<LLView>("ao_notecard"); |
333 | if(target_view) | 346 | if (target_view) |
334 | { | 347 | { |
335 | if (mAOItemDropTarget) | 348 | if (sAOItemDropTarget) |
336 | { | 349 | { |
337 | delete mAOItemDropTarget; | 350 | delete sAOItemDropTarget; |
338 | } | 351 | } |
339 | mAOItemDropTarget = new AONoteCardDropTarget("drop target", target_view->getRect(), AOItemDrop);//, mAvatarID); | 352 | sAOItemDropTarget = new AONoteCardDropTarget("drop target", target_view->getRect(), AOItemDrop);//, mAvatarID); |
340 | addChild(mAOItemDropTarget); | 353 | addChild(sAOItemDropTarget); |
341 | } | 354 | } |
342 | if(LLStartUp::getStartupState() == STATE_STARTED) | 355 | if (LLStartUp::getStartupState() == STATE_STARTED) |
343 | { | 356 | { |
344 | LLUUID itemidimport = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); | 357 | LLUUID itemidimport = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); |
345 | LLViewerInventoryItem* itemimport = gInventory.getItem(itemidimport); | 358 | LLViewerInventoryItem* itemimport = gInventory.getItem(itemidimport); |
346 | if(itemimport) | 359 | if (itemimport) |
347 | { | 360 | { |
348 | childSetValue("ao_nc_text","Currently set to: "+itemimport->getName()); | 361 | childSetValue("ao_nc_text","Currently set to: "+itemimport->getName()); |
349 | } | 362 | } |
350 | else if(itemidimport.isNull()) | 363 | else if (itemidimport.isNull()) |
351 | { | 364 | { |
352 | childSetValue("ao_nc_text","Currently not set"); | 365 | childSetValue("ao_nc_text","Currently not set"); |
353 | } | 366 | } |
354 | else | 367 | else |
355 | { | 368 | { |
356 | childSetValue("ao_nc_text","Currently set to a item not on this account"); | 369 | childSetValue("ao_nc_text","Currently not loaded"); |
357 | } | 370 | } |
358 | } | 371 | } |
359 | else | 372 | else |
@@ -371,23 +384,23 @@ BOOL LLFloaterAO::postBuild() | |||
371 | childSetCommitCallback("AOEnabled",onClickToggleAO); | 384 | childSetCommitCallback("AOEnabled",onClickToggleAO); |
372 | childSetCommitCallback("AOSitsEnabled",onClickToggleSits); | 385 | childSetCommitCallback("AOSitsEnabled",onClickToggleSits); |
373 | childSetCommitCallback("standtime",onSpinnerCommit); | 386 | childSetCommitCallback("standtime",onSpinnerCommit); |
374 | mcomboBox_stands = getChild<LLComboBox>("stands"); | 387 | mComboBox_stands = getChild<LLComboBox>("stands"); |
375 | mcomboBox_walks = getChild<LLComboBox>("walks"); | 388 | mComboBox_walks = getChild<LLComboBox>("walks"); |
376 | mcomboBox_runs = getChild<LLComboBox>("runs"); | 389 | mComboBox_runs = getChild<LLComboBox>("runs"); |
377 | mcomboBox_jumps = getChild<LLComboBox>("jumps"); | 390 | mComboBox_jumps = getChild<LLComboBox>("jumps"); |
378 | mcomboBox_sits = getChild<LLComboBox>("sits"); | 391 | mComboBox_sits = getChild<LLComboBox>("sits"); |
379 | mcomboBox_gsits = getChild<LLComboBox>("gsits"); | 392 | mComboBox_gsits = getChild<LLComboBox>("gsits"); |
380 | mcomboBox_crouchs = getChild<LLComboBox>("crouchs"); | 393 | mComboBox_crouchs = getChild<LLComboBox>("crouchs"); |
381 | mcomboBox_cwalks = getChild<LLComboBox>("cwalks"); | 394 | mComboBox_cwalks = getChild<LLComboBox>("cwalks"); |
382 | mcomboBox_falls = getChild<LLComboBox>("falls"); | 395 | mComboBox_falls = getChild<LLComboBox>("falls"); |
383 | mcomboBox_hovers = getChild<LLComboBox>("hovers"); | 396 | mComboBox_hovers = getChild<LLComboBox>("hovers"); |
384 | mcomboBox_flys = getChild<LLComboBox>("flys"); | 397 | mComboBox_flys = getChild<LLComboBox>("flys"); |
385 | mcomboBox_flyslows = getChild<LLComboBox>("flyslows"); | 398 | mComboBox_flyslows = getChild<LLComboBox>("flyslows"); |
386 | mcomboBox_flyups = getChild<LLComboBox>("flyups"); | 399 | mComboBox_flyups = getChild<LLComboBox>("flyups"); |
387 | mcomboBox_flydowns = getChild<LLComboBox>("flydowns"); | 400 | mComboBox_flydowns = getChild<LLComboBox>("flydowns"); |
388 | mcomboBox_lands = getChild<LLComboBox>("lands"); | 401 | mComboBox_lands = getChild<LLComboBox>("lands"); |
389 | mcomboBox_standups = getChild<LLComboBox>("standups"); | 402 | mComboBox_standups = getChild<LLComboBox>("standups"); |
390 | mcomboBox_prejumps = getChild<LLComboBox>("prejumps"); | 403 | mComboBox_prejumps = getChild<LLComboBox>("prejumps"); |
391 | getChild<LLComboBox>("stands")->setCommitCallback(onComboBoxCommit); | 404 | getChild<LLComboBox>("stands")->setCommitCallback(onComboBoxCommit); |
392 | getChild<LLComboBox>("walks")->setCommitCallback(onComboBoxCommit); | 405 | getChild<LLComboBox>("walks")->setCommitCallback(onComboBoxCommit); |
393 | getChild<LLComboBox>("runs")->setCommitCallback(onComboBoxCommit); | 406 | getChild<LLComboBox>("runs")->setCommitCallback(onComboBoxCommit); |
@@ -409,10 +422,49 @@ BOOL LLFloaterAO::postBuild() | |||
409 | return TRUE; | 422 | return TRUE; |
410 | } | 423 | } |
411 | 424 | ||
425 | // static | ||
426 | void 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 | ||
444 | LLFloaterAO* LLFloaterAO::getInstance() | ||
445 | { | ||
446 | if (!sInstance) | ||
447 | { | ||
448 | sInstance = new LLFloaterAO(); | ||
449 | } | ||
450 | return sInstance; | ||
451 | } | ||
452 | |||
453 | // static | ||
454 | bool LLFloaterAO::getVisible() | ||
455 | { | ||
456 | if (sInstance) | ||
457 | { | ||
458 | return true; | ||
459 | } | ||
460 | return false; | ||
461 | } | ||
462 | |||
463 | // static | ||
412 | void LLFloaterAO::onSpinnerCommit(LLUICtrl* ctrl, void* userdata) | 464 | void LLFloaterAO::onSpinnerCommit(LLUICtrl* ctrl, void* userdata) |
413 | { | 465 | { |
414 | LLSpinCtrl* spin = (LLSpinCtrl*) ctrl; | 466 | LLSpinCtrl* spin = (LLSpinCtrl*)ctrl; |
415 | if(spin) | 467 | if (spin) |
416 | { | 468 | { |
417 | if (spin->getName() == "standtime") | 469 | if (spin->getName() == "standtime") |
418 | { | 470 | { |
@@ -421,10 +473,11 @@ void LLFloaterAO::onSpinnerCommit(LLUICtrl* ctrl, void* userdata) | |||
421 | } | 473 | } |
422 | } | 474 | } |
423 | 475 | ||
476 | // static | ||
424 | void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) | 477 | void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) |
425 | { | 478 | { |
426 | LLComboBox* box = (LLComboBox*)ctrl; | 479 | LLComboBox* box = (LLComboBox*)ctrl; |
427 | if(box) | 480 | if (box) |
428 | { | 481 | { |
429 | if (box->getName() == "stands") | 482 | if (box->getName() == "stands") |
430 | { | 483 | { |
@@ -434,7 +487,7 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) | |||
434 | } | 487 | } |
435 | else | 488 | else |
436 | { | 489 | { |
437 | int state = STATE_AGENT_IDLE; | 490 | S32 state = STATE_AGENT_IDLE; |
438 | std::string stranim = box->getValue().asString(); | 491 | std::string stranim = box->getValue().asString(); |
439 | // llinfos << "state " << (gAgent.getAvatarObject()->mIsSitting) << " - " << getAnimationState() << llendl; | 492 | // llinfos << "state " << (gAgent.getAvatarObject()->mIsSitting) << " - " << getAnimationState() << llendl; |
440 | if (box->getName() == "walks") | 493 | if (box->getName() == "walks") |
@@ -561,6 +614,7 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) | |||
561 | } | 614 | } |
562 | } | 615 | } |
563 | 616 | ||
617 | // static | ||
564 | void LLFloaterAO::updateLayout(LLFloaterAO* floater) | 618 | void LLFloaterAO::updateLayout(LLFloaterAO* floater) |
565 | { | 619 | { |
566 | if (floater) | 620 | if (floater) |
@@ -618,8 +672,10 @@ void LLFloaterAO::updateLayout(LLFloaterAO* floater) | |||
618 | } | 672 | } |
619 | } | 673 | } |
620 | 674 | ||
621 | void LLFloaterAO::init() | 675 | // static |
676 | bool LLFloaterAO::init() | ||
622 | { | 677 | { |
678 | //cmdline_printchat("init() called"); | ||
623 | mAOStands.clear(); | 679 | mAOStands.clear(); |
624 | mAOTokens.clear(); | 680 | mAOTokens.clear(); |
625 | mAOOverrides.clear(); | 681 | mAOOverrides.clear(); |
@@ -678,82 +734,87 @@ void LLFloaterAO::init() | |||
678 | 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); |
679 | 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); |
680 | 736 | ||
681 | BOOL success = TRUE; | 737 | BOOL success = FALSE; |
682 | 738 | ||
683 | if(LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) | 739 | if (LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) |
684 | { | 740 | { |
685 | if(gInventory.isEverythingFetched()) | 741 | LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); |
742 | if (configncitem.notNull()) | ||
686 | { | 743 | { |
687 | LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); | 744 | const LLInventoryItem* item = gInventory.getItem(configncitem); |
688 | if (configncitem.notNull()) | 745 | if (item) |
689 | { | 746 | { |
690 | success = FALSE; | 747 | if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) |
691 | const LLInventoryItem* item = gInventory.getItem(configncitem); | ||
692 | if(item) | ||
693 | { | 748 | { |
694 | if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) | 749 | if (!item->getAssetUUID().isNull()) |
695 | { | 750 | { |
696 | if(!item->getAssetUUID().isNull()) | 751 | LLUUID* new_uuid = new LLUUID(configncitem); |
697 | { | 752 | LLHost source_sim = LLHost::invalid; |
698 | LLUUID* new_uuid = new LLUUID(configncitem); | 753 | invfolderid = item->getParentUUID(); |
699 | LLHost source_sim = LLHost::invalid; | 754 | gAssetStorage->getInvItemAsset(source_sim, |
700 | invfolderid = item->getParentUUID(); | 755 | gAgent.getID(), |
701 | gAssetStorage->getInvItemAsset(source_sim, | 756 | gAgent.getSessionID(), |
702 | gAgent.getID(), | 757 | item->getPermissions().getOwner(), |
703 | gAgent.getSessionID(), | 758 | LLUUID::null, |
704 | item->getPermissions().getOwner(), | 759 | item->getUUID(), |
705 | LLUUID::null, | 760 | item->getAssetUUID(), |
706 | item->getUUID(), | 761 | item->getType(), |
707 | item->getAssetUUID(), | 762 | &onNotecardLoadComplete, |
708 | item->getType(), | 763 | (void*)new_uuid, |
709 | &onNotecardLoadComplete, | 764 | TRUE); |
710 | (void*)new_uuid, | 765 | success = TRUE; |
711 | TRUE); | ||
712 | success = TRUE; | ||
713 | } | ||
714 | } | 766 | } |
715 | } | 767 | } |
716 | } | 768 | } |
769 | else // item | ||
770 | { | ||
771 | //cmdline_printchat("no item (notecard)"); | ||
772 | } | ||
717 | } | 773 | } |
718 | } | 774 | } |
719 | 775 | else // notecard null | |
720 | if (!success) | ||
721 | { | 776 | { |
722 | cmdline_printchat("Could not read the specified Config Notecard"); | 777 | //cmdline_printchat("Config Notecard set to a null UUID!"); |
723 | } | 778 | } |
724 | 779 | ||
725 | // mAnimationState = 0; | 780 | // sAnimationState = 0; |
726 | // mCurrentStandId = LLUUID::null; | 781 | // sCurrentStandId = LLUUID::null; |
727 | // setAnimationState(STATE_AGENT_IDLE); | 782 | // setAnimationState(STATE_AGENT_IDLE); |
728 | 783 | ||
784 | return success; | ||
729 | } | 785 | } |
730 | 786 | ||
787 | // static | ||
731 | void LLFloaterAO::onClickMore(void* data) | 788 | void LLFloaterAO::onClickMore(void* data) |
732 | { | 789 | { |
733 | gSavedSettings.setBOOL( "AOAdvanced", TRUE ); | 790 | gSavedSettings.setBOOL( "AOAdvanced", TRUE ); |
734 | updateLayout(sInstance); | 791 | updateLayout(sInstance); |
735 | } | 792 | } |
793 | |||
794 | // static | ||
736 | void LLFloaterAO::onClickLess(void* data) | 795 | void LLFloaterAO::onClickLess(void* data) |
737 | { | 796 | { |
738 | gSavedSettings.setBOOL( "AOAdvanced", FALSE ); | 797 | gSavedSettings.setBOOL( "AOAdvanced", FALSE ); |
739 | updateLayout(sInstance); | 798 | updateLayout(sInstance); |
740 | } | 799 | } |
741 | 800 | ||
801 | // static | ||
742 | void LLFloaterAO::onClickToggleAO(LLUICtrl *, void*) | 802 | void LLFloaterAO::onClickToggleAO(LLUICtrl *, void*) |
743 | { | 803 | { |
744 | run(); | 804 | run(); |
745 | } | 805 | } |
746 | 806 | ||
807 | // static | ||
747 | void LLFloaterAO::onClickToggleSits(LLUICtrl *, void*) | 808 | void LLFloaterAO::onClickToggleSits(LLUICtrl *, void*) |
748 | { | 809 | { |
749 | run(); | 810 | run(); |
750 | } | 811 | } |
751 | 812 | ||
752 | 813 | // static | |
753 | void LLFloaterAO::run() | 814 | void LLFloaterAO::run() |
754 | { | 815 | { |
755 | setAnimationState(STATE_AGENT_IDLE); // reset state | 816 | setAnimationState(STATE_AGENT_IDLE); // reset state |
756 | int state = getAnimationState(); // check if sitting or hovering | 817 | S32 state = getAnimationState(); // check if sitting or hovering |
757 | if ((state == STATE_AGENT_IDLE) || (state == STATE_AGENT_STAND)) | 818 | if ((state == STATE_AGENT_IDLE) || (state == STATE_AGENT_STAND)) |
758 | { | 819 | { |
759 | if (gSavedSettings.getBOOL("AOEnabled")) | 820 | if (gSavedSettings.getBOOL("AOEnabled")) |
@@ -776,98 +837,158 @@ void LLFloaterAO::run() | |||
776 | } | 837 | } |
777 | else | 838 | else |
778 | { | 839 | { |
779 | 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) |
780 | 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 | } | ||
781 | } | 848 | } |
782 | } | 849 | } |
783 | 850 | ||
784 | int LLFloaterAO::getAnimationState() | 851 | // static |
852 | S32 LLFloaterAO::getAnimationState() | ||
785 | { | 853 | { |
786 | if (gAgent.getAvatarObject()) | 854 | if (gAgent.getAvatarObject()) |
787 | { | 855 | { |
788 | if (gAgent.getAvatarObject()->mIsSitting) setAnimationState(STATE_AGENT_SIT); | 856 | if (gAgent.getAvatarObject()->mIsSitting) |
789 | 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 | } | ||
790 | } | 864 | } |
791 | return mAnimationState; | 865 | return sAnimationState; |
792 | } | 866 | } |
793 | 867 | ||
794 | void LLFloaterAO::setAnimationState(const int state) | 868 | // static |
869 | void LLFloaterAO::setAnimationState(const S32 state) | ||
795 | { | 870 | { |
796 | mAnimationState = state; | 871 | sAnimationState = state; |
797 | } | 872 | } |
798 | 873 | ||
874 | // static | ||
799 | LLUUID LLFloaterAO::getCurrentStandId() | 875 | LLUUID LLFloaterAO::getCurrentStandId() |
800 | { | 876 | { |
801 | return mCurrentStandId; | 877 | return sCurrentStandId; |
802 | } | 878 | } |
803 | 879 | ||
880 | // static | ||
804 | void LLFloaterAO::setCurrentStandId(const LLUUID& id) | 881 | void LLFloaterAO::setCurrentStandId(const LLUUID& id) |
805 | { | 882 | { |
806 | mCurrentStandId = id; | 883 | sCurrentStandId = id; |
807 | } | 884 | } |
808 | 885 | ||
886 | // static | ||
809 | void LLFloaterAO::AOItemDrop(LLViewerInventoryItem* item) | 887 | void LLFloaterAO::AOItemDrop(LLViewerInventoryItem* item) |
810 | { | 888 | { |
811 | gSavedPerAccountSettings.setString("AOConfigNotecardID", item->getUUID().asString()); | 889 | gSavedPerAccountSettings.setString("AOConfigNotecardID", item->getUUID().asString()); |
812 | sInstance->childSetValue("ao_nc_text","Currently set to: "+item->getName()); | 890 | sInstance->childSetValue("ao_nc_text","Currently set to: "+item->getName()); |
813 | } | 891 | } |
814 | 892 | ||
893 | // static | ||
815 | LLUUID LLFloaterAO::GetAnimID(const LLUUID& id) | 894 | LLUUID LLFloaterAO::GetAnimID(const LLUUID& id) |
816 | { | 895 | { |
817 | 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) |
818 | { | 897 | { |
819 | if (iter->orig_id == id) return iter->ao_id; | 898 | if (iter->orig_id == id) |
899 | { | ||
900 | return iter->ao_id; | ||
901 | } | ||
820 | } | 902 | } |
821 | return LLUUID::null; | 903 | return LLUUID::null; |
822 | } | 904 | } |
823 | 905 | ||
824 | int LLFloaterAO::GetStateFromAnimID(const LLUUID& id) | 906 | // static |
907 | S32 LLFloaterAO::GetStateFromAnimID(const LLUUID& id) | ||
825 | { | 908 | { |
826 | 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) |
827 | { | 910 | { |
828 | if (iter->orig_id == id) return iter->state; | 911 | if (iter->orig_id == id) |
912 | { | ||
913 | return iter->state; | ||
914 | } | ||
829 | } | 915 | } |
830 | return STATE_AGENT_IDLE; | 916 | return STATE_AGENT_IDLE; |
831 | } | 917 | } |
832 | 918 | ||
833 | LLUUID LLFloaterAO::GetAnimIDFromState(const int state) | 919 | // static |
920 | LLUUID LLFloaterAO::GetAnimIDFromState(const S32 state) | ||
834 | { | 921 | { |
835 | 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) |
836 | { | 923 | { |
837 | if (iter->state == state) return iter->ao_id; | 924 | if (iter->state == state) |
925 | { | ||
926 | return iter->ao_id; | ||
927 | } | ||
838 | } | 928 | } |
839 | return LLUUID::null; | 929 | return LLUUID::null; |
840 | } | 930 | } |
841 | 931 | ||
842 | int LLFloaterAO::GetStateFromToken(std::string strtoken) | 932 | // static |
933 | S32 LLFloaterAO::GetStateFromToken(std::string strtoken) | ||
843 | { | 934 | { |
844 | 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) |
845 | { | 936 | { |
846 | if (iter->token == strtoken) return iter->state; | 937 | if (iter->token == strtoken) |
938 | { | ||
939 | return iter->state; | ||
940 | } | ||
847 | } | 941 | } |
848 | return STATE_AGENT_IDLE; | 942 | return STATE_AGENT_IDLE; |
849 | } | 943 | } |
850 | 944 | ||
945 | // static | ||
851 | void LLFloaterAO::onClickPrevStand(void* user_data) | 946 | void LLFloaterAO::onClickPrevStand(void* user_data) |
852 | { | 947 | { |
853 | if (!(mAOStands.size() > 0)) return; | 948 | if (!(mAOStands.size() > 0)) |
854 | stand_iterator=stand_iterator-1; | 949 | { |
855 | if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); | 950 | return; |
856 | 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 | |||
857 | 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())); |
858 | ChangeStand(); | 965 | ChangeStand(); |
859 | } | 966 | } |
860 | 967 | ||
968 | // static | ||
861 | void LLFloaterAO::onClickNextStand(void* user_data) | 969 | void LLFloaterAO::onClickNextStand(void* user_data) |
862 | { | 970 | { |
863 | if (!(mAOStands.size() > 0)) return; | 971 | if (!(mAOStands.size() > 0)) |
864 | stand_iterator=stand_iterator+1; | 972 | { |
865 | if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); | 973 | return; |
866 | 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 | |||
867 | 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())); |
868 | ChangeStand(); | 988 | ChangeStand(); |
869 | } | 989 | } |
870 | 990 | ||
991 | // static | ||
871 | BOOL LLFloaterAO::ChangeStand() | 992 | BOOL LLFloaterAO::ChangeStand() |
872 | { | 993 | { |
873 | if (gSavedSettings.getBOOL("AOEnabled")) | 994 | if (gSavedSettings.getBOOL("AOEnabled")) |
@@ -886,17 +1007,32 @@ BOOL LLFloaterAO::ChangeStand() | |||
886 | } | 1007 | } |
887 | 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 |
888 | { | 1009 | { |
889 | if (!(mAOStands.size() > 0)) return TRUE; | 1010 | if (!(mAOStands.size() > 0)) |
1011 | { | ||
1012 | return TRUE; | ||
1013 | } | ||
1014 | |||
890 | if (gSavedSettings.getBOOL("AOStandRandomize")) | 1015 | if (gSavedSettings.getBOOL("AOStandRandomize")) |
891 | { | 1016 | { |
892 | stand_iterator = ll_rand(mAOStands.size()-1); | 1017 | stand_iterator = ll_rand(mAOStands.size()-1); |
893 | } | 1018 | } |
894 | if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); | ||
895 | if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0; | ||
896 | 1019 | ||
897 | 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; | ||
898 | 1031 | ||
899 | 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 | } | ||
900 | 1036 | ||
901 | if (mAOStands[stand_iterator].ao_id.notNull()) | 1037 | if (mAOStands[stand_iterator].ao_id.notNull()) |
902 | { | 1038 | { |
@@ -905,7 +1041,10 @@ BOOL LLFloaterAO::ChangeStand() | |||
905 | 1041 | ||
906 | setAnimationState(STATE_AGENT_STAND); | 1042 | setAnimationState(STATE_AGENT_STAND); |
907 | setCurrentStandId(mAOStands[stand_iterator].ao_id); | 1043 | setCurrentStandId(mAOStands[stand_iterator].ao_id); |
908 | if ((sInstance)&&(mcomboBox_stands)) mcomboBox_stands->selectNthItem(stand_iterator); | 1044 | if (sInstance && mComboBox_stands) |
1045 | { | ||
1046 | mComboBox_stands->selectNthItem(stand_iterator); | ||
1047 | } | ||
909 | // llinfos << "changing stand to " << mAOStands[stand_iterator].anim_name << llendl; | 1048 | // llinfos << "changing stand to " << mAOStands[stand_iterator].anim_name << llendl; |
910 | return FALSE; | 1049 | return FALSE; |
911 | } | 1050 | } |
@@ -931,7 +1070,10 @@ BOOL LLFloaterAO::startMotion(const LLUUID& id, F32 time_offset, BOOL stand) | |||
931 | { | 1070 | { |
932 | sitting = gAgent.getAvatarObject()->mIsSitting; | 1071 | sitting = gAgent.getAvatarObject()->mIsSitting; |
933 | } | 1072 | } |
934 | if (sitting) return FALSE; | 1073 | if (sitting) |
1074 | { | ||
1075 | return FALSE; | ||
1076 | } | ||
935 | gAgent.sendAnimationRequest(id, ANIM_REQUEST_START); | 1077 | gAgent.sendAnimationRequest(id, ANIM_REQUEST_START); |
936 | return TRUE; | 1078 | return TRUE; |
937 | } | 1079 | } |
@@ -944,7 +1086,10 @@ BOOL LLFloaterAO::startMotion(const LLUUID& id, F32 time_offset, BOOL stand) | |||
944 | setAnimationState(GetStateFromAnimID(id)); | 1086 | setAnimationState(GetStateFromAnimID(id)); |
945 | 1087 | ||
946 | // llinfos << " state " << getAnimationState() << " start anim " << id << " overriding with " << GetAnimID(id) << llendl; | 1088 | // llinfos << " state " << getAnimationState() << " start anim " << id << " overriding with " << GetAnimID(id) << llendl; |
947 | 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 | } | ||
948 | gAgent.sendAnimationRequest(GetAnimID(id), ANIM_REQUEST_START); | 1093 | gAgent.sendAnimationRequest(GetAnimID(id), ANIM_REQUEST_START); |
949 | return TRUE; | 1094 | return TRUE; |
950 | } | 1095 | } |
@@ -977,35 +1122,36 @@ BOOL LLFloaterAO::stopMotion(const LLUUID& id, BOOL stop_immediate, BOOL stand) | |||
977 | return FALSE; | 1122 | return FALSE; |
978 | } | 1123 | } |
979 | 1124 | ||
1125 | // static | ||
980 | void LLFloaterAO::onClickReloadCard(void* user_data) | 1126 | void LLFloaterAO::onClickReloadCard(void* user_data) |
981 | { | 1127 | { |
982 | if(gInventory.isEverythingFetched()) | 1128 | LLFloaterAO::init(); |
983 | { | ||
984 | LLFloaterAO::init(); | ||
985 | } | ||
986 | } | 1129 | } |
987 | 1130 | ||
1131 | // static | ||
988 | void LLFloaterAO::onClickOpenCard(void* user_data) | 1132 | void LLFloaterAO::onClickOpenCard(void* user_data) |
989 | { | 1133 | { |
990 | if(gInventory.isEverythingFetched()) | 1134 | LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); |
1135 | if (configncitem.notNull()) | ||
991 | { | 1136 | { |
992 | LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); | 1137 | const LLInventoryItem* item = gInventory.getItem(configncitem); |
993 | if (configncitem.notNull()) | 1138 | if (item) |
994 | { | 1139 | { |
995 | const LLInventoryItem* item = gInventory.getItem(configncitem); | 1140 | if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) |
996 | if(item) | ||
997 | { | 1141 | { |
998 | if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) | 1142 | if(!item->getAssetUUID().isNull()) |
999 | { | 1143 | open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE); |
1000 | if(!item->getAssetUUID().isNull()) | 1144 | // open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE, LLUUID::null, FALSE); |
1001 | open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE); | ||
1002 | // open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE, LLUUID::null, FALSE); | ||
1003 | } | ||
1004 | } | 1145 | } |
1005 | } | 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 | } | ||
1006 | } | 1151 | } |
1007 | } | 1152 | } |
1008 | 1153 | ||
1154 | // static | ||
1009 | void LLFloaterAO::onClickNewCard(void* user_data) | 1155 | void LLFloaterAO::onClickNewCard(void* user_data) |
1010 | { | 1156 | { |
1011 | // load the template file from app_settings/ao_template.ini then | 1157 | // load the template file from app_settings/ao_template.ini then |
@@ -1031,15 +1177,16 @@ struct AOAssetInfo | |||
1031 | std::string name; | 1177 | std::string name; |
1032 | }; | 1178 | }; |
1033 | 1179 | ||
1180 | // static | ||
1034 | void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status) | 1181 | void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status) |
1035 | { | 1182 | { |
1036 | if(status == LL_ERR_NOERR) | 1183 | if (status == LL_ERR_NOERR) |
1037 | { | 1184 | { |
1038 | S32 size = vfs->getSize(asset_uuid, type); | 1185 | S32 size = vfs->getSize(asset_uuid, type); |
1039 | U8* buffer = new U8[size]; | 1186 | U8* buffer = new U8[size]; |
1040 | vfs->getData(asset_uuid, type, buffer, 0, size); | 1187 | vfs->getData(asset_uuid, type, buffer, 0, size); |
1041 | 1188 | ||
1042 | if(type == LLAssetType::AT_NOTECARD) | 1189 | if (type == LLAssetType::AT_NOTECARD) |
1043 | { | 1190 | { |
1044 | LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,""); | 1191 | LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,""); |
1045 | if(edit->importBuffer((char*)buffer, (S32)size)) | 1192 | if(edit->importBuffer((char*)buffer, (S32)size)) |
@@ -1048,27 +1195,43 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA | |||
1048 | std::string card = edit->getText(); | 1195 | std::string card = edit->getText(); |
1049 | edit->die(); | 1196 | edit->die(); |
1050 | 1197 | ||
1051 | if (mcomboBox_stands) | 1198 | if (sInstance && mComboBox_stands) |
1052 | { | 1199 | { |
1053 | mcomboBox_stands->clear(); | 1200 | mComboBox_stands->clear(); |
1054 | mcomboBox_stands->removeall(); | 1201 | mComboBox_stands->removeall(); |
1055 | } | 1202 | } |
1056 | if (mcomboBox_walks) mcomboBox_walks->clear(); | 1203 | if (sInstance && mComboBox_walks) |
1057 | if (mcomboBox_runs) mcomboBox_runs->clear(); | 1204 | mComboBox_walks->clear(); |
1058 | if (mcomboBox_jumps) mcomboBox_jumps->clear(); | 1205 | if (sInstance && mComboBox_runs) |
1059 | if (mcomboBox_sits) mcomboBox_sits->clear(); | 1206 | mComboBox_runs->clear(); |
1060 | if (mcomboBox_gsits) mcomboBox_gsits->clear(); | 1207 | if (sInstance && mComboBox_jumps) |
1061 | if (mcomboBox_crouchs) mcomboBox_cwalks->clear(); | 1208 | mComboBox_jumps->clear(); |
1062 | if (mcomboBox_cwalks) mcomboBox_cwalks->clear(); | 1209 | if (sInstance && mComboBox_sits) |
1063 | if (mcomboBox_falls) mcomboBox_falls->clear(); | 1210 | mComboBox_sits->clear(); |
1064 | if (mcomboBox_hovers) mcomboBox_hovers->clear(); | 1211 | if (sInstance && mComboBox_gsits) |
1065 | if (mcomboBox_flys) mcomboBox_flys->clear(); | 1212 | mComboBox_gsits->clear(); |
1066 | if (mcomboBox_flyslows) mcomboBox_flyslows->clear(); | 1213 | if (sInstance && mComboBox_crouchs) |
1067 | if (mcomboBox_flyups) mcomboBox_flyups->clear(); | 1214 | mComboBox_cwalks->clear(); |
1068 | if (mcomboBox_flydowns) mcomboBox_flydowns->clear(); | 1215 | if (sInstance && mComboBox_cwalks) |
1069 | if (mcomboBox_lands) mcomboBox_lands->clear(); | 1216 | mComboBox_cwalks->clear(); |
1070 | if (mcomboBox_standups) mcomboBox_standups->clear(); | 1217 | if (sInstance && mComboBox_falls) |
1071 | 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(); | ||
1072 | 1235 | ||
1073 | 1236 | ||
1074 | struct_stands loader; | 1237 | struct_stands loader; |
@@ -1111,134 +1274,185 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA | |||
1111 | { | 1274 | { |
1112 | case STATE_AGENT_STAND: | 1275 | case STATE_AGENT_STAND: |
1113 | 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); |
1114 | 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 | } | ||
1115 | break; | 1281 | break; |
1116 | case STATE_AGENT_WALK: | 1282 | case STATE_AGENT_WALK: |
1117 | { | 1283 | { |
1118 | if (sInstance && (mcomboBox_walks != NULL)) | 1284 | if (sInstance && mComboBox_walks != NULL) |
1119 | { | 1285 | { |
1120 | //llinfos << "1 anim: " << stranim.c_str() << " assetid: " << animid << llendl; | 1286 | //llinfos << "1 anim: " << stranim.c_str() << " assetid: " << animid << llendl; |
1121 | 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 | } | ||
1122 | } | 1291 | } |
1123 | } | 1292 | } |
1124 | break; | 1293 | break; |
1125 | case STATE_AGENT_RUN: | 1294 | case STATE_AGENT_RUN: |
1126 | { | 1295 | { |
1127 | if (sInstance && (mcomboBox_runs != NULL)) | 1296 | if (sInstance && mComboBox_runs != NULL) |
1128 | { | 1297 | { |
1129 | 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 | } | ||
1130 | } | 1302 | } |
1131 | } | 1303 | } |
1132 | break; | 1304 | break; |
1133 | case STATE_AGENT_JUMP: | 1305 | case STATE_AGENT_JUMP: |
1134 | { | 1306 | { |
1135 | if (sInstance && (mcomboBox_jumps != NULL)) | 1307 | if (sInstance && mComboBox_jumps != NULL) |
1136 | { | 1308 | { |
1137 | 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 | } | ||
1138 | } | 1313 | } |
1139 | } | 1314 | } |
1140 | break; | 1315 | break; |
1141 | case STATE_AGENT_SIT: | 1316 | case STATE_AGENT_SIT: |
1142 | { | 1317 | { |
1143 | if (sInstance && (mcomboBox_sits != NULL)) | 1318 | if (sInstance && mComboBox_sits != NULL) |
1144 | { | 1319 | { |
1145 | 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 | } | ||
1146 | } | 1324 | } |
1147 | } | 1325 | } |
1148 | break; | 1326 | break; |
1149 | case STATE_AGENT_GROUNDSIT: | 1327 | case STATE_AGENT_GROUNDSIT: |
1150 | { | 1328 | { |
1151 | if (sInstance && (mcomboBox_gsits != NULL)) | 1329 | if (sInstance && mComboBox_gsits != NULL) |
1152 | { | 1330 | { |
1153 | 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 | } | ||
1154 | } | 1335 | } |
1155 | } | 1336 | } |
1156 | break; | 1337 | break; |
1157 | case STATE_AGENT_CROUCH: | 1338 | case STATE_AGENT_CROUCH: |
1158 | { | 1339 | { |
1159 | if (sInstance && (mcomboBox_crouchs != NULL)) | 1340 | if (sInstance && mComboBox_crouchs != NULL) |
1160 | { | 1341 | { |
1161 | 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 | } | ||
1162 | } | 1346 | } |
1163 | } | 1347 | } |
1164 | break; | 1348 | break; |
1165 | case STATE_AGENT_CROUCHWALK: | 1349 | case STATE_AGENT_CROUCHWALK: |
1166 | { | 1350 | { |
1167 | if (sInstance && (mcomboBox_cwalks != NULL)) | 1351 | if (sInstance && mComboBox_cwalks != NULL) |
1168 | { | 1352 | { |
1169 | 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 | } | ||
1170 | } | 1357 | } |
1171 | } | 1358 | } |
1172 | break; | 1359 | break; |
1173 | case STATE_AGENT_FALLDOWN: | 1360 | case STATE_AGENT_FALLDOWN: |
1174 | { | 1361 | { |
1175 | if (sInstance && (mcomboBox_falls != NULL)) | 1362 | if (sInstance && mComboBox_falls != NULL) |
1176 | { | 1363 | { |
1177 | 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 | } | ||
1178 | } | 1368 | } |
1179 | } | 1369 | } |
1180 | break; | 1370 | break; |
1181 | case STATE_AGENT_HOVER: | 1371 | case STATE_AGENT_HOVER: |
1182 | { | 1372 | { |
1183 | if (sInstance && (mcomboBox_hovers != NULL)) | 1373 | if (sInstance && mComboBox_hovers != NULL) |
1184 | { | 1374 | { |
1185 | 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 | } | ||
1186 | } | 1379 | } |
1187 | } | 1380 | } |
1188 | break; | 1381 | break; |
1189 | case STATE_AGENT_FLY: | 1382 | case STATE_AGENT_FLY: |
1190 | { | 1383 | { |
1191 | if (sInstance && (mcomboBox_flys != NULL)) | 1384 | if (sInstance && mComboBox_flys != NULL) |
1192 | { | 1385 | { |
1193 | 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 | } | ||
1194 | } | 1390 | } |
1195 | } | 1391 | } |
1196 | break; | 1392 | break; |
1197 | case STATE_AGENT_FLYSLOW: | 1393 | case STATE_AGENT_FLYSLOW: |
1198 | { | 1394 | { |
1199 | if (sInstance && (mcomboBox_flyslows != NULL)) | 1395 | if (sInstance && mComboBox_flyslows != NULL) |
1200 | { | 1396 | { |
1201 | 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 | } | ||
1202 | } | 1401 | } |
1203 | } | 1402 | } |
1204 | break; | 1403 | break; |
1205 | case STATE_AGENT_HOVER_UP: | 1404 | case STATE_AGENT_HOVER_UP: |
1206 | { | 1405 | { |
1207 | if (sInstance && (mcomboBox_flyups != NULL)) | 1406 | if (sInstance && mComboBox_flyups != NULL) |
1208 | { | 1407 | { |
1209 | 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 | } | ||
1210 | } | 1412 | } |
1211 | } | 1413 | } |
1212 | break; | 1414 | break; |
1213 | case STATE_AGENT_HOVER_DOWN: | 1415 | case STATE_AGENT_HOVER_DOWN: |
1214 | { | 1416 | { |
1215 | if (sInstance && (mcomboBox_flydowns != NULL)) | 1417 | if (sInstance && mComboBox_flydowns != NULL) |
1216 | { | 1418 | { |
1217 | 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 | } | ||
1218 | } | 1423 | } |
1219 | } | 1424 | } |
1220 | break; | 1425 | break; |
1221 | case STATE_AGENT_LAND: | 1426 | case STATE_AGENT_LAND: |
1222 | { | 1427 | { |
1223 | if (sInstance && (mcomboBox_lands != NULL)) | 1428 | if (sInstance && mComboBox_lands != NULL) |
1224 | { | 1429 | { |
1225 | 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 | } | ||
1226 | } | 1434 | } |
1227 | } | 1435 | } |
1228 | break; | 1436 | break; |
1229 | case STATE_AGENT_STANDUP: | 1437 | case STATE_AGENT_STANDUP: |
1230 | { | 1438 | { |
1231 | if (sInstance && (mcomboBox_standups != NULL)) | 1439 | if (sInstance && mComboBox_standups != NULL) |
1232 | { | 1440 | { |
1233 | 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 | } | ||
1234 | } | 1445 | } |
1235 | } | 1446 | } |
1236 | break; | 1447 | break; |
1237 | case STATE_AGENT_PRE_JUMP: | 1448 | case STATE_AGENT_PRE_JUMP: |
1238 | { | 1449 | { |
1239 | if (sInstance && (mcomboBox_prejumps != NULL)) | 1450 | if (sInstance && mComboBox_prejumps != NULL) |
1240 | { | 1451 | { |
1241 | 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 | } | ||
1242 | } | 1456 | } |
1243 | } | 1457 | } |
1244 | break; | 1458 | break; |
@@ -1264,113 +1478,161 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA | |||
1264 | case STATE_AGENT_WALK: | 1478 | case STATE_AGENT_WALK: |
1265 | { | 1479 | { |
1266 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultWalk"); | 1480 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultWalk"); |
1267 | SetDefault(mcomboBox_walks,iter->ao_id,defaultanim); | 1481 | setDefault(mComboBox_walks, iter->ao_id,defaultanim); |
1268 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1482 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1483 | { | ||
1484 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1485 | } | ||
1269 | } | 1486 | } |
1270 | break; | 1487 | break; |
1271 | case STATE_AGENT_RUN: | 1488 | case STATE_AGENT_RUN: |
1272 | { | 1489 | { |
1273 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultRun"); | 1490 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultRun"); |
1274 | SetDefault(mcomboBox_runs,iter->ao_id,defaultanim); | 1491 | setDefault(mComboBox_runs, iter->ao_id,defaultanim); |
1275 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1492 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1493 | { | ||
1494 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1495 | } | ||
1276 | } | 1496 | } |
1277 | break; | 1497 | break; |
1278 | case STATE_AGENT_JUMP: | 1498 | case STATE_AGENT_JUMP: |
1279 | { | 1499 | { |
1280 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultJump"); | 1500 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultJump"); |
1281 | SetDefault(mcomboBox_jumps,iter->ao_id,defaultanim); | 1501 | setDefault(mComboBox_jumps, iter->ao_id,defaultanim); |
1282 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1502 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1503 | { | ||
1504 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1505 | } | ||
1283 | } | 1506 | } |
1284 | break; | 1507 | break; |
1285 | case STATE_AGENT_SIT: | 1508 | case STATE_AGENT_SIT: |
1286 | { | 1509 | { |
1287 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultSit"); | 1510 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultSit"); |
1288 | SetDefault(mcomboBox_sits,iter->ao_id,defaultanim); | 1511 | setDefault(mComboBox_sits, iter->ao_id,defaultanim); |
1289 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1512 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1513 | { | ||
1514 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1515 | } | ||
1290 | } | 1516 | } |
1291 | break; | 1517 | break; |
1292 | case STATE_AGENT_CROUCH: | 1518 | case STATE_AGENT_CROUCH: |
1293 | { | 1519 | { |
1294 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouch"); | 1520 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouch"); |
1295 | SetDefault(mcomboBox_crouchs,iter->ao_id,defaultanim); | 1521 | setDefault(mComboBox_crouchs,iter->ao_id,defaultanim); |
1296 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1522 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1523 | { | ||
1524 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1525 | } | ||
1297 | } | 1526 | } |
1298 | break; | 1527 | break; |
1299 | case STATE_AGENT_GROUNDSIT: | 1528 | case STATE_AGENT_GROUNDSIT: |
1300 | { | 1529 | { |
1301 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultGroundSit"); | 1530 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultGroundSit"); |
1302 | SetDefault(mcomboBox_gsits,iter->ao_id,defaultanim); | 1531 | setDefault(mComboBox_gsits,iter->ao_id,defaultanim); |
1303 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1532 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1533 | { | ||
1534 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1535 | } | ||
1304 | } | 1536 | } |
1305 | break; | 1537 | break; |
1306 | case STATE_AGENT_CROUCHWALK: | 1538 | case STATE_AGENT_CROUCHWALK: |
1307 | { | 1539 | { |
1308 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouchWalk"); | 1540 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouchWalk"); |
1309 | SetDefault(mcomboBox_cwalks,iter->ao_id,defaultanim); | 1541 | setDefault(mComboBox_cwalks,iter->ao_id,defaultanim); |
1310 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1542 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1543 | { | ||
1544 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1545 | } | ||
1311 | } | 1546 | } |
1312 | break; | 1547 | break; |
1313 | case STATE_AGENT_FALLDOWN: | 1548 | case STATE_AGENT_FALLDOWN: |
1314 | { | 1549 | { |
1315 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFall"); | 1550 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFall"); |
1316 | SetDefault(mcomboBox_falls,iter->ao_id,defaultanim); | 1551 | setDefault(mComboBox_falls,iter->ao_id,defaultanim); |
1317 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1552 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1553 | { | ||
1554 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1555 | } | ||
1318 | } | 1556 | } |
1319 | break; | 1557 | break; |
1320 | case STATE_AGENT_HOVER: | 1558 | case STATE_AGENT_HOVER: |
1321 | { | 1559 | { |
1322 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultHover"); | 1560 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultHover"); |
1323 | SetDefault(mcomboBox_hovers,iter->ao_id,defaultanim); | 1561 | setDefault(mComboBox_hovers,iter->ao_id,defaultanim); |
1324 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1562 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1563 | { | ||
1564 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1565 | } | ||
1325 | } | 1566 | } |
1326 | break; | 1567 | break; |
1327 | case STATE_AGENT_FLY: | 1568 | case STATE_AGENT_FLY: |
1328 | { | 1569 | { |
1329 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFly"); | 1570 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFly"); |
1330 | SetDefault(mcomboBox_flys,iter->ao_id,defaultanim); | 1571 | setDefault(mComboBox_flys,iter->ao_id,defaultanim); |
1331 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1572 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1573 | { | ||
1574 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1575 | } | ||
1332 | } | 1576 | } |
1333 | break; | 1577 | break; |
1334 | case STATE_AGENT_HOVER_UP: | 1578 | case STATE_AGENT_HOVER_UP: |
1335 | { | 1579 | { |
1336 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyUp"); | 1580 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyUp"); |
1337 | SetDefault(mcomboBox_flyups,iter->ao_id,defaultanim); | 1581 | setDefault(mComboBox_flyups,iter->ao_id,defaultanim); |
1338 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1582 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1583 | { | ||
1584 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1585 | } | ||
1339 | } | 1586 | } |
1340 | break; | 1587 | break; |
1341 | case STATE_AGENT_FLYSLOW: | 1588 | case STATE_AGENT_FLYSLOW: |
1342 | { | 1589 | { |
1343 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlySlow"); | 1590 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlySlow"); |
1344 | SetDefault(mcomboBox_flyslows,iter->ao_id,defaultanim); | 1591 | setDefault(mComboBox_flyslows,iter->ao_id,defaultanim); |
1345 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1592 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1593 | { | ||
1594 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1595 | } | ||
1346 | } | 1596 | } |
1347 | break; | 1597 | break; |
1348 | case STATE_AGENT_HOVER_DOWN: | 1598 | case STATE_AGENT_HOVER_DOWN: |
1349 | { | 1599 | { |
1350 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyDown"); | 1600 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyDown"); |
1351 | SetDefault(mcomboBox_flydowns,iter->ao_id,defaultanim); | 1601 | setDefault(mComboBox_flydowns,iter->ao_id,defaultanim); |
1352 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1602 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1603 | { | ||
1604 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1605 | } | ||
1353 | } | 1606 | } |
1354 | break; | 1607 | break; |
1355 | case STATE_AGENT_LAND: | 1608 | case STATE_AGENT_LAND: |
1356 | { | 1609 | { |
1357 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultLand"); | 1610 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultLand"); |
1358 | SetDefault(mcomboBox_lands,iter->ao_id,defaultanim); | 1611 | setDefault(mComboBox_lands,iter->ao_id,defaultanim); |
1359 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1612 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1613 | { | ||
1614 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1615 | } | ||
1360 | } | 1616 | } |
1361 | break; | 1617 | break; |
1362 | case STATE_AGENT_STANDUP: | 1618 | case STATE_AGENT_STANDUP: |
1363 | { | 1619 | { |
1364 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultStandUp"); | 1620 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultStandUp"); |
1365 | SetDefault(mcomboBox_standups,iter->ao_id,defaultanim); | 1621 | setDefault(mComboBox_standups,iter->ao_id,defaultanim); |
1366 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1622 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1623 | { | ||
1624 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1625 | } | ||
1367 | } | 1626 | } |
1368 | break; | 1627 | break; |
1369 | case STATE_AGENT_PRE_JUMP: | 1628 | case STATE_AGENT_PRE_JUMP: |
1370 | { | 1629 | { |
1371 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultPreJump"); | 1630 | std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultPreJump"); |
1372 | SetDefault(mcomboBox_prejumps,iter->ao_id,defaultanim); | 1631 | setDefault(mComboBox_prejumps,iter->ao_id,defaultanim); |
1373 | if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); | 1632 | if (getAssetIDByName(defaultanim) != LLUUID::null) |
1633 | { | ||
1634 | iter->ao_id = getAssetIDByName(defaultanim); | ||
1635 | } | ||
1374 | } | 1636 | } |
1375 | break; | 1637 | break; |
1376 | } | 1638 | } |
@@ -1389,7 +1651,8 @@ void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLA | |||
1389 | } | 1651 | } |
1390 | } | 1652 | } |
1391 | 1653 | ||
1392 | BOOL LLFloaterAO::SetDefault(void* userdata, LLUUID ao_id, std::string defaultanim) | 1654 | // static |
1655 | bool LLFloaterAO::setDefault(void* userdata, LLUUID ao_id, std::string defaultanim) | ||
1393 | { | 1656 | { |
1394 | if (sInstance && (userdata)) | 1657 | if (sInstance && (userdata)) |
1395 | { | 1658 | { |
@@ -1432,14 +1695,18 @@ private: | |||
1432 | std::string sName; | 1695 | std::string sName; |
1433 | }; | 1696 | }; |
1434 | 1697 | ||
1698 | // static | ||
1435 | const LLUUID& LLFloaterAO::getAssetIDByName(const std::string& name) | 1699 | const LLUUID& LLFloaterAO::getAssetIDByName(const std::string& name) |
1436 | { | 1700 | { |
1437 | if (name.empty() || !(gInventory.isEverythingFetched())) return LLUUID::null; | 1701 | if (name.empty()) |
1702 | { | ||
1703 | return LLUUID::null; | ||
1704 | } | ||
1438 | 1705 | ||
1439 | LLViewerInventoryCategory::cat_array_t cats; | 1706 | LLViewerInventoryCategory::cat_array_t cats; |
1440 | LLViewerInventoryItem::item_array_t items; | 1707 | LLViewerInventoryItem::item_array_t items; |
1441 | ObjectNameMatches objectnamematches(name); | 1708 | ObjectNameMatches objectnamematches(name); |
1442 | gInventory.collectDescendentsIf(LLUUID::null,cats,items,FALSE,objectnamematches); | 1709 | gInventory.collectDescendentsIf(LLUUID::null, cats, items, FALSE, objectnamematches); |
1443 | 1710 | ||
1444 | if (items.count()) | 1711 | if (items.count()) |
1445 | { | 1712 | { |