本文整理汇总了C++中LLAgent::getRegion方法的典型用法代码示例。如果您正苦于以下问题:C++ LLAgent::getRegion方法的具体用法?C++ LLAgent::getRegion怎么用?C++ LLAgent::getRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLAgent
的用法示例。
在下文中一共展示了LLAgent::getRegion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: playAmbient
// <edit>
void LLPreviewSound::playAmbient( void* userdata )
{
LLPreviewSound* self = (LLPreviewSound*) userdata;
const LLInventoryItem *item = self->getItem();
if(item && gAudiop)
{
F32 gain = 0.01f;
for(int i = 0; i < 2; i++)
{
gMessageSystem->newMessageFast(_PREHASH_SoundTrigger);
gMessageSystem->nextBlockFast(_PREHASH_SoundData);
gMessageSystem->addUUIDFast(_PREHASH_SoundID, LLUUID(item->getAssetUUID()));
gMessageSystem->addUUIDFast(_PREHASH_OwnerID, LLUUID::null);
gMessageSystem->addUUIDFast(_PREHASH_ObjectID, LLUUID::null);
gMessageSystem->addUUIDFast(_PREHASH_ParentID, LLUUID::null);
gMessageSystem->addU64Fast(_PREHASH_Handle, gAgent.getRegion()->getHandle());
LLVector3d pos = -from_region_handle(gAgent.getRegion()->getHandle());
gMessageSystem->addVector3Fast(_PREHASH_Position, (LLVector3)pos);
gMessageSystem->addF32Fast(_PREHASH_Gain, gain);
gMessageSystem->sendReliable(gAgent.getRegionHost());
gain = 1.0f;
}
}
}
示例2: send_namedesc
void ImportTracker::send_namedesc(LLSD& prim)
{
if(prim.has("name"))
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectName);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_LocalID, prim["LocalID"].asInteger());
msg->addStringFast(_PREHASH_Name, prim["name"]);
msg->sendReliable(gAgent.getRegion()->getHost());
}
if(prim.has("description"))
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectDescription);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_LocalID, prim["LocalID"].asInteger());
msg->addStringFast(_PREHASH_Description, prim["description"]);
msg->sendReliable(gAgent.getRegion()->getHost());
}
}
示例3: send_namedesc
void ImportTracker::send_namedesc(LLSD& prim)
{
if(prim.has("name"))
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectName);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_LocalID, prim["LocalID"].asInteger());
msg->addStringFast(_PREHASH_Name, prim["name"]);
msg->sendReliable(gAgent.getRegion()->getHost());
}
if(prim.has("description"))
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectDescription);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
LLVector3 scale = prim["scale"];
if((scale.mV[VX] > 10.) || (scale.mV[VY] > 10.) || (scale.mV[VZ] > 10.) )
prim["description"] = llformat("<%d, %d, %d>", (U8)scale.mV[VX], (U8)scale.mV[VY], (U8)scale.mV[VZ]);
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_LocalID, prim["LocalID"].asInteger());
msg->addStringFast(_PREHASH_Description, prim["description"]);
msg->sendReliable(gAgent.getRegion()->getHost());
}
}
示例4: wear
void ImportTracker::wear(LLSD &prim)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectAttach);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addU8Fast(_PREHASH_AttachmentPoint, U8(prim["Attachment"].asInteger()));
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg->addQuatFast(_PREHASH_Rotation, LLQuaternion(0.0f, 0.0f, 0.0f, 1.0f));
msg->sendReliable(gAgent.getRegion()->getHost());
LLVector3 position = prim["attachpos"];
LLSD rot = prim["attachrot"];
LLQuaternion rotq;
rotq.mQ[VX] = (F32)(rot[0].asReal());
rotq.mQ[VY] = (F32)(rot[1].asReal());
rotq.mQ[VZ] = (F32)(rot[2].asReal());
rotq.mQ[VW] = (F32)(rot[3].asReal());
LLVector3 rotation = rotq.packToVector3();
U8 data[256];
LLMessageSystem* msg2 = gMessageSystem;
msg2->newMessageFast(_PREHASH_MultipleObjectUpdate);
msg2->nextBlockFast(_PREHASH_AgentData);
msg2->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg2->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg2->nextBlockFast(_PREHASH_ObjectData);
msg2->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg2->addU8Fast(_PREHASH_Type, U8(0x01 | 0x08));
htonmemcpy(&data[0], &(position.mV), MVT_LLVector3, 12);
msg2->addBinaryDataFast(_PREHASH_Data, data, 12);
msg2->nextBlockFast(_PREHASH_ObjectData);
msg2->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg2->addU8Fast(_PREHASH_Type, U8(0x02 | 0x08));
htonmemcpy(&data[0], &(rotation.mV), MVT_LLQuaternion, 12);
msg2->addBinaryDataFast(_PREHASH_Data, data, 12);
msg2->sendReliable(gAgent.getRegion()->getHost());
llinfos << "POSITIONED, IMPORT COMPLETED" << llendl;
cleanUp();
}
示例5: send_image
void ImportTracker::send_image(LLSD& prim)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectImage);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg->addStringFast(_PREHASH_MediaURL, NULL);
LLPrimitive obj;
LLSD tes = prim["textures"];
obj.setNumTEs(U8(tes.size()));
for (int i = 0; i < tes.size(); i++)
{
LLTextureEntry tex;
tex.fromLLSD(tes[i]);
obj.setTE(U8(i), tex);
}
obj.packTEMessage(gMessageSystem);
msg->sendReliable(gAgent.getRegion()->getHost());
}
示例6: plywood_above_head
void ImportTracker::plywood_above_head()
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectAdd);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU8Fast(_PREHASH_Material, 3);
msg->addU32Fast(_PREHASH_AddFlags, FLAGS_CREATE_SELECTED);
LLVolumeParams volume_params;
volume_params.setType(0x01, 0x10);
volume_params.setBeginAndEndS(0.f, 1.f);
volume_params.setBeginAndEndT(0.f, 1.f);
volume_params.setRatio(1, 1);
volume_params.setShear(0, 0);
LLVolumeMessage::packVolumeParams(&volume_params, msg);
msg->addU8Fast(_PREHASH_PCode, 9);
msg->addVector3Fast(_PREHASH_Scale, LLVector3(0.52345f, 0.52346f, 0.52347f));
LLQuaternion rot;
msg->addQuatFast(_PREHASH_Rotation, rot);
LLViewerRegion *region = gAgent.getRegion();
if (!localids.size())
root = (initialPos + linksetoffset);
msg->addVector3Fast(_PREHASH_RayStart, root);
msg->addVector3Fast(_PREHASH_RayEnd, root);
msg->addU8Fast(_PREHASH_BypassRaycast, (U8)TRUE );
msg->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE );
msg->addU8Fast(_PREHASH_State, (U8)0);
msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null);
msg->sendReliable(region->getHost());
}
示例7: plyWood
void Object::plyWood()
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectAdd);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU8Fast(_PREHASH_Material, 3);
//msg->addU32Fast(_PREHASH_AddFlags, ); // CREATE_SELECTED
LLVolumeParams volume_params;
volume_params.setType(0x01, 0x10);
volume_params.setBeginAndEndS(0.f, 1.f);
volume_params.setBeginAndEndT(0.f, 1.f);
volume_params.setRatio(1, 1);
volume_params.setShear(0, 0);
LLVolumeMessage::packVolumeParams(&volume_params, msg);
msg->addU8Fast(_PREHASH_PCode, 9);
msg->addVector3Fast(_PREHASH_Scale, LLVector3(0.52346f, 0.52347f, 0.52348f));
LLQuaternion rot;
msg->addQuatFast(_PREHASH_Rotation, rot);
LLViewerRegion *region = gAgent.getRegion();
LLVector3 root(0.f,0.f,0.1f);
root+=gAgent.getCameraPositionAgent();
msg->addVector3Fast(_PREHASH_RayStart, root);
msg->addVector3Fast(_PREHASH_RayEnd, root);
msg->addU8Fast(_PREHASH_BypassRaycast, (U8)TRUE );
msg->addU8Fast(_PREHASH_RayEndIsIntersection, (U8)FALSE );
msg->addU8Fast(_PREHASH_State, (U8)0);
msg->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null);
msg->sendReliable(region->getHost());
}
示例8: cs
Object::Object(int pcode,bool viewerside)
{
if(viewerside)
mObject=gObjectList.createObjectViewer((LLPCode)pcode, gAgent.getRegion());
else
{
mObject=NULL;
mWaiting=true;
CB_Args0(plyWood);
while(true)
{
// lock to main
{
FLLua::CriticalSection cs();
if(mReady.notNull())
{
mObject=gObjectList.findObject(mReady);
mWaiting=false;
break;
}
}
FLLua::yield();
}
}
}
示例9: send_shape
void ImportTracker::send_shape(LLSD& prim)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectShape);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
LLVolumeParams params;
params.fromLLSD(prim["volume"]);
LLVolumeMessage::packVolumeParams(¶ms, msg);
msg->sendReliable(gAgent.getRegion()->getHost());
}
示例10: send_vectors
void ImportTracker::send_vectors(LLSD& prim,int counter)
{
LLVector3 position = ((LLVector3)prim["position"] * rootrot) + root;
LLSD rot = prim["rotation"];
LLQuaternion rotq;
rotq.mQ[VX] = (F32)(rot[0].asReal());
rotq.mQ[VY] = (F32)(rot[1].asReal());
rotq.mQ[VZ] = (F32)(rot[2].asReal());
rotq.mQ[VW] = (F32)(rot[3].asReal());
LLVector3 rotation;
if(counter == 1)
rotation = rotq.packToVector3();
else
rotation = (rotq * rootrot).packToVector3();
LLVector3 scale = prim["scale"];
U8 data[256];
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_MultipleObjectUpdate);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg->addU8Fast(_PREHASH_Type, U8(0x01));
htonmemcpy(&data[0], &(position.mV), MVT_LLVector3, 12);
msg->addBinaryDataFast(_PREHASH_Data, data, 12);
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg->addU8Fast(_PREHASH_Type, U8(0x02));
htonmemcpy(&data[0], &(rotation.mV), MVT_LLQuaternion, 12);
msg->addBinaryDataFast(_PREHASH_Data, data, 12);
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg->addU8Fast(_PREHASH_Type, U8(0x04));
htonmemcpy(&data[0], &(scale.mV), MVT_LLVector3, 12);
msg->addBinaryDataFast(_PREHASH_Data, data, 12);
msg->sendReliable(gAgent.getRegion()->getHost());
}
示例11: fire
void fire(const LLUUID &inv_item)
{
S32 file_size;
LLAPRFile infile;
infile.open(data->filename, LL_APR_RB, LLAPRFile::access_t(), &file_size);
if (infile.getFileHandle())
{
//cmdline_printchat("got file handle @ postinv");
LLVFile file(gVFS, data->assetid, data->type, LLVFile::WRITE);
file.setMaxSize(file_size);
const S32 buf_size = 65536;
U8 copy_buf[buf_size];
while ((file_size = infile.read(copy_buf, buf_size)))
{
file.write(copy_buf, file_size);
}
switch(data->type)
{
case LLAssetType::AT_NOTECARD:
//cmdline_printchat("case notecard @ postinv");
{
*//*LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,"");
S32 size = gVFS->getSize(data->assetid, data->type);
U8* buffer = new U8[size];
gVFS->getData(data->assetid, data->type, buffer, 0, size);
edit->setText(LLStringExplicit((char*)buffer));
std::string card;
edit->exportBuffer(card);
cmdline_printchat("Encoded notecard");;
edit->die();
delete buffer;
//buffer = new U8[card.size()];
//size = card.size();
//strcpy((char*)buffer,card.c_str());
file.remove();
LLVFile newfile(gVFS, data->assetid, data->type, LLVFile::APPEND);
newfile.setMaxSize(size);
newfile.write((const U8*)card.c_str(),size);*//*
//FAIL.
std::string agent_url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory");
LLSD body;
body["item_id"] = inv_item;
//cmdline_printchat("posting content as " + data->assetid.asString());
LLHTTPClient::post(agent_url, body,
new JCPostInvUploadResponder(body, data->assetid, data->type,inv_item,data));
}
break;
case LLAssetType::AT_LSL_TEXT:
//cmdline_printchat("case lsltext @ postinv");
{
std::string url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
LLSD body;
body["item_id"] = inv_item;
S32 size = gVFS->getSize(data->assetid, data->type);
U8* buffer = new U8[size];
gVFS->getData(data->assetid, data->type, buffer, 0, size);
std::string script((char*)buffer);
BOOL domono = FALSE;//Phox- this needs to be fixed when the preproc is added = JCLSLPreprocessor::mono_directive(script);
*//*if(script.find("//mono\n") != -1)
{
domono = TRUE;
}else if(script.find("//lsl2\n") != -1)
{
domono = FALSE;
}*//*
delete buffer;
buffer = 0;
body["target"] = (domono == TRUE) ? "mono" : "lsl2";
//cmdline_printchat("posting content as " + data->assetid.asString());
LLHTTPClient::post(url, body, new JCPostInvUploadResponder(body, data->assetid, data->type,inv_item,data));
}
break;
default:
break;
}
示例12: get_update
void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected)
{
switch (state)
{
//lgg crap
case WAND:
if(justCreated && createSelected)
{
numberExpected--;
if(numberExpected<=0)
state=IDLE;
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectImage);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid);
msg->addStringFast(_PREHASH_MediaURL, NULL);
LLPrimitive obj;
obj.setNumTEs(U8(10));
S32 shinnyLevel = 0;
static std::string* shinystr = rebind_llcontrol<std::string>("EmeraldBuildPrefs_Shiny", &gSavedSettings, true);
if(*shinystr == "None") shinnyLevel = 0;
if(*shinystr == "Low") shinnyLevel = 1;
if(*shinystr == "Medium") shinnyLevel = 2;
if(*shinystr == "High") shinnyLevel = 3;
for (int i = 0; i < 10; i++)
{
static std::string* buildpreftex = rebind_llcontrol<std::string>("EmeraldBuildPrefs_Texture", &gSavedSettings, true);
LLTextureEntry tex = LLTextureEntry(LLUUID(*buildpreftex));
tex.setColor(gSavedSettings.getColor4("EmeraldBuildPrefs_Color"));
tex.setAlpha(1.0 - ((gSavedSettings.getF32("EmeraldBuildPrefs_Alpha")) / 100.0));
tex.setGlow(gSavedSettings.getF32("EmeraldBuildPrefs_Glow"));
if(gSavedSettings.getBOOL("EmeraldBuildPrefs_FullBright"))
{
tex.setFullbright(TEM_FULLBRIGHT_MASK);
}
tex.setShiny((U8) shinnyLevel & TEM_SHINY_MASK);
obj.setTE(U8(i), tex);
}
obj.packTEMessage(gMessageSystem);
msg->sendReliable(gAgent.getRegion()->getHost());
msg->newMessage("ObjectFlagUpdate");
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid );
msg->addBOOLFast(_PREHASH_UsePhysics, gSavedSettings.getBOOL("EmeraldBuildPrefs_Physical"));
msg->addBOOL("IsTemporary", gSavedSettings.getBOOL("EmeraldBuildPrefs_Temporary"));
msg->addBOOL("IsPhantom", gSavedSettings.getBOOL("EmeraldBuildPrefs_Phantom") );
msg->addBOOL("CastsShadows", true );
msg->sendReliable(gAgent.getRegion()->getHost());
if(gSavedSettings.getBOOL("EmeraldBuildPrefs_EmbedItem"))
{
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem((LLUUID)gSavedSettings.getString("EmeraldBuildPrefs_Item"));
LLViewerObject* objectp = find((U32)newid);
if(objectp)
if(item)
{
if(item->getType()==LLAssetType::AT_LSL_TEXT)
{
LLToolDragAndDrop::dropScript(objectp,
item,
TRUE,
LLToolDragAndDrop::SOURCE_AGENT,
gAgent.getID());
}else
{
LLToolDragAndDrop::dropInventory(objectp,item,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID());
}
}
}
//llinfos << "LGG SENDING CUBE TEXTURE.." << llendl;
}
break;
case BUILDING:
if (justCreated && (int)localids.size() < linkset.size())
{
localids.push_back(newid);
localids.sort();
localids.unique();
linkset[localids.size() -1]["LocalID"] = newid;
LLSD prim = linkset[localids.size() -1];
//MAKERIGHT
if (!(prim).has("Updated"))
{
//.........这里部分代码省略.........
示例13: get_update
void ImportTracker::get_update(S32 newid, BOOL justCreated, BOOL createSelected)
{
switch (state)
{
//lgg crap to change remaining prim parameters from the ascent system build preferences subtab
case WAND:
if(justCreated && createSelected)
{
numberExpected--;
if(numberExpected<=0)
state=IDLE;
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectImage);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid);
msg->addStringFast(_PREHASH_MediaURL, NULL);
//sets texture stuff
LLPrimitive obj;
obj.setNumTEs(U8(10));
S32 shinnyLevel = 0;
static LLCachedControl<std::string> sshinystr(gSavedSettings, "EmeraldBuildPrefs_Shiny");
std::string shinystr = sshinystr;
//if(shinystr == "None") shinnyLevel = 0; //We're already 0.
if(shinystr == "Low") shinnyLevel = 1;
else if(shinystr == "Medium") shinnyLevel = 2;
else if(shinystr == "High") shinnyLevel = 3;
for (int i = 0; i < 10; i++)
{
LLTextureEntry tex = LLTextureEntry(LLUUID(gSavedSettings.getString("EmeraldBuildPrefs_Texture")));
tex.setColor(gSavedSettings.getColor4("EmeraldBuildPrefs_Color"));
tex.setAlpha(1.0 - ((gSavedSettings.getF32("EmeraldBuildPrefs_Alpha")) / 100.0));
tex.setGlow(gSavedSettings.getF32("EmeraldBuildPrefs_Glow"));
if(gSavedSettings.getBOOL("EmeraldBuildPrefs_FullBright"))
{
tex.setFullbright(TEM_FULLBRIGHT_MASK);
}
tex.setShiny((U8) shinnyLevel & TEM_SHINY_MASK);
obj.setTE(U8(i), tex);
}
obj.packTEMessage(gMessageSystem);
msg->sendReliable(gAgent.getRegion()->getHost());
//sets some object parameters
msg->newMessage("ObjectFlagUpdate");
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid );
msg->addBOOLFast(_PREHASH_UsePhysics, gSavedSettings.getBOOL("EmeraldBuildPrefs_Physical"));
msg->addBOOLFast(_PREHASH_IsTemporary, gSavedSettings.getBOOL("EmeraldBuildPrefs_Temporary"));
msg->addBOOLFast(_PREHASH_IsPhantom, gSavedSettings.getBOOL("EmeraldBuildPrefs_Phantom") );
msg->addBOOL("CastsShadows", false );
msg->sendReliable(gAgent.getRegion()->getHost());
if(gSavedSettings.getBOOL("EmeraldBuildPrefs_EmbedItem"))
{
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem((LLUUID)gSavedPerAccountSettings.getString("EmeraldBuildPrefs_Item"));
LLViewerObject* objectp = find((U32)newid);
if(objectp)
if(item)
{
if(item->getType()==LLAssetType::AT_LSL_TEXT)
{
LLToolDragAndDrop::dropScript(objectp,
item,
TRUE,
LLToolDragAndDrop::SOURCE_AGENT,
gAgent.getID());
}else
{
LLToolDragAndDrop::dropInventory(objectp,item,LLToolDragAndDrop::SOURCE_AGENT,gAgent.getID());
}
}
}
msg->newMessageFast(_PREHASH_ObjectPermissions);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_HeaderData);
msg->addBOOLFast(_PREHASH_Override, FALSE);
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, (U32)newid);
msg->addU8Fast(_PREHASH_Field, PERM_NEXT_OWNER);
msg->addU8Fast(_PREHASH_Set, PERM_SET_TRUE);
U32 flags = 0;
if ( gSavedSettings.getBOOL("NextOwnerCopy") )
{
flags |= PERM_COPY;
}
if ( gSavedSettings.getBOOL("NextOwnerModify") )
{
flags |= PERM_MODIFY;
//.........这里部分代码省略.........
示例14: link
void ImportTracker::link()
{
if(linkset.size() == 256)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectLink);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
LLSD::array_iterator prim = linkset.beginArray();
++prim;
for (; prim != linkset.endArray(); ++prim)
{
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, (*prim)["LocalID"].asInteger());
}
msg->sendReliable(gAgent.getRegion()->getHost());
LLMessageSystem* msg2 = gMessageSystem;
msg2->newMessageFast(_PREHASH_ObjectLink);
msg2->nextBlockFast(_PREHASH_AgentData);
msg2->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg2->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
LLSD prim2 = linkset[0];
msg2->nextBlockFast(_PREHASH_ObjectData);
msg2->addU32Fast(_PREHASH_ObjectLocalID, (prim2)["LocalID"].asInteger());
prim2 = linkset[1];
msg2->nextBlockFast(_PREHASH_ObjectData);
msg2->addU32Fast(_PREHASH_ObjectLocalID, (prim2)["LocalID"].asInteger());
msg2->sendReliable(gAgent.getRegion()->getHost());
}
else
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectLink);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
for (LLSD::array_iterator prim = linkset.beginArray(); prim != linkset.endArray(); ++prim)
{
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, (*prim)["LocalID"].asInteger());
}
msg->sendReliable(gAgent.getRegion()->getHost());
}
llinfos << "FINISHED IMPORT" << llendl;
if (linkset[0].has("Attachment"))
{
llinfos << "OBJECT IS ATTACHMENT, WAITING FOR POSITION PACKETS.." << llendl;
state = POSITIONING;
wear(linkset[0]);
}
else
cleanUp();
}
示例15: send_inventory
void ImportTracker::send_inventory(LLSD& prim)
{
U32 local_id = prim["LocalID"].asInteger();
if (prim.has("inventory"))
{
std::string assetpre = asset_dir + gDirUtilp->getDirDelimiter();
LLSD inventory = prim["inventory"];
for (LLSD::array_iterator inv = inventory.beginArray(); inv != inventory.endArray(); ++inv)
{
LLSD item = (*inv);
InventoryImportInfo* data = new InventoryImportInfo;
data->localid = local_id;
LLTransactionID tid;
tid.generate();
LLUUID assetid = tid.makeAssetID(gAgent.getSecureSessionID());
data->tid = tid;
data->assetid = assetid;
data->type = LLAssetType::lookup(item["type"].asString());////LLAssetType::EType(U32(item["type"].asInteger()));
data->name = item["name"].asString();
data->description = item["desc"].asString();
if(item.has("item_id"))
{
//cmdline_printchat("item id found");
std::string filename = assetpre + item["item_id"].asString() + "." + item["type"].asString();
//S32 file_size;
//LLAPRFile infile ;
//infile.open(filename, LL_APR_RB, NULL, &file_size);
//apr_file_t* fp = infile.getFileHandle();
//if(fp)
if(LLFile::isfile(filename))
{
//cmdline_printchat("file "+filename+" exists");
data->filename = filename;
//infile.close();
}else
{
//cmdline_printchat("file "+filename+" does not exist");
delete data;
continue;
}
}else
{
//cmdline_printchat("item id not found");
delete data;
continue;
}
data->wear_type = NOT_WEARABLE;
//if(data->type == LLAssetType::AT_LSL_TEXT)
{
data->inv_type = LLInventoryType::defaultForAssetType(data->type);
//printchat("is script");
data->compiled = false;
//
switch(data->type)
{
case LLAssetType::AT_TEXTURE:
case LLAssetType::AT_TEXTURE_TGA:
//cmdline_printchat("case textures");
{
std::string url = gAgent.getRegion()->getCapability("NewFileAgentInventory");
S32 file_size;
LLAPRFile infile ;
infile.open(data->filename, LL_APR_RB, NULL, &file_size);
if (infile.getFileHandle())
{
//cmdline_printchat("got file handle");
LLVFile file(gVFS, data->assetid, data->type, LLVFile::WRITE);
file.setMaxSize(file_size);
const S32 buf_size = 65536;
U8 copy_buf[buf_size];
while ((file_size = infile.read(copy_buf, buf_size)))
{
file.write(copy_buf, file_size);
}
LLSD body;
body["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
body["asset_type"] = LLAssetType::lookup(data->type);
body["inventory_type"] = LLInventoryType::lookup(data->inv_type);
body["name"] = data->name;
body["description"] = data->description;
body["next_owner_mask"] = LLSD::Integer(U32_MAX);
body["group_mask"] = LLSD::Integer(U32_MAX);
body["everyone_mask"] = LLSD::Integer(U32_MAX);
body["expected_upload_cost"] = LLSD::Integer(LLGlobalEconomy::Singleton::getInstance()->getPriceUpload());
//cmdline_printchat("posting "+ data->assetid.asString());
LLHTTPClient::post(url, body, new JCImportInventoryResponder(body, data->assetid, data->type,data));
//error = TRUE;
}
}
break;
case LLAssetType::AT_CLOTHING:
case LLAssetType::AT_BODYPART:
//cmdline_printchat("case cloth/bodypart");
{
S32 file_size;
LLAPRFile infile ;
infile.open(data->filename, LL_APR_RB, NULL, &file_size);
if (infile.getFileHandle())
//.........这里部分代码省略.........