BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain() { LLUUID region_id; LLFloaterLand* instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land"); if(!instance) { childSetValue("loading_text", LLSD(std::string(""))); //might have to do parent post build here //if not logic below could use early outs return FALSE; } LLParcel* parcel = instance->getCurrentSelectedParcel(); LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); LLUUID current_region_id = gAgent.getRegion()->getRegionID(); if ((region) && (parcel)) { LLVector3 parcel_center = parcel->getCenterpoint(); region_id = region->getRegionID(); if(region_id != current_region_id) { std::string msg_wrong_region = LLTrans::getString("ScriptLimitsRequestWrongRegion"); childSetValue("loading_text", LLSD(msg_wrong_region)); return FALSE; } LLVector3d pos_global = region->getCenterGlobal(); LLSD body; std::string url = region->getCapability("RemoteParcelRequest"); if (!url.empty()) { body["location"] = ll_sd_from_vector3(parcel_center); if (!region_id.isNull()) { body["region_id"] = region_id; } if (!pos_global.isExactlyZero()) { U64 region_handle = to_region_handle(pos_global); body["region_handle"] = ll_sd_from_U64(region_handle); } LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle())); } else { llwarns << "Can't get parcel info for script information request" << region_id << ". Region: " << region->getName() << " does not support RemoteParcelRequest" << llendl; std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestError"); childSetValue("loading_text", LLSD(msg_waiting)); } } else { std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestNoParcelSelected"); childSetValue("loading_text", LLSD(msg_waiting)); } return LLPanelScriptLimitsInfo::postBuild(); }
BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain() { LLUUID region_id; LLFloaterLand* instance = LLFloaterLand::getInstance(); if(!instance) { getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string(""))); //might have to do parent post build here //if not logic below could use early outs return FALSE; } LLParcel* parcel = instance->getCurrentSelectedParcel(); LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); LLUUID current_region_id = gAgent.getRegion()->getRegionID(); // <alchemy> Fall back to the parcel we're on if none is selected. // Fixes parcel script info intermittently working and broken in toolbar button. if (!parcel) { parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); region = gAgent.getRegion(); } // </alchemy> if ((region) && (parcel)) { LLVector3 parcel_center = parcel->getCenterpoint(); region_id = region->getRegionID(); if(region_id != current_region_id) { std::string msg_wrong_region = LLTrans::getString("ScriptLimitsRequestWrongRegion"); getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_wrong_region)); return FALSE; } LLVector3d pos_global = region->getCenterGlobal(); LLSD body; std::string url = region->getCapability("RemoteParcelRequest"); if (!url.empty()) { body["location"] = ll_sd_from_vector3(parcel_center); if (!region_id.isNull()) { body["region_id"] = region_id; } if (!pos_global.isExactlyZero()) { U64 region_handle = to_region_handle(pos_global); body["region_handle"] = ll_sd_from_U64(region_handle); } LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(getObserverHandle())); } else { LL_WARNS() << "Can't get parcel info for script information request" << region_id << ". Region: " << region->getName() << " does not support RemoteParcelRequest" << LL_ENDL; std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestError"); getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); } } else { std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestNoParcelSelected"); getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); } return LLPanelScriptLimitsInfo::postBuild(); }