diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h index 25a51da03d..2d5be0162f 100644 --- a/indra/llappearance/llavatarappearance.h +++ b/indra/llappearance/llavatarappearance.h @@ -140,10 +140,7 @@ public: LLVector3 mHeadOffset{}; // current head position LLAvatarJoint* mRoot{ nullptr }; - // Joint-lookup improvements - // typedef std::map joint_map_t; typedef std::map> joint_map_t; - joint_map_t mJointMap; typedef std::map joint_state_map_t; @@ -156,7 +153,7 @@ public: public: typedef std::vector avatar_joint_list_t; const avatar_joint_list_t& getSkeleton() { return mSkeleton; } - typedef std::map joint_alias_map_t; + typedef std::map> joint_alias_map_t; const joint_alias_map_t& getJointAliases(); diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp index 20613ea771..e8cb1c9dfd 100644 --- a/indra/llcharacter/llbvhloader.cpp +++ b/indra/llcharacter/llbvhloader.cpp @@ -131,7 +131,7 @@ LLQuaternion::Order bvhStringToOrder( char *str ) // LLBVHLoader() //----------------------------------------------------------------------------- -LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &errorLine, std::map& joint_alias_map ) +LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &errorLine, std::map>& joint_alias_map ) { reset(); errorLine = 0; diff --git a/indra/llcharacter/llbvhloader.h b/indra/llcharacter/llbvhloader.h index 3fc49a3482..347e8ff416 100644 --- a/indra/llcharacter/llbvhloader.h +++ b/indra/llcharacter/llbvhloader.h @@ -227,7 +227,7 @@ class LLBVHLoader friend class LLKeyframeMotion; public: // Constructor - LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &errorLine, std::map& joint_alias_map ); + LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &errorLine, std::map>& joint_alias_map ); ~LLBVHLoader(); /* diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 65c70c2ce1..3f747c4d3d 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -77,14 +77,11 @@ LLCharacter::~LLCharacter() //----------------------------------------------------------------------------- // getJoint() //----------------------------------------------------------------------------- -// Joint-lookup improvements -//LLJoint *LLCharacter::getJoint( const std::string &name ) LLJoint* LLCharacter::getJoint(std::string_view name) { - LLJoint* joint = NULL; + LLJoint* joint = nullptr; - LLJoint *root = getRootJoint(); - if (root) + if (LLJoint* root = getRootJoint()) { joint = root->findJoint(name); } diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index 53803bbb24..2c4b5bc7ce 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -76,8 +76,6 @@ public: // get the specified joint // default implementation does recursive search, // subclasses may optimize/cache results. - // Joint-lookup improvements - // virtual LLJoint *getJoint( const std::string &name ); virtual LLJoint* getJoint(std::string_view name); // get the position of the character diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 7749e2748e..60a29d4fe9 100644 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -242,9 +242,7 @@ LLJoint *LLJoint::getRoot() //----------------------------------------------------------------------------- // findJoint() //----------------------------------------------------------------------------- -// Joint-lookup improvements -//LLJoint *LLJoint::findJoint( const std::string &name ) -LLJoint *LLJoint::findJoint(std::string_view name) +LLJoint* LLJoint::findJoint(std::string_view name) { if (name == getName()) return this; @@ -253,15 +251,14 @@ LLJoint *LLJoint::findJoint(std::string_view name) { if(joint) { - LLJoint *found = joint->findJoint(name); - if (found) + if (LLJoint* found = joint->findJoint(name)) { return found; } } } - return NULL; + return nullptr; } diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index f2ceed5f55..b58dc797f8 100644 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -222,8 +222,6 @@ public: LLJoint *getRoot(); // search for child joints by name - // Joint-lookup improvements - //LLJoint *findJoint( const std::string &name ); LLJoint* findJoint(std::string_view name); // add/remove children diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index 67f0b83c7a..4f15683d22 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -69,7 +69,7 @@ public: // Called from MAIN THREAD. void pause(); void unpause(); - bool isPaused() { return isStopped() || mPaused; } + bool isPaused() const { return isStopped() || mPaused; } // Cause the thread to wake up and check its condition void wake(); diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp index f1ef8fbd3e..c896d60c85 100644 --- a/indra/llimage/llimagedimensionsinfo.cpp +++ b/indra/llimage/llimagedimensionsinfo.cpp @@ -75,7 +75,7 @@ bool LLImageDimensionsInfo::load(const std::string& src_filename,U32 codec) bool LLImageDimensionsInfo::getImageDimensionsBmp() { // Make sure the file is long enough. - const S32 DATA_LEN = 26; // BMP header (14) + DIB header size (4) + width (4) + height (4) + constexpr S32 DATA_LEN = 26; // BMP header (14) + DIB header size (4) + width (4) + height (4) if (!checkFileLength(DATA_LEN)) { LL_WARNS() << "Premature end of file" << LL_ENDL; @@ -105,7 +105,7 @@ bool LLImageDimensionsInfo::getImageDimensionsBmp() bool LLImageDimensionsInfo::getImageDimensionsTga() { - const S32 TGA_FILE_HEADER_SIZE = 12; + constexpr S32 TGA_FILE_HEADER_SIZE = 12; // Make sure the file is long enough. if (!checkFileLength(TGA_FILE_HEADER_SIZE + 1 /* width */ + 1 /* height */)) @@ -124,7 +124,7 @@ bool LLImageDimensionsInfo::getImageDimensionsTga() bool LLImageDimensionsInfo::getImageDimensionsPng() { - const S32 PNG_MAGIC_SIZE = 8; + constexpr S32 PNG_MAGIC_SIZE = 8; // Make sure the file is long enough. if (!checkFileLength(PNG_MAGIC_SIZE + 8 + sizeof(S32) * 2 /* width, height */)) @@ -134,7 +134,7 @@ bool LLImageDimensionsInfo::getImageDimensionsPng() } // Read PNG signature. - const U8 png_magic[PNG_MAGIC_SIZE] = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A}; + constexpr U8 png_magic[PNG_MAGIC_SIZE] = {0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A}; U8 signature[PNG_MAGIC_SIZE]; mInfile.read((void*)signature, PNG_MAGIC_SIZE); @@ -166,36 +166,36 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg() { sJpegErrorEncountered = false; clean(); - FILE *fp = LLFile::fopen(mSrcFilename, "rb"); - if (fp == NULL) + FILE* fp = LLFile::fopen(mSrcFilename, "rb"); + if (!fp) { setLastError("Unable to open file for reading", mSrcFilename); return false; } /* Make sure this is a JPEG file. */ - const size_t JPEG_MAGIC_SIZE = 2; - const U8 jpeg_magic[JPEG_MAGIC_SIZE] = {0xFF, 0xD8}; + constexpr size_t JPEG_MAGIC_SIZE = 2; + constexpr U8 jpeg_magic[JPEG_MAGIC_SIZE] = {0xFF, 0xD8}; U8 signature[JPEG_MAGIC_SIZE]; if (fread(signature, sizeof(signature), 1, fp) != 1) { LL_WARNS() << "Premature end of file" << LL_ENDL; - fclose(fp); // Don't leak the file handle + fclose(fp); return false; } if (memcmp(signature, jpeg_magic, JPEG_MAGIC_SIZE) != 0) { LL_WARNS() << "Not a JPEG" << LL_ENDL; mWarning = "texture_load_format_error"; - fclose(fp); // Don't leak the file handle + fclose(fp); return false; } fseek(fp, 0, SEEK_SET); // go back to start of the file /* Init jpeg */ jpeg_error_mgr jerr; - jpeg_decompress_struct cinfo; + jpeg_decompress_struct cinfo{}; cinfo.err = jpeg_std_error(&jerr); // Call our function instead of exit() if Libjpeg encounters an error. // This is done to avoid crash in this case (STORM-472). diff --git a/indra/llimage/llimagedimensionsinfo.h b/indra/llimage/llimagedimensionsinfo.h index 681d66ae4e..4870f2e815 100644 --- a/indra/llimage/llimagedimensionsinfo.h +++ b/indra/llimage/llimagedimensionsinfo.h @@ -38,7 +38,7 @@ class LLImageDimensionsInfo { public: LLImageDimensionsInfo(): - mData(NULL) + mData(nullptr) ,mHeight(0) ,mWidth(0) {} @@ -67,7 +67,7 @@ protected: { mInfile.close(); delete[] mData; - mData = NULL; + mData = nullptr; mWidth = 0; mHeight = 0; } diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index 03601e0048..0984add93c 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -554,7 +554,20 @@ public: opj_set_warning_handler(encoder, opj_warn, this); opj_set_error_handler(encoder, opj_error, this); - U32 tile_count = (rawImageIn.getWidth() >> 6) * (rawImageIn.getHeight() >> 6); + U32 width_tiles = (rawImageIn.getWidth() >> 6); + U32 height_tiles = (rawImageIn.getHeight() >> 6); + + // Allow images with a width or height that are MIN_IMAGE_SIZE <= x < 64 + if (width_tiles == 0 && (rawImageIn.getWidth() >= MIN_IMAGE_SIZE)) + { + width_tiles = 1; + } + if (height_tiles == 0 && (rawImageIn.getHeight() >= MIN_IMAGE_SIZE)) + { + height_tiles = 1; + } + + U32 tile_count = width_tiles * height_tiles; U32 data_size_guess = tile_count * TILE_SIZE; // will be freed in opj_free_user_data_write @@ -915,12 +928,11 @@ bool LLImageJ2COJ::encodeImpl(LLImageJ2C &base, const LLImageRaw &raw_image, con { JPEG2KEncode encode(comment_text, reversible); bool encoded = encode.encode(raw_image, base); - if (encoded) + if (!encoded) { - LL_WARNS() << "Openjpeg encoding implementation isn't complete, returning false" << LL_ENDL; + LL_WARNS() << "Openjpeg encoding was unsuccessful, returning false" << LL_ENDL; } return encoded; - //return false; } bool LLImageJ2COJ::getMetadata(LLImageJ2C &base) diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 759638b956..ac50b428bf 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -37,98 +37,98 @@ #include "llsettingsdaycycle.h" // Grid out of which parcels taken is stepped every 4 meters. -const F32 PARCEL_GRID_STEP_METERS = 4.f; +constexpr F32 PARCEL_GRID_STEP_METERS = 4.f; // Area of one "square" of parcel -const S32 PARCEL_UNIT_AREA = 16; +constexpr S32 PARCEL_UNIT_AREA = 16; // Height _above_ground_ that parcel boundary ends -const F32 PARCEL_HEIGHT = 50.f; +constexpr F32 PARCEL_HEIGHT = 50.f; //Height above ground which parcel boundries exist for explicitly banned avatars -const F32 BAN_HEIGHT = 5000.f; +constexpr F32 BAN_HEIGHT = 5000.f; // Maximum number of entries in an access list -const S32 PARCEL_MAX_ACCESS_LIST = 300; +constexpr S32 PARCEL_MAX_ACCESS_LIST = 300; //Maximum number of entires in an update packet //for access/ban lists. -const F32 PARCEL_MAX_ENTRIES_PER_PACKET = 48.f; +constexpr F32 PARCEL_MAX_ENTRIES_PER_PACKET = 48.f; // Maximum number of experiences -const S32 PARCEL_MAX_EXPERIENCE_LIST = 24; +constexpr S32 PARCEL_MAX_EXPERIENCE_LIST = 24; // Weekly charge for listing a parcel in the directory -const S32 PARCEL_DIRECTORY_FEE = 30; +constexpr S32 PARCEL_DIRECTORY_FEE = 30; -const S32 PARCEL_PASS_PRICE_DEFAULT = 10; -const F32 PARCEL_PASS_HOURS_DEFAULT = 1.f; +constexpr S32 PARCEL_PASS_PRICE_DEFAULT = 10; +constexpr F32 PARCEL_PASS_HOURS_DEFAULT = 1.f; // Number of "chunks" in which parcel overlay data is sent // Chunk 0 = southern rows, entire width -const S32 PARCEL_OVERLAY_CHUNKS = 4; +constexpr S32 PARCEL_OVERLAY_CHUNKS = 4; // Bottom three bits are a color index for the land overlay -const U8 PARCEL_COLOR_MASK = 0x07; -const U8 PARCEL_PUBLIC = 0x00; -const U8 PARCEL_OWNED = 0x01; -const U8 PARCEL_GROUP = 0x02; -const U8 PARCEL_SELF = 0x03; -const U8 PARCEL_FOR_SALE = 0x04; -const U8 PARCEL_AUCTION = 0x05; +constexpr U8 PARCEL_COLOR_MASK = 0x07; +constexpr U8 PARCEL_PUBLIC = 0x00; +constexpr U8 PARCEL_OWNED = 0x01; +constexpr U8 PARCEL_GROUP = 0x02; +constexpr U8 PARCEL_SELF = 0x03; +constexpr U8 PARCEL_FOR_SALE = 0x04; +constexpr U8 PARCEL_AUCTION = 0x05; // unused 0x06 // unused 0x07 // flag, unused 0x08 -const U8 PARCEL_HIDDENAVS = 0x10; // avatars not visible outside of parcel. Used for 'see avs' feature, but must be off for compatibility -const U8 PARCEL_SOUND_LOCAL = 0x20; -const U8 PARCEL_WEST_LINE = 0x40; // flag, property line on west edge -const U8 PARCEL_SOUTH_LINE = 0x80; // flag, property line on south edge +constexpr U8 PARCEL_HIDDENAVS = 0x10; // avatars not visible outside of parcel. Used for 'see avs' feature, but must be off for compatibility +constexpr U8 PARCEL_SOUND_LOCAL = 0x20; +constexpr U8 PARCEL_WEST_LINE = 0x40; // flag, property line on west edge +constexpr U8 PARCEL_SOUTH_LINE = 0x80; // flag, property line on south edge // Transmission results for parcel properties -const S32 PARCEL_RESULT_NO_DATA = -1; -const S32 PARCEL_RESULT_SUCCESS = 0; // got exactly one parcel -const S32 PARCEL_RESULT_MULTIPLE = 1; // got multiple parcels +constexpr S32 PARCEL_RESULT_NO_DATA = -1; +constexpr S32 PARCEL_RESULT_SUCCESS = 0; // got exactly one parcel +constexpr S32 PARCEL_RESULT_MULTIPLE = 1; // got multiple parcels -const S32 SELECTED_PARCEL_SEQ_ID = -10000; -const S32 COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID = -20000; -const S32 COLLISION_BANNED_PARCEL_SEQ_ID = -30000; -const S32 COLLISION_NOT_ON_LIST_PARCEL_SEQ_ID = -40000; -const S32 HOVERED_PARCEL_SEQ_ID = -50000; +constexpr S32 SELECTED_PARCEL_SEQ_ID = -10000; +constexpr S32 COLLISION_NOT_IN_GROUP_PARCEL_SEQ_ID = -20000; +constexpr S32 COLLISION_BANNED_PARCEL_SEQ_ID = -30000; +constexpr S32 COLLISION_NOT_ON_LIST_PARCEL_SEQ_ID = -40000; +constexpr S32 HOVERED_PARCEL_SEQ_ID = -50000; -const U32 RT_NONE = 0x1 << 0; -const U32 RT_OWNER = 0x1 << 1; -const U32 RT_GROUP = 0x1 << 2; -const U32 RT_OTHER = 0x1 << 3; -const U32 RT_LIST = 0x1 << 4; -const U32 RT_SELL = 0x1 << 5; +constexpr U32 RT_NONE = 0x1 << 0; +constexpr U32 RT_OWNER = 0x1 << 1; +constexpr U32 RT_GROUP = 0x1 << 2; +constexpr U32 RT_OTHER = 0x1 << 3; +constexpr U32 RT_LIST = 0x1 << 4; +constexpr U32 RT_SELL = 0x1 << 5; -const S32 INVALID_PARCEL_ID = -1; +constexpr S32 INVALID_PARCEL_ID = -1; -const S32 INVALID_PARCEL_ENVIRONMENT_VERSION = -2; +constexpr S32 INVALID_PARCEL_ENVIRONMENT_VERSION = -2; // if Region settings are used, parcel env. version is -1 -const S32 UNSET_PARCEL_ENVIRONMENT_VERSION = -1; +constexpr S32 UNSET_PARCEL_ENVIRONMENT_VERSION = -1; // Timeouts for parcels // default is 21 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 1814400000000 -const U64 DEFAULT_USEC_CONVERSION_TIMEOUT = U64L(1814400000000); +constexpr U64 DEFAULT_USEC_CONVERSION_TIMEOUT = U64L(1814400000000); // ***** TESTING is 10 minutes //const U64 DEFAULT_USEC_CONVERSION_TIMEOUT = U64L(600000000); // group is 60 days * 24h/d * 60m/h * 60s/m *1000000 usec/s = 5184000000000 -const U64 GROUP_USEC_CONVERSION_TIMEOUT = U64L(5184000000000); +constexpr U64 GROUP_USEC_CONVERSION_TIMEOUT = U64L(5184000000000); // ***** TESTING is 10 minutes //const U64 GROUP_USEC_CONVERSION_TIMEOUT = U64L(600000000); // default sale timeout is 2 days -> 172800000000 -const U64 DEFAULT_USEC_SALE_TIMEOUT = U64L(172800000000); +constexpr U64 DEFAULT_USEC_SALE_TIMEOUT = U64L(172800000000); // ***** TESTING is 10 minutes //const U64 DEFAULT_USEC_SALE_TIMEOUT = U64L(600000000); // more grace period extensions. -const U64 SEVEN_DAYS_IN_USEC = U64L(604800000000); +constexpr U64 SEVEN_DAYS_IN_USEC = U64L(604800000000); // if more than 100,000s before sale revert, and no extra extension // has been given, go ahead and extend it more. That's about 1.2 days. -const S32 EXTEND_GRACE_IF_MORE_THAN_SEC = 100000; +constexpr S32 EXTEND_GRACE_IF_MORE_THAN_SEC = 100000; @@ -250,9 +250,9 @@ public: void setMediaURL(const std::string& url); void setMediaType(const std::string& type); void setMediaDesc(const std::string& desc); - void setMediaID(const LLUUID& id) { mMediaID = id; } - void setMediaAutoScale ( U8 flagIn ) { mMediaAutoScale = flagIn; } - void setMediaLoop (U8 loop) { mMediaLoop = loop; } + void setMediaID(const LLUUID& id) { mMediaID = id; } + void setMediaAutoScale ( U8 flagIn ) { mMediaAutoScale = flagIn; } + void setMediaLoop(U8 loop) { mMediaLoop = loop; } void setMediaWidth(S32 width); void setMediaHeight(S32 height); void setMediaCurrentURL(const std::string& url); diff --git a/indra/llmath/raytrace.cpp b/indra/llmath/raytrace.cpp index 893bf1fc70..c0b5f48f2d 100644 --- a/indra/llmath/raytrace.cpp +++ b/indra/llmath/raytrace.cpp @@ -27,7 +27,6 @@ #include "linden_common.h" #include "math.h" -//#include "vmath.h" #include "v3math.h" #include "llquaternion.h" #include "m3math.h" diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp index 68fb0456ef..2d98de7d3e 100644 --- a/indra/llmessage/patch_code.cpp +++ b/indra/llmessage/patch_code.cpp @@ -27,7 +27,6 @@ #include "linden_common.h" #include "llmath.h" -//#include "vmath.h" #include "v3math.h" #include "patch_dct.h" #include "patch_code.h" diff --git a/indra/llmessage/patch_dct.cpp b/indra/llmessage/patch_dct.cpp index 728fe84537..e74e5fd459 100644 --- a/indra/llmessage/patch_dct.cpp +++ b/indra/llmessage/patch_dct.cpp @@ -27,7 +27,6 @@ #include "linden_common.h" #include "llmath.h" -//#include "vmath.h" #include "v3math.h" #include "patch_dct.h" diff --git a/indra/llmessage/patch_idct.cpp b/indra/llmessage/patch_idct.cpp index 5483cf98c0..4bcc439917 100644 --- a/indra/llmessage/patch_idct.cpp +++ b/indra/llmessage/patch_idct.cpp @@ -27,7 +27,6 @@ #include "linden_common.h" #include "llmath.h" -//#include "vmath.h" #include "v3math.h" #include "patch_dct.h" diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 8d5d02aff0..d0ff1945ea 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -917,7 +917,7 @@ LLDAELoader::LLDAELoader( void* opaque_userdata, JointTransformMap& jointTransformMap, JointNameSet& jointsFromNodes, - std::map& jointAliasMap, + std::map>& jointAliasMap, U32 maxJointsPerMesh, U32 modelLimit, // mesh loader suffix configuration diff --git a/indra/llprimitive/lldaeloader.h b/indra/llprimitive/lldaeloader.h index d20422d5cb..a94605a652 100644 --- a/indra/llprimitive/lldaeloader.h +++ b/indra/llprimitive/lldaeloader.h @@ -49,22 +49,22 @@ public: dae_model_map mModelsMap; LLDAELoader( - std::string filename, - S32 lod, - LLModelLoader::load_callback_t load_cb, - LLModelLoader::joint_lookup_func_t joint_lookup_func, - LLModelLoader::texture_load_func_t texture_load_func, - LLModelLoader::state_callback_t state_cb, - void* opaque_userdata, - JointTransformMap& jointTransformMap, - JointNameSet& jointsFromNodes, - std::map& jointAliasMap, - U32 maxJointsPerMesh, - U32 modelLimit, + std::string filename, + S32 lod, + LLModelLoader::load_callback_t load_cb, + LLModelLoader::joint_lookup_func_t joint_lookup_func, + LLModelLoader::texture_load_func_t texture_load_func, + LLModelLoader::state_callback_t state_cb, + void* opaque_userdata, + JointTransformMap& jointTransformMap, + JointNameSet& jointsFromNodes, + std::map>& jointAliasMap, + U32 maxJointsPerMesh, + U32 modelLimit, // configrable lod suffix support - // bool preprocess); - bool preprocess, - const LODSuffixArray& lod_suffix); + // bool preprocess); + bool preprocess, + const LODSuffixArray& lod_suffix); // virtual ~LLDAELoader() ; diff --git a/indra/llprimitive/llgltfloader.cpp b/indra/llprimitive/llgltfloader.cpp index 480012699a..724b1a88b2 100644 --- a/indra/llprimitive/llgltfloader.cpp +++ b/indra/llprimitive/llgltfloader.cpp @@ -66,19 +66,19 @@ static const std::string lod_suffix[LLModel::NUM_LODS] = }; -LLGLTFLoader::LLGLTFLoader(std::string filename, - S32 lod, - LLModelLoader::load_callback_t load_cb, - LLModelLoader::joint_lookup_func_t joint_lookup_func, - LLModelLoader::texture_load_func_t texture_load_func, - LLModelLoader::state_callback_t state_cb, - void * opaque_userdata, - JointTransformMap & jointTransformMap, - JointNameSet & jointsFromNodes, - std::map &jointAliasMap, - U32 maxJointsPerMesh, - U32 modelLimit) //, - //bool preprocess) +LLGLTFLoader::LLGLTFLoader(std::string filename, + S32 lod, + LLModelLoader::load_callback_t load_cb, + LLModelLoader::joint_lookup_func_t joint_lookup_func, + LLModelLoader::texture_load_func_t texture_load_func, + LLModelLoader::state_callback_t state_cb, + void * opaque_userdata, + JointTransformMap & jointTransformMap, + JointNameSet & jointsFromNodes, + std::map> & jointAliasMap, + U32 maxJointsPerMesh, + U32 modelLimit) //, + //bool preprocess) : LLModelLoader( filename, lod, load_cb, diff --git a/indra/llprimitive/llgltfloader.h b/indra/llprimitive/llgltfloader.h index 66671d1c5a..848a07c1e4 100644 --- a/indra/llprimitive/llgltfloader.h +++ b/indra/llprimitive/llgltfloader.h @@ -121,18 +121,18 @@ class LLGLTFLoader : public LLModelLoader typedef std::map material_map; LLGLTFLoader(std::string filename, - S32 lod, - LLModelLoader::load_callback_t load_cb, - LLModelLoader::joint_lookup_func_t joint_lookup_func, - LLModelLoader::texture_load_func_t texture_load_func, - LLModelLoader::state_callback_t state_cb, - void * opaque_userdata, - JointTransformMap & jointTransformMap, - JointNameSet & jointsFromNodes, - std::map &jointAliasMap, - U32 maxJointsPerMesh, - U32 modelLimit); //, - //bool preprocess ); + S32 lod, + LLModelLoader::load_callback_t load_cb, + LLModelLoader::joint_lookup_func_t joint_lookup_func, + LLModelLoader::texture_load_func_t texture_load_func, + LLModelLoader::state_callback_t state_cb, + void * opaque_userdata, + JointTransformMap & jointTransformMap, + JointNameSet & jointsFromNodes, + std::map> &jointAliasMap, + U32 maxJointsPerMesh, + U32 modelLimit); //, + //bool preprocess ); virtual ~LLGLTFLoader(); virtual bool OpenFile(const std::string &filename); diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h index f5783515fa..357672aa4e 100644 --- a/indra/llprimitive/llmodelloader.h +++ b/indra/llprimitive/llmodelloader.h @@ -36,7 +36,7 @@ class LLJoint; typedef std::map JointTransformMap; typedef std::map::iterator JointTransformMapIt; -typedef std::map JointMap; +typedef std::map> JointMap; typedef std::deque JointNameSet; const S32 SLM_SUPPORTED_VERSION = 3; diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index 991d8e5c5f..682452864e 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -7.1.13 +7.1.16 diff --git a/indra/newview/fspanelface.cpp b/indra/newview/fspanelface.cpp index 8ff008372c..6485e80ebd 100644 --- a/indra/newview/fspanelface.cpp +++ b/indra/newview/fspanelface.cpp @@ -184,35 +184,7 @@ void readSelectedGLTFMaterial(std::function func, T& v identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&select_func, value, has_tolerance, tolerance); } -void getSelectedGLTFMaterialMaxRepeats(LLGLTFMaterial::TextureInfo channel, F32& repeats, bool& identical) -{ - // The All channel should read base color values - if (channel == LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT) - channel = LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_BASE_COLOR; - - struct LLSelectedTEGetGLTFMaterialMaxRepeatsFunctor : public LLSelectedTEGetFunctor - { - LLSelectedTEGetGLTFMaterialMaxRepeatsFunctor(LLGLTFMaterial::TextureInfo channel) : mChannel(channel) {} - virtual ~LLSelectedTEGetGLTFMaterialMaxRepeatsFunctor() {}; - F32 get(LLViewerObject* object, S32 face) override - { - const LLTextureEntry* tep = object->getTE(face); - const LLGLTFMaterial* render_material = tep->getGLTFRenderMaterial(); - if (!render_material) - return 0.f; - - U32 s_axis = VX; - U32 t_axis = VY; - LLPrimitive::getTESTAxes(face, &s_axis, &t_axis); - F32 repeats_u = render_material->mTextureTransform[mChannel].mScale[VX] / object->getScale().mV[s_axis]; - F32 repeats_v = render_material->mTextureTransform[mChannel].mScale[VY] / object->getScale().mV[t_axis]; - return llmax(repeats_u, repeats_v); - } - - LLGLTFMaterial::TextureInfo mChannel; - } max_repeats_func(channel); - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&max_repeats_func, repeats); -} +void getSelectedGLTFMaterialMaxRepeats(LLGLTFMaterial::TextureInfo channel, F32& repeats, bool& identical); // Defined in llpanelface.cpp // // keep LLRenderMaterialFunctor in sync with llmaterialeditor.cpp - Would be nice if we diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index f9728df6ad..e0cba74045 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4140,11 +4140,14 @@ void LLAgent::initOriginGlobal(const LLVector3d &origin_global) bool LLAgent::leftButtonGrabbed() const { - const bool camera_mouse_look = gAgentCamera.cameraMouselook(); - return (!camera_mouse_look && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) - || (camera_mouse_look && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0) - || (!camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) - || (camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0); + if (gAgentCamera.cameraMouselook()) + { + return mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0; + } + else + { + return mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0; + } } bool LLAgent::rotateGrabbed() const diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index cea5800c36..627d9a0095 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -2141,16 +2141,6 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(bool *hit_limit) isConstrained = true; } } - -// JC - Could constrain camera based on parcel stuff here. -// LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(camera_position_global); -// -// if (regionp && !regionp->mParcelOverlay->isBuildCameraAllowed(regionp->getPosRegionFromGlobal(camera_position_global))) -// { -// camera_position_global = last_position_global; -// -// isConstrained = true; -// } } // [RLVa:KB] - Checked: RLVa-2.0.0 diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 2279181bba..bc42027bf0 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -6610,12 +6610,9 @@ void LLAppViewer::forceErrorThreadCrash() thread->start(); } -// Change from std::string to char const*, saving a lot of object construction/destruction per frame -//void LLAppViewer::initMainloopTimeout(const std::string& state, F32 secs) -void LLAppViewer::initMainloopTimeout( char const* state, F32 secs) -// +void LLAppViewer::initMainloopTimeout(std::string_view state, F32 secs) { - if(!mMainloopTimeout) + if (!mMainloopTimeout) { mMainloopTimeout = new LLWatchdogTimeout(); resumeMainloopTimeout(state, secs); @@ -6624,23 +6621,20 @@ void LLAppViewer::initMainloopTimeout( char const* state, F32 secs) void LLAppViewer::destroyMainloopTimeout() { - if(mMainloopTimeout) + if (mMainloopTimeout) { delete mMainloopTimeout; - mMainloopTimeout = NULL; + mMainloopTimeout = nullptr; } } -// Change from std::string to char const*, saving a lot of object construction/destruction per frame -//void LLAppViewer::resumeMainloopTimeout(const std::string& state, F32 secs) -void LLAppViewer::resumeMainloopTimeout( char const* state, F32 secs) -// +void LLAppViewer::resumeMainloopTimeout(std::string_view state, F32 secs) { - if(mMainloopTimeout) + if (mMainloopTimeout) { - if(secs < 0.0f) + if (secs < 0.0f) { - static LLCachedControl mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60); + static LLCachedControl mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60.f); secs = mainloop_timeout; } @@ -6651,22 +6645,19 @@ void LLAppViewer::resumeMainloopTimeout( char const* state, F32 secs) void LLAppViewer::pauseMainloopTimeout() { - if(mMainloopTimeout) + if (mMainloopTimeout) { mMainloopTimeout->stop(); } } -// Change from std::string to char const*, saving a lot of object construction/destruction per frame -//void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) -void LLAppViewer::pingMainloopTimeout( char const* state, F32 secs) -// +void LLAppViewer::pingMainloopTimeout(std::string_view state, F32 secs) { LL_PROFILE_ZONE_SCOPED_CATEGORY_APP; - if(mMainloopTimeout) + if (mMainloopTimeout) { - if(secs < 0.0f) + if (secs < 0.0f) { static LLCachedControl mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60); secs = mainloop_timeout; diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index a9dae2fc72..b620d4384c 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -198,25 +198,11 @@ public: // For thread debugging. // llstartup needs to control init. // llworld, send_agent_pause() also controls pause/resume. - - // Change from std::string to char const*, saving a lot of object construction/destruction per frame - - // void initMainloopTimeout(const std::string& state, F32 secs = -1.0f); - void initMainloopTimeout( char const *state, F32 secs = -1.0f); - - // - + void initMainloopTimeout(std::string_view state, F32 secs = -1.0f); void destroyMainloopTimeout(); void pauseMainloopTimeout(); - - // Change from std::string to char const*, saving a lot of object construction/destruction per frame - - // void resumeMainloopTimeout(const std::string& state = "", F32 secs = -1.0f); - // void pingMainloopTimeout(const std::string& state, F32 secs = -1.0f); - void resumeMainloopTimeout( char const *state = "", F32 secs = -1.0f); - void pingMainloopTimeout( char const *state, F32 secs = -1.0f); - - // + void resumeMainloopTimeout(std::string_view state = "", F32 secs = -1.0f); + void pingMainloopTimeout(std::string_view state, F32 secs = -1.0f); // Handle the 'login completed' event. // *NOTE:Mani Fix this for login abstraction!! diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index ce3627a136..fc12854f99 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -217,7 +217,7 @@ void LLFloaterBvhPreview::setAnimCallbacks() getChild("ease_out_time")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateEaseOut, this, _1)); } -std::map LLFloaterBvhPreview::getJointAliases() +std::map> LLFloaterBvhPreview::getJointAliases() { LLPointer av = (LLVOAvatar*)mAnimPreview->getDummyAvatar(); return av->getJointAliases(); @@ -337,7 +337,7 @@ bool LLFloaterBvhPreview::loadBVH() ELoadStatus load_status = E_ST_OK; S32 line_number = 0; - std::map joint_alias_map = getJointAliases(); + auto joint_alias_map = getJointAliases(); loaderp = new LLBVHLoader(file_buffer, load_status, line_number, joint_alias_map); std::string status = getString(STATUS[load_status]); diff --git a/indra/newview/llfloaterbvhpreview.h b/indra/newview/llfloaterbvhpreview.h index b677e4c1be..5f99d962a3 100644 --- a/indra/newview/llfloaterbvhpreview.h +++ b/indra/newview/llfloaterbvhpreview.h @@ -123,7 +123,7 @@ public: // private: void setAnimCallbacks() ; - std::map getJointAliases(); + std::map> getJointAliases(); // Reload animation from disk bool loadBVH(); diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 0fcd96dd8b..1edc6a52b2 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1671,7 +1671,7 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides) { // Populate table - std::map joint_alias_map; + std::map> joint_alias_map; mModelPreview->getJointAliases(joint_alias_map); S32 conflicts = 0; diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 73449f4e86..ee57deecb7 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -1060,7 +1060,7 @@ void LLInventoryFilter::setFilterSubString(const std::string& string) boost::char_separator sep("+"); tokenizer tokens(filter_sub_string_new, sep); - for (auto token_iter : tokens) + for (const auto& token_iter : tokens) { mFilterTokens.push_back(token_iter); } @@ -1128,7 +1128,7 @@ void LLInventoryFilter::setFilterSubString(const std::string& string) // // Cancel out UUID once the search string is modified - if (mFilterOps.mFilterTypes == FILTERTYPE_UUID) + if (mFilterOps.mFilterTypes & FILTERTYPE_UUID) { // Find all links unhiding hidden empty system folders //mFilterOps.mFilterTypes &= ~FILTERTYPE_UUID; @@ -1948,7 +1948,7 @@ std::string LLInventoryFilter::getEmptyLookupMessage(bool is_empty_folder) const } } -bool LLInventoryFilter::areDateLimitsSet() +bool LLInventoryFilter::areDateLimitsSet() const { return mFilterOps.mMinDate != time_min() || mFilterOps.mMaxDate != time_max() diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index 554d755c17..804ca551ad 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -363,7 +363,7 @@ public: bool checkAgainstFilterThumbnails(const LLUUID& object_id) const; private: - bool areDateLimitsSet(); + bool areDateLimitsSet() const; bool checkAgainstFilterSubString(const std::string& desc) const; bool checkAgainstFilterType(const class LLFolderViewModelItemInventory* listener) const; bool checkAgainstFilterType(const LLInventoryItem* item) const; diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index de1f34eadb..effb969636 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -1020,7 +1020,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable clearGLODGroup(); } // - std::map joint_alias_map; + std::map> joint_alias_map; getJointAliases(joint_alias_map); LLHandle preview_handle = getHandle(); diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 4612dfd6e9..2445a7994c 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -164,6 +164,36 @@ void LLPanelFace::updateSelectedGLTFMaterials(std::functiongetSelection()->applyToTEs(&select_func); } +void LLPanelFace::updateSelectedGLTFMaterialsWithScale(std::function func) +{ + struct LLSelectedTEGLTFMaterialFunctor : public LLSelectedTEFunctor + { + LLSelectedTEGLTFMaterialFunctor(std::function func) : mFunc(func) {} + virtual ~LLSelectedTEGLTFMaterialFunctor() {}; + bool apply(LLViewerObject* object, S32 face) override + { + LLGLTFMaterial new_override; + const LLTextureEntry* tep = object->getTE(face); + if (tep->getGLTFMaterialOverride()) + { + new_override = *tep->getGLTFMaterialOverride(); + } + + U32 s_axis = VX; + U32 t_axis = VY; + LLPrimitive::getTESTAxes(face, &s_axis, &t_axis); + mFunc(&new_override, object->getScale().mV[s_axis], object->getScale().mV[t_axis]); + LLGLTFMaterialList::queueModify(object, face, &new_override); + + return true; + } + + std::function mFunc; + } select_func(func); + + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&select_func); +} + template void readSelectedGLTFMaterial(std::function func, T& value, bool& identical, bool has_tolerance, T tolerance) { @@ -184,6 +214,36 @@ void readSelectedGLTFMaterial(std::function func, T& v identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&select_func, value, has_tolerance, tolerance); } +void getSelectedGLTFMaterialMaxRepeats(LLGLTFMaterial::TextureInfo channel, F32& repeats, bool& identical) +{ + // The All channel should read base color values + if (channel == LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_COUNT) + channel = LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_BASE_COLOR; + + struct LLSelectedTEGetGLTFMaterialMaxRepeatsFunctor : public LLSelectedTEGetFunctor + { + LLSelectedTEGetGLTFMaterialMaxRepeatsFunctor(LLGLTFMaterial::TextureInfo channel) : mChannel(channel) {} + virtual ~LLSelectedTEGetGLTFMaterialMaxRepeatsFunctor() {}; + F32 get(LLViewerObject* object, S32 face) override + { + const LLTextureEntry* tep = object->getTE(face); + const LLGLTFMaterial* render_material = tep->getGLTFRenderMaterial(); + if (!render_material) + return 0.f; + + U32 s_axis = VX; + U32 t_axis = VY; + LLPrimitive::getTESTAxes(face, &s_axis, &t_axis); + F32 repeats_u = render_material->mTextureTransform[mChannel].mScale[VX] / object->getScale().mV[s_axis]; + F32 repeats_v = render_material->mTextureTransform[mChannel].mScale[VY] / object->getScale().mV[t_axis]; + return llmax(repeats_u, repeats_v); + } + + LLGLTFMaterial::TextureInfo mChannel; + } max_repeats_func(channel); + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue(&max_repeats_func, repeats); +} + BOOST_STATIC_ASSERT(MATTYPE_DIFFUSE == LLRender::DIFFUSE_MAP && MATTYPE_NORMAL == LLRender::NORMAL_MAP && MATTYPE_SPECULAR == LLRender::SPECULAR_MAP); // @@ -332,6 +392,7 @@ bool LLPanelFace::postBuild() getChildSetCommitCallback(mPBRScaleU, "gltfTextureScaleU", [&](LLUICtrl*, const LLSD&) { onCommitGLTFTextureScaleU(); }); getChildSetCommitCallback(mPBRScaleV, "gltfTextureScaleV", [&](LLUICtrl*, const LLSD&) { onCommitGLTFTextureScaleV(); }); + getChildSetCommitCallback(mPBRRepeat, "gltfRptctrl", [&](LLUICtrl*, const LLSD&) { onCommitGLTFRepeatsPerMeter(); }); getChildSetCommitCallback(mPBRRotate, "gltfTextureRotation", [&](LLUICtrl*, const LLSD&) { onCommitGLTFRotation(); }); getChildSetCommitCallback(mPBROffsetU, "gltfTextureOffsetU", [&](LLUICtrl*, const LLSD&) { onCommitGLTFTextureOffsetU(); }); getChildSetCommitCallback(mPBROffsetV, "gltfTextureOffsetV", [&](LLUICtrl*, const LLSD&) { onCommitGLTFTextureOffsetV(); }); @@ -1443,9 +1504,18 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) spec_scale_s = editable ? spec_scale_s : 1.0f; spec_scale_s *= identical_planar_texgen ? 2.0f : 1.0f; - mTexScaleU->setValue(diff_scale_s); - mShinyScaleU->setValue(spec_scale_s); - mBumpyScaleU->setValue(norm_scale_s); + if (force_set_values) + { + mTexScaleU->forceSetValue(diff_scale_s); + mShinyScaleU->forceSetValue(spec_scale_s); + mBumpyScaleU->forceSetValue(norm_scale_s); + } + else + { + mTexScaleU->setValue(diff_scale_s); + mShinyScaleU->setValue(spec_scale_s); + mBumpyScaleU->setValue(norm_scale_s); + } mTexScaleU->setEnabled(editable && has_material); // Materials alignment @@ -1502,13 +1572,16 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (force_set_values) { mTexScaleV->forceSetValue(diff_scale_t); + mShinyScaleV->forceSetValue(spec_scale_t); + mBumpyScaleV->forceSetValue(norm_scale_t); } else { mTexScaleV->setValue(diff_scale_t); + mShinyScaleV->setValue(spec_scale_t); + mBumpyScaleV->setValue(norm_scale_t); } - mShinyScaleV->setValue(spec_scale_t); - mBumpyScaleV->setValue(norm_scale_t); + mTexScaleV->setTentative(LLSD(diff_scale_tentative)); mShinyScaleV->setTentative(LLSD(spec_scale_tentative)); @@ -1657,36 +1730,57 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) F32 repeats_norm = 1.f; F32 repeats_spec = 1.f; + F32 repeats_pbr_basecolor = 1.f; + F32 repeats_pbr_metallic_roughness = 1.f; + F32 repeats_pbr_normal = 1.f; + F32 repeats_pbr_emissive = 1.f; + bool identical_diff_repeats = false; bool identical_norm_repeats = false; bool identical_spec_repeats = false; - LLSelectedTE::getMaxDiffuseRepeats(repeats_diff, identical_diff_repeats); - LLSelectedTEMaterial::getMaxNormalRepeats(repeats_norm, identical_norm_repeats); - LLSelectedTEMaterial::getMaxSpecularRepeats(repeats_spec, identical_spec_repeats); + bool identical_pbr_basecolor_repeats = false; + bool identical_pbr_metallic_roughness_repeats = false; + bool identical_pbr_normal_repeats = false; + bool identical_pbr_emissive_repeats = false; { + LLSpinCtrl* repeats_spin_ctrl = nullptr; S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; bool enabled = editable && (index != 1); bool identical_repeats = true; S32 material_selection = mComboMatMedia->getCurrentIndex(); F32 repeats = 1.0f; - U32 material_type = MATTYPE_DIFFUSE; - if (material_selection == MATMEDIA_MATERIAL) + LLRender::eTexIndex material_channel = LLRender::DIFFUSE_MAP; + if (material_selection != MATMEDIA_PBR) { - material_type = mRadioMaterialType->getSelectedIndex(); + repeats_spin_ctrl = mTexRepeat; + material_channel = getMatTextureChannel(); + LLSelectedTE::getMaxDiffuseRepeats(repeats_diff, identical_diff_repeats); + LLSelectedTEMaterial::getMaxNormalRepeats(repeats_norm, identical_norm_repeats); + LLSelectedTEMaterial::getMaxSpecularRepeats(repeats_spec, identical_spec_repeats); } else if (material_selection == MATMEDIA_PBR) { + repeats_spin_ctrl = mPBRRepeat; enabled = editable && has_pbr_material; - material_type = mRadioPbrType->getSelectedIndex(); + material_channel = getPBRTextureChannel(); + + getSelectedGLTFMaterialMaxRepeats(LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_BASE_COLOR, + repeats_pbr_basecolor, identical_pbr_basecolor_repeats); + getSelectedGLTFMaterialMaxRepeats(LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS, + repeats_pbr_metallic_roughness, identical_pbr_metallic_roughness_repeats); + getSelectedGLTFMaterialMaxRepeats(LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_NORMAL, + repeats_pbr_normal, identical_pbr_normal_repeats); + getSelectedGLTFMaterialMaxRepeats(LLGLTFMaterial::TextureInfo::GLTF_TEXTURE_INFO_EMISSIVE, + repeats_pbr_emissive, identical_pbr_emissive_repeats); } - switch (material_type) + switch (material_channel) { default: - case MATTYPE_DIFFUSE: + case LLRender::DIFFUSE_MAP: if (material_selection != MATMEDIA_PBR) { enabled = editable && !id.isNull(); @@ -1694,7 +1788,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) identical_repeats = identical_diff_repeats; repeats = repeats_diff; break; - case MATTYPE_SPECULAR: + case LLRender::SPECULAR_MAP: if (material_selection != MATMEDIA_PBR) { enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull()) @@ -1703,7 +1797,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) identical_repeats = identical_spec_repeats; repeats = repeats_spec; break; - case MATTYPE_NORMAL: + case LLRender::NORMAL_MAP: if (material_selection != MATMEDIA_PBR) { enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull()) @@ -1712,6 +1806,23 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) identical_repeats = identical_norm_repeats; repeats = repeats_norm; break; + case LLRender::NUM_TEXTURE_CHANNELS: + case LLRender::BASECOLOR_MAP: + identical_repeats = identical_pbr_basecolor_repeats; + repeats = repeats_pbr_basecolor; + break; + case LLRender::METALLIC_ROUGHNESS_MAP: + identical_repeats = identical_pbr_metallic_roughness_repeats; + repeats = repeats_pbr_metallic_roughness; + break; + case LLRender::GLTF_NORMAL_MAP: + identical_repeats = identical_pbr_normal_repeats; + repeats = repeats_pbr_normal; + break; + case LLRender::EMISSIVE_MAP: + identical_repeats = identical_pbr_emissive_repeats; + repeats = repeats_pbr_emissive; + break; } bool repeats_tentative = !identical_repeats; @@ -1719,14 +1830,14 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) if (force_set_values) { // onCommit, previosly edited element updates related ones - mTexRepeat->forceSetValue(editable ? repeats : 1.0f); + repeats_spin_ctrl->forceSetValue(editable ? repeats : 1.0f); } else { - mTexRepeat->setValue(editable ? repeats : 1.0f); + repeats_spin_ctrl->setValue(editable ? repeats : 1.0f); } - mTexRepeat->setTentative(LLSD(repeats_tentative)); - mTexRepeat->setEnabled(has_material && !identical_planar_texgen && enabled); + repeats_spin_ctrl->setTentative(LLSD(repeats_tentative)); + repeats_spin_ctrl->setEnabled(!identical_planar_texgen && enabled); // FIRE-11407 - Flip buttons mBtnTexFlipScaleU->setEnabled(enabled); mBtnTexFlipScaleV->setEnabled(enabled); @@ -1886,6 +1997,7 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) } mLabelColorTransp->setEnabled(false); mTexRepeat->setEnabled(false); + mPBRRepeat->setEnabled(false); mLabelTexGen->setEnabled(false); mLabelShininess->setEnabled(false); mLabelBumpiness->setEnabled(false); @@ -2086,6 +2198,7 @@ void LLPanelFace::updateVisibilityGLTF(LLViewerObject* objectp /*= nullptr */) mPBRRotate->setVisible(show_pbr); mPBROffsetU->setVisible(show_pbr); mPBROffsetV->setVisible(show_pbr); + mPBRRepeat->setVisible(show_pbr); } void LLPanelFace::updateCopyTexButton() @@ -3757,18 +3870,8 @@ void LLPanelFace::onCommitRepeatsPerMeter() if (gSavedSettings.getBOOL("SyncMaterialSettings")) { LLSelectMgr::getInstance()->selectionTexScaleAutofit(repeats_per_meter); - - mBumpyScaleU->setValue(obj_scale_s * repeats_per_meter); - mBumpyScaleV->setValue(obj_scale_t * repeats_per_meter); - - LLSelectedTEMaterial::setNormalRepeatX(this, obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setNormalRepeatY(this, obj_scale_t * repeats_per_meter); - - mShinyScaleU->setValue(obj_scale_s * repeats_per_meter); - mShinyScaleV->setValue(obj_scale_t * repeats_per_meter); - - LLSelectedTEMaterial::setSpecularRepeatX(this, obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setSpecularRepeatY(this, obj_scale_t * repeats_per_meter); + LLSelectedTEMaterial::selectionNormalScaleAutofit(this, repeats_per_meter); + LLSelectedTEMaterial::selectionSpecularScaleAutofit(this, repeats_per_meter); } else { @@ -3779,18 +3882,10 @@ void LLPanelFace::onCommitRepeatsPerMeter() LLSelectMgr::getInstance()->selectionTexScaleAutofit(repeats_per_meter); break; case MATTYPE_NORMAL: - mBumpyScaleU->setValue(obj_scale_s * repeats_per_meter); - mBumpyScaleV->setValue(obj_scale_t * repeats_per_meter); - - LLSelectedTEMaterial::setNormalRepeatX(this, obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setNormalRepeatY(this, obj_scale_t * repeats_per_meter); + LLSelectedTEMaterial::selectionNormalScaleAutofit(this, repeats_per_meter); break; case MATTYPE_SPECULAR: - mBumpyScaleU->setValue(obj_scale_s * repeats_per_meter); - mBumpyScaleV->setValue(obj_scale_t * repeats_per_meter); - - LLSelectedTEMaterial::setSpecularRepeatX(this, obj_scale_s * repeats_per_meter); - LLSelectedTEMaterial::setSpecularRepeatY(this, obj_scale_t * repeats_per_meter); + LLSelectedTEMaterial::selectionSpecularScaleAutofit(this, repeats_per_meter); break; default: llassert(false); @@ -3801,6 +3896,21 @@ void LLPanelFace::onCommitRepeatsPerMeter() updateUI(true); } +// Commit the number of GLTF repeats per meter +void LLPanelFace::onCommitGLTFRepeatsPerMeter() +{ + F32 repeats_per_meter = (F32)mPBRRepeat->getValue().asReal(); + + LLGLTFMaterial::TextureInfo material_type = getPBRTextureInfo(); + updateGLTFTextureTransformWithScale(material_type, [&](LLGLTFMaterial::TextureTransform* new_transform, F32 scale_s, F32 scale_t) + { + new_transform->mScale.mV[VX] = scale_s * repeats_per_meter; + new_transform->mScale.mV[VY] = scale_t * repeats_per_meter; + }); + + updateUI(true); +} + struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor { virtual bool apply(LLViewerObject* object, S32 te) @@ -4775,6 +4885,29 @@ void LLPanelFace::updateGLTFTextureTransform(std::function edit) +{ + if (texture_info == LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT) + { + updateSelectedGLTFMaterialsWithScale([&](LLGLTFMaterial* new_override, const F32 scale_s, const F32 scale_t) + { + for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i) + { + LLGLTFMaterial::TextureTransform& new_transform = new_override->mTextureTransform[(LLGLTFMaterial::TextureInfo)i]; + edit(&new_transform, scale_s, scale_t); + } + }); + } + else + { + updateSelectedGLTFMaterialsWithScale([&](LLGLTFMaterial* new_override, const F32 scale_s, const F32 scale_t) + { + LLGLTFMaterial::TextureTransform& new_transform = new_override->mTextureTransform[texture_info]; + edit(&new_transform, scale_s, scale_t); + }); + } +} + void LLPanelFace::setMaterialOverridesFromSelection() { const LLGLTFMaterial::TextureInfo texture_info = getPBRTextureInfo(); @@ -4850,8 +4983,9 @@ void LLPanelFace::setMaterialOverridesFromSelection() } } - mPBRScaleU->setValue(transform.mScale[VX]); - mPBRScaleV->setValue(transform.mScale[VY]); + // Force set scales just in case they were set by repeats per meter and their spinner is focused + mPBRScaleU->forceSetValue(transform.mScale[VX]); + mPBRScaleV->forceSetValue(transform.mScale[VY]); mPBRRotate->setValue(transform.mRotation * RAD_TO_DEG); mPBROffsetU->setValue(transform.mOffset[VX]); mPBROffsetV->setValue(transform.mOffset[VY]); @@ -4861,6 +4995,12 @@ void LLPanelFace::setMaterialOverridesFromSelection() mPBRRotate->setTentative(!rotation_same); mPBROffsetU->setTentative(!offset_u_same); mPBROffsetV->setTentative(!offset_v_same); + + F32 repeats = 1.f; + bool identical = false; + getSelectedGLTFMaterialMaxRepeats(getPBRDropChannel(), repeats, identical); + mPBRRepeat->forceSetValue(repeats); + mPBRRepeat->setTentative(!identical || !scale_u_same || !scale_v_same); } void LLPanelFace::Selection::connect() @@ -5354,6 +5494,62 @@ void LLPanelFace::LLSelectedTEMaterial::getCurrentDiffuseAlphaMode(U8& diffuse_a identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &get_diff_mode, diffuse_alpha_mode); } +void LLPanelFace::LLSelectedTEMaterial::selectionNormalScaleAutofit(LLPanelFace* panel_face, F32 repeats_per_meter) +{ + struct f : public LLSelectedTEFunctor + { + LLPanelFace* mFacePanel; + F32 mRepeatsPerMeter; + f(LLPanelFace* face_panel, const F32& repeats_per_meter) : mFacePanel(face_panel), mRepeatsPerMeter(repeats_per_meter) {} + bool apply(LLViewerObject* object, S32 te) + { + if (object->permModify()) + { + // Compute S,T to axis mapping + U32 s_axis, t_axis; + if (!LLPrimitive::getTESTAxes(te, &s_axis, &t_axis)) + return true; + + F32 new_s = object->getScale().mV[s_axis] * mRepeatsPerMeter; + F32 new_t = object->getScale().mV[t_axis] * mRepeatsPerMeter; + + setNormalRepeatX(mFacePanel, new_s, te); + setNormalRepeatY(mFacePanel, new_t, te); + } + return true; + } + } setfunc(panel_face, repeats_per_meter); + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); +} + +void LLPanelFace::LLSelectedTEMaterial::selectionSpecularScaleAutofit(LLPanelFace* panel_face, F32 repeats_per_meter) +{ + struct f : public LLSelectedTEFunctor + { + LLPanelFace* mFacePanel; + F32 mRepeatsPerMeter; + f(LLPanelFace* face_panel, const F32& repeats_per_meter) : mFacePanel(face_panel), mRepeatsPerMeter(repeats_per_meter) {} + bool apply(LLViewerObject* object, S32 te) + { + if (object->permModify()) + { + // Compute S,T to axis mapping + U32 s_axis, t_axis; + if (!LLPrimitive::getTESTAxes(te, &s_axis, &t_axis)) + return true; + + F32 new_s = object->getScale().mV[s_axis] * mRepeatsPerMeter; + F32 new_t = object->getScale().mV[t_axis] * mRepeatsPerMeter; + + setSpecularRepeatX(mFacePanel, new_s, te); + setSpecularRepeatY(mFacePanel, new_t, te); + } + return true; + } + } setfunc(panel_face, repeats_per_meter); + LLSelectMgr::getInstance()->getSelection()->applyToTEs(&setfunc); +} + void LLPanelFace::LLSelectedTE::getObjectScaleS(F32& scale_s, bool& identical) { struct LLSelectedTEGetObjectScaleS : public LLSelectedTEGetFunctor @@ -5544,6 +5740,12 @@ void LLPanelFace::changePrecision(S32 decimal_precision) mBumpyRotate->setPrecision(decimal_precision); mShinyRotate->setPrecision(decimal_precision); mTexRepeat->setPrecision(decimal_precision); + mPBRScaleU->setPrecision(decimal_precision); + mPBRScaleV->setPrecision(decimal_precision); + mPBRRotate->setPrecision(decimal_precision); + mPBROffsetU->setPrecision(decimal_precision); + mPBROffsetV->setPrecision(decimal_precision); + mPBRRepeat->setPrecision(decimal_precision); } // diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 7515d6785f..8dfc6cdcd9 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -251,6 +251,7 @@ protected: void onCommitGLTFRotation(); void onCommitGLTFTextureOffsetU(); void onCommitGLTFTextureOffsetV(); + void onCommitGLTFRepeatsPerMeter(); void onClickAutoFix(); void onAlignTexture(); @@ -384,6 +385,7 @@ private: LLButton* mDelMedia { nullptr }; LLSpinCtrl* mPBRScaleU { nullptr }; LLSpinCtrl* mPBRScaleV { nullptr }; + LLSpinCtrl* mPBRRepeat { nullptr }; LLSpinCtrl* mPBRRotate { nullptr }; LLSpinCtrl* mPBROffsetU { nullptr }; LLSpinCtrl* mPBROffsetV { nullptr }; @@ -585,7 +587,9 @@ private: void updateVisibilityGLTF(LLViewerObject* objectp = nullptr); void updateSelectedGLTFMaterials(std::function func); + void updateSelectedGLTFMaterialsWithScale(std::function func); void updateGLTFTextureTransform(std::function edit); + void updateGLTFTextureTransformWithScale(const LLGLTFMaterial::TextureInfo texture_info, std::function edit); void setMaterialOverridesFromSelection(); @@ -684,6 +688,8 @@ public: static void getMaxSpecularRepeats(F32& repeats, bool& identical); static void getMaxNormalRepeats(F32& repeats, bool& identical); static void getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha); + static void selectionNormalScaleAutofit(LLPanelFace* panel_face, F32 repeats_per_meter); + static void selectionSpecularScaleAutofit(LLPanelFace* panel_face, F32 repeats_per_meter); DEF_GET_MAT_STATE(LLUUID, const LLUUID&, getNormalID, LLUUID::null, false, LLUUID::null); DEF_GET_MAT_STATE(LLUUID, const LLUUID&, getSpecularID, LLUUID::null, false, LLUUID::null); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index dfae87d95a..88eb15079a 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -87,9 +87,9 @@ static LLPanelInjector t_inventory("panel_main_inventory") class LLFloaterInventoryFinder : public LLFloater { public: - LLFloaterInventoryFinder( LLPanelMainInventory* inventory_view); - virtual void draw(); - /*virtual*/ bool postBuild(); + LLFloaterInventoryFinder(LLPanelMainInventory* inventory_view); + void draw(); + bool postBuild(); void changeFilter(LLInventoryFilter* filter); void updateElementsFromFilter(); bool getCheckShowEmpty(); @@ -106,20 +106,44 @@ public: void onPermissionsChanged(); // FIRE-1175 - Filter Permissions Menu - static void onTimeAgo(LLUICtrl*, void *); - static void onCloseBtn(void* user_data); - static void selectAllTypes(void* user_data); - static void selectNoTypes(void* user_data); + void onTimeAgo(); + void onCloseBtn(); + void selectAllTypes(); + void selectNoTypes(); // FIRE-5160: Don't reset inventory filter when clearing search term void onResetBtn(); private: - LLPanelMainInventory* mPanelMainInventory; - LLSpinCtrl* mSpinSinceDays; - LLSpinCtrl* mSpinSinceHours; - LLCheckBoxCtrl* mCreatorSelf; - LLCheckBoxCtrl* mCreatorOthers; - LLInventoryFilter* mFilter; + LLPanelMainInventory* mPanelMainInventory{ nullptr }; + LLSpinCtrl* mSpinSinceDays{ nullptr }; + LLSpinCtrl* mSpinSinceHours{ nullptr }; + LLCheckBoxCtrl* mCreatorSelf{ nullptr }; + LLCheckBoxCtrl* mCreatorOthers{ nullptr }; + LLInventoryFilter* mFilter{ nullptr }; + + LLCheckBoxCtrl* mCheckAnimation{ nullptr }; + LLCheckBoxCtrl* mCheckCallingCard{ nullptr }; + LLCheckBoxCtrl* mCheckClothing{ nullptr }; + LLCheckBoxCtrl* mCheckGesture{ nullptr }; + LLCheckBoxCtrl* mCheckLandmark{ nullptr }; + LLCheckBoxCtrl* mCheckMaterial{ nullptr }; + LLCheckBoxCtrl* mCheckNotecard{ nullptr }; + LLCheckBoxCtrl* mCheckObject{ nullptr }; + LLCheckBoxCtrl* mCheckScript{ nullptr }; + LLCheckBoxCtrl* mCheckSounds{ nullptr }; + LLCheckBoxCtrl* mCheckTexture{ nullptr }; + LLCheckBoxCtrl* mCheckSnapshot{ nullptr }; + LLCheckBoxCtrl* mCheckSettings{ nullptr }; + LLCheckBoxCtrl* mCheckShowEmpty{ nullptr }; + LLCheckBoxCtrl* mCheckSinceLogoff{ nullptr }; + // FIRE-1175 - Filter Permissions Menu + LLCheckBoxCtrl* mCheckModify{ nullptr }; + LLCheckBoxCtrl* mCheckCopy{ nullptr }; + LLCheckBoxCtrl* mCheckTransfer{ nullptr }; + // + + LLRadioGroup* mRadioDateSearchDirection{ nullptr }; + // [FIRE-35042] Inventory - Only Coalesced Filter - More accessible LLCheckBoxCtrl* mOnlyCoalescedFilterCheck; // Stores the pointer to the Only Coalesced filter checkbox LLComboBox* mShowLinksFilterCombo; // Stores the pointer to the Show Links filter combo box @@ -963,7 +987,6 @@ bool LLPanelMainInventory::filtersVisible(void* user_data) void LLPanelMainInventory::onClearSearch() { bool initially_active = false; - LLFloater *finder = getFinder(); // Worn inventory panel //if (mActivePanel && (getActivePanel() != mWornItemsPanel)) if (mActivePanel) @@ -978,9 +1001,9 @@ void LLPanelMainInventory::onClearSearch() // } - if (finder) + if (LLFloaterInventoryFinder* finder = getFinder()) { - LLFloaterInventoryFinder::selectAllTypes(finder); + finder->selectAllTypes(); } // re-open folders that were initially open in case filter was active @@ -1099,7 +1122,7 @@ void LLPanelMainInventory::onFilterTypeSelected(const std::string& filter_type_n // update subwindow if it's open if (finder) { - LLFloaterInventoryFinder::selectAllTypes(finder); + finder->selectAllTypes(); } } // special treatment for "custom" filter @@ -1562,65 +1585,71 @@ bool LLFloaterInventoryFinder::postBuild() const LLRect& viewrect = mPanelMainInventory->getRect(); setRect(LLRect(viewrect.mLeft - getRect().getWidth(), viewrect.mTop, viewrect.mLeft, viewrect.mTop - getRect().getHeight())); - childSetAction("All", selectAllTypes, this); - childSetAction("None", selectNoTypes, this); + childSetAction("All", [this](LLUICtrl*, const LLSD&) { selectAllTypes(); }); + childSetAction("None", [this](LLUICtrl*, const LLSD&) { selectNoTypes(); }); mSpinSinceHours = getChild("spin_hours_ago"); - childSetCommitCallback("spin_hours_ago", onTimeAgo, this); + mSpinSinceHours->setCommitCallback([this](LLUICtrl*, const LLSD&) { onTimeAgo(); }); mSpinSinceDays = getChild("spin_days_ago"); - childSetCommitCallback("spin_days_ago", onTimeAgo, this); + mSpinSinceDays->setCommitCallback([this](LLUICtrl*, const LLSD&) { onTimeAgo(); }); mCreatorSelf = getChild("check_created_by_me"); mCreatorOthers = getChild("check_created_by_others"); mCreatorSelf->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onCreatorSelfFilterCommit, this)); mCreatorOthers->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onCreatorOtherFilterCommit, this)); + mCheckAnimation = getChild("check_animation"); + mCheckCallingCard = getChild("check_calling_card"); + mCheckClothing = getChild("check_clothing"); + mCheckGesture = getChild("check_gesture"); + mCheckLandmark = getChild("check_landmark"); + mCheckMaterial = getChild("check_material"); + mCheckNotecard = getChild("check_notecard"); + mCheckObject = getChild("check_object"); + mCheckScript = getChild("check_script"); + mCheckSounds = getChild("check_sound"); + mCheckTexture = getChild("check_texture"); + mCheckSnapshot = getChild("check_snapshot"); + mCheckSettings = getChild("check_settings"); + mCheckShowEmpty = getChild("check_show_empty"); + mCheckSinceLogoff = getChild("check_since_logoff"); + mRadioDateSearchDirection = getChild("date_search_direction"); + + childSetAction("Close", [this](LLUICtrl*, const LLSD&) { onCloseBtn(); }); + // [FIRE-35042] Inventory - Only Coalesced Filter - More accessible - // Get the Finder's Only Coalesced check box for use later on, instead of calling getChild everytime accessing it mOnlyCoalescedFilterCheck = getChild("check_only_coalesced"); - // If the checkbox could be found, then set the commit callback to onOnlyCoalescedFilterCommit to update the mFilter object - // with the value in the checkbox. - if (mOnlyCoalescedFilterCheck) - { - mOnlyCoalescedFilterCheck->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onOnlyCoalescedFilterCommit, this)); - } - // Get the Finder's Show Links Filter combobox for use later as well to also prevent having to call get child everytime accessing it. + mOnlyCoalescedFilterCheck->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onOnlyCoalescedFilterCommit, this)); + mShowLinksFilterCombo = getChild("inventory_filter_show_links_combo"); - // If the combobox could be found, then set the commit callback to onShowLinksFilterCommit to update the mFilter object - // with the value in the checkbox. - if (mShowLinksFilterCombo) - { - mShowLinksFilterCombo->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onShowLinksFilterCommit, this)); - } + mShowLinksFilterCombo->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onShowLinksFilterCommit, this)); // [FIRE-35042] - - childSetAction("Close", onCloseBtn, this); - // FIRE-5160: Don't reset inventory filter when clearing search term getChild("btnReset")->setClickedCallback(boost::bind(&LLFloaterInventoryFinder::onResetBtn, this)); updateElementsFromFilter(); // FIRE-1175 - Filter Permissions Menu - getChild("check_modify")->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onPermissionsChanged, this)); - getChild("check_copy")->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onPermissionsChanged, this)); - getChild("check_transfer")->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onPermissionsChanged, this)); + mCheckModify = getChild("check_modify"); + mCheckCopy = getChild("check_copy"); + mCheckTransfer = getChild("check_transfer"); + mCheckModify->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onPermissionsChanged, this)); + mCheckCopy->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onPermissionsChanged, this)); + mCheckTransfer->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onPermissionsChanged, this)); // return true; } -void LLFloaterInventoryFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data) + +void LLFloaterInventoryFinder::onTimeAgo() { - LLFloaterInventoryFinder *self = (LLFloaterInventoryFinder *)user_data; - if (!self) return; - - if ( self->mSpinSinceDays->get() || self->mSpinSinceHours->get() ) + if (mSpinSinceDays->get() || mSpinSinceHours->get()) { - self->getChild("check_since_logoff")->setValue(false); + mCheckSinceLogoff->setValue(false); - U32 days = (U32)self->mSpinSinceDays->get(); - U32 hours = (U32)self->mSpinSinceHours->get(); + U32 days = (U32)mSpinSinceDays->get(); + U32 hours = (U32)mSpinSinceHours->get(); if (hours >= 24) { // Try to handle both cases of spinner clicking and text input in a sensible fashion as best as possible. @@ -1636,11 +1665,11 @@ void LLFloaterInventoryFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data) days = hours / 24; } hours = (U32)hours % 24; - self->mSpinSinceHours->setFocus(false); - self->mSpinSinceDays->setFocus(false); - self->mSpinSinceDays->set((F32)days); - self->mSpinSinceHours->set((F32)hours); - self->mSpinSinceHours->setFocus(true); + mSpinSinceHours->setFocus(false); + mSpinSinceDays->setFocus(false); + mSpinSinceDays->set((F32)days); + mSpinSinceHours->set((F32)hours); + mSpinSinceHours->setFocus(true); } } } @@ -1679,34 +1708,33 @@ void LLFloaterInventoryFinder::updateElementsFromFilter() setTitle(LLTrans::getString(mFilter->getName())); // - getChild("check_animation")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_ANIMATION)); + mCheckAnimation->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_ANIMATION)); + mCheckCallingCard->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_CALLINGCARD)); + mCheckClothing->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_WEARABLE)); + mCheckGesture->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_GESTURE)); + mCheckLandmark->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LANDMARK)); + mCheckMaterial->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_MATERIAL)); + mCheckNotecard->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_NOTECARD)); + mCheckObject->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_OBJECT)); + mCheckScript->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LSL)); + mCheckSounds->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SOUND)); + mCheckTexture->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_TEXTURE)); + mCheckSnapshot->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SNAPSHOT)); + mCheckSettings->setValue((S32)(filter_types & 0x1 << LLInventoryType::IT_SETTINGS)); + mCheckShowEmpty->setValue(show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS); - getChild("check_calling_card")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_CALLINGCARD)); - getChild("check_clothing")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_WEARABLE)); - getChild("check_gesture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_GESTURE)); - getChild("check_landmark")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LANDMARK)); - getChild("check_material")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_MATERIAL)); - getChild("check_notecard")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_NOTECARD)); - getChild("check_object")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_OBJECT)); - getChild("check_script")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LSL)); - getChild("check_sound")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SOUND)); - getChild("check_texture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_TEXTURE)); - getChild("check_snapshot")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SNAPSHOT)); - getChild("check_settings")->setValue((S32)(filter_types & 0x1 << LLInventoryType::IT_SETTINGS)); - getChild("check_show_empty")->setValue(show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS); + mCreatorSelf->setValue(show_created_by_me); + mCreatorOthers->setValue(show_created_by_others); - getChild("check_created_by_me")->setValue(show_created_by_me); - getChild("check_created_by_others")->setValue(show_created_by_others); - - getChild("check_since_logoff")->setValue(mFilter->isSinceLogoff()); + mCheckSinceLogoff->setValue(mFilter->isSinceLogoff()); mSpinSinceHours->set((F32)(hours % 24)); mSpinSinceDays->set((F32)(hours / 24)); - getChild("date_search_direction")->setSelectedIndex(date_search_direction); + mRadioDateSearchDirection->setSelectedIndex(date_search_direction); // FIRE-1175 - Filter Permissions Menu - getChild("check_modify")->setValue((bool) (mFilter->getFilterPermissions() & PERM_MODIFY)); - getChild("check_copy")->setValue((bool) (mFilter->getFilterPermissions() & PERM_COPY)); - getChild("check_transfer")->setValue((bool) (mFilter->getFilterPermissions() & PERM_TRANSFER)); + mCheckModify->setValue(mFilter->getFilterPermissions() & PERM_MODIFY); + mCheckCopy->setValue(mFilter->getFilterPermissions() & PERM_COPY); + mCheckTransfer->setValue(mFilter->getFilterPermissions() & PERM_TRANSFER); // // [FIRE-35042] Inventory - Only Coalesced Filter - More accessible @@ -1735,80 +1763,80 @@ void LLFloaterInventoryFinder::draw() U64 filter = 0xffffffffffffffffULL; bool filtered_by_all_types = true; - if (!getChild("check_animation")->getValue()) + if (!mCheckAnimation->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_ANIMATION); filtered_by_all_types = false; } - if (!getChild("check_calling_card")->getValue()) + if (!mCheckCallingCard->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_CALLINGCARD); filtered_by_all_types = false; } - if (!getChild("check_clothing")->getValue()) + if (!mCheckClothing->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_WEARABLE); filtered_by_all_types = false; } - if (!getChild("check_gesture")->getValue()) + if (!mCheckGesture->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_GESTURE); filtered_by_all_types = false; } - if (!getChild("check_landmark")->getValue()) + if (!mCheckLandmark->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_LANDMARK); filtered_by_all_types = false; } - if (!getChild("check_material")->getValue()) + if (!mCheckMaterial->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_MATERIAL); filtered_by_all_types = false; } - if (!getChild("check_notecard")->getValue()) + if (!mCheckNotecard->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_NOTECARD); filtered_by_all_types = false; } - if (!getChild("check_object")->getValue()) + if (!mCheckObject->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_OBJECT); filter &= ~(0x1 << LLInventoryType::IT_ATTACHMENT); filtered_by_all_types = false; } - if (!getChild("check_script")->getValue()) + if (!mCheckScript->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_LSL); filtered_by_all_types = false; } - if (!getChild("check_sound")->getValue()) + if (!mCheckSounds->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_SOUND); filtered_by_all_types = false; } - if (!getChild("check_texture")->getValue()) + if (!mCheckTexture->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_TEXTURE); filtered_by_all_types = false; } - if (!getChild("check_snapshot")->getValue()) + if (!mCheckSnapshot->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_SNAPSHOT); filtered_by_all_types = false; } - if (!getChild("check_settings")->getValue()) + if (!mCheckSettings->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_SETTINGS); filtered_by_all_types = false; @@ -1929,17 +1957,17 @@ void LLFloaterInventoryFinder::onPermissionsChanged() { PermissionMask perms = PERM_NONE; - if (getChild("check_modify")->getValue().asBoolean()) + if (mCheckModify->getValue().asBoolean()) { perms |= PERM_MODIFY; } - if (getChild("check_copy")->getValue().asBoolean()) + if (mCheckCopy->getValue().asBoolean()) { perms |= PERM_COPY; } - if (getChild("check_transfer")->getValue().asBoolean()) + if (mCheckTransfer->getValue().asBoolean()) { perms |= PERM_TRANSFER; } @@ -1974,65 +2002,56 @@ void LLFloaterInventoryFinder::onShowLinksFilterCommit() bool LLFloaterInventoryFinder::getCheckShowEmpty() { - return getChild("check_show_empty")->getValue(); + return mCheckShowEmpty->getValue(); } bool LLFloaterInventoryFinder::getCheckSinceLogoff() { - return getChild("check_since_logoff")->getValue(); + return mCheckSinceLogoff->getValue(); } U32 LLFloaterInventoryFinder::getDateSearchDirection() { - return getChild("date_search_direction")->getSelectedIndex(); + return mRadioDateSearchDirection->getSelectedIndex(); } -void LLFloaterInventoryFinder::onCloseBtn(void* user_data) +void LLFloaterInventoryFinder::onCloseBtn() { - LLFloaterInventoryFinder* finderp = (LLFloaterInventoryFinder*)user_data; - finderp->closeFloater(); + closeFloater(); } -// static -void LLFloaterInventoryFinder::selectAllTypes(void* user_data) +void LLFloaterInventoryFinder::selectAllTypes() { - LLFloaterInventoryFinder* self = (LLFloaterInventoryFinder*)user_data; - if(!self) return; - - self->getChild("check_animation")->setValue(true); - self->getChild("check_calling_card")->setValue(true); - self->getChild("check_clothing")->setValue(true); - self->getChild("check_gesture")->setValue(true); - self->getChild("check_landmark")->setValue(true); - self->getChild("check_material")->setValue(true); - self->getChild("check_notecard")->setValue(true); - self->getChild("check_object")->setValue(true); - self->getChild("check_script")->setValue(true); - self->getChild("check_sound")->setValue(true); - self->getChild("check_texture")->setValue(true); - self->getChild("check_snapshot")->setValue(true); - self->getChild("check_settings")->setValue(true); + mCheckAnimation->setValue(true); + mCheckCallingCard->setValue(true); + mCheckClothing->setValue(true); + mCheckGesture->setValue(true); + mCheckLandmark->setValue(true); + mCheckMaterial->setValue(true); + mCheckNotecard->setValue(true); + mCheckObject->setValue(true); + mCheckScript->setValue(true); + mCheckSounds->setValue(true); + mCheckTexture->setValue(true); + mCheckSnapshot->setValue(true); + mCheckSettings->setValue(true); } -//static -void LLFloaterInventoryFinder::selectNoTypes(void* user_data) +void LLFloaterInventoryFinder::selectNoTypes() { - LLFloaterInventoryFinder* self = (LLFloaterInventoryFinder*)user_data; - if(!self) return; - - self->getChild("check_animation")->setValue(false); - self->getChild("check_calling_card")->setValue(false); - self->getChild("check_clothing")->setValue(false); - self->getChild("check_gesture")->setValue(false); - self->getChild("check_landmark")->setValue(false); - self->getChild("check_material")->setValue(false); - self->getChild("check_notecard")->setValue(false); - self->getChild("check_object")->setValue(false); - self->getChild("check_script")->setValue(false); - self->getChild("check_sound")->setValue(false); - self->getChild("check_texture")->setValue(false); - self->getChild("check_snapshot")->setValue(false); - self->getChild("check_settings")->setValue(false); + mCheckAnimation->setValue(false); + mCheckCallingCard->setValue(false); + mCheckClothing->setValue(false); + mCheckGesture->setValue(false); + mCheckLandmark->setValue(false); + mCheckMaterial->setValue(false); + mCheckNotecard->setValue(false); + mCheckObject->setValue(false); + mCheckScript->setValue(false); + mCheckSounds->setValue(false); + mCheckTexture->setValue(false); + mCheckSnapshot->setValue(false); + mCheckSettings->setValue(false); } // Inventory Collapse and Expand Buttons diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp index 1be24ed946..c1c4acbd60 100644 --- a/indra/newview/llpanelprofilepicks.cpp +++ b/indra/newview/llpanelprofilepicks.cpp @@ -267,7 +267,6 @@ void LLPanelProfilePicks::onClickNewBtn() label(pick_panel->getPickName())); updateButtons(); - // Keep set location button pick_panel->addLocationChangedCallbacks(); } @@ -670,14 +669,12 @@ void LLPanelProfilePick::setAvatarId(const LLUUID& avatar_id) { mPickName->setEnabled(true); mPickDescription->setEnabled(true); - // Make sure the "Set Location" button is only visible when viewing own picks - childSetVisible("set_to_curr_location_btn_lp", true); + mSetCurrentLocationButton->setVisible(true); } else { - // Make sure the "Set Location" button is only visible when viewing own picks - childSetVisible("set_to_curr_location_btn_lp", false); mSnapshotCtrl->setEnabled(false); + mSetCurrentLocationButton->setVisible(false); } } @@ -688,7 +685,8 @@ bool LLPanelProfilePick::postBuild() mSaveButton = getChild("save_changes_btn"); mCreateButton = getChild("create_changes_btn"); mCancelButton = getChild("cancel_changes_btn"); - mSetCurrentLocationButton = getChild("set_to_curr_location_btn"); // Keep set location button + mSetCurrentLocationButton = getChild("set_to_curr_location_btn"); + mPreviewButton = getChild("btn_preview"); // Preview button mSnapshotCtrl = getChild("pick_snapshot"); @@ -702,7 +700,8 @@ bool LLPanelProfilePick::postBuild() mSaveButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSave, this)); mCreateButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSave, this)); mCancelButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickCancel, this)); - mSetCurrentLocationButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSetLocation, this)); // Keep set location button + mSetCurrentLocationButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSetLocation, this)); + // Preview button mPreviewButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickPreview, this)); // @@ -894,7 +893,6 @@ bool LLPanelProfilePick::isDirty() const return false; } -// Keep set location button void LLPanelProfilePick::onClickSetLocation() { // Save location for later use. @@ -920,8 +918,6 @@ void LLPanelProfilePick::onClickSetLocation() mLocationChanged = true; enableSaveButton(true); } -// - // Preview button void LLPanelProfilePick::onClickPreview() { @@ -954,12 +950,10 @@ void LLPanelProfilePick::onClickSave() { mParcelCallbackConnection.disconnect(); } - // Keep set location button - if (mLocationChanged) + if (mLocationChanged) { onClickSetLocation(); } - // sendUpdate(); mLocationChanged = false; @@ -1010,6 +1004,12 @@ void LLPanelProfilePick::processParcelInfo(const LLParcelData& parcel_data) } } +void LLPanelProfilePick::addLocationChangedCallbacks() +{ + mRegionCallbackConnection = gAgent.addRegionChangedCallback([this]() { onClickSetLocation(); }); + mParcelCallbackConnection = gAgent.addParcelChangedCallback([this]() { onClickSetLocation(); }); +} + void LLPanelProfilePick::setParcelID(const LLUUID& parcel_id) { if (mParcelId != parcel_id) @@ -1024,14 +1024,6 @@ void LLPanelProfilePick::setParcelID(const LLUUID& parcel_id) } } -// Keep set location button -void LLPanelProfilePick::addLocationChangedCallbacks() -{ - mRegionCallbackConnection = gAgent.addRegionChangedCallback([this]() { onClickSetLocation(); }); - mParcelCallbackConnection = gAgent.addParcelChangedCallback([this]() { onClickSetLocation(); }); -} -// - void LLPanelProfilePick::sendUpdate() { LLPickData pick_data; diff --git a/indra/newview/llpanelprofilepicks.h b/indra/newview/llpanelprofilepicks.h index 25ab352c14..2207a5df03 100644 --- a/indra/newview/llpanelprofilepicks.h +++ b/indra/newview/llpanelprofilepicks.h @@ -148,7 +148,7 @@ public: LLUUID getParcelID() const { return mParcelId; } void setErrorStatus(S32 status, const std::string& reason) override {}; - void addLocationChangedCallbacks(); // Keep set location button + void addLocationChangedCallbacks(); protected: @@ -214,12 +214,10 @@ public: */ void resetDirty() override; - // Keep set location button /** * Callback for "Set Location" button click */ void onClickSetLocation(); - // // Preview button /** @@ -250,7 +248,7 @@ protected: LLTextureCtrl* mSnapshotCtrl; LLLineEditor* mPickName; LLTextEditor* mPickDescription; - LLButton* mSetCurrentLocationButton; // Keep set location button + LLButton* mSetCurrentLocationButton; LLButton* mSaveButton; LLButton* mCreateButton; LLButton* mCancelButton; @@ -269,7 +267,7 @@ protected: bool mLocationChanged; bool mNewPick; - bool mIsEditing; + bool mIsEditing; // Preview button bool mPreview; std::string mOriginalPickText; diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h index 32599dcee2..d06f181357 100644 --- a/indra/newview/llsky.h +++ b/indra/newview/llsky.h @@ -28,7 +28,6 @@ #define LL_LLSKY_H #include "llmath.h" -//#include "vmath.h" #include "v3math.h" #include "v4math.h" #include "v4color.h" diff --git a/indra/newview/llsprite.h b/indra/newview/llsprite.h index 44439bd30c..d6e8e37ec9 100644 --- a/indra/newview/llsprite.h +++ b/indra/newview/llsprite.h @@ -27,8 +27,6 @@ #ifndef LL_LLSPRITE_H #define LL_LLSPRITE_H -////#include "vmath.h" -//#include "llmath.h" #include "v3math.h" #include "v4math.h" #include "v4color.h" diff --git a/indra/newview/llsurface.h b/indra/newview/llsurface.h index d7a57b8a52..14f27d737d 100644 --- a/indra/newview/llsurface.h +++ b/indra/newview/llsurface.h @@ -27,7 +27,6 @@ #ifndef LL_LLSURFACE_H #define LL_LLSURFACE_H -//#include "vmath.h" #include "v3math.h" #include "v3dmath.h" #include "v4math.h" diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 1cc89f21ca..002c1450ca 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -107,13 +107,13 @@ extern LLPointer gStartTexture; extern bool gShiftFrame; -LLPointer gDisconnectedImagep = NULL; +LLPointer gDisconnectedImagep = nullptr; // used to toggle renderer back on after teleport bool gTeleportDisplay = false; LLFrameTimer gTeleportDisplayTimer; LLFrameTimer gTeleportArrivalTimer; -const F32 RESTORE_GL_TIME = 5.f; // Wait this long while reloading textures before we raise the curtain +constexpr F32 RESTORE_GL_TIME = 5.f; // Wait this long while reloading textures before we raise the curtain // Draw Distance stepping; originally based on SpeedRez by Henri Beauchamp, licensed under LGPL F32 gSavedDrawDistance = 0.0f; F32 gLastDrawDistanceStep = 0.0f; @@ -132,9 +132,9 @@ bool gSnapshotNoPost = false; bool gShaderProfileFrame = false; // This is how long the sim will try to teleport you before giving up. -const F32 TELEPORT_EXPIRY = 15.0f; +constexpr F32 TELEPORT_EXPIRY = 15.0f; // Additional time (in seconds) to wait per attachment -const F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3.f; +constexpr F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3.f; U32 gRecentFrameCount = 0; // number of 'recent' frames LLFrameTimer gRecentFPSTime; @@ -142,8 +142,6 @@ LLFrameTimer gRecentMemoryTime; LLFrameTimer gAssetStorageLogTime; // Rendering stuff -void pre_show_depth_buffer(); -void post_show_depth_buffer(); void render_ui(F32 zoom_factor = 1.f, int subfield = 0); void swap(); void render_hud_attachments(); @@ -224,7 +222,8 @@ void display_update_camera() F32 final_far = gAgentCamera.mDrawDistance; if (gCubeSnapshot) { - final_far = gSavedSettings.getF32("RenderReflectionProbeDrawDistance"); + static LLCachedControl reflection_probe_draw_distance(gSavedSettings, "RenderReflectionProbeDrawDistance", 64.f); + final_far = reflection_probe_draw_distance(); } else if (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode()) @@ -252,7 +251,7 @@ void display_update_camera() void display_stats() { LL_PROFILE_ZONE_SCOPED; - const F32 FPS_LOG_FREQUENCY = 10.f; + constexpr F32 FPS_LOG_FREQUENCY = 10.f; if (gRecentFPSTime.getElapsedTimeF32() >= FPS_LOG_FREQUENCY) { LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("DS - FPS"); @@ -261,11 +260,7 @@ void display_stats() gRecentFrameCount = 0; gRecentFPSTime.reset(); } - // gSavedSettings replacement - //F32 mem_log_freq = gSavedSettings.getF32("MemoryLogFrequency"); - static LLCachedControl memoryLogFrequency(gSavedSettings, "MemoryLogFrequency"); - F32 mem_log_freq = (F32)memoryLogFrequency; - // + static LLCachedControl mem_log_freq(gSavedSettings, "MemoryLogFrequency", 600.f); if (mem_log_freq > 0.f && gRecentMemoryTime.getElapsedTimeF32() >= mem_log_freq) { LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("DS - Memory"); @@ -275,7 +270,7 @@ void display_stats() LLMemory::logMemoryInfo(true) ; gRecentMemoryTime.reset(); } - const F32 ASSET_STORAGE_LOG_FREQUENCY = 60.f; + constexpr F32 ASSET_STORAGE_LOG_FREQUENCY = 60.f; if (gAssetStorageLogTime.getElapsedTimeF32() >= ASSET_STORAGE_LOG_FREQUENCY) { LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("DS - Asset Storage"); @@ -623,21 +618,15 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot) LLImageGL::updateStats(gFrameTimeSeconds); + static LLCachedControl avatar_name_tag_mode(gSavedSettings, "AvatarNameTagMode", 1); + static LLCachedControl name_tag_show_group_titles(gSavedSettings, "NameTagShowGroupTitles", true); // Aurora sim - //LLVOAvatar::sRenderName = gSavedSettings.getS32("AvatarNameTagMode"); - static LLCachedControl avatarNameTagMode(gSavedSettings, "AvatarNameTagMode"); - S32 RenderName = (S32)avatarNameTagMode; - - if(RenderName > LLWorld::getInstance()->getAllowRenderName())//The most restricted gets set here - RenderName = LLWorld::getInstance()->getAllowRenderName(); - LLVOAvatar::sRenderName = RenderName; + //LLVOAvatar::sRenderName = avatar_name_tag_mode; + //LLVOAvatar::sRenderGroupTitles = name_tag_show_group_titles && avatar_name_tag_mode > 0; + auto& world_instance = LLWorld::instance(); + LLVOAvatar::sRenderName = avatar_name_tag_mode > world_instance.getAllowRenderName() ? world_instance.getAllowRenderName() : avatar_name_tag_mode; // Aurora sim - - // gSavedSettings replacement - //LLVOAvatar::sRenderGroupTitles = (gSavedSettings.getBOOL("NameTagShowGroupTitles") && gSavedSettings.getS32("AvatarNameTagMode")); - static LLCachedControl nameTagShowGroupTitles(gSavedSettings, "NameTagShowGroupTitles"); - LLVOAvatar::sRenderGroupTitles = (nameTagShowGroupTitles && LLVOAvatar::sRenderName); - // + LLVOAvatar::sRenderGroupTitles = name_tag_show_group_titles && LLVOAvatar::sRenderName > 0; gPipeline.mBackfaceCull = true; gFrameCount++; @@ -899,7 +888,7 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot) } gGL.setColorMask(true, true); - glClearColor(0,0,0,0); + glClearColor(0.f, 0.f, 0.f, 0.f); LLGLState::checkStates(); @@ -1073,7 +1062,7 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot) gPipeline.mRT->deferredScreen.bindTarget(); if (gUseWireframe) { - F32 g = 0.5f; + constexpr F32 g = 0.5f; glClearColor(g, g, g, 1.f); } else @@ -1092,15 +1081,12 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot) LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 5") LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; - // gSavedSettings replacement - //if (gSavedSettings.getBOOL("RenderDepthPrePass")) - static LLCachedControl renderDepthPrePass(gSavedSettings, "RenderDepthPrePass"); - if (renderDepthPrePass) - // + static LLCachedControl render_depth_pre_pass(gSavedSettings, "RenderDepthPrePass", false); + if (render_depth_pre_pass) { gGL.setColorMask(false, false); - static const U32 types[] = { + constexpr U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_FULLBRIGHT, LLRenderPass::PASS_SHINY @@ -1315,7 +1301,7 @@ void display_cube_face() gGL.setColorMask(true, true); - glClearColor(0, 0, 0, 0); + glClearColor(0.f, 0.f, 0.f, 0.f); gPipeline.generateSunShadow(*LLViewerCamera::getInstance()); glClear(GL_DEPTH_BUFFER_BIT); // | GL_STENCIL_BUFFER_BIT); @@ -1351,7 +1337,7 @@ void display_cube_face() } else { - glClearColor(1, 0, 1, 1); + glClearColor(1.f, 0.f, 1.f, 1.f); } gPipeline.mRT->deferredScreen.clear(); @@ -1396,15 +1382,12 @@ void render_hud_attachments() { LLPipeline::sRenderingHUDs = true; LLCamera hud_cam = *LLViewerCamera::getInstance(); - hud_cam.setOrigin(-1.f,0,0); - hud_cam.setAxes(LLVector3(1,0,0), LLVector3(0,1,0), LLVector3(0,0,1)); + hud_cam.setOrigin(-1.f, 0.f, 0.f); + hud_cam.setAxes(LLVector3(1.f, 0.f, 0.f), LLVector3(0.f, 1.f, 0.f), LLVector3(0.f, 0.f, 1.f)); LLViewerCamera::updateFrustumPlanes(hud_cam, true); - // gSavedSettings replacement - //bool render_particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) && gSavedSettings.getBOOL("RenderHUDParticles"); - static LLCachedControl renderHUDParticles(gSavedSettings, "RenderHUDParticles"); - bool render_particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) && renderHUDParticles; - // + static LLCachedControl render_hud_particles(gSavedSettings, "RenderHUDParticles", false); + bool render_particles = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES) && render_hud_particles; //only render hud objects gPipeline.pushRenderTypeMask(); @@ -1785,14 +1768,11 @@ void render_ui_3d() stop_glerror(); gUIProgram.bind(); - gGL.color4f(1, 1, 1, 1); + gGL.color4f(1.f, 1.f, 1.f, 1.f); // Coordinate axes - // gSavedSettings replacement - //if (gSavedSettings.getBOOL("ShowAxes")) - static LLCachedControl showAxes(gSavedSettings, "ShowAxes"); - if (showAxes) - // + static LLCachedControl show_axes(gSavedSettings, "ShowAxes"); + if (show_axes()) { draw_axes(); } @@ -1857,9 +1837,7 @@ void render_ui_2d() gGL.pushMatrix(); S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2); S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2); - // Factor out instance() call - //gGL.scalef(LLUI::getScaleFactor().mV[0], LLUI::getScaleFactor().mV[1], 1.f); - gGL.scalef(ui_scale_factor.mV[0], ui_scale_factor.mV[1], 1.f); + gGL.scalef(LLUI::getScaleFactor().mV[VX], LLUI::getScaleFactor().mV[VY], 1.f); gGL.translatef((F32)half_width, (F32)half_height, 0.f); F32 zoom = gAgentCamera.mHUDCurZoom; gGL.scalef(zoom,zoom,1.f); @@ -1881,7 +1859,7 @@ void render_ui_2d() gPipeline.mUIScreen.bindTarget(); gGL.setColorMask(true, true); { - static const S32 pad = 8; + constexpr S32 pad = 8; LLView::sDirtyRect.mLeft -= pad; LLView::sDirtyRect.mRight += pad; @@ -1939,8 +1917,6 @@ void render_ui_2d() gViewerWindow->draw(); } - - // reset current origin for font rendering, in case of tiling render LLFontGL::sCurOrigin.set(0, 0); } @@ -1949,7 +1925,7 @@ void render_disconnected_background() { gUIProgram.bind(); - gGL.color4f(1,1,1,1); + gGL.color4f(1.f, 1.f, 1.f, 1.f); if (!gDisconnectedImagep && gDisconnected) { LL_INFOS() << "Loading last bitmap..." << LL_ENDL; @@ -1989,7 +1965,7 @@ void render_disconnected_background() raw->expandToPowerOfTwo(); - gDisconnectedImagep = LLViewerTextureManager::getLocalTexture(raw.get(), false ); + gDisconnectedImagep = LLViewerTextureManager::getLocalTexture(raw.get(), false); gStartTexture = gDisconnectedImagep; gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } @@ -2024,6 +2000,5 @@ void render_disconnected_background() void display_cleanup() { - gDisconnectedImagep = NULL; + gDisconnectedImagep = nullptr; } - diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 49abf74f40..8a7075a2a9 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -33,6 +33,7 @@ #include "llfloaterreg.h" #include "llgl.h" #include "llrender.h" +#include "lluicolor.h" #include "v4color.h" #include "v2math.h" @@ -50,8 +51,8 @@ #include "pipeline.h" -static const U8 OVERLAY_IMG_COMPONENTS = 4; -static const F32 LINE_WIDTH = 0.0625f; +static constexpr U8 OVERLAY_IMG_COMPONENTS = 4; +static constexpr F32 LINE_WIDTH = 0.0625f; bool LLViewerParcelOverlay::sColorSetInitialized = false; LLUIColor LLViewerParcelOverlay::sAvailColor; @@ -98,7 +99,7 @@ LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_ // Initialize the GL texture with empty data. // // Create the base texture. - U8 *raw = mImageRaw->getData(); + U8* raw = mImageRaw->getData(); const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge * OVERLAY_IMG_COMPONENTS; for (S32 i = 0; i < COUNT; i++) { @@ -165,10 +166,10 @@ bool LLViewerParcelOverlay::encroachesOwned(const std::vector& boxes) co LLVector3 min = boxes[i].getMinAgent(); LLVector3 max = boxes[i].getMaxAgent(); - S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); - S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); - S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); - S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); + S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1.f)); + S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1.f)); + S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1.f)); + S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1.f)); for (S32 row = top; row <= bottom; row++) { @@ -193,10 +194,10 @@ bool LLViewerParcelOverlay::encroachesOnUnowned(const std::vector& boxes LLVector3 min = boxes[i].getMinAgent(); LLVector3 max = boxes[i].getMaxAgent(); - S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); - S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); - S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); - S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); + S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1.f)); + S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1.f)); + S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1.f)); + S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1.f)); for (S32 row = top; row <= bottom; row++) { @@ -230,10 +231,10 @@ bool LLViewerParcelOverlay::encroachesOnNearbyParcel(const std::vector& return true; } - S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); - S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); - S32 bottom = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); - S32 top = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); + S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1.f)); + S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1.f)); + S32 bottom = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1.f)); + S32 top = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1.f)); const S32 GRIDS_PER_EDGE = mParcelGridsPerEdge; @@ -355,11 +356,11 @@ void LLViewerParcelOverlay::updateOverlayTexture() const LLColor4U auction = sAuctionColor.get(); // Create the base texture. - U8 *raw = mImageRaw->getData(); + U8* raw = mImageRaw->getData(); const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge; S32 max = mOverlayTextureIdx + mParcelGridsPerEdge; if (max > COUNT) max = COUNT; - S32 pixel_index = mOverlayTextureIdx*OVERLAY_IMG_COMPONENTS; + S32 pixel_index = mOverlayTextureIdx * OVERLAY_IMG_COMPONENTS; S32 i; for (i = mOverlayTextureIdx; i < max; i++) { @@ -368,7 +369,7 @@ void LLViewerParcelOverlay::updateOverlayTexture() U8 r,g,b,a; // Color stored in low three bits - switch( ownership & 0x7 ) + switch (ownership & 0x7) { case PARCEL_PUBLIC: r = avail.mV[VRED]; @@ -414,10 +415,10 @@ void LLViewerParcelOverlay::updateOverlayTexture() break; } - raw[pixel_index + 0] = (U8)r; - raw[pixel_index + 1] = (U8)g; - raw[pixel_index + 2] = (U8)b; - raw[pixel_index + 3] = (U8)a; + raw[pixel_index + VRED] = (U8)r; + raw[pixel_index + VGREEN] = (U8)g; + raw[pixel_index + VBLUE] = (U8)b; + raw[pixel_index + VALPHA] = (U8)a; pixel_index += OVERLAY_IMG_COMPONENTS; } @@ -438,11 +439,10 @@ void LLViewerParcelOverlay::updateOverlayTexture() } } - -void LLViewerParcelOverlay::uncompressLandOverlay(S32 chunk, U8 *packed_overlay) +void LLViewerParcelOverlay::uncompressLandOverlay(S32 chunk, U8* packed_overlay) { // Unpack the message data into the ownership array - S32 size = mParcelGridsPerEdge * mParcelGridsPerEdge; + S32 size = mParcelGridsPerEdge * mParcelGridsPerEdge; // Aurora Sim //S32 chunk_size = size / PARCEL_OVERLAY_CHUNKS; @@ -472,7 +472,7 @@ void LLViewerParcelOverlay::updatePropertyLines() mEdges.clear(); - const F32 GRID_STEP = PARCEL_GRID_STEP_METERS; + constexpr F32 GRID_STEP = PARCEL_GRID_STEP_METERS; const S32 GRIDS_PER_EDGE = mParcelGridsPerEdge; for (S32 row = 0; row < GRIDS_PER_EDGE; row++) @@ -549,16 +549,16 @@ void LLViewerParcelOverlay::addPropertyLine(F32 start_x, F32 start_y, F32 dx, F3 auto split = [&](const LLVector3& start, F32 x, F32 y, F32 z, F32 part) { - F32 new_x = start.mV[0] + (x - start.mV[0]) * part; - F32 new_y = start.mV[1] + (y - start.mV[1]) * part; - F32 new_z = start.mV[2] + (z - start.mV[2]) * part; + F32 new_x = start.mV[VX] + (x - start.mV[VX]) * part; + F32 new_y = start.mV[VY] + (y - start.mV[VY]) * part; + F32 new_z = start.mV[VZ] + (z - start.mV[VZ]) * part; edge.vertices.emplace_back(new_x, new_y, new_z); }; auto checkForSplit = [&]() { const LLVector3& last_outside = edge.vertices.back(); - F32 z0 = last_outside.mV[2]; + F32 z0 = last_outside.mV[VZ]; F32 z1 = outside_z; if ((z0 >= water_z && z1 >= water_z) || (z0 < water_z && z1 < water_z)) return; @@ -593,7 +593,7 @@ void LLViewerParcelOverlay::addPropertyLine(F32 start_x, F32 start_y, F32 dx, F3 outside_y += dy * (dy - LINE_WIDTH); // Middle part, full width - const S32 GRID_STEP = (S32)PARCEL_GRID_STEP_METERS; + constexpr S32 GRID_STEP = (S32)PARCEL_GRID_STEP_METERS; for (S32 i = 1; i < GRID_STEP; i++) { inside_z = land.resolveHeightRegion( inside_x, inside_y ); @@ -727,7 +727,7 @@ void LLViewerParcelOverlay::renderPropertyLines() bool render_hidden = LLSelectMgr::sRenderHiddenSelections && LLFloaterReg::instanceVisible("build"); - const F32 PROPERTY_LINE_CLIP_DIST_SQUARED = 256.f * 256.f; + constexpr F32 PROPERTY_LINE_CLIP_DIST_SQUARED = 256.f * 256.f; for (const Edge& edge : mEdges) { @@ -760,7 +760,7 @@ void LLViewerParcelOverlay::renderPropertyLines() else { LLVector3 visible = vertex; - visible.mV[2] = water_z; + visible.mV[VZ] = water_z; gGL.vertex3fv(visible.mV); } } @@ -774,7 +774,7 @@ void LLViewerParcelOverlay::renderPropertyLines() gGL.begin(LLRender::TRIANGLE_STRIP); LLColor4U color = edge.color; - color.mV[3] /= 4; + color.mV[VALPHA] /= 4; gGL.color4ubv(color.mV); for (const LLVector3& vertex : edge.vertices) @@ -808,7 +808,7 @@ void grid_2d_part_lines(const F32 left, const F32 top, const F32 right, const F3 gGL.end(); } -void LLViewerParcelOverlay::renderPropertyLinesOnMinimap(F32 scale_pixels_per_meter, const F32 *parcel_outline_color) +void LLViewerParcelOverlay::renderPropertyLinesOnMinimap(F32 scale_pixels_per_meter, const F32* parcel_outline_color) { static LLCachedControl show(gSavedSettings, "MiniMapShowPropertyLines"); @@ -819,8 +819,8 @@ void LLViewerParcelOverlay::renderPropertyLinesOnMinimap(F32 scale_pixels_per_me LLVector3 origin_agent = mRegion->getOriginAgent(); LLVector3 rel_region_pos = origin_agent - gAgentCamera.getCameraPositionAgent(); - F32 region_left = rel_region_pos.mV[0] * scale_pixels_per_meter; - F32 region_bottom = rel_region_pos.mV[1] * scale_pixels_per_meter; + F32 region_left = rel_region_pos.mV[VX] * scale_pixels_per_meter; + F32 region_bottom = rel_region_pos.mV[VY] * scale_pixels_per_meter; F32 map_parcel_width = PARCEL_GRID_STEP_METERS * scale_pixels_per_meter; const S32 GRIDS_PER_EDGE = mParcelGridsPerEdge; diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index bb2eeda51a..bee79d42de 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -34,12 +34,11 @@ #include "llframetimer.h" #include "lluuid.h" #include "llviewertexture.h" -#include "llgl.h" -#include "lluicolor.h" class LLViewerRegion; class LLVector3; class LLColor4U; +class LLUIColor; class LLVector2; class LLViewerParcelOverlay : public LLGLUpdate @@ -65,7 +64,6 @@ public: bool isSoundLocal(const LLVector3& pos) const; - bool isBuildCameraAllowed(const LLVector3& pos) const; F32 getOwnedRatio() const; // [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3) const U8* getOwnership() const { return mOwnership; } @@ -75,12 +73,12 @@ public: void renderPropertyLines(); void renderPropertyLinesOnMinimap(F32 scale_pixels_per_meter, const F32* parcel_outline_color); - U8 ownership( const LLVector3& pos) const; - U8 parcelLineFlags( const LLVector3& pos) const; + U8 ownership(const LLVector3& pos) const; + U8 parcelLineFlags(const LLVector3& pos) const; U8 parcelLineFlags(S32 row, S32 col) const; // MANIPULATE - void uncompressLandOverlay(S32 chunk, U8 *compressed_overlay); + void uncompressLandOverlay(S32 chunk, U8* compressed_overlay); // Indicate property lines and overlay texture need to be rebuilt. void setDirty(); @@ -96,8 +94,7 @@ public: private: // This is in parcel rows and columns, not grid rows and columns // Stored in bottom three bits. - U8 ownership(S32 row, S32 col) const - { return parcelFlags(row, col, (U8)0x7); } + U8 ownership(S32 row, S32 col) const { return parcelFlags(row, col, (U8)0x7); } U8 parcelFlags(S32 row, S32 col, U8 flags) const; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d2e8826e10..0fdee5ca53 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -38,7 +38,6 @@ #include "llregionhandle.h" #include "llsurface.h" #include "message.h" -//#include "vmath.h" #include "v3math.h" #include "v4math.h" diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 135bbe14ed..f51b40ba56 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7267,39 +7267,33 @@ const LLUUID& LLVOAvatar::getID() const // getJoint() //----------------------------------------------------------------------------- // RN: avatar joints are multi-rooted to include screen-based attachments -// Joint-lookup improvements -//LLJoint *LLVOAvatar::getJoint(const std::string &name) -LLJoint *LLVOAvatar::getJoint(std::string_view name) +LLJoint* LLVOAvatar::getJoint(std::string_view name) { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; // Joint-lookup improvements //joint_map_t::iterator iter = mJointMap.find( name ); joint_map_t::iterator iter = mJointMap.find(name.data()); - LLJoint* jointp = NULL; + LLJoint* jointp = nullptr; - if( iter == mJointMap.end() || iter->second == NULL ) - { //search for joint and cache found joint in lookup table - if (mJointAliasMap.empty()) - { - getJointAliases(); - } - // Joint-lookup improvements - //joint_alias_map_t::const_iterator alias_iter = mJointAliasMap.find(name); - joint_alias_map_t::const_iterator alias_iter = mJointAliasMap.find(std::string(name)); - std::string canonical_name; - if (alias_iter != mJointAliasMap.end()) - { - canonical_name = alias_iter->second; - } - else - { - canonical_name = name; - } - jointp = mRoot->findJoint(canonical_name); - // Joint-lookup improvements - //mJointMap[name] = jointp; - mJointMap[std::string(name)] = jointp; + if (iter == mJointMap.end() || iter->second == nullptr) + { //search for joint and cache found joint in lookup table + if (mJointAliasMap.empty()) + { + getJointAliases(); + } + joint_alias_map_t::const_iterator alias_iter = mJointAliasMap.find(name); + std::string canonical_name; + if (alias_iter != mJointAliasMap.end()) + { + canonical_name = alias_iter->second; + } + else + { + canonical_name = name; + } + jointp = mRoot->findJoint(canonical_name); + mJointMap[std::string(name)] = jointp; } else { //return cached pointer diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 4cb80380fb..bbbd51eff4 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -204,8 +204,6 @@ public: void startDefaultMotions(); void dumpAnimationState(); - // Joint-lookup improvements - //virtual LLJoint* getJoint(const std::string &name); virtual LLJoint* getJoint(std::string_view name); LLJoint* getJoint(S32 num); void initAllJoints(); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 9dae1846ca..68ca411af0 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1029,22 +1029,18 @@ void LLVOAvatarSelf::idleUpdate(LLAgent &agent, const F64 &time) } // virtual -// Joint-lookup improvements -//LLJoint *LLVOAvatarSelf::getJoint(const std::string &name) LLJoint* LLVOAvatarSelf::getJoint(std::string_view name) { std::lock_guard lock(mJointMapMutex); - LLJoint *jointp = NULL; + LLJoint* jointp = nullptr; jointp = LLVOAvatar::getJoint(name); if (!jointp && mScreenp) { jointp = mScreenp->findJoint(name); if (jointp) { - // Joint-lookup improvements - //mJointMap[name] = jointp; mJointMap[std::string(name)] = jointp; - } + } } if (jointp && jointp != mScreenp && jointp != mRoot) { diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 688891eb68..be35df4bc0 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -90,9 +90,6 @@ public: /*virtual*/ bool hasMotionFromSource(const LLUUID& source_id); /*virtual*/ void stopMotionFromSource(const LLUUID& source_id); /*virtual*/ void requestStopMotion(LLMotion* motion); - - // Joint-lookup improvements -// /*virtual*/ LLJoint* getJoint(const std::string &name); /*virtual*/ LLJoint* getJoint(std::string_view name); /*virtual*/ void renderJoints(); diff --git a/indra/newview/llwatchdog.cpp b/indra/newview/llwatchdog.cpp index bcd101667a..c384576621 100644 --- a/indra/newview/llwatchdog.cpp +++ b/indra/newview/llwatchdog.cpp @@ -29,7 +29,7 @@ #include "llwatchdog.h" #include "llthread.h" -const U32 WATCHDOG_SLEEP_TIME_USEC = 1000000; +constexpr U32 WATCHDOG_SLEEP_TIME_USEC = 1000000U; // This class runs the watchdog timing thread. class LLWatchdogTimerThread : public LLThread @@ -51,7 +51,7 @@ public: mSleepMsecs = 1; } - /* virtual */ void run() + void run() override { while(!mStopping) { @@ -83,7 +83,7 @@ void LLWatchdogEntry::start() void LLWatchdogEntry::stop() { // this can happen very late in the shutdown sequence - if (! LLWatchdog::wasDeleted()) + if (!LLWatchdog::wasDeleted()) { LLWatchdog::getInstance()->remove(this); } @@ -118,10 +118,7 @@ void LLWatchdogTimeout::setTimeout(F32 d) mTimeout = d; } -// Change from std::string to char const*, saving a lot of object construction/destruction per frame -// void LLWatchdogTimeout::start(const std::string& state) -void LLWatchdogTimeout::start(const char *state) -// +void LLWatchdogTimeout::start(std::string_view state) { if (mTimeout == 0) { @@ -143,12 +140,9 @@ void LLWatchdogTimeout::stop() mTimer.stop(); } -// Change from std::string to char const*, saving a lot of object construction/destruction per frame -// void LLWatchdogTimeout::ping(const std::string& state) -void LLWatchdogTimeout::ping(const char *state) -// +void LLWatchdogTimeout::ping(std::string_view state) { - if(state) + if (!state.empty()) { mPingState = state; } @@ -158,7 +152,7 @@ void LLWatchdogTimeout::ping(const char *state) // LLWatchdog LLWatchdog::LLWatchdog() :mSuspectsAccessMutex() - ,mTimer(NULL) + ,mTimer(nullptr) ,mLastClockCount(0) { } @@ -183,7 +177,7 @@ void LLWatchdog::remove(LLWatchdogEntry* e) void LLWatchdog::init() { - if(!mSuspectsAccessMutex && !mTimer) + if (!mSuspectsAccessMutex && !mTimer) { mSuspectsAccessMutex = new LLMutex(); mTimer = new LLWatchdogTimerThread(); @@ -198,17 +192,17 @@ void LLWatchdog::init() void LLWatchdog::cleanup() { - if(mTimer) + if (mTimer) { mTimer->stop(); delete mTimer; - mTimer = NULL; + mTimer = nullptr; } - if(mSuspectsAccessMutex) + if (mSuspectsAccessMutex) { delete mSuspectsAccessMutex; - mSuspectsAccessMutex = NULL; + mSuspectsAccessMutex = nullptr; } mLastClockCount = 0; @@ -221,12 +215,12 @@ void LLWatchdog::run() // Check the time since the last call to run... // If the time elapsed is two times greater than the regualr sleep time // reset the active timeouts. - const U32 TIME_ELAPSED_MULTIPLIER = 2; + constexpr U32 TIME_ELAPSED_MULTIPLIER = 2; U64 current_time = LLTimer::getTotalTime(); U64 current_run_delta = current_time - mLastClockCount; mLastClockCount = current_time; - if(current_run_delta > (WATCHDOG_SLEEP_TIME_USEC * TIME_ELAPSED_MULTIPLIER)) + if (current_run_delta > (WATCHDOG_SLEEP_TIME_USEC * TIME_ELAPSED_MULTIPLIER)) { LL_INFOS() << "Watchdog thread delayed: resetting entries." << LL_ENDL; for (const auto& suspect : mSuspects) @@ -240,7 +234,7 @@ void LLWatchdog::run() std::find_if(mSuspects.begin(), mSuspects.end(), [](const LLWatchdogEntry* suspect){ return ! suspect->isAlive(); }); - if(result != mSuspects.end()) + if (result != mSuspects.end()) { // error!!! if(mTimer) @@ -258,7 +252,7 @@ void LLWatchdog::run() void LLWatchdog::lockThread() { - if(mSuspectsAccessMutex != NULL) + if (mSuspectsAccessMutex) { mSuspectsAccessMutex->lock(); } @@ -266,7 +260,7 @@ void LLWatchdog::lockThread() void LLWatchdog::unlockThread() { - if(mSuspectsAccessMutex != NULL) + if (mSuspectsAccessMutex) { mSuspectsAccessMutex->unlock(); } diff --git a/indra/newview/llwatchdog.h b/indra/newview/llwatchdog.h index 054421194f..1931c582b0 100644 --- a/indra/newview/llwatchdog.h +++ b/indra/newview/llwatchdog.h @@ -56,35 +56,20 @@ public: LLWatchdogTimeout(); virtual ~LLWatchdogTimeout(); - /* virtual */ bool isAlive() const; - /* virtual */ void reset(); - /* virtual */ void start() { start(""); } - /* virtual */ void stop(); + bool isAlive() const override; + void reset() override; + void start() override { start(""); } + void stop() override; - // Change from std::string to char const*, saving a lot of object construction/destruction per frame - - // void start(const std::string& state); - // void setTimeout(F32 d); - // void ping(const std::string& state); - // const std::string& getState() {return mPingState; } - - void start( char const *state); + void start(std::string_view state); void setTimeout(F32 d); - void ping( char const *state ); - std::string getState() {return mPingState; } - - // + void ping(std::string_view state); + const std::string& getState() {return mPingState; } private: LLTimer mTimer; F32 mTimeout; - - // Change from std::string to char const*, saving a lot of object construction/destruction per frame - - // std::string mPingState; - char const *mPingState; - - // + std::string mPingState; }; class LLWatchdogTimerThread; // Defined in the cpp diff --git a/indra/newview/skins/default/xui/de/panel_tools_texture.xml b/indra/newview/skins/default/xui/de/panel_tools_texture.xml index b89e45574c..71084f0283 100644 --- a/indra/newview/skins/default/xui/de/panel_tools_texture.xml +++ b/indra/newview/skins/default/xui/de/panel_tools_texture.xml @@ -29,13 +29,10 @@ Leuchten - + + + getJointAliases(); @@ -483,7 +483,7 @@ JointMap loadJointMap() extra_names.insert(extra_names.end(), more_extra_names.begin(), more_extra_names.end()); // add the extras to jointmap - for (auto extra_name : extra_names) + for (const auto& extra_name : extra_names) { joint_map[extra_name] = extra_name; } @@ -1067,7 +1067,7 @@ bool LLLocalMeshImportDAE::processSkin(daeDatabase* collada_db, daeElement* coll return true; } -bool LLLocalMeshImportDAE::processSkeletonJoint(domNode* current_node, std::map& joint_map, std::map& joint_transforms, bool recurse_children) +bool LLLocalMeshImportDAE::processSkeletonJoint(domNode* current_node, std::map>& joint_map, std::map& joint_transforms, bool recurse_children) { // safety checks & name check const auto node_name = current_node->getName(); diff --git a/indra/newview/vjlocalmeshimportdae.h b/indra/newview/vjlocalmeshimportdae.h index 87582f4201..fb6b021e43 100644 --- a/indra/newview/vjlocalmeshimportdae.h +++ b/indra/newview/vjlocalmeshimportdae.h @@ -71,7 +71,7 @@ public: loadFile_return loadFile(LLLocalMeshFile* data, LLLocalMeshFileLOD lod); bool processObject(domMesh* current_mesh, LLLocalMeshObject* current_object); bool processSkin(daeDatabase* collada_db, daeElement* collada_document_root, domMesh* current_mesh, domSkin* current_skin, std::unique_ptr& current_object); - bool processSkeletonJoint(domNode* current_node, std::map& joint_map, std::map& joint_transforms, bool recurse_children=false); + bool processSkeletonJoint(domNode* current_node, std::map>& joint_map, std::map& joint_transforms, bool recurse_children=false); bool readMesh_CommonElements(const domInputLocalOffset_Array& inputs, int& offset_position, int& offset_normals, int& offset_uvmap, int& index_stride,