summaryrefslogtreecommitdiff
path: root/indra/newview/llagentwearables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llagentwearables.cpp')
-rw-r--r--indra/newview/llagentwearables.cpp79
1 files changed, 43 insertions, 36 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index ebadd8a165..5eb943877a 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -32,7 +32,8 @@
#include "llviewerprecompiledheaders.h"
-#include "llagent.h"
+#include "llagent.h"
+#include "llagentcamera.h"
#include "llagentwearables.h"
#include "llcallbacklist.h"
@@ -218,8 +219,7 @@ struct LLAgentDumper
};
LLAgentWearables::LLAgentWearables() :
- mWearablesLoaded(FALSE),
- mAvatarObject(NULL)
+ mWearablesLoaded(FALSE)
{
}
@@ -230,12 +230,10 @@ LLAgentWearables::~LLAgentWearables()
void LLAgentWearables::cleanup()
{
- mAvatarObject = NULL;
}
void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
{
- mAvatarObject = avatar;
if (avatar)
{
sendAgentWearablesRequest();
@@ -686,13 +684,13 @@ const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
return NULL;
}
-const LLWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id) const
+LLWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id)
{
for (S32 i=0; i < WT_COUNT; i++)
{
for (U32 j=0; j < getWearableCount((EWearableType)i); j++)
{
- const LLWearable * curr_wearable = getWearable((EWearableType)i, j);
+ LLWearable * curr_wearable = getWearable((EWearableType)i, j);
if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
{
return curr_wearable;
@@ -785,7 +783,8 @@ U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearabl
void LLAgentWearables::wearableUpdated(LLWearable *wearable)
{
- mAvatarObject->wearableUpdated(wearable->getType(), TRUE);
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+ avatarp->wearableUpdated(wearable->getType(), TRUE);
wearable->refreshName();
wearable->setLabelUpdated();
@@ -826,10 +825,11 @@ void LLAgentWearables::popWearable(LLWearable *wearable)
void LLAgentWearables::popWearable(const EWearableType type, U32 index)
{
LLWearable *wearable = getWearable(type, index);
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
if (wearable)
{
mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
- mAvatarObject->wearableUpdated(wearable->getType(), TRUE);
+ avatarp->wearableUpdated(wearable->getType(), TRUE);
wearable->setLabelUpdated();
}
}
@@ -961,8 +961,8 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
LLUUID agent_id;
gMessageSystem->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- LLVOAvatar* avatar = gAgent.getAvatarObject();
- if (avatar && (agent_id == avatar->getID()))
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+ if (avatarp && (agent_id == avatarp->getID()))
{
gMessageSystem->getU32Fast(_PREHASH_AgentData, _PREHASH_SerialNum, gAgentQueryManager.mUpdateSerialNum);
@@ -1054,8 +1054,8 @@ void LLAgentWearables::onInitialWearableAssetArrived(LLWearable* wearable, void*
const EWearableType type = wear_data->mType;
U32 index = 0;
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- if (!avatar)
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+ if (!avatarp)
{
return;
}
@@ -1068,9 +1068,9 @@ void LLAgentWearables::onInitialWearableAssetArrived(LLWearable* wearable, void*
gAgentWearables.mItemsAwaitingWearableUpdate.erase(wear_data->mItemID);
// disable composites if initial textures are baked
- avatar->setupComposites();
+ avatarp->setupComposites();
- avatar->setCompositeUpdatesEnabled(TRUE);
+ avatarp->setCompositeUpdatesEnabled(TRUE);
gInventory.addChangedMask(LLInventoryObserver::LABEL, wearable->getItemID());
}
else
@@ -1097,9 +1097,9 @@ void LLAgentWearables::onInitialWearableAssetArrived(LLWearable* wearable, void*
// Check to see if there are any baked textures that we hadn't uploaded before we logged off last time.
// If there are any, schedule them to be uploaded as soon as the layer textures they depend on arrive.
- if (gAgent.cameraCustomizeAvatar())
+ if (gAgentCamera.cameraCustomizeAvatar())
{
- avatar->requestLayerSetUploads();
+ avatarp->requestLayerSetUploads();
}
}
}
@@ -1239,12 +1239,13 @@ void LLAgentWearables::createStandardWearables(BOOL female)
llwarns << "Creating Standard " << (female ? "female" : "male")
<< " Wearables" << llendl;
- if (mAvatarObject.isNull())
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+ if (!avatarp)
{
return;
}
- mAvatarObject->setSex(female ? SEX_FEMALE : SEX_MALE);
+ avatarp->setSex(female ? SEX_FEMALE : SEX_MALE);
const BOOL create[WT_COUNT] =
{
@@ -1291,9 +1292,11 @@ void LLAgentWearables::createStandardWearables(BOOL female)
void LLAgentWearables::createStandardWearablesDone(S32 type, U32 index)
{
llinfos << "type " << type << " index " << index << llendl;
- if (mAvatarObject)
+
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+ if (avatarp)
{
- mAvatarObject->updateVisualParams();
+ avatarp->updateVisualParams();
}
}
@@ -1309,7 +1312,8 @@ void LLAgentWearables::createStandardWearablesAllDone()
updateServer();
// Treat this as the first texture entry message, if none received yet
- mAvatarObject->onFirstTEMessageReceived();
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+ avatarp->onFirstTEMessageReceived();
}
// MULTI-WEARABLE: Properly handle multiwearables later.
@@ -1331,7 +1335,8 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
const LLDynamicArray<S32>& attachments_to_include,
BOOL rename_clothing)
{
- if (mAvatarObject.isNull())
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+ if (!avatarp)
{
return;
}
@@ -1432,7 +1437,7 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
for (S32 i = 0; i < attachments_to_include.count(); i++)
{
S32 attachment_pt = attachments_to_include[i];
- LLViewerJointAttachment* attachment = get_if_there(mAvatarObject->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL);
+ LLViewerJointAttachment* attachment = get_if_there(avatarp->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL);
if (!attachment) continue;
for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
attachment_iter != attachment->mAttachedObjects.end();
@@ -1507,7 +1512,8 @@ private:
LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name)
{
- if (mAvatarObject.isNull())
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+ if (!avatarp)
{
return LLUUID::null;
}
@@ -1674,6 +1680,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
BOOL remove)
{
llinfos << "setWearableOutfit() start" << llendl;
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
BOOL wearables_to_remove[WT_COUNT];
wearables_to_remove[WT_SHAPE] = FALSE;
@@ -1777,11 +1784,11 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
}
}
- if (mAvatarObject)
+ if (avatarp)
{
- mAvatarObject->setCompositeUpdatesEnabled(TRUE);
- mAvatarObject->updateVisualParams();
- mAvatarObject->invalidateAll();
+ avatarp->setCompositeUpdatesEnabled(TRUE);
+ avatarp->updateVisualParams();
+ avatarp->invalidateAll();
}
// Start rendering & update the server
@@ -2031,7 +2038,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
// already wearing and in request set -> leave alone.
// not wearing and in request set -> put on.
- LLVOAvatar* avatarp = gAgent.getAvatarObject();
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
if (!avatarp)
{
llwarns << "No avatar found." << llendl;
@@ -2102,7 +2109,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remove)
{
- LLVOAvatar* avatarp = gAgent.getAvatarObject();
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
if (!avatarp)
{
llwarns << "No avatar found." << llendl;
@@ -2130,7 +2137,7 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo
void LLAgentWearables::userRemoveAllAttachments()
{
- LLVOAvatar* avatarp = gAgent.getAvatarObject();
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
if (!avatarp)
{
llwarns << "No avatar found." << llendl;
@@ -2706,11 +2713,11 @@ void LLInitialWearablesFetch::processWearablesMessage()
}
// Add all current attachments to the requested items as well.
- LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
- if( avatar )
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+ if(avatarp)
{
- for (LLVOAvatar::attachment_map_t::const_iterator iter = avatar->mAttachmentPoints.begin();
- iter != avatar->mAttachmentPoints.end(); ++iter)
+ for (LLVOAvatar::attachment_map_t::const_iterator iter = avatarp->mAttachmentPoints.begin();
+ iter != avatarp->mAttachmentPoints.end(); ++iter)
{
LLViewerJointAttachment* attachment = iter->second;
if (!attachment) continue;