diff options
Diffstat (limited to 'indra')
347 files changed, 3554 insertions, 2244 deletions
diff --git a/indra/fix-incredibuild.py b/indra/fix-incredibuild.py deleted file mode 100755 index 678ee4329e..0000000000 --- a/indra/fix-incredibuild.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python3 -## -## $LicenseInfo:firstyear=2011&license=viewerlgpl$ -## Second Life Viewer Source Code -## Copyright (C) 2011, 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$ - -import sys -import os -import glob - -def delete_file_types(path, filetypes): - if os.path.exists(path): - print('Cleaning: ' + path) - orig_dir = os.getcwd(); - os.chdir(path) - filelist = [] - for type in filetypes: - filelist.extend(glob.glob(type)) - for file in filelist: - os.remove(file) - os.chdir(orig_dir) - -def main(): - build_types = ['*.exp','*.exe','*.pdb','*.idb', - '*.ilk','*.lib','*.obj','*.ib_pdb_index'] - pch_types = ['*.pch'] - delete_file_types("build-vc80/newview/Release", build_types) - delete_file_types("build-vc80/newview/secondlife-bin.dir/Release/", - pch_types) - delete_file_types("build-vc80/newview/RelWithDebInfo", build_types) - delete_file_types("build-vc80/newview/secondlife-bin.dir/RelWithDebInfo/", - pch_types) - delete_file_types("build-vc80/newview/Debug", build_types) - delete_file_types("build-vc80/newview/secondlife-bin.dir/Debug/", - pch_types) - - - delete_file_types("build-vc80/test/RelWithDebInfo", build_types) - delete_file_types("build-vc80/test/test.dir/RelWithDebInfo/", - pch_types) - - -if __name__ == "__main__": - main() diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index 43ee78519d..b46edf573c 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -24,12 +24,6 @@ * $/LicenseInfo$ */ -#if LL_MSVC -// disable warning about boost::lexical_cast returning uninitialized data -// when it fails to parse the string -#pragma warning (disable:4701) -#endif - #include "linden_common.h" #include "llavatarappearance.h" @@ -46,14 +40,6 @@ #include "boost/bind.hpp" #include "boost/tokenizer.hpp" - -#if LL_MSVC -// disable boost::lexical_cast warning -#pragma warning (disable:4702) -#endif - -#include <boost/lexical_cast.hpp> - using namespace LLAvatarAppearanceDefines; //----------------------------------------------------------------------------- @@ -230,7 +216,7 @@ void LLAvatarAppearance::initInstance() for (U32 lod = 0; lod < mesh_dict->mLOD; lod++) { LLAvatarJointMesh* mesh = createAvatarJointMesh(); - std::string mesh_name = "m" + mesh_dict->mName + boost::lexical_cast<std::string>(lod); + std::string mesh_name = "m" + mesh_dict->mName + std::to_string(lod); // We pre-pended an m - need to capitalize first character for camelCase mesh_name[1] = toupper(mesh_name[1]); mesh->setName(mesh_name); diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp index 42a37c4e16..e4e9e8d550 100644 --- a/indra/llappearance/llpolymesh.cpp +++ b/indra/llappearance/llpolymesh.cpp @@ -321,7 +321,7 @@ bool LLPolyMeshSharedData::loadMesh( const std::string& fileName ) } if (!isLOD()) { - mHasWeights = (hasWeights==0) ? false : true; + mHasWeights = hasWeights > 0; } //---------------------------------------------------------------- diff --git a/indra/llappearance/lltexlayerparams.cpp b/indra/llappearance/lltexlayerparams.cpp index 8ad718a506..19eb0c784d 100644 --- a/indra/llappearance/lltexlayerparams.cpp +++ b/indra/llappearance/lltexlayerparams.cpp @@ -294,7 +294,7 @@ bool LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) // Don't load the image file until we actually need it the first time. Like now. mStaticImageTGA = LLTexLayerStaticImageList::getInstance()->getImageTGA(info->mStaticImageFileName); // We now have something in one of our caches - LLTexLayerSet::sHasCaches |= mStaticImageTGA.notNull() ? true : false; + LLTexLayerSet::sHasCaches |= mStaticImageTGA.notNull(); if (mStaticImageTGA.isNull()) { @@ -319,7 +319,7 @@ bool LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) mCachedProcessedTexture = gTextureManagerBridgep->getLocalTexture(image_tga_width, image_tga_height, 1, false); // We now have something in one of our caches - LLTexLayerSet::sHasCaches |= mCachedProcessedTexture ? true : false; + LLTexLayerSet::sHasCaches |= mCachedProcessedTexture.notNull(); mCachedProcessedTexture->setExplicitFormat(GL_ALPHA8, GL_ALPHA); } diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index a387bb23cd..ece0a12a7a 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -398,7 +398,7 @@ void LLAudioEngine::idle() for (source_map::value_type& src_pair : mAllSources) { LLAudioSource *sourcep = src_pair.second; - if (sourcep->isMuted() && sourcep->isSyncMaster() && sourcep->getPriority() > max_sm_priority) + if (!sourcep->isMuted() && sourcep->isSyncMaster() && sourcep->getPriority() > max_sm_priority) { sync_masterp = sourcep; master_channelp = sync_masterp->getChannel(); diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp index 44e95c4e7f..a277014ca5 100644 --- a/indra/llcharacter/llbvhloader.cpp +++ b/indra/llcharacter/llbvhloader.cpp @@ -1202,7 +1202,7 @@ void LLBVHLoader::optimize() // because it's significantly faster. if (diff_max > 0) { - if (ki_max->mIgnoreRot == true) + if (ki_max->mIgnoreRot) { ki_max->mIgnoreRot = false; joint->mNumRotKeys++; diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index fa87ad8c29..2706e2ed31 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -509,7 +509,8 @@ LLMotion::LLMotionInitStatus LLKeyframeMotion::onInitialize(LLCharacter *charact } else { - LL_INFOS("Animation") << "Attempted to fetch animation " << mName << " with null id for character " << mCharacter->getID() << LL_ENDL; + LL_INFOS("Animation") << "Attempted to fetch animation '" << mName << "' with null id" + << " for character " << mCharacter->getID() << LL_ENDL; } return STATUS_HOLD; @@ -661,14 +662,13 @@ bool LLKeyframeMotion::setupPose() //----------------------------------------------------------------------------- bool LLKeyframeMotion::onActivate() { - // If the keyframe anim has an associated emote, trigger it. - if( mJointMotionList->mEmoteName.length() > 0 ) + // If the keyframe anim has an associated emote, trigger it. + if (mJointMotionList->mEmoteID.notNull()) { - LLUUID emote_anim_id = gAnimLibrary.stringToAnimState(mJointMotionList->mEmoteName); // don't start emote if already active to avoid recursion - if (!mCharacter->isMotionActive(emote_anim_id)) + if (!mCharacter->isMotionActive(mJointMotionList->mEmoteID)) { - mCharacter->startMotion( emote_anim_id ); + mCharacter->startMotion(mJointMotionList->mEmoteID); } } @@ -1237,15 +1237,23 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo U16 version; U16 sub_version; + // Amimation identifier for log messages + auto asset = [&]() -> std::string + { + return asset_id.asString() + ", char " + mCharacter->getID().asString(); + }; + if (!dp.unpackU16(version, "version")) { - LL_WARNS() << "can't read version number for animation " << asset_id << LL_ENDL; + LL_WARNS() << "can't read version number" + << " for animation " << asset() << LL_ENDL; return false; } if (!dp.unpackU16(sub_version, "sub_version")) { - LL_WARNS() << "can't read sub version number for animation " << asset_id << LL_ENDL; + LL_WARNS() << "can't read sub version number" + << " for animation " << asset() << LL_ENDL; return false; } @@ -1257,18 +1265,18 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { #if LL_RELEASE LL_WARNS() << "Bad animation version " << version << "." << sub_version - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; #else LL_ERRS() << "Bad animation version " << version << "." << sub_version - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; #endif } if (!dp.unpackS32(temp_priority, "base_priority")) { LL_WARNS() << "can't read animation base_priority" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } joint_motion_list->mBasePriority = (LLJoint::JointPriority) temp_priority; @@ -1281,7 +1289,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo else if (joint_motion_list->mBasePriority < LLJoint::USE_MOTION_PRIORITY) { LL_WARNS() << "bad animation base_priority " << joint_motion_list->mBasePriority - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1291,7 +1299,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackF32(joint_motion_list->mDuration, "duration")) { LL_WARNS() << "can't read duration" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1299,7 +1307,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(joint_motion_list->mDuration)) { LL_WARNS() << "invalid animation duration" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1308,16 +1316,34 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo //------------------------------------------------------------------------- if (!dp.unpackString(joint_motion_list->mEmoteName, "emote_name")) { - LL_WARNS() << "can't read optional_emote_animation" - << " for animation " << asset_id << LL_ENDL; + LL_WARNS() << "can't read emote_name" + << " for animation " << asset() << LL_ENDL; return false; } - if(joint_motion_list->mEmoteName==mID.asString()) + if (!joint_motion_list->mEmoteName.empty()) { - LL_WARNS() << "Malformed animation mEmoteName==mID" - << " for animation " << asset_id << LL_ENDL; - return false; + if (joint_motion_list->mEmoteName == mID.asString()) + { + LL_WARNS() << "Malformed animation mEmoteName==mID" + << " for animation " << asset() << LL_ENDL; + return false; + } + // "Closed_Mouth" is a very popular emote name we should ignore + if (joint_motion_list->mEmoteName == "Closed_Mouth") + { + joint_motion_list->mEmoteName.clear(); + } + else + { + joint_motion_list->mEmoteID = gAnimLibrary.stringToAnimState(joint_motion_list->mEmoteName); + if (joint_motion_list->mEmoteID.isNull()) + { + LL_WARNS() << "unknown emote_name '" << joint_motion_list->mEmoteName << "'" + << " for animation " << asset() << LL_ENDL; + joint_motion_list->mEmoteName.clear(); + } + } } //------------------------------------------------------------------------- @@ -1327,7 +1353,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(joint_motion_list->mLoopInPoint)) { LL_WARNS() << "can't read loop point" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1335,7 +1361,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(joint_motion_list->mLoopOutPoint)) { LL_WARNS() << "can't read loop point" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1343,7 +1369,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(loop, "loop")) { LL_WARNS() << "can't read loop" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } joint_motion_list->mLoop = static_cast<bool>(loop); @@ -1353,7 +1379,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo LLUUID const formal_female_land_anim("6a9a173b-61fa-3ad5-01fa-a851cfc5f66a"); if (female_land_anim == asset_id || formal_female_land_anim == asset_id) { - LL_WARNS() << "Animation(" << asset_id << ") won't be looped." << LL_ENDL; + LL_WARNS() << "Animation " << asset() << " won't be looped." << LL_ENDL; joint_motion_list->mLoop = false; } @@ -1364,7 +1390,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(joint_motion_list->mEaseInDuration)) { LL_WARNS() << "can't read easeIn" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1372,7 +1398,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(joint_motion_list->mEaseOutDuration)) { LL_WARNS() << "can't read easeOut" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1383,14 +1409,14 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU32(word, "hand_pose")) { LL_WARNS() << "can't read hand pose" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } - if(word > LLHandMotion::NUM_HAND_POSES) + if (word > LLHandMotion::NUM_HAND_POSES) { LL_WARNS() << "invalid LLHandMotion::eHandPose index: " << word - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1400,25 +1426,25 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo // get number of joint motions //------------------------------------------------------------------------- U32 num_motions = 0; - S32 rotation_dupplicates = 0; - S32 position_dupplicates = 0; + S32 rotation_duplicates = 0; + S32 position_duplicates = 0; if (!dp.unpackU32(num_motions, "num_joints")) { LL_WARNS() << "can't read number of joints" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if (num_motions == 0) { LL_WARNS() << "no joints" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } else if (num_motions > LL_CHARACTER_MAX_ANIMATED_JOINTS) { LL_WARNS() << "too many joints" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1431,7 +1457,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo // initialize joint motions //------------------------------------------------------------------------- - for(U32 i=0; i<num_motions; ++i) + for (U32 i = 0; i < num_motions; ++i) { JointMotion* joint_motion = new JointMotion; joint_motion_list->mJointMotionArray.push_back(joint_motion); @@ -1440,14 +1466,14 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackString(joint_name, "joint_name")) { LL_WARNS() << "can't read joint name" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if (joint_name == "mScreen" || joint_name == "mRoot") { LL_WARNS() << "attempted to animate special " << joint_name << " joint" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1465,14 +1491,14 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo LL_WARNS() << "Joint will be omitted from animation: joint_num " << joint_num << " is outside of legal range [0-" << LL_CHARACTER_MAX_ANIMATED_JOINTS << ") for joint " << joint->getName() - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; joint = NULL; } } else { LL_WARNS() << "invalid joint name: " << joint_name - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; if (!allow_invalid_joints) { return false; @@ -1493,14 +1519,14 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(joint_priority, "joint_priority")) { LL_WARNS() << "can't read joint priority." - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if (joint_priority < LLJoint::USE_MOTION_PRIORITY) { LL_WARNS() << "joint priority unknown - too low." - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1519,7 +1545,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(joint_motion->mRotationCurve.mNumKeys, "num_rot_keys") || joint_motion->mRotationCurve.mNumKeys < 0) { LL_WARNS() << "can't read number of rotation keys" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1545,7 +1571,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(time)) { LL_WARNS() << "can't read rotation key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1555,7 +1581,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU16(time_short, "time")) { LL_WARNS() << "can't read rotation key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1564,7 +1590,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (time < 0 || time > joint_motion_list->mDuration) { LL_WARNS() << "invalid frame time" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } } @@ -1578,12 +1604,14 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { if (!dp.unpackVector3(rot_angles, "rot_angles")) { - LL_WARNS() << "can't read rot_angles in rotation key (" << k << ")" << LL_ENDL; + LL_WARNS() << "can't read rot_angles in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; return false; } if (!rot_angles.isFinite()) { - LL_WARNS() << "non-finite angle in rotation key (" << k << ")" << LL_ENDL; + LL_WARNS() << "non-finite angle in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; return false; } @@ -1594,17 +1622,20 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { if (!dp.unpackU16(x, "rot_angle_x")) { - LL_WARNS() << "can't read rot_angle_x in rotation key (" << k << ")" << LL_ENDL; + LL_WARNS() << "can't read rot_angle_x in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; return false; } if (!dp.unpackU16(y, "rot_angle_y")) { - LL_WARNS() << "can't read rot_angle_y in rotation key (" << k << ")" << LL_ENDL; + LL_WARNS() << "can't read rot_angle_y in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; return false; } if (!dp.unpackU16(z, "rot_angle_z")) { - LL_WARNS() << "can't read rot_angle_z in rotation key (" << k << ")" << LL_ENDL; + LL_WARNS() << "can't read rot_angle_z in rotation key (" << k << ")" + << " for animation " << asset() << LL_ENDL; return false; } @@ -1613,19 +1644,19 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo rot_vec.mV[VY] = U16_to_F32(y, -1.f, 1.f); rot_vec.mV[VZ] = U16_to_F32(z, -1.f, 1.f); - if(!rot_vec.isFinite()) + if (!rot_vec.isFinite()) { LL_WARNS() << "non-finite angle in rotation key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } rot_key.mRotation.unpackFromVector3(rot_vec); } - if(!rot_key.mRotation.isFinite()) + if (!rot_key.mRotation.isFinite()) { LL_WARNS() << "non-finite angle in rotation key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1634,8 +1665,10 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (joint_motion->mRotationCurve.mNumKeys > joint_motion->mRotationCurve.mKeys.size()) { - rotation_dupplicates++; - LL_INFOS() << "Motion: " << asset_id << " had dupplicate rotation keys that were removed" << LL_ENDL; + rotation_duplicates++; + LL_INFOS() << "Motion " << asset() << " had duplicated rotation keys that were removed: " + << joint_motion->mRotationCurve.mNumKeys << " > " << joint_motion->mRotationCurve.mKeys.size() + << " (" << rotation_duplicates << ")" << LL_ENDL; } //--------------------------------------------------------------------- @@ -1644,7 +1677,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(joint_motion->mPositionCurve.mNumKeys, "num_pos_keys") || joint_motion->mPositionCurve.mNumKeys < 0) { LL_WARNS() << "can't read number of position keys" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1670,7 +1703,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo !llfinite(pos_key.mTime)) { LL_WARNS() << "can't read position key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } } @@ -1679,7 +1712,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU16(time_short, "time")) { LL_WARNS() << "can't read position key (" << k << ")" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1690,7 +1723,8 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { if (!dp.unpackVector3(pos_key.mPosition, "pos")) { - LL_WARNS() << "can't read pos in position key (" << k << ")" << LL_ENDL; + LL_WARNS() << "can't read pos in position key (" << k << ")" + << " for animation " << asset() << LL_ENDL; return false; } @@ -1706,17 +1740,20 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU16(x, "pos_x")) { - LL_WARNS() << "can't read pos_x in position key (" << k << ")" << LL_ENDL; + LL_WARNS() << "can't read pos_x in position key (" << k << ")" + << " for animation " << asset() << LL_ENDL; return false; } if (!dp.unpackU16(y, "pos_y")) { - LL_WARNS() << "can't read pos_y in position key (" << k << ")" << LL_ENDL; + LL_WARNS() << "can't read pos_y in position key (" << k << ")" + << " for animation " << asset() << LL_ENDL; return false; } if (!dp.unpackU16(z, "pos_z")) { - LL_WARNS() << "can't read pos_z in position key (" << k << ")" << LL_ENDL; + LL_WARNS() << "can't read pos_z in position key (" << k << ")" + << " for animation " << asset() << LL_ENDL; return false; } @@ -1725,10 +1762,10 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo pos_key.mPosition.mV[VZ] = U16_to_F32(z, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET); } - if(!pos_key.mPosition.isFinite()) + if (!pos_key.mPosition.isFinite()) { LL_WARNS() << "non-finite position in key" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1742,20 +1779,25 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (joint_motion->mPositionCurve.mNumKeys > joint_motion->mPositionCurve.mKeys.size()) { - position_dupplicates++; + position_duplicates++; + LL_INFOS() << "Motion " << asset() << " had duplicated position keys that were removed: " + << joint_motion->mPositionCurve.mNumKeys << " > " << joint_motion->mPositionCurve.mKeys.size() + << " (" << position_duplicates << ")" << LL_ENDL; } joint_motion->mUsage = joint_state->getUsage(); } - if (rotation_dupplicates > 0) + if (rotation_duplicates > 0) { - LL_INFOS() << "Motion: " << asset_id << " had " << rotation_dupplicates << " dupplicate rotation keys that were removed" << LL_ENDL; + LL_INFOS() << "Motion " << asset() << " had " << rotation_duplicates + << " duplicated rotation keys that were removed" << LL_ENDL; } - if (position_dupplicates > 0) + if (position_duplicates > 0) { - LL_INFOS() << "Motion: " << asset_id << " had " << position_dupplicates << " dupplicate position keys that were removed" << LL_ENDL; + LL_INFOS() << "Motion " << asset() << " had " << position_duplicates + << " duplicated position keys that were removed" << LL_ENDL; } //------------------------------------------------------------------------- @@ -1765,14 +1807,14 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackS32(num_constraints, "num_constraints")) { LL_WARNS() << "can't read number of constraints" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if (num_constraints > MAX_CONSTRAINTS || num_constraints < 0) { LL_WARNS() << "Bad number of constraints... ignoring: " << num_constraints - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; } else { @@ -1789,7 +1831,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackU8(byte, "chain_length")) { LL_WARNS() << "can't read constraint chain length" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } constraintp->mChainLength = (S32) byte; @@ -1797,21 +1839,21 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if((U32)constraintp->mChainLength > joint_motion_list->getNumJointMotions()) { LL_WARNS() << "invalid constraint chain length" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if (!dp.unpackU8(byte, "constraint_type")) { LL_WARNS() << "can't read constraint type" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if( byte >= NUM_CONSTRAINT_TYPES ) { LL_WARNS() << "invalid constraint type" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } constraintp->mConstraintType = (EConstraintType)byte; @@ -1821,7 +1863,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "source_volume")) { LL_WARNS() << "can't read source volume name" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1831,28 +1873,28 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (constraintp->mSourceConstraintVolume == -1) { LL_WARNS() << "not a valid source constraint volume " << str - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if (!dp.unpackVector3(constraintp->mSourceConstraintOffset, "source_offset")) { LL_WARNS() << "can't read constraint source offset" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if( !(constraintp->mSourceConstraintOffset.isFinite()) ) { LL_WARNS() << "non-finite constraint source offset" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "target_volume")) { LL_WARNS() << "can't read target volume name" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1870,7 +1912,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (constraintp->mTargetConstraintVolume == -1) { LL_WARNS() << "not a valid target constraint volume " << str - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } } @@ -1878,28 +1920,28 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackVector3(constraintp->mTargetConstraintOffset, "target_offset")) { LL_WARNS() << "can't read constraint target offset" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if( !(constraintp->mTargetConstraintOffset.isFinite()) ) { LL_WARNS() << "non-finite constraint target offset" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if (!dp.unpackVector3(constraintp->mTargetConstraintDir, "target_dir")) { LL_WARNS() << "can't read constraint target direction" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if( !(constraintp->mTargetConstraintDir.isFinite()) ) { LL_WARNS() << "non-finite constraint target direction" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1912,28 +1954,28 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start") || !llfinite(constraintp->mEaseInStartTime)) { LL_WARNS() << "can't read constraint ease in start time" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop") || !llfinite(constraintp->mEaseInStopTime)) { LL_WARNS() << "can't read constraint ease in stop time" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start") || !llfinite(constraintp->mEaseOutStartTime)) { LL_WARNS() << "can't read constraint ease out start time" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop") || !llfinite(constraintp->mEaseOutStopTime)) { LL_WARNS() << "can't read constraint ease out stop time" - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } @@ -1953,7 +1995,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo { LL_WARNS() << "Joint with no parent: " << joint->getName() << " Emote: " << joint_motion_list->mEmoteName - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } joint = parent; @@ -1965,10 +2007,10 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if ( !constraint_joint ) { LL_WARNS() << "Invalid joint " << j - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } - + if(constraint_joint == joint) { constraintp->mJointStateIndices[i] = (S32)j; @@ -1978,7 +2020,7 @@ bool LLKeyframeMotion::deserialize(LLDataPacker& dp, const LLUUID& asset_id, boo if (constraintp->mJointStateIndices[i] < 0 ) { LL_WARNS() << "No joint index for constraint " << i - << " for animation " << asset_id << LL_ENDL; + << " for animation " << asset() << LL_ENDL; return false; } } @@ -2243,10 +2285,12 @@ void LLKeyframeMotion::setEmote(const LLUUID& emote_id) if (emote_name) { mJointMotionList->mEmoteName = emote_name; + mJointMotionList->mEmoteID = emote_id; } else { - mJointMotionList->mEmoteName = ""; + mJointMotionList->mEmoteName.clear(); + mJointMotionList->mEmoteID.setNull(); } } diff --git a/indra/llcharacter/llkeyframemotion.h b/indra/llcharacter/llkeyframemotion.h index 4acebeba27..be9f35d3e4 100644 --- a/indra/llcharacter/llkeyframemotion.h +++ b/indra/llcharacter/llkeyframemotion.h @@ -412,7 +412,9 @@ public: // mEmoteName is a facial motion, but it's necessary to appear here so that it's cached. // TODO: LLKeyframeDataCache::getKeyframeData should probably return a class containing // JointMotionList and mEmoteName, see LLKeyframeMotion::onInitialize. - std::string mEmoteName; + std::string mEmoteName; + LLUUID mEmoteID; + public: JointMotionList(); ~JointMotionList(); diff --git a/indra/llcommon/StackWalker.cpp b/indra/llcommon/StackWalker.cpp index 4ecff4ee69..2c1bc47d0e 100644 --- a/indra/llcommon/StackWalker.cpp +++ b/indra/llcommon/StackWalker.cpp @@ -1256,7 +1256,7 @@ bool StackWalker::ShowCallstack(bool verbose, HANDLE hThread, const CONTEXT *con cleanup: if (pSym) free( pSym ); - if (bLastEntryCalled == false) + if (!bLastEntryCalled) this->OnCallstackEntry(lastEntry, csEntry); if (context == NULL) diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 8275f80f75..2f41c039f2 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -474,7 +474,7 @@ void LLApp::disableCrashlogger() // static bool LLApp::isCrashloggerDisabled() { - return (sDisableCrashlogger == true); + return sDisableCrashlogger; } // static diff --git a/indra/llcommon/lldoubledispatch.h b/indra/llcommon/lldoubledispatch.h index 8ed295b6f1..ce6731e864 100644 --- a/indra/llcommon/lldoubledispatch.h +++ b/indra/llcommon/lldoubledispatch.h @@ -255,7 +255,7 @@ private: }; /// shared_ptr manages Entry lifespan for us - typedef boost::shared_ptr<EntryBase> EntryPtr; + typedef std::shared_ptr<EntryBase> EntryPtr; /// use a @c list to make it easy to insert typedef std::list<EntryPtr> DispatchTable; DispatchTable mDispatch; diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 4dd7b69fc2..6211362615 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -1070,7 +1070,7 @@ namespace LLError // // NOTE!!! Requires external mutex lock!!! template <typename RECORDER> - std::pair<boost::shared_ptr<RECORDER>, Recorders::iterator> + std::pair<std::shared_ptr<RECORDER>, Recorders::iterator> findRecorderPos(SettingsConfigPtr &s) { // Since we promise to return an iterator, use a classic iterator @@ -1081,7 +1081,7 @@ namespace LLError // *it is a RecorderPtr, a shared_ptr<Recorder>. Use a // dynamic_pointer_cast to try to downcast to test if it's also a // shared_ptr<RECORDER>. - auto ptr = boost::dynamic_pointer_cast<RECORDER>(*it); + auto ptr = std::dynamic_pointer_cast<RECORDER>(*it); if (ptr) { // found the entry we want @@ -1101,7 +1101,7 @@ namespace LLError // shared_ptr might be empty (operator!() returns true) if there was no // such RECORDER subclass instance in mRecorders. template <typename RECORDER> - boost::shared_ptr<RECORDER> findRecorder() + std::shared_ptr<RECORDER> findRecorder() { SettingsConfigPtr s = Globals::getInstance()->getSettingsConfig(); LLMutexLock lock(&s->mRecorderMutex); @@ -1134,7 +1134,7 @@ namespace LLError if (!file_name.empty()) { - boost::shared_ptr<RecordToFile> recordToFile(new RecordToFile(file_name)); + std::shared_ptr<RecordToFile> recordToFile(new RecordToFile(file_name)); if (recordToFile->okay()) { addRecorder(recordToFile); diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index 57f10b7895..77b187a80f 100644 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -174,7 +174,7 @@ namespace LLError bool mWantsMultiline; }; - typedef boost::shared_ptr<Recorder> RecorderPtr; + typedef std::shared_ptr<Recorder> RecorderPtr; /** * Instantiate GenericRecorder with a callable(level, message) to get diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index 1a305ec3dc..70931f3a65 100644 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -211,12 +211,21 @@ void LLEventPumps::clear() } } -void LLEventPumps::reset() +void LLEventPumps::reset(bool log_pumps) { // Reset every known LLEventPump instance. Leave it up to each instance to // decide what to do with the reset() call. + if (log_pumps) + { + LL_INFOS() << "Resetting " << (S32)mPumpMap.size() << " pumps" << LL_ENDL; + } + for (PumpMap::value_type& pair : mPumpMap) { + if (log_pumps) + { + LL_INFOS() << "Resetting pump " << pair.first << LL_ENDL; + } pair.second->reset(); } } @@ -373,9 +382,11 @@ std::string LLEventPump::inventName(const std::string& pfx) void LLEventPump::clear() { + LLMutexLock lock(&mConnectionListMutex); // Destroy the original LLStandardSignal instance, replacing it with a // whole new one. mSignal = std::make_shared<LLStandardSignal>(); + mConnections.clear(); } @@ -383,6 +394,7 @@ void LLEventPump::reset() { // Resetting mSignal is supposed to disconnect everything on its own // But due to crash on 'reset' added explicit cleanup to get more data + LLMutexLock lock(&mConnectionListMutex); ConnectionMap::const_iterator iter = mConnections.begin(); ConnectionMap::const_iterator end = mConnections.end(); while (iter!=end) @@ -407,6 +419,8 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL return LLBoundListener(); } + LLMutexLock lock(&mConnectionListMutex); + float nodePosition = 1.0; // if the supplied name is empty we are not interested in the ordering mechanism @@ -566,8 +580,9 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL return bound; } -LLBoundListener LLEventPump::getListener(const std::string& name) const +LLBoundListener LLEventPump::getListener(const std::string& name) { + LLMutexLock lock(&mConnectionListMutex); ConnectionMap::const_iterator found = mConnections.find(name); if (found != mConnections.end()) { @@ -579,6 +594,7 @@ LLBoundListener LLEventPump::getListener(const std::string& name) const void LLEventPump::stopListening(const std::string& name) { + LLMutexLock lock(&mConnectionListMutex); ConnectionMap::iterator found = mConnections.find(name); if (found != mConnections.end()) { diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index c1dbf4392f..bebcfacdcb 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -332,7 +332,7 @@ public: * Reset all known LLEventPump instances * workaround for DEV-35406 crash on shutdown */ - void reset(); + void reset(bool log_pumps = false); private: friend class LLEventPump; @@ -558,7 +558,7 @@ public: /// Get the LLBoundListener associated with the passed name (dummy /// LLBoundListener if not found) - virtual LLBoundListener getListener(const std::string& name) const; + virtual LLBoundListener getListener(const std::string& name); /** * Instantiate one of these to block an existing connection: * @code @@ -601,6 +601,7 @@ private: LLHandle<LLEventPumps> mRegistry; std::string mName; + LLMutex mConnectionListMutex; protected: virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&, diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 9edc7e40f3..e0d0ab9ac7 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -627,7 +627,7 @@ namespace LLInitParam UserData* mUserData; }; - typedef boost::shared_ptr<ParamDescriptor> ParamDescriptorPtr; + typedef std::shared_ptr<ParamDescriptor> ParamDescriptorPtr; // each derived Block class keeps a static data structure maintaining offsets to various params class LL_COMMON_API BlockDescriptor diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index 8f88e728ce..b2b1162f63 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -462,10 +462,10 @@ private: LLProcessPtr mChild; LLTempBoundListener mStdinConnection, mStdoutConnection, mStdoutDataConnection, mStderrConnection; - boost::scoped_ptr<LLEventPump::Blocker> mBlocker; + std::unique_ptr<LLEventPump::Blocker> mBlocker; LLProcess::ReadPipe::size_type mExpect; LLError::RecorderPtr mRecorder; - boost::scoped_ptr<LLLeapListener> mListener; + std::unique_ptr<LLLeapListener> mListener; }; // These must follow the declaration of LLLeapImpl, so they may as well be last. diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 196114cee9..6e0715d697 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -38,6 +38,7 @@ #include <mach/mach_host.h> #elif LL_LINUX # include <unistd.h> +# include <sys/resource.h> #endif #include "llmemory.h" @@ -273,33 +274,16 @@ U64 LLMemory::getCurrentRSS() U64 LLMemory::getCurrentRSS() { - static const char statPath[] = "/proc/self/stat"; - LLFILE *fp = LLFile::fopen(statPath, "r"); - U64 rss = 0; + struct rusage usage; - if (fp == NULL) - { - LL_WARNS() << "couldn't open " << statPath << LL_ENDL; + if (getrusage(RUSAGE_SELF, &usage) != 0) { + // Error handling code could be here return 0; } - // Eee-yew! See Documentation/filesystems/proc.txt in your - // nearest friendly kernel tree for details. - - { - int ret = fscanf(fp, "%*d (%*[^)]) %*c %*d %*d %*d %*d %*d %*d %*d " - "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %Lu", - &rss); - if (ret != 1) - { - LL_WARNS() << "couldn't parse contents of " << statPath << LL_ENDL; - rss = 0; - } - } - - fclose(fp); - - return rss; + // ru_maxrss (since Linux 2.6.32) + // This is the maximum resident set size used (in kilobytes). + return usage.ru_maxrss * 1024; } #else diff --git a/indra/llcommon/llmutex.cpp b/indra/llcommon/llmutex.cpp index 1c025c286d..3cfdc8304e 100644 --- a/indra/llcommon/llmutex.cpp +++ b/indra/llcommon/llmutex.cpp @@ -57,7 +57,7 @@ void LLMutex::lock() #if MUTEX_DEBUG // Have to have the lock before we can access the debug info auto id = LLThread::currentID(); - if (mIsLocked[id] != false) + if (mIsLocked[id]) LL_ERRS() << "Already locked in Thread: " << id << LL_ENDL; mIsLocked[id] = true; #endif @@ -77,7 +77,7 @@ void LLMutex::unlock() #if MUTEX_DEBUG // Access the debug info while we have the lock auto id = LLThread::currentID(); - if (mIsLocked[id] != true) + if (!mIsLocked[id]) LL_ERRS() << "Not locked in Thread: " << id << LL_ENDL; mIsLocked[id] = false; #endif @@ -127,7 +127,7 @@ bool LLMutex::trylock() #if MUTEX_DEBUG // Have to have the lock before we can access the debug info auto id = LLThread::currentID(); - if (mIsLocked[id] != false) + if (mIsLocked[id]) LL_ERRS() << "Already locked in Thread: " << id << LL_ENDL; mIsLocked[id] = true; #endif diff --git a/indra/llcommon/llnametable.h b/indra/llcommon/llnametable.h index 4f11c595ed..ca4c56f630 100644 --- a/indra/llcommon/llnametable.h +++ b/indra/llcommon/llnametable.h @@ -64,7 +64,7 @@ public: bool checkName(const char *name) const { char *tablename = gStringTable.addString(name); - return mNameMap.count(tablename) ? true : false; + return mNameMap.find(tablename) != mNameMap.end(); } DATA resolveName(const std::string& name) const diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 588d27a53f..3b0d6df0d4 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -36,7 +36,6 @@ #include "llevents.h" #include "llexception.h" -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include <boost/asio/streambuf.hpp> #include <boost/asio/buffers_iterator.hpp> @@ -587,7 +586,7 @@ LLProcess::LLProcess(const LLSDOrParams& params): // apr_procattr_child_err_set()), or accepting a filename, opening it and // passing that apr_file_t (simple <, >, 2> redirect emulation). std::vector<apr_int32_t> select; - BOOST_FOREACH(const FileParam& fparam, params.files) + for (const FileParam& fparam : params.files) { // Every iteration, we're going to append an item to 'select'. At the // top of the loop, its size() is, in effect, an index. Use that to @@ -684,7 +683,7 @@ LLProcess::LLProcess(const LLSDOrParams& params): argv.push_back(params.executable().c_str()); // Add arguments. See above remarks about c_str(). - BOOST_FOREACH(const std::string& arg, params.args) + for (const std::string& arg : params.args) { argv.push_back(arg.c_str()); } @@ -961,7 +960,7 @@ void LLProcess::handle_status(int reason, int status) // only be performed if in fact we're going to produce the log message. LL_DEBUGS("LLProcess") << empty; std::string reason_str; - BOOST_FOREACH(const ReasonCode& rcp, reasons) + for (const ReasonCode& rcp : reasons) { if (reason == rcp.code) { @@ -1151,7 +1150,7 @@ std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params) out << "cd " << LLStringUtil::quote(params.cwd) << ": "; } out << LLStringUtil::quote(params.executable); - BOOST_FOREACH(const std::string& arg, params.args) + for (const std::string& arg : params.args) { out << ' ' << LLStringUtil::quote(arg); } diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index 0842f2eb07..c57821bf52 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -51,7 +51,7 @@ class LLEventPump; class LLProcess; /// LLProcess instances are created on the heap by static factory methods and /// managed by ref-counted pointers. -typedef boost::shared_ptr<LLProcess> LLProcessPtr; +typedef std::shared_ptr<LLProcess> LLProcessPtr; /** * LLProcess handles launching an external process with specified command line diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h index eac4a3e2cb..70d87e7c04 100644 --- a/indra/llcommon/llqueuedthread.h +++ b/indra/llcommon/llqueuedthread.h @@ -144,7 +144,7 @@ public: void printQueueStats(); virtual size_t getPending(); - bool getThreaded() { return mThreaded ? true : false; } + bool getThreaded() { return mThreaded; } // Request accessors status_t getRequestStatus(handle_t handle); diff --git a/indra/llcommon/llregistry.h b/indra/llcommon/llregistry.h index e272d7a9b8..89d56373e1 100644 --- a/indra/llcommon/llregistry.h +++ b/indra/llcommon/llregistry.h @@ -60,7 +60,7 @@ public: bool add(ref_const_key_t key, ref_const_value_t value) { - if (mMap.insert(std::make_pair(key, value)).second == false) + if (!mMap.insert(std::make_pair(key, value)).second) { LL_WARNS() << "Tried to register " << key << " but it was already registered!" << LL_ENDL; return false; diff --git a/indra/llcommon/llrun.h b/indra/llcommon/llrun.h index d610f86234..42e3d9b47a 100644 --- a/indra/llcommon/llrun.h +++ b/indra/llcommon/llrun.h @@ -48,7 +48,7 @@ public: /** * @brief The pointer to a runnable. */ - typedef boost::shared_ptr<LLRunnable> run_ptr_t; + typedef std::shared_ptr<LLRunnable> run_ptr_t; /** * @brief The handle for use in the API. diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 76171f2dfd..756fd7c678 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -389,7 +389,7 @@ LLSDParser::~LLSDParser() S32 LLSDParser::parse(std::istream& istr, LLSD& data, llssize max_bytes, S32 max_depth) { - mCheckLimits = (LLSDSerialize::SIZE_UNLIMITED == max_bytes) ? false : true; + mCheckLimits = LLSDSerialize::SIZE_UNLIMITED != max_bytes; mMaxBytesLeft = max_bytes; return doParse(istr, data, max_depth); } diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index a2b29604b9..b7afa59d79 100644 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h @@ -478,9 +478,9 @@ namespace llsd { /***************************************************************************** -* BOOST_FOREACH() helpers for LLSD +* range-based for-loop helpers for LLSD *****************************************************************************/ -/// Usage: BOOST_FOREACH(LLSD item, inArray(someLLSDarray)) { ... } +/// Usage: for (LLSD item : inArray(someLLSDarray)) { ... } class inArray { public: @@ -503,7 +503,7 @@ private: /// MapEntry is what you get from dereferencing an LLSD::map_[const_]iterator. typedef std::map<LLSD::String, LLSD>::value_type MapEntry; -/// Usage: BOOST_FOREACH([const] MapEntry& e, inMap(someLLSDmap)) { ... } +/// Usage: for([const] MapEntry& e : inMap(someLLSDmap)) { ... } class inMap { public: diff --git a/indra/llcommon/llsingleton.cpp b/indra/llcommon/llsingleton.cpp index 6b1986d0e9..5f1a89670e 100644 --- a/indra/llcommon/llsingleton.cpp +++ b/indra/llcommon/llsingleton.cpp @@ -32,7 +32,6 @@ #include "lldependencies.h" #include "llexception.h" #include "llcoros.h" -#include <boost/foreach.hpp> #include <algorithm> #include <iostream> // std::cerr in dire emergency #include <sstream> @@ -411,7 +410,7 @@ void LLSingletonBase::cleanup_() void LLSingletonBase::deleteAll() { // It's essential to traverse these in dependency order. - BOOST_FOREACH(LLSingletonBase* sp, dep_sort()) + for (LLSingletonBase* sp : dep_sort()) { // Capture the class name first: in case of exception, don't count on // being able to extract it later. diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index 25131291f9..e39769fe9d 100644 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -532,7 +532,7 @@ bool before(const std::type_info* lhs, const std::type_info* rhs) return strcmp(lhs->name(), rhs->name()) < 0; #else // not Linux, or gcc 4.4+ // Just use before(), as we normally would - return lhs->before(*rhs) ? true : false; + return lhs->before(*rhs); #endif } diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 605d0ac4d7..a20a40e205 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -464,7 +464,7 @@ struct LLDictionaryLess public: bool operator()(const std::string& a, const std::string& b) const { - return (LLStringUtil::precedesDict(a, b) ? true : false); + return (LLStringUtil::precedesDict(a, b)); } }; @@ -1209,7 +1209,7 @@ void LLStringUtilBase<T>::getTokens(const string_type& string, std::vector<strin { // This overload must deal with escapes. Delegate that to InEscString // (unless there ARE no escapes). - boost::scoped_ptr< LLStringUtilBaseImpl::InString<T> > instrp; + std::unique_ptr< LLStringUtilBaseImpl::InString<T> > instrp; if (escapes.empty()) instrp.reset(new LLStringUtilBaseImpl::InString<T>(string.begin(), string.end())); else diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 7dccf6cf5b..efa7ea5666 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -49,7 +49,6 @@ #include "llsdutil.h" #include <boost/bind.hpp> #include <boost/circular_buffer.hpp> -#include <boost/foreach.hpp> #include <boost/lexical_cast.hpp> #include <boost/range.hpp> #include <boost/utility/enable_if.hpp> @@ -905,9 +904,9 @@ void LLMemoryInfo::stream(std::ostream& s) const // Max key length size_t key_width(0); - BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap)) + for (const auto& [key, value] : inMap(mStatsMap)) { - size_t len(pair.first.length()); + size_t len(key.length()); if (len > key_width) { key_width = len; @@ -915,10 +914,9 @@ void LLMemoryInfo::stream(std::ostream& s) const } // Now stream stats - BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap)) + for (const auto& [key, value] : inMap(mStatsMap)) { - s << pfx << std::setw(narrow<size_t>(key_width+1)) << (pair.first + ':') << ' '; - LLSD value(pair.second); + s << pfx << std::setw(narrow<size_t>(key_width+1)) << (key + ':') << ' '; if (value.isInteger()) s << std::setw(12) << value.asInteger(); else if (value.isReal()) diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index 1bcbefe9b2..cf2ae00cd7 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -59,17 +59,17 @@ public: bool isQuitting() const { return (QUITTING == mStatus); } bool isStopped() const { return (STOPPED == mStatus) || (CRASHED == mStatus); } bool isCrashed() const { return (CRASHED == mStatus); } - + static id_t currentID(); // Return ID of current thread static void yield(); // Static because it can be called by the main thread, which doesn't have an LLThread data structure. - + public: // PAUSE / RESUME functionality. See source code for important usage notes. // Called from MAIN THREAD. void pause(); void unpause(); - bool isPaused() { return isStopped() || mPaused == true; } - + bool isPaused() { return isStopped() || mPaused; } + // Cause the thread to wake up and check its condition void wake(); diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 42c4911ff1..b1ddfc952c 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -424,7 +424,7 @@ F32SecondsImplicit LLTimer::getElapsedTimeAndResetF32() /////////////////////////////////////////////////////////////////////////////// -void LLTimer::setTimerExpirySec(F32SecondsImplicit expiration) +void LLTimer::setTimerExpirySec(F32SecondsImplicit expiration) { mExpirationTicks = get_clock_count() + (U64)((F32)(expiration * get_timer_info().mClockFrequency.value())); @@ -441,7 +441,7 @@ F32SecondsImplicit LLTimer::getRemainingTimeF32() const } -bool LLTimer::checkExpirationAndReset(F32 expiration) +bool LLTimer::checkExpirationAndReset(F32 expiration) { U64 cur_ticks = get_clock_count(); if (cur_ticks < mExpirationTicks) @@ -455,10 +455,9 @@ bool LLTimer::checkExpirationAndReset(F32 expiration) } -bool LLTimer::hasExpired() const +bool LLTimer::hasExpired() const { - return (get_clock_count() >= mExpirationTicks) - ? true : false; + return get_clock_count() >= mExpirationTicks; } /////////////////////////////////////////////////////////////////////////////// diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 9c306266e7..54fb5742a2 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -153,7 +153,7 @@ struct lluuid_less { bool operator()(const LLUUID& lhs, const LLUUID& rhs) const { - return (lhs < rhs) ? true : false; + return lhs < rhs; } }; diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index 06c74bdba0..231dbe4310 100644 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp @@ -284,7 +284,7 @@ bool LLWorkerClass::yield() mWorkerThread->checkPause(); bool res; mMutex.lock(); - res = (getFlags() & WCF_ABORT_REQUESTED) ? true : false; + res = (getFlags() & WCF_ABORT_REQUESTED) != 0; mMutex.unlock(); return res; } diff --git a/indra/llcommon/llworkerthread.h b/indra/llcommon/llworkerthread.h index eb26c28d3d..a0fe30404d 100644 --- a/indra/llcommon/llworkerthread.h +++ b/indra/llcommon/llworkerthread.h @@ -178,7 +178,7 @@ private: void clearFlags(U32 flags) { mWorkFlags = mWorkFlags & ~flags; } U32 getFlags() { return mWorkFlags; } public: - bool getFlags(U32 flags) { return mWorkFlags & flags ? true : false; } + bool getFlags(U32 flags) { return (mWorkFlags & flags) != 0; } private: // pure virtuals diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index 148c18aabe..b4cdbdc6bf 100644 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -153,27 +153,27 @@ namespace tut int countMessages() { - return boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->countMessages(); + return std::dynamic_pointer_cast<TestRecorder>(mRecorder)->countMessages(); } void clearMessages() { - boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->clearMessages(); + std::dynamic_pointer_cast<TestRecorder>(mRecorder)->clearMessages(); } void setWantsTime(bool t) { - boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->showTime(t); + std::dynamic_pointer_cast<TestRecorder>(mRecorder)->showTime(t); } void setWantsMultiline(bool t) { - boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->showMultiline(t); + std::dynamic_pointer_cast<TestRecorder>(mRecorder)->showMultiline(t); } std::string message(int n) { - return boost::dynamic_pointer_cast<TestRecorder>(mRecorder)->message(n); + return std::dynamic_pointer_cast<TestRecorder>(mRecorder)->message(n); } void ensure_message_count(int expectedCount) @@ -497,12 +497,12 @@ namespace void testLogName(LLError::RecorderPtr recorder, LogFromFunction f, const std::string& class_name = "") { - boost::dynamic_pointer_cast<tut::TestRecorder>(recorder)->clearMessages(); + std::dynamic_pointer_cast<tut::TestRecorder>(recorder)->clearMessages(); std::string name = f(false); f(true); - std::string messageWithoutName = boost::dynamic_pointer_cast<tut::TestRecorder>(recorder)->message(0); - std::string messageWithName = boost::dynamic_pointer_cast<tut::TestRecorder>(recorder)->message(1); + std::string messageWithoutName = std::dynamic_pointer_cast<tut::TestRecorder>(recorder)->message(0); + std::string messageWithName = std::dynamic_pointer_cast<tut::TestRecorder>(recorder)->message(1); ensure_has(name + " logged without name", messageWithoutName, name); @@ -691,13 +691,13 @@ namespace tut LL_INFOS() << "boo" << LL_ENDL; ensure_message_field_equals(0, MSG_FIELD, "boo"); - ensure_equals("alt recorder count", boost::dynamic_pointer_cast<TestRecorder>(altRecorder)->countMessages(), 1); - ensure_contains("alt recorder message 0", boost::dynamic_pointer_cast<TestRecorder>(altRecorder)->message(0), "boo"); + ensure_equals("alt recorder count", std::dynamic_pointer_cast<TestRecorder>(altRecorder)->countMessages(), 1); + ensure_contains("alt recorder message 0", std::dynamic_pointer_cast<TestRecorder>(altRecorder)->message(0), "boo"); LLError::setTimeFunction(roswell); LLError::RecorderPtr anotherRecorder(new TestRecorder()); - boost::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->showTime(true); + std::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->showTime(true); LLError::addRecorder(anotherRecorder); LL_INFOS() << "baz" << LL_ENDL; @@ -705,10 +705,10 @@ namespace tut std::string when = roswell(); ensure_message_does_not_contain(1, when); - ensure_equals("alt recorder count", boost::dynamic_pointer_cast<TestRecorder>(altRecorder)->countMessages(), 2); - ensure_does_not_contain("alt recorder message 1", boost::dynamic_pointer_cast<TestRecorder>(altRecorder)->message(1), when); - ensure_equals("another recorder count", boost::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->countMessages(), 1); - ensure_contains("another recorder message 0", boost::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->message(0), when); + ensure_equals("alt recorder count", std::dynamic_pointer_cast<TestRecorder>(altRecorder)->countMessages(), 2); + ensure_does_not_contain("alt recorder message 1", std::dynamic_pointer_cast<TestRecorder>(altRecorder)->message(1), when); + ensure_equals("another recorder count", std::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->countMessages(), 1); + ensure_contains("another recorder message 0", std::dynamic_pointer_cast<TestRecorder>(anotherRecorder)->message(0), when); LLError::removeRecorder(altRecorder); LLError::removeRecorder(anotherRecorder); diff --git a/indra/llcommon/tests/lleventcoro_test.cpp b/indra/llcommon/tests/lleventcoro_test.cpp index 032923a108..01104545c6 100644 --- a/indra/llcommon/tests/lleventcoro_test.cpp +++ b/indra/llcommon/tests/lleventcoro_test.cpp @@ -101,7 +101,7 @@ namespace tut int which; LLTestApp testApp; - void explicit_wait(boost::shared_ptr<LLCoros::Promise<std::string>>& cbp); + void explicit_wait(std::shared_ptr<LLCoros::Promise<std::string>>& cbp); void waitForEventOn1(); void coroPump(); void postAndWait1(); @@ -111,7 +111,7 @@ namespace tut typedef coroutine_group::object object; coroutine_group coroutinegrp("coroutine"); - void test_data::explicit_wait(boost::shared_ptr<LLCoros::Promise<std::string>>& cbp) + void test_data::explicit_wait(std::shared_ptr<LLCoros::Promise<std::string>>& cbp) { BEGIN { @@ -127,7 +127,7 @@ namespace tut // For test purposes, instead of handing 'callback' (or an // adapter) off to some I/O subsystem, we'll just pass it back to // our caller. - cbp = boost::make_shared<LLCoros::Promise<std::string>>(); + cbp = std::make_shared<LLCoros::Promise<std::string>>(); LLCoros::Future<std::string> future = LLCoros::getFuture(*cbp); // calling get() on the future causes us to suspend @@ -146,7 +146,7 @@ namespace tut DEBUG; // Construct the coroutine instance that will run explicit_wait. - boost::shared_ptr<LLCoros::Promise<std::string>> respond; + std::shared_ptr<LLCoros::Promise<std::string>> respond; LLCoros::instance().launch("test<1>", [this, &respond](){ explicit_wait(respond); }); mSync.bump(); diff --git a/indra/llcommon/tests/llinstancetracker_test.cpp b/indra/llcommon/tests/llinstancetracker_test.cpp index 5daa29adf4..95af9c2a50 100644 --- a/indra/llcommon/tests/llinstancetracker_test.cpp +++ b/indra/llcommon/tests/llinstancetracker_test.cpp @@ -94,7 +94,7 @@ namespace tut ensure("couldn't find stack Keyed", bool(found)); ensure_equals("found wrong Keyed instance", found.get(), &one); { - boost::scoped_ptr<Keyed> two(new Keyed("two")); + std::unique_ptr<Keyed> two(new Keyed("two")); ensure_equals(Keyed::instanceCount(), 2); auto found = Keyed::getInstance("two"); ensure("couldn't find heap Keyed", bool(found)); @@ -118,7 +118,7 @@ namespace tut std::weak_ptr<Unkeyed> found = one.getWeak(); ensure(! found.expired()); { - boost::scoped_ptr<Unkeyed> two(new Unkeyed); + std::unique_ptr<Unkeyed> two(new Unkeyed); ensure_equals(Unkeyed::instanceCount(), 2); } ensure_equals(Unkeyed::instanceCount(), 1); diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index b6b297b8d7..628f046f55 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -21,7 +21,6 @@ // external library headers #include "llapr.h" #include "apr_thread_proc.h" -#include <boost/foreach.hpp> #include <boost/function.hpp> #include <boost/algorithm/string/find_iterator.hpp> #include <boost/algorithm/string/finder.hpp> @@ -323,7 +322,7 @@ namespace tut { /*==========================================================================*| std::string reason_str; - BOOST_FOREACH(const ReasonCode& rcp, reasons) + for (const ReasonCode& rcp : reasons) { if (reason == rcp.code) { @@ -554,7 +553,7 @@ namespace tut catch (const failure&) { std::cout << "History:\n"; - BOOST_FOREACH(const Item& item, history) + for (const Item& item : history) { std::string what(item.what); if ((! what.empty()) && what[what.length() - 1] == '\n') diff --git a/indra/llcommon/tests/llstreamqueue_test.cpp b/indra/llcommon/tests/llstreamqueue_test.cpp index 050ad5c5bf..8af057328b 100644 --- a/indra/llcommon/tests/llstreamqueue_test.cpp +++ b/indra/llcommon/tests/llstreamqueue_test.cpp @@ -15,9 +15,6 @@ #include "llstreamqueue.h" // STL headers #include <vector> -// std headers -// external library headers -#include <boost/foreach.hpp> // other Linden headers #include "../test/lltut.h" #include "stringize.h" @@ -133,7 +130,7 @@ namespace tut std::streamsize leave(5); // len("craft") above std::streamsize skip(total - leave); std::streamsize written(0); - BOOST_FOREACH(const std::string& block, blocks) + for (const std::string& block : blocks) { written += strq.write(&block[0], block.length()); ensure_equals("size() after write()", strq.size(), written); @@ -152,7 +149,7 @@ namespace tut { set_test_name("concatenate blocks"); std::string blocks[] = { "abcd", "efghij", "klmnopqrs" }; - BOOST_FOREACH(const std::string& block, blocks) + for (const std::string& block : blocks) { strq.write(&block[0], block.length()); } @@ -170,7 +167,7 @@ namespace tut { set_test_name("split blocks"); std::string blocks[] = { "abcdefghijklm", "nopqrstuvwxyz" }; - BOOST_FOREACH(const std::string& block, blocks) + for (const std::string& block : blocks) { strq.write(&block[0], block.length()); } diff --git a/indra/llcommon/tests/lltreeiterators_test.cpp b/indra/llcommon/tests/lltreeiterators_test.cpp index 1d619867d4..b9c7a70c07 100644 --- a/indra/llcommon/tests/lltreeiterators_test.cpp +++ b/indra/llcommon/tests/lltreeiterators_test.cpp @@ -38,7 +38,6 @@ // external library headers #include <boost/bind.hpp> #include <boost/range/iterator_range.hpp> -#include <boost/foreach.hpp> // associated header #include "../lltreeiterators.h" @@ -402,7 +401,7 @@ private: * * Example: * @code - * BOOST_FOREACH(TreeNodePtr node, getRootRange<LLTreeIter::UP>(somenode)) + * for (TreeNodePtr node : getRootRange<LLTreeIter::UP>(somenode)) * { * std::cout << node->name() << '\n'; * } @@ -424,7 +423,7 @@ getRootRange(const TreeNodePtr& node) * * Example: * @code - * BOOST_FOREACH(TreeNodePtr node, getWalkRange<LLTreeIter::DFS_PRE>(root)) + * for (TreeNodePtr node : getWalkRange<LLTreeIter::DFS_PRE>(root)) * { * std::cout << node->name() << '\n'; * } @@ -520,7 +519,7 @@ public: * * Example usage: * @code - * BOOST_FOREACH(EnhancedTreeNodePtr node, somenode->getRootRange<LLTreeIter::UP>()) + * for (EnhancedTreeNodePtr node : somenode->getRootRange<LLTreeIter::UP>()) * { * std::cout << node->name() << '\n'; * } @@ -564,7 +563,7 @@ public: * * Example usage: * @code - * BOOST_FOREACH(EnhancedTreeNodePtr node, somenode->getWalkRange<LLTreeIter::DFS_PRE>()) + * for (EnhancedTreeNodePtr node : somenode->getWalkRange<LLTreeIter::DFS_PRE>()) * { * std::cout << node->name() << '\n'; * } @@ -644,7 +643,7 @@ LLLinkedIter<PlainTree> PlainTree_child_end(PlainTree* node) * * Example: * @code - * BOOST_FOREACH(PlainTree* node, getRootRange<LLTreeIter::UP>(somenode)) + * for (PlainTree* node : getRootRange<LLTreeIter::UP>(somenode)) * { * std::cout << node->name() << '\n'; * } @@ -668,7 +667,7 @@ getRootRange(PlainTree* node) * * Example: * @code - * BOOST_FOREACH(PlainTree* node, getWalkRange<LLTreeIter::DFS_PRE>(root)) + * for (PlainTree* node : getWalkRange<LLTreeIter::DFS_PRE>(root)) * { * std::cout << node->name() << '\n'; * } @@ -1103,18 +1102,18 @@ namespace tut // This test function illustrates the looping techniques described in the // comments for the getRootRange() free function, the // EnhancedTreeNode::root_range template and the - // EnhancedTreeNode::getRootRange() method. Obviously the BOOST_FOREACH() + // EnhancedTreeNode::getRootRange() method. Obviously the for() // forms are more succinct. TreeNodePtr tnroot(example_tree<TreeNode>()); TreeNodePtr tnB2b(get_B2b<TreeNode, TreeNode::child_iterator> (tnroot, boost::bind(&TreeNode::child_begin, _1))); - std::string desc1("BOOST_FOREACH(TreeNodePr, getRootRange<LLTreeIter::UP>(tnB2b))"); + std::string desc1("for (TreeNodePr : getRootRange<LLTreeIter::UP>(tnB2b))"); // std::cout << desc1 << "\n"; // Although we've commented out the output statement, ensure that the // loop construct is still valid, as promised by the getRootRange() // documentation. - BOOST_FOREACH(TreeNodePtr node, getRootRange<LLTreeIter::UP>(tnB2b)) + for (TreeNodePtr node : getRootRange<LLTreeIter::UP>(tnB2b)) { // std::cout << node->name() << '\n'; } @@ -1137,9 +1136,9 @@ namespace tut // std::cout << (*ri)->name() << '\n'; } - std::string desc2("BOOST_FOREACH(EnhancedTreeNodePtr node, etnB2b->getRootRange<LLTreeIter::UP>())"); + std::string desc2("for (EnhancedTreeNodePtr node : etnB2b->getRootRange<LLTreeIter::UP>())"); // std::cout << desc2 << '\n'; - BOOST_FOREACH(EnhancedTreeNodePtr node, etnB2b->getRootRange<LLTreeIter::UP>()) + for (EnhancedTreeNodePtr node : etnB2b->getRootRange<LLTreeIter::UP>()) { // std::cout << node->name() << '\n'; } diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h index d657b329bb..6978c296b3 100644 --- a/indra/llcommon/tests/wrapllerrs.h +++ b/indra/llcommon/tests/wrapllerrs.h @@ -218,12 +218,12 @@ public: /// for the sought string. std::string messageWith(const std::string& search, bool required=true) { - return boost::dynamic_pointer_cast<CaptureLogRecorder>(mRecorder)->messageWith(search, required); + return std::dynamic_pointer_cast<CaptureLogRecorder>(mRecorder)->messageWith(search, required); } std::ostream& streamto(std::ostream& out) const { - return boost::dynamic_pointer_cast<CaptureLogRecorder>(mRecorder)->streamto(out); + return std::dynamic_pointer_cast<CaptureLogRecorder>(mRecorder)->streamto(out); } friend inline std::ostream& operator<<(std::ostream& out, const CaptureLog& self) diff --git a/indra/llcorehttp/_httplibcurl.h b/indra/llcorehttp/_httplibcurl.h index a71eae59c0..61ecc492af 100644 --- a/indra/llcorehttp/_httplibcurl.h +++ b/indra/llcorehttp/_httplibcurl.h @@ -65,7 +65,7 @@ private: void operator=(const HttpLibcurl &); // Not defined public: - typedef boost::shared_ptr<HttpOpRequest> opReqPtr_t; + typedef std::shared_ptr<HttpOpRequest> opReqPtr_t; /// Give cycles to libcurl to run active requests. Completed /// operations (successful or failed) will be retried or handed diff --git a/indra/llcorehttp/_httpoperation.cpp b/indra/llcorehttp/_httpoperation.cpp index 3b64018132..c3a9bcaf54 100644 --- a/indra/llcorehttp/_httpoperation.cpp +++ b/indra/llcorehttp/_httpoperation.cpp @@ -58,7 +58,7 @@ HttpOperation::handleMap_t HttpOperation::mHandleMap; LLCoreInt::HttpMutex HttpOperation::mOpMutex; HttpOperation::HttpOperation(): - boost::enable_shared_from_this<HttpOperation>(), + std::enable_shared_from_this<HttpOperation>(), mReplyQueue(), mUserHandler(), mReqPolicy(HttpRequest::DEFAULT_POLICY_ID), diff --git a/indra/llcorehttp/_httpoperation.h b/indra/llcorehttp/_httpoperation.h index 8c1364bab4..b07ef76d49 100644 --- a/indra/llcorehttp/_httpoperation.h +++ b/indra/llcorehttp/_httpoperation.h @@ -69,12 +69,12 @@ class HttpService; /// and those interfaces establish the access rules. class HttpOperation : private boost::noncopyable, - public boost::enable_shared_from_this<HttpOperation> + public std::enable_shared_from_this<HttpOperation> { public: - typedef boost::shared_ptr<HttpOperation> ptr_t; - typedef boost::weak_ptr<HttpOperation> wptr_t; - typedef boost::shared_ptr<HttpReplyQueue> HttpReplyQueuePtr_t; + typedef std::shared_ptr<HttpOperation> ptr_t; + typedef std::weak_ptr<HttpOperation> wptr_t; + typedef std::shared_ptr<HttpReplyQueue> HttpReplyQueuePtr_t; /// Threading: called by consumer thread. HttpOperation(); @@ -157,12 +157,12 @@ public: HttpHandle getHandle(); template< class OPT > - static boost::shared_ptr< OPT > fromHandle(HttpHandle handle) + static std::shared_ptr< OPT > fromHandle(HttpHandle handle) { ptr_t ptr = findByHandle(handle); if (!ptr) - return boost::shared_ptr< OPT >(); - return boost::dynamic_pointer_cast< OPT >(ptr); + return std::shared_ptr< OPT >(); + return std::dynamic_pointer_cast< OPT >(ptr); } protected: diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index d60eb6c95f..3247146212 100644 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -201,7 +201,7 @@ HttpOpRequest::~HttpOpRequest() void HttpOpRequest::stageFromRequest(HttpService * service) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; - HttpOpRequest::ptr_t self(boost::dynamic_pointer_cast<HttpOpRequest>(shared_from_this())); + HttpOpRequest::ptr_t self(std::dynamic_pointer_cast<HttpOpRequest>(shared_from_this())); service->getPolicy().addOp(self); // transfers refcount } @@ -209,7 +209,7 @@ void HttpOpRequest::stageFromRequest(HttpService * service) void HttpOpRequest::stageFromReady(HttpService * service) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; - HttpOpRequest::ptr_t self(boost::dynamic_pointer_cast<HttpOpRequest>(shared_from_this())); + HttpOpRequest::ptr_t self(std::dynamic_pointer_cast<HttpOpRequest>(shared_from_this())); service->getTransport().addOp(self); // transfers refcount } @@ -290,7 +290,7 @@ void HttpOpRequest::visitNotifier(HttpRequest * request) // HttpOpRequest::ptr_t HttpOpRequest::fromHandle(HttpHandle handle) // { // -// return boost::dynamic_pointer_cast<HttpOpRequest>((static_cast<HttpOpRequest *>(handle))->shared_from_this()); +// return std::dynamic_pointer_cast<HttpOpRequest>((static_cast<HttpOpRequest *>(handle))->shared_from_this()); // } diff --git a/indra/llcorehttp/_httpoprequest.h b/indra/llcorehttp/_httpoprequest.h index ec84822cf4..626064329d 100644 --- a/indra/llcorehttp/_httpoprequest.h +++ b/indra/llcorehttp/_httpoprequest.h @@ -66,7 +66,7 @@ class BufferArray; class HttpOpRequest : public HttpOperation { public: - typedef boost::shared_ptr<HttpOpRequest> ptr_t; + typedef std::shared_ptr<HttpOpRequest> ptr_t; HttpOpRequest(); diff --git a/indra/llcorehttp/_httpopsetget.h b/indra/llcorehttp/_httpopsetget.h index eabd41e79f..04ab2446ef 100644 --- a/indra/llcorehttp/_httpopsetget.h +++ b/indra/llcorehttp/_httpopsetget.h @@ -53,7 +53,7 @@ namespace LLCore class HttpOpSetGet : public HttpOperation { public: - typedef boost::shared_ptr<HttpOpSetGet> ptr_t; + typedef std::shared_ptr<HttpOpSetGet> ptr_t; HttpOpSetGet(); diff --git a/indra/llcorehttp/_httppolicy.h b/indra/llcorehttp/_httppolicy.h index 0b8806a3e2..955f757c93 100644 --- a/indra/llcorehttp/_httppolicy.h +++ b/indra/llcorehttp/_httppolicy.h @@ -60,7 +60,7 @@ private: void operator=(const HttpPolicy &); // Not defined public: - typedef boost::shared_ptr<HttpOpRequest> opReqPtr_t; + typedef std::shared_ptr<HttpOpRequest> opReqPtr_t; /// Threading: called by init thread. HttpRequest::policy_t createPolicyClass(); diff --git a/indra/llcorehttp/_httpreplyqueue.h b/indra/llcorehttp/_httpreplyqueue.h index 33e205c1c9..2de26249ef 100644 --- a/indra/llcorehttp/_httpreplyqueue.h +++ b/indra/llcorehttp/_httpreplyqueue.h @@ -63,8 +63,8 @@ class HttpReplyQueue : private boost::noncopyable { public: - typedef boost::shared_ptr<HttpOperation> opPtr_t; - typedef boost::shared_ptr<HttpReplyQueue> ptr_t; + typedef std::shared_ptr<HttpOperation> opPtr_t; + typedef std::shared_ptr<HttpReplyQueue> ptr_t; HttpReplyQueue(); virtual ~HttpReplyQueue(); diff --git a/indra/llcorehttp/_httprequestqueue.h b/indra/llcorehttp/_httprequestqueue.h index f0296f30e3..52369df174 100644 --- a/indra/llcorehttp/_httprequestqueue.h +++ b/indra/llcorehttp/_httprequestqueue.h @@ -61,7 +61,7 @@ private: void operator=(const HttpRequestQueue &); // Not defined public: - typedef boost::shared_ptr<HttpOperation> opPtr_t; + typedef std::shared_ptr<HttpOperation> opPtr_t; static void init(); static void term(); diff --git a/indra/llcorehttp/httpcommon.h b/indra/llcorehttp/httpcommon.h index 18505e0aad..7fe5c48edf 100644 --- a/indra/llcorehttp/httpcommon.h +++ b/indra/llcorehttp/httpcommon.h @@ -301,24 +301,24 @@ struct HttpStatus HttpStatus() { - mDetails = boost::shared_ptr<Details>(new Details(LLCORE, HE_SUCCESS)); + mDetails = std::shared_ptr<Details>(new Details(LLCORE, HE_SUCCESS)); } HttpStatus(type_enum_t type, short status) { - mDetails = boost::shared_ptr<Details>(new Details(type, status)); + mDetails = std::shared_ptr<Details>(new Details(type, status)); } HttpStatus(int http_status) { - mDetails = boost::shared_ptr<Details>(new Details(http_status, + mDetails = std::shared_ptr<Details>(new Details(http_status, (http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR)); llassert(http_status >= 100 && http_status <= 999); } HttpStatus(int http_status, const std::string &message) { - mDetails = boost::shared_ptr<Details>(new Details(http_status, + mDetails = std::shared_ptr<Details>(new Details(http_status, (http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR)); llassert(http_status >= 100 && http_status <= 999); mDetails->mMessage = message; @@ -341,7 +341,7 @@ struct HttpStatus HttpStatus & clone(const HttpStatus &rhs) { - mDetails = boost::shared_ptr<Details>(new Details(*rhs.mDetails)); + mDetails = std::shared_ptr<Details>(new Details(*rhs.mDetails)); return *this; } @@ -490,14 +490,14 @@ private: LLSD mErrorData; }; - boost::shared_ptr<Details> mDetails; + std::shared_ptr<Details> mDetails; }; // end struct HttpStatus /// A namespace for several free methods and low level utilities. namespace LLHttp { - typedef boost::shared_ptr<CURL> CURL_ptr; + typedef std::shared_ptr<CURL> CURL_ptr; void initialize(); void cleanup(); diff --git a/indra/llcorehttp/httphandler.h b/indra/llcorehttp/httphandler.h index 65e043f5d3..4cfb2598c7 100644 --- a/indra/llcorehttp/httphandler.h +++ b/indra/llcorehttp/httphandler.h @@ -58,8 +58,8 @@ class HttpResponse; class HttpHandler { public: - typedef boost::shared_ptr<HttpHandler> ptr_t; - typedef boost::weak_ptr<HttpHandler> wptr_t; + typedef std::shared_ptr<HttpHandler> ptr_t; + typedef std::weak_ptr<HttpHandler> wptr_t; virtual ~HttpHandler() { } diff --git a/indra/llcorehttp/httpheaders.h b/indra/llcorehttp/httpheaders.h index b9168cb6ec..e7cf4037bf 100644 --- a/indra/llcorehttp/httpheaders.h +++ b/indra/llcorehttp/httpheaders.h @@ -85,7 +85,7 @@ public: typedef container_t::const_reverse_iterator const_reverse_iterator; typedef container_t::value_type value_type; typedef container_t::size_type size_type; - typedef boost::shared_ptr<HttpHeaders> ptr_t; + typedef std::shared_ptr<HttpHeaders> ptr_t; public: /// @post In addition to the instance, caller has a refcount diff --git a/indra/llcorehttp/httpoptions.h b/indra/llcorehttp/httpoptions.h index 41f71896b0..fa993c857b 100644 --- a/indra/llcorehttp/httpoptions.h +++ b/indra/llcorehttp/httpoptions.h @@ -60,7 +60,7 @@ class HttpOptions : private boost::noncopyable public: HttpOptions(); - typedef boost::shared_ptr<HttpOptions> ptr_t; + typedef std::shared_ptr<HttpOptions> ptr_t; virtual ~HttpOptions(); // Use release() diff --git a/indra/llcorehttp/httprequest.h b/indra/llcorehttp/httprequest.h index ca4b9e92bc..857a034a7b 100644 --- a/indra/llcorehttp/httprequest.h +++ b/indra/llcorehttp/httprequest.h @@ -96,8 +96,8 @@ private: public: typedef unsigned int policy_t; - typedef boost::shared_ptr<HttpRequest> ptr_t; - typedef boost::weak_ptr<HttpRequest> wptr_t; + typedef std::shared_ptr<HttpRequest> ptr_t; + typedef std::weak_ptr<HttpRequest> wptr_t; public: /// @name PolicyMethods /// @{ @@ -627,7 +627,7 @@ public: protected: private: - typedef boost::shared_ptr<HttpReplyQueue> HttpReplyQueuePtr_t; + typedef std::shared_ptr<HttpReplyQueue> HttpReplyQueuePtr_t; /// @name InstanceData /// diff --git a/indra/llcorehttp/httpresponse.h b/indra/llcorehttp/httpresponse.h index b834085e5c..ef98fbef2b 100644 --- a/indra/llcorehttp/httpresponse.h +++ b/indra/llcorehttp/httpresponse.h @@ -72,7 +72,7 @@ public: /// Statistics for the HTTP struct TransferStats { - typedef boost::shared_ptr<TransferStats> ptr_t; + typedef std::shared_ptr<TransferStats> ptr_t; TransferStats() : mSizeDownload(0.0), mTotalTime(0.0), mSpeedDownload(0.0) {} F64 mSizeDownload; diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index c448ab1bfe..e02894c271 100644 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -187,27 +187,27 @@ bool LLCrashLogger::readMinidump(std::string minidump_path) size_t length=0; llifstream minidump_stream(minidump_path.c_str(), std::ios_base::in | std::ios_base::binary); - if(minidump_stream.is_open()) + if (minidump_stream.is_open()) { minidump_stream.seekg(0, std::ios::end); length = (size_t)minidump_stream.tellg(); LL_WARNS("CRASHREPORT") << "minidump length "<< length <<LL_ENDL; minidump_stream.seekg(0, std::ios::beg); - + LLSD::Binary data; data.resize(length); - + minidump_stream.read(reinterpret_cast<char *>(&(data[0])),length); minidump_stream.close(); - + mCrashInfo["Minidump"] = data; } else { LL_WARNS("CRASHREPORT") << "failed to open minidump "<<minidump_path<<LL_ENDL; } - - return (length>0?true:false); + + return length > 0; } void LLCrashLogger::gatherFiles() diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp index ee5dec2b77..41fbb97175 100644 --- a/indra/llfilesystem/lldir.cpp +++ b/indra/llfilesystem/lldir.cpp @@ -44,7 +44,6 @@ #include "stringize.h" #include "llstring.h" #include <boost/filesystem.hpp> -#include <boost/foreach.hpp> #include <boost/range/begin.hpp> #include <boost/range/end.hpp> #include <boost/assign/list_of.hpp> @@ -71,7 +70,6 @@ LLDir *gDirUtilp = (LLDir *)&gDirUtil; /// Values for findSkinnedFilenames(subdir) parameter const char *LLDir::XUI = "xui", - *LLDir::HTML = "html", *LLDir::TEXTURES = "textures", *LLDir::SKINBASE = ""; @@ -692,10 +690,10 @@ void LLDir::walkSearchSkinDirs(const std::string& subdir, const std::string& filename, const FUNCTION& function) const { - BOOST_FOREACH(std::string skindir, mSearchSkinDirs) + for (const std::string& skindir : mSearchSkinDirs) { std::string subdir_path(add(skindir, subdir)); - BOOST_FOREACH(std::string subsubdir, subsubdirs) + for (const std::string& subsubdir : subsubdirs) { std::string full_path(add(subdir_path, subsubdir, filename)); if (fileExists(full_path)) @@ -762,13 +760,14 @@ std::vector<std::string> LLDir::findSkinnedFilenames(const std::string& subdir, else { // We do not recognize this subdir. Investigate. - if (skinExists(subdir, "en")) + std::string subdir_path(add(getDefaultSkinDir(), subdir)); + if (fileExists(add(subdir_path, "en"))) { // defaultSkinDir/subdir contains subdir "en". That's our // default language; this subdir is localized. found = sLocalized.insert(StringMap::value_type(subdir, "en")).first; } - else if (skinExists(subdir, "en-us")) + else if (fileExists(add(subdir_path, "en-us"))) { // defaultSkinDir/subdir contains subdir "en-us" but not "en". // Set as default language; this subdir is localized. @@ -843,7 +842,7 @@ std::vector<std::string> LLDir::findSkinnedFilenames(const std::string& subdir, // current language, copy them -- in proper order -- into results. // Don't drive this by walking the map itself: it matters that we // generate results in the same order as subsubdirs. - BOOST_FOREACH(std::string subsubdir, subsubdirs) + for (const std::string& subsubdir : subsubdirs) { StringMap::const_iterator found(path_for.find(subsubdir)); if (found != path_for.end()) @@ -855,7 +854,7 @@ std::vector<std::string> LLDir::findSkinnedFilenames(const std::string& subdir, LL_DEBUGS("LLDir") << empty; const char* comma = ""; - BOOST_FOREACH(std::string path, results) + for (const std::string& path : results) { LL_CONT << comma << "'" << path << "'"; comma = ", "; @@ -865,33 +864,6 @@ std::vector<std::string> LLDir::findSkinnedFilenames(const std::string& subdir, return results; } -// virtual -bool LLDir::skinExists(const std::string& subdir, const std::string& skin) const -{ - std::string skin_path(add(getDefaultSkinDir(), subdir, skin)); - return fileExists(skin_path); -} - -// virtual -std::string LLDir::getFileContents(const std::string& filename) const -{ - LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ - if (fp) - { - fseek(fp, 0, SEEK_END); - U32 length = ftell(fp); - fseek(fp, 0, SEEK_SET); - - std::vector<char> buffer(length); - size_t nread = fread(buffer.data(), 1, length, fp); - fclose(fp); - - return std::string(buffer.data(), nread); - } - - return LLStringUtil::null; -} - std::string LLDir::getTempFilename() const { LLUUID random_uuid; diff --git a/indra/llfilesystem/lldir.h b/indra/llfilesystem/lldir.h index d43921c292..b9a046ba33 100644 --- a/indra/llfilesystem/lldir.h +++ b/indra/llfilesystem/lldir.h @@ -72,8 +72,6 @@ class LLDir // pure virtual functions virtual std::string getCurPath() = 0; virtual bool fileExists(const std::string &filename) const = 0; - virtual bool skinExists(const std::string& subdir, const std::string &skin) const; - virtual std::string getFileContents(const std::string& filename) const; const std::string findFile(const std::string& filename, const std::vector<std::string> filenames) const; const std::string findFile(const std::string& filename, const std::string& searchPath1 = "", const std::string& searchPath2 = "", const std::string& searchPath3 = "") const; @@ -152,7 +150,7 @@ class LLDir const std::string& filename, ESkinConstraint constraint=CURRENT_SKIN) const; /// Values for findSkinnedFilenames(subdir) parameter - static const char *XUI, *HTML, *TEXTURES, *SKINBASE; + static const char *XUI, *TEXTURES, *SKINBASE; /** * Return the base-language pathname from findSkinnedFilenames(), or * the empty string if no such file exists. Parameters are identical to diff --git a/indra/llfilesystem/tests/lldir_test.cpp b/indra/llfilesystem/tests/lldir_test.cpp index 3cff622a4b..60265cade6 100644 --- a/indra/llfilesystem/tests/lldir_test.cpp +++ b/indra/llfilesystem/tests/lldir_test.cpp @@ -34,7 +34,6 @@ #include "../test/lltut.h" #include "stringize.h" -#include <boost/foreach.hpp> #include <boost/assign/list_of.hpp> using boost::assign::list_of; @@ -109,7 +108,7 @@ struct LLDir_Dummy: public LLDir "install/skins/default/future/somefile.txt" }; - BOOST_FOREACH(const char* path, preload) + for (const char* path : preload) { buildFilesystem(path); } @@ -166,7 +165,7 @@ struct LLDir_Dummy: public LLDir LLStringUtil::getTokens(path, components, "/"); // Ensure we have an entry representing every level of this path std::string partial; - BOOST_FOREACH(std::string component, components) + for (std::string component : components) { append(partial, component); mFilesystem.insert(partial); diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 520d7b4fd9..281ae12491 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -2342,9 +2342,9 @@ bool LLImageFormatted::save(const std::string &filename) LLImageDataSharedLock lock(this); - outfile.write(getData(), getDataSize()); + S32 result = outfile.write(getData(), getDataSize()); outfile.close() ; - return true; + return (result != 0); } S8 LLImageFormatted::getCodec() const diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index c77edeb1a4..382da40dcf 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -48,7 +48,7 @@ std::string LLImageJ2C::getEngineInfo() { // All known LLImageJ2CImpl implementation subclasses are cheap to // construct. - boost::scoped_ptr<LLImageJ2CImpl> impl(fallbackCreateLLImageJ2CImpl()); + std::unique_ptr<LLImageJ2CImpl> impl(fallbackCreateLLImageJ2CImpl()); return impl->getEngineInfo(); } diff --git a/indra/llimage/llimagej2c.h b/indra/llimage/llimagej2c.h index e196f7479e..b30df6f776 100644 --- a/indra/llimage/llimagej2c.h +++ b/indra/llimage/llimagej2c.h @@ -95,7 +95,7 @@ protected: S8 mRawDiscardLevel; F32 mRate; bool mReversible; - boost::scoped_ptr<LLImageJ2CImpl> mImpl; + std::unique_ptr<LLImageJ2CImpl> mImpl; std::string mLastError; // Image compression/decompression tester diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 873f214f70..d220731f6a 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -32,6 +32,7 @@ #include "llinventorydefines.h" #include "llxorcipher.h" #include "llsd.h" +#include "llsdserialize.h" #include "message.h" #include <boost/tokenizer.hpp> @@ -217,7 +218,19 @@ bool LLInventoryObject::importLegacyStream(std::istream& input_stream) } else if (0 == strcmp("metadata", keyword)) { - LLSD metadata(valuestr); + LLSD metadata; + if (strncmp("<llsd>", valuestr, 6) == 0) + { + std::istringstream stream(valuestr); + LLSDSerialize::fromXML(metadata, stream); + } + else + { + // next line likely contains metadata, but at the moment is not supported + // can do something like: + // LLSDSerialize::fromNotation(metadata, input_stream, -1); + } + if (metadata.has("thumbnail")) { const LLSD& thumbnail = metadata["thumbnail"]; @@ -693,7 +706,19 @@ bool LLInventoryItem::importLegacyStream(std::istream& input_stream) } else if (0 == strcmp("metadata", keyword)) { - LLSD metadata(valuestr); + LLSD metadata; + if (strncmp("<llsd>", valuestr, 6) == 0) + { + std::istringstream stream(valuestr); + LLSDSerialize::fromXML(metadata, stream); + } + else + { + // next line likely contains metadata, but at the moment is not supported + // can do something like: + // LLSDSerialize::fromNotation(metadata, input_stream, -1); + } + if (metadata.has("thumbnail")) { const LLSD& thumbnail = metadata["thumbnail"]; @@ -802,9 +827,14 @@ bool LLInventoryItem::exportLegacyStream(std::ostream& output_stream, bool inclu if (mThumbnailUUID.notNull()) { + // Max length is 255 chars, will have to export differently if it gets more data + // Ex: use newline and toNotation (uses {}) for unlimited size LLSD metadata; metadata["thumbnail"] = LLSD().with("asset_id", mThumbnailUUID); - output_stream << "\t\tmetadata\t" << metadata << "|\n"; + + output_stream << "\t\tmetadata\t"; + LLSDSerialize::toXML(metadata, output_stream); + output_stream << "|\n"; } // Check for permissions to see the asset id, and if so write it @@ -1303,7 +1333,19 @@ bool LLInventoryCategory::importLegacyStream(std::istream& input_stream) } else if (0 == strcmp("metadata", keyword)) { - LLSD metadata(valuestr); + LLSD metadata; + if (strncmp("<llsd>", valuestr, 6) == 0) + { + std::istringstream stream(valuestr); + LLSDSerialize::fromXML(metadata, stream); + } + else + { + // next line likely contains metadata, but at the moment is not supported + // can do something like: + // LLSDSerialize::fromNotation(metadata, input_stream, -1); + } + if (metadata.has("thumbnail")) { const LLSD& thumbnail = metadata["thumbnail"]; @@ -1343,9 +1385,12 @@ bool LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, bool) output_stream << "\t\tname\t" << mName.c_str() << "|\n"; if (mThumbnailUUID.notNull()) { + // Only up to 255 chars LLSD metadata; metadata["thumbnail"] = LLSD().with("asset_id", mThumbnailUUID); - output_stream << "\t\tmetadata\t" << metadata << "|\n"; + output_stream << "\t\tmetadata\t"; + LLSDSerialize::toXML(metadata, output_stream); + output_stream << "|\n"; } output_stream << "\t}\n"; return true; diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 598e28921d..36d9e1c900 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -949,7 +949,7 @@ const std::string& LLParcel::getActionString(LLParcel::EAction action) bool LLParcel::isSaleTimerExpired(const U64& time) { - if (mSaleTimerExpires.getStarted() == false) + if (!mSaleTimerExpires.getStarted()) { return false; } @@ -963,7 +963,7 @@ bool LLParcel::isSaleTimerExpired(const U64& time) bool LLParcel::isMediaResetTimerExpired(const U64& time) { - if (mMediaResetTimer.getStarted() == false) + if (!mMediaResetTimer.getStarted()) { return false; } diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 0311a5bbd5..70522d3682 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -444,82 +444,50 @@ public: // more accessors - U32 getParcelFlags() const { return mParcelFlags; } + U32 getParcelFlags() const { return mParcelFlags; } - bool getParcelFlag(U32 flag) const - { return (mParcelFlags & flag) ? true : false; } + bool getParcelFlag(U32 flag) const { return (mParcelFlags & flag) != 0; } // objects can be added or modified by anyone (only parcel owner if disabled) - bool getAllowModify() const - { return (mParcelFlags & PF_CREATE_OBJECTS) ? true : false; } + bool getAllowModify() const { return getParcelFlag(PF_CREATE_OBJECTS); } // objects can be added or modified by group members - bool getAllowGroupModify() const - { return (mParcelFlags & PF_CREATE_GROUP_OBJECTS) ? true : false; } + bool getAllowGroupModify() const { return getParcelFlag(PF_CREATE_GROUP_OBJECTS); } // the parcel can be deeded to the group - bool getAllowDeedToGroup() const - { return (mParcelFlags & PF_ALLOW_DEED_TO_GROUP) ? true : false; } + bool getAllowDeedToGroup() const { return getParcelFlag(PF_ALLOW_DEED_TO_GROUP); } // Does the owner want to make a contribution along with the deed. - bool getContributeWithDeed() const - { return (mParcelFlags & PF_CONTRIBUTE_WITH_DEED) ? true : false; } + bool getContributeWithDeed() const { return getParcelFlag(PF_CONTRIBUTE_WITH_DEED); } // heightfield can be modified - bool getAllowTerraform() const - { return (mParcelFlags & PF_ALLOW_TERRAFORM) ? true : false; } + bool getAllowTerraform() const { return getParcelFlag(PF_ALLOW_TERRAFORM); } // avatars can be hurt here - bool getAllowDamage() const - { return (mParcelFlags & PF_ALLOW_DAMAGE) ? true : false; } - - bool getAllowFly() const - { return (mParcelFlags & PF_ALLOW_FLY) ? true : false; } - - bool getAllowGroupScripts() const - { return (mParcelFlags & PF_ALLOW_GROUP_SCRIPTS) ? true : false; } - - bool getAllowOtherScripts() const - { return (mParcelFlags & PF_ALLOW_OTHER_SCRIPTS) ? true : false; } - - bool getAllowAllObjectEntry() const - { return (mParcelFlags & PF_ALLOW_ALL_OBJECT_ENTRY) ? true : false; } - - bool getAllowGroupObjectEntry() const - { return (mParcelFlags & PF_ALLOW_GROUP_OBJECT_ENTRY) ? true : false; } - - bool getForSale() const - { return (mParcelFlags & PF_FOR_SALE) ? true : false; } - bool getSoundLocal() const - { return (mParcelFlags & PF_SOUND_LOCAL) ? true : false; } - bool getParcelFlagAllowVoice() const - { return (mParcelFlags & PF_ALLOW_VOICE_CHAT) ? true : false; } - bool getParcelFlagUseEstateVoiceChannel() const - { return (mParcelFlags & PF_USE_ESTATE_VOICE_CHAN) ? true : false; } - bool getAllowPublish() const - { return (mParcelFlags & PF_ALLOW_PUBLISH) ? true : false; } - bool getMaturePublish() const - { return (mParcelFlags & PF_MATURE_PUBLISH) ? true : false; } - bool getRestrictPushObject() const - { return (mParcelFlags & PF_RESTRICT_PUSHOBJECT) ? true : false; } - bool getRegionPushOverride() const - { return mRegionPushOverride; } - bool getRegionDenyAnonymousOverride() const - { return mRegionDenyAnonymousOverride; } - bool getRegionDenyAgeUnverifiedOverride() const - { return mRegionDenyAgeUnverifiedOverride; } - bool getRegionAllowAccessOverride() const - { return mRegionAllowAccessoverride; } - bool getRegionAllowEnvironmentOverride() const - { return mRegionAllowEnvironmentOverride; } - S32 getParcelEnvironmentVersion() const - { return mCurrentEnvironmentVersion; } - - - bool getAllowGroupAVSounds() const { return mAllowGroupAVSounds; } - bool getAllowAnyAVSounds() const { return mAllowAnyAVSounds; } - - bool getObscureMOAP() const { return mObscureMOAP; } + bool getAllowDamage() const { return getParcelFlag(PF_ALLOW_DAMAGE); } + + bool getAllowFly() const { return getParcelFlag(PF_ALLOW_FLY); } + bool getAllowGroupScripts() const { return getParcelFlag(PF_ALLOW_GROUP_SCRIPTS); } + bool getAllowOtherScripts() const { return getParcelFlag(PF_ALLOW_OTHER_SCRIPTS); } + bool getAllowAllObjectEntry() const { return getParcelFlag(PF_ALLOW_ALL_OBJECT_ENTRY); } + bool getAllowGroupObjectEntry() const { return getParcelFlag(PF_ALLOW_GROUP_OBJECT_ENTRY); } + bool getForSale() const { return getParcelFlag(PF_FOR_SALE); } + bool getSoundLocal() const { return getParcelFlag(PF_SOUND_LOCAL); } + bool getParcelFlagAllowVoice() const { return getParcelFlag(PF_ALLOW_VOICE_CHAT); } + bool getParcelFlagUseEstateVoiceChannel() const { return getParcelFlag(PF_USE_ESTATE_VOICE_CHAN); } + bool getAllowPublish() const { return getParcelFlag(PF_ALLOW_PUBLISH); } + bool getMaturePublish() const { return getParcelFlag(PF_MATURE_PUBLISH); } + bool getRestrictPushObject() const { return getParcelFlag(PF_RESTRICT_PUSHOBJECT); } + + bool getRegionPushOverride() const { return mRegionPushOverride; } + bool getRegionDenyAnonymousOverride() const { return mRegionDenyAnonymousOverride; } + bool getRegionDenyAgeUnverifiedOverride() const { return mRegionDenyAgeUnverifiedOverride; } + bool getRegionAllowAccessOverride() const { return mRegionAllowAccessoverride; } + bool getRegionAllowEnvironmentOverride() const { return mRegionAllowEnvironmentOverride; } + S32 getParcelEnvironmentVersion() const { return mCurrentEnvironmentVersion; } + bool getAllowGroupAVSounds() const { return mAllowGroupAVSounds; } + bool getAllowAnyAVSounds() const { return mAllowAnyAVSounds; } + bool getObscureMOAP() const { return mObscureMOAP; } F32 getDrawDistance() const { return mDrawDistance; } S32 getSalePrice() const { return mSalePrice; } @@ -597,7 +565,7 @@ public: LLUUID getPreviousOwnerID() const { return mPreviousOwnerID; } bool getPreviouslyGroupOwned() const { return mPreviouslyGroupOwned; } - bool getSellWithObjects() const { return (mParcelFlags & PF_SELL_PARCEL_OBJECTS) ? true : false; } + bool getSellWithObjects() const { return getParcelFlag(PF_SELL_PARCEL_OBJECTS); } protected: LLUUID mID; diff --git a/indra/llinventory/llpermissions.h b/indra/llinventory/llpermissions.h index f6a3db463d..4f6920f27a 100644 --- a/indra/llinventory/llpermissions.h +++ b/indra/llinventory/llpermissions.h @@ -151,10 +151,10 @@ public: U32 getMaskEveryone() const { return mMaskEveryone; } U32 getMaskNextOwner() const { return mMaskNextOwner; } - // return TRUE if the object has any owner + // return true if the object has any owner bool isOwned() const { return (mOwner.notNull() || mIsGroupOwned); } - // return TRUE if group_id is owner. + // return true if group_id is owner. bool isGroupOwned() const { return mIsGroupOwned; } // This API returns true if the object is owned at all, and false diff --git a/indra/llkdu/llimagej2ckdu.h b/indra/llkdu/llimagej2ckdu.h index b57e4cc40e..fe3902380c 100644 --- a/indra/llkdu/llimagej2ckdu.h +++ b/indra/llkdu/llimagej2ckdu.h @@ -113,10 +113,10 @@ private: }; // Encode variable - boost::scoped_ptr<LLKDUMemSource> mInputp; + std::unique_ptr<LLKDUMemSource> mInputp; CodeStreamHolder mCodeStreamp; - boost::scoped_ptr<kdu_core::kdu_coords> mTPosp; // tile position - boost::scoped_ptr<kdu_core::kdu_dims> mTileIndicesp; + std::unique_ptr<kdu_core::kdu_coords> mTPosp; // tile position + std::unique_ptr<kdu_core::kdu_dims> mTileIndicesp; int mBlocksSize; int mPrecinctsSize; int mLevels; @@ -125,7 +125,7 @@ private: // We don't own this LLImageRaw. We're simply pointing to an instance // passed into initDecode(). LLImageRaw *mRawImagep; - boost::scoped_ptr<LLKDUDecodeState> mDecodeState; + std::unique_ptr<LLKDUDecodeState> mDecodeState; }; #endif diff --git a/indra/llmath/llsphere.cpp b/indra/llmath/llsphere.cpp index 7292e3c0de..3f04ca704c 100644 --- a/indra/llmath/llsphere.cpp +++ b/indra/llmath/llsphere.cpp @@ -73,14 +73,14 @@ F32 LLSphere::getRadius() const bool LLSphere::contains(const LLSphere& other_sphere) const { F32 separation = (mCenter - other_sphere.mCenter).length(); - return (mRadius >= separation + other_sphere.mRadius) ? true : false; + return mRadius >= separation + other_sphere.mRadius; } // returns 'true' if this sphere completely contains other_sphere bool LLSphere::overlaps(const LLSphere& other_sphere) const { F32 separation = (mCenter - other_sphere.mCenter).length(); - return (separation <= mRadius + other_sphere.mRadius) ? true : false; + return mRadius >= separation - other_sphere.mRadius; } // returns overlap @@ -93,9 +93,8 @@ F32 LLSphere::getOverlap(const LLSphere& other_sphere) const bool LLSphere::operator==(const LLSphere& rhs) const { - // TODO? -- use approximate equality for centers? - return (mRadius == rhs.mRadius - && mCenter == rhs.mCenter); + return fabs(mRadius - rhs.mRadius) <= FLT_EPSILON && + (mCenter - rhs.mCenter).length() <= FLT_EPSILON; } std::ostream& operator<<( std::ostream& output_stream, const LLSphere& sphere) diff --git a/indra/llmath/lltreenode.h b/indra/llmath/lltreenode.h index 0b479c4564..ce104b88a0 100644 --- a/indra/llmath/lltreenode.h +++ b/indra/llmath/lltreenode.h @@ -56,10 +56,11 @@ public: virtual bool insert(T* data); virtual bool remove(T* data); virtual void notifyRemoval(T* data); - virtual U32 getListenerCount() { return mListeners.size(); } + virtual U32 hasListeners() const { return !mListeners.empty(); } + virtual U32 getListenerCount() const { return mListeners.size(); } virtual LLTreeListener<T>* getListener(U32 index) const { - if(index < mListeners.size()) + if (index < mListeners.size()) { return mListeners[index]; } diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 5375e2813b..a4b039fd55 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -6878,45 +6878,63 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build) mIndices[cur_index++] = s+1 + mNumS*t; //bottom right mIndices[cur_index++] = s+1 + mNumS*(t+1); //top right - mEdge[cur_edge++] = (mNumS-1)*2*t+s*2+1; //bottom left/top right neighbor face - if (t < mNumT-2) { //top right/top left neighbor face + // bottom left/top right neighbor face + mEdge[cur_edge++] = (mNumS-1)*2*t+s*2+1; + + if (t < mNumT-2) + { // top right/top left neighbor face mEdge[cur_edge++] = (mNumS-1)*2*(t+1)+s*2+1; } - else if (mNumT <= 3 || volume->getPath().isOpen() == true) { //no neighbor + else if (mNumT <= 3 || volume->getPath().isOpen()) + { // no neighbor mEdge[cur_edge++] = -1; } - else { //wrap on T + else + { // wrap on T mEdge[cur_edge++] = s*2+1; } - if (s > 0) { //top left/bottom left neighbor face + + if (s > 0) + { // top left/bottom left neighbor face mEdge[cur_edge++] = (mNumS-1)*2*t+s*2-1; } - else if (flat_face || volume->getProfile().isOpen() == true) { //no neighbor + else if (flat_face || volume->getProfile().isOpen()) + { // no neighbor mEdge[cur_edge++] = -1; } - else { //wrap on S + else + { // wrap on S mEdge[cur_edge++] = (mNumS-1)*2*t+(mNumS-2)*2+1; } - - if (t > 0) { //bottom left/bottom right neighbor face + + if (t > 0) + { // bottom left/bottom right neighbor face mEdge[cur_edge++] = (mNumS-1)*2*(t-1)+s*2; } - else if (mNumT <= 3 || volume->getPath().isOpen() == true) { //no neighbor + else if (mNumT <= 3 || volume->getPath().isOpen()) + { // no neighbor mEdge[cur_edge++] = -1; } - else { //wrap on T + else + { // wrap on T mEdge[cur_edge++] = (mNumS-1)*2*(mNumT-2)+s*2; } - if (s < mNumS-2) { //bottom right/top right neighbor face + + if (s < mNumS-2) + { // bottom right/top right neighbor face mEdge[cur_edge++] = (mNumS-1)*2*t+(s+1)*2; } - else if (flat_face || volume->getProfile().isOpen() == true) { //no neighbor + else if (flat_face || volume->getProfile().isOpen()) + { // no neighbor mEdge[cur_edge++] = -1; } - else { //wrap on S + else + { // wrap on S mEdge[cur_edge++] = (mNumS-1)*2*t; } - mEdge[cur_edge++] = (mNumS-1)*2*t+s*2; //top right/bottom left neighbor face + + // top right/bottom left neighbor face + mEdge[cur_edge++] = (mNumS-1)*2*t+s*2; } } } @@ -7053,7 +7071,7 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build) if (sculpt_stitching == LL_SCULPT_TYPE_NONE) // logic for non-sculpt volumes { - if (volume->getPath().isOpen() == false) + if (!volume->getPath().isOpen()) { //wrap normals on T for (S32 i = 0; i < mNumS; i++) { @@ -7064,7 +7082,7 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build) } } - if ((volume->getProfile().isOpen() == false) && !(s_bottom_converges)) + if (!volume->getProfile().isOpen() && !s_bottom_converges) { //wrap normals on S for (S32 i = 0; i < mNumT; i++) { diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 0df46da9d0..d4099b6366 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -1000,7 +1000,7 @@ class LLVolume : public LLRefCount friend class LLVolumeLODGroup; protected: - ~LLVolume(); // use unref + virtual ~LLVolume(); // use unref public: typedef std::vector<LLVolumeFace> face_list_t; diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp index d1e145cff1..06794fd23f 100644 --- a/indra/llmath/llvolumemgr.cpp +++ b/indra/llmath/llvolumemgr.cpp @@ -71,7 +71,7 @@ bool LLVolumeMgr::cleanup() iter != end; iter++) { LLVolumeLODGroup *volgroupp = iter->second; - if (volgroupp->cleanupRefs() == false) + if (!volgroupp->cleanupRefs()) { no_refs = false; } diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index cef4d66c04..61455affec 100644 --- a/indra/llmath/llvolumeoctree.cpp +++ b/indra/llmath/llvolumeoctree.cpp @@ -71,10 +71,9 @@ bool LLLineSegmentBoxIntersect(const LLVector4a& start, const LLVector4a& end, c grt = f.greaterThan(rhs).getGatheredBits(); - return (grt & 0x7) ? false : true; + return (grt & 0x7) == 0; } - LLVolumeOctreeListener::LLVolumeOctreeListener(LLOctreeNode<LLVolumeTriangle, LLVolumeTriangle*>* node) { node->addListener(this); @@ -84,7 +83,7 @@ LLVolumeOctreeListener::~LLVolumeOctreeListener() { } - + void LLVolumeOctreeListener::handleChildAddition(const LLOctreeNode<LLVolumeTriangle, LLVolumeTriangle*>* parent, LLOctreeNode<LLVolumeTriangle, LLVolumeTriangle*>* child) { diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index c90b6d86ad..5b4f9aded7 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -87,19 +87,19 @@ public: LLUUID mID; LLCacheNameSignal mSignal; LLHost mHost; - + PendingReply(const LLUUID& id, const LLHost& host) : mID(id), mHost(host) { } - + boost::signals2::connection setCallback(const LLCacheNameCallback& cb) { return mSignal.connect(cb); } - + void done() { mID.setNull(); } - bool isDone() const { return mID.isNull() != false; } + bool isDone() const { return mID.isNull(); } }; class ReplySender diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp index ebbaea9b12..c0a5e361b1 100644 --- a/indra/llmessage/llcoproceduremanager.cpp +++ b/indra/llmessage/llcoproceduremanager.cpp @@ -95,7 +95,7 @@ public: private: struct QueuedCoproc { - typedef boost::shared_ptr<QueuedCoproc> ptr_t; + typedef std::shared_ptr<QueuedCoproc> ptr_t; QueuedCoproc(const std::string &name, const LLUUID &id, CoProcedure_t proc) : mName(name), @@ -115,7 +115,7 @@ private: // Use shared_ptr to control the lifespan of our CoprocQueue_t instance // because the consuming coroutine might outlive this LLCoprocedurePool // instance. - typedef boost::shared_ptr<CoprocQueue_t> CoprocQueuePtr; + typedef std::shared_ptr<CoprocQueue_t> CoprocQueuePtr; std::string mPoolName; size_t mPoolSize, mActiveCoprocsCount, mPending; @@ -301,7 +301,7 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size): mPoolSize(size), mActiveCoprocsCount(0), mPending(0), - mPendingCoprocs(boost::make_shared<CoprocQueue_t>(LLCoprocedureManager::DEFAULT_QUEUE_SIZE)), + mPendingCoprocs(std::make_shared<CoprocQueue_t>(LLCoprocedureManager::DEFAULT_QUEUE_SIZE)), mHTTPPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID), mCoroMapping() { @@ -384,7 +384,7 @@ LLUUID LLCoprocedurePool::enqueueCoprocedure(const std::string &name, LLCoproced LL_INFOS("CoProcMgr") << "Coprocedure(" << name << ") enqueuing with id=" << id.asString() << " in pool \"" << mPoolName << "\" at " << mPending << LL_ENDL; } - auto pushed = mPendingCoprocs->try_push(boost::make_shared<QueuedCoproc>(name, id, proc)); + auto pushed = mPendingCoprocs->try_push(std::make_shared<QueuedCoproc>(name, id, proc)); if (pushed == boost::fibers::channel_op_status::success) { ++mPending; diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h index 6d0d68cf24..fc561c6b0f 100644 --- a/indra/llmessage/llcorehttputil.h +++ b/indra/llmessage/llcorehttputil.h @@ -263,8 +263,8 @@ class HttpCoroHandler : public LLCore::HttpHandler { public: - typedef boost::shared_ptr<HttpCoroHandler> ptr_t; - typedef boost::weak_ptr<HttpCoroHandler> wptr_t; + typedef std::shared_ptr<HttpCoroHandler> ptr_t; + typedef std::weak_ptr<HttpCoroHandler> wptr_t; HttpCoroHandler(LLEventStream &reply); @@ -317,8 +317,8 @@ public: static const std::string HTTP_RESULTS_CONTENT; static const std::string HTTP_RESULTS_RAW; - typedef boost::shared_ptr<HttpCoroutineAdapter> ptr_t; - typedef boost::weak_ptr<HttpCoroutineAdapter> wptr_t; + typedef std::shared_ptr<HttpCoroutineAdapter> ptr_t; + typedef std::weak_ptr<HttpCoroutineAdapter> wptr_t; HttpCoroutineAdapter(const std::string &name, LLCore::HttpRequest::policy_t policyId); ~HttpCoroutineAdapter(); diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index b3113cd5d8..1545443798 100644 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -298,6 +298,13 @@ bool LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char } htolememcpy(&size, mCurBufferp, MVT_S32, 4); + + if (size < 0) + { + LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData unpacked invalid size, aborting!" << LL_ENDL; + return false; + } + mCurBufferp += 4; if (!verifyLength(size, name)) diff --git a/indra/llmessage/llexperiencecache.h b/indra/llmessage/llexperiencecache.h index 8be4c64dfc..3ee45da2e7 100644 --- a/indra/llmessage/llexperiencecache.h +++ b/indra/llmessage/llexperiencecache.h @@ -112,7 +112,7 @@ private: // Callback types for get() typedef boost::signals2::signal < void(const LLSD &) > callback_signal_t; - typedef boost::shared_ptr<callback_signal_t> signal_ptr; + typedef std::shared_ptr<callback_signal_t> signal_ptr; // May have multiple callbacks for a single ID, which are // represented as multiple slots bound to the signal. // Avoid copying signals via pointers. diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index c707c7ad09..e302dd2b5e 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -982,7 +982,7 @@ LLHTTPNode& LLIOHTTPServer::create( } LLHTTPResponseFactory* factory = new LLHTTPResponseFactory; - boost::shared_ptr<LLChainIOFactory> factory_ptr(factory); + std::shared_ptr<LLChainIOFactory> factory_ptr(factory); LLIOServerSocket* server = new LLIOServerSocket(pool, socket, factory_ptr); diff --git a/indra/llmessage/lliopipe.h b/indra/llmessage/lliopipe.h index 7fd4cee8ba..e6ac8ebfc2 100644 --- a/indra/llmessage/lliopipe.h +++ b/indra/llmessage/lliopipe.h @@ -89,7 +89,7 @@ public: /** * @brief Scattered memory container. */ - typedef boost::shared_ptr<LLBufferArray> buffer_ptr_t; + typedef std::shared_ptr<LLBufferArray> buffer_ptr_t; /** * @brief Enumeration for IO return codes diff --git a/indra/llmessage/lliosocket.h b/indra/llmessage/lliosocket.h index 303d80eb14..a62b3c0204 100644 --- a/indra/llmessage/lliosocket.h +++ b/indra/llmessage/lliosocket.h @@ -65,7 +65,7 @@ public: /** * @brief Reference counted shared pointers to sockets. */ - typedef boost::shared_ptr<LLSocket> ptr_t; + typedef std::shared_ptr<LLSocket> ptr_t; /** * @brief Type of socket to create. @@ -305,7 +305,7 @@ class LLIOServerSocket : public LLIOPipe { public: typedef LLSocket::ptr_t socket_t; - typedef boost::shared_ptr<LLChainIOFactory> factory_t; + typedef std::shared_ptr<LLChainIOFactory> factory_t; LLIOServerSocket(apr_pool_t* pool, socket_t listener, factory_t reactor); virtual ~LLIOServerSocket(); diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index 44720f0015..52e6be6f98 100644 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -113,7 +113,7 @@ void ll_debug_poll_fd(const char* msg, const apr_pollfd_t* poll) { LL_DEBUGS() << "Poll -- " << (msg?msg:"") << ": no descriptor." << LL_ENDL; } -#endif +#endif } /** @@ -181,12 +181,13 @@ bool LLPumpIO::prime(apr_pool_t* pool) { cleanup(); initialize(pool); - return ((pool == NULL) ? false : true); + return pool != nullptr; } bool LLPumpIO::addChain(const chain_t& chain, F32 timeout, bool has_curl_request) { - if(chain.empty()) return false; + if (chain.empty()) + return false; LLChainInfo info; info.mHasCurlRequest = has_curl_request; @@ -218,12 +219,13 @@ bool LLPumpIO::addChain( LLSD context, F32 timeout) { - // remember that if the caller is providing a full link // description, we need to have that description matched to a // particular buffer. - if(!data) return false; - if(links.empty()) return false; + if (!data) + return false; + if (links.empty()) + return false; #if LL_DEBUG_PIPE_TYPE_IN_PUMP LL_DEBUGS() << "LLPumpIO::addChain() " << links[0].mPipe << " '" @@ -243,10 +245,11 @@ bool LLPumpIO::addChain( bool LLPumpIO::setTimeoutSeconds(F32 timeout) { // If no chain is running, return failure. - if(mRunningChains.end() == mCurrentChain) + if (mRunningChains.end() == mCurrentChain) { return false; } + (*mCurrentChain).setTimeoutSeconds(timeout); return true; } @@ -254,7 +257,7 @@ bool LLPumpIO::setTimeoutSeconds(F32 timeout) void LLPumpIO::adjustTimeoutSeconds(F32 delta) { // Ensure a chain is running - if(mRunningChains.end() != mCurrentChain) + if (mRunningChains.end() != mCurrentChain) { (*mCurrentChain).adjustTimeoutSeconds(delta); } @@ -263,27 +266,27 @@ void LLPumpIO::adjustTimeoutSeconds(F32 delta) static std::string events_2_string(apr_int16_t events) { std::ostringstream ostr; - if(events & APR_POLLIN) + if (events & APR_POLLIN) { ostr << "read,"; } - if(events & APR_POLLPRI) + if (events & APR_POLLPRI) { ostr << "priority,"; } - if(events & APR_POLLOUT) + if (events & APR_POLLOUT) { ostr << "write,"; } - if(events & APR_POLLERR) + if (events & APR_POLLERR) { ostr << "error,"; } - if(events & APR_POLLHUP) + if (events & APR_POLLHUP) { ostr << "hangup,"; } - if(events & APR_POLLNVAL) + if (events & APR_POLLNVAL) { ostr << "invalid,"; } @@ -292,7 +295,8 @@ static std::string events_2_string(apr_int16_t events) bool LLPumpIO::setConditional(LLIOPipe* pipe, const apr_pollfd_t* poll) { - if(!pipe) return false; + if (!pipe) + return false; ll_debug_poll_fd("Set conditional", poll); LL_DEBUGS() << "Setting conditionals (" << (poll ? events_2_string(poll->reqevents) :"null") diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h index 489765e0ac..ab2d127f6e 100644 --- a/indra/llmessage/llregionflags.h +++ b/indra/llmessage/llregionflags.h @@ -106,11 +106,16 @@ const U64 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE | REGION_FLAGS_DENY_ANONYMOUS | REGION_FLAGS_DENY_AGEUNVERIFIED; +inline bool is_flag_set(U64 flags, U64 flag) +{ + return (flags & flag) != 0; +} + inline bool is_prelude( U64 flags ) { // definition of prelude does not depend on fixed-sun - return 0 == (flags & REGION_FLAGS_PRELUDE_UNSET) - && 0 != (flags & REGION_FLAGS_PRELUDE_SET); + return !is_flag_set(flags, REGION_FLAGS_PRELUDE_UNSET) && + is_flag_set(flags, REGION_FLAGS_PRELUDE_SET); } inline U64 set_prelude_flags(U64 flags) diff --git a/indra/llmessage/llservice.h b/indra/llmessage/llservice.h index 9c09aeb44c..f215acab56 100644 --- a/indra/llmessage/llservice.h +++ b/indra/llmessage/llservice.h @@ -116,7 +116,7 @@ class LLService : public LLIOPipe public: //typedef boost::intrusive_ptr<LLServiceCreator> creator_t; //typedef boost::intrusive_ptr<LLService> service_t; - typedef boost::shared_ptr<LLChainIOFactory> creator_t; + typedef std::shared_ptr<LLChainIOFactory> creator_t; /** * @brief This method is used to register a protocol name with a diff --git a/indra/llmessage/llstoredmessage.h b/indra/llmessage/llstoredmessage.h index 9c98e2c558..6ea150fda3 100644 --- a/indra/llmessage/llstoredmessage.h +++ b/indra/llmessage/llstoredmessage.h @@ -46,7 +46,7 @@ private: std::string mName; }; -typedef boost::shared_ptr<LLStoredMessage> LLStoredMessagePtr; +typedef std::shared_ptr<LLStoredMessage> LLStoredMessagePtr; #endif // LL_STOREDMESSAGE_H diff --git a/indra/llmessage/lluseroperation.cpp b/indra/llmessage/lluseroperation.cpp index 3e387d3d5e..6b0cc63686 100644 --- a/indra/llmessage/lluseroperation.cpp +++ b/indra/llmessage/lluseroperation.cpp @@ -138,7 +138,7 @@ bool LLUserOperationMgr::deleteOperation(LLUserOperation* op) delete op; op = NULL; } - return rv ? true : false; + return rv != 0; } void LLUserOperationMgr::deleteExpiredOperations() diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 0d7810a659..272bf9b672 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -1947,7 +1947,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, // passed the circuit code and session id check, so we will go // ahead and persist the ID associated. LLCircuitData *cdp = msg->mCircuitInfo.findCircuit(msg->getSender()); - bool had_circuit_already = cdp ? true : false; + bool had_circuit_already = cdp != nullptr; msg->enableCircuit(msg->getSender(), false); cdp = msg->mCircuitInfo.findCircuit(msg->getSender()); diff --git a/indra/llmessage/tests/llcurl_stub.cpp b/indra/llmessage/tests/llcurl_stub.cpp index b7fdf4f437..1c571a74da 100644 --- a/indra/llmessage/tests/llcurl_stub.cpp +++ b/indra/llmessage/tests/llcurl_stub.cpp @@ -49,7 +49,7 @@ void LLCurl::Responder::httpCompleted() } void LLCurl::Responder::completedRaw(LLChannelDescriptors const&, - boost::shared_ptr<LLBufferArray> const&) + std::shared_ptr<LLBufferArray> const&) { } diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index ba76ae4e37..d56712257b 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -335,7 +335,7 @@ public: // "init_history" message void initializeUrlHistory(const LLSD& url_history); - boost::shared_ptr<LLPluginClassMedia> getSharedPtr() { return boost::dynamic_pointer_cast<LLPluginClassMedia>(shared_from_this()); } // due to enable_shared_from_this + std::shared_ptr<LLPluginClassMedia> getSharedPtr() { return std::dynamic_pointer_cast<LLPluginClassMedia>(shared_from_this()); } // due to enable_shared_from_this protected: diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h index 1893c9e657..01627925d7 100644 --- a/indra/llplugin/llpluginprocessparent.h +++ b/indra/llplugin/llpluginprocessparent.h @@ -43,7 +43,7 @@ #include "llsd.h" #include "llevents.h" -class LLPluginProcessParentOwner : public boost::enable_shared_from_this < LLPluginProcessParentOwner > +class LLPluginProcessParentOwner : public std::enable_shared_from_this < LLPluginProcessParentOwner > { public: virtual ~LLPluginProcessParentOwner(); @@ -60,7 +60,7 @@ class LLPluginProcessParent : public LLPluginMessagePipeOwner LLPluginProcessParent(LLPluginProcessParentOwner *owner); public: - typedef boost::shared_ptr<LLPluginProcessParent> ptr_t; + typedef std::shared_ptr<LLPluginProcessParent> ptr_t; ~LLPluginProcessParent(); diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index cf7b40dc73..b3ae249951 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -53,8 +53,6 @@ #pragma warning (default : 4264) #endif -#include <boost/lexical_cast.hpp> - #include "lldaeloader.h" #include "llsdserialize.h" #include "lljoint.h" @@ -2385,7 +2383,7 @@ std::string LLDAELoader::getElementLabel(daeElement *element) if (ind > 0) { - index_string = "_" + boost::lexical_cast<std::string>(ind); + index_string = "_" + std::to_string(ind); } // if parent has a name or ID, use it diff --git a/indra/llprimitive/llgltfloader.cpp b/indra/llprimitive/llgltfloader.cpp index 7394f99794..8e498158d6 100644 --- a/indra/llprimitive/llgltfloader.cpp +++ b/indra/llprimitive/llgltfloader.cpp @@ -48,8 +48,6 @@ // TODO: includes inherited from dae loader. Validate / prune -#include <boost/lexical_cast.hpp> - #include "llsdserialize.h" #include "lljoint.h" diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index d7c17be779..c208e538fc 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -50,7 +50,7 @@ std::string model_names[] = const int MODEL_NAMES_LENGTH = sizeof(model_names) / sizeof(std::string); -LLModel::LLModel(LLVolumeParams& params, F32 detail) +LLModel::LLModel(const LLVolumeParams& params, F32 detail) : LLVolume(params, detail), mNormalizedScale(1,1,1), mNormalizedTranslation(0, 0, 0), @@ -68,6 +68,7 @@ LLModel::~LLModel() { LLConvexDecomposition::getInstance()->deleteDecomposition(mDecompID); } + mPhysics.mMesh.clear(); } //static diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index f6c0061b3e..37e76c895c 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -106,6 +106,8 @@ public: std::vector<LLVector3> mPositions; std::vector<LLVector3> mNormals; + ~PhysicsMesh() {} + void clear() { mPositions.clear(); @@ -131,6 +133,7 @@ public: public: Decomposition() { } Decomposition(LLSD& data); + ~Decomposition() { } void fromLLSD(LLSD& data); LLSD asLLSD() const; bool hasHullList() const; @@ -147,7 +150,7 @@ public: LLModel::PhysicsMesh mPhysicsShapeMesh; }; - LLModel(LLVolumeParams& params, F32 detail); + LLModel(const LLVolumeParams& params, F32 detail); ~LLModel(); bool loadModel(std::istream& is); @@ -253,17 +256,18 @@ public: } }; - //Are the doubles the same w/in epsilon specified tolerance bool areEqual( double a, double b ) { const float epsilon = 1e-5f; - return (fabs((a - b)) < epsilon) ? true : false ; + return fabs(a - b) < epsilon; } + //Make sure that we return false for any values that are within the tolerance for equivalence bool jointPositionalLookup( const LLVector3& a, const LLVector3& b ) { - return ( areEqual( a[0],b[0]) && areEqual( a[1],b[1] ) && areEqual( a[2],b[2]) ) ? true : false; + const float epsilon = 1e-5f; + return (a - b).length() < epsilon; } //copy of position array for this model -- mPosition[idx].mV[X,Y,Z] @@ -365,13 +369,13 @@ class LLModelInstanceBase { public: LLPointer<LLModel> mModel; - LLPointer<LLModel> mLOD[5]; + LLPointer<LLModel> mLOD[LLModel::NUM_LODS]; LLUUID mMeshID; LLMatrix4 mTransform; material_map mMaterial; - LLModelInstanceBase(LLModel* model, LLMatrix4& transform, material_map& materials) + LLModelInstanceBase(LLModel* model, const LLMatrix4& transform, const material_map& materials) : mModel(model), mTransform(transform), mMaterial(materials) { } @@ -380,6 +384,15 @@ public: : mModel(NULL) { } + + virtual ~LLModelInstanceBase() + { + mModel = NULL; + for (int j = 0; j < LLModel::NUM_LODS; ++j) + { + mLOD[j] = NULL; + } + }; }; typedef std::vector<LLModelInstanceBase> model_instance_list; @@ -391,7 +404,7 @@ public: LLUUID mMeshID; S32 mLocalMeshID; - LLModelInstance(LLModel* model, const std::string& label, LLMatrix4& transform, material_map& materials) + LLModelInstance(LLModel* model, const std::string& label, const LLMatrix4& transform, const material_map& materials) : LLModelInstanceBase(model, transform, materials), mLabel(label) { mLocalMeshID = -1; @@ -399,6 +412,8 @@ public: LLModelInstance(LLSD& data); + ~LLModelInstance() {} + LLSD asLLSD(); }; diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 45307d567c..1c04e0b595 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -563,6 +563,7 @@ public: void addFlags(U32 flags) { mMiscFlags |= flags; } void removeFlags(U32 flags) { mMiscFlags &= ~flags; } U32 getFlags() const { return mMiscFlags; } + bool checkFlags(U32 flags) const { return (mMiscFlags & flags) != 0; } static std::string pCodeToString(const LLPCode pcode); static LLPCode legacyToPCode(const U8 legacy); @@ -600,21 +601,19 @@ public: inline bool LLPrimitive::isAvatar() const { - return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode ) ? true : false; + return LL_PCODE_LEGACY_AVATAR == mPrimitiveCode; } inline bool LLPrimitive::isSittingAvatar() const { // this is only used server-side - return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode - && ((getFlags() & (PRIM_FLAG_SITTING | PRIM_FLAG_SITTING_ON_GROUND)) != 0) ) ? true : false; + return isAvatar() && checkFlags(PRIM_FLAG_SITTING | PRIM_FLAG_SITTING_ON_GROUND); } inline bool LLPrimitive::isSittingAvatarOnGround() const { // this is only used server-side - return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode - && ((getFlags() & PRIM_FLAG_SITTING_ON_GROUND) != 0) ) ? true : false; + return isAvatar() && checkFlags(PRIM_FLAG_SITTING_ON_GROUND); } // static diff --git a/indra/llprimitive/llvolumemessage.cpp b/indra/llprimitive/llvolumemessage.cpp index 8d47a7147f..1b3422ab6d 100644 --- a/indra/llprimitive/llvolumemessage.cpp +++ b/indra/llprimitive/llvolumemessage.cpp @@ -478,13 +478,15 @@ bool LLVolumeMessage::constrainVolumeParams(LLVolumeParams& params) bad |= params.setRevolutions(params.getPathParams().getRevolutions()) ? 0 : 0x200; bad |= params.setRadiusOffset(params.getPathParams().getRadiusOffset()) ? 0 : 0x400; bad |= params.setSkew(params.getPathParams().getSkew()) ? 0 : 0x800; - if(bad) + + if (bad) { LL_WARNS() << "LLVolumeMessage::constrainVolumeParams() - " << "forced to constrain incoming volume params: " - << llformat("0x%04x",bad) << LL_ENDL; + << llformat("0x%04x", bad) << LL_ENDL; } - return bad ? false : true; + + return bad == 0; } bool LLVolumeMessage::packVolumeParams(const LLVolumeParams* params, LLMessageSystem *mesgsys) diff --git a/indra/llprimitive/tests/llmediaentry_test.cpp b/indra/llprimitive/tests/llmediaentry_test.cpp index b072ce3964..c3e17d1267 100644 --- a/indra/llprimitive/tests/llmediaentry_test.cpp +++ b/indra/llprimitive/tests/llmediaentry_test.cpp @@ -211,7 +211,7 @@ namespace tut void whitelist_test(int num, bool enable, const char *whitelist, const char *candidate_url, bool expected_pass) { - std::string message = "Whitelist test " + boost::lexical_cast<std::string>(num); + std::string message = "Whitelist test " + std::to_string(num); LLMediaEntry entry; entry.setWhiteListEnable(enable); set_whitelist(entry, whitelist); diff --git a/indra/llrender/llcubemaparray.cpp b/indra/llrender/llcubemaparray.cpp index ed0ad07dc0..4f8d4015b6 100644 --- a/indra/llrender/llcubemaparray.cpp +++ b/indra/llrender/llcubemaparray.cpp @@ -42,6 +42,8 @@ //#pragma optimize("", off) +using namespace LLImageGLMemory; + // MUST match order of OpenGL face-layers GLenum LLCubeMapArray::sTargets[6] = { @@ -128,6 +130,8 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool us U32 mip = 0; + free_cur_tex_image(); + while (resolution >= 1) { glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, mip, format, resolution, resolution, count * 6, 0, @@ -141,6 +145,8 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, bool us ++mip; } + alloc_tex_image(resolution * 6, resolution, format); + mImage->setAddressMode(LLTexUnit::TAM_CLAMP); if (use_mips) diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index ed729f64e3..39345929b3 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -63,7 +63,7 @@ static U64 sTextureBytes = 0; // track a texture alloc on the currently bound texture. // asserts that no currently tracked alloc exists -static void alloc_tex_image(U32 width, U32 height, U32 pixformat) +void LLImageGLMemory::alloc_tex_image(U32 width, U32 height, U32 pixformat) { U32 texUnit = gGL.getCurrentTexUnitIndex(); U32 texName = gGL.getTexUnit(texUnit)->getCurrTexture(); @@ -81,7 +81,7 @@ static void alloc_tex_image(U32 width, U32 height, U32 pixformat) } // track texture free on given texName -static void free_tex_image(U32 texName) +void LLImageGLMemory::free_tex_image(U32 texName) { sTexMemMutex.lock(); auto iter = sTextureAllocs.find(texName); @@ -98,7 +98,7 @@ static void free_tex_image(U32 texName) } // track texture free on given texNames -static void free_tex_images(U32 count, const U32* texNames) +void LLImageGLMemory::free_tex_images(U32 count, const U32* texNames) { for (int i = 0; i < count; ++i) { @@ -107,13 +107,15 @@ static void free_tex_images(U32 count, const U32* texNames) } // track texture free on currently bound texture -static void free_cur_tex_image() +void LLImageGLMemory::free_cur_tex_image() { U32 texUnit = gGL.getCurrentTexUnitIndex(); U32 texName = gGL.getTexUnit(texUnit)->getCurrTexture(); free_tex_image(texName); } +using namespace LLImageGLMemory; + // static U64 LLImageGL::getTextureBytesAllocated() { @@ -289,6 +291,8 @@ S32 LLImageGL::dataFormatBits(S32 dataformat) case GL_SRGB_ALPHA: return 32; case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac case GL_DEPTH_COMPONENT: return 24; + case GL_RGB16F: return 48; + case GL_RGBA16F: return 64; default: LL_ERRS() << "LLImageGL::Unknown format: " << dataformat << LL_ENDL; return 0; @@ -2432,7 +2436,7 @@ bool LLImageGL::getMask(const LLVector2 &tc) S32 idx = y*mPickMaskWidth+x; S32 offset = idx%8; - res = mPickMask[idx/8] & (1 << offset) ? true : false; + res = (mPickMask[idx/8] & (1 << offset)) != 0; } return res; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 60fa1258b6..18187734f1 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -47,6 +47,14 @@ class LLWindow; #define BYTES_TO_MEGA_BYTES(x) ((x) >> 20) #define MEGA_BYTES_TO_BYTES(x) ((x) << 20) +namespace LLImageGLMemory +{ + void alloc_tex_image(U32 width, U32 height, U32 pixformat); + void free_tex_image(U32 texName); + void free_tex_images(U32 count, const U32* texNames); + void free_cur_tex_image(); +} + //============================================================================ class LLImageGL : public LLRefCount { diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 88c48e5166..8c05a47c39 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -545,7 +545,7 @@ void LLRenderTarget::flush() bool LLRenderTarget::isComplete() const { - return (!mTex.empty() || mDepth) ? true : false; + return !mTex.empty() || mDepth; } void LLRenderTarget::getViewport(S32* viewport) diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index d88e1a1f11..f075aa564e 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -265,7 +265,7 @@ void LLAccordionCtrl::showScrollbar(S32 width, S32 height) void LLAccordionCtrl::hideScrollbar(S32 width, S32 height) { - if (mScrollbar->getVisible() == false) + if (!mScrollbar->getVisible()) return; mScrollbar->setVisible(false); @@ -391,7 +391,7 @@ void LLAccordionCtrl::updateNoTabsHelpTextVisibility() } } - mNoVisibleTabsHelpText->setVisible(visible_exists ? false : true); + mNoVisibleTabsHelpText->setVisible(!visible_exists); } void LLAccordionCtrl::arrangeSingle() @@ -407,7 +407,7 @@ void LLAccordionCtrl::arrangeSingle() { LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (accordion_tab->getVisible() == false) // Skip hidden accordion tabs + if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) { @@ -421,7 +421,7 @@ void LLAccordionCtrl::arrangeSingle() { LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (accordion_tab->getVisible() == false) // Skip hidden accordion tabs + if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) { @@ -469,7 +469,7 @@ void LLAccordionCtrl::arrangeMultiple() { LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); - if (accordion_tab->getVisible() == false) // Skip hidden accordion tabs + if (!accordion_tab->getVisible()) // Skip hidden accordion tabs continue; if (!accordion_tab->isExpanded() ) @@ -624,7 +624,7 @@ bool LLAccordionCtrl::autoScroll(S32 x, S32 y) } } - return scrolling ? true : false; + return scrolling; } void LLAccordionCtrl::updateLayout(S32 width, S32 height) diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index c8f75a1af2..5945c31407 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -643,7 +643,7 @@ void LLAccordionCtrlTab::setHeaderVisible(bool value) if (mHeader) { - mHeader->setVisible(value ? true : false); + mHeader->setVisible(value); } reshape(getRect().getWidth(), getRect().getHeight(), false); @@ -992,7 +992,7 @@ void LLAccordionCtrlTab::hideScrollbar(const LLRect& child_rect) if (!mContainerPanel || !mScrollbar) return; - if (mScrollbar->getVisible() == false) + if (!mScrollbar->getVisible()) return; mScrollbar->setVisible(false); diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 3e159365e5..8ef7bd837f 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -34,8 +34,6 @@ #include "llerror.h" #include "llxuiparser.h" -#include <boost/foreach.hpp> - // // LLCommandId class @@ -182,7 +180,7 @@ bool LLCommandManager::load() return false; } - BOOST_FOREACH(LLCommand::Params& commandParams, commandsParams.commands) + for (const LLCommand::Params& commandParams : commandsParams.commands) { LLCommand * command = new LLCommand(commandParams); diff --git a/indra/llui/llfiltereditor.h b/indra/llui/llfiltereditor.h index 3a05bc05a1..52cad3bff4 100644 --- a/indra/llui/llfiltereditor.h +++ b/indra/llui/llfiltereditor.h @@ -43,6 +43,7 @@ class LLFilterEditor : public LLSearchEditor public: struct Params : public LLInitParam::Block<Params, LLSearchEditor::Params> {}; + virtual ~LLFilterEditor() {} protected: LLFilterEditor(const Params&); diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index ccd60dc536..48693c6267 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -59,7 +59,6 @@ #include "llmultifloater.h" #include "llsdutil.h" #include "lluiusage.h" -#include <boost/foreach.hpp> // use this to control "jumping" behavior when Ctrl-Tabbing @@ -1849,6 +1848,8 @@ void LLFloater::onClickTearOff(LLFloater* self) { if (self->mSaveRect) { + LLRect screen_rect = self->calcScreenRect(); + self->mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); self->storeRectControl(); } self->setMinimized(false); // to reenable minimize button if it was minimized @@ -2461,7 +2462,7 @@ void LLFloaterView::reshape(S32 width, S32 height, bool called_from_parent) //{ // floaterp->translate(translate_x, translate_y); //} - BOOST_FOREACH(LLHandle<LLFloater> dependent_floater, floaterp->mDependents) + for (LLHandle<LLFloater> dependent_floater : floaterp->mDependents) { if (dependent_floater.get()) { @@ -2476,10 +2477,9 @@ void LLFloaterView::reshape(S32 width, S32 height, bool called_from_parent) void LLFloaterView::restoreAll() { // make sure all subwindows aren't minimized - child_list_t child_list = *(getChildList()); - for (child_list_const_iter_t child_it = child_list.begin(); child_it != child_list.end(); ++child_it) + for (auto child : *getChildList()) { - LLFloater* floaterp = dynamic_cast<LLFloater*>(*child_it); + LLFloater* floaterp = dynamic_cast<LLFloater*>(child); if (floaterp) { floaterp->setMinimized(false); @@ -3522,16 +3522,12 @@ bool LLFloater::isVisible(const LLFloater* floater) return floater && floater->getVisible(); } -bool LLFloater::buildFromFile(const std::string& filename, bool cacheable) +bool LLFloater::buildFromFile(const std::string& filename) { LL_PROFILE_ZONE_SCOPED; - - llassert_msg(!cacheable || !mSingleInstance || !mReuseInstance, - "No needs to cache XML for floater with mSingleInstance AND mReuseInstance flags set"); - LLXMLNodePtr root; - if (!LLUICtrlFactory::getLayeredXMLNode(filename, root, LLDir::CURRENT_SKIN, cacheable)) + if (!LLUICtrlFactory::getLayeredXMLNode(filename, root)) { LL_WARNS() << "Couldn't find (or parse) floater from: " << filename << LL_ENDL; return false; diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 13d9bf5adc..f7e121ed7e 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -208,7 +208,7 @@ public: // Don't export top/left for rect, only height/width static void setupParamsForExport(Params& p, LLView* parent); - bool buildFromFile(const std::string &filename, bool cacheable = false); + bool buildFromFile(const std::string &filename); boost::signals2::connection setMinimizeCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setOpenCallback( const commit_signal_t::slot_type& cb ); diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index d87e4ce70f..1c3efaa9cf 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -281,15 +281,15 @@ bool LLFloaterReg::hideInstance(const std::string& name, const LLSD& key) bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key) { LLFloater* instance = findInstance(name, key); - if (LLFloater::isShown(instance)) + if (instance && instance->isShown()) { instance->closeHostedFloater(); return false; } - else - { - return showInstance(name, key, true) ? true : false; - } + + instance = showInstance(name, key, true); + + return instance != nullptr; } //static diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index bcbc0f9970..311056f541 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -484,7 +484,7 @@ void LLFolderViewItem::deselectItem(void) void LLFolderViewItem::selectItem(void) { - if (mIsSelected == false) + if (!mIsSelected) { mIsSelected = true; getViewModelItem()->selectItem(); @@ -1582,7 +1582,8 @@ void LLFolderViewFolder::gatherChildRangeExclusive(LLFolderViewItem* start, LLFo void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) { - if (getRoot()->getAllowMultiSelect() == false) return; + if (!getRoot()->getAllowMultiSelect()) + return; LLFolderViewItem* cur_selected_item = getRoot()->getCurSelectedItem(); if (cur_selected_item == NULL) @@ -1593,14 +1594,15 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) bool reverse = false; LLFolderViewFolder* common_ancestor = getCommonAncestor(cur_selected_item, new_selection, reverse); - if (!common_ancestor) return; + if (!common_ancestor) + return; LLFolderViewItem* last_selected_item_from_cur = cur_selected_item; LLFolderViewFolder* cur_folder = cur_selected_item->getParentFolder(); std::vector<LLFolderViewItem*> items_to_select_forward; - while(cur_folder != common_ancestor) + while (cur_folder != common_ancestor) { cur_folder->gatherChildRangeExclusive(last_selected_item_from_cur, NULL, reverse, items_to_select_forward); @@ -1612,7 +1614,7 @@ void LLFolderViewFolder::extendSelectionTo(LLFolderViewItem* new_selection) LLFolderViewItem* last_selected_item_from_new = new_selection; cur_folder = new_selection->getParentFolder(); - while(cur_folder != common_ancestor) + while (cur_folder != common_ancestor) { cur_folder->gatherChildRangeExclusive(last_selected_item_from_new, NULL, !reverse, items_to_select_reverse); diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 2db0101769..cf8cfa6ea6 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -136,7 +136,7 @@ S32 LLLayoutPanel::getVisibleDim() const * (min_dim + (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt)))); } - + void LLLayoutPanel::setOrientation( LLView::EOrientation orientation ) { mOrientation = orientation; @@ -144,9 +144,7 @@ void LLLayoutPanel::setOrientation( LLView::EOrientation orientation ) ? getRect().getWidth() : getRect().getHeight())); - if (mAutoResize == false - && mUserResize == true - && mMinDim == -1 ) + if (!mAutoResize && mUserResize && mMinDim == -1) { setMinDim(layout_dim); } @@ -170,7 +168,7 @@ void LLLayoutPanel::reshape( S32 width, S32 height, bool called_from_parent /*= { if (width == getRect().getWidth() && height == getRect().getHeight() && !LLView::sForceReshape) return; - if (!mIgnoreReshape && mAutoResize == false) + if (!mIgnoreReshape && !mAutoResize) { mTargetDim = (mOrientation == LLLayoutStack::HORIZONTAL) ? width : height; LLLayoutStack* stackp = dynamic_cast<LLLayoutStack*>(getParent()); @@ -395,8 +393,7 @@ void LLLayoutStack::updateLayout() : getRect().getHeight(); // first, assign minimum dimensions - LLLayoutPanel* panelp = NULL; - BOOST_FOREACH(panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -409,12 +406,15 @@ void LLLayoutStack::updateLayout() llassert(total_visible_fraction < 1.05f); // don't need spacing after last panel - space_to_distribute += panelp ? ll_round((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0; + if (!mPanels.empty()) + { + space_to_distribute += ll_round(F32(mPanelSpacing) * mPanels.back()->getVisibleAmount()); + } S32 remaining_space = space_to_distribute; if (space_to_distribute > 0 && total_visible_fraction > 0.f) { // give space proportionally to visible auto resize panels - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -427,7 +427,7 @@ void LLLayoutStack::updateLayout() } // distribute any left over pixels to non-collapsed, visible panels - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (remaining_space == 0) break; @@ -443,7 +443,7 @@ void LLLayoutStack::updateLayout() F32 cur_pos = (mOrientation == HORIZONTAL) ? 0.f : (F32)getRect().getHeight(); - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { F32 panel_dim = llmax(panelp->getExpandedMinDim(), panelp->mTargetDim); @@ -538,7 +538,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const { if (!panelp) return NULL; - BOOST_FOREACH(LLLayoutPanel* p, mPanels) + for (LLLayoutPanel* p : mPanels) { if (p == panelp) { @@ -552,7 +552,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) c { LLLayoutPanel* result = NULL; - BOOST_FOREACH(LLLayoutPanel* p, mPanels) + for (LLLayoutPanel* p : mPanels) { if (p->getName() == name) { @@ -566,7 +566,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) c void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) { - BOOST_FOREACH(LLLayoutPanel* lp, mPanels) + for (LLLayoutPanel* lp : mPanels) { if (lp->mResizeBar == NULL) { @@ -669,7 +669,7 @@ void LLLayoutStack::updateFractionalSizes() { F32 total_resizable_dim = 0.f; - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -677,7 +677,7 @@ void LLLayoutStack::updateFractionalSizes() } } - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -698,7 +698,7 @@ void LLLayoutStack::normalizeFractionalSizes() S32 num_auto_resize_panels = 0; F32 total_fractional_size = 0.f; - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -709,7 +709,7 @@ void LLLayoutStack::normalizeFractionalSizes() if (total_fractional_size == 0.f) { // equal distribution - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -719,7 +719,7 @@ void LLLayoutStack::normalizeFractionalSizes() } else { // renormalize - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->mAutoResize) { @@ -736,7 +736,7 @@ bool LLLayoutStack::animatePanels() // // animate visibility // - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (panelp->getVisible()) { @@ -834,7 +834,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& LLLayoutPanel* other_resize_panel = NULL; LLLayoutPanel* following_panel = NULL; - BOOST_REVERSE_FOREACH(LLLayoutPanel* panelp, mPanels) + BOOST_REVERSE_FOREACH(LLLayoutPanel* panelp, mPanels) // Should replace this when C++20 reverse view adaptor becomes available... { if (panelp->mAutoResize) { @@ -883,7 +883,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& AFTER_RESIZED_PANEL } which_panel = BEFORE_RESIZED_PANEL; - BOOST_FOREACH(LLLayoutPanel* panelp, mPanels) + for (LLLayoutPanel* panelp : mPanels) { if (!panelp->getVisible() || panelp->mCollapsed) { @@ -974,6 +974,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& MIN_FRACTIONAL_SIZE, MAX_FRACTIONAL_SIZE); } + break; default: break; } @@ -990,8 +991,8 @@ void LLLayoutStack::reshape(S32 width, S32 height, bool called_from_parent) void LLLayoutStack::updateResizeBarLimits() { - LLLayoutPanel* previous_visible_panelp = NULL; - BOOST_REVERSE_FOREACH(LLLayoutPanel* visible_panelp, mPanels) + LLLayoutPanel* previous_visible_panelp{ nullptr }; + BOOST_REVERSE_FOREACH(LLLayoutPanel* visible_panelp, mPanels) // Should replace this when C++20 reverse view adaptor becomes available... { if (!visible_panelp->getVisible() || visible_panelp->mCollapsed) { diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 505216d0ff..8a04342af0 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1473,11 +1473,11 @@ bool LLLineEditor::handleSpecialKey(KEY key, MASK mask) // handle ctrl-uparrow if we have a history enabled line editor. case KEY_UP: - if( mHaveHistory && ((mIgnoreArrowKeys == false) || ( MASK_CONTROL == mask )) ) + if (mHaveHistory && (!mIgnoreArrowKeys || (MASK_CONTROL == mask))) { - if( mCurrentHistoryLine > mLineHistory.begin() ) + if (mCurrentHistoryLine > mLineHistory.begin()) { - mText.assign( *(--mCurrentHistoryLine) ); + mText.assign(*(--mCurrentHistoryLine)); setCursorToEnd(); } else @@ -1490,9 +1490,9 @@ bool LLLineEditor::handleSpecialKey(KEY key, MASK mask) // handle [ctrl]-downarrow if we have a history enabled line editor case KEY_DOWN: - if( mHaveHistory && ((mIgnoreArrowKeys == false) || ( MASK_CONTROL == mask )) ) + if (mHaveHistory && (!mIgnoreArrowKeys || (MASK_CONTROL == mask))) { - if( !mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.end() - 1 ) + if (!mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.end() - 1) { mText.assign( *(++mCurrentHistoryLine) ); setCursorToEnd(); @@ -2684,7 +2684,7 @@ void LLLineEditor::showContextMenu(S32 x, S32 y) // If the cursor is on a misspelled word, retrieve suggestions for it std::string misspelled_word = getMisspelledWord(mCursorPos); - if ((is_misspelled = !misspelled_word.empty()) == true) + if ((is_misspelled = !misspelled_word.empty())) { LLSpellChecker::instance().getSuggestions(misspelled_word, mSuggestionList); } diff --git a/indra/llui/llloadingindicator.cpp b/indra/llui/llloadingindicator.cpp index 1ede5b706f..e8b6b7e43b 100644 --- a/indra/llui/llloadingindicator.cpp +++ b/indra/llui/llloadingindicator.cpp @@ -34,7 +34,6 @@ // Project includes #include "lluictrlfactory.h" #include "lluiimage.h" -#include "boost/foreach.hpp" // registered in llui.cpp to avoid being left out by MS linker //static LLDefaultChildRegistry::Register<LLLoadingIndicator> r("loading_indicator"); @@ -52,7 +51,7 @@ LLLoadingIndicator::LLLoadingIndicator(const Params& p) void LLLoadingIndicator::initFromParams(const Params& p) { - BOOST_FOREACH(LLUIImage* image, p.images().image) + for (LLUIImage* image : p.images().image) { mImages.push_back(image); } diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index 85aa766918..5374b7ea73 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -95,7 +95,7 @@ void LLMenuButton::setMenu(const std::string& menu_filename, EMenuPosition posit } llassert(LLMenuGL::sMenuContainer != NULL); - LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance(), true); + LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (!menu) { LL_WARNS() << "Error loading menu_button menu" << LL_ENDL; diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 79a8bc5ba4..5dc92e555a 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -60,7 +60,6 @@ #include "v2math.h" #include <set> #include <boost/tokenizer.hpp> -#include <boost/foreach.hpp> // static LLMenuHolderGL *LLMenuGL::sMenuContainer = NULL; @@ -1189,16 +1188,16 @@ void LLMenuItemBranchGL::updateBranchParent(LLView* parentp) } } -void LLMenuItemBranchGL::onVisibilityChange( bool new_visibility ) +void LLMenuItemBranchGL::onVisibilityChange(bool new_visibility) { - if (new_visibility == false && getBranch() && !getBranch()->getTornOff()) + if (!new_visibility && getBranch() && !getBranch()->getTornOff()) { getBranch()->setVisible(false); } LLMenuItemGL::onVisibilityChange(new_visibility); } -bool LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) +bool LLMenuItemBranchGL::handleKeyHere(KEY key, MASK mask) { LLMenuGL* branch = getBranch(); if (!branch) @@ -2162,7 +2161,7 @@ void LLMenuGL::arrange( void ) } else { - BOOST_FOREACH(LLMenuItemGL* itemp, mItems) + for (LLMenuItemGL* itemp : mItems) { // do first so LLMenuGLItemCall can call on_visible to determine if visible itemp->buildDrawLabel(); diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 8185f2d597..9ba8e9e645 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -45,7 +45,6 @@ #include <algorithm> #include <boost/regex.hpp> -#include <boost/foreach.hpp> const std::string NOTIFICATION_PERSIST_VERSION = "0.93"; @@ -444,14 +443,14 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mSoundName = p.sound; } - BOOST_FOREACH(const LLNotificationTemplate::UniquenessContext& context, p.unique.contexts) + for (const LLNotificationTemplate::UniquenessContext& context : p.unique.contexts) { mUniqueContext.push_back(context.value); } LL_DEBUGS("Notifications") << "notification \"" << mName << "\": tag count is " << p.tags.size() << LL_ENDL; - BOOST_FOREACH(const LLNotificationTemplate::Tag& tag, p.tags) + for (const LLNotificationTemplate::Tag& tag : p.tags) { LL_DEBUGS("Notifications") << " tag \"" << std::string(tag.value) << "\"" << LL_ENDL; mTags.push_back(tag.value); @@ -994,6 +993,7 @@ LLBoundListener LLNotificationChannelBase::connectChangedImpl(const LLEventListe // all of the notifications that are already in the channel // we use a special signal called "load" in case the channel wants to care // only about new notifications + LLMutexLock lock(&mItemsMutex); for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it) { slot(LLSD().with("sigtype", "load").with("id", (*it)->id())); @@ -1153,7 +1153,7 @@ LLNotificationChannel::LLNotificationChannel(const Params& p) LLInstanceTracker<LLNotificationChannel, std::string>(p.name.isProvided() ? p.name : LLUUID::generateNewID().asString()), mName(p.name.isProvided() ? p.name : LLUUID::generateNewID().asString()) { - BOOST_FOREACH(const std::string& source, p.sources) + for (const std::string& source : p.sources) { connectToChannel(source); } @@ -1171,29 +1171,33 @@ LLNotificationChannel::LLNotificationChannel(const std::string& name, connectToChannel(parent); } -bool LLNotificationChannel::isEmpty() const +LLNotificationChannel::~LLNotificationChannel() { - return mItems.empty(); + for (LLBoundListener &listener : mListeners) + { + listener.disconnect(); + } } -S32 LLNotificationChannel::size() const +bool LLNotificationChannel::isEmpty() const { - return mItems.size(); + return mItems.empty(); } -LLNotificationChannel::Iterator LLNotificationChannel::begin() +S32 LLNotificationChannel::size() const { - return mItems.begin(); + return mItems.size(); } -LLNotificationChannel::Iterator LLNotificationChannel::end() +size_t LLNotificationChannel::size() { - return mItems.end(); + return mItems.size(); } -size_t LLNotificationChannel::size() +void LLNotificationChannel::forEachNotification(NotificationProcess process) { - return mItems.size(); + LLMutexLock lock(&mItemsMutex); + std::for_each(mItems.begin(), mItems.end(), process); } std::string LLNotificationChannel::summarize() @@ -1201,7 +1205,8 @@ std::string LLNotificationChannel::summarize() std::string s("Channel '"); s += mName; s += "'\n "; - for (LLNotificationChannel::Iterator it = begin(); it != end(); ++it) + LLMutexLock lock(&mItemsMutex); + for (LLNotificationChannel::Iterator it = mItems.begin(); it != mItems.end(); ++it) { s += (*it)->summarize(); s += "\n "; @@ -1213,14 +1218,14 @@ void LLNotificationChannel::connectToChannel( const std::string& channel_name ) { if (channel_name.empty()) { - LLNotifications::instance().connectChanged( - boost::bind(&LLNotificationChannelBase::updateItem, this, _1)); + mListeners.push_back(LLNotifications::instance().connectChanged( + boost::bind(&LLNotificationChannelBase::updateItem, this, _1))); } else { mParents.push_back(channel_name); LLNotificationChannelPtr p = LLNotifications::instance().getChannel(channel_name); - p->connectChanged(boost::bind(&LLNotificationChannelBase::updateItem, this, _1)); + mListeners.push_back(p->connectChanged(boost::bind(&LLNotificationChannelBase::updateItem, this, _1))); } } @@ -1521,7 +1526,7 @@ void replaceFormText(LLNotificationForm::Params& form, const std::string& patter form.ignore.text = replace; } - BOOST_FOREACH(LLNotificationForm::FormElement& element, form.form_elements.elements) + for (LLNotificationForm::FormElement& element : form.form_elements.elements) { if (element.button.isChosen() && element.button.text() == pattern) { @@ -1571,19 +1576,19 @@ bool LLNotifications::loadTemplates() mTemplates.clear(); - BOOST_FOREACH(LLNotificationTemplate::GlobalString& string, params.strings) + for (const LLNotificationTemplate::GlobalString& string : params.strings) { mGlobalStrings[string.name] = string.value; } std::map<std::string, LLNotificationForm::Params> form_templates; - BOOST_FOREACH(LLNotificationTemplate::Template& notification_template, params.templates) + for (const LLNotificationTemplate::Template& notification_template : params.templates) { form_templates[notification_template.name] = notification_template.form; } - BOOST_FOREACH(LLNotificationTemplate::Params& notification, params.notifications) + for (LLNotificationTemplate::Params& notification : params.notifications) { if (notification.form_ref.form_template.isChosen()) { @@ -1638,7 +1643,7 @@ bool LLNotifications::loadVisibilityRules() mVisibilityRules.clear(); - BOOST_FOREACH(LLNotificationVisibilityRule::Rule& rule, params.rules) + for (const LLNotificationVisibilityRule::Rule& rule : params.rules) { mVisibilityRules.push_back(LLNotificationVisibilityRulePtr(new LLNotificationVisibilityRule(rule))); } @@ -1731,6 +1736,7 @@ void LLNotifications::cancel(LLNotificationPtr pNotif) void LLNotifications::cancelByName(const std::string& name) { + LLMutexLock lock(&mItemsMutex); std::vector<LLNotificationPtr> notifs_to_cancel; for (LLNotificationSet::iterator it=mItems.begin(), end_it = mItems.end(); it != end_it; @@ -1755,6 +1761,7 @@ void LLNotifications::cancelByName(const std::string& name) void LLNotifications::cancelByOwner(const LLUUID ownerId) { + LLMutexLock lock(&mItemsMutex); std::vector<LLNotificationPtr> notifs_to_cancel; for (LLNotificationSet::iterator it = mItems.begin(), end_it = mItems.end(); it != end_it; @@ -1802,11 +1809,6 @@ LLNotificationPtr LLNotifications::find(LLUUID uuid) } } -void LLNotifications::forEachNotification(NotificationProcess process) -{ - std::for_each(mItems.begin(), mItems.end(), process); -} - std::string LLNotifications::getGlobalString(const std::string& key) const { GlobalStringMap::const_iterator it = mGlobalStrings.find(key); diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 5fb18d8299..ccc8a42a6c 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -738,16 +738,19 @@ class LLNotificationChannelBase : { LOG_CLASS(LLNotificationChannelBase); public: - LLNotificationChannelBase(LLNotificationFilter filter) - : mFilter(filter), - mItems() - {} + LLNotificationChannelBase(LLNotificationFilter filter) + : mFilter(filter) + , mItems() + , mItemsMutex() + {} + virtual ~LLNotificationChannelBase() { // explicit cleanup for easier issue detection mChanged.disconnect_all_slots(); mPassedFilter.disconnect_all_slots(); mFailedFilter.disconnect_all_slots(); + LLMutexLock lock(&mItemsMutex); mItems.clear(); } // you can also connect to a Channel, so you can be notified of @@ -786,6 +789,7 @@ protected: LLStandardSignal mChanged; LLStandardSignal mPassedFilter; LLStandardSignal mFailedFilter; + LLMutex mItemsMutex; // these are action methods that subclasses can override to take action // on specific types of changes; the management of the mItems list is @@ -835,7 +839,7 @@ public: LLNotificationChannel(const Params& p = Params()); LLNotificationChannel(const std::string& name, const std::string& parent, LLNotificationFilter filter); - virtual ~LLNotificationChannel() {} + virtual ~LLNotificationChannel(); typedef LLNotificationSet::iterator Iterator; std::string getName() const { return mName; } @@ -844,21 +848,23 @@ public: { return boost::iterator_range<parents_iter>(mParents); } - - void connectToChannel(const std::string& channel_name); - + bool isEmpty() const; S32 size() const; - - Iterator begin(); - Iterator end(); - size_t size(); - + size_t size(); + + typedef boost::function<void(LLNotificationPtr)> NotificationProcess; + void forEachNotification(NotificationProcess process); + std::string summarize(); +protected: + void connectToChannel(const std::string& channel_name); + private: std::string mName; std::vector<std::string> mParents; + std::vector<LLBoundListener> mListeners; }; // An interface class to provide a clean linker seam to the LLNotifications class. @@ -924,10 +930,6 @@ public: void update(const LLNotificationPtr pNotif); LLNotificationPtr find(LLUUID uuid); - - typedef boost::function<void (LLNotificationPtr)> NotificationProcess; - - void forEachNotification(NotificationProcess process); // This is all stuff for managing the templates // take your template out @@ -990,7 +992,7 @@ private: bool mIgnoreAllNotifications; - boost::scoped_ptr<LLNotificationsListener> mListener; + std::unique_ptr<LLNotificationsListener> mListener; std::vector<LLNotificationChannelPtr> mDefaultChannels; }; diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp index e73ba1fbe9..859222f907 100644 --- a/indra/llui/llnotificationslistener.cpp +++ b/indra/llui/llnotificationslistener.cpp @@ -32,7 +32,6 @@ #include "llnotificationtemplate.h" #include "llsd.h" #include "llui.h" -#include <boost/foreach.hpp> LLNotificationsListener::LLNotificationsListener(LLNotifications & notifications) : LLEventAPI("LLNotifications", @@ -149,11 +148,11 @@ void LLNotificationsListener::listChannelNotifications(const LLSD& params) const if (channel) { LLSD notifications(LLSD::emptyArray()); - for (LLNotificationChannel::Iterator ni(channel->begin()), nend(channel->end()); - ni != nend; ++ni) - { - notifications.append(asLLSD(*ni)); - } + std::function<void(LLNotificationPtr)> func = [notifications](LLNotificationPtr ni) mutable + { + notifications.append(asLLSD(ni)); + }; + channel->forEachNotification(func); response["notifications"] = notifications; } LLEventPumps::instance().obtain(params["reply"]).post(response); diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index bba10bd792..ba6a31eb9e 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -803,13 +803,13 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t:: //----------------------------------------------------------------------------- // buildPanel() //----------------------------------------------------------------------------- -bool LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params, bool cacheable) +bool LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params) { LL_PROFILE_ZONE_SCOPED; bool didPost = false; LLXMLNodePtr root; - if (!LLUICtrlFactory::getLayeredXMLNode(filename, root, LLDir::CURRENT_SKIN, cacheable)) + if (!LLUICtrlFactory::getLayeredXMLNode(filename, root)) { LL_WARNS() << "Couldn't parse panel from: " << filename << LL_ENDL; return didPost; diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index dd73a41132..33883bf6a4 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -107,8 +107,7 @@ protected: public: typedef std::vector<class LLUICtrl *> ctrl_list_t; - bool buildFromFile(const std::string &filename, const LLPanel::Params& default_params, bool cacheable = false); - bool buildFromFile(const std::string &filename, bool cacheable = false) { return buildFromFile(filename, getDefaultParams(), cacheable); } + bool buildFromFile(const std::string &filename, const LLPanel::Params& default_params = getDefaultParams()); static LLPanel* createFactoryPanel(const std::string& name); diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index 04553e1f9f..2a45a8118e 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -138,7 +138,7 @@ void LLRadioGroup::setIndexEnabled(S32 index, bool enabled) if (count == index) { child->setEnabled(enabled); - if (index == mSelectedIndex && enabled == false) + if (index == mSelectedIndex && !enabled) { setSelectedIndex(-1); } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index dbfacafd00..535a880120 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1527,12 +1527,12 @@ bool LLScrollListCtrl::setSelectedByValue(const LLSD& value, bool selected) { LLSD::Binary data1 = value.asBinary(); LLSD::Binary data2 = item->getValue().asBinary(); - found = std::equal(data1.begin(), data1.end(), data2.begin()) ? true : false; + found = std::equal(data1.begin(), data1.end(), data2.begin()); } } else { - found = item->getValue().asString() == value.asString() ? true : false; + found = item->getValue().asString() == value.asString(); } if (found) diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index 6da0c69457..46fb8c64b5 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -109,6 +109,11 @@ LLSearchEditor::~LLSearchEditor() mKeystrokeCallback = NULL; mTextChangedCallback = NULL; setCommitOnFocusLost(false); + + mSearchButton = NULL; + mClearButton = NULL; + mSearchEditor->deleteAllChildren(); + deleteAllChildren(); } //virtual diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 81eaec620c..438b3d96b1 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2202,7 +2202,7 @@ void LLTextEditor::showContextMenu(S32 x, S32 y) // If the cursor is on a misspelled word, retrieve suggestions for it std::string misspelled_word = getMisspelledWord(mCursorPos); - if ((is_misspelled = !misspelled_word.empty()) == true) + if ((is_misspelled = !misspelled_word.empty())) { LLSpellChecker::instance().getSuggestions(misspelled_word, mSuggestionList); } diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 580d91fb4b..1c1414dd74 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -27,7 +27,6 @@ #include "linden_common.h" -#include <boost/foreach.hpp> #include "lltoolbar.h" #include "llcommandmanager.h" @@ -219,7 +218,7 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p)); - BOOST_FOREACH(LLCommandId id, p.commands) + for (const auto& id : p.commands) { addCommand(id); } @@ -417,7 +416,7 @@ bool LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) // Determine which button the mouse was over during the click in case the context menu action // is intended to affect the button. mRightMouseTargetButton = NULL; - BOOST_FOREACH(LLToolBarButton* button, mButtons) + for (LLToolBarButton* button : mButtons) { LLRect button_rect; button->localRectToOtherView(button->getLocalRect(), &button_rect, this); @@ -505,7 +504,7 @@ void LLToolBar::setButtonType(LLToolBarEnums::ButtonType button_type) void LLToolBar::resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth) { // make buttons in current row all same girth - BOOST_FOREACH(LLToolBarButton* button, buttons_in_row) + for (LLToolBarButton* button : buttons_in_row) { if (getOrientation(mSideType) == LLLayoutStack::HORIZONTAL) { @@ -693,7 +692,7 @@ void LLToolBar::updateLayoutAsNeeded() std::vector<LLToolBarButton*> buttons_in_row; - BOOST_FOREACH(LLToolBarButton* button, mButtons) + for (LLToolBarButton* button : mButtons) { button->reshape(button->mWidthRange.getMin(), button->mDesiredHeight); button->autoResize(); @@ -878,7 +877,7 @@ void LLToolBar::createButtons() { std::set<LLUUID> set_flashing; - BOOST_FOREACH(LLToolBarButton* button, mButtons) + for (LLToolBarButton* button : mButtons) { if (button->getFlashTimer() && button->getFlashTimer()->isFlashingInProgress()) { @@ -896,7 +895,7 @@ void LLToolBar::createButtons() mButtonMap.clear(); mRightMouseTargetButton = NULL; - BOOST_FOREACH(LLCommandId& command_id, mButtonCommands) + for (const LLCommandId& command_id : mButtonCommands) { LLToolBarButton* button = createButton(command_id); mButtons.push_back(button); @@ -1050,20 +1049,20 @@ bool LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, std::string& tooltip_msg) { // If we have a drop callback, that means that we can handle the drop - bool handled = (mHandleDropCallback ? true : false); - + bool handled = mHandleDropCallback != nullptr; + // if drop is set, it's time to call the callback to get the operation done if (handled && drop) { - handled = mHandleDropCallback(cargo_data, x, y ,this); + handled = mHandleDropCallback(cargo_data, x, y, this); } - + // We accept only single tool drop on toolbars - *accept = (handled ? ACCEPT_YES_SINGLE : ACCEPT_NO); - + *accept = handled ? ACCEPT_YES_SINGLE : ACCEPT_NO; + // We'll use that flag to change the visual aspect of the toolbar target on draw() mDragAndDropTarget = false; - + // Convert drag position into insert position and rank if (!isReadOnly() && handled && !drop) { @@ -1074,7 +1073,7 @@ bool LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, int orig_rank = getRankFromPosition(dragged_command); mDragRank = getRankFromPosition(x, y); // Don't DaD if we're dragging a command on itself - mDragAndDropTarget = ((orig_rank != RANK_NONE) && ((mDragRank == orig_rank) || ((mDragRank-1) == orig_rank)) ? false : true); + mDragAndDropTarget = ((orig_rank != RANK_NONE) && ((mDragRank == orig_rank) || ((mDragRank - 1) == orig_rank))); //LL_INFOS() << "Merov debug : DaD, rank = " << mDragRank << ", dragged uui = " << inv_item->getUUID() << LL_ENDL; /* Do the following if you want to animate the button itself LLCommandId dragged_command(inv_item->getUUID()); @@ -1087,7 +1086,7 @@ bool LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, handled = false; } } - + return handled; } diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 4df2c0cb6d..4c138eff65 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -444,7 +444,13 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params) tooltip_params.rect = LLRect (0, 1, 1, 0); if (tooltip_params.create_callback.isProvided()) - mToolTip = tooltip_params.create_callback()(tooltip_params); + { + mToolTip = tooltip_params.create_callback()(tooltip_params); + if (mToolTip == NULL) + { + return; + } + } else mToolTip = LLUICtrlFactory::create<LLToolTip> (tooltip_params); @@ -496,7 +502,7 @@ void LLToolTipMgr::show(const LLToolTip::Params& params) { if (!params.styled_message.isProvided() && (!params.message.isProvided() || params.message().empty()) - && !params.image.isProvided()) return; + && !params.image.isProvided() && !params.create_callback.isProvided()) return; // fill in default tooltip params from tool_tip.xml LLToolTip::Params params_with_defaults(params); diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index 096336045c..f43bdf1fdc 100644 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp @@ -32,7 +32,6 @@ #include "llui.h" #include "lluicolortable.h" #include "lluictrlfactory.h" -#include <boost/foreach.hpp> LLUIColorTable::ColorParams::ColorParams() : value("value"), @@ -208,7 +207,7 @@ bool LLUIColorTable::loadFromSettings() // pass constraint=LLDir::ALL_SKINS because we want colors.xml from every // skin dir - BOOST_FOREACH(std::string colors_path, + for (const std::string& colors_path : gDirUtilp->findSkinnedFilenames(LLDir::SKINBASE, "colors.xml", LLDir::ALL_SKINS)) { result |= loadFromFilename(colors_path, mLoadedColors); diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 706140fd49..dca777cc1f 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -157,7 +157,7 @@ void LLUICtrlFactory::createChildren(LLView* viewp, LLXMLNodePtr node, const wid // getLayeredXMLNode() //----------------------------------------------------------------------------- bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& root, - LLDir::ESkinConstraint constraint, bool cacheable) + LLDir::ESkinConstraint constraint) { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; std::vector<std::string> paths = @@ -169,7 +169,7 @@ bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNo paths.push_back(xui_filename); } - return LLXMLNode::getLayeredXMLNode(root, paths, cacheable); + return LLXMLNode::getLayeredXMLNode(root, paths); } diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 2e1cc75508..6e585abfc0 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -148,7 +148,7 @@ public: LLView* createFromXML(LLXMLNodePtr node, LLView* parent, const std::string& filename, const widget_registry_t&, LLXMLNodePtr output_node ); template<typename T> - static T* createFromFile(const std::string &filename, LLView *parent, const widget_registry_t& registry, bool cacheable = false) + static T* createFromFile(const std::string &filename, LLView *parent, const widget_registry_t& registry) { T* widget = NULL; @@ -156,7 +156,7 @@ public: { LLXMLNodePtr root_node; - if (!LLUICtrlFactory::getLayeredXMLNode(filename, root_node, LLDir::CURRENT_SKIN, cacheable)) + if (!LLUICtrlFactory::getLayeredXMLNode(filename, root_node)) { LL_WARNS() << "Couldn't parse XUI from path: " << instance().getCurFileName() << ", from filename: " << filename << LL_ENDL; goto fail; @@ -192,7 +192,7 @@ fail: static void createChildren(LLView* viewp, LLXMLNodePtr node, const widget_registry_t&, LLXMLNodePtr output_node = NULL); static bool getLayeredXMLNode(const std::string &filename, LLXMLNodePtr& root, - LLDir::ESkinConstraint constraint = LLDir::CURRENT_SKIN, bool cacheable = false); + LLDir::ESkinConstraint constraint=LLDir::CURRENT_SKIN); private: //NOTE: both friend declarations are necessary to keep both gcc and msvc happy diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index aa9272f782..45668e4a87 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -229,7 +229,7 @@ bool LLUrlEntryBase::isWikiLinkCorrect(const std::string &labeled_url) const label = "http://" + label; } - return (LLUrlRegistry::instance().hasUrl(label)) ? false : true; + return !LLUrlRegistry::instance().hasUrl(label); } std::string LLUrlEntryBase::urlToLabelWithGreyQuery(const std::string &url) const diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index f3ef7591e9..30cc5cd10a 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -32,7 +32,6 @@ #include <sstream> #include <boost/tokenizer.hpp> -#include <boost/foreach.hpp> #include <boost/bind.hpp> #include "llrender.h" @@ -61,6 +60,7 @@ static const S32 LINE_HEIGHT = 15; S32 LLView::sDepth = 0; bool LLView::sDebugRects = false; bool LLView::sDebugUnicode = false; +bool LLView::sDebugCamera = false; bool LLView::sIsRectDirty = false; LLRect LLView::sDirtyRect; bool LLView::sDebugRectsShowNames = true; @@ -342,11 +342,11 @@ void LLView::removeChild(LLView* child) if (child->mParentView == this) { // if we are removing an item we are currently iterating over, that would be bad - llassert(child->mInDraw == false); + llassert(!child->mInDraw); mChildList.remove( child ); child->mParentView = NULL; child_tab_order_t::iterator found = mTabOrder.find(child); - if(found != mTabOrder.end()) + if (found != mTabOrder.end()) { mTabOrder.erase(found); } @@ -593,7 +593,7 @@ void LLView::deleteAllChildren() void LLView::setAllChildrenEnabled(bool b) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { viewp->setEnabled(b); } @@ -622,7 +622,7 @@ void LLView::onVisibilityChange ( bool new_visibility ) { bool old_visibility; bool log_visibility_change = LLViewerEventRecorder::instance().getLoggingStatus(); - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { if (!viewp) { @@ -726,7 +726,7 @@ LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& m { if ( getVisible() && getEnabled() ) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { if ((viewp->*method)(c, mask, true)) { @@ -745,7 +745,7 @@ LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& m template <typename METHOD, typename XDATA> LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra, bool allow_mouse_block) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -774,7 +774,7 @@ LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDA LLView* LLView::childrenHandleToolTip(S32 x, S32 y, MASK mask) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -806,7 +806,7 @@ LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, // default to not accepting drag and drop, will be overridden by handler *accept = ACCEPT_NO; - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -832,7 +832,7 @@ LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) { - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -860,7 +860,7 @@ LLView* LLView::childFromPoint(S32 x, S32 y, bool recur) if (!getVisible()) return NULL; - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; @@ -1379,7 +1379,7 @@ void LLView::reshape(S32 width, S32 height, bool called_from_parent) mRect.mTop = getRect().mBottom + height; // move child views according to reshape flags - BOOST_FOREACH(LLView* viewp, mChildList) + for (LLView* viewp : mChildList) { if (viewp != NULL) { @@ -1451,7 +1451,7 @@ LLRect LLView::calcBoundingRect() { LLRect local_bounding_rect = LLRect::null; - BOOST_FOREACH(LLView* childp, mChildList) + for (LLView* childp : mChildList) { // ignore invisible and "top" children when calculating bounding rect // such as combobox popups @@ -1614,7 +1614,7 @@ LLView* LLView::findChildView(const std::string& name, bool recurse) const LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; // Look for direct children *first* - BOOST_FOREACH(LLView* childp, mChildList) + for (LLView* childp : mChildList) { llassert(childp); if (childp->getName() == name) @@ -1625,7 +1625,7 @@ LLView* LLView::findChildView(const std::string& name, bool recurse) const if (recurse) { // Look inside each child as well. - BOOST_FOREACH(LLView* childp, mChildList) + for (LLView* childp : mChildList) { llassert(childp); LLView* viewp = childp->findChildView(name, recurse); @@ -2809,7 +2809,7 @@ S32 LLView::notifyParent(const LLSD& info) bool LLView::notifyChildren(const LLSD& info) { bool ret = false; - BOOST_FOREACH(LLView* childp, mChildList) + for (LLView* childp : mChildList) { ret = ret || childp->notifyChildren(info); } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 1e35f0092d..dcc77a79d1 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -662,6 +662,9 @@ public: // Show hexadecimal byte values of unicode symbols in a tooltip static bool sDebugUnicode; + // Show camera position and direction in Camera Controls floater + static bool sDebugCamera; + static bool sIsRectDirty; static LLRect sDirtyRect; diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 84507a58b6..f8d4a61721 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -28,7 +28,6 @@ #include "llxuiparser.h" -#include "lldir.h" #include "llxmlnode.h" #include "llfasttimer.h" #ifdef LL_USESYSTEMLIBS @@ -45,7 +44,6 @@ #include "lluicolor.h" #include "v3math.h" - using namespace BOOST_SPIRIT_CLASSIC_NS; const S32 MAX_STRING_ATTRIBUTE_SIZE = 40; @@ -935,7 +933,7 @@ bool LLXUIParser::readBoolValue(Parser& parser, void* val_ptr) bool value; LLXUIParser& self = static_cast<LLXUIParser&>(parser); bool success = self.mCurReadNode->getBoolValue(1, &value); - *((bool*)val_ptr) = (value != false); + *((bool*)val_ptr) = value; return success; } @@ -1399,17 +1397,36 @@ bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBl mCurReadDepth = 0; setParseSilently(silent); - std::string xml = gDirUtilp->getFileContents(filename); - if (xml.empty()) + ScopedFile file(filename, "rb"); + if( !file.isOpen() ) { LL_WARNS("ReadXUI") << "Unable to open file " << filename << LL_ENDL; XML_ParserFree( mParser ); return false; } + S32 bytes_read = 0; + + S32 buffer_size = file.getRemainingBytes(); + void* buffer = XML_GetBuffer(mParser, buffer_size); + if( !buffer ) + { + LL_WARNS("ReadXUI") << "Unable to allocate XML buffer while reading file " << filename << LL_ENDL; + XML_ParserFree( mParser ); + return false; + } + + bytes_read = (S32)fread(buffer, 1, buffer_size, file.mFile); + if( bytes_read <= 0 ) + { + LL_WARNS("ReadXUI") << "Error while reading file " << filename << LL_ENDL; + XML_ParserFree( mParser ); + return false; + } + mEmptyLeafNode.push_back(false); - if (!XML_Parse(mParser, xml.data(), (int)xml.size(), true)) + if( !XML_ParseBuffer(mParser, bytes_read, true ) ) { LL_WARNS("ReadXUI") << "Error while parsing file " << filename << LL_ENDL; XML_ParserFree( mParser ); diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index 603f33e400..4c97829146 100644 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp @@ -65,13 +65,12 @@ HRESULT GetVideoMemoryViaWMI(WCHAR* strInputDeviceID, DWORD* pdwAdapterRam) { HRESULT hr; bool bGotMemory = false; - HRESULT hrCoInitialize = S_OK; IWbemLocator* pIWbemLocator = nullptr; IWbemServices* pIWbemServices = nullptr; BSTR pNamespace = nullptr; *pdwAdapterRam = 0; - hrCoInitialize = CoInitialize( 0 ); + CoInitializeEx(0, COINIT_APARTMENTTHREADED); hr = CoCreateInstance( CLSID_WbemLocator, nullptr, @@ -208,8 +207,7 @@ HRESULT GetVideoMemoryViaWMI(WCHAR* strInputDeviceID, DWORD* pdwAdapterRam) SAFE_RELEASE( pIWbemLocator ); - if( SUCCEEDED( hrCoInitialize ) ) - CoUninitialize(); + CoUninitialize(); if( bGotMemory ) return S_OK; @@ -232,9 +230,8 @@ S32 LLDXHardware::getMBVideoMemoryViaWMI() std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor) { std::string mDriverVersion; - HRESULT hrCoInitialize = S_OK; HRESULT hres; - hrCoInitialize = CoInitialize(0); + CoInitializeEx(0, COINIT_APARTMENTTHREADED); IWbemLocator *pLoc = NULL; hres = CoCreateInstance( @@ -437,10 +434,10 @@ std::string LLDXHardware::getDriverVersionWMI(EGPUVendor vendor) { pEnumerator->Release(); } - if (SUCCEEDED(hrCoInitialize)) - { - CoUninitialize(); - } + + // supposed to always call CoUninitialize even if init returned false + CoUninitialize(); + return mDriverVersion; } @@ -687,7 +684,8 @@ bool LLDXHardware::getInfo(bool vram_only) bool ok = false; HRESULT hr; - CoInitialize(NULL); + // CLSID_DxDiagProvider does not work with Multithreaded? + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); IDxDiagProvider *dx_diag_providerp = NULL; IDxDiagContainer *dx_diag_rootp = NULL; @@ -976,7 +974,7 @@ LLSD LLDXHardware::getDisplayInfo() LLTimer hw_timer; HRESULT hr; LLSD ret; - CoInitialize(NULL); + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); IDxDiagProvider *dx_diag_providerp = NULL; IDxDiagContainer *dx_diag_rootp = NULL; diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index d951f7f676..f1e6114f85 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -336,7 +336,7 @@ void LLWindow::handleUnicodeUTF16(U16 utf16, MASK mask) // static bool LLSplashScreen::isVisible() { - return gSplashScreenp ? true: false; + return gSplashScreenp; } // static diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 1c41c1f627..396daec527 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -164,8 +164,6 @@ public: virtual F32 getPixelAspectRatio() = 0; virtual void setNativeAspectRatio(F32 aspect) = 0; - // query VRAM usage - virtual U32 getAvailableVRAMMegabytes() = 0; virtual void setMaxVRAMMegabytes(U32 max_vram) = 0; virtual void beforeDialog() {}; // prepare to put up an OS dialog (if special measures are required, such as in fullscreen mode) diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h index 06e6b2783d..f422152ab2 100644 --- a/indra/llwindow/llwindowheadless.h +++ b/indra/llwindow/llwindowheadless.h @@ -101,7 +101,6 @@ public: /*virtual*/ F32 getPixelAspectRatio() override { return 1.0f; } /*virtual*/ void setNativeAspectRatio(F32 ratio) override {} - U32 getAvailableVRAMMegabytes() override { return 4096; } void setMaxVRAMMegabytes(U32 max_vram) override {} /*virtual*/ void *getPlatformWindow() override { return 0; } diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index bfa893fff8..73230805b4 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -118,7 +118,6 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, U32 fsaa_samples, U32 max_vram) : LLWindow(NULL, fullscreen, flags) - , mMaxVRAM(max_vram) { // *HACK: During window construction we get lots of OS events for window // reshape, activate, etc. that the viewer isn't ready to handle. @@ -1255,21 +1254,6 @@ F32 LLWindowMacOSX::getPixelAspectRatio() return 1.f; } -U32 LLWindowMacOSX::getAvailableVRAMMegabytes() { - // MTL (and MoltenVK) has some additional gpu data, such as recommendedMaxWorkingSetSize and currentAllocatedSize. - // But these are not available for OpenGL and/or our current mimimum OS version. - // So we will estimate. - static const U32 mb = 1024*1024; - // We're asked for total available gpu memory, but we only have allocation info on texture usage. So estimate by doubling that. - static const U32 total_factor = 2; // estimated total/textures - U32 total_vram = gGLManager.mVRAM; - if (mMaxVRAM) - { - total_vram = llmin(mMaxVRAM, total_vram); - } - return total_vram - (LLImageGL::getTextureBytesAllocated() * total_factor/mb); -} - //static SInt32 oldWindowLevel; // MBW -- XXX -- There's got to be a better way than this. Find it, please... diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 7b0695bc79..0d675671a9 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -100,9 +100,7 @@ public: F32 getPixelAspectRatio() override; void setNativeAspectRatio(F32 ratio) override { mOverrideAspectRatio = ratio; } - // query VRAM usage - /*virtual*/ U32 getAvailableVRAMMegabytes() override; - virtual void setMaxVRAMMegabytes(U32 max_vram) override { mMaxVRAM = max_vram; } + virtual void setMaxVRAMMegabytes(U32 max_vram) override {} void beforeDialog() override; void afterDialog() override; @@ -226,7 +224,6 @@ protected: bool mMinimized; U32 mFSAASamples; bool mForceRebuild; - U32 mMaxVRAM; S32 mDragOverrideCursor; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 1ed801a85a..eb9ece6ea9 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -370,14 +370,6 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool //clean up DXGI/D3D resources void cleanupDX(); - // call periodically to update available VRAM - void updateVRAMUsage(); - - U32 getAvailableVRAMMegabytes() - { - return mAvailableVRAM; - } - /// called by main thread to post work to this window thread template <typename CALLABLE> void post(CALLABLE&& func) @@ -425,8 +417,6 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool // *HACK: Attempt to prevent startup crashes by deferring memory accounting // until after some graphics setup. See SL-20177. -Cosmic,2023-09-18 bool mGLReady = false; - // best guess at available video memory in MB - std::atomic<U32> mAvailableVRAM; U32 mMaxVRAM = 0; // maximum amount of vram to allow in the "budget", or 0 for no maximum (see updateVRAMUsage) @@ -3378,7 +3368,7 @@ F32 LLWindowWin32::getGamma() bool LLWindowWin32::restoreGamma() { ASSERT_MAIN_THREAD(); - if (mCustomGammaSet != false) + if (mCustomGammaSet) { LL_DEBUGS("Window") << "Restoring gamma" << LL_ENDL; mCustomGammaSet = false; @@ -3393,12 +3383,12 @@ bool LLWindowWin32::setGamma(const F32 gamma) mCurrentGamma = gamma; //Get the previous gamma ramp to restore later. - if (mCustomGammaSet == false) + if (!mCustomGammaSet) { if (!gGLManager.mIsIntel) // skip for Intel GPUs (see SL-11341) { LL_DEBUGS("Window") << "Getting the previous gamma ramp to restore later" << LL_ENDL; - if(GetDeviceGammaRamp(mhDC, mPrevGammaRamp) == FALSE) + if (!GetDeviceGammaRamp(mhDC, mPrevGammaRamp)) { LL_WARNS("Window") << "Failed to get the previous gamma ramp" << LL_ENDL; return false; @@ -4556,11 +4546,6 @@ std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList() return std::vector<std::string>(); } -U32 LLWindowWin32::getAvailableVRAMMegabytes() -{ - return mWindowThread ? mWindowThread->getAvailableVRAMMegabytes() : 0; -} - void LLWindowWin32::setMaxVRAMMegabytes(U32 max_vram) { if (mWindowThread) @@ -4787,79 +4772,6 @@ void LLWindowWin32::LLWindowWin32Thread::cleanupDX() } } -void LLWindowWin32::LLWindowWin32Thread::updateVRAMUsage() -{ - LL_PROFILE_ZONE_SCOPED; - if (!mGLReady) { return; } - - if (mDXGIAdapter != nullptr) - { - // NOTE: what lies below is hand wavy math based on compatibility testing and observation against a variety of hardware - // It doesn't make sense, but please don't refactor it to make sense. -- davep - - DXGI_QUERY_VIDEO_MEMORY_INFO info; - mDXGIAdapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &info); -#if 0 // debug 0 budget and 0 CU - info.Budget = 0; - info.CurrentUsage = 0; -#endif - - U32 budget_mb = info.Budget / 1024 / 1024; - gGLManager.mVRAM = llmax(gGLManager.mVRAM, (S32) budget_mb); - - U32 afr_mb = info.AvailableForReservation / 1024 / 1024; - // correct for systems that misreport budget - if (budget_mb == 0) - { - // fall back to available for reservation clamped between 512MB and 2GB - budget_mb = llclamp(afr_mb, (U32) 512, (U32) 2048); - } - - if ( mMaxVRAM != 0) - { - budget_mb = llmin(budget_mb, mMaxVRAM); - } - - U32 cu_mb = info.CurrentUsage / 1024 / 1024; - - // get an estimated usage based on texture bytes allocated - U32 eu_mb = LLImageGL::getTextureBytesAllocated() * 2 / 1024 / 1024; - - if (cu_mb == 0) - { // current usage is sometimes unreliable on Intel GPUs, fall back to estimated usage - cu_mb = llmax((U32)1, eu_mb); - } - U32 target_mb = budget_mb; - - if (target_mb > 4096) // if 4GB are installed, try to leave 2GB free - { - target_mb -= 2048; - } - else // if less than 4GB are installed, try not to use more than half of it - { - target_mb /= 2; - } - - mAvailableVRAM = cu_mb < target_mb ? target_mb - cu_mb : 0; - -#if 0 - - F32 eu_error = (F32)((S32)eu_mb - (S32)cu_mb) / (F32)cu_mb; - LL_INFOS("Window") << "\nLocal\nAFR: " << info.AvailableForReservation / 1024 / 1024 - << "\nBudget: " << info.Budget / 1024 / 1024 - << "\nCR: " << info.CurrentReservation / 1024 / 1024 - << "\nCU: " << info.CurrentUsage / 1024 / 1024 - << "\nEU: " << eu_mb << llformat(" (%.2f)", eu_error) - << "\nTU: " << target_mb - << "\nAM: " << mAvailableVRAM << LL_ENDL; -#endif - } - else if (mD3DDevice != NULL) - { // fallback to D3D9 - mAvailableVRAM = mD3DDevice->GetAvailableTextureMem() / 1024 / 1024; - } -} - void LLWindowWin32::LLWindowWin32Thread::run() { sWindowThreadId = std::this_thread::get_id(); @@ -4917,14 +4829,7 @@ void LLWindowWin32::LLWindowWin32Thread::run() //process any pending functions getQueue().runPending(); } - - // update available vram once every 3 seconds - static LLFrameTimer vramTimer; - if (vramTimer.getElapsedTimeF32() > 3.f) - { - updateVRAMUsage(); - vramTimer.reset(); - } + #if 0 { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("w32t - Sleep"); diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 8b82ad92d5..7e320053a6 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -108,7 +108,6 @@ public: /*virtual*/ F32 getPixelAspectRatio(); /*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; } - U32 getAvailableVRAMMegabytes() override; /*virtual*/ void setMaxVRAMMegabytes(U32 max_vram) override; /*virtual*/ bool dialogColorPicker(F32 *r, F32 *g, F32 *b ); diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 6b7f63c192..c0f27e2c22 100644 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -210,7 +210,7 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value) void LLControlVariable::setValue(const LLSD& new_value, bool saved_value) { - if (mValidateSignal(this, new_value) == false) + if (!mValidateSignal(this, new_value)) { // can not set new value, exit return; @@ -218,12 +218,12 @@ void LLControlVariable::setValue(const LLSD& new_value, bool saved_value) LLSD storable_value = getComparableValue(new_value); LLSD original_value = getValue(); - bool value_changed = llsd_compare(original_value, storable_value) == false; + bool value_changed = !llsd_compare(original_value, storable_value); if(saved_value) { // If we're going to save this value, return to default but don't fire resetToDefault(false); - if (llsd_compare(mValues.back(), storable_value) == false) + if (!llsd_compare(mValues.back(), storable_value)) { mValues.push_back(storable_value); } @@ -233,7 +233,7 @@ void LLControlVariable::setValue(const LLSD& new_value, bool saved_value) // This is an unsaved value. Its needs to reside at // mValues[2] (or greater). It must not affect // the result of getSaveValue() - if (llsd_compare(mValues.back(), storable_value) == false) + if (!llsd_compare(mValues.back(), storable_value)) { while(mValues.size() > 2) { @@ -267,10 +267,10 @@ void LLControlVariable::setDefaultValue(const LLSD& value) LLSD comparable_value = getComparableValue(value); LLSD original_value = getValue(); - bool value_changed = (llsd_compare(original_value, comparable_value) == false); + bool value_changed = !llsd_compare(original_value, comparable_value); resetToDefault(false); mValues[0] = comparable_value; - if(value_changed) + if (value_changed) { firePropertyChanged(original_value); } @@ -753,13 +753,13 @@ void LLControlGroup::setUntypedValue(std::string_view name, const LLSD& val) //--------------------------------------------------------------- // Returns number of controls loaded, so 0 if failure -U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, const std::string& xml, bool require_declaration, eControlType declare_as) +U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, bool require_declaration, eControlType declare_as) { std::string name; LLXmlTree xml_controls; - if (!xml_controls.parseString(xml)) + if (!xml_controls.parseFile(filename)) { LL_WARNS("Settings") << "Unable to open control file " << filename << LL_ENDL; return 0; @@ -772,7 +772,7 @@ U32 LLControlGroup::loadFromFileLegacy(const std::string& filename, const std::s return 0; } - U32 validitems = 0; + U32 validitems = 0; S32 version; rootp->getAttributeS32("version", version); @@ -990,24 +990,24 @@ U32 LLControlGroup::saveToFile(const std::string& filename, bool nondefault_only U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values, bool save_values) { LLSD settings; - - std::string xml = gDirUtilp->getFileContents(filename); - if (xml.empty()) + llifstream infile; + infile.open(filename.c_str()); + if(!infile.is_open()) { LL_WARNS("Settings") << "Cannot find file " << filename << " to load." << LL_ENDL; return 0; } - std::stringstream stream(xml); - if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings, stream)) + if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings, infile)) { + infile.close(); LL_WARNS("Settings") << "Unable to parse LLSD control file " << filename << ". Trying Legacy Method." << LL_ENDL; - return loadFromFileLegacy(filename, xml, true, TYPE_STRING); + return loadFromFileLegacy(filename, true, TYPE_STRING); } U32 validitems = 0; bool hidefromsettingseditor = false; - + for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr) { LLControlVariable::ePersist persist = LLControlVariable::PERSIST_NONDFT; @@ -1019,7 +1019,7 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v persist = control_map["Persist"].asInteger()? LLControlVariable::PERSIST_NONDFT : LLControlVariable::PERSIST_NO; } - + // Sometimes we want to use the settings system to provide cheap persistence, but we // don't want the settings themselves to be easily manipulated in the UI because // doing so can cause support problems. So we have this option: @@ -1031,7 +1031,7 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v { hidefromsettingseditor = false; } - + // If the control exists just set the value from the input file. LLControlVariable* existing_control = getControl(name); if(existing_control) diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index e148b74292..a8bc584c48 100644 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -300,7 +300,7 @@ public: // Returns number of controls loaded, 0 if failed // If require_declaration is false, will auto-declare controls it finds // as the given type. - U32 loadFromFileLegacy(const std::string& filename, const std::string& xml, bool require_declaration = true, eControlType declare_as = TYPE_STRING); + U32 loadFromFileLegacy(const std::string& filename, bool require_declaration = true, eControlType declare_as = TYPE_STRING); U32 saveToFile(const std::string& filename, bool nondefault_only); U32 loadFromFile(const std::string& filename, bool default_values = false, bool save_values = true); void resetToDefaults(); diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 627e99a1e6..9c7ac66f01 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -650,56 +650,34 @@ bool LLXMLNode::updateNode( return true; } -static std::map<std::string, LLXMLNodePtr> sXMLCache; -static LLSharedMutex sXMLCacheMutex; - -static void saveToCache(const std::string& filename, LLXMLNodePtr& node) +// static +bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXMLNode* defaults_tree) { - LLExclusiveMutexLock lock(&sXMLCacheMutex); - sXMLCache.emplace(filename, node.notNull() ? node->deepCopy() : nullptr); -} + // Read file + LL_DEBUGS("XMLNode") << "parsing XML file: " << filename << LL_ENDL; + LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ + if (fp == NULL) + { + node = NULL ; + return false; + } + fseek(fp, 0, SEEK_END); + U32 length = ftell(fp); + fseek(fp, 0, SEEK_SET); -static bool loadFromCache(const std::string& filename, LLXMLNodePtr& node) -{ - LLSharedMutexLock lock(&sXMLCacheMutex); - auto it = sXMLCache.find(filename); - if (it == sXMLCache.end()) - return false; - node = it->second.notNull() ? it->second->deepCopy() : nullptr; - return node.notNull(); -} + U8* buffer = new U8[length+1]; + size_t nread = fread(buffer, 1, length, fp); + buffer[nread] = 0; + fclose(fp); -// static -bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXMLNode* defaults_tree, bool cacheable) -{ - // Try to read from cache - if (cacheable) - { - if (loadFromCache(filename, node)) - return true; - } - - std::string xml = gDirUtilp->getFileContents(filename); - if (xml.empty()) - { - LL_WARNS("XMLNode") << "no XML file: " << filename << LL_ENDL; - } - else if (parseBuffer(xml.data(), xml.size(), node, defaults_tree)) - { - if (cacheable) - { - saveToCache(filename, node); - } - return true; - } - - node = nullptr; - return false; + bool rv = parseBuffer(buffer, nread, node, defaults_tree); + delete [] buffer; + return rv; } // static bool LLXMLNode::parseBuffer( - const char* buffer, + U8* buffer, U32 length, LLXMLNodePtr& node, LLXMLNode* defaults) @@ -718,7 +696,7 @@ bool LLXMLNode::parseBuffer( XML_SetUserData(my_parser, (void *)file_node_ptr); // Do the parsing - if (XML_Parse(my_parser, buffer, length, true) != XML_STATUS_OK) + if (XML_Parse(my_parser, (const char *)buffer, length, true) != XML_STATUS_OK) { LL_WARNS() << "Error parsing xml error code: " << XML_ErrorString(XML_GetErrorCode(my_parser)) @@ -846,20 +824,18 @@ bool LLXMLNode::isFullyDefault() } // static -bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root, const std::vector<std::string>& paths, bool cacheable) +bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root, + const std::vector<std::string>& paths) { - if (paths.empty()) - { - return false; - } + if (paths.empty()) return false; std::string filename = paths.front(); if (filename.empty()) { return false; } - - if (!LLXMLNode::parseFile(filename, root, nullptr, cacheable)) + + if (!LLXMLNode::parseFile(filename, root, NULL)) { LL_WARNS() << "Problem reading UI description file: " << filename << LL_ENDL; return false; diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index 32aee057ed..d5b8b36d86 100644 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -126,34 +126,34 @@ public: bool isNull(); bool deleteChild(LLXMLNode* child); - void addChild(LLXMLNodePtr& new_child); + void addChild(LLXMLNodePtr& new_child); void setParent(LLXMLNodePtr& new_parent); // reparent if necessary - // Deserialization + // Serialization static bool parseFile( const std::string& filename, - LLXMLNodePtr& node, - LLXMLNode* defaults_tree, - bool cacheable = false); + LLXMLNodePtr& node, + LLXMLNode* defaults_tree); static bool parseBuffer( - const char* buffer, + U8* buffer, U32 length, - LLXMLNodePtr& node, + LLXMLNodePtr& node, LLXMLNode* defaults); static bool parseStream( std::istream& str, - LLXMLNodePtr& node, + LLXMLNodePtr& node, LLXMLNode* defaults); static bool updateNode( LLXMLNodePtr& node, LLXMLNodePtr& update_node); - - static bool getLayeredXMLNode(LLXMLNodePtr& root, const std::vector<std::string>& paths, bool cacheable = false); - + + static bool getLayeredXMLNode(LLXMLNodePtr& root, const std::vector<std::string>& paths); + + // Write standard XML file header: // <?xml version="1.0" encoding="utf-8" standalone="yes" ?> static void writeHeaderToFile(LLFILE *out_file); - + // Write XML to file with one attribute per line. // XML escapes values as they are written. void writeToFile(LLFILE *out_file, const std::string& indent = std::string(), bool use_type_decorations=true); @@ -237,7 +237,7 @@ public: // Setters bool setAttributeString(const char* attr, const std::string& value); - + void setBoolValue(const bool value) { setBoolValue(1, &value); } void setByteValue(const U8 value, Encoding encoding = ENCODING_DEFAULT) { setByteValue(1, &value, encoding); } void setIntValue(const S32 value, Encoding encoding = ENCODING_DEFAULT) { setIntValue(1, &value, encoding); } diff --git a/indra/llxml/llxmltree.cpp b/indra/llxml/llxmltree.cpp index 38321847c3..a9c702f552 100644 --- a/indra/llxml/llxmltree.cpp +++ b/indra/llxml/llxmltree.cpp @@ -35,7 +35,6 @@ #include "v4math.h" #include "llquaternion.h" #include "lluuid.h" -#include "lldir.h" ////////////////////////////////////////////////////////////// // LLXmlTree @@ -61,37 +60,20 @@ void LLXmlTree::cleanup() mNodeNames.cleanup(); } -bool LLXmlTree::parseFile(const std::string & filename, bool keep_contents) -{ - delete mRoot; - mRoot = NULL; - - std::string xml = gDirUtilp->getFileContents(filename); - if (xml.empty()) - { - LL_WARNS() << "LLXmlTree parse failed. No XML file: " << filename << LL_ENDL; - return false; - } - - bool success = parseString(xml, keep_contents); - return success; -} - -bool LLXmlTree::parseString(const std::string &xml, bool keep_contents) +bool LLXmlTree::parseFile(const std::string &path, bool keep_contents) { delete mRoot; mRoot = NULL; LLXmlTreeParser parser(this); - bool success = parser.parseString(xml, &mRoot, keep_contents); - if (!success) + bool success = parser.parseFile( path, &mRoot, keep_contents ); + if( !success ) { S32 line_number = parser.getCurrentLineNumber(); const char* error = parser.getErrorString(); LL_WARNS() << "LLXmlTree parse failed. Line " << line_number << ": " << error << LL_ENDL; } - return success; } @@ -155,14 +137,14 @@ void LLXmlTreeNode::dump( const std::string& prefix ) bool LLXmlTreeNode::hasAttribute(const std::string& name) { - LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); + LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name); attribute_map_t::iterator iter = mAttributes.find(canonical_name); - return (iter == mAttributes.end()) ? false : true; + return iter != mAttributes.end(); } void LLXmlTreeNode::addAttribute(const std::string& name, const std::string& value) { - LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString( name ); + LLStdStringHandle canonical_name = LLXmlTree::sAttributeKeys.addString(name); const std::string *newstr = new std::string(value); mAttributes[canonical_name] = newstr; // insert + copy } @@ -554,27 +536,6 @@ bool LLXmlTreeParser::parseFile(const std::string &path, LLXmlTreeNode** root, b return success; } -bool LLXmlTreeParser::parseString(const std::string& xml, LLXmlTreeNode** root, bool keep_contents) -{ - llassert( !mRoot ); - llassert( !mCurrent ); - - mKeepContents = keep_contents; - - bool success = LLXmlParser::parse(xml.data(), (int)xml.size(), true); - - *root = mRoot; - mRoot = NULL; - - if (success) - { - llassert(!mCurrent); - } - - mCurrent = NULL; - - return success; -} const std::string& LLXmlTreeParser::tabs() { diff --git a/indra/llxml/llxmltree.h b/indra/llxml/llxmltree.h index d47f26f731..5d15c4c7f5 100644 --- a/indra/llxml/llxmltree.h +++ b/indra/llxml/llxmltree.h @@ -56,7 +56,6 @@ public: void cleanup(); virtual bool parseFile(const std::string &path, bool keep_contents = true); - virtual bool parseString(const std::string &xml, bool keep_contents = true); LLXmlTreeNode* getRoot() { return mRoot; } @@ -200,8 +199,7 @@ public: LLXmlTreeParser(LLXmlTree* tree); virtual ~LLXmlTreeParser(); - bool parseFile(const std::string &path, LLXmlTreeNode** root, bool keep_contents); - bool parseString(const std::string &xml, LLXmlTreeNode** root, bool keep_contents); + bool parseFile(const std::string &path, LLXmlTreeNode** root, bool keep_contents ); protected: const std::string& tabs(); diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 0630a353ed..6c2cfb3e6b 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -232,6 +232,7 @@ set(viewer_SOURCE_FILES llfloaterimcontainer.cpp llfloaterinspect.cpp llfloaterinventorysettings.cpp + llfloaterinventorythumbnailshelper.cpp llfloaterjoystick.cpp llfloaterlagmeter.cpp llfloaterland.cpp @@ -884,6 +885,7 @@ set(viewer_HEADER_FILES llfloaterimcontainer.h llfloaterinspect.h llfloaterinventorysettings.h + llfloaterinventorythumbnailshelper.h llfloaterjoystick.h llfloaterlagmeter.h llfloaterland.h @@ -1566,34 +1568,15 @@ endif (WINDOWS) # Add the xui files. This is handy for searching for xui elements # from within the IDE. -set(viewer_XUI_FILES - skins/default/colors.xml - skins/default/default_languages.xml - skins/default/textures/textures.xml - ) -file(GLOB DEFAULT_XUI_FILE_GLOB_LIST - ${CMAKE_CURRENT_SOURCE_DIR}/skins/*/xui/en/*.xml) -list(APPEND viewer_XUI_FILES ${DEFAULT_XUI_FILE_GLOB_LIST}) - -file(GLOB DEFAULT_WIDGET_FILE_GLOB_LIST - ${CMAKE_CURRENT_SOURCE_DIR}/skins/*/xui/en/widgets/*.xml) -list(APPEND viewer_XUI_FILES ${DEFAULT_WIDGET_FILE_GLOB_LIST}) - -# Cannot append empty lists in CMake, wait until we have files here. -#file(GLOB SILVER_WIDGET_FILE_GLOB_LIST -# ${CMAKE_CURRENT_SOURCE_DIR}/skins/silver/xui/en-us/widgets/*.xml) -#list(APPEND viewer_XUI_FILES ${SILVER_WIDGET_FILE_GLOB_LIST}) - -list(SORT viewer_XUI_FILES) - -source_group("XUI Files" FILES ${viewer_XUI_FILES}) - -set_source_files_properties(${viewer_XUI_FILES} +file(GLOB_RECURSE viewer_XUI_FILES LIST_DIRECTORIES FALSE + ${CMAKE_CURRENT_SOURCE_DIR}/skins/*.xml) +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/skins PREFIX "XUI Files" FILES ${viewer_XUI_FILES}) +set_source_files_properties(${viewer_XUI_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) - list(APPEND viewer_SOURCE_FILES ${viewer_XUI_FILES}) -file(GLOB_RECURSE viewer_SHADER_FILES LIST_DIRECTORIES TRUE +# Add the shader sources +file(GLOB_RECURSE viewer_SHADER_FILES LIST_DIRECTORIES FALSE ${CMAKE_CURRENT_SOURCE_DIR}/app_settings/shaders/*.glsl) source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/app_settings/shaders PREFIX "Shaders" FILES ${viewer_SHADER_FILES}) set_source_files_properties(${viewer_SHADER_FILES} @@ -1603,6 +1586,7 @@ list(APPEND viewer_SOURCE_FILES ${viewer_SHADER_FILES}) set(viewer_APPSETTINGS_FILES app_settings/anim.ini + app_settings/autoreplace.xml app_settings/cmd_line.xml app_settings/commands.xml app_settings/grass.xml diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index 14627a7c8c..2380dcfd47 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -7.1.6 +7.1.7 diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5997c59048..ed996e6832 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10346,6 +10346,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>NameTagDebugAVRezState</key> + <map> + <key>Comment</key> + <string>Show Avatar Rez state in name tag</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>RenderInitError</key> <map> <key>Comment</key> @@ -10899,6 +10910,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>RenderAvatarFriendsOnly</key> + <map> + <key>Comment</key> + <string>When enabled hides all avatars that aren't friends. Does not affect inworld control avatars (animeshes), nor self.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <real>0</real> + </map> <key>RenderAvatarComplexityMode</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl index 1a85d70256..6791fe44d9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl @@ -27,11 +27,11 @@ float random (vec2 uv) { - return 0; + return 0.f; } float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n, inout vec4 collectedColor, sampler2D source, float glossiness) { collectedColor = vec4(0); - return 0; + return 0.f; } diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index aef402d4db..2cdd86267e 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -2021,7 +2021,7 @@ value_min="-1" value_max="1"> <param_skeleton> - + <bone name="mEyeLeft" scale="0 0 0" @@ -2031,8 +2031,9 @@ name="mEyeRight" scale="0 0 0" offset="-.005 0 0" /> - - <bone + + +<bone name="mFaceEyeAltLeft" scale="0 0 0" offset="-.005 0 0" /> @@ -2041,7 +2042,7 @@ name="mFaceEyeAltRight" scale="0 0 0" offset="-.005 0 0" /> - + <bone name="mFaceEyeLidLowerRight" scale="0 0.3 0.7" @@ -2052,7 +2053,7 @@ scale="0 0.3 0.7" offset="0 0 0" /> - <bone + <bone name="mFaceEyeLidUpperRight" scale="0 0.3 0.7" offset=" 0 0 0" /> @@ -2061,17 +2062,17 @@ name="mFaceEyeLidUpperLeft" scale="0 0.3 0.7" offset=" 0 0 0" /> - + <bone name="mFaceEyecornerInnerLeft" scale="0 0 0" offset="-0.005 -0.008 0.0" /> - + <bone name="mFaceEyecornerInnerRight" scale="0 0 0" offset="-0.005 0.008 0.0" /> - + </param_skeleton> </param> diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index fb0d3bd58c..e07375b0bd 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -95,7 +95,6 @@ #include "llworld.h" #include "llworldmap.h" #include "stringize.h" -#include "boost/foreach.hpp" #include "llcorehttputil.h" #include "lluiusage.h" @@ -1469,24 +1468,27 @@ void LLAgent::pitch(F32 angle) LLVector3 skyward = getReferenceUpVector(); - // SL-19286 Avatar is upside down when viewed from below - // after left-clicking the mouse on the avatar and dragging down - // - // The issue is observed on angle below 10 degrees - bool isMouseLookOn = mControlFlags & AGENT_CONTROL_MOUSELOOK; - const F32 look_down_limit = 179.f * DEG_TO_RAD; - const F32 look_up_limit = (isMouseLookOn ? 1.f : 10.f) * DEG_TO_RAD; - - F32 angle_from_skyward = acos(mFrameAgent.getAtAxis() * skyward); - // clamp pitch to limits - if ((angle >= 0.f) && (angle_from_skyward + angle > look_down_limit)) + if (angle >= 0.f) { - angle = look_down_limit - angle_from_skyward; + const F32 look_down_limit = 179.f * DEG_TO_RAD; + F32 angle_from_skyward = acos(mFrameAgent.getAtAxis() * skyward); + if (angle_from_skyward + angle > look_down_limit) + { + angle = look_down_limit - angle_from_skyward; + } } - else if ((angle < 0.f) && (angle_from_skyward + angle < look_up_limit)) + else if (angle < 0.f) { - angle = look_up_limit - angle_from_skyward; + const F32 look_up_limit = 5.f * DEG_TO_RAD; + const LLVector3& viewer_camera_pos = LLViewerCamera::getInstance()->getOrigin(); + LLVector3 agent_focus_pos = getPosAgentFromGlobal(gAgentCamera.calcFocusPositionTargetGlobal()); + LLVector3 look_dir = agent_focus_pos - viewer_camera_pos; + F32 angle_from_skyward = angle_between(look_dir, skyward); + if (angle_from_skyward + angle < look_up_limit) + { + angle = look_up_limit - angle_from_skyward; + } } if (fabs(angle) > 1e-4) @@ -2330,7 +2332,7 @@ void LLAgent::endAnimationUpdateUI() LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container"); LLFloaterIMContainer::floater_list_t conversations; im_box->getDetachedConversationFloaters(conversations); - BOOST_FOREACH(LLFloater* conversation, conversations) + for (LLFloater* conversation : conversations) { LL_INFOS() << "skip_list.insert(session_floater): " << conversation->getTitle() << LL_ENDL; skip_list.insert(conversation); @@ -3302,16 +3304,15 @@ void LLAgent::sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRe msg->addUUIDFast(_PREHASH_AgentID, getID()); msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); - for (S32 i = 0; i < anim_ids.size(); i++) + for (const LLUUID& uuid : anim_ids) { - if (anim_ids[i].isNull()) + if (uuid.notNull()) { - continue; + msg->nextBlockFast(_PREHASH_AnimationList); + msg->addUUIDFast(_PREHASH_AnimID, uuid); + msg->addBOOLFast(_PREHASH_StartAnim, request == ANIM_REQUEST_START); + num_valid_anims++; } - msg->nextBlockFast(_PREHASH_AnimationList); - msg->addUUIDFast(_PREHASH_AnimID, (anim_ids[i]) ); - msg->addBOOLFast(_PREHASH_StartAnim, (request == ANIM_REQUEST_START) ? true : false); - num_valid_anims++; } msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList); @@ -3336,8 +3337,8 @@ void LLAgent::sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request) msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); msg->nextBlockFast(_PREHASH_AnimationList); - msg->addUUIDFast(_PREHASH_AnimID, (anim_id) ); - msg->addBOOLFast(_PREHASH_StartAnim, (request == ANIM_REQUEST_START) ? true : false); + msg->addUUIDFast(_PREHASH_AnimID, anim_id); + msg->addBOOLFast(_PREHASH_StartAnim, request == ANIM_REQUEST_START); msg->nextBlockFast(_PREHASH_PhysicalAvatarEventList); msg->addBinaryDataFast(_PREHASH_TypeData, NULL, 0); @@ -4334,6 +4335,10 @@ void LLAgent::teleportRequest( // Landmark ID = LLUUID::null means teleport home void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id) { + if (landmark_asset_id.isNull()) + { + gAgentCamera.resetView(); + } mTeleportRequest = LLTeleportRequestPtr(new LLTeleportRequestViaLandmark(landmark_asset_id)); startTeleportRequest(); } diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 1cdb2b5936..f076409eb2 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -61,7 +61,7 @@ class LLTeleportRequest; -typedef boost::shared_ptr<LLTeleportRequest> LLTeleportRequestPtr; +typedef std::shared_ptr<LLTeleportRequest> LLTeleportRequestPtr; //-------------------------------------------------------------------- // Types @@ -131,7 +131,7 @@ public: private: bool mInitialized; bool mFirstLogin; - boost::shared_ptr<LLAgentListener> mListener; + std::shared_ptr<LLAgentListener> mListener; //-------------------------------------------------------------------- // Session diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index e6c988fe14..a8a4576d42 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1778,7 +1778,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(bool *hit_limit) head_offset.clearVec(); F32 fixup; - if (gAgentAvatarp->hasPelvisFixup(fixup)) + if (gAgentAvatarp->hasPelvisFixup(fixup) && !gAgentAvatarp->isSitting()) { head_offset[VZ] -= fixup; } diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index fc3851deb4..a78b2ffc6f 100644 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -1738,10 +1738,6 @@ void AISUpdate::doUpdate() LL_DEBUGS("Inventory") << "cat version update " << cat->getName() << " to version " << cat->getVersion() << LL_ENDL; if (cat->getVersion() != version) { - LL_WARNS() << "Possible version mismatch for category " << cat->getName() - << ", viewer version " << cat->getVersion() - << " AIS version " << version << " !!!Adjusting local version!!!" << LL_ENDL; - // the AIS version should be considered the true version. Adjust // our local category model to reflect this version number. Otherwise // it becomes possible to get stuck with the viewer being out of @@ -1751,13 +1747,23 @@ void AISUpdate::doUpdate() // is performed. This occasionally gets out of sync however. if (version != LLViewerInventoryCategory::VERSION_UNKNOWN) { + LL_WARNS() << "Possible version mismatch for category " << cat->getName() + << ", viewer version " << cat->getVersion() + << " AIS version " << version << " !!!Adjusting local version!!!" << LL_ENDL; cat->setVersion(version); } else { // We do not account for update if version is UNKNOWN, so we shouldn't rise version // either or viewer will get stuck on descendants count -1, try to refetch folder instead - cat->fetch(); + // + // Todo: proper backoff? + + LL_WARNS() << "Possible version mismatch for category " << cat->getName() + << ", viewer version " << cat->getVersion() + << " AIS version " << version << " !!!Rerequesting category!!!" << LL_ENDL; + const S32 LONG_EXPIRY = 360; + cat->fetch(LONG_EXPIRY); } } } diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4ad56b22b8..488709cfa1 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -27,7 +27,6 @@ #include "llviewerprecompiledheaders.h" #include <boost/lexical_cast.hpp> -#include <boost/foreach.hpp> #include "llaccordionctrltab.h" #include "llagent.h" #include "llagentcamera.h" @@ -1647,7 +1646,7 @@ void LLAppearanceMgr::removeOutfitPhoto(const LLUUID& outfit_id) sub_cat_array, outfit_item_array, LLInventoryModel::EXCLUDE_TRASH); - BOOST_FOREACH(LLViewerInventoryItem* outfit_item, outfit_item_array) + for (LLViewerInventoryItem* outfit_item : outfit_item_array) { LLViewerInventoryItem* linked_item = outfit_item->getLinkedItem(); if (linked_item != NULL) @@ -3438,7 +3437,7 @@ void update_base_outfit_after_ordering() sub_cat_array, outfit_item_array, LLInventoryModel::EXCLUDE_TRASH); - BOOST_FOREACH(LLViewerInventoryItem* outfit_item, outfit_item_array) + for (LLViewerInventoryItem* outfit_item : outfit_item_array) { LLViewerInventoryItem* linked_item = outfit_item->getLinkedItem(); if (linked_item != NULL) @@ -3742,7 +3741,7 @@ LLSD LLAppearanceMgr::dumpCOF() const LLUUID linked_asset_id(linked_item->getAssetUUID()); md5.update((unsigned char*)linked_asset_id.mData, 16); U32 flags = linked_item->getFlags(); - md5.update(boost::lexical_cast<std::string>(flags)); + md5.update(std::to_string(flags)); } else if (LLAssetType::AT_LINK_FOLDER != inv_item->getActualType()) { diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 0fdb8b7742..56521895c1 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -143,7 +143,6 @@ // Third party library includes #include <boost/bind.hpp> -#include <boost/foreach.hpp> #include <boost/algorithm/string.hpp> #include <boost/regex.hpp> #include <boost/throw_exception.hpp> @@ -1206,7 +1205,7 @@ bool LLAppViewer::init() LLSD item(LeapCommand); LeapCommand.append(item); } - BOOST_FOREACH(const std::string& leap, llsd::inArray(LeapCommand)) + for (const auto& leap : llsd::inArray(LeapCommand)) { LL_INFOS("InitInfo") << "processing --leap \"" << leap << '"' << LL_ENDL; // We don't have any better description of this plugin than the @@ -1711,7 +1710,7 @@ bool LLAppViewer::cleanup() LLNotifications::instance().clear(); // workaround for DEV-35406 crash on shutdown - LLEventPumps::instance().reset(); + LLEventPumps::instance().reset(true); //dump scene loading monitor results if (LLSceneMonitor::instanceExists()) @@ -2369,7 +2368,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, LL_ERRS() << "Invalid settings location list" << LL_ENDL; } - BOOST_FOREACH(const SettingsGroup& group, mSettingsLocationList->groups) + for (const SettingsGroup& group : mSettingsLocationList->groups) { // skip settings groups that aren't the one we requested if (group.name() != location_key) continue; @@ -2381,7 +2380,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, return false; } - BOOST_FOREACH(const SettingsFile& file, group.files) + for (const SettingsFile& file : group.files) { LL_INFOS("Settings") << "Attempting to load settings for the group " << file.name() << " - from location " << location_key << LL_ENDL; @@ -2446,11 +2445,11 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, std::string LLAppViewer::getSettingsFilename(const std::string& location_key, const std::string& file) { - BOOST_FOREACH(const SettingsGroup& group, mSettingsLocationList->groups) + for (const SettingsGroup& group : mSettingsLocationList->groups) { if (group.name() == location_key) { - BOOST_FOREACH(const SettingsFile& settings_file, group.files) + for (const SettingsFile& settings_file : group.files) { if (settings_file.name() == file) { @@ -2996,7 +2995,7 @@ void LLAppViewer::initStrings() { std::string strings_file = "strings.xml"; std::string strings_path_full = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, strings_file); - if (strings_path_full.empty() || !gDirUtilp->fileExists(strings_path_full)) + if (strings_path_full.empty() || !LLFile::isfile(strings_path_full)) { if (strings_path_full.empty()) { @@ -3036,7 +3035,7 @@ void LLAppViewer::initStrings() // Now that we've set "[sourceid]", have to go back through // default_trans_args and reinitialize all those other keys because some // of them, in turn, reference "[sourceid]". - BOOST_FOREACH(std::string key, default_trans_args) + for (const std::string& key : default_trans_args) { std::string brackets(key), nobrackets(key); // Invalid to inspect key[0] if key is empty(). But then, the entire @@ -4197,7 +4196,7 @@ U32 LLAppViewer::getObjectCacheVersion() bool LLAppViewer::initCache() { mPurgeCache = false; - bool read_only = mSecondInstance ? true : false; + bool read_only = mSecondInstance; LLAppViewer::getTextureCache()->setReadOnly(read_only) ; LLVOCache::initParamSingleton(read_only); @@ -4222,7 +4221,7 @@ bool LLAppViewer::initCache() if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion()) { texture_cache_mismatch = true; - if(!read_only) + if (!read_only) { gSavedSettings.setS32("LocalCacheVersion", LLAppViewer::getTextureCacheVersion()); @@ -4231,7 +4230,7 @@ bool LLAppViewer::initCache() } } - if(!read_only) + if (!read_only) { // Purge cache if user requested it if (gSavedSettings.getBOOL("PurgeCacheOnStartup") || @@ -4701,16 +4700,23 @@ void LLAppViewer::idle() // When appropriate, update agent location to the simulator. F32 agent_update_time = agent_update_timer.getElapsedTimeF32(); F32 agent_force_update_time = mLastAgentForceUpdate + agent_update_time; - bool force_update = gAgent.controlFlagsDirty() - || (mLastAgentControlFlags != gAgent.getControlFlags()) - || (agent_force_update_time > (1.0f / (F32) AGENT_FORCE_UPDATES_PER_SECOND)); - if (force_update || (agent_update_time > (1.0f / (F32) AGENT_UPDATES_PER_SECOND))) + bool timed_out = agent_update_time > (1.0f / (F32)AGENT_UPDATES_PER_SECOND); + bool force_send = + // if there is something to send + (gAgent.controlFlagsDirty() && timed_out) + // if something changed + || (mLastAgentControlFlags != gAgent.getControlFlags()) + // keep alive + || (agent_force_update_time > (1.0f / (F32) AGENT_FORCE_UPDATES_PER_SECOND)); + // timing out doesn't warranty that an update will be sent, + // just that it will be checked. + if (force_send || timed_out) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; // Send avatar and camera info mLastAgentControlFlags = gAgent.getControlFlags(); - mLastAgentForceUpdate = force_update ? 0 : agent_force_update_time; - send_agent_update(force_update); + mLastAgentForceUpdate = force_send ? 0 : agent_force_update_time; + send_agent_update(force_send); agent_update_timer.reset(); } } diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 1550872d81..087c25bcad 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -502,7 +502,7 @@ bool LLAvatarList::handleHover(S32 x, S32 y, MASK mask) void LLAvatarList::setVisible(bool visible) { - if ( visible == false && mContextMenu ) + if (!visible && mContextMenu ) { mContextMenu->hide(); } diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 16db32862d..29be2aaa6d 100644 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -61,9 +61,8 @@ LLBlockList::LLBlockList(const Params& p) LLToggleableMenu* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>( "menu_people_blocked_gear.xml", gMenuHolder, - LLViewerMenuHolderGL::child_registry_t::instance(), - true); - if (context_menu) + LLViewerMenuHolderGL::child_registry_t::instance()); + if(context_menu) { mContextMenu = context_menu->getHandle(); } diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 0c365d33c4..7d9fa2a475 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -131,7 +131,7 @@ public: static LLChatHistoryHeader* createInstance(const std::string& file_name) { LLChatHistoryHeader* pInstance = new LLChatHistoryHeader; - pInstance->buildFromFile(file_name, true); + pInstance->buildFromFile(file_name); return pInstance; } @@ -587,7 +587,7 @@ public: mUserNameTextBox = getChild<LLTextBox>("user_name"); mTimeBoxTextBox = getChild<LLTextBox>("time_box"); - mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile<LLUICtrl>("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance(), true); + mInfoCtrl = LLUICtrlFactory::getInstance()->createFromFile<LLUICtrl>("inspector_info_ctrl.xml", this, LLPanel::child_registry_t::instance()); if (mInfoCtrl) { mInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, mInfoCtrl)); @@ -1181,7 +1181,7 @@ void LLChatHistory::initFromParams(const LLChatHistory::Params& p) LLView* LLChatHistory::getSeparator() { - LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>(mMessageSeparatorFilename, NULL, LLPanel::child_registry_t::instance(), true); + LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>(mMessageSeparatorFilename, NULL, LLPanel::child_registry_t::instance()); return separator; } diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index 57446bb7a0..354a596e46 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -342,20 +342,19 @@ bool LLFloaterIMNearbyChatToastPanel::handleMouseUp (S32 x, S32 y, MASK mask) S32 local_x = x - mMsgText->getRect().mLeft; S32 local_y = y - mMsgText->getRect().mBottom; - + //if text_box process mouse up (ussually this is click on url) - we didn't show nearby_chat. - if (mMsgText->pointInView(local_x, local_y) ) + if (mMsgText->pointInView(local_x, local_y)) { - if (mMsgText->handleMouseUp(local_x,local_y,mask) == true) + if (mMsgText->handleMouseUp(local_x, local_y, mask)) return true; - else - { - LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->showHistory(); - return false; - } + + LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->showHistory(); + return false; } + LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->showHistory(); - return LLPanel::handleMouseUp(x,y,mask); + return LLPanel::handleMouseUp(x, y, mask); } void LLFloaterIMNearbyChatToastPanel::setHeaderVisibility(EShowItemHeader e) diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 6e5df103f9..ad542e84cc 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -177,6 +177,11 @@ LLNotificationChiclet::LLNotificationChiclet(const Params& p) LLFloaterNotificationsTabbed::getInstance()->setSysWellChiclet(this); } +LLNotificationChiclet::~LLNotificationChiclet() +{ + mNotificationChannel.reset(); +} + void LLNotificationChiclet::onMenuItemClicked(const LLSD& user_data) { std::string action = user_data.asString(); diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 08f8ef66b8..75831adf62 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -531,8 +531,9 @@ public: struct Params : public LLInitParam::Block<Params, LLSysWellChiclet::Params>{}; protected: - struct ChicletNotificationChannel : public LLNotificationChannel + class ChicletNotificationChannel : public LLNotificationChannel { + public: ChicletNotificationChannel(LLNotificationChiclet* chiclet) : LLNotificationChannel(LLNotificationChannel::Params().filter(filterNotification).name(chiclet->getSessionId().asString())) , mChiclet(chiclet) @@ -542,6 +543,7 @@ protected: connectToChannel("Offer"); connectToChannel("Notifications"); } + virtual ~ChicletNotificationChannel() {} static bool filterNotification(LLNotificationPtr notify); // connect counter updaters to the corresponding signals @@ -553,9 +555,10 @@ protected: }; boost::scoped_ptr<ChicletNotificationChannel> mNotificationChannel; - - LLNotificationChiclet(const Params& p); - + + LLNotificationChiclet(const Params& p); + ~LLNotificationChiclet(); + /** * Processes clicks on chiclet menu. */ diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index 030d24bed8..bc61fac00b 100644 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -657,11 +657,12 @@ void LLControlGroupCLP::configure(const std::string& config_filename, LLControlG // This method reads the llsd based config file, and uses it to set // members of a control group. LLSD clpConfigLLSD; + + llifstream input_stream; + input_stream.open(config_filename.c_str(), std::ios::in | std::ios::binary); - std::string xml = gDirUtilp->getFileContents(config_filename); - if (!xml.empty()) + if(input_stream.is_open()) { - std::stringstream input_stream(xml); LLSDSerialize::fromXML(clpConfigLLSD, input_stream); for(LLSD::map_iterator option_itr = clpConfigLLSD.beginMap(); option_itr != clpConfigLLSD.endMap(); diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 5fcdbe4ffe..19b2ce77c5 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -73,7 +73,7 @@ namespace class ObjectInventoryFetcher: public LLVOInventoryListener { public: - typedef boost::shared_ptr<ObjectInventoryFetcher> ptr_t; + typedef std::shared_ptr<ObjectInventoryFetcher> ptr_t; ObjectInventoryFetcher(LLEventPump &pump, LLViewerObject* object, void* user_data) : mPump(pump), diff --git a/indra/newview/llcontrolavatar.h b/indra/newview/llcontrolavatar.h index 7beefad191..fd1cda7a2c 100644 --- a/indra/newview/llcontrolavatar.h +++ b/indra/newview/llcontrolavatar.h @@ -85,6 +85,7 @@ public: virtual bool shouldRenderRigged() const; virtual bool isImpostor(); + virtual bool isBuddy() const { return false; } bool mPlaying; diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 17ef56612c..e4d2c8f39a 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -32,7 +32,6 @@ #include "llnotificationsutil.h" #include "lltrans.h" -#include <boost/foreach.hpp> #include "boost/lexical_cast.hpp" const S32Days CONVERSATION_LIFETIME = (S32Days)30; // lifetime of LLConversation is 30 days by spec @@ -392,7 +391,7 @@ void LLConversationLog::deleteBackupLogs() std::vector<std::string> backup_logs; getListOfBackupLogs(backup_logs); - BOOST_FOREACH(const std::string& fullpath, backup_logs) + for (const std::string& fullpath : backup_logs) { LLFile::remove(fullpath); } @@ -434,7 +433,7 @@ bool LLConversationLog::moveLog(const std::string &originDirectory, const std::s while(LLFile::isfile(backupFileName)) { ++backupFileCount; - backupFileName = targetDirectory + ".backup" + boost::lexical_cast<std::string>(backupFileCount); + backupFileName = targetDirectory + ".backup" + std::to_string(backupFileCount); } //Rename the file to its backup name so it is not overwritten diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index e4ae60b49e..44d4c863c7 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -37,8 +37,6 @@ #include "llimview.h" //For LLIMModel #include "lltrans.h" -#include <boost/foreach.hpp> - // // Conversation items : common behaviors // @@ -300,8 +298,7 @@ void LLConversationItemSession::updateName(LLConversationItemParticipant* partic // In the case of a P2P conversation, we need to grab the name of the other participant in the session instance itself // as we do not create participants for such a session. - LLFolderViewModelItem * itemp; - BOOST_FOREACH(itemp, mChildren) + for (auto itemp : mChildren) { LLConversationItem* current_participant = dynamic_cast<LLConversationItem*>(itemp); // Add the avatar uuid to the list (except if it's the own agent uuid) diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp index ce7f7eb938..4306185f0a 100644 --- a/indra/newview/lldirpicker.cpp +++ b/indra/newview/lldirpicker.cpp @@ -91,20 +91,19 @@ void LLDirPicker::reset() bool LLDirPicker::getDir(std::string* filename, bool blocking) { - if( mLocked ) + if (mLocked) { return false; } // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } bool success = false; - if (blocking) { // Modal, so pause agent @@ -236,7 +235,7 @@ bool LLDirPicker::getDir(std::string* filename, bool blocking) reset(); // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 8189948f55..99494c96b8 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -832,7 +832,7 @@ bool LLDrawable::updateMoveDamped() mVObjp->updateText(); } - bool done_moving = (dist_squared == 0.0f) ? true : false; + bool done_moving = dist_squared == 0.0f; if (done_moving) { diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index e5b2471903..78bcc5d5f4 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -162,20 +162,20 @@ public: virtual bool updateMove(); virtual void movePartition(); - + void updateTexture(); void updateMaterial(); virtual void updateDistance(LLCamera& camera, bool force_update); bool updateGeometry(); void updateFaceSize(S32 idx); - + void updateSpecialHoverCursor(bool enabled); virtual void shiftPos(const LLVector4a &shift_vector); S32 getGeneration() const { return mGeneration; } - bool getLit() const { return isState(UNLIT) ? false : true; } + bool getLit() const { return !isState(UNLIT); } void setLit(bool lit) { lit ? clearState(UNLIT) : setState(UNLIT); } bool isVisible() const; diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 32f0e185ce..72e6945679 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -370,6 +370,15 @@ void LLDrawPoolAvatar::renderShadow(S32 pass) return; } + static LLCachedControl<bool> friends_only(gSavedSettings, "RenderAvatarFriendsOnly", false); + if (friends_only() + && !avatarp->isControlAvatar() + && !avatarp->isSelf() + && !avatarp->isBuddy()) + { + return; + } + LLVOAvatar::AvatarOverallAppearance oa = avatarp->getOverallAppearance(); bool impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor(); // no shadows if the shadows are causing this avatar to breach the limit. @@ -723,6 +732,17 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) return; } + static LLCachedControl<bool> friends_only(gSavedSettings, "RenderAvatarFriendsOnly", false); + if (!single_avatar + && friends_only() + && !avatarp->isUIAvatar() + && !avatarp->isControlAvatar() + && !avatarp->isSelf() + && !avatarp->isBuddy()) + { + return; + } + bool impostor = !LLPipeline::sImpostorRender && avatarp->isImpostor() && !single_avatar; if (( avatarp->isInMuteList() diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp index 5afd3c7c98..717d36d5e5 100644 --- a/indra/newview/llexternaleditor.cpp +++ b/indra/newview/llexternaleditor.cpp @@ -32,7 +32,6 @@ #include "llprocess.h" #include "llsdutil.h" #include "llstring.h" -#include <boost/foreach.hpp> // static const std::string LLExternalEditor::sFilenameMarker = "%s"; @@ -93,7 +92,7 @@ LLExternalEditor::EErrorCode LLExternalEditor::run(const std::string& file_path) params.executable = mProcessParams.executable; // Substitute the filename marker in the command with the actual passed file name. - BOOST_FOREACH(const std::string& arg, mProcessParams.args) + for (const std::string& arg : mProcessParams.args) { std::string fixed(arg); LLStringUtil::replaceString(fixed, sFilenameMarker, file_path); diff --git a/indra/newview/llface.h b/indra/newview/llface.h index d8476d39c5..b5018abc64 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -117,14 +117,14 @@ public: U32 getState() const { return mState; } void setState(U32 state) { mState |= state; } void clearState(U32 state) { mState &= ~state; } - bool isState(U32 state) const { return ((mState & state) != 0) ? true : false; } + bool isState(U32 state) const { return (mState & state) != 0; } void setVirtualSize(F32 size) { mVSize = size; } void setPixelArea(F32 area) { mPixelArea = area; } F32 getVirtualSize() const { return mVSize; } F32 getPixelArea() const { return mPixelArea; } - S32 getIndexInTex(U32 ch) const {llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); return mIndexInTex[ch];} - void setIndexInTex(U32 ch, S32 index) { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); mIndexInTex[ch] = index ;} + S32 getIndexInTex(U32 ch) const { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); return mIndexInTex[ch]; } + void setIndexInTex(U32 ch, S32 index) { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); mIndexInTex[ch] = index; } void setWorldMatrix(const LLMatrix4& mat); const LLTextureEntry* getTextureEntry() const { return mVObjp->getTE(mTEOffset); } diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index a46cc0ce30..727f5592cd 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -886,11 +886,10 @@ const LLButton::Params& LLFavoritesBarCtrl::getButtonParams() if (!params_initialized) { LLXMLNodePtr button_xml_node; - static const std::string filename("favorites_bar_button.xml"); - if (LLUICtrlFactory::getLayeredXMLNode(filename, button_xml_node, LLDir::CURRENT_SKIN, true)) + if(LLUICtrlFactory::getLayeredXMLNode("favorites_bar_button.xml", button_xml_node)) { LLXUIParser parser; - parser.readXUI(button_xml_node, button_params, filename); + parser.readXUI(button_xml_node, button_params, "favorites_bar_button.xml"); } params_initialized = true; } diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 3d202cc731..f1e11cf75a 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -245,14 +245,14 @@ bool LLFilePicker::setupFilter(ELoadFilter filter) bool LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking) { - if( mLocked ) + if (mLocked) { return false; } bool success = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } @@ -312,7 +312,7 @@ bool LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking) bool success = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } @@ -398,7 +398,7 @@ bool LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, bool success = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } @@ -688,18 +688,18 @@ std::unique_ptr<std::vector<std::string>> LLFilePicker::navOpenFilterProc(ELoadF return allowedv; } -bool LLFilePicker::doNavChooseDialog(ELoadFilter filter) +bool LLFilePicker::doNavChooseDialog(ELoadFilter filter) { // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } - + gViewerWindow->getWindow()->beforeDialog(); - + std::unique_ptr<std::vector<std::string>> allowed_types = navOpenFilterProc(filter); - + std::unique_ptr<std::vector<std::string>> filev = doLoadDialog(allowed_types.get(), mPickOptions); @@ -711,27 +711,27 @@ bool LLFilePicker::doNavChooseDialog(ELoadFilter filter) mFiles.insert(mFiles.end(), filev->begin(), filev->end()); return true; } - + return false; } -bool LLFilePicker::doNavChooseDialogModeless(ELoadFilter filter, +bool LLFilePicker::doNavChooseDialogModeless(ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &,void*), void *userdata) { // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } - + std::unique_ptr<std::vector<std::string>> allowed_types=navOpenFilterProc(filter); - + doLoadDialogModeless(allowed_types.get(), mPickOptions, callback, userdata); - + return true; } @@ -819,16 +819,16 @@ void set_nav_save_data(LLFilePicker::ESaveFilter filter, std::string &extension, } } -bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filename) +bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filename) { // Setup the type, creator, and extension std::string extension, type, creator; - + set_nav_save_data(filter, extension, type, creator); - + std::string namestring = filename; if (namestring.empty()) namestring="Untitled"; - + gViewerWindow->getWindow()->beforeDialog(); // Run the dialog @@ -845,20 +845,20 @@ bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filena mFiles.push_back(*filev); return true; } - + return false; } -bool LLFilePicker::doNavSaveDialogModeless(ESaveFilter filter, +bool LLFilePicker::doNavSaveDialogModeless(ESaveFilter filter, const std::string& filename, void (*callback)(bool, std::string&, void*), void *userdata) { // Setup the type, creator, and extension std::string extension, type, creator; - + set_nav_save_data(filter, extension, type, creator); - + std::string namestring = filename; if (namestring.empty()) namestring="Untitled"; @@ -881,19 +881,18 @@ bool LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking) bool success = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } reset(); - + mPickOptions &= ~F_MULTIPLE; mPickOptions |= F_FILE; - + if (filter == FFLOAD_DIRECTORY) //This should only be called from lldirpicker. { - mPickOptions |= ( F_NAV_SUPPORT | F_DIRECTORY ); mPickOptions &= ~F_FILE; } @@ -933,11 +932,11 @@ bool LLFilePicker::getOpenFileModeless(ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata) { - if( mLocked ) + if (mLocked) return false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } @@ -964,19 +963,19 @@ bool LLFilePicker::getOpenFileModeless(ELoadFilter filter, bool LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking) { - if( mLocked ) + if (mLocked) return false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } - + bool success = false; reset(); - + mPickOptions |= F_FILE; mPickOptions |= F_MULTIPLE; @@ -1012,17 +1011,17 @@ bool LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter, void (*callback)(bool, std::vector<std::string> &, void*), void *userdata ) { - if( mLocked ) + if (mLocked) return false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } reset(); - + mPickOptions |= F_FILE; mPickOptions |= F_MULTIPLE; @@ -1033,18 +1032,19 @@ bool LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter, bool LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, bool blocking) { - if( mLocked ) + if (mLocked) return false; + bool success = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } reset(); - + mPickOptions &= ~F_MULTIPLE; if (blocking) @@ -1076,17 +1076,17 @@ bool LLFilePicker::getSaveFileModeless(ESaveFilter filter, void (*callback)(bool, std::string&, void*), void *userdata) { - if( mLocked ) + if (mLocked) return false; - + // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } reset(); - + mPickOptions &= ~F_MULTIPLE; return doNavSaveDialogModeless(filter, filename, callback, userdata); @@ -1365,7 +1365,7 @@ bool LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, bool rtn = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } @@ -1373,7 +1373,7 @@ bool LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, gViewerWindow->getWindow()->beforeDialog(); reset(); - + GtkWindow* picker = buildFilePicker(true, false, "savefile"); if (picker) @@ -1441,7 +1441,7 @@ bool LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, default:; break; } - + gtk_window_set_title(GTK_WINDOW(picker), caption.c_str()); if (filename.empty()) @@ -1482,7 +1482,7 @@ bool LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) bool rtn = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } @@ -1490,7 +1490,7 @@ bool LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) gViewerWindow->getWindow()->beforeDialog(); reset(); - + GtkWindow* picker = buildFilePicker(false, false, "openfile"); if (picker) @@ -1547,7 +1547,7 @@ bool LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking) bool rtn = false; // if local file browsing is turned off, return without opening dialog - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } @@ -1584,13 +1584,13 @@ bool LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename, { // if local file browsing is turned off, return without opening dialog // (Even though this is a stub, I think we still should not return anything at all) - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } reset(); - + LL_INFOS() << "getSaveFile suggested filename is [" << filename << "]" << LL_ENDL; if (!filename.empty()) @@ -1614,13 +1614,13 @@ bool LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) { // if local file browsing is turned off, return without opening dialog // (Even though this is a stub, I think we still should not return anything at all) - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } reset(); - + // HACK: Static filenames for 'open' until we implement filepicker std::string filename = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + "upload"; switch (filter) @@ -1647,7 +1647,7 @@ bool LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking) { // if local file browsing is turned off, return without opening dialog // (Even though this is a stub, I think we still should not return anything at all) - if ( check_local_file_access_enabled() == false ) + if (!check_local_file_access_enabled()) { return false; } diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index c619c19493..74298c2b3d 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -433,7 +433,7 @@ void LLVolumeImplFlexible::doFlexibleUpdate() LLPath *path = &volume->getPath(); if ((mSimulateRes == 0 || !mInitialized) && mVO->mDrawable->isVisible()) { - bool force_update = mSimulateRes == 0 ? true : false; + bool force_update = mSimulateRes == 0; doIdleUpdate(); if (!force_update || !gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE)) @@ -442,10 +442,10 @@ void LLVolumeImplFlexible::doFlexibleUpdate() } } - if(!mInitialized || !mAttributes) + if (!mInitialized || !mAttributes) { //the object is not visible - return ; + return; } // Fix for MAINT-1894 @@ -456,7 +456,7 @@ void LLVolumeImplFlexible::doFlexibleUpdate() { return; } - + S32 num_sections = 1 << mSimulateRes; F32 secondsThisFrame = mTimer.getElapsedTimeAndResetF32(); diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp index d5efc15e35..527ed62fc7 100644 --- a/indra/newview/llfloater360capture.cpp +++ b/indra/newview/llfloater360capture.cpp @@ -811,7 +811,7 @@ void LLFloater360Capture::freezeWorld(bool enable) { // restart the clouds moving if they were not paused before // we starting using the 360 capture floater - if (clouds_scroll_paused == false) + if (!clouds_scroll_paused) { LLEnvironment::instance().resumeCloudScroll(); } diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 2d373dfa5d..dde4b6ff0e 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -44,6 +44,7 @@ #include "llfirstuse.h" #include "llhints.h" #include "lltabcontainer.h" +#include "llviewercamera.h" #include "llvoavatarself.h" static LLDefaultChildRegistry::Register<LLPanelCameraItem> r("panel_camera_item"); @@ -65,13 +66,19 @@ class LLPanelCameraZoom : public LLPanel { LOG_CLASS(LLPanelCameraZoom); + public: - LLPanelCameraZoom(); + struct Params : public LLInitParam::Block<Params, LLPanel::Params> {}; + + LLPanelCameraZoom() { onCreate(); } /* virtual */ bool postBuild(); /* virtual */ void draw(); protected: + LLPanelCameraZoom(const Params& p) { onCreate(); } + + void onCreate(); void onZoomPlusHeldDown(); void onZoomMinusHeldDown(); void onSliderValueChanged(); @@ -80,9 +87,11 @@ protected: F32 getOrbitRate(F32 time); private: - LLButton* mPlusBtn; - LLButton* mMinusBtn; - LLSlider* mSlider; + LLButton* mPlusBtn { nullptr }; + LLButton* mMinusBtn{ nullptr }; + LLSlider* mSlider{ nullptr }; + + friend class LLUICtrlFactory; }; LLPanelCameraItem::Params::Params() @@ -158,10 +167,7 @@ static LLPanelInjector<LLPanelCameraZoom> t_camera_zoom_panel("camera_zoom_panel // LLPanelCameraZoom //------------------------------------------------------------------------------- -LLPanelCameraZoom::LLPanelCameraZoom() -: mPlusBtn( NULL ), - mMinusBtn( NULL ), - mSlider( NULL ) +void LLPanelCameraZoom::onCreate() { mCommitCallbackRegistrar.add("Zoom.minus", boost::bind(&LLPanelCameraZoom::onZoomMinusHeldDown, this)); mCommitCallbackRegistrar.add("Zoom.plus", boost::bind(&LLPanelCameraZoom::onZoomPlusHeldDown, this)); @@ -172,9 +178,9 @@ LLPanelCameraZoom::LLPanelCameraZoom() bool LLPanelCameraZoom::postBuild() { - mPlusBtn = getChild <LLButton> ("zoom_plus_btn"); - mMinusBtn = getChild <LLButton> ("zoom_minus_btn"); - mSlider = getChild <LLSlider> ("zoom_slider"); + mPlusBtn = getChild<LLButton>("zoom_plus_btn"); + mMinusBtn = getChild<LLButton>("zoom_minus_btn"); + mSlider = getChild<LLSlider>("zoom_slider"); return LLPanel::postBuild(); } @@ -240,11 +246,80 @@ void activate_camera_tool() LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); }; +class LLCameraInfoPanel : public LLPanel +{ +public: + typedef std::function<LLVector3()> get_vector_t; + + LLCameraInfoPanel( + const LLView* parent, + const char* title, + const LLCoordFrame& camera, + const get_vector_t get_focus + ) + : LLPanel([&]() -> LLPanel::Params + { + LLPanel::Params params; + params.rect = LLRect(parent->getLocalRect()); + return params; + }()) + , mTitle(title) + , mCamera(camera) + , mGetFocus(get_focus) + , mFont(LLFontGL::getFontSansSerifBig()) + { + } + + virtual void draw() override + { + LLPanel::draw(); + + static const U32 HPADDING = 10; + static const U32 VPADDING = 5; + LLVector3 focus = mGetFocus(); + LLVector3 sight = focus - mCamera.mOrigin; + std::pair<const char*, const LLVector3&> const data[] = + { + { "Origin:", mCamera.mOrigin }, + { "X Axis:", mCamera.mXAxis }, + { "Y Axis:", mCamera.mYAxis }, + { "Z Axis:", mCamera.mZAxis }, + { "Focus:", focus }, + { "Sight:", sight } + }; + S32 width = getRect().getWidth(); + S32 height = getRect().getHeight(); + S32 row_count = 1 + sizeof(data) / sizeof(*data); + S32 row_height = (height - VPADDING * 2) / row_count; + S32 top = height - VPADDING - row_height / 2; + mFont->renderUTF8(mTitle, 0, HPADDING, top, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER); + for (const auto& row : data) + { + top -= row_height; + mFont->renderUTF8(row.first, 0, HPADDING, top, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER); + const LLVector3& vector = row.second; + for (S32 i = 0; i < 3; ++i) + { + std::string text = llformat("%.6f", vector[i]); + S32 right = width / 4 * (i + 2) - HPADDING; + mFont->renderUTF8(text, 0, right, top, LLColor4::white, LLFontGL::RIGHT, LLFontGL::VCENTER); + } + } + } + +private: + const char* mTitle; + const LLCoordFrame& mCamera; + const get_vector_t mGetFocus; + const LLFontGL* mFont; +}; + // // Member functions // -/*static*/ bool LLFloaterCamera::inFreeCameraMode() +// static +bool LLFloaterCamera::inFreeCameraMode() { LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK) @@ -254,6 +329,7 @@ void activate_camera_tool() return false; } +// static void LLFloaterCamera::resetCameraMode() { LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); @@ -261,6 +337,7 @@ void LLFloaterCamera::resetCameraMode() floater_camera->switchMode(CAMERA_CTRL_MODE_PAN); } +// static void LLFloaterCamera::onAvatarEditingAppearance(bool editing) { sAppearanceEditing = editing; @@ -269,15 +346,46 @@ void LLFloaterCamera::onAvatarEditingAppearance(bool editing) floater_camera->handleAvatarEditingAppearance(editing); } -void LLFloaterCamera::handleAvatarEditingAppearance(bool editing) +// static +void LLFloaterCamera::onDebugCameraToggled() { + if (LLFloaterCamera* instance = LLFloaterCamera::findInstance()) + { + instance->showDebugInfo(LLView::sDebugCamera); + } + if (LLView::sDebugCamera) + { + LLFloaterReg::showInstanceOrBringToFront("camera"); + } +} + +void LLFloaterCamera::showDebugInfo(bool show) +{ + // Initially LLPanel contains 1 child "view_border" + if (show && mViewerCameraInfo->getChildCount() < 2) + { + mViewerCameraInfo->addChild(new LLCameraInfoPanel(mViewerCameraInfo, "Viewer Camera", *LLViewerCamera::getInstance(), + []() { return LLViewerCamera::getInstance()->getPointOfInterest(); })); + mAgentCameraInfo->addChild(new LLCameraInfoPanel(mAgentCameraInfo, "Agent Camera", gAgent.getFrameAgent(), + []() { return gAgent.getPosAgentFromGlobal(gAgentCamera.calcFocusPositionTargetGlobal()); })); + } + + mAgentCameraInfo->setVisible(show); + mViewerCameraInfo->setVisible(show); +} + +void LLFloaterCamera::handleAvatarEditingAppearance(bool editing) +{ } void LLFloaterCamera::update() { ECameraControlMode mode = determineMode(); - if (mode != mCurrMode) setMode(mode); + if (mode != mCurrMode) + { + setMode(mode); + } } @@ -286,7 +394,8 @@ void LLFloaterCamera::toPrevMode() switchMode(mPrevMode); } -/*static*/ void LLFloaterCamera::onLeavingMouseLook() +// static +void LLFloaterCamera::onLeavingMouseLook() { LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); if (floater_camera) @@ -320,12 +429,14 @@ void LLFloaterCamera::onOpen(const LLSD& key) mClosed = false; populatePresetCombo(); + + showDebugInfo(LLView::sDebugCamera); } void LLFloaterCamera::onClose(bool app_quitting) { //We don't care of camera mode if app is quitting - if(app_quitting) + if (app_quitting) return; // It is necessary to reset mCurrMode to CAMERA_CTRL_MODE_PAN so // to avoid seeing an empty floater when reopening the control. @@ -360,14 +471,18 @@ bool LLFloaterCamera::postBuild() { updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730) + mControls = getChild<LLPanel>("controls"); + mAgentCameraInfo = getChild<LLPanel>("agent_camera_info"); + mViewerCameraInfo = getChild<LLPanel>("viewer_camera_info"); mRotate = getChild<LLJoystickCameraRotate>(ORBIT); - mZoom = findChild<LLPanelCameraZoom>(ZOOM); + mZoom = getChild<LLPanelCameraZoom>(ZOOM); mTrack = getChild<LLJoystickCameraTrack>(PAN); mPresetCombo = getChild<LLComboBox>("preset_combo"); + mPreciseCtrls = getChild<LLTextBox>("precise_ctrs_label"); - getChild<LLTextBox>("precise_ctrs_label")->setShowCursorHand(false); - getChild<LLTextBox>("precise_ctrs_label")->setSoundFlags(LLView::MOUSE_UP); - getChild<LLTextBox>("precise_ctrs_label")->setClickedCallback(boost::bind(&LLFloaterReg::showInstance, "prefs_view_advanced", LLSD(), false)); + mPreciseCtrls->setShowCursorHand(false); + mPreciseCtrls->setSoundFlags(LLView::MOUSE_UP); + mPreciseCtrls->setClickedCallback(boost::bind(&LLFloaterReg::showInstance, "prefs_view_advanced", LLSD(), false)); mPresetCombo->setCommitCallback(boost::bind(&LLFloaterCamera::onCustomPresetSelected, this)); LLPresetsManager::getInstance()->setPresetListChangeCameraCallback(boost::bind(&LLFloaterCamera::populatePresetCombo, this)); @@ -507,6 +622,7 @@ void LLFloaterCamera::updateItemsSelection() getChild<LLPanelCameraItem>("object_view")->setValue(argument); } +// static void LLFloaterCamera::onClickCameraItem(const LLSD& param) { std::string name = param.asString(); @@ -533,7 +649,7 @@ void LLFloaterCamera::onClickCameraItem(const LLSD& param) } } -/*static*/ +// static void LLFloaterCamera::switchToPreset(const std::string& name) { sFreeCamera = false; diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 7a30485d4f..0ff5ae14bc 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -63,6 +63,9 @@ public: /** Called when Avatar is entered/exited editing appearance mode */ static void onAvatarEditingAppearance(bool editing); + /** Called when opening and when "Advanced | Debug Camera" menu item is toggled */ + static void onDebugCameraToggled(); + /* determines actual mode and updates ui */ void update(); @@ -77,9 +80,9 @@ public: void populatePresetCombo(); - LLJoystickCameraRotate* mRotate; - LLPanelCameraZoom* mZoom; - LLJoystickCameraTrack* mTrack; + LLJoystickCameraRotate* mRotate { nullptr }; + LLPanelCameraZoom* mZoom { nullptr }; + LLJoystickCameraTrack* mTrack { nullptr }; private: @@ -117,6 +120,8 @@ private: void handleAvatarEditingAppearance(bool editing); + void showDebugInfo(bool show); + // set to true when free camera mode is selected in modes list // remains true until preset camera mode is chosen, or pan button is clicked, or escape pressed static bool sFreeCamera; @@ -126,7 +131,11 @@ private: ECameraControlMode mCurrMode; std::map<ECameraControlMode, LLButton*> mMode2Button; - LLComboBox* mPresetCombo; + LLPanel* mControls { nullptr }; + LLPanel* mViewerCameraInfo { nullptr }; + LLPanel* mAgentCameraInfo { nullptr }; + LLComboBox* mPresetCombo { nullptr }; + LLTextBox* mPreciseCtrls { nullptr }; }; /** diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 00e4961f6a..befc765cb0 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -1213,7 +1213,7 @@ void LLFloaterEditExtDayCycle::updateButtons() mDeleteFrameButton->setEnabled(can_manipulate && isRemovingFrameAllowed()); mLoadFrame->setEnabled(can_manipulate); - bool enable_play = mEditDay ? true : false; + bool enable_play = (bool)mEditDay; childSetEnabled(BTN_PLAY, enable_play); childSetEnabled(BTN_SKIP_BACK, enable_play); childSetEnabled(BTN_SKIP_FORWARD, enable_play); diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index bfde125476..96908df2ab 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -832,8 +832,8 @@ void LLFloaterEmojiPicker::createEmojiIcon(const LLEmojiSearchResult& emoji, void LLFloaterEmojiPicker::showPreview(bool show) { //mPreview->setIcon(nullptr); - mDummy->setVisible(show ? false : true); - mPreview->setVisible(show ? true : false); + mDummy->setVisible(show); + mPreview->setVisible(show); } void LLFloaterEmojiPicker::onGroupButtonClick(LLUICtrl* ctrl) diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index 813bde0fac..da4947839f 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -718,14 +718,14 @@ void LLPanelRegionTools::setParentEstateID(U32 id) void LLPanelRegionTools::setCheckFlags(U64 flags) { - getChild<LLUICtrl>("check prelude")->setValue(is_prelude(flags) ? true : false); - getChild<LLUICtrl>("check fixed sun")->setValue(flags & REGION_FLAGS_SUN_FIXED ? true : false); - getChild<LLUICtrl>("check reset home")->setValue(flags & REGION_FLAGS_RESET_HOME_ON_TELEPORT ? true : false); - getChild<LLUICtrl>("check damage")->setValue(flags & REGION_FLAGS_ALLOW_DAMAGE ? true : false); - getChild<LLUICtrl>("check visible")->setValue(flags & REGION_FLAGS_EXTERNALLY_VISIBLE ? true : false); - getChild<LLUICtrl>("block terraform")->setValue(flags & REGION_FLAGS_BLOCK_TERRAFORM ? true : false); - getChild<LLUICtrl>("block dwell")->setValue(flags & REGION_FLAGS_BLOCK_DWELL ? true : false); - getChild<LLUICtrl>("is sandbox")->setValue(flags & REGION_FLAGS_SANDBOX ? true : false ); + getChild<LLUICtrl>("check prelude")->setValue(is_prelude(flags)); + getChild<LLUICtrl>("check fixed sun")->setValue(is_flag_set(flags, REGION_FLAGS_SUN_FIXED)); + getChild<LLUICtrl>("check reset home")->setValue(is_flag_set(flags, REGION_FLAGS_RESET_HOME_ON_TELEPORT)); + getChild<LLUICtrl>("check damage")->setValue(is_flag_set(flags, REGION_FLAGS_ALLOW_DAMAGE)); + getChild<LLUICtrl>("check visible")->setValue(is_flag_set(flags, REGION_FLAGS_EXTERNALLY_VISIBLE)); + getChild<LLUICtrl>("block terraform")->setValue(is_flag_set(flags, REGION_FLAGS_BLOCK_TERRAFORM)); + getChild<LLUICtrl>("block dwell")->setValue(is_flag_set(flags, REGION_FLAGS_BLOCK_DWELL)); + getChild<LLUICtrl>("is sandbox")->setValue(is_flag_set(flags, REGION_FLAGS_SANDBOX)); } void LLPanelRegionTools::setBillableFactor(F32 billable_factor) @@ -1004,9 +1004,9 @@ U64 LLPanelObjectTools::computeRegionFlags(U64 flags) const void LLPanelObjectTools::setCheckFlags(U64 flags) { - getChild<LLUICtrl>("disable scripts")->setValue(flags & REGION_FLAGS_SKIP_SCRIPTS ? true : false); - getChild<LLUICtrl>("disable collisions")->setValue(flags & REGION_FLAGS_SKIP_COLLISIONS ? true : false); - getChild<LLUICtrl>("disable physics")->setValue(flags & REGION_FLAGS_SKIP_PHYSICS ? true : false); + getChild<LLUICtrl>("disable scripts")->setValue(is_flag_set(flags, REGION_FLAGS_SKIP_SCRIPTS)); + getChild<LLUICtrl>("disable collisions")->setValue(is_flag_set(flags, REGION_FLAGS_SKIP_COLLISIONS)); + getChild<LLUICtrl>("disable physics")->setValue(is_flag_set(flags, REGION_FLAGS_SKIP_PHYSICS)); } diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 88dc2c78e2..13fe7e16a9 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -57,7 +57,6 @@ #include "llsdserialize.h" #include "llviewermenu.h" // is_agent_mappable #include "llviewerobjectlist.h" -#include "boost/foreach.hpp" const S32 EVENTS_PER_IDLE_LOOP_CURRENT_SESSION = 80; @@ -805,12 +804,11 @@ void LLFloaterIMContainer::setVisible(bool visible) void LLFloaterIMContainer::getDetachedConversationFloaters(floater_list_t& floaters) { - typedef conversations_widgets_map::value_type conv_pair; LLFloaterIMNearbyChat *nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"); - BOOST_FOREACH(conv_pair item, mConversationsWidgets) + for (const auto& [key, fvi] : mConversationsWidgets) { - LLConversationViewSession* widget = dynamic_cast<LLConversationViewSession*>(item.second); + LLConversationViewSession* widget = dynamic_cast<LLConversationViewSession*>(fvi); if (widget) { LLFloater* session_floater = widget->getSessionFloater(); diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index 2e66d6f359..c76c1da8d6 100644 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -282,7 +282,7 @@ bool LLFloaterIMNearbyChatScreenChannel::createPoolToast() void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) { //look in pool. if there is any message - if(mStopProcessing) + if (mStopProcessing) return; if (mFloaterSnapRegion == NULL) @@ -297,7 +297,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) find last toast and check ID */ - if(m_active_toasts.size()) + if (m_active_toasts.size()) { LLUUID fromID = chat["from_id"].asUUID(); // agent id or object id std::string from = chat["from"].asString(); @@ -306,7 +306,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) { LLFloaterIMNearbyChatToastPanel* panel = dynamic_cast<LLFloaterIMNearbyChatToastPanel*>(toast->getPanel()); - if(panel && panel->messageID() == fromID && panel->getFromName() == from && panel->canAddText()) + if (panel && panel->messageID() == fromID && panel->getFromName() == from && panel->canAddText()) { panel->addMessage(chat); toast->reshapeToPanel(); @@ -320,7 +320,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) - if(m_toast_pool.empty()) + if (m_toast_pool.empty()) { //"pool" is empty - create one more panel LL_DEBUGS("NearbyChat") << "Empty pool" << LL_ENDL; @@ -331,15 +331,14 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) } int chat_type = chat["chat_type"].asInteger(); - - if( ((EChatType)chat_type == CHAT_TYPE_DEBUG_MSG)) + + if (chat_type == CHAT_TYPE_DEBUG_MSG) { - if(gSavedSettings.getBOOL("ShowScriptErrors") == false) + if (!gSavedSettings.getBOOL("ShowScriptErrors")) return; - if(gSavedSettings.getS32("ShowScriptErrorsLocation")== 1) + if (gSavedSettings.getS32("ShowScriptErrorsLocation") == 1) return; } - //take 1st element from pool, (re)initialize it, put it in active toasts @@ -350,7 +349,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) LLFloaterIMNearbyChatToastPanel* panel = dynamic_cast<LLFloaterIMNearbyChatToastPanel*>(toast->getPanel()); - if(!panel) + if (!panel) return; panel->init(chat); @@ -453,7 +452,7 @@ void LLFloaterIMNearbyChatScreenChannel::arrangeToasts() //----------------------------------------------------------------------------------------------- //LLFloaterIMNearbyChatHandler //----------------------------------------------------------------------------------------------- -boost::scoped_ptr<LLEventPump> LLFloaterIMNearbyChatHandler::sChatWatcher(new LLEventStream("LLChat")); +std::unique_ptr<LLEventPump> LLFloaterIMNearbyChatHandler::sChatWatcher(new LLEventStream("LLChat")); LLFloaterIMNearbyChatHandler::LLFloaterIMNearbyChatHandler() { @@ -487,11 +486,11 @@ void LLFloaterIMNearbyChatHandler::initChannel() void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) { - if(chat_msg.mMuted == true) + if (chat_msg.mMuted) return; - if(chat_msg.mText.empty()) - return;//don't process empty messages + if (chat_msg.mText.empty()) + return; // don't process empty messages LLFloaterReg::getInstance("im_container"); LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat"); @@ -522,9 +521,10 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, // errors in separate window. if (chat_msg.mChatType == CHAT_TYPE_DEBUG_MSG) { - if (LLFloater::isQuitRequested()) return; + if (LLFloater::isQuitRequested()) + return; - if(gSavedSettings.getBOOL("ShowScriptErrors") == false) + if (!gSavedSettings.getBOOL("ShowScriptErrors")) return; // don't process debug messages from not owned objects, see EXT-7762 @@ -533,7 +533,7 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, return; } - if (gSavedSettings.getS32("ShowScriptErrorsLocation")== 1)// show error in window //("ScriptErrorsAsChat")) + if (gSavedSettings.getS32("ShowScriptErrorsLocation") == 1)// show error in window //("ScriptErrorsAsChat")) { LLColor4 txt_color; @@ -550,7 +550,7 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg, nearby_chat->addMessage(chat_msg, true, args); - if(chat_msg.mSourceType == CHAT_SOURCE_AGENT + if (chat_msg.mSourceType == CHAT_SOURCE_AGENT && chat_msg.mFromID.notNull() && chat_msg.mFromID != gAgentID) { diff --git a/indra/newview/llfloaterimnearbychathandler.h b/indra/newview/llfloaterimnearbychathandler.h index 5e6f8cde30..1849604470 100644 --- a/indra/newview/llfloaterimnearbychathandler.h +++ b/indra/newview/llfloaterimnearbychathandler.h @@ -46,7 +46,7 @@ public: protected: virtual void initChannel(); - static boost::scoped_ptr<LLEventPump> sChatWatcher; + static std::unique_ptr<LLEventPump> sChatWatcher; }; } diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 9b1fc96706..9a7737657d 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -473,7 +473,7 @@ void LLFloaterIMSessionTab::onInputEditorClicked() void LLFloaterIMSessionTab::onEmojiRecentPanelToggleBtnClicked() { - bool show = mEmojiRecentPanel->getVisible() ? false : true; + bool show = !mEmojiRecentPanel->getVisible(); if (show) { initEmojiRecentPanel(); diff --git a/indra/newview/llfloaterinventorythumbnailshelper.cpp b/indra/newview/llfloaterinventorythumbnailshelper.cpp new file mode 100644 index 0000000000..9775eda697 --- /dev/null +++ b/indra/newview/llfloaterinventorythumbnailshelper.cpp @@ -0,0 +1,543 @@ +/** + * @file llfloaterinventorythumbnailshelper.cpp + * @author Callum Prentice + * @brief LLFloaterInventoryThumbnailsHelper class implementation + * + * Usage instructions and some brief notes can be found in Confluence here: + * https://lindenlab.atlassian.net/wiki/spaces/~174746736/pages/2928672843/Inventory+Thumbnail+Helper+Tool + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, 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 "llaisapi.h" +#include "llclipboard.h" +#include "llinventoryfunctions.h" +#include "llinventorymodel.h" +#include "llnotifications.h" +#include "llnotificationsutil.h" +#include "llscrolllistctrl.h" +#include "lltexteditor.h" +#include "lluictrlfactory.h" +#include "lluuid.h" + +#include "llfloaterinventorythumbnailshelper.h" + +LLFloaterInventoryThumbnailsHelper::LLFloaterInventoryThumbnailsHelper(const LLSD& key) + : LLFloater("floater_inventory_thumbnails_helper") +{ +} + +LLFloaterInventoryThumbnailsHelper::~LLFloaterInventoryThumbnailsHelper() +{ +} + +bool LLFloaterInventoryThumbnailsHelper::postBuild() +{ + mInventoryThumbnailsList = getChild<LLScrollListCtrl>("inventory_thumbnails_list"); + mInventoryThumbnailsList->setAllowMultipleSelection(true); + + mOutputLog = getChild<LLTextEditor>("output_log"); + mOutputLog->setMaxTextLength(0xffff * 0x10); + + mPasteItemsBtn = getChild<LLUICtrl>("paste_items_btn"); + mPasteItemsBtn->setCommitCallback(boost::bind(&LLFloaterInventoryThumbnailsHelper::onPasteItems, this)); + mPasteItemsBtn->setEnabled(true); + + mPasteTexturesBtn = getChild<LLUICtrl>("paste_textures_btn"); + mPasteTexturesBtn->setCommitCallback(boost::bind(&LLFloaterInventoryThumbnailsHelper::onPasteTextures, this)); + mPasteTexturesBtn->setEnabled(true); + + mWriteThumbnailsBtn = getChild<LLUICtrl>("write_thumbnails_btn"); + mWriteThumbnailsBtn->setCommitCallback(boost::bind(&LLFloaterInventoryThumbnailsHelper::onWriteThumbnails, this)); + mWriteThumbnailsBtn->setEnabled(false); + + mLogMissingThumbnailsBtn = getChild<LLUICtrl>("log_missing_thumbnails_btn"); + mLogMissingThumbnailsBtn->setCommitCallback(boost::bind(&LLFloaterInventoryThumbnailsHelper::onLogMissingThumbnails, this)); + mLogMissingThumbnailsBtn->setEnabled(false); + + mClearThumbnailsBtn = getChild<LLUICtrl>("clear_thumbnails_btn"); + mClearThumbnailsBtn->setCommitCallback(boost::bind(&LLFloaterInventoryThumbnailsHelper::onClearThumbnails, this)); + mClearThumbnailsBtn->setEnabled(false); + + return true; +} + +// Records an entry in the pasted items - saves it to a map and writes it to the log +// window for later confirmation/validation - since it uses a map, duplicates (based on +// the name) are discarded +void LLFloaterInventoryThumbnailsHelper::recordInventoryItemEntry(LLViewerInventoryItem* item) +{ + const std::string name = item->getName(); + + std::map<std::string, LLViewerInventoryItem*>::iterator iter = mItemNamesItems.find(name); + if (iter == mItemNamesItems.end()) + { + mItemNamesItems.insert({name, item}); + + writeToLog( + STRINGIZE( + "ITEM " << mItemNamesItems.size() << "> " << + name << + std::endl + ), false); + } + else + { + // dupe - do not save + } +} + +// Called when the user has copied items from their inventory and selects the Paste Items button +// in the UI - iterates over items and folders and saves details of each one. +// The first use of this tool is for updating NUX items and as such, only looks for OBJECTS, +// CLOTHING and BODYPARTS - later versions of this tool should make that selection editable. +void LLFloaterInventoryThumbnailsHelper::onPasteItems() +{ + if (!LLClipboard::instance().hasContents()) + { + return; + } + + writeToLog( + STRINGIZE( + "\n==== Pasting items from inventory ====" << + std::endl + ), false); + + std::vector<LLUUID> objects; + LLClipboard::instance().pasteFromClipboard(objects); + size_t count = objects.size(); + + for (size_t i = 0; i < count; i++) + { + const LLUUID& entry = objects.at(i); + + // Check for a folder + const LLInventoryCategory* cat = gInventory.getCategory(entry); + if (cat) + { + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + + LLIsType is_object(LLAssetType::AT_OBJECT); + gInventory.collectDescendentsIf(cat->getUUID(), + cat_array, + item_array, + LLInventoryModel::EXCLUDE_TRASH, + is_object); + + LLIsType is_bodypart(LLAssetType::AT_BODYPART); + gInventory.collectDescendentsIf(cat->getUUID(), + cat_array, + item_array, + LLInventoryModel::EXCLUDE_TRASH, + is_bodypart); + + LLIsType is_clothing(LLAssetType::AT_CLOTHING); + gInventory.collectDescendentsIf(cat->getUUID(), + cat_array, + item_array, + LLInventoryModel::EXCLUDE_TRASH, + is_clothing); + + for (size_t i = 0; i < item_array.size(); i++) + { + LLViewerInventoryItem* item = item_array.at(i); + recordInventoryItemEntry(item); + } + } + + // Check for an item + LLViewerInventoryItem* item = gInventory.getItem(entry); + if (item) + { + const LLAssetType::EType item_type = item->getType(); + if (item_type == LLAssetType::AT_OBJECT || item_type == LLAssetType::AT_BODYPART || item_type == LLAssetType::AT_CLOTHING) + { + recordInventoryItemEntry(item); + } + } + } + + // update the main list view based on what we found + updateDisplayList(); + + // update the buttons enabled state based on what we found/saved + updateButtonStates(); +} + +// Records a entry in the pasted textures - saves it to a map and writes it to the log +// window for later confirmation/validation - since it uses a map, duplicates (based on +// the name) are discarded +void LLFloaterInventoryThumbnailsHelper::recordTextureItemEntry(LLViewerInventoryItem* item) +{ + const std::string name = item->getName(); + + std::map<std::string, LLUUID>::iterator iter = mTextureNamesIDs.find(name); + if (iter == mTextureNamesIDs.end()) + { + LLUUID id = item->getAssetUUID(); + mTextureNamesIDs.insert({name, id}); + + writeToLog( + STRINGIZE( + "TEXTURE " << mTextureNamesIDs.size() << "> " << + name << + //" | " << + //id.asString() << + std::endl + ), false); + } + else + { + // dupe - do not save + } +} + +// Called when the user has copied textures from their inventory and selects the Paste Textures +// button in the UI - iterates over textures and folders and saves details of each one. +void LLFloaterInventoryThumbnailsHelper::onPasteTextures() +{ + if (!LLClipboard::instance().hasContents()) + { + return; + } + + writeToLog( + STRINGIZE( + "\n==== Pasting textures from inventory ====" << + std::endl + ), false); + + std::vector<LLUUID> objects; + LLClipboard::instance().pasteFromClipboard(objects); + size_t count = objects.size(); + + for (size_t i = 0; i < count; i++) + { + const LLUUID& entry = objects.at(i); + + const LLInventoryCategory* cat = gInventory.getCategory(entry); + if (cat) + { + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + + LLIsType is_object(LLAssetType::AT_TEXTURE); + gInventory.collectDescendentsIf(cat->getUUID(), + cat_array, + item_array, + LLInventoryModel::EXCLUDE_TRASH, + is_object); + + for (size_t i = 0; i < item_array.size(); i++) + { + LLViewerInventoryItem* item = item_array.at(i); + recordTextureItemEntry(item); + } + } + + LLViewerInventoryItem* item = gInventory.getItem(entry); + if (item) + { + const LLAssetType::EType item_type = item->getType(); + if (item_type == LLAssetType::AT_TEXTURE) + { + recordTextureItemEntry(item); + } + } + } + + // update the main list view based on what we found + updateDisplayList(); + + // update the buttons enabled state based on what we found/saved + updateButtonStates(); +} + +// Updates the main list of entries in the UI based on what is in the maps/storage +void LLFloaterInventoryThumbnailsHelper::updateDisplayList() +{ + mInventoryThumbnailsList->deleteAllItems(); + + std::map<std::string, LLViewerInventoryItem*>::iterator item_iter = mItemNamesItems.begin(); + while (item_iter != mItemNamesItems.end()) + { + std::string item_name = (*item_iter).first; + + std::string existing_texture_name = std::string(); + LLUUID existing_thumbnail_id = (*item_iter).second->getThumbnailUUID(); + if (existing_thumbnail_id != LLUUID::null) + { + existing_texture_name = existing_thumbnail_id.asString(); + } + else + { + existing_texture_name = "none"; + } + + std::string new_texture_name = std::string(); + std::map<std::string, LLUUID>::iterator texture_iter = mTextureNamesIDs.find(item_name); + if (texture_iter != mTextureNamesIDs.end()) + { + new_texture_name = (*texture_iter).first; + } + else + { + new_texture_name = "missing"; + } + + LLSD row; + row["columns"][EListColumnNum::NAME]["column"] = "item_name"; + row["columns"][EListColumnNum::NAME]["type"] = "text"; + row["columns"][EListColumnNum::NAME]["value"] = item_name; + row["columns"][EListColumnNum::NAME]["font"]["name"] = "Monospace"; + + row["columns"][EListColumnNum::EXISTING_TEXTURE]["column"] = "existing_texture"; + row["columns"][EListColumnNum::EXISTING_TEXTURE]["type"] = "text"; + row["columns"][EListColumnNum::EXISTING_TEXTURE]["font"]["name"] = "Monospace"; + row["columns"][EListColumnNum::EXISTING_TEXTURE]["value"] = existing_texture_name; + + row["columns"][EListColumnNum::NEW_TEXTURE]["column"] = "new_texture"; + row["columns"][EListColumnNum::NEW_TEXTURE]["type"] = "text"; + row["columns"][EListColumnNum::NEW_TEXTURE]["font"]["name"] = "Monospace"; + row["columns"][EListColumnNum::NEW_TEXTURE]["value"] = new_texture_name; + + mInventoryThumbnailsList->addElement(row); + + ++item_iter; + } +} + +#if 1 +// *TODO$: LLInventoryCallback should be deprecated to conform to the new boost::bind/coroutine model. +// temp code in transition +void inventoryThumbnailsHelperCb(LLPointer<LLInventoryCallback> cb, LLUUID id) +{ + if (cb.notNull()) + { + cb->fire(id); + } +} +#endif + +// Makes calls to the AIS v3 API to record the local changes made to the thumbnails. +// If this is not called, the operations (e.g. set thumbnail or clear thumbnail) +// appear to work but do not push the changes back to the inventory (local cache view only) +bool writeInventoryThumbnailID(LLUUID item_id, LLUUID thumbnail_asset_id) +{ + if (AISAPI::isAvailable()) + { + + LLSD updates; + updates["thumbnail"] = LLSD().with("asset_id", thumbnail_asset_id.asString()); + + LLPointer<LLInventoryCallback> cb; + + AISAPI::completion_t cr = boost::bind(&inventoryThumbnailsHelperCb, cb, _1); + AISAPI::UpdateItem(item_id, updates, cr); + + return true; + } + else + { + LL_WARNS() << "Unable to write inventory thumbnail because the AIS API is not available" << LL_ENDL; + return false; + } +} + +// Called when the Write Thumbanils button is pushed. Iterates over the name/item and +// name/.texture maps and where it finds a common name, extracts what is needed and +// writes the thumbnail accordingly. +void LLFloaterInventoryThumbnailsHelper::onWriteThumbnails() +{ + // create and show confirmation (Yes/No) textbox since this is a destructive operation + LLNotificationsUtil::add("WriteInventoryThumbnailsWarning", LLSD(), LLSD(), + [&](const LLSD & notif, const LLSD & resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + { + std::map<std::string, LLViewerInventoryItem*>::iterator item_iter = mItemNamesItems.begin(); + while (item_iter != mItemNamesItems.end()) + { + std::string item_name = (*item_iter).first; + + std::map<std::string, LLUUID>::iterator texture_iter = mTextureNamesIDs.find(item_name); + if (texture_iter != mTextureNamesIDs.end()) + { + LLUUID item_id = (*item_iter).second->getUUID(); + + LLUUID thumbnail_asset_id = (*texture_iter).second; + + writeToLog( + STRINGIZE( + "WRITING THUMB " << + (*item_iter).first << + "\n" << + "item ID: " << + item_id << + "\n" << + "thumbnail texture ID: " << + thumbnail_asset_id << + "\n" + ), true); + + + (*item_iter).second->setThumbnailUUID(thumbnail_asset_id); + + // This additional step (notifying AIS API) is required + // to make the changes persist outside of the local cache + writeInventoryThumbnailID(item_id, thumbnail_asset_id); + } + + ++item_iter; + } + + updateDisplayList(); + } + else + { + LL_INFOS() << "Writing new thumbnails was canceled" << LL_ENDL; + } + }); +} + +// Called when the Log Items with Missing Thumbnails is selected. This merely writes +// a list of all the items for which the thumbnail ID is Null. Typical use case is to +// copy from the log window, pasted to Slack to illustrate which items are missing +// a thumbnail +void LLFloaterInventoryThumbnailsHelper::onLogMissingThumbnails() +{ + std::map<std::string, LLViewerInventoryItem*>::iterator item_iter = mItemNamesItems.begin(); + while (item_iter != mItemNamesItems.end()) + { + LLUUID thumbnail_id = (*item_iter).second->getThumbnailUUID(); + + if (thumbnail_id == LLUUID::null) + { + writeToLog( + STRINGIZE( + "Missing thumbnail: " << + (*item_iter).first << + std::endl + ), true); + } + + ++item_iter; + } +} + +// Called when the Clear Thumbnail button is selected. Code to perform the clear (really +// just writing a NULL UUID into the thumbnail field) is behind an "Are you Sure?" dialog +// since it cannot be undone and potentinally, you could remove the thumbnails from your +// whole inventory this way. +void LLFloaterInventoryThumbnailsHelper::onClearThumbnails() +{ + // create and show confirmation (Yes/No) textbox since this is a destructive operation + LLNotificationsUtil::add("ClearInventoryThumbnailsWarning", LLSD(), LLSD(), + [&](const LLSD & notif, const LLSD & resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + { + std::map<std::string, LLViewerInventoryItem*>::iterator item_iter = mItemNamesItems.begin(); + while (item_iter != mItemNamesItems.end()) + { + (*item_iter).second->setThumbnailUUID(LLUUID::null); + + // This additional step (notifying AIS API) is required + // to make the changes persist outside of the local cache + const LLUUID item_id = (*item_iter).second->getUUID(); + writeInventoryThumbnailID(item_id, LLUUID::null); + + ++item_iter; + } + + updateDisplayList(); + } + else + { + LL_INFOS() << "Clearing on thumbnails was canceled" << LL_ENDL; + } + }); +} + +// Update the endabled state of some of the UI buttons based on what has +// been recorded so far. For example, if there are no valid item/texture pairs, +// then the Write Thumbnails button is not enabled. +void LLFloaterInventoryThumbnailsHelper::updateButtonStates() +{ + size_t found_count = 0; + + std::map<std::string, LLViewerInventoryItem*>::iterator item_iter = mItemNamesItems.begin(); + while (item_iter != mItemNamesItems.end()) + { + std::string item_name = (*item_iter).first; + + std::map<std::string, LLUUID>::iterator texture_iter = mTextureNamesIDs.find(item_name); + if (texture_iter != mTextureNamesIDs.end()) + { + found_count++; + } + + ++item_iter; + } + + // the "Write Thumbnails" button is only enabled when there is at least one + // item with a matching texture ready to be written to the thumbnail field + if (found_count > 0) + { + mWriteThumbnailsBtn->setEnabled(true); + } + else + { + mWriteThumbnailsBtn->setEnabled(false); + } + + // The "Log Missing Items" and "Clear Thumbnails" buttons are only enabled + // when there is at least 1 item that was pasted from inventory (doesn't need + // to have a matching texture for these operations) + if (mItemNamesItems.size() > 0) + { + mLogMissingThumbnailsBtn->setEnabled(true); + mClearThumbnailsBtn->setEnabled(true); + } + else + { + mLogMissingThumbnailsBtn->setEnabled(false); + mClearThumbnailsBtn->setEnabled(false); + } +} + +// Helper function for writing a line to the log window. Currently the only additional +// feature is that it scrolls to the bottom each time a line is written but it +// is envisaged that other common actions will be added here eventually - E.G. write eavh +// line to the Second Life log too for example. +void LLFloaterInventoryThumbnailsHelper::writeToLog(std::string logline, bool prepend_newline) +{ + mOutputLog->appendText(logline, prepend_newline); + + mOutputLog->setCursorAndScrollToEnd(); +} diff --git a/indra/newview/llfloaterinventorythumbnailshelper.h b/indra/newview/llfloaterinventorythumbnailshelper.h new file mode 100644 index 0000000000..71eeef31ee --- /dev/null +++ b/indra/newview/llfloaterinventorythumbnailshelper.h @@ -0,0 +1,82 @@ +/** + * @file llfloaterinventorythumbnailshelper.h + * @author Callum Prentice + * @brief Helper floater for bulk processing of inventory thumbnails tool + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, 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 LL_LLFLOATERINVENTORYTHUMBNAILSHELPER_H +#define LL_LLFLOATERINVENTORYTHUMBNAILSHELPER_H + +#include "llfloater.h" +class LLTextEditor; +class LLScrollListCtrl; +class LLViewerInventoryItem; +class LLUUID; + +class LLFloaterInventoryThumbnailsHelper: + public LLFloater +{ + friend class LLFloaterReg; + private: + LLFloaterInventoryThumbnailsHelper(const LLSD& key); + bool postBuild() override; + ~LLFloaterInventoryThumbnailsHelper(); + + LLScrollListCtrl* mInventoryThumbnailsList; + + LLTextEditor* mOutputLog; + + LLUICtrl* mPasteItemsBtn; + void onPasteItems(); + + LLUICtrl* mPasteTexturesBtn; + void onPasteTextures(); + + LLUICtrl* mWriteThumbnailsBtn; + void onWriteThumbnails(); + + LLUICtrl* mLogMissingThumbnailsBtn; + void onLogMissingThumbnails(); + + LLUICtrl* mClearThumbnailsBtn; + void onClearThumbnails(); + + void recordInventoryItemEntry(LLViewerInventoryItem* item); + void recordTextureItemEntry(LLViewerInventoryItem* item); + void updateButtonStates(); + void updateDisplayList(); + void writeToLog(std::string logline, bool prepend_newline); + + std::map<std::string, LLViewerInventoryItem*> mItemNamesItems; + std::map<std::string, LLUUID> mTextureNamesIDs; + + enum EListColumnNum + { + NAME = 0, + EXISTING_TEXTURE = 1, + NEW_TEXTURE = 2 + }; +}; + +#endif // LL_LLFLOATERINVENTORYTHUMBNAILSHELPER_H diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp index 1cd46cdd44..c258da6640 100644 --- a/indra/newview/llfloaterlagmeter.cpp +++ b/indra/newview/llfloaterlagmeter.cpp @@ -179,10 +179,6 @@ void LLFloaterLagMeter::determineClient() { mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) ); } - else if(LLViewerTexture::isMemoryForTextureLow()) - { - mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) ); - } else { mClientCause->setText( getString("client_complex_objects_cause_msg", mStringArgs) ); diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 19df41689a..9e3d8e19f3 100644 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -183,7 +183,8 @@ void LLPanelMarketplaceListings::draw() // Get the audit button enabled only after the whole inventory is fetched if (!mAuditBtn->getEnabled()) { - mAuditBtn->setEnabled(LLInventoryModelBackgroundFetch::instance().isEverythingFetched()); + LLInventoryModelBackgroundFetch* inst = LLInventoryModelBackgroundFetch::getInstance(); + mAuditBtn->setEnabled(inst->isEverythingFetched() && !inst->folderFetchActive()); } LLPanel::draw(); @@ -410,8 +411,14 @@ bool LLFloaterMarketplaceListings::postBuild() mCategoryAddedObserver = new LLMarketplaceListingsAddedObserver(this); gInventory.addObserver(mCategoryAddedObserver); - // Fetch aggressively so we can interact with listings right onOpen() - fetchContents(); + + // Fetch aggressively so we can interact with listings as soon as possible + if (!fetchContents()) + { + const LLUUID& marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); + LLInventoryModelBackgroundFetch::instance().start(marketplacelistings_id, true); + } + return true; } @@ -440,17 +447,19 @@ void LLFloaterMarketplaceListings::onFocusReceived() updateView(); } -void LLFloaterMarketplaceListings::fetchContents() +bool LLFloaterMarketplaceListings::fetchContents() { - if (mRootFolderId.notNull() && + if (mRootFolderId.notNull() && (LLMarketplaceData::instance().getSLMDataFetched() != MarketplaceFetchCodes::MARKET_FETCH_LOADING) && (LLMarketplaceData::instance().getSLMDataFetched() != MarketplaceFetchCodes::MARKET_FETCH_DONE)) - { + { LLMarketplaceData::instance().setDataFetchedSignal(boost::bind(&LLFloaterMarketplaceListings::updateView, this)); LLMarketplaceData::instance().setSLMDataFetched(MarketplaceFetchCodes::MARKET_FETCH_LOADING); - LLInventoryModelBackgroundFetch::instance().start(mRootFolderId, true); + LLInventoryModelBackgroundFetch::instance().start(mRootFolderId, true); LLMarketplaceData::instance().getSLMListings(); - } + return true; + } + return false; } void LLFloaterMarketplaceListings::setRootFolder() diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h index c010e4d2bf..5dc0e4479e 100644 --- a/indra/newview/llfloatermarketplacelistings.h +++ b/indra/newview/llfloatermarketplacelistings.h @@ -114,8 +114,8 @@ public: protected: void setRootFolder(); void setPanels(); - void fetchContents(); - + bool fetchContents(); + void setStatusString(const std::string& statusString); void onClose(bool app_quitting); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index d0233da920..b503fc3630 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1026,7 +1026,6 @@ void LLFloaterPreference::onBtnCancel(const LLSD& userdata) { cancel({"RenderQualityPerformance"}); LLFloaterReg::hideInstance("prefs_graphics_advanced"); - updateMaxComplexity(); } else { @@ -1245,7 +1244,7 @@ void LLFloaterPreference::refreshEnabledState() ctrl_pbr->setEnabled(true); // Cannot have floater active until caps have been received - getChild<LLButton>("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() < STATE_STARTED ? false : true); + getChild<LLButton>("default_creation_permissions")->setEnabled(LLStartUp::getStartupState() >= STATE_STARTED); getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess()); } @@ -3282,9 +3281,9 @@ void LLFloaterPreferenceProxy::onChangeSocksSettings() // Check for invalid states for the other HTTP proxy radio LLRadioGroup* otherHttpProxy = getChild<LLRadioGroup>("other_http_proxy_type"); if ((otherHttpProxy->getSelectedValue().asString() == "Socks" && - getChild<LLCheckBoxCtrl>("socks_proxy_enabled")->get() == false )||( + !getChild<LLCheckBoxCtrl>("socks_proxy_enabled")->get())||( otherHttpProxy->getSelectedValue().asString() == "Web" && - getChild<LLCheckBoxCtrl>("web_proxy_enabled")->get() == false ) ) + !getChild<LLCheckBoxCtrl>("web_proxy_enabled")->get())) { otherHttpProxy->selectFirstItem(); } @@ -3293,10 +3292,10 @@ void LLFloaterPreferenceProxy::onChangeSocksSettings() void LLFloaterPreference::onUpdateFilterTerm(bool force) { - LLWString seachValue = utf8str_to_wstring( mFilterEdit->getValue() ); - LLWStringUtil::toLower( seachValue ); + LLWString seachValue = utf8str_to_wstring(mFilterEdit->getValue()); + LLWStringUtil::toLower(seachValue); - if( !mSearchData || (mSearchData->mLastFilter == seachValue && !force)) + if (!mSearchData || (mSearchData->mLastFilter == seachValue && !force)) return; if (mSearchDataDirty) @@ -3307,14 +3306,13 @@ void LLFloaterPreference::onUpdateFilterTerm(bool force) mSearchData->mLastFilter = seachValue; - if( !mSearchData->mRootTab ) + if (!mSearchData->mRootTab) return; mSearchData->mRootTab->hightlightAndHide( seachValue ); filterIgnorableNotifications(); - LLTabContainer *pRoot = getChild< LLTabContainer >( "pref core" ); - if( pRoot ) + if (LLTabContainer* pRoot = getChild<LLTabContainer>("pref core")) pRoot->selectFirstTab(); } @@ -3331,72 +3329,69 @@ void LLFloaterPreference::filterIgnorableNotifications() void collectChildren( LLView const *aView, ll::prefs::PanelDataPtr aParentPanel, ll::prefs::TabContainerDataPtr aParentTabContainer ) { - if( !aView ) + if (!aView) return; - llassert_always( aParentPanel || aParentTabContainer ); - - LLView::child_list_const_iter_t itr = aView->beginChild(); - LLView::child_list_const_iter_t itrEnd = aView->endChild(); + llassert_always(aParentPanel || aParentTabContainer); - while( itr != itrEnd ) + for (LLView* pView : *aView->getChildList()) { - LLView *pView = *itr; + if (!pView) + continue; + ll::prefs::PanelDataPtr pCurPanelData = aParentPanel; ll::prefs::TabContainerDataPtr pCurTabContainer = aParentTabContainer; - if( !pView ) - continue; - LLPanel const *pPanel = dynamic_cast< LLPanel const *>( pView ); - LLTabContainer const *pTabContainer = dynamic_cast< LLTabContainer const *>( pView ); - ll::ui::SearchableControl const *pSCtrl = dynamic_cast< ll::ui::SearchableControl const *>( pView ); - if( pTabContainer ) + LLPanel const *pPanel = dynamic_cast<LLPanel const*>(pView); + LLTabContainer const *pTabContainer = dynamic_cast<LLTabContainer const*>(pView); + ll::ui::SearchableControl const *pSCtrl = dynamic_cast<ll::ui::SearchableControl const*>( pView ); + + if (pTabContainer) { pCurPanelData.reset(); - pCurTabContainer = ll::prefs::TabContainerDataPtr( new ll::prefs::TabContainerData ); - pCurTabContainer->mTabContainer = const_cast< LLTabContainer *>( pTabContainer ); + pCurTabContainer = ll::prefs::TabContainerDataPtr(new ll::prefs::TabContainerData); + pCurTabContainer->mTabContainer = const_cast< LLTabContainer *>(pTabContainer); pCurTabContainer->mLabel = pTabContainer->getLabel(); pCurTabContainer->mPanel = 0; - if( aParentPanel ) - aParentPanel->mChildPanel.push_back( pCurTabContainer ); - if( aParentTabContainer ) - aParentTabContainer->mChildPanel.push_back( pCurTabContainer ); + if (aParentPanel) + aParentPanel->mChildPanel.push_back(pCurTabContainer); + if (aParentTabContainer) + aParentTabContainer->mChildPanel.push_back(pCurTabContainer); } - else if( pPanel ) + else if (pPanel) { pCurTabContainer.reset(); - pCurPanelData = ll::prefs::PanelDataPtr( new ll::prefs::PanelData ); + pCurPanelData = ll::prefs::PanelDataPtr(new ll::prefs::PanelData); pCurPanelData->mPanel = pPanel; pCurPanelData->mLabel = pPanel->getLabel(); llassert_always( aParentPanel || aParentTabContainer ); - if( aParentTabContainer ) - aParentTabContainer->mChildPanel.push_back( pCurPanelData ); - else if( aParentPanel ) - aParentPanel->mChildPanel.push_back( pCurPanelData ); + if (aParentTabContainer) + aParentTabContainer->mChildPanel.push_back(pCurPanelData); + else if (aParentPanel) + aParentPanel->mChildPanel.push_back(pCurPanelData); } - else if( pSCtrl && pSCtrl->getSearchText().size() ) + else if (pSCtrl && pSCtrl->getSearchText().size()) { - ll::prefs::SearchableItemPtr item = ll::prefs::SearchableItemPtr( new ll::prefs::SearchableItem() ); + ll::prefs::SearchableItemPtr item = ll::prefs::SearchableItemPtr(new ll::prefs::SearchableItem()); item->mView = pView; item->mCtrl = pSCtrl; - item->mLabel = utf8str_to_wstring( pSCtrl->getSearchText() ); - LLWStringUtil::toLower( item->mLabel ); + item->mLabel = utf8str_to_wstring(pSCtrl->getSearchText()); + LLWStringUtil::toLower(item->mLabel); - llassert_always( aParentPanel || aParentTabContainer ); + llassert_always(aParentPanel || aParentTabContainer); - if( aParentPanel ) - aParentPanel->mChildren.push_back( item ); - if( aParentTabContainer ) - aParentTabContainer->mChildren.push_back( item ); + if (aParentPanel) + aParentPanel->mChildren.push_back(item); + if (aParentTabContainer) + aParentTabContainer->mChildren.push_back(item); } - collectChildren( pView, pCurPanelData, pCurTabContainer ); - ++itr; + collectChildren(pView, pCurPanelData, pCurTabContainer); } } diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp index 6741dbb7e4..25ee834109 100644 --- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp +++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp @@ -390,7 +390,7 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() // Bump & Shiny LLCheckBoxCtrl* bumpshiny_ctrl = getChild<LLCheckBoxCtrl>("BumpShiny"); bool bumpshiny = LLCubeMap::sUseCubeMaps && LLFeatureManager::getInstance()->isFeatureAvailable("RenderObjectBump"); - bumpshiny_ctrl->setEnabled(bumpshiny ? true : false); + bumpshiny_ctrl->setEnabled(bumpshiny); // Avatar Mode // Enable Avatar Shaders @@ -402,19 +402,12 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() if (LLViewerShaderMgr::sInitialized) { S32 max_avatar_shader = LLViewerShaderMgr::instance()->mMaxAvatarShaderLevel; - avatar_vp_enabled = (max_avatar_shader > 0) ? true : false; + avatar_vp_enabled = max_avatar_shader > 0; } ctrl_avatar_vp->setEnabled(avatar_vp_enabled); - if (gSavedSettings.getBOOL("RenderAvatarVP") == false) - { - ctrl_avatar_cloth->setEnabled(false); - } - else - { - ctrl_avatar_cloth->setEnabled(true); - } + ctrl_avatar_cloth->setEnabled(gSavedSettings.getBOOL("RenderAvatarVP")); // Vertex Shaders, Global Shader Enable // SL-12594 Basic shaders are always enabled. DJH TODO clean up now-orphaned state handling code @@ -438,8 +431,8 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() LLCheckBoxCtrl* ctrl_deferred = getChild<LLCheckBoxCtrl>("UseLightShaders"); enabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && - ((bumpshiny_ctrl && bumpshiny_ctrl->get()) ? true : false) && - (ctrl_wind_light->get()) ? true : false; + bumpshiny_ctrl && bumpshiny_ctrl->get() && + ctrl_wind_light->get(); ctrl_deferred->setEnabled(enabled); #endif @@ -455,7 +448,7 @@ void LLFloaterPreferenceGraphicsAdvanced::refreshEnabledState() LLTextBox* shadow_text = getChild<LLTextBox>("RenderShadowDetailText"); // note, okay here to get from ctrl_deferred as it's twin, ctrl_deferred2 will alway match it - enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO");// && (ctrl_deferred->get() ? true : false); + enabled = enabled && LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferredSSAO");// && ctrl_deferred->get(); //ctrl_deferred->set(gSavedSettings.getBOOL("RenderDeferred")); diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index bf809da5d5..8b7445e0dc 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -499,17 +499,17 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel->getChild<LLUICtrl>("region_type")->setValue(LLSD(sim_type)); panel->getChild<LLUICtrl>("version_channel_text")->setValue(gLastVersionChannel); - panel->getChild<LLUICtrl>("block_terraform_check")->setValue((region_flags & REGION_FLAGS_BLOCK_TERRAFORM) ? true : false ); - panel->getChild<LLUICtrl>("block_fly_check")->setValue((region_flags & REGION_FLAGS_BLOCK_FLY) ? true : false ); - panel->getChild<LLUICtrl>("block_fly_over_check")->setValue((region_flags & REGION_FLAGS_BLOCK_FLYOVER) ? true : false ); - panel->getChild<LLUICtrl>("allow_damage_check")->setValue((region_flags & REGION_FLAGS_ALLOW_DAMAGE) ? true : false ); - panel->getChild<LLUICtrl>("restrict_pushobject")->setValue((region_flags & REGION_FLAGS_RESTRICT_PUSHOBJECT) ? true : false ); - panel->getChild<LLUICtrl>("allow_land_resell_check")->setValue((region_flags & REGION_FLAGS_BLOCK_LAND_RESELL) ? false : true ); - panel->getChild<LLUICtrl>("allow_parcel_changes_check")->setValue((region_flags & REGION_FLAGS_ALLOW_PARCEL_CHANGES) ? true : false ); - panel->getChild<LLUICtrl>("block_parcel_search_check")->setValue((region_flags & REGION_FLAGS_BLOCK_PARCEL_SEARCH) ? true : false ); - panel->getChild<LLUICtrl>("agent_limit_spin")->setValue(LLSD((F32)agent_limit) ); - panel->getChild<LLUICtrl>("object_bonus_spin")->setValue(LLSD(object_bonus_factor) ); - panel->getChild<LLUICtrl>("access_combo")->setValue(LLSD(sim_access) ); + panel->getChild<LLUICtrl>("block_terraform_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_TERRAFORM)); + panel->getChild<LLUICtrl>("block_fly_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_FLY)); + panel->getChild<LLUICtrl>("block_fly_over_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_FLYOVER)); + panel->getChild<LLUICtrl>("allow_damage_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_ALLOW_DAMAGE)); + panel->getChild<LLUICtrl>("restrict_pushobject")->setValue(is_flag_set(region_flags, REGION_FLAGS_RESTRICT_PUSHOBJECT)); + panel->getChild<LLUICtrl>("allow_land_resell_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_LAND_RESELL)); + panel->getChild<LLUICtrl>("allow_parcel_changes_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_ALLOW_PARCEL_CHANGES)); + panel->getChild<LLUICtrl>("block_parcel_search_check")->setValue(is_flag_set(region_flags, REGION_FLAGS_BLOCK_PARCEL_SEARCH)); + panel->getChild<LLUICtrl>("agent_limit_spin")->setValue(LLSD((F32)agent_limit)); + panel->getChild<LLUICtrl>("object_bonus_spin")->setValue(LLSD(object_bonus_factor)); + panel->getChild<LLUICtrl>("access_combo")->setValue(LLSD(sim_access)); panel->getChild<LLSpinCtrl>("agent_limit_spin")->setMaxValue(hard_agent_limit); @@ -532,9 +532,9 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel = tab->getChild<LLPanel>("Debug"); panel->getChild<LLUICtrl>("region_text")->setValue(LLSD(sim_name) ); - panel->getChild<LLUICtrl>("disable_scripts_check")->setValue(LLSD((bool)((region_flags & REGION_FLAGS_SKIP_SCRIPTS) ? true : false )) ); - panel->getChild<LLUICtrl>("disable_collisions_check")->setValue(LLSD((bool)((region_flags & REGION_FLAGS_SKIP_COLLISIONS) ? true : false )) ); - panel->getChild<LLUICtrl>("disable_physics_check")->setValue(LLSD((bool)((region_flags & REGION_FLAGS_SKIP_PHYSICS) ? true : false )) ); + panel->getChild<LLUICtrl>("disable_scripts_check")->setValue(LLSD((bool)(region_flags & REGION_FLAGS_SKIP_SCRIPTS))); + panel->getChild<LLUICtrl>("disable_collisions_check")->setValue(LLSD((bool)(region_flags & REGION_FLAGS_SKIP_COLLISIONS))); + panel->getChild<LLUICtrl>("disable_physics_check")->setValue(LLSD((bool)(region_flags & REGION_FLAGS_SKIP_PHYSICS))); panel->setCtrlsEnabled(allow_modify); // TERRAIN PANEL @@ -1893,7 +1893,7 @@ void LLPanelEstateInfo::refresh() getChildView("limit_bots")->setEnabled(public_access); // if this is set to false, then the limit fields are meaningless and should be turned off - if (public_access == false) + if (!public_access) { getChild<LLUICtrl>("limit_payment")->setValue(false); getChild<LLUICtrl>("limit_age_verified")->setValue(false); @@ -2832,19 +2832,24 @@ void LLPanelEstateAccess::updateControls(LLViewerRegion* region) bool manager = (region && region->isEstateManager()); bool enable_cotrols = god || owner || manager; setCtrlsEnabled(enable_cotrols); - - bool has_allowed_avatar = getChild<LLNameListCtrl>("allowed_avatar_name_list")->getFirstSelected() ? true : false; - bool has_allowed_group = getChild<LLNameListCtrl>("allowed_group_name_list")->getFirstSelected() ? true : false; - bool has_banned_agent = getChild<LLNameListCtrl>("banned_avatar_name_list")->getFirstSelected() ? true : false; - bool has_estate_manager = getChild<LLNameListCtrl>("estate_manager_name_list")->getFirstSelected() ? true : false; + + LLNameListCtrl* allowedAvatars = getChild<LLNameListCtrl>("allowed_avatar_name_list"); + LLNameListCtrl* allowedGroups = getChild<LLNameListCtrl>("allowed_group_name_list"); + LLNameListCtrl* bannedAvatars = getChild<LLNameListCtrl>("banned_avatar_name_list"); + LLNameListCtrl* estateManagers = getChild<LLNameListCtrl>("estate_manager_name_list"); + + bool has_allowed_avatar = allowedAvatars->getFirstSelected(); + bool has_allowed_group = allowedGroups->getFirstSelected(); + bool has_banned_agent = bannedAvatars->getFirstSelected(); + bool has_estate_manager = estateManagers->getFirstSelected(); getChildView("add_allowed_avatar_btn")->setEnabled(enable_cotrols); getChildView("remove_allowed_avatar_btn")->setEnabled(has_allowed_avatar && enable_cotrols); - getChildView("allowed_avatar_name_list")->setEnabled(enable_cotrols); + allowedAvatars->setEnabled(enable_cotrols); getChildView("add_allowed_group_btn")->setEnabled(enable_cotrols); getChildView("remove_allowed_group_btn")->setEnabled(has_allowed_group && enable_cotrols); - getChildView("allowed_group_name_list")->setEnabled(enable_cotrols); + allowedGroups->setEnabled(enable_cotrols); // Can't ban people from mainland, orientation islands, etc. because this // creates much network traffic and server load. @@ -2853,12 +2858,12 @@ void LLPanelEstateAccess::updateControls(LLViewerRegion* region) bool enable_ban = enable_cotrols && !linden_estate; getChildView("add_banned_avatar_btn")->setEnabled(enable_ban); getChildView("remove_banned_avatar_btn")->setEnabled(has_banned_agent && enable_ban); - getChildView("banned_avatar_name_list")->setEnabled(enable_cotrols); + bannedAvatars->setEnabled(enable_cotrols); // estate managers can't add estate managers getChildView("add_estate_manager_btn")->setEnabled(god || owner); getChildView("remove_estate_manager_btn")->setEnabled(has_estate_manager && (god || owner)); - getChildView("estate_manager_name_list")->setEnabled(god || owner); + estateManagers->setEnabled(god || owner); if (enable_cotrols != mCtrlsEnabled) { diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index 90e44d49dd..70504944b1 100644 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -158,7 +158,7 @@ public: // typedef std::map<std::string,std::pair<std::list<std::string>,std::list<std::string> > > DiffMap; // this version copies the lists etc., and thus is bad memory-wise typedef std::list<std::string> StringList; - typedef boost::shared_ptr<StringList> StringListPtr; + typedef std::shared_ptr<StringList> StringListPtr; typedef std::map<std::string, std::pair<StringListPtr,StringListPtr> > DiffMap; DiffMap mDiffsMap; // map, of filename to pair of list of changed element paths and list of errors diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp index de37c92326..ce9e1b13b6 100644 --- a/indra/newview/llfloaterurlentry.cpp +++ b/indra/newview/llfloaterurlentry.cpp @@ -71,7 +71,7 @@ bool LLFloaterURLEntry::postBuild() childSetAction("clear_btn", onBtnClear, this); // clear media list button LLSD parcel_history = LLURLHistory::getURLHistory("parcel"); - bool enable_clear_button = parcel_history.size() > 0 ? true : false; + bool enable_clear_button = parcel_history.size() > 0; getChildView("clear_btn")->setEnabled(enable_clear_button ); // OK button diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 24391046c1..8fb6710161 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -327,6 +327,7 @@ void* LLFloaterWorldMap::createWorldMapView(void* data) bool LLFloaterWorldMap::postBuild() { mMapView = dynamic_cast<LLWorldMapView*>(getChild<LLPanel>("objects_mapview")); + mMapView->setPan(0, 0, true); LLComboBox *avatar_combo = getChild<LLComboBox>("friend combo"); avatar_combo->selectFirstItem(); diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index ca3f670518..fc8e1f3d26 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -177,7 +177,7 @@ void LLFriendCardsManager::putAvatarData(const LLUUID& avatarID) LL_INFOS() << "Store avatar data, avatarID: " << avatarID << LL_ENDL; std::pair< avatar_uuid_set_t::iterator, bool > pr; pr = mBuddyIDSet.insert(avatarID); - if (pr.second == false) + if (!pr.second) { LL_WARNS() << "Trying to add avatar UUID for the stored avatar: " << avatarID diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 90575ccda6..8224171297 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -247,7 +247,7 @@ void LLHUDNameTag::renderText(bool for_select) { return; } - + if (for_select) { gGL.getTexUnit(0)->disable(); @@ -257,8 +257,8 @@ void LLHUDNameTag::renderText(bool for_select) gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); } - LLGLState gls_blend(GL_BLEND, for_select ? false : true); - + LLGLState gls_blend(GL_BLEND, !for_select); + LLColor4 shadow_color(0.f, 0.f, 0.f, 1.f); F32 alpha_factor = 1.f; LLColor4 text_color = mColor; diff --git a/indra/newview/llhudobject.cpp b/indra/newview/llhudobject.cpp index 08a763bcec..7fe313e3b0 100644 --- a/indra/newview/llhudobject.cpp +++ b/indra/newview/llhudobject.cpp @@ -52,13 +52,13 @@ struct hud_object_further_away bool hud_object_further_away::operator()(const LLPointer<LLHUDObject>& lhs, const LLPointer<LLHUDObject>& rhs) const { - return (lhs->getDistance() > rhs->getDistance()) ? true : false; + return lhs->getDistance() > rhs->getDistance(); } -LLHUDObject::LLHUDObject(const U8 type) : - mPositionGlobal(), - mSourceObject(NULL), +LLHUDObject::LLHUDObject(const U8 type) : + mPositionGlobal(), + mSourceObject(NULL), mTargetObject(NULL) { mVisible = true; diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp index 5516a8fc61..44705acb07 100644 --- a/indra/newview/llimprocessing.cpp +++ b/indra/newview/llimprocessing.cpp @@ -278,7 +278,7 @@ void inventory_offer_handler(LLOfferInfo* info) p.name = info->mFromID == gAgentID ? "OwnObjectGiveItem" : "ObjectGiveItem"; // Pop up inv offer chiclet and let the user accept (keep), or reject (and silently delete) the inventory. - LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, info->mFromGroup == true); + LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, info->mFromGroup); } else // Agent -> Agent Inventory Offer { @@ -450,7 +450,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, // object IMs contain sender object id in session_id (STORM-1209) || (dialog == IM_FROM_TASK && LLMuteList::getInstance()->isMuted(session_id)); bool is_owned_by_me = false; - bool is_friend = (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL) ? false : true; + bool is_friend = LLAvatarTracker::instance().getBuddyInfo(from_id) != NULL; bool accept_im_from_only_friend = gSavedPerAccountSettings.getBOOL("VoiceCallsFriendsOnly"); bool is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT && LLMuteList::isLinden(name); @@ -640,7 +640,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, { // aux_id contains group id, binary bucket contains name and asset type group_id = aux_id; - has_inventory = binary_bucket_size > 1 ? true : false; + has_inventory = binary_bucket_size > 1; from_group = true; // inaccurate value correction if (has_inventory) { diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index e9b15b2bc1..10fe740138 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -206,26 +206,26 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg) if (msg["source_type"].asInteger() == CHAT_SOURCE_OBJECT) { user_preferences = gSavedSettings.getString("NotificationObjectIMOptions"); - if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundObjectIM") == true)) + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundObjectIM"))) { make_ui_sound("UISndNewIncomingIMSession"); } } else { - user_preferences = gSavedSettings.getString("NotificationNearbyChatOptions"); - if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNearbyChatIM") == true)) + user_preferences = gSavedSettings.getString("NotificationNearbyChatOptions"); + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNearbyChatIM"))) { make_ui_sound("UISndNewIncomingIMSession"); - } + } } } - else if(session->isP2PSessionType()) + else if (session->isP2PSessionType()) { if (LLAvatarTracker::instance().isBuddy(participant_id)) { user_preferences = gSavedSettings.getString("NotificationFriendIMOptions"); - if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundFriendIM") == true)) + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundFriendIM"))) { make_ui_sound("UISndNewIncomingIMSession"); } @@ -233,24 +233,24 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg) else { user_preferences = gSavedSettings.getString("NotificationNonFriendIMOptions"); - if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNonFriendIM") == true)) + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNonFriendIM"))) { make_ui_sound("UISndNewIncomingIMSession"); - } - } + } + } } - else if(session->isAdHocSessionType()) + else if (session->isAdHocSessionType()) { user_preferences = gSavedSettings.getString("NotificationConferenceIMOptions"); - if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundConferenceIM") == true)) + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundConferenceIM"))) { make_ui_sound("UISndNewIncomingIMSession"); - } + } } else if(session->isGroupSessionType()) { user_preferences = gSavedSettings.getString("NotificationGroupChatOptions"); - if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundGroupChatIM") == true)) + if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundGroupChatIM"))) { make_ui_sound("UISndNewIncomingIMSession"); } @@ -300,8 +300,7 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg) else { store_dnd_message = true; - } - + } } // 2. Flash line item @@ -3162,13 +3161,15 @@ void LLIMMgr::addMessage( // Fetch group chat history, enabled by default. if (gSavedPerAccountSettings.getBOOL("FetchGroupChatHistory")) { - std::string chat_url = gAgent.getRegion()->getCapability("ChatSessionRequest"); - LLCoros::instance().launch("chatterBoxHistoryCoro", - boost::bind(&chatterBoxHistoryCoro, chat_url, session_id, from, msg, timestamp)); + std::string chat_url = gAgent.getRegionCapability("ChatSessionRequest"); + if (!chat_url.empty()) + { + LLCoros::instance().launch("chatterBoxHistoryCoro", boost::bind(&chatterBoxHistoryCoro, chat_url, session_id, from, msg, timestamp)); + } } //Play sound for new conversations - if (!skip_message & !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation") == true)) + if (!skip_message & !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation"))) { make_ui_sound("UISndNewIncomingIMSession"); } diff --git a/indra/newview/llinspecttexture.cpp b/indra/newview/llinspecttexture.cpp index 1d712bb7e2..c8a2bdda7f 100644 --- a/indra/newview/llinspecttexture.cpp +++ b/indra/newview/llinspecttexture.cpp @@ -84,7 +84,10 @@ LLToolTip* LLInspectTextureUtil::createInventoryToolTip(LLToolTip::Params p) } } } - + if ((!p.message.isProvided() || p.message().empty())) + { + return NULL; + } // No or more than one texture found => show default tooltip return LLUICtrlFactory::create<LLToolTip>(p); } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 0dd2b4bcd9..075c11f86f 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1190,8 +1190,8 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; gInventory.collectDescendents(local_version_folder_id, categories, items, false); - LLCachedControl<U32> max_depth(gSavedSettings, "InventoryOutboxMaxFolderDepth", 4); - LLCachedControl<U32> max_count(gSavedSettings, "InventoryOutboxMaxFolderCount", 20); + static LLCachedControl<U32> max_depth(gSavedSettings, "InventoryOutboxMaxFolderDepth", 4); + static LLCachedControl<U32> max_count(gSavedSettings, "InventoryOutboxMaxFolderCount", 20); if (categories.size() >= max_count || depth > (max_depth + 1)) { @@ -2284,8 +2284,11 @@ bool LLFolderBridge::isItemMovable() const void LLFolderBridge::selectItem() { - // Have no fear: the first thing start() does is to test if everything for that folder has been fetched... - LLInventoryModelBackgroundFetch::instance().start(getUUID(), true); + LLViewerInventoryCategory* cat = gInventory.getCategory(getUUID()); + if (cat) + { + cat->fetch(); + } } void LLFolderBridge::buildDisplayName() const @@ -2810,7 +2813,7 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, is_movable = can_move_folder_to_marketplace(master_folder, dest_folder, inv_cat, tooltip_msg, bundle_size); } - if (is_movable) + if (is_movable && !move_is_into_landmarks) { LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(false); is_movable = active_panel != NULL; @@ -3027,7 +3030,7 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, return accept; } -void warn_move_inventory(LLViewerObject* object, boost::shared_ptr<LLMoveInv> move_inv) +void warn_move_inventory(LLViewerObject* object, std::shared_ptr<LLMoveInv> move_inv) { const char* dialog = NULL; if (object->flagScripted()) @@ -3040,7 +3043,7 @@ void warn_move_inventory(LLViewerObject* object, boost::shared_ptr<LLMoveInv> mo } static LLNotificationPtr notification_ptr; - static boost::shared_ptr<LLMoveInv> inv_ptr; + static std::shared_ptr<LLMoveInv> inv_ptr; // Notification blocks user from interacting with inventories so everything that comes after first message // is part of this message - don'r show it again @@ -3153,7 +3156,7 @@ bool move_inv_category_world_to_agent(const LLUUID& object_id, if(drop && accept) { it = inventory_objects.begin(); - boost::shared_ptr<LLMoveInv> move_inv(new LLMoveInv); + std::shared_ptr<LLMoveInv> move_inv(new LLMoveInv); move_inv->mObjectID = object_id; move_inv->mCategoryID = category_id; move_inv->mCallback = callback; @@ -4247,7 +4250,7 @@ bool LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv item_array, LLInventoryModel::EXCLUDE_TRASH, is_type); - return ((item_array.size() > 0) ? true : false ); + return !item_array.empty(); } void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items) @@ -5006,7 +5009,7 @@ LLFontGL::StyleFlags LLMarketplaceFolderBridge::getLabelStyle() const // helper stuff -bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, boost::shared_ptr<LLMoveInv> move_inv) +bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, std::shared_ptr<LLMoveInv> move_inv) { LLFloaterOpenObject::LLCatAndWear* cat_and_wear = (LLFloaterOpenObject::LLCatAndWear* )move_inv->mUserData; LLViewerObject* object = gObjectList.findObject(move_inv->mObjectID); @@ -5480,7 +5483,7 @@ bool LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if (accept && drop) { LLUUID item_id = inv_item->getUUID(); - boost::shared_ptr<LLMoveInv> move_inv (new LLMoveInv()); + std::shared_ptr<LLMoveInv> move_inv (new LLMoveInv()); move_inv->mObjectID = inv_item->getParentUUID(); two_uuids_t item_pair(mUUID, item_id); move_inv->mMoveList.push_back(item_pair); @@ -6625,7 +6628,7 @@ LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory, LLItemBridge(inventory, root, uuid) { mAttachPt = (flags & 0xff); // low bye of inventory flags - mIsMultiObject = ( flags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ? true: false; + mIsMultiObject = is_flag_set(flags, LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS); mInvType = type; } diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 7c7c7efa18..1c58c235b8 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -793,7 +793,7 @@ struct LLMoveInv void* mUserData; }; -void warn_move_inventory(LLViewerObject* object, boost::shared_ptr<LLMoveInv> move_inv); -bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, boost::shared_ptr<LLMoveInv>); +void warn_move_inventory(LLViewerObject* object, std::shared_ptr<LLMoveInv> move_inv); +bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, std::shared_ptr<LLMoveInv>); #endif // LL_LLINVENTORYBRIDGE_H diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index e1cbd291b9..83770e28b6 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -202,12 +202,18 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const && !LLInventoryModelBackgroundFetch::instance().inventoryFetchInProgress()) { LLViewerInventoryCategory* cat = gInventory.getCategory(folder_id); - if ((!cat && folder_id.notNull()) || (cat && cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN)) + if ((!cat && folder_id.notNull())) { - // At the moment background fetch only cares about VERSION_UNKNOWN, - // so do not check isCategoryComplete that compares descendant count + // Shouldn't happen? Server provides full list of folders on startup LLInventoryModelBackgroundFetch::instance().start(folder_id, false); } + else if (cat && cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN) + { + // At the moment background fetch only cares about VERSION_UNKNOWN, + // so do not check isCategoryComplete that compares descendant count, + // but if that is nesesary, do a forced scheduleFolderFetch. + cat->fetch(); + } } if (!checkAgainstFilterThumbnails(folder_id)) diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index b28b72452e..c7e4926220 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -91,8 +91,6 @@ #include "llvoavatarself.h" #include "llwearablelist.h" -#include <boost/foreach.hpp> - bool LLInventoryState::sWearNewClothing = false; LLUUID LLInventoryState::sWearNewClothingTransactionID; std::list<LLUUID> LLInventoryAction::sMarketplaceFolders; @@ -462,6 +460,13 @@ void copy_inventory_category(LLInventoryModel* model, gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName(), func, cat->getThumbnailUUID()); } +void copy_cb(const LLUUID& dest_folder, const LLUUID& root_id) +{ + // Decrement the count in root_id since that one item won't be copied over + LLMarketplaceData::instance().decrementValidationWaiting(root_id); + update_folder_cb(dest_folder); +}; + void copy_inventory_category_content(const LLUUID& new_cat_uuid, LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& root_copy_id, bool move_no_copy_items) { model->notifyObservers(); @@ -480,12 +485,21 @@ void copy_inventory_category_content(const LLUUID& new_cat_uuid, LLInventoryMode LLMarketplaceData::instance().setValidationWaiting(root_id, count_descendants_items(cat->getUUID())); } + LLPointer<LLInventoryCallback> cb; + if (root_copy_id.isNull()) + { + cb = new LLBoostFuncInventoryCallback(boost::bind(copy_cb, new_cat_uuid, root_id)); + } + else + { + cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, new_cat_uuid)); + } + // Copy all the items LLInventoryModel::item_array_t item_array_copy = *item_array; for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++) { LLInventoryItem* item = *iter; - LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, new_cat_uuid)); if (item->getIsLinkType()) { @@ -500,8 +514,11 @@ void copy_inventory_category_content(const LLUUID& new_cat_uuid, LLInventoryMode LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *)item; gInventory.changeItemParent(viewer_inv_item, new_cat_uuid, true); } - // Decrement the count in root_id since that one item won't be copied over - LLMarketplaceData::instance().decrementValidationWaiting(root_id); + if (root_copy_id.isNull()) + { + // Decrement the count in root_id since that one item won't be copied over + LLMarketplaceData::instance().decrementValidationWaiting(root_id); + } } else { @@ -2973,6 +2990,23 @@ bool get_selection_object_uuids(LLFolderView *root, uuid_vec_t& ids) void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, bool user_confirm) { std::set<LLFolderViewItem*> selected_items = root->getSelectionList(); + if (selected_items.empty() + && action != "wear" + && action != "wear_add" + && !isRemoveAction(action)) + { + // Was item removed while user was checking menu? + // "wear" and removal exlusions are due to use of + // getInventorySelectedUUIDs() below + LL_WARNS("Inventory") << "Menu tried to operate on empty selection" << LL_ENDL; + + if (("copy" == action) || ("cut" == action)) + { + LLClipboard::instance().reset(); + } + + return; + } // Prompt the user and check for authorization for some marketplace active listing edits if (user_confirm && (("delete" == action) || ("cut" == action) || ("rename" == action) || ("properties" == action) || ("task_properties" == action) || ("open" == action))) diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index aa3d45b7d2..ca9d8ecaf4 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -2452,17 +2452,22 @@ void LLInventoryGallery::startDrag() } const LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id); - if (cat && gInventory.isObjectDescendentOf(selected_id, gInventory.getRootFolderID()) - && !LLFolderType::lookupIsProtectedType((cat)->getPreferredType())) + if (cat) { - if (cat->getOwnerID() == ALEXANDRIA_LINDEN_ID) + if (gInventory.isObjectDescendentOf(selected_id, gInventory.getLibraryRootFolderID())) { src = LLToolDragAndDrop::SOURCE_LIBRARY; + EDragAndDropType type = LLViewerAssetType::lookupDragAndDropType(cat->getType()); + types.push_back(type); + ids.push_back(selected_id); + } + else if (gInventory.isObjectDescendentOf(selected_id, gInventory.getRootFolderID()) + && !LLFolderType::lookupIsProtectedType((cat)->getPreferredType())) + { + EDragAndDropType type = LLViewerAssetType::lookupDragAndDropType(cat->getType()); + types.push_back(type); + ids.push_back(selected_id); } - - EDragAndDropType type = LLViewerAssetType::lookupDragAndDropType(cat->getType()); - types.push_back(type); - ids.push_back(selected_id); } } LLToolDragAndDrop::getInstance()->beginMultiDrag(types, ids, src); @@ -3367,7 +3372,7 @@ bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, if (accept && drop) { - boost::shared_ptr<LLMoveInv> move_inv (new LLMoveInv()); + std::shared_ptr<LLMoveInv> move_inv (new LLMoveInv()); move_inv->mObjectID = inv_item->getParentUUID(); std::pair<LLUUID, LLUUID> item_pair(folder_id, inv_item->getUUID()); move_inv->mMoveList.push_back(item_pair); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 1508b81494..b8bef6361f 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1593,7 +1593,7 @@ LLInventoryModel::cat_array_t* LLInventoryModel::getUnlockedCatArray(const LLUUI cat_array_t* cat_array = get_ptr_in_map(mParentChildCategoryTree, id); if (cat_array) { - llassert_always(mCategoryLock[id] == false); + llassert_always(!mCategoryLock[id]); } return cat_array; } @@ -1603,7 +1603,7 @@ LLInventoryModel::item_array_t* LLInventoryModel::getUnlockedItemArray(const LLU item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, id); if (item_array) { - llassert_always(mItemLock[id] == false); + llassert_always(!mItemLock[id]); } return item_array; } @@ -1675,8 +1675,8 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat, U32 } // make space in the tree for this category's children. - llassert_always(mCategoryLock[new_cat->getUUID()] == false); - llassert_always(mItemLock[new_cat->getUUID()] == false); + llassert_always(!mCategoryLock[new_cat->getUUID()]); + llassert_always(!mItemLock[new_cat->getUUID()]); cat_array_t* catsp = new cat_array_t; item_array_t* itemsp = new item_array_t; mParentChildCategoryTree[new_cat->getUUID()] = catsp; @@ -2955,13 +2955,13 @@ void LLInventoryModel::buildParentChildMap() cats.push_back(cat); if (mParentChildCategoryTree.count(cat->getUUID()) == 0) { - llassert_always(mCategoryLock[cat->getUUID()] == false); + llassert_always(!mCategoryLock[cat->getUUID()]); catsp = new cat_array_t; mParentChildCategoryTree[cat->getUUID()] = catsp; } if (mParentChildItemTree.count(cat->getUUID()) == 0) { - llassert_always(mItemLock[cat->getUUID()] == false); + llassert_always(!mItemLock[cat->getUUID()]); itemsp = new item_array_t; mParentChildItemTree[cat->getUUID()] = itemsp; } @@ -3550,6 +3550,9 @@ void LLInventoryModel::processUpdateCreateInventoryItem(LLMessageSystem* msg, vo gInventoryCallbacks.fire(callback_id, item_id); + // Message system at the moment doesn't support Thumbnails and potential + // newer features so just rerequest whole item + // // todo: instead of unpacking message fully, // grab only an item_id, then fetch LLInventoryModelBackgroundFetch::instance().scheduleItemFetch(item_id, true); @@ -3912,19 +3915,22 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) for (cat_array_t::iterator cit = folders.begin(); cit != folders.end(); ++cit) { - gInventory.updateCategory(*cit); - - // Temporary workaround: just fetch the item using AIS to get missing fields. - // If this works fine we might want to extract ids only from the message - // then use AIS as a primary fetcher - LLInventoryModelBackgroundFetch::instance().scheduleFolderFetch((*cit)->getUUID(), true /*force, since it has changes*/); + gInventory.updateCategory(*cit); + if ((*cit)->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) + { + // Temporary workaround: just fetch the item using AIS to get missing fields. + // If this works fine we might want to extract 'ids only' from the message + // then use AIS as a primary fetcher + LLInventoryModelBackgroundFetch::instance().scheduleFolderFetch((*cit)->getUUID(), true /*force, since it has changes*/); + } + // else already called fetch() above } for (item_array_t::iterator iit = items.begin(); iit != items.end(); ++iit) { gInventory.updateItem(*iit); // Temporary workaround: just fetch the item using AIS to get missing fields. - // If this works fine we might want to extract ids only from the message + // If this works fine we might want to extract 'ids only' from the message // then use AIS as a primary fetcher LLInventoryModelBackgroundFetch::instance().scheduleItemFetch((*iit)->getUUID(), true); } diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index 920d5df1af..486b71120c 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -193,13 +193,16 @@ LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch(): mLastFetchCount(0), mFetchFolderCount(0), mAllRecursiveFoldersFetched(false), - mRecursiveInventoryFetchStarted(false), - mRecursiveLibraryFetchStarted(false), - mMinTimeBetweenFetches(0.3f) + mRecursiveInventoryFetchStarted(false), + mRecursiveLibraryFetchStarted(false), + mRecursiveMarketplaceFetchStarted(false), + mMinTimeBetweenFetches(0.3f) {} LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch() -{} +{ + gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); +} bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete() const { @@ -314,6 +317,23 @@ void LLInventoryModelBackgroundFetch::start(const LLUUID& id, bool recursive) gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); } } + else if (recursive && cat && cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_LISTINGS) + { + if (mFetchFolderQueue.empty() || mFetchFolderQueue.back().mUUID != id) + { + if (recursive && AISAPI::isAvailable()) + { + // Request marketplace folder and content separately + mFetchFolderQueue.push_front(FetchQueueInfo(id, FT_FOLDER_AND_CONTENT)); + } + else + { + mFetchFolderQueue.push_front(FetchQueueInfo(id, recursion_type)); + } + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); + mRecursiveMarketplaceFetchStarted = true; + } + } else { if (AISAPI::isAvailable()) @@ -359,8 +379,22 @@ void LLInventoryModelBackgroundFetch::scheduleFolderFetch(const LLUUID& cat_id, mBackgroundFetchActive = true; mFolderFetchActive = true; - // Specific folder requests go to front of queue. - mFetchFolderQueue.push_front(FetchQueueInfo(cat_id, forced ? FT_FORCED : FT_DEFAULT)); + if (forced) + { + // check if already requested + if (mForceFetchSet.find(cat_id) == mForceFetchSet.end()) + { + mForceFetchSet.insert(cat_id); + mFetchItemQueue.push_front(FetchQueueInfo(cat_id, FT_FORCED)); + } + } + else + { + // Specific folder requests go to front of queue. + // version presence acts as dupplicate prevention for normal fetches + mFetchItemQueue.push_front(FetchQueueInfo(cat_id, FT_DEFAULT)); + } + gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); } } @@ -370,8 +404,21 @@ void LLInventoryModelBackgroundFetch::scheduleItemFetch(const LLUUID& item_id, b if (mFetchItemQueue.empty() || mFetchItemQueue.front().mUUID != item_id) { mBackgroundFetchActive = true; + if (forced) + { + // check if already requested + if (mForceFetchSet.find(item_id) == mForceFetchSet.end()) + { + mForceFetchSet.insert(item_id); + mFetchItemQueue.push_front(FetchQueueInfo(item_id, FT_FORCED, false)); + } + } + else + { + // 'isFinished' being set acts as dupplicate prevention for normal fetches + mFetchItemQueue.push_front(FetchQueueInfo(item_id, FT_DEFAULT, false)); + } - mFetchItemQueue.push_front(FetchQueueInfo(item_id, forced ? FT_FORCED : FT_DEFAULT, false)); gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL); } } @@ -591,6 +638,7 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i return; } + LLViewerInventoryCategory::EFetchType new_state = LLViewerInventoryCategory::FETCH_NONE; bool request_descendants = false; if (response_id.isNull()) // Failure { @@ -608,10 +656,12 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i // set folder's version to prevent viewer from trying to request folder indefinetely LLViewerInventoryCategory* cat(gInventory.getCategory(request_id)); - if (cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN) + if (cat && cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN) { cat->setVersion(0); } + // back off for a bit in case something tries to force-request immediately + new_state = LLViewerInventoryCategory::FETCH_FAILED; } } else @@ -664,7 +714,7 @@ void LLInventoryModelBackgroundFetch::onAISFolderCalback(const LLUUID &request_i LLViewerInventoryCategory * cat(gInventory.getCategory(request_id)); if (cat) { - cat->setFetching(LLViewerInventoryCategory::FETCH_NONE); + cat->setFetching(new_state); } } @@ -753,7 +803,26 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis() if (isFolderFetchProcessingComplete() && mFolderFetchActive) { - setAllFoldersFetched(); + if (!mRecursiveInventoryFetchStarted || mRecursiveMarketplaceFetchStarted) + { + setAllFoldersFetched(); + } + else + { + // Intent is for marketplace request to happen after + // main inventory is done, unless requested by floater + mRecursiveMarketplaceFetchStarted = true; + const LLUUID& marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS); + if (marketplacelistings_id.notNull()) + { + mFetchFolderQueue.push_front(FetchQueueInfo(marketplacelistings_id, FT_FOLDER_AND_CONTENT)); + } + else + { + setAllFoldersFetched(); + } + } + } if (isBulkFetchProcessingComplete()) @@ -813,22 +882,8 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc if (child_cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_LISTINGS) { - // special case - content_done = false; - if (children.empty()) - { - // fetch marketplace alone - // Should it actually be fetched as FT_FOLDER_AND_CONTENT? - children.push_back(child_cat->getUUID()); - mExpectedFolderIds.push_back(child_cat->getUUID()); - child_cat->setFetching(target_state); - break; - } - else - { - // fetch marketplace alone next run - continue; - } + // special case, marketplace will fetch that as needed + continue; } children.push_back(child_cat->getUUID()); @@ -902,10 +957,10 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc mExpectedFolderIds.push_back(cat_id); EFetchType type = fetch_info.mFetchType; - LLUUID cat_id = cat->getUUID(); - AISAPI::completion_t cb = [cat_id , type](const LLUUID& response_id) + LLUUID cat_cb_id = cat_id; + AISAPI::completion_t cb = [cat_cb_id, type](const LLUUID& response_id) { - LLInventoryModelBackgroundFetch::instance().onAISFolderCalback(cat_id , response_id , type); + LLInventoryModelBackgroundFetch::instance().onAISFolderCalback(cat_cb_id, response_id , type); }; AISAPI::ITEM_TYPE item_type = AISAPI::INVENTORY; @@ -964,6 +1019,11 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc AISAPI::FetchItem(fetch_info.mUUID, AISAPI::INVENTORY, ais_simple_item_callback); } } + + if (fetch_info.mFetchType == FT_FORCED) + { + mForceFetchSet.erase(fetch_info.mUUID); + } } // Bundle up a bunch of requests to send all at once. diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h index 4054042a45..831ab80dba 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.h +++ b/indra/newview/llinventorymodelbackgroundfetch.h @@ -76,7 +76,6 @@ public: void incrFetchFolderCount(S32 fetching); bool isBulkFetchProcessingComplete() const; - bool isFolderFetchProcessingComplete() const; void setAllFoldersFetched(); typedef boost::function<void()> folders_fetched_callback_t; @@ -86,6 +85,7 @@ public: void addRequestAtBack(const LLUUID & id, bool recursive, bool is_category); protected: + bool isFolderFetchProcessingComplete() const; typedef enum { FT_DEFAULT = 0, @@ -122,6 +122,7 @@ protected: private: bool mRecursiveInventoryFetchStarted; bool mRecursiveLibraryFetchStarted; + bool mRecursiveMarketplaceFetchStarted; // AIS3 specific bool mAllRecursiveFoldersFetched; typedef boost::signals2::signal<void()> folders_fetched_signal_t; folders_fetched_signal_t mFoldersFetchedSignal; @@ -136,6 +137,7 @@ private: F32 mMinTimeBetweenFetches; fetch_queue_t mFetchFolderQueue; fetch_queue_t mFetchItemQueue; + uuid_set_t mForceFetchSet; std::list<LLUUID> mExpectedFolderIds; // for debug, should this track time? }; diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 61729b1473..d80574d14c 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -356,7 +356,6 @@ void LLInventoryFetchItemsObserver::startFetch() { // Start fetching whole folder since we need all items LLInventoryModelBackgroundFetch::getInstance()->scheduleFolderFetch(folder.first, true); - } else { diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 3982e0fbee..8940117f0d 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -42,7 +42,6 @@ #include <boost/algorithm/string/trim.hpp> #include <boost/algorithm/string/replace.hpp> #include <boost/regex.hpp> -#include <boost/foreach.hpp> #if LL_MSVC #pragma warning(push) @@ -709,7 +708,7 @@ bool LLLogChat::moveTranscripts(const std::string originDirectory, std::string backupFileName; unsigned backupFileCount; - BOOST_FOREACH(const std::string& fullpath, listOfFilesToMove) + for (const std::string& fullpath : listOfFilesToMove) { backupFileCount = 0; newFullPath = targetDirectory + fullpath.substr(originDirectory.length(), std::string::npos); @@ -723,7 +722,7 @@ bool LLLogChat::moveTranscripts(const std::string originDirectory, while(LLFile::isfile(backupFileName)) { ++backupFileCount; - backupFileName = newFullPath + ".backup" + boost::lexical_cast<std::string>(backupFileCount); + backupFileName = newFullPath + ".backup" + std::to_string(backupFileCount); } //Rename the file to its backup name so it is not overwritten @@ -780,7 +779,7 @@ void LLLogChat::deleteTranscripts() getListOfTranscriptFiles(list_of_transcriptions); getListOfTranscriptBackupFiles(list_of_transcriptions); - BOOST_FOREACH(const std::string& fullpath, list_of_transcriptions) + for (const std::string& fullpath : list_of_transcriptions) { S32 retry_count = 0; while (retry_count < 5) diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h index 2e9aab7c00..74d6890d1d 100644 --- a/indra/newview/lllogininstance.h +++ b/indra/newview/lllogininstance.h @@ -90,7 +90,7 @@ private: void attemptComplete() { mAttemptComplete = true; } // In the future an event? - boost::scoped_ptr<LLLogin> mLoginModule; + std::unique_ptr<LLLogin> mLoginModule; LLNotificationsInterface* mNotifications; std::string mLoginState; diff --git a/indra/newview/llmachineid.cpp b/indra/newview/llmachineid.cpp index 583742f970..1f4418f119 100644 --- a/indra/newview/llmachineid.cpp +++ b/indra/newview/llmachineid.cpp @@ -85,11 +85,11 @@ void LLWMIMethods::initCOMObjects() // Step 1: -------------------------------------------------- // Initialize COM. ------------------------------------------ - mHR = CoInitializeEx(0, COINIT_MULTITHREADED); + mHR = CoInitializeEx(0, COINIT_APARTMENTTHREADED); if (FAILED(mHR)) { + // if result S_FALSE, it's already initialized LL_DEBUGS("AppInit") << "Failed to initialize COM library. Error code = 0x" << std::hex << mHR << LL_ENDL; - return; } // Step 2: -------------------------------------------------- diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 2c98ba3d42..1f29058474 100644 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -609,27 +609,17 @@ private: static void onIdleProcessQueue(void *userdata); // doesn't hold just marketplace related ids - static std::set<LLUUID> sAddQueue; static std::set<LLUUID> sStructureQueue; static bool sProcessingQueue; }; -std::set<LLUUID> LLMarketplaceInventoryObserver::sAddQueue; std::set<LLUUID> LLMarketplaceInventoryObserver::sStructureQueue; bool LLMarketplaceInventoryObserver::sProcessingQueue = false; void LLMarketplaceInventoryObserver::changed(U32 mask) { - if (mask & LLInventoryObserver::ADD && LLMarketplaceData::instance().hasValidationWaiting()) - { - // When things are added to the marketplace, we might need to re-validate and fix the containing listings - // just add whole list even if it contains items and non-marketplace folders - const std::set<LLUUID>& changed_items = gInventory.getChangedIDs(); - sAddQueue.insert(changed_items.begin(), changed_items.end()); - } - - if (mask & (LLInventoryObserver::INTERNAL | LLInventoryObserver::STRUCTURE)) - { + if (mask & (LLInventoryObserver::INTERNAL | LLInventoryObserver::STRUCTURE)) + { // When things are changed in the inventory, this can trigger a host of changes in the marketplace listings folder: // * stock counts changing : no copy items coming in and out will change the stock count on folders // * version and listing folders : moving those might invalidate the marketplace data itself @@ -639,7 +629,7 @@ void LLMarketplaceInventoryObserver::changed(U32 mask) sStructureQueue.insert(changed_items.begin(), changed_items.end()); } - if (!sProcessingQueue && (!sAddQueue.empty() || !sStructureQueue.empty())) + if (!sProcessingQueue && !sStructureQueue.empty()) { gIdleCallbacks.addFunction(onIdleProcessQueue, NULL); // can do without sProcessingQueue, but it's usufull for simplicity and reliability @@ -653,40 +643,6 @@ void LLMarketplaceInventoryObserver::onIdleProcessQueue(void *userdata) const U64 MAX_PROCESSING_TIME = 1000; U64 stop_time = start_time + MAX_PROCESSING_TIME; - if (!sAddQueue.empty()) - { - // Make a copy of sAddQueue since decrementValidationWaiting - // can theoretically add more items - std::set<LLUUID> add_queue(sAddQueue); - sAddQueue.clear(); - - std::set<LLUUID>::const_iterator id_it = add_queue.begin(); - std::set<LLUUID>::const_iterator id_end = add_queue.end(); - // First, count the number of items in this list... - S32 count = 0; - for (; id_it != id_end; ++id_it) - { - LLInventoryObject* obj = gInventory.getObject(*id_it); - if (obj && (LLAssetType::AT_CATEGORY != obj->getType())) - { - count++; - } - } - // Then, decrement the folders of that amount - // Note that of all of those, only one folder will be a listing folder (if at all). - // The other will be ignored by the decrement method. - id_it = add_queue.begin(); - for (; id_it != id_end; ++id_it) - { - LLInventoryObject* obj = gInventory.getObject(*id_it); - if (obj && (LLAssetType::AT_CATEGORY == obj->getType())) - { - // can trigger notifyObservers - LLMarketplaceData::instance().decrementValidationWaiting(obj->getUUID(), count); - } - } - } - while (!sStructureQueue.empty() && LLTimer::getTotalTime() < stop_time) { std::set<LLUUID>::const_iterator id_it = sStructureQueue.begin(); @@ -720,7 +676,7 @@ void LLMarketplaceInventoryObserver::onIdleProcessQueue(void *userdata) sStructureQueue.erase(id_it); } - if (LLApp::isExiting() || (sAddQueue.empty() && sStructureQueue.empty())) + if (LLApp::isExiting() || sStructureQueue.empty()) { // Nothing to do anymore gIdleCallbacks.deleteFunction(onIdleProcessQueue, NULL); diff --git a/indra/newview/llmarketplacenotifications.cpp b/indra/newview/llmarketplacenotifications.cpp index 0886f9a990..02bd9e1f34 100644 --- a/indra/newview/llmarketplacenotifications.cpp +++ b/indra/newview/llmarketplacenotifications.cpp @@ -33,7 +33,6 @@ #include "llerror.h" -#include <boost/foreach.hpp> #include <boost/signals2.hpp> @@ -54,7 +53,7 @@ namespace LLMarketplaceInventoryNotifications llassert(!no_copy_payloads.empty()); llassert(no_copy_cb_action != NULL); - BOOST_FOREACH(const LLSD& payload, no_copy_payloads) + for (const LLSD& payload : no_copy_payloads) { (*no_copy_cb_action)(payload); } diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 06876d84df..98d2a6d375 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -2658,7 +2658,7 @@ const std::string LLMaterialEditor::getImageNameFromUri(std::string image_uri, c } // uri doesn't include the type at all - if (name_includes_type == false) + if (!name_includes_type) { // uri doesn't include the type and the uri is not empty // so we can include everything diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 3b59b2f05e..577ab0048f 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -68,7 +68,7 @@ class LLMaterialHttpHandler : public LLHttpSDHandler { public: typedef boost::function<void(bool, const LLSD&)> CallbackFunction; - typedef boost::shared_ptr<LLMaterialHttpHandler> ptr_t; + typedef std::shared_ptr<LLMaterialHttpHandler> ptr_t; LLMaterialHttpHandler(const std::string& method, CallbackFunction cback); diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 72fbab406b..5461f98624 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -633,7 +633,7 @@ void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type, bool cl void LLMediaCtrl::navigateToLocalPage( const std::string& subdir, const std::string& filename_in ) { std::string filename(gDirUtilp->add(subdir, filename_in)); - std::string expanded_filename = gDirUtilp->findSkinnedFilename(LLDir::HTML, filename); + std::string expanded_filename = gDirUtilp->findSkinnedFilename("html", filename); if (expanded_filename.empty()) { diff --git a/indra/newview/llmediadataclient.h b/indra/newview/llmediadataclient.h index cd45825c77..8c4b3cff90 100644 --- a/indra/newview/llmediadataclient.h +++ b/indra/newview/llmediadataclient.h @@ -116,10 +116,10 @@ protected: // Request (pure virtual base class for requests in the queue) class Request: - public boost::enable_shared_from_this<Request> + public std::enable_shared_from_this<Request> { public: - typedef boost::shared_ptr<Request> ptr_t; + typedef std::shared_ptr<Request> ptr_t; // Subclasses must implement this to build a payload for their request type. virtual LLSD getPayload() const = 0; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 6ec69268d0..9a2f47cc8d 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -411,7 +411,7 @@ namespace { static S32 dump_num = 0; std::string make_dump_name(std::string prefix, S32 num) { - return prefix + boost::lexical_cast<std::string>(num) + std::string(".xml"); + return prefix + std::to_string(num) + std::string(".xml"); } void dump_llsd_to_file(const LLSD& content, std::string filename); LLSD llsd_from_file(std::string filename); @@ -572,10 +572,10 @@ S32 LLMeshRepoThread::sRequestWaterLevel = 0; // LLMeshUploadThread class LLMeshHandlerBase : public LLCore::HttpHandler, - public boost::enable_shared_from_this<LLMeshHandlerBase> + public std::enable_shared_from_this<LLMeshHandlerBase> { public: - typedef boost::shared_ptr<LLMeshHandlerBase> ptr_t; + typedef std::shared_ptr<LLMeshHandlerBase> ptr_t; LOG_CLASS(LLMeshHandlerBase); LLMeshHandlerBase(U32 offset, U32 requested_bytes) @@ -1355,7 +1355,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry) { //check cache for mesh skin info LLFileSystem file(mesh_id, LLAssetType::AT_MESH); - if (file.getSize() >= offset+size) + if (file.getSize() >= offset + size) { U8* buffer = new(std::nothrow) U8[size]; if (!buffer) @@ -1372,7 +1372,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry) bool zero = true; for (S32 i = 0; i < llmin(size, 1024) && zero; ++i) { - zero = buffer[i] > 0 ? false : true; + zero = buffer[i] == 0; } if (!zero) @@ -1486,7 +1486,7 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) bool zero = true; for (S32 i = 0; i < llmin(size, 1024) && zero; ++i) { - zero = buffer[i] > 0 ? false : true; + zero = buffer[i] == 0; } if (!zero) @@ -1584,7 +1584,7 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) bool zero = true; for (S32 i = 0; i < llmin(size, 1024) && zero; ++i) { - zero = buffer[i] > 0 ? false : true; + zero = buffer[i] == 0; } if (!zero) @@ -1784,7 +1784,7 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, bool zero = true; for (S32 i = 0; i < llmin(size, 1024) && zero; ++i) { - zero = buffer[i] > 0 ? false : true; + zero = buffer[i] == 0; } if (!zero) diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index d5636980b0..c94f87bddc 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -68,6 +68,8 @@ #include "lltabcontainer.h" #include "lltextbox.h" +#include <filesystem> + #include <boost/algorithm/string.hpp> bool LLModelPreview::sIgnoreLoadedCallback = false; @@ -220,6 +222,16 @@ LLModelPreview::~LLModelPreview() mPreviewAvatar->markDead(); mPreviewAvatar = NULL; } + + mUploadData.clear(); + mTextureSet.clear(); + + for (U32 i = 0; i < LLModel::NUM_LODS; i++) + { + clearModel(i); + } + mBaseModel.clear(); + mBaseScene.clear(); } void LLModelPreview::updateDimentionsAndOffsets() @@ -1057,6 +1069,29 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) { //only replace given LoD mModel[loaded_lod] = mModelLoader->mModelList; mScene[loaded_lod] = mModelLoader->mScene; + + // Duplicate the model if it is an internal bounding box model + if (loaded_lod == LLModel::LOD_PHYSICS && + mBaseModel.size() > 1 && // This makes sense for multiple models only + mModelLoader->mModelList.size() == 1 && // Just on the off-chance + mModelLoader->mScene.size() == 1 && // Just on the off-chance + std::filesystem::path(mModelLoader->mFilename).filename() == "cube.dae") + { + // Create a copy of the just loaded model for each model in mBaseModel + const LLModel* origin = mModelLoader->mModelList.front(); + const LLModelInstance& mi = mModelLoader->mScene.begin()->second.front(); + for (U32 i = 1; i < mBaseModel.size(); ++i) + { + LLPointer<LLModel> copy(new LLModel(origin->getParams(), origin->getDetail())); + copy->mLabel = origin->mLabel; + copy->copyVolumeFaces(origin); + copy->mPosition = origin->mPosition; + copy->mMaterialList = origin->mMaterialList; + mModel[loaded_lod].push_back(copy); + mScene[loaded_lod][mi.mTransform].push_back(LLModelInstance(copy, copy->mLabel, mi.mTransform, mi.mMaterial)); + } + } + mVertexBuffer[loaded_lod].clear(); setPreviewLOD(loaded_lod); @@ -1153,6 +1188,17 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod) LLFloaterModelPreview::addStringToLog(out, false); } mModel[loaded_lod][idx]->mLabel = name; + // Rename the correspondent instance as well + [&]() + { + for (auto& p : mScene[loaded_lod]) + for (auto& i : p.second) + if (i.mModel == mModel[loaded_lod][idx]) + { + i.mLabel = name; + return; + } + }(); } } } diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index 43b0ae785e..c4876ba8c4 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -310,7 +310,6 @@ protected: vv_LLVolumeFace_t mBaseModelFacesCopy; U32 mGroup; - std::map<LLPointer<LLModel>, U32> mObject; // Amount of triangles in original(base) model U32 mMaxTriangleLimit; diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 01a1361ceb..739144a377 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -60,11 +60,9 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification) LLUUID from_id = notification->getPayload()["from_id"]; LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id); - LLFloaterIMSession* im_floater = LLFloaterReg::findTypedInstance<LLFloaterIMSession>("impanel", session_id); - - if (im_floater != NULL) + if (LLFloaterIMSession* im_floater = LLFloaterReg::findTypedInstance<LLFloaterIMSession>("impanel", session_id)) { - res = im_floater->getVisible() == true; + res = im_floater->getVisible(); } return res; diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 79a90c4f4c..75edac105a 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -594,7 +594,7 @@ LLSystemNotificationListItem::LLSystemNotificationListItem(const Params& p) mSystemNotificationIcon(NULL), mIsCaution(false) { - buildFromFile("panel_notification_list_item.xml", true); + buildFromFile("panel_notification_list_item.xml"); mIsCaution = p.notification_priority >= NOTIFICATION_PRIORITY_HIGH; if (mIsCaution) { diff --git a/indra/newview/llnotificationmanager.cpp b/indra/newview/llnotificationmanager.cpp index b06131cf38..3f6a86106a 100644 --- a/indra/newview/llnotificationmanager.cpp +++ b/indra/newview/llnotificationmanager.cpp @@ -34,9 +34,6 @@ #include "llfloaterimnearbychathandler.h" #include "llnotifications.h" -#include <boost/bind.hpp> -#include <boost/foreach.hpp> - using namespace LLNotificationsUI; //-------------------------------------------------------------------------- @@ -53,15 +50,15 @@ LLNotificationManager::~LLNotificationManager() //-------------------------------------------------------------------------- void LLNotificationManager::init() { - mChannels.push_back(new LLScriptHandler()); - mChannels.push_back(new LLTipHandler()); - mChannels.push_back(new LLGroupHandler()); - mChannels.push_back(new LLAlertHandler("Alerts", "alert", false)); - mChannels.push_back(new LLAlertHandler("AlertModal", "alertmodal", true)); - mChannels.push_back(new LLOfferHandler()); - mChannels.push_back(new LLHintHandler()); - mChannels.push_back(new LLBrowserNotification()); - mChannels.push_back(new LLIMHandler()); + mChannels.emplace_back(new LLScriptHandler()); + mChannels.emplace_back(new LLTipHandler()); + mChannels.emplace_back(new LLGroupHandler()); + mChannels.emplace_back(new LLAlertHandler("Alerts", "alert", false)); + mChannels.emplace_back(new LLAlertHandler("AlertModal", "alertmodal", true)); + mChannels.emplace_back(new LLOfferHandler()); + mChannels.emplace_back(new LLHintHandler()); + mChannels.emplace_back(new LLBrowserNotification()); + mChannels.emplace_back(new LLIMHandler()); mChatHandler = std::shared_ptr<LLFloaterIMNearbyChatHandler>(new LLFloaterIMNearbyChatHandler()); } diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp index 3f22467544..578af50ed8 100644 --- a/indra/newview/llnotificationofferhandler.cpp +++ b/indra/newview/llnotificationofferhandler.cpp @@ -70,20 +70,19 @@ void LLOfferHandler::initChannel() //-------------------------------------------------------------------------- bool LLOfferHandler::processNotification(const LLNotificationPtr& notification, bool should_log) { - if(mChannel.isDead()) + if (mChannel.isDead()) { return false; } // arrange a channel on a screen - if(!mChannel.get()->getVisible()) + if (!mChannel.get()->getVisible()) { initChannel(); } - - if( notification->getPayload().has("give_inventory_notification") - && notification->getPayload()["give_inventory_notification"].asBoolean() == false) + if (notification->getPayload().has("give_inventory_notification") && + !notification->getPayload()["give_inventory_notification"].asBoolean()) { // This is an original inventory offer, so add a script floater LLScriptFloaterManager::instance().onAddNotification(notification->getID()); diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index bd5703ecb5..51ff664913 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -28,8 +28,6 @@ #include "llviewerprecompiledheaders.h" // must be first include #include "lloutfitgallery.h" -#include <boost/foreach.hpp> - // llcommon #include "llcommonutils.h" #include "llfilesystem.h" @@ -1151,22 +1149,13 @@ LLContextMenu* LLOutfitGalleryContextMenu::createMenu() registrar.add("Outfit.Delete", boost::bind(LLOutfitGallery::onRemoveOutfit, selected_id)); registrar.add("Outfit.Create", boost::bind(&LLOutfitGalleryContextMenu::onCreate, this, _2)); registrar.add("Outfit.Thumbnail", boost::bind(&LLOutfitGalleryContextMenu::onThumbnail, this, selected_id)); + registrar.add("Outfit.Save", boost::bind(&LLOutfitGalleryContextMenu::onSave, this, selected_id)); enable_registrar.add("Outfit.OnEnable", boost::bind(&LLOutfitGalleryContextMenu::onEnable, this, _2)); enable_registrar.add("Outfit.OnVisible", boost::bind(&LLOutfitGalleryContextMenu::onVisible, this, _2)); return createFromFile("menu_gallery_outfit_tab.xml"); } -void LLOutfitGalleryContextMenu::onThumbnail(const LLUUID& outfit_cat_id) -{ - LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList); - if (gallery && outfit_cat_id.notNull()) - { - LLSD data(outfit_cat_id); - LLFloaterReg::showInstance("change_item_thumbnail", data); - } -} - void LLOutfitGalleryContextMenu::onCreate(const LLSD& data) { LLWearableType::EType type = LLWearableType::getInstance()->typeNameToType(data.asString()); @@ -1249,7 +1238,7 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id) sub_cat_array, outfit_item_array, LLInventoryModel::EXCLUDE_TRASH); - BOOST_FOREACH(LLViewerInventoryItem* outfit_item, outfit_item_array) + for (LLViewerInventoryItem* outfit_item : outfit_item_array) { LLViewerInventoryItem* linked_item = outfit_item->getLinkedItem(); LLUUID asset_id, inv_id; diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h index badaa8bd19..0b1eacd289 100644 --- a/indra/newview/lloutfitgallery.h +++ b/indra/newview/lloutfitgallery.h @@ -193,17 +193,13 @@ public: friend class LLOutfitGallery; LLOutfitGalleryContextMenu(LLOutfitListBase* outfit_list) - : LLOutfitContextMenu(outfit_list), - mOutfitList(outfit_list){} + : LLOutfitContextMenu(outfit_list){} protected: /* virtual */ LLContextMenu* createMenu(); bool onEnable(LLSD::String param); bool onVisible(LLSD::String param); - void onThumbnail(const LLUUID& outfit_cat_id); void onCreate(const LLSD& data); -private: - LLOutfitListBase* mOutfitList; }; diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 4fe614b0a7..060f10d813 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -37,6 +37,7 @@ #include "llappearancemgr.h" #include "llfloaterreg.h" #include "llfloatersidepanelcontainer.h" +#include "llinspecttexture.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" #include "llmenubutton.h" @@ -62,7 +63,7 @@ bool LLOutfitTabNameComparator::compare(const LLAccordionCtrlTab* tab1, const LL return (LLStringUtil::compareDict(name1, name2) < 0); } -struct outfit_accordion_tab_params : public LLInitParam::Block<outfit_accordion_tab_params, LLAccordionCtrlTab::Params> +struct outfit_accordion_tab_params : public LLInitParam::Block<outfit_accordion_tab_params, LLOutfitAccordionCtrlTab::Params> { Mandatory<LLWearableItemsList::Params> wearable_list; @@ -144,7 +145,8 @@ void LLOutfitsList::updateAddedCategory(LLUUID cat_id) std::string name = cat->getName(); outfit_accordion_tab_params tab_params(get_accordion_tab_params()); - LLAccordionCtrlTab* tab = LLUICtrlFactory::create<LLAccordionCtrlTab>(tab_params); + tab_params.cat_id = cat_id; + LLOutfitAccordionCtrlTab *tab = LLUICtrlFactory::create<LLOutfitAccordionCtrlTab>(tab_params); if (!tab) return; LLWearableItemsList* wearable_list = LLUICtrlFactory::create<LLWearableItemsList>(tab_params.wearable_list); wearable_list->setShape(tab->getLocalRect()); @@ -1059,6 +1061,8 @@ LLContextMenu* LLOutfitContextMenu::createMenu() registrar.add("Outfit.Edit", boost::bind(editOutfit)); registrar.add("Outfit.Rename", boost::bind(renameOutfit, selected_id)); registrar.add("Outfit.Delete", boost::bind(&LLOutfitListBase::removeSelected, mOutfitList)); + registrar.add("Outfit.Thumbnail", boost::bind(&LLOutfitContextMenu::onThumbnail, this, selected_id)); + registrar.add("Outfit.Save", boost::bind(&LLOutfitContextMenu::onSave, this, selected_id)); enable_registrar.add("Outfit.OnEnable", boost::bind(&LLOutfitContextMenu::onEnable, this, _2)); enable_registrar.add("Outfit.OnVisible", boost::bind(&LLOutfitContextMenu::onVisible, this, _2)); @@ -1123,6 +1127,31 @@ void LLOutfitContextMenu::renameOutfit(const LLUUID& outfit_cat_id) LLAppearanceMgr::instance().renameOutfit(outfit_cat_id); } +void LLOutfitContextMenu::onThumbnail(const LLUUID &outfit_cat_id) +{ + if (outfit_cat_id.notNull()) + { + LLSD data(outfit_cat_id); + LLFloaterReg::showInstance("change_item_thumbnail", data); + } +} + +void LLOutfitContextMenu::onSave(const LLUUID &outfit_cat_id) +{ + if (outfit_cat_id.notNull()) + { + LLNotificationsUtil::add("ConfirmOverwriteOutfit", LLSD(), LLSD(), + [outfit_cat_id](const LLSD ¬if, const LLSD &resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + { + LLAppearanceMgr::getInstance()->onOutfitFolderCreated(outfit_cat_id, true); + } + }); + } +} + LLOutfitListGearMenuBase::LLOutfitListGearMenuBase(LLOutfitListBase* olist) : mOutfitList(olist), mMenu(NULL) @@ -1141,6 +1170,7 @@ LLOutfitListGearMenuBase::LLOutfitListGearMenuBase(LLOutfitListBase* olist) registrar.add("Gear.Expand", boost::bind(&LLOutfitListBase::onExpandAllFolders, mOutfitList)); registrar.add("Gear.WearAdd", boost::bind(&LLOutfitListGearMenuBase::onAdd, this)); + registrar.add("Gear.Save", boost::bind(&LLOutfitListGearMenuBase::onSave, this)); registrar.add("Gear.Thumbnail", boost::bind(&LLOutfitListGearMenuBase::onThumbnail, this)); registrar.add("Gear.SortByName", boost::bind(&LLOutfitListGearMenuBase::onChangeSortOrder, this)); @@ -1166,8 +1196,7 @@ void LLOutfitListGearMenuBase::onUpdateItemsVisibility() if (!mMenu) return; bool have_selection = getSelectedOutfitID().notNull(); - mMenu->setItemVisible("sepatator1", have_selection); - mMenu->setItemVisible("sepatator2", have_selection); + mMenu->setItemVisible("wear_separator", have_selection); mMenu->arrangeAndClear(); // update menu height } @@ -1212,6 +1241,20 @@ void LLOutfitListGearMenuBase::onAdd() } } +void LLOutfitListGearMenuBase::onSave() +{ + const LLUUID &selected_id = getSelectedOutfitID(); + LLNotificationsUtil::add("ConfirmOverwriteOutfit", LLSD(), LLSD(), + [selected_id](const LLSD ¬if, const LLSD &resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + { + LLAppearanceMgr::getInstance()->onOutfitFolderCreated(selected_id, true); + } + }); +} + void LLOutfitListGearMenuBase::onTakeOff() { // Take off selected outfit. @@ -1265,15 +1308,6 @@ bool LLOutfitListGearMenuBase::onVisible(LLSD::String param) return false; } - // *TODO This condition leads to menu item behavior inconsistent with - // "Wear" button behavior and should be modified or removed. - bool is_worn = LLAppearanceMgr::instance().getBaseOutfitUUID() == selected_outfit_id; - - if ("wear" == param) - { - return !is_worn; - } - return true; } @@ -1301,10 +1335,30 @@ void LLOutfitListGearMenu::onUpdateItemsVisibility() if (!mMenu) return; mMenu->setItemVisible("expand", true); mMenu->setItemVisible("collapse", true); - mMenu->setItemVisible("thumbnail", false); // Never visible? + mMenu->setItemVisible("thumbnail", getSelectedOutfitID().notNull()); mMenu->setItemVisible("sepatator3", false); mMenu->setItemVisible("sort_folders_by_name", false); LLOutfitListGearMenuBase::onUpdateItemsVisibility(); } +bool LLOutfitAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) +{ + if (y >= getLocalRect().getHeight() - getHeaderHeight()) + { + LLSD params; + params["inv_type"] = LLInventoryType::IT_CATEGORY; + params["thumbnail_id"] = gInventory.getCategory(mFolderID)->getThumbnailUUID(); + params["item_id"] = mFolderID; + + LLToolTipMgr::instance().show(LLToolTip::Params() + .message(getToolTip()) + .sticky_rect(calcScreenRect()) + .delay_time(LLView::getTooltipTimeout()) + .create_callback(boost::bind(&LLInspectTextureUtil::createInventoryToolTip, _1)) + .create_params(params)); + return true; + } + + return LLAccordionCtrlTab::handleToolTip(x, y, mask); +} // EOF diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index 5bd5b0329c..30aa9d9cdf 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -31,6 +31,7 @@ #include "llpanel.h" // newview +#include "llaccordionctrltab.h" #include "llinventorymodel.h" #include "lllistcontextmenu.h" #include "llpanelappearancetab.h" @@ -159,6 +160,9 @@ protected: static void renameOutfit(const LLUUID& outfit_cat_id); + void onThumbnail(const LLUUID &outfit_cat_id); + void onSave(const LLUUID &outfit_cat_id); + private: LLOutfitListBase* mOutfitList; }; @@ -190,6 +194,7 @@ private: void onAdd(); void onTakeOff(); void onRename(); + void onSave(); void onCreate(const LLSD& data); bool onEnable(LLSD::String param); bool onVisible(LLSD::String param); @@ -205,7 +210,27 @@ protected: /*virtual*/ void onUpdateItemsVisibility(); }; -/** +class LLOutfitAccordionCtrlTab : public LLAccordionCtrlTab +{ +public: + struct Params : public LLInitParam::Block<Params, LLAccordionCtrlTab::Params> + { + Optional<LLUUID> cat_id; + Params() : cat_id("cat_id") {} + }; + + virtual bool handleToolTip(S32 x, S32 y, MASK mask); + + protected: + LLOutfitAccordionCtrlTab(const LLOutfitAccordionCtrlTab::Params &p) + : LLAccordionCtrlTab(p), + mFolderID(p.cat_id) + {} + friend class LLUICtrlFactory; + + LLUUID mFolderID; +}; + /** * @class LLOutfitsList * * A list of agents's outfits from "My Outfits" inventory category diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 5a4dfd5458..6890469131 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1344,7 +1344,7 @@ void LLPanelEditWearable::updateTypeSpecificControls(LLWearableType::EType type) { // Update avatar height F32 new_size = gAgentAvatarp->mBodySize.mV[VZ]; - if (gSavedSettings.getBOOL("HeightUnits") == false) + if (!gSavedSettings.getBOOL("HeightUnits")) { // convert meters to feet new_size = new_size / ONE_FOOT; @@ -1668,7 +1668,7 @@ public: bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web) { // change height units true for meters and false for feet - bool new_value = (gSavedSettings.getBOOL("HeightUnits") == false) ? true : false; + bool new_value = !gSavedSettings.getBOOL("HeightUnits"); gSavedSettings.setBOOL("HeightUnits", new_value); return true; } diff --git a/indra/newview/llpanelexperiencelisteditor.cpp b/indra/newview/llpanelexperiencelisteditor.cpp index 00015d13c8..4af30ef443 100644 --- a/indra/newview/llpanelexperiencelisteditor.cpp +++ b/indra/newview/llpanelexperiencelisteditor.cpp @@ -40,7 +40,6 @@ #include "lltextbox.h" #include "lltrans.h" #include "llsdutil.h" -#include <boost/foreach.hpp> static LLPanelInjector<LLPanelExperienceListEditor> t_panel_experience_list_editor("panel_experience_list_editor"); @@ -96,7 +95,7 @@ void LLPanelExperienceListEditor::addExperienceIds( const uuid_vec_t& experience void LLPanelExperienceListEditor::setExperienceIds( const LLSD& experience_ids ) { mExperienceIds.clear(); - BOOST_FOREACH(LLSD uuid, llsd::inArray(experience_ids)) + for (LLSD uuid : llsd::inArray(experience_ids)) { // Using insert(range) doesn't work here because the conversion from // LLSD to LLUUID is ambiguous: have to specify asUUID() for each entry. diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 84ee0c326b..cd3cf00b7b 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -1999,7 +1999,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, { LLSelectedTE::getPbrMaterialId(pbr_id, identical_pbr, has_pbr_material, has_faces_without_pbr); - pbr_ctrl->setTentative(identical_pbr ? false : true); + pbr_ctrl->setTentative(!identical_pbr); pbr_ctrl->setEnabled(settable); pbr_ctrl->setImageAssetID(pbr_id); diff --git a/indra/newview/llpanelgroupbulkban.cpp b/indra/newview/llpanelgroupbulkban.cpp index 847a895bb8..e38c8acdaa 100644 --- a/indra/newview/llpanelgroupbulkban.cpp +++ b/indra/newview/llpanelgroupbulkban.cpp @@ -49,8 +49,6 @@ #include "lluictrlfactory.h" #include "llviewerwindow.h" -#include <boost/foreach.hpp> - LLPanelGroupBulkBan::LLPanelGroupBulkBan(const LLUUID& group_id) : LLPanelGroupBulk(group_id) { // Pass on construction of this panel to the control factory. @@ -172,18 +170,17 @@ void LLPanelGroupBulkBan::submit() } if (group_datap) { - BOOST_FOREACH(const LLGroupMgrGroupData::ban_list_t::value_type& group_ban_pair, group_datap->mBanList) + for (const auto& [group_ban_agent_id, group_ban_data] : group_datap->mBanList) { - const LLUUID& group_ban_agent_id = group_ban_pair.first; std::vector<LLUUID>::iterator conflict = std::find(banned_agent_list.begin(), banned_agent_list.end(), group_ban_agent_id); if (conflict != banned_agent_list.end()) { LLAvatarName av_name; LLAvatarNameCache::get(group_ban_agent_id, &av_name); - banned_avatar_names.push_back(av_name); + banned_avatar_names.emplace_back(av_name); banned_agent_list.erase(conflict); - if (banned_agent_list.size() == 0) + if (banned_agent_list.empty()) { break; } diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp index 24b0074bb0..e4022494de 100644 --- a/indra/newview/llpanellandmarkinfo.cpp +++ b/indra/newview/llpanellandmarkinfo.cpp @@ -353,7 +353,7 @@ void LLPanelLandmarkInfo::toggleLandmarkEditMode(bool enabled) mLandmarkTitle->setText(mLandmarkTitleEditor->getText()); } - if (mNotesEditor->getReadOnly() == (enabled == true)) + if (mNotesEditor->getReadOnly() == enabled) { mLandmarkTitle->setVisible(!enabled); mLandmarkTitleEditor->setVisible(enabled); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 97c192d87d..06cfd5b23c 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -1117,7 +1117,7 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data) { LLPanelLogin *self = (LLPanelLogin *)user_data; self->mPasswordModified = true; - if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == false) + if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && !sCapslockDidNotification) { // *TODO: use another way to notify user about enabled caps lock, see EXT-6858 sCapslockDidNotification = true; diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index b6cb6e9600..39ca861026 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -107,7 +107,7 @@ private: static void onPassKey(LLLineEditor* caller, void* user_data); private: - boost::scoped_ptr<LLPanelLoginListener> mListener; + std::unique_ptr<LLPanelLoginListener> mListener; void updateLoginButtons(); void populateUserList(LLPointer<LLCredential> credential); diff --git a/indra/newview/llpanelmediasettingsgeneral.cpp b/indra/newview/llpanelmediasettingsgeneral.cpp index ffbf91b522..db421708ee 100644 --- a/indra/newview/llpanelmediasettingsgeneral.cpp +++ b/indra/newview/llpanelmediasettingsgeneral.cpp @@ -121,7 +121,7 @@ void LLPanelMediaSettingsGeneral::draw() checkHomeUrlPassesWhitelist(); // enable/disable pixel values image entry based on auto scale checkbox - if ( mAutoScale->getValue().asBoolean() == false ) + if (!mAutoScale->getValue().asBoolean()) { getChildView( LLMediaEntry::WIDTH_PIXELS_KEY )->setEnabled( true ); getChildView( LLMediaEntry::HEIGHT_PIXELS_KEY )->setEnabled( true ); @@ -134,10 +134,9 @@ void LLPanelMediaSettingsGeneral::draw() // enable/disable UI based on type of media bool reset_button_is_active = true; - if( mPreviewMedia ) + if (mPreviewMedia) { - LLPluginClassMedia* media_plugin = mPreviewMedia->getMediaPlugin(); - if( media_plugin ) + if (LLPluginClassMedia* media_plugin = mPreviewMedia->getMediaPlugin()) { // turn off volume (if we can) for preview. Note: this really only // works for QuickTime movies right now - no way to control the @@ -147,8 +146,7 @@ void LLPanelMediaSettingsGeneral::draw() // some controls are only appropriate for time or browser type plugins // so we selectively enable/disable them - need to do it in draw // because the information from plugins arrives assynchronously - bool show_time_controls = media_plugin->pluginSupportsMediaTime(); - if ( show_time_controls ) + if (media_plugin->pluginSupportsMediaTime()) { getChildView( LLMediaEntry::CURRENT_URL_KEY )->setEnabled( false ); reset_button_is_active = false; diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index a8553b654e..36605fed7a 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -260,10 +260,16 @@ bool LLPanelNearByMedia::handleRightMouseDown(S32 x, S32 y, MASK mask) S32 x_list, y_list; localPointToOtherView(x, y, &x_list, &y_list, mMediaList); if (mMoreLessBtn->getToggleState() - && mMediaList->pointInView(x_list, y_list) - && mMediaList->selectItemAt(x_list, y_list, mask)) + && mMediaList->pointInView(x_list, y_list)) { - if (mContextMenu) + LLScrollListItem* hit_item = mMediaList->hitItem(x_list, y_list); + bool selected = hit_item && hit_item->getSelected(); + if (!selected) + { + selected = mMediaList->selectItemAt(x_list, y_list, mask); + } + + if (selected && mContextMenu) { mContextMenu->buildDrawLabels(); mContextMenu->updateParent(LLMenuGL::sMenuContainer); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index ac0b5d40a4..b06f41b920 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -1766,30 +1766,39 @@ void LLPanelObject::sendSculpt() LLUUID sculpt_id = LLUUID::null; if (mCtrlSculptTexture) + { sculpt_id = mCtrlSculptTexture->getImageAssetID(); + } U8 sculpt_type = 0; if (mCtrlSculptType) + { sculpt_type |= mCtrlSculptType->getValue().asInteger(); + } bool enabled = sculpt_type != LL_SCULPT_TYPE_MESH; if (mCtrlSculptMirror) { - mCtrlSculptMirror->setEnabled(enabled ? true : false); + mCtrlSculptMirror->setEnabled(enabled); } + if (mCtrlSculptInvert) { - mCtrlSculptInvert->setEnabled(enabled ? true : false); + mCtrlSculptInvert->setEnabled(enabled); } - + if ((mCtrlSculptMirror) && (mCtrlSculptMirror->get())) + { sculpt_type |= LL_SCULPT_FLAG_MIRROR; + } if ((mCtrlSculptInvert) && (mCtrlSculptInvert->get())) + { sculpt_type |= LL_SCULPT_FLAG_INVERT; - + } + sculpt_params.setSculptTexture(sculpt_id, sculpt_type); mObject->setParameterEntry(LLNetworkData::PARAMS_SCULPT, sculpt_params, true); } diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index 3bf374d8fd..157e051923 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -61,6 +61,8 @@ public: void openApearanceTab(const std::string& tab_name); + bool isCOFPanelActive() const; + protected: void updateVerbs(); @@ -72,7 +74,6 @@ private: protected: void initTabPanels(); void onTabChange(); - bool isCOFPanelActive() const; bool isOutfitsListPanelActive() const; bool isOutfitsGalleryPanelActive() const; diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 3a26fb086b..0fc2ad4d6d 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -779,11 +779,11 @@ void LLFloaterProfilePermissions::fillRightsData() { S32 rights = relation->getRightsGrantedTo(); - bool see_online = LLRelationship::GRANT_ONLINE_STATUS & rights ? true : false; + bool see_online = LLRelationship::GRANT_ONLINE_STATUS & rights; mOnlineStatus->setValue(see_online); mMapRights->setEnabled(see_online); - mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? true : false); - mEditObjectRights->setValue(LLRelationship::GRANT_MODIFY_OBJECTS & rights ? true : false); + mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights); + mEditObjectRights->setValue(LLRelationship::GRANT_MODIFY_OBJECTS & rights); } else { @@ -798,7 +798,7 @@ void LLFloaterProfilePermissions::rightsConfirmationCallback(const LLSD& notific S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option != 0) // canceled { - mEditObjectRights->setValue(mEditObjectRights->getValue().asBoolean() ? false : true); + mEditObjectRights->setValue(!mEditObjectRights->getValue().asBoolean()); } else { @@ -824,7 +824,7 @@ void LLFloaterProfilePermissions::onCommitSeeOnlineRights() if (relation) { S32 rights = relation->getRightsGrantedTo(); - mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights ? true : false); + mMapRights->setValue(LLRelationship::GRANT_MAP_LOCATION & rights); } else { diff --git a/indra/newview/llpanelprofileclassifieds.cpp b/indra/newview/llpanelprofileclassifieds.cpp index b0ee96c04b..b39e4fddf1 100644 --- a/indra/newview/llpanelprofileclassifieds.cpp +++ b/indra/newview/llpanelprofileclassifieds.cpp @@ -650,6 +650,8 @@ bool LLPanelProfileClassified::postBuild() mSnapshotCtrl->setOnSelectCallback(boost::bind(&LLPanelProfileClassified::onTextureSelected, this)); mSnapshotCtrl->setMouseEnterCallback(boost::bind(&LLPanelProfileClassified::onTexturePickerMouseEnter, this)); mSnapshotCtrl->setMouseLeaveCallback(boost::bind(&LLPanelProfileClassified::onTexturePickerMouseLeave, this)); + mSnapshotCtrl->setAllowLocalTexture(false); + mSnapshotCtrl->setBakeTextureEnabled(false); mEditIcon->setVisible(false); mMapButton->setCommitCallback(boost::bind(&LLPanelProfileClassified::onMapClick, this)); @@ -667,7 +669,7 @@ bool LLPanelProfileClassified::postBuild() mCategoryCombo->add(LLTrans::getString(iter->second)); } - mClassifiedNameEdit->setKeystrokeCallback(boost::bind(&LLPanelProfileClassified::onChange, this), NULL); + mClassifiedNameEdit->setKeystrokeCallback(boost::bind(&LLPanelProfileClassified::onTitleChange, this), NULL); mClassifiedDescEdit->setKeystrokeCallback(boost::bind(&LLPanelProfileClassified::onChange, this)); mCategoryCombo->setCommitCallback(boost::bind(&LLPanelProfileClassified::onChange, this)); mContentTypeCombo->setCommitCallback(boost::bind(&LLPanelProfileClassified::onChange, this)); @@ -935,6 +937,8 @@ void LLPanelProfileClassified::onCancelClick() } else { + updateTabLabel(mClassifiedNameText->getValue()); + // Reload data to undo changes to forms LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId()); } @@ -955,7 +959,7 @@ void LLPanelProfileClassified::onSaveClick() } if(isNew() || isNewWithErrors()) { - if(gStatusBar->getBalance() < getPriceForListing()) + if(gStatusBar->getBalance() < MINIMUM_PRICE_FOR_LISTING) { LLNotificationsUtil::add("ClassifiedInsufficientFunds"); return; @@ -1403,6 +1407,12 @@ void LLPanelProfileClassified::onChange() enableSave(isDirty()); } +void LLPanelProfileClassified::onTitleChange() +{ + updateTabLabel(getClassifiedName()); + onChange(); +} + void LLPanelProfileClassified::doSave() { //*TODO: Fix all of this @@ -1428,6 +1438,14 @@ void LLPanelProfileClassified::doSave() void LLPanelProfileClassified::onPublishFloaterPublishClicked() { + if (mPublishFloater->getPrice() < MINIMUM_PRICE_FOR_LISTING) + { + LLSD args; + args["MIN_PRICE"] = MINIMUM_PRICE_FOR_LISTING; + LLNotificationsUtil::add("MinClassifiedPrice", args); + return; + } + setPriceForListing(mPublishFloater->getPrice()); doSave(); diff --git a/indra/newview/llpanelprofileclassifieds.h b/indra/newview/llpanelprofileclassifieds.h index da98fb2556..9f0b27139a 100644 --- a/indra/newview/llpanelprofileclassifieds.h +++ b/indra/newview/llpanelprofileclassifieds.h @@ -257,6 +257,7 @@ protected: void onSetLocationClick(); void onChange(); + void onTitleChange(); void onPublishFloaterPublishClicked(); diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp index 05a26a45a1..7a0b4ff1ce 100644 --- a/indra/newview/llpanelprofilepicks.cpp +++ b/indra/newview/llpanelprofilepicks.cpp @@ -488,6 +488,8 @@ LLPanelProfilePick::LLPanelProfilePick() , mLocationChanged(false) , mNewPick(false) , mIsEditing(false) + , mRegionCallbackConnection() + , mParcelCallbackConnection() { } @@ -505,6 +507,15 @@ LLPanelProfilePick::~LLPanelProfilePick() { LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelId, this); } + + if (mRegionCallbackConnection.connected()) + { + mRegionCallbackConnection.disconnect(); + } + if (mParcelCallbackConnection.connected()) + { + mParcelCallbackConnection.disconnect(); + } } void LLPanelProfilePick::setAvatarId(const LLUUID& avatar_id) @@ -579,6 +590,8 @@ bool LLPanelProfilePick::postBuild() mSnapshotCtrl = getChild<LLTextureCtrl>("pick_snapshot"); mSnapshotCtrl->setCommitCallback(boost::bind(&LLPanelProfilePick::onSnapshotChanged, this)); + mSnapshotCtrl->setAllowLocalTexture(false); + mSnapshotCtrl->setBakeTextureEnabled(false); childSetAction("teleport_btn", boost::bind(&LLPanelProfilePick::onClickTeleport, this)); childSetAction("show_on_map_btn", boost::bind(&LLPanelProfilePick::onClickMap, this)); @@ -667,6 +680,7 @@ void LLPanelProfilePick::setSnapshotId(const LLUUID& id) void LLPanelProfilePick::setPickName(const std::string& name) { mPickName->setValue(name); + mPickNameStr = name; } const std::string LLPanelProfilePick::getPickName() @@ -749,6 +763,14 @@ bool LLPanelProfilePick::isDirty() const void LLPanelProfilePick::onClickSave() { + if (mRegionCallbackConnection.connected()) + { + mRegionCallbackConnection.disconnect(); + } + if (mParcelCallbackConnection.connected()) + { + mParcelCallbackConnection.disconnect(); + } sendUpdate(); mLocationChanged = false; @@ -756,6 +778,7 @@ void LLPanelProfilePick::onClickSave() void LLPanelProfilePick::onClickCancel() { + updateTabLabel(mPickNameStr); LLAvatarPropertiesProcessor::getInstance()->sendPickInfoRequest(getAvatarId(), getPickId()); mLocationChanged = false; enableSaveButton(false); diff --git a/indra/newview/llpanelprofilepicks.h b/indra/newview/llpanelprofilepicks.h index 62e626936b..3608d113ed 100644 --- a/indra/newview/llpanelprofilepicks.h +++ b/indra/newview/llpanelprofilepicks.h @@ -140,7 +140,7 @@ public: void setParcelID(const LLUUID& parcel_id) override { mParcelId = parcel_id; } void setErrorStatus(S32 status, const std::string& reason) override {}; -protected: + protected: /** * Sends remote parcel info request to resolve parcel name from its ID. @@ -231,6 +231,10 @@ protected: LLUUID mParcelId; LLUUID mPickId; LLUUID mRequestedId; + std::string mPickNameStr; + + boost::signals2::connection mRegionCallbackConnection; + boost::signals2::connection mParcelCallbackConnection; bool mLocationChanged; bool mNewPick; diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index 65059e4231..5e6e61b6b3 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -949,8 +949,8 @@ void LLTeleportHistoryPanel::onAccordionTabRightClick(LLView *view, S32 x, S32 y mAccordionTabMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>( "menu_teleport_history_tab.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance()); - mAccordionTabMenu->setItemVisible("TabOpen", !tab->isExpanded() ? true : false); - mAccordionTabMenu->setItemVisible("TabClose", tab->isExpanded() ? true : false); + mAccordionTabMenu->setItemVisible("TabOpen", !tab->isExpanded()); + mAccordionTabMenu->setItemVisible("TabClose", tab->isExpanded()); mAccordionTabMenu->show(x, y); LLMenuGL::showPopup(tab, mAccordionTabMenu, x, y); @@ -1067,6 +1067,12 @@ void LLTeleportHistoryPanel::onGearMenuAction(const LLSD& userdata) LLLandmarkActions::getSLURLfromPosGlobal(globalPos, boost::bind(&LLTeleportHistoryPanel::gotSLURLCallback, _1)); } + else if ("remove" == command_name) + { + LLTeleportHistoryStorage::getInstance()->removeItem(index); + LLTeleportHistoryStorage::getInstance()->save(); + showTeleportHistory(); + } } bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const @@ -1121,7 +1127,8 @@ bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const if ("teleport" == command_name || "view" == command_name || "show_on_map" == command_name - || "copy_slurl" == command_name) + || "copy_slurl" == command_name + || "remove" == command_name) { if (!mLastSelectedFlatlList) { diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 5a3ef63edf..4d262fe477 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -1456,7 +1456,7 @@ void LLPanelVolume::setLightTextureID(const LLUUID &asset_id, const LLUUID &item if (item && volobjp->isAttachment()) { const LLPermissions& perm = item->getPermissions(); - bool unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? true : false; + bool unrestricted = (perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED; if (!unrestricted) { // Attachments are in world and in inventory simultaneously, @@ -1468,7 +1468,8 @@ void LLPanelVolume::setLightTextureID(const LLUUID &asset_id, const LLUUID &item if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) { LLToolDragAndDrop::handleDropMaterialProtections(volobjp, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); - } + } + volobjp->setLightTextureID(asset_id); } } diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index a9563c7c17..dc1c749126 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -114,7 +114,7 @@ public: void handleTerrainLinksetsResult(const LLSD &pContent); void handleTerrainLinksetsError(); - typedef boost::shared_ptr<LinksetsResponder> ptr_t; + typedef std::shared_ptr<LinksetsResponder> ptr_t; protected: @@ -139,7 +139,7 @@ private: LLPathfindingObjectPtr mTerrainLinksetPtr; }; -typedef boost::shared_ptr<LinksetsResponder> LinksetsResponderPtr; +typedef std::shared_ptr<LinksetsResponder> LinksetsResponderPtr; //--------------------------------------------------------------------------- // LLPathfindingManager diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index ac781cedcc..13589b603b 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -107,8 +107,8 @@ private: void navMeshStatusRequestCoro(std::string url, U64 regionHandle, bool isGetStatusOnly); void navAgentStateRequestCoro(std::string url); void navMeshRebakeCoro(std::string url, rebake_navmesh_callback_t rebakeNavMeshCallback); - void linksetObjectsCoro(std::string url, boost::shared_ptr<LinksetsResponder> linksetsResponsderPtr, LLSD putData) const; - void linksetTerrainCoro(std::string url, boost::shared_ptr<LinksetsResponder> linksetsResponsderPtr, LLSD putData) const; + void linksetObjectsCoro(std::string url, std::shared_ptr<LinksetsResponder> linksetsResponsderPtr, LLSD putData) const; + void linksetTerrainCoro(std::string url, std::shared_ptr<LinksetsResponder> linksetsResponsderPtr, LLSD putData) const; void charactersCoro(std::string url, request_id_t requestId, object_request_callback_t callback) const; //void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion, bool pIsGetStatusOnly); diff --git a/indra/newview/llpathfindingnavmesh.h b/indra/newview/llpathfindingnavmesh.h index 87f32b8d56..ddc886f01c 100644 --- a/indra/newview/llpathfindingnavmesh.h +++ b/indra/newview/llpathfindingnavmesh.h @@ -39,7 +39,7 @@ class LLPathfindingNavMesh; class LLUUID; -typedef boost::shared_ptr<LLPathfindingNavMesh> LLPathfindingNavMeshPtr; +typedef std::shared_ptr<LLPathfindingNavMesh> LLPathfindingNavMeshPtr; class LLPathfindingNavMesh { diff --git a/indra/newview/llpathfindingnavmeshzone.h b/indra/newview/llpathfindingnavmeshzone.h index baa1cc5979..b76f4421a6 100644 --- a/indra/newview/llpathfindingnavmeshzone.h +++ b/indra/newview/llpathfindingnavmeshzone.h @@ -114,7 +114,7 @@ private: LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot; }; - typedef boost::shared_ptr<NavMeshLocation> NavMeshLocationPtr; + typedef std::shared_ptr<NavMeshLocation> NavMeshLocationPtr; typedef std::vector<NavMeshLocationPtr> NavMeshLocationPtrs; void handleNavMeshLocation(); diff --git a/indra/newview/llpathfindingobject.h b/indra/newview/llpathfindingobject.h index 12dd18f986..4095d05f36 100644 --- a/indra/newview/llpathfindingobject.h +++ b/indra/newview/llpathfindingobject.h @@ -41,7 +41,7 @@ class LLPathfindingObject; class LLSD; -typedef boost::shared_ptr<LLPathfindingObject> LLPathfindingObjectPtr; +typedef std::shared_ptr<LLPathfindingObject> LLPathfindingObjectPtr; class LLPathfindingObject { diff --git a/indra/newview/llpathfindingobjectlist.h b/indra/newview/llpathfindingobjectlist.h index 61580582d3..e2e0dce4da 100644 --- a/indra/newview/llpathfindingobjectlist.h +++ b/indra/newview/llpathfindingobjectlist.h @@ -36,7 +36,7 @@ class LLPathfindingObjectList; -typedef boost::shared_ptr<LLPathfindingObjectList> LLPathfindingObjectListPtr; +typedef std::shared_ptr<LLPathfindingObjectList> LLPathfindingObjectListPtr; typedef std::map<std::string, LLPathfindingObjectPtr> LLPathfindingObjectMap; class LLPathfindingObjectList diff --git a/indra/newview/llperfstats.cpp b/indra/newview/llperfstats.cpp index af407c73f1..93851a4980 100644 --- a/indra/newview/llperfstats.cpp +++ b/indra/newview/llperfstats.cpp @@ -69,7 +69,7 @@ namespace LLPerfStats { assert_main_thread(); // these following variables are proxies for pipeline statics we do not need a two way update (no llviewercontrol handler) - if( tuningFlag & NonImpostors ){ gSavedSettings.setU32("IndirectMaxNonImpostors", nonImpostors); }; + if( tuningFlag & NonImpostors ){ gSavedSettings.setU32("RenderAvatarMaxNonImpostors", nonImpostors); }; if( tuningFlag & ReflectionDetail ){ gSavedSettings.setS32("RenderReflectionDetail", reflectionDetail); }; if( tuningFlag & FarClip ){ gSavedSettings.setF32("RenderFarClip", farClip); }; if( tuningFlag & UserMinDrawDistance ){ gSavedSettings.setF32("AutoTuneRenderFarClipMin", userMinDrawDistance); }; @@ -378,7 +378,7 @@ namespace LLPerfStats auto count = countNearbyAvatars(std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance)); if( count != tunables.nonImpostors ) { - tunables.updateNonImposters( (count < LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER)?count : LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER ); + tunables.updateNonImposters( (count < LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER)?count : 0 ); LL_DEBUGS("AutoTune") << "There are " << count << "avatars within " << std::min(LLPipeline::RenderFarClip, tunables.userImpostorDistance) << "m of the camera" << LL_ENDL; } } @@ -411,7 +411,7 @@ namespace LLPerfStats return; } - if(belowTargetFPS == false) + if (!belowTargetFPS) { // this is the first frame under. hold fire to add a little hysteresis belowTargetFPS = true; @@ -488,7 +488,7 @@ namespace LLPerfStats new_render_limit_ns = std::max((U64)new_render_limit_ns, (U64)LLPerfStats::ART_MINIMUM_NANOS); // assign the new value - if(renderAvatarMaxART_ns != new_render_limit_ns) + if (renderAvatarMaxART_ns != new_render_limit_ns) { renderAvatarMaxART_ns = new_render_limit_ns; tunables.updateSettingsFromRenderCostLimit(); @@ -497,10 +497,10 @@ namespace LLPerfStats } // LL_DEBUGS() << "AUTO_TUNE: Target frame time:"<< LLPerfStats::raw_to_us(target_frame_time_raw) << "usecs (non_avatar is " << LLPerfStats::raw_to_us(non_avatar_time_raw) << "usecs) Max cost limited=" << renderAvatarMaxART_ns << LL_ENDL; } - else if(( LLPerfStats::raw_to_ns(target_frame_time_raw) > (LLPerfStats::raw_to_ns(tot_frame_time_raw) + renderAvatarMaxART_ns) ) || + else if ((LLPerfStats::raw_to_ns(target_frame_time_raw) > (LLPerfStats::raw_to_ns(tot_frame_time_raw) + renderAvatarMaxART_ns)) || (tunables.vsyncEnabled && (target_fps == LLPerfStats::vsync_max_fps) && (target_frame_time_raw > getMeanTotalFrameTime()))) { - if(belowTargetFPS == true) + if (belowTargetFPS) { // we reached target, force a pause lastGlobalPrefChange = gFrameCount; @@ -508,15 +508,17 @@ namespace LLPerfStats } // once we're over the FPS target we slow down further - if((gFrameCount - lastGlobalPrefChange) > settingsChangeFrequency*3) + if ((gFrameCount - lastGlobalPrefChange) > settingsChangeFrequency * 3) { - if(!tunables.userAutoTuneLock) + if (!tunables.userAutoTuneLock) { // we've reached the target and stayed long enough to consider stable. // turn off if we are not locked. tunables.updateUserAutoTuneEnabled(false); } - if(renderAvatarMaxART_ns != 0 && LLPerfStats::tunedAvatars > 0 && (tunables.userFPSTuningStrategy != TUNE_SCENE_ONLY) ) + if (renderAvatarMaxART_ns > 0 && + LLPerfStats::tunedAvatars > 0 && + tunables.userFPSTuningStrategy != TUNE_SCENE_ONLY) { // if we have more time to spare let's shift up little in the hope we'll restore an avatar. U64 up_step = LLPerfStats::tunedAvatars > 2 ? LLPerfStats::ART_MIN_ADJUST_UP_NANOS : LLPerfStats::ART_MIN_ADJUST_UP_NANOS * 2; @@ -524,15 +526,15 @@ namespace LLPerfStats tunables.updateSettingsFromRenderCostLimit(); return; } - if(tunables.userFPSTuningStrategy != TUNE_AVATARS_ONLY) + if (tunables.userFPSTuningStrategy != TUNE_AVATARS_ONLY) { - if( LLPipeline::RenderFarClip < tunables.userTargetDrawDistance ) + if (LLPipeline::RenderFarClip < tunables.userTargetDrawDistance) { LLPerfStats::tunables.updateFarClip( std::min(LLPipeline::RenderFarClip + DD_STEP, tunables.userTargetDrawDistance) ); LLPerfStats::lastGlobalPrefChange = gFrameCount; return; } - if( (tot_frame_time_raw * 1.5) < target_frame_time_raw ) + if ((tot_frame_time_raw * 1.5) < target_frame_time_raw) { // if everything else is "max" and we have >50% headroom let's knock the water quality up a notch at a time. # if 0 // RenderReflectionDetail went away diff --git a/indra/newview/llphysicsshapebuilderutil.h b/indra/newview/llphysicsshapebuilderutil.h index b3b100296f..7dbc577562 100644 --- a/indra/newview/llphysicsshapebuilderutil.h +++ b/indra/newview/llphysicsshapebuilderutil.h @@ -73,7 +73,8 @@ public: { return LLVolumeParams::operator<(params); } - return (params.mForceConvex == false) && (mForceConvex == true); + + return !params.mForceConvex && mForceConvex; } bool shouldForceConvex() const { return mForceConvex; } diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp index a67dc37dc9..ccb2feac10 100644 --- a/indra/newview/llplacesinventorypanel.cpp +++ b/indra/newview/llplacesinventorypanel.cpp @@ -120,3 +120,13 @@ S32 LLPlacesInventoryPanel::notify(const LLSD& info) } return 0; } + +bool LLPlacesInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, + EAcceptance *accept, std::string &tooltip_msg) +{ + if (mAcceptsDragAndDrop) + { + return LLInventoryPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + } + return false; +} diff --git a/indra/newview/llplacesinventorypanel.h b/indra/newview/llplacesinventorypanel.h index 3c27964ec5..0f6aa03e0d 100644 --- a/indra/newview/llplacesinventorypanel.h +++ b/indra/newview/llplacesinventorypanel.h @@ -47,11 +47,14 @@ public: LLPlacesInventoryPanel(const Params& p); ~LLPlacesInventoryPanel(); - LLFolderView * createFolderRoot(LLUUID root_id ); + LLFolderView * createFolderRoot(LLUUID root_id ) override; void saveFolderState(); void restoreFolderState(); - virtual S32 notify(const LLSD& info) ; + virtual S32 notify(const LLSD& info) override; + + bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, + EAcceptance *accept, std::string &tooltip_msg) override; private: LLSaveFolderState* mSavedFolderState; diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 1f66db92d5..05faf17bdc 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -616,10 +616,9 @@ void LLPreviewGesture::refresh() LLPreview::refresh(); // If previewing or item is incomplete, all controls are disabled LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem(); - bool is_complete = (item && item->isFinished()) ? true : false; + bool is_complete = item && item->isFinished(); if (mPreviewGesture || !is_complete) { - getChildView("desc")->setEnabled(false); //mDescEditor->setEnabled(false); mTriggerEditor->setEnabled(false); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 151252fb2d..4be3f6c742 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -2309,7 +2309,6 @@ LLLiveLSLSaveData::LLLiveLSLSaveData(const LLUUID& id, mItem = new LLViewerInventoryItem(item); } - /*static*/ void LLLiveLSLEditor::finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response, bool isRunning) { @@ -2333,15 +2332,13 @@ void LLLiveLSLEditor::finishLSLUpload(LLUUID itemId, LLUUID taskId, LLUUID newAs preview->callbackLSLCompileFailed(response["errors"]); } } - } - // virtual void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) { LLViewerObject* object = gObjectList.findObject(mObjectUUID); - if(!object) + if (!object) { LLNotificationsUtil::add("SaveScriptFailObjectNotFound"); return; @@ -2366,7 +2363,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) } // Don't need to save if we're pristine - if(!mScriptEd->hasChanged()) + if (!mScriptEd->hasChanged()) { return; } @@ -2383,6 +2380,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) { mScriptEd->sync(); } + bool isRunning = getChild<LLCheckBoxCtrl>("running")->get(); getWindow()->incBusyCount(); mPendingUploads++; @@ -2409,14 +2407,14 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) bool LLLiveLSLEditor::canClose() { - return (mScriptEd->canClose()); + return mScriptEd->canClose(); } void LLLiveLSLEditor::closeIfNeeded() { getWindow()->decBusyCount(); mPendingUploads--; - if (mPendingUploads <= 0 && mCloseAfterSave) + if ((mPendingUploads <= 0) && mCloseAfterSave) { closeFloater(); } @@ -2432,8 +2430,7 @@ void LLLiveLSLEditor::onLoad(void* userdata) // static void LLLiveLSLEditor::onSave(void* userdata, bool close_after_save) { - LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata; - if(self) + if (LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata) { self->mCloseAfterSave = close_after_save; self->mScriptEd->mErrorList->setCommentText(""); @@ -2441,7 +2438,6 @@ void LLLiveLSLEditor::onSave(void* userdata, bool close_after_save) } } - // static void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) { @@ -2453,8 +2449,7 @@ void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) LLSD floater_key; floater_key["taskid"] = object_id; floater_key["itemid"] = item_id; - LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key); - if(instance) + if (LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", floater_key)) { instance->mHaveRunningInfo = true; bool running; @@ -2469,7 +2464,6 @@ void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**) } } - void LLLiveLSLEditor::onMonoCheckboxClicked(LLUICtrl*, void* userdata) { LLLiveLSLEditor* self = static_cast<LLLiveLSLEditor*>(userdata); @@ -2479,20 +2473,15 @@ void LLLiveLSLEditor::onMonoCheckboxClicked(LLUICtrl*, void* userdata) bool LLLiveLSLEditor::monoChecked() const { - if(NULL != mMonoCheckbox) - { - return mMonoCheckbox->getValue()? true : false; - } - return false; + return mMonoCheckbox && mMonoCheckbox->getValue(); } void LLLiveLSLEditor::setAssociatedExperience( LLHandle<LLLiveLSLEditor> editor, const LLSD& experience ) { - LLLiveLSLEditor* scriptEd = editor.get(); - if(scriptEd) + if (LLLiveLSLEditor* scriptEd = editor.get()) { LLUUID id; - if(experience.has(LLExperienceCache::EXPERIENCE_ID)) + if (experience.has(LLExperienceCache::EXPERIENCE_ID)) { id=experience[LLExperienceCache::EXPERIENCE_ID].asUUID(); } diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 039e9b2797..91b8f0496e 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -67,6 +67,7 @@ const F32 PREVIEW_TEXTURE_MIN_ASPECT = 0.005f; LLPreviewTexture::LLPreviewTexture(const LLSD& key) : LLPreview(key), mLoadingFullImage( false ), + mSavingMultiple(false), mShowKeepDiscard(false), mCopyToInv(false), mIsCopyable(false), @@ -310,9 +311,12 @@ void LLPreviewTexture::saveTextureToFile(const std::vector<std::string>& filenam // remember the user-approved/edited file name. mSaveFileName = filenames[0]; + mSavingMultiple = false; mLoadingFullImage = true; getWindow()->incBusyCount(); + LL_DEBUGS("FileSaveAs") << "Scheduling saving file to " << mSaveFileName << LL_ENDL; + mImage->forceToSaveRawImage(0);//re-fetch the raw image if the old one is removed. mImage->setLoadedCallback(LLPreviewTexture::onFileLoadedForSave, 0, true, false, new LLUUID(mItemUUID), &mCallbackTextureList); @@ -322,35 +326,16 @@ void LLPreviewTexture::saveTextureToFile(const std::vector<std::string>& filenam void LLPreviewTexture::saveMultipleToFile(const std::string& file_name) { std::string texture_location(gSavedSettings.getString("TextureSaveLocation")); - std::string texture_name = file_name.empty() ? getItem()->getName() : file_name; - - std::string filepath; - S32 i = 0; - S32 err = 0; - std::string extension(".png"); - do - { - filepath = texture_location; - filepath += gDirUtilp->getDirDelimiter(); - filepath += texture_name; - - if (i != 0) - { - filepath += llformat("_%.3d", i); - } + std::string texture_name = LLDir::getScrubbedFileName(file_name.empty() ? getItem()->getName() : file_name); - filepath += extension; + mSaveFileName = texture_location + gDirUtilp->getDirDelimiter() + texture_name + ".png"; - llstat stat_info; - err = LLFile::stat( filepath, &stat_info ); - i++; - } while (-1 != err); // Search until the file is not found (i.e., stat() gives an error). - - - mSaveFileName = filepath; + mSavingMultiple = true; mLoadingFullImage = true; getWindow()->incBusyCount(); + LL_DEBUGS("FileSaveAs") << "Scheduling saving file to " << mSaveFileName << LL_ENDL; + mImage->forceToSaveRawImage(0);//re-fetch the raw image if the old one is removed. mImage->setLoadedCallback(LLPreviewTexture::onFileLoadedForSave, 0, true, false, new LLUUID(mItemUUID), &mCallbackTextureList); @@ -451,8 +436,39 @@ void LLPreviewTexture::onFileLoadedForSave(bool success, if( self && final && success ) { + LL_DEBUGS("FileSaveAs") << "Saving file to " << self->mSaveFileName << LL_ENDL; const U32 ext_length = 3; std::string extension = self->mSaveFileName.substr( self->mSaveFileName.length() - ext_length); + + std::string filepath; + if (self->mSavingMultiple) + { + std::string part_path = self->mSaveFileName.substr(0, self->mSaveFileName.length() - ext_length - 1); + + S32 i = 0; + S32 err = 0; + do + { + filepath = part_path; + + if (i != 0) + { + filepath += llformat("_%.3d", i); + } + + filepath += "."; + filepath += extension; + + llstat stat_info; + err = LLFile::stat(filepath, &stat_info); + i++; + } while (-1 != err); // Search until the file is not found (i.e., stat() gives an error). + } + else + { + filepath = self->mSaveFileName; + } + LLStringUtil::toLower(extension); // We only support saving in PNG or TGA format LLPointer<LLImageFormatted> image; @@ -468,13 +484,13 @@ void LLPreviewTexture::onFileLoadedForSave(bool success, if( image && !image->encode( src, 0 ) ) { LLSD args; - args["FILE"] = self->mSaveFileName; + args["FILE"] = filepath; LLNotificationsUtil::add("CannotEncodeFile", args); } - else if( image && !image->save( self->mSaveFileName ) ) + else if( image && !image->save(filepath) ) { LLSD args; - args["FILE"] = self->mSaveFileName; + args["FILE"] = filepath; LLNotificationsUtil::add("CannotWriteFile", args); } else @@ -482,6 +498,7 @@ void LLPreviewTexture::onFileLoadedForSave(bool success, self->mSavedFileTimer.reset(); self->mSavedFileTimer.setTimerExpirySec( SECONDS_TO_SHOW_FILE_SAVED_MSG ); } + LL_DEBUGS("FileSaveAs") << "Done saving file to " << filepath << LL_ENDL; self->mSaveFileName.clear(); } @@ -653,7 +670,7 @@ void LLPreviewTexture::adjustAspectRatio() { // No existing ratio found, create an element that will show image at original ratio populateRatioList(); // makes sure previous custom ratio is cleared - std::string ratio = boost::lexical_cast<std::string>(num)+":" + boost::lexical_cast<std::string>(denom); + std::string ratio = std::to_string(num)+":" + std::to_string(denom); mRatiosList.push_back(ratio); combo->add(ratio); combo->setCurrentByIndex(mRatiosList.size()- 1); diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index fdc6dddb38..e8a0a43245 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -86,6 +86,7 @@ private: S32 mImageOldBoostLevel; std::string mSaveFileName; LLFrameTimer mSavedFileTimer; + bool mSavingMultiple; bool mLoadingFullImage; bool mShowKeepDiscard; bool mCopyToInv; diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index 7c22514264..a46c444eb9 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -141,7 +141,7 @@ void LLProgressView::revealIntroPanel() std::string intro_url = gSavedSettings.getString("PostFirstLoginIntroURL"); if ( intro_url.length() > 0 && gSavedSettings.getBOOL("BrowserJavascriptEnabled") && - gSavedSettings.getBOOL("PostFirstLoginIntroViewed" ) == false ) + !gSavedSettings.getBOOL("PostFirstLoginIntroViewed")) { // hide the progress bar getChild<LLView>("stack1")->setVisible(false); @@ -504,8 +504,8 @@ void LLProgressView::initTextures(S32 location_id, bool is_in_production) initStartTexture(location_id, is_in_production); initLogos(); - childSetVisible("panel_icons", mLogosList.empty() ? false : true); - childSetVisible("panel_top_spacer", mLogosList.empty() ? true : false); + childSetVisible("panel_icons", !mLogosList.empty()); + childSetVisible("panel_top_spacer", mLogosList.empty()); } void LLProgressView::releaseTextures() @@ -519,8 +519,8 @@ void LLProgressView::releaseTextures() void LLProgressView::setCancelButtonVisible(bool b, const std::string& label) { - mCancelBtn->setVisible( b ); - mCancelBtn->setEnabled( b ); + mCancelBtn->setVisible(b); + mCancelBtn->setEnabled(b); mCancelBtn->setLabelSelected(label); mCancelBtn->setLabelUnselected(label); } diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp index 76340a9ea8..833eaaf8ca 100644 --- a/indra/newview/llscrollingpanelparam.cpp +++ b/indra/newview/llscrollingpanelparam.cpp @@ -254,15 +254,19 @@ void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint ) // Make sure we're not taking the slider out of bounds // (this is where some simple UI limits are stored) - F32 new_percent = weightToSlider(new_weight); - if (mSlider->getMinValue() < new_percent - && new_percent < mSlider->getMaxValue()) + F32 new_percent = weightToPercent(new_weight); + LLSliderCtrl* slider = getChild<LLSliderCtrl>("param slider"); + if (slider) { - mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight); - mWearable->writeToAvatar(gAgentAvatarp); - gAgentAvatarp->updateVisualParams(); + if (slider->getMinValue() < new_percent + && new_percent < slider->getMaxValue()) + { + mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight); + mWearable->writeToAvatar(gAgentAvatarp); + gAgentAvatarp->updateVisualParams(); - mSlider->setValue( weightToSlider( new_weight ) ); + slider->setValue( weightToPercent( new_weight ) ); + } } } } @@ -283,13 +287,17 @@ void LLScrollingPanelParam::onHintMinMouseUp( void* userdata ) F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight(); // step a fraction in the negative directiona F32 new_weight = current_weight - (range / 10.f); - F32 new_percent = self->weightToSlider(new_weight); - if (self->mSlider->getMinValue() < new_percent - && new_percent < self->mSlider->getMaxValue()) + F32 new_percent = self->weightToPercent(new_weight); + LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider"); + if (slider) { - self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight); - self->mWearable->writeToAvatar(gAgentAvatarp); - self->mSlider->setValue( self->weightToSlider( new_weight ) ); + if (slider->getMinValue() < new_percent + && new_percent < slider->getMaxValue()) + { + self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight); + self->mWearable->writeToAvatar(gAgentAvatarp); + slider->setValue( self->weightToPercent( new_weight ) ); + } } } @@ -313,16 +321,33 @@ void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata ) F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight(); // step a fraction in the negative direction F32 new_weight = current_weight + (range / 10.f); - F32 new_percent = self->weightToSlider(new_weight); - if (self->mSlider->getMinValue() < new_percent - && new_percent < self->mSlider->getMaxValue()) + F32 new_percent = self->weightToPercent(new_weight); + LLSliderCtrl* slider = self->getChild<LLSliderCtrl>("param slider"); + if (slider) { - self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight); - self->mWearable->writeToAvatar(gAgentAvatarp); - self->mSlider->setValue( self->weightToSlider( new_weight ) ); + if (slider->getMinValue() < new_percent + && new_percent < slider->getMaxValue()) + { + self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight); + self->mWearable->writeToAvatar(gAgentAvatarp); + slider->setValue( self->weightToPercent( new_weight ) ); + } } } } LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax ); } + + +F32 LLScrollingPanelParam::weightToPercent( F32 weight ) +{ + LLViewerVisualParam* param = mParam; + return (weight - param->getMinWeight()) / (param->getMaxWeight() - param->getMinWeight()) * 100.f; +} + +F32 LLScrollingPanelParam::percentToWeight( F32 percent ) +{ + LLViewerVisualParam* param = mParam; + return percent / 100.f * (param->getMaxWeight() - param->getMinWeight()) + param->getMinWeight(); +} diff --git a/indra/newview/llscrollingpanelparam.h b/indra/newview/llscrollingpanelparam.h index fd8ef75cdd..1ebf89f483 100644 --- a/indra/newview/llscrollingpanelparam.h +++ b/indra/newview/llscrollingpanelparam.h @@ -63,6 +63,9 @@ public: void onHintMouseDown( LLVisualParamHint* hint ); void onHintHeldDown( LLVisualParamHint* hint ); + F32 weightToPercent( F32 weight ); + F32 percentToWeight( F32 percent ); + public: // Constants for LLPanelVisualParam const static F32 PARAM_STEP_TIME_THRESHOLD; diff --git a/indra/newview/llscrollingpanelparambase.cpp b/indra/newview/llscrollingpanelparambase.cpp index 4df619ed7d..eb490127a1 100644 --- a/indra/newview/llscrollingpanelparambase.cpp +++ b/indra/newview/llscrollingpanelparambase.cpp @@ -43,7 +43,6 @@ LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& pan LLViewerJointMesh* mesh, LLViewerVisualParam* param, bool allow_modify, LLWearable* wearable, LLJoint* jointp, bool use_hints) : LLScrollingPanel( panel_params ), mParam(param), - mSlider(nullptr), mAllowModify(allow_modify), mWearable(wearable) { @@ -51,15 +50,13 @@ LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& pan buildFromFile( "panel_scrolling_param.xml"); else buildFromFile( "panel_scrolling_param_base.xml"); - - mSlider = getChild<LLSliderCtrl>("param slider"); - mSlider->setMaxValue(100.f * (mParam->getMaxWeight() - mParam->getMinWeight())); - mSlider->setValue(weightToSlider(param->getWeight())); + + getChild<LLUICtrl>("param slider")->setValue(weightToPercent(param->getWeight())); std::string display_name = LLTrans::getString(param->getDisplayName()); - mSlider->setLabelArg("[DESC]", display_name); - mSlider->setEnabled(mAllowModify); - mSlider->setCommitCallback(boost::bind(LLScrollingPanelParamBase::onSliderMoved, mSlider, this)); + getChild<LLUICtrl>("param slider")->setLabelArg("[DESC]", display_name); + getChildView("param slider")->setEnabled(mAllowModify); + childSetCommitCallback("param slider", LLScrollingPanelParamBase::onSliderMoved, this); setVisible(false); setBorderVisible( false ); @@ -80,9 +77,9 @@ void LLScrollingPanelParamBase::updatePanel(bool allow_modify) } F32 current_weight = mWearable->getVisualParamWeight( param->getID() ); - mSlider->setValue(weightToSlider( current_weight ) ); + getChild<LLUICtrl>("param slider")->setValue(weightToPercent( current_weight ) ); mAllowModify = allow_modify; - mSlider->setEnabled(mAllowModify); + getChildView("param slider")->setEnabled(mAllowModify); } // static @@ -93,7 +90,7 @@ void LLScrollingPanelParamBase::onSliderMoved(LLUICtrl* ctrl, void* userdata) LLViewerVisualParam* param = self->mParam; F32 current_weight = self->mWearable->getVisualParamWeight( param->getID() ); - F32 new_weight = self->sliderToWeight( (F32)slider->getValue().asReal() ); + F32 new_weight = self->percentToWeight( (F32)slider->getValue().asReal() ); if (current_weight != new_weight ) { self->mWearable->setVisualParamWeight( param->getID(), new_weight); @@ -102,12 +99,14 @@ void LLScrollingPanelParamBase::onSliderMoved(LLUICtrl* ctrl, void* userdata) } } -F32 LLScrollingPanelParamBase::weightToSlider(F32 weight) +F32 LLScrollingPanelParamBase::weightToPercent( F32 weight ) { - return (weight - mParam->getMinWeight()) * 100.f; + LLViewerVisualParam* param = mParam; + return (weight - param->getMinWeight()) / (param->getMaxWeight() - param->getMinWeight()) * 100.f; } -F32 LLScrollingPanelParamBase::sliderToWeight(F32 slider) +F32 LLScrollingPanelParamBase::percentToWeight( F32 percent ) { - return slider / 100.f + mParam->getMinWeight(); + LLViewerVisualParam* param = mParam; + return percent / 100.f * (param->getMaxWeight() - param->getMinWeight()) + param->getMinWeight(); } diff --git a/indra/newview/llscrollingpanelparambase.h b/indra/newview/llscrollingpanelparambase.h index 1e9d1628bb..fd686636f2 100644 --- a/indra/newview/llscrollingpanelparambase.h +++ b/indra/newview/llscrollingpanelparambase.h @@ -36,7 +36,6 @@ class LLViewerVisualParam; class LLWearable; class LLVisualParamHint; class LLViewerVisualParam; -class LLSliderCtrl; class LLJoint; class LLScrollingPanelParamBase : public LLScrollingPanel @@ -50,13 +49,11 @@ public: static void onSliderMoved(LLUICtrl* ctrl, void* userdata); - F32 weightToSlider(F32 weight); - F32 sliderToWeight(F32 slider); + F32 weightToPercent( F32 weight ); + F32 percentToWeight( F32 percent ); public: LLViewerVisualParam* mParam; - LLSliderCtrl* mSlider; - protected: bool mAllowModify; LLWearable *mWearable; diff --git a/indra/newview/llsculptidsize.cpp b/indra/newview/llsculptidsize.cpp index 5d051d0ebf..bedee32213 100644 --- a/indra/newview/llsculptidsize.cpp +++ b/indra/newview/llsculptidsize.cpp @@ -66,7 +66,7 @@ void LLSculptIDSize::inc(const LLDrawable *pdrawable, int sz) if (itLU.first == itLU.second) { //register //llassert(mSizeInfo.get<tag_BY_DRAWABLE>().end() == mSizeInfo.get<tag_BY_DRAWABLE>().find(pdrawable)); - mSizeInfo.get<tag_BY_DRAWABLE>().insert(Info(pdrawable, sz, boost::make_shared<SizeSum>(sz), sculptId)); + mSizeInfo.get<tag_BY_DRAWABLE>().insert(Info(pdrawable, sz, std::make_shared<SizeSum>(sz), sculptId)); total_size = sz; } else diff --git a/indra/newview/llsculptidsize.h b/indra/newview/llsculptidsize.h index 87ee417b86..679fcbd44c 100644 --- a/indra/newview/llsculptidsize.h +++ b/indra/newview/llsculptidsize.h @@ -52,7 +52,7 @@ public: struct Info { - typedef boost::shared_ptr<SizeSum> PtrSizeSum; + typedef std::shared_ptr<SizeSum> PtrSizeSum; Info(const LLDrawable *drawable, int size, PtrSizeSum sizeInfo, LLUUID sculptId) : mDrawable(drawable) diff --git a/indra/newview/llsearchableui.h b/indra/newview/llsearchableui.h index 31f11eb8ef..84fcefb835 100644 --- a/indra/newview/llsearchableui.h +++ b/indra/newview/llsearchableui.h @@ -93,7 +93,7 @@ namespace ll { struct SearchableItem; - typedef boost::shared_ptr< SearchableItem > SearchableItemPtr; + typedef std::shared_ptr< SearchableItem > SearchableItemPtr; typedef std::vector< SearchableItemPtr > tSearchableItemList; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 64105e5740..eceaa28872 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1864,7 +1864,7 @@ bool LLSelectMgr::selectionSetImage(const LLUUID& imageid) if (mItem && objectp->isAttachment()) { const LLPermissions& perm = mItem->getPermissions(); - bool unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? true : false; + bool unrestricted = (perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED; if (!unrestricted) { // Attachments are in world and in inventory simultaneously, @@ -2292,6 +2292,7 @@ void LLSelectMgr::selectionSetBumpmap(U8 bumpmap, const LLUUID &image_id) LL_WARNS() << "Attempted to apply no-copy texture to multiple objects" << LL_ENDL; return; } + if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) { LLViewerObject *object = mSelectedObjects->getFirstRootObject(); @@ -2300,7 +2301,7 @@ void LLSelectMgr::selectionSetBumpmap(U8 bumpmap, const LLUUID &image_id) return; } const LLPermissions& perm = item->getPermissions(); - bool unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? true : false; + bool unrestricted = (perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED; bool attached = object->isAttachment(); if (attached && !unrestricted) { @@ -2311,7 +2312,7 @@ void LLSelectMgr::selectionSetBumpmap(U8 bumpmap, const LLUUID &image_id) LLToolDragAndDrop::handleDropMaterialProtections(object, item, LLToolDragAndDrop::SOURCE_AGENT, LLUUID::null); } getSelection()->applyToTEs(&setfunc); - + LLSelectMgrSendFunctor sendfunc; getSelection()->applyToObjects(&sendfunc); } @@ -2364,6 +2365,7 @@ void LLSelectMgr::selectionSetShiny(U8 shiny, const LLUUID &image_id) LL_WARNS() << "Attempted to apply no-copy texture to multiple objects" << LL_ENDL; return; } + if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) { LLViewerObject *object = mSelectedObjects->getFirstRootObject(); @@ -2372,7 +2374,7 @@ void LLSelectMgr::selectionSetShiny(U8 shiny, const LLUUID &image_id) return; } const LLPermissions& perm = item->getPermissions(); - bool unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? true : false; + bool unrestricted = (perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED; bool attached = object->isAttachment(); if (attached && !unrestricted) { @@ -3876,7 +3878,7 @@ bool LLSelectMgr::selectIsGroupOwned() LLSelectGetFirstGroupOwner test; getFirst(&test); - return test.mFirstValue.notNull() ? true : false; + return test.mFirstValue.notNull(); } //----------------------------------------------------------------------------- @@ -6942,7 +6944,7 @@ bool LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power) if (PERM_OWNER == op) { // This this was just a check for ownership, we can now return the answer. - return (proxy_agent_id == object_owner_id ? true : false); + return proxy_agent_id == object_owner_id; } // check permissions to see if the agent can operate @@ -8017,7 +8019,7 @@ bool LLObjectSelection::checkAnimatedObjectLinkable() bool LLObjectSelection::applyToRootObjects(LLSelectedObjectFunctor* func, bool firstonly) { - bool result = firstonly ? false : true; + bool result = !firstonly; for (root_iterator iter = root_begin(); iter != root_end(); ) { root_iterator nextiter = iter++; @@ -8035,7 +8037,7 @@ bool LLObjectSelection::applyToRootObjects(LLSelectedObjectFunctor* func, bool f bool LLObjectSelection::applyToTEs(LLSelectedTEFunctor* func, bool firstonly) { - bool result = firstonly ? false : true; + bool result = !firstonly; for (iterator iter = begin(); iter != end(); ) { iterator nextiter = iter++; @@ -8061,7 +8063,7 @@ bool LLObjectSelection::applyToTEs(LLSelectedTEFunctor* func, bool firstonly) bool LLObjectSelection::applyToNodes(LLSelectedNodeFunctor *func, bool firstonly) { - bool result = firstonly ? false : true; + bool result = !firstonly; for (iterator iter = begin(); iter != end(); ) { iterator nextiter = iter++; @@ -8077,7 +8079,7 @@ bool LLObjectSelection::applyToNodes(LLSelectedNodeFunctor *func, bool firstonly bool LLObjectSelection::applyToRootNodes(LLSelectedNodeFunctor *func, bool firstonly) { - bool result = firstonly ? false : true; + bool result = !firstonly; for (root_iterator iter = root_begin(); iter != root_end(); ) { root_iterator nextiter = iter++; diff --git a/indra/newview/llsetkeybinddialog.cpp b/indra/newview/llsetkeybinddialog.cpp index 1e5a67302a..dc3b34b1b9 100644 --- a/indra/newview/llsetkeybinddialog.cpp +++ b/indra/newview/llsetkeybinddialog.cpp @@ -217,7 +217,7 @@ bool LLSetKeyBindDialog::recordAndHandleKey(KEY key, MASK mask, bool down) // Masks by themself are not allowed return false; } - if (down == true) + if (down) { // Most keys are handled on 'down' event because menu is handled on 'down' // masks are exceptions to let other keys be handled diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 8f7267a54f..0e45385c2e 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -361,6 +361,15 @@ void LLSidepanelAppearance::toggleMyOutfitsPanel(bool visible, const std::string } } +bool LLSidepanelAppearance::isCOFPanelVisible() +{ + if (mPanelOutfitsInventory && mPanelOutfitsInventory->getVisible()) + { + return mPanelOutfitsInventory->isCOFPanelActive(); + } + return false; +} + void LLSidepanelAppearance::toggleOutfitEditPanel(bool visible, bool disable_camera_switch) { if (!mOutfitEdit || mOutfitEdit->getVisible() == visible) diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h index 29d9a4585c..4949f78a3f 100644 --- a/indra/newview/llsidepanelappearance.h +++ b/indra/newview/llsidepanelappearance.h @@ -66,6 +66,8 @@ public: void updateToVisibility( const LLSD& new_visibility ); LLPanelEditWearable* getWearable(){ return mEditWearable; } + bool isCOFPanelVisible(); + private: void onFilterEdit(const std::string& search_string); void onVisibilityChanged ( const LLSD& new_visibility ); diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 0a76a1f48f..54194e5fe6 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -633,16 +633,14 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) } // Set values. - bool is_group_copy = (group_mask & PERM_COPY) ? true : false; - bool is_group_modify = (group_mask & PERM_MODIFY) ? true : false; - bool is_group_move = (group_mask & PERM_MOVE) ? true : false; + bool is_group_copy = group_mask & PERM_COPY; + bool is_group_modify = group_mask & PERM_MODIFY; + bool is_group_move = group_mask & PERM_MOVE; if (is_group_copy && is_group_modify && is_group_move) { getChild<LLUICtrl>("CheckShareWithGroup")->setValue(LLSD((bool)true)); - - LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); - if(ctl) + if (LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup")) { ctl->setTentative(false); } @@ -650,22 +648,20 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) else if (!is_group_copy && !is_group_modify && !is_group_move) { getChild<LLUICtrl>("CheckShareWithGroup")->setValue(LLSD((bool)false)); - LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); - if(ctl) + if (LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup")) { ctl->setTentative(false); } } else { - LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); - if(ctl) + if (LLCheckBoxCtrl* ctl = getChild<LLCheckBoxCtrl>("CheckShareWithGroup")) { ctl->setTentative(!ctl->getEnabled()); ctl->set(true); } } - + getChild<LLUICtrl>("CheckEveryoneCopy")->setValue(LLSD((bool)(everyone_mask & PERM_COPY))); /////////////// diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 34bd8412f5..fd7d8bcc6c 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1353,19 +1353,19 @@ void LLFloaterTexturePicker::changeMode() { int index = mModeSelector->getValue().asInteger(); - mDefaultBtn->setVisible(index == PICKER_INVENTORY ? true : false); - mBlankBtn->setVisible(index == PICKER_INVENTORY ? true : false); - mNoneBtn->setVisible(index == PICKER_INVENTORY ? true : false); - mFilterEdit->setVisible(index == PICKER_INVENTORY ? true : false); - mInventoryPanel->setVisible(index == PICKER_INVENTORY ? true : false); + mDefaultBtn->setVisible(index == PICKER_INVENTORY); + mBlankBtn->setVisible(index == PICKER_INVENTORY); + mNoneBtn->setVisible(index == PICKER_INVENTORY); + mFilterEdit->setVisible(index == PICKER_INVENTORY); + mInventoryPanel->setVisible(index == PICKER_INVENTORY); - getChild<LLButton>("l_add_btn")->setVisible(index == PICKER_LOCAL ? true : false); - getChild<LLButton>("l_rem_btn")->setVisible(index == PICKER_LOCAL ? true : false); - getChild<LLButton>("l_upl_btn")->setVisible(index == PICKER_LOCAL ? true : false); - getChild<LLScrollListCtrl>("l_name_list")->setVisible(index == PICKER_LOCAL ? true : false); + getChild<LLButton>("l_add_btn")->setVisible(index == PICKER_LOCAL); + getChild<LLButton>("l_rem_btn")->setVisible(index == PICKER_LOCAL); + getChild<LLButton>("l_upl_btn")->setVisible(index == PICKER_LOCAL); + getChild<LLScrollListCtrl>("l_name_list")->setVisible(index == PICKER_LOCAL); - getChild<LLComboBox>("l_bake_use_texture_combo_box")->setVisible(index == PICKER_BAKE ? true : false); - getChild<LLCheckBoxCtrl>("hide_base_mesh_region")->setVisible(false);// index == 2 ? true : false); + getChild<LLComboBox>("l_bake_use_texture_combo_box")->setVisible(index == PICKER_BAKE); + getChild<LLCheckBoxCtrl>("hide_base_mesh_region")->setVisible(false);// index == 2); bool pipette_visible = (index == PICKER_INVENTORY) && (mInventoryPickType != PICK_MATERIAL); @@ -2239,8 +2239,8 @@ void LLTextureCtrl::draw() // Using the discard level, do not show the string if the texture is almost but not // fully loaded. if (mTexturep.notNull() && - (!mTexturep->isFullyLoaded()) && - (mShowLoadingPlaceholder == true)) + !mTexturep->isFullyLoaded() && + mShowLoadingPlaceholder) { U32 v_offset = 25; LLFontGL* font = LLFontGL::getFontSansSerif(); diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index f410217387..e1779ba976 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -529,12 +529,11 @@ void LLGLTexMemBar::draw() U32 texFetchLatMed = U32(recording.getMean(LLTextureFetch::sTexFetchLatency).value() * 1000.0f); U32 texFetchLatMax = U32(recording.getMax(LLTextureFetch::sTexFetchLatency).value() * 1000.0f); - text = llformat("GL Free: %d MB Sys Free: %d MB FBO: %d MB Bias: %.2f(%d MB) Cache: %.1f/%.1f MB", - gViewerWindow->getWindow()->getAvailableVRAMMegabytes(), + text = llformat("Est. Free: %d MB Sys Free: %d MB FBO: %d MB Bias: %.2f Cache: %.1f/%.1f MB", + (S32)LLViewerTexture::sFreeVRAMMegabytes, LLMemory::getAvailableMemKB()/1024, LLRenderTarget::sBytesAllocated/(1024*1024), discard_bias, - (S32)LLViewerTexture::sFreeVRAMMegabytes, cache_usage, cache_max_usage); //, cache_entries, cache_max_entries diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index 5cf2e89c63..f6fadf276c 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -119,7 +119,7 @@ LLToast::LLToast(const LLToast::Params& p) { mTimer.reset(new LLToastLifeTimer(this, p.lifetime_secs)); - buildFromFile("panel_toast.xml", true); + buildFromFile("panel_toast.xml"); setCanDrag(false); diff --git a/indra/newview/lltoastimpanel.cpp b/indra/newview/lltoastimpanel.cpp index e4f4a94bf1..910e42addf 100644 --- a/indra/newview/lltoastimpanel.cpp +++ b/indra/newview/lltoastimpanel.cpp @@ -119,7 +119,7 @@ LLToastIMPanel::~LLToastIMPanel() //virtual bool LLToastIMPanel::handleMouseUp(S32 x, S32 y, MASK mask) { - if (LLPanel::handleMouseUp(x,y,mask) == false) + if (!LLPanel::handleMouseUp(x, y, mask)) { mNotification->respond(mNotification->getResponseTemplate()); } diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index f7bebf08aa..1f6a88cd95 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -266,9 +266,9 @@ void LLToastNotifyPanel::init( LLRect rect, bool show_images ) LLRect current_rect = getRect(); setXMLFilename(""); - buildFromFile("panel_notification.xml", true); + buildFromFile("panel_notification.xml"); - if (rect != LLRect::null) + if(rect != LLRect::null) { this->setShape(rect); } diff --git a/indra/newview/lltoastscriptquestion.cpp b/indra/newview/lltoastscriptquestion.cpp index 49fbf885eb..f6fc9e7889 100644 --- a/indra/newview/lltoastscriptquestion.cpp +++ b/indra/newview/lltoastscriptquestion.cpp @@ -37,7 +37,7 @@ LLToastScriptQuestion::LLToastScriptQuestion(const LLNotificationPtr& notificati : LLToastPanel(notification) { - buildFromFile("panel_script_question_toast.xml", true); + buildFromFile("panel_script_question_toast.xml"); } bool LLToastScriptQuestion::postBuild() diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 109e6895d0..75ea1046a9 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -46,8 +46,6 @@ #include "llviewercontrol.h" // HACK for destinations guide on startup #include "llinventorymodel.h" // HACK to disable starter avatars button for NUX -#include <boost/foreach.hpp> - LLToolBarView* gToolBarView = NULL; static LLDefaultChildRegistry::Register<LLToolBarView> r("toolbar_view"); @@ -282,7 +280,7 @@ bool LLToolBarView::loadToolbars(bool force_default) LLToolBarEnums::ButtonType button_type = toolbar_set.left_toolbar.button_display_mode; mToolbars[LLToolBarEnums::TOOLBAR_LEFT]->setButtonType(button_type); } - BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.left_toolbar.commands) + for (const LLCommandId::Params& command_params : toolbar_set.left_toolbar.commands) { if (!addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_LEFT])) { @@ -297,7 +295,7 @@ bool LLToolBarView::loadToolbars(bool force_default) LLToolBarEnums::ButtonType button_type = toolbar_set.right_toolbar.button_display_mode; mToolbars[LLToolBarEnums::TOOLBAR_RIGHT]->setButtonType(button_type); } - BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.right_toolbar.commands) + for (const LLCommandId::Params& command_params : toolbar_set.right_toolbar.commands) { if (!addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_RIGHT])) { @@ -312,7 +310,7 @@ bool LLToolBarView::loadToolbars(bool force_default) LLToolBarEnums::ButtonType button_type = toolbar_set.bottom_toolbar.button_display_mode; mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM]->setButtonType(button_type); } - BOOST_FOREACH(const LLCommandId::Params& command_params, toolbar_set.bottom_toolbar.commands) + for (const LLCommandId::Params& command_params : toolbar_set.bottom_toolbar.commands) { if (!addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM])) { diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 304784cace..49c3cb1304 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1672,13 +1672,13 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, // currently the ray's end point is an approximation, // and is sometimes too short (causing failure.) so we // double the ray's length: - if (bypass_sim_raycast == false) + if (!bypass_sim_raycast) { LLVector3 ray_direction = ray_start - ray_end; ray_end = ray_end - ray_direction; } - - + + // Message packing code should be it's own uninterrupted block LLMessageSystem* msg = gMessageSystem; if (mSource == SOURCE_NOTECARD) @@ -1835,7 +1835,9 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LLInventoryItem* item, EDragAndDropType type) { // check the basics - if (!item || !obj) return ACCEPT_NO; + if (!item || !obj) + return ACCEPT_NO; + // HACK: downcast LLViewerInventoryItem* vitem = (LLViewerInventoryItem*)item; if (!vitem->isFinished() && (type != DAD_CATEGORY)) @@ -1846,13 +1848,14 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL // Library or agent inventory only. return ACCEPT_NO; } - if (vitem->getIsLinkType()) return ACCEPT_NO; // No giving away links + if (vitem->getIsLinkType()) + return ACCEPT_NO; // No giving away links // deny attempts to drop from an object onto itself. This is to // help make sure that drops that are from an object to an object // don't have to worry about order of evaluation. Think of this // like check for self in assignment. - if(obj->getID() == item->getParentUUID()) + if (obj->getID() == item->getParentUUID()) { return ACCEPT_NO; } @@ -1862,7 +1865,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL // && (obj->mPermModify || obj->mFlagAllowInventoryAdd)); bool worn = false; LLVOAvatarSelf* my_avatar = NULL; - switch(item->getType()) + switch (item->getType()) { case LLAssetType::AT_OBJECT: my_avatar = gAgentAvatarp; @@ -1873,7 +1876,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL break; case LLAssetType::AT_BODYPART: case LLAssetType::AT_CLOTHING: - if(gAgentWearables.isWearingItem(item->getUUID())) + if (gAgentWearables.isWearingItem(item->getUUID())) { worn = true; } @@ -1883,33 +1886,37 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL // because of incomplete LSL support. See STORM-1117. return ACCEPT_NO; default: - break; + break; } const LLPermissions& perm = item->getPermissions(); bool modify = (obj->permModify() || obj->flagAllowInventoryAdd()); bool transfer = false; - if((obj->permYouOwner() && (perm.getOwner() == gAgent.getID())) + if ((obj->permYouOwner() && (perm.getOwner() == gAgent.getID())) || perm.allowOperationBy(PERM_TRANSFER, gAgent.getID())) { transfer = true; } bool volume = (LL_PCODE_VOLUME == obj->getPCode()); bool attached = obj->isAttachment(); - bool unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? true : false; - if(attached && !unrestricted) + bool unrestricted = (perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED; + + if (attached && !unrestricted) { // Attachments are in world and in inventory simultaneously, // at the moment server doesn't support such a situation. return ACCEPT_NO_LOCKED; } - else if(modify && transfer && volume && !worn) + + if (modify && transfer && volume && !worn) { return ACCEPT_YES_MULTI; } - else if(!modify) + + if (!modify) { return ACCEPT_NO_LOCKED; } + return ACCEPT_NO; } @@ -2599,41 +2606,41 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory( return ACCEPT_NO_CUSTOM; } - if(mSource == SOURCE_AGENT) + if (mSource == SOURCE_AGENT) { const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if( gInventory.isObjectDescendentOf( category->getUUID(), trash_id ) ) + if (gInventory.isObjectDescendentOf(category->getUUID(), trash_id)) { return ACCEPT_NO; } const LLUUID &outbox_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OUTBOX); - if(outbox_id.notNull() && gInventory.isObjectDescendentOf(category->getUUID(), outbox_id)) + if (outbox_id.notNull() && gInventory.isObjectDescendentOf(category->getUUID(), outbox_id)) { // Legacy return ACCEPT_NO; } - if(drop) + if (drop) { - bool append = ( (mask & MASK_SHIFT) ? true : false ); - LLAppearanceMgr::instance().wearInventoryCategory(category, false, append); + LLAppearanceMgr::instance().wearInventoryCategory(category, false, mask & MASK_SHIFT); } + return ACCEPT_YES_MULTI; } - else if(mSource == SOURCE_LIBRARY) + + if (mSource == SOURCE_LIBRARY) { - if(drop) + if (drop) { LLAppearanceMgr::instance().wearInventoryCategory(category, true, false); } + return ACCEPT_YES_MULTI; } - else - { - // TODO: copy/move category to avatar's inventory and then wear it. - return ACCEPT_NO; - } + + // TODO: copy/move category to avatar's inventory and then wear it. + return ACCEPT_NO; } @@ -2644,15 +2651,15 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory( // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. - if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource)) - { + if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource)) return ACCEPT_NO; - } LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); - if (!item || !item->isFinished()) return ACCEPT_NO; + if (!item || !item->isFinished()) + return ACCEPT_NO; + LLViewerObject* root_object = obj; if (obj && obj->getParent()) { @@ -2664,17 +2671,18 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory( } EAcceptance rv = willObjectAcceptInventory(root_object, item); - if(root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv)) + if (root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv)) { dropInventory(root_object, item, mSource, mSourceID); } + return rv; } bool LLToolDragAndDrop::dadUpdateInventory(LLViewerObject* obj, bool drop) { EAcceptance rv = dad3dUpdateInventory(obj, -1, MASK_NONE, drop); - return (rv >= ACCEPT_YES_COPY_SINGLE); + return rv >= ACCEPT_YES_COPY_SINGLE; } EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index 63545ee5b0..a4f43bde11 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -145,12 +145,13 @@ LLToolMgr::~LLToolMgr() bool LLToolMgr::usingTransientTool() { - return mTransientTool ? true : false; + return mTransientTool != nullptr; } void LLToolMgr::setCurrentToolset(LLToolset* current) { - if (!current) return; + if (!current) + return; // switching toolsets? if (current != mCurrentToolset) @@ -164,6 +165,7 @@ void LLToolMgr::setCurrentToolset(LLToolset* current) // select first tool of new toolset only if toolset changed mCurrentToolset->selectFirstTool(); } + // update current tool based on new toolset setCurrentTool( mCurrentToolset->getSelectedTool() ); } diff --git a/indra/newview/lluiavatar.h b/indra/newview/lluiavatar.h index bcdffedef2..d9fe003155 100644 --- a/indra/newview/lluiavatar.h +++ b/indra/newview/lluiavatar.h @@ -39,6 +39,7 @@ public: LLUIAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); virtual void initInstance(); // Called after construction to initialize the class. virtual ~LLUIAvatar(); + virtual bool isBuddy() const { return false; } }; #endif //LL_CONTROLAVATAR_H diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 66184abd37..318cf199c0 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -74,7 +74,7 @@ LLViewerAudio::~LLViewerAudio() void LLViewerAudio::registerIdleListener() { - if(mIdleListnerActive==false) + if (!mIdleListnerActive) { mIdleListnerActive = true; doOnIdleRepeating(boost::bind(boost::bind(&LLViewerAudio::onIdleUpdate, this))); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 2a248cd120..b809f06e3a 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -251,7 +251,7 @@ static bool handleVSyncChanged(const LLSD& newvalue) LLPerfStats::tunables.vsyncEnabled = newvalue.asBoolean(); gViewerWindow->getWindow()->toggleVSync(newvalue.asBoolean()); - if(newvalue.asBoolean() == true) + if (newvalue.asBoolean()) { U32 current_target = gSavedSettings.getU32("TargetFPS"); gSavedSettings.setU32("TargetFPS", std::min((U32)gViewerWindow->getWindow()->getRefreshRate(), current_target)); @@ -281,12 +281,12 @@ static bool handleAvatarPhysicsLODChanged(const LLSD& newvalue) static bool handleTerrainLODChanged(const LLSD& newvalue) { - LLVOSurfacePatch::sLODFactor = (F32)newvalue.asReal(); - //sqaure lod factor to get exponential range of [0,4] and keep - //a value of 1 in the middle of the detail slider for consistency - //with other detail sliders (see panel_preferences_graphics1.xml) - LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; - return true; + LLVOSurfacePatch::sLODFactor = (F32)newvalue.asReal(); + //sqaure lod factor to get exponential range of [0,4] and keep + //a value of 1 in the middle of the detail slider for consistency + //with other detail sliders (see panel_preferences_graphics1.xml) + LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; + return true; } static bool handleTreeLODChanged(const LLSD& newvalue) diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index f8f466be45..4c32459a94 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -892,7 +892,7 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot) // gGL.popMatrix(); //} - LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? true : false; + LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater(); LLGLState::checkStates(); @@ -1099,7 +1099,7 @@ void display_cube_face() LLAppViewer::instance()->pingMainloopTimeout("Display:RenderStart"); - LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? true : false; + LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater(); gGL.setColorMask(true, true); diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 8353d4d1d7..1b34bed2da 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -87,6 +87,7 @@ #include "llfloaterimsession.h" #include "llfloaterinspect.h" #include "llfloaterinventorysettings.h" +#include "llfloaterinventorythumbnailshelper.h" #include "llfloaterjoystick.h" #include "llfloaterlagmeter.h" #include "llfloaterland.h" @@ -249,6 +250,7 @@ public: "group_picker", "hud", "incoming_call", + "inventory_thumbnails_helper", "linkreplace", "mem_leaking", "marketplace_validation", @@ -335,7 +337,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("build", "floater_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTools>); LLFloaterReg::add("build_options", "floater_build_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuildOptions>); LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBump>); - + LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCamera>); LLFloaterReg::add("camera_presets", "floater_camera_presets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCameraPresets>); LLFloaterReg::add("chat_voice", "floater_voice_chat_volume.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterChatVoiceVolume>); @@ -384,6 +386,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("incoming_call", "floater_incoming_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIncomingCallDialog>); LLFloaterReg::add("inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); LLFloaterReg::add("inspect", "floater_inspect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInspect>); + LLFloaterReg::add("inventory_thumbnails_helper", "floater_inventory_thumbnails_helper.xml", (LLFloaterBuildFunc) &LLFloaterReg::build<LLFloaterInventoryThumbnailsHelper>); LLFloaterReg::add("item_properties", "floater_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterItemProperties>); LLFloaterReg::add("task_properties", "floater_task_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterItemProperties>); LLFloaterReg::add("inventory_settings", "floater_inventory_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInventorySettings>); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 3082165538..937f016e16 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -668,15 +668,14 @@ void LLViewerInventoryCategory::setVersion(S32 version) mVersion = version; } -bool LLViewerInventoryCategory::fetch() +bool LLViewerInventoryCategory::fetch(S32 expiry_seconds) { if((VERSION_UNKNOWN == getVersion()) && mDescendentsRequested.hasExpired()) //Expired check prevents multiple downloads. { LL_DEBUGS(LOG_INV) << "Fetching category children: " << mName << ", UUID: " << mUUID << LL_ENDL; - const F32 FETCH_TIMER_EXPIRY = 10.0f; mDescendentsRequested.reset(); - mDescendentsRequested.setTimerExpirySec(FETCH_TIMER_EXPIRY); + mDescendentsRequested.setTimerExpirySec(expiry_seconds); std::string url; if (gAgent.getRegion()) @@ -685,7 +684,7 @@ bool LLViewerInventoryCategory::fetch() } else { - LL_WARNS(LOG_INV) << "agent region is null" << LL_ENDL; + LL_WARNS_ONCE(LOG_INV) << "agent region is null" << LL_ENDL; } if (!url.empty() || AISAPI::isAvailable()) { @@ -709,7 +708,13 @@ LLViewerInventoryCategory::EFetchType LLViewerInventoryCategory::getFetching() void LLViewerInventoryCategory::setFetching(LLViewerInventoryCategory::EFetchType fetching) { - if (fetching > mFetching) // allow a switch from normal to recursive + if (fetching == FETCH_FAILED) + { + const F32 FETCH_FAILURE_EXPIRY = 60.0f; + mDescendentsRequested.setTimerExpirySec(FETCH_FAILURE_EXPIRY); + mFetching = fetching; + } + else if (fetching > mFetching) // allow a switch from normal to recursive { if (mDescendentsRequested.hasExpired() || (mFetching == FETCH_NONE)) { diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 997b98db9b..bb6a6edf55 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -209,13 +209,15 @@ public: S32 getVersion() const; void setVersion(S32 version); - // Returns true if a fetch was issued (not nessesary in progress). - bool fetch(); + // Returns true if a fetch was issued (not nessesary in progress). + // no requests will happen during expiry_seconds even if fetch completed + bool fetch(S32 expiry_seconds = 10); typedef enum { FETCH_NONE = 0, FETCH_NORMAL, FETCH_RECURSIVE, + FETCH_FAILED, // back off } EFetchType; EFetchType getFetching(); // marks as fetch being in progress or as done diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index a53b8ebd88..0aba982ba9 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -342,7 +342,7 @@ void LLViewerJoystick::init(bool autoenable) loadDeviceIdFromSettings(); - if (libinit == false) + if (!libinit) { // Note: The HotPlug callbacks are not actually getting called on Windows if (ndof_libinit(HotPlugAddCallback, @@ -401,10 +401,10 @@ void LLViewerJoystick::init(bool autoenable) // Autoenable the joystick for recognized devices if nothing was connected previously if (!autoenable) { - autoenable = gSavedSettings.getString("JoystickInitialized").empty() ? true : false; + autoenable = gSavedSettings.getString("JoystickInitialized").empty(); } updateEnabled(autoenable); - + if (mDriverState == JDS_INITIALIZED) { // A Joystick device is plugged in diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 5b4e1096f7..dda74ec2fa 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -431,7 +431,7 @@ private: private: // a single media url with some data and an impl. - boost::shared_ptr<LLPluginClassMedia> mMediaSource; + std::shared_ptr<LLPluginClassMedia> mMediaSource; LLMutex mLock; F64 mZoomFactor; LLUUID mTextureId; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 668c63bbee..b3f9bab332 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -102,6 +102,7 @@ #include "llsceneview.h" #include "llscenemonitor.h" #include "llselectmgr.h" +#include "llsidepanelappearance.h" #include "llspellcheckmenuhandler.h" #include "llstatusbar.h" #include "lltextureview.h" @@ -937,7 +938,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t std::string mode = userdata.asString(); if (mode == "none") { - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == true) + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY)) { gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY); } @@ -945,7 +946,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t } else if (mode == "current") { - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == false) + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY)) { gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY); } @@ -953,7 +954,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t } else if (mode == "desired") { - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == false) + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY)) { gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY); } @@ -962,7 +963,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t } else if (mode == "full") { - if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY) == false) + if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY)) { gPipeline.toggleRenderDebug(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY); } @@ -1464,6 +1465,31 @@ class LLAdvancedCheckDebugUnicode : public view_listener_t +////////////////// +// DEBUG CAMERA // +////////////////// + + +class LLAdvancedToggleDebugCamera : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLView::sDebugCamera = !(LLView::sDebugCamera); + LLFloaterCamera::onDebugCameraToggled(); + return true; + } +}; + +class LLAdvancedCheckDebugCamera : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + return LLView::sDebugCamera; + } +}; + + + /////////////////////// // XUI NAME TOOLTIPS // /////////////////////// @@ -6772,6 +6798,13 @@ void handle_edit_outfit() void handle_now_wearing() { + LLSidepanelAppearance *panel_appearance = dynamic_cast<LLSidepanelAppearance *>(LLFloaterSidePanelContainer::getPanel("appearance")); + if (panel_appearance && panel_appearance->isInVisibleChain() && panel_appearance->isCOFPanelVisible()) + { + LLFloaterReg::findInstance("appearance")->closeFloater(); + return; + } + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "now_wearing")); } @@ -9643,6 +9676,8 @@ void initialize_menus() view_listener_t::addMenu(new LLAdvancedToggleDebugViews(), "Advanced.ToggleDebugViews"); view_listener_t::addMenu(new LLAdvancedCheckDebugUnicode(), "Advanced.CheckDebugUnicode"); view_listener_t::addMenu(new LLAdvancedToggleDebugUnicode(), "Advanced.ToggleDebugUnicode"); + view_listener_t::addMenu(new LLAdvancedCheckDebugCamera(), "Advanced.CheckDebugCamera"); + view_listener_t::addMenu(new LLAdvancedToggleDebugCamera(), "Advanced.ToggleDebugCamera"); view_listener_t::addMenu(new LLAdvancedToggleXUINameTooltips(), "Advanced.ToggleXUINameTooltips"); view_listener_t::addMenu(new LLAdvancedCheckXUINameTooltips(), "Advanced.CheckXUINameTooltips"); view_listener_t::addMenu(new LLAdvancedToggleDebugMouseEvents(), "Advanced.ToggleDebugMouseEvents"); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 888a31b17a..5681047b89 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -451,7 +451,7 @@ const bool check_file_extension(const std::string& filename, LLFilePicker::ELoad //and compare them to the extension of the file //to be uploaded for (token_iter = tokens.begin(); - token_iter != tokens.end() && ext_valid != true; + token_iter != tokens.end() && !ext_valid; ++token_iter) { const std::string& cur_token = *token_iter; @@ -464,7 +464,7 @@ const bool check_file_extension(const std::string& filename, LLFilePicker::ELoad } }//end for (loop over all tokens) - if (ext_valid == false) + if (!ext_valid) { //should only get here if the extension exists //but is invalid diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index ff2ee693fd..6b9df6df28 100644 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -145,7 +145,7 @@ public: virtual void notify(const std::vector<std::string>& filenames); private: - boost::shared_ptr<LLPluginClassMedia> mPlugin; + std::shared_ptr<LLPluginClassMedia> mPlugin; }; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index d417a94ab4..348206bd30 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -119,8 +119,6 @@ #include "llviewerregion.h" #include "llfloaterregionrestarting.h" -#include <boost/foreach.hpp> - #include "llnotificationmanager.h" // #include "llexperiencecache.h" @@ -189,7 +187,7 @@ void accept_friendship_coro(std::string url, LLSD notification) } else { - if (!result.has("success") || result["success"].asBoolean() == false) + if (!result.has("success") || !result["success"].asBoolean()) { LL_WARNS("Friendship") << "Server failed to process accepted friendship. " << httpResults << LL_ENDL; } @@ -232,7 +230,7 @@ void decline_friendship_coro(std::string url, LLSD notification, S32 option) } else { - if (!result.has("success") || result["success"].asBoolean() == false) + if (!result.has("success") || !result["success"].asBoolean()) { LL_WARNS("Friendship") << "Server failed to process declined friendship. " << httpResults << LL_ENDL; } @@ -276,7 +274,7 @@ bool friendship_offer_callback(const LLSD& notification, const LLSD& response) // This will also trigger an onlinenotification if the user is online std::string url = gAgent.getRegionCapability("AcceptFriendship"); LL_DEBUGS("Friendship") << "Cap string: " << url << LL_ENDL; - if (!url.empty() && payload.has("online") && payload["online"].asBoolean() == false) + if (!url.empty() && payload.has("online") && !payload["online"].asBoolean()) { LL_DEBUGS("Friendship") << "Accepting friendship via capability" << LL_ENDL; LLCoros::instance().launch("LLMessageSystem::acceptFriendshipOffer", @@ -316,7 +314,7 @@ bool friendship_offer_callback(const LLSD& notification, const LLSD& response) // the rejection to the simulator to delete the pending userop. std::string url = gAgent.getRegionCapability("DeclineFriendship"); LL_DEBUGS("Friendship") << "Cap string: " << url << LL_ENDL; - if (!url.empty() && payload.has("online") && payload["online"].asBoolean() == false) + if (!url.empty() && payload.has("online") && !payload["online"].asBoolean()) { LL_DEBUGS("Friendship") << "Declining friendship via capability" << LL_ENDL; LLCoros::instance().launch("LLMessageSystem::declineFriendshipOffer", @@ -776,7 +774,7 @@ void response_group_invitation_coro(std::string url, LLUUID group_id, bool notif } else { - if (!result.has("success") || result["success"].asBoolean() == false) + if (!result.has("success") || !result["success"].asBoolean()) { LL_WARNS("GroupInvite") << "Server failed to process group " << group_id << " invitation response. " << httpResults << LL_ENDL; } @@ -2043,25 +2041,29 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const std::string from_string; // Used in the pop-up. std::string chatHistory_string; // Used in chat history. - if (mFromObject == true) + if (mFromObject) { + std::string quot = LLTrans::getString("'"); if (mFromGroup) { std::string group_name; if (gCacheName->getGroupName(mFromID, group_name)) { - from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'" - + mFromName + LLTrans::getString("'") +" " + LLTrans::getString("InvOfferOwnedByGroup") - + " "+ "'" + group_name + "'"; - - chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByGroup") - + " " + group_name + "'"; + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " " + + quot + mFromName + quot + " " + + LLTrans::getString("InvOfferOwnedByGroup") + " " + + quot + group_name + quot; + chatHistory_string = mFromName + " " + + LLTrans::getString("InvOfferOwnedByGroup") + " " + + quot + group_name + quot; } else { - from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'" - + mFromName +"'"+ " " + LLTrans::getString("InvOfferOwnedByUnknownGroup"); - chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownGroup"); + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " " + + quot + mFromName + quot + " " + + LLTrans::getString("InvOfferOwnedByUnknownGroup"); + chatHistory_string = mFromName + " " + + LLTrans::getString("InvOfferOwnedByUnknownGroup"); } } else @@ -2069,15 +2071,19 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const LLAvatarName av_name; if (LLAvatarNameCache::get(mFromID, &av_name)) { - from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+ LLTrans::getString("'") + mFromName - + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + av_name.getUserName(); - chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedBy") + " " + av_name.getUserName(); + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " " + + quot + mFromName + quot + " " + + LLTrans::getString("InvOfferOwnedBy") + " " + av_name.getUserName(); + chatHistory_string = mFromName + " " + + LLTrans::getString("InvOfferOwnedBy") + " " + av_name.getUserName(); } else { - from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+LLTrans::getString("'") - + mFromName + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedByUnknownUser"); - chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownUser"); + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " " + + quot + mFromName + quot + " " + + LLTrans::getString("InvOfferOwnedByUnknownUser"); + chatHistory_string = mFromName + " " + + LLTrans::getString("InvOfferOwnedByUnknownUser"); } } } @@ -2085,7 +2091,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const { from_string = chatHistory_string = mFromName; } - + LLUUID destination; bool accept = true; @@ -4165,6 +4171,12 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) LLVOAvatar::AnimSourceIterator anim_it = avatarp->mAnimationSources.find(object_id); for (;anim_it != avatarp->mAnimationSources.end(); ++anim_it) { + if (anim_it->first != object_id) + { + // elements with the same key are always contiguous, bail if we went past the + // end of this object's animations + break; + } if (anim_it->second == animation_id) { anim_found = true; @@ -5627,7 +5639,7 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp bool caution = false; S32 count = 0; std::string perms; - BOOST_FOREACH(script_perm_t script_perm, SCRIPT_PERMISSIONS) + for (const script_perm_t& script_perm : SCRIPT_PERMISSIONS) { if ((orig_questions & script_perm.permbit) && script_perm.caution) @@ -5871,7 +5883,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data) S32 known_questions = 0; bool has_not_only_debit = questions ^ SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_DEBIT].permbit; // check the received permission flags against each permission - BOOST_FOREACH(script_perm_t script_perm, SCRIPT_PERMISSIONS) + for (const script_perm_t& script_perm : SCRIPT_PERMISSIONS) { if (questions & script_perm.permbit) { diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 668596b96c..8b9a59a79b 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2711,7 +2711,7 @@ void LLViewerObject::doUpdateInventory( deleteInventoryItem(item_id); LLPermissions perm(item->getPermissions()); LLPermissions* obj_perm = LLSelectMgr::getInstance()->findObjectPermissions(this); - bool is_atomic = ((S32)LLAssetType::AT_OBJECT == item->getType()) ? false : true; + bool is_atomic = (S32)LLAssetType::AT_OBJECT != item->getType(); if(obj_perm) { perm.setOwnerAndGroup(LLUUID::null, obj_perm->getOwner(), obj_perm->getGroup(), is_atomic); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 8e22576265..729098623f 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -2043,6 +2043,7 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) { LL_WARNS() << objectp->mID << " has self as parent, skipping!" << LL_ENDL; + ++iter; continue; } diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index 420f02d759..079fa82545 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -760,7 +760,7 @@ bool LLViewerOctreeGroup::boundObjects(bool empty, LLVector4a& minOut, LLVector4 //virtual bool LLViewerOctreeGroup::isVisible() const { - return mVisible[LLViewerCamera::sCurCameraID] >= LLViewerOctreeEntryData::getCurrentFrame() ? true : false; + return mVisible[LLViewerCamera::sCurCameraID] >= LLViewerOctreeEntryData::getCurrentFrame(); } //virtual @@ -888,7 +888,7 @@ LLOcclusionCullingGroup::~LLOcclusionCullingGroup() bool LLOcclusionCullingGroup::needsUpdate() { - return (LLDrawable::getCurrentFrame() % mSpatialPartition->mLODPeriod == mLODHash) ? true : false; + return LLDrawable::getCurrentFrame() % mSpatialPartition->mLODPeriod == mLODHash; } bool LLOcclusionCullingGroup::isRecentlyVisible() const @@ -906,7 +906,7 @@ bool LLOcclusionCullingGroup::isAnyRecentlyVisible() const //virtual void LLOcclusionCullingGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child) { - if (child->getListenerCount() == 0) + if (!child->hasListeners()) { new LLOcclusionCullingGroup(child, mSpatialPartition); } diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 7d9dfe7605..e655845077 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -299,14 +299,14 @@ public: LLOcclusionCullingGroup(const LLOcclusionCullingGroup& rhs) : LLViewerOctreeGroup(rhs) { *this = rhs; - } + } void setOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); void clearOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); void checkOcclusion(); //read back last occlusion query (if any) void doOcclusion(LLCamera* camera, const LLVector4a* shift = NULL); //issue occlusion query - bool isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? true : false; } - U32 getOcclusionState() const { return mOcclusionState[LLViewerCamera::sCurCameraID];} + bool isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state; } + U32 getOcclusionState() const { return mOcclusionState[LLViewerCamera::sCurCameraID];} bool needsUpdate(); U32 getLastOcclusionIssuedTime(); @@ -325,7 +325,7 @@ public: protected: void releaseOcclusionQueryObjectNames(); -private: +private: bool earlyFail(LLCamera* camera, const LLVector4a* bounds); protected: @@ -338,7 +338,7 @@ protected: U32 mOcclusionQuery[LLViewerCamera::NUM_CAMERAS]; U32 mOcclusionCheckCount[LLViewerCamera::NUM_CAMERAS]; -public: +public: static std::set<U32> sPendingQueries; };//LL_ALIGN_POSTFIX(16); @@ -356,7 +356,7 @@ protected: // MUST call from destructor of any derived classes (SL-17276) void cleanup(); -public: +public: U32 mPartitionType; U32 mDrawableType; OctreeNode* mOctree; @@ -376,7 +376,7 @@ public: protected: virtual bool earlyFail(LLViewerOctreeGroup* group); - + //agent space group cull S32 AABBInFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group); S32 AABBSphereIntersectGroupExtents(const LLViewerOctreeGroup* group); @@ -386,7 +386,7 @@ protected: S32 AABBInFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group); S32 AABBSphereIntersectObjectExtents(const LLViewerOctreeGroup* group); S32 AABBInFrustumObjectBounds(const LLViewerOctreeGroup* group); - + //local region space group cull S32 AABBInRegionFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group); S32 AABBInRegionFrustumGroupBounds(const LLViewerOctreeGroup* group); @@ -396,7 +396,7 @@ protected: S32 AABBInRegionFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group); S32 AABBInRegionFrustumObjectBounds(const LLViewerOctreeGroup* group); S32 AABBRegionSphereIntersectObjectExtents(const LLViewerOctreeGroup* group, const LLVector3& shift); - + virtual S32 frustumCheck(const LLViewerOctreeGroup* group) = 0; virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) = 0; @@ -405,7 +405,7 @@ protected: virtual void preprocess(LLViewerOctreeGroup* group); virtual void processGroup(LLViewerOctreeGroup* group); virtual void visit(const OctreeNode* branch); - + protected: LLCamera *mCamera; S32 mRes; diff --git a/indra/newview/llviewerparcelaskplay.cpp b/indra/newview/llviewerparcelaskplay.cpp index afbe2c94de..aea06834b2 100644 --- a/indra/newview/llviewerparcelaskplay.cpp +++ b/indra/newview/llviewerparcelaskplay.cpp @@ -287,7 +287,7 @@ void LLViewerParcelAskPlay::saveSettings() 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); + std::string parcel_id = std::to_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; diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index daeb9de1e3..8ed9d24c69 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -2344,7 +2344,7 @@ bool LLViewerParcelMgr::canAgentBuyParcel(LLParcel* parcel, bool forGroup) const && ((parcel->getSalePrice() > 0) || (authorizeBuyer.notNull())); bool isEmpowered - = forGroup ? gAgent.hasPowerInActiveGroup(GP_LAND_DEED) == true : true; + = forGroup ? gAgent.hasPowerInActiveGroup(GP_LAND_DEED) : true; bool isOwner = parcelOwner == (forGroup ? gAgent.getGroupID() : gAgent.getID()); @@ -2361,7 +2361,7 @@ bool LLViewerParcelMgr::canAgentBuyParcel(LLParcel* parcel, bool forGroup) const void LLViewerParcelMgr::startBuyLand(bool is_for_group) { - LLFloaterBuyLand::buyLand(getSelectionRegion(), mCurrentParcelSelection, is_for_group == true); + LLFloaterBuyLand::buyLand(getSelectionRegion(), mCurrentParcelSelection, is_for_group); } void LLViewerParcelMgr::startSellLand() diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 6a25f218c9..4ffe49beae 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -592,7 +592,7 @@ std::string LLViewerShaderMgr::loadBasicShaders() std::map<std::string, std::string> attribs; attribs["MAX_JOINTS_PER_MESH_OBJECT"] = - boost::lexical_cast<std::string>(LLSkinningUtil::getMaxJointCount()); + std::to_string(LLSkinningUtil::getMaxJointCount()); bool ssr = gSavedSettings.getBOOL("RenderScreenSpaceReflections"); diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 9109f49945..28e637cc68 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -401,7 +401,7 @@ bool LLEmbeddedItems::insertEmbeddedItem( LLInventoryItem* item, llwchar* ext_ch } sEntries[wc_emb].mItemPtr = item; - sEntries[wc_emb].mSaved = is_new ? false : true; + sEntries[wc_emb].mSaved = !is_new; *ext_char = wc_emb; mEmbeddedUsedChars.insert(wc_emb); return true; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 4b94fe141c..eab8e95ae7 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1,3 +1,4 @@ + /** * @file llviewertexture.cpp * @brief Object which handles a received image (and associated texture(s)) @@ -471,61 +472,10 @@ void LLViewerTexture::initClass() LLImageGL::sDefaultGLTexture = LLViewerFetchedTexture::sDefaultImagep->getGLTexture(); } -// tuning params -const F32 GPU_MEMORY_CHECK_WAIT_TIME = 1.0f; // non-const (used externally F32 texmem_lower_bound_scale = 0.85f; F32 texmem_middle_bound_scale = 0.925f; -//static -bool LLViewerTexture::isMemoryForTextureLow() -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - // Note: we need to figure out a better source for 'min' values, - // what is free for low end at minimal settings is 'nothing left' - // for higher end gpus at high settings. - const S32Megabytes MIN_FREE_TEXTURE_MEMORY(20); - const S32Megabytes MIN_FREE_MAIN_MEMORY(100); - - S32Megabytes gpu; - S32Megabytes physical; - getGPUMemoryForTextures(gpu, physical); - - return (gpu < MIN_FREE_TEXTURE_MEMORY); // || (physical < MIN_FREE_MAIN_MEMORY); -} - -//static -void LLViewerTexture::getGPUMemoryForTextures(S32Megabytes &gpu, S32Megabytes &physical) -{ - LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - static LLFrameTimer timer; - - static S32Megabytes gpu_res = S32Megabytes(S32_MAX); - static S32Megabytes physical_res = S32Megabytes(S32_MAX); - - if (timer.getElapsedTimeF32() < GPU_MEMORY_CHECK_WAIT_TIME) //call this once per second. - { - gpu = gpu_res; - physical = physical_res; - return; - } - timer.reset(); - - { - // For purposes of texture memory need to check both, actual free - // memory and estimated free texture memory from bias calculations - U32 free_memory = llmin(gViewerWindow->getWindow()->getAvailableVRAMMegabytes(), (U32)sFreeVRAMMegabytes); - gpu_res = (S32Megabytes)free_memory; - - //check main memory, only works for windows and macos. - LLMemory::updateMemoryInfo(); - physical_res = LLMemory::getAvailableMemKB(); - - gpu = gpu_res; - physical = physical_res; - } -} - //static void LLViewerTexture::updateClass() { @@ -544,10 +494,11 @@ void LLViewerTexture::updateClass() F64 texture_bytes_alloc = LLImageGL::getTextureBytesAllocated() / 1024.0 / 512.0; F64 vertex_bytes_alloc = LLVertexBuffer::getBytesAllocated() / 1024.0 / 512.0; + F64 render_bytes_alloc = LLRenderTarget::sBytesAllocated / 1024.0 / 512.0; // get an estimate of how much video memory we're using // NOTE: our metrics miss about half the vram we use, so this biases high but turns out to typically be within 5% of the real number - F32 used = (F32)ll_round(texture_bytes_alloc + vertex_bytes_alloc); + F32 used = (F32)ll_round(texture_bytes_alloc + vertex_bytes_alloc + render_bytes_alloc); F32 budget = max_vram_budget == 0 ? gGLManager.mVRAM : max_vram_budget; @@ -2132,7 +2083,7 @@ bool LLViewerFetchedTexture::updateFetch() } } - return mIsFetching ? true : false; + return mIsFetching; } void LLViewerFetchedTexture::clearFetchedResults() @@ -2586,7 +2537,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() { LL_WARNS() << "Raw Image with no Aux Data for callback" << LL_ENDL; } - bool final = mRawDiscardLevel <= entryp->mDesiredDiscard ? true : false; + bool final = mRawDiscardLevel <= entryp->mDesiredDiscard; //LL_INFOS() << "Running callback for " << getID() << LL_ENDL; //LL_INFOS() << mRawImage->getWidth() << "x" << mRawImage->getHeight() << LL_ENDL; entryp->mLastUsedDiscard = mRawDiscardLevel; @@ -2617,7 +2568,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() if (!entryp->mNeedsImageRaw && (entryp->mLastUsedDiscard > gl_discard)) { mLastCallBackActiveTime = sCurrentTime; - bool final = gl_discard <= entryp->mDesiredDiscard ? true : false; + bool final = gl_discard <= entryp->mDesiredDiscard; entryp->mLastUsedDiscard = gl_discard; entryp->mCallback(true, this, NULL, NULL, gl_discard, final, entryp->mUserData); if (final) diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index ffa072b7f6..c825e0977b 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -185,11 +185,7 @@ private: friend class LLUIImageList; virtual void switchToCachedImage(); - - static void getGPUMemoryForTextures(S32Megabytes &gpu, S32Megabytes &physical); -public: - static bool isMemoryForTextureLow(); protected: friend class LLViewerTextureList; LLUUID mID; @@ -308,7 +304,7 @@ public: void setLoadedCallback(loaded_callback_func cb, S32 discard_level, bool keep_imageraw, bool needs_aux, void* userdata, LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, bool pause = false); - bool hasCallbacks() { return mLoadedCallbackList.empty() ? false : true; } + bool hasCallbacks() { return !mLoadedCallbackList.empty(); } void pauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list); void unpauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list); bool doLoadedCallbacks(); diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 6fb85482d1..9ed96a22d6 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -416,7 +416,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& return NULL ; } - std::string full_path = gDirUtilp->findSkinnedFilename(LLDir::TEXTURES, filename); + std::string full_path = gDirUtilp->findSkinnedFilename("textures", filename); if (full_path.empty()) { LL_WARNS() << "Failed to find local image file: " << filename << LL_ENDL; @@ -678,12 +678,12 @@ void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image) } else { - if((mImageList.insert(image)).second != true) - { + if (!(mImageList.insert(image)).second) + { LL_WARNS() << "Error happens when insert image " << image->getID() << " into mImageList!" << LL_ENDL ; + } + image->setInImageList(true); } - image->setInImageList(true) ; -} } void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 8841cf2590..44297526e3 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -3976,7 +3976,7 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window) // start off using whole window to render world LLRect new_world_rect = mWindowRectRaw; - if (use_full_window == false && mWorldViewPlaceholder.get()) + if (!use_full_window && mWorldViewPlaceholder.get()) { new_world_rect = mWorldViewPlaceholder.get()->calcScreenRect(); // clamp to at least a 1x1 rect so we don't try to allocate zero width gl buffers @@ -4933,7 +4933,7 @@ bool LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei setCursor(UI_CURSOR_WAIT); // Hide all the UI widgets first and draw a frame - bool prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI) ? true : false; + bool prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI); if ( prev_draw_ui != show_ui) { @@ -4959,7 +4959,7 @@ bool LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei // SNAPSHOT S32 window_width = snapshot_width; S32 window_height = snapshot_height; - + // Note: Scaling of the UI is currently *not* supported so we limit the output size if UI is requested if (show_ui) { @@ -5015,7 +5015,7 @@ bool LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei scale_factor = llmax(1.0f, 1.0f / ratio) ; } } - + if (show_ui && scale_factor > 1.f) { // Note: we should never get there... @@ -5043,11 +5043,12 @@ bool LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei } else { - return false ; + return false; } + if (raw->isBufferInvalid()) { - return false ; + return false; } bool high_res = scale_factor >= 2.f; // Font scaling is slow, only do so if rez is much higher @@ -5194,7 +5195,6 @@ bool LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei { ret = raw->scale( image_width, image_height, false ); } - setCursor(UI_CURSOR_ARROW); @@ -5235,8 +5235,8 @@ bool LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_ glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // stencil buffer is deprecated | GL_STENCIL_BUFFER_BIT); setCursor(UI_CURSOR_WAIT); - bool prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI) ? true : false; - if (prev_draw_ui != false) + bool prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI); + if (prev_draw_ui) { LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI); } @@ -5312,7 +5312,7 @@ bool LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_ if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - if (prev_draw_ui != false) + if (prev_draw_ui) { LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI); } @@ -5343,7 +5343,7 @@ bool LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea LL_PROFILE_GPU_ZONE("cubeSnapshot"); llassert(LLPipeline::sRenderDeferred); llassert(!gCubeSnapshot); //assert a snapshot isn't already in progress - + U32 res = gPipeline.mRT->deferredScreen.getWidth(); //llassert(res <= gPipeline.mRT->deferredScreen.getWidth()); @@ -5355,7 +5355,7 @@ bool LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea // set new parameters specific to the 360 requirements LLPipeline::sUseOcclusion = 0; LLViewerCamera* camera = LLViewerCamera::getInstance(); - + LLViewerCamera saved_camera = LLViewerCamera::instance(); glh::matrix4f saved_proj = get_current_projection(); glh::matrix4f saved_mod = get_current_modelview(); @@ -5377,7 +5377,7 @@ bool LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea constexpr U32 dynamic_render_type_count = sizeof(dynamic_render_types) / sizeof(U32); bool prev_dynamic_render_type[dynamic_render_type_count]; - + if (!dynamic_render) { for (int i = 0; i < dynamic_render_type_count; ++i) @@ -5390,12 +5390,12 @@ bool LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea } } - bool prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI) ? true : false; - if (prev_draw_ui != false) + bool prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI); + if (prev_draw_ui) { LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI); } - + bool hide_hud = LLPipeline::sShowHUDAttachments; if (hide_hud) { @@ -5449,7 +5449,7 @@ bool LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - if (prev_draw_ui != false) + if (prev_draw_ui) { LLPipeline::toggleRenderDebugFeature(LLPipeline::RENDER_DEBUG_FEATURE_UI); } diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 2097d525d3..358aaab45e 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -539,8 +539,8 @@ private: bool mStatesDirty; U32 mCurrResolutionIndex; - boost::scoped_ptr<LLWindowListener> mWindowListener; - boost::scoped_ptr<LLViewerWindowListener> mViewerWindowListener; + std::unique_ptr<LLWindowListener> mWindowListener; + std::unique_ptr<LLViewerWindowListener> mViewerWindowListener; // Object temporarily hovered over while dragging LLPointer<LLViewerObject> mDragHoveredObject; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index fd99491eb7..e4f7e8292c 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -207,7 +207,7 @@ const U32 LLVOAvatar::VISUAL_COMPLEXITY_UNKNOWN = 0; const F64 HUD_OVERSIZED_TEXTURE_DATA_SIZE = 1024 * 1024; const F32 MAX_TEXTURE_WAIT_TIME_SEC = 60; -const F32 MAX_ATTACHMENT_WAIT_TIME_SEC = 120; +const F32 MAX_ATTACHMENT_WAIT_TIME_SEC = 60; const S32 MIN_NONTUNED_AVS = 5; @@ -679,7 +679,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mVisuallyMuteSetting(AV_RENDER_NORMALLY), mMutedAVColor(LLColor4::white /* used for "uninitialize" */), mFirstFullyVisible(true), - mFirstUseDelaySeconds(FIRST_APPEARANCE_CLOUD_MIN_DELAY), + mFirstDecloudTime(-1.f), mFullyLoaded(false), mPreviousFullyLoaded(false), mFullyLoadedInitialized(false), @@ -773,7 +773,7 @@ std::string LLVOAvatar::avString() const { if (isControlAvatar()) { - return getFullname(); + return " " + getFullname() + " "; } else { @@ -924,7 +924,9 @@ S32 LLVOAvatar::getRezzedStatus() const { if (getIsCloud()) return 0; bool textured = isFullyTextured(); - if (textured && allBakedTexturesCompletelyDownloaded()) return 3; + bool all_baked_loaded = allBakedTexturesCompletelyDownloaded(); + if (textured && all_baked_loaded && getAttachmentCount() == mSimAttachments.size()) return 4; + if (textured && all_baked_loaded) return 3; if (textured) return 2; llassert(hasGray()); return 1; // gray @@ -977,10 +979,13 @@ bool LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) } // static -void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts) +void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts, F32& avg_cloud_time, S32& cloud_avatars) { counts.clear(); - counts.resize(4); + counts.resize(5); + avg_cloud_time = 0; + cloud_avatars = 0; + S32 count_avg = 0; for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) { @@ -989,8 +994,23 @@ void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts) { S32 rez_status = inst->getRezzedStatus(); counts[rez_status]++; + F32 time = inst->getFirstDecloudTime(); + if (time >= 0) + { + avg_cloud_time+=time; + count_avg++; + } + if (!inst->isFullyLoaded() || time < 0) + { + // still renders as cloud + cloud_avatars++; + } } } + if (count_avg > 0) + { + avg_cloud_time /= count_avg; + } } // static @@ -998,8 +1018,9 @@ std::string LLVOAvatar::rezStatusToString(S32 rez_status) { if (rez_status==0) return "cloud"; if (rez_status==1) return "gray"; - if (rez_status==2) return "downloading"; - if (rez_status==3) return "full"; + if (rez_status==2) return "downloading baked"; + if (rez_status==3) return "loading attachments"; + if (rez_status==4) return "full"; return "unknown"; } @@ -1139,7 +1160,7 @@ void LLVOAvatar::deleteCachedImages(bool clearAll) // LLVOAvatar::initClass() //------------------------------------------------------------------------ void LLVOAvatar::initClass() -{ +{ gAnimLibrary.animStateSetString(ANIM_AGENT_BODY_NOISE,"body_noise"); gAnimLibrary.animStateSetString(ANIM_AGENT_BREATHE_ROT,"breathe_rot"); gAnimLibrary.animStateSetString(ANIM_AGENT_PHYSICS_MOTION,"physics_motion"); @@ -2115,7 +2136,7 @@ void LLVOAvatar::resetSkeleton(bool reset_animations) LL_DEBUGS("Avatar") << avString() << " reset starts" << LL_ENDL; if (!isControlAvatar() && !mLastProcessedAppearance) { - LL_WARNS() << "Can't reset avatar; no appearance message has been received yet." << LL_ENDL; + LL_WARNS() << "Can't reset avatar " << getID() << "; no appearance message has been received yet." << LL_ENDL; return; } @@ -2455,19 +2476,20 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, U32 block_num, const EObjectUpdateType update_type, LLDataPacker *dp) { - const bool has_name = !getNVPair("FirstName"); + const bool had_no_name = !getNVPair("FirstName"); // Do base class updates... U32 retval = LLViewerObject::processUpdateMessage(mesgsys, user_data, block_num, update_type, dp); // Print out arrival information once we have name of avatar. - if (has_name && getNVPair("FirstName")) + const bool has_name = getNVPair("FirstName"); + if (had_no_name && has_name) { mDebugExistenceTimer.reset(); - debugAvatarRezTime("AvatarRezArrivedNotification","avatar arrived"); + debugAvatarRezTime("AvatarRezArrivedNotification", "avatar arrived"); } - if(retval & LLViewerObject::INVALID_UPDATE) + if (retval & LLViewerObject::INVALID_UPDATE) { if (isSelf()) { @@ -2564,6 +2586,27 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) LL_INFOS() << "Warning! Idle on dead avatar" << LL_ENDL; return; } + + LLCachedControl<bool> friends_only(gSavedSettings, "RenderAvatarFriendsOnly", false); + if (friends_only() + && !isUIAvatar() + && !isControlAvatar() + && !isSelf() + && !isBuddy()) + { + if (mNameText) + { + mNameIsSet = false; + mNameText->markDead(); + mNameText = NULL; + sNumVisibleChatBubbles--; + } + deleteParticleSource(); + mVoiceVisualizer->setVoiceEnabled(false); + + return; + } + // record time and refresh "tooSlow" status updateTooSlow(); @@ -3100,14 +3143,15 @@ void LLVOAvatar::idleUpdateLoadingEffect() if (mFirstFullyVisible) { mFirstFullyVisible = false; + mFirstDecloudTime = mFirstAppearanceMessageTimer.getElapsedTimeF32(); if (isSelf()) { - LL_INFOS("Avatar") << avString() << "self isFullyLoaded, mFirstFullyVisible" << LL_ENDL; + LL_INFOS("Avatar") << avString() << "self isFullyLoaded, mFirstFullyVisible after " << mFirstDecloudTime << LL_ENDL; LLAppearanceMgr::instance().onFirstFullyVisible(); } else { - LL_INFOS("Avatar") << avString() << "other isFullyLoaded, mFirstFullyVisible" << LL_ENDL; + LL_INFOS("Avatar") << avString() << "other isFullyLoaded, mFirstFullyVisible after " << mFirstDecloudTime << LL_ENDL; } } @@ -3418,6 +3462,7 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name) static LLUICachedControl<bool> show_display_names("NameTagShowDisplayNames", true); static LLUICachedControl<bool> show_usernames("NameTagShowUsernames", true); + static LLUICachedControl<bool> show_rez_status("NameTagDebugAVRezState", false); if (LLAvatarName::useDisplayNames()) { @@ -3451,6 +3496,12 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name) addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font, true); } + if (show_rez_status) + { + std::string av_string = LLVOAvatar::rezStatusToString(mLastRezzedStatus); + addNameTagLine(av_string, name_tag_color, LLFontGL::NORMAL, LLFontGL::getFontSansSerifSmall(), true); + } + mNameAway = is_away; mNameDoNotDisturb = is_do_not_disturb; mNameMute = is_muted; @@ -4294,6 +4345,15 @@ void LLVOAvatar::updateOrientation(LLAgent& agent, F32 speed, F32 delta_time) if (mTurning) { pelvis_rot_threshold *= 0.4f; + // account for fps, assume that above value is for ~60fps + constexpr F32 default_frame_sec = 0.016f; + F32 prev_frame_sec = LLFrameTimer::getFrameDeltaTimeF32(); + if (default_frame_sec > prev_frame_sec) + { + // reduce threshold since turn rate per second is constant, + // shorter frame means shorter turn. + pelvis_rot_threshold *= prev_frame_sec/default_frame_sec; + } } // am I done turning? @@ -5863,7 +5923,7 @@ void LLVOAvatar::processAnimationStateChanges() startMotion(ANIM_AGENT_BODY_NOISE); } } - + // clear all current animations AnimIterator anim_it; for (anim_it = mPlayingAnimations.begin(); anim_it != mPlayingAnimations.end();) @@ -6565,15 +6625,15 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL LL_DEBUGS("AnimatedObjects") << "adding attachment overrides for " << mesh_id << " to root object " << root_object->getID() << LL_ENDL; } - bool fullRig = (jointCnt>=JOINT_COUNT_REQUIRED_FOR_FULLRIG) ? true : false; + bool fullRig = jointCnt>=JOINT_COUNT_REQUIRED_FOR_FULLRIG; if ( fullRig && !mesh_overrides_loaded ) - { + { for ( int i=0; i<jointCnt; ++i ) { std::string lookingForJoint = pSkinData->mJointNames[i].c_str(); LLJoint* pJoint = getJoint( lookingForJoint ); if (pJoint) - { + { const LLVector3& jointPos = LLVector3(pSkinData->mAlternateBindMatrix[i].getTranslation()); if (pJoint->aboveJointPosThreshold(jointPos)) { @@ -6584,9 +6644,9 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL { //If joint is a pelvis then handle old/new pelvis to foot values if ( lookingForJoint == "mPelvis" ) - { - pelvisGotSet = true; - } + { + pelvisGotSet = true; + } } if (pSkinData->mLockScaleIfJointPosition) { @@ -6595,8 +6655,9 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL pJoint->addAttachmentScaleOverride(pJoint->getDefaultScale(), mesh_id, avString()); } } - } - } + } + } + if (pelvisZOffset != 0.0F) { F32 pelvis_fixup_before; @@ -6606,25 +6667,25 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL hasPelvisFixup(pelvis_fixup_after); // Don't have to check bool here because we just added it... if (!has_fixup_before || (pelvis_fixup_before != pelvis_fixup_after)) { - pelvisGotSet = true; + pelvisGotSet = true; } } mActiveOverrideMeshes.insert(mesh_id); onActiveOverrideMeshesChanged(); - } + } } } else { LL_DEBUGS("AnimatedObjects") << "failed to add attachment overrides for root object " << root_object->getID() << " not mesh or no pSkinData" << LL_ENDL; } - + //Rebuild body data if we altered joints/pelvis if ( pelvisGotSet ) { postPelvisSetRecalc(); - } + } } //----------------------------------------------------------------------------- @@ -6663,7 +6724,6 @@ void LLVOAvatar::getAttachmentOverrideNames(std::set<std::string>& pos_names, st } // Attachment points don't have scales. } - } //----------------------------------------------------------------------------- @@ -6683,6 +6743,7 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const { LL_DEBUGS("Avatar") << getFullname() << " no attachment positions defined for any joints" << "\n" << LL_ENDL; } + if (scale_names.size()) { std::stringstream ss; @@ -6778,25 +6839,26 @@ void LLVOAvatar::removeAttachmentOverridesForObject(const LLUUID& mesh_id) for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++) { LLJoint *pJoint = getJoint(joint_num); - if ( pJoint ) - { + if (pJoint) + { bool dummy; // unused pJoint->removeAttachmentPosOverride(mesh_id, av_string, dummy); pJoint->removeAttachmentScaleOverride(mesh_id, av_string); - } - if ( pJoint && pJoint == pJointPelvis) + } + if (pJoint && pJoint == pJointPelvis) { - removePelvisFixup( mesh_id ); + removePelvisFixup(mesh_id); // SL-315 - pJoint->setPosition( LLVector3( 0.0f, 0.0f, 0.0f) ); - } - } - + pJoint->setPosition(LLVector3( 0.0f, 0.0f, 0.0f)); + } + } + postPelvisSetRecalc(); mActiveOverrideMeshes.erase(mesh_id); onActiveOverrideMeshesChanged(); } + //----------------------------------------------------------------------------- // getCharacterPosition() //----------------------------------------------------------------------------- @@ -6812,7 +6874,6 @@ LLVector3 LLVOAvatar::getCharacterPosition() } } - //----------------------------------------------------------------------------- // LLVOAvatar::getCharacterRotation() //----------------------------------------------------------------------------- @@ -6821,7 +6882,6 @@ LLQuaternion LLVOAvatar::getCharacterRotation() return getRotation(); } - //----------------------------------------------------------------------------- // LLVOAvatar::getCharacterVelocity() //----------------------------------------------------------------------------- @@ -6830,7 +6890,6 @@ LLVector3 LLVOAvatar::getCharacterVelocity() return getVelocity() - mStepObjectVelocity; } - //----------------------------------------------------------------------------- // LLVOAvatar::getCharacterAngularVelocity() //----------------------------------------------------------------------------- @@ -6853,7 +6912,7 @@ void LLVOAvatar::getGround(const LLVector3 &in_pos_agent, LLVector3 &out_pos_age out_pos_agent = in_pos_agent; return; } - + p0_global = gAgent.getPosGlobalFromAgent(in_pos_agent) + z_vec; p1_global = gAgent.getPosGlobalFromAgent(in_pos_agent) - z_vec; LLViewerObject *obj; @@ -6870,7 +6929,6 @@ F32 LLVOAvatar::getTimeDilation() return mRegionp ? mRegionp->getTimeDilation() : 1.f; } - //----------------------------------------------------------------------------- // LLVOAvatar::getPixelArea() //----------------------------------------------------------------------------- @@ -6883,8 +6941,6 @@ F32 LLVOAvatar::getPixelArea() const return mPixelArea; } - - //----------------------------------------------------------------------------- // LLVOAvatar::getPosGlobalFromAgent() //----------------------------------------------------------------------------- @@ -6901,7 +6957,6 @@ LLVector3 LLVOAvatar::getPosAgentFromGlobal(const LLVector3d &position) return gAgent.getPosAgentFromGlobal(position); } - //----------------------------------------------------------------------------- // requestStopMotion() //----------------------------------------------------------------------------- @@ -6921,7 +6976,7 @@ bool LLVOAvatar::loadSkeletonNode () { return false; } - + bool ignore_hud_joints = false; initAttachmentPoints(ignore_hud_joints); @@ -7888,11 +7943,11 @@ LLVOAvatar* LLVOAvatar::findAvatarFromAttachment( LLViewerObject* obj ) return NULL; } -S32 LLVOAvatar::getAttachmentCount() +S32 LLVOAvatar::getAttachmentCount() const { S32 count = 0; - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) + for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) { LLViewerJointAttachment* pAttachment = iter->second; count += pAttachment->mAttachedObjects.size(); @@ -8060,7 +8115,7 @@ bool LLVOAvatar::getIsCloud() const void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status) { // State machine for rezzed status. Statuses are -1 on startup, 0 - // = cloud, 1 = gray, 2 = downloading, 3 = full. + // = cloud, 1 = gray, 2 = downloading, 3 = waiting for attachments, 4 = full. // Purpose is to collect time data for each it takes avatar to reach // various loading landmarks: gray, textured (partial), textured fully. @@ -8093,7 +8148,7 @@ void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status) stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); stopPhase("first_load_" + LLVOAvatar::rezStatusToString(i), false); } - if (rez_status == 3) + if (rez_status == 4) { // "fully loaded", mark any pending appearance change complete. selfStopPhase("update_appearance_from_cof"); @@ -8104,6 +8159,12 @@ void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status) } } mLastRezzedStatus = rez_status; + + static LLUICachedControl<bool> show_rez_status("NameTagDebugAVRezState", false); + if (show_rez_status) + { + mNameIsSet = false; + } } } @@ -8234,7 +8295,7 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse bool LLVOAvatar::updateIsFullyLoaded() { S32 rez_status = getRezzedStatus(); - bool loading = getIsCloud(); + bool loading = rez_status == 0; if (mFirstFullyVisible && !mIsControlAvatar) { loading = ((rez_status < 2) @@ -8249,7 +8310,7 @@ bool LLVOAvatar::updateIsFullyLoaded() ); // compare amount of attachments to one reported by simulator - if (!loading && !isSelf() && mLastCloudAttachmentCount != mSimAttachments.size()) + if (!loading && !isSelf() && rez_status < 4 && mLastCloudAttachmentCount < mSimAttachments.size()) { S32 attachment_count = getAttachmentCount(); if (mLastCloudAttachmentCount != attachment_count) @@ -8317,11 +8378,12 @@ bool LLVOAvatar::processFullyLoadedChange(bool loading) if (mFirstFullyVisible) { + F32 first_use_delay = FIRST_APPEARANCE_CLOUD_MIN_DELAY; if (!isSelf() && loading) { // Note that textures can causes 60s delay on thier own // so this delay might end up on top of textures' delay - mFirstUseDelaySeconds = llclamp( + first_use_delay = llclamp( mFirstAppearanceMessageTimer.getElapsedTimeF32(), FIRST_APPEARANCE_CLOUD_MIN_DELAY, FIRST_APPEARANCE_CLOUD_MAX_DELAY); @@ -8330,10 +8392,10 @@ bool LLVOAvatar::processFullyLoadedChange(bool loading) { // Impostors are less of a priority, // let them stay cloud longer - mFirstUseDelaySeconds *= FIRST_APPEARANCE_CLOUD_IMPOSTOR_MODIFIER; + first_use_delay *= FIRST_APPEARANCE_CLOUD_IMPOSTOR_MODIFIER; } } - mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > mFirstUseDelaySeconds); + mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > first_use_delay); } else { @@ -8342,7 +8404,7 @@ bool LLVOAvatar::processFullyLoadedChange(bool loading) if (!mPreviousFullyLoaded && !loading && mFullyLoaded) { - debugAvatarRezTime("AvatarRezNotification","fully loaded"); + debugAvatarRezTime("AvatarRezNotification", "fully loaded"); } // did our loading state "change" from last call? @@ -9344,9 +9406,20 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe << (attachment_id.isNull() ? "pending" : attachment_id.asString()) << " on point " << (S32)attach_point << LL_ENDL; - mSimAttachments[attachment_id] = attach_point; - } + if (attachment_id.notNull()) + { + mSimAttachments[attachment_id] = attach_point; + } + else + { + // at the moment viewer is only interested in non-null attachments + LL_DEBUGS("AVAppearanceAttachments") << "AV " << getID() + << " has null attachment on point " << (S32)attach_point + << ", discarding" << LL_ENDL; + } + } + // todo? Doesn't detect if attachments were switched if (old_size != mSimAttachments.size()) { mLastCloudAttachmentCount = 0; @@ -11246,7 +11319,10 @@ void LLVOAvatar::setOverallAppearanceNormal() return; LLVector3 pelvis_pos = getJoint("mPelvis")->getPosition(); - resetSkeleton(false); + if (isControlAvatar() || mLastProcessedAppearance) + { + resetSkeleton(false); + } getJoint("mPelvis")->setPosition(pelvis_pos); for (auto it = mJellyAnims.begin(); it != mJellyAnims.end(); ++it) @@ -11528,15 +11604,16 @@ bool LLVOAvatar::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U { return false; } - - if( !getImage( te, index ) ) + + LLViewerTexture* tex = getImage(te, index); + if (!tex) { LL_WARNS() << "getImage( " << te << ", " << index << " ) returned 0" << LL_ENDL; return false; } - return (getImage(te, index)->getID() != IMG_DEFAULT_AVATAR && - getImage(te, index)->getID() != IMG_DEFAULT); + return (tex->getID() != IMG_DEFAULT_AVATAR && + tex->getID() != IMG_DEFAULT); } //virtual @@ -11546,13 +11623,10 @@ bool LLVOAvatar::isTextureVisible(LLAvatarAppearanceDefines::ETextureIndex type, { return isTextureDefined(type, index); } - else - { - // baked textures can use TE images directly - return ((isTextureDefined(type) || isSelf()) - && (getTEImage(type)->getID() != IMG_INVISIBLE - || LLDrawPoolAlpha::sShowDebugAlpha)); - } + + // baked textures can use TE images directly + return ((isTextureDefined(type) || isSelf()) && + (getTEImage(type)->getID() != IMG_INVISIBLE || LLDrawPoolAlpha::sShowDebugAlpha)); } //virtual @@ -11669,5 +11743,8 @@ F32 LLVOAvatar::getAverageGPURenderTime() return ret; } - +bool LLVOAvatar::isBuddy() const +{ + return LLAvatarTracker::instance().isBuddy(getID()); +} diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2af62ca83b..e5d232b792 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -253,6 +253,7 @@ public: virtual bool isControlAvatar() const { return mIsControlAvatar; } // True if this avatar is a control av (no associated user) virtual bool isUIAvatar() const { return mIsUIAvatar; } // True if this avatar is a supplemental av used in some UI views (no associated user) + virtual bool isBuddy() const; // If this is an attachment, return the avatar it is attached to. Otherwise NULL. virtual const LLVOAvatar *getAttachedAvatar() const { return NULL; } @@ -382,7 +383,8 @@ public: // Loading state //-------------------------------------------------------------------- public: - bool isFullyLoaded() const; + bool isFullyLoaded() const; + F32 getFirstDecloudTime() const {return mFirstDecloudTime;} // check and return current state relative to limits // default will test only the geometry (combined=false). @@ -422,7 +424,7 @@ protected: private: bool mFirstFullyVisible; - F32 mFirstUseDelaySeconds; + F32 mFirstDecloudTime; LLFrameTimer mFirstAppearanceMessageTimer; bool mFullyLoaded; @@ -715,7 +717,7 @@ public: bool isFullyBaked(); static bool areAllNearbyInstancesBaked(S32& grey_avatars); - static void getNearbyRezzedStats(std::vector<S32>& counts); + static void getNearbyRezzedStats(std::vector<S32>& counts, F32& avg_cloud_time, S32& cloud_avatars); static std::string rezStatusToString(S32 status); //-------------------------------------------------------------------- @@ -939,7 +941,7 @@ protected: // Map of attachment points, by ID //-------------------------------------------------------------------- public: - S32 getAttachmentCount(); // Warning: order(N) not order(1) + S32 getAttachmentCount() const; // Warning: order(N) not order(1) typedef std::map<S32, LLViewerJointAttachment*> attachment_map_t; attachment_map_t mAttachmentPoints; std::vector<LLPointer<LLViewerObject> > mPendingAttachment; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index b1ca5f7a4b..dc07c2d711 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -834,7 +834,11 @@ void LLVOAvatarSelf::stopMotionFromSource(const LLUUID& source_id) for (AnimSourceIterator motion_it = mAnimationSources.find(source_id); motion_it != mAnimationSources.end(); ) { gAgent.sendAnimationRequest(motion_it->second, ANIM_REQUEST_STOP); - mAnimationSources.erase(motion_it++); + mAnimationSources.erase(motion_it); + // Must find() after each erase() to deal with potential iterator invalidation + // This also ensures that we don't go past the end of this source's animations + // into those of another source. + motion_it = mAnimationSources.find(source_id); } @@ -2226,16 +2230,21 @@ void LLVOAvatarSelf::appearanceChangeMetricsCoro(std::string url) // Status of our own rezzing. msg["rez_status"] = LLVOAvatar::rezStatusToString(getRezzedStatus()); + msg["first_decloud_time"] = getFirstDecloudTime(); // Status of all nearby avs including ourself. msg["nearby"] = LLSD::emptyArray(); std::vector<S32> rez_counts; - LLVOAvatar::getNearbyRezzedStats(rez_counts); + F32 avg_time; + S32 total_cloud_avatars; + LLVOAvatar::getNearbyRezzedStats(rez_counts, avg_time, total_cloud_avatars); for (S32 rez_stat = 0; rez_stat < rez_counts.size(); ++rez_stat) { std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat); msg["nearby"][rez_status_name] = rez_counts[rez_stat]; } + msg["nearby"]["avg_decloud_time"] = avg_time; + msg["nearby"]["cloud_total"] = total_cloud_avatars; // std::vector<std::string> bucket_fields("timer_name","is_self","grid_x","grid_y","is_using_server_bake"); std::vector<std::string> by_fields; diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index c7b61edd1c..46bac63d93 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -110,6 +110,7 @@ private: public: /*virtual*/ bool isSelf() const { return true; } + virtual bool isBuddy() const { return false; } /*virtual*/ bool isValid() const; //-------------------------------------------------------------------- diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index 3d7cedb823..304b7adfb7 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -284,7 +284,7 @@ void LLVoiceVisualizer::lipStringToF32s ( std::string& in_string, F32*& out_F32s //-------------------------------------------------------------------------- void LLVoiceVisualizer::lipSyncOohAah( F32& ooh, F32& aah ) { - if( ( sLipSyncEnabled == true ) && mCurrentlySpeaking ) + if (sLipSyncEnabled && mCurrentlySpeaking) { U32 transfer_index = (U32) (sOohPowerTransfersf * mSpeakingAmplitude); if (transfer_index >= sOohPowerTransfers) diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 4caac36858..429310b5e8 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -5971,7 +5971,7 @@ void LLVivoxVoiceClient::filePlaybackSetMode(bool vox, float speed) } //------------------------------------------------------------------------ -std::set<LLVivoxVoiceClient::sessionState::wptr_t> LLVivoxVoiceClient::sessionState::mSession; +std::set<LLVivoxVoiceClient::sessionState::wptr_t, std::owner_less<LLVivoxVoiceClient::sessionState::wptr_t>> LLVivoxVoiceClient::sessionState::mSession; LLVivoxVoiceClient::sessionState::sessionState() : diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index bf1cec7d89..aaff93495a 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -294,8 +294,8 @@ protected: bool mAvatarIDValid; bool mIsSelf; }; - typedef boost::shared_ptr<participantState> participantStatePtr_t; - typedef boost::weak_ptr<participantState> participantStateWptr_t; + typedef std::shared_ptr<participantState> participantStatePtr_t; + typedef std::weak_ptr<participantState> participantStateWptr_t; typedef std::map<const std::string, participantStatePtr_t> participantMap; typedef std::map<const LLUUID, participantStatePtr_t> participantUUIDMap; @@ -303,10 +303,10 @@ protected: struct sessionState { public: - typedef boost::shared_ptr<sessionState> ptr_t; - typedef boost::weak_ptr<sessionState> wptr_t; + typedef std::shared_ptr<sessionState> ptr_t; + typedef std::weak_ptr<sessionState> wptr_t; - typedef boost::function<void(const ptr_t &)> sessionFunc_t; + typedef std::function<void(const ptr_t &)> sessionFunc_t; static ptr_t createSession(); ~sessionState(); @@ -370,7 +370,7 @@ protected: private: sessionState(); - static std::set<wptr_t> mSession; // canonical list of outstanding sessions. + static std::set<wptr_t, std::owner_less<wptr_t>> mSession; // canonical list of outstanding sessions. std::set<wptr_t>::iterator mMyIterator; // used for delete static void for_eachPredicate(const wptr_t &a, sessionFunc_t func); @@ -381,7 +381,7 @@ protected: static bool testByCallerId(const LLVivoxVoiceClient::sessionState::wptr_t &a, LLUUID participantId); }; - typedef boost::shared_ptr<sessionState> sessionStatePtr_t; + typedef std::shared_ptr<sessionState> sessionStatePtr_t; typedef std::map<std::string, sessionStatePtr_t> sessionMap; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index f2fb7b7396..0392ea864e 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3553,9 +3553,10 @@ bool LLVOVolume::isVolumeGlobal() const { if (mVolumeImpl) { - return mVolumeImpl->isVolumeGlobal() ? true : false; + return mVolumeImpl->isVolumeGlobal(); } - else if (mRiggedVolume.notNull()) + + if (mRiggedVolume.notNull()) { return true; } @@ -4577,6 +4578,11 @@ bool LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& } } + if (getClickAction() == CLICK_ACTION_IGNORE && !LLFloater::isVisible(gFloaterTools)) + { + return false; + } + bool ret = false; LLVolume* volume = getVolume(); @@ -5277,7 +5283,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if (mat) { - bool is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) || (te->getColor().mV[3] < 0.999f) ? true : false; + bool is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) || (te->getColor().mV[3] < 0.999f); if (type == LLRenderPass::PASS_ALPHA) { shader_mask = mat->getShaderMask(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND, is_alpha); @@ -6439,7 +6445,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace tex = facep->getTexture(); - bool is_alpha = (facep->getPoolType() == LLDrawPool::POOL_ALPHA) ? true : false; + bool is_alpha = facep->getPoolType() == LLDrawPool::POOL_ALPHA; LLMaterial* mat = nullptr; bool can_be_shiny = false; @@ -6465,7 +6471,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace if (!gltf_mat) { - is_alpha = (is_alpha || blinn_phong_transparent) ? true : false; + is_alpha |= blinn_phong_transparent; } if (gltf_mat || (mat && !hud_group)) diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index 9515ace10e..26799d60be 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -388,7 +388,7 @@ static void mouseEvent(const MouseFunc& func, const LLSD& request) LLCoordGL pos(request["x"].asInteger(), request["y"].asInteger()); bool has_pos(request.has("x") && request.has("y")); - boost::scoped_ptr<LLView::TemporaryDrilldownFunc> tempfunc; + std::unique_ptr<LLView::TemporaryDrilldownFunc> tempfunc; // Documentation for mouseDown(), mouseUp() and mouseMove() claims you // must either specify ["path"], or both of ["x"] and ["y"]. You MAY diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index a90839ae7e..129bbef185 100755 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -345,7 +345,7 @@ void LLWorldMapView::setPanWithInterpTime(S32 x, S32 y, bool snap, F32 interp_ti mMapIterpTime = interp_time; } -bool LLWorldMapView::showRegionInfo() { return (LLWorldMipmap::scaleToLevel(mMapScale) <= DRAW_SIMINFO_THRESHOLD ? true : false); } +bool LLWorldMapView::showRegionInfo() { return LLWorldMipmap::scaleToLevel(mMapScale) <= DRAW_SIMINFO_THRESHOLD; } /////////////////////////////////////////////////////////////////////////////////// // HELPERS diff --git a/indra/newview/llxmlrpclistener.cpp b/indra/newview/llxmlrpclistener.cpp index b816f9a3b5..3c2c6d15c4 100644 --- a/indra/newview/llxmlrpclistener.cpp +++ b/indra/newview/llxmlrpclistener.cpp @@ -544,7 +544,7 @@ private: const std::string mMethod; const std::string mReplyPump; LLTempBoundListener mBoundListener; - boost::scoped_ptr<LLXMLRPCTransaction> mTransaction; + std::unique_ptr<LLXMLRPCTransaction> mTransaction; LLXMLRPCTransaction::EStatus mPreviousStatus; // To detect state changes. }; diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index ba7e8d7298..a77c31eee3 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -188,7 +188,7 @@ public: virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response); - typedef boost::shared_ptr<LLXMLRPCTransaction::Handler> ptr_t; + typedef std::shared_ptr<LLXMLRPCTransaction::Handler> ptr_t; private: diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml index 4655a4d394..93b306d7d7 100644 --- a/indra/newview/skins/default/xui/en/floater_camera.xml +++ b/indra/newview/skins/default/xui/en/floater_camera.xml @@ -138,13 +138,13 @@ </panel> </panel> <panel - follows="all" + follows="left|top" height="102" layout="topleft" left_pad="2" + right="-2" name="buttons_panel" - top="22" - width="212"> + top="22"> <panel_camera_item name="front_view" tool_tip="Front View" @@ -253,4 +253,22 @@ function="CameraPresets.Save"/> </button> </panel> + <panel + name="viewer_camera_info" + left="0" + top="135" + width="400" + height="150" + border="true" + visible="false" + background_visible="true"/> + <panel + name="agent_camera_info" + left="0" + top="285" + width="400" + height="150" + border="true" + visible="false" + background_visible="true"/> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_inventory_thumbnails_helper.xml b/indra/newview/skins/default/xui/en/floater_inventory_thumbnails_helper.xml new file mode 100644 index 0000000000..aa3500bac2 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_inventory_thumbnails_helper.xml @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + legacy_header_height="18" + can_resize="false" + height="600" + layout="topleft" + min_height="175" + min_width="500" + name="contents" + help_topic="contents" + title="Inventory Thumbnails Helper" + width="800"> + <scroll_list + top="20" + height="350" + draw_stripes="true" + draw_heading="true" + follows="all" + layout="topleft" + left="8" + multi_select="true" + name="inventory_thumbnails_list" + right="-8" + tool_tip="Paste items from your inventory"> + <scroll_list.columns + dynamic_width="true" + label="Inventory Item" + name="item_name" + relative_width="0.4" /> + <scroll_list.columns + dynamic_width="true" + label="Existing Texture" + name="existing_texture" + relative_width="0.3" /> + <scroll_list.columns + dynamic_width="true" + label="New Texture" + name="new_texture" + relative_width="0.3" /> + </scroll_list> + <text_editor + top="375" + height="140" + follows="all" + left="8" + right="-8" + name="output_log" + font="Monospace" + text_color="0.1 0.5 0.1 1.0" + width="480"> + </text_editor> + <button + follows="left|bottom" + height="20" + label="Paste items from Inventory" + layout="topleft" + left="10" + name="paste_items_btn" + bottom="-60" + width="235" /> + <button + follows="left|bottom" + height="20" + label="Paste textures from Inventory" + layout="topleft" + left_delta="0" + name="paste_textures_btn" + top_delta="26 " + width="235" /> + <button + follows="left|bottom" + height="20" + label="Write Thumbnails" + layout="topleft" + left_delta="0" + name="write_thumbnails_btn" + top_delta="26 " + width="235" /> + <button + follows="left|bottom" + height="20" + label="Log items with no thumbnail" + layout="bottomleft" + right="-10" + name="log_missing_thumbnails_btn" + bottom="60" + width="235" /> + <button + follows="left|bottom" + height="20" + label="Clear thumbnails from pasted items" + layout="bottomleft" + right="-10" + name="clear_thumbnails_btn" + top_delta="26" + width="235" /> + + +</floater>
\ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/floater_publish_classified.xml b/indra/newview/skins/default/xui/en/floater_publish_classified.xml index 2d7d03f7a0..04840e1c64 100644 --- a/indra/newview/skins/default/xui/en/floater_publish_classified.xml +++ b/indra/newview/skins/default/xui/en/floater_publish_classified.xml @@ -25,6 +25,7 @@ Remember, Classified fees are non-refundable. </text> <spinner decimal_digits="0" + allow_digits_only="true" follows="left|top" font="SansSerif" halign="left" @@ -36,7 +37,6 @@ Remember, Classified fees are non-refundable. layout="topleft" left="15" value="50" - min_val="50" max_val="999999" name="price_for_listing" top_pad="10" diff --git a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml index d9f847a4fa..16907d3577 100644 --- a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml @@ -35,7 +35,7 @@ layout="topleft" name="Folder Wearables Separator" /> <menu_item_call - label="Replace Current Outfit" + label="Replace current outfit" layout="topleft" name="Replace Outfit"> <menu_item_call.on_click @@ -43,7 +43,7 @@ parameter="replaceoutfit" /> </menu_item_call> <menu_item_call - label="Add To Current Outfit" + label="Add folder items" layout="topleft" name="Add To Outfit"> <menu_item_call.on_click @@ -51,7 +51,7 @@ parameter="addtooutfit" /> </menu_item_call> <menu_item_call - label="Remove From Current Outfit" + label="Take off folder items" layout="topleft" name="Remove From Outfit"> <menu_item_call.on_click diff --git a/indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml b/indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml index 25d64ba74d..99cee83f4e 100755 --- a/indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml +++ b/indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml @@ -3,7 +3,7 @@ layout="topleft" name="Outfit"> <menu_item_call - label="Wear - Replace Current Outfit" + label="Replace current outfit" layout="topleft" name="wear_replace"> <on_click @@ -16,7 +16,7 @@ parameter="wear_replace" /> </menu_item_call> <menu_item_call - label="Wear - Add to Current Outfit" + label="Add outfit items" layout="topleft" name="wear_add"> <on_click @@ -29,7 +29,7 @@ parameter="wear_add" /> </menu_item_call> <menu_item_call - label="Take Off - Remove from Current Outfit" + label="Take off outfit items" layout="topleft" name="take_off"> <on_click @@ -41,17 +41,60 @@ function="Outfit.OnVisible" parameter="take_off" /> </menu_item_call> + <menu_item_separator/> <menu_item_call - label="Image..." - layout="topleft" - name="thumbnail"> + label="Image..." + layout="topleft" + name="thumbnail"> + <on_click + function="Outfit.Thumbnail" /> + </menu_item_call> + <menu_item_call + label="Edit outfit" + layout="topleft" + name="edit"> + <on_click + function="Outfit.Edit" /> + <on_visible + function="Outfit.OnVisible" + parameter="edit" /> + </menu_item_call> + <menu_item_call + label="Rename outfit" + layout="topleft" + name="rename"> + <on_click + function="Outfit.Rename" /> + <on_enable + function="Outfit.OnEnable" + parameter="rename" /> + </menu_item_call> + <menu_item_call + label="Save to this outfit" + layout="topleft" + name="save"> + <on_click + function="Outfit.Save" /> + </menu_item_call> + <menu_item_separator> + <on_visible + function="Outfit.OnVisible" + parameter="delete" /> + </menu_item_separator> + <menu_item_call + label="Delete outfit" + layout="topleft" + name="delete"> <on_click - function="Outfit.Thumbnail" /> + function="Outfit.Delete" /> + <on_visible + function="Outfit.OnVisible" + parameter="delete" /> </menu_item_call> - <menu_item_separator name="sepatator1" /> + <menu_item_separator/> <menu height="175" - label="New Clothes" + label="New clothes" layout="topleft" left_delta="0" mouse_opaque="false" @@ -157,7 +200,7 @@ </menu> <menu height="85" - label="New Body Parts" + label="New body parts" layout="topleft" left_delta="0" mouse_opaque="false" @@ -197,35 +240,4 @@ parameter="eyes" /> </menu_item_call> </menu> - <menu_item_separator name="sepatator2" /> - <menu_item_call - label="Edit Outfit" - layout="topleft" - name="edit"> - <on_click - function="Outfit.Edit" /> - <on_visible - function="Outfit.OnVisible" - parameter="edit" /> - </menu_item_call> - <menu_item_call - label="Rename Outfit" - layout="topleft" - name="rename"> - <on_click - function="Outfit.Rename" /> - <on_enable - function="Outfit.OnEnable" - parameter="rename" /> - </menu_item_call> - <menu_item_call - label="Delete Outfit" - layout="topleft" - name="delete"> - <on_click - function="Outfit.Delete" /> - <on_visible - function="Outfit.OnVisible" - parameter="delete" /> - </menu_item_call> </context_menu> diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index 488b39de06..35ec0bf9e1 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -264,7 +264,7 @@ layout="topleft" name="Folder Wearables Separator" /> <menu_item_call - label="Replace Current Outfit" + label="Replace current outfit" layout="topleft" name="Replace Outfit"> <menu_item_call.on_click @@ -272,7 +272,7 @@ parameter="replaceoutfit" /> </menu_item_call> <menu_item_call - label="Add To Current Outfit" + label="Add folder items" layout="topleft" name="Add To Outfit"> <menu_item_call.on_click @@ -280,7 +280,7 @@ parameter="addtooutfit" /> </menu_item_call> <menu_item_call - label="Remove From Current Outfit" + label="Take off folder items" layout="topleft" name="Remove From Outfit"> <menu_item_call.on_click diff --git a/indra/newview/skins/default/xui/en/menu_outfit_gear.xml b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml index 85eb941e31..8f36c7a00a 100644 --- a/indra/newview/skins/default/xui/en/menu_outfit_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml @@ -4,7 +4,7 @@ visible="false" name="Gear Outfit"> <menu_item_call - label="Wear - Replace Current Outfit" + label="Replace current outfit" layout="topleft" name="wear"> <on_click @@ -17,7 +17,7 @@ parameter="wear" /> </menu_item_call> <menu_item_call - label="Wear - Add to Current Outfit" + label="Add outfit items" layout="topleft" name="wear_add"> <on_click @@ -25,9 +25,11 @@ <on_enable function="Gear.OnEnable" parameter="wear_add" /> + <on_visible + function="Gear.OnVisible"/> </menu_item_call> <menu_item_call - label="Take Off - Remove from Current Outfit" + label="Take off outfit items" layout="topleft" name="take_off"> <on_click @@ -39,19 +41,88 @@ function="Gear.OnVisible" parameter="take_off" /> </menu_item_call> + <menu_item_separator name="wear_separator" /> <menu_item_call label="Image..." layout="topleft" name="thumbnail"> + <on_click + function="Gear.Thumbnail" /> + </menu_item_call> + <menu_item_call + label="Rename outfit" + layout="topleft" + name="rename"> + <on_click + function="Gear.Rename" /> + <on_enable + function="Gear.OnEnable" + parameter="rename" /> + <on_visible + function="Gear.OnVisible" + parameter="rename" /> + </menu_item_call> + <menu_item_call + label="Save to this outfit" + layout="topleft" + name="save"> + <on_click + function="Gear.Save" /> + <on_visible + function="Gear.OnVisible"/> + </menu_item_call> + <menu_item_separator> + <on_visible + function="Gear.OnVisible" + parameter="delete" /> + </menu_item_separator> + <menu_item_call + label="Delete outfit" + layout="topleft" + name="delete_outfit"> + <on_click + function="Gear.Delete" /> + <on_enable + function="Gear.OnEnable" + parameter="delete" /> + <on_visible + function="Gear.OnVisible" + parameter="delete" /> + </menu_item_call> + <menu_item_separator> + <on_visible + function="Gear.OnVisible"/> + </menu_item_separator> + <menu_item_check + label="Sort folders always by name" + layout="topleft" + name="sort_folders_by_name"> + <on_click + function="Gear.SortByName" /> + <on_check + function="CheckControl" + parameter="OutfitGallerySortByName" /> + </menu_item_check> + <menu_item_call + label="Expand all folders" + layout="topleft" + name="expand"> + <on_click + function="Gear.Expand" /> + </menu_item_call> + <menu_item_call + label="Collapse all folders" + layout="topleft" + name="collapse"> <on_click - function="Gear.Thumbnail" /> + function="Gear.Collapse" /> </menu_item_call> - <menu_item_separator name="sepatator1" /> + <menu_item_separator/> <!-- copied (with minor modifications) from menu_inventory_add.xml --> <!-- *TODO: generate dynamically? --> <menu height="175" - label="New Clothes" + label="New clothes" layout="topleft" left_delta="0" mouse_opaque="false" @@ -165,7 +236,7 @@ </menu> <menu height="85" - label="New Body Parts" + label="New body parts" layout="topleft" left_delta="0" mouse_opaque="false" @@ -206,57 +277,4 @@ </menu_item_call> </menu> <!-- copied from menu_inventory_add.xml --> - - <menu_item_separator name="sepatator2" /> - <menu_item_call - label="Expand all folders" - layout="topleft" - name="expand"> - <on_click - function="Gear.Expand" /> - </menu_item_call> - <menu_item_call - label="Collapse all folders" - layout="topleft" - name="collapse"> - <on_click - function="Gear.Collapse" /> - </menu_item_call> - <menu_item_call - label="Rename Outfit" - layout="topleft" - name="rename"> - <on_click - function="Gear.Rename" /> - <on_enable - function="Gear.OnEnable" - parameter="rename" /> - <on_visible - function="Gear.OnVisible" - parameter="rename" /> - </menu_item_call> - <menu_item_call - label="Delete Outfit" - layout="topleft" - name="delete_outfit"> - <on_click - function="Gear.Delete" /> - <on_enable - function="Gear.OnEnable" - parameter="delete" /> - <on_visible - function="Gear.OnVisible" - parameter="delete" /> - </menu_item_call> - <menu_item_separator name="sepatator3" /> - <menu_item_check - label="Sort Folders Always by Name" - layout="topleft" - name="sort_folders_by_name"> - <on_click - function="Gear.SortByName" /> - <on_check - function="CheckControl" - parameter="OutfitGallerySortByName" /> - </menu_item_check> </toggleable_menu> diff --git a/indra/newview/skins/default/xui/en/menu_outfit_tab.xml b/indra/newview/skins/default/xui/en/menu_outfit_tab.xml index ae5fae864d..c6805edd63 100644 --- a/indra/newview/skins/default/xui/en/menu_outfit_tab.xml +++ b/indra/newview/skins/default/xui/en/menu_outfit_tab.xml @@ -3,7 +3,7 @@ layout="topleft" name="Outfit"> <menu_item_call - label="Wear - Replace Current Outfit" + label="Replace current outfit" layout="topleft" name="wear_replace"> <on_click @@ -16,7 +16,7 @@ parameter="wear_replace" /> </menu_item_call> <menu_item_call - label="Wear - Add to Current Outfit" + label="Add outfit items" layout="topleft" name="wear_add"> <on_click @@ -29,7 +29,7 @@ parameter="wear_add" /> </menu_item_call> <menu_item_call - label="Take Off - Remove from Current Outfit" + label="Take off outfit items" layout="topleft" name="take_off"> <on_click @@ -41,19 +41,26 @@ function="Outfit.OnVisible" parameter="take_off" /> </menu_item_call> + <menu_item_separator /> <menu_item_call - label="Edit Outfit" - layout="topleft" - name="edit"> + label="Image..." + layout="topleft" + name="thumbnail"> + <on_click + function="Outfit.Thumbnail" /> + </menu_item_call> + <menu_item_call + label="Edit outfit" + layout="topleft" + name="edit"> <on_click function="Outfit.Edit" /> <on_visible function="Outfit.OnVisible" parameter="edit" /> </menu_item_call> - <menu_item_separator /> <menu_item_call - label="Rename Outfit" + label="Rename outfit" layout="topleft" name="rename"> <on_click @@ -63,7 +70,19 @@ parameter="rename" /> </menu_item_call> <menu_item_call - label="Delete Outfit" + label="Save to this outfit" + layout="topleft" + name="save"> + <on_click + function="Outfit.Save" /> + </menu_item_call> + <menu_item_separator> + <on_visible + function="Outfit.OnVisible" + parameter="delete" /> + </menu_item_separator> + <menu_item_call + label="Delete outfit" layout="topleft" name="delete"> <on_click diff --git a/indra/newview/skins/default/xui/en/menu_teleport_history_item.xml b/indra/newview/skins/default/xui/en/menu_teleport_history_item.xml index 910a0adc28..e4e86bb911 100644 --- a/indra/newview/skins/default/xui/en/menu_teleport_history_item.xml +++ b/indra/newview/skins/default/xui/en/menu_teleport_history_item.xml @@ -49,4 +49,17 @@ function="TeleportHistory.GearMenu.Enable" parameter="copy_slurl" /> </menu_item_call> + <menu_item_separator + layout="topleft" /> + <menu_item_call + label="Remove from history" + layout="topleft" + name="remove_from_history"> + <on_click + function="TeleportHistory.GearMenu.Action" + parameter="remove" /> + <on_enable + function="TeleportHistory.GearMenu.Enable" + parameter="remove" /> + </menu_item_call> </toggleable_menu> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index d580369ab2..49f5dfec04 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3552,6 +3552,21 @@ function="World.EnvPreset" function="Advanced.WebContentTest" parameter="http://duckduckgo.com"/> </menu_item_call> + <menu_item_call + label="Inventory Thumbnails Helper" + name="Inventory Thumbnails Helper" + shortcut="control|alt|shift|X"> + <menu_item_call.on_click + function="Floater.Show" + parameter="inventory_thumbnails_helper" /> + </menu_item_call> + <menu_item_call + label="FB Connect Test" + name="FB Connect Test"> + <menu_item_call.on_click + function="Advanced.WebContentTest" + parameter="https://cryptic-ridge-1632.herokuapp.com/"/> + </menu_item_call> <menu_item_call label="Dump Fonts" name="Dump Fonts"> @@ -3641,6 +3656,14 @@ function="World.EnvPreset" function="Advanced.ToggleDebugUnicode" /> </menu_item_check> <menu_item_check + label="Debug Camera Controls" + name="Debug Camera Controls"> + <menu_item_check.on_check + function="Advanced.CheckDebugCamera" /> + <menu_item_check.on_click + function="Advanced.ToggleDebugCamera" /> + </menu_item_check> + <menu_item_check label="Debug Name Tooltips" name="Debug Name Tooltips"> <menu_item_check.on_check @@ -3820,6 +3843,16 @@ function="World.EnvPreset" function="ToggleControl" parameter="AllowSelectAvatar" /> </menu_item_check> + <menu_item_check + label="Render Only Friends" + name="Render Only Friends"> + <menu_item_check.on_check + function="CheckControl" + parameter="RenderAvatarFriendsOnly" /> + <menu_item_check.on_click + function="ToggleControl" + parameter="RenderAvatarFriendsOnly" /> + </menu_item_check> </menu> <menu create_jump_keys="true" @@ -3917,6 +3950,16 @@ function="World.EnvPreset" function="Advanced.ToggleDebugCharacterVis" /> </menu_item_check> <menu_item_check + label="Debug Character Rez State" + name="Debug Character Rez State"> + <menu_item_check.on_check + function="CheckControl" + parameter="NameTagDebugAVRezState" /> + <menu_item_check.on_click + function="ToggleControl" + parameter="NameTagDebugAVRezState" /> + </menu_item_check> + <menu_item_check label="Show Collision Skeleton" name="Show Collision Skeleton"> <menu_item_check.on_check diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 6964ce3a4c..b58fdcc99a 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -12265,6 +12265,50 @@ Would you like to save them first? notext="No" yestext="Yes"/> </notification> + + <notification + icon="alertmodal.tga" + name="ConfirmOverwriteOutfit" + type="alertmodal"> + <unique/> +This will replace the items in the +selected outfit with the items you +are wearing now. + <tag>confirm</tag> + <usetemplate + ignoretext="Confirm before overwriting outfit" + name="okcancelignore" + notext="Cancel" + yestext="Save"/> + </notification> + + <notification + icon="alertmodal.tga" + name="ClearInventoryThumbnailsWarning" + type="alertmodal"> + You are about to remove thumbnail images from the inventory items in the list. This change cannot be undone. + + Would you like to proceed? + <tag>confirm</tag> + <usetemplate + name="okcancelbuttons" + notext="No" + yestext="Yes"/> + </notification> + + <notification + icon="alertmodal.tga" + name="WriteInventoryThumbnailsWarning" + type="alertmodal"> + You are about to overwrite thumbnail images for some or all of the inventory items in the list. This change cannot be undone. + + Would you like to proceed? + <tag>confirm</tag> + <usetemplate + name="okcancelbuttons" + notext="No" + yestext="Yes"/> + </notification> <notification icon="notifytip.tga" diff --git a/indra/newview/skins/default/xui/en/panel_settings_water.xml b/indra/newview/skins/default/xui/en/panel_settings_water.xml index bec4f7852f..5e65b0e8a2 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_water.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_water.xml @@ -65,7 +65,7 @@ Density Exponent: </text> <slider - decimal_digits="1" + decimal_digits="2" follows="left|top" height="16" increment="0.01" diff --git a/indra/newview/tests/llremoteparcelrequest_test.cpp b/indra/newview/tests/llremoteparcelrequest_test.cpp index 4f7f87b6b0..4eddfb46e1 100644 --- a/indra/newview/tests/llremoteparcelrequest_test.cpp +++ b/indra/newview/tests/llremoteparcelrequest_test.cpp @@ -49,7 +49,7 @@ void LLCurl::Responder::failureResult(S32 status, const std::string& reason, con void LLCurl::Responder::successResult(const LLSD& content) { } void LLCurl::Responder::completeResult(S32 status, const std::string& reason, const LLSD& content) { } std::string LLCurl::Responder::dumpResponse() const { return "(failure)"; } -void LLCurl::Responder::completedRaw(LLChannelDescriptors const &,boost::shared_ptr<LLBufferArray> const &) { } +void LLCurl::Responder::completedRaw(LLChannelDescriptors const &,std::shared_ptr<LLBufferArray> const &) { } void LLMessageSystem::getF32(char const *,char const *,F32 &,S32) { } void LLMessageSystem::getU8(char const *,char const *,U8 &,S32) { } void LLMessageSystem::getS32(char const *,char const *,S32 &,S32) { } @@ -110,7 +110,7 @@ namespace tut { set_test_name("observer pointer"); - boost::scoped_ptr<TestObserver> observer(new TestObserver()); + std::unique_ptr<TestObserver> observer(new TestObserver()); LLRemoteParcelInfoProcessor & processor = LLRemoteParcelInfoProcessor::instance(); processor.addObserver(LLUUID(TEST_PARCEL_ID), observer.get()); diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index e2e7f09c3b..bdf91d0f07 100644 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -43,7 +43,7 @@ namespace LLStatViewer LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample"); } -void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts) +void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts, F32& avg_cloud_time, S32& cloud_avatars) { counts.resize(3); counts[0] = 0; diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 3fb0a02c23..63383e52bb 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -525,7 +525,7 @@ class Windows_x86_64_Manifest(ViewerManifest): 'secondlife-bin.*', '*_Setup.exe', '*.bat', - '*.tar.bz2'))) + '*.tar.xz'))) with self.prefix(src=os.path.join(pkgdir, "VMP")): # include the compiled launcher scripts so that it gets included in the file_list @@ -1172,9 +1172,9 @@ class Darwin_x86_64_Manifest(ViewerManifest): # causes problems, especially with frameworks: a framework's top # level must contain symlinks into its Versions/Current, which # must itself be a symlink to some specific Versions subdir. - tarpath = os.path.join(RUNNER_TEMP, "viewer.tar.bz2") + tarpath = os.path.join(RUNNER_TEMP, "viewer.tar.xz") print(f'Creating {tarpath} from {self.get_dst_prefix()}') - with tarfile.open(tarpath, mode="w:bz2") as tarball: + with tarfile.open(tarpath, mode="w:xz") as tarball: # Store in the tarball as just 'Second Life Mumble.app' # instead of 'Users/someone/.../newview/Release/Second...' # It's at this point that we rename 'Second Life Release.app' @@ -1261,7 +1261,7 @@ class LinuxManifest(ViewerManifest): self.run_command(['find', self.get_dst_prefix(), '-type', 'f', '-perm', old, '-exec', 'chmod', new, '{}', ';']) - self.package_file = installer_name + '.tar.bz2' + self.package_file = installer_name + '.tar.xz' # temporarily move directory tree so that it has the right # name in the tarfile @@ -1274,10 +1274,10 @@ class LinuxManifest(ViewerManifest): # --numeric-owner hides the username of the builder for # security etc. self.run_command(['tar', '-C', self.get_build_prefix(), - '--numeric-owner', '-cjf', - tempname + '.tar.bz2', installer_name]) + '--numeric-owner', '-cJf', + tempname + '.tar.xz', installer_name]) else: - print("Skipping %s.tar.bz2 for non-Release build (%s)" % \ + print("Skipping %s.tar.xz for non-Release build (%s)" % \ (installer_name, self.args['buildtype'])) finally: self.run_command(["mv", tempname, realname]) diff --git a/indra/test/io.cpp b/indra/test/io.cpp index 40243a8ad6..99b49c8b29 100644 --- a/indra/test/io.cpp +++ b/indra/test/io.cpp @@ -946,7 +946,7 @@ namespace tut typedef LLCloneIOFactory<LLPipeStringInjector> emitter_t; emitter_t* emitter = new emitter_t( new LLPipeStringInjector("suckers never play me")); - boost::shared_ptr<LLChainIOFactory> factory(emitter); + std::shared_ptr<LLChainIOFactory> factory(emitter); LLIOServerSocket* server = new LLIOServerSocket( mPool, mSocket, @@ -993,7 +993,7 @@ namespace tut LLPumpIO::chain_t chain; typedef LLCloneIOFactory<LLIOFuzz> emitter_t; emitter_t* emitter = new emitter_t(new LLIOFuzz(1000000)); - boost::shared_ptr<LLChainIOFactory> factory(emitter); + std::shared_ptr<LLChainIOFactory> factory(emitter); LLIOServerSocket* server = new LLIOServerSocket( mPool, mSocket, @@ -1036,7 +1036,7 @@ namespace tut LLPumpIO::chain_t chain; typedef LLCloneIOFactory<LLIOFuzz> emitter_t; emitter_t* emitter = new emitter_t(new LLIOFuzz(1000000)); - boost::shared_ptr<LLChainIOFactory> factory(emitter); + std::shared_ptr<LLChainIOFactory> factory(emitter); LLIOServerSocket* server = new LLIOServerSocket( mPool, mSocket, @@ -1079,7 +1079,7 @@ namespace tut LLPumpIO::chain_t chain; typedef LLCloneIOFactory<LLIOFuzz> emitter_t; emitter_t* emitter = new emitter_t(new LLIOFuzz(1000000)); - boost::shared_ptr<LLChainIOFactory> factory(emitter); + std::shared_ptr<LLChainIOFactory> factory(emitter); LLIOServerSocket* server = new LLIOServerSocket( mPool, mSocket, @@ -1120,7 +1120,7 @@ namespace tut LLPumpIO::chain_t chain; typedef LLCloneIOFactory<LLIOSleeper> sleeper_t; sleeper_t* sleeper = new sleeper_t(new LLIOSleeper); - boost::shared_ptr<LLChainIOFactory> factory(sleeper); + std::shared_ptr<LLChainIOFactory> factory(sleeper); LLIOServerSocket* server = new LLIOServerSocket( mPool, mSocket, diff --git a/indra/test/llevents_tut.cpp b/indra/test/llevents_tut.cpp index 17f64a4953..a38de71e48 100644 --- a/indra/test/llevents_tut.cpp +++ b/indra/test/llevents_tut.cpp @@ -368,10 +368,10 @@ void events_object::test<7>() LLEventStream bob("bob"); // should work, previous one unregistered LLEventStream bob1("bob", true);// allowed to tweak name ensure_equals("tweaked LLEventStream name", bob1.getName(), "bob1"); - std::vector<boost::shared_ptr<LLEventStream> > streams; + std::vector<std::shared_ptr<LLEventStream> > streams; for (int i = 2; i <= 10; ++i) { - streams.push_back(boost::shared_ptr<LLEventStream>(new LLEventStream("bob", true))); + streams.push_back(std::shared_ptr<LLEventStream>(new LLEventStream("bob", true))); } ensure_equals("last tweaked LLEventStream name", streams.back()->getName(), "bob10"); } diff --git a/indra/test/test.cpp b/indra/test/test.cpp index be3b326afe..6b88553cbb 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -155,12 +155,12 @@ public: virtual void reset() { - boost::dynamic_pointer_cast<RecordToTempFile>(mRecorder)->reset(); + std::dynamic_pointer_cast<RecordToTempFile>(mRecorder)->reset(); } virtual void replay(std::ostream& out) { - boost::dynamic_pointer_cast<RecordToTempFile>(mRecorder)->replay(out); + std::dynamic_pointer_cast<RecordToTempFile>(mRecorder)->replay(out); } private: @@ -174,7 +174,7 @@ class LLTestCallback : public chained_callback public: LLTestCallback(bool verbose_mode, std::ostream *stream, - boost::shared_ptr<LLReplayLog> replayer) : + std::shared_ptr<LLReplayLog> replayer) : mVerboseMode(verbose_mode), mTotalTests(0), mPassedTests(0), @@ -182,7 +182,7 @@ public: mSkippedTests(0), // By default, capture a shared_ptr to std::cout, with a no-op "deleter" // so that destroying the shared_ptr makes no attempt to delete std::cout. - mStream(boost::shared_ptr<std::ostream>(&std::cout, [](std::ostream*){})), + mStream(std::shared_ptr<std::ostream>(&std::cout, [](std::ostream*){})), mReplayer(replayer) { if (stream) @@ -196,7 +196,7 @@ public: // Allocate and assign in two separate steps, per Herb Sutter. // (Until we turn on C++11 support, have to wrap *stream with // boost::ref() due to lack of perfect forwarding.) - boost::shared_ptr<std::ostream> pstream(new TeeStream(std::cout, boost::ref(*stream))); + std::shared_ptr<std::ostream> pstream(new TeeStream(std::cout, boost::ref(*stream))); mStream = pstream; } } @@ -320,8 +320,8 @@ protected: int mPassedTests; int mFailedTests; int mSkippedTests; - boost::shared_ptr<std::ostream> mStream; - boost::shared_ptr<LLReplayLog> mReplayer; + std::shared_ptr<std::ostream> mStream; + std::shared_ptr<LLReplayLog> mReplayer; }; // TeamCity specific class which emits service messages @@ -331,7 +331,7 @@ class LLTCTestCallback : public LLTestCallback { public: LLTCTestCallback(bool verbose_mode, std::ostream *stream, - boost::shared_ptr<LLReplayLog> replayer) : + std::shared_ptr<LLReplayLog> replayer) : LLTestCallback(verbose_mode, stream, replayer) { } @@ -538,7 +538,7 @@ int main(int argc, char **argv) apr_status_t apr_err; const char* opt_arg = NULL; int opt_id = 0; - boost::scoped_ptr<llofstream> output; + std::unique_ptr<llofstream> output; const char *touch = NULL; while(true) @@ -597,7 +597,7 @@ int main(int argc, char **argv) // set up logging const char* LOGFAIL = getenv("LOGFAIL"); - boost::shared_ptr<LLReplayLog> replayer{boost::make_shared<LLReplayLog>()}; + std::shared_ptr<LLReplayLog> replayer{std::make_shared<LLReplayLog>()}; // Testing environment variables for both 'set' and 'not empty' allows a // user to suppress a pre-existing environment variable by forcing empty. diff --git a/indra/viewer_components/login/lllogin.h b/indra/viewer_components/login/lllogin.h index 051641ff59..de58ca0c29 100644 --- a/indra/viewer_components/login/lllogin.h +++ b/indra/viewer_components/login/lllogin.h @@ -121,7 +121,7 @@ public: private: class Impl; - boost::scoped_ptr<Impl> mImpl; + std::unique_ptr<Impl> mImpl; }; #endif // LL_LLLOGIN_H |