本文整理汇总了C++中LLViewerRegion::getCapability方法的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerRegion::getCapability方法的具体用法?C++ LLViewerRegion::getCapability怎么用?C++ LLViewerRegion::getCapability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLViewerRegion
的用法示例。
在下文中一共展示了LLViewerRegion::getCapability方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fetchFromServer
void LLViewerInventoryItem::fetchFromServer(void) const
{
if(!mIsComplete)
{
std::string url;
LLViewerRegion* region = gAgent.getRegion();
// we have to check region. It can be null after region was destroyed. See EXT-245
if (region)
{
if(gAgent.getID() != mPermissions.getOwner())
{
url = region->getCapability("FetchLib");
}
else
{
url = region->getCapability("FetchInventory");
}
}
else
{
llwarns << "Agent Region is absent" << llendl;
}
if (!url.empty())
{
LLSD body;
body["agent_id"] = gAgent.getID();
body["items"][0]["owner_id"] = mPermissions.getOwner();
body["items"][0]["item_id"] = mUUID;
LLHTTPClient::post(url, body, new LLInventoryModel::fetchInventoryResponder(body));
}
else
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("FetchInventory");
msg->nextBlock("AgentData");
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
msg->nextBlock("InventoryData");
msg->addUUID("OwnerID", mPermissions.getOwner());
msg->addUUID("ItemID", mUUID);
gAgent.sendReliableMessage();
}
}
else
{
// *FIX: this can be removed after a bit.
llwarns << "request to fetch complete item" << llendl;
}
}
示例2: displayParcelInfo
void LLPanelPlaceInfo::displayParcelInfo(const LLUUID& region_id,
const LLVector3d& pos_global)
{
LLViewerRegion* region = gAgent.getRegion();
if (!region)
return;
mPosRegion.setVec((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
(F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
(F32)pos_global.mdV[VZ]);
LLSD body;
std::string url = region->getCapability("RemoteParcelRequest");
if (!url.empty())
{
body["location"] = ll_sd_from_vector3(mPosRegion);
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
{
mDescEditor->setText(getString("server_update_text"));
}
}
示例3: refresh
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;
}
}
}
示例4: getChannelInfo
void LLVoiceChannelGroup::getChannelInfo()
{
LLViewerRegion* region = gAgent.getRegion();
if (region)
{
std::string url = region->getCapability("ChatSessionRequest");
LLSD data;
data["method"] = "call";
data["session-id"] = mSessionID;
LLHTTPClient::post(url,
data,
new LLVoiceCallCapResponder(mSessionID));
}
}
示例5: initialize
void LLFloaterAuction::initialize()
{
mParcelUpdateCapUrl.clear();
mParcelp = LLViewerParcelMgr::getInstance()->getParcelSelection();
LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
LLParcel* parcelp = mParcelp->getParcel();
if(parcelp && region && !parcelp->getForSale())
{
mParcelHost = region->getHost();
mParcelID = parcelp->getLocalID();
mParcelUpdateCapUrl = region->getCapability("ParcelPropertiesUpdate");
childSetText("parcel_text", parcelp->getName());
childEnable("snapshot_btn");
childEnable("reset_parcel_btn");
childEnable("start_auction_btn");
LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate();
if (panel)
{ // Only enable "Sell to Anyone" on Teen grid or if we don't know the ID yet
U32 estate_id = panel->getEstateID();
childSetEnabled("sell_to_anyone_btn", (estate_id == ESTATE_TEEN || estate_id == 0));
}
else
{ // Don't have the panel up, so don't know if we're on the teen grid or not. Default to enabling it
childEnable("sell_to_anyone_btn");
}
}
else
{
mParcelHost.invalidate();
if(parcelp && parcelp->getForSale())
{
childSetText("parcel_text", getString("already for sale"));
}
else
{
childSetText("parcel_text", LLStringUtil::null);
}
mParcelID = -1;
childSetEnabled("snapshot_btn", false);
childSetEnabled("reset_parcel_btn", false);
childSetEnabled("sell_to_anyone_btn", false);
childSetEnabled("start_auction_btn", false);
}
mImageID.setNull();
mImage = NULL;
}
示例6: find
void LLFloaterAvatarPicker::find()
{
//clear our stored LLAvatarNames
sAvatarNameMap.clear();
std::string text = getChild<LLUICtrl>("Edit")->getValue().asString();
mQueryID.generate();
std::string url;
url.reserve(128); // avoid a memory allocation or two
LLViewerRegion* region = gAgent.getRegion();
url = region->getCapability("AvatarPickerSearch");
// Prefer use of capabilities to search on both SLID and display name
// but allow display name search to be manually turned off for test
if (!url.empty()
&& LLAvatarNameCache::useDisplayNames())
{
// capability urls don't end in '/', but we need one to parse
// query parameters correctly
if (url.size() > 0 && url[url.size()-1] != '/')
{
url += "/";
}
url += "?page_size=100&names=";
url += LLURI::escape(text);
llinfos << "avatar picker " << url << llendl;
LLHTTPClient::get(url, new LLAvatarPickerResponder(mQueryID));
}
else
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessage("AvatarPickerRequest");
msg->nextBlock("AgentData");
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
msg->addUUID("QueryID", mQueryID); // not used right now
msg->nextBlock("Data");
msg->addString("Name", text);
gAgent.sendReliableMessage();
}
getChild<LLScrollListCtrl>("SearchResults")->deleteAllItems();
getChild<LLScrollListCtrl>("SearchResults")->setCommentText(getString("searching"));
getChildView("ok_btn")->setEnabled(FALSE);
mNumResultsReturned = 0;
}
示例7: set
void LLViewerDisplayName::set(const std::string& display_name, const set_name_slot_t& slot)
{
// TODO: simple validation here
LLViewerRegion* region = gAgent.getRegion();
llassert(region);
std::string cap_url = region->getCapability("SetDisplayName");
if (cap_url.empty())
{
// this server does not support display names, report error
slot(false, "unsupported", LLSD());
return;
}
// People API can return localized error messages. Indicate our
// language preference via header.
LLSD headers;
headers["Accept-Language"] = LLUI::getLanguage();
// People API requires both the old and new value to change a variable.
// Our display name will be in cache before the viewer's UI is available
// to request a change, so we can use direct lookup without callback.
LLAvatarName av_name;
if (!LLAvatarNameCache::get( gAgent.getID(), &av_name))
{
slot(false, "name unavailable", LLSD());
return;
}
// People API expects array of [ "old value", "new value" ]
LLSD change_array = LLSD::emptyArray();
change_array.append(av_name.mDisplayName);
change_array.append(display_name);
llinfos << "Set name POST to " << cap_url << llendl;
// Record our caller for when the server sends back a reply
sSetDisplayNameSignal.connect(slot);
// POST the requested change. The sim will not send a response back to
// this request directly, rather it will send a separate message after it
// communicates with the back-end.
LLSD body;
body["display_name"] = change_array;
LLHTTPClient::post(cap_url, body, new LLSetDisplayNameResponder, headers);
}
示例8: initialize
void LLFloaterAuction::initialize()
{
mParcelUpdateCapUrl.clear();
mParcelp = LLViewerParcelMgr::getInstance()->getParcelSelection();
LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
LLParcel* parcelp = mParcelp->getParcel();
if(parcelp && region && !parcelp->getForSale())
{
mParcelHost = region->getHost();
mParcelID = parcelp->getLocalID();
mParcelUpdateCapUrl = region->getCapability("ParcelPropertiesUpdate");
getChild<LLUICtrl>("parcel_text")->setValue(parcelp->getName());
getChildView("snapshot_btn")->setEnabled(TRUE);
getChildView("reset_parcel_btn")->setEnabled(TRUE);
getChildView("start_auction_btn")->setEnabled(TRUE);
U32 estate_id = LLEstateInfoModel::instance().getID();
// Only enable "Sell to Anyone" on Teen grid or if we don't know the ID yet
getChildView("sell_to_anyone_btn")->setEnabled(estate_id == ESTATE_TEEN || estate_id == 0);
}
else
{
mParcelHost.invalidate();
if(parcelp && parcelp->getForSale())
{
getChild<LLUICtrl>("parcel_text")->setValue(getString("already for sale"));
}
else
{
getChild<LLUICtrl>("parcel_text")->setValue(LLStringUtil::null);
}
mParcelID = -1;
getChildView("snapshot_btn")->setEnabled(false);
getChildView("reset_parcel_btn")->setEnabled(false);
getChildView("sell_to_anyone_btn")->setEnabled(false);
getChildView("start_auction_btn")->setEnabled(false);
}
mImageID.setNull();
mImage = NULL;
}
示例9: inviteToSession
BOOL LLIMFloater::inviteToSession(const uuid_vec_t& ids)
{
LLViewerRegion* region = gAgent.getRegion();
if (!region)
{
return FALSE;
}
S32 count = ids.size();
if( isInviteAllowed() && (count > 0) )
{
llinfos << "LLIMFloater::inviteToSession() - inviting participants" << llendl;
std::string url = region->getCapability("ChatSessionRequest");
LLSD data;
data["params"] = LLSD::emptyArray();
for (int i = 0; i < count; i++)
{
data["params"].append(ids[i]);
}
data["method"] = "invite";
data["session-id"] = mSessionID;
LLHTTPClient::post(
url,
data,
new LLSessionInviteResponder(
mSessionID));
}
else
{
llinfos << "LLIMFloater::inviteToSession -"
<< " no need to invite agents for "
<< mDialog << llendl;
// successful add, because everyone that needed to get added
// was added.
}
return TRUE;
}
示例10: fetchAssociatedExperience
void ExperienceAssociationResponder::fetchAssociatedExperience(LLSD& request, callback_t callback)
{
LLViewerObject* object = gObjectList.findObject(request["object-id"]);
if (!object)
{
LL_WARNS() << "Failed to find object with ID " << request["object-id"] << " in fetchAssociatedExperience" << LL_ENDL;
return;
}
LLViewerRegion* region = object->getRegion();
if (region)
{
std::string lookup_url=region->getCapability("GetMetadata");
if(!lookup_url.empty())
{
LLSD fields;
fields.append("experience");
request["fields"] = fields;
LLHTTPClient::post(lookup_url, request, new ExperienceAssociationResponder(callback));
}
}
}
示例11: processGetAllQueue
void LLMaterialMgr::processGetAllQueue()
{
getall_queue_t::iterator loopRegion = mGetAllQueue.begin();
while (mGetAllQueue.end() != loopRegion)
{
getall_queue_t::iterator itRegion = loopRegion++;
const LLUUID& region_id = *itRegion;
LLViewerRegion* regionp = LLWorld::instance().getRegionFromID(region_id);
if (regionp == NULL)
{
LL_WARNS("Materials") << "Unknown region with id " << region_id.asString() << LL_ENDL;
clearGetQueues(region_id); // Invalidates region_id
continue;
}
else if (!regionp->capabilitiesReceived() || regionp->materialsCapThrottled())
{
continue;
}
std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME);
if (capURL.empty())
{
LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME
<< "' is not defined on the current region '" << regionp->getName() << "'" << LL_ENDL;
clearGetQueues(region_id); // Invalidates region_id
continue;
}
LL_DEBUGS("Materials") << "GET all for region " << region_id << "url " << capURL << LL_ENDL;
LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("GET", capURL, boost::bind(&LLMaterialMgr::onGetAllResponse, this, _1, _2, *itRegion));
LLHTTPClient::get(capURL, materialsResponder);
regionp->resetMaterialsCapThrottle();
mGetAllPending.insert(std::pair<LLUUID, F64>(region_id, LLFrameTimer::getTotalSeconds()));
mGetAllQueue.erase(itRegion); // Invalidates region_id
}
}
示例12: doCreatePick
void LLLandmarksPanel::doCreatePick(LLLandmark* landmark)
{
LLViewerRegion* region = gAgent.getRegion();
if (!region) return;
LLGlobalVec pos_global;
LLUUID region_id;
landmark->getGlobalPos(pos_global);
landmark->getRegionID(region_id);
LLVector3 region_pos((F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS),
(F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS),
(F32)pos_global.mdV[VZ]);
LLSD body;
std::string url = region->getCapability("RemoteParcelRequest");
if (!url.empty())
{
body["location"] = ll_sd_from_vector3(region_pos);
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 create pick for landmark for region" << region_id
<< ". Region: " << region->getName()
<< " does not support RemoteParcelRequest" << LL_ENDL;
}
}
示例13: bulkFetch
//.........这里部分代码省略.........
// May already have this folder, but append child folders to list.
if (fetch_info.mRecursive)
{
LLInventoryModel::cat_array_t* categories;
LLInventoryModel::item_array_t* items;
gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
it != categories->end();
++it)
{
mFetchQueue.push_back(FetchQueueInfo((*it)->getUUID(), fetch_info.mRecursive));
}
}
}
if (fetch_info.mRecursive)
recursive_cats.push_back(cat_id);
}
}
else
{
LLViewerInventoryItem* itemp = gInventory.getItem(fetch_info.mUUID);
if (itemp)
{
LLSD item_sd;
item_sd["owner_id"] = itemp->getPermissions().getOwner();
item_sd["item_id"] = itemp->getUUID();
if (itemp->getPermissions().getOwner() == gAgent.getID())
{
if (item_count == max_batch_size ||
(item_count == 0 &&
!(approved_item = AIPerService::approveHTTPRequestFor(mPerServicePtr, cap_inventory))))
{
break;
}
item_request_body.append(item_sd);
++item_count;
}
else
{
if (item_lib_count == max_batch_size ||
(item_lib_count == 0 &&
!(approved_item_lib = AIPerService::approveHTTPRequestFor(mPerServicePtr, cap_inventory))))
{
break;
}
item_request_body_lib.append(item_sd);
++item_lib_count;
}
}
}
mFetchQueue.pop_front();
}
if (item_count + folder_count + item_lib_count + folder_lib_count > 0)
{
if (folder_count)
{
std::string url = region->getCapability("FetchInventoryDescendents2");
llassert(!url.empty());
++mFetchCount;
LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body, recursive_cats);
LLHTTPClient::post_approved(url, folder_request_body, fetcher, approved_folder);
}
if (folder_lib_count)
{
std::string url = gAgent.getRegion()->getCapability("FetchLibDescendents2");
llassert(!url.empty());
++mFetchCount;
LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(folder_request_body_lib, recursive_cats);
LLHTTPClient::post_approved(url, folder_request_body_lib, fetcher, approved_folder_lib);
}
if (item_count)
{
std::string url = region->getCapability("FetchInventory2");
llassert(!url.empty());
++mFetchCount;
LLSD body;
body["agent_id"] = gAgent.getID();
body["items"] = item_request_body;
LLHTTPClient::post_approved(url, body, new LLInventoryModelFetchItemResponder(body), approved_item);
}
if (item_lib_count)
{
std::string url = region->getCapability("FetchLib2");
llassert(!url.empty());
++mFetchCount;
LLSD body;
body["agent_id"] = gAgent.getID();
body["items"] = item_request_body_lib;
LLHTTPClient::post_approved(url, body, new LLInventoryModelFetchItemResponder(body), approved_item_lib);
}
mFetchTimer.reset();
}
else if (isBulkFetchProcessingComplete())
{
llinfos << "Inventory fetch completed" << llendl;
setAllFoldersFetched();
}
}
示例14: title
// Default constructor
LLFloaterAbout::LLFloaterAbout()
: LLFloater(std::string("floater_about"), std::string("FloaterAboutRect"), LLStringUtil::null)
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_about.xml");
// Support for changing product name.
std::string title("About ");
title += LLAppViewer::instance()->getSecondLifeTitle();
setTitle(title);
LLViewerTextEditor *support_widget =
getChild<LLViewerTextEditor>("support_editor", true);
LLViewerTextEditor *credits_widget =
getChild<LLViewerTextEditor>("credits_editor", true);
if (!support_widget || !credits_widget)
{
return;
}
// For some reason, adding style doesn't work unless this is true.
support_widget->setParseHTML(TRUE);
// Text styles for release notes hyperlinks
LLStyleSP viewer_link_style(new LLStyle);
viewer_link_style->setVisible(true);
viewer_link_style->setFontName(LLStringUtil::null);
viewer_link_style->setLinkHREF(get_viewer_release_notes_url());
viewer_link_style->setColor(gSavedSettings.getColor4("HTMLLinkColor"));
// Version string
std::string version = llformat(
"%s %d.%d.%d %s / %s %d.%d.%d (%d), %s %s\n",
IMP_VIEWER_NAME,
IMP_VERSION_MAJOR, IMP_VERSION_MINOR, IMP_VERSION_PATCH, IMP_VERSION_TEST,
LL_VIEWER_NAME,
LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD,
__DATE__, __TIME__);
support_widget->appendColoredText(version, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor"));
support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, viewer_link_style);
std::string support;
support.append("\n\n");
#if LL_MSVC
support.append(llformat("Built with MSVC version %d\n\n", _MSC_VER));
#endif
#if LL_GNUC
support.append(llformat("Built with GCC version %d\n\n", GCC_VERSION));
#endif
// Position
LLViewerRegion* region = gAgent.getRegion();
// [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-04 (RLVa-1.0.0a)
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
{
support.append(rlv_handler_t::cstrHidden);
support.append("\n\n");
}
else if (region)
// [/RLVa:KB]
// if (region)
{
LLStyleSP server_link_style(new LLStyle);
server_link_style->setVisible(true);
server_link_style->setFontName(LLStringUtil::null);
server_link_style->setLinkHREF(region->getCapability("ServerReleaseNotes"));
server_link_style->setColor(gSavedSettings.getColor4("HTMLLinkColor"));
const LLVector3d &pos = gAgent.getPositionGlobal();
LLUIString pos_text = getString("you_are_at");
pos_text.setArg("[POSITION]",
llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ]));
support.append(pos_text);
std::string region_text = llformat("in %s located at ",
gAgent.getRegion()->getName().c_str());
support.append(region_text);
std::string buffer;
buffer = gAgent.getRegion()->getHost().getHostName();
support.append(buffer);
support.append(" (");
buffer = gAgent.getRegion()->getHost().getString();
support.append(buffer);
support.append(")\n");
support.append(gLastVersionChannel);
support.append("\n");
support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor"));
support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, server_link_style);
support = "\n\n";
}
//.........这里部分代码省略.........
示例15: processPutQueue
void LLMaterialMgr::processPutQueue()
{
typedef std::map<LLViewerRegion*, LLSD> regionput_request_map;
regionput_request_map requests;
put_queue_t::iterator loopQueue = mPutQueue.begin();
while (mPutQueue.end() != loopQueue)
{
put_queue_t::iterator itQueue = loopQueue++;
const LLUUID& object_id = itQueue->first;
const LLViewerObject* objectp = gObjectList.findObject(object_id);
if ( !objectp )
{
LL_WARNS("Materials") << "Object is NULL" << LL_ENDL;
mPutQueue.erase(itQueue);
}
else
{
LLViewerRegion* regionp = objectp->getRegion();
if ( !regionp )
{
LL_WARNS("Materials") << "Object region is NULL" << LL_ENDL;
mPutQueue.erase(itQueue);
}
else if ( regionp->capabilitiesReceived() && !regionp->materialsCapThrottled())
{
LLSD& facesData = requests[regionp];
facematerial_map_t& face_map = itQueue->second;
U32 max_entries = regionp->getMaxMaterialsPerTransaction();
facematerial_map_t::iterator itFace = face_map.begin();
while ( (face_map.end() != itFace) && (facesData.size() < (int)max_entries) )
{
LLSD faceData = LLSD::emptyMap();
faceData[MATERIALS_CAP_FACE_FIELD] = static_cast<LLSD::Integer>(itFace->first);
faceData[MATERIALS_CAP_OBJECT_ID_FIELD] = static_cast<LLSD::Integer>(objectp->getLocalID());
if (!itFace->second.isNull())
{
faceData[MATERIALS_CAP_MATERIAL_FIELD] = itFace->second.asLLSD();
}
facesData.append(faceData);
face_map.erase(itFace++);
}
if (face_map.empty())
{
mPutQueue.erase(itQueue);
}
}
}
}
for (regionput_request_map::const_iterator itRequest = requests.begin(); itRequest != requests.end(); ++itRequest)
{
LLViewerRegion* regionp = itRequest->first;
std::string capURL = regionp->getCapability(MATERIALS_CAPABILITY_NAME);
if (capURL.empty())
{
LL_WARNS("Materials") << "Capability '" << MATERIALS_CAPABILITY_NAME
<< "' is not defined on region '" << regionp->getName() << "'" << LL_ENDL;
continue;
}
LLSD materialsData = LLSD::emptyMap();
materialsData[MATERIALS_CAP_FULL_PER_FACE_FIELD] = itRequest->second;
std::string materialString = zip_llsd(materialsData);
S32 materialSize = materialString.size();
if (materialSize > 0)
{
LLSD::Binary materialBinary;
materialBinary.resize(materialSize);
memcpy(materialBinary.data(), materialString.data(), materialSize);
LLSD putData = LLSD::emptyMap();
putData[MATERIALS_CAP_ZIP_FIELD] = materialBinary;
LL_DEBUGS("Materials") << "put for " << itRequest->second.size() << " faces to region " << itRequest->first->getName() << LL_ENDL;
LLHTTPClient::ResponderPtr materialsResponder = new LLMaterialsResponder("PUT", capURL, boost::bind(&LLMaterialMgr::onPutResponse, this, _1, _2));
LLHTTPClient::put(capURL, putData, materialsResponder);
regionp->resetMaterialsCapThrottle();
}
else
{
LL_ERRS("debugMaterials") << "cannot zip LLSD binary content" << LL_ENDL;
}
}
}