Merge branch 'master' of github-hazim:HazimGazov/Inertia
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
// <edit>
|
// <edit>
|
||||||
/**
|
/**
|
||||||
* @file llimportobject.cpp
|
* @file llimportobject.cpp
|
||||||
@@ -35,6 +36,7 @@ int LLXmlImport::sPrimIndex = 0;
|
|||||||
int LLXmlImport::sAttachmentsDone = 0;
|
int LLXmlImport::sAttachmentsDone = 0;
|
||||||
std::map<std::string, U32> LLXmlImport::sId2localid;
|
std::map<std::string, U32> LLXmlImport::sId2localid;
|
||||||
std::map<U32, LLVector3> LLXmlImport::sRootpositions;
|
std::map<U32, LLVector3> LLXmlImport::sRootpositions;
|
||||||
|
std::map<U32, LLQuaternion> LLXmlImport::sRootrotations;
|
||||||
LLXmlImportOptions* LLXmlImport::sXmlImportOptions;
|
LLXmlImportOptions* LLXmlImport::sXmlImportOptions;
|
||||||
|
|
||||||
LLXmlImportOptions::LLXmlImportOptions(LLXmlImportOptions* options)
|
LLXmlImportOptions::LLXmlImportOptions(LLXmlImportOptions* options)
|
||||||
@@ -274,20 +276,14 @@ LLImportObject::LLImportObject(std::string id, LLSD prim)
|
|||||||
mPrimName = prim["name"].asString();
|
mPrimName = prim["name"].asString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BuildingSupply::BuildingSupply() : LLEventTimer(0.1f)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL BuildingSupply::tick()
|
void LLXmlImport::rez_supply()
|
||||||
{
|
{
|
||||||
if(LLXmlImport::sImportInProgress && (LLXmlImport::sPrimsNeeded > 0))
|
if(sImportInProgress && sXmlImportOptions && (sPrimsNeeded > 0))
|
||||||
{
|
{
|
||||||
LLXmlImport::sPrimsNeeded--;
|
sPrimsNeeded--;
|
||||||
// Need moar prims
|
// Need moar prims
|
||||||
if(LLXmlImport::sXmlImportOptions->mSupplier == NULL)
|
if(sXmlImportOptions->mSupplier == NULL)
|
||||||
{
|
{
|
||||||
gMessageSystem->newMessageFast(_PREHASH_ObjectAdd);
|
gMessageSystem->newMessageFast(_PREHASH_ObjectAdd);
|
||||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||||
@@ -324,41 +320,31 @@ BOOL BuildingSupply::tick()
|
|||||||
gMessageSystem->addVector3Fast(_PREHASH_RayEnd, rezpos);
|
gMessageSystem->addVector3Fast(_PREHASH_RayEnd, rezpos);
|
||||||
gMessageSystem->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null);
|
gMessageSystem->addUUIDFast(_PREHASH_RayTargetID, LLUUID::null);
|
||||||
gMessageSystem->addU8Fast(_PREHASH_RayEndIsIntersection, 0);
|
gMessageSystem->addU8Fast(_PREHASH_RayEndIsIntersection, 0);
|
||||||
gMessageSystem->addVector3Fast(_PREHASH_Scale, LLXmlImport::sSupplyParams->getScale());
|
gMessageSystem->addVector3Fast(_PREHASH_Scale, sSupplyParams->getScale());
|
||||||
gMessageSystem->addQuatFast(_PREHASH_Rotation, LLQuaternion::DEFAULT);
|
gMessageSystem->addQuatFast(_PREHASH_Rotation, LLQuaternion::DEFAULT);
|
||||||
gMessageSystem->addU8Fast(_PREHASH_State, 0);
|
gMessageSystem->addU8Fast(_PREHASH_State, 0);
|
||||||
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
||||||
}
|
}
|
||||||
else // have supplier
|
else // have supplier
|
||||||
{
|
{
|
||||||
try
|
gMessageSystem->newMessageFast(_PREHASH_ObjectDuplicate);
|
||||||
{
|
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||||
gMessageSystem->newMessageFast(_PREHASH_ObjectDuplicate);
|
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
gMessageSystem->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
|
||||||
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
gMessageSystem->nextBlockFast(_PREHASH_SharedData);
|
||||||
gMessageSystem->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
|
|
||||||
gMessageSystem->nextBlockFast(_PREHASH_SharedData);
|
LLVector3 rezpos = gAgent.getPositionAgent() + LLVector3(0.0f, 0.0f, 2.0f);
|
||||||
|
rezpos -= sSupplyParams->getPositionRegion();
|
||||||
LLVector3 rezpos = gAgent.getPositionAgent() + LLVector3(0.0f, 0.0f, 2.0f);
|
|
||||||
rezpos -= LLXmlImport::sSupplyParams->getPositionRegion();
|
gMessageSystem->addVector3Fast(_PREHASH_Offset, rezpos);
|
||||||
|
gMessageSystem->addU32Fast(_PREHASH_DuplicateFlags, 0);
|
||||||
gMessageSystem->addVector3Fast(_PREHASH_Offset, rezpos);
|
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
||||||
gMessageSystem->addU32Fast(_PREHASH_DuplicateFlags, 0);
|
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, sXmlImportOptions->mSupplier->getLocalID());
|
||||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
||||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, LLXmlImport::sXmlImportOptions->mSupplier->getLocalID());
|
|
||||||
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
|
||||||
}
|
|
||||||
catch(int)
|
|
||||||
{
|
|
||||||
llwarns << "Abort! Abort!" << llendl;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
LLFloaterImportProgress::update();
|
LLFloaterImportProgress::update();
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -502,7 +488,7 @@ void LLXmlImport::import(LLXmlImportOptions* import_options)
|
|||||||
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
||||||
}
|
}
|
||||||
|
|
||||||
new BuildingSupply();
|
rez_supply();
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@@ -530,12 +516,13 @@ void LLXmlImport::onNewPrim(LLViewerObject* object)
|
|||||||
flags = flags & (~FLAGS_USE_PHYSICS);
|
flags = flags & (~FLAGS_USE_PHYSICS);
|
||||||
object->setFlags(flags, TRUE);
|
object->setFlags(flags, TRUE);
|
||||||
object->setFlags(~flags, FALSE); // Can I improve this lol?
|
object->setFlags(~flags, FALSE); // Can I improve this lol?
|
||||||
|
bool root = (from->mParentId == "");
|
||||||
if(from->mParentId == "")
|
if(root)
|
||||||
{
|
{
|
||||||
// this will be a root
|
// this will be a root
|
||||||
sId2localid[from->mId] = object->getLocalID();
|
sId2localid[from->mId] = object->getLocalID();
|
||||||
sRootpositions[object->getLocalID()] = from->getPosition();
|
sRootpositions[object->getLocalID()] = from->getPosition();
|
||||||
|
sRootrotations[object->getLocalID()] = from->getRotation();
|
||||||
// If it's an attachment, set description
|
// If it's an attachment, set description
|
||||||
if(from->importIsAttachment)
|
if(from->importIsAttachment)
|
||||||
{
|
{
|
||||||
@@ -551,40 +538,15 @@ void LLXmlImport::onNewPrim(LLViewerObject* object)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Move it to its root before linking
|
//make positions and rotations offset from the root prim.
|
||||||
U32 parentlocalid = sId2localid[from->mParentId];
|
U32 parentlocalid = sId2localid[from->mParentId];
|
||||||
LLVector3 rootpos = sRootpositions[parentlocalid];
|
from->setPosition((from->getPosition() * sRootrotations[parentlocalid]) + sRootpositions[parentlocalid]);
|
||||||
|
from->setRotation(from->getRotation() * sRootrotations[parentlocalid]);
|
||||||
U8 data[256];
|
|
||||||
S32 offset = 0;
|
|
||||||
gMessageSystem->newMessageFast(_PREHASH_MultipleObjectUpdate);
|
|
||||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
|
||||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
|
||||||
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
|
||||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
|
||||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
|
|
||||||
gMessageSystem->addU8Fast(_PREHASH_Type, 5);
|
|
||||||
htonmemcpy(&data[offset], &(rootpos.mV), MVT_LLVector3, 12);
|
|
||||||
offset += 12;
|
|
||||||
htonmemcpy(&data[offset], &(from->getScale().mV), MVT_LLVector3, 12);
|
|
||||||
offset += 12;
|
|
||||||
gMessageSystem->addBinaryDataFast(_PREHASH_Data, data, offset);
|
|
||||||
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
|
||||||
|
|
||||||
// Link it up
|
|
||||||
gMessageSystem->newMessageFast(_PREHASH_ObjectLink);
|
|
||||||
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
|
||||||
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
|
||||||
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
|
||||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
|
||||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, sId2localid[from->mParentId]);
|
|
||||||
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
|
||||||
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
|
|
||||||
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
|
||||||
}
|
}
|
||||||
// Volume params
|
// Volume params
|
||||||
LLVolumeParams params = from->getVolume()->getParams();
|
LLVolumeParams params = from->getVolume()->getParams();
|
||||||
object->setVolume(params, 0, false);
|
object->setVolume(params, 0, false);
|
||||||
|
object->sendShapeUpdate();
|
||||||
// Extra params
|
// Extra params
|
||||||
if(from->isFlexible())
|
if(from->isFlexible())
|
||||||
{
|
{
|
||||||
@@ -633,8 +595,6 @@ void LLXmlImport::onNewPrim(LLViewerObject* object)
|
|||||||
LLTextureEntry te = *wat;
|
LLTextureEntry te = *wat;
|
||||||
object->setTE(i, te);
|
object->setTE(i, te);
|
||||||
}
|
}
|
||||||
|
|
||||||
object->sendShapeUpdate();
|
|
||||||
object->sendTEUpdate();
|
object->sendTEUpdate();
|
||||||
// Flag update is already coming from somewhere
|
// Flag update is already coming from somewhere
|
||||||
//object->updateFlags();
|
//object->updateFlags();
|
||||||
@@ -690,8 +650,36 @@ void LLXmlImport::onNewPrim(LLViewerObject* object)
|
|||||||
gMessageSystem->addStringFast(_PREHASH_Name, from->mPrimName);
|
gMessageSystem->addStringFast(_PREHASH_Name, from->mPrimName);
|
||||||
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Link
|
||||||
|
if(!root)
|
||||||
|
{
|
||||||
|
gMessageSystem->newMessageFast(_PREHASH_ObjectLink);
|
||||||
|
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
|
||||||
|
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
|
||||||
|
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
|
||||||
|
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
||||||
|
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, sId2localid[from->mParentId]);
|
||||||
|
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
|
||||||
|
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
|
||||||
|
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
||||||
|
}
|
||||||
|
|
||||||
if(currPrimIndex + 1 >= (int)sPrims.size())
|
if(currPrimIndex + 1 >= (int)sPrims.size())
|
||||||
{
|
{
|
||||||
|
// stop the throttle
|
||||||
|
F32 throttle = gSavedSettings.getF32("OutBandwidth");
|
||||||
|
if(throttle != 0.)
|
||||||
|
{
|
||||||
|
gMessageSystem->mPacketRing.setOutBandwidth(throttle);
|
||||||
|
gMessageSystem->mPacketRing.setUseOutThrottle(TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gMessageSystem->mPacketRing.setOutBandwidth(0.0);
|
||||||
|
gMessageSystem->mPacketRing.setUseOutThrottle(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
if(sId2attachpt.size() == 0)
|
if(sId2attachpt.size() == 0)
|
||||||
{
|
{
|
||||||
sImportInProgress = false;
|
sImportInProgress = false;
|
||||||
@@ -732,21 +720,9 @@ void LLXmlImport::onNewPrim(LLViewerObject* object)
|
|||||||
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
gMessageSystem->sendReliable(gAgent.getRegionHost());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 throttle = gSavedSettings.getF32("OutBandwidth");
|
|
||||||
if(throttle != 0.)
|
|
||||||
{
|
|
||||||
gMessageSystem->mPacketRing.setOutBandwidth(throttle);
|
|
||||||
gMessageSystem->mPacketRing.setUseOutThrottle(TRUE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gMessageSystem->mPacketRing.setOutBandwidth(0.0);
|
|
||||||
gMessageSystem->mPacketRing.setUseOutThrottle(FALSE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LLFloaterImportProgress::update();
|
LLFloaterImportProgress::update();
|
||||||
|
rez_supply();
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|||||||
@@ -10,13 +10,6 @@
|
|||||||
#include "llfloater.h"
|
#include "llfloater.h"
|
||||||
|
|
||||||
|
|
||||||
class BuildingSupply : public LLEventTimer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
BuildingSupply();
|
|
||||||
BOOL tick();
|
|
||||||
};
|
|
||||||
|
|
||||||
class LLImportWearable
|
class LLImportWearable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -68,6 +61,7 @@ public:
|
|||||||
static void onNewItem(LLViewerInventoryItem* item);
|
static void onNewItem(LLViewerInventoryItem* item);
|
||||||
static void onNewAttachment(LLViewerObject* object);
|
static void onNewAttachment(LLViewerObject* object);
|
||||||
static void Cancel(void* user_data);
|
static void Cancel(void* user_data);
|
||||||
|
static void rez_supply();
|
||||||
|
|
||||||
static bool sImportInProgress;
|
static bool sImportInProgress;
|
||||||
static bool sImportHasAttachments;
|
static bool sImportHasAttachments;
|
||||||
@@ -83,6 +77,7 @@ public:
|
|||||||
static int sAttachmentsDone;
|
static int sAttachmentsDone;
|
||||||
static std::map<std::string, U32> sId2localid;
|
static std::map<std::string, U32> sId2localid;
|
||||||
static std::map<U32, LLVector3> sRootpositions;
|
static std::map<U32, LLVector3> sRootpositions;
|
||||||
|
static std::map<U32, LLQuaternion> sRootrotations;
|
||||||
static LLXmlImportOptions* sXmlImportOptions;
|
static LLXmlImportOptions* sXmlImportOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user