diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index 9bdbc0c31..2583862cc 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -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. diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 73392750a..49745fd16 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -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(); } // diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index ac3b6ba28..af369ba05 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -654,6 +654,9 @@ public: // TODO: Make all this stuff private. JC LLPointer mText; + std::string mHudTextString; //Cache for reset on debug infodisplay toggle. + LLColor4 mHudTextColor; //Cache for reset on debug infodisplay toggle. + LLPointer mIcon; bool mIsNameAttachment;