Skip to content
Snippets Groups Projects
Commit cdb6f67f authored by Nyx (Neal Orman)'s avatar Nyx (Neal Orman)
Browse files

EXT-3958 title needs to update appropriately when changes made to outfit

We now show a string "(unsaved)" under the appearance panel outfit title
when the currently loaded outfit has been modified from its original state.

Tested with following conditions:
1) item added to loaded outfit
2) item removed from loaded outfit
3) item replaced in loaded outfit

Appears to work properly on login as well. Checking is a manual folder compare,
but should be fairly efficient.

XUI changes submitted by Erica

Entire diff reviewed by Vir
parent 27bd6512
No related branches found
No related tags found
No related merge requests found
...@@ -2274,6 +2274,8 @@ void LLInitialWearablesFetch::processContents() ...@@ -2274,6 +2274,8 @@ void LLInitialWearablesFetch::processContents()
} }
else else
{ {
// if we're constructing the COF from the wearables message, we don't have a proper outfit link
LLAppearanceManager::instance().setOutfitDirty(true);
processWearablesMessage(); processWearablesMessage();
} }
delete this; delete this;
......
...@@ -674,6 +674,10 @@ void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, ...@@ -674,6 +674,10 @@ void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder,
void LLAppearanceManager::updateAppearanceFromCOF() void LLAppearanceManager::updateAppearanceFromCOF()
{ {
// update dirty flag to see if the state of the COF matches
// the saved outfit stored as a folder link
updateIsDirty();
dumpCat(getCOF(),"COF, start"); dumpCat(getCOF(),"COF, start");
bool follow_folder_links = true; bool follow_folder_links = true;
...@@ -1005,7 +1009,9 @@ void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_up ...@@ -1005,7 +1009,9 @@ void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_up
if (linked_already) if (linked_already)
{ {
if (do_update) if (do_update)
{
LLAppearanceManager::updateAppearanceFromCOF(); LLAppearanceManager::updateAppearanceFromCOF();
}
return; return;
} }
else else
...@@ -1059,6 +1065,75 @@ void LLAppearanceManager::removeCOFItemLinks(const LLUUID& item_id, bool do_upda ...@@ -1059,6 +1065,75 @@ void LLAppearanceManager::removeCOFItemLinks(const LLUUID& item_id, bool do_upda
} }
} }
void LLAppearanceManager::updateIsDirty()
{
LLUUID cof = getCOF();
LLUUID base_outfit;
// find base outfit link
const LLViewerInventoryItem* base_outfit_item = getBaseOutfitLink();
LLViewerInventoryCategory* catp = NULL;
if (base_outfit_item && base_outfit_item->getIsLinkType())
{
catp = base_outfit_item->getLinkedCategory();
}
if(catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
{
base_outfit = catp->getUUID();
}
if(base_outfit.isNull())
{
// no outfit link found, display "unsaved outfit"
mOutfitIsDirty = true;
}
else
{
LLInventoryModel::cat_array_t cof_cats;
LLInventoryModel::item_array_t cof_items;
gInventory.collectDescendents(cof, cof_cats, cof_items,
LLInventoryModel::EXCLUDE_TRASH);
LLInventoryModel::cat_array_t outfit_cats;
LLInventoryModel::item_array_t outfit_items;
gInventory.collectDescendents(base_outfit, outfit_cats, outfit_items,
LLInventoryModel::EXCLUDE_TRASH);
if(outfit_items.count() != cof_items.count() -1)
{
// Current outfit folder should have one more item than the outfit folder.
// this one item is the link back to the outfit folder itself.
mOutfitIsDirty = true;
}
else
{
typedef std::set<LLUUID> item_set_t;
item_set_t cof_set;
item_set_t outfit_set;
// sort COF items by UUID
for (S32 i = 0; i < cof_items.count(); ++i)
{
LLViewerInventoryItem *item = cof_items.get(i);
// don't add the base outfit link to the list of objects we're comparing
if(item != base_outfit_item)
{
cof_set.insert(item->getLinkedUUID());
}
}
// sort outfit folder by UUID
for (S32 i = 0; i < outfit_items.count(); ++i)
{
LLViewerInventoryItem *item = outfit_items.get(i);
outfit_set.insert(item->getLinkedUUID());
}
mOutfitIsDirty = (outfit_set != cof_set);
}
}
}
//#define DUMP_CAT_VERBOSE //#define DUMP_CAT_VERBOSE
void LLAppearanceManager::dumpCat(const LLUUID& cat_id, const std::string& msg) void LLAppearanceManager::dumpCat(const LLUUID& cat_id, const std::string& msg)
...@@ -1095,7 +1170,8 @@ void LLAppearanceManager::dumpItemArray(const LLInventoryModel::item_array_t& it ...@@ -1095,7 +1170,8 @@ void LLAppearanceManager::dumpItemArray(const LLInventoryModel::item_array_t& it
} }
LLAppearanceManager::LLAppearanceManager(): LLAppearanceManager::LLAppearanceManager():
mAttachmentInvLinkEnabled(false) mAttachmentInvLinkEnabled(false),
mOutfitIsDirty(false)
{ {
} }
......
...@@ -96,6 +96,16 @@ public: ...@@ -96,6 +96,16 @@ public:
// Add COF link to ensemble folder. // Add COF link to ensemble folder.
void addEnsembleLink(LLInventoryCategory* item, bool do_update = true); void addEnsembleLink(LLInventoryCategory* item, bool do_update = true);
//has the current outfit changed since it was loaded?
bool isOutfitDirty() { return mOutfitIsDirty; }
// set false if you just loaded the outfit, true otherwise
void setOutfitDirty(bool isDirty) { mOutfitIsDirty = isDirty; }
// manually compare ouftit folder link to COF to see if outfit has changed.
// should only be necessary to do on initial login.
void updateIsDirty();
protected: protected:
LLAppearanceManager(); LLAppearanceManager();
~LLAppearanceManager(); ~LLAppearanceManager();
...@@ -120,6 +130,7 @@ private: ...@@ -120,6 +130,7 @@ private:
std::set<LLUUID> mRegisteredAttachments; std::set<LLUUID> mRegisteredAttachments;
bool mAttachmentInvLinkEnabled; bool mAttachmentInvLinkEnabled;
bool mOutfitIsDirty;
}; };
#define SUPPORT_ENSEMBLES 0 #define SUPPORT_ENSEMBLES 0
......
...@@ -151,6 +151,8 @@ BOOL LLSidepanelAppearance::postBuild() ...@@ -151,6 +151,8 @@ BOOL LLSidepanelAppearance::postBuild()
} }
mCurrentLookName = getChild<LLTextBox>("currentlook_name"); mCurrentLookName = getChild<LLTextBox>("currentlook_name");
mOutfitDirtyTag = getChild<LLTextBox>("currentlook_title");
mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook"); mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook");
...@@ -316,6 +318,7 @@ void LLSidepanelAppearance::updateVerbs() ...@@ -316,6 +318,7 @@ void LLSidepanelAppearance::updateVerbs()
void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name)
{ {
mOutfitDirtyTag->setVisible(LLAppearanceManager::getInstance()->isOutfitDirty());
if (name == "") if (name == "")
{ {
const LLViewerInventoryItem *outfit_link = LLAppearanceManager::getInstance()->getBaseOutfitLink(); const LLViewerInventoryItem *outfit_link = LLAppearanceManager::getInstance()->getBaseOutfitLink();
......
...@@ -86,6 +86,7 @@ private: ...@@ -86,6 +86,7 @@ private:
LLPanel* mCurrOutfitPanel; LLPanel* mCurrOutfitPanel;
LLTextBox* mCurrentLookName; LLTextBox* mCurrentLookName;
LLTextBox* mOutfitDirtyTag;
// Used to make sure the user's inventory is in memory. // Used to make sure the user's inventory is in memory.
LLCurrentlyWornFetchObserver* mFetchWorn; LLCurrentlyWornFetchObserver* mFetchWorn;
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
<button <button
follows="bottom|left" follows="bottom|left"
height="23" height="23"
label="Make Outfit" label="Save Outfit"
layout="topleft" layout="topleft"
name="make_outfit_btn" name="make_outfit_btn"
tool_tip="Save appearance as an outfit" tool_tip="Save appearance as an outfit"
......
...@@ -52,25 +52,25 @@ width="333"> ...@@ -52,25 +52,25 @@ width="333">
text_color="white" text_color="white"
top="3" top="3"
use_ellipses="true" use_ellipses="true"
width="290" width="305"
follows="top|left" follows="top|left"
word_wrap="true" word_wrap="true"
mouse_opaque="false" mouse_opaque="false"
name="currentlook_name"> name="currentlook_name">
MyOutfit With a really Long Name like MOOSE MyOutfit With a really Long Name like MOOSE
</text> </text>
<!-- <text <text
text_color="LtGray_50" font="SansSerifSmall"
width="290" text_color="White_50"
left="40" width="300"
height="1" height="1"
follows="top|left" follows="top|left"
layout="topleft" layout="topleft"
top_pad="-2" top_pad="5"
mouse_opaque="false" mouse_opaque="false"
name="currentlook_title" > name="currentlook_title" >
(current outfit) (unsaved)
</text>--> </text>
</panel> </panel>
<filter_editor <filter_editor
height="23" height="23"
...@@ -80,18 +80,18 @@ width="333"> ...@@ -80,18 +80,18 @@ width="333">
label="Filter Outfits" label="Filter Outfits"
max_length="300" max_length="300"
name="Filter" name="Filter"
top_pad="0" top_pad="10"
width="303" /> width="303" />
<panel <panel
class="panel_outfits_inventory" class="panel_outfits_inventory"
filename="panel_outfits_inventory.xml" filename="panel_outfits_inventory.xml"
name="panel_outfits_inventory" name="panel_outfits_inventory"
height="515" height="505"
min_height="410" min_height="410"
width="320" width="320"
left="0"
top_pad="0" top_pad="0"
follows="all" follows="all" />
/>
<!-- <button <!-- <button
follows="bottom|left" follows="bottom|left"
height="23" height="23"
...@@ -120,4 +120,3 @@ width="333"> ...@@ -120,4 +120,3 @@ width="333">
top="35" top="35"
visible="false" /> visible="false" />
</panel> </panel>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment