EXT-6539 : Take out mAvatarObject from LLAgentWearables

Removed mAvatarObject / gAgentWearables.mAvatarObject since it's redundant with gAgent.mAvatarObject.
meow-7.2.2
Loren Shih 2010-03-25 17:27:50 -04:00
parent 504cf0870d
commit 853d9e4453
5 changed files with 31 additions and 25 deletions

View File

@ -1645,7 +1645,8 @@ void LLAgent::setAvatarObject(LLVOAvatarSelf *avatar)
return;
}
gAgentCamera.setCameraAvatarObject(avatar);
gAgentCamera.setAvatarObject(avatar);
gAgentWearables.setAvatarObject(avatar);
}
// TRUE if your own avatar needs to be rendered. Usually only

View File

@ -256,7 +256,7 @@ void LLAgentCamera::cleanup()
setFocusObject(NULL);
}
void LLAgentCamera::setCameraAvatarObject(LLVOAvatarSelf* avatar)
void LLAgentCamera::setAvatarObject(LLVOAvatarSelf* avatar)
{
if (!mLookAt)
{

View File

@ -102,7 +102,7 @@ public:
virtual ~LLAgentCamera();
void init();
void cleanup();
void setCameraAvatarObject(LLVOAvatarSelf* avatar);
void setAvatarObject(LLVOAvatarSelf* avatar);
private:
BOOL mInitialized;

View File

@ -219,8 +219,7 @@ struct LLAgentDumper
};
LLAgentWearables::LLAgentWearables() :
mWearablesLoaded(FALSE),
mAvatarObject(NULL)
mWearablesLoaded(FALSE)
{
}
@ -231,12 +230,10 @@ LLAgentWearables::~LLAgentWearables()
void LLAgentWearables::cleanup()
{
mAvatarObject = NULL;
}
void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
{
mAvatarObject = avatar;
if (avatar)
{
sendAgentWearablesRequest();
@ -776,7 +773,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();
@ -817,10 +815,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();
}
}
@ -1230,12 +1229,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] =
{
@ -1282,9 +1282,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();
}
}
@ -1300,7 +1302,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.
@ -1322,7 +1325,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;
}
@ -1423,7 +1427,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();
@ -1498,7 +1502,8 @@ private:
LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name)
{
if (mAvatarObject.isNull())
LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
if (!avatarp)
{
return LLUUID::null;
}
@ -1665,6 +1670,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;
@ -1758,11 +1764,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
@ -2012,7 +2018,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;
@ -2083,7 +2089,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;
@ -2111,7 +2117,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;

View File

@ -218,7 +218,6 @@ private:
static BOOL mInitialWearablesUpdateReceived;
BOOL mWearablesLoaded;
std::set<LLUUID> mItemsAwaitingWearableUpdate;
LLPointer<LLVOAvatarSelf> mAvatarObject; // NULL until avatar object sent down from simulator
//--------------------------------------------------------------------------------
// Support classes