summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorybridge.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventorybridge.cpp')
-rw-r--r--indra/newview/llinventorybridge.cpp158
1 files changed, 59 insertions, 99 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index b7eec5e30b..6c9e8b08e1 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -37,6 +37,7 @@
#include "llinventorybridge.h"
#include "llagent.h"
+#include "llagentcamera.h"
#include "llagentwearables.h"
#include "llappearancemgr.h"
#include "llavataractions.h"
@@ -194,7 +195,7 @@ BOOL LLInvFVBridge::isItemRemovable() const
}
// Disable delete from COF folder; have users explicitly choose "detach/take off".
- if (LLAppearanceManager::instance().getIsProtectedCOFItem(mUUID))
+ if (LLAppearanceMgr::instance().getIsProtectedCOFItem(mUUID))
{
return FALSE;
}
@@ -261,7 +262,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc
{
if(LLAssetType::AT_GESTURE == item->getType())
{
- LLGestureManager::instance().deactivateGesture(item->getUUID());
+ LLGestureMgr::instance().deactivateGesture(item->getUUID());
}
}
}
@@ -277,7 +278,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc
{
if(LLAssetType::AT_GESTURE == descendent_items[j]->getType())
{
- LLGestureManager::instance().deactivateGesture(descendent_items[j]->getUUID());
+ LLGestureMgr::instance().deactivateGesture(descendent_items[j]->getUUID());
}
}
}
@@ -298,7 +299,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
LLMessageSystem* msg = gMessageSystem;
const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
LLViewerInventoryItem* item = NULL;
- std::vector<LLUUID> move_ids;
+ uuid_vec_t move_ids;
LLInventoryModel::update_map_t update;
bool start_new_message = true;
S32 count = batch.count();
@@ -399,8 +400,8 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
}
// move everything.
- std::vector<LLUUID>::iterator it = move_ids.begin();
- std::vector<LLUUID>::iterator end = move_ids.end();
+ uuid_vec_t::iterator it = move_ids.begin();
+ uuid_vec_t::iterator end = move_ids.end();
for(; it != end; ++it)
{
gInventory.moveObject((*it), trash_id);
@@ -803,7 +804,7 @@ BOOL LLInvFVBridge::isAgentInventory() const
BOOL LLInvFVBridge::isCOFFolder() const
{
- return LLAppearanceManager::instance().getIsInCOF(mUUID);
+ return LLAppearanceMgr::instance().getIsInCOF(mUUID);
}
BOOL LLInvFVBridge::isItemPermissive() const
@@ -1515,14 +1516,10 @@ BOOL LLFolderBridge::isItemRemovable() const
return FALSE;
}
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- if( !avatar )
- {
- return FALSE;
- }
+ if (!isAgentAvatarValid()) return FALSE;
LLInventoryCategory* category = model->getCategory(mUUID);
- if( !category )
+ if(!category)
{
return FALSE;
}
@@ -1670,8 +1667,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
LLInventoryModel* model = getInventoryModel();
if(!model) return FALSE;
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- if(!avatar) return FALSE;
+ if (!isAgentAvatarValid()) return FALSE;
// cannot drag categories into library
if(!isAgentInventory())
@@ -1757,9 +1753,9 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
{
LLInventoryItem* item = descendent_items[i];
if (item->getType() == LLAssetType::AT_GESTURE
- && LLGestureManager::instance().isGestureActive(item->getUUID()))
+ && LLGestureMgr::instance().isGestureActive(item->getUUID()))
{
- LLGestureManager::instance().deactivateGesture(item->getUUID());
+ LLGestureMgr::instance().deactivateGesture(item->getUUID());
}
}
}
@@ -1772,7 +1768,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
{
// traverse category and add all contents to currently worn.
BOOL append = true;
- LLAppearanceManager::instance().wearInventoryCategory(inv_cat, false, append);
+ LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append);
}
else
{
@@ -1780,7 +1776,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
gInventory.collectDescendents(inv_cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH);
- LLAppearanceManager::instance().linkAll(mUUID,items,NULL);
+ LLAppearanceMgr::instance().linkAll(mUUID,items,NULL);
}
}
else
@@ -1789,7 +1785,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
// BAP - should skip if dup.
if (move_is_into_current_outfit)
{
- LLAppearanceManager::instance().addEnsembleLink(inv_cat);
+ LLAppearanceMgr::instance().addEnsembleLink(inv_cat);
}
else
{
@@ -2147,7 +2143,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
mContentsCount)
{
gInventory.removeObserver(this);
- LLAppearanceManager::instance().wearInventoryCategory(category, FALSE, TRUE);
+ LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, TRUE);
delete this;
}
}
@@ -2197,7 +2193,7 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model
if(!model) return;
LLViewerInventoryCategory* cat = getCategory();
if(!cat) return;
- LLAppearanceManager::instance().addEnsembleLink(cat,true);
+ LLAppearanceMgr::instance().addEnsembleLink(cat,true);
return;
}
#endif
@@ -2430,9 +2426,9 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re
const LLViewerInventoryItem* item = (*iter);
const LLUUID& item_id = item->getUUID();
if (item->getType() == LLAssetType::AT_GESTURE
- && LLGestureManager::instance().isGestureActive(item_id))
+ && LLGestureMgr::instance().isGestureActive(item_id))
{
- LLGestureManager::instance().deactivateGesture(item_id);
+ LLGestureMgr::instance().deactivateGesture(item_id);
}
}
@@ -2735,7 +2731,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
addDeleteContextMenuOptions(mItems, mDisabledItems);
// EXT-4030: disallow deletion of currently worn outfit
- const LLViewerInventoryItem *base_outfit_link = LLAppearanceManager::instance().getBaseOutfitLink();
+ const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink();
if (base_outfit_link && (cat == base_outfit_link->getLinkedCategory()))
{
mDisabledItems.push_back(std::string("Delete"));
@@ -2767,7 +2763,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
sSelf = this;
LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(FALSE);
- LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+ uuid_vec_t folders;
LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
if (category)
{
@@ -2984,7 +2980,7 @@ void LLFolderBridge::modifyOutfit(BOOL append)
LLViewerInventoryCategory* cat = getCategory();
if(!cat) return;
- LLAppearanceManager::instance().wearInventoryCategory( cat, FALSE, append );
+ LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, append );
}
// helper stuff
@@ -3039,8 +3035,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
return FALSE;
}
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- if(!avatar) return FALSE;
+ if (!isAgentAvatarValid()) return FALSE;
LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
BOOL accept = FALSE;
@@ -3062,7 +3057,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
- const BOOL move_is_outof_current_outfit = LLAppearanceManager::instance().getIsInCOF(inv_item->getUUID());
+ const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID());
// Can't explicitly drag things out of the COF.
if (move_is_outof_current_outfit)
@@ -3094,9 +3089,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
if(accept && drop)
{
if (inv_item->getType() == LLAssetType::AT_GESTURE
- && LLGestureManager::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash)
+ && LLGestureMgr::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash)
{
- LLGestureManager::instance().deactivateGesture(inv_item->getUUID());
+ LLGestureMgr::instance().deactivateGesture(inv_item->getUUID());
}
// If an item is being dragged between windows, unselect
// everything in the active window so that we don't follow
@@ -3149,7 +3144,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
// BAP - should skip if dup.
if (move_is_into_current_outfit)
{
- LLAppearanceManager::instance().addCOFItemLink(inv_item);
+ LLAppearanceMgr::instance().addCOFItemLink(inv_item);
}
else
{
@@ -3809,7 +3804,7 @@ LLUIImagePtr LLGestureBridge::getIcon() const
LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const
{
- if( LLGestureManager::instance().isGestureActive(mUUID) )
+ if( LLGestureMgr::instance().isGestureActive(mUUID) )
{
return LLFontGL::BOLD;
}
@@ -3821,7 +3816,7 @@ LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const
std::string LLGestureBridge::getLabelSuffix() const
{
- if( LLGestureManager::instance().isGestureActive(mUUID) )
+ if( LLGestureMgr::instance().isGestureActive(mUUID) )
{
LLStringUtil::format_map_t args;
args["[GESLABEL]"] = LLItemBridge::getLabelSuffix();
@@ -3838,7 +3833,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
{
if (isAddAction(action))
{
- LLGestureManager::instance().activateGesture(mUUID);
+ LLGestureMgr::instance().activateGesture(mUUID);
LLViewerInventoryItem* item = gInventory.getItem(mUUID);
if (!item) return;
@@ -3850,7 +3845,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
}
else if (isRemoveAction(action))
{
- LLGestureManager::instance().deactivateGesture(mUUID);
+ LLGestureMgr::instance().deactivateGesture(mUUID);
LLViewerInventoryItem* item = gInventory.getItem(mUUID);
if (!item) return;
@@ -3862,17 +3857,17 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
}
else if("play" == action)
{
- if(!LLGestureManager::instance().isGestureActive(mUUID))
+ if(!LLGestureMgr::instance().isGestureActive(mUUID))
{
// we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboList.
BOOL inform_server = TRUE;
BOOL deactivate_similar = FALSE;
- LLGestureManager::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID));
+ LLGestureMgr::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID));
LLViewerInventoryItem* item = gInventory.getItem(mUUID);
llassert(item);
if (item)
{
- LLGestureManager::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar);
+ LLGestureMgr::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar);
}
}
else
@@ -3914,7 +3909,7 @@ BOOL LLGestureBridge::removeItem()
// This will also force close the preview window, if it exists.
// This may actually delete *this, if mUUID is in the COF.
- LLGestureManager::instance().deactivateGesture(item_id);
+ LLGestureMgr::instance().deactivateGesture(item_id);
// If deactivateGesture deleted *this, then return out immediately.
if (!model->getObject(item_id))
@@ -3947,7 +3942,7 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
getClipboardEntries(true, items, disabled_items, flags);
items.push_back(std::string("Gesture Separator"));
- if (LLGestureManager::instance().isGestureActive(getUUID()))
+ if (LLGestureMgr::instance().isGestureActive(getUUID()))
{
items.push_back(std::string("Deactivate"));
}
@@ -3962,13 +3957,13 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
// static
void LLGestureBridge::playGesture(const LLUUID& item_id)
{
- if (LLGestureManager::instance().isGesturePlaying(item_id))
+ if (LLGestureMgr::instance().isGesturePlaying(item_id))
{
- LLGestureManager::instance().stopGesture(item_id);
+ LLGestureMgr::instance().stopGesture(item_id);
}
else
{
- LLGestureManager::instance().playGesture(item_id);
+ LLGestureMgr::instance().playGesture(item_id);
}
}
@@ -4169,8 +4164,7 @@ std::string LLObjectBridge::getLabelSuffix() const
{
if (get_is_item_worn(mUUID))
{
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- std::string attachment_point_name = avatar->getAttachedPointName(mUUID);
+ std::string attachment_point_name = gAgentAvatarp->getAttachedPointName(mUUID);
// e.g. "(worn on ...)" / "(attached to ...)"
LLStringUtil::format_map_t args;
@@ -4189,10 +4183,10 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
payload["item_id"] = item->getLinkedUUID(); // Wear the base object in case this is a link.
S32 attach_pt = 0;
- if (gAgent.getAvatarObject() && attachment)
+ if (isAgentAvatarValid() && attachment)
{
- for (LLVOAvatar::attachment_map_t::iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin();
- iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter)
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
{
if (iter->second == attachment)
{
@@ -4218,9 +4212,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response)
{
- LLVOAvatar *avatarp = gAgent.getAvatarObject();
-
- if (!avatarp->canAttachMoreObjects())
+ if (!gAgentAvatarp->canAttachMoreObjects())
{
LLSD args;
args["MAX_ATTACHMENTS"] = llformat("%d", MAX_AGENT_ATTACHMENTS);
@@ -4282,11 +4274,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
LLInventoryItem *item = getItem();
if(item)
{
- LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
- if( !avatarp )
- {
- return;
- }
+ if (!isAgentAvatarValid()) return;
if( get_is_item_worn( mUUID ) )
{
@@ -4302,7 +4290,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
// commented out for DEV-32347
//items.push_back(std::string("Restore to Last Position"));
- if (!avatarp->canAttachMoreObjects())
+ if (!gAgentAvatarp->canAttachMoreObjects())
{
disabled_items.push_back(std::string("Object Wear"));
disabled_items.push_back(std::string("Attach To"));
@@ -4310,15 +4298,14 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
}
LLMenuGL* attach_menu = menu.findChildMenuByName("Attach To", TRUE);
LLMenuGL* attach_hud_menu = menu.findChildMenuByName("Attach To HUD", TRUE);
- LLVOAvatar *avatarp = gAgent.getAvatarObject();
if (attach_menu
&& (attach_menu->getChildCount() == 0)
&& attach_hud_menu
&& (attach_hud_menu->getChildCount() == 0)
- && avatarp)
+ && isAgentAvatarValid())
{
- for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
- iter != avatarp->mAttachmentPoints.end(); )
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+ iter != gAgentAvatarp->mAttachmentPoints.end(); )
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachment = curiter->second;
@@ -4368,11 +4355,10 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
model->notifyObservers();
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- if( avatar )
+ if (isAgentAvatarValid())
{
- LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() );
- if( obj )
+ LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() );
+ if(obj)
{
LLSelectMgr::getInstance()->deselectAll();
LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE );
@@ -4424,7 +4410,7 @@ void wear_inventory_item_on_avatar( LLInventoryItem* item )
lldebugs << "wear_inventory_item_on_avatar( " << item->getName()
<< " )" << llendl;
- LLAppearanceManager::instance().addCOFItemLink(item);
+ LLAppearanceMgr::instance().addCOFItemLink(item);
}
}
@@ -4561,7 +4547,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_
LLViewerInventoryItem *gest_item = gest_item_array.get(i);
if (get_is_item_worn(gest_item->getUUID()))
{
- LLGestureManager::instance().deactivateGesture( gest_item->getLinkedUUID() );
+ LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() );
gInventory.updateItem( gest_item );
gInventory.notifyObservers();
}
@@ -4921,10 +4907,10 @@ void LLWearableBridge::editOnAvatar()
if (gFloaterCustomize)
gFloaterCustomize->setCurrentWearableType( wearable->getType() );
- if( CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode() )
+ if( CAMERA_MODE_CUSTOMIZE_AVATAR != gAgentCamera.getCameraMode() )
{
// Start Avatar Customization
- gAgent.changeCameraToCustomizeAvatar();
+ gAgentCamera.changeCameraToCustomizeAvatar();
}
}
}
@@ -4983,20 +4969,7 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
}
// Find and remove this item from the COF.
- // FIXME 2.1 - call removeCOFItemLinks in llappearancemgr instead.
- LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(item_id, LLAppearanceManager::instance().getCOF());
- if (items.size() != 1)
- {
- llwarns << "Found " << items.size() << " COF links to " << item_id.asString() << ", expected 1" << llendl;
- }
- for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
- iter != items.end();
- ++iter)
- {
- const LLViewerInventoryItem *linked_item = (*iter);
- const LLUUID &item_id = linked_item->getUUID();
- gInventory.purgeObject(item_id);
- }
+ LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false);
gInventory.notifyObservers();
delete on_remove_struct;
@@ -5022,20 +4995,7 @@ void LLWearableBridge::removeAllClothesFromAvatar()
continue;
// Find and remove this item from the COF.
- LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(
- item_id, LLAppearanceManager::instance().getCOF());
- if (items.size() != 1)
- {
- llwarns << "Found " << items.size() << " COF links to " << item_id.asString() << ", expected 1" << llendl;
- }
- for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
- iter != items.end();
- ++iter)
- {
- const LLViewerInventoryItem *linked_item = (*iter);
- const LLUUID &item_id = linked_item->getUUID();
- gInventory.purgeObject(item_id);
- }
+ LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false);
}
gInventory.notifyObservers();