diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d341e98a38..044bfe853e 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -90,6 +90,17 @@ Value + + RLVaBlockedExperiences + + Comment + List of experiences blocked from interacting with RLVa + Persist + 1 + Type + String + Value + bfe25fb4-222c-11e5-85a2-fa4c4ccaa202 + RLVaCompatibilityModeList Comment @@ -189,6 +200,17 @@ Value 1 + RLVaExperienceMaturityThreshold + + Comment + Specifies the minimum maturity an experience has to be before it can interact with RLVa (0: never; 1: PG; 2: Mature; 3: Adult) + Persist + 1 + Type + S32 + Value + 2 + RLVaHideLockedLayers Comment diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index a4eddc5aeb..f3b26d537b 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -84,9 +84,11 @@ void RlvNotifications::onGiveToRLVConfirmation(const LLSD& notification, const L bool RlvSettings::s_fCompositeFolders = false; #endif // RLV_EXPERIMENTAL_COMPOSITEFOLDERS bool RlvSettings::s_fCanOOC = true; +U8 RlvSettings::s_nExperienceMinMaturity = 0; bool RlvSettings::s_fLegacyNaming = true; bool RlvSettings::s_fNoSetEnv = false; bool RlvSettings::s_fTempAttach = true; +std::list RlvSettings::s_BlockedExperiences; std::list RlvSettings::s_CompatItemCreators; std::list RlvSettings::s_CompatItemNames; @@ -122,6 +124,10 @@ void RlvSettings::initClass() if (gSavedSettings.controlExists(RLV_SETTING_TOPLEVELMENU)) gSavedSettings.getControl(RLV_SETTING_TOPLEVELMENU)->getSignal()->connect(boost::bind(&onChangedMenuLevel)); + int nMinMaturity = gSavedSettings.getS32("RLVaExperienceMaturityThreshold"); + s_nExperienceMinMaturity = (nMinMaturity == 0) ? 0 : ((nMinMaturity == 1) ? SIM_ACCESS_PG : ((nMinMaturity == 2) ? SIM_ACCESS_MATURE : SIM_ACCESS_ADULT)); + boost::split(s_BlockedExperiences, gSavedSettings.getString("RLVaBlockedExperiences"), boost::is_any_of(";")); + fInitialized = true; } } @@ -224,6 +230,18 @@ bool RlvSettings::isCompatibilityModeObject(const LLUUID& idRlvObject) return fCompatMode; } +bool RlvSettings::isAllowedExperience(const LLUUID& idExperience, U8 nMaturity) +{ + // An experience is allowed to interact with RLVa if: + // - temporary attachments can interact with RLVa + // - the user set a minimum maturity and the specified maturity is equal or higher + // - the experience isn't explicitly blocked (NOTE: case-sensitive string comparison) + return + (getEnableTemporaryAttachments()) && + (s_nExperienceMinMaturity) && (s_nExperienceMinMaturity <= nMaturity) && + (s_BlockedExperiences.end() == std::find(s_BlockedExperiences.begin(), s_BlockedExperiences.end(), idExperience.asString())); +} + // ============================================================================ // RlvStrings // diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h index bdc0dbc94a..8a36e97aa6 100644 --- a/indra/newview/rlvcommon.h +++ b/indra/newview/rlvcommon.h @@ -106,6 +106,8 @@ public: static void initCompatibilityMode(std::string strCompatList); static bool isCompatibilityModeObject(const LLUUID& idRlvObject); + static bool isAllowedExperience(const LLUUID& idExperience, U8 nMaturity); + static void initClass(); static void onChangedSettingMain(const LLSD& sdValue); protected: @@ -121,9 +123,11 @@ protected: */ protected: static bool s_fCanOOC; + static U8 s_nExperienceMinMaturity; static bool s_fLegacyNaming; static bool s_fNoSetEnv; static bool s_fTempAttach; + static std::list s_BlockedExperiences; static std::list s_CompatItemCreators; static std::list s_CompatItemNames; }; diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 88beb6a00f..11d7f51c18 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -883,7 +883,7 @@ void RlvHandler::onDetach(const LLViewerObject* pAttachObj, const LLViewerJointA void RlvHandler::onExperienceAttach(const LLSD& sdExperience, const std::string& strObjName) { - if (sdExperience["maturity"].asInteger() != SIM_ACCESS_ADULT) + if (!RlvSettings::isAllowedExperience(sdExperience[LLExperienceCache::EXPERIENCE_ID].asUUID(), sdExperience[LLExperienceCache::MATURITY].asInteger())) { addBlockedObject(LLUUID::null, strObjName);