diff options
author | Loren Shih <seraph@lindenlab.com> | 2010-03-26 14:33:48 -0400 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2010-03-26 14:33:48 -0400 |
commit | 46fe5d49caef6c8db3df9d88f0d0ec773ef28095 (patch) | |
tree | 87f8ae2f01d871b23b9d1c1ef9f9ce736dbc8c98 | |
parent | 0bcfbde3a4265d7963ea501622e512de8eab7f61 (diff) |
EXT-6536 : Make LLVOAvatarSelf a singleton
Superficial cleanup so that all instances of gAgent.getAvatarObject() use "LLVOAvatarSelf *avatarp = gAgent.getAvatarObject".
-rw-r--r-- | indra/newview/llagentui.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llagentwearables.cpp | 3 | ||||
-rw-r--r-- | indra/newview/lldriverparam.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llgesturemgr.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llinventoryfunctions.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llinventorymodel.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llmorphview.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llpreviewanim.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llselectmgr.cpp | 15 | ||||
-rw-r--r-- | indra/newview/lltooldraganddrop.cpp | 2 | ||||
-rw-r--r-- | indra/newview/lltoolfocus.cpp | 7 | ||||
-rw-r--r-- | indra/newview/lltoolpie.cpp | 24 | ||||
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewerkeyboard.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 22 | ||||
-rw-r--r-- | indra/newview/llvoavatarself.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llwearable.cpp | 65 |
21 files changed, 126 insertions, 132 deletions
diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp index 4601e3241b..97e956c082 100644 --- a/indra/newview/llagentui.cpp +++ b/indra/newview/llagentui.cpp @@ -73,7 +73,8 @@ void LLAgentUI::buildName(std::string& name) //static void LLAgentUI::buildFullname(std::string& name) { - if (gAgent.getAvatarObject()) name = gAgent.getAvatarObject()->getFullname(); + LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); + if (avatarp) name = avatarp->getFullname(); } //static diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index c673e82d5f..aec8c6e403 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -485,7 +485,8 @@ void LLAgentWearables::saveWearable(const EWearableType type, const U32 index, B return; } - gAgent.getAvatarObject()->wearableUpdated( type, TRUE ); + LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); + avatarp->wearableUpdated( type, TRUE ); if (send_update) { diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp index 830e975e8a..c22c9d3048 100644 --- a/indra/newview/lldriverparam.cpp +++ b/indra/newview/lldriverparam.cpp @@ -118,13 +118,13 @@ void LLDriverParamInfo::toStream(std::ostream &out) out << std::endl; - LLVOAvatarSelf *avatar = gAgent.getAvatarObject(); - if(avatar) + LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); + if(avatarp) { for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++) { LLDrivenEntryInfo driven = *iter; - LLViewerVisualParam *param = (LLViewerVisualParam*)avatar->getVisualParam(driven.mDrivenID); + LLViewerVisualParam *param = (LLViewerVisualParam*)avatarp->getVisualParam(driven.mDrivenID); if (param) { param->getInfo()->toStream(out); @@ -146,7 +146,7 @@ void LLDriverParamInfo::toStream(std::ostream &out) } else { - llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << avatar << " for driver parameter " << getID() << llendl; + llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << avatarp << " for driver parameter " << getID() << llendl; } out << std::endl; } @@ -626,13 +626,14 @@ F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake) { - LLVOAvatarSelf *avatar_self = gAgent.getAvatarObject(); - if(mWearablep && + LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); + if(avatarp && + mWearablep && driven->mParam->getCrossWearable() && mWearablep->isOnTop()) { // call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values - avatar_self->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake ); + avatarp->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake ); } else { diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 0ba7bdf613..47a9961323 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -746,8 +746,8 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture) { return; } - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if (!avatar) return; + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (!avatarp) return; // Of the ones that started playing, have any stopped? @@ -758,8 +758,8 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture) { // look in signaled animations (simulator's view of what is // currently playing. - LLVOAvatar::AnimIterator play_it = avatar->mSignaledAnimations.find(*gest_it); - if (play_it != avatar->mSignaledAnimations.end()) + LLVOAvatar::AnimIterator play_it = avatarp->mSignaledAnimations.find(*gest_it); + if (play_it != avatarp->mSignaledAnimations.end()) { ++gest_it; } @@ -777,8 +777,8 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture) gest_it != gesture->mRequestedAnimIDs.end(); ) { - LLVOAvatar::AnimIterator play_it = avatar->mSignaledAnimations.find(*gest_it); - if (play_it != avatar->mSignaledAnimations.end()) + LLVOAvatar::AnimIterator play_it = avatarp->mSignaledAnimations.find(*gest_it); + if (play_it != avatarp->mSignaledAnimations.end()) { // Hooray, this animation has started playing! // Copy into playing. diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 2d544f53f4..08734137b6 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -4177,8 +4177,9 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach S32 attach_pt = 0; if (gAgent.getAvatarObject() && attachment) { - for (LLVOAvatar::attachment_map_t::iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin(); - iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter) + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); + iter != avatarp->mAttachmentPoints.end(); ++iter) { if (iter->second == attachment) { @@ -4204,7 +4205,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response) { - LLVOAvatar *avatarp = gAgent.getAvatarObject(); + LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); if (!avatarp->canAttachMoreObjects()) { @@ -4296,7 +4297,7 @@ 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(); + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); if (attach_menu && (attach_menu->getChildCount() == 0) && attach_hud_menu diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 3553137f53..d3e2a2f555 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -352,8 +352,8 @@ BOOL get_is_item_worn(const LLUUID& id) { case LLAssetType::AT_OBJECT: { - const LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject(); - if(my_avatar && my_avatar->isWearingAttachment(item->getLinkedUUID())) + const LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if(avatarp && avatarp->isWearingAttachment(item->getLinkedUUID())) return TRUE; break; } diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 83a466a243..1f9840923c 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -3774,7 +3774,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite return false; bool allowed = false; - LLVOAvatarSelf* my_avatar = NULL; + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); switch(item->getType()) { @@ -3783,8 +3783,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite break; case LLAssetType::AT_OBJECT: - my_avatar = gAgent.getAvatarObject(); - if(my_avatar && !my_avatar->isWearingAttachment(item->getUUID())) + if(avatarp && !avatarp->isWearingAttachment(item->getUUID())) { allowed = true; } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index d7720b735c..2a8306f232 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -871,7 +871,7 @@ bool LLInventoryPanel::attachObject(const LLSD& userdata) mFolders->getSelectionList(selected_items); std::string joint_name = userdata.asString(); - LLVOAvatar *avatarp = static_cast<LLVOAvatar*>(gAgent.getAvatarObject()); + LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); LLViewerJointAttachment* attachmentp = NULL; for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); iter != avatarp->mAttachmentPoints.end(); ) diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp index 28da9a2b90..cb48db15e4 100644 --- a/indra/newview/llmorphview.cpp +++ b/indra/newview/llmorphview.cpp @@ -89,7 +89,7 @@ void LLMorphView::initialize() mCameraYaw = 0.f; mCameraDist = -1.f; - LLVOAvatar *avatarp = gAgent.getAvatarObject(); + LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); if (!avatarp || avatarp->isDead()) { gAgentCamera.changeCameraToDefault(); @@ -111,7 +111,7 @@ void LLMorphView::shutdown() { LLVOAvatarSelf::onCustomizeEnd(); - LLVOAvatar *avatarp = gAgent.getAvatarObject(); + LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); if (avatarp && !avatarp->isDead()) { avatarp->startMotion( ANIM_AGENT_BODY_NOISE ); @@ -167,12 +167,12 @@ void LLMorphView::updateCamera() setCameraTargetJoint(gAgent.getAvatarObject()->getJoint("mHead")); } - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if( !avatar ) + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (!avatarp) { return; } - LLJoint* root_joint = avatar->getRootJoint(); + LLJoint* root_joint = avatarp->getRootJoint(); if( !root_joint ) { return; diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 0cc747f789..49b297f702 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -110,6 +110,7 @@ void LLPreviewAnim::playAnim( void *userdata ) { LLPreviewAnim* self = (LLPreviewAnim*) userdata; const LLInventoryItem *item = self->getItem(); + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); if(item) { @@ -125,10 +126,7 @@ void LLPreviewAnim::playAnim( void *userdata ) { self->mPauseRequest = NULL; gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_START); - - LLVOAvatar* avatar = gAgent.getAvatarObject(); - LLMotion* motion = avatar->findMotion(itemID); - + LLMotion* motion = avatarp->findMotion(itemID); if (motion) { motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle()))); @@ -136,7 +134,7 @@ void LLPreviewAnim::playAnim( void *userdata ) } else { - gAgent.getAvatarObject()->stopMotion(itemID); + avatarp->stopMotion(itemID); gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP); } } @@ -161,10 +159,9 @@ void LLPreviewAnim::auditionAnim( void *userdata ) if (self->childGetValue("Anim audition btn").asBoolean() ) { self->mPauseRequest = NULL; + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); gAgent.getAvatarObject()->startMotion(item->getAssetUUID()); - - LLVOAvatar* avatar = gAgent.getAvatarObject(); - LLMotion* motion = avatar->findMotion(itemID); + LLMotion* motion = avatarp->findMotion(itemID); if (motion) { @@ -189,8 +186,8 @@ void LLPreviewAnim::onClose(bool app_quitting) gAgent.getAvatarObject()->stopMotion(item->getAssetUUID()); gAgent.sendAnimationRequest(item->getAssetUUID(), ANIM_REQUEST_STOP); - LLVOAvatar* avatar = gAgent.getAvatarObject(); - LLMotion* motion = avatar->findMotion(item->getAssetUUID()); + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + LLMotion* motion = avatarp->findMotion(item->getAssetUUID()); if (motion) { diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index d744f097d5..69f9a7e6fa 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -4911,10 +4911,10 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) LLGLEnable blend(GL_BLEND); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if (for_hud && avatar) + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (avatarp && for_hud) { - LLBBox hud_bbox = avatar->getHUDBBox(); + LLBBox hud_bbox = avatarp->getHUDBBox(); F32 cur_zoom = gAgentCamera.mHUDCurZoom; @@ -5023,7 +5023,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) } } - if (for_hud && avatar) + if (avatarp && for_hud) { glMatrixMode(GL_PROJECTION); gGL.popMatrix(); @@ -5399,7 +5399,8 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) if (volume) { F32 silhouette_thickness; - if (is_hud_object && gAgent.getAvatarObject()) + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (avatarp && is_hud_object) { silhouette_thickness = LLSelectMgr::sHighlightThickness / gAgentCamera.mHUDCurZoom; } @@ -5641,10 +5642,10 @@ void LLSelectMgr::updateSelectionCenter() LLViewerObject* object = node->getObject(); if (!object) continue; - LLViewerObject *myAvatar = gAgent.getAvatarObject(); + LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); LLViewerObject *root = object->getRootEdit(); if (mSelectedObjects->mSelectType == SELECT_TYPE_WORLD && // not an attachment - !root->isChild(myAvatar) && // not the object you're sitting on + !root->isChild(avatarp) && // not the object you're sitting on !object->isAvatar()) // not another avatar { mShowSelection = TRUE; diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 0aa6b8736b..1f6f840c45 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1547,7 +1547,7 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent, llinfos << "LLToolDragAndDrop::giveInventoryCategory() - " << cat->getUUID() << llendl; - LLVOAvatar* avatarp = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); if (!avatarp) { return; diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index 1e2e7095d8..363df74379 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -173,14 +173,13 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) BOOL good_customize_avatar_hit = FALSE; if( hit_obj ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if( hit_obj == avatar) + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (avatarp &&(hit_obj == avatarp)) { // It's you good_customize_avatar_hit = TRUE; } - else - if( hit_obj->isAttachment() && hit_obj->permYouOwner() ) + else if (hit_obj->isAttachment() && hit_obj->permYouOwner()) { // It's an attachment that you're wearing good_customize_avatar_hit = TRUE; diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 8d4f0f9116..c80db89ef0 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -205,15 +205,16 @@ BOOL LLToolPie::pickLeftMouseDownCallback() // touch behavior down below... break; case CLICK_ACTION_SIT: - - if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // agent not already sitting { - handle_object_sit_or_stand(); - // put focus in world when sitting on an object - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; - } // else nothing (fall through to touch) - + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (avatarp && !avatarp->isSitting()) // agent not already sitting + { + handle_object_sit_or_stand(); + // put focus in world when sitting on an object + gFocusMgr.setKeyboardFocus(NULL); + return TRUE; + } // else nothing (fall through to touch) + } case CLICK_ACTION_PAY: if ((object && object->flagTakesMoney()) || (parent && parent->flagTakesMoney())) @@ -411,9 +412,12 @@ ECursorType cursor_from_object(LLViewerObject* object) switch(click_action) { case CLICK_ACTION_SIT: - if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // not already sitting? { - cursor = UI_CURSOR_TOOLSIT; + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (avatarp && !avatarp->isSitting()) // not already sitting? + { + cursor = UI_CURSOR_TOOLSIT; + } } break; case CLICK_ACTION_BUY: diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 5a2b901bd7..7bbe40a486 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1032,11 +1032,11 @@ LLRect get_whole_screen_region() bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::matrix4f &model) { - LLVOAvatar* my_avatarp = gAgent.getAvatarObject(); - if (my_avatarp && my_avatarp->hasHUDAttachment()) + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (avatarp && avatarp->hasHUDAttachment()) { F32 zoom_level = gAgentCamera.mHUDCurZoom; - LLBBox hud_bbox = my_avatarp->getHUDBBox(); + LLBBox hud_bbox = avatarp->getHUDBBox(); F32 hud_depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f); proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth); diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index cbec2c890f..00046ed3dd 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -869,6 +869,7 @@ S32 LLViewerKeyboard::loadBindings(const std::string& filename) EKeyboardMode LLViewerKeyboard::getMode() { + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); if ( gAgentCamera.cameraMouselook() ) { return MODE_FIRST_PERSON; @@ -877,7 +878,7 @@ EKeyboardMode LLViewerKeyboard::getMode() { return MODE_EDIT_AVATAR; } - else if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()) + else if (avatarp && avatarp->isSitting()) { return MODE_SITTING; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index d79cb85730..b8a3232c29 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4587,13 +4587,13 @@ BOOL sitting_on_selection() } // Need to determine if avatar is sitting on this object - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if (!avatar) + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (!avatarp) { return FALSE; } - return (avatar->isSitting() && avatar->getRoot() == root_object); + return (avatarp->isSitting() && avatarp->getRoot() == root_object); } class LLToolsSaveToInventory : public view_listener_t @@ -6489,15 +6489,15 @@ void handle_toggle_pg(void*) void handle_dump_attachments(void*) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - if( !avatar ) + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if(!avatarp) { llinfos << "NO AVATAR" << llendl; return; } - for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin(); - iter != avatar->mAttachmentPoints.end(); ) + for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); + iter != avatarp->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; LLViewerJointAttachment* attachment = curiter->second; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 7b52724e8e..1ead7bac10 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4165,9 +4165,9 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data) BOOL force_mouselook; mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_ForceMouselook, force_mouselook); - LLVOAvatar* avatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); - if (avatar && dist_vec_squared(camera_eye, camera_at) > 0.0001f) + if (avatarp && dist_vec_squared(camera_eye, camera_at) > 0.0001f) { gAgentCamera.setSitCamera(sitObjectID, camera_eye, camera_at); } @@ -4178,7 +4178,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data) if (object) { LLVector3 sit_spot = object->getPositionAgent() + (sitPosition * object->getRotation()); - if (!use_autopilot || (avatar && avatar->isSitting() && avatar->getRoot() == object->getRoot())) + if (!use_autopilot || (avatarp && avatarp->isSitting() && avatarp->getRoot() == object->getRoot())) { //we're already sitting on this object, so don't autopilot } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 54379dece3..bb69622135 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -965,15 +965,15 @@ void LLVOAvatar::dumpBakedStatus() //static void LLVOAvatar::restoreGL() { - LLVOAvatar* self = gAgent.getAvatarObject(); - if (!self) - return; - self->setCompositeUpdatesEnabled(TRUE); - for (U32 i = 0; i < self->mBakedTextureDatas.size(); i++) + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (!avatarp) return; + + avatarp->setCompositeUpdatesEnabled(TRUE); + for (U32 i = 0; i < avatarp->mBakedTextureDatas.size(); i++) { - self->invalidateComposite(self->mBakedTextureDatas[i].mTexLayerSet, FALSE); + avatarp->invalidateComposite(avatarp->mBakedTextureDatas[i].mTexLayerSet, FALSE); } - self->updateMeshTextures(); + avatarp->updateMeshTextures(); } //static @@ -6859,8 +6859,8 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) // static void LLVOAvatar::dumpArchetypeXML( void* ) { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - LLAPRFile outfile ; + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + LLAPRFile outfile; outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"new archetype.xml"), LL_APR_WB ); apr_file_t* file = outfile.getFileHandle() ; if (!file) @@ -6878,7 +6878,7 @@ void LLVOAvatar::dumpArchetypeXML( void* ) const std::string& wearable_name = LLWearableDictionary::getTypeName((EWearableType)type); apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() ); - for (LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam()) + for (LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam()) { LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; if( (viewer_param->getWearableType() == type) && @@ -6894,7 +6894,7 @@ void LLVOAvatar::dumpArchetypeXML( void* ) if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type) { // MULTIPLE_WEARABLES: extend to multiple wearables? - LLViewerTexture* te_image = avatar->getImage((ETextureIndex)te, 0); + LLViewerTexture* te_image = ((LLVOAvatar*)avatarp)->getImage((ETextureIndex)te, 0); if( te_image ) { std::string uuid_str; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 0243130e12..e3583b4d6b 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1930,8 +1930,8 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**) LLUUID texture_id; msg->getUUID("TextureData", "TextureID", texture_id); - LLVOAvatarSelf* self = gAgent.getAvatarObject(); - if (!self) return; + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + if (!avatarp) return; // If this is a texture corresponding to one of our baked entries, // just rebake that layer set. @@ -1948,13 +1948,13 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**) const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; if (texture_dict->mIsBakedTexture) { - if (texture_id == self->getTEImage(index)->getID()) + if (texture_id == avatarp->getTEImage(index)->getID()) { - LLTexLayerSet* layer_set = self->getLayerSet(index); + LLTexLayerSet* layer_set = avatarp->getLayerSet(index); if (layer_set) { llinfos << "TAT: rebake - matched entry " << (S32)index << llendl; - self->invalidateComposite(layer_set, TRUE); + avatarp->invalidateComposite(layer_set, TRUE); found = TRUE; LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); } @@ -1965,12 +1965,12 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**) // If texture not found, rebake all entries. if (!found) { - self->forceBakeAllTextures(); + avatarp->forceBakeAllTextures(); } else { // Not sure if this is necessary, but forceBakeAllTextures() does it. - self->updateMeshTextures(); + avatarp->updateMeshTextures(); } } diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index de2d049382..c9fe032a24 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -62,27 +62,26 @@ class LLOverrideBakedTextureUpdate public: LLOverrideBakedTextureUpdate(bool temp_state) { - mAvatar = gAgent.getAvatarObject(); + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); U32 num_bakes = (U32) LLVOAvatarDefines::BAKED_NUM_INDICES; for( U32 index = 0; index < num_bakes; ++index ) { - composite_enabled[index] = mAvatar->isCompositeUpdateEnabled(index); + composite_enabled[index] = avatarp->isCompositeUpdateEnabled(index); } - mAvatar->setCompositeUpdatesEnabled(temp_state); + avatarp->setCompositeUpdatesEnabled(temp_state); } ~LLOverrideBakedTextureUpdate() { + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); U32 num_bakes = (U32)LLVOAvatarDefines::BAKED_NUM_INDICES; for( U32 index = 0; index < num_bakes; ++index ) { - mAvatar->setCompositeUpdatesEnabled(index, composite_enabled[index]); - } + avatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]); + } } - private: bool composite_enabled[LLVOAvatarDefines::BAKED_NUM_INDICES]; - LLVOAvatarSelf *mAvatar; }; // Private local functions @@ -205,10 +204,10 @@ BOOL LLWearable::exportFile(LLFILE* file) const void LLWearable::createVisualParams() { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); param; - param = (LLViewerVisualParam*) avatar->getNextVisualParam()) + param = (LLViewerVisualParam*) avatarp->getNextVisualParam()) { if (param->getWearableType() == mType) { @@ -228,7 +227,7 @@ void LLWearable::createVisualParams() param->resetDrivenParams(); if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false)) { - if( !param->linkDrivenParams(boost::bind(avatar_function,(LLVOAvatarSelf*)avatar,_1 ), true)) + if( !param->linkDrivenParams(boost::bind(avatar_function,avatarp,_1 ), true)) { llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; continue; @@ -464,12 +463,9 @@ BOOL LLWearable::importFile( LLFILE* file ) // since this wearable was created. BOOL LLWearable::isOldVersion() const { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - return FALSE; - } + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + llassert(avatarp); + if(!avatarp) return FALSE; if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion ) { @@ -483,9 +479,9 @@ BOOL LLWearable::isOldVersion() const } S32 param_count = 0; - for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); + for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); param; - param = (LLViewerVisualParam*) avatar->getNextVisualParam() ) + param = (LLViewerVisualParam*) avatarp->getNextVisualParam() ) { if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { @@ -531,17 +527,13 @@ BOOL LLWearable::isOldVersion() const // only if those values are the same as the defaults. BOOL LLWearable::isDirty() const { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - return FALSE; - } - + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + llassert(avatarp); + if(!avatarp) return FALSE; - for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); + for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); param; - param = (LLViewerVisualParam*) avatar->getNextVisualParam() ) + param = (LLViewerVisualParam*) avatarp->getNextVisualParam() ) { if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) @@ -602,14 +594,11 @@ BOOL LLWearable::isDirty() const void LLWearable::setParamsToDefaults() { - LLVOAvatar* avatar = gAgent.getAvatarObject(); - llassert( avatar ); - if( !avatar ) - { - return; - } + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + llassert(avatarp); + if (!avatarp) return; - for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) + for( LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() ) { if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) ) { @@ -1123,10 +1112,10 @@ void LLWearable::destroyTextures() void LLWearable::pullCrossWearableValues() { // scan through all of the avatar's visual parameters - LLVOAvatar* avatar = gAgent.getAvatarObject(); - for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); + LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); + for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); param; - param = (LLViewerVisualParam*) avatar->getNextVisualParam()) + param = (LLViewerVisualParam*) avatarp->getNextVisualParam()) { if( param ) { |