Optimize the way we send top scripts/object disable/return

This commit is contained in:
Lirusaito
2019-03-28 02:43:32 -04:00
parent 90e9bce8de
commit 0ca9047f8c

View File

@@ -328,21 +328,11 @@ void LLFloaterTopObjects::doToObjects(int action, bool all)
LLViewerRegion* region = gAgent.getRegion(); LLViewerRegion* region = gAgent.getRegion();
if (!region) return; if (!region) return;
LLCtrlListInterface *list = getChild<LLUICtrl>("objects_list")->getListInterface(); const auto list = getChild<LLScrollListCtrl>("objects_list");
if (!list || list->getItemCount() == 0) return; if (!list || list->getItemCount() == 0) return;
uuid_vec_t::iterator id_itor;
bool start_message = true; bool start_message = true;
auto func = [&](const LLUUID& task_id){
for (id_itor = mObjectListIDs.begin(); id_itor != mObjectListIDs.end(); ++id_itor)
{
LLUUID task_id = *id_itor;
if (!all && !list->isSelected(task_id))
{
// Selected only
continue;
}
if (start_message) if (start_message)
{ {
if (action == ACTION_RETURN) if (action == ACTION_RETURN)
@@ -370,7 +360,10 @@ void LLFloaterTopObjects::doToObjects(int action, bool all)
msg->sendReliable(region->getHost()); msg->sendReliable(region->getHost());
start_message = true; start_message = true;
} }
} };
if (all) for (const auto& id : mObjectListIDs) func(id);
else for (const auto& item : list->getAllSelected()) func(item->getUUID());
if (!start_message) if (!start_message)
{ {