Skip to content

Commit

Permalink
viewer#1117 Use attachment info to prevent accidental nudity #2
Browse files Browse the repository at this point in the history
Discard null id attachments
  • Loading branch information
akleshchev committed May 17, 2024
1 parent 43603fe commit 36de04b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
24 changes: 17 additions & 7 deletions indra/newview/llvoavatar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const U32 LLVOAvatar::VISUAL_COMPLEXITY_UNKNOWN = 0;
const F64 HUD_OVERSIZED_TEXTURE_DATA_SIZE = 1024 * 1024;

const F32 MAX_TEXTURE_WAIT_TIME_SEC = 60;
const F32 MAX_ATTACHMENT_WAIT_TIME_SEC = 120;
const F32 MAX_ATTACHMENT_WAIT_TIME_SEC = 60;

const S32 MIN_NONTUNED_AVS = 5;

Expand Down Expand Up @@ -680,7 +680,6 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
mMutedAVColor(LLColor4::white /* used for "uninitialize" */),
mFirstFullyVisible(true),
mFirstDecloudTime(-1.f),
mFirstUseDelaySeconds(FIRST_APPEARANCE_CLOUD_MIN_DELAY),
mFullyLoaded(false),
mPreviousFullyLoaded(false),
mFullyLoadedInitialized(false),
Expand Down Expand Up @@ -8290,7 +8289,7 @@ bool LLVOAvatar::updateIsFullyLoaded()
);

// compare amount of attachments to one reported by simulator
if (!loading && !isSelf() && rez_status < 4 && mLastCloudAttachmentCount != mSimAttachments.size())
if (!loading && !isSelf() && rez_status < 4 && mLastCloudAttachmentCount < mSimAttachments.size())
{
S32 attachment_count = getAttachmentCount();
if (mLastCloudAttachmentCount != attachment_count)
Expand Down Expand Up @@ -8358,11 +8357,12 @@ bool LLVOAvatar::processFullyLoadedChange(bool loading)

if (mFirstFullyVisible)
{
F32 first_use_delay = FIRST_APPEARANCE_CLOUD_MIN_DELAY;
if (!isSelf() && loading)
{
// Note that textures can causes 60s delay on thier own
// so this delay might end up on top of textures' delay
mFirstUseDelaySeconds = llclamp(
first_use_delay = llclamp(
mFirstAppearanceMessageTimer.getElapsedTimeF32(),
FIRST_APPEARANCE_CLOUD_MIN_DELAY,
FIRST_APPEARANCE_CLOUD_MAX_DELAY);
Expand All @@ -8371,10 +8371,10 @@ bool LLVOAvatar::processFullyLoadedChange(bool loading)
{
// Impostors are less of a priority,
// let them stay cloud longer
mFirstUseDelaySeconds *= FIRST_APPEARANCE_CLOUD_IMPOSTOR_MODIFIER;
first_use_delay *= FIRST_APPEARANCE_CLOUD_IMPOSTOR_MODIFIER;
}
}
mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > mFirstUseDelaySeconds);
mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > first_use_delay);
}
else
{
Expand Down Expand Up @@ -9385,7 +9385,17 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe
<< (attachment_id.isNull() ? "pending" : attachment_id.asString())
<< " on point " << (S32)attach_point << LL_ENDL;

mSimAttachments[attachment_id] = attach_point;
if (attachment_id.notNull())
{
mSimAttachments[attachment_id] = attach_point;
}
else
{
// at the moment viewer is only interested in non-null attachments
LL_DEBUGS("AVAppearanceAttachments") << "AV " << getID()
<< " has null attachment on point " << (S32)attach_point
<< ", discarding" << LL_ENDL;
}
}

// todo? Doesn't detect if attachments were switched
Expand Down
1 change: 0 additions & 1 deletion indra/newview/llvoavatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ class LLVOAvatar :
private:
bool mFirstFullyVisible;
F32 mFirstDecloudTime;
F32 mFirstUseDelaySeconds;
LLFrameTimer mFirstAppearanceMessageTimer;

bool mFullyLoaded;
Expand Down

0 comments on commit 36de04b

Please sign in to comment.