Persist avatar render settings (visual mute settings)
parent
12bd27aa2e
commit
485e8d2b4f
|
|
@ -127,6 +127,7 @@ set(viewer_SOURCE_FILES
|
|||
floatermedialists.cpp
|
||||
fsareasearch.cpp
|
||||
fsareasearchmenu.cpp
|
||||
fsavatarrenderpersistence.cpp
|
||||
fsavatarsearchmenu.cpp
|
||||
fsblocklistmenu.cpp
|
||||
fschathistory.cpp
|
||||
|
|
@ -864,6 +865,7 @@ set(viewer_HEADER_FILES
|
|||
floatermedialists.h
|
||||
fsareasearch.h
|
||||
fsareasearchmenu.h
|
||||
fsavatarrenderpersistence.h
|
||||
fsavatarsearchmenu.h
|
||||
fsblocklistmenu.h
|
||||
fschathistory.h
|
||||
|
|
|
|||
|
|
@ -0,0 +1,122 @@
|
|||
/**
|
||||
* @file fsavatarrenderpersistence.cpp
|
||||
* @brief Firestorm avatar render settings persistence
|
||||
*
|
||||
* $LicenseInfo:firstyear=2016&license=viewerlgpl$
|
||||
* Copyright (c) 2016 Ansariel Hiller @ Second Life
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
|
||||
* http://www.firestormviewer.org
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "fsavatarrenderpersistence.h"
|
||||
#include "llsdserialize.h"
|
||||
|
||||
FSAvatarRenderPersistence::FSAvatarRenderPersistence()
|
||||
{
|
||||
}
|
||||
|
||||
FSAvatarRenderPersistence::~FSAvatarRenderPersistence()
|
||||
{
|
||||
saveAvatarRenderSettings();
|
||||
}
|
||||
|
||||
void FSAvatarRenderPersistence::init()
|
||||
{
|
||||
LL_INFOS() << "Initializing avatar render persistence manager..." << LL_ENDL;
|
||||
loadAvatarRenderSettings();
|
||||
}
|
||||
|
||||
LLVOAvatar::VisualMuteSettings FSAvatarRenderPersistence::getAvatarRenderSettings(const LLUUID& avatar_id)
|
||||
{
|
||||
avatar_render_setting_t::iterator found = mAvatarRenderMap.find(avatar_id);
|
||||
if (found != mAvatarRenderMap.end())
|
||||
{
|
||||
return found->second;
|
||||
}
|
||||
|
||||
return LLVOAvatar::VisualMuteSettings::AV_RENDER_NORMALLY;
|
||||
}
|
||||
|
||||
void FSAvatarRenderPersistence::setAvatarRenderSettings(const LLUUID& avatar_id, LLVOAvatar::VisualMuteSettings render_settings)
|
||||
{
|
||||
if (render_settings == LLVOAvatar::VisualMuteSettings::AV_RENDER_NORMALLY)
|
||||
{
|
||||
avatar_render_setting_t::iterator found = mAvatarRenderMap.find(avatar_id);
|
||||
if (found != mAvatarRenderMap.end())
|
||||
{
|
||||
mAvatarRenderMap.erase(found);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mAvatarRenderMap[avatar_id] = render_settings;
|
||||
}
|
||||
}
|
||||
|
||||
void FSAvatarRenderPersistence::loadAvatarRenderSettings()
|
||||
{
|
||||
const std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "avatar_render_settings.xml");
|
||||
|
||||
if (LLFile::isfile(filename))
|
||||
{
|
||||
llifstream file(filename.c_str());
|
||||
if (!file.is_open())
|
||||
{
|
||||
LL_WARNS() << "Failed to open avatar render settings file." << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
LLSD data;
|
||||
LLSDSerialize::fromXMLDocument(data, file);
|
||||
file.close();
|
||||
|
||||
mAvatarRenderMap.clear();
|
||||
for (LLSD::map_const_iterator it = data.beginMap(); it != data.endMap(); ++it)
|
||||
{
|
||||
LLUUID avatar_id(it->first);
|
||||
LLVOAvatar::VisualMuteSettings render_settings = (LLVOAvatar::VisualMuteSettings)it->second.asInteger();
|
||||
|
||||
mAvatarRenderMap[avatar_id] = render_settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FSAvatarRenderPersistence::saveAvatarRenderSettings()
|
||||
{
|
||||
LL_INFOS() << "Saving avatar render settings..." << LL_ENDL;
|
||||
|
||||
const std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "avatar_render_settings.xml");
|
||||
|
||||
LLSD data(LLSD::emptyMap());
|
||||
|
||||
for (avatar_render_setting_t::iterator it = mAvatarRenderMap.begin(); it != mAvatarRenderMap.end(); ++it)
|
||||
{
|
||||
data[it->first.asString()] = (S32)it->second;
|
||||
}
|
||||
|
||||
llofstream file(filename.c_str());
|
||||
if (!file.is_open())
|
||||
{
|
||||
LL_WARNS() << "Unable to save avatar render settings!" << LL_ENDL;
|
||||
return;
|
||||
}
|
||||
LLSDSerialize::toPrettyXML(data, file);
|
||||
file.close();
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* @file fsavatarrenderpersistence.h
|
||||
* @brief Firestorm avatar render settings persistence
|
||||
*
|
||||
* $LicenseInfo:firstyear=2016&license=viewerlgpl$
|
||||
* Copyright (c) 2016 Ansariel Hiller @ Second Life
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
|
||||
* http://www.firestormviewer.org
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef FS_AVATARRENDERPERSISTENCE_H
|
||||
#define FS_AVATARRENDERPERSISTENCE_H
|
||||
|
||||
#include "llsingleton.h"
|
||||
#include "llvoavatar.h"
|
||||
|
||||
class FSAvatarRenderPersistence
|
||||
: public LLSingleton<FSAvatarRenderPersistence>
|
||||
{
|
||||
LOG_CLASS(FSAvatarRenderPersistence);
|
||||
|
||||
friend class LLSingleton<FSAvatarRenderPersistence>;
|
||||
friend class FSPanelPreferenceBackup;
|
||||
|
||||
public:
|
||||
void init();
|
||||
LLVOAvatar::VisualMuteSettings getAvatarRenderSettings(const LLUUID& avatar_id);
|
||||
void setAvatarRenderSettings(const LLUUID& avatar_id, LLVOAvatar::VisualMuteSettings render_settings);
|
||||
|
||||
private:
|
||||
FSAvatarRenderPersistence();
|
||||
virtual ~FSAvatarRenderPersistence();
|
||||
|
||||
void loadAvatarRenderSettings();
|
||||
void saveAvatarRenderSettings();
|
||||
|
||||
typedef std::map<LLUUID, LLVOAvatar::VisualMuteSettings> avatar_render_setting_t;
|
||||
avatar_render_setting_t mAvatarRenderMap;
|
||||
};
|
||||
|
||||
#endif // FS_AVATARRENDERPERSISTENCE_H
|
||||
|
|
@ -129,6 +129,7 @@
|
|||
|
||||
// Firestorm Includes
|
||||
#include "exogroupmutelist.h"
|
||||
#include "fsavatarrenderpersistence.h"
|
||||
#include "fsdroptarget.h"
|
||||
#include "fsfloaterimcontainer.h"
|
||||
#include "growlmanager.h"
|
||||
|
|
@ -4820,6 +4821,9 @@ void FSPanelPreferenceBackup::onClickBackupSettings()
|
|||
std::string backup_per_account_name = gDirUtilp->getExpandedFilename(LL_PATH_NONE, backup_per_account_folder,
|
||||
LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount"));
|
||||
|
||||
// Make sure to persist settings to file before we copy them
|
||||
FSAvatarRenderPersistence::instance().saveAvatarRenderSettings();
|
||||
|
||||
LL_INFOS("SettingsBackup") << "copying per account settings" << LL_ENDL;
|
||||
// create per-user folder if it doesn't exist yet
|
||||
LLFile::mkdir(backup_per_account_folder.c_str());
|
||||
|
|
@ -5146,6 +5150,7 @@ void FSPanelPreferenceBackup:: doRestoreSettings(const LLSD& notification, const
|
|||
exoGroupMuteList::instance().loadMuteList();
|
||||
}
|
||||
#endif
|
||||
FSAvatarRenderPersistence::instance().loadAvatarRenderSettings();
|
||||
|
||||
LLPanelMainInventory::sSaveFilters = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@
|
|||
#include "growlmanager.h"
|
||||
#endif
|
||||
|
||||
#include "fsavatarrenderpersistence.h"
|
||||
#include "fscommon.h"
|
||||
#include "fsdata.h"
|
||||
#include "fsfloatercontacts.h"
|
||||
|
|
@ -1920,6 +1921,9 @@ bool idle_startup()
|
|||
// Otherwise it is only create if isChatMultriTab() == true and LLIMFloaterContainer::getInstance is called
|
||||
// Moved here from llfloaternearbyvchat.cpp by Zi, to make this work even if LogShowHistory is FALSE
|
||||
LLFloater *pContacts(FSFloaterContacts::getInstance());
|
||||
|
||||
// <FS:Ansariel> Load persisted avatar render settings
|
||||
FSAvatarRenderPersistence::instance().init();
|
||||
|
||||
// Do something with pContacts so no overzealous optimizer optimzes our neat little call to FSFloaterContacts::getInstance() away.
|
||||
if( pContacts )
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@
|
|||
#include "llnetmap.h"
|
||||
#include "llviewernetwork.h" // [FS:CR] isInSecondlife()
|
||||
#include "llsidepanelappearance.h"
|
||||
#include "fsavatarrenderpersistence.h"
|
||||
|
||||
extern F32 SPEED_ADJUST_MAX;
|
||||
extern F32 SPEED_ADJUST_MAX_SEC;
|
||||
|
|
@ -758,6 +759,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
|
|||
mMeshTexturesDirty = FALSE;
|
||||
mHeadp = NULL;
|
||||
|
||||
// <FS:Ansariel> Load persisted avatar render settings
|
||||
mVisuallyMuteSetting = FSAvatarRenderPersistence::instance().getAvatarRenderSettings(id);
|
||||
|
||||
// set up animation variables
|
||||
mSpeed = 0.f;
|
||||
|
|
@ -9304,6 +9307,8 @@ void LLVOAvatar::setVisualMuteSettings(VisualMuteSettings set)
|
|||
{
|
||||
mVisuallyMuteSetting = set;
|
||||
mNeedsImpostorUpdate = TRUE;
|
||||
// <FS:Ansariel> Load persisted avatar render settings
|
||||
FSAvatarRenderPersistence::instance().setAvatarRenderSettings(getID(), set);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -79,6 +79,9 @@
|
|||
<row name="restore_per_account_row_presets">
|
||||
<column name="restore_per_account_files_label">Voreinstellungen</column>
|
||||
</row>
|
||||
<row name="restore_per_account_row_avatar_render_settings">
|
||||
<column name="restore_per_account_files_label">Avatar Darstel.-Einst.</column>
|
||||
</row>
|
||||
</scroll_list>
|
||||
</layout_panel>
|
||||
<layout_panel name="lp_restore_folders">
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ Settings groups to be restored (backup will always save all):
|
|||
<layout_stack
|
||||
name="ls_list_view_stack"
|
||||
follows="top|left|right"
|
||||
height="215"
|
||||
height="220"
|
||||
orientation="horizontal"
|
||||
top_pad="4"
|
||||
left="1"
|
||||
|
|
@ -243,6 +243,11 @@ Settings groups to be restored (backup will always save all):
|
|||
<column name="restore_per_account_files_label">Presets</column>
|
||||
<column name="value">presets</column>
|
||||
</row>
|
||||
<row name="restore_per_account_row_avatar_render_settings" value="avatar_render_settings">
|
||||
<column type="checkbox" name="restore_per_account_files_check" value="true" />
|
||||
<column name="restore_per_account_files_label">Avatar Render Settings</column>
|
||||
<column name="value">avatar_render_settings.xml</column>
|
||||
</row>
|
||||
</scroll_list>
|
||||
<!-- since enabled_control does not work properly on scroll list items and
|
||||
enabling/disabling in code did not show any visual difference, we just use
|
||||
|
|
|
|||
Loading…
Reference in New Issue