Fixed ancient annoyance of enabling any debug info display clobbering object hovertext. Object's real hovertext is now cached, and only substituted if overridden by setDebugText, and is properly recovered when debug text is cleared.

This commit is contained in:
Shyotl
2012-08-16 02:15:10 -05:00
committed by Siana Gearz
parent b8276fd8e3
commit 4d1e822de7
3 changed files with 35 additions and 14 deletions

View File

@@ -99,6 +99,7 @@ public:
void setAlpha(F32 alpha);
void setZCompare(const BOOL zcompare);
void setDoFade(const BOOL do_fade);
bool getDoFade() const { return mDoFade; }
// void setVisibleOffScreen(BOOL visible) { mVisibleOffScreen = visible; }
// mMaxLines of -1 means unlimited lines.

View File

@@ -1235,6 +1235,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, mData, data_size, block_num);
}
mHudTextString.clear(); //Cache for reset on debug infodisplay toggle.
mHudTextColor = LLColor4U::white; //Cache for reset on debug infodisplay toggle.
S32 text_size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_Text);
if (text_size > 1)
{
@@ -1249,17 +1252,21 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
mText->setOnHUDAttachment(isHUDAttachment());
}
std::string temp_string;
mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_Text, temp_string, block_num );
//Cache for reset on debug infodisplay toggle.
mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_Text, mHudTextString, block_num );
LLColor4U coloru;
mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextColor, coloru.mV, 4, block_num);
// alpha was flipped so that it zero encoded better
coloru.mV[3] = 255 - coloru.mV[3];
mText->setColor(LLColor4(coloru));
mText->setString(temp_string);
mHudTextColor = LLColor4(coloru); //Cache for reset on debug infodisplay toggle.
if(mText->getDoFade()) //Fade is disabled when this is being overridden by debug text.
{
mText->setColor(mHudTextColor);
mText->setString(mHudTextString);
}
if (mDrawable.notNull())
{
setChanged(MOVED | SILHOUETTE);
@@ -1638,6 +1645,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
mData = NULL;
}
mHudTextString.clear(); //Cache for reset on debug infodisplay toggle.
mHudTextColor = LLColor4U::white; //Cache for reset on debug infodisplay toggle.
// Setup object text
if (!mText && (value & 0x4))
{
@@ -1651,13 +1661,17 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
if (value & 0x4)
{
std::string temp_string;
dp->unpackString(temp_string, "Text");
//Cache for reset on debug infodisplay toggle.
dp->unpackString(mHudTextString, "Text");
LLColor4U coloru;
dp->unpackBinaryDataFixed(coloru.mV, 4, "Color");
coloru.mV[3] = 255 - coloru.mV[3];
mText->setColor(LLColor4(coloru));
mText->setString(temp_string);
mHudTextColor = LLColor4(coloru); //Cache for reset on debug infodisplay toggle.
if(mText->getDoFade()) //Fade is disabled when this is being overridden by debug text.
{
mText->setColor(mHudTextColor);
mText->setString(mHudTextString);
}
setChanged(TEXTURE);
}
else if(mText.notNull())
@@ -4623,8 +4637,11 @@ void LLViewerObject::setCanSelect(BOOL canSelect)
void LLViewerObject::setDebugText(const std::string &utf8text)
{
if (utf8text.empty() && !mText)
if (utf8text.empty() && mHudTextString.empty())
{
if(mText)
mText->markDead();
mText = NULL;
return;
}
@@ -4637,10 +4654,10 @@ void LLViewerObject::setDebugText(const std::string &utf8text)
mText->setSourceObject(this);
mText->setOnHUDAttachment(isHUDAttachment());
}
mText->setColor(LLColor4::white);
mText->setString(utf8text);
mText->setZCompare(FALSE);
mText->setDoFade(FALSE);
mText->setColor(utf8text.empty() ? mHudTextColor : LLColor4::white );
mText->setString(utf8text.empty() ? mHudTextString : utf8text );
mText->setZCompare(utf8text.empty());
mText->setDoFade(utf8text.empty());
updateText();
}
// <edit>

View File

@@ -654,6 +654,9 @@ public:
// TODO: Make all this stuff private. JC
LLPointer<LLHUDText> mText;
std::string mHudTextString; //Cache for reset on debug infodisplay toggle.
LLColor4 mHudTextColor; //Cache for reset on debug infodisplay toggle.
LLPointer<LLHUDIcon> mIcon;
bool mIsNameAttachment;