LLViewerRegion WIP: Use LLViewerRegion::getCapAPI
Viewer 3 uses this in LLAgent::setStartPosition and copy_inventory_from_notecard; so I brought those up to speed with V3. The viewer now uses LLViewerRegion::getCapAPI in all the same place as V3.
This commit is contained in:
@@ -57,6 +57,7 @@
|
|||||||
#include "llnotificationsutil.h"
|
#include "llnotificationsutil.h"
|
||||||
#include "llparcel.h"
|
#include "llparcel.h"
|
||||||
#include "llrendersphere.h"
|
#include "llrendersphere.h"
|
||||||
|
#include "llsdmessage.h"
|
||||||
#include "llsdutil.h"
|
#include "llsdutil.h"
|
||||||
#include "llsky.h"
|
#include "llsky.h"
|
||||||
#include "llsmoothstep.h"
|
#include "llsmoothstep.h"
|
||||||
@@ -2105,11 +2106,15 @@ LLVector3 ll_vector3_from_sdmap(const LLSD& sd)
|
|||||||
|
|
||||||
void LLAgent::setStartPosition( U32 location_id )
|
void LLAgent::setStartPosition( U32 location_id )
|
||||||
{
|
{
|
||||||
|
LLViewerObject *object;
|
||||||
|
|
||||||
if (gAgentID == LLUUID::null)
|
if (gAgentID == LLUUID::null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (gObjectList.findAvatar(gAgentID) == NULL)
|
// we've got an ID for an agent viewerobject
|
||||||
|
object = gObjectList.findObject(gAgentID);
|
||||||
|
if (! object)
|
||||||
{
|
{
|
||||||
llinfos << "setStartPosition - Can't find agent viewerobject id " << gAgentID << llendl;
|
llinfos << "setStartPosition - Can't find agent viewerobject id " << gAgentID << llendl;
|
||||||
return;
|
return;
|
||||||
@@ -2136,9 +2141,6 @@ void LLAgent::setStartPosition( U32 location_id )
|
|||||||
agent_pos.mV[VZ] = llclamp( agent_pos.mV[VZ],
|
agent_pos.mV[VZ] = llclamp( agent_pos.mV[VZ],
|
||||||
mRegionp->getLandHeightRegion( agent_pos ),
|
mRegionp->getLandHeightRegion( agent_pos ),
|
||||||
LLWorld::getInstance()->getRegionMaxHeight() );
|
LLWorld::getInstance()->getRegionMaxHeight() );
|
||||||
std::string url = gAgent.getRegion()->getCapability("HomeLocation");
|
|
||||||
if( !url.empty() )
|
|
||||||
{
|
|
||||||
// Send the CapReq
|
// Send the CapReq
|
||||||
LLSD request;
|
LLSD request;
|
||||||
LLSD body;
|
LLSD body;
|
||||||
@@ -2150,27 +2152,28 @@ void LLAgent::setStartPosition( U32 location_id )
|
|||||||
|
|
||||||
body["HomeLocation"] = homeLocation;
|
body["HomeLocation"] = homeLocation;
|
||||||
|
|
||||||
LLHTTPClient::post( url, body, new LLHomeLocationResponder() );
|
// This awkward idiom warrants explanation.
|
||||||
}
|
// For starters, LLSDMessage::ResponderAdapter is ONLY for testing the new
|
||||||
else
|
// LLSDMessage functionality with a pre-existing LLHTTPClient::Responder.
|
||||||
{
|
// In new code, define your reply/error methods on the same class as the
|
||||||
LLMessageSystem* msg = gMessageSystem;
|
// sending method, bind them to local LLEventPump objects and pass those
|
||||||
msg->newMessageFast(_PREHASH_SetStartLocationRequest);
|
// LLEventPump names in the request LLSD object.
|
||||||
msg->nextBlockFast( _PREHASH_AgentData);
|
// When testing old code, the new LLHomeLocationResponder object
|
||||||
msg->addUUIDFast(_PREHASH_AgentID, getID());
|
// is referenced by an LLHTTPClient::ResponderPtr, so when the
|
||||||
msg->addUUIDFast(_PREHASH_SessionID, getSessionID());
|
// ResponderAdapter is deleted, the LLHomeLocationResponder will be too.
|
||||||
msg->nextBlockFast( _PREHASH_StartLocationData);
|
// We must trust that the underlying LLHTTPClient code will eventually
|
||||||
// corrected by sim
|
// fire either the reply callback or the error callback; either will cause
|
||||||
msg->addStringFast(_PREHASH_SimName, "");
|
// the ResponderAdapter to delete itself.
|
||||||
msg->addU32Fast(_PREHASH_LocationID, location_id);
|
LLSDMessage::ResponderAdapter*
|
||||||
msg->addVector3Fast(_PREHASH_LocationPos, agent_pos);
|
adapter(new LLSDMessage::ResponderAdapter(new LLHomeLocationResponder()));
|
||||||
msg->addVector3Fast(_PREHASH_LocationLookAt,mFrameAgent.getAtAxis());
|
|
||||||
|
request["message"] = "HomeLocation";
|
||||||
|
request["payload"] = body;
|
||||||
|
request["reply"] = adapter->getReplyName();
|
||||||
|
request["error"] = adapter->getErrorName();
|
||||||
|
|
||||||
|
gAgent.getRegion()->getCapAPI().post(request);
|
||||||
|
|
||||||
// Reliable only helps when setting home location. Last
|
|
||||||
// location is sent on quit, and we don't have time to ack
|
|
||||||
// the packets.
|
|
||||||
msg->sendReliable(mRegionp->getHost());
|
|
||||||
}
|
|
||||||
const U32 HOME_INDEX = 1;
|
const U32 HOME_INDEX = 1;
|
||||||
if( HOME_INDEX == location_id )
|
if( HOME_INDEX == location_id )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -911,7 +911,11 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecard_inv_id, const LLInventoryItem *src, U32 callback_id)
|
void copy_inventory_from_notecard(/* V3: const LLUUID& destination_id, */
|
||||||
|
const LLUUID& object_id,
|
||||||
|
const LLUUID& notecard_inv_id,
|
||||||
|
const LLInventoryItem *src,
|
||||||
|
U32 callback_id)
|
||||||
{
|
{
|
||||||
if (NULL == src)
|
if (NULL == src)
|
||||||
{
|
{
|
||||||
@@ -958,9 +962,13 @@ void copy_inventory_from_notecard(const LLUUID& object_id, const LLUUID& notecar
|
|||||||
body["object-id"] = object_id;
|
body["object-id"] = object_id;
|
||||||
body["item-id"] = src->getUUID();
|
body["item-id"] = src->getUUID();
|
||||||
body["folder-id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(src->getType()));
|
body["folder-id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(src->getType()));
|
||||||
|
// V3: body["folder-id"] = destination_id;
|
||||||
body["callback-id"] = (LLSD::Integer)callback_id;
|
body["callback-id"] = (LLSD::Integer)callback_id;
|
||||||
|
|
||||||
LLHTTPClient::post(url, body, new LLCopyInventoryFromNotecardResponder());
|
request["message"] = "CopyInventoryFromNotecard";
|
||||||
|
request["payload"] = body;
|
||||||
|
|
||||||
|
viewer_region->getCapAPI().post(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user