More asset blacklist improvements: Don't save the list after adding/removing an item during a bulk operation

meow-7.2.2
Ansariel 2016-08-26 15:48:52 +02:00
parent 120e06bb85
commit a5b89c588f
4 changed files with 42 additions and 13 deletions

View File

@ -109,7 +109,7 @@ void FSAssetBlacklist::addNewItemToBlacklist(const LLUUID& id, const std::string
addNewItemToBlacklistData(id, data, save);
}
void FSAssetBlacklist::removeItemFromBlacklist(const LLUUID& id)
void FSAssetBlacklist::removeItem(const LLUUID& id)
{
gObjectList.removeDerenderedItem(id);
@ -126,7 +126,20 @@ void FSAssetBlacklist::removeItemFromBlacklist(const LLUUID& id)
mBlacklistTypeContainer[type].erase(id);
mBlacklistData.erase(it);
}
void FSAssetBlacklist::removeItemFromBlacklist(const LLUUID& id)
{
removeItem(id);
saveBlacklist();
}
void FSAssetBlacklist::removeItemsFromBlacklist(const uuid_vec_t& ids)
{
for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
{
removeItem(*it);
}
saveBlacklist();
}

View File

@ -46,12 +46,14 @@ public:
void addNewItemToBlacklist(const LLUUID& id, const std::string& name, const std::string& region, LLAssetType::EType type, bool permanent = true, bool save = true);
void addNewItemToBlacklistData(const LLUUID& id, const LLSD& data, bool save = true);
void removeItemFromBlacklist(const LLUUID& id);
void removeItemsFromBlacklist(const uuid_vec_t& ids);
void saveBlacklist();
blacklist_data_t getBlacklistData() const { return mBlacklistData; };
private:
void loadBlacklist();
void saveBlacklist();
void removeItem(const LLUUID& id);
bool addEntryToBlacklistMap(const LLUUID& id, LLAssetType::EType type);
std::string mBlacklistFileName;

View File

@ -141,14 +141,15 @@ void FSFloaterAssetBlacklist::addElementToList(const LLUUID& id, const LLSD& dat
void FSFloaterAssetBlacklist::removeElements()
{
uuid_vec_t items;
std::vector<LLScrollListItem*> list = mResultList->getAllSelected();
FSAssetBlacklist& instance = FSAssetBlacklist::instance();
for (std::vector<LLScrollListItem*>::const_iterator it = list.begin(); it != list.end(); ++it)
{
instance.removeItemFromBlacklist((*it)->getUUID());
items.push_back((*it)->getUUID());
}
FSAssetBlacklist::instance().removeItemsFromBlacklist(items);
mResultList->deleteSelectedItems();
}

View File

@ -2859,6 +2859,7 @@ void cleanup_menus()
// <FS:Ansariel> FIRE-6970/FIRE-6998: Optional permanent derendering of multiple objects
void derenderObject(bool permanent)
{
bool need_save = false;
LLViewerObject* objp;
LLSelectMgr* select_mgr = LLSelectMgr::getInstance();
@ -2883,6 +2884,7 @@ void derenderObject(bool permanent)
}
else
{
bool next_object = false;
LLViewerObject::child_list_t object_children = objp->getChildren();
for (LLViewerObject::child_list_t::const_iterator it = object_children.begin(); it != object_children.end(); it++)
{
@ -2893,16 +2895,21 @@ void derenderObject(bool permanent)
{
// RLVa: Prevent cheating out of sitting by derendering the object
select_mgr->deselectObjectOnly(objp);
return;
next_object = true;
}
else
{
gAgent.standUp();
break;
}
break;
}
}
if (next_object)
{
continue;
}
LLSelectNode* nodep = select_mgr->getSelection()->getFirstRootNode();
if (nodep)
{
@ -2919,15 +2926,16 @@ void derenderObject(bool permanent)
asset_type = LLAssetType::AT_OBJECT;
}
FSAssetBlacklist::getInstance()->addNewItemToBlacklist(objp->getID(), entry_name, region_name, asset_type, permanent, permanent);
FSAssetBlacklist::getInstance()->addNewItemToBlacklist(objp->getID(), entry_name, region_name, asset_type, permanent, false);
if (permanent)
{
need_save = true;
}
select_mgr->deselectObjectOnly(objp);
// <FS:ND> Pass true to make sure this object stays dead.
// gObjectList.killObject(objp);
gObjectList.addDerenderedItem( objp->getID(), permanent );
gObjectList.addDerenderedItem(objp->getID(), permanent);
gObjectList.killObject(objp);
// </FS:ND>
}
else if( (objp) && (gAgentID != objp->getID()) && ((rlv_handler_t::isEnabled()) || (objp->isAttachment()) || (objp->permYouOwner())) )
{
@ -2935,6 +2943,11 @@ void derenderObject(bool permanent)
return;
}
}
if (need_save)
{
FSAssetBlacklist::getInstance()->saveBlacklist();
}
}
class LLObjectDerenderPermanent : public view_listener_t