Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • alchemy-archive/alchemy
  • Liru/alchemy
  • TesticularSlingshot/alchemy
3 results
Show changes
Showing
with 698 additions and 136 deletions
......@@ -953,7 +953,7 @@ void LLViewerObjectList::update(LLAgent &agent)
std::vector<LLViewerObject*>::iterator idle_end = idle_list.begin()+idle_count;
static LLCachedControl<bool> freezeTime(gSavedSettings, "FreezeTime");
static const LLCachedControl<bool> freezeTime(gSavedSettings, "FreezeTime");
if (freezeTime)
{
......@@ -1084,7 +1084,7 @@ void LLViewerObjectList::fetchObjectCosts()
void LLViewerObjectList::reportObjectCostFailure(LLSD &objectList)
{
// TODO*: No more hard coding
for (LLSD::array_iterator it = objectList.beginArray(); it != objectList.endArray(); ++it)
for (LLSD::array_const_iterator it = objectList.beginArray(), end = objectList.endArray(); it != end; ++it)
{
gObjectList.onObjectCostFetchFailure(it->asUUID());
}
......@@ -1150,7 +1150,7 @@ void LLViewerObjectList::fetchObjectCostsCoro(std::string url)
// Success, grab the resource cost and linked set costs
// for an object if one was returned
for (LLSD::array_iterator it = idList.beginArray(); it != idList.endArray(); ++it)
for (LLSD::array_const_iterator it = idList.beginArray(), end = idList.endArray(); it != end; ++it)
{
LLUUID objectId = it->asUUID();
......@@ -1208,7 +1208,7 @@ void LLViewerObjectList::fetchPhysicsFlags()
void LLViewerObjectList::reportPhysicsFlagFailure(LLSD &objectList)
{
// TODO*: No more hard coding
for (LLSD::array_iterator it = objectList.beginArray(); it != objectList.endArray(); ++it)
for (LLSD::array_const_iterator it = objectList.beginArray(), end = objectList.endArray(); it != end; ++it)
{
gObjectList.onPhysicsFlagsFetchFailure(it->asUUID());
}
......@@ -1275,7 +1275,7 @@ void LLViewerObjectList::fetchPhisicsFlagsCoro(std::string url)
// Success, grab the resource cost and linked set costs
// for an object if one was returned
for (LLSD::array_iterator it = idList.beginArray(); it != idList.endArray(); ++it)
for (LLSD::array_const_iterator it = idList.beginArray(), end = idList.endArray(); it != end; ++it)
{
LLUUID objectId = it->asUUID();
......@@ -1782,7 +1782,7 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap)
static LLUIColor physical_object_color(LLUIColorTable::instance().getColor("NetMapPhysicalObject"));
static LLUIColor temp_object_color(LLUIColorTable::instance().getColor("NetMapTempObject"));
static LLCachedControl<F32> max_radius(gSavedSettings, "MiniMapPrimMaxRadius");
static const LLCachedControl<F32> max_radius(gSavedSettings, "MiniMapPrimMaxRadius");
const vobj_list_t::const_iterator end_it = mMapObjects.cend();
for (vobj_list_t::iterator iter = mMapObjects.begin(); iter != end_it; ++iter)
......
/**
* @file llviewerparcelaskplay.cpp
* @brief stores data about parcel media user wants to auto-play and shows related notifications
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
*
* 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
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llviewerparcelaskplay.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "llparcel.h"
#include "llstartup.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "llagent.h"
#include "llsdserialize.h"
#include <boost/lexical_cast.hpp>
// class LLViewerParcelAskPlay
LLViewerParcelAskPlay::LLViewerParcelAskPlay() :
pNotification(NULL)
{
}
LLViewerParcelAskPlay::~LLViewerParcelAskPlay()
{
}
void LLViewerParcelAskPlay::initSingleton()
{
}
void LLViewerParcelAskPlay::cleanupSingleton()
{
cancelNotification();
}
void LLViewerParcelAskPlay::askToPlay(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, ask_callback cb)
{
EAskPlayMode mode = getPlayMode(region_id, parcel_id);
switch (mode)
{
case ASK_PLAY_IGNORE:
cb(region_id, parcel_id, url, false);
break;
case ASK_PLAY_PLAY:
cb(region_id, parcel_id, url, true);
break;
case ASK_PLAY_ASK:
default:
{
// create or re-create notification
cancelNotification();
if (LLStartUp::getStartupState() > STATE_PRECACHE)
{
LLSD args;
args["URL"] = url;
LLSD payload;
payload["url"] = url; // or we can extract it from notification["substitutions"]
payload["parcel_id"] = parcel_id;
payload["region_id"] = region_id;
pNotification = LLNotificationsUtil::add("ParcelPlayingMedia", args, payload, boost::bind(onAskPlayResponse, _1, _2, cb));
}
else
{
// workaround: avoid 'new notifications arrived' on startup and just play
// (alternative: move to different channel, may be create new one...)
cb(region_id, parcel_id, url, true);
}
}
}
}
void LLViewerParcelAskPlay::cancelNotification()
{
if (pNotification)
{
if (!pNotification->isCancelled())
{
// Force a responce
// Alternative is to mark notification as unique
pNotification->setIgnored(false);
LLNotifications::getInstance()->cancel(pNotification);
}
pNotification = NULL;
}
}
void LLViewerParcelAskPlay::resetCurrentParcelSetting()
{
LLParcel *agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (agent_parcel && gAgent.getRegion())
{
LLViewerParcelAskPlay::resetSetting(gAgent.getRegion()->getRegionID(), agent_parcel->getLocalID());
}
}
void LLViewerParcelAskPlay::resetSetting(const LLUUID &region_id, const S32 &parcel_id)
{
region_map_t::iterator found = mRegionMap.find(region_id);
if (found != mRegionMap.end())
{
found->second.erase(parcel_id);
}
}
void LLViewerParcelAskPlay::resetSettings()
{
if (LLViewerParcelAskPlay::instanceExists())
{
LLViewerParcelAskPlay::getInstance()->mRegionMap.clear();
}
LLFile::remove(getAskPlayFilename());
}
void LLViewerParcelAskPlay::setSetting(const LLUUID &region_id, const S32 &parcel_id, const LLViewerParcelAskPlay::ParcelData &data)
{
mRegionMap[region_id][parcel_id] = data;
}
LLViewerParcelAskPlay::ParcelData* LLViewerParcelAskPlay::getSetting(const LLUUID &region_id, const S32 &parcel_id)
{
region_map_t::iterator found = mRegionMap.find(region_id);
if (found != mRegionMap.end())
{
parcel_data_map_t::iterator found_parcel = found->second.find(parcel_id);
if (found_parcel != found->second.end())
{
return &(found_parcel->second);
}
}
return NULL;
}
LLViewerParcelAskPlay::EAskPlayMode LLViewerParcelAskPlay::getPlayMode(const LLUUID &region_id, const S32 &parcel_id)
{
EAskPlayMode mode = ASK_PLAY_ASK;
ParcelData* data = getSetting(region_id, parcel_id);
if (data)
{
mode = data->mMode;
// refresh date
data->mDate = LLDate::now();
}
return mode;
}
void LLViewerParcelAskPlay::setPlayMode(const LLUUID &region_id, const S32 &parcel_id, LLViewerParcelAskPlay::EAskPlayMode mode)
{
ParcelData data;
data.mMode = mode;
data.mDate = LLDate::now();
setSetting(region_id, parcel_id, data);
}
//static
void LLViewerParcelAskPlay::onAskPlayResponse(const LLSD& notification, const LLSD& response, ask_callback cb)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
LLUUID region_id = notification["payload"]["region_id"];
S32 parcel_id = notification["payload"]["parcel_id"];
std::string url = notification["payload"]["url"];
bool play = option == 1;
cb(region_id, parcel_id, url, play);
LLViewerParcelAskPlay *inst = getInstance();
bool save_choice = inst->pNotification->isIgnored(); // checkbox selected
if (save_choice)
{
EAskPlayMode mode = (play) ? ASK_PLAY_PLAY : ASK_PLAY_IGNORE;
inst->setPlayMode(region_id, parcel_id, mode);
}
}
// static
std::string LLViewerParcelAskPlay::getAskPlayFilename()
{
return gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "media_autoplay.xml");
}
void LLViewerParcelAskPlay::loadSettings()
{
mRegionMap.clear();
std::string path = getAskPlayFilename();
if (!gDirUtilp->fileExists(path))
{
return;
}
LLSD autoplay_llsd;
llifstream file;
file.open(path.c_str());
if (!file.is_open())
{
return;
}
S32 status = LLSDSerialize::fromXML(autoplay_llsd, file);
file.close();
if (status == LLSDParser::PARSE_FAILURE || !autoplay_llsd.isMap())
{
return;
}
for (LLSD::map_const_iterator iter_region = autoplay_llsd.beginMap();
iter_region != autoplay_llsd.endMap(); ++iter_region)
{
LLUUID region_id = LLUUID(iter_region->first);
mRegionMap[region_id] = parcel_data_map_t();
const LLSD &parcel_map = iter_region->second;
if (parcel_map.isMap())
{
for (LLSD::map_const_iterator iter_parcel = parcel_map.beginMap();
iter_parcel != parcel_map.endMap(); ++iter_parcel)
{
if (!iter_parcel->second.isMap())
{
break;
}
S32 parcel_id = boost::lexical_cast<S32>(iter_parcel->first.c_str());
ParcelData data;
data.mMode = (EAskPlayMode)(iter_parcel->second["mode"].asInteger());
data.mDate = iter_parcel->second["date"].asDate();
mRegionMap[region_id][parcel_id] = data;
}
}
}
}
void LLViewerParcelAskPlay::saveSettings()
{
LLSD write_llsd;
std::string key;
for (region_map_t::iterator iter_region = mRegionMap.begin();
iter_region != mRegionMap.end(); ++iter_region)
{
if (iter_region->second.empty())
{
continue;
}
key = iter_region->first.asString();
write_llsd[key] = LLSD();
for (parcel_data_map_t::iterator iter_parcel = iter_region->second.begin();
iter_parcel != iter_region->second.end(); ++iter_parcel)
{
if ((iter_parcel->second.mDate.secondsSinceEpoch() + (F64SecondsImplicit)U32Days(30)) > LLTimer::getTotalSeconds())
{
// write unexpired parcels
std::string parcel_id = boost::lexical_cast<std::string>(iter_parcel->first);
write_llsd[key][parcel_id] = LLSD();
write_llsd[key][parcel_id]["mode"] = (LLSD::Integer)iter_parcel->second.mMode;
write_llsd[key][parcel_id]["date"] = iter_parcel->second.mDate;
}
}
}
llofstream file;
file.open(getAskPlayFilename().c_str());
if (file.is_open())
{
LLSDSerialize::toPrettyXML(write_llsd, file);
file.close();
}
}
/**
* @file llviewerparcelaskplay.h
* @brief stores data about parcel media user wants to auto-play and shows related notifications
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
*
* 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
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LLVIEWERPARCELASKPLAY_H
#define LLVIEWERPARCELASKPLAY_H
#include "llnotificationptr.h"
#include "lluuid.h"
class LLViewerParcelAskPlay : public LLSingleton<LLViewerParcelAskPlay>
{
LLSINGLETON(LLViewerParcelAskPlay);
~LLViewerParcelAskPlay();
void initSingleton();
void cleanupSingleton();
public:
// functor expects functor(region_id, parcel_id, url, play/stop)
typedef boost::function<void(const LLUUID&, const S32&, const std::string&, const bool&)> ask_callback;
void askToPlay(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, ask_callback cb);
void cancelNotification();
void resetCurrentParcelSetting();
void resetSetting(const LLUUID &region_id, const S32 &parcel_id);
static void resetSettings();
void loadSettings();
void saveSettings();
S32 hasData() { return !mRegionMap.empty(); } // subsitution for 'isInitialized'
private:
enum EAskPlayMode{
ASK_PLAY_IGNORE = 0,
ASK_PLAY_PLAY,
ASK_PLAY_ASK
};
class ParcelData
{
public:
LLDate mDate;
EAskPlayMode mMode;
};
void setSetting(const LLUUID &region_id, const S32 &parcel_id, const ParcelData &data);
ParcelData* getSetting(const LLUUID &region_id, const S32 &parcel_id);
EAskPlayMode getPlayMode(const LLUUID &region_id, const S32 &parcel_id);
void setPlayMode(const LLUUID &region_id, const S32 &parcel_id, EAskPlayMode);
static void onAskPlayResponse(const LLSD& notification, const LLSD& response, ask_callback cb);
static std::string getAskPlayFilename();
private:
// Variables
typedef std::map<S32, ParcelData> parcel_data_map_t;
typedef std::map<LLUUID, parcel_data_map_t> region_map_t;
region_map_t mRegionMap;
// only one notification is supposed to exists and be visible
LLNotificationPtr pNotification;
};
#endif // LLVIEWERPARCELASKPLAY_H
......@@ -24,17 +24,20 @@
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llviewerparcelmediaautoplay.h"
#include "llviewerparcelmedia.h"
#include "llparcel.h"
#include "llviewercontrol.h"
#include "llviewermedia.h"
#include "llviewerregion.h"
#include "llparcel.h"
#include "llviewerparcelaskplay.h"
#include "llviewerparcelmedia.h"
#include "llviewerparcelmgr.h"
#include "lluuid.h"
#include "message.h"
#include "llviewerregion.h"
#include "llviewertexturelist.h" // for texture stats
#include "message.h"
#include "llagent.h"
#include "llmimetypes.h"
......@@ -122,11 +125,28 @@ BOOL LLViewerParcelMediaAutoPlay::tick()
{
if (this_parcel)
{
if (gSavedSettings.getBOOL("ParcelMediaAutoPlayEnable"))
static LLCachedControl<S32> autoplay_mode(gSavedSettings, "ParcelMediaAutoPlayEnable");
switch (autoplay_mode())
{
// and last but not least, only play when autoplay is enabled
LLViewerParcelMedia::getInstance()->play(this_parcel);
}
case 0:
// Disabled
break;
case 1:
// Play, default value for ParcelMediaAutoPlayEnable
LLViewerParcelMedia::getInstance()->play(this_parcel);
break;
case 2:
default:
{
// Ask
LLViewerParcelAskPlay::getInstance()->askToPlay(this_region->getRegionID(),
this_parcel->getLocalID(),
this_parcel->getMediaURL(),
onStartMusicResponse);
break;
}
}
}
mPlayed = TRUE;
......@@ -139,5 +159,18 @@ BOOL LLViewerParcelMediaAutoPlay::tick()
return FALSE; // continue ticking forever please.
}
//static
void LLViewerParcelMediaAutoPlay::onStartMusicResponse(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, const bool &play)
{
if (play)
{
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
// make sure we are still there
if (parcel->getLocalID() == parcel_id && gAgent.getRegion()->getRegionID() == region_id)
{
LLViewerParcelMedia::getInstance()->play(parcel);
}
}
}
......@@ -38,6 +38,9 @@ public:
BOOL tick() override;
static void playStarted();
private:
static void onStartMusicResponse(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, const bool &play);
private:
S32 mLastParcelID;
LLUUID mLastRegionID;
......
......@@ -42,6 +42,7 @@
// Viewer includes
#include "llagent.h"
#include "llagentaccess.h"
#include "llviewerparcelaskplay.h"
#include "llviewerwindow.h"
#include "llviewercontrol.h"
//#include "llfirstuse.h"
......@@ -1856,7 +1857,8 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
// Only update stream if parcel changed (recreated) or music is playing (enabled)
if (!agent_parcel_update || gSavedSettings.getBOOL("MediaTentativeAutoPlay"))
{
std::string const& music_url_raw = parcel->getMusicURL();
LLViewerParcelAskPlay::getInstance()->cancelNotification();
const std::string& music_url_raw = parcel->getMusicURL();
// Trim off whitespace from front and back
std::string music_url = music_url_raw;
......@@ -1867,7 +1869,8 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
{
if (music_url.substr(0, 7) == "http://")
{
optionally_start_music(music_url);
LLViewerRegion *region = LLWorld::getInstance()->getRegion(msg->getSender());
optionally_start_music(music_url, parcel->mLocalID, region->getRegionID());
}
else
{
......@@ -1888,25 +1891,61 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
else
{
// Public land has no music
LLViewerParcelAskPlay::getInstance()->cancelNotification();
LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade();
}
}//if gAudiop
};
}
void LLViewerParcelMgr::optionally_start_music(const std::string& music_url)
//static
void LLViewerParcelMgr::onStartMusicResponse(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, const bool &play)
{
if (gSavedSettings.getBOOL("AudioStreamingMusic"))
if (play)
{
LL_INFOS("ParcelMgr") << "Starting parcel music " << url << LL_ENDL;
LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(url);
}
}
void LLViewerParcelMgr::optionally_start_music(const std::string &music_url, const S32 &local_id, const LLUUID &region_id)
{
static LLCachedControl<bool> streaming_music(gSavedSettings, "AudioStreamingMusic", true);
if (streaming_music)
{
static LLCachedControl<S32> autoplay_mode(gSavedSettings, "ParcelMediaAutoPlayEnable", 1);
static LLCachedControl<bool> tentative_autoplay(gSavedSettings, "MediaTentativeAutoPlay", true);
// only play music when you enter a new parcel if the UI control for this
// was not *explicitly* stopped by the user. (part of SL-4878)
LLPanelNearByMedia* nearby_media_panel = gStatusBar->getNearbyMediaPanel();
if ((nearby_media_panel &&
nearby_media_panel->getParcelAudioAutoStart()) ||
// or they have expressed no opinion in the UI, but have autoplay on...
(!nearby_media_panel &&
gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) &&
gSavedSettings.getBOOL("MediaTentativeAutoPlay")))
// ask mode //todo constants
if (autoplay_mode == 2)
{
// stop previous stream
LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null);
// if user set media to play - ask
if ((nearby_media_panel && nearby_media_panel->getParcelAudioAutoStart())
|| (!nearby_media_panel && tentative_autoplay))
{
LLViewerParcelAskPlay::getInstance()->askToPlay(region_id,
local_id,
music_url,
onStartMusicResponse);
}
else
{
LLViewerParcelAskPlay::getInstance()->cancelNotification();
}
}
// autoplay
else if ((nearby_media_panel
&& nearby_media_panel->getParcelAudioAutoStart())
// or they have expressed no opinion in the UI, but have autoplay on...
|| (!nearby_media_panel
&& autoplay_mode == 1
&& tentative_autoplay))
{
LL_INFOS("ParcelMgr") << "Starting parcel music " << music_url << LL_ENDL;
LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(music_url);
......
......@@ -280,7 +280,8 @@ public:
// *NOTE: Taken out 2005-03-21. Phoenix.
//void makeLandmarkAtSelection();
static void optionally_start_music(const std::string& music_url);
static void onStartMusicResponse(const LLUUID &region_id, const S32 &parcel_id, const std::string &url, const bool &play);
static void optionally_start_music(const std::string &music_url, const S32 &local_id, const LLUUID &region_id);
static void processParcelOverlay(LLMessageSystem *msg, void **user_data);
static void processParcelProperties(LLMessageSystem *msg, void **user_data);
......
......@@ -84,7 +84,7 @@ LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_
{
raw[i] = 0;
}
//mTexture->setSubImage(mImageRaw, 0, 0, mParcelGridsPerEdge, mParcelGridsPerEdge);
mTexture->setSubImage(mImageRaw, 0, 0, mParcelGridsPerEdge, mParcelGridsPerEdge);
// Create storage for ownership information from simulator
// and initialize it.
......@@ -340,12 +340,12 @@ void LLViewerParcelOverlay::updateOverlayTexture()
{
return;
}
const LLColor4U avail = LLUIColorTable::instance().getColor("PropertyColorAvail").get();
const LLColor4U owned = LLUIColorTable::instance().getColor("PropertyColorOther").get();
const LLColor4U group = LLUIColorTable::instance().getColor("PropertyColorGroup").get();
const LLColor4U self = LLUIColorTable::instance().getColor("PropertyColorSelf").get();
const LLColor4U for_sale = LLUIColorTable::instance().getColor("PropertyColorForSale").get();
const LLColor4U auction = LLUIColorTable::instance().getColor("PropertyColorAuction").get();
static const LLColor4U avail = LLUIColorTable::instance().getColor("PropertyColorAvail").get();
static const LLColor4U owned = LLUIColorTable::instance().getColor("PropertyColorOther").get();
static const LLColor4U group = LLUIColorTable::instance().getColor("PropertyColorGroup").get();
static const LLColor4U self = LLUIColorTable::instance().getColor("PropertyColorSelf").get();
static const LLColor4U for_sale = LLUIColorTable::instance().getColor("PropertyColorForSale").get();
static const LLColor4U auction = LLUIColorTable::instance().getColor("PropertyColorAuction").get();
// Create the base texture.
U8 *raw = mImageRaw->getData();
......@@ -454,11 +454,11 @@ void LLViewerParcelOverlay::updatePropertyLines()
S32 row, col;
const LLColor4U self_coloru = LLUIColorTable::instance().getColor("PropertyColorSelf").get();
const LLColor4U other_coloru = LLUIColorTable::instance().getColor("PropertyColorOther").get();
const LLColor4U group_coloru = LLUIColorTable::instance().getColor("PropertyColorGroup").get();
const LLColor4U for_sale_coloru = LLUIColorTable::instance().getColor("PropertyColorForSale").get();
const LLColor4U auction_coloru = LLUIColorTable::instance().getColor("PropertyColorAuction").get();
static const LLColor4U self_coloru = LLUIColorTable::instance().getColor("PropertyColorSelf").get();
static const LLColor4U other_coloru = LLUIColorTable::instance().getColor("PropertyColorOther").get();
static const LLColor4U group_coloru = LLUIColorTable::instance().getColor("PropertyColorGroup").get();
static const LLColor4U for_sale_coloru = LLUIColorTable::instance().getColor("PropertyColorForSale").get();
static const LLColor4U auction_coloru = LLUIColorTable::instance().getColor("PropertyColorAuction").get();
// Build into dynamic arrays, then copy into static arrays.
std::vector<LLVector3> new_vertex_array;
......
......@@ -76,9 +76,7 @@ LLViewerPart::LLViewerPart() :
mPartID(0),
mLastUpdateTime(0.f),
mSkipOffset(0.f),
mImagep(NULL),
mStartGlow(0.f),
mEndGlow(0.f)
mImagep(NULL)
{
mPartSourcep = NULL;
mParent = NULL;
......@@ -762,7 +760,7 @@ void LLViewerPartSim::updateSimulation()
if ((LLDrawable::getCurrentFrame()+mViewerPartGroups[i]->mID)%visirate == 0)
{
if (vobj && !vobj->isDead())
if (vobj && !vobj->isDead() && vobj->mDrawable)
{
gPipeline.markRebuild(vobj->mDrawable, LLDrawable::REBUILD_ALL, TRUE);
}
......
......@@ -74,8 +74,6 @@ public:
LLVector3 mAxis;
LLColor4 mColor;
LLVector2 mScale;
F32 mStartGlow;
F32 mEndGlow;
LLColor4U mGlow;
......
......@@ -79,10 +79,15 @@
#include "llcorehttputil.h"
#include "llcallstack.h"
#include "absl/container/node_hash_map.h"
#include <boost/lexical_cast.hpp>
#include "llweb.h"
#include "llcurrencywrapper.h"
// Constants
static const std::string CAP_NAME_SEED("Seed");
static const std::string CAP_NAME_OBJECT_MEDIA("ObjectMedia");
// When we receive a base grant of capabilities that has a different number of
// capabilities than the original base grant received for the region, print
// out the two lists of capabilities for analysis.
......@@ -100,7 +105,7 @@ BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE;
S32 LLViewerRegion::sLastCameraUpdated = 0;
S32 LLViewerRegion::sNewObjectCreationThrottle = -1;
typedef std::map<std::string, std::string> CapabilityMap;
typedef absl::node_hash_map<std::string, std::string> CapabilityMap;
static void log_capabilities(const CapabilityMap &capmap);
......@@ -254,7 +259,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
LL_DEBUGS("AppInit", "Capabilities") << "requesting seed caps for handle " << regionHandle
<< " name " << regionp->getName() << LL_ENDL;
std::string url = regionp->getCapability("Seed");
std::string url = regionp->getCapability(CAP_NAME_SEED);
if (url.empty())
{
LL_WARNS("AppInit", "Capabilities") << "Failed to get seed capabilities, and can not determine url!" << LL_ENDL;
......@@ -286,6 +291,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
LL_INFOS("AppInit", "Capabilities") << "Requesting seed from " << url
<< " region name " << regionp->getName()
<< " (attempt #" << mSeedCapAttempts + 1 << ")" << LL_ENDL;
LL_DEBUGS("AppInit", "Capabilities") << "Capabilities requested: " << capabilityNames << LL_ENDL;
regionp = nullptr;
LLSD result = httpAdapter->postAndSuspend(httpRequest, url, capabilityNames);
......@@ -325,7 +331,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle)
// remove the http_result from the llsd
result.erase("http_result");
for (LLSD::map_const_iterator iter = result.beginMap(); iter != result.endMap(); ++iter)
for (LLSD::map_const_iterator iter = result.beginMap(), end = result.endMap(); iter != end; ++iter)
{
regionp->setCapability(iter->first, iter->second);
......@@ -377,7 +383,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle)
break; // this error condition is not recoverable.
}
std::string url = regionp->getCapabilityDebug("Seed");
std::string url = regionp->getCapabilityDebug(CAP_NAME_SEED);
if (url.empty())
{
LL_WARNS("AppInit", "Capabilities") << "Failed to get seed capabilities, and can not determine url!" << LL_ENDL;
......@@ -413,7 +419,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle)
// remove the http_result from the llsd
result.erase("http_result");
for (LLSD::map_const_iterator iter = result.beginMap(); iter != result.endMap(); ++iter)
for (LLSD::map_const_iterator iter = result.beginMap(), end = result.endMap(); iter != end; ++iter)
{
regionp->setCapabilityDebug(iter->first, iter->second);
//LL_INFOS()<<"BaseCapabilitiesCompleteTracker New Caps "<<iter->first<<" "<< iter->second<<LL_ENDL;
......@@ -533,6 +539,13 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
mWidth(region_width_meters),
mHandle(handle),
mTimeDilation(1.0f),
mWidthScaleFactor(region_width_meters / REGION_WIDTH_METERS),
mMaxBakes(LLGridManager::getInstance()->isInSecondlife()?
LLAvatarAppearanceDefines::EBakedTextureIndex::BAKED_NUM_INDICES:
LLAvatarAppearanceDefines::EBakedTextureIndex::BAKED_LEFT_ARM),
mMaxTEs(LLGridManager::getInstance()->isInSecondlife()?
LLAvatarAppearanceDefines::ETextureIndex::TEX_NUM_INDICES:
LLAvatarAppearanceDefines::ETextureIndex::TEX_HEAD_UNIVERSAL_TATTOO),
mName(""),
mZoning(""),
mIsEstateManager(FALSE),
......@@ -841,7 +854,7 @@ BOOL LLViewerRegion::canManageEstate() const
|| gAgent.getID() == getOwner();
}
const std::string LLViewerRegion::getSimAccessString() const
const std::string& LLViewerRegion::getSimAccessString() const
{
return accessToString(mSimAccess);
}
......@@ -871,7 +884,7 @@ std::string LLViewerRegion::regionFlagsToString(U64 flags)
}
// static
std::string LLViewerRegion::accessToString(U8 sim_access)
const std::string& LLViewerRegion::accessToString(U8 sim_access)
{
switch (sim_access)
{
......@@ -907,42 +920,51 @@ std::string LLViewerRegion::accessToString(U8 sim_access)
}
// static
std::string LLViewerRegion::getAccessIcon(U8 sim_access)
const std::string& LLViewerRegion::getAccessIcon(U8 sim_access)
{
static const std::string parcel_m_dark("Parcel_M_Dark");
static const std::string parcel_r_light("Parcel_R_Light");
static const std::string parcel_pg_light("Parcel_PG_Light");
switch(sim_access)
{
case SIM_ACCESS_MATURE:
return "Parcel_M_Dark";
return parcel_m_dark;
case SIM_ACCESS_ADULT:
return "Parcel_R_Light";
return parcel_r_light;
case SIM_ACCESS_PG:
return "Parcel_PG_Light";
return parcel_pg_light;
case SIM_ACCESS_MIN:
default:
return "";
return LLStringUtil::null;
}
}
// static
std::string LLViewerRegion::accessToShortString(U8 sim_access)
const std::string& LLViewerRegion::accessToShortString(U8 sim_access)
{
static const std::string ACCESS_PG_SHORT_STR("PG");
static const std::string ACCESS_MATURE_SHORT_STR("M");
static const std::string ACCESS_ADULT_SHORT_STR("A");
static const std::string ACCESS_MIN_SHORT_STR("U");
switch(sim_access) /* Flawfinder: ignore */
{
case SIM_ACCESS_PG:
return "PG";
return ACCESS_PG_SHORT_STR;
case SIM_ACCESS_MATURE:
return "M";
return ACCESS_MATURE_SHORT_STR;
case SIM_ACCESS_ADULT:
return "A";
return ACCESS_ADULT_SHORT_STR;
case SIM_ACCESS_MIN:
default:
return "U";
return ACCESS_MIN_SHORT_STR;
}
}
......@@ -1996,7 +2018,7 @@ bool LLViewerRegion::isAlive()
return mAlive;
}
BOOL LLViewerRegion::isOwnedSelf(const LLVector3& pos)
BOOL LLViewerRegion::isOwnedSelf(const LLVector3& pos) const
{
if (mParcelOverlay)
{
......@@ -2007,7 +2029,7 @@ BOOL LLViewerRegion::isOwnedSelf(const LLVector3& pos)
}
// Owned by a group you belong to? (officer or member)
BOOL LLViewerRegion::isOwnedGroup(const LLVector3& pos)
BOOL LLViewerRegion::isOwnedGroup(const LLVector3& pos) const
{
if (mParcelOverlay)
{
......@@ -2050,10 +2072,11 @@ public:
agents = input["body"]["AgentData"];
LLSD::array_iterator
locs_it = locs.beginArray(),
locs_end = locs.endArray(),
agents_it = agents.beginArray();
BOOL has_agent_data = input["body"].has("AgentData");
for (int i=0; locs_it != locs.endArray(); i++, ++locs_it)
for (int i=0; locs_it != locs_end; i++, ++locs_it)
{
U8
x = locs_it->get("X").asInteger(),
......@@ -2063,8 +2086,8 @@ public:
if(i == target_index)
{
LLVector3d global_pos(region->getOriginGlobal());
global_pos.mdV[VX] += (F64)x;
global_pos.mdV[VY] += (F64)y;
global_pos.mdV[VX] += (F64)x * region->getWidthScaleFactor();
global_pos.mdV[VY] += (F64)y * region->getWidthScaleFactor();
global_pos.mdV[VZ] += (F64)z * 4.0;
LLAvatarTracker::instance().setTrackedCoarseLocation(global_pos);
}
......@@ -2167,8 +2190,8 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg)
if(i == target_index)
{
LLVector3d global_pos(mImpl->mOriginGlobal);
global_pos.mdV[VX] += (F64)(x_pos);
global_pos.mdV[VY] += (F64)(y_pos);
global_pos.mdV[VX] += (F64)(x_pos) * mWidthScaleFactor;
global_pos.mdV[VY] += (F64)(y_pos) * mWidthScaleFactor;
global_pos.mdV[VZ] += (F64)(z_pos) * 4.0;
LLAvatarTracker::instance().setTrackedCoarseLocation(global_pos);
}
......@@ -2301,6 +2324,17 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features)
LLCurrencyWrapper::instance().setCurrency(cur_symbol);
}
}
if (mSimulatorFeatures.has("BakesOnMeshEnabled") && (mSimulatorFeatures["BakesOnMeshEnabled"].asBoolean()==true))
{
mMaxBakes = LLAvatarAppearanceDefines::EBakedTextureIndex::BAKED_NUM_INDICES;
mMaxTEs = LLAvatarAppearanceDefines::ETextureIndex::TEX_NUM_INDICES;
}
else
{
mMaxBakes = LLAvatarAppearanceDefines::EBakedTextureIndex::BAKED_LEFT_ARM;
mMaxTEs = LLAvatarAppearanceDefines::ETextureIndex::TEX_HEAD_UNIVERSAL_TATTOO;
}
setSimulatorFeaturesReceived(true);
}
......@@ -3011,10 +3045,9 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
capabilityNames.append("NavMeshGenerationStatus");
capabilityNames.append("NewFileAgentInventory");
capabilityNames.append("ObjectAnimation");
capabilityNames.append("ObjectMedia");
capabilityNames.append(CAP_NAME_OBJECT_MEDIA);
capabilityNames.append("ObjectMediaNavigate");
capabilityNames.append("ObjectNavMeshProperties");
capabilityNames.append("OpenSimExtras");
capabilityNames.append("ParcelPropertiesUpdate");
capabilityNames.append("ParcelVoiceInfoRequest");
capabilityNames.append("ProductInfoRequest");
......@@ -3050,6 +3083,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
capabilityNames.append("UploadBakedTexture");
capabilityNames.append("UserInfo");
capabilityNames.append("ViewerAsset");
capabilityNames.append("ViewerBenefits");
capabilityNames.append("ViewerMetrics");
capabilityNames.append("ViewerStartAuction");
capabilityNames.append("ViewerStats");
......@@ -3060,9 +3094,9 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
void LLViewerRegion::setSeedCapability(const std::string& url)
{
if (getCapability("Seed") == url)
if (getCapability(CAP_NAME_SEED) == url)
{
setCapabilityDebug("Seed", url);
setCapabilityDebug(CAP_NAME_SEED, url);
LL_WARNS("CrossingCaps") << "Received duplicate seed capability, posting to seed " <<
url << LL_ENDL;
......@@ -3077,7 +3111,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
mImpl->mEventPoll = nullptr;
mImpl->mCapabilities.clear();
setCapability("Seed", url);
setCapability(CAP_NAME_SEED, url);
std::string coroname =
LLCoros::instance().launch("LLViewerRegionImpl::requestBaseCapabilitiesCoro",
......@@ -3147,8 +3181,10 @@ void LLViewerRegion::setCapability(const std::string& name, const std::string& u
mViewerAssetUrl = VIEWERASSET;
}
else
{
mViewerAssetUrl = url;
}
/*==============================================================*/
mViewerAssetUrl = url;
}
else if (name == "GetTexture")
{
......@@ -3175,8 +3211,10 @@ void LLViewerRegion::setCapabilityDebug(const std::string& name, const std::stri
mViewerAssetUrl = VIEWERASSET;
}
else
{
mViewerAssetUrl = url;
}
/*==============================================================*/
mViewerAssetUrl = url;
}
else if (name == "GetTexture")
{
......@@ -3190,7 +3228,7 @@ std::string LLViewerRegion::getCapabilityDebug(const std::string& name) const
CapabilityMap::const_iterator iter = mImpl->mSecondCapabilitiesTracker.find(name);
if (iter == mImpl->mSecondCapabilitiesTracker.end())
{
return "";
return std::string();
}
return iter->second;
......@@ -3204,7 +3242,7 @@ bool LLViewerRegion::isSpecialCapabilityName(const std::string &name)
std::string LLViewerRegion::getCapability(const std::string& name) const
{
if (!capabilitiesReceived() && (name!=std::string("Seed")) && (name!=std::string("ObjectMedia")))
if (!capabilitiesReceived() && (name != CAP_NAME_SEED) && (name != CAP_NAME_OBJECT_MEDIA))
{
LL_WARNS() << "getCapability called before caps received for " << name << LL_ENDL;
}
......@@ -3212,7 +3250,7 @@ std::string LLViewerRegion::getCapability(const std::string& name) const
CapabilityMap::const_iterator iter = mImpl->mCapabilities.find(name);
if(iter == mImpl->mCapabilities.end())
{
return "";
return std::string();
}
return iter->second;
......@@ -3220,7 +3258,7 @@ std::string LLViewerRegion::getCapability(const std::string& name) const
bool LLViewerRegion::isCapabilityAvailable(const std::string& name) const
{
if (!capabilitiesReceived() && (name!=std::string("Seed")) && (name!=std::string("ObjectMedia")))
if (!capabilitiesReceived() && (name!= CAP_NAME_SEED) && (name != CAP_NAME_OBJECT_MEDIA))
{
LL_WARNS() << "isCapabilityAvailable called before caps received for " << name << LL_ENDL;
}
......@@ -3622,8 +3660,9 @@ void LLViewerRegion::setGodnames()
if (mSimulatorFeatures["god_names"].has("full_names"))
{
LLSD god_names = mSimulatorFeatures["god_names"]["full_names"];
for (LLSD::array_iterator itr = god_names.beginArray();
itr != god_names.endArray();
for (LLSD::array_const_iterator itr = god_names.beginArray(),
ite = god_names.endArray();
itr != ite;
++itr)
{
mGodNames.insert((*itr).asString());
......@@ -3632,8 +3671,8 @@ void LLViewerRegion::setGodnames()
if (mSimulatorFeatures["god_names"].has("last_names"))
{
LLSD god_names = mSimulatorFeatures["god_names"]["last_names"];
for (LLSD::array_iterator itr = god_names.beginArray();
itr != god_names.endArray();
for (LLSD::array_const_iterator itr = god_names.beginArray(), ite = god_names.endArray();
itr != ite;
++itr)
{
mGodNames.insert((*itr).asString());
......
......@@ -38,6 +38,7 @@
#include "llframetimer.h"
#include "lleasymessagesender.h"
#include <unordered_map>
#include "absl/container/flat_hash_set.h"
// Surface id's
#define LAND 1
......@@ -192,7 +193,7 @@ public:
void setSimAccess(U8 sim_access) { mSimAccess = sim_access; }
U8 getSimAccess() const { return mSimAccess; }
const std::string getSimAccessString() const;
const std::string& getSimAccessString() const;
// Homestead-related getters; there are no setters as nobody should be
// setting them other than the individual message handler which is a member
......@@ -206,14 +207,14 @@ public:
static std::string regionFlagsToString(U64 flags);
// Returns translated version of "Mature", "PG", "Adult", etc.
static std::string accessToString(U8 sim_access);
static const std::string& accessToString(U8 sim_access);
// Returns "M", "PG", "A" etc.
static std::string accessToShortString(U8 sim_access);
static const std::string& accessToShortString(U8 sim_access);
static U8 shortStringToAccess(const std::string &sim_access);
// Return access icon name
static std::string getAccessIcon(U8 sim_access);
static const std::string& getAccessIcon(U8 sim_access);
// helper function which just makes sure all interested parties
// can process the message.
......@@ -226,7 +227,10 @@ public:
void setCacheID(const LLUUID& id);
F32 getWidth() const { return mWidth; }
F32 getWidthScaleFactor() const { return mWidthScaleFactor; } // Scaling for OpenSim VarRegions
S32 getRegionMaxBakes() const { return mMaxBakes; }
S32 getRegionMaxTEs() const { return mMaxTEs; }
void idleUpdate(F32 max_update_time);
void lightIdleUpdate();
bool addVisibleGroup(LLViewerOctreeGroup* group);
......@@ -289,10 +293,10 @@ public:
LLVLComposition *getComposition() const;
F32 getCompositionXY(const S32 x, const S32 y) const;
BOOL isOwnedSelf(const LLVector3& pos);
BOOL isOwnedSelf(const LLVector3& pos) const;
// Owned by a group you belong to? (officer OR member)
BOOL isOwnedGroup(const LLVector3& pos);
BOOL isOwnedGroup(const LLVector3& pos) const;
// deal with map object updates in the world.
void updateCoarseLocations(LLMessageSystem* msg);
......@@ -361,8 +365,8 @@ public:
friend std::ostream& operator<<(std::ostream &s, const LLViewerRegion &region);
/// implements LLCapabilityProvider
virtual std::string getDescription() const override;
std::string getLegacyHttpUrl() const { return mLegacyHttpUrl; }
std::string getViewerAssetUrl() const { return mViewerAssetUrl; }
const std::string& getLegacyHttpUrl() const { return mLegacyHttpUrl; }
const std::string& getViewerAssetUrl() const { return mViewerAssetUrl; }
U32 getNumOfVisibleGroups() const;
U32 getNumOfActiveCachedObjects() const;
......@@ -420,7 +424,7 @@ public:
U32 getWhisperRange() const;
/// "God names" surname and full account names map
std::set<std::string> getGods() const { return mGodNames; };
const auto& getGods() const { return mGodNames; };
//@}
typedef std::vector<LLPointer<LLViewerTexture> > tex_matrix_t;
......@@ -514,7 +518,9 @@ private:
U64 mHandle;
F32 mTimeDilation; // time dilation of physics simulation on simulator
S32 mLastUpdate; //last time called idleUpdate()
F32 mWidthScaleFactor; // Scaling for OpenSim VarRegions
S32 mMaxBakes; // store max bakes on the region
S32 mMaxTEs; // store max TEs on the region
// simulator name
std::string mName;
std::string mZoning;
......@@ -594,7 +600,7 @@ private:
LLFrameTimer mRenderInfoReportTimer;
mutable tex_matrix_t mWorldMapTiles;
std::set<std::string> mGodNames;
absl::flat_hash_set<std::string> mGodNames;
LLEasyMessageSender mMessageSender;
using url_mapping_t = std::unordered_multimap<std::string, std::string>;
......
......@@ -364,16 +364,19 @@ void update_statistics()
record(LLStatViewer::REBUILD_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Sort Draw State")));
record(LLStatViewer::RENDER_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Render Geometry")));
LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost());
if (cdp)
if (gAgent.getRegion() && isAgentAvatarValid())
{
sample(LLStatViewer::SIM_PING, F64Milliseconds (cdp->getPingDelay()));
gAvgSimPing = ((gAvgSimPing * gSimPingCount) + cdp->getPingDelay()) / (gSimPingCount + 1);
gSimPingCount++;
}
else
{
sample(LLStatViewer::SIM_PING, U32Seconds(10));
LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost());
if (cdp)
{
sample(LLStatViewer::SIM_PING, F64Milliseconds(cdp->getPingDelay()));
gAvgSimPing = ((gAvgSimPing * gSimPingCount) + cdp->getPingDelay()) / (gSimPingCount + 1);
gSimPingCount++;
}
else
{
sample(LLStatViewer::SIM_PING, U32Seconds(10));
}
}
if (LLViewerStats::instance().getRecording().getSum(LLStatViewer::FPS))
......
......@@ -76,7 +76,7 @@ LLViewerTexLayerSetBuffer::LLViewerTexLayerSetBuffer(LLTexLayerSet* const owner,
S32 width, S32 height) :
// ORDER_LAST => must render these after the hints are created.
LLTexLayerSetBuffer(owner),
LLViewerDynamicTexture( width, height, 4, LLViewerDynamicTexture::ORDER_LAST, TRUE ),
LLViewerDynamicTexture( width, height, 4, LLViewerDynamicTexture::ORDER_LAST, FALSE ),
mNeedsUpload(FALSE), // Not used for any logic here, just to sync sending of updates
mNumLowresUploads(0),
mUploadPending(FALSE),
......@@ -243,8 +243,16 @@ void LLViewerTexLayerSetBuffer::midRenderTexLayerSet(BOOL success)
LLViewerTexLayerSet* layer_set = getViewerTexLayerSet();
if (layer_set->isVisible())
{
layer_set->getAvatar()->debugBakedTextureUpload(layer_set->getBakedTexIndex(), FALSE); // FALSE for start of upload, TRUE for finish.
doUpload();
auto bakedTexIdx = layer_set->getBakedTexIndex();
if(bakedTexIdx <= layer_set->getAvatar()->getNumBakes())
{
layer_set->getAvatar()->debugBakedTextureUpload(bakedTexIdx, FALSE); // FALSE for start of upload, TRUE for finish.
doUpload();
}
else
{
LL_DEBUGS("Avatar") << "Skipping bake for unsupported layer on this region" << LL_ENDL;
}
}
else
{
......@@ -491,10 +499,10 @@ void LLViewerTexLayerSetBuffer::doUpload()
LLVFile file(gVFS, asset_id, LLAssetType::AT_TEXTURE);
file_size = file.getSize();
U8* data = integrity_test->allocateData(file_size);
file.read(data, file_size);
std::string asset_data;
if (data)
{
file.read(data, file_size);
asset_data.append(reinterpret_cast< char const*> (data), file_size);
valid = integrity_test->validate(data, file_size); // integrity_test will delete 'data'
}
......
......@@ -220,15 +220,10 @@ public:
image_rect.mTop = image_rect.mBottom + mImage->getHeight();
mImage->draw(LLRect(image_rect.mLeft, image_rect.mTop, image_rect.mRight, image_rect.mBottom));
LLColor4 color;
if (mEditor.getReadOnly())
{
color = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor");
}
else
{
color = LLUIColorTable::instance().getColor("TextEmbeddedItemColor");
}
static const LLUIColor text_embed_item_readonly_color = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor");
static const LLUIColor text_embed_item_color = LLUIColorTable::instance().getColor("TextEmbeddedItemColor");
const LLColor4 color = mEditor.getReadOnly() ? text_embed_item_readonly_color : text_embed_item_color;
F32 right_x;
mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, mLabel.length(), S32_MAX, &right_x);
......@@ -1048,7 +1043,7 @@ void LLViewerTextEditor::onValueChange(S32 start, S32 end)
void LLViewerTextEditor::findEmbeddedItemSegments(S32 start, S32 end)
{
LLWString text = getWText();
const LLWString& text = getWText();
// Start with i just after the first embedded item
for(S32 idx = start; idx < end; idx++ )
......
......@@ -332,7 +332,7 @@ public:
BOOL needsAux() const { return mNeedsAux; }
// Host we think might have this image, used for baked av textures.
void setTargetHost(LLHost host) { mTargetHost = host; }
void setTargetHost(const LLHost& host) { mTargetHost = host; }
LLHost getTargetHost() const { return mTargetHost; }
// Set the decode priority for this image...
......
......@@ -231,8 +231,8 @@ void LLViewerTextureList::doPrefetchImages()
file.close();
}
S32 texture_count = 0;
for (LLSD::array_iterator iter = imagelist.beginArray();
iter != imagelist.endArray(); ++iter)
for (LLSD::array_const_iterator iter = imagelist.beginArray(), end = imagelist.endArray();
iter != end; ++iter)
{
LLSD imagesd = *iter;
LLUUID uuid = imagesd["uuid"];
......
......@@ -206,7 +206,7 @@ private:
// Request image from a specific host, used for baked avatar textures.
// Implemented in header in case someone changes default params above. JC
LLViewerFetchedTexture* getImageFromHost(const LLUUID& image_id, FTType f_type, LLHost host)
LLViewerFetchedTexture* getImageFromHost(const LLUUID& image_id, FTType f_type, const LLHost& host)
{ return getImage(image_id, f_type, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); }
public:
......
......@@ -49,7 +49,7 @@ class LLOverrideBakedTextureUpdate
public:
LLOverrideBakedTextureUpdate(bool temp_state)
{
U32 num_bakes = (U32) LLAvatarAppearanceDefines::BAKED_NUM_INDICES;
U32 num_bakes = (U32) gAgentAvatarp->getNumBakes();
for( U32 index = 0; index < num_bakes; ++index )
{
composite_enabled[index] = gAgentAvatarp->isCompositeUpdateEnabled(index);
......@@ -59,7 +59,7 @@ public:
~LLOverrideBakedTextureUpdate()
{
U32 num_bakes = (U32)LLAvatarAppearanceDefines::BAKED_NUM_INDICES;
U32 num_bakes = (U32) gAgentAvatarp->getNumBakes();
for( U32 index = 0; index < num_bakes; ++index )
{
gAgentAvatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]);
......
......@@ -224,11 +224,11 @@ static const U8 NO_FACE = 255;
BOOL gQuietSnapshot = FALSE;
// Minimum value for UIScaleFactor, also defined in preferences, ui_scale_slider
static const F32 MIN_UI_SCALE = 0.75f;
static const F32 MIN_UI_SCALE = 0.5f;
// 4.0 in preferences, but win10 supports larger scaling and value is used more as
// sanity check, so leaving space for larger values from DPI updates.
static const F32 MAX_UI_SCALE = 7.0f;
static const F32 MIN_DISPLAY_SCALE = 0.75f;
static const F32 MIN_DISPLAY_SCALE = 0.5f;
static LLCachedControl<std::string> sSnapshotBaseName(LLCachedControl<std::string>(gSavedPerAccountSettings, "SnapshotBaseName", "Snapshot"));
static LLCachedControl<std::string> sSnapshotDir(LLCachedControl<std::string>(gSavedPerAccountSettings, "SnapshotBaseDir", ""));
......@@ -1529,6 +1529,11 @@ void LLViewerWindow::handleScrollWheel(LLWindow *window, S32 clicks)
handleScrollWheel( clicks );
}
void LLViewerWindow::handleScrollHWheel(LLWindow *window, S32 clicks)
{
handleScrollHWheel(clicks);
}
void LLViewerWindow::handleWindowBlock(LLWindow *window)
{
send_agent_pause();
......@@ -2690,7 +2695,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
if( keyboard_focus )
{
if ((focusedFloaterName == "nearby_chat") || (focusedFloaterName == "im_container") || (focusedFloaterName == "impanel"))
if ((focusedFloaterName == "chatbar") || (focusedFloaterName == "nearby_chat") || (focusedFloaterName == "im_container") || (focusedFloaterName == "impanel"))
{
if (gSavedSettings.getBOOL("ArrowKeysAlwaysMove"))
{
......@@ -2901,6 +2906,49 @@ void LLViewerWindow::handleScrollWheel(S32 clicks)
return;
}
void LLViewerWindow::handleScrollHWheel(S32 clicks)
{
LLUI::getInstance()->resetMouseIdleTimer();
LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
if (mouse_captor)
{
S32 local_x;
S32 local_y;
mouse_captor->screenPointToLocal(mCurrentMousePoint.mX, mCurrentMousePoint.mY, &local_x, &local_y);
mouse_captor->handleScrollHWheel(local_x, local_y, clicks);
if (LLView::sDebugMouseHandling)
{
LL_INFOS() << "Scroll Horizontal Wheel handled by captor " << mouse_captor->getName() << LL_ENDL;
}
return;
}
LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
if (top_ctrl)
{
S32 local_x;
S32 local_y;
top_ctrl->screenPointToLocal(mCurrentMousePoint.mX, mCurrentMousePoint.mY, &local_x, &local_y);
if (top_ctrl->handleScrollHWheel(local_x, local_y, clicks)) return;
}
if (mRootView->handleScrollHWheel(mCurrentMousePoint.mX, mCurrentMousePoint.mY, clicks))
{
if (LLView::sDebugMouseHandling)
{
LL_INFOS() << "Scroll Horizontal Wheel" << LLView::sMouseHandlerMessage << LL_ENDL;
}
return;
}
else if (LLView::sDebugMouseHandling)
{
LL_INFOS() << "Scroll Horizontal Wheel not handled by view" << LL_ENDL;
}
return;
}
void LLViewerWindow::addPopup(LLView* popup)
{
if (mPopupView)
......@@ -2978,24 +3026,24 @@ void append_xui_tooltip(LLView* viewp, LLToolTip::Params& params)
}
}
static LLTrace::BlockTimerStatHandle ftm("Update UI");
static LLTrace::BlockTimerStatHandle FTM_UPDATE_UI("Update UI");
// Update UI based on stored mouse position from mouse-move
// event processing.
void LLViewerWindow::updateUI()
{
LL_RECORD_BLOCK_TIME(ftm);
LL_RECORD_BLOCK_TIME(FTM_UPDATE_UI);
static std::string last_handle_msg;
if (gLoggedInTime.getStarted())
{
static LLCachedControl<F32> dest_hint_timeout(gSavedSettings, "DestinationGuideHintTimeout");
static const LLCachedControl<F32> dest_hint_timeout(gSavedSettings, "DestinationGuideHintTimeout");
if (gLoggedInTime.getElapsedTimeF32() > dest_hint_timeout)
{
LLFirstUse::notUsingDestinationGuide();
}
static LLCachedControl<F32> sidepanel_hint_timeout(gSavedSettings, "SidePanelHintTimeout");
static const LLCachedControl<F32> sidepanel_hint_timeout(gSavedSettings, "SidePanelHintTimeout");
if (gLoggedInTime.getElapsedTimeF32() > sidepanel_hint_timeout)
{
LLFirstUse::notUsingSidePanel();
......@@ -3554,7 +3602,7 @@ void LLViewerWindow::updateMouseDelta()
LLVector2 mouse_vel;
static LLCachedControl<bool> mouseSmooth(gSavedSettings, "MouseSmooth");
static const LLCachedControl<bool> mouseSmooth(gSavedSettings, "MouseSmooth");
if (mouseSmooth)
{
static F32 fdx = 0.f;
......@@ -4162,7 +4210,7 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de
}
// [RLVa:KB] - Checked: RLVa-1.2.0
if ( (found) && ((gTeleportDisplay) || ((rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_INTERACT)))) )
if ( (found) && ((gTeleportDisplay) || ((rlv_handler_t::isEnabled()) && (RlvHandler::instance().hasBehaviour(RLV_BHVR_INTERACT)))) )
{
// Allow picking if:
// - the drag-and-drop tool is active (allows inventory offers)
......@@ -4697,7 +4745,8 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
if ((image_width <= gGLManager.mGLMaxTextureSize && image_height <= gGLManager.mGLMaxTextureSize) &&
(image_width > window_width || image_height > window_height) && LLPipeline::sRenderDeferred && !show_ui)
{
if (scratch_space.allocate(image_width, image_height, GL_DEPTH_COMPONENT24, true, true))
U32 color_fmt = type == LLSnapshotModel::SNAPSHOT_TYPE_DEPTH ? GL_DEPTH_COMPONENT : GL_RGBA;
if (scratch_space.allocate(image_width, image_height, color_fmt, true, true))
{
original_width = gPipeline.mDeferredScreen.getWidth();
original_height = gPipeline.mDeferredScreen.getHeight();
......@@ -5661,9 +5710,9 @@ void LLPickInfo::fetchResults()
mPickPt = mMousePt;
// [RLVa:KB] - Checked: RLVa-2.2 (@setoverlay)
if ( (gRlvHandler.isEnabled()) && (hit_object) && (!hit_object->isHUDAttachment()) )
if ( (RlvHandler::instance().isEnabled()) && (hit_object) && (!hit_object->isHUDAttachment()) )
{
if (gRlvHandler.hitTestOverlay(mMousePt))
if (RlvHandler::instance().hitTestOverlay(mMousePt))
{
hit_object = nullptr;
}
......