Added buttons on sounds explorer window to mute all attached / rezzed sounds by avatar

master
Rohacan Hirons 2025-06-09 01:35:21 +02:00
parent 744d3dddf3
commit f85c085f5f
9 changed files with 181 additions and 2 deletions

View File

@ -131,7 +131,10 @@ public:
AT_GLTF = 58, // gltf json document
AT_GLTF_BIN = 59, // gltf binary data
AT_COUNT = 60,
AT_AVATAR_ATTACHED_SOUNDS = 60, // Black list avatar attached sounds
AT_AVATAR_REZZED_SOUNDS = 61, // Black list avatar rezzed sounds
AT_COUNT = 62,
// +*********************************************************+
// | TO ADD AN ELEMENT TO THIS ENUM: |

View File

@ -162,6 +162,9 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
LLInventoryType::IT_MATERIAL, // 57 AT_MATERIAL
LLInventoryType::IT_GLTF, // 58 AT_GLTF
LLInventoryType::IT_GLTF_BIN, // 59 AT_GLTF_BIN
LLInventoryType::IT_NONE, // 60 AT_AVATAR_ATTACHED_SOUNDS
LLInventoryType::IT_NONE, // 61 AT_AVATAR_REZZED_SOUNDS
};
// static

View File

@ -75,6 +75,8 @@ bool NACLFloaterExploreSounds::postBuild()
getChild<LLButton>("stop_btn")->setClickedCallback(boost::bind(&NACLFloaterExploreSounds::handleStop, this));
getChild<LLButton>("bl_btn")->setClickedCallback(boost::bind(&NACLFloaterExploreSounds::blacklistSound, this));
getChild<LLButton>("stop_locally_btn")->setClickedCallback(boost::bind(&NACLFloaterExploreSounds::handleStopLocally, this));
getChild<LLButton>("block_avatar_attached_sounds_btn")->setClickedCallback(boost::bind(&NACLFloaterExploreSounds::blacklistAvatarAttachedSounds, this));
getChild<LLButton>("block_avatar_rezzed_sounds_btn")->setClickedCallback(boost::bind(&NACLFloaterExploreSounds::blacklistAvatarRezzedSounds, this));
mHistoryScroller = getChild<LLScrollListCtrl>("sound_list");
mHistoryScroller->setCommitCallback(boost::bind(&NACLFloaterExploreSounds::handleSelection, this));
@ -500,6 +502,7 @@ void NACLFloaterExploreSounds::blacklistSound()
}
}
void NACLFloaterExploreSounds::onBlacklistAvatarNameCacheCallback(const LLUUID& av_id, const LLAvatarName& av_name, const LLUUID& asset_id, const std::string& region_name)
{
blacklist_avatar_name_cache_connection_map_t::iterator it = mBlacklistAvatarNameCacheConnections.find(av_id);
@ -513,3 +516,126 @@ void NACLFloaterExploreSounds::onBlacklistAvatarNameCacheCallback(const LLUUID&
}
FSAssetBlacklist::getInstance()->addNewItemToBlacklist(asset_id, av_name.getCompleteName(), region_name, LLAssetType::AT_SOUND);
}
// add avatar attached sounds to blacklist
void NACLFloaterExploreSounds::blacklistAvatarAttachedSounds()
{
std::vector<LLScrollListItem*> selection = mHistoryScroller->getAllSelected();
std::vector<LLScrollListItem*>::iterator selection_iter = selection.begin();
std::vector<LLScrollListItem*>::iterator selection_end = selection.end();
for (; selection_iter != selection_end; ++selection_iter)
{
LLSoundHistoryItem item = getItem((*selection_iter)->getValue());
if (item.mID.isNull())
{
continue;
}
std::string region_name;
LLViewerRegion* cur_region = gAgent.getRegion();
if (cur_region)
{
region_name = cur_region->getName();
}
blacklist_avatar_name_cache_connection_map_t::iterator it = mBlacklistAvatarNameCacheConnections.find(item.mOwnerID);
if (it != mBlacklistAvatarNameCacheConnections.end())
{
if (it->second.connected())
{
it->second.disconnect();
}
mBlacklistAvatarNameCacheConnections.erase(it);
}
LLAvatarNameCache::callback_connection_t cb = LLAvatarNameCache::get(
item.mOwnerID,
boost::bind(&NACLFloaterExploreSounds::onBlacklistAvatarAttachedSoundsNameCacheCallback, this, _1, _2, item.mOwnerID, region_name));
mBlacklistAvatarNameCacheConnections.insert(std::make_pair(item.mOwnerID, cb));
}
}
void NACLFloaterExploreSounds::onBlacklistAvatarAttachedSoundsNameCacheCallback(const LLUUID& av_id,
const LLAvatarName& av_name,
const LLUUID& owner_id,
const std::string& region_name)
{
blacklist_avatar_name_cache_connection_map_t::iterator it = mBlacklistAvatarNameCacheConnections.find(av_id);
if (it != mBlacklistAvatarNameCacheConnections.end())
{
if (it->second.connected())
{
it->second.disconnect();
}
mBlacklistAvatarNameCacheConnections.erase(it);
}
FSAssetBlacklist::getInstance()->addNewItemToBlacklist(owner_id, av_name.getCompleteName(), region_name, LLAssetType::AT_AVATAR_ATTACHED_SOUNDS);
}
// add avatar rezzed sounds to blacklist
void NACLFloaterExploreSounds::blacklistAvatarRezzedSounds()
{
std::vector<LLScrollListItem*> selection = mHistoryScroller->getAllSelected();
std::vector<LLScrollListItem*>::iterator selection_iter = selection.begin();
std::vector<LLScrollListItem*>::iterator selection_end = selection.end();
for (; selection_iter != selection_end; ++selection_iter)
{
LLSoundHistoryItem item = getItem((*selection_iter)->getValue());
if (item.mID.isNull())
{
continue;
}
std::string region_name;
LLViewerRegion* cur_region = gAgent.getRegion();
if (cur_region)
{
region_name = cur_region->getName();
}
blacklist_avatar_name_cache_connection_map_t::iterator it = mBlacklistAvatarNameCacheConnections.find(item.mOwnerID);
if (it != mBlacklistAvatarNameCacheConnections.end())
{
if (it->second.connected())
{
it->second.disconnect();
}
mBlacklistAvatarNameCacheConnections.erase(it);
}
LLAvatarNameCache::callback_connection_t cb =
LLAvatarNameCache::get(item.mOwnerID,
boost::bind(&NACLFloaterExploreSounds::onBlacklistAvatarRezzedSoundsNameCacheCallback,
this,
_1,
_2,
item.mOwnerID,
region_name));
mBlacklistAvatarNameCacheConnections.insert(std::make_pair(item.mOwnerID, cb));
}
}
void NACLFloaterExploreSounds::onBlacklistAvatarRezzedSoundsNameCacheCallback(const LLUUID& av_id,
const LLAvatarName& av_name,
const LLUUID& owner_id,
const std::string& region_name)
{
blacklist_avatar_name_cache_connection_map_t::iterator it = mBlacklistAvatarNameCacheConnections.find(av_id);
if (it != mBlacklistAvatarNameCacheConnections.end())
{
if (it->second.connected())
{
it->second.disconnect();
}
mBlacklistAvatarNameCacheConnections.erase(it);
}
FSAssetBlacklist::getInstance()->addNewItemToBlacklist(owner_id,
av_name.getCompleteName(),
region_name,
LLAssetType::AT_AVATAR_REZZED_SOUNDS);
}

View File

@ -32,6 +32,8 @@ private:
void handleStopLocally();
void handleSelection();
void blacklistSound();
void blacklistAvatarAttachedSounds();
void blacklistAvatarRezzedSounds();
LLScrollListCtrl* mHistoryScroller;
LLCheckBoxCtrl* mCollisionSounds;
@ -46,8 +48,10 @@ private:
typedef std::map<LLUUID, boost::signals2::connection> blacklist_avatar_name_cache_connection_map_t;
blacklist_avatar_name_cache_connection_map_t mBlacklistAvatarNameCacheConnections;
void onBlacklistAvatarNameCacheCallback(const LLUUID& av_id, const LLAvatarName& av_name, const LLUUID& asset_id, const std::string& region_name);
void onBlacklistAvatarAttachedSoundsNameCacheCallback(const LLUUID& av_id, const LLAvatarName& av_name, const LLUUID& asset_id, const std::string& region_name);
void onBlacklistAvatarRezzedSoundsNameCacheCallback(const LLUUID& av_id, const LLAvatarName& av_name, const LLUUID& asset_id, const std::string& region_name);
};
#endif

View File

@ -60,6 +60,12 @@ LLAssetType::EType S32toAssetType(S32 assetindex)
case 45:
type = LLAssetType::AT_PERSON;
break;
case 60:
type = LLAssetType::AT_AVATAR_ATTACHED_SOUNDS;
break;
case 61:
type = LLAssetType::AT_AVATAR_REZZED_SOUNDS;
break;
default:
type = LLAssetType::AT_NONE;
}

View File

@ -104,6 +104,10 @@ std::string FSFloaterAssetBlacklist::getTypeString(S32 type)
return getString("asset_animation");
case LLAssetType::AT_PERSON:
return getString("asset_resident");
case LLAssetType::AT_AVATAR_ATTACHED_SOUNDS:
return getString("asset_avatar_attached_sounds");
case LLAssetType::AT_AVATAR_REZZED_SOUNDS:
return getString("asset_avatar_rezzed_sounds");
default:
return getString("asset_unknown");
}

View File

@ -4714,6 +4714,18 @@ void process_sound_trigger(LLMessageSystem *msg, void **)
{
return;
}
if (object_id == owner_id)
{
if (FSAssetBlacklist::getInstance()->isBlacklisted(owner_id, LLAssetType::AT_AVATAR_ATTACHED_SOUNDS))
{
return;
}
}
else if (FSAssetBlacklist::getInstance()->isBlacklisted(owner_id, LLAssetType::AT_AVATAR_REZZED_SOUNDS))
{
return;
}
// </FS>
// NaCl - Antispam Registry
@ -4824,6 +4836,17 @@ void process_preload_sound(LLMessageSystem *msg, void **user_data)
{
return;
}
if (object_id == owner_id)
{
if (FSAssetBlacklist::getInstance()->isBlacklisted(owner_id, LLAssetType::AT_AVATAR_ATTACHED_SOUNDS))
{
return;
}
}
else if (FSAssetBlacklist::getInstance()->isBlacklisted(owner_id, LLAssetType::AT_AVATAR_REZZED_SOUNDS))
{
return;
}
// </FS>
// NaCl - Antispam Registry

View File

@ -52,4 +52,8 @@
<button bottom_delta="0" follows="left|bottom" height="20" label="Stop" name="stop_btn" right="-10" width="95" enabled="false"/>
<button bottom_delta="0" follows="left|bottom" height="20" label="Blacklist" name="bl_btn" right="-110" width="95" enabled="false"/>
<button bottom_delta="25" follows="left|bottom" height="20" label="Block attached sounds by avatar" name="block_avatar_attached_sounds_btn" left="10" width="195" enabled="true"/>
<button bottom_delta="0" follows="left|bottom" height="20" label="Block rezzed sounds by avatar" name="block_avatar_rezzed_sounds_btn" left_delta="200" width="195" enabled="true"/>
</floater>

View File

@ -27,6 +27,12 @@
<floater.string name="asset_resident">
Resident
</floater.string>
<floater.string name="asset_avatar_attached_sounds">
Avatar Attached Sounds
</floater.string>
<floater.string name="asset_avatar_rezzed_sounds">
Avatar Rezzed Sounds
</floater.string>
<floater.string name="asset_unknown">
Unknown
</floater.string>