summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r--indra/newview/llviewerobject.cpp134
1 files changed, 69 insertions, 65 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index b52c9d0d4b..78fa585a41 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -439,7 +439,7 @@ void LLViewerObject::dump() const
/*
llinfos << "Velocity: " << getVelocity() << llendl;
llinfos << "AnyOwner: " << permAnyOwner() << " YouOwner: " << permYouOwner() << " Edit: " << mPermEdit << llendl;
- llinfos << "UsePhysics: " << usePhysics() << " CanSelect " << mbCanSelect << " UserSelected " << mUserSelected << llendl;
+ llinfos << "UsePhysics: " << flagUsePhysics() << " CanSelect " << mbCanSelect << " UserSelected " << mUserSelected << llendl;
llinfos << "AppAngle: " << mAppAngle << llendl;
llinfos << "PixelArea: " << mPixelArea << llendl;
@@ -2036,12 +2036,11 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
}
}
- if (new_rot != mLastRot
+ if (new_rot != getRotation()
|| new_angv != old_angv)
{
- if (new_rot != mLastRot)
+ if (new_rot != getRotation())
{
- mLastRot = new_rot;
setRotation(new_rot);
}
@@ -2285,10 +2284,11 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
{ // This will put the object underground, but we can't tell if it will stop
// at ground level or not
min_height = LLWorld::getInstance()->getMinAllowedZ(this, new_pos_global);
+ // Cap maximum height
+ new_pos.mV[VZ] = llmin(LLWorld::getInstance()->getRegionMaxHeight(), new_pos.mV[VZ]);
}
new_pos.mV[VZ] = llmax(min_height, new_pos.mV[VZ]);
- new_pos.mV[VZ] = llmin(LLWorld::getInstance()->getRegionMaxHeight(), new_pos.mV[VZ]);
// Check to see if it's going off the region
LLVector3 temp(new_pos);
@@ -2817,6 +2817,33 @@ void LLViewerObject::removeInventory(const LLUUID& item_id)
++mInventorySerialNum;
}
+bool LLViewerObject::isTextureInInventory(LLViewerInventoryItem* item)
+{
+ bool result = false;
+
+ if (item && LLAssetType::AT_TEXTURE == item->getType())
+ {
+ std::list<LLUUID>::iterator begin = mPendingInventoryItemsIDs.begin();
+ std::list<LLUUID>::iterator end = mPendingInventoryItemsIDs.end();
+
+ bool is_fetching = std::find(begin, end, item->getAssetUUID()) != end;
+ bool is_fetched = getInventoryItemByAsset(item->getAssetUUID()) != NULL;
+
+ result = is_fetched || is_fetching;
+ }
+
+ return result;
+}
+
+void LLViewerObject::updateTextureInventory(LLViewerInventoryItem* item, U8 key, bool is_new)
+{
+ if (item && !isTextureInInventory(item))
+ {
+ mPendingInventoryItemsIDs.push_back(item->getAssetUUID());
+ updateInventory(item, key, is_new);
+ }
+}
+
void LLViewerObject::updateInventory(
LLViewerInventoryItem* item,
U8 key,
@@ -3956,38 +3983,6 @@ void LLViewerObject::sendMaterialUpdate() const
}
-// formerly send_object_rotation
-void LLViewerObject::sendRotationUpdate() const
-{
- LLViewerRegion* regionp = getRegion();
- if(!regionp) return;
- gMessageSystem->newMessageFast(_PREHASH_ObjectRotation);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID);
- gMessageSystem->addQuatFast(_PREHASH_Rotation, getRotationEdit());
- //llinfos << "Sent rotation " << getRotationEdit() << llendl;
- gMessageSystem->sendReliable( regionp->getHost() );
-}
-
-/* Obsolete, we use MultipleObjectUpdate instead
-//// formerly send_object_position_global
-//void LLViewerObject::sendPositionUpdate() const
-//{
-// gMessageSystem->newMessageFast(_PREHASH_ObjectPosition);
-// gMessageSystem->nextBlockFast(_PREHASH_AgentData);
-// gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
-// gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
-// gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
-// gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, mLocalID );
-// gMessageSystem->addVector3Fast(_PREHASH_Position, getPositionRegion());
-// LLViewerRegion* regionp = getRegion();
-// gMessageSystem->sendReliable(regionp->getHost());
-//}
-*/
-
//formerly send_object_shape(LLViewerObject *object)
void LLViewerObject::sendShapeUpdate()
{
@@ -5056,7 +5051,7 @@ BOOL LLViewerObject::permAnyOwner() const
{
if (isRootEdit())
{
- return ((mFlags & FLAGS_OBJECT_ANY_OWNER) != 0);
+ return flagObjectAnyOwner();
}
else
{
@@ -5078,7 +5073,7 @@ BOOL LLViewerObject::permYouOwner() const
return TRUE;
}
# endif
- return ((mFlags & FLAGS_OBJECT_YOU_OWNER) != 0);
+ return flagObjectYouOwner();
#endif
}
else
@@ -5092,7 +5087,7 @@ BOOL LLViewerObject::permGroupOwner() const
{
if (isRootEdit())
{
- return ((mFlags & FLAGS_OBJECT_GROUP_OWNED) != 0);
+ return flagObjectGroupOwned();
}
else
{
@@ -5115,7 +5110,7 @@ BOOL LLViewerObject::permOwnerModify() const
return TRUE;
}
# endif
- return ((mFlags & FLAGS_OBJECT_OWNER_MODIFY) != 0);
+ return flagObjectOwnerModify();
#endif
}
else
@@ -5139,7 +5134,7 @@ BOOL LLViewerObject::permModify() const
return TRUE;
}
# endif
- return ((mFlags & FLAGS_OBJECT_MODIFY) != 0);
+ return flagObjectModify();
#endif
}
else
@@ -5163,7 +5158,7 @@ BOOL LLViewerObject::permCopy() const
return TRUE;
}
# endif
- return ((mFlags & FLAGS_OBJECT_COPY) != 0);
+ return flagObjectCopy();
#endif
}
else
@@ -5187,7 +5182,7 @@ BOOL LLViewerObject::permMove() const
return TRUE;
}
# endif
- return ((mFlags & FLAGS_OBJECT_MOVE) != 0);
+ return flagObjectMove();
#endif
}
else
@@ -5211,7 +5206,7 @@ BOOL LLViewerObject::permTransfer() const
return TRUE;
}
# endif
- return ((mFlags & FLAGS_OBJECT_TRANSFER) != 0);
+ return flagObjectTransfer();
#endif
}
else
@@ -5254,21 +5249,19 @@ void LLViewerObject::markForUpdate(BOOL priority)
}
}
+bool LLViewerObject::isPermanentEnforced() const
+{
+ return flagObjectPermanent() && (mRegionp != gAgent.getRegion()) && !gAgent.isGodlike();
+}
+
bool LLViewerObject::getIncludeInSearch() const
{
- return ((mFlags & FLAGS_INCLUDE_IN_SEARCH) != 0);
+ return flagIncludeInSearch();
}
void LLViewerObject::setIncludeInSearch(bool include_in_search)
{
- if (include_in_search)
- {
- mFlags |= FLAGS_INCLUDE_IN_SEARCH;
- }
- else
- {
- mFlags &= ~FLAGS_INCLUDE_IN_SEARCH;
- }
+ setFlags(FLAGS_INCLUDE_IN_SEARCH, include_in_search);
}
void LLViewerObject::setRegion(LLViewerRegion *regionp)
@@ -5307,8 +5300,8 @@ void LLViewerObject::updateRegion(LLViewerRegion *regionp)
bool LLViewerObject::specialHoverCursor() const
{
- return (mFlags & FLAGS_USE_PHYSICS)
- || (mFlags & FLAGS_HANDLE_TOUCH)
+ return flagUsePhysics()
+ || flagHandleTouch()
|| (mClickAction != 0);
}
@@ -5321,10 +5314,15 @@ void LLViewerObject::updateFlags(BOOL physics_changed)
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, getLocalID() );
- gMessageSystem->addBOOLFast(_PREHASH_UsePhysics, usePhysics() );
+ gMessageSystem->addBOOLFast(_PREHASH_UsePhysics, flagUsePhysics() );
gMessageSystem->addBOOL("IsTemporary", flagTemporaryOnRez() );
gMessageSystem->addBOOL("IsPhantom", flagPhantom() );
- gMessageSystem->addBOOL("CastsShadows", flagCastShadows() );
+
+ // stinson 02/28/2012 : This CastsShadows BOOL is no longer used in either the viewer or the simulator
+ // The simulator code does not even unpack this value when the message is received.
+ // This could be potentially hijacked in the future for another use should the urgent need arise.
+ gMessageSystem->addBOOL("CastsShadows", FALSE );
+
if (physics_changed)
{
gMessageSystem->nextBlock("ExtraPhysics");
@@ -5339,6 +5337,19 @@ void LLViewerObject::updateFlags(BOOL physics_changed)
BOOL LLViewerObject::setFlags(U32 flags, BOOL state)
{
+ BOOL setit = setFlagsWithoutUpdate(flags, state);
+
+ // BUG: Sometimes viewer physics and simulator physics get
+ // out of sync. To fix this, always send update to simulator.
+// if (setit)
+ {
+ updateFlags();
+ }
+ return setit;
+}
+
+BOOL LLViewerObject::setFlagsWithoutUpdate(U32 flags, BOOL state)
+{
BOOL setit = FALSE;
if (state)
{
@@ -5356,13 +5367,6 @@ BOOL LLViewerObject::setFlags(U32 flags, BOOL state)
setit = TRUE;
}
}
-
- // BUG: Sometimes viewer physics and simulator physics get
- // out of sync. To fix this, always send update to simulator.
-// if (setit)
- {
- updateFlags();
- }
return setit;
}