summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r--[-rwxr-xr-x]indra/newview/llviewerobject.cpp88
1 files changed, 57 insertions, 31 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 13d870bd7f..0bfdb654c7 100755..100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -233,6 +233,8 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
mRenderMedia(FALSE),
mBestUpdatePrecision(0),
mText(),
+ mHudText(""),
+ mHudTextColor(LLColor4::white),
mLastInterpUpdateSecs(0.f),
mLastMessageUpdateSecs(0.f),
mLatestRecvPacketID(0),
@@ -1414,12 +1416,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
// Setup object text
if (!mText)
{
- mText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
- mText->setFont(LLFontGL::getFontSansSerif());
- mText->setVertAlignment(LLHUDText::ALIGN_VERT_TOP);
- mText->setMaxLines(-1);
- mText->setSourceObject(this);
- mText->setOnHUDAttachment(isHUDAttachment());
+ initHudText();
}
std::string temp_string;
@@ -1433,6 +1430,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
mText->setColor(LLColor4(coloru));
mText->setString(temp_string);
+ mHudText = temp_string;
+ mHudTextColor = LLColor4(coloru);
+
setChanged(MOVED | SILHOUETTE);
}
else if (mText.notNull())
@@ -1795,12 +1795,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
// Setup object text
if (!mText && (value & 0x4))
{
- mText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
- mText->setFont(LLFontGL::getFontSansSerif());
- mText->setVertAlignment(LLHUDText::ALIGN_VERT_TOP);
- mText->setMaxLines(-1); // Set to match current agni behavior.
- mText->setSourceObject(this);
- mText->setOnHUDAttachment(isHUDAttachment());
+ initHudText();
}
if (value & 0x4)
@@ -1813,6 +1808,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
mText->setColor(LLColor4(coloru));
mText->setString(temp_string);
+ mHudText = temp_string;
+ mHudTextColor = LLColor4(coloru);
+
setChanged(TEXTURE);
}
else if(mText.notNull())
@@ -2841,6 +2839,11 @@ void LLViewerObject::clearInventoryListeners()
mInventoryCallbacks.clear();
}
+bool LLViewerObject::hasInventoryListeners()
+{
+ return !mInventoryCallbacks.empty();
+}
+
void LLViewerObject::requestInventory()
{
if(mInventoryDirty && mInventory && !mInventoryCallbacks.empty())
@@ -2848,15 +2851,20 @@ void LLViewerObject::requestInventory()
mInventory->clear(); // will deref and delete entries
delete mInventory;
mInventory = NULL;
- mInventoryDirty = FALSE; //since we are going to request it now
}
+
if(mInventory)
{
+ // inventory is either up to date or doesn't has a listener
+ // if it is dirty, leave it this way in case we gain a listener
doInventoryCallback();
}
- // throw away duplicate requests
else
{
+ // since we are going to request it now
+ mInventoryDirty = FALSE;
+
+ // Note: throws away duplicate requests
fetchInventoryFromServer();
}
}
@@ -2866,8 +2874,6 @@ void LLViewerObject::fetchInventoryFromServer()
if (!mInventoryPending)
{
delete mInventory;
- mInventory = NULL;
- mInventoryDirty = FALSE;
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RequestTaskInventory);
msg->nextBlockFast(_PREHASH_AgentData);
@@ -4091,6 +4097,7 @@ LLViewerObject* LLViewerObject::getRootEdit() const
BOOL LLViewerObject::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end,
S32 face,
BOOL pick_transparent,
+ BOOL pick_rigged,
S32* face_hit,
LLVector4a* intersection,
LLVector2* tex_coord,
@@ -4453,21 +4460,21 @@ S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid)
{
// Invalid host == get from the agent's sim
LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(
- uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid);
+ uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
return setTETextureCore(te,image);
}
S32 LLViewerObject::setTENormalMap(const U8 te, const LLUUID& uuid)
{
LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture(
- uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid);
+ uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
return setTENormalMapCore(te, image);
}
S32 LLViewerObject::setTESpecularMap(const U8 te, const LLUUID& uuid)
{
LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture(
- uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid);
+ uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
return setTESpecularMapCore(te, image);
}
@@ -4653,7 +4660,7 @@ S32 LLViewerObject::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID
return retval;
}
-S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams, bool isInitFromServer)
+S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams)
{
S32 retval = 0;
const LLTextureEntry *tep = getTE(te);
@@ -4663,14 +4670,13 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri
return 0;
}
- setTENormalMap(te, (pMaterialParams) ? pMaterialParams->getNormalID() : LLUUID::null);
- setTESpecularMap(te, (pMaterialParams) ? pMaterialParams->getSpecularID() : LLUUID::null);
-
- retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams, isInitFromServer);
+ retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams);
LL_DEBUGS("Material") << "Changing material params for te " << (S32)te
<< ", object " << mID
<< " (" << retval << ")"
<< LL_ENDL;
+ setTENormalMap(te, (pMaterialParams) ? pMaterialParams->getNormalID() : LLUUID::null);
+ setTESpecularMap(te, (pMaterialParams) ? pMaterialParams->getSpecularID() : LLUUID::null);
refreshMaterials();
return retval;
@@ -4964,12 +4970,7 @@ void LLViewerObject::setDebugText(const std::string &utf8text)
if (!mText)
{
- mText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
- mText->setFont(LLFontGL::getFontSansSerif());
- mText->setVertAlignment(LLHUDText::ALIGN_VERT_TOP);
- mText->setMaxLines(-1);
- mText->setSourceObject(this);
- mText->setOnHUDAttachment(isHUDAttachment());
+ initHudText();
}
mText->setColor(LLColor4::white);
mText->setString(utf8text);
@@ -4978,6 +4979,25 @@ void LLViewerObject::setDebugText(const std::string &utf8text)
updateText();
}
+void LLViewerObject::initHudText()
+{
+ mText = (LLHUDText *)LLHUDObject::addHUDObject(LLHUDObject::LL_HUD_TEXT);
+ mText->setFont(LLFontGL::getFontSansSerif());
+ mText->setVertAlignment(LLHUDText::ALIGN_VERT_TOP);
+ mText->setMaxLines(-1);
+ mText->setSourceObject(this);
+ mText->setOnHUDAttachment(isHUDAttachment());
+}
+
+void LLViewerObject::restoreHudText()
+{
+ if(mText)
+ {
+ mText->setColor(mHudTextColor);
+ mText->setString(mHudText);
+ }
+}
+
void LLViewerObject::setIcon(LLViewerTexture* icon_image)
{
if (!mIcon)
@@ -5024,7 +5044,13 @@ void LLViewerObject::updateText()
{
if (mText.notNull())
{
- LLVector3 up_offset(0,0,0);
+ LLVOAvatar* avatar = getAvatar();
+ if (avatar)
+ {
+ mText->setHidden(avatar->isInMuteList());
+ }
+
+ LLVector3 up_offset(0,0,0);
up_offset.mV[2] = getScale().mV[VZ]*0.6f;
if (mDrawable.notNull())