1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
|
/**
* @file llpanelplaces.cpp
* @brief Side Bar "Places" panel
*
* $LicenseInfo:firstyear=2009&license=viewergpl$
*
* Copyright (c) 2004-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llassettype.h"
#include "lllandmark.h"
#include "llfloaterreg.h"
#include "llnotifications.h"
#include "llfiltereditor.h"
#include "lltabcontainer.h"
#include "lltrans.h"
#include "lluictrlfactory.h"
#include "llagent.h"
#include "lllandmarklist.h"
#include "llfloaterworldmap.h"
#include "llpanelplaces.h"
#include "llpanellandmarks.h"
#include "llpanelteleporthistory.h"
#include "llsidetray.h"
#include "lltoggleablemenu.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
// Helper functions
static bool cmp_folders(const folder_pair_t& left, const folder_pair_t& right);
static std::string getFullFolderName(const LLViewerInventoryCategory* cat);
static void collectLandmarkFolders(LLInventoryModel::cat_array_t& cats);
static const LLVector3 get_pos_local_from_global(const LLVector3d &pos_global);
static LLRegisterPanelClassWrapper<LLPanelPlaces> t_places("panel_places");
LLPanelPlaces::LLPanelPlaces()
: LLPanel(),
mFilterSubString(LLStringUtil::null),
mActivePanel(NULL),
mFilterEditor(NULL),
mPlaceInfo(NULL),
mItem(NULL),
mLandmarkFoldersMenuHandle(),
mPosGlobal()
{
gInventory.addObserver(this);
LLViewerParcelMgr::getInstance()->setAgentParcelChangedCallback(
boost::bind(&LLPanelPlaces::onAgentParcelChange, this));
//LLUICtrlFactory::getInstance()->buildPanel(this, "panel_places.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder()
}
LLPanelPlaces::~LLPanelPlaces()
{
if (gInventory.containsObserver(this))
gInventory.removeObserver(this);
LLView::deleteViewByHandle(mLandmarkFoldersMenuHandle);
}
BOOL LLPanelPlaces::postBuild()
{
mCreateLandmarkBtn = getChild<LLButton>("create_landmark_btn");
mCreateLandmarkBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onCreateLandmarkButtonClicked, this, LLUUID()));
mFolderMenuBtn = getChild<LLButton>("folder_menu_btn");
mFolderMenuBtn->setClickedCallback(boost::bind(&LLPanelPlaces::showLandmarkFoldersMenu, this));
mTeleportBtn = getChild<LLButton>("teleport_btn");
mTeleportBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onTeleportButtonClicked, this));
mShowOnMapBtn = getChild<LLButton>("map_btn");
mShowOnMapBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onShowOnMapButtonClicked, this));
mShareBtn = getChild<LLButton>("share_btn");
//mShareBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onShareButtonClicked, this));
mOverflowBtn = getChild<LLButton>("overflow_btn");
// *TODO: Assign the action to an appropriate event.
mOverflowBtn->setClickedCallback(boost::bind(&LLPanelPlaces::toggleMediaPanel, this));
mTabContainer = getChild<LLTabContainer>("Places Tabs");
if (mTabContainer)
{
mTabContainer->setCommitCallback(boost::bind(&LLPanelPlaces::onTabSelected, this));
}
mFilterEditor = getChild<LLFilterEditor>("Filter");
if (mFilterEditor)
{
mFilterEditor->setCommitCallback(boost::bind(&LLPanelPlaces::onFilterEdit, this, _2));
}
mPlaceInfo = getChild<LLPanelPlaceInfo>("panel_place_info");
if (!mPlaceInfo)
return FALSE;
LLButton* back_btn = mPlaceInfo->getChild<LLButton>("back_btn");
if (back_btn)
{
back_btn->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this));
}
return TRUE;
}
void LLPanelPlaces::onOpen(const LLSD& key)
{
mFilterEditor->clear();
onFilterEdit("");
if(mPlaceInfo == NULL || key.size() == 0)
return;
mPlaceInfoType = key["type"].asString();
mPosGlobal.setZero();
togglePlaceInfoPanel(TRUE);
updateVerbs();
if (mPlaceInfoType == "agent")
{
mPlaceInfo->setInfoType(LLPanelPlaceInfo::PLACE);
mPlaceInfo->displayAgentParcelInfo();
mPosGlobal = gAgent.getPositionGlobal();
}
else if (mPlaceInfoType == "create_landmark")
{
mPlaceInfo->setInfoType(LLPanelPlaceInfo::CREATE_LANDMARK);
mPlaceInfo->displayAgentParcelInfo();
mPosGlobal = gAgent.getPositionGlobal();
}
else if (mPlaceInfoType == "landmark")
{
LLUUID item_uuid = key["id"].asUUID();
LLInventoryItem* item = gInventory.getItem(item_uuid);
if (!item)
return;
setItem(item);
}
else if (mPlaceInfoType == "remote_place")
{
if (mPlaceInfo->isMediaPanelVisible())
{
toggleMediaPanel();
}
mPosGlobal = LLVector3d(key["x"].asReal(),
key["y"].asReal(),
key["z"].asReal());
mPlaceInfo->setInfoType(LLPanelPlaceInfo::PLACE);
mPlaceInfo->displayParcelInfo(get_pos_local_from_global(mPosGlobal),
LLUUID(),
mPosGlobal);
}
else if (mPlaceInfoType == "teleport_history")
{
S32 index = key["id"].asInteger();
const LLTeleportHistory::slurl_list_t& hist_items =
LLTeleportHistory::getInstance()->getItems();
LLVector3d pos_global = hist_items[index].mGlobalPos;
mPlaceInfo->setInfoType(LLPanelPlaceInfo::TELEPORT_HISTORY);
mPlaceInfo->displayParcelInfo(get_pos_local_from_global(pos_global),
hist_items[index].mRegionID,
pos_global);
}
}
void LLPanelPlaces::setItem(LLInventoryItem* item)
{
if (!mPlaceInfo)
return;
mItem = item;
// If the item is a link get a linked item
if (mItem->getType() == LLAssetType::AT_LINK)
{
mItem = gInventory.getItem(mItem->getAssetUUID());
if (mItem.isNull())
return;
}
mPlaceInfo->setInfoType(LLPanelPlaceInfo::LANDMARK);
mPlaceInfo->displayItemInfo(mItem);
LLLandmark* lm = gLandmarkList.getAsset(mItem->getAssetUUID(),
boost::bind(&LLPanelPlaces::onLandmarkLoaded, this, _1));
if (lm)
{
onLandmarkLoaded(lm);
}
}
void LLPanelPlaces::onLandmarkLoaded(LLLandmark* landmark)
{
if (!mPlaceInfo)
return;
LLUUID region_id;
landmark->getRegionID(region_id);
LLVector3d pos_global;
landmark->getGlobalPos(pos_global);
mPlaceInfo->displayParcelInfo(landmark->getRegionPos(),
region_id,
pos_global);
}
void LLPanelPlaces::onFilterEdit(const std::string& search_string)
{
if (mFilterSubString != search_string)
{
mFilterSubString = search_string;
// Searches are case-insensitive
LLStringUtil::toUpper(mFilterSubString);
LLStringUtil::trimHead(mFilterSubString);
mActivePanel->onSearchEdit(mFilterSubString);
}
}
void LLPanelPlaces::onTabSelected()
{
mActivePanel = dynamic_cast<LLPanelPlacesTab*>(mTabContainer->getCurrentPanel());
if (!mActivePanel)
return;
onFilterEdit(mFilterSubString);
mActivePanel->updateVerbs();
}
/*
void LLPanelPlaces::onShareButtonClicked()
{
// TODO: Launch the "Things" Share wizard
}
void LLPanelPlaces::onCopySLURLButtonClicked()
{
mActivePanel->onCopySLURL();
}
*/
void LLPanelPlaces::onTeleportButtonClicked()
{
if (!mPlaceInfo)
return;
if (mPlaceInfo->getVisible())
{
if (mPlaceInfoType == "landmark")
{
LLSD payload;
payload["asset_id"] = mItem->getAssetUUID();
LLNotifications::instance().add("TeleportFromLandmark", LLSD(), payload);
}
else if (mPlaceInfoType == "remote_place" || mPlaceInfoType == "agent")
{
LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
if (!mPosGlobal.isExactlyZero() && worldmap_instance)
{
gAgent.teleportViaLocation(mPosGlobal);
worldmap_instance->trackLocation(mPosGlobal);
}
}
}
else
{
mActivePanel->onTeleport();
}
}
void LLPanelPlaces::onShowOnMapButtonClicked()
{
if (!mPlaceInfo)
return;
if (mPlaceInfo->getVisible())
{
LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
if(!worldmap_instance)
return;
if (mPlaceInfoType == "agent" ||
mPlaceInfoType == "create_landmark" ||
mPlaceInfoType == "remote_place")
{
if (!mPosGlobal.isExactlyZero())
{
worldmap_instance->trackLocation(mPosGlobal);
LLFloaterReg::showInstance("world_map", "center");
}
}
else if (mPlaceInfoType == "landmark")
{
LLLandmark* landmark = gLandmarkList.getAsset(mItem->getAssetUUID());
if (!landmark)
return;
LLVector3d landmark_global_pos;
if (!landmark->getGlobalPos(landmark_global_pos))
return;
if (!landmark_global_pos.isExactlyZero())
{
worldmap_instance->trackLocation(landmark_global_pos);
LLFloaterReg::showInstance("world_map", "center");
}
}
}
else
{
mActivePanel->onShowOnMap();
}
}
void LLPanelPlaces::onCreateLandmarkButtonClicked(const LLUUID& folder_id)
{
if (!mPlaceInfo)
return;
mPlaceInfo->createLandmark(folder_id);
onBackButtonClicked();
LLSideTray::getInstance()->collapseSideBar();
}
void LLPanelPlaces::onBackButtonClicked()
{
togglePlaceInfoPanel(FALSE);
// Resetting mPlaceInfoType when Place Info panel is closed.
mPlaceInfoType = LLStringUtil::null;
updateVerbs();
}
void LLPanelPlaces::toggleMediaPanel()
{
if (!mPlaceInfo)
return;
mPlaceInfo->toggleMediaPanel(!mPlaceInfo->isMediaPanelVisible());
// Refresh the current place info because
// the media panel controls can't refer to
// the remote parcel media.
onOpen(LLSD().insert("type", "agent"));
}
void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible)
{
if (!mPlaceInfo)
return;
mPlaceInfo->setVisible(visible);
mFilterEditor->setVisible(!visible);
mTabContainer->setVisible(!visible);
if (visible)
{
mPlaceInfo->resetLocation();
LLRect rect = getRect();
LLRect new_rect = LLRect(rect.mLeft, rect.mTop, rect.mRight, mTabContainer->getRect().mBottom);
mPlaceInfo->reshape(new_rect.getWidth(),new_rect.getHeight());
}
}
//virtual
void LLPanelPlaces::changed(U32 mask)
{
if (!(gInventory.isInventoryUsable() && LLTeleportHistory::getInstance()))
return;
LLLandmarksPanel* landmarks_panel = new LLLandmarksPanel();
if (landmarks_panel)
{
landmarks_panel->setPanelPlacesButtons(this);
mTabContainer->addTabPanel(
LLTabContainer::TabPanelParams().
panel(landmarks_panel).
label(getString("landmarks_tab_title")).
insert_at(LLTabContainer::END));
}
LLTeleportHistoryPanel* teleport_history_panel = new LLTeleportHistoryPanel();
if (teleport_history_panel)
{
teleport_history_panel->setPanelPlacesButtons(this);
mTabContainer->addTabPanel(
LLTabContainer::TabPanelParams().
panel(teleport_history_panel).
label(getString("teleport_history_tab_title")).
insert_at(LLTabContainer::END));
}
mTabContainer->selectFirstTab();
mActivePanel = dynamic_cast<LLPanelPlacesTab*>(mTabContainer->getCurrentPanel());
// we don't need to monitor inventory changes anymore,
// so remove the observer
gInventory.removeObserver(this);
}
void LLPanelPlaces::onAgentParcelChange()
{
if (!mPlaceInfo)
return;
if (mPlaceInfo->getVisible() && mPlaceInfoType == "create_landmark")
{
onOpen(LLSD().insert("type", mPlaceInfoType));
}
else if (mPlaceInfo->isMediaPanelVisible())
{
onOpen(LLSD().insert("type", "agent"));
}
else
{
updateVerbs();
}
}
void LLPanelPlaces::updateVerbs()
{
if (!mPlaceInfo)
return;
bool is_place_info_visible = mPlaceInfo->getVisible();
bool is_agent_place_info_visible = mPlaceInfoType == "agent";
bool is_create_landmark_visible = mPlaceInfoType == "create_landmark";
bool is_media_panel_visible = mPlaceInfo->isMediaPanelVisible();
mTeleportBtn->setVisible(!is_create_landmark_visible);
mShareBtn->setVisible(!is_create_landmark_visible);
mCreateLandmarkBtn->setVisible(is_create_landmark_visible);
mFolderMenuBtn->setVisible(is_create_landmark_visible);
// Enable overflow button only when showing the information
// about agent's current location.
mOverflowBtn->setEnabled(is_agent_place_info_visible);
if (is_place_info_visible)
{
if (is_agent_place_info_visible)
{
// We don't need to teleport to the current location
// so check if the location is not within the current parcel.
mTeleportBtn->setEnabled(!is_media_panel_visible &&
!mPosGlobal.isExactlyZero() &&
!LLViewerParcelMgr::getInstance()->inAgentParcel(mPosGlobal));
}
else if (mPlaceInfoType == "landmark" || mPlaceInfoType == "remote_place")
{
mTeleportBtn->setEnabled(TRUE);
}
mShowOnMapBtn->setEnabled(!is_media_panel_visible);
}
else
{
mActivePanel->updateVerbs();
}
}
void LLPanelPlaces::showLandmarkFoldersMenu()
{
if (mLandmarkFoldersMenuHandle.isDead())
{
LLToggleableMenu::Params menu_p;
menu_p.name("landmarks_folders_menu");
menu_p.can_tear_off(false);
menu_p.visible(false);
menu_p.scrollable(true);
LLToggleableMenu* menu = LLUICtrlFactory::create<LLToggleableMenu>(menu_p);
mLandmarkFoldersMenuHandle = menu->getHandle();
}
LLToggleableMenu* menu = (LLToggleableMenu*)mLandmarkFoldersMenuHandle.get();
if(!menu)
return;
if (menu->getClosedByButtonClick())
{
menu->resetClosedByButtonClick();
return;
}
if (menu->getVisible())
{
menu->setVisible(FALSE);
menu->resetClosedByButtonClick();
return;
}
// Collect all folders that can contain landmarks.
LLInventoryModel::cat_array_t cats;
collectLandmarkFolders(cats);
// Sort the folders by their full name.
folder_vec_t folders;
S32 count = cats.count();
for (S32 i = 0; i < count; i++)
{
const LLViewerInventoryCategory* cat = cats.get(i);
std::string cat_full_name = getFullFolderName(cat);
folders.push_back(folder_pair_t(cat->getUUID(), cat_full_name));
}
sort(folders.begin(), folders.end(), cmp_folders);
LLRect btn_rect = mFolderMenuBtn->getRect();
LLRect root_rect = getRootView()->getRect();
// Check it there are changed items or viewer dimensions
// have changed since last call
if (mLandmarkFoldersCache.size() == count &&
mRootViewWidth == root_rect.getWidth() &&
mRootViewHeight == root_rect.getHeight())
{
S32 i;
for (i = 0; i < count; i++)
{
if (mLandmarkFoldersCache[i].second != folders[i].second)
{
break;
}
}
// Check passed, just show the menu
if (i == count)
{
menu->buildDrawLabels();
menu->updateParent(LLMenuGL::sMenuContainer);
menu->setButtonRect(btn_rect, this);
LLMenuGL::showPopup(this, menu, btn_rect.mRight, btn_rect.mTop);
return;
}
}
// If there are changes, store the new viewer dimensions
// and a list of folders
mRootViewWidth = root_rect.getWidth();
mRootViewHeight = root_rect.getHeight();
mLandmarkFoldersCache = folders;
menu->empty();
U32 max_width = 0;
// Menu width must not exceed the root view limits,
// so we assume the space between the left edge of
// the root view and
LLRect screen_btn_rect;
localRectToScreen(btn_rect, &screen_btn_rect);
S32 free_space = screen_btn_rect.mRight;
for(folder_vec_t::const_iterator it = mLandmarkFoldersCache.begin(); it != mLandmarkFoldersCache.end(); it++)
{
const std::string& item_name = it->second;
LLMenuItemCallGL::Params item_params;
item_params.name(item_name);
item_params.label(item_name);
item_params.on_click.function(boost::bind(&LLPanelPlaces::onCreateLandmarkButtonClicked, this, it->first));
LLMenuItemCallGL *menu_item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params);
// Check whether item name wider than menu
if ((S32) menu_item->getNominalWidth() > free_space)
{
S32 chars_total = item_name.length();
S32 chars_fitted = 1;
menu_item->setLabel(LLStringExplicit(""));
S32 label_space = free_space - menu_item->getFont()->getWidth("...") -
menu_item->getNominalWidth(); // This returns width of menu item with empty label (pad pixels)
while (chars_fitted < chars_total && menu_item->getFont()->getWidth(item_name, 0, chars_fitted) < label_space)
{
chars_fitted++;
}
chars_fitted--; // Rolling back one char, that doesn't fit
menu_item->setLabel(item_name.substr(0, chars_fitted) + "...");
}
max_width = llmax(max_width, menu_item->getNominalWidth());
menu->addChild(menu_item);
}
menu->buildDrawLabels();
menu->updateParent(LLMenuGL::sMenuContainer);
menu->setButtonRect(btn_rect, this);
LLMenuGL::showPopup(this, menu, btn_rect.mRight, btn_rect.mTop);
}
static bool cmp_folders(const folder_pair_t& left, const folder_pair_t& right)
{
return left.second < right.second;
}
static std::string getFullFolderName(const LLViewerInventoryCategory* cat)
{
std::string name = cat->getName();
LLUUID parent_id;
// translate category name, if it's right below the root
// FIXME: it can throw notification about non existent string in strings.xml
if (cat->getParentUUID().notNull() && cat->getParentUUID() == gInventory.getRootFolderID())
{
name = LLTrans::getString("InvFolder " + name);
}
// we don't want "My Inventory" to appear in the name
while ((parent_id = cat->getParentUUID()).notNull() && parent_id != gInventory.getRootFolderID())
{
cat = gInventory.getCategory(parent_id);
name = cat->getName() + "/" + name;
}
return name;
}
static void collectLandmarkFolders(LLInventoryModel::cat_array_t& cats)
{
// Add the "Landmarks" category itself.
LLUUID landmarks_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK);
LLViewerInventoryCategory* landmarks_cat = gInventory.getCategory(landmarks_id);
if (!landmarks_cat)
{
llwarns << "Cannot find the landmarks folder" << llendl;
}
else
{
cats.put(landmarks_cat);
}
// Add descendent folders of the "Landmarks" category.
LLInventoryModel::item_array_t items; // unused
LLIsType is_category(LLAssetType::AT_CATEGORY);
gInventory.collectDescendentsIf(
landmarks_id,
cats,
items,
LLInventoryModel::EXCLUDE_TRASH,
is_category);
// Add the "My Favorites" category.
LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE);
LLViewerInventoryCategory* favorites_cat = gInventory.getCategory(favorites_id);
if (!favorites_cat)
{
llwarns << "Cannot find the favorites folder" << llendl;
}
else
{
cats.put(favorites_cat);
}
}
const LLVector3 get_pos_local_from_global(const LLVector3d &pos_global)
{
F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
LLVector3 pos_local(region_x, region_y, (F32)pos_global.mdV[VZ]);
return pos_local;
}
|