diff options
Diffstat (limited to 'indra/newview/llagentwearables.cpp')
-rwxr-xr-x | indra/newview/llagentwearables.cpp | 140 |
1 files changed, 60 insertions, 80 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 1edbbe2a2e..f3c9998a7d 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -62,15 +62,15 @@ using namespace LLAvatarAppearanceDefines; // Callback to wear and start editing an item that has just been created. void wear_and_edit_cb(const LLUUID& inv_item) - { - if (inv_item.isNull()) return; - - // Request editing the item after it gets worn. - gAgentWearables.requestEditingWearable(inv_item); - - // Wear it. - LLAppearanceMgr::instance().wearItemOnAvatar(inv_item); - } +{ + if (inv_item.isNull()) return; + + // Request editing the item after it gets worn. + gAgentWearables.requestEditingWearable(inv_item); + + // Wear it. + LLAppearanceMgr::instance().wearItemOnAvatar(inv_item,true); +} /////////////////////////////////////////////////////////////////////////////// @@ -180,10 +180,10 @@ void LLAgentWearables::initClass() } void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar) -{ +{ llassert(avatar); - avatar->outputRezTiming("Sending wearables request"); - sendAgentWearablesRequest(); + avatar->outputRezTiming("Sending wearables request"); + sendAgentWearablesRequest(); setAvatarAppearance(avatar); } @@ -209,7 +209,7 @@ LLAgentWearables::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCal * @param wearable The wearable data. * @param todo Bitmask of actions to take on completion. */ -LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInventoryCallback( +LLAgentWearables::AddWearableToAgentInventoryCallback::AddWearableToAgentInventoryCallback( LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo, const std::string description) : mType(type), mIndex(index), @@ -221,7 +221,7 @@ LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInvento llinfos << "constructor" << llendl; } -void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& inv_item) +void LLAgentWearables::AddWearableToAgentInventoryCallback::fire(const LLUUID& inv_item) { if (mTodo & CALL_CREATESTANDARDDONE) { @@ -239,7 +239,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i } if (mTodo & CALL_RECOVERDONE) { - LLAppearanceMgr::instance().addCOFItemLink(inv_item,false); + LLAppearanceMgr::instance().addCOFItemLink(inv_item); gAgentWearables.recoverMissingWearableDone(); } /* @@ -247,7 +247,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i */ if (mTodo & CALL_CREATESTANDARDDONE) { - LLAppearanceMgr::instance().addCOFItemLink(inv_item,false); + LLAppearanceMgr::instance().addCOFItemLink(inv_item); gAgentWearables.createStandardWearablesDone(mType, mIndex); } if (mTodo & CALL_MAKENEWOUTFITDONE) @@ -256,7 +256,8 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i } if (mTodo & CALL_WEARITEM) { - LLAppearanceMgr::instance().addCOFItemLink(inv_item, true, NULL, mDescription); + LLAppearanceMgr::instance().addCOFItemLink(inv_item, + new LLUpdateAppearanceAndEditWearableOnDestroy(inv_item), mDescription); } } @@ -316,12 +317,12 @@ void LLAgentWearables::sendAgentWearablesUpdate() if (wearable->getItemID().isNull()) { LLPointer<LLInventoryCallback> cb = - new addWearableToAgentInventoryCallback( + new AddWearableToAgentInventoryCallback( LLPointer<LLRefCount>(NULL), (LLWearableType::EType)type, index, wearable, - addWearableToAgentInventoryCallback::CALL_NONE); + AddWearableToAgentInventoryCallback::CALL_NONE); addWearableToAgentInventory(cb, wearable); } else @@ -418,23 +419,18 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 item->getFlags(), item->getCreationDate()); template_item->setTransactionID(new_wearable->getTransactionID()); - template_item->updateServer(FALSE); - gInventory.updateItem(template_item); - if (name_changed) - { - gInventory.notifyObservers(); - } + update_inventory_item(template_item, gAgentAvatarp->mEndCustomizeCallback); } else { // Add a new inventory item (shouldn't ever happen here) - U32 todo = addWearableToAgentInventoryCallback::CALL_NONE; + U32 todo = AddWearableToAgentInventoryCallback::CALL_NONE; if (send_update) { - todo |= addWearableToAgentInventoryCallback::CALL_UPDATE; + todo |= AddWearableToAgentInventoryCallback::CALL_UPDATE; } LLPointer<LLInventoryCallback> cb = - new addWearableToAgentInventoryCallback( + new AddWearableToAgentInventoryCallback( LLPointer<LLRefCount>(NULL), type, index, @@ -483,12 +479,12 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, old_wearable, trunc_name); LLPointer<LLInventoryCallback> cb = - new addWearableToAgentInventoryCallback( + new AddWearableToAgentInventoryCallback( LLPointer<LLRefCount>(NULL), type, index, new_wearable, - addWearableToAgentInventoryCallback::CALL_WEARITEM, + AddWearableToAgentInventoryCallback::CALL_WEARITEM, description ); LLUUID category_id; @@ -706,7 +702,7 @@ LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::ETyp } const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const - { +{ return dynamic_cast<const LLViewerWearable*> (getWearable(type, index)); } @@ -714,39 +710,39 @@ const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type) { return (gAgentWearables.getWearableCount(type) > 0); - } - +} + // virtual void LLAgentWearables::wearableUpdated(LLWearable *wearable, BOOL removed) - { +{ if (isAgentAvatarValid()) { const BOOL upload_result = removed; gAgentAvatarp->wearableUpdated(wearable->getType(), upload_result); -} + } LLWearableData::wearableUpdated(wearable, removed); if (!removed) -{ + { LLViewerWearable* viewer_wearable = dynamic_cast<LLViewerWearable*>(wearable); viewer_wearable->refreshName(); - // Hack pt 2. If the wearable we just loaded has definition version 24, - // then force a re-save of this wearable after slamming the version number to 22. - // This number was incorrectly incremented for internal builds before release, and - // this fix will ensure that the affected wearables are re-saved with the right version number. - // the versions themselves are compatible. This code can be removed before release. - if( wearable->getDefinitionVersion() == 24 ) - { - wearable->setDefinitionVersion(22); - U32 index = getWearableIndex(wearable); + // Hack pt 2. If the wearable we just loaded has definition version 24, + // then force a re-save of this wearable after slamming the version number to 22. + // This number was incorrectly incremented for internal builds before release, and + // this fix will ensure that the affected wearables are re-saved with the right version number. + // the versions themselves are compatible. This code can be removed before release. + if( wearable->getDefinitionVersion() == 24 ) + { + wearable->setDefinitionVersion(22); + U32 index = getWearableIndex(wearable); llinfos << "forcing wearable type " << wearable->getType() << " to version 22 from 24" << llendl; - saveWearable(wearable->getType(),index,TRUE); - } + saveWearable(wearable->getType(),index,TRUE); + } checkWearableAgainstInventory(viewer_wearable); -} + } } BOOL LLAgentWearables::itemUpdatePending(const LLUUID& item_id) const @@ -908,12 +904,12 @@ void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type, // destory content.) JC const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); LLPointer<LLInventoryCallback> cb = - new addWearableToAgentInventoryCallback( + new AddWearableToAgentInventoryCallback( LLPointer<LLRefCount>(NULL), type, index, new_wearable, - addWearableToAgentInventoryCallback::CALL_RECOVERDONE); + AddWearableToAgentInventoryCallback::CALL_RECOVERDONE); addWearableToAgentInventory(cb, new_wearable, lost_and_found_id, TRUE); } @@ -956,17 +952,17 @@ public: /* virtual */ void fire(const LLUUID& inv_item) { llinfos << "One item created " << inv_item.asString() << llendl; - LLViewerInventoryItem *item = gInventory.getItem(inv_item); - mItemsToLink.put(item); + LLConstPointer<LLInventoryObject> item = gInventory.getItem(inv_item); + mItemsToLink.push_back(item); updatePendingWearable(inv_item); } ~OnWearableItemCreatedCB() { llinfos << "All items created" << llendl; LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy; - LLAppearanceMgr::instance().linkAll(LLAppearanceMgr::instance().getCOF(), - mItemsToLink, - link_waiter); + link_inventory_array(LLAppearanceMgr::instance().getCOF(), + mItemsToLink, + link_waiter); } void addPendingWearable(LLViewerWearable *wearable) { @@ -1015,7 +1011,7 @@ public: } private: - LLInventoryModel::item_array_t mItemsToLink; + LLInventoryObject::const_object_list_t mItemsToLink; std::vector<LLViewerWearable*> mWearablesAwaitingItems; }; @@ -1442,6 +1438,7 @@ void LLAgentWearables::queryWearableCache() { return; } + gAgentAvatarp->setIsUsingServerBakes(false); // Look up affected baked textures. // If they exist: @@ -1496,12 +1493,12 @@ void LLAgentWearables::queryWearableCache() // virtual void LLAgentWearables::invalidateBakedTextureHash(LLMD5& hash) const { - // Add some garbage into the hash so that it becomes invalid. - if (isAgentAvatarValid()) - { - hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES); - } - } + // Add some garbage into the hash so that it becomes invalid. + if (isAgentAvatarValid()) + { + hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES); + } +} // User has picked "remove from avatar" from a menu. // static @@ -1860,24 +1857,6 @@ void LLAgentWearables::updateServer() gAgent.sendAgentSetAppearance(); } -void LLAgentWearables::populateMyOutfitsFolder(void) -{ - llinfos << "starting outfit population" << llendl; - - const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); - LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch(my_outfits_id); - outfits->mMyOutfitsID = my_outfits_id; - - // Get the complete information on the items in the inventory and - // setup an observer that will wait for that to happen. - gInventory.addObserver(outfits); - outfits->startFetch(); - if (outfits->isFinished()) - { - outfits->done(); - } -} - boost::signals2::connection LLAgentWearables::addLoadingStartedCallback(loading_started_callback_t cb) { return mLoadingStartedSignal.connect(cb); @@ -1896,6 +1875,7 @@ bool LLAgentWearables::changeInProgress() const void LLAgentWearables::notifyLoadingStarted() { mCOFChangeInProgress = true; + mCOFChangeTimer.reset(); mLoadingStartedSignal(); } |