FIRE-20288: Option to render friends only

master
Ansariel 2016-11-12 12:33:32 +01:00
parent ed02621aff
commit e4b096efe3
6 changed files with 85 additions and 2 deletions

View File

@ -1092,5 +1092,16 @@
<key>Value</key>
<string>a3f48b85-c29f-1f97-ebb6-644b7c053512</string>
</map>
<key>FSRenderFriendsOnly</key>
<map>
<key>Comment</key>
<string>If enabled, only avatars on your friend list will be rendered.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
</map>
</llsd>

View File

@ -90,6 +90,7 @@
#include "fsfloaterteleporthistory.h"
#include "fslslbridge.h"
#include "fsradar.h"
#include "llavataractions.h"
#include "llfloaterreg.h"
#include "llfloatersidepanelcontainer.h"
#include "llhudtext.h"
@ -97,9 +98,10 @@
#include "llnotificationsutil.h"
#include "llpanelplaces.h"
#include "llstatusbar.h"
#include "NACLantispam.h"
#include "llviewerkeyboard.h"
#include "llviewerobjectlist.h"
#include "llviewerregion.h"
#include "NACLantispam.h"
#include "nd/ndlogthrottle.h"
// Third party library includes
@ -917,6 +919,29 @@ void handleStaticEyesChanged()
}
// </FS:Ansariel>
// <FS:Ansariel> FIRE-20288: Option to render friends only
void handleRenderFriendsOnlyChanged(const LLSD& newvalue)
{
if (newvalue.asBoolean())
{
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
iter != LLCharacter::sInstances.end(); ++iter)
{
LLVOAvatar* avatar = (LLVOAvatar*)*iter;
if (avatar->getID() != gAgentID && !LLAvatarActions::isFriend(avatar->getID()))
{
gObjectList.killObject(avatar);
if (LLViewerRegion::sVOCacheCullingEnabled && avatar->getRegion())
{
avatar->getRegion()->killCacheEntry(avatar->getLocalID());
}
}
}
}
}
// </FS:Ansariel>
////////////////////////////////////////////////////////////////////////////
void settings_setup_listeners()
@ -1137,6 +1162,9 @@ void settings_setup_listeners()
gSavedSettings.getControl("FSStaticEyesUUID")->getSignal()->connect(boost::bind(&handleStaticEyesChanged));
gSavedPerAccountSettings.getControl("FSStaticEyes")->getSignal()->connect(boost::bind(&handleStaticEyesChanged));
// </FS:Ansariel>
// <FS:Ansariel> FIRE-20288: Option to render friends only
gSavedPerAccountSettings.getControl("FSRenderFriendsOnly")->getSignal()->connect(boost::bind(&handleRenderFriendsOnlyChanged, _2));
}
#if TEST_CACHED_CONTROL

View File

@ -88,6 +88,7 @@
#include "llfloaterreg.h"
#include "fsareasearch.h" // <FS:Cron> Added to provide the ability to update the impact costs in area search. </FS:Cron>
#include "llavataractions.h"
extern F32 gMinObjectDistance;
extern BOOL gAnimateTextures;
@ -357,6 +358,13 @@ LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry*
}
// </FS:Ansariel>
// <FS:Ansariel> FIRE-20288: Option to render friends only
if (isNonFriendDerendered(fullid, pcode))
{
return NULL;
}
// </FS:Ansariel>
objectp = findObject(fullid);
if (objectp)
@ -649,6 +657,14 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
continue;
}
// <FS:Ansariel> FIRE-20288: Option to render friends only
if (isNonFriendDerendered(fullid, pcode))
{
LL_INFOS() << "Not rendering avatar " << fullid.asString() << " because it is not on the friend list" << LL_ENDL;
continue;
}
// </FS:Ansariel>
objectp = createObject(pcode, regionp, fullid, local_id, gMessageSystem->getSender());
if (!objectp)
{
@ -2160,6 +2176,13 @@ LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRe
return NULL;
}
// </FS:Ansariel>
// <FS:Ansariel> FIRE-20288: Option to render friends only
if (isNonFriendDerendered(uuid, pcode))
{
return NULL;
}
// </FS:Ansariel>
LLUUID fullid;
if (uuid == LLUUID::null)
@ -2458,5 +2481,12 @@ void LLViewerObjectList::removeDerenderedItem( LLUUID const &aId )
{
mDerendered.erase( aId );
}
// </FS:ND>
// <FS:Ansariel> FIRE-20288: Option to render friends only
bool LLViewerObjectList::isNonFriendDerendered(const LLUUID& id, LLPCode pcode)
{
static LLCachedControl<bool> fsRenderFriendsOnly(gSavedPerAccountSettings, "FSRenderFriendsOnly");
return (pcode == LL_PCODE_LEGACY_AVATAR && fsRenderFriendsOnly && id != gAgentID && !LLAvatarActions::isFriend(id));
}
// </FS:Ansariel>

View File

@ -248,6 +248,9 @@ private:
static void reportPhysicsFlagFailure(LLSD &obejectList);
void fetchPhisicsFlagsCoro(std::string url);
// <FS:Ansariel> FIRE-20288: Option to render friends only
bool isNonFriendDerendered(const LLUUID& id, LLPCode pcode);
// <FS:ND> Remember objects we did derender. We might get object updates for them that create new instances. In those cases we kill them again.
private:
std::map< LLUUID, bool > mDerendered;

View File

@ -135,6 +135,7 @@
<menu_item_call label="Animation-Explorer" name="Animation Explorer"/>
<menu_item_call label="Asset-Blacklist" name="asset_blacklist"/>
<menu_item_call label="Avatar-Anzeigeeinstellungen" name="Avatar Render Settings"/>
<menu_item_check label="Nur Freunde anzeigen" name="Render Friends Only"/>
</menu>
<menu label="Bauen" name="BuildTools">
<menu_item_check label="Bauen" name="Show Build Tools"/>

View File

@ -1204,6 +1204,16 @@
function="Floater.Toggle"
parameter="fs_avatar_render_settings" />
</menu_item_call>
<menu_item_check
label="Show Friends only"
name="Render Friends Only">
<menu_item_check.on_click
function="TogglePerAccountControl"
parameter="FSRenderFriendsOnly"/>
<menu_item_check.on_check
function="CheckPerAccountControl"
parameter="FSRenderFriendsOnly"/>
</menu_item_check>
</menu>
<menu
create_jump_keys="true"