diff options
-rwxr-xr-x[-rw-r--r--] | .hgignore | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llinventory/llinventory.cpp | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/llinventory/llinventory.h | 1 | ||||
-rwxr-xr-x | indra/newview/llappearancemgr.cpp | 49 | ||||
-rwxr-xr-x | indra/newview/llappearancemgr.h | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/newview/llpaneleditwearable.cpp | 22 |
6 files changed, 68 insertions, 12 deletions
diff --git a/.hgignore b/.hgignore index c845758e7c..c845758e7c 100644..100755 --- a/.hgignore +++ b/.hgignore diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 2dbc331036..3150a99a21 100644..100755 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -379,6 +379,11 @@ const std::string& LLInventoryItem::getDescription() const return mDescription; } +const std::string& LLInventoryItem::getActualDescription() const +{ + return mDescription; +} + time_t LLInventoryItem::getCreationDate() const { return mCreationDate; diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index a5cfe59bda..44e7c0c34d 100644..100755 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -160,6 +160,7 @@ public: virtual const LLUUID& getCreatorUUID() const; virtual const LLUUID& getAssetUUID() const; virtual const std::string& getDescription() const; + virtual const std::string& getActualDescription() const; // Does not follow links virtual const LLSaleInfo& getSaleInfo() const; virtual LLInventoryType::EType getInventoryType() const; virtual U32 getFlags() const; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 7edba842b8..d1ed82cc98 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -451,7 +451,7 @@ public: item->getLinkedUUID(), mDstCatID, item->getName(), - item->LLInventoryItem::getDescription(), + item->getActualDescription(), LLAssetType::AT_LINK, new LLBoostFuncInventoryCallback( boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item_id,_1,LLTimer()))); @@ -1467,13 +1467,13 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL { case LLAssetType::AT_LINK: { - //LLInventoryItem::getDescription() is used for a new description + //getActualDescription() is used for a new description //to propagate ordering information saved in descriptions of links link_inventory_item(gAgent.getID(), item->getLinkedUUID(), dst_id, item->getName(), - item->LLInventoryItem::getDescription(), + item->getActualDescription(), LLAssetType::AT_LINK, cb); break; } @@ -1718,7 +1718,7 @@ void LLAppearanceMgr::linkAll(const LLUUID& cat_uuid, item->getLinkedUUID(), cat_uuid, item->getName(), - item->LLInventoryItem::getDescription(), + item->getActualDescription(), LLAssetType::AT_LINK, cb); @@ -1910,7 +1910,7 @@ bool sort_by_description(const LLInventoryItem* item1, const LLInventoryItem* it return true; } - return item1->LLInventoryItem::getDescription() < item2->LLInventoryItem::getDescription(); + return item1->getActualDescription() < item2->getActualDescription(); } void item_array_diff(LLInventoryModel::item_array_t& full_list, @@ -2486,6 +2486,33 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update return; } +LLInventoryModel::item_array_t LLAppearanceMgr::findCOFItemLinks(const LLUUID& item_id) +{ + + LLInventoryModel::item_array_t result; + const LLViewerInventoryItem *vitem = + dynamic_cast<const LLViewerInventoryItem*>(gInventory.getItem(item_id)); + + if (vitem) + { + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendents(LLAppearanceMgr::getCOF(), + cat_array, + item_array, + LLInventoryModel::EXCLUDE_TRASH); + for (S32 i=0; i<item_array.count(); i++) + { + const LLViewerInventoryItem* inv_item = item_array.get(i).get(); + if (inv_item->getLinkedUUID() == vitem->getLinkedUUID()) + { + result.put(item_array.get(i)); + } + } + } + return result; +} + void LLAppearanceMgr::removeAllClothesFromAvatar() { // Fetch worn clothes (i.e. the ones in COF). @@ -2644,7 +2671,7 @@ void LLAppearanceMgr::updateIsDirty() if (item1->getLinkedUUID() != item2->getLinkedUUID() || item1->getName() != item2->getName() || - item1->LLInventoryItem::getDescription() != item2->LLInventoryItem::getDescription()) + item1->getActualDescription() != item2->getActualDescription()) { mOutfitIsDirty = true; return; @@ -2855,8 +2882,8 @@ struct WearablesOrderComparator return true; } - const std::string& desc1 = item1->LLInventoryItem::getDescription(); - const std::string& desc2 = item2->LLInventoryItem::getDescription(); + const std::string& desc1 = item1->getActualDescription(); + const std::string& desc2 = item2->getActualDescription(); bool item1_valid = (desc1.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc1[0]); bool item2_valid = (desc2.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc2[0]); @@ -2914,7 +2941,7 @@ void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id, bool update_base if (!item) continue; std::string new_order_str = build_order_string((LLWearableType::EType)type, i); - if (new_order_str == item->LLInventoryItem::getDescription()) continue; + if (new_order_str == item->getActualDescription()) continue; item->setDescription(new_order_str); item->setComplete(TRUE); @@ -3179,8 +3206,8 @@ bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_b closer_to_body ? --it : ++it; LLViewerInventoryItem* swap_item = *it; if (!swap_item) return false; - std::string tmp = swap_item->LLInventoryItem::getDescription(); - swap_item->setDescription(item->LLInventoryItem::getDescription()); + std::string tmp = swap_item->getActualDescription(); + swap_item->setDescription(item->getActualDescription()); item->setDescription(tmp); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 31dbce892a..01a2d41458 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -132,6 +132,9 @@ public: void addCOFItemLink(const LLUUID& item_id, bool do_update = true, LLPointer<LLInventoryCallback> cb = NULL); void addCOFItemLink(const LLInventoryItem *item, bool do_update = true, LLPointer<LLInventoryCallback> cb = NULL); + // Find COF entries referencing the given item. + LLInventoryModel::item_array_t findCOFItemLinks(const LLUUID& item_id); + // Remove COF entries void removeCOFItemLinks(const LLUUID& item_id); void removeCOFLinksOfType(LLWearableType::EType type); diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 606e78bd58..cca3b90329 100644..100755 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1065,7 +1065,27 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) } else { - gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); + LLInventoryModel::item_array_t links = + LLAppearanceMgr::instance().findCOFItemLinks(mWearablePtr->getItemID()); + if (links.size()>0) + { + // Make another copy of this link, with the same description. + LLInventoryItem *item = links.get(0).get(); + if (item) + { + const std::string description = item->getIsLinkType() ? item->getActualDescription() : ""; + link_inventory_item( gAgent.getID(), + item->getLinkedUUID(), + LLAppearanceMgr::instance().getCOF(), + item->getName(), + description, + LLAssetType::AT_LINK, + NULL); + gInventory.purgeObject(item->getUUID()); + } + } + gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); + } } |