diff options
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rwxr-xr-x | indra/newview/llviewerobject.cpp | 522 |
1 files changed, 379 insertions, 143 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e62998db70..1dabe07942 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -29,7 +29,6 @@ #include "llviewerobject.h" #include "llaudioengine.h" -#include "imageids.h" #include "indra_constants.h" #include "llmath.h" #include "llflexibleobject.h" @@ -39,6 +38,7 @@ #include "llfloaterreg.h" #include "llfontgl.h" #include "llframetimer.h" +#include "llhudicon.h" #include "llinventory.h" #include "llinventorydefines.h" #include "llmaterialtable.h" @@ -52,7 +52,6 @@ #include "llxfermanager.h" #include "message.h" #include "object_flags.h" -#include "timing.h" #include "llaudiosourcevo.h" #include "llagent.h" @@ -100,6 +99,7 @@ #include "lltrans.h" #include "llsdutil.h" #include "llmediaentry.h" +#include "llvocache.h" //#define DEBUG_UPDATE_TYPE @@ -112,21 +112,33 @@ BOOL LLViewerObject::sMapDebug = TRUE; LLColor4 LLViewerObject::sEditSelectColor( 1.0f, 1.f, 0.f, 0.3f); // Edit OK LLColor4 LLViewerObject::sNoEditSelectColor( 1.0f, 0.f, 0.f, 0.3f); // Can't edit S32 LLViewerObject::sAxisArrowLength(50); + + BOOL LLViewerObject::sPulseEnabled(FALSE); BOOL LLViewerObject::sUseSharedDrawables(FALSE); // TRUE // sMaxUpdateInterpolationTime must be greater than sPhaseOutUpdateInterpolationTime -F64 LLViewerObject::sMaxUpdateInterpolationTime = 3.0; // For motion interpolation: after X seconds with no updates, don't predict object motion -F64 LLViewerObject::sPhaseOutUpdateInterpolationTime = 2.0; // For motion interpolation: after Y seconds with no updates, taper off motion prediction +F64Seconds LLViewerObject::sMaxUpdateInterpolationTime(3.0); // For motion interpolation: after X seconds with no updates, don't predict object motion +F64Seconds LLViewerObject::sPhaseOutUpdateInterpolationTime(2.0); // For motion interpolation: after Y seconds with no updates, taper off motion prediction + +std::map<std::string, U32> LLViewerObject::sObjectDataMap; + +// The maximum size of an object extra parameters binary (packed) block +#define MAX_OBJECT_PARAMS_SIZE 1024 +// At 45 Hz collisions seem stable and objects seem +// to settle down at a reasonable rate. +// JC 3/18/2003 -static LLFastTimer::DeclareTimer FTM_CREATE_OBJECT("Create Object"); +const F32 PHYSICS_TIMESTEP = 1.f / 45.f; + +static LLTrace::BlockTimerStatHandle FTM_CREATE_OBJECT("Create Object"); // static LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) { LLViewerObject *res = NULL; - LLFastTimer t1(FTM_CREATE_OBJECT); + LL_RECORD_BLOCK_TIME(FTM_CREATE_OBJECT); switch (pcode) { @@ -161,13 +173,13 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco case LL_PCODE_LEGACY_GRASS: res = new LLVOGrass(id, pcode, regionp); break; case LL_PCODE_LEGACY_PART_SYS: -// llwarns << "Creating old part sys!" << llendl; +// LL_WARNS() << "Creating old part sys!" << LL_ENDL; // res = new LLVOPart(id, pcode, regionp); break; res = NULL; break; case LL_PCODE_LEGACY_TREE: res = new LLVOTree(id, pcode, regionp); break; case LL_PCODE_TREE_NEW: -// llwarns << "Creating new tree!" << llendl; +// LL_WARNS() << "Creating new tree!" << LL_ENDL; // res = new LLVOTree(id, pcode, regionp); break; res = NULL; break; case LL_VO_SURFACE_PATCH: @@ -187,14 +199,15 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco case LL_VO_WL_SKY: res = new LLVOWLSky(id, pcode, regionp); break; default: - llwarns << "Unknown object pcode " << (S32)pcode << llendl; + LL_WARNS() << "Unknown object pcode " << (S32)pcode << LL_ENDL; res = NULL; break; } return res; } LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, BOOL is_global) -: LLPrimitive(), +: LLTrace::MemTrackable<LLViewerObject>("LLViewerObject"), + LLPrimitive(), mChildList(), mID(id), mLocalID(0), @@ -340,7 +353,7 @@ void LLViewerObject::markDead() { if (!mDead) { - //llinfos << "Marking self " << mLocalID << " as dead." << llendl; + //LL_INFOS() << "Marking self " << mLocalID << " as dead." << LL_ENDL; // Root object of this hierarchy unlinks itself. if (getParent()) @@ -350,6 +363,10 @@ void LLViewerObject::markDead() // Mark itself as dead mDead = TRUE; + if(mRegionp) + { + mRegionp->removeFromCreatedList(getLocalID()); + } gObjectList.cleanupReferences(this); LLViewerObject *childp; @@ -358,7 +375,7 @@ void LLViewerObject::markDead() childp = mChildList.back(); if (childp->getPCode() != LL_PCODE_LEGACY_AVATAR) { - //llinfos << "Marking child " << childp->getLocalID() << " as dead." << llendl; + //LL_INFOS() << "Marking child " << childp->getLocalID() << " as dead." << LL_ENDL; childp->setParent(NULL); // LLViewerObject::markDead 1 childp->markDead(); } @@ -428,17 +445,17 @@ void LLViewerObject::markDead() void LLViewerObject::dump() const { - llinfos << "Type: " << pCodeToString(mPrimitiveCode) << llendl; - llinfos << "Drawable: " << (LLDrawable *)mDrawable << llendl; - llinfos << "Update Age: " << LLFrameTimer::getElapsedSeconds() - mLastMessageUpdateSecs << llendl; - - llinfos << "Parent: " << getParent() << llendl; - llinfos << "ID: " << mID << llendl; - llinfos << "LocalID: " << mLocalID << llendl; - llinfos << "PositionRegion: " << getPositionRegion() << llendl; - llinfos << "PositionAgent: " << getPositionAgent() << llendl; - llinfos << "PositionGlobal: " << getPositionGlobal() << llendl; - llinfos << "Velocity: " << getVelocity() << llendl; + LL_INFOS() << "Type: " << pCodeToString(mPrimitiveCode) << LL_ENDL; + LL_INFOS() << "Drawable: " << (LLDrawable *)mDrawable << LL_ENDL; + LL_INFOS() << "Update Age: " << LLFrameTimer::getElapsedSeconds() - mLastMessageUpdateSecs << LL_ENDL; + + LL_INFOS() << "Parent: " << getParent() << LL_ENDL; + LL_INFOS() << "ID: " << mID << LL_ENDL; + LL_INFOS() << "LocalID: " << mLocalID << LL_ENDL; + LL_INFOS() << "PositionRegion: " << getPositionRegion() << LL_ENDL; + LL_INFOS() << "PositionAgent: " << getPositionAgent() << LL_ENDL; + LL_INFOS() << "PositionGlobal: " << getPositionGlobal() << LL_ENDL; + LL_INFOS() << "Velocity: " << getVelocity() << LL_ENDL; if (mDrawable.notNull() && mDrawable->getNumFaces() && mDrawable->getFace(0)) @@ -446,31 +463,31 @@ void LLViewerObject::dump() const LLFacePool *poolp = mDrawable->getFace(0)->getPool(); if (poolp) { - llinfos << "Pool: " << poolp << llendl; - llinfos << "Pool reference count: " << poolp->mReferences.size() << llendl; + LL_INFOS() << "Pool: " << poolp << LL_ENDL; + LL_INFOS() << "Pool reference count: " << poolp->mReferences.size() << LL_ENDL; } } - //llinfos << "BoxTree Min: " << mDrawable->getBox()->getMin() << llendl; - //llinfos << "BoxTree Max: " << mDrawable->getBox()->getMin() << llendl; + //LL_INFOS() << "BoxTree Min: " << mDrawable->getBox()->getMin() << LL_ENDL; + //LL_INFOS() << "BoxTree Max: " << mDrawable->getBox()->getMin() << LL_ENDL; /* - llinfos << "Velocity: " << getVelocity() << llendl; - llinfos << "AnyOwner: " << permAnyOwner() << " YouOwner: " << permYouOwner() << " Edit: " << mPermEdit << llendl; - llinfos << "UsePhysics: " << flagUsePhysics() << " CanSelect " << mbCanSelect << " UserSelected " << mUserSelected << llendl; - llinfos << "AppAngle: " << mAppAngle << llendl; - llinfos << "PixelArea: " << mPixelArea << llendl; + LL_INFOS() << "Velocity: " << getVelocity() << LL_ENDL; + LL_INFOS() << "AnyOwner: " << permAnyOwner() << " YouOwner: " << permYouOwner() << " Edit: " << mPermEdit << LL_ENDL; + LL_INFOS() << "UsePhysics: " << flagUsePhysics() << " CanSelect " << mbCanSelect << " UserSelected " << mUserSelected << LL_ENDL; + LL_INFOS() << "AppAngle: " << mAppAngle << LL_ENDL; + LL_INFOS() << "PixelArea: " << mPixelArea << LL_ENDL; char buffer[1000]; char *key; for (key = mNameValuePairs.getFirstKey(); key; key = mNameValuePairs.getNextKey() ) { mNameValuePairs[key]->printNameValue(buffer); - llinfos << buffer << llendl; + LL_INFOS() << buffer << LL_ENDL; } for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) { LLViewerObject* child = *iter; - llinfos << " child " << child->getID() << llendl; + LL_INFOS() << " child " << child->getID() << LL_ENDL; } */ } @@ -481,7 +498,7 @@ void LLViewerObject::printNameValuePairs() const iter != mNameValuePairs.end(); iter++) { LLNameValue* nv = iter->second; - llinfos << nv->printNameValue() << llendl; + LL_INFOS() << nv->printNameValue() << LL_ENDL; } } @@ -490,10 +507,12 @@ void LLViewerObject::initVOClasses() // Initialized shared class stuff first. LLVOAvatar::initClass(); LLVOTree::initClass(); - llinfos << "Viewer Object size: " << sizeof(LLViewerObject) << llendl; + LL_INFOS() << "Viewer Object size: " << sizeof(LLViewerObject) << LL_ENDL; LLVOGrass::initClass(); LLVOWater::initClass(); LLVOVolume::initClass(); + + initObjectDataMap(); } void LLViewerObject::cleanupVOClasses() @@ -503,6 +522,118 @@ void LLViewerObject::cleanupVOClasses() LLVOTree::cleanupClass(); LLVOAvatar::cleanupClass(); LLVOVolume::cleanupClass(); + + sObjectDataMap.clear(); +} + +//object data map for compressed && !OUT_TERSE_IMPROVED +//static +void LLViewerObject::initObjectDataMap() +{ + U32 count = 0; + + sObjectDataMap["ID"] = count; //full id //LLUUID + count += sizeof(LLUUID); + + sObjectDataMap["LocalID"] = count; //U32 + count += sizeof(U32); + + sObjectDataMap["PCode"] = count; //U8 + count += sizeof(U8); + + sObjectDataMap["State"] = count; //U8 + count += sizeof(U8); + + sObjectDataMap["CRC"] = count; //U32 + count += sizeof(U32); + + sObjectDataMap["Material"] = count; //U8 + count += sizeof(U8); + + sObjectDataMap["ClickAction"] = count; //U8 + count += sizeof(U8); + + sObjectDataMap["Scale"] = count; //LLVector3 + count += sizeof(LLVector3); + + sObjectDataMap["Pos"] = count; //LLVector3 + count += sizeof(LLVector3); + + sObjectDataMap["Rot"] = count; //LLVector3 + count += sizeof(LLVector3); + + sObjectDataMap["SpecialCode"] = count; //U32 + count += sizeof(U32); + + sObjectDataMap["Owner"] = count; //LLUUID + count += sizeof(LLUUID); + + sObjectDataMap["Omega"] = count; //LLVector3, when SpecialCode & 0x80 is set + count += sizeof(LLVector3); + + //ParentID is after Omega if there is Omega, otherwise is after Owner + sObjectDataMap["ParentID"] = count;//U32, when SpecialCode & 0x20 is set + count += sizeof(U32); + + //------- + //The rest items are not included here + //------- +} + +//static +void LLViewerObject::unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value, std::string name) +{ + dp->shift(sObjectDataMap[name]); + dp->unpackVector3(value, name.c_str()); + dp->reset(); +} + +//static +void LLViewerObject::unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value, std::string name) +{ + dp->shift(sObjectDataMap[name]); + dp->unpackUUID(value, name.c_str()); + dp->reset(); +} + +//static +void LLViewerObject::unpackU32(LLDataPackerBinaryBuffer* dp, U32& value, std::string name) +{ + dp->shift(sObjectDataMap[name]); + dp->unpackU32(value, name.c_str()); + dp->reset(); +} + +//static +void LLViewerObject::unpackU8(LLDataPackerBinaryBuffer* dp, U8& value, std::string name) +{ + dp->shift(sObjectDataMap[name]); + dp->unpackU8(value, name.c_str()); + dp->reset(); +} + +//static +U32 LLViewerObject::unpackParentID(LLDataPackerBinaryBuffer* dp, U32& parent_id) +{ + dp->shift(sObjectDataMap["SpecialCode"]); + U32 value; + dp->unpackU32(value, "SpecialCode"); + + parent_id = 0; + if(value & 0x20) + { + S32 offset = sObjectDataMap["ParentID"]; + if(!(value & 0x80)) + { + offset -= sizeof(LLVector3); + } + + dp->shift(offset); + dp->unpackU32(parent_id, "ParentID"); + } + dp->reset(); + + return parent_id; } // Replaces all name value pairs with data from \n delimited list @@ -613,7 +744,7 @@ void LLViewerObject::buildReturnablesForChildrenVO( std::vector<PotentialReturna { if ( !pChild ) { - llerrs<<"child viewerobject is NULL "<<llendl; + LL_ERRS()<<"child viewerobject is NULL "<<LL_ENDL; } constructAndAddReturnable( returnables, pChild, pTargetRegion ); @@ -894,26 +1025,47 @@ U32 LLViewerObject::checkMediaURL(const std::string &media_url) return retval; } +//extract spatial information from object update message +//return parent_id +//static +U32 LLViewerObject::extractSpatialExtents(LLDataPackerBinaryBuffer *dp, LLVector3& pos, LLVector3& scale, LLQuaternion& rot) +{ + U32 parent_id = 0; + LLViewerObject::unpackParentID(dp, parent_id); + + LLViewerObject::unpackVector3(dp, scale, "Scale"); + LLViewerObject::unpackVector3(dp, pos, "Pos"); + + LLVector3 vec; + LLViewerObject::unpackVector3(dp, vec, "Rot"); + rot.unpackFromVector3(vec); + + return parent_id; +} + U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, void **user_data, U32 block_num, const EObjectUpdateType update_type, LLDataPacker *dp) { + LL_DEBUGS_ONCE("SceneLoadTiming") << "Received viewer object data" << LL_ENDL; + U32 retval = 0x0; // If region is removed from the list it is also deleted. if (!LLWorld::instance().isRegionListed(mRegionp)) { - llwarns << "Updating object in an invalid region" << llendl; + LL_WARNS() << "Updating object in an invalid region" << LL_ENDL; return retval; } // Coordinates of objects on simulators are region-local. - U64 region_handle; - mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); + U64 region_handle = 0; + if(mesgsys != NULL) { + mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle); if(regionp != mRegionp && regionp && mRegionp)//region cross { @@ -926,6 +1078,17 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } else { + if(regionp != mRegionp) + { + if(mRegionp) + { + mRegionp->removeFromCreatedList(getLocalID()); + } + if(regionp) + { + regionp->addToCreatedList(getLocalID()); + } + } mRegionp = regionp ; } } @@ -935,14 +1098,18 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U32 x, y; from_region_handle(region_handle, &x, &y); - llerrs << "Object has invalid region " << x << ":" << y << "!" << llendl; + LL_ERRS() << "Object has invalid region " << x << ":" << y << "!" << LL_ENDL; return retval; } + F32 time_dilation = 1.f; + if(mesgsys != NULL) + { U16 time_dilation16; mesgsys->getU16Fast(_PREHASH_RegionData, _PREHASH_TimeDilation, time_dilation16); - F32 time_dilation = ((F32) time_dilation16) / 65535.f; + time_dilation = ((F32) time_dilation16) / 65535.f; mRegionp->setTimeDilation(time_dilation); + } // this will be used to determine if we've really changed position // Use getPosition, not getPositionRegion, since this is what we're comparing directly against. @@ -990,7 +1157,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, case OUT_FULL: { #ifdef DEBUG_UPDATE_TYPE - llinfos << "Full:" << getID() << llendl; + LL_INFOS() << "Full:" << getID() << LL_ENDL; #endif //clear cost and linkset cost mCostStale = true; @@ -1296,7 +1463,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, S32 param_size; dp.unpackU16(param_type, "param_type"); dp.unpackBinaryData(param_block, param_size, "param_data"); - //llinfos << "Param type: " << param_type << ", Size: " << param_size << llendl; + //LL_INFOS() << "Param type: " << param_type << ", Size: " << param_size << LL_ENDL; LLDataPackerBinaryBuffer dp2(param_block, param_size); unpackParameterEntry(param_type, &dp2); } @@ -1318,7 +1485,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, case OUT_TERSE_IMPROVED: { #ifdef DEBUG_UPDATE_TYPE - llinfos << "TI:" << getID() << llendl; + LL_INFOS() << "TI:" << getID() << LL_ENDL; #endif length = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ObjectData); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ObjectData, data, length, block_num); @@ -1495,7 +1662,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, case OUT_TERSE_IMPROVED: { #ifdef DEBUG_UPDATE_TYPE - llinfos << "CompTI:" << getID() << llendl; + LL_INFOS() << "CompTI:" << getID() << LL_ENDL; #endif U8 value; dp->unpackU8(value, "agent"); @@ -1541,7 +1708,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, case OUT_FULL_CACHED: { #ifdef DEBUG_UPDATE_TYPE - llinfos << "CompFull:" << getID() << llendl; + LL_INFOS() << "CompFull:" << getID() << LL_ENDL; #endif mCostStale = true; @@ -1679,7 +1846,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, S32 param_size; dp->unpackU16(param_type, "param_type"); dp->unpackBinaryData(param_block, param_size, "param_data"); - //llinfos << "Param type: " << param_type << ", Size: " << param_size << llendl; + //LL_INFOS() << "Param type: " << param_type << ", Size: " << param_size << LL_ENDL; LLDataPackerBinaryBuffer dp2(param_block, param_size); unpackParameterEntry(param_type, &dp2); } @@ -1717,13 +1884,12 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Preload these five flags for every object. // Finer shades require the object to be selected, and the selection manager // stores the extended permission info. + if(mesgsys != NULL) + { U32 flags; mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, block_num); - // keep local flags and overwrite remote-controlled flags - mFlags = (mFlags & FLAGS_LOCAL) | flags; - - // ...new objects that should come in selected need to be added to the selected list - mCreateSelected = ((flags & FLAGS_CREATE_SELECTED) != 0); + loadFlags(flags); + } } break; @@ -1751,10 +1917,21 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, { // No parent now, new parent in message -> attach to that parent if possible LLUUID parent_uuid; + + if(mesgsys != NULL) + { LLViewerObjectList::getUUIDFromLocal(parent_uuid, parent_id, mesgsys->getSenderIP(), mesgsys->getSenderPort()); + } + else + { + LLViewerObjectList::getUUIDFromLocal(parent_uuid, + parent_id, + mRegionp->getHost().getAddress(), + mRegionp->getHost().getPort()); + } LLViewerObject *sent_parentp = gObjectList.findObject(parent_uuid); @@ -1764,7 +1941,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (sent_parentp && sent_parentp->getParent() == this) { // Try to recover if we attempt to attach a parent to its child - llwarns << "Attempt to attach a parent to it's child: " << this->getID() << " to " << sent_parentp->getID() << llendl; + LL_WARNS() << "Attempt to attach a parent to it's child: " << this->getID() << " to " << sent_parentp->getID() << LL_ENDL; this->removeChild(sent_parentp); sent_parentp->setDrawableParent(NULL); } @@ -1783,7 +1960,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, { if (mDrawable->isDead() || !mDrawable->getVObj()) { - llwarns << "Drawable is dead or no VObj!" << llendl; + LL_WARNS() << "Drawable is dead or no VObj!" << LL_ENDL; sent_parentp->addChild(this); } else @@ -1793,9 +1970,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Bad, we got a cycle somehow. // Kill both the parent and the child, and // set cache misses for both of them. - llwarns << "Attempting to recover from parenting cycle!" << llendl; - llwarns << "Killing " << sent_parentp->getID() << " and " << getID() << llendl; - llwarns << "Adding to cache miss list" << llendl; + LL_WARNS() << "Attempting to recover from parenting cycle!" << LL_ENDL; + LL_WARNS() << "Killing " << sent_parentp->getID() << " and " << getID() << LL_ENDL; + LL_WARNS() << "Adding to cache miss list" << LL_ENDL; setParent(NULL); sent_parentp->setParent(NULL); getRegion()->addCacheMissFull(getLocalID()); @@ -1830,9 +2007,18 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // //parent_id - U32 ip = mesgsys->getSenderIP(); - U32 port = mesgsys->getSenderPort(); + U32 ip, port; + if(mesgsys != NULL) + { + ip = mesgsys->getSenderIP(); + port = mesgsys->getSenderPort(); + } + else + { + ip = mRegionp->getHost().getAddress(); + port = mRegionp->getHost().getPort(); + } gObjectList.orphanize(this, parent_id, ip, port); // Hide particles, icon and HUD @@ -1853,7 +2039,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, //LLViewerObjectList::getUUIDFromLocal(parent_uuid, parent_id, mesgsys->getSenderIP(), mesgsys->getSenderPort() ); //if (parent_uuid != cur_parentp->getID() ) //{ - // llerrs << "Local ID match but UUID mismatch of viewer object" << llendl; + // LL_ERRS() << "Local ID match but UUID mismatch of viewer object" << LL_ENDL; //} } else @@ -1870,10 +2056,21 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, else { LLUUID parent_uuid; + + if(mesgsys != NULL) + { LLViewerObjectList::getUUIDFromLocal(parent_uuid, parent_id, gMessageSystem->getSenderIP(), gMessageSystem->getSenderPort()); + } + else + { + LLViewerObjectList::getUUIDFromLocal(parent_uuid, + parent_id, + mRegionp->getHost().getAddress(), + mRegionp->getHost().getPort()); + } sent_parentp = gObjectList.findObject(parent_uuid); if (isAvatar()) @@ -1894,8 +2091,18 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // // Switching parents, but we don't know the new parent. // - U32 ip = mesgsys->getSenderIP(); - U32 port = mesgsys->getSenderPort(); + U32 ip, port; + + if(mesgsys != NULL) + { + ip = mesgsys->getSenderIP(); + port = mesgsys->getSenderPort(); + } + else + { + ip = mRegionp->getHost().getAddress(); + port = mRegionp->getHost().getPort(); + } // We're an orphan, flag things appropriately. gObjectList.orphanize(this, parent_id, ip, port); @@ -1914,9 +2121,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Bad, we got a cycle somehow. // Kill both the parent and the child, and // set cache misses for both of them. - llwarns << "Attempting to recover from parenting cycle!" << llendl; - llwarns << "Killing " << sent_parentp->getID() << " and " << getID() << llendl; - llwarns << "Adding to cache miss list" << llendl; + LL_WARNS() << "Attempting to recover from parenting cycle!" << LL_ENDL; + LL_WARNS() << "Killing " << sent_parentp->getID() << " and " << getID() << LL_ENDL; + LL_WARNS() << "Adding to cache miss list" << LL_ENDL; setParent(NULL); sent_parentp->setParent(NULL); getRegion()->addCacheMissFull(getLocalID()); @@ -1948,7 +2155,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // This is probably an object flying across a region boundary, the // object probably ISN'T being reparented, but just got an object // update out of order (child update before parent). - //llinfos << "Don't reparent object handoffs!" << llendl; + //LL_INFOS() << "Don't reparent object handoffs!" << LL_ENDL; remove_parent = false; } } @@ -1979,18 +2186,18 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, new_rot.normQuat(); - if (sPingInterpolate) + if (sPingInterpolate && mesgsys != NULL) { LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mesgsys->getSender()); if (cdp) { - F32 ping_delay = 0.5f * time_dilation * ( ((F32)cdp->getPingDelay()) * 0.001f + gFrameDTClamped); + F32 ping_delay = 0.5f * time_dilation * ( ((F32)cdp->getPingDelay().valueInUnits<LLUnits::Seconds>()) + gFrameDTClamped); LLVector3 diff = getVelocity() * ping_delay; new_pos_parent += diff; } else { - llwarns << "findCircuit() returned NULL; skipping interpolation" << llendl; + LL_WARNS() << "findCircuit() returned NULL; skipping interpolation" << LL_ENDL; } } @@ -2002,6 +2209,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // If we're going to skip this message, why are we // doing all the parenting, etc above? + if(mesgsys != NULL) + { U32 packet_id = mesgsys->getCurrentRecvPacketID(); if (packet_id < mLatestRecvPacketID && mLatestRecvPacketID - packet_id < 65536) @@ -2009,8 +2218,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, //skip application of this message, it's old return retval; } - mLatestRecvPacketID = packet_id; + } // Set the change flags for scale if (new_scale != getScale()) @@ -2042,7 +2251,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } else { - llwarns << "Can not move the object/avatar to an infinite location!" << llendl ; + LL_WARNS() << "Can not move the object/avatar to an infinite location!" << LL_ENDL ; retval |= INVALID_UPDATE ; } @@ -2058,7 +2267,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // If we're snapping the position by more than 0.5m, update LLViewerStats::mAgentPositionSnaps if ( asAvatar() && asAvatar()->isSelf() && (mag_sqr > 0.25f) ) { - LLViewerStats::getInstance()->mAgentPositionSnaps.push( diff.length() ); + record(LLStatViewer::AGENT_POSITION_SNAP, LLUnit<F64, LLUnits::Meters>(diff.length())); } } @@ -2159,7 +2368,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Don't clear invisibility flag on update if still orphaned! if (mDrawable->isState(LLDrawable::FORCE_INVISIBLE) && !mOrphaned) { -// lldebugs << "Clearing force invisible: " << mID << ":" << getPCodeString() << ":" << getPositionAgent() << llendl; +// LL_DEBUGS() << "Clearing force invisible: " << mID << ":" << getPCodeString() << ":" << getPositionAgent() << LL_ENDL; mDrawable->clearState(LLDrawable::FORCE_INVISIBLE); gPipeline.markRebuild( mDrawable, LLDrawable::REBUILD_ALL, TRUE ); } @@ -2181,12 +2390,26 @@ BOOL LLViewerObject::isActive() const return TRUE; } +//load flags from cache or from message +void LLViewerObject::loadFlags(U32 flags) +{ + if(flags == (U32)(-1)) + { + return; //invalid + } + + // keep local flags and overwrite remote-controlled flags + mFlags = (mFlags & FLAGS_LOCAL) | flags; + // ...new objects that should come in selected need to be added to the selected list + mCreateSelected = ((flags & FLAGS_CREATE_SELECTED) != 0); + return; +} void LLViewerObject::idleUpdate(LLAgent &agent, const F64 &time) { - //static LLFastTimer::DeclareTimer ftm("Viewer Object"); - //LLFastTimer t(ftm); + //static LLTrace::BlockTimerStatHandle ftm("Viewer Object"); + //LL_RECORD_BLOCK_TIME(ftm); if (!mDead) { @@ -2194,13 +2417,14 @@ void LLViewerObject::idleUpdate(LLAgent &agent, const F64 &time) { // calculate dt from last update F32 time_dilation = mRegionp ? mRegionp->getTimeDilation() : 1.0f; - F32 dt = time_dilation * (F32)(time - mLastInterpUpdateSecs); + F32 dt_raw = ((F64Seconds)time - mLastInterpUpdateSecs).value(); + F32 dt = time_dilation * dt_raw; applyAngularVelocity(dt); if (isAttachment()) { - mLastInterpUpdateSecs = time; + mLastInterpUpdateSecs = (F64Seconds)time; return; } else @@ -2214,8 +2438,8 @@ void LLViewerObject::idleUpdate(LLAgent &agent, const F64 &time) } -// Move an object due to idle-time viewer side updates by iterpolating motion -void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) +// Move an object due to idle-time viewer side updates by interpolating motion +void LLViewerObject::interpolateLinearMotion(const F64SecondsImplicit& time, const F32SecondsImplicit& dt_seconds) { // linear motion // PHYSICS_TIMESTEP is used below to correct for the fact that the velocity in object @@ -2226,8 +2450,9 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) // to see if object is selected, instead of explicitly // zeroing it out - F64 time_since_last_update = time - mLastMessageUpdateSecs; - if (time_since_last_update <= 0.0 || dt <= 0.f) + F32 dt = dt_seconds; + F64Seconds time_since_last_update = time - mLastMessageUpdateSecs; + if (time_since_last_update <= (F64Seconds)0.0 || dt <= 0.f) { return; } @@ -2235,7 +2460,7 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) LLVector3 accel = getAcceleration(); LLVector3 vel = getVelocity(); - if (sMaxUpdateInterpolationTime <= 0.0) + if (sMaxUpdateInterpolationTime <= (F64Seconds)0.0) { // Old code path ... unbounded, simple interpolation if (!(accel.isExactlyZero() && vel.isExactlyZero())) { @@ -2257,8 +2482,8 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) LLVector3 new_v = accel * dt; if (time_since_last_update > sPhaseOutUpdateInterpolationTime && - sPhaseOutUpdateInterpolationTime > 0.0) - { // Haven't seen a viewer update in a while, check to see if the ciruit is still active + sPhaseOutUpdateInterpolationTime > (F64Seconds)0.0) + { // Haven't seen a viewer update in a while, check to see if the circuit is still active if (mRegionp) { // The simulator will NOT send updates if the object continues normally on the path // predicted by the velocity and the acceleration (often gravity) sent to the viewer @@ -2267,19 +2492,19 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) if (cdp) { // Find out how many seconds since last packet arrived on the circuit - F64 time_since_last_packet = LLMessageSystem::getMessageTimeSeconds() - cdp->getLastPacketInTime(); + F64Seconds time_since_last_packet = LLMessageSystem::getMessageTimeSeconds() - cdp->getLastPacketInTime(); if (!cdp->isAlive() || // Circuit is dead or blocked cdp->isBlocked() || // or doesn't seem to be getting any packets (time_since_last_packet > sPhaseOutUpdateInterpolationTime)) { // Start to reduce motion interpolation since we haven't seen a server update in a while - F64 time_since_last_interpolation = time - mLastInterpUpdateSecs; + F64Seconds time_since_last_interpolation = time - mLastInterpUpdateSecs; F64 phase_out = 1.0; if (time_since_last_update > sMaxUpdateInterpolationTime) { // Past the time limit, so stop the object phase_out = 0.0; - //llinfos << "Motion phase out to zero" << llendl; + //LL_INFOS() << "Motion phase out to zero" << LL_ENDL; // Kill angular motion as well. Note - not adding this due to paranoia // about stopping rotation for llTargetOmega objects and not having it restart @@ -2289,13 +2514,13 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) { // Last update was already phased out a bit phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) / (sMaxUpdateInterpolationTime - time_since_last_interpolation); - //llinfos << "Continuing motion phase out of " << (F32) phase_out << llendl; + //LL_INFOS() << "Continuing motion phase out of " << (F32) phase_out << LL_ENDL; } else { // Phase out from full value phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) / (sMaxUpdateInterpolationTime - sPhaseOutUpdateInterpolationTime); - //llinfos << "Starting motion phase out of " << (F32) phase_out << llendl; + //LL_INFOS() << "Starting motion phase out of " << (F32) phase_out << LL_ENDL; } phase_out = llclamp(phase_out, 0.0, 1.0); @@ -2340,8 +2565,8 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) if (clip_pos_global != new_pos_global) { // Was clipped, so this means we hit a edge where there is no region to enter - //llinfos << "Hit empty region edge, clipped predicted position to " << mRegionp->getPosRegionFromGlobal(clip_pos_global) - // << " from " << new_pos << llendl; + //LL_INFOS() << "Hit empty region edge, clipped predicted position to " << mRegionp->getPosRegionFromGlobal(clip_pos_global) + // << " from " << new_pos << LL_ENDL; new_pos = mRegionp->getPosRegionFromGlobal(clip_pos_global); // Stop motion and get server update for bouncing on the edge @@ -2350,7 +2575,7 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) } else { // Let predicted movement cross into another region - //llinfos << "Predicting region crossing to " << new_pos << llendl; + //LL_INFOS() << "Predicting region crossing to " << new_pos << LL_ENDL; } } @@ -2498,7 +2723,7 @@ void LLViewerObject::saveScript( * XXXPAM Investigate not making this copy. Seems unecessary, but I'm unsure about the * interaction with doUpdateInventory() called below. */ - lldebugs << "LLViewerObject::saveScript() " << item->getUUID() << " " << item->getAssetUUID() << llendl; + LL_DEBUGS() << "LLViewerObject::saveScript() " << item->getUUID() << " " << item->getAssetUUID() << LL_ENDL; LLPointer<LLViewerInventoryItem> task_item = new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(), item->getAssetUUID(), item->getType(), @@ -2529,7 +2754,7 @@ void LLViewerObject::saveScript( void LLViewerObject::moveInventory(const LLUUID& folder_id, const LLUUID& item_id) { - lldebugs << "LLViewerObject::moveInventory " << item_id << llendl; + LL_DEBUGS() << "LLViewerObject::moveInventory " << item_id << LL_ENDL; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MoveTaskInventory); msg->nextBlockFast(_PREHASH_AgentData); @@ -2646,12 +2871,12 @@ struct LLFilenameAndTask LLFilenameAndTask() { ++sCount; - lldebugs << "Constructing LLFilenameAndTask: " << sCount << llendl; + LL_DEBUGS() << "Constructing LLFilenameAndTask: " << sCount << LL_ENDL; } ~LLFilenameAndTask() { --sCount; - lldebugs << "Destroying LLFilenameAndTask: " << sCount << llendl; + LL_DEBUGS() << "Destroying LLFilenameAndTask: " << sCount << LL_ENDL; } private: LLFilenameAndTask(const LLFilenameAndTask& rhs); @@ -2671,8 +2896,8 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) LLViewerObject* object = gObjectList.findObject(task_id); if(!object) { - llwarns << "LLViewerObject::processTaskInv object " - << task_id << " does not exist." << llendl; + LL_WARNS() << "LLViewerObject::processTaskInv object " + << task_id << " does not exist." << LL_ENDL; return; } @@ -2686,7 +2911,7 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) if(ft->mFilename.empty()) { - lldebugs << "Task has no inventory" << llendl; + LL_DEBUGS() << "Task has no inventory" << LL_ENDL; // mock up some inventory to make a drop target. if(object->mInventory) { @@ -2746,15 +2971,15 @@ void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtS // MAINT-2597 - crash when trying to edit a no-mod object // Somehow get an contents inventory response, but with an invalid stream (possibly 0 size?) // Stated repro was specific to no-mod objects so failing without user interaction should be safe. - llwarns << "Trying to load invalid task inventory file. Ignoring file contents." << llendl; + LL_WARNS() << "Trying to load invalid task inventory file. Ignoring file contents." << LL_ENDL; } } else { // This Occurs When to requests were made, and the first one // has already handled it. - lldebugs << "Problem loading task inventory. Return code: " - << error_code << llendl; + LL_DEBUGS() << "Problem loading task inventory. Return code: " + << error_code << LL_ENDL; } delete ft; } @@ -2795,8 +3020,8 @@ BOOL LLViewerObject::loadTaskInvFile(const std::string& filename) } else { - llwarns << "Unknown token in inventory file '" - << keyword << "'" << llendl; + LL_WARNS() << "Unknown token in inventory file '" + << keyword << "'" << LL_ENDL; } } ifs.close(); @@ -2804,8 +3029,8 @@ BOOL LLViewerObject::loadTaskInvFile(const std::string& filename) } else { - llwarns << "unable to load task inventory: " << filename_and_local_path - << llendl; + LL_WARNS() << "unable to load task inventory: " << filename_and_local_path + << LL_ENDL; return FALSE; } doInventoryCallback(); @@ -2829,7 +3054,7 @@ void LLViewerObject::doInventoryCallback() } else { - llinfos << "LLViewerObject::doInventoryCallback() deleting bad listener entry." << llendl; + LL_INFOS() << "LLViewerObject::doInventoryCallback() deleting bad listener entry." << LL_ENDL; delete info; mInventoryCallbacks.erase(curiter); } @@ -2977,7 +3202,7 @@ LLInventoryObject* LLViewerObject::getInventoryRoot() LLViewerInventoryItem* LLViewerObject::getInventoryItemByAsset(const LLUUID& asset_id) { if (mInventoryDirty) - llwarns << "Peforming inventory lookup for object " << mID << " that has dirty inventory!" << llendl; + LL_WARNS() << "Peforming inventory lookup for object " << mID << " that has dirty inventory!" << LL_ENDL; LLViewerInventoryItem* rv = NULL; if(mInventory) @@ -3382,7 +3607,7 @@ void LLViewerObject::addNVPair(const std::string& data) // char splat[MAX_STRING]; // temp->printNameValue(splat); -// llinfos << "addNVPair " << splat << llendl; +// LL_INFOS() << "addNVPair " << splat << LL_ENDL; name_value_map_t::iterator iter = mNameValuePairs.find(nv->mName); if (iter != mNameValuePairs.end()) @@ -3396,7 +3621,7 @@ void LLViewerObject::addNVPair(const std::string& data) else { delete nv; -// llinfos << "Trying to write to Read Only NVPair " << temp->mName << " in addNVPair()" << llendl; +// LL_INFOS() << "Trying to write to Read Only NVPair " << temp->mName << " in addNVPair()" << LL_ENDL; return; } } @@ -3407,7 +3632,7 @@ BOOL LLViewerObject::removeNVPair(const std::string& name) { char* canonical_name = gNVNameTable.addString(name); - lldebugs << "LLViewerObject::removeNVPair(): " << name << llendl; + LL_DEBUGS() << "LLViewerObject::removeNVPair(): " << name << LL_ENDL; name_value_map_t::iterator iter = mNameValuePairs.find(canonical_name); if (iter != mNameValuePairs.end()) @@ -3433,7 +3658,7 @@ BOOL LLViewerObject::removeNVPair(const std::string& name) } else { - lldebugs << "removeNVPair - No region for object" << llendl; + LL_DEBUGS() << "removeNVPair - No region for object" << LL_ENDL; } } return FALSE; @@ -4213,7 +4438,7 @@ S32 LLViewerObject::setTEColor(const U8 te, const LLColor4& color) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (color != tep->getColor()) { @@ -4233,7 +4458,7 @@ S32 LLViewerObject::setTEBumpmap(const U8 te, const U8 bump) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (bump != tep->getBumpmap()) { @@ -4254,7 +4479,7 @@ S32 LLViewerObject::setTETexGen(const U8 te, const U8 texgen) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (texgen != tep->getTexGen()) { @@ -4270,7 +4495,7 @@ S32 LLViewerObject::setTEMediaTexGen(const U8 te, const U8 media) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (media != tep->getMediaTexGen()) { @@ -4286,7 +4511,7 @@ S32 LLViewerObject::setTEShiny(const U8 te, const U8 shiny) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (shiny != tep->getShiny()) { @@ -4302,7 +4527,7 @@ S32 LLViewerObject::setTEFullbright(const U8 te, const U8 fullbright) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (fullbright != tep->getFullbright()) { @@ -4324,7 +4549,7 @@ S32 LLViewerObject::setTEMediaFlags(const U8 te, const U8 media_flags) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (media_flags != tep->getMediaFlags()) { @@ -4347,7 +4572,7 @@ S32 LLViewerObject::setTEGlow(const U8 te, const F32 glow) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (glow != tep->getGlow()) { @@ -4390,7 +4615,7 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; return 0; } @@ -4509,7 +4734,7 @@ LLViewerTexture *LLViewerObject::getTEImage(const U8 face) const } } - llerrs << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << llendl; + LL_ERRS() << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << LL_ENDL; return NULL; } @@ -4531,7 +4756,7 @@ bool LLViewerObject::isImageAlphaBlended(const U8 te) const case GL_RGB: break; default: { - llwarns << "Unexpected tex format in LLViewerObject::isImageAlphaBlended...returning no alpha." << llendl; + LL_WARNS() << "Unexpected tex format in LLViewerObject::isImageAlphaBlended...returning no alpha." << LL_ENDL; } break; } @@ -4556,7 +4781,7 @@ LLViewerTexture *LLViewerObject::getTENormalMap(const U8 face) const } } - llerrs << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << llendl; + LL_ERRS() << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << LL_ENDL; return NULL; } @@ -4578,14 +4803,14 @@ LLViewerTexture *LLViewerObject::getTESpecularMap(const U8 face) const } } - llerrs << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << llendl; + LL_ERRS() << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << LL_ENDL; return NULL; } void LLViewerObject::fitFaceTexture(const U8 face) { - llinfos << "fitFaceTexture not implemented" << llendl; + LL_INFOS() << "fitFaceTexture not implemented" << LL_ENDL; } @@ -4834,7 +5059,7 @@ void LLViewerObject::unpackParticleSource(const S32 block_num, const LLUUID& own // We need to be able to deal with a particle source that hasn't changed, but still got an update! if (pss) { -// llinfos << "Making particle system with owner " << owner_id << llendl; +// LL_INFOS() << "Making particle system with owner " << owner_id << LL_ENDL; pss->setOwnerUUID(owner_id); mPartSourcep = pss; LLViewerPartSim::getInstance()->addPartSource(pss); @@ -4881,7 +5106,7 @@ void LLViewerObject::unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_ // We need to be able to deal with a particle source that hasn't changed, but still got an update! if (pss) { -// llinfos << "Making particle system with owner " << owner_id << llendl; +// LL_INFOS() << "Making particle system with owner " << owner_id << LL_ENDL; pss->setOwnerUUID(owner_id); mPartSourcep = pss; LLViewerPartSim::getInstance()->addPartSource(pss); @@ -4950,6 +5175,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow { if (!gAudiop) { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; return; } @@ -4965,7 +5191,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow // At least, this appears to be how the scripts work. // The attached sound ID is set to NULL to avoid it playing back when the // object rezzes in on non-looping sounds. - //llinfos << "Clearing attached sound " << mAudioSourcep->getCurrentData()->getID() << llendl; + //LL_INFOS() << "Clearing attached sound " << mAudioSourcep->getCurrentData()->getID() << LL_ENDL; gAudiop->cleanupAudioSource(mAudioSourcep); mAudioSourcep = NULL; } @@ -4980,7 +5206,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow && mAudioSourcep && mAudioSourcep->isLoop() && mAudioSourcep->getCurrentData() && mAudioSourcep->getCurrentData()->getID() == audio_uuid) { - //llinfos << "Already playing this sound on a loop, ignoring" << llendl; + //LL_INFOS() << "Already playing this sound on a loop, ignoring" << LL_ENDL; return; } @@ -4994,7 +5220,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow if (mAudioSourcep && mAudioSourcep->isMuted() && mAudioSourcep->getCurrentData() && mAudioSourcep->getCurrentData()->getID() == audio_uuid) { - //llinfos << "Already having this sound as muted sound, ignoring" << llendl; + //LL_INFOS() << "Already having this sound as muted sound, ignoring" << LL_ENDL; return; } @@ -5017,7 +5243,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow // Play this sound if region maturity permits if( gAgent.canAccessMaturityAtGlobal(this->getPositionGlobal()) ) { - //llinfos << "Playing attached sound " << audio_uuid << llendl; + //LL_INFOS() << "Playing attached sound " << audio_uuid << LL_ENDL; mAudioSourcep->play(audio_uuid); } } @@ -5032,7 +5258,10 @@ LLAudioSource *LLViewerObject::getAudioSource(const LLUUID& owner_id) LLAudioSourceVO *asvop = new LLAudioSourceVO(mID, owner_id, 0.01f, this); mAudioSourcep = asvop; - if(gAudiop) gAudiop->addAudioSource(asvop); + if(gAudiop) + { + gAudiop->addAudioSource(asvop); + } } return mAudioSourcep; @@ -5040,10 +5269,6 @@ LLAudioSource *LLViewerObject::getAudioSource(const LLUUID& owner_id) void LLViewerObject::adjustAudioGain(const F32 gain) { - if (!gAudiop) - { - return; - } if (mAudioSourcep) { mAudioGain = gain; @@ -5100,7 +5325,7 @@ LLViewerObject::ExtraParameter* LLViewerObject::createNewParameterEntry(U16 para } default: { - llinfos << "Unknown param type." << llendl; + LL_INFOS() << "Unknown param type." << LL_ENDL; break; } }; @@ -5238,7 +5463,7 @@ void LLViewerObject::parameterChanged(U16 param_type, LLNetworkData* data, BOOL } else { - llwarns << "Failed to send object extra parameters: " << param_type << llendl; + LL_WARNS() << "Failed to send object extra parameters: " << param_type << LL_ENDL; } } } @@ -5503,7 +5728,18 @@ void LLViewerObject::setRegion(LLViewerRegion *regionp) { if (!regionp) { - llwarns << "viewer object set region to NULL" << llendl; + LL_WARNS() << "viewer object set region to NULL" << LL_ENDL; + } + if(regionp != mRegionp) + { + if(mRegionp) + { + mRegionp->removeFromCreatedList(getLocalID()); + } + if(regionp) + { + regionp->addToCreatedList(getLocalID()); + } } mLatestRecvPacketID = 0; @@ -5525,10 +5761,10 @@ void LLViewerObject::updateRegion(LLViewerRegion *regionp) // if (regionp) // { // F64 now = LLFrameTimer::getElapsedSeconds(); -// llinfos << "Updating to region " << regionp->getName() +// LL_INFOS() << "Updating to region " << regionp->getName() // << ", ms since last update message: " << (F32)((now - mLastMessageUpdateSecs) * 1000.0) // << ", ms since last interpolation: " << (F32)((now - mLastInterpUpdateSecs) * 1000.0) -// << llendl; +// << LL_ENDL; // } } |