Code consolidation. Redundant code moved into single function (checkMediaURL).
This commit is contained in:
@@ -1880,7 +1880,7 @@ void LLSelectMgr::selectionSetFullbright(U8 fullbright)
|
|||||||
void LLSelectMgr::selectionSetMediaTypeAndURL(U8 media_type, const std::string& media_url)
|
void LLSelectMgr::selectionSetMediaTypeAndURL(U8 media_type, const std::string& media_url)
|
||||||
{
|
{
|
||||||
U8 media_flags = LLTextureEntry::MF_NONE;
|
U8 media_flags = LLTextureEntry::MF_NONE;
|
||||||
if (media_type == LLViewerObject::MEDIA_TYPE_WEB_PAGE)
|
if (media_type == LLViewerObject::MEDIA_SET)
|
||||||
{
|
{
|
||||||
media_flags = LLTextureEntry::MF_HAS_MEDIA;
|
media_flags = LLTextureEntry::MF_HAS_MEDIA;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -740,6 +740,42 @@ void LLViewerObject::hideExtraDisplayItems( BOOL hidden )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
U32 LLViewerObject::checkMediaURL(const std::string &media_url)
|
||||||
|
{
|
||||||
|
U32 retval = (U32)0x0;
|
||||||
|
if (!mMedia && !media_url.empty())
|
||||||
|
{
|
||||||
|
retval |= MEDIA_URL_ADDED;
|
||||||
|
mMedia = new LLViewerObjectMedia;
|
||||||
|
mMedia->mMediaURL = media_url;
|
||||||
|
mMedia->mMediaType = LLViewerObject::MEDIA_SET;
|
||||||
|
mMedia->mPassedWhitelist = FALSE;
|
||||||
|
}
|
||||||
|
else if (mMedia)
|
||||||
|
{
|
||||||
|
if (media_url.empty())
|
||||||
|
{
|
||||||
|
retval |= MEDIA_URL_REMOVED;
|
||||||
|
delete mMedia;
|
||||||
|
mMedia = NULL;
|
||||||
|
}
|
||||||
|
else if (mMedia->mMediaURL != media_url) // <-- This is an optimization. If they are equal don't bother with below's test.
|
||||||
|
{
|
||||||
|
/*if (! (LLTextureEntry::getAgentIDFromMediaVersionString(media_url) == gAgent.getID() &&
|
||||||
|
LLTextureEntry::getVersionFromMediaVersionString(media_url) ==
|
||||||
|
LLTextureEntry::getVersionFromMediaVersionString(mMedia->mMediaURL) + 1))
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
// If the media URL is different and WE were not the one who
|
||||||
|
// changed it, mark dirty.
|
||||||
|
retval |= MEDIA_URL_UPDATED;
|
||||||
|
}
|
||||||
|
mMedia->mMediaURL = media_url;
|
||||||
|
mMedia->mPassedWhitelist = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
|
U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
|
||||||
void **user_data,
|
void **user_data,
|
||||||
@@ -1118,34 +1154,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
|
|||||||
|
|
||||||
std::string media_url;
|
std::string media_url;
|
||||||
mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_MediaURL, media_url, block_num);
|
mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_MediaURL, media_url, block_num);
|
||||||
//if (!media_url.empty())
|
retval |= checkMediaURL(media_url);
|
||||||
//{
|
|
||||||
// llinfos << "WEBONPRIM media_url " << media_url << llendl;
|
|
||||||
//}
|
|
||||||
if (!mMedia && !media_url.empty())
|
|
||||||
{
|
|
||||||
retval |= MEDIA_URL_ADDED;
|
|
||||||
mMedia = new LLViewerObjectMedia;
|
|
||||||
mMedia->mMediaURL = media_url;
|
|
||||||
mMedia->mMediaType = LLViewerObject::MEDIA_TYPE_WEB_PAGE;
|
|
||||||
mMedia->mPassedWhitelist = FALSE;
|
|
||||||
}
|
|
||||||
else if (mMedia)
|
|
||||||
{
|
|
||||||
if (media_url.empty())
|
|
||||||
{
|
|
||||||
retval |= MEDIA_URL_REMOVED;
|
|
||||||
delete mMedia;
|
|
||||||
mMedia = NULL;
|
|
||||||
}
|
|
||||||
else if (mMedia->mMediaURL != media_url)
|
|
||||||
{
|
|
||||||
// We just added or changed a web page.
|
|
||||||
retval |= MEDIA_URL_UPDATED;
|
|
||||||
mMedia->mMediaURL = media_url;
|
|
||||||
mMedia->mPassedWhitelist = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Unpack particle system data
|
// Unpack particle system data
|
||||||
@@ -1546,31 +1555,12 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
|
|||||||
mText = NULL;
|
mText = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string media_url;
|
||||||
if (value & 0x200)
|
if (value & 0x200)
|
||||||
{
|
{
|
||||||
std::string media_url;
|
|
||||||
dp->unpackString(media_url, "MediaURL");
|
dp->unpackString(media_url, "MediaURL");
|
||||||
if (!mMedia)
|
|
||||||
{
|
|
||||||
retval |= MEDIA_URL_ADDED;
|
|
||||||
mMedia = new LLViewerObjectMedia;
|
|
||||||
mMedia->mMediaURL = media_url;
|
|
||||||
mMedia->mMediaType = LLViewerObject::MEDIA_TYPE_WEB_PAGE;
|
|
||||||
mMedia->mPassedWhitelist = FALSE;
|
|
||||||
}
|
|
||||||
else if (mMedia->mMediaURL != media_url)
|
|
||||||
{
|
|
||||||
retval |= MEDIA_URL_UPDATED;
|
|
||||||
mMedia->mMediaURL = media_url;
|
|
||||||
mMedia->mPassedWhitelist = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (mMedia)
|
|
||||||
{
|
|
||||||
retval |= MEDIA_URL_REMOVED;
|
|
||||||
delete mMedia;
|
|
||||||
mMedia = NULL;
|
|
||||||
}
|
}
|
||||||
|
retval |= checkMediaURL(media_url);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Unpack particle system data
|
// Unpack particle system data
|
||||||
@@ -3863,7 +3853,7 @@ U8 LLViewerObject::getMediaType() const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return LLViewerObject::MEDIA_TYPE_NONE;
|
return LLViewerObject::MEDIA_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,10 +158,15 @@ public:
|
|||||||
virtual BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
|
virtual BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
|
||||||
|
|
||||||
// Types of media we can associate
|
// Types of media we can associate
|
||||||
enum { MEDIA_TYPE_NONE = 0, MEDIA_TYPE_WEB_PAGE = 1 };
|
enum { MEDIA_NONE = 0, MEDIA_SET = 1 };
|
||||||
|
|
||||||
// Return codes for processUpdateMessage
|
// Return codes for processUpdateMessage
|
||||||
enum { MEDIA_URL_REMOVED = 0x1, MEDIA_URL_ADDED = 0x2, MEDIA_URL_UPDATED = 0x4, INVALID_UPDATE = 0x80000000 };
|
enum {
|
||||||
|
MEDIA_URL_REMOVED = 0x1,
|
||||||
|
MEDIA_URL_ADDED = 0x2,
|
||||||
|
MEDIA_URL_UPDATED = 0x4,
|
||||||
|
INVALID_UPDATE = 0x80000000
|
||||||
|
};
|
||||||
|
|
||||||
virtual U32 processUpdateMessage(LLMessageSystem *mesgsys,
|
virtual U32 processUpdateMessage(LLMessageSystem *mesgsys,
|
||||||
void **user_data,
|
void **user_data,
|
||||||
@@ -547,6 +552,10 @@ private:
|
|||||||
ExtraParameter* getExtraParameterEntryCreate(U16 param_type);
|
ExtraParameter* getExtraParameterEntryCreate(U16 param_type);
|
||||||
bool unpackParameterEntry(U16 param_type, LLDataPacker *dp);
|
bool unpackParameterEntry(U16 param_type, LLDataPacker *dp);
|
||||||
|
|
||||||
|
// This function checks to see if the given media URL has changed its version
|
||||||
|
// and the update wasn't due to this agent's last action.
|
||||||
|
U32 checkMediaURL(const std::string &media_url);
|
||||||
|
|
||||||
// Motion prediction between updates
|
// Motion prediction between updates
|
||||||
void interpolateLinearMotion(const F64 & time, const F32 & dt);
|
void interpolateLinearMotion(const F64 & time, const F32 & dt);
|
||||||
|
|
||||||
@@ -812,8 +821,8 @@ public:
|
|||||||
class LLAlphaObject : public LLViewerObject
|
class LLAlphaObject : public LLViewerObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLAlphaObject(const LLUUID &id, const LLPCode type, LLViewerRegion *regionp)
|
LLAlphaObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
|
||||||
: LLViewerObject(id,type,regionp)
|
: LLViewerObject(id,pcode,regionp)
|
||||||
{ mDepth = 0.f; }
|
{ mDepth = 0.f; }
|
||||||
|
|
||||||
virtual F32 getPartSize(S32 idx);
|
virtual F32 getPartSize(S32 idx);
|
||||||
|
|||||||
Reference in New Issue
Block a user