void LLFloaterObjectWeights::refresh()
{
	LLSelectMgr* sel_mgr = LLSelectMgr::getInstance();

	if (sel_mgr->getSelection()->isEmpty())
	{
		updateIfNothingSelected();
	}
	else
	{
		S32 prim_count = sel_mgr->getSelection()->getObjectCount();
		S32 link_count = sel_mgr->getSelection()->getRootObjectCount();
		F32 prim_equiv = sel_mgr->getSelection()->getSelectedLinksetCost();

		mSelectedObjects->setText(llformat("%d", link_count));
		mSelectedPrims->setText(llformat("%d", prim_count));
		mSelectedOnLand->setText(llformat("%.1d", (S32)prim_equiv));

		LLCrossParcelFunctor func;
		if (sel_mgr->getSelection()->applyToRootObjects(&func, true))
		{
			// Some of the selected objects cross parcel bounds.
			// We don't display object weights and land impacts in this case.
			const std::string text = getString("nothing_selected");

			mRezzedOnLand->setText(text);
			mRemainingCapacity->setText(text);
			mTotalCapacity->setText(text);

			toggleLandImpactsLoadingIndicators(false);
		}

		LLViewerRegion* region = gAgent.getRegion();
		if (region && region->capabilitiesReceived())
		{
			for (LLObjectSelection::valid_root_iterator iter = sel_mgr->getSelection()->valid_root_begin();
					iter != sel_mgr->getSelection()->valid_root_end(); ++iter)
			{
				LLAccountingCostManager::getInstance()->addObject((*iter)->getObject()->getID());
			}

			std::string url = region->getCapability("ResourceCostSelected");
			if (!url.empty())
			{
				// Update the transaction id before the new fetch request
				generateTransactionID();

				LLAccountingCostManager::getInstance()->fetchCosts(Roots, url, getObserverHandle());
				toggleWeightsLoadingIndicators(true);
			}
		}
		else
		{
			//LL_WARNS() << "Failed to get region capabilities" << LL_ENDL;
			llwarns << "Failed to get region capabilities" << llendl;
		}
	}
}
void LLFloaterObjectWeights::updateLandImpacts(const LLParcel* parcel)
{
	if (!parcel || LLSelectMgr::getInstance()->getSelection()->isEmpty())
	{
		updateIfNothingSelected();
	}
	else
	{
		S32 rezzed_prims = parcel->getSimWidePrimCount();
		S32 total_capacity = parcel->getSimWideMaxPrimCapacity();

		mRezzedOnLand->setText(llformat("%d", rezzed_prims));
		mRemainingCapacity->setText(llformat("%d", total_capacity - rezzed_prims));
		mTotalCapacity->setText(llformat("%d", total_capacity));

		toggleLandImpactsLoadingIndicators(false);
	}
}