diff options
Diffstat (limited to 'indra')
194 files changed, 4848 insertions, 1814 deletions
diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index 6143ec8cd1..0b9b148463 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -119,6 +119,8 @@ public: virtual void addDebugText( const std::string& text ) = 0; + virtual std::string getDebugName() const { return getID().asString(); } + virtual const LLUUID& getID() const = 0; //------------------------------------------------------------------------- // End Interface diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index 5f51f40232..4ff56ae8c8 100644 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -79,6 +79,15 @@ std::string LLDate::asRFC1123() const return toHTTPDateString (std::string ("%A, %d %b %Y %H:%M:%S GMT")); } +std::string LLDate::toLocalDateString (std::string fmt) const +{ + LL_PROFILE_ZONE_SCOPED; + + time_t locSeconds = (time_t) mSecondsSinceEpoch; + struct tm * lt = localtime (&locSeconds); + return toHTTPDateString(lt, fmt); +} + std::string LLDate::toHTTPDateString (std::string fmt) const { LL_PROFILE_ZONE_SCOPED; diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h index 0afe0b0599..534b660689 100644 --- a/indra/llcommon/lldate.h +++ b/indra/llcommon/lldate.h @@ -79,6 +79,7 @@ public: std::string asRFC1123() const; void toStream(std::ostream&) const; bool split(S32 *year, S32 *month = NULL, S32 *day = NULL, S32 *hour = NULL, S32 *min = NULL, S32 *sec = NULL) const; + std::string toLocalDateString (std::string fmt) const; std::string toHTTPDateString (std::string fmt) const; static std::string toHTTPDateString (tm * gmt, std::string fmt); /** diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index 51b1b967f1..0264cf792b 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -638,6 +638,14 @@ public: { getCPUIDInfo(); uint64_t frequency = getSysctlInt64("hw.cpufrequency"); + if (!frequency) + { + auto tbfrequency = getSysctlInt64("hw.tbfrequency"); + struct clockinfo clockrate; + auto clockrate_len = sizeof(clockrate); + if (!sysctlbyname("kern.clockrate", &clockrate, &clockrate_len, NULL, 0)) + frequency = tbfrequency * clockrate.hz; + } setInfo(eFrequency, (F64)frequency / (F64)1000000); } diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 082d8b2f9f..16c112d411 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -46,6 +46,7 @@ static const std::string INV_ITEM_ID_LABEL("item_id"); static const std::string INV_FOLDER_ID_LABEL("cat_id"); static const std::string INV_PARENT_ID_LABEL("parent_id"); static const std::string INV_THUMBNAIL_LABEL("thumbnail"); +static const std::string INV_FAVORITE_LABEL("favorite"); static const std::string INV_THUMBNAIL_ID_LABEL("thumbnail_id"); static const std::string INV_ASSET_TYPE_LABEL("type"); static const std::string INV_PREFERRED_TYPE_LABEL("preferred_type"); @@ -59,6 +60,7 @@ static const std::string INV_LINKED_ID_LABEL("linked_id"); static const std::string INV_SALE_INFO_LABEL("sale_info"); static const std::string INV_FLAGS_LABEL("flags"); static const std::string INV_CREATION_DATE_LABEL("created_at"); +static const std::string INV_TOGGLED_LABEL("toggled"); // key used by agent-inventory-service static const std::string INV_ASSET_TYPE_LABEL_WS("type_default"); @@ -82,14 +84,16 @@ LLInventoryObject::LLInventoryObject(const LLUUID& uuid, mParentUUID(parent_uuid), mType(type), mName(name), - mCreationDate(0) + mCreationDate(0), + mFavorite(false) { correctInventoryName(mName); } LLInventoryObject::LLInventoryObject() : mType(LLAssetType::AT_NONE), - mCreationDate(0) + mCreationDate(0), + mFavorite(false) { } @@ -104,6 +108,7 @@ void LLInventoryObject::copyObject(const LLInventoryObject* other) mType = other->mType; mName = other->mName; mThumbnailUUID = other->mThumbnailUUID; + mFavorite = other->mFavorite; } const LLUUID& LLInventoryObject::getUUID() const @@ -121,6 +126,11 @@ const LLUUID& LLInventoryObject::getThumbnailUUID() const return mThumbnailUUID; } +bool LLInventoryObject::getIsFavorite() const +{ + return mFavorite; +} + const std::string& LLInventoryObject::getName() const { return mName; @@ -175,6 +185,11 @@ void LLInventoryObject::setThumbnailUUID(const LLUUID& thumbnail_uuid) mThumbnailUUID = thumbnail_uuid; } +void LLInventoryObject::setFavorite(bool favorite) +{ + mFavorite = favorite; +} + void LLInventoryObject::setType(LLAssetType::EType type) { mType = type; @@ -247,6 +262,23 @@ bool LLInventoryObject::importLegacyStream(std::istream& input_stream) { setThumbnailUUID(LLUUID::null); } + + if (metadata.has("favorite")) + { + const LLSD& favorite = metadata["favorite"]; + if (favorite.has("toggled")) + { + setFavorite(favorite["toggled"].asBoolean()); + } + else + { + setFavorite(false); + } + } + else + { + setFavorite(false); + } } else if(0 == strcmp("name", keyword)) { @@ -735,6 +767,23 @@ bool LLInventoryItem::importLegacyStream(std::istream& input_stream) { setThumbnailUUID(LLUUID::null); } + + if (metadata.has("favorite")) + { + const LLSD& favorite = metadata["favorite"]; + if (favorite.has("toggled")) + { + setFavorite(favorite["toggled"].asBoolean()); + } + else + { + setFavorite(false); + } + } + else + { + setFavorite(false); + } } else if(0 == strcmp("inv_type", keyword)) { @@ -895,6 +944,11 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); } + if (mFavorite) + { + sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); + } + U32 mask = mPermissions.getMaskBase(); if(((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) || (mAssetUUID.isNull())) @@ -937,6 +991,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) // TODO - figure out if this should be moved into the noclobber fields above mThumbnailUUID.setNull(); + mFavorite = false; // iterate as map to avoid making unnecessary temp copies of everything LLSD::map_const_iterator i, end; @@ -974,7 +1029,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) <integer> 1 </key> */ continue; - } + } if (i->first == INV_THUMBNAIL_ID_LABEL) { @@ -982,6 +1037,17 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) continue; } + if (i->first == INV_FAVORITE_LABEL) + { + const LLSD& favorite_map = i->second; + const std::string w = INV_TOGGLED_LABEL; + if (favorite_map.has(w)) + { + mFavorite = favorite_map[w].asBoolean(); + } + continue; + } + if (i->first == INV_PERMISSIONS_LABEL) { mPermissions = ll_permissions_from_sd(i->second); @@ -1177,6 +1243,11 @@ LLSD LLInventoryCategory::asLLSD() const sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); } + if (mFavorite) + { + sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); + } + return sd; } @@ -1188,11 +1259,17 @@ LLSD LLInventoryCategory::asAISCreateCatLLSD() const S8 type = static_cast<S8>(mPreferredType); sd[INV_ASSET_TYPE_LABEL_WS] = type; sd[INV_NAME_LABEL] = mName; + if (mThumbnailUUID.notNull()) { sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); } + if (mFavorite) + { + sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); + } + return sd; } @@ -1240,6 +1317,17 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd) mThumbnailUUID = sd[w]; } } + mFavorite = false; + w = INV_FAVORITE_LABEL; + if (sd.has(w)) + { + const LLSD& favorite_map = sd[w]; + w = INV_TOGGLED_LABEL; + if (favorite_map.has(w)) + { + mFavorite = favorite_map[w].asBoolean(); + } + } w = INV_ASSET_TYPE_LABEL; if (sd.has(w)) { @@ -1362,6 +1450,23 @@ bool LLInventoryCategory::importLegacyStream(std::istream& input_stream) { setThumbnailUUID(LLUUID::null); } + + if (metadata.has("favorite")) + { + const LLSD& favorite = metadata["favorite"]; + if (favorite.has("toggled")) + { + setFavorite(favorite["toggled"].asBoolean()); + } + else + { + setFavorite(false); + } + } + else + { + setFavorite(false); + } } else { @@ -1409,6 +1514,10 @@ LLSD LLInventoryCategory::exportLLSD() const { cat_data[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); } + if (mFavorite) + { + cat_data[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); + } return cat_data; } @@ -1441,6 +1550,16 @@ bool LLInventoryCategory::importLLSD(const LLSD& cat_data) } setThumbnailUUID(thumbnail_uuid); } + if (cat_data.has(INV_FAVORITE_LABEL)) + { + bool favorite = false; + const LLSD& favorite_data = cat_data[INV_FAVORITE_LABEL]; + if (favorite_data.has(INV_TOGGLED_LABEL)) + { + favorite = favorite_data[INV_TOGGLED_LABEL].asBoolean(); + } + setFavorite(favorite); + } if (cat_data.has(INV_NAME_LABEL)) { mName = cat_data[INV_NAME_LABEL].asString(); diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index e63f2deba7..2044b0102c 100644 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -71,6 +71,7 @@ public: virtual const LLUUID& getLinkedUUID() const; // inventoryID that this item points to, else this item's inventoryID const LLUUID& getParentUUID() const; virtual const LLUUID& getThumbnailUUID() const; + virtual bool getIsFavorite() const; virtual const std::string& getName() const; virtual LLAssetType::EType getType() const; LLAssetType::EType getActualType() const; // bypasses indirection for linked items @@ -86,6 +87,7 @@ public: virtual void rename(const std::string& new_name); void setParent(const LLUUID& new_parent); virtual void setThumbnailUUID(const LLUUID& thumbnail_uuid); + virtual void setFavorite(bool favorite); void setType(LLAssetType::EType type); virtual void setCreationDate(time_t creation_date_utc); // only stored for items @@ -111,6 +113,7 @@ protected: LLUUID mUUID; LLUUID mParentUUID; // Parent category. Root categories have LLUUID::NULL. LLUUID mThumbnailUUID; + bool mFavorite; LLAssetType::EType mType; std::string mName; time_t mCreationDate; // seconds from 1/1/1970, UTC diff --git a/indra/llmath/llcoordframe.cpp b/indra/llmath/llcoordframe.cpp index 15c9f6ff3f..f9ecea1a4a 100644 --- a/indra/llmath/llcoordframe.cpp +++ b/indra/llmath/llcoordframe.cpp @@ -328,28 +328,30 @@ void LLCoordFrame::rotate(const LLMatrix3 &rotation_matrix) } +// Rotate 2 normalized orthogonal vectors in direction from `source` to `target` +static void rotate2(LLVector3& source, LLVector3& target, F32 angle) +{ + F32 sx = source[VX], sy = source[VY], sz = source[VZ]; + F32 tx = target[VX], ty = target[VY], tz = target[VZ]; + F32 c = cos(angle), s = sin(angle); + + source.set(sx * c + tx * s, sy * c + ty * s, sz * c + tz * s); + target.set(tx * c - sx * s, ty * c - sy * s, tz * c - sz * s); +} + void LLCoordFrame::roll(F32 angle) { - LLQuaternion q(angle, mXAxis); - LLMatrix3 rotation_matrix(q); - rotate(rotation_matrix); - CHECK_FINITE_OBJ(); + rotate2(mYAxis, mZAxis, angle); } void LLCoordFrame::pitch(F32 angle) { - LLQuaternion q(angle, mYAxis); - LLMatrix3 rotation_matrix(q); - rotate(rotation_matrix); - CHECK_FINITE_OBJ(); + rotate2(mZAxis, mXAxis, angle); } void LLCoordFrame::yaw(F32 angle) { - LLQuaternion q(angle, mZAxis); - LLMatrix3 rotation_matrix(q); - rotate(rotation_matrix); - CHECK_FINITE_OBJ(); + rotate2(mXAxis, mYAxis, angle); } // get*() routines diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 0348dad8fe..f40c05997c 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -75,7 +75,7 @@ constexpr F32 DEG_TO_RAD = 0.017453292519943295769236907684886f; constexpr F32 RAD_TO_DEG = 57.295779513082320876798154814105f; constexpr F32 F_APPROXIMATELY_ZERO = 0.00001f; constexpr F32 F_LN10 = 2.3025850929940456840179914546844f; -constexpr F32 OO_LN10 = 0.43429448190325182765112891891661; +constexpr F32 OO_LN10 = 0.43429448190325182765112891891661f; constexpr F32 F_LN2 = 0.69314718056f; constexpr F32 OO_LN2 = 1.4426950408889634073599246810019f; diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp index 1ab3a73d79..3a6748bdb3 100644 --- a/indra/llmath/llquaternion.cpp +++ b/indra/llmath/llquaternion.cpp @@ -57,7 +57,7 @@ LLQuaternion::LLQuaternion(const LLMatrix3 &mat) LLQuaternion::LLQuaternion(F32 angle, const LLVector4 &vec) { - F32 mag = sqrtf(vec.mV[VX] * vec.mV[VX] + vec.mV[VY] * vec.mV[VY] + vec.mV[VZ] * vec.mV[VZ]); + F32 mag = vec.length(); if (mag > FP_MAG_THRESHOLD) { angle *= 0.5; @@ -76,7 +76,7 @@ LLQuaternion::LLQuaternion(F32 angle, const LLVector4 &vec) LLQuaternion::LLQuaternion(F32 angle, const LLVector3 &vec) { - F32 mag = sqrtf(vec.mV[VX] * vec.mV[VX] + vec.mV[VY] * vec.mV[VY] + vec.mV[VZ] * vec.mV[VZ]); + F32 mag = vec.length(); if (mag > FP_MAG_THRESHOLD) { angle *= 0.5; diff --git a/indra/llmath/v2math.cpp b/indra/llmath/v2math.cpp index 198fedcb03..9d16f1e654 100644 --- a/indra/llmath/v2math.cpp +++ b/indra/llmath/v2math.cpp @@ -66,7 +66,14 @@ F32 angle_between(const LLVector2& a, const LLVector2& b) return angle; } -bool are_parallel(const LLVector2& a, const LLVector2& b, F32 epsilon) +F32 signed_angle_between(const LLVector2& a, const LLVector2& b) +{ + F32 angle = angle_between(a, b); + F32 rhombus_square = a[VX] * b[VY] - b[VX] * a[VY]; + return rhombus_square < 0 ? -angle : angle; +} + +bool are_parallel(const LLVector2 &a, const LLVector2 &b, F32 epsilon) { LLVector2 an = a; LLVector2 bn = b; diff --git a/indra/llmath/v2math.h b/indra/llmath/v2math.h index a0ba3ec505..6f2136139a 100644 --- a/indra/llmath/v2math.h +++ b/indra/llmath/v2math.h @@ -107,13 +107,14 @@ class LLVector2 friend LLVector2 operator-(const LLVector2 &a); // Return vector -a - friend std::ostream& operator<<(std::ostream& s, const LLVector2 &a); // Stream a + friend std::ostream& operator<<(std::ostream& s, const LLVector2 &a); // Stream a }; // Non-member functions F32 angle_between(const LLVector2& a, const LLVector2& b); // Returns angle (radians) between a and b +F32 signed_angle_between(const LLVector2& a, const LLVector2& b); // Returns signed angle (radians) between a and b bool are_parallel(const LLVector2& a, const LLVector2& b, F32 epsilon = F_APPROXIMATELY_ZERO); // Returns true if a and b are very close to parallel F32 dist_vec(const LLVector2& a, const LLVector2& b); // Returns distance between a and b F32 dist_vec_squared(const LLVector2& a, const LLVector2& b);// Returns distance squared between a and b @@ -124,26 +125,22 @@ LLVector2 lerp(const LLVector2& a, const LLVector2& b, F32 u); // Returns a vect inline LLVector2::LLVector2() { - mV[VX] = 0.f; - mV[VY] = 0.f; + clear(); } inline LLVector2::LLVector2(F32 x, F32 y) { - mV[VX] = x; - mV[VY] = y; + set(x, y); } inline LLVector2::LLVector2(const F32 *vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; + set(vec); } inline LLVector2::LLVector2(const LLVector3 &vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; + set(vec.mV); } inline LLVector2::LLVector2(const LLSD &sd) @@ -155,28 +152,24 @@ inline LLVector2::LLVector2(const LLSD &sd) inline void LLVector2::clear() { - mV[VX] = 0.f; - mV[VY] = 0.f; + mV[VX] = mV[VY] = 0.f; } inline void LLVector2::setZero() { - mV[VX] = 0.f; - mV[VY] = 0.f; + clear(); } // deprecated inline void LLVector2::clearVec() { - mV[VX] = 0.f; - mV[VY] = 0.f; + clear(); } // deprecated inline void LLVector2::zeroVec() { - mV[VX] = 0.f; - mV[VY] = 0.f; + clear(); } inline void LLVector2::set(F32 x, F32 y) @@ -187,36 +180,31 @@ inline void LLVector2::set(F32 x, F32 y) inline void LLVector2::set(const LLVector2 &vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; + set(vec.mV); } inline void LLVector2::set(const F32 *vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; + set(vec[VX], vec[VY]); } // deprecated inline void LLVector2::setVec(F32 x, F32 y) { - mV[VX] = x; - mV[VY] = y; + set(x, y); } // deprecated inline void LLVector2::setVec(const LLVector2 &vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; + set(vec); } // deprecated inline void LLVector2::setVec(const F32 *vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; + set(vec); } @@ -224,7 +212,7 @@ inline void LLVector2::setVec(const F32 *vec) inline F32 LLVector2::length() const { - return sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY]); + return sqrt(lengthSquared()); } inline F32 LLVector2::lengthSquared() const @@ -234,61 +222,42 @@ inline F32 LLVector2::lengthSquared() const inline F32 LLVector2::normalize() { - F32 mag = sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY]); - F32 oomag; + F32 mag = length(); if (mag > FP_MAG_THRESHOLD) { - oomag = 1.f/mag; - mV[VX] *= oomag; - mV[VY] *= oomag; + *this /= mag; } else { - mV[VX] = 0.f; - mV[VY] = 0.f; + clear(); mag = 0; } - return (mag); + return mag; } // checker inline bool LLVector2::isFinite() const { - return (llfinite(mV[VX]) && llfinite(mV[VY])); + return llfinite(mV[VX]) && llfinite(mV[VY]); } // deprecated inline F32 LLVector2::magVec() const { - return sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY]); + return length(); } // deprecated inline F32 LLVector2::magVecSquared() const { - return mV[VX]*mV[VX] + mV[VY]*mV[VY]; + return lengthSquared(); } // deprecated inline F32 LLVector2::normVec() { - F32 mag = sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY]); - F32 oomag; - - if (mag > FP_MAG_THRESHOLD) - { - oomag = 1.f/mag; - mV[VX] *= oomag; - mV[VY] *= oomag; - } - else - { - mV[VX] = 0.f; - mV[VY] = 0.f; - mag = 0; - } - return (mag); + return normalize(); } inline const LLVector2& LLVector2::scaleVec(const LLVector2& vec) @@ -301,11 +270,7 @@ inline const LLVector2& LLVector2::scaleVec(const LLVector2& vec) inline bool LLVector2::isNull() const { - if ( F_APPROXIMATELY_ZERO > mV[VX]*mV[VX] + mV[VY]*mV[VY] ) - { - return true; - } - return false; + return F_APPROXIMATELY_ZERO > mV[VX]*mV[VX] + mV[VY]*mV[VY]; } @@ -339,7 +304,7 @@ inline LLVector2 operator-(const LLVector2& a, const LLVector2& b) inline F32 operator*(const LLVector2& a, const LLVector2& b) { - return (a.mV[VX]*b.mV[VX] + a.mV[VY]*b.mV[VY]); + return a.mV[VX]*b.mV[VX] + a.mV[VY]*b.mV[VY]; } inline LLVector2 operator%(const LLVector2& a, const LLVector2& b) @@ -405,10 +370,7 @@ inline const LLVector2& operator*=(LLVector2& a, F32 k) inline const LLVector2& operator/=(LLVector2& a, F32 k) { - F32 t = 1.f / k; - a.mV[VX] *= t; - a.mV[VY] *= t; - return a; + return a *= 1.f / k; } inline LLVector2 operator-(const LLVector2& a) diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index 53491533c2..c51c3bd316 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -100,24 +100,24 @@ class LLVector3 const LLVector3& setVec(const LLVector4 &vec); // deprecated const LLVector3& setVec(const LLVector3d &vec); // deprecated - F32 length() const; // Returns magnitude of LLVector3 - F32 lengthSquared() const; // Returns magnitude squared of LLVector3 - F32 magVec() const; // deprecated - F32 magVecSquared() const; // deprecated + F32 length() const; // Returns magnitude of LLVector3 + F32 lengthSquared() const; // Returns magnitude squared of LLVector3 + F32 magVec() const; // deprecated + F32 magVecSquared() const; // deprecated - inline F32 normalize(); // Normalizes and returns the magnitude of LLVector3 - inline F32 normVec(); // deprecated + inline F32 normalize(); // Normalizes and returns the magnitude of LLVector3 + inline F32 normVec(); // deprecated - inline bool inRange( F32 min, F32 max ) const; // Returns true if all values of the vector are between min and max + inline bool inRange(F32 min, F32 max) const; // Returns true if all values of the vector are between min and max - const LLVector3& rotVec(F32 angle, const LLVector3 &vec); // Rotates about vec by angle radians - const LLVector3& rotVec(F32 angle, F32 x, F32 y, F32 z); // Rotates about x,y,z by angle radians - const LLVector3& rotVec(const LLMatrix3 &mat); // Rotates by LLMatrix4 mat - const LLVector3& rotVec(const LLQuaternion &q); // Rotates by LLQuaternion q - const LLVector3& transVec(const LLMatrix4& mat); // Transforms by LLMatrix4 mat (mat * v) + const LLVector3& rotVec(F32 angle, const LLVector3 &vec); // Rotates about vec by angle radians + const LLVector3& rotVec(F32 angle, F32 x, F32 y, F32 z); // Rotates about x,y,z by angle radians + const LLVector3& rotVec(const LLMatrix3 &mat); // Rotates by LLMatrix4 mat + const LLVector3& rotVec(const LLQuaternion &q); // Rotates by LLQuaternion q + const LLVector3& transVec(const LLMatrix4& mat); // Transforms by LLMatrix4 mat (mat * v) - const LLVector3& scaleVec(const LLVector3& vec); // scales per component by vec - LLVector3 scaledVec(const LLVector3& vec) const; // get a copy of this vector scaled by vec + const LLVector3& scaleVec(const LLVector3& vec); // scales per component by vec + LLVector3 scaledVec(const LLVector3& vec) const; // get a copy of this vector scaled by vec bool isNull() const; // Returns true if vector has a _very_small_ length bool isExactlyZero() const { return !mV[VX] && !mV[VY] && !mV[VZ]; } @@ -171,23 +171,17 @@ bool box_valid_and_non_zero(const LLVector3* box); inline LLVector3::LLVector3() { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; + clear(); } inline LLVector3::LLVector3(const F32 x, const F32 y, const F32 z) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; + set(x, y, z); } inline LLVector3::LLVector3(const F32 *vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; - mV[VZ] = vec[VZ]; + set(vec); } /* @@ -204,7 +198,7 @@ inline LLVector3::LLVector3(const LLVector3 ©) // checker inline bool LLVector3::isFinite() const { - return (llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ])); + return llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ]); } @@ -212,30 +206,22 @@ inline bool LLVector3::isFinite() const inline void LLVector3::clear() { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; + set(0.f, 0.f, 0.f); } inline void LLVector3::setZero() { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; + clear(); } inline void LLVector3::clearVec() { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; + clear(); } inline void LLVector3::zeroVec() { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; + clear(); } inline void LLVector3::set(F32 x, F32 y, F32 z) @@ -247,107 +233,74 @@ inline void LLVector3::set(F32 x, F32 y, F32 z) inline void LLVector3::set(const LLVector3& vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; + set(vec.mV[VX], vec.mV[VY], vec.mV[VZ]); } inline void LLVector3::set(const F32* vec) { - mV[VX] = vec[0]; - mV[VY] = vec[1]; - mV[VZ] = vec[2]; + set(vec[0], vec[1], vec[2]); } // deprecated inline void LLVector3::setVec(F32 x, F32 y, F32 z) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; + set(x, y, z); } // deprecated inline void LLVector3::setVec(const LLVector3& vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; + set(vec); } // deprecated inline void LLVector3::setVec(const F32* vec) { - mV[VX] = vec[0]; - mV[VY] = vec[1]; - mV[VZ] = vec[2]; + set(vec); } inline F32 LLVector3::normalize() { F32 mag = (F32) sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); - F32 oomag; if (mag > FP_MAG_THRESHOLD) { - oomag = 1.f/mag; - mV[VX] *= oomag; - mV[VY] *= oomag; - mV[VZ] *= oomag; + *this /= mag; } else { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; + clear(); mag = 0; } - return (mag); + return mag; } // deprecated inline F32 LLVector3::normVec() { - F32 mag = sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); - F32 oomag; - - if (mag > FP_MAG_THRESHOLD) - { - oomag = 1.f/mag; - mV[VX] *= oomag; - mV[VY] *= oomag; - mV[VZ] *= oomag; - } - else - { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; - mag = 0; - } - return (mag); + return normalize(); } // LLVector3 Magnitude and Normalization Functions -inline F32 LLVector3::length() const +inline F32 LLVector3::length() const { - return sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); + return sqrt(lengthSquared()); } -inline F32 LLVector3::lengthSquared() const +inline F32 LLVector3::lengthSquared() const { return mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]; } -inline F32 LLVector3::magVec() const +inline F32 LLVector3::magVec() const { - return sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); + return length(); } -inline F32 LLVector3::magVecSquared() const +inline F32 LLVector3::magVecSquared() const { - return mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]; + return lengthSquared(); } inline bool LLVector3::inRange( F32 min, F32 max ) const @@ -371,7 +324,7 @@ inline LLVector3 operator-(const LLVector3& a, const LLVector3& b) inline F32 operator*(const LLVector3& a, const LLVector3& b) { - return (a.mV[VX]*b.mV[VX] + a.mV[VY]*b.mV[VY] + a.mV[VZ]*b.mV[VZ]); + return a.mV[VX]*b.mV[VX] + a.mV[VY]*b.mV[VY] + a.mV[VZ]*b.mV[VZ]; } inline LLVector3 operator%(const LLVector3& a, const LLVector3& b) @@ -459,9 +412,7 @@ inline const LLVector3& operator*=(LLVector3& a, const LLVector3& b) inline const LLVector3& operator/=(LLVector3& a, F32 k) { - a.mV[VX] /= k; - a.mV[VY] /= k; - a.mV[VZ] /= k; + a *= 1.f / k; return a; } @@ -478,7 +429,7 @@ inline LLVector3 operator-(const LLVector3& a) return LLVector3( -a.mV[VX], -a.mV[VY], -a.mV[VZ] ); } -inline F32 dist_vec(const LLVector3& a, const LLVector3& b) +inline F32 dist_vec(const LLVector3& a, const LLVector3& b) { F32 x = a.mV[VX] - b.mV[VX]; F32 y = a.mV[VY] - b.mV[VY]; @@ -486,7 +437,7 @@ inline F32 dist_vec(const LLVector3& a, const LLVector3& b) return sqrt( x*x + y*y + z*z ); } -inline F32 dist_vec_squared(const LLVector3& a, const LLVector3& b) +inline F32 dist_vec_squared(const LLVector3& a, const LLVector3& b) { F32 x = a.mV[VX] - b.mV[VX]; F32 y = a.mV[VY] - b.mV[VY]; @@ -494,7 +445,7 @@ inline F32 dist_vec_squared(const LLVector3& a, const LLVector3& b) return x*x + y*y + z*z; } -inline F32 dist_vec_squared2D(const LLVector3& a, const LLVector3& b) +inline F32 dist_vec_squared2D(const LLVector3& a, const LLVector3& b) { F32 x = a.mV[VX] - b.mV[VX]; F32 y = a.mV[VY] - b.mV[VY]; @@ -508,10 +459,7 @@ inline LLVector3 projected_vec(const LLVector3& a, const LLVector3& b) { return ((a * b) / bb) * b; } - else - { - return b.zero; - } + return b.zero; } inline LLVector3 inverse_projected_vec(const LLVector3& a, const LLVector3& b) @@ -548,11 +496,7 @@ inline LLVector3 lerp(const LLVector3& a, const LLVector3& b, F32 u) inline bool LLVector3::isNull() const { - if ( F_APPROXIMATELY_ZERO > mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ] ) - { - return true; - } - return false; + return F_APPROXIMATELY_ZERO > mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]; } inline void update_min_max(LLVector3& min, LLVector3& max, const LLVector3& pos) @@ -593,7 +537,7 @@ inline F32 angle_between(const LLVector3& a, const LLVector3& b) ab = 0.0f; // get rid of negative zero } LLVector3 c = a % b; // crossproduct - return atan2f(sqrtf(c * c), ab); // return the angle + return atan2f(c.length(), ab); // return the angle } inline bool are_parallel(const LLVector3& a, const LLVector3& b, F32 epsilon) @@ -603,7 +547,7 @@ inline bool are_parallel(const LLVector3& a, const LLVector3& b, F32 epsilon) an.normalize(); bn.normalize(); F32 dot = an * bn; - if ( (1.0f - fabs(dot)) < epsilon) + if (1.0f - fabs(dot) < epsilon) { return true; } diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h index e2092d1277..4f36dc6533 100644 --- a/indra/llmath/v4math.h +++ b/indra/llmath/v4math.h @@ -148,34 +148,22 @@ LLVector4 lerp(const LLVector4 &a, const LLVector4 &b, F32 u); // Returns a vect inline LLVector4::LLVector4(void) { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; - mV[VW] = 1.f; + clear(); } inline LLVector4::LLVector4(F32 x, F32 y, F32 z) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; - mV[VW] = 1.f; + set(x, y, z, 1.f); } inline LLVector4::LLVector4(F32 x, F32 y, F32 z, F32 w) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; - mV[VW] = w; + set(x, y, z, w); } inline LLVector4::LLVector4(const F32 *vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; - mV[VZ] = vec[VZ]; - mV[VW] = vec[VW]; + set(vec); } inline LLVector4::LLVector4(const F64 *vec) @@ -204,18 +192,12 @@ inline LLVector4::LLVector4(const LLVector2 &vec, F32 z, F32 w) inline LLVector4::LLVector4(const LLVector3 &vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = 1.f; + set(vec, 1.f); } inline LLVector4::LLVector4(const LLVector3 &vec, F32 w) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = w; + set(vec, w); } inline LLVector4::LLVector4(const LLSD &sd) @@ -226,43 +208,31 @@ inline LLVector4::LLVector4(const LLSD &sd) inline bool LLVector4::isFinite() const { - return (llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ]) && llfinite(mV[VW])); + return llfinite(mV[VX]) && llfinite(mV[VY]) && llfinite(mV[VZ]) && llfinite(mV[VW]); } // Clear and Assignment Functions inline void LLVector4::clear() { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; - mV[VW] = 1.f; + set(0.f, 0.f, 0.f, 1.f); } // deprecated inline void LLVector4::clearVec() { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; - mV[VW] = 1.f; + clear(); } // deprecated inline void LLVector4::zeroVec() { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; - mV[VW] = 0.f; + set(0.f, 0.f, 0.f, 0.f); } inline void LLVector4::set(F32 x, F32 y, F32 z) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; - mV[VW] = 1.f; + set(x, y, z, 1.f); } inline void LLVector4::set(F32 x, F32 y, F32 z, F32 w) @@ -275,10 +245,7 @@ inline void LLVector4::set(F32 x, F32 y, F32 z, F32 w) inline void LLVector4::set(const LLVector4& vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = vec.mV[VW]; + set(vec.mV); } inline void LLVector4::set(const LLVector3& vec, F32 w) @@ -297,57 +264,41 @@ inline void LLVector4::set(const F32* vec) mV[VW] = vec[VW]; } - // deprecated inline void LLVector4::setVec(F32 x, F32 y, F32 z) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; - mV[VW] = 1.f; + set(x, y, z); } // deprecated inline void LLVector4::setVec(F32 x, F32 y, F32 z, F32 w) { - mV[VX] = x; - mV[VY] = y; - mV[VZ] = z; - mV[VW] = w; + set(x, y, z, w); } // deprecated inline void LLVector4::setVec(const LLVector4& vec) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = vec.mV[VW]; + set(vec); } // deprecated inline void LLVector4::setVec(const LLVector3& vec, F32 w) { - mV[VX] = vec.mV[VX]; - mV[VY] = vec.mV[VY]; - mV[VZ] = vec.mV[VZ]; - mV[VW] = w; + set(vec, w); } // deprecated inline void LLVector4::setVec(const F32* vec) { - mV[VX] = vec[VX]; - mV[VY] = vec[VY]; - mV[VZ] = vec[VZ]; - mV[VW] = vec[VW]; + set(vec); } // LLVector4 Magnitude and Normalization Functions inline F32 LLVector4::length() const { - return sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); + return sqrt(lengthSquared()); } inline F32 LLVector4::lengthSquared() const @@ -357,12 +308,12 @@ inline F32 LLVector4::lengthSquared() const inline F32 LLVector4::magVec() const { - return sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); + return length(); } inline F32 LLVector4::magVecSquared() const { - return mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]; + return lengthSquared(); } // LLVector4 Operators @@ -381,7 +332,7 @@ inline LLVector4 operator-(const LLVector4& a, const LLVector4& b) inline F32 operator*(const LLVector4& a, const LLVector4& b) { - return (a.mV[VX]*b.mV[VX] + a.mV[VY]*b.mV[VY] + a.mV[VZ]*b.mV[VZ]); + return a.mV[VX]*b.mV[VX] + a.mV[VY]*b.mV[VY] + a.mV[VZ]*b.mV[VZ]; } inline LLVector4 operator%(const LLVector4& a, const LLVector4& b) @@ -454,11 +405,7 @@ inline const LLVector4& operator*=(LLVector4& a, F32 k) inline const LLVector4& operator/=(LLVector4& a, F32 k) { - F32 t = 1.f / k; - a.mV[VX] *= t; - a.mV[VY] *= t; - a.mV[VZ] *= t; - return a; + return a *= 1.f / k; } inline LLVector4 operator-(const LLVector4& a) @@ -469,13 +416,13 @@ inline LLVector4 operator-(const LLVector4& a) inline F32 dist_vec(const LLVector4& a, const LLVector4& b) { LLVector4 vec = a - b; - return (vec.length()); + return vec.length(); } inline F32 dist_vec_squared(const LLVector4& a, const LLVector4& b) { LLVector4 vec = a - b; - return (vec.lengthSquared()); + return vec.lengthSquared(); } inline LLVector4 lerp(const LLVector4& a, const LLVector4& b, F32 u) @@ -490,14 +437,10 @@ inline LLVector4 lerp(const LLVector4& a, const LLVector4& b, F32 u) inline F32 LLVector4::normalize() { F32 mag = sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); - F32 oomag; if (mag > FP_MAG_THRESHOLD) { - oomag = 1.f/mag; - mV[VX] *= oomag; - mV[VY] *= oomag; - mV[VZ] *= oomag; + *this /= mag; } else { @@ -506,30 +449,13 @@ inline F32 LLVector4::normalize() mV[VZ] = 0.f; mag = 0.f; } - return (mag); + return mag; } // deprecated inline F32 LLVector4::normVec() { - F32 mag = sqrt(mV[VX]*mV[VX] + mV[VY]*mV[VY] + mV[VZ]*mV[VZ]); - F32 oomag; - - if (mag > FP_MAG_THRESHOLD) - { - oomag = 1.f/mag; - mV[VX] *= oomag; - mV[VY] *= oomag; - mV[VZ] *= oomag; - } - else - { - mV[VX] = 0.f; - mV[VY] = 0.f; - mV[VZ] = 0.f; - mag = 0.f; - } - return (mag); + return normalize(); } // Because apparently some parts of the viewer use this for color info. diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 4e3e49ec9f..2fb1956301 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -66,7 +66,12 @@ LLModel::~LLModel() { if (mDecompID >= 0) { - LLConvexDecomposition::getInstance()->deleteDecomposition(mDecompID); + // can be null on shutdown + LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance(); + if (decomp) + { + decomp->deleteDecomposition(mDecompID); + } } mPhysics.mMesh.clear(); } diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index 3fdcf9f7f2..bb0b8ce04f 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -140,7 +140,7 @@ public: S32 notify(const LLSD& info); bool notifyChildren(const LLSD& info); - void draw(); + virtual void draw(); void storeOpenCloseState(); void restoreOpenCloseState(); diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index b8c833f4fd..8a69bd010e 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -1342,9 +1342,17 @@ bool LLFlatListViewEx::getForceShowingUnmatchedItems() const return mForceShowingUnmatchedItems; } -void LLFlatListViewEx::setForceShowingUnmatchedItems(bool show) +void LLFlatListViewEx::setForceShowingUnmatchedItems(bool show, bool notify_parent) +{ + if (mForceShowingUnmatchedItems != show) { mForceShowingUnmatchedItems = show; + if (!mFilterSubString.empty()) + { + updateNoItemsMessage(mFilterSubString); + filterItems(false, true); + } + } } void LLFlatListViewEx::setFilterSubString(const std::string& filter_str, bool notify_parent) @@ -1412,6 +1420,7 @@ void LLFlatListViewEx::filterItems(bool re_sort, bool notify_parent) if (visibility_changed && notify_parent) { + rearrangeItems(); notifyParentItemsRectChanged(); } } diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 112c330a15..32fef6c11a 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -480,7 +480,11 @@ public: bool getForceShowingUnmatchedItems() const; - void setForceShowingUnmatchedItems(bool show); + /** + * Sets filtered out items to stay visible. Can result in rect changes, + * so can notify_parent if rect changes + */ + void setForceShowingUnmatchedItems(bool show, bool notify_parent); /** * Sets up new filter string and filters the list. diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 18bde344a0..5592bb4b5c 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -31,11 +31,12 @@ #include "llfolderviewitem.h" #include "llfolderview.h" #include "llfolderviewmodel.h" -#include "llpanel.h" #include "llcallbacklist.h" #include "llcriticaldamp.h" #include "llclipboard.h" #include "llfocusmgr.h" // gFocusMgr +#include "llnotificationsutil.h" +#include "llpanel.h" #include "lltrans.h" #include "llwindow.h" @@ -57,9 +58,12 @@ LLUIColor LLFolderViewItem::sFilterBGColor; LLUIColor LLFolderViewItem::sFilterTextColor; LLUIColor LLFolderViewItem::sSuffixColor; LLUIColor LLFolderViewItem::sSearchStatusColor; +LLUIColor LLFolderViewItem::sFavoriteColor; S32 LLFolderViewItem::sTopPad = 0; LLUIImagePtr LLFolderViewItem::sFolderArrowImg; LLUIImagePtr LLFolderViewItem::sSelectionImg; +LLUIImagePtr LLFolderViewItem::sFavoriteImg; +LLUIImagePtr LLFolderViewItem::sFavoriteContentImg; LLFontGL* LLFolderViewItem::sSuffixFont = nullptr; // only integers can be initialized in header @@ -102,6 +106,8 @@ void LLFolderViewItem::initClass() sTopPad = default_params.item_top_pad; sFolderArrowImg = default_params.folder_arrow_image; sSelectionImg = default_params.selection_image; + sFavoriteImg = default_params.favorite_image; + sFavoriteContentImg = default_params.favorite_content_image; sSuffixFont = getLabelFontForStyle(LLFontGL::NORMAL); sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); @@ -113,6 +119,7 @@ void LLFolderViewItem::initClass() sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE); sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE); sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE); + sFavoriteColor = LLUIColorTable::instance().getColor("InventoryFavoriteColor", DEFAULT_WHITE); } //static @@ -121,6 +128,8 @@ void LLFolderViewItem::cleanupClass() sFonts.clear(); sFolderArrowImg = nullptr; sSelectionImg = nullptr; + sFavoriteImg = nullptr; + sFavoriteContentImg = nullptr; sSuffixFont = nullptr; } @@ -129,13 +138,15 @@ void LLFolderViewItem::cleanupClass() LLFolderViewItem::Params::Params() : root(), listener(), + favorite_image("favorite_image"), + favorite_content_image("favorite_content_image"), folder_arrow_image("folder_arrow_image"), folder_indentation("folder_indentation"), selection_image("selection_image"), item_height("item_height"), item_top_pad("item_top_pad"), creation_date(), - allow_wear("allow_wear", true), + marketplace_item("marketplace_item", false), allow_drop("allow_drop", true), font_color("font_color"), font_highlight_color("font_highlight_color"), @@ -155,6 +166,8 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) : LLView(p), mLabelWidth(0), mLabelWidthDirty(false), + mIsFavorite(false), + mHasFavorites(false), mSuffixNeedsRefresh(false), mLabelPaddingRight(DEFAULT_LABEL_PADDING_RIGHT), mParentFolder( NULL ), @@ -175,7 +188,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) mRoot(p.root), mViewModelItem(p.listener), mIsMouseOverTitle(false), - mAllowWear(p.allow_wear), + mMarketplaceItem(p.marketplace_item), mAllowDrop(p.allow_drop), mFontColor(p.font_color), mFontHighlightColor(p.font_highlight_color), @@ -211,6 +224,7 @@ bool LLFolderViewItem::postBuild() // getDisplayName() is expensive (due to internal getLabelSuffix() and name building) // it also sets search strings so it requires a filter reset mLabel = utf8str_to_wstring(vmi->getDisplayName()); + mIsFavorite = vmi->isFavorite() && !vmi->isItemInTrash(); setToolTip(vmi->getName()); // Dirty the filter flag of the model from the view (CHUI-849) @@ -325,6 +339,7 @@ void LLFolderViewItem::refresh() mLabel = utf8str_to_wstring(vmi.getDisplayName()); mLabelFontBuffer.reset(); + mIsFavorite = vmi.isFavorite() && !vmi.isItemInTrash(); setToolTip(vmi.getName()); // icons are slightly expensive to get, can be optimized // see LLInventoryIcon::getIcon() @@ -359,6 +374,8 @@ void LLFolderViewItem::refreshSuffix() mIconOpen = vmi->getIconOpen(); mIconOverlay = vmi->getIconOverlay(); + mIsFavorite = vmi->isFavorite() && !vmi->isItemInTrash(); + if (mRoot->useLabelSuffix()) { // Very Expensive! @@ -554,10 +571,15 @@ void LLFolderViewItem::buildContextMenu(LLMenuGL& menu, U32 flags) void LLFolderViewItem::openItem( void ) { - if (mAllowWear || !getViewModelItem()->isItemWearable()) + if (!mMarketplaceItem || !getViewModelItem()->isItemWearable()) { getViewModelItem()->openItem(); } + else if (mMarketplaceItem) + { + // Wearing an object from any listing, active or not, is verbotten + LLNotificationsUtil::add("AlertMerchantListingCannotWear"); + } } void LLFolderViewItem::rename(const std::string& new_name) @@ -771,6 +793,32 @@ void LLFolderViewItem::drawOpenFolderArrow() } } +void LLFolderViewItem::drawFavoriteIcon() +{ + static LLUICachedControl<bool> draw_star("InventoryFavoritesUseStar", true); + static LLUICachedControl<bool> draw_hollow_star("InventoryFavoritesUseHollowStar", true); + + LLUIImage* favorite_image = nullptr; + if (draw_star && mIsFavorite) + { + favorite_image = sFavoriteImg; + } + else if (draw_hollow_star && mHasFavorites && !isOpen()) + { + favorite_image = sFavoriteContentImg; + } + + if (favorite_image) + { + constexpr S32 PAD = 3; + constexpr S32 image_size = 14; + + gl_draw_scaled_image( + getRect().getWidth() - image_size - PAD, getRect().getHeight() - mItemHeight + PAD, + image_size, image_size, favorite_image->getImage(), sFgColor); + } +} + /*virtual*/ bool LLFolderViewItem::isHighlightAllowed() { return mIsSelected; @@ -928,6 +976,7 @@ void LLFolderViewItem::draw() { drawOpenFolderArrow(); } + drawFavoriteIcon(); drawHighlight(show_context, filled, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor); @@ -999,7 +1048,20 @@ void LLFolderViewItem::draw() } } - LLColor4 color = (mIsSelected && filled) ? mFontHighlightColor : mFontColor; + static LLUICachedControl<bool> highlight_color("InventoryFavoritesColorText", true); + LLColor4 color; + if (mIsSelected && filled) + { + color = mFontHighlightColor; + } + else if (mIsFavorite && highlight_color) + { + color = sFavoriteColor; + } + else + { + color = mFontColor; + } if (isFadeItem()) { @@ -1093,7 +1155,8 @@ LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ): mIsFolderComplete(false), // folder might have children that are not loaded yet. mAreChildrenInited(false), // folder might have children that are not built yet. mLastArrangeGeneration( -1 ), - mLastCalculatedWidth(0) + mLastCalculatedWidth(0), + mFavoritesDirtyFlags(0) { } @@ -1119,6 +1182,11 @@ LLFolderViewFolder::~LLFolderViewFolder( void ) // The LLView base class takes care of object destruction. make sure that we // don't have mouse or keyboard focus gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() + + if (mFavoritesDirtyFlags) + { + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, this); + } } // addToFolder() returns true if it succeeds. false otherwise @@ -1762,6 +1830,128 @@ bool LLFolderViewFolder::isMovable() return true; } +void LLFolderViewFolder::updateHasFavorites(bool new_childs_value) +{ + if (mFavoritesDirtyFlags == 0) + { + gIdleCallbacks.addFunction(&LLFolderViewFolder::onIdleUpdateFavorites, this); + } + if (new_childs_value) + { + mFavoritesDirtyFlags |= FAVORITE_ADDED; + } + else + { + mFavoritesDirtyFlags |= FAVORITE_REMOVED; + } +} + +void LLFolderViewFolder::onIdleUpdateFavorites(void* data) +{ + LLFolderViewFolder* self = reinterpret_cast<LLFolderViewFolder*>(data); + if (self->mFavoritesDirtyFlags == 0) + { + LL_WARNS() << "Called onIdleUpdateFavorites without dirty flags set" << LL_ENDL; + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); + return; + } + + if (self->getViewModelItem()->isItemInTrash()) + { + // do not display favorite-stars in trash + self->mFavoritesDirtyFlags = 0; + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self); + return; + } + + if (self->mFavoritesDirtyFlags == FAVORITE_ADDED) + { + if (!self->mHasFavorites) + { + // propagate up, exclude root + LLFolderViewFolder* parent = self; + while (parent + && (!parent->hasFavorites() || parent->mFavoritesDirtyFlags) + && !parent->getViewModelItem()->isAgentInventoryRoot()) + { + parent->setHasFavorites(true); + if (parent->mFavoritesDirtyFlags) + { + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, parent); + parent->mFavoritesDirtyFlags = 0; + } + parent = parent->getParentFolder(); + } + } + } + else if (self->mFavoritesDirtyFlags > FAVORITE_ADDED) + { + // full check + LLFolderViewFolder* parent = self; + while (parent && !parent->getViewModelItem()->isAgentInventoryRoot()) + { + bool has_favorites = false; + for (items_t::iterator iter = parent->mItems.begin(); + iter != parent->mItems.end();) + { + items_t::iterator iit = iter++; + if ((*iit)->isFavorite()) + { + has_favorites = true; + break; + } + } + + for (folders_t::iterator iter = parent->mFolders.begin(); + iter != parent->mFolders.end() && !has_favorites;) + { + folders_t::iterator fit = iter++; + if ((*fit)->isFavorite() || (*fit)->hasFavorites()) + { + has_favorites = true; + break; + } + } + + if (!has_favorites) + { + if (parent->hasFavorites()) + { + parent->setHasFavorites(false); + } + else + { + // Nothing changed + break; + } + } + else + { + // propagate up, exclude root + while (parent + && (!parent->hasFavorites() || parent->mFavoritesDirtyFlags) + && !parent->getViewModelItem()->isAgentInventoryRoot()) + { + parent->setHasFavorites(true); + if (parent->mFavoritesDirtyFlags) + { + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, parent); + parent->mFavoritesDirtyFlags = 0; + } + parent = parent->getParentFolder(); + } + break; + } + if (parent->mFavoritesDirtyFlags) + { + parent->mFavoritesDirtyFlags = 0; + gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, parent); + } + parent = parent->getParentFolder(); + } + } +} + bool LLFolderViewFolder::isRemovable() { diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 234d0dc7f9..32b15e32e2 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -50,7 +50,9 @@ class LLFolderViewItem : public LLView public: struct Params : public LLInitParam::Block<Params, LLView::Params> { - Optional<LLUIImage*> folder_arrow_image, + Optional<LLUIImage*> favorite_image, + favorite_content_image, + folder_arrow_image, selection_image; Mandatory<LLFolderView*> root; Mandatory<LLFolderViewModelItem*> listener; @@ -60,7 +62,7 @@ public: item_top_pad; Optional<time_t> creation_date; - Optional<bool> allow_wear; + Optional<bool> marketplace_item; Optional<bool> allow_drop; Optional<LLUIColor> font_color; @@ -93,6 +95,8 @@ protected: LLWString mLabel; S32 mLabelWidth; bool mLabelWidthDirty; + bool mIsFavorite; + bool mHasFavorites; S32 mLabelPaddingRight; LLFolderViewFolder* mParentFolder; LLPointer<LLFolderViewModelItem> mViewModelItem; @@ -122,7 +126,7 @@ protected: mIsCurSelection, mDragAndDropTarget, mIsMouseOverTitle, - mAllowWear, + mMarketplaceItem, mAllowDrop, mSingleFolderMode, mDoubleClickOverride, @@ -145,6 +149,8 @@ protected: static LLUIColor sFilterTextColor; static LLUIColor sSuffixColor; static LLUIColor sSearchStatusColor; + static LLUIColor sFavoriteColor; + // this is an internal method used for adding items to folders. A // no-op at this level, but reimplemented in derived classes. @@ -208,6 +214,8 @@ public: // Returns true is this object and all of its children can be moved virtual bool isMovable(); + bool isFavorite() const { return mIsFavorite; } + // destroys this item recursively virtual void destroyView(); @@ -298,6 +306,7 @@ public: // virtual void handleDropped(); virtual void draw(); void drawOpenFolderArrow(); + void drawFavoriteIcon(); void drawHighlight(bool showContent, bool hasKeyboardFocus, const LLUIColor& selectColor, const LLUIColor& flashColor, const LLUIColor& outlineColor, const LLUIColor& mouseOverColor); void drawLabel(const LLFontGL* font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x); virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, @@ -311,6 +320,8 @@ private: static S32 sTopPad; static LLUIImagePtr sFolderArrowImg; static LLUIImagePtr sSelectionImg; + static LLUIImagePtr sFavoriteImg; + static LLUIImagePtr sFavoriteContentImg; static LLFontGL* sSuffixFont; LLFontVertexBuffer mLabelFontBuffer; @@ -400,6 +411,18 @@ public: // Returns true is this object and all of its children can be moved virtual bool isMovable(); + bool isFavorite() const { return mIsFavorite; } + bool hasFavorites() const { return mHasFavorites; } + void setHasFavorites(bool val) { mHasFavorites = val; } + void updateHasFavorites(bool new_childs_value); +private: + static void onIdleUpdateFavorites(void* data); + + constexpr static S32 FAVORITE_ADDED = 1; + constexpr static S32 FAVORITE_REMOVED = 2; + S32 mFavoritesDirtyFlags { 0 }; +public: + // destroys this folder, and all children virtual void destroyView(); void destroyRoot(); diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 9372818ca5..24bac4509b 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -162,6 +162,7 @@ public: virtual void navigateToFolder(bool new_window = false, bool change_mode = false) = 0; + virtual bool isFavorite() const = 0; virtual bool isItemWearable() const { return false; } virtual bool isItemRenameable() const = 0; @@ -171,6 +172,7 @@ public: virtual void move( LLFolderViewModelItem* parent_listener ) = 0; virtual bool isItemRemovable( bool check_worn = true ) const = 0; // Can be destroyed + virtual bool isItemInTrash(void) const = 0; virtual bool removeItem() = 0; virtual void removeBatch(std::vector<LLFolderViewModelItem*>& batch) = 0; @@ -183,6 +185,9 @@ public: virtual void pasteFromClipboard() = 0; virtual void pasteLinkFromClipboard() = 0; + virtual bool isAgentInventory() const = 0; + virtual bool isAgentInventoryRoot() const = 0; + virtual void buildContextMenu(LLMenuGL& menu, U32 flags) = 0; virtual bool potentiallyVisible() = 0; // is the item definitely visible or we haven't made up our minds yet? diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index cc770ca90a..6b2723b305 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -46,6 +46,7 @@ #include "llfocusmgr.h" #include "llcoord.h" #include "llwindow.h" +#include "llemojihelper.h" #include "llcriticaldamp.h" #include "lluictrlfactory.h" @@ -1411,6 +1412,7 @@ void LLMenuItemBranchDownGL::openMenu( void ) } else { + LLEmojiHelper::instance().hideHelper(nullptr, true); if (branch->getTornOff()) { LLFloater * branch_parent = dynamic_cast<LLFloater *>(branch->getParent()); diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp index c5c31f7252..d3658bcf9f 100644 --- a/indra/llui/llmodaldialog.cpp +++ b/indra/llui/llmodaldialog.cpp @@ -28,6 +28,7 @@ #include "llmodaldialog.h" +#include "llemojihelper.h" #include "llfocusmgr.h" #include "v4color.h" #include "v2math.h" @@ -35,19 +36,20 @@ #include "llwindow.h" #include "llkeyboard.h" #include "llmenugl.h" + // static std::list<LLModalDialog*> LLModalDialog::sModalStack; -LLModalDialog::LLModalDialog( const LLSD& key, bool modal ) +LLModalDialog::LLModalDialog(const LLSD& key, bool modal) : LLFloater(key), - mModal( modal ) + mModal(modal) { if (modal) { setCanMinimize(false); setCanClose(false); } - setVisible( false ); + setVisible(false); setBackgroundVisible(true); setBackgroundOpaque(true); centerOnScreen(); // default position @@ -98,7 +100,7 @@ void LLModalDialog::onOpen(const LLSD& key) { if (mModal) { - // If Modal, Hide the active modal dialog + // If Modal, hide the active modal dialog if (!sModalStack.empty()) { LLModalDialog* front = sModalStack.front(); @@ -148,13 +150,18 @@ void LLModalDialog::stopModal() } } - void LLModalDialog::setVisible( bool visible ) { if (mModal) { - if( visible ) + if (visible) { + // Hide all menus currently shown + LLMenuGL::sMenuContainer->hideMenus(); + + // Hide EmojiPicker if it is shown + LLEmojiHelper::instance().hideHelper(nullptr, true); + // This is a modal dialog. It sucks up all mouse and keyboard operations. gFocusMgr.setMouseCapture( this ); @@ -257,7 +264,6 @@ bool LLModalDialog::handleRightMouseDown(S32 x, S32 y, MASK mask) return true; } - bool LLModalDialog::handleKeyHere(KEY key, MASK mask ) { LLFloater::handleKeyHere(key, mask ); @@ -301,7 +307,6 @@ void LLModalDialog::centerOnScreen() centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY]))); } - // static void LLModalDialog::onAppFocusLost() { @@ -333,6 +338,7 @@ void LLModalDialog::onAppFocusGained() } } +// static void LLModalDialog::shutdownModals() { // This method is only for use during app shutdown. ~LLModalDialog() diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 81959f1542..2d01116e40 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -265,7 +265,9 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) : mShowEmojiHelper(p.show_emoji_helper), mEnableTooltipPaste(p.enable_tooltip_paste), mPassDelete(false), - mKeepSelectionOnReturn(false) + mKeepSelectionOnReturn(false), + mSelectAllOnFocusReceived(false), + mSelectedOnFocusReceived(false) { mSourceID.generate(); @@ -389,6 +391,7 @@ void LLTextEditor::selectNext(const std::string& search_text_in, bool case_insen setCursorPos(loc); mIsSelecting = true; + mSelectedOnFocusReceived = false; mSelectionEnd = mCursorPos; mSelectionStart = llmin((S32)getLength(), (S32)(mCursorPos + search_text.size())); } @@ -668,6 +671,13 @@ bool LLTextEditor::canSelectAll() const return true; } +//virtual +void LLTextEditor::deselect() +{ + LLTextBase::deselect(); + mSelectedOnFocusReceived = false; +} + // virtual void LLTextEditor::selectAll() { @@ -685,6 +695,11 @@ void LLTextEditor::selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_p endSelection(); } +void LLTextEditor::setSelectAllOnFocusReceived(bool b) +{ + mSelectAllOnFocusReceived = b; +} + void LLTextEditor::insertEmoji(llwchar emoji) { LL_INFOS() << "LLTextEditor::insertEmoji(" << wchar_utf8_preview(emoji) << ")" << LL_ENDL; @@ -762,8 +777,16 @@ bool LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) // Delay cursor flashing resetCursorBlink(); + mSelectedOnFocusReceived = false; if (handled && !gFocusMgr.getMouseCapture()) { + if (!mask && mSelectAllOnFocusReceived) + { + mIsSelecting = false; + mSelectionStart = getLength(); + mSelectionEnd = 0; + mSelectedOnFocusReceived = true; + } gFocusMgr.setMouseCapture( this ); } return handled; @@ -2140,6 +2163,11 @@ void LLTextEditor::focusLostHelper() gEditMenuHandler = NULL; } + if (mSelectedOnFocusReceived) + { + deselect(); + } + if (mCommitOnFocusLost) { onCommit(); diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 0df2f6b38a..869ff2a63c 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -143,8 +143,10 @@ public: virtual bool canDoDelete() const; virtual void selectAll(); virtual bool canSelectAll() const; + virtual void deselect(); void selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_pos); + void setSelectAllOnFocusReceived(bool b); virtual bool canLoadOrSaveToFile(); @@ -341,6 +343,8 @@ private: bool mEnableTooltipPaste; bool mPassDelete; bool mKeepSelectionOnReturn; // disabling of removing selected text after pressing of Enter + bool mSelectAllOnFocusReceived; + bool mSelectedOnFocusReceived; LLUUID mSourceID; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index f349c4aea8..70bdb25415 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -345,8 +345,13 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool void run() override; void close() override; - // closes queue, wakes thread, waits until thread closes - void wakeAndDestroy(); + // Detroys handles and window + // Either post to or call from window thread + void destroyWindow(); + + // Closes queue, wakes thread, waits until thread closes. + // Call from main thread + bool wakeAndDestroy(); void glReady() { @@ -404,6 +409,7 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool bool mGLReady = false; bool mGotGLBuffer = false; bool mShuttingDown = false; + LLAtomicBool mDeleteOnExit = false; }; @@ -847,6 +853,7 @@ LLWindowWin32::~LLWindowWin32() } delete mDragDrop; + mDragDrop = NULL; delete [] mWindowTitle; mWindowTitle = NULL; @@ -858,6 +865,7 @@ LLWindowWin32::~LLWindowWin32() mWindowClassName = NULL; delete mWindowThread; + mWindowThread = NULL; } void LLWindowWin32::show() @@ -976,7 +984,11 @@ void LLWindowWin32::close() mhDC = NULL; mWindowHandle = NULL; - mWindowThread->wakeAndDestroy(); + if (mWindowThread->wakeAndDestroy()) + { + // thread will delete itselfs once done + mWindowThread = NULL; + } } bool LLWindowWin32::isValid() @@ -3096,10 +3108,17 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ break; } } - else + else // (NULL == window_imp) { - // (NULL == window_imp) - LL_DEBUGS("Window") << "No window implementation to handle message with, message code: " << U32(u_msg) << LL_ENDL; + if (u_msg == WM_DESTROY) + { + PostQuitMessage(0); // Posts WM_QUIT with an exit code of 0 + return 0; + } + else + { + LL_DEBUGS("Window") << "No window implementation to handle message with, message code: " << U32(u_msg) << LL_ENDL; + } } // pass unhandled messages down to Windows @@ -4786,14 +4805,50 @@ void LLWindowWin32::LLWindowWin32Thread::run() } #endif } + + destroyWindow(); + + if (mDeleteOnExit) + { + delete this; + } } -void LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() +void LLWindowWin32::LLWindowWin32Thread::destroyWindow() +{ + if (mWindowHandleThrd != NULL && IsWindow(mWindowHandleThrd)) + { + if (mhDCThrd) + { + if (!ReleaseDC(mWindowHandleThrd, mhDCThrd)) + { + LL_WARNS("Window") << "Release of ghDC failed!" << LL_ENDL; + } + mhDCThrd = NULL; + } + + // This causes WM_DESTROY to be sent *immediately* + if (!destroy_window_handler(mWindowHandleThrd)) + { + LL_WARNS("Window") << "Failed to destroy Window! " << std::hex << GetLastError() << LL_ENDL; + } + } + else + { + // Something killed the window while we were busy destroying gl or handle somehow got broken + LL_WARNS("Window") << "Failed to destroy Window, invalid handle!" << LL_ENDL; + } + mWindowHandleThrd = NULL; + mhDCThrd = NULL; + mGLReady = false; +} + +bool LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() { if (mQueue->isClosed()) { - LL_WARNS() << "Tried to close Queue. Win32 thread Queue already closed." << LL_ENDL; - return; + LL_WARNS() << "Tried to close Queue. Win32 thread Queue already closed." <<LL_ENDL; + return false; } mShuttingDown = true; @@ -4805,34 +4860,14 @@ void LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() // Schedule destruction HWND old_handle = mWindowHandleThrd; - post([this]() - { - if (IsWindow(mWindowHandleThrd)) - { - if (mhDCThrd) - { - if (!ReleaseDC(mWindowHandleThrd, mhDCThrd)) - { - LL_WARNS("Window") << "Release of ghDC failed!" << LL_ENDL; - } - mhDCThrd = NULL; - } - - // This causes WM_DESTROY to be sent *immediately* - if (!destroy_window_handler(mWindowHandleThrd)) - { - LL_WARNS("Window") << "Failed to destroy Window! " << std::hex << GetLastError() << LL_ENDL; - } - } - else - { - // Something killed the window while we were busy destroying gl or handle somehow got broken - LL_WARNS("Window") << "Failed to destroy Window, invalid handle!" << LL_ENDL; - } - mWindowHandleThrd = NULL; - mhDCThrd = NULL; - mGLReady = false; - }); + mDeleteOnExit = true; + SetWindowLongPtr(old_handle, GWLP_USERDATA, NULL); + + // Let thread finish on its own and don't block main thread. + for (auto& pair : mThreads) + { + pair.second.detach(); + } LL_DEBUGS("Window") << "Closing window's pool queue" << LL_ENDL; mQueue->close(); @@ -4848,48 +4883,8 @@ void LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() PostMessage(old_handle, WM_DUMMY_, wparam, 0x1337); } - // There are cases where window will refuse to close, - // can't wait forever on join, check state instead - LLTimer timeout; - timeout.setTimerExpirySec(2.0); - while (!getQueue().done() && !timeout.hasExpired() && mWindowHandleThrd) - { - ms_sleep(100); - } - - if (getQueue().done() || mWindowHandleThrd == NULL) - { - // Window is closed, started closing or is cleaning up - // now wait for our single thread to die. - if (mWindowHandleThrd) - { - LL_INFOS("Window") << "Window is closing, waiting on pool's thread to join, time since post: " << timeout.getElapsedSeconds() << "s" << LL_ENDL; - } - else - { - LL_DEBUGS("Window") << "Waiting on pool's thread, time since post: " << timeout.getElapsedSeconds() << "s" << LL_ENDL; - } - for (auto& pair : mThreads) - { - pair.second.join(); - } - } - else - { - // Something suspended window thread, can't afford to wait forever - // so kill thread instead - // Ex: This can happen if user starts dragging window arround (if it - // was visible) or a modal notification pops up - LL_WARNS("Window") << "Window is frozen, couldn't perform clean exit" << LL_ENDL; - - for (auto& pair : mThreads) - { - // very unsafe - TerminateThread(pair.second.native_handle(), 0); - pair.second.detach(); - } - } LL_DEBUGS("Window") << "thread pool shutdown complete" << LL_ENDL; + return true; } void LLWindowWin32::post(const std::function<void()>& func) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 3bf01d252d..b0f5116215 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -339,6 +339,7 @@ set(viewer_SOURCE_FILES llhudeffectpointat.cpp llhudeffecttrail.cpp llhudeffectblob.cpp + llhudeffectresetskeleton.cpp llhudicon.cpp llhudmanager.cpp llhudnametag.cpp @@ -1018,6 +1019,7 @@ set(viewer_HEADER_FILES llhudeffectpointat.h llhudeffecttrail.h llhudeffectblob.h + llhudeffectresetskeleton.h llhudicon.h llhudmanager.h llhudnametag.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 7a29401bb6..a810e72aac 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -91,7 +91,7 @@ <key>Type</key> <string>S32</string> <key>Value</key> - <real>300.0</real> + <real>300</real> </map> <key>AckCollectTime</key> <map> @@ -1853,6 +1853,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>DebugSelectionLODs</key> + <map> + <key>Comment</key> + <string>Force selection to show specific LOD, -1 for off, 0 - lowest, 4 - high.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>-1</integer> + </map> <key>AnimatedObjectsAllowLeftClick</key> <map> <key>Comment</key> @@ -14369,10 +14380,32 @@ <key>Value</key> <integer>1</integer> </map> - <key>OutfitGallerySortByName</key> + <key>OutfitGallerySortOrder</key> <map> <key>Comment</key> - <string>Always sort outfits by name in Outfit Gallery</string> + <string>Gallery sorting: 0 - sort outfits by name, 1 - images frst, 2 - favorites first</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>OutfitListSortOrder</key> + <map> + <key>Comment</key> + <string>How outfit list in Avatar's floater is sorted. 0 - by name 1 - favorites to top</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>OutfitListFilterFullList</key> + <map> + <key>Comment</key> + <string> 0 - show only matches. 1 - show all items in outfit as long as outfit or item inside matches.</string> <key>Persist</key> <integer>1</integer> <key>Type</key> @@ -16253,6 +16286,50 @@ <key>Value</key> <integer>0</integer> </map> + <key>InventoryFavoritesUseStar</key> + <map> + <key>Comment</key> + <string>Show star near favorited items in inventory</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>InventoryFavoritesUseHollowStar</key> + <map> + <key>Comment</key> + <string>Show star near folders that contain favorites</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>InventoryFavoritesColorText</key> + <map> + <key>Comment</key> + <string>render favorite items using InventoryFavoriteText as color</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>InventoryAddAttachmentBehavior</key> + <map> + <key>Comment</key> + <string>Defines behavior when hitting return on an inventory item</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>StatsReportMaxDuration</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index 6b788dd78f..99c43acd49 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -329,7 +329,7 @@ <key>KeepConversationLogTranscripts</key> <map> <key>Comment</key> - <string>Keep a conversation log and transcripts</string> + <string>Keep a conversation log and transcripts 2 - both, 1 - logs, 0 - none</string> <key>Persist</key> <integer>1</integer> <key>Type</key> diff --git a/indra/newview/gltfscenemanager.cpp b/indra/newview/gltfscenemanager.cpp index f596ce04f8..335dbf820a 100644 --- a/indra/newview/gltfscenemanager.cpp +++ b/indra/newview/gltfscenemanager.cpp @@ -213,6 +213,7 @@ void GLTFSceneManager::uploadSelection() LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), expected_upload_cost, + LLUUID::null, false, finish, failure)); @@ -276,6 +277,7 @@ void GLTFSceneManager::uploadSelection() LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), expected_upload_cost, + LLUUID::null, false, finish, failure)); @@ -545,6 +547,7 @@ void GLTFSceneManager::update() LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), expected_upload_cost, + LLUUID::null, false, finish, failure)); diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 3d4f5e1054..6d03fdd61f 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -120,8 +120,8 @@ const F32 MIN_FIDGET_TIME = 8.f; // seconds const F32 MAX_FIDGET_TIME = 20.f; // seconds const S32 UI_FEATURE_VERSION = 1; -// For version 1: 1 - inventory, 2 - gltf -const S32 UI_FEATURE_FLAGS = 3; +// For version 1, flag holds: 1 - inventory thumbnails, 2 - gltf, 4 - inventory favorites +const S32 UI_FEATURE_FLAGS = 7; // The agent instance. LLAgent gAgent; @@ -222,7 +222,6 @@ private: LLVector3d mPosGlobal; }; - class LLTeleportRequestViaLocationLookAt : public LLTeleportRequestViaLocation { public: @@ -603,7 +602,7 @@ void LLAgent::getFeatureVersionAndFlags(S32& version, S32& flags) if (feature_version.isInteger()) { version = feature_version.asInteger(); - flags = 1; // inventory flag + flags = 3; // show 'favorites' notification } else if (feature_version.isMap()) { @@ -629,13 +628,8 @@ void LLAgent::showLatestFeatureNotification(const std::string key) if (key == "inventory") { - // Notify user about new thumbnail support - flag = 1; - } - - if (key == "gltf") - { - flag = 2; + // Notify user about new favorites support + flag = 4; } if ((flags & flag) == 0) @@ -842,7 +836,6 @@ void LLAgent::movePitch(F32 mag) } } - // Does this parcel allow you to fly? bool LLAgent::canFly() { @@ -922,7 +915,6 @@ void LLAgent::setFlying(bool fly, bool fail_sound) LLFloaterMove::setFlyingMode(fly); } - // UI based mechanism of setting fly state //----------------------------------------------------------------------------- // toggleFlying() @@ -1001,7 +993,6 @@ void LLAgent::capabilityReceivedCallback(const LLUUID ®ion_id, LLViewerRegion } } - //----------------------------------------------------------------------------- // setRegion() //----------------------------------------------------------------------------- @@ -1107,7 +1098,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp) mRegionChangedSignal(); } - //----------------------------------------------------------------------------- // getRegion() //----------------------------------------------------------------------------- @@ -1116,7 +1106,6 @@ LLViewerRegion *LLAgent::getRegion() const return mRegionp; } - LLHost LLAgent::getRegionHost() const { if (mRegionp) @@ -1147,7 +1136,6 @@ bool LLAgent::inPrelude() return mRegionp && mRegionp->isPrelude(); } - std::string LLAgent::getRegionCapability(const std::string &name) { if (!mRegionp) @@ -1156,7 +1144,6 @@ std::string LLAgent::getRegionCapability(const std::string &name) return mRegionp->getCapability(name); } - //----------------------------------------------------------------------------- // canManageEstate() //----------------------------------------------------------------------------- @@ -1184,7 +1171,6 @@ void LLAgent::sendMessage() gMessageSystem->sendMessage(mRegionp->getHost()); } - //----------------------------------------------------------------------------- // sendReliableMessage() //----------------------------------------------------------------------------- @@ -1218,7 +1204,6 @@ LLVector3 LLAgent::getVelocity() const } } - //----------------------------------------------------------------------------- // setPositionAgent() //----------------------------------------------------------------------------- @@ -1287,12 +1272,11 @@ const LLVector3 &LLAgent::getPositionAgent() mFrameAgent.setOrigin(gAgentAvatarp->getPositionAgent()); } else - { - mFrameAgent.setOrigin(gAgentAvatarp->getRenderPosition()); - } + { + mFrameAgent.setOrigin(gAgentAvatarp->getRenderPosition()); + } } - return mFrameAgent.getOrigin(); } @@ -1301,7 +1285,6 @@ boost::signals2::connection LLAgent::whenPositionChanged(position_signal_t::slot return mOnPositionChanged.connect(fn); } - //----------------------------------------------------------------------------- // getRegionsVisited() //----------------------------------------------------------------------------- @@ -1318,7 +1301,6 @@ F64 LLAgent::getDistanceTraveled() const return mDistanceTraveled; } - //----------------------------------------------------------------------------- // getPosAgentFromGlobal() //----------------------------------------------------------------------------- @@ -1329,7 +1311,6 @@ LLVector3 LLAgent::getPosAgentFromGlobal(const LLVector3d &pos_global) const return pos_agent; } - //----------------------------------------------------------------------------- // getPosGlobalFromAgent() //----------------------------------------------------------------------------- @@ -1345,7 +1326,6 @@ void LLAgent::sitDown() setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); } - //----------------------------------------------------------------------------- // resetAxes() //----------------------------------------------------------------------------- @@ -1354,7 +1334,6 @@ void LLAgent::resetAxes() mFrameAgent.resetAxes(); } - // Copied from LLCamera::setOriginAndLookAt // Look_at must be unit vector //----------------------------------------------------------------------------- @@ -1383,7 +1362,6 @@ void LLAgent::resetAxes(const LLVector3 &look_at) mFrameAgent.setAxes(look_at, left, up); } - //----------------------------------------------------------------------------- // rotate() //----------------------------------------------------------------------------- @@ -1392,7 +1370,6 @@ void LLAgent::rotate(F32 angle, const LLVector3 &axis) mFrameAgent.rotate(angle, axis); } - //----------------------------------------------------------------------------- // rotate() //----------------------------------------------------------------------------- @@ -1401,7 +1378,6 @@ void LLAgent::rotate(F32 angle, F32 x, F32 y, F32 z) mFrameAgent.rotate(angle, x, y, z); } - //----------------------------------------------------------------------------- // rotate() //----------------------------------------------------------------------------- @@ -1410,7 +1386,6 @@ void LLAgent::rotate(const LLMatrix3 &matrix) mFrameAgent.rotate(matrix); } - //----------------------------------------------------------------------------- // rotate() //----------------------------------------------------------------------------- @@ -1419,7 +1394,6 @@ void LLAgent::rotate(const LLQuaternion &quaternion) mFrameAgent.rotate(quaternion); } - //----------------------------------------------------------------------------- // getReferenceUpVector() //----------------------------------------------------------------------------- @@ -1448,47 +1422,71 @@ LLVector3 LLAgent::getReferenceUpVector() return up_vector; } - // Radians, positive is downward toward ground //----------------------------------------------------------------------------- // pitch() //----------------------------------------------------------------------------- void LLAgent::pitch(F32 angle) { - // don't let user pitch if pointed almost all the way down or up - - // A dot B = mag(A) * mag(B) * cos(angle between A and B) - // so... cos(angle between A and B) = A dot B / mag(A) / mag(B) - // = A dot B for unit vectors + if (gAgentCamera.getCameraMode() == CAMERA_MODE_THIRD_PERSON || + gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) + { + // Backup the current orientation + LLCoordFrame saved_frame_agent(mFrameAgent); - LLVector3 skyward = getReferenceUpVector(); + // Optimistic rotation up/down (vertical angle can reach and exceed 0 or 180) + mFrameAgent.pitch(angle); - // SL-19286 Avatar is upside down when viewed from below - // after left-clicking the mouse on the avatar and dragging down - // - // The issue is observed on angle below 10 degrees - const F32 look_down_limit = 179.f * DEG_TO_RAD; - const F32 look_up_limit = 10.f * DEG_TO_RAD; + // Cosine of the angle between current agent At and Up directions + F32 agent_at_to_up_now_cos = saved_frame_agent.mXAxis * gAgentCamera.getCameraUpVector(); + bool pitch_away_from_horizont = (angle < 0) ^ (agent_at_to_up_now_cos < 0); + // We always allow to pitch in direction to horizont (from zenith or from nadir) + if (!pitch_away_from_horizont) + return; - F32 angle_from_skyward = acos(mFrameAgent.getAtAxis() * skyward); + // Current angle between agent At and Up directions + F32 agent_at_to_up_now = acos(agent_at_to_up_now_cos); + // Requested angle between agent At and Up directions + F32 agent_at_to_up_new = agent_at_to_up_now + angle; + F32 agent_at_to_up_new_sin = sin(agent_at_to_up_new); + // Overpitched? Then rollback + if (agent_at_to_up_new_sin < 1e-4) + { + mFrameAgent = saved_frame_agent; + return; + } - // clamp pitch to limits - if ((angle >= 0.f) && (angle_from_skyward + angle > look_down_limit)) - { - angle = look_down_limit - angle_from_skyward; - } - else if ((angle < 0.f) && (angle_from_skyward + angle < look_up_limit)) - { - angle = look_up_limit - angle_from_skyward; + if (gAgentCamera.getCameraMode() == CAMERA_MODE_THIRD_PERSON || + (isAgentAvatarValid() && gAgentAvatarp->getParent())) + { + // Camera sight relative to agent frame (focus - offset) + LLVector3 camera_offset(gAgentCamera.getCameraOffsetInitial()); + LLVector3 camera_focus(gAgentCamera.getFocusOffsetInitial()); + LLVector3 camera_sight(camera_focus - camera_offset); + // 2D projection of the camera sight to the XZ plane + LLVector2 camera_sight_2d_vert(1, camera_sight[VZ]); + camera_sight_2d_vert.normalize(); + // Cosine of the 2D angle between initial camera At and X axis (in the XZ plane) + F32 camera_sight_to_at_2d_vert_cos = camera_sight_2d_vert * LLVector2(LLVector3::x_axis); + F32 camera_sight_to_at_2d_vert = acos(camera_sight_to_at_2d_vert_cos); + // Requested angle between camera At and Up directions + F32 camera_at_to_up_new = agent_at_to_up_new - camera_sight_to_at_2d_vert; + F32 camera_at_to_up_new_sin = sin(camera_at_to_up_new); + // Overpitched? Then rollback + if (camera_at_to_up_new_sin < 1e-4) + { + mFrameAgent = saved_frame_agent; + return; + } + } } - - if (fabs(angle) > 1e-4) + else { + // No limitations in other modes mFrameAgent.pitch(angle); } } - //----------------------------------------------------------------------------- // roll() //----------------------------------------------------------------------------- @@ -1497,7 +1495,6 @@ void LLAgent::roll(F32 angle) mFrameAgent.roll(angle); } - //----------------------------------------------------------------------------- // yaw() //----------------------------------------------------------------------------- @@ -1509,7 +1506,6 @@ void LLAgent::yaw(F32 angle) } } - // Returns a quat that represents the rotation of the agent in the absolute frame //----------------------------------------------------------------------------- // getQuat() @@ -1535,7 +1531,6 @@ void LLAgent::setControlFlags(U32 mask) mControlFlags |= mask; } - //----------------------------------------------------------------------------- // clearControlFlags() //----------------------------------------------------------------------------- @@ -1623,7 +1618,6 @@ bool LLAgent::isDoNotDisturb() const return mIsDoNotDisturb; } - //----------------------------------------------------------------------------- // startAutoPilotGlobal() //----------------------------------------------------------------------------- @@ -1729,7 +1723,6 @@ void LLAgent::startAutoPilotGlobal( mAutoPilotNoProgressFrameCount = 0; } - //----------------------------------------------------------------------------- // setAutoPilotTargetGlobal //----------------------------------------------------------------------------- @@ -1783,7 +1776,6 @@ void LLAgent::startFollowPilot(const LLUUID &leader_id, bool allow_flying, F32 s allow_flying); } - //----------------------------------------------------------------------------- // stopAutoPilot() //----------------------------------------------------------------------------- @@ -1825,7 +1817,6 @@ void LLAgent::stopAutoPilot(bool user_cancel) } } - // Returns necessary agent pitch and yaw changes, radians. //----------------------------------------------------------------------------- // autoPilot() @@ -2014,7 +2005,6 @@ void LLAgent::autoPilot(F32 *delta_yaw) } } - //----------------------------------------------------------------------------- // propagate() //----------------------------------------------------------------------------- @@ -2035,18 +2025,19 @@ void LLAgent::propagate(const F32 dt) } // handle rotation based on keyboard levels - constexpr F32 YAW_RATE = 90.f * DEG_TO_RAD; // radians per second - F32 angle = YAW_RATE * gAgentCamera.getYawKey() * dt; - if (fabs(angle) > 0.0f) + if (fabs(dt) > 1e-6) { - yaw(angle); - } + if (fabs(gAgentCamera.getYawKey()) > 1e-6) + { + static const F32 YAW_RATE = 90.f * DEG_TO_RAD; // radians per second + yaw(YAW_RATE * gAgentCamera.getYawKey() * dt); + } - constexpr F32 PITCH_RATE = 90.f * DEG_TO_RAD; // radians per second - angle = PITCH_RATE * gAgentCamera.getPitchKey() * dt; - if (fabs(angle) > 0.0f) - { - pitch(angle); + if (fabs(gAgentCamera.getPitchKey()) > 1e-6) + { + static const F32 PITCH_RATE = 90.f * DEG_TO_RAD; // radians per second + pitch(PITCH_RATE * gAgentCamera.getPitchKey() * dt); + } } // handle auto-land behavior @@ -2208,7 +2199,6 @@ void LLAgent::clearRenderState(U8 clearstate) mRenderState &= ~clearstate; } - //----------------------------------------------------------------------------- // getRenderState() //----------------------------------------------------------------------------- @@ -2250,6 +2240,7 @@ void LLAgent::endAnimationUpdateUI() { return; } + if (gAgentCamera.getCameraMode() == gAgentCamera.getLastCameraMode()) { // We're already done endAnimationUpdateUI for this transition. @@ -2315,9 +2306,8 @@ void LLAgent::endAnimationUpdateUI() mViewsPushed = false; } - gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR); - if( gMorphView ) + if (gMorphView) { gMorphView->setVisible( false ); } @@ -2325,7 +2315,7 @@ void LLAgent::endAnimationUpdateUI() // Disable mouselook-specific animations if (isAgentAvatarValid()) { - if( gAgentAvatarp->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) ) + if (gAgentAvatarp->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS)) { if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_RIFLE_R) != gAgentAvatarp->mSignaledAnimations.end()) { @@ -2944,7 +2934,6 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity) } } - void LLAgent::processMaturityPreferenceFromServer(const LLSD &result, U8 perferredMaturity) { U8 maturity = SIM_ACCESS_MIN; @@ -3014,7 +3003,6 @@ void LLAgent::changeInterestListMode(const std::string &new_mode) } } - bool LLAgent::requestPostCapability(const std::string &capName, LLSD &postData, httpCallback_t cbSuccess, httpCallback_t cbFailure) { if (getRegion()) @@ -3341,7 +3329,6 @@ void LLAgent::sendAnimationStateReset() sendReliableMessage(); } - // Send a message to the region to revoke sepecified permissions on ALL scripts in the region // If the target is an object in the region, permissions in scripts on that object are cleared. // If it is the region ID, all scripts clear the permissions for this agent @@ -4271,7 +4258,6 @@ void LLAgent::onCapabilitiesReceivedAfterTeleport() check_merchant_status(); } - void LLAgent::teleportRequest( const U64& region_handle, const LLVector3& pos_local, @@ -4371,7 +4357,6 @@ void LLAgent::doTeleportViaLure(const LLUUID& lure_id, bool godlike) } } - // James Cook, July 28, 2005 void LLAgent::teleportCancel() { @@ -4496,7 +4481,6 @@ LLAgent::ETeleportState LLAgent::getTeleportState() const TELEPORT_NONE : mTeleportState; } - void LLAgent::setTeleportState(ETeleportState state) { if (mTeleportRequest && (state != TELEPORT_NONE) && (mTeleportRequest->getStatus() == LLTeleportRequest::kFailed)) @@ -4541,7 +4525,6 @@ void LLAgent::setTeleportState(ETeleportState state) } } - void LLAgent::stopCurrentAnimations() { LL_DEBUGS("Avatar") << "Stopping current animations" << LL_ENDL; @@ -4656,7 +4639,6 @@ void LLAgent::stopFidget() gAgent.sendAnimationRequests(anims, ANIM_REQUEST_STOP); } - void LLAgent::requestEnterGodMode() { LLMessageSystem* msg = gMessageSystem; @@ -4777,7 +4759,6 @@ void LLAgent::sendAgentUpdateUserInfo(const std::string& directory_visibility) } } - void LLAgent::updateAgentUserInfoCoro(std::string capurl, std::string directory_visibility) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -5047,7 +5028,7 @@ void LLAgent::applyExternalActionFlags(U32 outer_flags) if( delta_time > FLY_TIME && delta_frames > FLY_FRAMES) { - setFlying(TRUE); + setFlying(true); } } } diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index d4767e18af..7f60b2b8a0 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1231,7 +1231,7 @@ void LLAgentCamera::updateCamera() } //NOTE - this needs to be integrated into a general upVector system here within llAgent. - if ( camera_mode == CAMERA_MODE_FOLLOW && mFocusOnAvatar ) + if (camera_mode == CAMERA_MODE_FOLLOW && mFocusOnAvatar) { mCameraUpVector = mFollowCam.getUpVector(); } @@ -1462,13 +1462,12 @@ void LLAgentCamera::updateCamera() // LL_INFOS() << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << LL_ENDL; LLVector3 focus_agent = gAgent.getPosAgentFromGlobal(mFocusGlobal); + LLVector3 position_agent = gAgent.getPosAgentFromGlobal(camera_pos_global); - mCameraPositionAgent = gAgent.getPosAgentFromGlobal(camera_pos_global); + // Try to move the camera - // Move the camera - - LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent); - //LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent); + if (!LLViewerCamera::getInstance()->updateCameraLocation(position_agent, mCameraUpVector, focus_agent)) + return; // Change FOV LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor)); @@ -1476,7 +1475,7 @@ void LLAgentCamera::updateCamera() // follow camera when in customize mode if (cameraCustomizeAvatar()) { - setLookAt(LOOKAT_TARGET_FOCUS, NULL, mCameraPositionAgent); + setLookAt(LOOKAT_TARGET_FOCUS, NULL, position_agent); } // update the travel distance stat @@ -1495,8 +1494,8 @@ void LLAgentCamera::updateCamera() LLVector3 head_pos = gAgentAvatarp->mHeadp->getWorldPosition() + LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatarp->mHeadp->getWorldRotation() + LLVector3(0.1f, 0.f, 0.f) * gAgentAvatarp->mPelvisp->getWorldRotation(); - LLVector3 diff = mCameraPositionAgent - head_pos; - diff = diff * ~gAgentAvatarp->mRoot->getWorldRotation(); + LLVector3 diff = position_agent - head_pos; + diff *= ~gAgentAvatarp->mRoot->getWorldRotation(); LLJoint* torso_joint = gAgentAvatarp->mTorsop; LLJoint* chest_joint = gAgentAvatarp->mChestp; @@ -2256,7 +2255,8 @@ void LLAgentCamera::changeCameraToFollow(bool animate) mCameraMode = CAMERA_MODE_FOLLOW; // bang-in the current focus, position, and up vector of the follow cam - mFollowCam.reset(mCameraPositionAgent, LLViewerCamera::getInstance()->getPointOfInterest(), LLVector3::z_axis); + const LLViewerCamera& camera = LLViewerCamera::instance(); + mFollowCam.reset(camera.getOrigin(), camera.getPointOfInterest(), LLVector3::z_axis); if (gBasicToolset) { diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 52571f3c55..d277fd6158 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -112,6 +112,7 @@ private: //-------------------------------------------------------------------- public: void switchCameraPreset(ECameraPreset preset); + ECameraPreset getCameraPreset() const { return mCameraPreset; } /** Determines default camera offset depending on the current camera preset */ LLVector3 getCameraOffsetInitial(); /** Determines default focus offset depending on the current camera preset */ @@ -138,13 +139,14 @@ private: //-------------------------------------------------------------------- public: LLVector3d getCameraPositionGlobal() const; - const LLVector3 &getCameraPositionAgent() const; + const LLVector3& getCameraPositionAgent() const; LLVector3d calcCameraPositionTargetGlobal(bool *hit_limit = NULL); // Calculate the camera position target F32 getCameraMinOffGround(); // Minimum height off ground for this mode, meters void setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; } bool calcCameraMinDistance(F32 &obj_min_distance); - F32 getCurrentCameraBuildOffset() { return (F32)mCameraFocusOffset.length(); } + F32 getCurrentCameraBuildOffset() const { return (F32)mCameraFocusOffset.length(); } void clearCameraLag() { mCameraLag.clearVec(); } + const LLVector3& getCameraUpVector() const { return mCameraUpVector; } private: LLVector3 getAvatarRootPosition(); @@ -154,7 +156,6 @@ private: F32 mCameraCurrentFOVZoomFactor; // Interpolated fov zoom LLVector4 mCameraCollidePlane; // Colliding plane for camera F32 mCameraZoomFraction; // Mousewheel driven fraction of zoom - LLVector3 mCameraPositionAgent; // Camera position in agent coordinates LLVector3 mCameraVirtualPositionAgent; // Camera virtual position (target) before performing FOV zoom LLVector3d mCameraSmoothingLastPositionGlobal; LLVector3d mCameraSmoothingLastPositionAgent; @@ -278,7 +279,7 @@ public: F32 getAgentHUDTargetZoom(); void resetCameraZoomFraction(); - F32 getCurrentCameraZoomFraction() { return mCameraZoomFraction; } + F32 getCurrentCameraZoomFraction() const { return mCameraZoomFraction; } //-------------------------------------------------------------------- // Pan diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index 0b5198bbd3..8b18b7d5a2 100644 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -322,9 +322,7 @@ void LLAgentPilot::moveCamera() LLViewerCamera::getInstance()->setView(view); LLViewerCamera::getInstance()->setOrigin(origin); - LLViewerCamera::getInstance()->mXAxis = LLVector3(mat.mMatrix[0]); - LLViewerCamera::getInstance()->mYAxis = LLVector3(mat.mMatrix[1]); - LLViewerCamera::getInstance()->mZAxis = LLVector3(mat.mMatrix[2]); + LLViewerCamera::getInstance()->setAxes(mat); } } diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index 11c5ffecb6..5114ac8a08 100644 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -839,7 +839,7 @@ void AISAPI::onUpdateReceived(const LLSD& update, COMMAND_TYPE type, const LLSD& if ( (type == UPDATECATEGORY || type == UPDATEITEM) && gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) { - dump_sequential_xml(gAgentAvatarp->getFullname() + "_ais_update", update); + dump_sequential_xml(gAgentAvatarp->getDebugName() + "_ais_update", update); } AISUpdate ais_update(update, type, request_body); diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 2877bb7c49..eae5aa36e0 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2030,7 +2030,7 @@ bool LLAppearanceMgr::getCanReplaceCOF(const LLUUID& outfit_cat_id) } // Moved from LLWearableList::ContextMenu for wider utility. -bool LLAppearanceMgr::canAddWearables(const uuid_vec_t& item_ids) const +bool LLAppearanceMgr::canAddWearables(const uuid_vec_t& item_ids, bool warn_on_type_mismatch) const { // TODO: investigate wearables may not be loaded at this point EXT-8231 @@ -2060,7 +2060,10 @@ bool LLAppearanceMgr::canAddWearables(const uuid_vec_t& item_ids) const } else { - LL_WARNS() << "Unexpected wearable type" << LL_ENDL; + if (warn_on_type_mismatch) + { + LL_WARNS() << "Unexpected wearable type" << LL_ENDL; + } return false; } } @@ -2251,7 +2254,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) } if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) { - dump_sequential_xml(gAgentAvatarp->getFullname() + "_slam_request", contents); + dump_sequential_xml(gAgentAvatarp->getDebugName() + "_slam_request", contents); } slam_inventory_folder(getCOF(), contents, link_waiter); @@ -3977,7 +3980,7 @@ void LLAppearanceMgr::serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAd LL_DEBUGS("Avatar") << "succeeded" << LL_ENDL; if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) { - dump_sequential_xml(gAgentAvatarp->getFullname() + "_appearance_request_ok", result); + dump_sequential_xml(gAgentAvatarp->getDebugName() + "_appearance_request_ok", result); } } while (bRetry); @@ -3986,7 +3989,7 @@ void LLAppearanceMgr::serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAd /*static*/ void LLAppearanceMgr::debugAppearanceUpdateCOF(const LLSD& content) { - dump_sequential_xml(gAgentAvatarp->getFullname() + "_appearance_request_error", content); + dump_sequential_xml(gAgentAvatarp->getDebugName() + "_appearance_request_error", content); LL_INFOS("Avatar") << "AIS COF, version received: " << content["expected"].asInteger() << " ================================= " << LL_ENDL; diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 9e624f593f..acb4d6174f 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -104,7 +104,7 @@ public: bool getCanReplaceCOF(const LLUUID& outfit_cat_id); // Can we add all referenced items to the avatar? - bool canAddWearables(const uuid_vec_t& item_ids) const; + bool canAddWearables(const uuid_vec_t& item_ids, bool warn_on_type_mismatch = true) const; // Copy all items in a category. void shallowCopyCategoryContents(const LLUUID& src_id, const LLUUID& dst_id, diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 46681af808..23da0faa47 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -461,11 +461,20 @@ void idle_afk_check() { // check idle timers F32 current_idle = gAwayTriggerTimer.getElapsedTimeF32(); - F32 afk_timeout = (F32)gSavedSettings.getS32("AFKTimeout"); - if (afk_timeout && (current_idle > afk_timeout) && ! gAgent.getAFK()) + LLCachedControl<S32> afk_timeout(gSavedSettings, "AFKTimeout", 300); + if (afk_timeout() && (current_idle > afk_timeout())) { - LL_INFOS("IdleAway") << "Idle more than " << afk_timeout << " seconds: automatically changing to Away status" << LL_ENDL; - gAgent.setAFK(); + if (!gAgent.getAFK()) + { + LL_INFOS("IdleAway") << "Idle more than " << afk_timeout << " seconds: automatically changing to Away status" << LL_ENDL; + gAgent.setAFK(); + } + else + { + // Refresh timer so that random one click or hover won't clear the status. + // But expanding the window still should lift afk status + gAwayTimer.reset(); + } } } @@ -1993,37 +2002,6 @@ bool LLAppViewer::cleanup() // Clean up before GL is shut down because we might be holding on to objects with texture references LLSelectMgr::cleanupGlobals(); - LL_INFOS() << "Shutting down OpenGL" << LL_ENDL; - - // Shut down OpenGL - if( gViewerWindow) - { - gViewerWindow->shutdownGL(); - - // Destroy window, and make sure we're not fullscreen - // This may generate window reshape and activation events. - // Therefore must do this before destroying the message system. - delete gViewerWindow; - gViewerWindow = NULL; - LL_INFOS() << "ViewerWindow deleted" << LL_ENDL; - } - - LLSplashScreen::show(); - LLSplashScreen::update(LLTrans::getString("ShuttingDown")); - - LL_INFOS() << "Cleaning up Keyboard & Joystick" << LL_ENDL; - - // viewer UI relies on keyboard so keep it aound until viewer UI isa gone - delete gKeyboard; - gKeyboard = NULL; - - if (LLViewerJoystick::instanceExists()) - { - // Turn off Space Navigator and similar devices - LLViewerJoystick::getInstance()->terminate(); - } - LLGameControl::terminate(); - LL_INFOS() << "Cleaning up Objects" << LL_ENDL; LLViewerObject::cleanupVOClasses(); @@ -2182,6 +2160,37 @@ bool LLAppViewer::cleanup() sTextureFetch->shutDownTextureCacheThread() ; LLLFSThread::sLocal->shutdown(); + LL_INFOS() << "Shutting down OpenGL" << LL_ENDL; + + // Shut down OpenGL + if (gViewerWindow) + { + gViewerWindow->shutdownGL(); + + // Destroy window, and make sure we're not fullscreen + // This may generate window reshape and activation events. + // Therefore must do this before destroying the message system. + delete gViewerWindow; + gViewerWindow = NULL; + LL_INFOS() << "ViewerWindow deleted" << LL_ENDL; + } + + LLSplashScreen::show(); + LLSplashScreen::update(LLTrans::getString("ShuttingDown")); + + LL_INFOS() << "Cleaning up Keyboard & Joystick" << LL_ENDL; + + // viewer UI relies on keyboard so keep it aound until viewer UI isa gone + delete gKeyboard; + gKeyboard = NULL; + + if (LLViewerJoystick::instanceExists()) + { + // Turn off Space Navigator and similar devices + LLViewerJoystick::getInstance()->terminate(); + } + LLGameControl::terminate(); + LL_INFOS() << "Shutting down message system" << LL_ENDL; end_messaging_system(); diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp index f200ca8e31..1ea2899ba4 100644 --- a/indra/newview/llautoreplace.cpp +++ b/indra/newview/llautoreplace.cpp @@ -536,11 +536,12 @@ LLAutoReplaceSettings::AddListResult LLAutoReplaceSettings::replaceList(const LL S32 search_index; LLSD targetList; // The following is working around the fact that LLSD arrays containing maps also seem to have undefined entries... see LLSD-30 - for ( search_index = 0, targetList = mLists[0]; + for ( search_index = 0; !listFound && search_index < mLists.size(); - search_index += 1, targetList = mLists[search_index] + search_index += 1 ) { + targetList = mLists[search_index]; if ( targetList.isMap() ) { if ( listNameMatches( targetList, listName) ) diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index 9201241856..660fb1b41a 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -129,14 +129,14 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ { LLVector3 pos_box_offset = point_to_box_offset(vol_pos, unshift_extents); F32 offset_dist = pos_box_offset.length(); - if (offset_dist > MAX_LEGAL_OFFSET && offset_dist > 0.f) + if (offset_dist > max_legal_offset && offset_dist > 0.f) { - F32 target_dist = (offset_dist - MAX_LEGAL_OFFSET); + F32 target_dist = (offset_dist - max_legal_offset); new_pos_fixup = (target_dist/offset_dist)*pos_box_offset; } if (new_pos_fixup != mPositionConstraintFixup) { - LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup " + LL_DEBUGS("ConstraintFix") << getDebugName() << " pos fix, offset_dist " << offset_dist << " pos fixup " << new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL; LL_DEBUGS("ConstraintFix") << "vol_pos " << vol_pos << LL_ENDL; LL_DEBUGS("ConstraintFix") << "extents " << extents[0] << " " << extents[1] << LL_ENDL; @@ -144,11 +144,11 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_ } } - if (box_size/mScaleConstraintFixup > MAX_LEGAL_SIZE) + if (box_size/mScaleConstraintFixup > max_legal_size) { - new_scale_fixup = mScaleConstraintFixup* MAX_LEGAL_SIZE /box_size; - LL_DEBUGS("ConstraintFix") << getFullname() << " scale fix, box_size " << box_size << " fixup " - << mScaleConstraintFixup << " max legal " << MAX_LEGAL_SIZE + new_scale_fixup = mScaleConstraintFixup*max_legal_size/box_size; + LL_DEBUGS("ConstraintFix") << getDebugName() << " scale fix, box_size " << box_size << " fixup " + << mScaleConstraintFixup << " max legal " << max_legal_size << " -> new scale " << new_scale_fixup << LL_ENDL; } } @@ -231,7 +231,7 @@ void LLControlAvatar::matchVolumeTransform() const LLMeshSkinInfo* skin_info = mRootVolp->getSkinInfo(); if (skin_info) { - LL_DEBUGS("BindShape") << getFullname() << " bind shape " << skin_info->mBindShapeMatrix << LL_ENDL; + LL_DEBUGS("BindShape") << getDebugName() << " bind shape " << skin_info->mBindShapeMatrix << LL_ENDL; bind_rot = LLSkinningUtil::getUnscaledQuaternion(LLMatrix4(skin_info->mBindShapeMatrix)); } #endif diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index c1e48c63a9..d5486b9f4a 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -79,6 +79,9 @@ public: virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); } virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; } virtual std::string getLabelSuffix() const { return LLStringUtil::null; } + virtual bool isFavorite() const { return false; } + virtual bool isAgentInventory() const { return false; } + virtual bool isAgentInventoryRoot() const { return false; } virtual bool isItemRenameable() const { return true; } virtual bool renameItem(const std::string& new_name) { mName = new_name; mNeedsRefresh = true; return true; } virtual bool isItemMovable( void ) const { return false; } diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp index ff30c83f51..f2345f5c01 100644 --- a/indra/newview/llfloater360capture.cpp +++ b/indra/newview/llfloater360capture.cpp @@ -33,6 +33,7 @@ #include "llagentui.h" #include "llbase64.h" #include "llcallbacklist.h" +#include "lldate.h" #include "llenvironment.h" #include "llimagejpeg.h" #include "llmediactrl.h" @@ -863,15 +864,7 @@ const std::string LLFloater360Capture::generate_proposed_filename() filename << "_"; // add in the current HH-MM-SS (with leading 0's) so users can easily save many shots in same folder - std::time_t cur_epoch = std::time(nullptr); - std::tm* tm_time = std::localtime(&cur_epoch); - filename << std::setfill('0') << std::setw(4) << (tm_time->tm_year + 1900); - filename << std::setfill('0') << std::setw(2) << (tm_time->tm_mon + 1); - filename << std::setfill('0') << std::setw(2) << tm_time->tm_mday; - filename << "_"; - filename << std::setfill('0') << std::setw(2) << tm_time->tm_hour; - filename << std::setfill('0') << std::setw(2) << tm_time->tm_min; - filename << std::setfill('0') << std::setw(2) << tm_time->tm_sec; + filename << LLDate::now().toLocalDateString("%Y%m%d_%H%M%S"); // the unusual way we save the output image (originates in the // embedded browser and not the C++ code) means that the system diff --git a/indra/newview/llfloaterautoreplacesettings.cpp b/indra/newview/llfloaterautoreplacesettings.cpp index 99f24e161e..d93bd624f5 100644 --- a/indra/newview/llfloaterautoreplacesettings.cpp +++ b/indra/newview/llfloaterautoreplacesettings.cpp @@ -422,7 +422,13 @@ bool LLFloaterAutoReplaceSettings::callbackNewListName(const LLSD& notification, LLSD newList = notification["payload"]["list"]; - if ( response.has("listname") && response["listname"].isString() ) + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option != 1) // Must also match RenameAutoReplaceList + { + // user cancelled + return false; + } + else if (response.has("listname") && response["listname"].isString() ) { std::string newName = response["listname"].asString(); LLAutoReplaceSettings::setListName(newList, newName); @@ -508,12 +514,53 @@ bool LLFloaterAutoReplaceSettings::callbackListNameConflict(const LLSD& notifica return false; } +bool LLFloaterAutoReplaceSettings::callbackRemoveList(const LLSD& notification, const LLSD& response) +{ + std::string listName = notification["payload"]["list"]; + + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + switch (option) + { + case 1: + if (mSettings.removeReplacementList(listName)) + { + LL_INFOS("AutoReplace") << "deleted list '" << listName << "'" << LL_ENDL; + mReplacementsList->deleteSelectedItems(); // remove from the scrolling list + mSelectedListName.clear(); + updateListNames(); + updateListNamesControls(); + updateReplacementsList(); + } + break; + case 0: + break; + + default: + LL_ERRS("AutoReplace") << "invalid selected option " << option << LL_ENDL; + } + + return false; +} + void LLFloaterAutoReplaceSettings::onDeleteList() { std::string listName = mListNames->getSelectedValue().asString(); if ( ! listName.empty() ) { - if ( mSettings.removeReplacementList(listName) ) + const LLSD* mappings = mSettings.getListEntries(mSelectedListName); + if (mappings->size() > 0) + { + LLSD payload; + payload["list"] = listName; + + LLSD args; + args["MAP_SIZE"] = llformat("%d",mappings->size()); + args["LIST_NAME"] = listName; + + LLNotificationsUtil::add("RemoveAutoReplaceList", args, payload, + boost::bind(&LLFloaterAutoReplaceSettings::callbackRemoveList, this, _1, _2)); + } + else if ( mSettings.removeReplacementList(listName) ) { LL_INFOS("AutoReplace")<<"deleted list '"<<listName<<"'"<<LL_ENDL; mReplacementsList->deleteSelectedItems(); // remove from the scrolling list diff --git a/indra/newview/llfloaterautoreplacesettings.h b/indra/newview/llfloaterautoreplacesettings.h index 94a7c00c15..1a8068ab7c 100644 --- a/indra/newview/llfloaterautoreplacesettings.h +++ b/indra/newview/llfloaterautoreplacesettings.h @@ -105,6 +105,8 @@ private: bool callbackNewListName(const LLSD& notification, const LLSD& response); /// called from the RenameAutoReplaceList notification dialog bool callbackListNameConflict(const LLSD& notification, const LLSD& response); + /// called from the RemoveAutoReplaceList notification dialog + bool callbackRemoveList(const LLSD& notification, const LLSD& response); bool selectedListIsFirst(); bool selectedListIsLast(); diff --git a/indra/newview/llfloaterbulkupload.cpp b/indra/newview/llfloaterbulkupload.cpp index b898cb28b6..e3664c61bf 100644 --- a/indra/newview/llfloaterbulkupload.cpp +++ b/indra/newview/llfloaterbulkupload.cpp @@ -41,6 +41,8 @@ LLFloaterBulkUpload::LLFloaterBulkUpload(const LLSD& key) mUploadCost = key["upload_cost"].asInteger(); mUploadCount = key["upload_count"].asInteger(); mHas2kTextures = key["has_2k_textures"].asBoolean(); + mDest = key["dest"].asUUID(); + if (key["files"].isArray()) { const LLSD& files = key["files"]; @@ -125,7 +127,7 @@ void LLFloaterBulkUpload::onUpload2KCheckBox() void LLFloaterBulkUpload::onClickUpload() { - do_bulk_upload(mFiles, mAllow2kTextures); + do_bulk_upload(mFiles, mAllow2kTextures, mDest); closeFloater(); } diff --git a/indra/newview/llfloaterbulkupload.h b/indra/newview/llfloaterbulkupload.h index d07dc8eabe..48e07b664f 100644 --- a/indra/newview/llfloaterbulkupload.h +++ b/indra/newview/llfloaterbulkupload.h @@ -61,6 +61,7 @@ private: bool mHas2kTextures = false; S32 mUploadCost = 0; S32 mUploadCount = 0; + LLUUID mDest = LLUUID::null; }; #endif diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index b94c31ec04..7450be45f1 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -118,8 +118,8 @@ std::string STATUS[] = //----------------------------------------------------------------------------- // LLFloaterBvhPreview() //----------------------------------------------------------------------------- -LLFloaterBvhPreview::LLFloaterBvhPreview(const std::string& filename) : - LLFloaterNameDesc(filename) +LLFloaterBvhPreview::LLFloaterBvhPreview(const LLSD& args) : + LLFloaterNameDesc(args) { mLastMouseX = 0; mLastMouseY = 0; @@ -1028,7 +1028,8 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), - expected_upload_cost)); + expected_upload_cost, + floaterp->mDestinationFolderId)); upload_new_resource(assetUploadInfo); } diff --git a/indra/newview/llfloaterbvhpreview.h b/indra/newview/llfloaterbvhpreview.h index ae64521492..c6b75c00b2 100644 --- a/indra/newview/llfloaterbvhpreview.h +++ b/indra/newview/llfloaterbvhpreview.h @@ -70,7 +70,7 @@ protected: class LLFloaterBvhPreview : public LLFloaterNameDesc { public: - LLFloaterBvhPreview(const std::string& filename); + LLFloaterBvhPreview(const LLSD& args); virtual ~LLFloaterBvhPreview(); bool postBuild(); diff --git a/indra/newview/llfloatereditenvironmentbase.h b/indra/newview/llfloatereditenvironmentbase.h index 37fda5d33e..41192f3d30 100644 --- a/indra/newview/llfloatereditenvironmentbase.h +++ b/indra/newview/llfloatereditenvironmentbase.h @@ -133,7 +133,8 @@ protected: LLSettingsEditPanel() : LLPanel(), mIsDirty(false), - mOnDirtyChanged() + mOnDirtyChanged(), + mCanEdit(false) {} private: diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 989e1d8d04..f254fdafaf 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -72,8 +72,8 @@ const S32 PREVIEW_TEXTURE_HEIGHT = 320; //----------------------------------------------------------------------------- // LLFloaterImagePreview() //----------------------------------------------------------------------------- -LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) : - LLFloaterNameDesc(filename), +LLFloaterImagePreview::LLFloaterImagePreview(const LLSD& args) : + LLFloaterNameDesc(args), mAvatarPreview(NULL), mSculptedPreview(NULL), diff --git a/indra/newview/llfloaterimagepreview.h b/indra/newview/llfloaterimagepreview.h index ed395722de..9bc57246cf 100644 --- a/indra/newview/llfloaterimagepreview.h +++ b/indra/newview/llfloaterimagepreview.h @@ -110,7 +110,7 @@ protected: class LLFloaterImagePreview : public LLFloaterNameDesc { public: - LLFloaterImagePreview(const std::string& filename); + LLFloaterImagePreview(const LLSD& args); virtual ~LLFloaterImagePreview(); bool postBuild() override; diff --git a/indra/newview/llfloaterinventorysettings.cpp b/indra/newview/llfloaterinventorysettings.cpp index e5ee69f240..dd46127d9c 100644 --- a/indra/newview/llfloaterinventorysettings.cpp +++ b/indra/newview/llfloaterinventorysettings.cpp @@ -28,9 +28,14 @@ #include "llfloaterinventorysettings.h" +#include "llcolorswatch.h" +#include "llviewercontrol.h" + LLFloaterInventorySettings::LLFloaterInventorySettings(const LLSD& key) : LLFloater(key) { + mCommitCallbackRegistrar.add("ScriptPref.applyUIColor", { boost::bind(&LLFloaterInventorySettings::applyUIColor, this, _1, _2) }); + mCommitCallbackRegistrar.add("ScriptPref.getUIColor", { boost::bind(&LLFloaterInventorySettings::getUIColor, this, _1, _2) }); } LLFloaterInventorySettings::~LLFloaterInventorySettings() @@ -38,7 +43,29 @@ LLFloaterInventorySettings::~LLFloaterInventorySettings() bool LLFloaterInventorySettings::postBuild() { + getChild<LLUICtrl>("favorites_color")->setCommitCallback(boost::bind(&LLFloaterInventorySettings::updateColorSwatch, this)); getChild<LLButton>("ok_btn")->setCommitCallback(boost::bind(&LLFloater::closeFloater, this, false)); + + bool enable_color = gSavedSettings.getBOOL("InventoryFavoritesColorText"); + getChild<LLUICtrl>("favorites_swatch")->setEnabled(enable_color); + return true; } +void LLFloaterInventorySettings::updateColorSwatch() +{ + bool val = getChild<LLUICtrl>("favorites_color")->getValue(); + getChild<LLUICtrl>("favorites_swatch")->setEnabled(val); +} + +void LLFloaterInventorySettings::applyUIColor(LLUICtrl* ctrl, const LLSD& param) +{ + LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); +} + +void LLFloaterInventorySettings::getUIColor(LLUICtrl* ctrl, const LLSD& param) +{ + LLColorSwatchCtrl* color_swatch = (LLColorSwatchCtrl*)ctrl; + color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString())); +} + diff --git a/indra/newview/llfloaterinventorysettings.h b/indra/newview/llfloaterinventorysettings.h index 3fe3a001b9..c27d5d2e1b 100644 --- a/indra/newview/llfloaterinventorysettings.h +++ b/indra/newview/llfloaterinventorysettings.h @@ -40,6 +40,11 @@ public: private: LLFloaterInventorySettings(const LLSD& key); ~LLFloaterInventorySettings(); + + void updateColorSwatch(); + + void applyUIColor(LLUICtrl* ctrl, const LLSD& param); + void getUIColor(LLUICtrl* ctrl, const LLSD& param); }; #endif diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 8332a430e6..b5489d2dd8 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -349,14 +349,14 @@ void LLFloaterModelPreview::initModelPreview() } //static -bool LLFloaterModelPreview::showModelPreview() +void LLFloaterModelPreview::showModelPreview(const LLUUID& dest_folder) { LLFloaterModelPreview* fmp = (LLFloaterModelPreview*)LLFloaterReg::getInstance("upload_model"); if (fmp && !fmp->isModelLoading()) { + fmp->setUploadDestination(dest_folder); fmp->loadHighLodModel(); } - return true; } void LLFloaterModelPreview::onUploadOptionChecked(LLUICtrl* ctrl) @@ -505,7 +505,7 @@ void LLFloaterModelPreview::onClickCalculateBtn() gMeshRepo.uploadModel(mModelPreview->mUploadData, mModelPreview->mPreviewScale, childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions, lock_scale_if_joint_position, - mUploadModelUrl, false, + mUploadModelUrl, mDestinationFolderId, false, getWholeModelFeeObserverHandle()); toggleCalculateButton(false); @@ -1660,7 +1660,7 @@ void LLFloaterModelPreview::onUpload(void* user_data) gMeshRepo.uploadModel(mp->mModelPreview->mUploadData, mp->mModelPreview->mPreviewScale, mp->childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions, lock_scale_if_joint_position, - mp->mUploadModelUrl, + mp->mUploadModelUrl, mp->mDestinationFolderId, true, LLHandle<LLWholeModelFeeObserver>(), mp->getWholeModelUploadObserverHandle()); } @@ -1770,9 +1770,15 @@ void LLFloaterModelPreview::onLoDSourceCommit(S32 lod) if (index == LLModelPreview::MESH_OPTIMIZER_AUTO || index == LLModelPreview::MESH_OPTIMIZER_SLOPPY || index == LLModelPreview::MESH_OPTIMIZER_PRECISE) - { //rebuild LoD to update triangle counts + { + // rebuild LoD to update triangle counts onLODParamCommit(lod, true); } + if (index == LLModelPreview::USE_LOD_ABOVE) + { + // refresh to pick triangle counts + mModelPreview->mDirty = true; + } } void LLFloaterModelPreview::resetDisplayOptions() diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 6adc084fe8..7b652a3613 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -73,7 +73,8 @@ public: /*virtual*/ void reshape(S32 width, S32 height, bool called_from_parent = true); void initModelPreview(); - static bool showModelPreview(); + void setUploadDestination(const LLUUID& dest_folder) { mDestinationFolderId = dest_folder; } + static void showModelPreview(const LLUUID& dest_folder = LLUUID::null); bool handleMouseDown(S32 x, S32 y, MASK mask); bool handleMouseUp(S32 x, S32 y, MASK mask); @@ -164,9 +165,6 @@ protected: static void onPhysicsBrowse(LLUICtrl* ctrl, void* userdata); static void onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata); - static void onPhysicsOptimize(LLUICtrl* ctrl, void* userdata); - static void onPhysicsDecomposeBack(LLUICtrl* ctrl, void* userdata); - static void onPhysicsSimplifyBack(LLUICtrl* ctrl, void* userdata); void draw(); @@ -225,6 +223,7 @@ private: void createSmoothComboBox(LLComboBox* combo_box, float min, float max); + LLUUID mDestinationFolderId; LLButton* mUploadBtn; LLButton* mCalculateBtn; LLViewerTextEditor* mUploadLogText; diff --git a/indra/newview/llfloatermyenvironment.cpp b/indra/newview/llfloatermyenvironment.cpp index b8aa4c6f72..422f056f01 100644 --- a/indra/newview/llfloatermyenvironment.cpp +++ b/indra/newview/llfloatermyenvironment.cpp @@ -38,7 +38,9 @@ #include "llcheckboxctrl.h" #include "llviewerinventory.h" #include "llenvironment.h" +#include "llnotificationsutil.h" #include "llparcel.h" +#include "lltrans.h" #include "llviewerparcelmgr.h" //========================================================================= @@ -223,6 +225,35 @@ void LLFloaterMyEnvironment::onFilterEdit(const std::string& search_string) mInventoryList->setFilterSubString(search_string); } +void LLFloaterMyEnvironment::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, uuid_vec_t item_ids) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + for (const LLUUID& itemid : item_ids) + { + LLInventoryItem* inv_item = gInventory.getItem(itemid); + + if (inv_item && inv_item->getInventoryType() == LLInventoryType::IT_SETTINGS) + { + LLInventoryModel::update_list_t update; + LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1); + update.push_back(old_folder); + LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1); + update.push_back(new_folder); + gInventory.accountForUpdate(update); + + LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item); + new_item->setParent(trash_id); + new_item->updateParentOnServer(false); + gInventory.updateItem(new_item); + } + } + gInventory.notifyObservers(); + } +} + void LLFloaterMyEnvironment::onDeleteSelected() { uuid_vec_t selected; @@ -231,27 +262,16 @@ void LLFloaterMyEnvironment::onDeleteSelected() if (selected.empty()) return; - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - for (const LLUUID& itemid: selected) - { - LLInventoryItem* inv_item = gInventory.getItem(itemid); - - if (inv_item && inv_item->getInventoryType() == LLInventoryType::IT_SETTINGS) + LLSD args; + args["QUESTION"] = LLTrans::getString(selected.size() > 1 ? "DeleteItems" : "DeleteItem"); + LLNotificationsUtil::add( + "DeleteItems", + args, + LLSD(), + [this, selected](const LLSD& notification, const LLSD& response) { - LLInventoryModel::update_list_t update; - LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1); - update.push_back(old_folder); - LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1); - update.push_back(new_folder); - gInventory.accountForUpdate(update); - - LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item); - new_item->setParent(trash_id); - new_item->updateParentOnServer(false); - gInventory.updateItem(new_item); - } - } - gInventory.notifyObservers(); + onItemsRemovalConfirmation(notification, response, selected); + }); } @@ -318,13 +338,13 @@ bool LLFloaterMyEnvironment::canAction(const std::string &context) if (context == PARAMETER_EDIT) { - return (selected.size() == 1) && isSettingSelected(selected.front()); + return (selected.size() == 1) && isSettingId(selected.front()); } else if (context == PARAMETER_COPY) { for (std::vector<LLUUID>::iterator it = selected.begin(); it != selected.end(); it++) { - if(!isSettingSelected(*it)) + if(!isSettingId(*it)) { return false; } @@ -342,7 +362,7 @@ bool LLFloaterMyEnvironment::canAction(const std::string &context) LLClipboard::instance().pasteFromClipboard(ids); for (std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) { - if (!isSettingSelected(*it)) + if (!isSettingId(*it)) { return false; } @@ -351,7 +371,7 @@ bool LLFloaterMyEnvironment::canAction(const std::string &context) } else if (context == PARAMETER_COPYUUID) { - return (selected.size() == 1) && isSettingSelected(selected.front()); + return (selected.size() == 1) && isSettingId(selected.front()); } return false; @@ -367,16 +387,42 @@ bool LLFloaterMyEnvironment::canApply(const std::string &context) if (context == PARAMETER_REGION) { - return LLEnvironment::instance().canAgentUpdateRegionEnvironment(); + return isSettingId(selected.front()) && LLEnvironment::instance().canAgentUpdateRegionEnvironment(); } else if (context == PARAMETER_PARCEL) { - return LLEnvironment::instance().canAgentUpdateParcelEnvironment(); + return isSettingId(selected.front()) && LLEnvironment::instance().canAgentUpdateParcelEnvironment(); } - else + else if (context == PARAMETER_LOCAL) + { + return isSettingId(selected.front()); + } + + return false; +} + +bool can_delete(const LLUUID& id) +{ + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + if (id == trash_id || gInventory.isObjectDescendentOf(id, trash_id)) + { + return false; + } + + LLViewerInventoryCategory* cat = gInventory.getCategory(id); + if (cat) + { + if (!get_is_category_removable(&gInventory, id)) + { + return false; + } + } + else if (!get_is_item_removable(&gInventory, id, true)) { - return (context == PARAMETER_LOCAL); + return false; } + + return true; } //------------------------------------------------------------------------- @@ -389,7 +435,14 @@ void LLFloaterMyEnvironment::refreshButtonStates() getChild<LLUICtrl>(BUTTON_GEAR)->setEnabled(settings_ok); getChild<LLUICtrl>(BUTTON_NEWSETTINGS)->setEnabled(true); - getChild<LLUICtrl>(BUTTON_DELETE)->setEnabled(settings_ok && !selected.empty()); + + bool enable_delete = false; + if(settings_ok && !selected.empty()) + { + enable_delete = can_delete(selected.front()); + } + + getChild<LLUICtrl>(BUTTON_DELETE)->setEnabled(enable_delete); } //------------------------------------------------------------------------- @@ -438,7 +491,7 @@ LLUUID LLFloaterMyEnvironment::findItemByAssetId(LLUUID asset_id, bool copyable_ return LLUUID::null; } -bool LLFloaterMyEnvironment::isSettingSelected(LLUUID item_id) +bool LLFloaterMyEnvironment::isSettingId(const LLUUID& item_id) { LLInventoryItem* itemp = gInventory.getItem(item_id); diff --git a/indra/newview/llfloatermyenvironment.h b/indra/newview/llfloatermyenvironment.h index 8e81b8e5e2..c5d521d207 100644 --- a/indra/newview/llfloatermyenvironment.h +++ b/indra/newview/llfloatermyenvironment.h @@ -60,6 +60,7 @@ private: void onFilterCheckChange(); void onFilterEdit(const std::string& search_string); void onSelectionChange(); + void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, uuid_vec_t item_ids); void onDeleteSelected(); void onDoCreate(const LLSD &data); void onDoApply(const std::string &context); @@ -69,7 +70,7 @@ private: void getSelectedIds(uuid_vec_t& ids) const; void refreshButtonStates(); - bool isSettingSelected(LLUUID item_id); + static bool isSettingId(const LLUUID &item_id); static LLUUID findItemByAssetId(LLUUID asset_id, bool copyable_only, bool ignore_library); }; diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 01c50d89c5..569b41cfa9 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -62,11 +62,20 @@ const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; //----------------------------------------------------------------------------- // LLFloaterNameDesc() //----------------------------------------------------------------------------- -LLFloaterNameDesc::LLFloaterNameDesc(const LLSD& filename ) - : LLFloater(filename), - mIsAudio(false) +LLFloaterNameDesc::LLFloaterNameDesc(const LLSD& args) + : LLFloater(args) + , mIsAudio(false) + , mIsText(false) { - mFilenameAndPath = filename.asString(); + if (args.isString()) + { + mFilenameAndPath = args.asString(); + } + else + { + mFilenameAndPath = args["filename"].asString(); + mDestinationFolderId = args["dest"].asUUID(); + } mFilename = gDirUtilp->getBaseFileName(mFilenameAndPath, false); } @@ -203,7 +212,8 @@ void LLFloaterNameDesc::onBtnOK( ) LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), - expected_upload_cost)); + expected_upload_cost, + mDestinationFolderId)); upload_new_resource(uploadInfo, callback, nruserdata); } @@ -230,8 +240,8 @@ void LLFloaterNameDesc::onBtnCancel() // LLFloaterSoundPreview() //----------------------------------------------------------------------------- -LLFloaterSoundPreview::LLFloaterSoundPreview(const LLSD& filename ) - : LLFloaterNameDesc(filename) +LLFloaterSoundPreview::LLFloaterSoundPreview(const LLSD& args ) + : LLFloaterNameDesc(args) { mIsAudio = true; } @@ -251,8 +261,8 @@ bool LLFloaterSoundPreview::postBuild() // LLFloaterAnimPreview() //----------------------------------------------------------------------------- -LLFloaterAnimPreview::LLFloaterAnimPreview(const LLSD& filename ) - : LLFloaterNameDesc(filename) +LLFloaterAnimPreview::LLFloaterAnimPreview(const LLSD& args ) + : LLFloaterNameDesc(args) { } @@ -270,8 +280,8 @@ bool LLFloaterAnimPreview::postBuild() // LLFloaterScriptPreview() //----------------------------------------------------------------------------- -LLFloaterScriptPreview::LLFloaterScriptPreview(const LLSD& filename ) - : LLFloaterNameDesc(filename) +LLFloaterScriptPreview::LLFloaterScriptPreview(const LLSD& args ) + : LLFloaterNameDesc(args) { mIsText = true; } diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h index aa5571ccc0..a1b9bd3b95 100644 --- a/indra/newview/llfloaternamedesc.h +++ b/indra/newview/llfloaternamedesc.h @@ -39,7 +39,7 @@ class LLRadioGroup; class LLFloaterNameDesc : public LLFloater { public: - LLFloaterNameDesc(const LLSD& filename); + LLFloaterNameDesc(const LLSD& args); virtual ~LLFloaterNameDesc(); bool postBuild() override; @@ -58,26 +58,27 @@ protected: std::string mFilenameAndPath; std::string mFilename; + LLUUID mDestinationFolderId; }; class LLFloaterSoundPreview : public LLFloaterNameDesc { public: - LLFloaterSoundPreview(const LLSD& filename ); + LLFloaterSoundPreview(const LLSD& args ); bool postBuild() override; }; class LLFloaterAnimPreview : public LLFloaterNameDesc { public: - LLFloaterAnimPreview(const LLSD& filename ); + LLFloaterAnimPreview(const LLSD& args ); bool postBuild() override; }; class LLFloaterScriptPreview : public LLFloaterNameDesc { public: - LLFloaterScriptPreview(const LLSD& filename ); + LLFloaterScriptPreview(const LLSD& args ); bool postBuild() override; }; diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp index 26b7304b9a..21aaed14c8 100644 --- a/indra/newview/llfloaterobjectweights.cpp +++ b/indra/newview/llfloaterobjectweights.cpp @@ -36,6 +36,14 @@ #include "llviewerparcelmgr.h" #include "llviewerregion.h" +static const std::string lod_strings[4] = +{ + "lowest_lod", + "low_lod", + "medium_lod", + "high_lod", +}; + // virtual bool LLCrossParcelFunctor::apply(LLViewerObject* obj) { @@ -75,7 +83,10 @@ LLFloaterObjectWeights::LLFloaterObjectWeights(const LLSD& key) mSelectedOnLand(NULL), mRezzedOnLand(NULL), mRemainingCapacity(NULL), - mTotalCapacity(NULL) + mTotalCapacity(NULL), + mLodLevel(nullptr), + mTrianglesShown(nullptr), + mPixelArea(nullptr) { } @@ -99,6 +110,10 @@ bool LLFloaterObjectWeights::postBuild() mRemainingCapacity = getChild<LLTextBox>("remaining_capacity"); mTotalCapacity = getChild<LLTextBox>("total_capacity"); + mLodLevel = getChild<LLTextBox>("lod_level"); + mTrianglesShown = getChild<LLTextBox>("triangles_shown"); + mPixelArea = getChild<LLTextBox>("pixel_area"); + return true; } @@ -135,6 +150,69 @@ void LLFloaterObjectWeights::setErrorStatus(S32 status, const std::string& reaso toggleWeightsLoadingIndicators(false); } +void LLFloaterObjectWeights::draw() +{ + // Normally it's a bad idea to set text and visibility inside draw + // since it can cause rect updates go to different, already drawn elements, + // but floater is very simple and these elements are supposed to be isolated + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (selection->isEmpty()) + { + const std::string text = getString("nothing_selected"); + mLodLevel->setText(text); + mTrianglesShown->setText(text); + mPixelArea->setText(text); + + toggleRenderLoadingIndicators(false); + } + else + { + S32 object_lod = -1; + bool multiple_lods = false; + S32 total_tris = 0; + S32 pixel_area = 0; + for (LLObjectSelection::valid_root_iterator iter = selection->valid_root_begin(); + iter != selection->valid_root_end(); ++iter) + { + LLViewerObject* object = (*iter)->getObject(); + S32 lod = object->getLOD(); + if (object_lod < 0) + { + object_lod = lod; + } + else if (object_lod != lod) + { + multiple_lods = true; + } + + if (object->isRootEdit()) + { + total_tris += object->recursiveGetTriangleCount(); + pixel_area += static_cast<S32>(object->getPixelArea()); + } + } + + if (multiple_lods) + { + mLodLevel->setText(getString("multiple_lods")); + toggleRenderLoadingIndicators(false); + } + else if (object_lod < 0) + { + // nodes are waiting for data + toggleRenderLoadingIndicators(true); + } + else + { + mLodLevel->setText(getString(lod_strings[object_lod])); + toggleRenderLoadingIndicators(false); + } + mTrianglesShown->setText(llformat("%d", total_tris)); + mPixelArea->setText(llformat("%d", pixel_area)); + } + LLFloater::draw(); +} + void LLFloaterObjectWeights::updateLandImpacts(const LLParcel* parcel) { if (!parcel || LLSelectMgr::getInstance()->getSelection()->isEmpty()) @@ -252,6 +330,17 @@ void LLFloaterObjectWeights::toggleLandImpactsLoadingIndicators(bool visible) mTotalCapacity->setVisible(!visible); } +void LLFloaterObjectWeights::toggleRenderLoadingIndicators(bool visible) +{ + childSetVisible("lod_level_loading_indicator", visible); + childSetVisible("triangles_shown_loading_indicator", visible); + childSetVisible("pixel_area_loading_indicator", visible); + + mLodLevel->setVisible(!visible); + mTrianglesShown->setVisible(!visible); + mPixelArea->setVisible(!visible); +} + void LLFloaterObjectWeights::updateIfNothingSelected() { const std::string text = getString("nothing_selected"); @@ -269,6 +358,11 @@ void LLFloaterObjectWeights::updateIfNothingSelected() mRemainingCapacity->setText(text); mTotalCapacity->setText(text); + mLodLevel->setText(text); + mTrianglesShown->setText(text); + mPixelArea->setText(text); + toggleWeightsLoadingIndicators(false); toggleLandImpactsLoadingIndicators(false); + toggleRenderLoadingIndicators(false); } diff --git a/indra/newview/llfloaterobjectweights.h b/indra/newview/llfloaterobjectweights.h index 3b999f6b9b..bda625564b 100644 --- a/indra/newview/llfloaterobjectweights.h +++ b/indra/newview/llfloaterobjectweights.h @@ -58,21 +58,24 @@ public: LLFloaterObjectWeights(const LLSD& key); ~LLFloaterObjectWeights(); - /*virtual*/ bool postBuild(); + bool postBuild() override; - /*virtual*/ void onOpen(const LLSD& key); + void onOpen(const LLSD& key) override; - /*virtual*/ void onWeightsUpdate(const SelectionCost& selection_cost); - /*virtual*/ void setErrorStatus(S32 status, const std::string& reason); + void onWeightsUpdate(const SelectionCost& selection_cost) override; + void setErrorStatus(S32 status, const std::string& reason) override; + + void draw() override; void updateLandImpacts(const LLParcel* parcel); - void refresh(); + void refresh() override; private: - /*virtual*/ void generateTransactionID(); + void generateTransactionID() override; void toggleWeightsLoadingIndicators(bool visible); void toggleLandImpactsLoadingIndicators(bool visible); + void toggleRenderLoadingIndicators(bool visible); void updateIfNothingSelected(); @@ -88,6 +91,10 @@ private: LLTextBox *mRezzedOnLand; LLTextBox *mRemainingCapacity; LLTextBox *mTotalCapacity; + + LLTextBox *mLodLevel; + LLTextBox *mTrianglesShown; + LLTextBox *mPixelArea; }; #endif //LL_LLFLOATEROBJECTWEIGHTS_H diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index d7ac8f0552..2bfe7aabc9 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -2004,7 +2004,21 @@ void LLFloaterPreference::selectChatPanel() void LLFloaterPreference::changed() { - getChild<LLButton>("clear_log")->setEnabled(LLConversationLog::instance().getConversations().size() > 0); + if (LLConversationLog::instance().getIsLoggingEnabled()) + { + getChild<LLButton>("clear_log")->setEnabled(LLConversationLog::instance().getConversations().size() > 0); + } + else + { + // onClearLog clears list, then notifies changed() and only then clears file, + // so check presence of conversations before checking file, file will cleared later. + llstat st; + bool has_logs = LLConversationLog::instance().getConversations().size() > 0 + && LLFile::stat(LLConversationLog::instance().getFileName(), &st) == 0 + && S_ISREG(st.st_mode) + && st.st_size > 0; + getChild<LLButton>("clear_log")->setEnabled(has_logs); + } // set 'enable' property for 'Delete transcripts...' button updateDeleteTranscriptsButton(); diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index c668d414d3..9223c13ec1 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -68,9 +68,10 @@ void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) if (!folder->areChildrenInited() || !needsSort(folder->getViewModelItem())) return; - LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(folder->getViewModelItem()); - if (modelp->getUUID().isNull()) return; + LLFolderViewModelItemInventory* sort_modelp = static_cast<LLFolderViewModelItemInventory*>(folder->getViewModelItem()); + if (sort_modelp->getUUID().isNull()) return; + bool has_favorites = false; for (std::list<LLFolderViewFolder*>::iterator it = folder->getFoldersBegin(), end_it = folder->getFoldersEnd(); it != end_it; ++it) @@ -79,11 +80,14 @@ void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) LLFolderViewFolder* child_folderp = *it; sort(child_folderp); + LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(child_folderp->getViewModelItem()); + has_favorites |= child_folderp->isFavorite() || child_folderp->hasFavorites(); + if (child_folderp->getFoldersCount() > 0) { - time_t most_recent_folder_time = - static_cast<LLFolderViewModelItemInventory*>((*child_folderp->getFoldersBegin())->getViewModelItem())->getCreationDate(); - LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(child_folderp->getViewModelItem()); + LLFolderViewModelItemInventory* folderp = static_cast<LLFolderViewModelItemInventory*>((*child_folderp->getFoldersBegin())->getViewModelItem()); + time_t most_recent_folder_time = folderp->getCreationDate(); + if (most_recent_folder_time > modelp->getCreationDate()) { modelp->setCreationDate(most_recent_folder_time); @@ -91,16 +95,26 @@ void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) } if (child_folderp->getItemsCount() > 0) { - time_t most_recent_item_time = - static_cast<LLFolderViewModelItemInventory*>((*child_folderp->getItemsBegin())->getViewModelItem())->getCreationDate(); + LLFolderViewModelItemInventory* itemp = static_cast<LLFolderViewModelItemInventory*>((*child_folderp->getItemsBegin())->getViewModelItem()); + time_t most_recent_item_time = itemp->getCreationDate(); - LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(child_folderp->getViewModelItem()); if (most_recent_item_time > modelp->getCreationDate()) { modelp->setCreationDate(most_recent_item_time); } } } + for (std::list<LLFolderViewItem*>::const_iterator it = folder->getItemsBegin(), end_it = folder->getItemsEnd(); + it != end_it && !has_favorites; + ++it) + { + LLFolderViewItem* child_itemp = *it; + has_favorites |= child_itemp->isFavorite(); + } + if (has_favorites) + { + folder->updateHasFavorites(true); + } base_t::sort(folder); } diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h index 48b4ee5fd9..04b0b6e8f4 100644 --- a/indra/newview/llfolderviewmodelinventory.h +++ b/indra/newview/llfolderviewmodelinventory.h @@ -48,6 +48,7 @@ public: virtual bool isItemInTrash( void) const { return false; } // TODO: make into pure virtual. virtual bool isItemInOutfits() const { return false; } virtual bool isAgentInventory() const { return false; } + virtual bool isAgentInventoryRoot() const { return false; } virtual bool isUpToDate() const = 0; virtual void addChild(LLFolderViewModelItem* child); virtual bool hasChildren() const = 0; diff --git a/indra/newview/llgltffolderitem.h b/indra/newview/llgltffolderitem.h index 89d90c81cc..a748e2fb6a 100644 --- a/indra/newview/llgltffolderitem.h +++ b/indra/newview/llgltffolderitem.h @@ -71,6 +71,7 @@ public: void navigateToFolder(bool new_window = false, bool change_mode = false) override {} + bool isFavorite() const override { return false; } bool isItemWearable() const override { return false; } bool isItemRenameable() const override { return false; } @@ -80,6 +81,7 @@ public: void move(LLFolderViewModelItem* parent_listener) override {} bool isItemRemovable(bool check_worn = true) const override { return false; } + bool isItemInTrash(void) const override { return false; } bool removeItem() override { return false; } void removeBatch(std::vector<LLFolderViewModelItem*>& batch) override {} @@ -92,6 +94,9 @@ public: void pasteFromClipboard() override {} void pasteLinkFromClipboard() override {} + bool isAgentInventory() const override { return false; } + bool isAgentInventoryRoot() const override { return false; } + void buildContextMenu(LLMenuGL& menu, U32 flags) override {}; bool potentiallyVisible() override { return true; }; // is the item definitely visible or we haven't made up our minds yet? diff --git a/indra/newview/llhudeffectresetskeleton.cpp b/indra/newview/llhudeffectresetskeleton.cpp new file mode 100644 index 0000000000..31065a3e76 --- /dev/null +++ b/indra/newview/llhudeffectresetskeleton.cpp @@ -0,0 +1,211 @@ +/** + * @file llhudeffectresetskeleton.cpp + * @brief LLHUDEffectResetSkeleton class implementation + * + * $LicenseInfo:firstyear=2024&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2024, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llhudeffectresetskeleton.h" + +#include "llagent.h" +#include "llviewerobjectlist.h" +#include "llvoavatar.h" +#include "message.h" + +// packet layout +const S32 TARGET_OBJECT = 0; // This is to allow for targetting owned animesh +const S32 RESET_ANIMATIONS = 16; //This can also be a flags if needed +const S32 PKT_SIZE = 17; + +//----------------------------------------------------------------------------- +// LLHUDEffectResetSkeleton() +//----------------------------------------------------------------------------- +LLHUDEffectResetSkeleton::LLHUDEffectResetSkeleton(const U8 type) : + LLHUDEffect(type) +{ +} + +//----------------------------------------------------------------------------- +// ~LLHUDEffectResetSkeleton() +//----------------------------------------------------------------------------- +LLHUDEffectResetSkeleton::~LLHUDEffectResetSkeleton() +{ +} + +//----------------------------------------------------------------------------- +// packData() +//----------------------------------------------------------------------------- +void LLHUDEffectResetSkeleton::packData(LLMessageSystem *mesgsys) +{ + // Pack the default data + LLHUDEffect::packData(mesgsys); + + // Pack the type-specific data. Uses a fun packed binary format. Whee! + U8 packed_data[PKT_SIZE]; + memset(packed_data, 0, PKT_SIZE); + + // pack both target object and position + // position interpreted as offset if target object is non-null + if (mTargetObject) + { + htolememcpy(&(packed_data[TARGET_OBJECT]), mTargetObject->mID.mData, MVT_LLUUID, 16); + } + else + { + htolememcpy(&(packed_data[TARGET_OBJECT]), LLUUID::null.mData, MVT_LLUUID, 16); + } + + U8 resetAnimations = (U8)mResetAnimations; + htolememcpy(&(packed_data[RESET_ANIMATIONS]), &resetAnimations, MVT_U8, 1); + + mesgsys->addBinaryDataFast(_PREHASH_TypeData, packed_data, PKT_SIZE); +} + +//----------------------------------------------------------------------------- +// unpackData() +//----------------------------------------------------------------------------- +void LLHUDEffectResetSkeleton::unpackData(LLMessageSystem *mesgsys, S32 blocknum) +{ + LLVector3d new_target; + U8 packed_data[PKT_SIZE]; + + + LLHUDEffect::unpackData(mesgsys, blocknum); + + LLUUID source_id; + mesgsys->getUUIDFast(_PREHASH_Effect, _PREHASH_AgentID, source_id, blocknum); + + LLViewerObject *objp = gObjectList.findObject(source_id); + if (objp && objp->isAvatar()) + { + setSourceObject(objp); + } + else + { + //LL_WARNS() << "Could not find source avatar for ResetSkeleton effect" << LL_ENDL; + return; + } + + S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData); + if (size != PKT_SIZE) + { + LL_WARNS() << "ResetSkeleton effect with bad size " << size << LL_ENDL; + return; + } + + mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, PKT_SIZE, blocknum); + + LLUUID target_id; + htolememcpy(target_id.mData, &(packed_data[TARGET_OBJECT]), MVT_LLUUID, 16); + + // The purpose for having a target ID is if we want to reset animesh, or + // other things in the future. + // I implemented this, but due to issues regarding various permission + // checks, I scrapped it for now. --Chaser Zaks + // See https://github.com/secondlife/viewer/pull/1212 for additional info + + if (target_id.isNull()) + { + target_id = source_id; + } + + objp = gObjectList.findObject(target_id); + + if (objp) + { + setTargetObject(objp); + } + + U8 resetAnimations = 0; + htolememcpy(&resetAnimations, &(packed_data[RESET_ANIMATIONS]), MVT_U8, 1); + + // Pre-emptively assume this is going to be flags in the future. + // It isn't needed now, but this will assure that only bit 1 is set + mResetAnimations = resetAnimations & 1; + + update(); +} + +//----------------------------------------------------------------------------- +// setTargetObjectAndOffset() +//----------------------------------------------------------------------------- +void LLHUDEffectResetSkeleton::setTargetObject(LLViewerObject *objp) +{ + mTargetObject = objp; +} + + +//----------------------------------------------------------------------------- +// markDead() +//----------------------------------------------------------------------------- +void LLHUDEffectResetSkeleton::markDead() +{ + LLHUDEffect::markDead(); +} + +void LLHUDEffectResetSkeleton::setSourceObject(LLViewerObject* objectp) +{ + // restrict source objects to avatars + if (objectp && objectp->isAvatar()) + { + LLHUDEffect::setSourceObject(objectp); + } +} + +//----------------------------------------------------------------------------- +// update() +//----------------------------------------------------------------------------- +void LLHUDEffectResetSkeleton::update() +{ + // If the target object is dead, set the target object to NULL + if (mTargetObject.isNull() || mTargetObject->isDead()) + { + markDead(); + return; + } + + if (mSourceObject.isNull() || mSourceObject->isDead()) + { + markDead(); + return; + } + + if (mTargetObject->isAvatar()) + { + // Only the owner of a avatar can reset their skeleton like this + // Also allow reset if we created the effect (Local resetting) + if (mSourceObject->getID() == mTargetObject->getID() || getOriginatedHere()) + { + LLVOAvatar* avatar = mTargetObject->asAvatar(); + avatar->resetSkeleton(mResetAnimations); + } + } + else + { + LL_WARNS() << mSourceObject->getID() << " attempted to reset skeleton on " + << mTargetObject->getID() << ", but it is not a avatar!" << LL_ENDL; + } + + markDead(); +} diff --git a/indra/newview/llhudeffectresetskeleton.h b/indra/newview/llhudeffectresetskeleton.h new file mode 100644 index 0000000000..39a6137054 --- /dev/null +++ b/indra/newview/llhudeffectresetskeleton.h @@ -0,0 +1,59 @@ +/** + * @file llhudeffectresetskeleton.h + * @brief LLHUDEffectResetSkeleton class definition + * + * $LicenseInfo:firstyear=2024&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2024, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLHUDEFFECTRESETSKELETON_H +#define LL_LLHUDEFFECTRESETSKELETON_H + +#include "llhudeffect.h" + +class LLViewerObject; +class LLVOAvatar; + + +class LLHUDEffectResetSkeleton final : public LLHUDEffect +{ +public: + friend class LLHUDObject; + + /*virtual*/ void markDead(); + /*virtual*/ void setSourceObject(LLViewerObject* objectp); + + void setTargetObject(LLViewerObject *objp); + void setResetAnimations(bool enable){ mResetAnimations = enable; }; + +protected: + LLHUDEffectResetSkeleton(const U8 type); + ~LLHUDEffectResetSkeleton(); + + /*virtual*/ void packData(LLMessageSystem *mesgsys); + /*virtual*/ void unpackData(LLMessageSystem *mesgsys, S32 blocknum); + + void update(); +private: + bool mResetAnimations; +}; + +#endif // LL_LLHUDEFFECTRESETSKELETON_H diff --git a/indra/newview/llhudobject.cpp b/indra/newview/llhudobject.cpp index e6fbfbfb38..04e9e2dff2 100644 --- a/indra/newview/llhudobject.cpp +++ b/indra/newview/llhudobject.cpp @@ -36,6 +36,7 @@ #include "llhudeffecttrail.h" #include "llhudeffectlookat.h" #include "llhudeffectpointat.h" +#include "llhudeffectresetskeleton.h" #include "llhudnametag.h" #include "llvoicevisualizer.h" @@ -241,6 +242,9 @@ LLHUDEffect *LLHUDObject::addHUDEffect(const U8 type) case LL_HUD_EFFECT_BLOB: hud_objectp = new LLHUDEffectBlob(type); break; + case LL_HUD_EFFECT_RESET_SKELETON: + hud_objectp = new LLHUDEffectResetSkeleton(type); + break; default: LL_WARNS() << "Unknown type of hud effect:" << (U32) type << LL_ENDL; } diff --git a/indra/newview/llhudobject.h b/indra/newview/llhudobject.h index 8c628e3f92..f683f21e96 100644 --- a/indra/newview/llhudobject.h +++ b/indra/newview/llhudobject.h @@ -96,7 +96,8 @@ public: LL_HUD_EFFECT_POINTAT, LL_HUD_EFFECT_VOICE_VISUALIZER, // Ventrella LL_HUD_NAME_TAG, - LL_HUD_EFFECT_BLOB + LL_HUD_EFFECT_BLOB, + LL_HUD_EFFECT_RESET_SKELETON }; protected: static void sortObjects(); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index beb32dd6fb..4fcbc91ffd 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1690,6 +1690,8 @@ bool LLIMModel::logToFile(const std::string& file_name, const std::string& from, } else { + // will check KeepConversationLogTranscripts on its own + LLConversationLog::instance().cache(); return false; } } diff --git a/indra/newview/llinspecttexture.cpp b/indra/newview/llinspecttexture.cpp index 24dbe61bad..0482befdcb 100644 --- a/indra/newview/llinspecttexture.cpp +++ b/indra/newview/llinspecttexture.cpp @@ -115,7 +115,6 @@ public: protected: LLPointer<LLViewerFetchedTexture> m_Image; - S32 mImageBoostLevel = LLGLTexture::BOOST_NONE; std::string mLoadingText; }; @@ -128,11 +127,7 @@ LLTexturePreviewView::LLTexturePreviewView(const LLView::Params& p) LLTexturePreviewView::~LLTexturePreviewView() { - if (m_Image) - { - m_Image->setBoostLevel(mImageBoostLevel); - m_Image = nullptr; - } + m_Image = nullptr; } void LLTexturePreviewView::draw() @@ -153,19 +148,19 @@ void LLTexturePreviewView::draw() bool isLoading = (!m_Image->isFullyLoaded()) && (m_Image->getDiscardLevel() > 0); if (isLoading) LLFontGL::getFontSansSerif()->renderUTF8(mLoadingText, 0, rctClient.mLeft + 3, rctClient.mTop - 25, LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW); - m_Image->addTextureStats((isLoading) ? MAX_IMAGE_AREA : (F32)(rctClient.getWidth() * rctClient.getHeight())); + + m_Image->setKnownDrawSize(MAX_IMAGE_SIZE, MAX_IMAGE_SIZE); } } void LLTexturePreviewView::setImageFromAssetId(const LLUUID& idAsset) { - m_Image = LLViewerTextureManager::getFetchedTexture(idAsset, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + m_Image = LLViewerTextureManager::getFetchedTexture(idAsset, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_THUMBNAIL); if (m_Image) { - mImageBoostLevel = m_Image->getBoostLevel(); - m_Image->setBoostLevel(LLGLTexture::BOOST_PREVIEW); m_Image->forceToSaveRawImage(0); - if ( (!m_Image->isFullyLoaded()) && (!m_Image->hasFetcher()) ) + m_Image->setKnownDrawSize(MAX_IMAGE_SIZE, MAX_IMAGE_SIZE); + if ((!m_Image->isFullyLoaded()) && (!m_Image->hasFetcher())) { if (m_Image->isInFastCacheList()) { @@ -179,7 +174,7 @@ void LLTexturePreviewView::setImageFromAssetId(const LLUUID& idAsset) void LLTexturePreviewView::setImageFromItemId(const LLUUID& idItem) { const LLViewerInventoryItem* pItem = gInventory.getItem(idItem); - setImageFromAssetId( (pItem) ? pItem->getAssetUUID() : LLUUID::null ); + setImageFromAssetId( (pItem) ? pItem->getAssetUUID() : LLUUID::null); } // ============================================================================ diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 2deb7caad5..9a38355858 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -830,6 +830,8 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, { const LLInventoryObject *obj = getInventoryObject(); bool single_folder_root = (mRoot == NULL); + bool is_cof = isCOFFolder(); + bool is_inbox = isInboxFolder(); if (obj) { @@ -844,7 +846,8 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, disabled_items.push_back(std::string("Copy")); } - if (isAgentInventory() && !single_folder_root && !isMarketplaceListingsFolder()) + bool is_agent_inventory = isAgentInventory(); + if (is_agent_inventory && !single_folder_root && !is_cof && !is_inbox && !isMarketplaceListingsFolder()) { items.push_back(std::string("New folder from selected")); items.push_back(std::string("Subfolder Separator")); @@ -857,6 +860,19 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, } } + if (isFavorite()) + { + items.push_back(std::string("Remove from Favorites")); + } + else if (is_agent_inventory && !gInventory.isObjectDescendentOf(mUUID, gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH))) + { + items.push_back(std::string("Add to Favorites")); + if (gInventory.getRootFolderID() == mUUID) + { + disabled_items.push_back(std::string("Add to Favorites")); + } + } + if (obj->getIsLinkType()) { items.push_back(std::string("Find Original")); @@ -869,6 +885,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, if (!isItemMovable() || !canMenuCut()) { disabled_items.push_back(std::string("Cut")); + disabled_items.push_back(std::string("New folder from selected")); } } else @@ -878,7 +895,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, items.push_back(std::string("Find Links")); } - if (!isInboxFolder() && !single_folder_root) + if (!is_inbox && !single_folder_root) { items.push_back(std::string("Rename")); if (!isItemRenameable() || ((flags & FIRST_SELECTED_ITEM) == 0)) @@ -918,6 +935,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, if (!isItemMovable() || !canMenuCut()) { disabled_items.push_back(std::string("Cut")); + disabled_items.push_back(std::string("New folder from selected")); } if (canListOnMarketplace() && !isMarketplaceListingsFolder() && !isInboxFolder()) @@ -940,7 +958,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, } // Don't allow items to be pasted directly into the COF or the inbox - if (!isCOFFolder() && !isInboxFolder()) + if (!is_cof && !is_inbox) { items.push_back(std::string("Paste")); } @@ -1334,6 +1352,13 @@ bool LLInvFVBridge::isAgentInventory() const return model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID()); } +bool LLInvFVBridge::isAgentInventoryRoot() const +{ + const LLInventoryModel* model = getInventoryModel(); + if(!model) return false; + return gInventory.getRootFolderID() == mUUID; +} + bool LLInvFVBridge::isCOFFolder() const { return LLAppearanceMgr::instance().getIsInCOF(mUUID); @@ -2281,6 +2306,21 @@ const LLUUID& LLItemBridge::getThumbnailUUID() const return LLUUID::null; } +bool LLItemBridge::isFavorite() const +{ + LLViewerInventoryItem* item = NULL; + LLInventoryModel* model = getInventoryModel(); + if (model) + { + item = model->getItem(mUUID); + } + if (item) + { + return get_is_favorite(item); + } + return false; +} + // virtual bool LLItemBridge::isItemPermissive() const { @@ -2426,6 +2466,16 @@ const LLUUID& LLFolderBridge::getThumbnailUUID() const return LLUUID::null; } +bool LLFolderBridge::isFavorite() const +{ + LLViewerInventoryCategory* cat = getCategory(); + if (cat) + { + return cat->getIsFavorite(); + } + return false; +} + void LLFolderBridge::update() { // we know we have children but haven't fetched them (doesn't obey filter) @@ -4298,6 +4348,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items } disabled_items.push_back(std::string("New Folder")); + disabled_items.push_back(std::string("upload_options")); disabled_items.push_back(std::string("upload_def")); disabled_items.push_back(std::string("create_new")); } @@ -4323,6 +4374,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items { disabled_items.push_back(std::string("New Folder")); disabled_items.push_back(std::string("New Listing Folder")); + disabled_items.push_back(std::string("upload_options")); disabled_items.push_back(std::string("upload_def")); disabled_items.push_back(std::string("create_new")); } @@ -4389,6 +4441,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items } if (!isMarketplaceListingsFolder()) { + items.push_back(std::string("upload_options")); items.push_back(std::string("upload_def")); items.push_back(std::string("create_new")); items.push_back(std::string("New Script")); @@ -4422,6 +4475,15 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items items.push_back(std::string("Rename")); items.push_back(std::string("thumbnail")); + if (cat->getIsFavorite()) + { + items.push_back(std::string("Remove from Favorites")); + } + else + { + items.push_back(std::string("Add to Favorites")); + } + addDeleteContextMenuOptions(items, disabled_items); // EXT-4030: disallow deletion of currently worn outfit const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink(); @@ -6929,7 +6991,7 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action) else if(item && item->isFinished()) { // must be in library. copy it to our inventory and put it on. - LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0)); + LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0, true)); copy_inventory_item( gAgent.getID(), item->getPermissions().getOwner(), @@ -8054,7 +8116,8 @@ void LLObjectBridgeAction::attachOrDetach() } else { - LLAppearanceMgr::instance().wearItemOnAvatar(mUUID, true, false); // Don't replace if adding. + static LLCachedControl<bool> inventory_linking(gSavedSettings, "InventoryAddAttachmentBehavior", false); + LLAppearanceMgr::instance().wearItemOnAvatar(mUUID, true, inventory_linking()); // Don't replace if adding. } } @@ -8245,6 +8308,7 @@ void LLRecentItemsFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) buildContextMenuOptions(flags, items, disabled_items); items.erase(std::remove(items.begin(), items.end(), std::string("New Folder")), items.end()); + items.erase(std::remove(items.begin(), items.end(), std::string("New folder from selected")), items.end()); hide_context_entries(menu, items, disabled_items); } @@ -8279,6 +8343,51 @@ LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge( return new_listener; } +/************************************************************************/ +/* Favorites Inventory Panel related classes */ +/************************************************************************/ +void LLFavoritesFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + // todo: consider things that should be disabled + menuentry_vec_t disabled_items, items; + buildContextMenuOptions(flags, items, disabled_items); + + items.erase(std::remove(items.begin(), items.end(), std::string("New Folder")), items.end()); + items.erase(std::remove(items.begin(), items.end(), std::string("New folder from selected")), items.end()); + + hide_context_entries(menu, items, disabled_items); +} + +LLInvFVBridge* LLFavoritesInventoryBridgeBuilder::createBridge( + LLAssetType::EType asset_type, + LLAssetType::EType actual_asset_type, + LLInventoryType::EType inv_type, + LLInventoryPanel* inventory, + LLFolderViewModelInventory* view_model, + LLFolderView* root, + const LLUUID& uuid, + U32 flags /*= 0x00*/) const +{ + LLInvFVBridge* new_listener = NULL; + if (asset_type == LLAssetType::AT_CATEGORY + && actual_asset_type != LLAssetType::AT_LINK_FOLDER) + { + new_listener = new LLFavoritesFolderBridge(inv_type, inventory, root, uuid); + } + else + { + new_listener = LLInventoryFolderViewModelBuilder::createBridge(asset_type, + actual_asset_type, + inv_type, + inventory, + view_model, + root, + uuid, + flags); + } + return new_listener; +} + LLFolderViewGroupedItemBridge::LLFolderViewGroupedItemBridge() { } @@ -8289,7 +8398,7 @@ void LLFolderViewGroupedItemBridge::groupFilterContextMenu(folder_view_item_dequ menuentry_vec_t disabled_items; if (get_selection_item_uuids(selected_items, ids)) { - if (!LLAppearanceMgr::instance().canAddWearables(ids) && canWearSelected(ids)) + if (!LLAppearanceMgr::instance().canAddWearables(ids, false) && canWearSelected(ids)) { disabled_items.push_back(std::string("Wearable And Object Wear")); disabled_items.push_back(std::string("Wearable Add")); diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 3e7f74384b..1b80ac163c 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -86,6 +86,7 @@ public: //-------------------------------------------------------------------- virtual const LLUUID& getUUID() const { return mUUID; } virtual const LLUUID& getThumbnailUUID() const { return LLUUID::null; } + virtual bool isFavorite() const { return false; } virtual void clearDisplayName() { mDisplayName.clear(); } virtual void restoreItem() {} virtual void restoreToWorld() {} @@ -175,6 +176,7 @@ protected: bool isLinkedObjectMissing() const; // Is this a linked obj whose baseobj is not in inventory? bool isAgentInventory() const; // false if lost or in the inventory library + bool isAgentInventoryRoot() const; // true if worn by agent bool isCOFFolder() const; // true if COF or descendant of bool isInboxFolder() const; // true if COF or descendant of marketplace inbox @@ -259,6 +261,7 @@ public: LLViewerInventoryItem* getItem() const; virtual const LLUUID& getThumbnailUUID() const; + virtual bool isFavorite() const; protected: bool confirmRemoveItem(const LLSD& notification, const LLSD& response); @@ -301,6 +304,7 @@ public: virtual std::string getLabelSuffix() const; virtual LLFontGL::StyleFlags getLabelStyle() const; virtual const LLUUID& getThumbnailUUID() const; + virtual bool isFavorite() const; void setShowDescendantsCount(bool show_count) {mShowDescendantsCount = show_count;} @@ -754,6 +758,45 @@ public: }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Favorites Inventory Panel related classes +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +// Overridden version of the Inventory-Folder-View-Bridge for Folders +class LLFavoritesFolderBridge : public LLFolderBridge +{ + friend class LLInvFVBridgeAction; +public: + // Creates context menu for Folders related to Recent Inventory Panel. + // Uses base logic and than removes from visible items "New..." menu items. + LLFavoritesFolderBridge(LLInventoryType::EType type, + LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid) : + LLFolderBridge(inventory, root, uuid) + { + mInvType = type; + } + /*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags); +}; + +// Bridge builder to create Inventory-Folder-View-Bridge for Recent Inventory Panel +class LLFavoritesInventoryBridgeBuilder : public LLInventoryFolderViewModelBuilder +{ +public: + LLFavoritesInventoryBridgeBuilder() {} + // Overrides FolderBridge for Recent Inventory Panel. + // It use base functionality for bridges other than FolderBridge. + virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type, + LLAssetType::EType actual_asset_type, + LLInventoryType::EType inv_type, + LLInventoryPanel* inventory, + LLFolderViewModelInventory* view_model, + LLFolderView* root, + const LLUUID& uuid, + U32 flags = 0x00) const; +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Marketplace Inventory Panel related classes //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -780,7 +823,7 @@ private: void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment, - bool replace = false); + bool replace); // Move items from an in-world object's "Contents" folder to a specified // folder in agent inventory. diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 01f2c6c525..99c2d6e410 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -64,6 +64,7 @@ LLInventoryFilter::FilterOps::FilterOps(const Params& p) mFilterUUID(p.uuid), mFilterLinks(p.links), mFilterThumbnails(p.thumbnails), + mFilterFavorites(p.favorites), mSearchVisibility(p.search_visibility) { } @@ -159,6 +160,7 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) passed = passed && checkAgainstCreator(listener); passed = passed && checkAgainstSearchVisibility(listener); + passed = passed && checkAgainstFilterFavorites(listener->getUUID()); passed = passed && checkAgainstFilterThumbnails(listener->getUUID()); return passed; @@ -221,6 +223,19 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const return false; } + const LLViewerInventoryCategory* cat = gInventory.getCategory(folder_id); + if (cat && cat->getIsFavorite()) + { + if (mFilterOps.mFilterFavorites == FILTER_ONLY_FAVORITES) + { + return true; + } + if (mFilterOps.mFilterFavorites == FILTER_EXCLUDE_FAVORITES) + { + return false; + } + } + // Marketplace folder filtering const U32 filterTypes = mFilterOps.mFilterTypes; const U32 marketplace_filter = FILTERTYPE_MARKETPLACE_ACTIVE | FILTERTYPE_MARKETPLACE_INACTIVE | @@ -273,6 +288,16 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const } } + if (filterTypes & FILTERTYPE_NO_TRASH_ITEMS) + { + const LLUUID trash_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + // If not a descendant of the marketplace listings root, then the nesting depth is -1 by definition + if (gInventory.isObjectDescendentOf(folder_id, trash_uuid)) + { + return false; + } + } + // show folder links LLViewerInventoryItem* item = gInventory.getItem(folder_id); if (item && item->getActualType() == LLAssetType::AT_LINK_FOLDER) @@ -611,6 +636,24 @@ bool LLInventoryFilter::checkAgainstFilterThumbnails(const LLUUID& object_id) co return true; } +bool LLInventoryFilter::checkAgainstFilterFavorites(const LLUUID& object_id) const +{ + const LLInventoryObject* object = gInventory.getObject(object_id); + if (!object) return true; + + + if (mFilterOps.mFilterFavorites != FILTER_INCLUDE_FAVORITES) + { + bool is_favorite = get_is_favorite(object); + if (is_favorite && (mFilterOps.mFilterFavorites == FILTER_EXCLUDE_FAVORITES)) + return false; + if (!is_favorite && (mFilterOps.mFilterFavorites == FILTER_ONLY_FAVORITES)) + return false; + } + + return true; +} + bool LLInventoryFilter::checkAgainstCreator(const LLFolderViewModelItemInventory* listener) const { if (!listener) @@ -811,6 +854,32 @@ void LLInventoryFilter::setFilterThumbnails(U64 filter_thumbnails) mFilterOps.mFilterThumbnails = filter_thumbnails; } +void LLInventoryFilter::setFilterFavorites(U64 filter_favorites) +{ + if (mFilterOps.mFilterFavorites != filter_favorites) + { + if (mFilterOps.mFilterFavorites == FILTER_EXCLUDE_FAVORITES + && filter_favorites == FILTER_ONLY_FAVORITES) + { + setModified(FILTER_RESTART); + } + else if (mFilterOps.mFilterFavorites == FILTER_ONLY_FAVORITES + && filter_favorites == FILTER_EXCLUDE_FAVORITES) + { + setModified(FILTER_RESTART); + } + else if (mFilterOps.mFilterFavorites == FILTER_INCLUDE_FAVORITES) + { + setModified(FILTER_MORE_RESTRICTIVE); + } + else + { + setModified(FILTER_LESS_RESTRICTIVE); + } + } + mFilterOps.mFilterFavorites = filter_favorites; +} + void LLInventoryFilter::setFilterEmptySystemFolders() { mFilterOps.mFilterTypes |= FILTERTYPE_EMPTYFOLDERS; @@ -923,6 +992,11 @@ void LLInventoryFilter::toggleSearchVisibilityLibrary() } } +void LLInventoryFilter::setFilterNoTrashFolder() +{ + mFilterOps.mFilterTypes |= FILTERTYPE_NO_TRASH_ITEMS; +} + void LLInventoryFilter::setFilterNoMarketplaceFolder() { mFilterOps.mFilterTypes |= FILTERTYPE_NO_MARKETPLACE_ITEMS; @@ -1615,6 +1689,11 @@ U64 LLInventoryFilter::getFilterThumbnails() const return mFilterOps.mFilterThumbnails; } +U64 LLInventoryFilter::getFilterFavorites() const +{ + return mFilterOps.mFilterFavorites; +} + bool LLInventoryFilter::hasFilterString() const { return mFilterSubString.size() > 0; diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index 612a161ba2..c0164e04e4 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -61,6 +61,7 @@ public: FILTERTYPE_NO_MARKETPLACE_ITEMS = 0x1 << 10, // pass iff folder is not under the marketplace FILTERTYPE_WORN = 0x1 << 11, // pass if item is worn FILTERTYPE_SETTINGS = 0x1 << 12, // pass if the item is a settings object + FILTERTYPE_NO_TRASH_ITEMS = 0x1 << 13, // pass iff folder is not under the marketplace }; enum EFilterDateDirection @@ -83,6 +84,13 @@ public: FILTER_ONLY_THUMBNAILS }; + enum EFilterFavorite + { + FILTER_INCLUDE_FAVORITES, + FILTER_EXCLUDE_FAVORITES, + FILTER_ONLY_FAVORITES + }; + enum ESortOrderType { SO_NAME = 0, // Sort inventory by name @@ -149,6 +157,7 @@ public: Optional<PermissionMask> permissions; Optional<EFilterCreatorType> creator_type; Optional<EFilterThumbnail> thumbnails; + Optional<EFilterFavorite> favorites; Params() : types("filter_types", FILTERTYPE_OBJECT), @@ -156,6 +165,7 @@ public: wearable_types("wearable_types", 0xffffFFFFffffFFFFULL), settings_types("settings_types", 0xffffFFFFffffFFFFULL), thumbnails("thumbnails", FILTER_INCLUDE_THUMBNAILS), + favorites("favorites", FILTER_INCLUDE_FAVORITES), category_types("category_types", 0xffffFFFFffffFFFFULL), links("links", FILTERLINK_INCLUDE_LINKS), search_visibility("search_visibility", 0xFFFFFFFF), @@ -177,6 +187,7 @@ public: mFilterWearableTypes, mFilterSettingsTypes, // for _SETTINGS mFilterThumbnails, + mFilterFavorites, mFilterLinks, mFilterCategoryTypes; // For _CATEGORY LLUUID mFilterUUID; // for UUID @@ -220,6 +231,7 @@ public: U64 getFilterSettingsTypes() const; U64 getSearchVisibilityTypes() const; U64 getFilterThumbnails() const; + U64 getFilterFavorites() const; bool isFilterObjectTypesWith(LLInventoryType::EType t) const; void setFilterObjectTypes(U64 types); @@ -233,8 +245,10 @@ public: void setFilterMarketplaceInactiveFolders(); void setFilterMarketplaceUnassociatedFolders(); void setFilterMarketplaceListingFolders(bool select_only_listing_folders); + void setFilterNoTrashFolder(); void setFilterNoMarketplaceFolder(); void setFilterThumbnails(U64 filter_thumbnails); + void setFilterFavorites(U64 filter_favorites); void updateFilterTypes(U64 types, U64& current_types); void setSearchType(ESearchType type); ESearchType getSearchType() { return mSearchType; } @@ -339,6 +353,7 @@ public: LLInventoryFilter& operator =(const LLInventoryFilter& other); bool checkAgainstFilterThumbnails(const LLUUID& object_id) const; + bool checkAgainstFilterFavorites(const LLUUID& object_id) const; private: bool areDateLimitsSet() const; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index fdf77ab8df..2be6a91bbf 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -51,6 +51,7 @@ #include "lldirpicker.h" #include "lldonotdisturbnotificationstorage.h" #include "llfloatermarketplacelistings.h" +#include "llfloatermodelpreview.h" #include "llfloatersidepanelcontainer.h" #include "llfocusmgr.h" #include "llfolderview.h" @@ -62,6 +63,7 @@ #include "llinventorymodel.h" #include "llinventorypanel.h" #include "lllineeditor.h" +#include "llmaterialeditor.h" #include "llmarketplacenotifications.h" #include "llmarketplacefunctions.h" #include "llmenugl.h" @@ -86,6 +88,7 @@ #include "llviewermessage.h" #include "llviewerfoldertype.h" #include "llviewerobjectlist.h" +#include "llviewermenufile.h" #include "llviewerregion.h" #include "llviewerwindow.h" #include "llvoavatarself.h" @@ -2418,6 +2421,149 @@ void ungroup_folder_items(const LLUUID& folder_id) gInventory.notifyObservers(); } +class LLUpdateFavorite : public LLInventoryCallback +{ +public: + LLUpdateFavorite(const LLUUID& inv_item_id) + : mInvItemID(inv_item_id) + {} + /* virtual */ void fire(const LLUUID& inv_item_id) override + { + gInventory.addChangedMask(LLInventoryObserver::UPDATE_FAVORITE, mInvItemID); + + LLInventoryModel::item_array_t items; + LLInventoryModel::cat_array_t cat_array; + LLLinkedItemIDMatches matches(mInvItemID); + gInventory.collectDescendentsIf(gInventory.getRootFolderID(), + cat_array, + items, + LLInventoryModel::INCLUDE_TRASH, + matches); + + std::set<LLUUID> link_ids; + for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); ++it) + { + LLPointer<LLViewerInventoryItem> item = *it; + + gInventory.addChangedMask(LLInventoryObserver::UPDATE_FAVORITE, item->getUUID()); + } + + gInventory.notifyObservers(); + } +private: + LLUUID mInvItemID; +}; + +void favorite_send(LLInventoryObject* obj, const LLUUID& obj_id, bool favorite) + { + LLSD val; + if (favorite) + { + val = true; + } // else leave undefined to remove unneeded metadata field + + LLSD updates; + if (favorite) + { + updates["favorite"] = LLSD().with("toggled", true); + } + else + { + updates["favorite"] = LLSD(); + } + + LLPointer<LLInventoryCallback> cb = new LLUpdateFavorite(obj_id); + + LLViewerInventoryCategory* view_folder = dynamic_cast<LLViewerInventoryCategory*>(obj); + if (view_folder) + { + update_inventory_category(obj_id, updates, cb); + } + LLViewerInventoryItem* view_item = dynamic_cast<LLViewerInventoryItem*>(obj); + if (view_item) + { + update_inventory_item(obj_id, updates, cb); + } + } + +bool get_is_favorite(const LLInventoryObject* object) +{ + if (object->getIsLinkType()) + { + LLInventoryObject* obj = gInventory.getObject(object->getLinkedUUID()); + return obj && obj->getIsFavorite(); + } + + return object->getIsFavorite(); +} + +bool get_is_favorite(const LLUUID& obj_id) +{ + LLInventoryObject* object = gInventory.getObject(obj_id); + if (object && object->getIsLinkType()) + { + LLInventoryObject* obj = gInventory.getObject(object->getLinkedUUID()); + return obj && obj->getIsFavorite(); + } + + return object->getIsFavorite(); +} + +void set_favorite(const LLUUID& obj_id, bool favorite) +{ + LLInventoryObject* obj = gInventory.getObject(obj_id); + + if (obj && obj->getIsLinkType()) + { + if (!favorite && obj->getIsFavorite()) + { + // Links currently aren't supposed to be favorites, + // instead should show state of the original + LL_INFOS("Inventory") << "Recovering proper 'favorites' state of a link " << obj_id << LL_ENDL; + favorite_send(obj, obj_id, false); + } + obj = gInventory.getObject(obj->getLinkedUUID()); + } + + if (obj && obj->getIsFavorite() != favorite) + { + favorite_send(obj, obj->getUUID(), favorite); + } +} + +void toggle_favorite(const LLUUID& obj_id) +{ + LLInventoryObject* obj = gInventory.getObject(obj_id); + if (obj && obj->getIsLinkType()) + { + obj = gInventory.getObject(obj->getLinkedUUID()); + } + + if (obj) + { + favorite_send(obj, obj->getUUID(), !obj->getIsFavorite()); + } +} + +void toggle_favorites(const uuid_vec_t& ids) +{ + if (ids.size() == 0) + { + return; + } + if (ids.size() == 1) + { + toggle_favorite(ids[0]); + return; + } + + bool new_val = !get_is_favorite(ids.front()); + for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + set_favorite(*it, new_val); + } +} + std::string get_searchable_description(LLInventoryModel* model, const LLUUID& item_id) { if (model) @@ -2697,6 +2843,20 @@ bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryIt return false; } +bool LLFavoritesCollector::operator()(LLInventoryCategory* cat, + LLInventoryItem* item) +{ + if (item && item->getIsFavorite()) + { + return true; + } + if (cat && cat->getIsFavorite()) + { + return true; + } + return false; +} + bool LLBuddyCollector::operator()(LLInventoryCategory* cat, LLInventoryItem* item) { @@ -3194,7 +3354,7 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root for (LLInventoryModel::item_array_t::value_type& item : items) { - if (get_is_item_worn(item)) + if (!item->getIsLinkType() && get_is_item_worn(item)) { has_worn = true; LLWearableType::EType type = item->getWearableType(); @@ -3214,7 +3374,7 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root } } LLViewerInventoryItem* item = gInventory.getItem(obj_id); - if (item && get_is_item_worn(item)) + if (item && !item->getIsLinkType() && get_is_item_worn(item)) { has_worn = true; LLWearableType::EType type = item->getWearableType(); @@ -3481,6 +3641,20 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root LLFloaterReg::showInstance("change_item_thumbnail", data); } } + else if ("add_to_favorites" == action) + { + for (const LLUUID& id : ids) + { + set_favorite(id, true); + } + } + else if ("remove_from_favorites" == action) + { + for (const LLUUID& id : ids) + { + set_favorite(id, false); + } + } else { std::set<LLFolderViewItem*>::iterator set_iter; @@ -3574,6 +3748,54 @@ void LLInventoryAction::removeItemFromDND(LLFolderView* root) } } +void LLInventoryAction::fileUploadLocation(const LLUUID& dest_id, const std::string& action) +{ + if (action == "def_model") + { + gSavedPerAccountSettings.setString("ModelUploadFolder", dest_id.asString()); + } + else if (action == "def_texture") + { + gSavedPerAccountSettings.setString("TextureUploadFolder", dest_id.asString()); + } + else if (action == "def_sound") + { + gSavedPerAccountSettings.setString("SoundUploadFolder", dest_id.asString()); + } + else if (action == "def_animation") + { + gSavedPerAccountSettings.setString("AnimationUploadFolder", dest_id.asString()); + } + else if (action == "def_pbr_material") + { + gSavedPerAccountSettings.setString("PBRUploadFolder", dest_id.asString()); + } + else if (action == "upload_texture") + { + LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2, dest_id), LLFilePicker::FFLOAD_IMAGE, false); + } + else if (action == "upload_sound") + { + LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2, dest_id), LLFilePicker::FFLOAD_WAV, false); + } + else if (action == "upload_animation") + { + LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2, dest_id), LLFilePicker::FFLOAD_ANIM, false); + } + else if (action == "upload_model") + { + LLFloaterModelPreview::showModelPreview(dest_id); + } + else if (action == "upload_pbr_material") + { + LLMaterialEditor::importMaterial(dest_id); + } + else if (action == "upload_bulk") + { + LLFilePickerReplyThread::startPicker(boost::bind(&upload_bulk, _1, _2, true, dest_id), LLFilePicker::FFLOAD_ALL, true); + } +} + void LLInventoryAction::onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLHandle<LLFolderView> root) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h index cd6f319f66..9e2739ef29 100644 --- a/indra/newview/llinventoryfunctions.h +++ b/indra/newview/llinventoryfunctions.h @@ -116,6 +116,11 @@ bool can_move_to_my_outfits(LLInventoryModel* model, LLInventoryCategory* inv_ca std::string get_localized_folder_name(LLUUID cat_uuid); void new_folder_window(const LLUUID& folder_id); void ungroup_folder_items(const LLUUID& folder_id); +bool get_is_favorite(const LLInventoryObject* object); +bool get_is_favorite(const LLUUID& obj_id); +void set_favorite(const LLUUID& obj_id, bool favorite); +void toggle_favorite(const LLUUID& obj_id); +void toggle_favorites(const uuid_vec_t& ids); std::string get_searchable_description(LLInventoryModel* model, const LLUUID& item_id); std::string get_searchable_creator_name(LLInventoryModel* model, const LLUUID& item_id); std::string get_searchable_UUID(LLInventoryModel* model, const LLUUID& item_id); @@ -328,6 +333,18 @@ protected: }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLFavoritesCollector +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLFavoritesCollector : public LLInventoryCollectFunctor +{ +public: + LLFavoritesCollector() {} + virtual ~LLFavoritesCollector() {} + virtual bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item); +}; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLBuddyCollector // // Simple class that collects calling cards that are not null, and not @@ -601,6 +618,7 @@ struct LLInventoryAction static void callback_copySelected(const LLSD& notification, const LLSD& response, class LLInventoryModel* model, class LLFolderView* root, const std::string& action); static void onItemsRemovalConfirmation(const LLSD& notification, const LLSD& response, LLHandle<LLFolderView> root); static void removeItemFromDND(LLFolderView* root); + static void fileUploadLocation(const LLUUID& dest_id, const std::string& action); static void saveMultipleTextures(const std::vector<std::string>& filenames, std::set<LLFolderViewItem*> selected_items, LLInventoryModel* model); diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 03bafa48bd..93f5425fd7 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -634,7 +634,7 @@ void LLInventoryGallery::removeFromLastRow(LLInventoryGalleryItem* item) mItemPanels.pop_back(); } -LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, time_t creation_date, bool is_link, bool is_worn) +LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, time_t creation_date, bool is_link, bool is_worn, bool is_favorite) { LLInventoryGalleryItem::Params giparams; giparams.visible = true; @@ -645,6 +645,7 @@ LLInventoryGalleryItem* LLInventoryGallery::buildGalleryItem(std::string name, L gitem->setUUID(item_id); gitem->setGallery(this); gitem->setType(type, inventory_type, flags, is_link); + gitem->setFavorite(is_favorite); gitem->setLoadImmediately(mLoadThumbnailsImmediately); gitem->setThumbnail(thumbnail_id); gitem->setWorn(is_worn); @@ -937,8 +938,19 @@ bool LLInventoryGallery::updateAddedItem(LLUUID item_id) } bool res = false; - - LLInventoryGalleryItem* item = buildGalleryItem(name, item_id, obj->getType(), thumbnail_id, inventory_type, misc_flags, obj->getCreationDate(), obj->getIsLinkType(), is_worn); + bool is_favorite = get_is_favorite(obj); + + LLInventoryGalleryItem* item = buildGalleryItem( + name, + item_id, + obj->getType(), + thumbnail_id, + inventory_type, + misc_flags, + obj->getCreationDate(), + obj->getIsLinkType(), + is_worn, + is_favorite); mItemMap.insert(LLInventoryGallery::gallery_item_map_t::value_type(item_id, item)); if (mGalleryCreated) { @@ -975,7 +987,7 @@ void LLInventoryGallery::updateRemovedItem(LLUUID item_id) mItemBuildQuery.erase(item_id); } -void LLInventoryGallery::updateChangedItemName(LLUUID item_id, std::string name) +void LLInventoryGallery::updateChangedItemData(LLUUID item_id, std::string name, bool is_favorite) { gallery_item_map_t::iterator iter = mItemMap.find(item_id); if (iter != mItemMap.end()) @@ -984,6 +996,7 @@ void LLInventoryGallery::updateChangedItemName(LLUUID item_id, std::string name) if (item) { item->setItemName(name); + item->setFavorite(is_favorite); } } } @@ -1999,7 +2012,7 @@ void LLInventoryGallery::deleteSelection() for (LLInventoryModel::item_array_t::value_type& item : items) { - if (get_is_item_worn(item)) + if (!item->getIsLinkType() && get_is_item_worn(item)) { has_worn = true; LLWearableType::EType type = item->getWearableType(); @@ -2020,7 +2033,7 @@ void LLInventoryGallery::deleteSelection() } LLViewerInventoryItem* item = gInventory.getItem(id); - if (item && get_is_item_worn(item)) + if (item && !item->getIsLinkType() && get_is_item_worn(item)) { has_worn = true; LLWearableType::EType type = item->getWearableType(); @@ -2357,7 +2370,7 @@ void LLInventoryGallery::refreshList(const LLUUID& category_id) return; } - updateChangedItemName(*items_iter, obj->getName()); + updateChangedItemData(*items_iter, obj->getName(), get_is_favorite(obj)); mNeedsArrange = true; } @@ -2873,6 +2886,14 @@ void LLInventoryGalleryItem::setType(LLAssetType::EType type, LLInventoryType::E getChild<LLIconCtrl>("link_overlay")->setVisible(is_link); } +void LLInventoryGalleryItem::setFavorite(bool is_favorite) +{ + getChild<LLIconCtrl>("fav_icon")->setVisible(is_favorite); + static const LLUIColor text_color = LLUIColorTable::instance().getColor("LabelTextColor", LLColor4::white); + static const LLUIColor favorite_color = LLUIColorTable::instance().getColor("InventoryFavoriteColor", LLColor4::white); + mNameText->setReadOnlyColor(is_favorite ? favorite_color : text_color); +} + void LLInventoryGalleryItem::setThumbnail(LLUUID id) { mDefaultImage = id.isNull(); diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index 59d08d19ed..7f53f9998d 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -102,7 +102,7 @@ public: void getCurrentCategories(uuid_vec_t& vcur); bool updateAddedItem(LLUUID item_id); // returns true if added item is visible void updateRemovedItem(LLUUID item_id); - void updateChangedItemName(LLUUID item_id, std::string name); + void updateChangedItemData(LLUUID item_id, std::string name, bool is_favorite); void updateItemThumbnail(LLUUID item_id); void updateWornItem(LLUUID item_id, bool is_worn); @@ -227,7 +227,7 @@ private: bool updateRowsIfNeeded(); void updateGalleryWidth(); - LLInventoryGalleryItem* buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, time_t creation_date, bool is_link, bool is_worn); + LLInventoryGalleryItem* buildGalleryItem(std::string name, LLUUID item_id, LLAssetType::EType type, LLUUID thumbnail_id, LLInventoryType::EType inventory_type, U32 flags, time_t creation_date, bool is_link, bool is_worn, bool is_favorite); LLInventoryGalleryItem* getItem(const LLUUID& id) const; void buildGalleryPanel(int row_count); @@ -343,6 +343,7 @@ public: void setHidden(bool hidden) {mHidden = hidden;} void setType(LLAssetType::EType type, LLInventoryType::EType inventory_type, U32 flags, bool is_link); + void setFavorite(bool is_favorite); LLAssetType::EType getAssetType() { return mType; } void setThumbnail(LLUUID id); void setGallery(LLInventoryGallery* gallery) { mGallery = gallery; } diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp index 340ecfcbbc..43ab9502d4 100644 --- a/indra/newview/llinventorygallerymenu.cpp +++ b/indra/newview/llinventorygallerymenu.cpp @@ -269,6 +269,20 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata) LLAppearanceMgr::instance().takeOffOutfit(cat->getLinkedUUID()); } } + else if ("add_to_favorites" == action) + { + for (const LLUUID& id : mUUIDs) + { + set_favorite(id, true); + } + } + else if ("remove_from_favorites" == action) + { + for (const LLUUID& id : mUUIDs) + { + set_favorite(id, false); + } + } else if ("take_off" == action || "detach" == action) { for (LLUUID& selected_id : mUUIDs) @@ -475,22 +489,7 @@ void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLS void LLInventoryGalleryContextMenu::fileUploadLocation(const LLSD& userdata) { const std::string param = userdata.asString(); - if (param == "model") - { - gSavedPerAccountSettings.setString("ModelUploadFolder", mUUIDs.front().asString()); - } - else if (param == "texture") - { - gSavedPerAccountSettings.setString("TextureUploadFolder", mUUIDs.front().asString()); - } - else if (param == "sound") - { - gSavedPerAccountSettings.setString("SoundUploadFolder", mUUIDs.front().asString()); - } - else if (param == "animation") - { - gSavedPerAccountSettings.setString("AnimationUploadFolder", mUUIDs.front().asString()); - } + LLInventoryAction::fileUploadLocation(mUUIDs.front(), param); } bool LLInventoryGalleryContextMenu::canSetUploadLocation(const LLSD& userdata) @@ -787,6 +786,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men { items.push_back(std::string("New Folder")); } + items.push_back(std::string("upload_options")); items.push_back(std::string("upload_def")); } @@ -795,6 +795,18 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men items.push_back(std::string("New Outfit")); } + if (!is_trash && !is_in_trash && gInventory.getRootFolderID() != selected_id) + { + if (get_is_favorite(obj)) + { + items.push_back(std::string("Remove from Favorites")); + } + else + { + items.push_back(std::string("Add to Favorites")); + } + } + items.push_back(std::string("Subfolder Separator")); if (!is_system_folder && !isRootFolder()) { @@ -840,6 +852,17 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men if(is_agent_inventory) { items.push_back(std::string("Cut")); + if (!is_in_trash) + { + if (get_is_favorite(obj)) + { + items.push_back(std::string("Remove from Favorites")); + } + else + { + items.push_back(std::string("Add to Favorites")); + } + } if (!is_link || !is_cof || !get_is_item_worn(selected_id)) { items.push_back(std::string("Delete")); @@ -976,6 +999,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men } disabled_items.push_back(std::string("New Folder")); + disabled_items.push_back(std::string("upload_options")); disabled_items.push_back(std::string("upload_def")); disabled_items.push_back(std::string("create_new")); } @@ -1025,6 +1049,15 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men disabled_items.push_back(std::string("Marketplace Move")); } } + + if (get_is_favorite(obj)) + { + items.push_back(std::string("Remove from Favorites")); + } + else if (is_agent_inventory) + { + items.push_back(std::string("Add to Favorites")); + } } hide_context_entries(*menu, items, disabled_items); diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp index 9e936eee5b..63d3117e77 100644 --- a/indra/newview/llinventoryitemslist.cpp +++ b/indra/newview/llinventoryitemslist.cpp @@ -115,7 +115,7 @@ void LLInventoryItemsList::doIdle() { if (mRefreshState == REFRESH_COMPLETE) return; - if (isInVisibleChain() || mForceRefresh ) + if (isInVisibleChain() || mForceRefresh || !getFilterSubString().empty()) { refresh(); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 2449a226c3..ccb5a59bf8 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -78,7 +78,7 @@ // Increment this if the inventory contents change in a non-backwards-compatible way. // For viewer 2, the addition of link items makes a pre-viewer-2 cache incorrect. -const S32 LLInventoryModel::sCurrentInvCacheVersion = 3; +const S32 LLInventoryModel::sCurrentInvCacheVersion = 4; bool LLInventoryModel::sFirstTimeInViewer2 = true; S32 LLInventoryModel::sPendingSystemFolders = 0; @@ -2773,8 +2773,9 @@ bool LLInventoryModel::loadSkeleton( cached_ids.insert(tcat->getUUID()); // At the moment download does not provide a thumbnail - // uuid, use the one from cache + // uuid or favorite, use values from cache tcat->setThumbnailUUID(cat->getThumbnailUUID()); + tcat->setFavorite(cat->getIsFavorite()); } } diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index ac791e224e..ac22be9d5a 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -749,6 +749,13 @@ void LLInventoryCategoriesObserver::changed(U32 mask) cat_changed = true; } + bool is_favorite = category->getIsFavorite(); + if (cat_data.mIsFavorite != is_favorite) + { + cat_data.mIsFavorite = is_favorite; + cat_changed = true; + } + // If anything has changed above, fire the callback. if (cat_changed) cat_data.mCallback(); @@ -766,6 +773,7 @@ bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t S32 version = LLViewerInventoryCategory::VERSION_UNKNOWN; S32 current_num_known_descendents = LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN; bool can_be_added = true; + bool favorite = false; LLUUID thumbnail_id; LLViewerInventoryCategory* category = gInventory.getCategory(cat_id); @@ -779,6 +787,7 @@ bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t // to a category have been made. version = category->getVersion(); thumbnail_id = category->getThumbnailUUID(); + favorite = category->getIsFavorite(); LLInventoryModel::cat_array_t* cats; LLInventoryModel::item_array_t* items; @@ -804,11 +813,11 @@ bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t if(init_name_hash) { digest_t item_name_hash = gInventory.hashDirectDescendentNames(cat_id); - mCategoryMap.insert(category_map_value_t(cat_id,LLCategoryData(cat_id, thumbnail_id, cb, version, current_num_known_descendents,item_name_hash))); + mCategoryMap.insert(category_map_value_t(cat_id,LLCategoryData(cat_id, thumbnail_id, favorite, cb, version, current_num_known_descendents,item_name_hash))); } else { - mCategoryMap.insert(category_map_value_t(cat_id,LLCategoryData(cat_id, thumbnail_id, cb, version, current_num_known_descendents))); + mCategoryMap.insert(category_map_value_t(cat_id,LLCategoryData(cat_id, thumbnail_id, favorite, cb, version, current_num_known_descendents))); } } @@ -821,25 +830,37 @@ void LLInventoryCategoriesObserver::removeCategory(const LLUUID& cat_id) } LLInventoryCategoriesObserver::LLCategoryData::LLCategoryData( - const LLUUID& cat_id, const LLUUID& thumbnail_id, callback_t cb, S32 version, S32 num_descendents) + const LLUUID& cat_id, + const LLUUID& thumbnail_id, + bool is_favorite, + callback_t cb, + S32 version, + S32 num_descendents) : mCatID(cat_id) , mCallback(cb) , mVersion(version) , mDescendentsCount(num_descendents) , mThumbnailId(thumbnail_id) + , mIsFavorite(is_favorite) , mIsNameHashInitialized(false) { } LLInventoryCategoriesObserver::LLCategoryData::LLCategoryData( - const LLUUID& cat_id, const LLUUID& thumbnail_id, callback_t cb, S32 version, S32 num_descendents, const digest_t& name_hash) + const LLUUID& cat_id, + const LLUUID& thumbnail_id, + bool is_favorite, + callback_t cb, S32 version, + S32 num_descendents, + const digest_t& name_hash) : mCatID(cat_id) , mCallback(cb) , mVersion(version) , mDescendentsCount(num_descendents) , mThumbnailId(thumbnail_id) + , mIsFavorite(is_favorite) , mIsNameHashInitialized(true) , mItemNameHash(name_hash) { diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 950b02d3cf..12d6c44521 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -60,6 +60,7 @@ public: CREATE = 512, // With ADD, item has just been created. // unfortunately a particular message is still associated with some unique semantics. UPDATE_CREATE = 1024, // With ADD, item added via UpdateCreateInventoryItem + UPDATE_FAVORITE = 2048, // With ADD, item added via UpdateCreateInventoryItem ALL = 0xffffffff }; LLInventoryObserver(); @@ -276,12 +277,26 @@ protected: typedef LLUUID digest_t; // To clarify the actual usage of this "UUID" struct LLCategoryData { - LLCategoryData(const LLUUID& cat_id, const LLUUID& thumbnail_id, callback_t cb, S32 version, S32 num_descendents); - LLCategoryData(const LLUUID& cat_id, const LLUUID& thumbnail_id, callback_t cb, S32 version, S32 num_descendents, const digest_t& name_hash); + LLCategoryData( + const LLUUID& cat_id, + const LLUUID& thumbnail_id, + bool is_favorite, + callback_t cb, + S32 version, + S32 num_descendents); + LLCategoryData( + const LLUUID& cat_id, + const LLUUID& thumbnail_id, + bool is_favorite, + callback_t cb, + S32 version, + S32 num_descendents, + const digest_t& name_hash); callback_t mCallback; S32 mVersion; S32 mDescendentsCount; digest_t mItemNameHash; + bool mIsFavorite; bool mIsNameHashInitialized; LLUUID mCatID; LLUUID mThumbnailId; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index b8833dcd05..ba4d4c08ed 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -55,11 +55,13 @@ #include "llviewerfoldertype.h" #include "llvoavatarself.h" +class LLInventoryFavoritesItemsPanel; class LLInventoryRecentItemsPanel; class LLAssetFilteredInventoryPanel; static LLDefaultChildRegistry::Register<LLInventoryPanel> r("inventory_panel"); static LLDefaultChildRegistry::Register<LLInventoryRecentItemsPanel> t_recent_inventory_panel("recent_inventory_panel"); +static LLDefaultChildRegistry::Register<LLInventoryFavoritesItemsPanel> t_favorites_inventory_panel("favorites_inventory_panel"); static LLDefaultChildRegistry::Register<LLAssetFilteredInventoryPanel> t_asset_filtered_inv_panel("asset_filtered_inv_panel"); const std::string LLInventoryPanel::DEFAULT_SORT_ORDER = std::string("InventorySortOrder"); @@ -622,6 +624,19 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve } } + if (mask & LLInventoryObserver::UPDATE_FAVORITE) + { + if (view_item) + { + view_item->refresh(); + LLFolderViewFolder* parent = view_item->getParentFolder(); + if (parent) + { + parent->updateHasFavorites(get_is_favorite(model_item)); + } + } + } + // We don't typically care which of these masks the item is actually flagged with, since the masks // may not be accurate (e.g. in the main inventory panel, I move an item from My Inventory into // Landmarks; this is a STRUCTURE change for that panel but is an ADD change for the Landmarks @@ -650,6 +665,16 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve setSelection(item_id, false); } updateFolderLabel(model_item->getParentUUID()); + + if (get_is_favorite(model_item)) + { + LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID()); + if (new_parent) + { + new_parent->updateHasFavorites(true); + } + } + } ////////////////////////////// @@ -700,6 +725,12 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve { old_parent_vmi->dirtyDescendantsFilter(); } + + if (view_item->isFavorite()) + { + old_parent->updateHasFavorites(false); // favorite was removed + new_parent->updateHasFavorites(true); // favorite was added + } } } } @@ -725,6 +756,10 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve updateFolderLabel(viewmodel_folder->getUUID()); } } + if (view_item->isFavorite()) + { + parent->updateHasFavorites(false); // favorite was removed + } } } } @@ -842,7 +877,23 @@ void LLInventoryPanel::idle(void* user_data) bool in_visible_chain = panel->isInVisibleChain(); - if (!panel->mBuildViewsQueue.empty()) + if (!panel->mBuildRootQueue.empty()) + { + const F64 max_time = in_visible_chain ? 0.006f : 0.001f; // 6 ms + F64 curent_time = LLTimer::getTotalSeconds(); + panel->mBuildViewsEndTime = curent_time + max_time; + + while (curent_time < panel->mBuildViewsEndTime + && !panel->mBuildRootQueue.empty()) + { + LLUUID item_id = panel->mBuildRootQueue.back(); + panel->mBuildRootQueue.pop_back(); + panel->findAndInitRootContent(item_id); + + curent_time = LLTimer::getTotalSeconds(); + } + } + else if (!panel->mBuildViewsQueue.empty()) { const F64 max_time = in_visible_chain ? 0.006f : 0.001f; // 6 ms F64 curent_time = LLTimer::getTotalSeconds(); @@ -924,20 +975,9 @@ void LLInventoryPanel::initializeViews(F64 max_time) mBuildViewsEndTime = curent_time + max_time; // init everything - LLUUID root_id = getRootFolderID(); - if (root_id.notNull()) - { - buildNewViews(getRootFolderID()); - } - else - { - // Default case: always add "My Inventory" root first, "Library" root second - // If we run out of time, this still should create root folders - buildNewViews(gInventory.getRootFolderID()); // My Inventory - buildNewViews(gInventory.getLibraryRootFolderID()); // Library - } + initRootContent(); - if (mBuildViewsQueue.empty()) + if (mBuildViewsQueue.empty() && mBuildRootQueue.empty()) { mViewsInitialized = VIEWS_INITIALIZED; } @@ -968,6 +1008,21 @@ void LLInventoryPanel::initializeViews(F64 max_time) } } +void LLInventoryPanel::initRootContent() +{ + LLUUID root_id = getRootFolderID(); + if (root_id.notNull()) + { + buildNewViews(getRootFolderID()); + } + else + { + // Default case: always add "My Inventory" root first, "Library" root second + // If we run out of time, this still should create root folders + buildNewViews(gInventory.getRootFolderID()); // My Inventory + buildNewViews(gInventory.getLibraryRootFolderID()); // Library + } +} LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * bridge, bool allow_drop) { @@ -1737,26 +1792,8 @@ bool LLInventoryPanel::beginIMSession() void LLInventoryPanel::fileUploadLocation(const LLSD& userdata) { const std::string param = userdata.asString(); - if (param == "model") - { - gSavedPerAccountSettings.setString("ModelUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); - } - else if (param == "texture") - { - gSavedPerAccountSettings.setString("TextureUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); - } - else if (param == "sound") - { - gSavedPerAccountSettings.setString("SoundUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); - } - else if (param == "animation") - { - gSavedPerAccountSettings.setString("AnimationUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); - } - else if (param == "pbr_material") - { - gSavedPerAccountSettings.setString("PBRUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString()); - } + const LLUUID dest = LLFolderBridge::sSelf.get()->getUUID(); + LLInventoryAction::fileUploadLocation(dest, param); } void LLInventoryPanel::openSingleViewInventory(LLUUID folder_id) @@ -2204,6 +2241,249 @@ LLInventoryRecentItemsPanel::LLInventoryRecentItemsPanel( const Params& params) mInvFVBridgeBuilder = &RECENT_ITEMS_BUILDER; } +/************************************************************************/ +/* Favorites Inventory Panel related class */ +/************************************************************************/ +static const LLFavoritesInventoryBridgeBuilder FAVORITES_BUILDER; +class LLInventoryFavoritesItemsPanel : public LLInventoryPanel +{ +public: + struct Params : public LLInitParam::Block<Params, LLInventoryPanel::Params> + {}; + + void initFromParams(const Params& p) + { + LLInventoryPanel::initFromParams(p); + // turn off trash + getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() | (1ULL << LLFolderType::FT_TRASH)); + getFilter().setFilterNoTrashFolder(); + // turn off marketplace for favorites + getFilter().setFilterNoMarketplaceFolder(); + } + + void removeItemID(const LLUUID& id) override; + +protected: + LLInventoryFavoritesItemsPanel(const Params&); + friend class LLUICtrlFactory; + + void findAndInitRootContent(const LLUUID& folder_id) override; + void initRootContent() override; + + bool removeFavorite(const LLUUID& id, const LLInventoryObject* model_item); + void itemChanged(const LLUUID& item_id, U32 mask, const LLInventoryObject* model_item) override; + + std::set<LLUUID> mRootContentIDs; +}; + +LLInventoryFavoritesItemsPanel::LLInventoryFavoritesItemsPanel(const Params& params) + : LLInventoryPanel(params) +{ + // replace bridge builder to have necessary View bridges. + mInvFVBridgeBuilder = &FAVORITES_BUILDER; +} + +void LLInventoryFavoritesItemsPanel::removeItemID(const LLUUID& id) +{ + std::set<LLUUID>::iterator found = mRootContentIDs.find(id); + if (found != mRootContentIDs.end()) + { + mRootContentIDs.erase(found); + // check content for favorites + mBuildRootQueue.emplace_back(id); + } + + LLInventoryPanel::removeItemID(id); +} + +void LLInventoryFavoritesItemsPanel::findAndInitRootContent(const LLUUID& id) +{ + F64 curent_time = LLTimer::getTotalSeconds(); + if (mBuildViewsEndTime < curent_time) + { + mBuildRootQueue.emplace_back(id); + return; + } + LLViewerInventoryCategory::cat_array_t* categories; + LLViewerInventoryItem::item_array_t* items; + mInventory->lockDirectDescendentArrays(id, categories, items); + + if (categories) + { + size_t count = categories->size(); + for (size_t i = 0; i < count; ++i) + { + LLViewerInventoryCategory* cat = categories->at(i); + if (cat->getPreferredType() == LLFolderType::FT_TRASH) + { + continue; + } + else if (cat->getIsFavorite()) + { + LLFolderViewItem* folder_view_item = getItemByID(cat->getUUID()); + if (!folder_view_item) + { + const LLUUID& parent_id = cat->getParentUUID(); + mRootContentIDs.emplace(cat->getUUID()); + + buildViewsTree(cat->getUUID(), parent_id, cat, folder_view_item, mFolderRoot.get(), BUILD_TIMELIMIT); + } + } + else + { + findAndInitRootContent(cat->getUUID()); + } + } + } + + if (items) + { + size_t count = items->size(); + for (size_t i = 0; i < count; ++i) + { + LLViewerInventoryItem* item = items->at(i); + const LLUUID item_id = item->getUUID(); + if (item->getIsFavorite() && typedViewsFilter(item_id, item)) + { + LLFolderViewItem* folder_view_item = getItemByID(id); + if (!folder_view_item) + { + const LLUUID& parent_id = item->getParentUUID(); + mRootContentIDs.emplace(item_id); + + buildViewsTree(item_id, parent_id, item, folder_view_item, mFolderRoot.get(), BUILD_TIMELIMIT); + } + } + } + } + + mInventory->unlockDirectDescendentArrays(id); +} + +void LLInventoryFavoritesItemsPanel::initRootContent() +{ + findAndInitRootContent(gInventory.getRootFolderID()); // My Inventory +} + +bool LLInventoryFavoritesItemsPanel::removeFavorite(const LLUUID& id, const LLInventoryObject* model_item) +{ + std::set<LLUUID>::iterator found = mRootContentIDs.find(id); + if (found == mRootContentIDs.end()) + { + return false; + } + + mRootContentIDs.erase(found); + + // This item is in root's content, remove item's UI. + LLFolderViewItem* view_item = getItemByID(id); + if (view_item) + { + LLFolderViewFolder* parent = view_item->getParentFolder(); + LLFolderViewModelItemInventory* viewmodel_item = static_cast<LLFolderViewModelItemInventory*>(view_item->getViewModelItem()); + if (viewmodel_item) + { + removeItemID(viewmodel_item->getUUID()); + } + view_item->destroyView(); + if (parent) + { + parent->getViewModelItem()->dirtyDescendantsFilter(); + LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(parent->getViewModelItem()); + if (viewmodel_folder) + { + updateFolderLabel(viewmodel_folder->getUUID()); + } + if (view_item->isFavorite()) + { + parent->updateHasFavorites(false); // favorite was removed + } + } + } + + return true; +} + +void LLInventoryFavoritesItemsPanel::itemChanged(const LLUUID& id, U32 mask, const LLInventoryObject* model_item) +{ + if (!model_item && !getItemByID(id)) + { + // remove operation, but item is not in panel already + return; + } + + bool handled = false; + + if (mask & (LLInventoryObserver::UPDATE_FAVORITE | + LLInventoryObserver::STRUCTURE | + LLInventoryObserver::ADD | + LLInventoryObserver::REMOVE)) + { + // specifically exlude links and not get_is_favorite(model_item) + if (model_item && model_item->getIsFavorite()) + { + LLFolderViewItem* view_item = getItemByID(id); + if (!view_item) + { + const LLViewerInventoryCategory* cat = dynamic_cast<const LLViewerInventoryCategory*>(model_item); + if (cat) + { + // New favorite folder + if (cat->getPreferredType() != LLFolderType::FT_TRASH) + { + // If any descendants were in the list, remove them + LLFavoritesCollector is_favorite; + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendentsIf(id, cat_array, item_array, false, is_favorite); + for (LLInventoryModel::cat_array_t::const_iterator it = cat_array.begin(); it != cat_array.end(); ++it) + { + removeFavorite((*it)->getUUID(), *it); + } + for (LLInventoryModel::item_array_t::const_iterator it = item_array.begin(); it != item_array.end(); ++it) + { + removeFavorite((*it)->getUUID(), *it); + } + + LLFolderViewItem* folder_view_item = getItemByID(cat->getUUID()); + if (!folder_view_item) + { + const LLUUID& parent_id = cat->getParentUUID(); + mRootContentIDs.emplace(cat->getUUID()); + + buildViewsTree(cat->getUUID(), parent_id, cat, folder_view_item, mFolderRoot.get(), BUILD_ONE_FOLDER); + } + } + } + else + { + // New favorite item + if (model_item->getIsFavorite() && typedViewsFilter(id, model_item)) + { + const LLUUID& parent_id = model_item->getParentUUID(); + mRootContentIDs.emplace(id); + + buildViewsTree(id, parent_id, model_item, NULL, mFolderRoot.get(), BUILD_ONE_FOLDER); + } + } + handled = true; + } + } + else + { + handled = removeFavorite(id, model_item); + } + } + + if (!handled) + { + LLInventoryPanel::itemChanged(id, mask, model_item); + } +} +/************************************************************************/ +/* LLInventorySingleFolderPanel */ +/************************************************************************/ + static LLDefaultChildRegistry::Register<LLInventorySingleFolderPanel> t_single_folder_inventory_panel("single_folder_inventory_panel"); LLInventorySingleFolderPanel::LLInventorySingleFolderPanel(const Params& params) diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 56909c8d98..73062e41a9 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -251,7 +251,7 @@ public: bool reset_filter = false); static void setSFViewAndOpenFolder(const LLInventoryPanel* panel, const LLUUID& folder_id); void addItemID(const LLUUID& id, LLFolderViewItem* itemp); - void removeItemID(const LLUUID& id); + virtual void removeItemID(const LLUUID& id); LLFolderViewItem* getItemByID(const LLUUID& id); LLFolderViewFolder* getFolderByID(const LLUUID& id); void setSelectionByID(const LLUUID& obj_id, bool take_keyboard_focus); @@ -334,6 +334,8 @@ public: protected: // Builds the UI. Call this once the inventory is usable. void initializeViews(F64 max_time); + virtual void initRootContent(); + virtual void findAndInitRootContent(const LLUUID& root_id) {}; // Specific inventory colors static bool sColorSetInitialized; @@ -371,7 +373,7 @@ protected: virtual LLFolderViewItem* createFolderViewItem(LLInvFVBridge * bridge); boost::function<void(const std::deque<LLFolderViewItem*>& items, bool user_action)> mSelectionCallback; -private: +protected: // buildViewsTree does not include some checks and is meant // for recursive use, use buildNewViews() for first call LLFolderViewItem* buildViewsTree(const LLUUID& id, @@ -394,6 +396,7 @@ private: EViewsInitializationState mViewsInitialized; // Whether views have been generated F64 mBuildViewsEndTime; // Stop building views past this timestamp std::deque<LLUUID> mBuildViewsQueue; + std::deque<LLUUID> mBuildRootQueue; }; diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 81b2d23cf7..4d54eac2ba 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -673,7 +673,7 @@ void LLLocalBitmap::updateGLTFMaterials(LLUUID old_id, LLUUID new_id) LLFetchedGLTFMaterial* render_mat = dynamic_cast<LLFetchedGLTFMaterial*>(entry->getGLTFRenderMaterial()); if (render_mat) { - *render_mat = *fetched_mat; + *render_mat = *fetched_mat; render_mat->applyOverride(*override_mat); } else diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index b5e494379d..355fb78ad2 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -1415,7 +1415,7 @@ bool LLMaterialEditor::saveIfNeeded() } std::string res_desc = buildMaterialDescription(); - createInventoryItem(buffer, mMaterialName, res_desc, local_permissions); + createInventoryItem(buffer, mMaterialName, res_desc, local_permissions, mUploadFolder); // We do not update floater with uploaded asset yet, so just close it. closeFloater(); @@ -1585,12 +1585,12 @@ private: std::string mNewName; }; -void LLMaterialEditor::createInventoryItem(const std::string &buffer, const std::string &name, const std::string &desc, const LLPermissions& permissions) +void LLMaterialEditor::createInventoryItem(const std::string &buffer, const std::string &name, const std::string &desc, const LLPermissions& permissions, const LLUUID& upload_folder) { // gen a new uuid for this asset LLTransactionID tid; tid.generate(); // timestamp-based randomization + uniquification - LLUUID parent = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_MATERIAL); + LLUUID parent = upload_folder.isNull() ? gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_MATERIAL) : upload_folder; const U8 subtype = NO_INV_SUBTYPE; // TODO maybe use AT_SETTINGS and LLSettingsType::ST_MATERIAL ? LLPointer<LLObjectsMaterialItemCallback> cb = new LLObjectsMaterialItemCallback(permissions, buffer, name); @@ -1904,7 +1904,11 @@ static void pack_textures( } } -void LLMaterialEditor::uploadMaterialFromModel(const std::string& filename, tinygltf::Model& model_in, S32 index) +void LLMaterialEditor::uploadMaterialFromModel( + const std::string& filename, + tinygltf::Model& model_in, + S32 index, + const LLUUID& dest) { if (index < 0 || !LLMaterialEditor::capabilitiesAvailable()) { @@ -1927,12 +1931,13 @@ void LLMaterialEditor::uploadMaterialFromModel(const std::string& filename, tiny // This uses 'filename' to make sure multiple bulk uploads work // instead of fighting for a single instance. LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor", LLSD().with("filename", filename).with("index", LLSD::Integer(index))); + me->mUploadFolder = dest; me->loadMaterial(model_in, filename, index, false); me->saveIfNeeded(); } -void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 index) +void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 index, const LLUUID& dest_folder) { LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; @@ -1978,6 +1983,7 @@ void LLMaterialEditor::loadMaterialFromFile(const std::string& filename, S32 ind } LLMaterialEditor* me = (LLMaterialEditor*)LLFloaterReg::getInstance("material_editor"); + me->mUploadFolder = dest_folder; if (index >= 0) { @@ -2428,17 +2434,18 @@ void LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback(const LLSD& notificati return; } - createInventoryItem(str.str(), new_name, std::string(), permissions); + createInventoryItem(str.str(), new_name, std::string(), permissions, LLUUID::null); } -const void upload_bulk(const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter type, bool allow_2k); + +void upload_bulk(const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter type, bool allow_2k, const LLUUID& dest); void LLMaterialEditor::loadMaterial(const tinygltf::Model &model_in, const std::string &filename, S32 index, bool open_floater) { if (index == model_in.materials.size()) { // bulk upload all the things - upload_bulk({ filename }, LLFilePicker::FFLOAD_MATERIAL, true); + upload_bulk({ filename }, LLFilePicker::FFLOAD_MATERIAL, true, LLUUID::null); return; } @@ -2845,10 +2852,10 @@ void LLMaterialEditor::setFromGltfMetaData(const std::string& filename, const ti } } -void LLMaterialEditor::importMaterial() +void LLMaterialEditor::importMaterial(const LLUUID dest_folder) { LLFilePickerReplyThread::startPicker( - [](const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter load_filter, LLFilePicker::ESaveFilter save_filter) + [dest_folder](const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter load_filter, LLFilePicker::ESaveFilter save_filter) { if (LLAppViewer::instance()->quitRequested()) { @@ -2856,7 +2863,7 @@ void LLMaterialEditor::importMaterial() } if (filenames.size() > 0) { - LLMaterialEditor::loadMaterialFromFile(filenames[0], -1); + LLMaterialEditor::loadMaterialFromFile(filenames[0], -1, dest_folder); } }, LLFilePicker::FFLOAD_MATERIAL, @@ -3539,6 +3546,7 @@ void LLMaterialEditor::saveTexture(LLImageJ2C* img, const std::string& name, con LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), expected_upload_cost, + mUploadFolder, false, cb, failed_upload)); diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index 232467460e..1abdd7f84c 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -94,7 +94,7 @@ class LLMaterialEditor : public LLPreview, public LLVOInventoryListener void setFromGltfMetaData(const std::string& filename, const tinygltf::Model& model, S32 index); // open a file dialog and select a gltf/glb file for import - static void importMaterial(); + static void importMaterial(const LLUUID dest_folder = LLUUID::null); // for live preview, apply current material to currently selected object void applyToSelection(); @@ -105,8 +105,11 @@ class LLMaterialEditor : public LLPreview, public LLVOInventoryListener void loadAsset() override; // @index if -1 and file contains more than one material, // will promt to select specific one - static void uploadMaterialFromModel(const std::string& filename, tinygltf::Model& model, S32 index); - static void loadMaterialFromFile(const std::string& filename, S32 index = -1); + static void uploadMaterialFromModel(const std::string& filename, + tinygltf::Model& model, + S32 index, + const LLUUID& dest_folder_id = LLUUID::null); + static void loadMaterialFromFile(const std::string& filename, S32 index = -1, const LLUUID& dest_folder = LLUUID::null); void onSelectionChanged(); // live overrides selection changes @@ -134,8 +137,6 @@ class LLMaterialEditor : public LLPreview, public LLVOInventoryListener void onClickSave(); - void getGLTFModel(tinygltf::Model& model); - std::string getEncodedAsset(); bool decodeAsset(const std::vector<char>& buffer); @@ -239,7 +240,7 @@ private: static void saveObjectsMaterialAs(const LLGLTFMaterial *render_material, const LLLocalGLTFMaterial *local_material, const LLPermissions& permissions, const LLUUID& object_id /* = LLUUID::null */, const LLUUID& item /* = LLUUID::null */); static bool updateInventoryItem(const std::string &buffer, const LLUUID &item_id, const LLUUID &task_id); - static void createInventoryItem(const std::string &buffer, const std::string &name, const std::string &desc, const LLPermissions& permissions); + static void createInventoryItem(const std::string &buffer, const std::string &name, const std::string &desc, const LLPermissions& permissions, const LLUUID& upload_folder); void setFromGLTFMaterial(LLGLTFMaterial* mat); bool setFromSelection(); @@ -249,6 +250,7 @@ private: friend class LLMaterialFilePicker; LLUUID mAssetID; + LLUUID mUploadFolder; LLTextureCtrl* mBaseColorTextureCtrl; LLTextureCtrl* mMetallicTextureCtrl; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index e4e70b02f9..f4b6f9bee9 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -742,8 +742,12 @@ public: }; -void log_upload_error(LLCore::HttpStatus status, const LLSD& content, - const char * const stage, const std::string & model_name) +void log_upload_error( + LLCore::HttpStatus status, + const LLSD& content, + const char * const stage, + const std::string & model_name, + const std::vector<std::string> & texture_filenames) { // Add notification popup. LLSD args; @@ -801,6 +805,20 @@ void log_upload_error(LLCore::HttpStatus status, const LLSD& content, error_num++; } } + + if (err.has("TextureIndex")) + { + S32 texture_index = err["TextureIndex"].asInteger(); + if (texture_index < texture_filenames.size()) + { + args["MESSAGE"] = message + "\n" + texture_filenames[texture_index]; + } + else + { + llassert(false); // figure out why or how texture wasn't in the list + args["MESSAGE"] = message + llformat("\nTexture index: %d", texture_index); + } + } } else { @@ -2158,7 +2176,7 @@ EMeshProcessingResult LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, LLVector3& scale, bool upload_textures, bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position, - const std::string & upload_url, bool do_upload, + const std::string & upload_url, LLUUID destination_folder_id, bool do_upload, LLHandle<LLWholeModelFeeObserver> fee_observer, LLHandle<LLWholeModelUploadObserver> upload_observer) : LLThread("mesh upload"), @@ -2166,6 +2184,7 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, mDiscarded(false), mDoUpload(do_upload), mWholeModelUploadURL(upload_url), + mDestinationFolderId(destination_folder_id), mFeeObserverHandle(fee_observer), mUploadObserverHandle(upload_observer) { @@ -2283,13 +2302,21 @@ LLSD llsd_from_file(std::string filename) return result; } -void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) +void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, std::vector<std::string>& texture_list_dest, bool include_textures) { LLSD result; LLSD res; - result["folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_OBJECT); - result["texture_folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE); + if (mDestinationFolderId.isNull()) + { + result["folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_OBJECT); + result["texture_folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE); + } + else + { + result["folder_id"] = mDestinationFolderId; + result["texture_folder_id"] = mDestinationFolderId; + } result["asset_type"] = "mesh"; result["inventory_type"] = "object"; result["description"] = "(No Description)"; @@ -2432,7 +2459,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) LLPointer<LLImageJ2C> upload_file = LLViewerTextureList::convertToUploadFile(texture->getSavedRawImage()); - if (!upload_file.isNull() && upload_file->getDataSize()) + if (!upload_file.isNull() && upload_file->getDataSize() && !upload_file->isBufferInvalid()) { texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); } @@ -2446,6 +2473,8 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) texture_index[texture] = texture_num; std::string str = texture_str.str(); res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); + // store indexes for error handling; + texture_list_dest.push_back(material.mDiffuseMapFilename); texture_num++; } @@ -2710,7 +2739,8 @@ void LLMeshUploadThread::doWholeModelUpload() LL_DEBUGS(LOG_MESH) << "Hull generation completed." << LL_ENDL; mModelData = LLSD::emptyMap(); - wholeModelToLLSD(mModelData, true); + mTextureFiles.clear(); + wholeModelToLLSD(mModelData, mTextureFiles, true); LLSD body = mModelData["asset_resources"]; dump_llsd_to_file(body, make_dump_name("whole_model_body_", dump_num)); @@ -2763,7 +2793,8 @@ void LLMeshUploadThread::requestWholeModelFee() generateHulls(); mModelData = LLSD::emptyMap(); - wholeModelToLLSD(mModelData, false); + mTextureFiles.clear(); + wholeModelToLLSD(mModelData, mTextureFiles, false); dump_llsd_to_file(mModelData, make_dump_name("whole_model_fee_request_", dump_num)); LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest, mHttpPolicyClass, @@ -2829,7 +2860,7 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp body["error"] = LLSD::emptyMap(); body["error"]["message"] = reason; body["error"]["identifier"] = "NetworkError"; // from asset-upload/upload_util.py - log_upload_error(status, body, "upload", mModelData["name"].asString()); + log_upload_error(status, body, "upload", mModelData["name"].asString(), mTextureFiles); if (observer) { @@ -2864,7 +2895,7 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp else { LL_WARNS(LOG_MESH) << "Upload failed. Not in expected 'complete' state." << LL_ENDL; - log_upload_error(status, body, "upload", mModelData["name"].asString()); + log_upload_error(status, body, "upload", mModelData["name"].asString(), mTextureFiles); if (observer) { @@ -2889,7 +2920,7 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp body["error"] = LLSD::emptyMap(); body["error"]["message"] = reason; body["error"]["identifier"] = "NetworkError"; // from asset-upload/upload_util.py - log_upload_error(status, body, "fee", mModelData["name"].asString()); + log_upload_error(status, body, "fee", mModelData["name"].asString(), mTextureFiles); if (observer) { @@ -2922,7 +2953,7 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp else { LL_WARNS(LOG_MESH) << "Fee request failed. Not in expected 'upload' state." << LL_ENDL; - log_upload_error(status, body, "fee", mModelData["name"].asString()); + log_upload_error(status, body, "fee", mModelData["name"].asString(), mTextureFiles); if (observer) { @@ -4453,12 +4484,12 @@ bool LLMeshRepoThread::hasHeader(const LLUUID& mesh_id) void LLMeshRepository::uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures, bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position, - std::string upload_url, bool do_upload, + std::string upload_url, const LLUUID& destination_folder_id, bool do_upload, LLHandle<LLWholeModelFeeObserver> fee_observer, LLHandle<LLWholeModelUploadObserver> upload_observer) { LLMeshUploadThread* thread = new LLMeshUploadThread(data, scale, upload_textures, upload_skin, upload_joints, lock_scale_if_joint_position, - upload_url, do_upload, fee_observer, upload_observer); + upload_url, destination_folder_id, do_upload, fee_observer, upload_observer); mUploadWaitList.push_back(thread); } diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index c7572c9cbf..51b19207d9 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -510,10 +510,13 @@ public: LLHost mHost; std::string mWholeModelFeeCapability; std::string mWholeModelUploadURL; + LLUUID mDestinationFolderId; LLMeshUploadThread(instance_list& data, LLVector3& scale, bool upload_textures, bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position, - const std::string & upload_url, bool do_upload = true, + const std::string & upload_url, + const LLUUID destination_folder_id = LLUUID::null, + bool do_upload = true, LLHandle<LLWholeModelFeeObserver> fee_observer = (LLHandle<LLWholeModelFeeObserver>()), LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>())); ~LLMeshUploadThread(); @@ -529,7 +532,7 @@ public: void doWholeModelUpload(); void requestWholeModelFee(); - void wholeModelToLLSD(LLSD& dest, bool include_textures); + void wholeModelToLLSD(LLSD& dest, std::vector<std::string>& texture_list_dest, bool include_textures); void decomposeMeshMatrix(LLMatrix4& transformation, LLVector3& result_pos, @@ -550,6 +553,7 @@ private: bool mDoUpload; // if false only model data will be requested, otherwise the model will be uploaded LLSD mModelData; + std::vector<std::string> mTextureFiles; // llcorehttp library interface objects. LLCore::HttpStatus mHttpStatus; @@ -674,7 +678,9 @@ public: void uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures, bool upload_skin, bool upload_joints, bool lock_scale_if_joint_position, - std::string upload_url, bool do_upload = true, + std::string upload_url, + const LLUUID& destination_folder_id = LLUUID::null, + bool do_upload = true, LLHandle<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()), LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>())); diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 1e7da126b0..6ef7712000 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -2344,7 +2344,7 @@ void LLModelPreview::updateStatusMessages() if (lod != lod_high) { - if (total_submeshes[lod] && total_submeshes[lod] != total_submeshes[lod_high]) + if (total_submeshes[lod] && total_submeshes[lod] > total_submeshes[lod_high]) { //number of submeshes is different message = "mesh_status_submesh_mismatch"; upload_status[lod] = 2; @@ -3322,7 +3322,6 @@ bool LLModelPreview::render() fmp->setViewOptionEnabled("show_skin_weight", show_skin_weight); } } - //if (this) return TRUE; if (upload_skin && !has_skin_weights) { //can't upload skin weights if model has no skin weights diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index dba294cef4..489be091d1 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -81,9 +81,16 @@ LLOutfitGallery::LLOutfitGallery(const LLOutfitGallery::Params& p) mItemsInRow(p.items_in_row), mRowPanWidthFactor(p.row_panel_width_factor), mGalleryWidthFactor(p.gallery_width_factor), - mTextureSelected(NULL) + mTextureSelected(NULL), + mSortMenu(nullptr) { updateGalleryWidth(); + + LLControlVariable* ctrl = gSavedSettings.getControl("InventoryFavoritesColorText"); + if (ctrl) + { + mSavedSettingInvFavColor = ctrl->getSignal()->connect(boost::bind(&LLOutfitGallery::handleInvFavColorChange, this)); + } } LLOutfitGallery::Params::Params() @@ -414,19 +421,28 @@ void LLOutfitGallery::updateRowsIfNeeded() bool compareGalleryItem(LLOutfitGalleryItem* item1, LLOutfitGalleryItem* item2) { - static LLCachedControl<bool> outfit_gallery_sort_by_name(gSavedSettings, "OutfitGallerySortByName"); - if(outfit_gallery_sort_by_name || - ((item1->isDefaultImage() && item2->isDefaultImage()) || (!item1->isDefaultImage() && !item2->isDefaultImage()))) + static LLCachedControl<S32> sort_by_name(gSavedSettings, "OutfitGallerySortOrder", 0); + switch (sort_by_name()) { - std::string name1 = item1->getItemName(); - std::string name2 = item2->getItemName(); - - return (LLStringUtil::compareDict(name1, name2) < 0); - } - else - { - return item2->isDefaultImage(); + case 2: + if (item1->isFavorite() != item2->isFavorite()) + { + return item1->isFavorite(); + } + break; + case 1: + if (item1->isDefaultImage() != item2->isDefaultImage()) + { + return item2->isDefaultImage(); + } + break; + default: + break; } + + std::string name1 = item1->getItemName(); + std::string name2 = item2->getItemName(); + return (LLStringUtil::compareDict(name1, name2) < 0); } void LLOutfitGallery::reArrangeRows(S32 row_diff) @@ -469,6 +485,20 @@ void LLOutfitGallery::updateGalleryWidth() mGalleryWidth = mGalleryWidthFactor * mItemsInRow - mItemHorizontalGap; } +void LLOutfitGallery::handleInvFavColorChange() +{ + for (outfit_map_t::iterator iter = mOutfitMap.begin(); + iter != mOutfitMap.end(); + ++iter) + { + if (!iter->second) continue; + LLOutfitGalleryItem* item = (LLOutfitGalleryItem*)iter->second; + + // refresh font color + item->setOutfitFavorite(item->isFavorite()); + } +} + LLPanel* LLOutfitGallery::addLastRow() { mRowCount++; @@ -620,7 +650,7 @@ void LLOutfitGallery::removeFromLastRow(LLOutfitGalleryItem* item) mItemPanels.pop_back(); } -LLOutfitGalleryItem* LLOutfitGallery::buildGalleryItem(std::string name, LLUUID outfit_id) +LLOutfitGalleryItem* LLOutfitGallery::buildGalleryItem(std::string name, LLUUID outfit_id, bool is_favorite) { LLOutfitGalleryItem::Params giparams; LLOutfitGalleryItem* gitem = LLUICtrlFactory::create<LLOutfitGalleryItem>(giparams); @@ -629,6 +659,7 @@ LLOutfitGalleryItem* LLOutfitGallery::buildGalleryItem(std::string name, LLUUID gitem->setFollowsLeft(); gitem->setFollowsTop(); gitem->setOutfitName(name); + gitem->setOutfitFavorite(is_favorite); gitem->setUUID(outfit_id); gitem->setGallery(this); return gitem; @@ -786,8 +817,7 @@ void LLOutfitGallery::updateAddedCategory(LLUUID cat_id) LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id); if (!cat) return; - std::string name = cat->getName(); - LLOutfitGalleryItem* item = buildGalleryItem(name, cat_id); + LLOutfitGalleryItem* item = buildGalleryItem(cat->getName(), cat_id, cat->getIsFavorite()); mOutfitMap.insert(LLOutfitGallery::outfit_map_value_t(cat_id, item)); item->setRightMouseDownCallback(boost::bind(&LLOutfitListBase::outfitRightClickCallBack, this, _1, _2, _3, cat_id)); @@ -856,6 +886,7 @@ void LLOutfitGallery::updateChangedCategoryName(LLViewerInventoryCategory *cat, if (item) { item->setOutfitName(name); + item->setOutfitFavorite(cat->getIsFavorite()); } } } @@ -936,6 +967,10 @@ LLOutfitListGearMenuBase* LLOutfitGallery::createGearMenu() static LLDefaultChildRegistry::Register<LLOutfitGalleryItem> r("outfit_gallery_item"); +bool LLOutfitGalleryItem::sColorSetInitialized = false; +LLUIColor LLOutfitGalleryItem::sDefaultTextColor; +LLUIColor LLOutfitGalleryItem::sDefaultFavoriteColor; + LLOutfitGalleryItem::LLOutfitGalleryItem(const Params& p) : LLPanel(p), mGallery(nullptr), @@ -947,6 +982,12 @@ LLOutfitGalleryItem::LLOutfitGalleryItem(const Params& p) mUUID(LLUUID()) { buildFromFile("panel_outfit_gallery_item.xml"); + if (!sColorSetInitialized) + { + sDefaultTextColor = LLUIColorTable::instance().getColor("White", LLColor4::white); + sDefaultFavoriteColor = LLUIColorTable::instance().getColor("InventoryFavoriteColor", LLColor4::white); + sColorSetInitialized = true; + } } LLOutfitGalleryItem::~LLOutfitGalleryItem() @@ -1003,6 +1044,18 @@ void LLOutfitGalleryItem::draw() } } + static LLUICachedControl<bool> draw_star("InventoryFavoritesUseStar", true); + if(mFavorite && draw_star()) + { + const S32 HPAD = 3; + const S32 VPAD = 6; // includes padding for text and for the image + const S32 image_size = 14; + static LLPointer<LLUIImage> fav_img = LLRender2D::getInstance()->getUIImage("Inv_Favorite_Star_Full"); + + gl_draw_scaled_image( + border.getWidth() - image_size - HPAD, image_size + VPAD + mOutfitNameText->getRect().getHeight(), + image_size, image_size, fav_img->getImage(), UI_VERTEX_COLOR % alpha); + } } void LLOutfitGalleryItem::setOutfitName(std::string name) @@ -1012,18 +1065,27 @@ void LLOutfitGalleryItem::setOutfitName(std::string name) mOutfitName = name; } +void LLOutfitGalleryItem::setOutfitFavorite(bool is_favorite) +{ + mFavorite = is_favorite; + + static LLCachedControl<bool> use_color(gSavedSettings, "InventoryFavoritesColorText"); + mOutfitNameText->setReadOnlyColor((mFavorite && use_color()) ? sDefaultFavoriteColor.get() : sDefaultTextColor.get()); +} + void LLOutfitGalleryItem::setOutfitWorn(bool value) { mWorn = value; LLStringUtil::format_map_t worn_string_args; std::string worn_string = getString("worn_string", worn_string_args); - LLUIColor text_color = LLUIColorTable::instance().getColor("White", LLColor4::white); - mOutfitWornText->setReadOnlyColor(text_color); - mOutfitNameText->setReadOnlyColor(text_color); + mOutfitWornText->setReadOnlyColor(sDefaultTextColor.get()); mOutfitWornText->setFont(value ? LLFontGL::getFontSansSerifBold() : LLFontGL::getFontSansSerifSmall()); mOutfitNameText->setFont(value ? LLFontGL::getFontSansSerifBold() : LLFontGL::getFontSansSerifSmall()); mOutfitWornText->setValue(value ? worn_string : ""); mOutfitNameText->setText(mOutfitName); // refresh LLTextViewModel to pick up font changes + + static LLCachedControl<bool> use_color(gSavedSettings, "InventoryFavoritesColorText"); + mOutfitNameText->setReadOnlyColor((mFavorite && use_color()) ? sDefaultFavoriteColor.get() : sDefaultTextColor.get()); } void LLOutfitGalleryItem::setSelected(bool value) @@ -1172,6 +1234,7 @@ LLContextMenu* LLOutfitGalleryContextMenu::createMenu() registrar.add("Outfit.Delete", boost::bind(LLOutfitGallery::onRemoveOutfit, selected_id), LLUICtrl::cb_info::UNTRUSTED_BLOCK); registrar.add("Outfit.Create", boost::bind(&LLOutfitGalleryContextMenu::onCreate, this, _2), LLUICtrl::cb_info::UNTRUSTED_BLOCK); registrar.add("Outfit.Thumbnail", boost::bind(&LLOutfitGalleryContextMenu::onThumbnail, this, selected_id)); + registrar.add("Outfit.Favorite", boost::bind(&LLOutfitGalleryContextMenu::onFavorite, this, selected_id)); registrar.add("Outfit.Save", boost::bind(&LLOutfitGalleryContextMenu::onSave, this, selected_id)); enable_registrar.add("Outfit.OnEnable", boost::bind(&LLOutfitGalleryContextMenu::onEnable, this, _2)); enable_registrar.add("Outfit.OnVisible", boost::bind(&LLOutfitGalleryContextMenu::onVisible, this, _2)); @@ -1210,25 +1273,10 @@ void LLOutfitGalleryGearMenu::onUpdateItemsVisibility() { if (!mMenu) return; bool have_selection = getSelectedOutfitID().notNull(); - mMenu->setItemVisible("expand", false); - mMenu->setItemVisible("collapse", false); mMenu->setItemVisible("thumbnail", have_selection); - mMenu->setItemVisible("sepatator3", true); - mMenu->setItemVisible("sort_folders_by_name", true); LLOutfitListGearMenuBase::onUpdateItemsVisibility(); } -void LLOutfitGalleryGearMenu::onChangeSortOrder() -{ - bool sort_by_name = !gSavedSettings.getBOOL("OutfitGallerySortByName"); - gSavedSettings.setBOOL("OutfitGallerySortByName", sort_by_name); - LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList); - if (gallery) - { - gallery->reArrangeRows(); - } -} - bool LLOutfitGalleryGearMenu::hasDefaultImage() { LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList); @@ -1345,6 +1393,15 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id) } } +LLToggleableMenu* LLOutfitGallery::getSortMenu() +{ + if (!mSortMenu) + { + mSortMenu = new LLOutfitGallerySortMenu(this); + } + return mSortMenu->getMenu(); +} + LLUUID LLOutfitGallery::getPhotoAssetId(const LLUUID& outfit_id) { outfit_map_t::iterator outfit_it = mOutfitMap.find(outfit_id); @@ -1360,3 +1417,84 @@ LLUUID LLOutfitGallery::getDefaultPhoto() return LLUUID(); } + +//////////////////// LLOutfitGallerySortMenu //////////////////// + +LLOutfitGallerySortMenu::LLOutfitGallerySortMenu(LLOutfitListBase* parent_panel) + : mPanelHandle(parent_panel->getHandle()) +{ + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; + + registrar.add("Sort.OnSort", { boost::bind(&LLOutfitGallerySortMenu::onSort, this, _2) }); + enable_registrar.add("Sort.OnEnable", boost::bind(&LLOutfitGallerySortMenu::onEnable, this, _2)); + + mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>( + "menu_outfit_gallery_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + llassert(mMenu); +} + + +LLToggleableMenu* LLOutfitGallerySortMenu::getMenu() +{ + return mMenu; +} + +void LLOutfitGallerySortMenu::updateItemsVisibility() +{ + onUpdateItemsVisibility(); +} + +void LLOutfitGallerySortMenu::onUpdateItemsVisibility() +{ + if (!mMenu) return; +} + +bool LLOutfitGallerySortMenu::onEnable(LLSD::String param) +{ + static LLCachedControl<S32> sort_order(gSavedSettings, "OutfitGallerySortOrder", 0); + if ("favorites_to_top" == param) + { + return sort_order == 2; + } + else if ("images_to_top" == param) + { + return sort_order == 1; + } + else if ("by_name" == param) + { + return sort_order == 0; + } + + return false; +} + +void LLOutfitGallerySortMenu::onSort(LLSD::String param) +{ + S32 sort_order = gSavedSettings.getS32("OutfitGallerySortOrder"); + S32 new_sort_order = 0; + if ("favorites_to_top" == param) + { + new_sort_order = 2; + } + else if ("images_to_top" == param) + { + new_sort_order = 1; + } + else if ("by_name" == param) + { + new_sort_order = 0; + } + if (sort_order == new_sort_order) + { + new_sort_order = sort_order ? 0 : 1; + } + gSavedSettings.setS32("OutfitGallerySortOrder", new_sort_order); + + LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mPanelHandle.get()); + if (gallery) + { + gallery->reArrangeRows(); + } +} + diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h index fa441ff209..1487aa6f5e 100644 --- a/indra/newview/lloutfitgallery.h +++ b/indra/newview/lloutfitgallery.h @@ -42,11 +42,13 @@ class LLOutfitGalleryItem; class LLOutfitListGearMenuBase; class LLOutfitGalleryGearMenu; class LLOutfitGalleryContextMenu; +class LLOutfitGallerySortMenu; class LLOutfitGallery : public LLOutfitListBase { public: friend class LLOutfitGalleryGearMenu; + friend class LLOutfitGallerySortMenu; friend class LLOutfitGalleryContextMenu; friend class LLUpdateGalleryOnPhotoLinked; @@ -102,10 +104,12 @@ public: /*virtual*/ bool getHasExpandableFolders() { return false; } + /*virtual*/ void onChangeSortOrder(const LLSD& userdata) {}; void updateMessageVisibility(); bool hasDefaultImage(const LLUUID& outfit_cat_id); void refreshOutfit(const LLUUID& category_id); + virtual LLToggleableMenu* getSortMenu(); protected: /*virtual*/ void onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id); @@ -133,8 +137,9 @@ private: void reArrangeRows(S32 row_diff = 0); void updateRowsIfNeeded(); void updateGalleryWidth(); + void handleInvFavColorChange(); - LLOutfitGalleryItem* buildGalleryItem(std::string name, LLUUID outfit_id); + LLOutfitGalleryItem* buildGalleryItem(std::string name, LLUUID outfit_id, bool is_favorite); LLOutfitGalleryItem* getSelectedItem() const; LLOutfitGalleryItem* getItem(const LLUUID& id) const; @@ -176,6 +181,7 @@ private: int mGalleryWidthFactor; LLListContextMenu* mOutfitGalleryMenu; + LLOutfitGallerySortMenu* mSortMenu; typedef std::map<LLUUID, LLOutfitGalleryItem*> outfit_map_t; typedef outfit_map_t::value_type outfit_map_value_t; @@ -187,6 +193,8 @@ private: LLInventoryCategoriesObserver* mOutfitsObserver; + + boost::signals2::connection mSavedSettingInvFavColor; }; class LLOutfitGalleryContextMenu : public LLOutfitContextMenu { @@ -213,8 +221,6 @@ public: protected: /*virtual*/ void onUpdateItemsVisibility(); private: - /*virtual*/ void onChangeSortOrder(); - bool hasDefaultImage(); }; @@ -243,6 +249,7 @@ public: bool setImageAssetId(LLUUID asset_id); LLUUID getImageAssetId(); void setOutfitName(std::string name); + void setOutfitFavorite(bool is_favorite); void setOutfitWorn(bool value); void setSelected(bool value); void setUUID(const LLUUID &outfit_id) {mUUID = outfit_id;} @@ -250,6 +257,7 @@ public: std::string getItemName() {return mOutfitName;} bool isDefaultImage() {return mDefaultImage;} + bool isFavorite() { return mFavorite; } bool isHidden() {return mHidden;} void setHidden(bool hidden) {mHidden = hidden;} @@ -268,7 +276,29 @@ private: bool mDefaultImage; bool mImageUpdatePending; bool mHidden; + bool mFavorite; std::string mOutfitName; + + static bool sColorSetInitialized; + static LLUIColor sDefaultTextColor; + static LLUIColor sDefaultFavoriteColor; +}; + +class LLOutfitGallerySortMenu +{ +public: + LLOutfitGallerySortMenu(LLOutfitListBase* parent_panel); + + LLToggleableMenu* getMenu(); + void updateItemsVisibility(); + +private: + void onUpdateItemsVisibility(); + bool onEnable(LLSD::String param); + void onSort(LLSD::String param); + + LLToggleableMenu* mMenu; + LLHandle<LLPanel> mPanelHandle; }; #endif // LL_LLOUTFITGALLERYCTRL_H diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 0233a22c2a..a7fda4b9d3 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -35,6 +35,7 @@ #include "llaccordionctrltab.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llappviewer.h" #include "llfloaterreg.h" #include "llfloatersidepanelcontainer.h" #include "llinspecttexture.h" @@ -45,6 +46,7 @@ #include "lloutfitobserver.h" #include "lltoggleablemenu.h" #include "lltransutil.h" +#include "llviewercontrol.h" #include "llviewermenu.h" #include "llvoavatar.h" #include "llvoavatarself.h" @@ -53,14 +55,24 @@ static bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y); static const LLOutfitTabNameComparator OUTFIT_TAB_NAME_COMPARATOR; +static const LLOutfitTabFavComparator OUTFIT_TAB_FAV_COMPARATOR; /*virtual*/ bool LLOutfitTabNameComparator::compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const { - std::string name1 = tab1->getTitle(); - std::string name2 = tab2->getTitle(); + return (LLStringUtil::compareDict(tab1->getTitle(), tab2->getTitle()) < 0); +} + +bool LLOutfitTabFavComparator::compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const +{ + LLOutfitAccordionCtrlTab* taba = (LLOutfitAccordionCtrlTab*)tab1; + LLOutfitAccordionCtrlTab* tabb = (LLOutfitAccordionCtrlTab*)tab2; + if (taba->getFavorite() != tabb->getFavorite()) + { + return taba->getFavorite(); + } - return (LLStringUtil::compareDict(name1, name2) < 0); + return (LLStringUtil::compareDict(tab1->getTitle(), tab2->getTitle()) < 0); } struct outfit_accordion_tab_params : public LLInitParam::Block<outfit_accordion_tab_params, LLOutfitAccordionCtrlTab::Params> @@ -80,6 +92,9 @@ const outfit_accordion_tab_params& get_accordion_tab_params() { initialized = true; + LLOutfitAccordionCtrlTab::sFavoriteIcon = LLUI::getUIImage("Inv_Favorite_Star_Full"); + LLOutfitAccordionCtrlTab::sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", LLColor4U(255, 255, 255)); + LLXMLNodePtr xmlNode; if (LLUICtrlFactory::getLayeredXMLNode("outfit_accordion_tab.xml", xmlNode)) { @@ -103,11 +118,20 @@ LLOutfitsList::LLOutfitsList() , mAccordion(NULL) , mListCommands(NULL) , mItemSelected(false) + , mSortMenu(nullptr) { + LLControlVariable* ctrl = gSavedSettings.getControl("InventoryFavoritesColorText"); + if (ctrl) + { + mSavedSettingInvFavColor = ctrl->getSignal()->connect(boost::bind(&LLOutfitsList::handleInvFavColorChange, this)); + } } LLOutfitsList::~LLOutfitsList() { + delete mSortMenu; + mSavedSettingInvFavColor.disconnect(); + mGearMenuConnection.disconnect(); } bool LLOutfitsList::postBuild() @@ -115,9 +139,25 @@ bool LLOutfitsList::postBuild() mAccordion = getChild<LLAccordionCtrl>("outfits_accordion"); mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR); + initComparator(); + return LLOutfitListBase::postBuild(); } +void LLOutfitsList::initComparator() +{ + S32 mode = gSavedSettings.getS32("OutfitListSortOrder"); + if (mode == 0) + { + mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR); + } + else + { + mAccordion->setComparator(&OUTFIT_TAB_FAV_COMPARATOR); + } + sortOutfits(); +} + //virtual void LLOutfitsList::onOpen(const LLSD& info) { @@ -154,6 +194,7 @@ void LLOutfitsList::updateAddedCategory(LLUUID cat_id) tab->setName(name); tab->setTitle(name); + tab->setFavorite(cat->getIsFavorite()); // *TODO: LLUICtrlFactory::defaultBuilder does not use "display_children" from xml. Should be investigated. tab->setDisplayChildren(false); @@ -183,8 +224,9 @@ void LLOutfitsList::updateAddedCategory(LLUUID cat_id) // Setting callback to reset items selection inside outfit on accordion collapsing and expanding (EXT-7875) tab->setDropDownStateChangedCallback(boost::bind(&LLOutfitsList::resetItemSelection, this, list, cat_id)); - // force showing list items that don't match current filter(EXT-7158) - list->setForceShowingUnmatchedItems(true); + // Depending on settings, force showing list items that don't match current filter(EXT-7158) + static LLCachedControl<bool> list_filter(gSavedSettings, "OutfitListFilterFullList"); + list->setForceShowingUnmatchedItems(list_filter(), false); // Setting list commit callback to monitor currently selected wearable item. list->setCommitCallback(boost::bind(&LLOutfitsList::onListSelectionChange, this, _1)); @@ -249,13 +291,11 @@ void LLOutfitsList::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id) { if (mOutfitsMap[prev_id]) { - mOutfitsMap[prev_id]->setTitleFontStyle("NORMAL"); - mOutfitsMap[prev_id]->setTitleColor(LLUIColorTable::instance().getColor("AccordionHeaderTextColor")); + ((LLOutfitAccordionCtrlTab*)mOutfitsMap[prev_id])->setOutfitSelected(false); } if (mOutfitsMap[base_id]) { - mOutfitsMap[base_id]->setTitleFontStyle("BOLD"); - mOutfitsMap[base_id]->setTitleColor(LLUIColorTable::instance().getColor("SelectedOutfitTextColor")); + ((LLOutfitAccordionCtrlTab*)mOutfitsMap[base_id])->setOutfitSelected(true); } } @@ -313,6 +353,11 @@ void LLOutfitsList::onSetSelectedOutfitByUUID(const LLUUID& outfit_uuid) } } +void LLOutfitListBase::onAction(const LLSD& userdata) +{ + performAction(userdata.asString()); +} + // virtual bool LLOutfitListBase::isActionEnabled(const LLSD& userdata) { @@ -425,11 +470,12 @@ void LLOutfitsList::updateChangedCategoryName(LLViewerInventoryCategory *cat, st if (outfits_iter != mOutfitsMap.end()) { // Update tab name with the new category name. - LLAccordionCtrlTab* tab = outfits_iter->second; + LLOutfitAccordionCtrlTab* tab = (LLOutfitAccordionCtrlTab*) outfits_iter->second; if (tab) { tab->setName(name); tab->setTitle(name); + tab->setFavorite(cat->getIsFavorite()); } } } @@ -521,7 +567,7 @@ void LLOutfitsList::onFilterSubStringChanged(const std::string& new_string, cons LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView()); if (list) { - list->setFilterSubString(new_string, tab->getDisplayChildren()); + list->setFilterSubString(new_string, true); } if (old_string.empty()) @@ -738,6 +784,75 @@ void LLOutfitsList::onOutfitRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUI } } +void LLOutfitsList::handleInvFavColorChange() +{ + for (outfits_map_t::iterator iter = mOutfitsMap.begin(); + iter != mOutfitsMap.end(); + ++iter) + { + if (!iter->second) continue; + LLOutfitAccordionCtrlTab* tab = (LLOutfitAccordionCtrlTab*)iter->second; + + // refresh font color + tab->setFavorite(tab->getFavorite()); + } +} + +void LLOutfitsList::onChangeSortOrder(const LLSD& userdata) +{ + std::string sort_data = userdata.asString(); + if (sort_data == "favorites_to_top") + { + // at the moment this is a toggle + S32 val = gSavedSettings.getS32("OutfitListSortOrder"); + gSavedSettings.setS32("OutfitListSortOrder", (val ? 0 : 1)); + + initComparator(); + } + else if (sort_data == "show_entire_outfit") + { + bool new_val = !gSavedSettings.getBOOL("OutfitListFilterFullList"); + gSavedSettings.setBOOL("OutfitListFilterFullList", new_val); + + if (!getFilterSubString().empty()) + { + for (outfits_map_t::value_type& outfit : mOutfitsMap) + { + LLAccordionCtrlTab* tab = outfit.second; + const LLUUID& category_id = outfit.first; + if (!tab) continue; + + LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView()); + if (list) + { + list->setForceRefresh(true); + list->setForceShowingUnmatchedItems(new_val, tab->getDisplayChildren()); + } + applyFilterToTab(category_id, tab, getFilterSubString()); + } + mAccordion->arrange(); + } + } +} + +LLToggleableMenu* LLOutfitsList::getSortMenu() +{ + if (!mSortMenu) + { + mSortMenu = new LLOutfitListSortMenu(this); + } + return mSortMenu->getMenu(); +} + +void LLOutfitsList::updateMenuItemsVisibility() +{ + if (mSortMenu) + { + mSortMenu->updateItemsVisibility(); + } + LLOutfitListBase::updateMenuItemsVisibility(); +} + LLOutfitListGearMenuBase* LLOutfitsList::createGearMenu() { return new LLOutfitListGearMenu(this); @@ -755,10 +870,10 @@ bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y) LLOutfitListBase::LLOutfitListBase() : LLPanelAppearanceTab() , mIsInitialized(false) + , mGearMenu(nullptr) { mCategoriesObserver = new LLInventoryCategoriesObserver(); mOutfitMenu = new LLOutfitContextMenu(this); - //mGearMenu = createGearMenu(); } LLOutfitListBase::~LLOutfitListBase() @@ -821,6 +936,10 @@ void LLOutfitListBase::observerCallback(const LLUUID& category_id) void LLOutfitListBase::refreshList(const LLUUID& category_id) { + if (LLAppViewer::instance()->quitRequested()) + { + return; + } bool wasNull = mRefreshListState.CategoryUUID.isNull(); mRefreshListState.CategoryUUID.setNull(); @@ -879,8 +998,18 @@ void LLOutfitListBase::onIdle(void* userdata) void LLOutfitListBase::onIdleRefreshList() { + if (LLAppViewer::instance()->quitRequested()) + { + mRefreshListState.CategoryUUID.setNull(); + gIdleCallbacks.deleteFunction(onIdle, this); + return; + } if (mRefreshListState.CategoryUUID.isNull()) + { + LL_WARNS() << "Called onIdleRefreshList without id" << LL_ENDL; + gIdleCallbacks.deleteFunction(onIdle, this); return; + } const F64 MAX_TIME = 0.05f; F64 curent_time = LLTimer::getTotalSeconds(); @@ -1022,12 +1151,6 @@ void LLOutfitListBase::ChangeOutfitSelection(LLWearableItemsList* list, const LL bool LLOutfitListBase::postBuild() { - mGearMenu = createGearMenu(); - - LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn"); - - menu_gear_btn->setMouseDownCallback(boost::bind(&LLOutfitListGearMenuBase::updateItemsVisibility, mGearMenu)); - menu_gear_btn->setMenu(mGearMenu->getMenu()); return true; } @@ -1041,6 +1164,20 @@ void LLOutfitListBase::expandAllFolders() onExpandAllFolders(); } +void LLOutfitListBase::updateMenuItemsVisibility() +{ + mGearMenu->updateItemsVisibility(); +} + +LLToggleableMenu* LLOutfitListBase::getGearMenu() +{ + if (!mGearMenu) + { + mGearMenu = createGearMenu(); + } + return mGearMenu->getMenu(); +}; + void LLOutfitListBase::deselectOutfit(const LLUUID& category_id) { // Reset selection if the outfit is selected. @@ -1067,6 +1204,7 @@ LLContextMenu* LLOutfitContextMenu::createMenu() registrar.add("Outfit.Rename", boost::bind(renameOutfit, selected_id), LLUICtrl::cb_info::UNTRUSTED_BLOCK); registrar.add("Outfit.Delete", boost::bind(&LLOutfitListBase::removeSelected, mOutfitList), LLUICtrl::cb_info::UNTRUSTED_BLOCK); registrar.add("Outfit.Thumbnail", boost::bind(&LLOutfitContextMenu::onThumbnail, this, selected_id)); + registrar.add("Outfit.Favorite", boost::bind(&LLOutfitContextMenu::onFavorite, this, selected_id)); registrar.add("Outfit.Save", boost::bind(&LLOutfitContextMenu::onSave, this, selected_id)); enable_registrar.add("Outfit.OnEnable", boost::bind(&LLOutfitContextMenu::onEnable, this, _2)); @@ -1117,6 +1255,16 @@ bool LLOutfitContextMenu::onVisible(LLSD::String param) { return LLAppearanceMgr::instance().getCanRemoveOutfit(outfit_cat_id); } + else if ("favorites_add" == param) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(outfit_cat_id); + return cat && !cat->getIsFavorite(); + } + else if ("favorites_remove" == param) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(outfit_cat_id); + return cat && cat->getIsFavorite(); + } return true; } @@ -1141,6 +1289,14 @@ void LLOutfitContextMenu::onThumbnail(const LLUUID &outfit_cat_id) } } +void LLOutfitContextMenu::onFavorite(const LLUUID& outfit_cat_id) +{ + if (outfit_cat_id.notNull()) + { + toggle_favorite(outfit_cat_id); + } +} + void LLOutfitContextMenu::onSave(const LLUUID &outfit_cat_id) { if (outfit_cat_id.notNull()) @@ -1171,14 +1327,13 @@ LLOutfitListGearMenuBase::LLOutfitListGearMenuBase(LLOutfitListBase* olist) registrar.add("Gear.Rename", boost::bind(&LLOutfitListGearMenuBase::onRename, this)); registrar.add("Gear.Delete", boost::bind(&LLOutfitListBase::removeSelected, mOutfitList)); registrar.add("Gear.Create", boost::bind(&LLOutfitListGearMenuBase::onCreate, this, _2)); - registrar.add("Gear.Collapse", boost::bind(&LLOutfitListBase::onCollapseAllFolders, mOutfitList)); - registrar.add("Gear.Expand", boost::bind(&LLOutfitListBase::onExpandAllFolders, mOutfitList)); registrar.add("Gear.WearAdd", boost::bind(&LLOutfitListGearMenuBase::onAdd, this)); registrar.add("Gear.Save", boost::bind(&LLOutfitListGearMenuBase::onSave, this)); registrar.add("Gear.Thumbnail", boost::bind(&LLOutfitListGearMenuBase::onThumbnail, this)); - registrar.add("Gear.SortByName", boost::bind(&LLOutfitListGearMenuBase::onChangeSortOrder, this)); + registrar.add("Gear.Favorite", boost::bind(&LLOutfitListGearMenuBase::onFavorite, this)); + registrar.add("Gear.SortByImage", boost::bind(&LLOutfitListGearMenuBase::onChangeSortOrder, this)); enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitListGearMenuBase::onEnable, this, _2)); enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenuBase::onVisible, this, _2)); @@ -1312,6 +1467,16 @@ bool LLOutfitListGearMenuBase::onVisible(LLSD::String param) { return false; } + else if ("favorites_add" == param) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(selected_outfit_id); + return cat && !cat->getIsFavorite(); + } + else if ("favorites_remove" == param) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(selected_outfit_id); + return cat && cat->getIsFavorite(); + } return true; } @@ -1323,6 +1488,12 @@ void LLOutfitListGearMenuBase::onThumbnail() LLFloaterReg::showInstance("change_item_thumbnail", data); } +void LLOutfitListGearMenuBase::onFavorite() +{ + const LLUUID& selected_outfit_id = getSelectedOutfitID(); + toggle_favorite(selected_outfit_id); +} + void LLOutfitListGearMenuBase::onChangeSortOrder() { @@ -1338,14 +1509,77 @@ LLOutfitListGearMenu::~LLOutfitListGearMenu() void LLOutfitListGearMenu::onUpdateItemsVisibility() { if (!mMenu) return; - mMenu->setItemVisible("expand", true); - mMenu->setItemVisible("collapse", true); mMenu->setItemVisible("thumbnail", getSelectedOutfitID().notNull()); - mMenu->setItemVisible("sepatator3", false); - mMenu->setItemVisible("sort_folders_by_name", false); + mMenu->setItemVisible("favorite", getSelectedOutfitID().notNull()); LLOutfitListGearMenuBase::onUpdateItemsVisibility(); } +//////////////////// LLOutfitListSortMenu //////////////////// + +LLOutfitListSortMenu::LLOutfitListSortMenu(LLOutfitListBase* parent_panel) + : mPanelHandle(parent_panel->getHandle()) +{ + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; + + registrar.add("Sort.Collapse", { boost::bind(&LLOutfitListBase::onCollapseAllFolders, parent_panel) }); + registrar.add("Sort.Expand", { boost::bind(&LLOutfitListBase::onExpandAllFolders, parent_panel) }); + registrar.add("Sort.OnSort", { boost::bind(&LLOutfitListBase::onChangeSortOrder, parent_panel, _2) }); + enable_registrar.add("Sort.OnEnable", boost::bind(&LLOutfitListSortMenu::onEnable, this, _2)); + + mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>( + "menu_outfit_list_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + llassert(mMenu); +} + + +LLToggleableMenu* LLOutfitListSortMenu::getMenu() +{ + return mMenu; +} + +void LLOutfitListSortMenu::updateItemsVisibility() +{ + onUpdateItemsVisibility(); +} + +void LLOutfitListSortMenu::onUpdateItemsVisibility() +{ + if (!mMenu) return; + mMenu->setItemVisible("expand", true); + mMenu->setItemVisible("collapse", true); + mMenu->setItemVisible("sort_favorites_to_top", true); + mMenu->setItemVisible("show_entire_outfit_in_search", true); +} + +bool LLOutfitListSortMenu::onEnable(LLSD::String param) +{ + if ("favorites_to_top" == param) + { + static LLCachedControl<S32> sort_order(gSavedSettings, "OutfitListSortOrder", 0); + return sort_order == 1; + } + else if ("show_entire_outfit" == param) + { + static LLCachedControl<bool> filter_mode(gSavedSettings, "OutfitListFilterFullList", 0); + return filter_mode; + } + + return false; +} + + +//////////////////// LLOutfitAccordionCtrlTab //////////////////// + +LLUIImage* LLOutfitAccordionCtrlTab::sFavoriteIcon; +LLUIColor LLOutfitAccordionCtrlTab::sFgColor; + +void LLOutfitAccordionCtrlTab::draw() +{ + LLAccordionCtrlTab::draw(); + drawFavoriteIcon(); +} + bool LLOutfitAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) { if (y >= getLocalRect().getHeight() - getHeaderHeight()) @@ -1366,4 +1600,61 @@ bool LLOutfitAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask) return LLAccordionCtrlTab::handleToolTip(x, y, mask); } + +void LLOutfitAccordionCtrlTab::setFavorite(bool is_favorite) +{ + mIsFavorite = is_favorite; + static LLUICachedControl<bool> highlight_color("InventoryFavoritesColorText", true); + if (!mIsSelected && mIsFavorite && highlight_color()) + { + setTitleColor(LLUIColorTable::instance().getColor("InventoryFavoriteColor")); + } + else + { + setTitleColor(LLUIColorTable::instance().getColor("AccordionHeaderTextColor")); + } +} + +void LLOutfitAccordionCtrlTab::setOutfitSelected(bool val) +{ + mIsSelected = val; + if (val) + { + setTitleFontStyle("BOLD"); + setTitleColor(LLUIColorTable::instance().getColor("SelectedOutfitTextColor")); + } + else + { + setTitleFontStyle("NORMAL"); + static LLUICachedControl<bool> highlight_color("InventoryFavoritesColorText", true); + if (mIsFavorite && highlight_color()) + { + setTitleColor(LLUIColorTable::instance().getColor("InventoryFavoriteColor")); + } + else + { + setTitleColor(LLUIColorTable::instance().getColor("AccordionHeaderTextColor")); + } + } +} + +void LLOutfitAccordionCtrlTab::drawFavoriteIcon() +{ + if (!mIsFavorite) + { + return; + } + static LLUICachedControl<bool> draw_star("InventoryFavoritesUseStar", true); + if (!draw_star) + { + return; + } + + const S32 PAD = 2; + const S32 image_size = 18; + + gl_draw_scaled_image( + getRect().getWidth() - image_size - PAD, getRect().getHeight() - image_size - PAD, + image_size, image_size, sFavoriteIcon->getImage(), sFgColor); +} // EOF diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index f581b419d9..8c926a85f6 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -41,6 +41,7 @@ class LLAccordionCtrlTab; class LLInventoryCategoriesObserver; class LLOutfitListGearMenuBase; +class LLOutfitListSortMenuBase; class LLWearableItemsList; class LLListContextMenu; @@ -61,6 +62,17 @@ public: /*virtual*/ bool compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const; }; +class LLOutfitTabFavComparator : public LLAccordionCtrl::LLTabComparator +{ + LOG_CLASS(LLOutfitTabFavComparator); + +public: + LLOutfitTabFavComparator() {}; + virtual ~LLOutfitTabFavComparator() {}; + + /*virtual*/ bool compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const; +}; + class LLOutfitListBase : public LLPanelAppearanceTab { public: @@ -92,6 +104,7 @@ public: boost::signals2::connection setSelectionChangeCallback(selection_change_callback_t cb); void outfitRightClickCallBack(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id); + void onAction(const LLSD& userdata); virtual bool isActionEnabled(const LLSD& userdata); virtual void performAction(std::string action); virtual bool hasItemSelected() = 0; @@ -109,6 +122,12 @@ public: virtual bool getHasExpandableFolders() = 0; + virtual void onChangeSortOrder(const LLSD& userdata) = 0; + + virtual void updateMenuItemsVisibility(); + virtual LLToggleableMenu* getGearMenu(); + virtual bool getTrashMenuVisible() { return true; }; + protected: void observerCallback(const LLUUID& category_id); virtual LLOutfitListGearMenuBase* createGearMenu() = 0; @@ -139,6 +158,7 @@ protected: selection_change_signal_t mSelectionChangeSignal; LLListContextMenu* mOutfitMenu; LLOutfitListGearMenuBase* mGearMenu; + boost::signals2::connection mGearMenuConnection; }; ////////////////////////////////////////////////////////////////////////// @@ -155,7 +175,6 @@ protected: /* virtual */ LLContextMenu* createMenu(); bool onEnable(LLSD::String param); - bool onVisible(LLSD::String param); static void editOutfit(); @@ -163,6 +182,7 @@ protected: static void renameOutfit(const LLUUID& outfit_cat_id); void onThumbnail(const LLUUID &outfit_cat_id); + void onFavorite(const LLUUID& outfit_cat_id); void onSave(const LLUUID &outfit_cat_id); private: @@ -182,6 +202,7 @@ public: protected: virtual void onUpdateItemsVisibility(); virtual void onThumbnail(); + virtual void onFavorite(); virtual void onChangeSortOrder(); const LLUUID& getSelectedOutfitID(); @@ -202,6 +223,23 @@ private: bool onVisible(LLSD::String param); }; +class LLOutfitListSortMenu +{ +public: + LLOutfitListSortMenu(LLOutfitListBase* parent_panel); + + LLToggleableMenu* getMenu(); + void updateItemsVisibility(); + +private: + void onUpdateItemsVisibility(); + bool onEnable(LLSD::String param); + + LLToggleableMenu* mMenu; + LLHandle<LLPanel> mPanelHandle; +}; + + class LLOutfitListGearMenu : public LLOutfitListGearMenuBase { public: @@ -221,8 +259,16 @@ public: Params() : cat_id("cat_id") {} }; + virtual void draw(); virtual bool handleToolTip(S32 x, S32 y, MASK mask); + void setFavorite(bool is_favorite); + bool getFavorite() const { return mIsFavorite; } + void setOutfitSelected(bool val); + + static LLUIImage* sFavoriteIcon; + static LLUIColor sFgColor; + protected: LLOutfitAccordionCtrlTab(const LLOutfitAccordionCtrlTab::Params &p) : LLAccordionCtrlTab(p), @@ -230,7 +276,11 @@ public: {} friend class LLUICtrlFactory; + void drawFavoriteIcon(); + LLUUID mFolderID; + bool mIsFavorite = false; + bool mIsSelected = false; }; /** * @class LLOutfitsList @@ -249,6 +299,7 @@ public: virtual ~LLOutfitsList(); /*virtual*/ bool postBuild(); + void initComparator(); /*virtual*/ void onOpen(const LLSD& info); @@ -287,6 +338,10 @@ public: /*virtual*/ bool getHasExpandableFolders() { return true; } + /*virtual*/ void onChangeSortOrder(const LLSD& userdata); + virtual LLToggleableMenu* getSortMenu(); + void updateMenuItemsVisibility(); + protected: LLOutfitListGearMenuBase* createGearMenu(); @@ -357,6 +412,8 @@ private: static void onOutfitRename(const LLSD& notification, const LLSD& response); + void handleInvFavColorChange(); + //LLInventoryCategoriesObserver* mCategoriesObserver; LLAccordionCtrl* mAccordion; @@ -374,13 +431,15 @@ private: // Used to monitor COF changes for updating items worn state. See EXT-8636. uuid_vec_t mCOFLinkedItems; - //LLOutfitListGearMenu* mGearMenu; + LLOutfitListSortMenu* mSortMenu; //bool mIsInitialized; /** * True if there is a selection inside currently selected outfit */ bool mItemSelected; + + boost::signals2::connection mSavedSettingInvFavColor; }; #endif //LL_LLOUTFITSLIST_H diff --git a/indra/newview/llpanelappearancetab.h b/indra/newview/llpanelappearancetab.h index e4d16582de..e088c3e6f0 100644 --- a/indra/newview/llpanelappearancetab.h +++ b/indra/newview/llpanelappearancetab.h @@ -29,6 +29,8 @@ #include "llpanel.h" +class LLToggleableMenu; + class LLPanelAppearanceTab : public LLPanel { public: @@ -47,6 +49,11 @@ public: const std::string& getFilterSubString() { return mFilterSubString; } + virtual void updateMenuItemsVisibility() = 0; + virtual LLToggleableMenu* getGearMenu() = 0; + virtual LLToggleableMenu* getSortMenu() = 0; + virtual bool getTrashMenuVisible() = 0; + protected: /** diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 7a63c6e10d..5de68950c6 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -481,10 +481,6 @@ LLPanelFace::~LLPanelFace() void LLPanelFace::onVisibilityChange(bool new_visibility) { - if (new_visibility) - { - gAgent.showLatestFeatureNotification("gltf"); - } LLPanel::onVisibilityChange(new_visibility); } diff --git a/indra/newview/llpanelgroupcreate.cpp b/indra/newview/llpanelgroupcreate.cpp index 4a370525ff..bc7b5caddf 100644 --- a/indra/newview/llpanelgroupcreate.cpp +++ b/indra/newview/llpanelgroupcreate.cpp @@ -85,6 +85,7 @@ bool LLPanelGroupCreate::postBuild() mInsignia = getChild<LLTextureCtrl>("insignia", true); mInsignia->setAllowLocalTexture(false); + mInsignia->setBakeTextureEnabled(false); mInsignia->setCanApplyImmediately(false); return true; diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index ca429ae2f8..270ca29403 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -197,6 +197,7 @@ void LLPanelGroupGeneral::setupCtrls(LLPanel* panel_group) { mInsignia->setCommitCallback(onCommitAny, this); mInsignia->setAllowLocalTexture(false); + mInsignia->setBakeTextureEnabled(false); } mFounderName = getChild<LLTextBox>("founder_name"); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 48f32a05ba..36a8069010 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -68,6 +68,7 @@ const std::string FILTERS_FILENAME("filters.xml"); const std::string ALL_ITEMS("All Items"); const std::string RECENT_ITEMS("Recent Items"); const std::string WORN_ITEMS("Worn Items"); +const std::string FAVORITES("Favorites"); static LLPanelInjector<LLPanelMainInventory> t_inventory("panel_main_inventory"); @@ -216,6 +217,17 @@ bool LLPanelMainInventory::postBuild() worn_filter.markDefault(); mWornItemsPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mWornItemsPanel, _1, _2)); } + + LLInventoryPanel* favorites_panel = getChild<LLInventoryPanel>(FAVORITES); + if (favorites_panel) + { + favorites_panel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER)); + LLInventoryFilter& favorites_filter = favorites_panel->getFilter(); + favorites_filter.setEmptyLookupMessage("InventoryNoMatchingFavorites"); + favorites_filter.markDefault(); + favorites_panel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, favorites_panel, _1, _2)); + } + mSearchTypeCombo = getChild<LLComboBox>("search_type"); if(mSearchTypeCombo) { diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index dcd7fdf30d..9a5b7a5d15 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -129,6 +129,7 @@ public: virtual void navigateToFolder(bool new_window = false, bool change_mode = false) {} virtual bool isItemRenameable() const; virtual bool renameItem(const std::string& new_name); + virtual bool isFavorite() const { return false; } virtual bool isItemMovable() const; virtual bool isItemRemovable(bool check_worn = true) const; virtual bool removeItem(); @@ -306,17 +307,28 @@ bool LLTaskInvFVBridge::isItemRenameable() const bool LLTaskInvFVBridge::renameItem(const std::string& new_name) { - if (LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID())) + LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); + if (!object) { - if (LLViewerInventoryItem* item = (LLViewerInventoryItem*)object->getInventoryObject(mUUID)) - { - if (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE, GOD_LIKE)) - { - LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); - new_item->rename(new_name); - object->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, false); - } - } + return false; + } + if (!object->permModify()) + { + LLNotificationsUtil::add("CantModifyContentInNoModTask"); + return false; + } + + LLViewerInventoryItem* item = NULL; + item = (LLViewerInventoryItem*)object->getInventoryObject(mUUID); + if (item && (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), + GP_OBJECT_MANIPULATE, GOD_LIKE))) + { + LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); + new_item->rename(new_name); + object->updateInventory( + new_item, + TASK_INVENTORY_ITEM_KEY, + false); } return true; @@ -1366,7 +1378,23 @@ bool LLPanelObjectInventory::postBuild() void LLPanelObjectInventory::doToSelected(const LLSD& userdata) { - LLInventoryAction::doToSelected(&gInventory, mFolders, userdata.asString()); + std::string action = userdata.asString(); + if ("rename" == action || "delete" == action) + { + LLViewerObject* objectp = gObjectList.findObject(mTaskUUID); + if (objectp && !objectp->permModify()) + { + LLNotificationsUtil::add("CantModifyContentInNoModTask"); + } + else + { + LLInventoryAction::doToSelected(&gInventory, mFolders, action); + } + } + else + { + LLInventoryAction::doToSelected(&gInventory, mFolders, action); + } } void LLPanelObjectInventory::clearContents() diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 1c2dac6d6e..241cb97f06 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -404,7 +404,9 @@ LLPanelOutfitEdit::LLPanelOutfitEdit() mWearableListManager(NULL), mPlusBtn(NULL), mWearablesGearMenuBtn(NULL), - mGearMenuBtn(NULL) + mGearMenuBtn(NULL), + mStatus(NULL), + mCurrentOutfitName(NULL) { mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(false); diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 47c02793a3..e2e2cf1a61 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -33,6 +33,7 @@ #include "llfloatersidepanelcontainer.h" #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" +#include "llmenubutton.h" #include "llnotificationsutil.h" #include "lloutfitgallery.h" #include "lloutfitobserver.h" @@ -53,12 +54,17 @@ static const std::string SAVE_BTN("save_btn"); static LLPanelInjector<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory"); -LLPanelOutfitsInventory::LLPanelOutfitsInventory() : - mMyOutfitsPanel(NULL), - mCurrentOutfitPanel(NULL), - mActivePanel(NULL), - mAppearanceTabs(NULL), - mInitialized(false) +LLPanelOutfitsInventory::LLPanelOutfitsInventory() + : mMyOutfitsPanel(nullptr) + , mCurrentOutfitPanel(nullptr) + , mActivePanel(nullptr) + , mAppearanceTabs(nullptr) + , mInitialized(false) + , mGearMenu(nullptr) + , mSortMenu(nullptr) + , mTrashBtn(nullptr) + , mSortMenuPanel(nullptr) + , mTrashMenuPanel(nullptr) { gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitsInventory::onWearablesLoaded, this)); gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitsInventory::onWearablesLoading, this)); @@ -75,6 +81,9 @@ LLPanelOutfitsInventory::~LLPanelOutfitsInventory() { gSavedSettings.setS32("LastAppearanceTab", mAppearanceTabs->getCurrentPanelIndex()); } + mGearMenuConnection.disconnect(); + mSortMenuConnection.disconnect(); + mTrashMenuConnection.disconnect(); } // virtual @@ -258,6 +267,22 @@ void LLPanelOutfitsInventory::initListCommandsHandlers() mOutfitGalleryPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this)); } +void LLPanelOutfitsInventory::setMenuButtons(LLMenuButton* gear_menu, LLMenuButton* sort_menu, LLButton* trash_btn, LLPanel* sort_menu_panel, LLPanel* trash_menu_panel) +{ + mGearMenu = gear_menu; + mSortMenu = sort_menu; + mTrashBtn = trash_btn; + mSortMenuPanel = sort_menu_panel; + mTrashMenuPanel = trash_menu_panel; + + mGearMenuConnection.disconnect(); + mSortMenuConnection.disconnect(); + mTrashMenuConnection.disconnect(); + mGearMenuConnection = mGearMenu->setMouseDownCallback(boost::bind(&LLPanelOutfitsInventory::onGearMouseDown, this)); + mSortMenuConnection = mSortMenu->setMouseDownCallback(boost::bind(&LLPanelOutfitsInventory::onGearMouseDown, this)); + mTrashMenuConnection = mTrashBtn->setClickedCallback(boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this)); +} + void LLPanelOutfitsInventory::updateListCommands() { bool trash_enabled = isActionEnabled("delete"); @@ -284,6 +309,14 @@ void LLPanelOutfitsInventory::onTrashButtonClick() } } +void LLPanelOutfitsInventory::onGearMouseDown() +{ + if (mActivePanel) + { + mActivePanel->updateMenuItemsVisibility(); + } +} + bool LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata) { return mActivePanel && mActivePanel->isActionEnabled(userdata); @@ -320,6 +353,28 @@ void LLPanelOutfitsInventory::onTabChange() mActivePanel->checkFilterSubString(); mActivePanel->onOpen(LLSD()); + if (mGearMenu) + { + mGearMenu->setMenu(mActivePanel->getGearMenu(), LLMenuButton::MP_BOTTOM_LEFT); + } + if (mSortMenu && mSortMenuPanel) + { + LLToggleableMenu* menu = mActivePanel->getSortMenu(); + if (menu) + { + mSortMenu->setMenu(menu, LLMenuButton::MP_BOTTOM_LEFT); + mSortMenuPanel->setVisible(true); + } + else + { + mSortMenuPanel->setVisible(false); + } + } + if (mTrashMenuPanel) + { + mTrashMenuPanel->setVisible(mActivePanel->getTrashMenuVisible()); + } + updateVerbs(); } diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index e046681e95..29f7eb44f7 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -30,11 +30,13 @@ #include "llpanel.h" +class LLButton; class LLOutfitGallery; class LLOutfitsList; class LLOutfitListGearMenuBase; class LLPanelAppearanceTab; class LLPanelWearing; +class LLMenuButton; class LLMenuGL; class LLSidepanelAppearance; class LLTabContainer; @@ -63,6 +65,13 @@ public: bool isCOFPanelActive() const; + void setMenuButtons( + LLMenuButton* gear_menu, + LLMenuButton* sort_menu, + LLButton* trash_btn, + LLPanel* sort_menu_panel, + LLPanel* trash_menu_panel); + protected: void updateVerbs(); @@ -92,20 +101,29 @@ protected: void initListCommandsHandlers(); void updateListCommands(); void onWearButtonClick(); - void showGearMenu(); void onTrashButtonClick(); + void onGearMouseDown(); bool isActionEnabled(const LLSD& userdata); void setWearablesLoading(bool val); void onWearablesLoaded(); void onWearablesLoading(); private: LLPanel* mListCommands; - LLMenuGL* mMenuAdd; LLButton* mWearBtn = nullptr; // List Commands // ////////////////////////////////////////////////////////////////////////////////// bool mInitialized; + + // not owned items + LLMenuButton* mGearMenu; + LLMenuButton* mSortMenu; + LLButton* mTrashBtn; + LLPanel* mSortMenuPanel; + LLPanel* mTrashMenuPanel; + boost::signals2::connection mGearMenuConnection; + boost::signals2::connection mSortMenuConnection; + boost::signals2::connection mTrashMenuConnection; }; #endif //LL_LLPANELOUTFITSINVENTORY_H diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index 283be752ed..6580752c79 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -350,7 +350,10 @@ void PeopleContextMenu::eject() avatar = (LLVOAvatar*) object; } } - if (!avatar) return; + + if (!avatar) + return; + LLSD payload; payload["avatar_id"] = avatar->getID(); std::string fullname = avatar->getFullname(); diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 0ce1f0f9d3..891896076a 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -176,7 +176,7 @@ bool LLPanelPermissions::postBuild() childSetCommitCallback("sale type",LLPanelPermissions::onCommitSaleType,this); - childSetCommitCallback("Edit Cost", LLPanelPermissions::onCommitSaleInfo, this); + childSetCommitCallback("Edit Cost", LLPanelPermissions::onCommitSalePrice, this); childSetCommitCallback("checkbox next owner can modify",LLPanelPermissions::onCommitNextOwnerModify,this); childSetCommitCallback("checkbox next owner can copy",LLPanelPermissions::onCommitNextOwnerCopy,this); @@ -781,7 +781,9 @@ void LLPanelPermissions::refresh() if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) { - getChildView("checkbox for sale")->setEnabled(can_transfer || (!can_transfer && num_for_sale)); + bool change_sale_allowed = can_transfer || (!can_transfer && num_for_sale); + getChildView("checkbox for sale")->setEnabled(change_sale_allowed); + getChildView("Edit Cost")->setEnabled(change_sale_allowed && !is_for_sale_mixed); // Set the checkbox to tentative if the prices of each object selected // are not the same. getChild<LLUICtrl>("checkbox for sale")->setTentative( is_for_sale_mixed); @@ -1223,6 +1225,16 @@ void LLPanelPermissions::onCommitSaleType(LLUICtrl*, void* data) self->setAllSaleInfo(); } +void LLPanelPermissions::onCommitSalePrice(LLUICtrl *, void *data) +{ + LLPanelPermissions *self = (LLPanelPermissions *) data; + LLCheckBoxCtrl *checkPurchase = self->getChild<LLCheckBoxCtrl>("checkbox for sale"); + if (checkPurchase && checkPurchase->get()) + { + self->setAllSaleInfo(); + } +} + void LLPanelPermissions::setAllSaleInfo() { LL_INFOS() << "LLPanelPermissions::setAllSaleInfo()" << LL_ENDL; diff --git a/indra/newview/llpanelpermissions.h b/indra/newview/llpanelpermissions.h index 77129434ed..12e88361c9 100644 --- a/indra/newview/llpanelpermissions.h +++ b/indra/newview/llpanelpermissions.h @@ -77,6 +77,7 @@ protected: static void onCommitSaleInfo(LLUICtrl* ctrl, void* data); static void onCommitSaleType(LLUICtrl* ctrl, void* data); + static void onCommitSalePrice(LLUICtrl *ctrl, void *data); void setAllSaleInfo(); static void onCommitClickAction(LLUICtrl* ctrl, void*); diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 5c54a3fc27..b0aadff277 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -2052,6 +2052,7 @@ void LLPanelProfileFirstLife::onChangePhoto() } }); texture_floaterp->setLocalTextureEnabled(false); + texture_floaterp->setBakeTextureEnabled(false); texture_floaterp->setCanApply(false, true, false); parent_floater->addDependentFloater(mFloaterTexturePickerHandle); diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index 1056f73d58..b4f6db9287 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -113,6 +113,7 @@ protected: boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs, no_op)); registrar.add("Wearing.Detach", boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), mUUIDs, no_op)); + registrar.add("Wearing.Favorite", boost::bind(toggle_favorites, mUUIDs)); LLContextMenu* menu = createFromFile("menu_wearing_tab.xml"); updateMenuItemsVisibility(menu); @@ -125,6 +126,8 @@ protected: bool bp_selected = false; // true if body parts selected bool clothes_selected = false; bool attachments_selected = false; + bool can_favorite = false; + bool can_unfavorite = false; // See what types of wearables are selected. for (uuid_vec_t::const_iterator it = mUUIDs.begin(); it != mUUIDs.end(); ++it) @@ -137,6 +140,9 @@ protected: continue; } + LLUUID linked_id = item->getLinkedUUID(); + LLViewerInventoryItem* linked_item = gInventory.getItem(linked_id); + LLAssetType::EType type = item->getType(); if (type == LLAssetType::AT_CLOTHING) { @@ -150,6 +156,8 @@ protected: { attachments_selected = true; } + can_favorite |= !linked_item->getIsFavorite(); + can_unfavorite |= linked_item->getIsFavorite(); } // Enable/disable some menu items depending on the selection. @@ -162,10 +170,12 @@ protected: menu->setItemEnabled("touch_attach", 1 == mUUIDs.size() && enable_attachment_touch(mUUIDs.front())); menu->setItemVisible("edit_item", show_edit); menu->setItemEnabled("edit_item", 1 == mUUIDs.size() && get_is_item_editable(mUUIDs.front())); - menu->setItemVisible("take_off", allow_take_off); - menu->setItemVisible("detach", allow_detach); + menu->setItemVisible("take_off", allow_take_off); + menu->setItemVisible("detach", allow_detach); menu->setItemVisible("edit_outfit_separator", show_touch | show_edit | allow_take_off || allow_detach); - menu->setItemVisible("show_original", mUUIDs.size() == 1); + menu->setItemVisible("show_original", mUUIDs.size() == 1); + menu->setItemVisible("favorites_add", can_favorite); + menu->setItemVisible("favorites_remove", can_unfavorite); } }; @@ -232,6 +242,10 @@ LLPanelWearing::~LLPanelWearing() { mAttachmentsChangedConnection.disconnect(); } + if (mGearMenuConnection.connected()) + { + mGearMenuConnection.disconnect(); + } } bool LLPanelWearing::postBuild() @@ -249,10 +263,6 @@ bool LLPanelWearing::postBuild() mTempItemsList->setFgUnselectedColor(LLColor4::white); mTempItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onTempAttachmentsListRightClick, this, _1, _2, _3)); - LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn"); - - menu_gear_btn->setMenu(mGearMenu->getMenu()); - return true; } @@ -560,6 +570,16 @@ void LLPanelWearing::onRemoveAttachment() } } +LLToggleableMenu* LLPanelWearing::getGearMenu() +{ + return mGearMenu->getMenu(); +} + +LLToggleableMenu* LLPanelWearing::getSortMenu() +{ + return NULL; +} + void LLPanelWearing::onRemoveItem() { if (mWearablesTab->isExpanded()) diff --git a/indra/newview/llpanelwearing.h b/indra/newview/llpanelwearing.h index ea0787d0ef..aa80a3fc21 100644 --- a/indra/newview/llpanelwearing.h +++ b/indra/newview/llpanelwearing.h @@ -84,6 +84,11 @@ public: void onEditAttachment(); void onRemoveAttachment(); + void updateMenuItemsVisibility() {}; + LLToggleableMenu* getGearMenu(); + LLToggleableMenu* getSortMenu(); + bool getTrashMenuVisible() { return false; } + private: void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y); void onTempAttachmentsListRightClick(LLUICtrl* ctrl, S32 x, S32 y); @@ -93,6 +98,7 @@ private: LLWearableItemsList* mCOFItemsList; LLScrollListCtrl* mTempItemsList; LLWearingGearMenu* mGearMenu; + boost::signals2::connection mGearMenuConnection; LLListContextMenu* mContextMenu; LLListContextMenu* mAttachmentsMenu; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 51da051340..9cce47107a 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -243,6 +243,23 @@ LLSelectMgr::LLSelectMgr() mForceSelection = false; mShowSelection = false; + + LLControlVariable* ctrl = gSavedSettings.getControl("DebugSelectionLODs").get(); + if (ctrl) + { + mSlectionLodModChangedConnection = ctrl->getSignal()->connect([this](LLControlVariable*, const LLSD&, const LLSD&) + { + for (LLObjectSelection::iterator iter = mSelectedObjects->begin(); + iter != mSelectedObjects->end(); ++iter) + { + LLViewerObject* object = (*iter)->getObject(); + if (object) + { + object->updateLOD(); + } + } + }); + } } @@ -252,6 +269,7 @@ LLSelectMgr::LLSelectMgr() LLSelectMgr::~LLSelectMgr() { clearSelections(); + mSlectionLodModChangedConnection.disconnect(); } void LLSelectMgr::clearSelections() diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index f8242675dc..40e4891bd9 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -938,6 +938,7 @@ private: bool mForceSelection; std::vector<LLAnimPauseRequest> mPauseRequests; + boost::signals2::connection mSlectionLodModChangedConnection; }; // *DEPRECATED: For callbacks or observers, use diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index c618483fc4..1d1b31d2a6 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -40,6 +40,7 @@ #include "llfloaterworldmap.h" #include "llfolderviewmodel.h" #include "llloadingindicator.h" +#include "llmenubutton.h" #include "lloutfitobserver.h" #include "llpaneleditwearable.h" #include "llpaneloutfitsinventory.h" @@ -145,6 +146,14 @@ bool LLSidepanelAppearance::postBuild() setWearablesLoading(gAgentWearables.isCOFChangeInProgress()); + + LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn"); + LLMenuButton* menu_sort_btn = getChild<LLMenuButton>("sorting_menu_btn"); + LLButton* menu_trash_btn = getChild<LLButton>("trash_btn"); + LLPanel* menu_sort_btn_panel = getChild<LLPanel>("options_sort_btn_panel"); + LLPanel* menu_trash_btn_panel = getChild<LLPanel>("trash_btn_panel"); + mPanelOutfitsInventory->setMenuButtons(menu_gear_btn, menu_sort_btn, menu_trash_btn, menu_sort_btn_panel, menu_trash_btn_panel); + return true; } diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 385e4314a9..8998d61c47 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -56,6 +56,8 @@ #include "llviewerregion.h" +const char* const DEFAULT_DESC = "(No Description)"; + class PropertiesChangedCallback : public LLInventoryCallback { public: @@ -128,6 +130,7 @@ LLSidepanelItemInfo::LLSidepanelItemInfo(const LLPanel::Params& p) , mUpdatePendingId(-1) , mIsDirty(false) /*Not ready*/ , mParentFloater(NULL) + , mLabelItemDesc(NULL) { gInventory.addObserver(this); gIdleCallbacks.addFunction(&LLSidepanelItemInfo::onIdle, (void*)this); @@ -158,10 +161,11 @@ bool LLSidepanelItemInfo::postBuild() mItemTypeIcon = getChild<LLIconCtrl>("item_type_icon"); mLabelOwnerName = getChild<LLTextBox>("LabelOwnerName"); mLabelCreatorName = getChild<LLTextBox>("LabelCreatorName"); + mLabelItemDesc = getChild<LLTextEditor>("LabelItemDesc"); getChild<LLLineEditor>("LabelItemName")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe); getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitName,this)); - getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this)); + mLabelItemDesc->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this)); // Thumnail edition mChangeThumbnailBtn->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onEditThumbnail, this)); // acquired date @@ -342,10 +346,14 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) getChildView("LabelItemName")->setEnabled(is_modifiable && !is_calling_card); // for now, don't allow rename of calling cards getChild<LLUICtrl>("LabelItemName")->setValue(item->getName()); getChildView("LabelItemDescTitle")->setEnabled(true); - getChildView("LabelItemDesc")->setEnabled(is_modifiable); - getChild<LLUICtrl>("LabelItemDesc")->setValue(item->getDescription()); getChild<LLUICtrl>("item_thumbnail")->setValue(item->getThumbnailUUID()); + // Asset upload substitutes empty description with a (No Description) placeholder + std::string desc = item->getDescription(); + mLabelItemDesc->setSelectAllOnFocusReceived(desc == DEFAULT_DESC); + mLabelItemDesc->setValue(desc); + mLabelItemDesc->setEnabled(is_modifiable); + LLUIImagePtr icon_img = LLInventoryIcon::getIcon(item->getType(), item->getInventoryType(), item->getFlags(), false); mItemTypeIcon->setImage(icon_img); @@ -924,17 +932,22 @@ void LLSidepanelItemInfo::onCommitDescription() LLViewerInventoryItem* item = findItem(); if(!item) return; - LLTextEditor* labelItemDesc = getChild<LLTextEditor>("LabelItemDesc"); - if(!labelItemDesc) + if(!mLabelItemDesc) + { + return; + } + if (!gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)) { return; } - if((item->getDescription() != labelItemDesc->getText()) && - (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE))) + std::string old_desc = item->getDescription(); + std::string new_desc = mLabelItemDesc->getText(); + if(old_desc != new_desc) { + mLabelItemDesc->setSelectAllOnFocusReceived(false); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); - new_item->setDescription(labelItemDesc->getText()); + new_item->setDescription(new_desc); onCommitChanges(new_item); } } diff --git a/indra/newview/llsidepaneliteminfo.h b/indra/newview/llsidepaneliteminfo.h index 718edc79d6..0895d3360c 100644 --- a/indra/newview/llsidepaneliteminfo.h +++ b/indra/newview/llsidepaneliteminfo.h @@ -46,6 +46,7 @@ class LLObjectInventoryObserver; class LLViewerObject; class LLPermissions; class LLTextBox; +class LLTextEditor; class LLSidepanelItemInfo : public LLPanel, public LLInventoryObserver { @@ -105,6 +106,7 @@ private: LLIconCtrl* mItemTypeIcon; LLTextBox* mLabelOwnerName; LLTextBox* mLabelCreatorName; + LLTextEditor* mLabelItemDesc; // // UI Elements diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp index cee43f3cff..afa4686d52 100644 --- a/indra/newview/llskinningutil.cpp +++ b/indra/newview/llskinningutil.cpp @@ -116,8 +116,8 @@ void LLSkinningUtil::scrubInvalidJoints(LLVOAvatar *avatar, LLMeshSkinInfo* skin // needed for handling of any legacy bad data. if (!avatar->getJoint(skin->mJointNames[j])) { - LL_DEBUGS("Avatar") << avatar->getFullname() << " mesh rigged to invalid joint " << skin->mJointNames[j] << LL_ENDL; - LL_WARNS_ONCE("Avatar") << avatar->getFullname() << " mesh rigged to invalid joint" << skin->mJointNames[j] << LL_ENDL; + LL_DEBUGS("Avatar") << avatar->getDebugName() << " mesh rigged to invalid joint " << skin->mJointNames[j] << LL_ENDL; + LL_WARNS_ONCE("Avatar") << avatar->getDebugName() << " mesh rigged to invalid joint" << skin->mJointNames[j] << LL_ENDL; skin->mJointNames[j] = "mPelvis"; skin->mJointNumsInitialized = false; // force update after names change. } diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index ea95d71b27..7d5f380886 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -1066,7 +1066,7 @@ void LLSnapshotLivePreview::saveTexture(bool outfit_snapshot, std::string name) tid, LLAssetType::AT_TEXTURE, res_name, res_desc, 0, folder_type, inv_type, PERM_ALL, LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), - expected_upload_cost, !outfit_snapshot)); + expected_upload_cost, LLUUID::null, !outfit_snapshot)); upload_new_resource(assetUploadInfo); diff --git a/indra/newview/llteleporthistorystorage.cpp b/indra/newview/llteleporthistorystorage.cpp index dd7c6aa9e3..e02f76711c 100644 --- a/indra/newview/llteleporthistorystorage.cpp +++ b/indra/newview/llteleporthistorystorage.cpp @@ -127,6 +127,12 @@ void LLTeleportHistoryStorage::addItem(const std::string title, const LLVector3d S32 removed_index = -1; if (item_iter != mItems.end()) { + // When teleporting via history it's possible that there can be + // an offset applied to the position, so each new teleport can + // be a meter higher than the last. + // Avoid it by preserving original position. + item.mGlobalPos = item_iter->mGlobalPos; + removed_index = (S32)(item_iter - mItems.begin()); mItems.erase(item_iter); } diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index db3e6335ec..c51e90e632 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -185,6 +185,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mSetImageAssetIDCallback(NULL), mOnUpdateImageStatsCallback(NULL), mBakeTextureEnabled(false), + mLocalTextureEnabled(false), mInventoryPickType(pick_type), mSelectionSource(PICKER_UNKNOWN) { @@ -529,6 +530,8 @@ bool LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask) void LLFloaterTexturePicker::onOpen(const LLSD& key) { if (sLastPickerMode != 0 + && (mLocalTextureEnabled || sLastPickerMode != 1) + && (mBakeTextureEnabled || sLastPickerMode != 2) && mModeSelector->selectByValue(sLastPickerMode)) { changeMode(); @@ -1507,7 +1510,13 @@ void LLFloaterTexturePicker::refreshInventoryFilter() void LLFloaterTexturePicker::setLocalTextureEnabled(bool enabled) { + mLocalTextureEnabled = enabled; mModeSelector->setEnabledByValue(1, enabled); + if (!enabled && (mModeSelector->getValue().asInteger() == 2)) + { + mModeSelector->selectByValue(0); + onModeSelect(0, this); + } } void LLFloaterTexturePicker::setBakeTextureEnabled(bool enabled) @@ -1895,11 +1904,9 @@ void LLTextureCtrl::showPicker(bool take_focus) if (texture_floaterp) { texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLTextureCtrl::onFloaterCommit, this, _1, _2, _3, _4, _5)); - } - if (texture_floaterp) - { texture_floaterp->setSetImageAssetIDCallback(boost::bind(&LLTextureCtrl::setImageAssetID, this, _1)); + texture_floaterp->setLocalTextureEnabled(mAllowLocalTexture); texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled && mInventoryPickType != PICK_MATERIAL); } @@ -1909,12 +1916,6 @@ void LLTextureCtrl::showPicker(bool take_focus) floaterp->openFloater(); } - LLFloaterTexturePicker* picker_floater = dynamic_cast<LLFloaterTexturePicker*>(floaterp); - if (picker_floater) - { - picker_floater->setLocalTextureEnabled(mAllowLocalTexture); - } - if (take_focus) { floaterp->setFocus(true); @@ -2094,6 +2095,16 @@ void LLTextureCtrl::setOnTextureSelectedCallback(texture_selected_callback cb) } } +void LLTextureCtrl::setAllowLocalTexture(bool b) +{ + mAllowLocalTexture = b; + LLFloaterTexturePicker* picker_floater = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get()); + if (picker_floater) + { + picker_floater->setLocalTextureEnabled(mAllowLocalTexture); + } +} + void LLTextureCtrl::setImageAssetName(const std::string& name) { LLPointer<LLUIImage> imagep = LLUI::getUIImage(name); diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index e4d877e229..93819a614c 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -181,7 +181,7 @@ public: void setAllowNoTexture( bool b ) { mAllowNoTexture = b; } bool getAllowNoTexture() const { return mAllowNoTexture; } - void setAllowLocalTexture(bool b) { mAllowLocalTexture = b; } + void setAllowLocalTexture(bool b); bool getAllowLocalTexture() const { return mAllowLocalTexture; } const LLUUID& getImageItemID() { return mImageItemID; } @@ -457,6 +457,7 @@ private: set_on_update_image_stats_callback mOnUpdateImageStatsCallback; bool mBakeTextureEnabled; + bool mLocalTextureEnabled; static S32 sLastPickerMode; }; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 7b6f591254..160674d3d8 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -2474,12 +2474,13 @@ LLTextureFetch::~LLTextureFetch() } S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, - S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux, bool can_use_http) + S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux, bool can_use_http, S32& worker_discard) { LL_PROFILE_ZONE_SCOPED; + worker_discard = -1; if (mDebugPause) { - return -1; + return FETCH_REQUEST_CREATION_FAILED; } if (f_type == FTT_SERVER_BAKE) @@ -2495,7 +2496,7 @@ S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const L << host << " != " << worker->mHost << LL_ENDL; removeRequest(worker, true); worker = NULL; - return -1; + return FETCH_REQUEST_ABORTED; } } @@ -2548,13 +2549,14 @@ S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const L { if (worker->wasAborted()) { - return -1; // need to wait for previous aborted request to complete + return FETCH_REQUEST_ABORTED; // need to wait for previous aborted request to complete } + worker_discard = desired_discard; worker->lockWorkMutex(); // +Mw if (worker->mState == LLTextureFetchWorker::DONE && worker->mDesiredSize == llmax(desired_size, TEXTURE_CACHE_ENTRY_SIZE) && worker->mDesiredDiscard == desired_discard) { worker->unlockWorkMutex(); // -Mw - return -1; // similar request has failed or is in a transitional state + return FETCH_REQUEST_EXISTS; // similar request has failed or is in a transitional state } worker->mActiveCount++; worker->mNeedsAux = needs_aux; @@ -2588,11 +2590,12 @@ S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const L worker->mNeedsAux = needs_aux; worker->setCanUseHTTP(can_use_http) ; worker->unlockWorkMutex(); // -Mw + worker_discard = desired_discard; } LL_DEBUGS(LOG_TXT) << "REQUESTED: " << id << " f_type " << fttype_to_string(f_type) << " Discard: " << desired_discard << " size " << desired_size << LL_ENDL; - return desired_discard; + return FETCH_REQUEST_OK; } // Threads: T* // diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 3405f76e37..c2296135e2 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -76,9 +76,14 @@ public: // Threads: Tmain void shutDownImageDecodeThread(); + static constexpr S32 FETCH_REQUEST_OK = 0; + static constexpr S32 FETCH_REQUEST_CREATION_FAILED = -1; + static constexpr S32 FETCH_REQUEST_ABORTED = -2; + static constexpr S32 FETCH_REQUEST_EXISTS = -3; // Threads: T* (but Tmain mostly) + // returns discard on success, fail code otherwise S32 createRequest(FTType f_type, const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, - S32 w, S32 h, S32 c, S32 discard, bool needs_aux, bool can_use_http); + S32 w, S32 h, S32 c, S32 discard, bool needs_aux, bool can_use_http, S32& worker_disacrd); // Requests that a fetch operation be deleted from the queue. // If @cancel is true, also stops any I/O operations pending. diff --git a/indra/newview/llthumbnailctrl.cpp b/indra/newview/llthumbnailctrl.cpp index ae21d3e733..b077262f06 100644 --- a/indra/newview/llthumbnailctrl.cpp +++ b/indra/newview/llthumbnailctrl.cpp @@ -111,7 +111,9 @@ void LLThumbnailCtrl::draw() gl_draw_scaled_image( draw_rect.mLeft, draw_rect.mBottom, draw_rect.getWidth(), draw_rect.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha); - mTexturep->setKnownDrawSize(draw_rect.getWidth(), draw_rect.getHeight()); + // Thumbnails are usually 256x256 or smaller, either report that or + // some high value to get image with higher priority + mTexturep->setKnownDrawSize(MAX_IMAGE_SIZE, MAX_IMAGE_SIZE); } else if( mImagep.notNull() ) { @@ -238,12 +240,8 @@ void LLThumbnailCtrl::initImage() { // Should it support baked textures? mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_THUMBNAIL); - mTexturep->forceToSaveRawImage(0); - - S32 desired_draw_width = MAX_IMAGE_SIZE; - S32 desired_draw_height = MAX_IMAGE_SIZE; - mTexturep->setKnownDrawSize(desired_draw_width, desired_draw_height); + mTexturep->setKnownDrawSize(MAX_IMAGE_SIZE, MAX_IMAGE_SIZE); } } else if (tvalue.isString()) diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index 43b7294b9a..db56544502 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -401,7 +401,7 @@ void LLToast::setVisible(bool show) if(mHideBtn) mHideBtn->setVisible(show); } - LLFloater::setVisible(show); + LLModalDialog::setVisible(show); if (mPanel && !mPanel->isDead() && mWrapperPanel diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 6d0704a469..58c01269f7 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -2145,7 +2145,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( { if(mSource == SOURCE_LIBRARY) { - LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0)); + LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, (LLViewerJointAttachment*)0, false)); copy_inventory_item( gAgent.getID(), item->getPermissions().getOwner(), @@ -2156,7 +2156,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( } else { - rez_attachment(item, 0); + rez_attachment(item, 0, false); } } return ACCEPT_YES_SINGLE; diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 7ef2c8d697..07921e472c 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -62,7 +62,8 @@ LLResourceUploadInfo::LLResourceUploadInfo(LLTransactionID transactId, LLAssetType::EType assetType, std::string name, std::string description, S32 compressionInfo, LLFolderType::EType destinationType, LLInventoryType::EType inventoryType, U32 nextOWnerPerms, - U32 groupPerms, U32 everyonePerms, S32 expectedCost, bool showInventory) : + U32 groupPerms, U32 everyonePerms, S32 expectedCost, + const LLUUID& destFolderId, bool showInventory) : mTransactionId(transactId), mAssetType(assetType), mName(name), @@ -75,7 +76,7 @@ LLResourceUploadInfo::LLResourceUploadInfo(LLTransactionID transactId, mEveryonePerms(everyonePerms), mExpectedUploadCost(expectedCost), mShowInventory(showInventory), - mFolderId(LLUUID::null), + mFolderId(destFolderId), mItemId(LLUUID::null), mAssetId(LLAssetID::null) { } @@ -84,7 +85,8 @@ LLResourceUploadInfo::LLResourceUploadInfo(LLTransactionID transactId, LLResourceUploadInfo::LLResourceUploadInfo(std::string name, std::string description, S32 compressionInfo, LLFolderType::EType destinationType, LLInventoryType::EType inventoryType, - U32 nextOWnerPerms, U32 groupPerms, U32 everyonePerms, S32 expectedCost, bool showInventory) : + U32 nextOWnerPerms, U32 groupPerms, U32 everyonePerms, S32 expectedCost, + const LLUUID& destFolderId, bool showInventory) : mName(name), mDescription(description), mCompressionInfo(compressionInfo), @@ -97,7 +99,7 @@ LLResourceUploadInfo::LLResourceUploadInfo(std::string name, mShowInventory(showInventory), mTransactionId(), mAssetType(LLAssetType::AT_NONE), - mFolderId(LLUUID::null), + mFolderId(destFolderId), mItemId(LLUUID::null), mAssetId(LLAssetID::null) { @@ -299,17 +301,20 @@ void LLResourceUploadInfo::assignDefaults() mDescription = "(No Description)"; } - if (mAssetType == LLAssetType::AT_GLTF || - mAssetType == LLAssetType::AT_GLTF_BIN) + if (mFolderId.isNull()) { - mFolderId = LLUUID::null; + if (mAssetType == LLAssetType::AT_GLTF || + mAssetType == LLAssetType::AT_GLTF_BIN) + { + mFolderId = LLUUID::null; + } + else + { + mFolderId = gInventory.findUserDefinedCategoryUUIDForType( + (mDestinationFolderType == LLFolderType::FT_NONE) ? + (LLFolderType::EType)mAssetType : mDestinationFolderType); + } } - else - { - mFolderId = gInventory.findUserDefinedCategoryUUIDForType( - (mDestinationFolderType == LLFolderType::FT_NONE) ? - (LLFolderType::EType)mAssetType : mDestinationFolderType); -} } std::string LLResourceUploadInfo::getDisplayName() const @@ -366,10 +371,12 @@ LLNewFileResourceUploadInfo::LLNewFileResourceUploadInfo( U32 groupPerms, U32 everyonePerms, S32 expectedCost, + const LLUUID& destFolderId, bool show_inventory) : LLResourceUploadInfo(name, description, compressionInfo, destinationType, inventoryType, - nextOWnerPerms, groupPerms, everyonePerms, expectedCost, show_inventory), + nextOWnerPerms, groupPerms, everyonePerms, expectedCost, + destFolderId, show_inventory), mFileName(fileName), mMaxImageSize(LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT) { @@ -580,12 +587,13 @@ LLNewBufferedResourceUploadInfo::LLNewBufferedResourceUploadInfo( U32 groupPerms, U32 everyonePerms, S32 expectedCost, + const LLUUID& destFolderId, bool show_inventory, uploadFinish_f finish, uploadFailure_f failure) : LLResourceUploadInfo(name, description, compressionInfo, destinationType, inventoryType, - nextOWnerPerms, groupPerms, everyonePerms, expectedCost, show_inventory) + nextOWnerPerms, groupPerms, everyonePerms, expectedCost, destFolderId, show_inventory) , mBuffer(buffer) , mFinishFn(finish) , mFailureFn(failure) diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h index 365436ede0..3e168fd879 100644 --- a/indra/newview/llviewerassetupload.h +++ b/indra/newview/llviewerassetupload.h @@ -54,6 +54,7 @@ public: U32 groupPerms, U32 everyonePerms, S32 expectedCost, + const LLUUID& destFolderId = LLUUID::null, bool showInventory = true); virtual ~LLResourceUploadInfo() @@ -104,6 +105,7 @@ protected: U32 groupPerms, U32 everyonePerms, S32 expectedCost, + const LLUUID& destFolderId = LLUUID::null, bool showInventory = true); LLResourceUploadInfo( @@ -155,6 +157,7 @@ public: U32 groupPerms, U32 everyonePerms, S32 expectedCost, + const LLUUID& destFolderId = LLUUID::null, bool show_inventory = true); virtual LLSD prepareUpload(); @@ -193,6 +196,7 @@ public: U32 groupPerms, U32 everyonePerms, S32 expectedCost, + const LLUUID& destFolderId, // use null for default bool show_inventory, uploadFinish_f finish, uploadFailure_f failure); @@ -219,6 +223,7 @@ public: typedef std::function<void(LLUUID itemId, LLUUID taskId, LLUUID newAssetId, LLSD response)> taskUploadFinish_f; typedef std::function<bool(LLUUID itemId, LLUUID taskId, LLSD response, std::string reason)> uploadFailed_f; + // destFolderId is the folder to put the new item in, leave null for default LLBufferedAssetUploadInfo(LLUUID itemId, LLAssetType::EType assetType, std::string buffer, invnUploadFinish_f finish, uploadFailed_f failed); LLBufferedAssetUploadInfo(LLUUID itemId, LLPointer<LLImageFormatted> image, invnUploadFinish_f finish); LLBufferedAssetUploadInfo(LLUUID taskId, LLUUID itemId, LLAssetType::EType assetType, std::string buffer, taskUploadFinish_f finish, uploadFailed_f failed); diff --git a/indra/newview/llviewerattachmenu.cpp b/indra/newview/llviewerattachmenu.cpp index f2557e299c..9828ab1fdf 100644 --- a/indra/newview/llviewerattachmenu.cpp +++ b/indra/newview/llviewerattachmenu.cpp @@ -116,12 +116,12 @@ void LLViewerAttachMenu::attachObjects(const uuid_vec_t& items, const std::strin LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getLinkedItem(id); if(item && gInventory.isObjectDescendentOf(id, gInventory.getRootFolderID())) { - rez_attachment(item, attachmentp); // don't replace if called from an "Attach To..." menu + rez_attachment(item, attachmentp, false); // don't replace if called from an "Attach To..." menu } else if(item && item->isFinished()) { // must be in library. copy it to our inventory and put it on. - LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, attachmentp)); + LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(rez_attachment_cb, _1, attachmentp, false)); copy_inventory_item(gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index aa43b2dbad..80c8d5045a 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -81,18 +81,16 @@ LLViewerCamera::~LLViewerCamera() mCameraAngleChangedSignal.disconnect(); } -void LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, const LLVector3 &up_direction, const LLVector3 &point_of_interest) +bool LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, const LLVector3 &up_direction, const LLVector3 &point_of_interest) { // do not update if avatar didn't move if (!LLViewerJoystick::getInstance()->getCameraNeedsUpdate()) { - return; + return true; } - LLVector3 last_position; - LLVector3 last_axis; - last_position = getOrigin(); - last_axis = getAtAxis(); + LLVector3 last_position = getOrigin(); + LLVector3 last_axis = getAtAxis(); mLastPointOfInterest = point_of_interest; @@ -102,30 +100,49 @@ void LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, const LLVecto regp = gAgent.getRegion(); } - F32 water_height = (NULL != regp) ? regp->getWaterHeight() : 0.f; + F32 water_height = regp ? regp->getWaterHeight() : 0.f; LLVector3 origin = center; + // Move origin[VZ] far enough (up or down) from the water surface + static const F32 MIN_DIST_TO_WATER = 0.2f; + F32& zpos = origin.mV[VZ]; + if (zpos < water_height + MIN_DIST_TO_WATER) { - if (origin.mV[2] > water_height) + if (zpos >= water_height) { - origin.mV[2] = llmax(origin.mV[2], water_height + 0.20f); + zpos = water_height + MIN_DIST_TO_WATER; } - else + else if (zpos > water_height - MIN_DIST_TO_WATER) { - origin.mV[2] = llmin(origin.mV[2], water_height - 0.20f); + zpos = water_height - MIN_DIST_TO_WATER; } } - setOriginAndLookAt(origin, up_direction, point_of_interest); + LLVector3 at(point_of_interest - origin); + at.normalize(); + if (at.isNull() || !at.isFinite()) + return false; + + LLVector3 left(up_direction % at); + left.normalize(); + if (left.isNull() || !left.isFinite()) + return false; + + LLVector3 up = at % left; + up.normalize(); + if (up.isNull() || !up.isFinite()) + return false; + + setOrigin(origin); + setAxes(at, left, up); - mVelocityDir = origin - last_position ; - F32 dpos = mVelocityDir.normVec() ; + mVelocityDir = origin - last_position; + F32 dpos = mVelocityDir.normVec(); LLQuaternion rotation; rotation.shortestArc(last_axis, getAtAxis()); - F32 x, y, z; - F32 drot; + F32 drot, x, y, z; rotation.getAngleAxis(&drot, &x, &y, &z); add(sVelocityStat, dpos); @@ -138,14 +155,15 @@ void LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, const LLVecto // update pixel meter ratio using default fov, not modified one mPixelMeterRatio = (F32)(getViewHeightInPixels()/ (2.f*tanf(mCameraFOVDefault*0.5f))); // update screen pixel area - mScreenPixelArea =(S32)((F32)getViewHeightInPixels() * ((F32)getViewHeightInPixels() * getAspect())); + mScreenPixelArea = (S32)((F32)getViewHeightInPixels() * ((F32)getViewHeightInPixels() * getAspect())); + + return true; } const LLMatrix4 &LLViewerCamera::getProjection() const { calcProjection(getFar()); return mProjectionMatrix; - } const LLMatrix4 &LLViewerCamera::getModelview() const @@ -158,19 +176,18 @@ const LLMatrix4 &LLViewerCamera::getModelview() const void LLViewerCamera::calcProjection(const F32 far_distance) const { - F32 fov_y, z_far, z_near, aspect, f; - fov_y = getView(); - z_far = far_distance; - z_near = getNear(); - aspect = getAspect(); + F32 fov_y = getView(); + F32 z_far = far_distance; + F32 z_near = getNear(); + F32 aspect = getAspect(); - f = 1/tan(fov_y*0.5f); + F32 f = 1 / tan(fov_y * 0.5f); mProjectionMatrix.setZero(); - mProjectionMatrix.mMatrix[0][0] = f/aspect; + mProjectionMatrix.mMatrix[0][0] = f / aspect; mProjectionMatrix.mMatrix[1][1] = f; - mProjectionMatrix.mMatrix[2][2] = (z_far + z_near)/(z_near - z_far); - mProjectionMatrix.mMatrix[3][2] = (2*z_far*z_near)/(z_near - z_far); + mProjectionMatrix.mMatrix[2][2] = (z_far + z_near) / (z_near - z_far); + mProjectionMatrix.mMatrix[3][2] = (2 * z_far * z_near) / (z_near - z_far); mProjectionMatrix.mMatrix[2][3] = -1; } @@ -231,9 +248,9 @@ void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, bool ortho, bool zfli for (U32 i = 0; i < 4; i++) { - frust[i+4] = frust[i+4]-frust[i]; - frust[i+4].normVec(); - frust[i+4] = frust[i] + frust[i+4]*camera.getFar(); + frust[i + 4] = frust[i + 4] - frust[i]; + frust[i + 4].normVec(); + frust[i + 4] = frust[i] + frust[i + 4] * camera.getFar(); } } else @@ -249,7 +266,7 @@ void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, bool ortho, bool zfli if (ortho) { - LLVector3 far_shift = camera.getAtAxis()*camera.getFar()*2.f; + LLVector3 far_shift = camera.getAtAxis() * camera.getFar() * 2.f; for (U32 i = 0; i < 4; i++) { frust[i+4] = frust[i] + far_shift; @@ -261,7 +278,7 @@ void LLViewerCamera::updateFrustumPlanes(LLCamera& camera, bool ortho, bool zfli { LLVector3 vec = frust[i] - camera.getOrigin(); vec.normVec(); - frust[i+4] = camera.getOrigin() + vec*camera.getFar(); + frust[i + 4] = camera.getOrigin() + vec * camera.getFar(); } } } @@ -357,7 +374,7 @@ void LLViewerCamera::setPerspective(bool for_selection, glm::mat4 modelview(glm::make_mat4((GLfloat*) OGL_TO_CFR_ROTATION)); - GLfloat ogl_matrix[16]; + GLfloat ogl_matrix[16]; getOpenGLTransform(ogl_matrix); diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index a204b85d88..c1c73dc0c6 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -61,7 +61,7 @@ public: static eCameraID sCurCameraID; - void updateCameraLocation(const LLVector3 ¢er, + bool updateCameraLocation(const LLVector3 ¢er, const LLVector3 &up_direction, const LLVector3 &point_of_interest); @@ -77,12 +77,12 @@ public: bool projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const bool clamp = true) const; bool projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const; - LLVector3 getVelocityDir() const {return mVelocityDir;} - static LLTrace::CountStatHandle<>* getVelocityStat() {return &sVelocityStat; } - static LLTrace::CountStatHandle<>* getAngularVelocityStat() {return &sAngularVelocityStat; } - F32 getCosHalfFov() {return mCosHalfCameraFOV;} - F32 getAverageSpeed() {return mAverageSpeed ;} - F32 getAverageAngularSpeed() {return mAverageAngularSpeed;} + LLVector3 getVelocityDir() const { return mVelocityDir; } + static LLTrace::CountStatHandle<>* getVelocityStat() { return &sVelocityStat; } + static LLTrace::CountStatHandle<>* getAngularVelocityStat() { return &sAngularVelocityStat; } + F32 getCosHalfFov() const { return mCosHalfCameraFOV; } + F32 getAverageSpeed() const { return mAverageSpeed; } + F32 getAverageAngularSpeed() const { return mAverageAngularSpeed; } void getPixelVectors(const LLVector3 &pos_agent, LLVector3 &up, LLVector3 &right); LLVector3 roundToPixel(const LLVector3 &pos_agent); @@ -90,21 +90,21 @@ public: // Sets the current matrix /* virtual */ void setView(F32 vertical_fov_rads); // NOTE: broadcasts to simulator void setViewNoBroadcast(F32 vertical_fov_rads); // set FOV without broadcasting to simulator (for temporary local cameras) - void setDefaultFOV(F32 fov) ; - F32 getDefaultFOV() { return mCameraFOVDefault; } + void setDefaultFOV(F32 fov); + F32 getDefaultFOV() const { return mCameraFOVDefault; } bool isDefaultFOVChanged(); bool cameraUnderWater() const; bool areVertsVisible(LLViewerObject* volumep, bool all_verts); - const LLVector3 &getPointOfInterest() { return mLastPointOfInterest; } + const LLVector3& getPointOfInterest() const { return mLastPointOfInterest; } F32 getPixelMeterRatio() const { return mPixelMeterRatio; } S32 getScreenPixelArea() const { return mScreenPixelArea; } void setZoomParameters(F32 factor, S16 subregion) { mZoomFactor = factor; mZoomSubregion = subregion; } - F32 getZoomFactor() { return mZoomFactor; } - S16 getZoomSubRegion() { return mZoomSubregion; } + F32 getZoomFactor() const { return mZoomFactor; } + S16 getZoomSubRegion() const { return mZoomSubregion; } protected: void calcProjection(const F32 far_distance) const; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 4c9910fd0a..01b97a6154 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -969,7 +969,7 @@ void LLInventoryCallbackManager::fire(U32 callback_id, const LLUUID& item_id) } } -void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp) +void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp, bool replace) { if (inv_item.isNull()) return; @@ -977,7 +977,7 @@ void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachme LLViewerInventoryItem *item = gInventory.getItem(inv_item); if (item) { - rez_attachment(item, attachmentp); + rez_attachment(item, attachmentp, replace); } } @@ -1439,7 +1439,8 @@ void update_inventory_category( if(obj) { if (LLFolderType::lookupIsProtectedType(obj->getPreferredType()) - && (updates.size() != 1 || !updates.has("thumbnail"))) + && (updates.size() != 1 + || !(updates.has("thumbnail") || updates.has("favorite")))) { LLNotificationsUtil::add("CannotModifyProtectedCategories"); return; diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index 21a6606253..18daa368d9 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -264,7 +264,7 @@ public: class LLViewerJointAttachment; -void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp); +void rez_attachment_cb(const LLUUID& inv_item, LLViewerJointAttachment *attachmentp, bool replace); void activate_gesture_cb(const LLUUID& inv_item); diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 416f6a476a..ffd595fd3b 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -880,6 +880,10 @@ void LLViewerJoystick::moveObjects(bool reset) { gAgent.clearAFK(); } + else + { + gAwayTriggerTimer.reset(); + } if (sDelta[0] || sDelta[1] || sDelta[2]) { @@ -1054,6 +1058,10 @@ void LLViewerJoystick::moveAvatar(bool reset) { gAgent.clearAFK(); } + else + { + gAwayTriggerTimer.reset(); + } setCameraNeedsUpdate(true); } @@ -1266,9 +1274,16 @@ void LLViewerJoystick::moveFlycam(bool reset) } // Clear AFK state if moved beyond the deadzone - if (!is_zero && gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME) + if (!is_zero) { - gAgent.clearAFK(); + if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME) + { + gAgent.clearAFK(); + } + else + { + gAwayTriggerTimer.reset(); + } } sFlycamPosition += LLVector3(sDelta) * sFlycamRotation; @@ -1330,6 +1345,10 @@ bool LLViewerJoystick::toggleFlycam() { gAgent.clearAFK(); } + else + { + gAwayTriggerTimer.reset(); + } mOverrideCamera = !mOverrideCamera; if (mOverrideCamera) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 68c38c3692..9ad4926634 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -88,6 +88,7 @@ #include "lltoolface.h" #include "llhints.h" #include "llhudeffecttrail.h" +#include "llhudeffectresetskeleton.h" #include "llhudmanager.h" #include "llimview.h" #include "llinventorybridge.h" @@ -1970,7 +1971,6 @@ class LLAdvancedAppearanceToXML : public view_listener_t { bool handleEvent(const LLSD& userdata) { - std::string emptyname; LLViewerObject *obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); LLVOAvatar *avatar = NULL; if (obj) @@ -1997,7 +1997,7 @@ class LLAdvancedAppearanceToXML : public view_listener_t } if (avatar) { - avatar->dumpArchetypeXML(emptyname); + avatar->dumpArchetypeXML(LLStringUtil::null); } return true; } @@ -5735,6 +5735,38 @@ class LLToolsEnablePathfindingRebakeRegion : public view_listener_t } }; +class LLToolsCheckSelectionLODMode : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string param = userdata.asString(); + static LLCachedControl<S32> debug_selection_lods(gSavedSettings, "DebugSelectionLODs", 0); + if ("default" == param) + { + return debug_selection_lods() < 0; + } + else if ("high" == param) + { + return debug_selection_lods() == 3; + } + else if ("medium" == param) + { + return debug_selection_lods() == 2; + } + else if ("low" == param) + { + return debug_selection_lods() == 1; + } + else if ("lowest" == param) + { + return debug_selection_lods() == 0; + } + + return false; + } +}; + + // Round the position of all root objects to the grid class LLToolsSnapObjectXY : public view_listener_t { @@ -6712,7 +6744,17 @@ class LLAvatarResetSkeleton : public view_listener_t { if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())) { - avatar->resetSkeleton(false); + if(avatar->getID() == gAgentID) + { + LLHUDEffectResetSkeleton* effectp = (LLHUDEffectResetSkeleton*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_RESET_SKELETON, true); + effectp->setSourceObject(gAgentAvatarp); + effectp->setTargetObject((LLViewerObject*)avatar); + effectp->setResetAnimations(false); + } + else + { + avatar->resetSkeleton(false); + } } return true; } @@ -6736,7 +6778,17 @@ class LLAvatarResetSkeletonAndAnimations : public view_listener_t { if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())) { - avatar->resetSkeleton(true); + if(avatar->getID() == gAgentID) + { + LLHUDEffectResetSkeleton* effectp = (LLHUDEffectResetSkeleton*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_RESET_SKELETON, true); + effectp->setSourceObject(gAgentAvatarp); + effectp->setTargetObject((LLViewerObject*)avatar); + effectp->setResetAnimations(true); + } + else + { + avatar->resetSkeleton(true); + } } return true; } @@ -6764,11 +6816,24 @@ class LLAvatarResetSelfSkeletonAndAnimations : public view_listener_t { if (LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())) { - avatar->resetSkeleton(true); + if(avatar->getID() == gAgentID) + { + LLHUDEffectResetSkeleton* effectp = (LLHUDEffectResetSkeleton*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_RESET_SKELETON, true); + effectp->setSourceObject(gAgentAvatarp); + effectp->setTargetObject((LLViewerObject*)avatar); + effectp->setResetAnimations(true); + } + else + { + avatar->resetSkeleton(true); + } } else { - gAgentAvatarp->resetSkeleton(true); + LLHUDEffectResetSkeleton* effectp = (LLHUDEffectResetSkeleton*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_RESET_SKELETON, true); + effectp->setSourceObject(gAgentAvatarp); + effectp->setTargetObject(gAgentAvatarp); + effectp->setResetAnimations(true); } return true; } @@ -8575,6 +8640,36 @@ class LLToolsSelectBySurrounding : public view_listener_t } }; +class LLToolsSelectionLODMode : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string param = userdata.asString(); + if ("default" == param) + { + gSavedSettings.setS32("DebugSelectionLODs", -1); + } + else if ("high" == param) + { + gSavedSettings.setS32("DebugSelectionLODs", 3); + } + else if ("medium" == param) + { + gSavedSettings.setS32("DebugSelectionLODs", 2); + } + else if ("low" == param) + { + gSavedSettings.setS32("DebugSelectionLODs", 1); + } + else if ("lowest" == param) + { + gSavedSettings.setS32("DebugSelectionLODs", 0); + } + + return true; + } +}; + class LLToolsShowHiddenSelection : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -9810,6 +9905,7 @@ void initialize_menus() view_listener_t::addMenu(new LLToolsSelectInvisibleObjects(), "Tools.SelectInvisibleObjects"); view_listener_t::addMenu(new LLToolsSelectReflectionProbes(), "Tools.SelectReflectionProbes"); view_listener_t::addMenu(new LLToolsSelectBySurrounding(), "Tools.SelectBySurrounding"); + view_listener_t::addMenu(new LLToolsSelectionLODMode(), "Tools.SelectionLODMode"); view_listener_t::addMenu(new LLToolsShowHiddenSelection(), "Tools.ShowHiddenSelection"); view_listener_t::addMenu(new LLToolsShowSelectionLightRadius(), "Tools.ShowSelectionLightRadius"); view_listener_t::addMenu(new LLToolsEditLinkedParts(), "Tools.EditLinkedParts"); @@ -9842,6 +9938,7 @@ void initialize_menus() view_listener_t::addMenu(new LLToolsEnablePathfindingView(), "Tools.EnablePathfindingView"); view_listener_t::addMenu(new LLToolsDoPathfindingRebakeRegion(), "Tools.DoPathfindingRebakeRegion"); view_listener_t::addMenu(new LLToolsEnablePathfindingRebakeRegion(), "Tools.EnablePathfindingRebakeRegion"); + view_listener_t::addMenu(new LLToolsCheckSelectionLODMode(), "Tools.ToolsCheckSelectionLODMode"); // Help menu // most items use the ShowFloater method diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 2a871a24af..02667a3ff6 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -478,13 +478,19 @@ const bool check_file_extension(const std::string& filename, LLFilePicker::ELoad return true; } -const void upload_single_file(const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter type) +void upload_single_file( + const std::vector<std::string>& filenames, + LLFilePicker::ELoadFilter type, + const LLUUID& dest) { std::string filename = filenames[0]; if (!check_file_extension(filename, type)) return; if (!filename.empty()) { + LLSD args; + args["filename"] = filename; + args["dest"] = dest; if (type == LLFilePicker::FFLOAD_WAV) { // pre-qualify wavs to make sure the format is acceptable @@ -499,12 +505,12 @@ const void upload_single_file(const std::vector<std::string>& filenames, LLFileP } else { - LLFloaterReg::showInstance("upload_sound", LLSD(filename)); + LLFloaterReg::showInstance("upload_sound", args); } } if (type == LLFilePicker::FFLOAD_IMAGE) { - LLFloaterReg::showInstance("upload_image", LLSD(filename)); + LLFloaterReg::showInstance("upload_image", args); } if (type == LLFilePicker::FFLOAD_ANIM) { @@ -512,18 +518,18 @@ const void upload_single_file(const std::vector<std::string>& filenames, LLFileP LLStringUtil::toLower(filename_lc); if (filename_lc.rfind(".anim") != std::string::npos) { - LLFloaterReg::showInstance("upload_anim_anim", LLSD(filename)); + LLFloaterReg::showInstance("upload_anim_anim", args); } else { - LLFloaterReg::showInstance("upload_anim_bvh", LLSD(filename)); + LLFloaterReg::showInstance("upload_anim_bvh", args); } } } return; } -void do_bulk_upload(std::vector<std::string> filenames, bool allow_2k) +void do_bulk_upload(std::vector<std::string> filenames, bool allow_2k, const LLUUID& dest) { for (std::vector<std::string>::const_iterator in_iter = filenames.begin(); in_iter != filenames.end(); ++in_iter) { @@ -570,7 +576,8 @@ void do_bulk_upload(std::vector<std::string> filenames, bool allow_2k) LLFloaterPerms::getNextOwnerPerms("Uploads"), LLFloaterPerms::getGroupPerms("Uploads"), LLFloaterPerms::getEveryonePerms("Uploads"), - expected_upload_cost); + expected_upload_cost, + dest); if (!allow_2k) { @@ -595,14 +602,14 @@ void do_bulk_upload(std::vector<std::string> filenames, bool allow_2k) // Todo: // 1. Decouple bulk upload from material editor // 2. Take into account possiblity of identical textures - LLMaterialEditor::uploadMaterialFromModel(filename, model, i); + LLMaterialEditor::uploadMaterialFromModel(filename, model, i, dest); } } } } } -void do_bulk_upload(std::vector<std::string> filenames, bool allow_2k, const LLSD& notification, const LLSD& response) +void do_bulk_upload(std::vector<std::string> filenames, bool allow_2k, const LLSD& notification, const LLSD& response, const LLUUID& dest) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option != 0) @@ -611,7 +618,7 @@ void do_bulk_upload(std::vector<std::string> filenames, bool allow_2k, const LLS return; } - do_bulk_upload(filenames, allow_2k); + do_bulk_upload(filenames, allow_2k, dest); } bool get_bulk_upload_expected_cost( @@ -709,7 +716,7 @@ bool get_bulk_upload_expected_cost( return file_count > 0; } -const void upload_bulk(const std::vector<std::string>& filtered_filenames, bool allow_2k) +const void upload_bulk(const std::vector<std::string>& filtered_filenames, bool allow_2k, const LLUUID& dest) { S32 expected_upload_cost; S32 expected_upload_count; @@ -721,6 +728,7 @@ const void upload_bulk(const std::vector<std::string>& filtered_filenames, bool key["upload_cost"] = expected_upload_cost; key["upload_count"] = expected_upload_count; key["has_2k_textures"] = (textures_2k_count > 0); + key["dest"] = dest; LLSD array; for (const std::string& str : filtered_filenames) @@ -754,7 +762,7 @@ const void upload_bulk(const std::vector<std::string>& filtered_filenames, bool } -const void upload_bulk(const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter type, bool allow_2k) +void upload_bulk(const std::vector<std::string>& filenames, LLFilePicker::ELoadFilter type, bool allow_2k, const LLUUID& dest) { // TODO: // Check user balance for entire cost @@ -776,7 +784,7 @@ const void upload_bulk(const std::vector<std::string>& filenames, LLFilePicker:: filtered_filenames.push_back(filename); } } - upload_bulk(filtered_filenames, allow_2k); + upload_bulk(filtered_filenames, allow_2k, dest); } class LLFileUploadImage : public view_listener_t @@ -787,7 +795,7 @@ class LLFileUploadImage : public view_listener_t { gAgentCamera.changeCameraToDefault(); } - LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_IMAGE, false); + LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2, LLUUID::null), LLFilePicker::FFLOAD_IMAGE, false); return true; } }; @@ -818,7 +826,7 @@ class LLFileUploadSound : public view_listener_t { gAgentCamera.changeCameraToDefault(); } - LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_WAV, false); + LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2, LLUUID::null), LLFilePicker::FFLOAD_WAV, false); return true; } }; @@ -831,7 +839,7 @@ class LLFileUploadAnim : public view_listener_t { gAgentCamera.changeCameraToDefault(); } - LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2), LLFilePicker::FFLOAD_ANIM, false); + LLFilePickerReplyThread::startPicker(boost::bind(&upload_single_file, _1, _2, LLUUID::null), LLFilePicker::FFLOAD_ANIM, false); return true; } }; @@ -844,7 +852,9 @@ class LLFileUploadBulk : public view_listener_t { gAgentCamera.changeCameraToDefault(); } - LLFilePickerReplyThread::startPicker(boost::bind(&upload_bulk, _1, _2, true), LLFilePicker::FFLOAD_ALL, true); + + LLFilePickerReplyThread::startPicker(boost::bind(&upload_bulk, _1, _2, true, LLUUID::null), LLFilePicker::FFLOAD_ALL, true); + return true; } }; @@ -1138,7 +1148,7 @@ LLUUID upload_new_resource( name, desc, compression_info, destination_folder_type, inv_type, next_owner_perms, group_perms, everyone_perms, - expected_upload_cost, show_inventory)); + expected_upload_cost, LLUUID::null, show_inventory)); upload_new_resource(uploadInfo, callback, userdata); return LLUUID::null; diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index 6b628f07de..0b0de38c94 100644 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -72,10 +72,21 @@ bool get_bulk_upload_expected_cost( S32& bvh_count, S32& textures_2k_count); -void do_bulk_upload(std::vector<std::string> filenames, bool allow_2k); +void do_bulk_upload(std::vector<std::string> filenames, bool allow_2k, const LLUUID& dest); void close_all_windows(); +void upload_single_file( + const std::vector<std::string>& filenames, + LLFilePicker::ELoadFilter type, + const LLUUID& dest); + +void upload_bulk( + const std::vector<std::string>& filenames, + LLFilePicker::ELoadFilter type, + bool allow_2k, + const LLUUID& dest); + //consider moving all file pickers below to more suitable place class LLFilePickerThread : public LLThread { //multi-threaded file picker (runs system specific file picker in background and calls "notify" from main thread) diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 019e870829..a643aa91bb 100755 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -690,7 +690,9 @@ void LLViewerParcelOverlay::renderPropertyLines() return; LLSurface& land = mRegion->getLand(); - F32 water_z = land.getWaterHeight() + 0.01f; + + bool render_water = gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_VOIDWATER); + F32 water_z = render_water ? land.getWaterHeight() + 0.01f : 0; LLGLSUIDefault gls_ui; // called from pipeline gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 0f9c65893d..6953407f75 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1070,6 +1070,7 @@ void LLViewerFetchedTexture::init(bool firstinit) mOrigHeight = 0; mHasAux = false; mNeedsAux = false; + mLastWorkerDiscardLevel = -1; mRequestedDiscardLevel = -1; mRequestedDownloadPriority = 0.f; mFullyLoaded = false; @@ -1222,12 +1223,11 @@ void LLViewerFetchedTexture::loadFromFastCache() if (mBoostLevel == LLGLTexture::BOOST_THUMBNAIL) { - S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_THUMBNAIL_DIMENSIONS; - S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_THUMBNAIL_DIMENSIONS; - if (mRawImage && (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height)) + if (mRawImage && (mRawImage->getWidth() > DEFAULT_THUMBNAIL_DIMENSIONS || mRawImage->getHeight() > DEFAULT_THUMBNAIL_DIMENSIONS)) { - // scale oversized icon, no need to give more work to gl - mRawImage->scale(expected_width, expected_height); + // Scale oversized thumbnail + // thumbnails aren't supposed to go over DEFAULT_THUMBNAIL_DIMENSIONS + mRawImage->scale(DEFAULT_THUMBNAIL_DIMENSIONS, DEFAULT_THUMBNAIL_DIMENSIONS); } } @@ -1904,13 +1904,10 @@ bool LLViewerFetchedTexture::updateFetch() if (mBoostLevel == LLGLTexture::BOOST_THUMBNAIL) { - S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_THUMBNAIL_DIMENSIONS; - S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_THUMBNAIL_DIMENSIONS; - if (mRawImage && (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height)) + if (mRawImage && (mRawImage->getWidth() > DEFAULT_THUMBNAIL_DIMENSIONS || mRawImage->getHeight() > DEFAULT_THUMBNAIL_DIMENSIONS)) { - // scale oversized icon, no need to give more work to gl - // since we got mRawImage from thread worker and image may be in use (ex: writing cache), make a copy - mRawImage = mRawImage->scaled(expected_width, expected_height); + // Scale oversized thumbnail + mRawImage = mRawImage->scaled(DEFAULT_THUMBNAIL_DIMENSIONS, DEFAULT_THUMBNAIL_DIMENSIONS); } } @@ -2044,18 +2041,26 @@ bool LLViewerFetchedTexture::updateFetch() } // bypass texturefetch directly by pulling from LLTextureCache - S32 fetch_request_discard = -1; - fetch_request_discard = LLAppViewer::getTextureFetch()->createRequest(mFTType, mUrl, getID(), getTargetHost(), decode_priority, - w, h, c, desired_discard, needsAux(), mCanUseHTTP); + S32 worker_discard = -1; + S32 result = LLAppViewer::getTextureFetch()->createRequest(mFTType, mUrl, getID(), getTargetHost(), decode_priority, + w, h, c, desired_discard, needsAux(), mCanUseHTTP, worker_discard); + - if (fetch_request_discard >= 0) + if ((result >= 0) // Worker created + // scaled and standard images share requests, they just process the result differently + // if mLastWorkerDiscardLevel doen't match worker, worker was requested by a different + // image and current one needs to schedule an update + || (result == LLTextureFetch::FETCH_REQUEST_EXISTS + && mLastWorkerDiscardLevel != worker_discard) + ) { LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("vftuf - request created"); mHasFetcher = true; mIsFetching = true; + mLastWorkerDiscardLevel = worker_discard; // in some cases createRequest can modify discard, as an example // bake textures are always at discard 0 - mRequestedDiscardLevel = llmin(desired_discard, fetch_request_discard); + mRequestedDiscardLevel = llmin(desired_discard, worker_discard); mFetchState = LLAppViewer::getTextureFetch()->getFetchState(mID, mDownloadProgress, mRequestedDownloadPriority, mFetchPriority, mFetchDeltaTime, mRequestDeltaTime, mCanUseHTTP); } @@ -2667,11 +2672,9 @@ void LLViewerFetchedTexture::saveRawImage() } else if (mBoostLevel == LLGLTexture::BOOST_THUMBNAIL) { - S32 expected_width = mKnownDrawWidth > 0 ? mKnownDrawWidth : DEFAULT_THUMBNAIL_DIMENSIONS; - S32 expected_height = mKnownDrawHeight > 0 ? mKnownDrawHeight : DEFAULT_THUMBNAIL_DIMENSIONS; - if (mRawImage->getWidth() > expected_width || mRawImage->getHeight() > expected_height) + if (mRawImage->getWidth() > DEFAULT_THUMBNAIL_DIMENSIONS || mRawImage->getHeight() > DEFAULT_THUMBNAIL_DIMENSIONS) { - mSavedRawImage = new LLImageRaw(expected_width, expected_height, mRawImage->getComponents()); + mSavedRawImage = new LLImageRaw(DEFAULT_THUMBNAIL_DIMENSIONS, DEFAULT_THUMBNAIL_DIMENSIONS, mRawImage->getComponents()); mSavedRawImage->copyScaled(mRawImage); } else diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 65fa633f81..c5dbbb82ef 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -439,6 +439,7 @@ protected: bool mKnownDrawSizeChanged ; std::string mUrl; + S32 mLastWorkerDiscardLevel; S32 mRequestedDiscardLevel; F32 mRequestedDownloadPriority; S32 mFetchState; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index cc3e916270..440eb427cc 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -66,6 +66,7 @@ #include "llchatentry.h" #include "indra_constants.h" #include "llassetstorage.h" +#include "lldate.h" #include "llerrorcontrol.h" #include "llfontgl.h" #include "llmousehandler.h" @@ -1424,10 +1425,16 @@ void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask mWindow->showCursorFromMouseMove(); - if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME - && !gDisconnected) + if (!gDisconnected) { - gAgent.clearAFK(); + if (gAwayTimer.getElapsedTimeF32() > LLAgent::MIN_AFK_TIME) + { + gAgent.clearAFK(); + } + else + { + gAwayTriggerTimer.reset(); + } } } @@ -1544,6 +1551,10 @@ bool LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, bool repeated) { gAgent.clearAFK(); } + else + { + gAwayTriggerTimer.reset(); + } // *NOTE: We want to interpret KEY_RETURN later when it arrives as // a Unicode char, not as a keydown. Otherwise when client frame @@ -3002,7 +3013,8 @@ bool LLViewerWindow::handleKey(KEY key, MASK mask) { if ((focusedFloaterName == "nearby_chat") || (focusedFloaterName == "im_container") || (focusedFloaterName == "impanel")) { - if (gSavedSettings.getBOOL("ArrowKeysAlwaysMove")) + LLCachedControl<bool> key_move(gSavedSettings, "ArrowKeysAlwaysMove"); + if (key_move()) { // let Control-Up and Control-Down through for chat line history, if (!(key == KEY_UP && mask == MASK_CONTROL) @@ -3016,10 +3028,9 @@ bool LLViewerWindow::handleKey(KEY key, MASK mask) case KEY_RIGHT: case KEY_UP: case KEY_DOWN: - case KEY_PAGE_UP: - case KEY_PAGE_DOWN: - case KEY_HOME: - case KEY_END: + case KEY_PAGE_UP: //jump + case KEY_PAGE_DOWN: // down + case KEY_HOME: // toggle fly // when chatbar is empty or ArrowKeysAlwaysMove set, // pass arrow keys on to avatar... return false; @@ -4798,22 +4809,19 @@ void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_save } // Look for an unused file name - bool is_snapshot_name_loc_set = isSnapshotLocSet(); + auto is_snapshot_name_loc_set = isSnapshotLocSet(); std::string filepath; - S32 i = 1; - S32 err = 0; - std::string extension("." + image->getExtension()); + auto i = 1; + auto err = 0; + auto extension("." + image->getExtension()); + auto now = LLDate::now(); do { filepath = sSnapshotDir; filepath += gDirUtilp->getDirDelimiter(); filepath += sSnapshotBaseName; - - if (is_snapshot_name_loc_set) - { - filepath += llformat("_%.3d",i); - } - + filepath += now.toLocalDateString("_%Y-%m-%d_%H%M%S"); + filepath += llformat("%.2d", i); filepath += extension; llstat stat_info; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 690cfaa677..8b7d284259 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -576,7 +576,7 @@ private: // joint states to be animated //------------------------------------------------------------------------- LLPointer<LLJointState> mPelvisState; - LLCharacter* mCharacter; + LLCharacter* mCharacter; }; /** @@ -684,6 +684,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mPreviousFullyLoaded(false), mFullyLoadedInitialized(false), mLastCloudAttachmentCount(0), + mFullyLoadedFrameCounter(0), mVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN), mLoadedCallbacksPaused(false), mLoadedCallbackTextures(0), @@ -777,11 +778,9 @@ std::string LLVOAvatar::avString() const { return " " + getFullname() + " "; } - else - { - std::string viz_string = LLVOAvatar::rezStatusToString(getRezzedStatus()); - return " Avatar '" + getFullname() + "' " + viz_string + " "; - } + + std::string status = LLVOAvatar::rezStatusToString(getRezzedStatus()); + return " Avatar '" + getDebugName() + "' " + status + " "; } void LLVOAvatar::debugAvatarRezTime(std::string notification_name, std::string comment) @@ -804,10 +803,10 @@ void LLVOAvatar::debugAvatarRezTime(std::string notification_name, std::string c if (gSavedSettings.getBOOL("DebugAvatarRezTime")) { LLSD args; - args["EXISTENCE"] = llformat("%d",(U32)mDebugExistenceTimer.getElapsedTimeF32()); - args["TIME"] = llformat("%d",(U32)mRuthDebugTimer.getElapsedTimeF32()); + args["EXISTENCE"] = llformat("%d", (U32)mDebugExistenceTimer.getElapsedTimeF32()); + args["TIME"] = llformat("%d", (U32)mRuthDebugTimer.getElapsedTimeF32()); args["NAME"] = getFullname(); - LLNotificationsUtil::add(notification_name,args); + LLNotificationsUtil::add(notification_name, args); } } @@ -820,14 +819,14 @@ LLVOAvatar::~LLVOAvatar() if (!mFullyLoaded) { - debugAvatarRezTime("AvatarRezLeftCloudNotification","left after ruth seconds as cloud"); + debugAvatarRezTime("AvatarRezLeftCloudNotification", "left after ruth seconds as cloud"); } else { - debugAvatarRezTime("AvatarRezLeftNotification","left sometime after declouding"); + debugAvatarRezTime("AvatarRezLeftNotification", "left sometime after declouding"); } - if(mTuned) + if (mTuned) { LLPerfStats::tunedAvatars--; mTuned = false; @@ -969,7 +968,7 @@ bool LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) ++grey_avatars; } } - return !grey_avatars; + return grey_avatars == 0; } // static @@ -2827,11 +2826,11 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) S32 compl_upd_freq = 20; if (isControlAvatar()) { - // animeshes do not (or won't) have impostors nor change outfis, + // animeshes do not (or won't) have impostors nor change outfis,F // no need for high frequency compl_upd_freq = 100; } - else if (mLastRezzedStatus <= 0) //cloud or init + else if (mLastRezzedStatus <= 0) // cloud or initial { compl_upd_freq = 60; } @@ -2839,11 +2838,11 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) { compl_upd_freq = 5; } - else if (mLastRezzedStatus == 1) //'grey', not fully loaded + else if (mLastRezzedStatus == 1) // 'gray', not fully loaded { compl_upd_freq = 40; } - else if (isInMuteList()) //cheap, buffers value from search + else if (isInMuteList()) // cheap, buffers value from search { compl_upd_freq = 100; } @@ -2965,7 +2964,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; if (LLVOAvatar::sJointDebug) { - LL_INFOS() << getFullname() << ": joint touches: " << LLJoint::sNumTouches << " updates: " << LLJoint::sNumUpdates << LL_ENDL; + LL_INFOS() << getDebugName() << ": joint touches: " << LLJoint::sNumTouches << " updates: " << LLJoint::sNumUpdates << LL_ENDL; } LLJoint::sNumUpdates = 0; @@ -3185,17 +3184,17 @@ F32 LLVOAvatar::calcMorphAmount() const void LLVOAvatar::idleUpdateLipSync(bool voice_enabled) { // Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync - if ( voice_enabled + if (voice_enabled && mLastRezzedStatus > 0 // no point updating lip-sync for clouds && LLVoiceVisualizer::getLipSyncEnabled() - && LLVoiceClient::getInstance()->getIsSpeaking( mID ) ) + && LLVoiceClient::getInstance()->getIsSpeaking(mID)) { F32 ooh_morph_amount = 0.0f; F32 aah_morph_amount = 0.0f; mVoiceVisualizer->lipSyncOohAah( ooh_morph_amount, aah_morph_amount ); - if( mOohMorph ) + if (mOohMorph) { F32 ooh_weight = mOohMorph->getMinWeight() + ooh_morph_amount * (mOohMorph->getMaxWeight() - mOohMorph->getMinWeight()); @@ -3203,7 +3202,7 @@ void LLVOAvatar::idleUpdateLipSync(bool voice_enabled) mOohMorph->setWeight( ooh_weight); } - if( mAahMorph ) + if (mAahMorph) { F32 aah_weight = mAahMorph->getMinWeight() + aah_morph_amount * (mAahMorph->getMaxWeight() - mAahMorph->getMinWeight()); @@ -6177,8 +6176,11 @@ void LLVOAvatar::resetAnimations() flushAllMotions(); } -// Override selectively based on avatar sex and whether we're using new -// animations. +//----------------------------------------------------------------------------- +// remapMotionID() +// Override selectively based on avatar sex and whether we're using new animations. +//----------------------------------------------------------------------------- +// virtual LLUUID LLVOAvatar::remapMotionID(const LLUUID& id) { static LLCachedControl<bool> use_new_walk_run(gSavedSettings, "UseNewWalkRun"); @@ -6228,7 +6230,6 @@ LLUUID LLVOAvatar::remapMotionID(const LLUUID& id) } return result; - } //----------------------------------------------------------------------------- @@ -6297,6 +6298,7 @@ void LLVOAvatar::stopMotionFromSource(const LLUUID& source_id) //----------------------------------------------------------------------------- // addDebugText() //----------------------------------------------------------------------------- +// virtual void LLVOAvatar::addDebugText(const std::string& text) { mDebugText.append(1, '\n'); @@ -6304,8 +6306,22 @@ void LLVOAvatar::addDebugText(const std::string& text) } //----------------------------------------------------------------------------- +// getDebugName() +//----------------------------------------------------------------------------- +// virtual +std::string LLVOAvatar::getDebugName() const +{ +#if LL_RELEASE_WITH_DEBUG_INFO + return getFullname(); +#else + return getID().asString(); +#endif // LL_RELEASE_WITH_DEBUG_INFO +} + +//----------------------------------------------------------------------------- // getID() //----------------------------------------------------------------------------- +// virtual const LLUUID& LLVOAvatar::getID() const { return mID; @@ -6315,6 +6331,7 @@ const LLUUID& LLVOAvatar::getID() const // getJoint() //----------------------------------------------------------------------------- // RN: avatar joints are multi-rooted to include screen-based attachments +// virtual LLJoint *LLVOAvatar::getJoint( const std::string &name ) { joint_map_t::iterator iter = mJointMap.find(name); @@ -6583,11 +6600,11 @@ void LLVOAvatar::updateAttachmentOverrides() } } pelvis_fixups = mPelvisFixups; - //dumpArchetypeXML(getFullname() + "_paranoid_updated"); + //dumpArchetypeXML(getDebugName() + "_paranoid_updated"); // Rebuild and compare rebuildAttachmentOverrides(); - //dumpArchetypeXML(getFullname() + "_paranoid_rebuilt"); + //dumpArchetypeXML(getDebugName() + "_paranoid_rebuilt"); bool mismatched = false; for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++) { @@ -6816,22 +6833,22 @@ void LLVOAvatar::showAttachmentOverrides(bool verbose) const { std::stringstream ss; std::copy(pos_names.begin(), pos_names.end(), std::ostream_iterator<std::string>(ss, ",")); - LL_INFOS() << getFullname() << " attachment positions defined for joints: " << ss.str() << "\n" << LL_ENDL; + LL_INFOS() << avString() << " attachment positions defined for joints: " << ss.str() << "\n" << LL_ENDL; } else { - LL_DEBUGS("Avatar") << getFullname() << " no attachment positions defined for any joints" << "\n" << LL_ENDL; + LL_DEBUGS("Avatar") << avString() << " no attachment positions defined for any joints" << "\n" << LL_ENDL; } if (scale_names.size()) { std::stringstream ss; std::copy(scale_names.begin(), scale_names.end(), std::ostream_iterator<std::string>(ss, ",")); - LL_INFOS() << getFullname() << " attachment scales defined for joints: " << ss.str() << "\n" << LL_ENDL; + LL_INFOS() << getDebugName() << " attachment scales defined for joints: " << ss.str() << "\n" << LL_ENDL; } else { - LL_INFOS() << getFullname() << " no attachment scales defined for any joints" << "\n" << LL_ENDL; + LL_INFOS() << getDebugName() << " no attachment scales defined for any joints" << "\n" << LL_ENDL; } if (!verbose) @@ -8202,7 +8219,7 @@ bool LLVOAvatar::getIsCloud() const void LLVOAvatar::updateRezzedStatusTimers(S32 rez_status) { // State machine for rezzed status. Statuses are -1 on startup, 0 - // = cloud, 1 = gray, 2 = downloading, 3 = waiting for attachments, 4 = full. + // Statuses are -1 on startup, 0 = cloud, 1 = gray, 2 = downloading, 3 = waiting for attachments, 4 = full. // Purpose is to collect time data for each it takes avatar to reach // various loading landmarks: gray, textured (partial), textured fully. @@ -8466,19 +8483,19 @@ bool LLVOAvatar::processFullyLoadedChange(bool loading) F32 first_use_delay = FIRST_APPEARANCE_CLOUD_MIN_DELAY; if (!isSelf() && loading) { - // Note that textures can causes 60s delay on thier own - // so this delay might end up on top of textures' delay - first_use_delay = llclamp( - mFirstAppearanceMessageTimer.getElapsedTimeF32(), - FIRST_APPEARANCE_CLOUD_MIN_DELAY, - FIRST_APPEARANCE_CLOUD_MAX_DELAY); + // Note that textures can causes 60s delay on thier own + // so this delay might end up on top of textures' delay + first_use_delay = llclamp( + mFirstAppearanceMessageTimer.getElapsedTimeF32(), + FIRST_APPEARANCE_CLOUD_MIN_DELAY, + FIRST_APPEARANCE_CLOUD_MAX_DELAY); - if (shouldImpostor()) - { - // Impostors are less of a priority, - // let them stay cloud longer - first_use_delay *= FIRST_APPEARANCE_CLOUD_IMPOSTOR_MODIFIER; - } + if (shouldImpostor()) + { + // Impostors are less of a priority, + // let them stay cloud longer + first_use_delay *= FIRST_APPEARANCE_CLOUD_IMPOSTOR_MODIFIER; + } } mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > first_use_delay); } @@ -8498,8 +8515,8 @@ bool LLVOAvatar::processFullyLoadedChange(bool loading) const S32 UPDATE_RATE = 30; bool changed = ((mFullyLoaded != mPreviousFullyLoaded) || // if the value is different from the previous call - (!mFullyLoadedInitialized) || // if we've never been called before - (mFullyLoadedFrameCounter % UPDATE_RATE == 0)); // every now and then issue a change + (!mFullyLoadedInitialized) || // if we've never been called before + (mFullyLoadedFrameCounter % UPDATE_RATE == 0)); // every now and then issue a change bool fully_loaded_changed = (mFullyLoaded != mPreviousFullyLoaded); mPreviousFullyLoaded = mFullyLoaded; @@ -9406,12 +9423,12 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, const LLAppearanceMessageContents& contents) { - std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml"); + std::string outfilename = get_sequential_numbered_file_name(dump_prefix, ".xml"); const std::vector<F32>& params_for_dump = contents.mParamWeights; const LLTEContents& tec = contents.mTEContents; LLAPRFile outfile; - std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, outfilename); outfile.open(fullpath, LL_APR_WB ); apr_file_t* file = outfile.getFileHandle(); if (!file) @@ -9624,7 +9641,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) static LLCachedControl<bool> enable_verbose_dumps(gSavedSettings, "DebugAvatarAppearanceMessage"); static LLCachedControl<bool> block_avatar_appearance_messages(gSavedSettings, "BlockAvatarAppearanceMessages"); - std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; + std::string dump_prefix = getDebugName() + (isSelf() ? "_s_" : "_o_"); if (block_avatar_appearance_messages) { LL_WARNS() << "Blocking AvatarAppearance message" << LL_ENDL; @@ -10258,7 +10275,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara std::string outprefix(prefix); if (outprefix.empty()) { - outprefix = getFullname() + (isSelf()?"_s":"_o"); + outprefix = getDebugName() + (isSelf()?"_s":"_o"); } if (outprefix.empty()) { @@ -10754,7 +10771,7 @@ void LLVOAvatar::updateRiggingInfo() { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - LL_DEBUGS("RigSpammish") << getFullname() << " updating rig tab" << LL_ENDL; + LL_DEBUGS("RigSpammish") << getDebugName() << " updating rig tab" << LL_ENDL; // use a local static for scratch space to avoid reallocation here static std::vector<LLVOVolume*> volumes; @@ -10798,7 +10815,7 @@ void LLVOAvatar::updateRiggingInfo() //LL_INFOS() << "done update rig count is " << countRigInfoTab(mJointRiggingInfoTab) << LL_ENDL; // Remove debug only stuff on hot path - // LL_DEBUGS("RigSpammish") << getFullname() << " after update rig tab:" << LL_ENDL; + // LL_DEBUGS("RigSpammish") << getDebugName() << " after update rig tab:" << LL_ENDL; // S32 joint_count, box_count; // showRigInfoTabExtents(this, mJointRiggingInfoTab, joint_count, box_count); // LL_DEBUGS("RigSpammish") << "uses " << joint_count << " joints " << " nonzero boxes: " << box_count << LL_ENDL; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index dd1725c322..d377ebad41 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -231,7 +231,8 @@ public: std::set<LLUUID> mActiveOverrideMeshes; virtual void onActiveOverrideMeshesChanged(); - /*virtual*/ const LLUUID& getID() const; +/*virtual*/ const LLUUID& getID() const; + /*virtual*/ std::string getDebugName() const; /*virtual*/ void addDebugText(const std::string& text); /*virtual*/ F32 getTimeDilation(); /*virtual*/ void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm); @@ -329,16 +330,16 @@ public: // avatar render cost - U32 getVisualComplexity() { return mVisualComplexity; }; + U32 getVisualComplexity() { return mVisualComplexity; }; // surface area calculation - F32 getAttachmentSurfaceArea() { return mAttachmentSurfaceArea; }; + F32 getAttachmentSurfaceArea() { return mAttachmentSurfaceArea; }; - U32 getReportedVisualComplexity() { return mReportedVisualComplexity; }; // Numbers as reported by the SL server - void setReportedVisualComplexity(U32 value) { mReportedVisualComplexity = value; }; + U32 getReportedVisualComplexity() { return mReportedVisualComplexity; }; // Numbers as reported by the SL server + void setReportedVisualComplexity(U32 value) { mReportedVisualComplexity = value; }; - S32 getUpdatePeriod() { return mUpdatePeriod; }; - const LLColor4 & getMutedAVColor() { return mMutedAVColor; }; + S32 getUpdatePeriod() { return mUpdatePeriod; }; + const LLColor4 & getMutedAVColor() { return mMutedAVColor; }; static void updateImpostorRendering(U32 newMaxNonImpostorsValue); void idleUpdateBelowWater(); @@ -401,7 +402,7 @@ public: virtual bool getIsCloud() const; bool isFullyTextured() const; bool hasGray() const; - S32 getRezzedStatus() const; // 0 = cloud, 1 = gray, 2 = textured, 3 = textured and fully downloaded. + S32 getRezzedStatus() const; // 0 = cloud, 1 = gray, 2 = textured, 3 = waiting for attachments, 4 = full. void updateRezzedStatusTimers(S32 status); S32 mLastRezzedStatus; @@ -740,7 +741,7 @@ protected: LLViewerTexLayerSet* getTexLayerSet(const U32 index) const { return dynamic_cast<LLViewerTexLayerSet*>(mBakedTextureDatas[index].mTexLayerSet); } - LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; + LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList; bool mLoadedCallbacksPaused; S32 mLoadedCallbackTextures; // count of 'loaded' baked textures, filled from mCallbackTextureList LLFrameTimer mLastTexCallbackAddedTime; diff --git a/indra/newview/llvoicecallhandler.cpp b/indra/newview/llvoicecallhandler.cpp index 25b0e69436..d2c947fef2 100644 --- a/indra/newview/llvoicecallhandler.cpp +++ b/indra/newview/llvoicecallhandler.cpp @@ -38,6 +38,11 @@ public: { } + virtual bool canHandleUntrusted(const LLSD ¶ms, const LLSD &query_map, LLMediaCtrl *web, const std::string &nav_type) + { + return (nav_type == NAV_TYPE_CLICKED || nav_type == NAV_TYPE_EXTERNAL); + } + bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web) { //Make sure we have some parameters diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index 55769f567b..b60337ee14 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -370,6 +370,12 @@ void LLVoiceChannel::resume() { if (sSuspendedVoiceChannel) { + if (sSuspendedVoiceChannel->callStarted()) + { + // should have channel data already, restart + sSuspendedVoiceChannel->setState(STATE_READY); + } + // won't do anything if call is already started sSuspendedVoiceChannel->activate(); } else diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 31f1bbcc21..43bb1c177c 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1535,11 +1535,16 @@ bool LLVOVolume::calcLOD() mLODAdjustedDistance = distance; + static LLCachedControl<S32> debug_selection_lods(gSavedSettings, "DebugSelectionLODs", 0); if (isHUDAttachment()) { // HUDs always show at highest detail cur_detail = 3; } + else if (isSelected() && debug_selection_lods() >= 0) + { + cur_detail = llmin(debug_selection_lods(), 3); + } else { cur_detail = computeLODDetail(ll_round(distance, 0.01f), ll_round(radius, 0.01f), lod_factor); diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index 217d46d1d2..89fd93d58d 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -933,6 +933,7 @@ LLContextMenu* LLWearableItemsList::ContextMenu::createMenu() // Register handlers for attachments. registrar.add("Attachment.Detach", boost::bind(&LLAppearanceMgr::removeItemsFromAvatar, LLAppearanceMgr::getInstance(), ids, no_op)); + registrar.add("Attachment.Favorite", boost::bind(toggle_favorites, ids)); registrar.add("Attachment.Touch", boost::bind(handle_attachment_touch, selected_id)); registrar.add("Attachment.Profile", boost::bind(show_item_profile, selected_id)); registrar.add("Object.Attach", boost::bind(LLViewerAttachMenu::attachObjects, ids, _2)); @@ -964,8 +965,11 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu U32 n_links = 0; // number of links among the selected items U32 n_editable = 0; // number of editable items among the selected ones U32 n_touchable = 0; // number of touchable items among the selected ones + U32 n_favorites = 0; // number of favorite items among the selected ones bool can_be_worn = true; + bool can_favorite = false; + bool can_unfavorite = false; for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { @@ -987,6 +991,12 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu const bool is_editable = get_is_item_editable(id); const bool is_touchable = enable_attachment_touch(id); const bool is_already_worn = gAgentWearables.selfHasWearable(wearable_type); + + LLUUID linked_id = item->getLinkedUUID(); + LLViewerInventoryItem* linked_item = gInventory.getItem(linked_id); + can_favorite |= !linked_item->getIsFavorite(); + can_unfavorite |= linked_item->getIsFavorite(); + if (is_worn) { ++n_worn; @@ -1010,7 +1020,7 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu if (can_be_worn) { - can_be_worn = get_can_item_be_worn(item->getLinkedUUID()); + can_be_worn = get_can_item_be_worn(linked_id); } } // for @@ -1032,6 +1042,8 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu setMenuItemEnabled(menu, "create_new", LLAppearanceMgr::instance().canAddWearables(ids)); setMenuItemVisible(menu, "show_original", !standalone); setMenuItemEnabled(menu, "show_original", n_items == 1 && n_links == n_items); + setMenuItemVisible(menu, "favorites_add", can_favorite); + setMenuItemVisible(menu, "favorites_remove", can_unfavorite); setMenuItemVisible(menu, "take_off", mask == MASK_CLOTHING && n_worn == n_items); setMenuItemVisible(menu, "detach", mask == MASK_ATTACHMENT && n_worn == n_items); setMenuItemVisible(menu, "take_off_or_detach", mask == (MASK_ATTACHMENT|MASK_CLOTHING)); diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index e39328fdd6..0deb59cad0 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -32,24 +32,24 @@ // // Defining these makes it easier if we ever need to change our tag -#define RLV_WARNS LL_WARNS("RLV") -#define RLV_INFOS LL_INFOS("RLV") -#define RLV_DEBUGS LL_DEBUGS("RLV") -#define RLV_ENDL LL_ENDL -#define RLV_VERIFY(f) (f) +#define RLV_WARNS LL_WARNS("RLV") +#define RLV_INFOS LL_INFOS("RLV") +#define RLV_DEBUGS LL_DEBUGS("RLV") +#define RLV_ENDL LL_ENDL +#define RLV_VERIFY(f) (f) #if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG // Make sure we halt execution on errors - #define RLV_ERRS LL_ERRS("RLV") + #define RLV_ERRS LL_ERRS("RLV") // Keep our asserts separate from LL's - #define RLV_ASSERT(f) if (!(f)) { RLV_ERRS << "ASSERT (" << #f << ")" << RLV_ENDL; } - #define RLV_ASSERT_DBG(f) RLV_ASSERT(f) + #define RLV_ASSERT(f) if (!(f)) { RLV_ERRS << "ASSERT (" << #f << ")" << RLV_ENDL; } + #define RLV_ASSERT_DBG(f) RLV_ASSERT(f) #else // Don't halt execution on errors in release - #define RLV_ERRS LL_WARNS("RLV") + #define RLV_ERRS LL_WARNS("RLV") // We don't want to check assertions in release builds #ifdef RLV_DEBUG - #define RLV_ASSERT(f) RLV_VERIFY(f) + #define RLV_ASSERT(f) RLV_VERIFY(f) #define RLV_ASSERT_DBG(f) #else #define RLV_ASSERT(f) @@ -142,9 +142,9 @@ namespace Rlv enum class EExceptionCheck { - Permissive, // Exception can be set by any object - Strict, // Exception must be set by all objects holding the restriction - Default, // Permissive or strict will be determined by currently enforced restrictions + Permissive, // Exception can be set by any object + Strict, // Exception must be set by all objects holding the restriction + Default, // Permissive or strict will be determined by currently enforced restrictions }; // Replace&remove in c++23 diff --git a/indra/newview/rlvhelper.h b/indra/newview/rlvhelper.h index f241332594..f0ce35b816 100644 --- a/indra/newview/rlvhelper.h +++ b/indra/newview/rlvhelper.h @@ -49,12 +49,12 @@ namespace Rlv enum EBehaviourFlags : uint32_t { // General behaviour flags - Strict = 0x0001, // Behaviour has a "_sec" version - Synonym = 0x0002, // Behaviour is a synonym of another - Extended = 0x0004, // Behaviour is part of the RLVa extended command set - Experimental = 0x0008, // Behaviour is part of the RLVa experimental command set - Blocked = 0x0010, // Behaviour is blocked - Deprecated = 0x0020, // Behaviour is deprecated + Strict = 0x0001, // Behaviour has a "_sec" version + Synonym = 0x0002, // Behaviour is a synonym of another + Extended = 0x0004, // Behaviour is part of the RLVa extended command set + Experimental = 0x0008, // Behaviour is part of the RLVa experimental command set + Blocked = 0x0010, // Behaviour is blocked + Deprecated = 0x0020, // Behaviour is deprecated MaskGeneral = 0x0FFF, // Force-wear specific flags @@ -175,7 +175,7 @@ namespace Rlv template<EBehaviour templBhvr> using ReplyHandler = CommandHandler<EParamType::Reply, templBhvr>; // List of shared handlers - using VersionReplyHandler = ReplyHandler<EBehaviour::Version>; // Shared between @version and @versionnew + using VersionReplyHandler = ReplyHandler<EBehaviour::Version>; // Shared between @version and @versionnew // // CommandProcessor - Templated glue class that brings BehaviourInfo, CommandHandlerBaseImpl and CommandHandler together diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index 92f63a1820..60d9a5da23 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -454,6 +454,9 @@ name="InventoryBackgroundColor" reference="DkGray2" /> <color + name="InventoryFavoriteColor" + reference="Yellow" /> + <color name="InventoryFocusOutlineColor" reference="White_25" /> <color diff --git a/indra/newview/skins/default/textures/icons/Icon_Pointer.png b/indra/newview/skins/default/textures/icons/Icon_Pointer.png Binary files differnew file mode 100644 index 0000000000..021942a8aa --- /dev/null +++ b/indra/newview/skins/default/textures/icons/Icon_Pointer.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Favorite_Star_Content.png b/indra/newview/skins/default/textures/icons/Inv_Favorite_Star_Content.png Binary files differnew file mode 100644 index 0000000000..b71b202234 --- /dev/null +++ b/indra/newview/skins/default/textures/icons/Inv_Favorite_Star_Content.png diff --git a/indra/newview/skins/default/textures/icons/Inv_Favorite_Star_Full.png b/indra/newview/skins/default/textures/icons/Inv_Favorite_Star_Full.png Binary files differnew file mode 100644 index 0000000000..7d55fb5cfe --- /dev/null +++ b/indra/newview/skins/default/textures/icons/Inv_Favorite_Star_Full.png diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 97468c3b2e..d650e7e791 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -306,6 +306,8 @@ with the same filename but different name <texture name="Inv_CallingCard" file_name="icons/Inv_CallingCard.png" preload="false" /> <texture name="Inv_Clothing" file_name="icons/Inv_Clothing.png" preload="false" /> <texture name="Inv_Eye" file_name="icons/Inv_Eye.png" preload="false" /> + <texture name="Inv_Favorite_Star_Content" file_name="icons/Inv_Favorite_Star_Content.png" preload="false" /> + <texture name="Inv_Favorite_Star_Full" file_name="icons/Inv_Favorite_Star_Full.png" preload="false" /> <texture name="Inv_FolderClosed" file_name="icons/Inv_FolderClosed.png" preload="false" /> <texture name="Inv_FolderOpen" file_name="icons/Inv_FolderOpen.png" preload="false" /> <texture name="Inv_Gesture" file_name="icons/Inv_Gesture.png" preload="false" /> @@ -907,4 +909,5 @@ with the same filename but different name <texture name="Single_Folder_Up" file_name="icons/single_folder_up.png" preload="true"/> <texture name="Icon_Color_Palette" file_name="icons/Icon_Color_Palette.png" preload="false"/> <texture name="Icon_Font_Size" file_name="icons/Icon_Font_Size.png" preload="false"/> + <texture name="Icon_Pointer" file_name="icons/Icon_Pointer.png" preload="false"/> </textures> diff --git a/indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml b/indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml deleted file mode 100644 index 1aa216d6b4..0000000000 --- a/indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml +++ /dev/null @@ -1,425 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater - legacy_header_height="18" - height="340" - layout="topleft" - name="item properties" - help_topic="item_properties" - save_rect="true" - title="INVENTORY ITEM PROPERTIES" - width="350"> - <floater.string - name="unknown"> - (unknown) - </floater.string> - <floater.string - name="public"> - (public) - </floater.string> - <floater.string - name="you_can"> - You can: - </floater.string> - <floater.string - name="owner_can"> - Owner can: - </floater.string> - <floater.string - name="acquiredDate"> - [wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local] - </floater.string> - <floater.string - name="acquiredDateAMPM"> - [wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour12,datetime,local]:[min,datetime,local]:[second,datetime,local] [ampm,datetime,local] [year,datetime,local] - </floater.string> - <icon - follows="top|right" - height="18" - image_name="Lock" - layout="topleft" - left="276" - mouse_opaque="true" - name="IconLocked" - top="4" - width="18" /> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left="10" - name="LabelItemNameTitle" - top="25" - width="78"> - Name: - </text> - <line_editor - border_style="line" - border_thickness="1" - follows="left|top|right" - height="16" - layout="topleft" - left_delta="78" - max_length_bytes="63" - name="LabelItemName" - top_delta="0" - width="252" /> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left="10" - name="LabelItemDescTitle" - top="45" - width="78"> - Description: - </text> - <line_editor - border_style="line" - border_thickness="1" - follows="left|top|right" - height="16" - layout="topleft" - left_delta="78" - max_length_bytes="127" - name="LabelItemDesc" - top_delta="0" - width="252" /> - <text - type="string" - length="1" - follows="left|top" - height="16" - layout="topleft" - left="10" - name="LabelCreatorTitle" - top="65" - width="78"> - Creator: - </text> - <text - type="string" - length="1" - follows="left|top" - height="16" - layout="topleft" - left_delta="78" - name="LabelCreatorName" - top_delta="0" - translate="false" - use_ellipses="true" - width="170"> - TestString PleaseIgnore - </text> - <button - follows="top|right" - height="16" - label="Profile..." - layout="topleft" - left_delta="174" - name="BtnCreator" - top_delta="0" - width="78" /> - <text - type="string" - length="1" - follows="left|top" - height="16" - layout="topleft" - left="10" - name="LabelOwnerTitle" - top="85" - width="78"> - Owner: - </text> - <text - type="string" - length="1" - follows="left|top" - height="16" - layout="topleft" - left_delta="78" - name="LabelOwnerName" - top_delta="0" - translate="false" - use_ellipses="true" - width="170"> - TestString PleaseIgnore - </text> - <button - follows="top|right" - height="16" - label="Profile..." - layout="topleft" - left_delta="174" - name="BtnOwner" - top_delta="0" - width="78" /> - <text - type="string" - length="1" - follows="left|top" - height="16" - layout="topleft" - left="10" - name="LabelAcquiredTitle" - top="105" - width="78"> - Acquired: - </text> - <text - type="string" - length="1" - follows="left|top" - height="16" - layout="topleft" - left_delta="78" - name="LabelAcquiredDate" - top_delta="0" - width="252"> - Wed May 24 12:50:46 2006 - </text> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left="10" - name="OwnerLabel" - top="125" - width="78"> - You: - </text> - <check_box - height="16" - label="Edit" - layout="topleft" - left_pad="5" - name="CheckOwnerModify" - top_delta="0" - width="78" /> - <check_box - height="16" - label="Copy" - layout="topleft" - left_delta="0" - name="CheckOwnerCopy" - top_pad="5" - width="88" /> - <check_box - height="16" - label="Resell" - layout="topleft" - left_delta="0" - name="CheckOwnerTransfer" - top_pad="5" - width="106" /> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left="10" - name="AnyoneLabel" - top_pad="5" - width="78"> - Anyone: - </text> - <check_box - height="16" - label="Copy" - layout="topleft" - left_pad="5" - name="CheckEveryoneCopy" - top_delta="0" - width="130" /> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left="10" - name="GroupLabel" - top_pad="5" - width="78"> - Group: - </text> - <check_box - height="16" - label="Share" - layout="topleft" - left_pad="5" - name="CheckShareWithGroup" - top_delta="5" - width="106" /> - <text - type="string" - length="1" - follows="left|top" - height="25" - layout="topleft" - left="10" - name="NextOwnerLabel" - top_pad="5" - width="78" - word_wrap="true"> - Next owner: - </text> - <check_box - height="16" - label="Edit" - layout="topleft" - left_pad="5" - name="CheckNextOwnerModify" - top_delta="0" - width="78" /> - <check_box - height="16" - label="Copy" - layout="topleft" - left_delta="0" - name="CheckNextOwnerCopy" - top_pad="5" - width="88" /> - <check_box - height="16" - label="Resell" - layout="topleft" - left_delta="0" - name="CheckNextOwnerTransfer" - top_pad="5" - width="106" /> - <check_box - height="16" - label="For Sale" - layout="topleft" - left="10" - name="CheckPurchase" - top_pad="5" - width="78" /> - <combo_box - height="19" - left_pad="5" - layout="topleft" - follows="left|top" - name="ComboBoxSaleType" - width="110"> - <combo_box.item - name="Copy" - label="Copy" - value="2" /> - <combo_box.item - name="Contents" - label="Contents" - value="3" /> - <combo_box.item - name="Original" - label="Original" - value="1" /> - </combo_box> - <spinner - follows="left|top" - decimal_digits="0" - increment="1" - name="Edit Cost" - label="Price:" - label_width="100" - left="10" - width="192" - min_val="1" - height="19" - max_val="999999999" - top_pad="5"/> - <text - type="string" - length="1" - height="15" - follows="left|top" - layout="topleft" - left_delta="82" - name="CurrencySymbol" - top_delta="1" - width="18"> - L$ - </text> - - <!--line_editor - border_style="line" - border_thickness="1" - follows="left|top|right" - height="16" - layout="topleft" - left_pad="5" - max_length_bytes="25" - name="EditPrice" - top_delta="0" - width="242" /--> - - <!--text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left="10" - name="BaseMaskDebug" - top="155" - width="330"> - B: - </text> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left_delta="60" - name="OwnerMaskDebug" - top_delta="0" - width="270"> - O: - </text> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left_delta="60" - name="GroupMaskDebug" - top_delta="0" - width="210"> - G: - </text> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left_delta="60" - name="EveryoneMaskDebug" - top_delta="0" - width="150"> - E: - </text> - <text - type="string" - length="1" - follows="left|top" - height="10" - layout="topleft" - left_delta="60" - name="NextMaskDebug" - top_delta="0" - width="90"> - N: - </text--> - -</floater> diff --git a/indra/newview/skins/default/xui/en/floater_inventory_settings.xml b/indra/newview/skins/default/xui/en/floater_inventory_settings.xml index 156bba6c27..08b7a7af05 100644 --- a/indra/newview/skins/default/xui/en/floater_inventory_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_inventory_settings.xml @@ -4,8 +4,8 @@ can_minimize="true" can_resize="false" save_rect="true" - height="370" - width="370" + height="483" + width="483" name="inventory_settings" title="INVENTORY SETTINGS"> <icon @@ -16,7 +16,7 @@ left="18" mouse_opaque="true" name="multi_folder_icon" - top="25" + top="20" width="18" /> <text type="string" @@ -40,10 +40,10 @@ font="SansSerifMedium" left="60" width="300" - height="70" + height="66" name="multi_double_click_setting"> <radio_item - height="20" + height="18" label="Expands & collapses folder" label_text.text_color="White" follows="left|top" @@ -51,24 +51,24 @@ name="0" width="200"/> <radio_item - height="20" + height="18" follows="left|top" label="Opens a new window" label_text.text_color="White" layout="topleft" left_delta="0" name="1" - top_pad ="5" + top_pad ="3" width="200" /> <radio_item - height="20" + height="18" follows="left|top" label="Switches view" label_text.text_color="White" layout="topleft" left_delta="0" name="2" - top_pad ="5" + top_pad ="3" width="200" /> </radio_group> <icon @@ -79,7 +79,7 @@ left="18" mouse_opaque="true" name="single_folder_icon" - top_pad="30" + top_pad="19" width="18" /> <text type="string" @@ -103,10 +103,10 @@ font="SansSerifMedium" left="60" width="300" - height="45" + height="44" name="single_double_click_setting"> <radio_item - height="20" + height="18" label="Stays in current window" label_text.text_color="White" follows="left|top" @@ -114,27 +114,37 @@ name="false" width="200"/> <radio_item - height="20" + height="18" follows="left|top" label="Opens a new window" label_text.text_color="White" layout="topleft" left_delta="0" name="true" - top_pad ="5" + top_pad ="3" width="200" /> </radio_group> + <icon + follows="top|left" + height="15" + image_name="Icon_Pointer" + layout="topleft" + left="20" + mouse_opaque="true" + name="single_folder_icon" + top_pad="20" + width="15" /> <text type="string" length="1" follows="left|top|right" height="13" layout="topleft" - left="48" + left_pad="13" name="find_original_txt" font="SansSerifMedium" text_color="White" - top_pad="30" + top_delta="1" width="300"> Clicking on "Show in inventory" or "Find original" </text> @@ -146,10 +156,10 @@ font="SansSerifMedium" left="60" width="300" - height="45" + height="44" name="find_original_settings"> <radio_item - height="20" + height="18" label="Shows item in main inventory window" label_text.text_color="White" follows="left|top" @@ -157,23 +167,136 @@ name="false" width="200"/> <radio_item - height="20" + height="18" follows="left|top" label="Opens a new single-folder window" label_text.text_color="White" layout="topleft" left_delta="0" name="true" - top_pad ="5" + top_pad ="3" width="200" /> </radio_group> - <button - height="20" - label="OK" - layout="topleft" - left="140" - bottom="-20" - name="ok_btn" - label_color="White" - width="90" /> + <icon + follows="top|left" + height="18" + image_name="Inv_Favorite_Star_Full" + layout="topleft" + left="18" + mouse_opaque="true" + name="favorites_icon" + top_pad="19" + width="18" /> + <text + type="string" + length="1" + layout="topleft" + follows="left|top|right" + height="13" + left_pad="12" + top_delta="2" + name="favorites_txt" + font="SansSerifMedium" + text_color="White" + width="300"> + Favorites + </text> + <check_box + control_name="InventoryFavoritesUseStar" + layout="topleft" + follows="left|top" + top_pad="8" + font="SansSerifMedium" + left="60" + width="300" + height="18" + label="Star on favorite items" + name="favorite_star" + label_text.text_color="White" + initial_value="false"/> + <check_box + control_name="InventoryFavoritesUseHollowStar" + follows="left|top" + top_pad="5" + layout="topleft" + font="SansSerifMedium" + left="60" + width="150" + height="18" + label="Star on folders containing a favorite" + name="favorite_hollow_star" + label_text.text_color="White" + initial_value="false"/> + <check_box + control_name="InventoryFavoritesColorText" + follows="left|top" + top_pad="5" + layout="topleft" + font="SansSerifMedium" + left="60" + width="150" + height="18" + label="Colored text" + name="favorites_color" + label_text.text_color="White" + initial_value="false"/> + <color_swatch + can_apply_immediately="true" + follows="left|top" + layout="topleft" + height="24" + label_height="0" + left_pad="40" + name="favorites_swatch" + top_delta="-6" + width="44" > + <color_swatch.init_callback + function="ScriptPref.getUIColor" + parameter="InventoryFavoriteColor" /> + <color_swatch.commit_callback + function="ScriptPref.applyUIColor" + parameter="InventoryFavoriteColor" /> + </color_swatch> + <icon + follows="top|left" + height="18" + image_name="Inv_Object" + layout="topleft" + left="18" + mouse_opaque="true" + name="obj_icon" + top_pad="19" + width="18" /> + <text + type="string" + length="1" + follows="left|top|right" + height="13" + layout="topleft" + left_pad="12" + top_delta="2" + name="single_folder_txt" + font="SansSerifMedium" + text_color="White" + width="300"> + Pressing return on an avatar attachment + </text> + <combo_box + control_name="InventoryAddAttachmentBehavior" + layout="topleft" + follows="left|top" + top_pad="8" + height="24" + left="60" + name="attach_combo" + width="300"> + <combo_box.item + label="Adds attachment (recommended)" + name="0" + value="0"/> + <combo_box.item + label="Wear (removes attachment at that point)" + name="1" + value="1"/> + </combo_box> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_new_feature_notification.xml b/indra/newview/skins/default/xui/en/floater_new_feature_notification.xml index 57b74b360a..9981e5d893 100644 --- a/indra/newview/skins/default/xui/en/floater_new_feature_notification.xml +++ b/indra/newview/skins/default/xui/en/floater_new_feature_notification.xml @@ -17,17 +17,7 @@ New inventory features </floater.string> <floater.string name="description_txt_inventory"> -You can now add preview images to inventory items and view a folder in its own window. -Learn more in this [https://community.secondlife.com/blogs/entry/13637-new-features-inventory-item-preview-and-single-folder-view/ blogpost] - </floater.string> - <floater.string name="title_txt_gltf"> -New GLTF PBR materials support - </floater.string> - <floater.string name="description_txt_gltf"> -You can now use expanded material support with the ability to import and edit GLTF Physically Based Rendering (PBR) Materials. -In order to support the addition of the GLTF format, some areas in the viewer may appear darker than usual. - -Learn more about [https://wiki.secondlife.com/wiki/PBR_Materials Physically Based Rendering (PBR)] +You can now mark items and folders as favorites. Favorited items will appear in the Favorites tab of inventory and by default will be highlighted with a star in the main inventory view. </floater.string> <text type="string" diff --git a/indra/newview/skins/default/xui/en/floater_object_weights.xml b/indra/newview/skins/default/xui/en/floater_object_weights.xml index 5e4b017590..709fbdd27e 100644 --- a/indra/newview/skins/default/xui/en/floater_object_weights.xml +++ b/indra/newview/skins/default/xui/en/floater_object_weights.xml @@ -2,7 +2,7 @@ <floater can_close="true" can_tear_off="false" - height="289" + height="372" help_topic="object_weights" layout="topleft" name="object_weights" @@ -13,6 +13,21 @@ <floater.string name="nothing_selected" value="--"/> + <floater.string + name="lowest_lod" + value="Lowest"/> + <floater.string + name="low_lod" + value="Low"/> + <floater.string + name="medium_lod" + value="Medium"/> + <floater.string + name="high_lod" + value="High"/> + <floater.string + name="multiple_lods" + value="Multiple"/> <text follows="left|top" @@ -320,4 +335,97 @@ top_delta="0" value="Total capacity" width="130" /> + + + <text + follows="left|top" + height="16" + layout="topleft" + left="10" + name="rendering_info_text" + text_color="EmphasisColor" + top_pad="10" + value="RENDERING INFO" + width="180" /> + <text + follows="left|top" + halign="right" + height="16" + layout="topleft" + left="10" + name="lod_level" + top_pad="3" + value="--" + width="40" /> + <loading_indicator + follows="left|top" + height="16" + layout="topleft" + left="34" + name="lod_level_loading_indicator" + top_delta="0" + width="16" /> + <text + follows="left|top" + height="16" + layout="topleft" + left_pad="10" + name="lod_level_label" + top_delta="0" + value="LOD (Level of detail)" + width="130" /> + <text + follows="left|top" + halign="right" + height="16" + layout="topleft" + left="10" + name="triangles_shown" + top_pad="3" + value="--" + width="40" /> + <loading_indicator + follows="left|top" + height="16" + layout="topleft" + left="34" + name="triangles_shown_loading_indicator" + top_delta="0" + width="16" /> + <text + follows="left|top" + height="16" + layout="topleft" + left_pad="10" + name="triangles_shown_label" + top_delta="0" + value="Triangles Shown" + width="130" /> + <text + follows="left|top" + halign="right" + height="16" + layout="topleft" + left="10" + name="pixel_area" + top_pad="3" + value="--" + width="40" /> + <loading_indicator + follows="left|top" + height="16" + layout="topleft" + left="34" + name="pixel_area_loading_indicator" + top_delta="0" + width="16" /> + <text + follows="left|top" + height="16" + layout="topleft" + left_pad="10" + name="pixel_area_label" + top_delta="0" + value="Pixel Area" + width="130" /> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_preview_trash.xml b/indra/newview/skins/default/xui/en/floater_preview_trash.xml index f1c87c8c5a..ebb5cd9251 100644 --- a/indra/newview/skins/default/xui/en/floater_preview_trash.xml +++ b/indra/newview/skins/default/xui/en/floater_preview_trash.xml @@ -29,6 +29,8 @@ bevel_style="none" scroll.reserve_scroll_corner="false"> <folder folder_arrow_image="Folder_Arrow" + favorite_image="Inv_Favorite_Star_Full" + favorite_content_image="Inv_Favorite_Star_Content" folder_indentation="8" item_height="20" item_top_pad="4" diff --git a/indra/newview/skins/default/xui/en/floater_voice_chat_volume.xml b/indra/newview/skins/default/xui/en/floater_voice_chat_volume.xml index 51809793d3..c0d260ef59 100644 --- a/indra/newview/skins/default/xui/en/floater_voice_chat_volume.xml +++ b/indra/newview/skins/default/xui/en/floater_voice_chat_volume.xml @@ -22,7 +22,7 @@ increment="0.025" initial_value="0.5" label="Voice Chat" - label_width="50" + label_width="60" layout="topleft" left="15" top="50" diff --git a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml index 16907d3577..d8090070bd 100644 --- a/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_gallery_inventory.xml @@ -670,6 +670,22 @@ function="Inventory.DoToSelected" parameter="ungroup_folder_items" /> </menu_item_call> + <menu_item_call + label="Add to Favorites" + layout="topleft" + name="Add to Favorites"> + <menu_item_call.on_click + function="Inventory.DoToSelected" + parameter="add_to_favorites" /> + </menu_item_call> + <menu_item_call + label="Remove from Favorites" + layout="topleft" + name="Remove from Favorites"> + <menu_item_call.on_click + function="Inventory.DoToSelected" + parameter="remove_from_favorites" /> + </menu_item_call> <menu label="Use as default for" layout="topleft" @@ -715,6 +731,136 @@ function="Inventory.CanSetUploadLocation" /> </menu_item_call> </menu> + <menu + label="Upload to folder" + layout="topleft" + name="upload_options"> + <menu_item_call + label="Image..." + layout="topleft" + name="Upload Image"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="upload_texture" /> + <menu_item_call.on_enable + function="File.EnableUpload" /> + <menu_item_call.on_visible + function="Upload.CalculateCosts" + parameter="Upload Image,texture" /> + </menu_item_call> + <menu_item_call + label="Sound (L$[COST])..." + layout="topleft" + name="Upload Sound"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="upload_sound" /> + <menu_item_call.on_enable + function="File.EnableUpload" /> + <menu_item_call.on_visible + function="Upload.CalculateCosts" + parameter="Upload Sound,sound" /> + </menu_item_call> + <menu_item_call + label="Animation (L$[COST])..." + layout="topleft" + name="Upload Animation"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="upload_animation" /> + <menu_item_call.on_enable + function="File.EnableUpload" /> + <menu_item_call.on_visible + function="Upload.CalculateCosts" + parameter="Upload Animation,animation" /> + </menu_item_call> + <menu_item_call + label="Model..." + layout="topleft" + name="Upload Model"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="upload_model" /> + <menu_item_call.on_enable + function="File.EnableUploadModel" /> + <menu_item_call.on_visible + function="File.VisibleUploadModel"/> + </menu_item_call> + <menu_item_call + label="Material..." + layout="topleft" + name="Upload Material"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="upload_pbr_material" /> + <menu_item_call.on_enable + function="File.EnableUploadMaterial" /> + </menu_item_call> + <menu_item_call + label="Bulk..." + layout="topleft" + name="Bulk Upload"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="upload_bulk" /> + <menu_item_call.on_visible + function="Upload.CalculateCosts" + parameter="Bulk Upload,texture" /> + </menu_item_call> + </menu> + <menu + label="Use as default for" + layout="topleft" + name="upload_def"> + <menu_item_call + label="Image uploads" + layout="topleft" + name="Image uploads"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="def_texture" /> + <menu_item_call.on_visible + function="Inventory.CanSetUploadLocation" /> + </menu_item_call> + <menu_item_call + label="Sound uploads" + layout="topleft" + name="Sound uploads"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="def_sound" /> + <menu_item_call.on_visible + function="Inventory.CanSetUploadLocation" /> + </menu_item_call> + <menu_item_call + label="Animation uploads" + layout="topleft" + name="Animation uploads"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="def_animation" /> + <menu_item_call.on_visible + function="Inventory.CanSetUploadLocation" /> + </menu_item_call> + <menu_item_call + label="Model uploads" + layout="topleft" + name="Model uploads"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="def_model" /> + <menu_item_call.on_visible + function="Inventory.CanSetUploadLocation" /> + </menu_item_call> + <menu_item_call + label="PBR material uploads" + layout="topleft" + name="PBR uploads"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="def_pbr_material" /> + </menu_item_call> + </menu> <menu_item_separator layout="topleft" name="Marketplace Separator" /> diff --git a/indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml b/indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml index 99cee83f4e..fb68193006 100755 --- a/indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml +++ b/indra/newview/skins/default/xui/en/menu_gallery_outfit_tab.xml @@ -50,6 +50,26 @@ function="Outfit.Thumbnail" /> </menu_item_call> <menu_item_call + label="Add to favorites" + layout="topleft" + name="favorites_add"> + <on_visible + function="Outfit.OnVisible" + parameter="favorites_add" /> + <on_click + function="Outfit.Favorite" /> + </menu_item_call> + <menu_item_call + label="Remove from favorites" + layout="topleft" + name="favorites_remove"> + <on_visible + function="Outfit.OnVisible" + parameter="favorites_remove" /> + <on_click + function="Outfit.Favorite" /> + </menu_item_call> + <menu_item_call label="Edit outfit" layout="topleft" name="edit"> diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index d8aac71dd5..1558343216 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -951,6 +951,99 @@ function="Inventory.DoToSelected" parameter="ungroup_folder_items" /> </menu_item_call> + <menu_item_call + label="Add to Favorites" + layout="topleft" + name="Add to Favorites"> + <menu_item_call.on_click + function="Inventory.DoToSelected" + parameter="add_to_favorites" /> + </menu_item_call> + <menu_item_call + label="Remove from Favorites" + layout="topleft" + name="Remove from Favorites"> + <menu_item_call.on_click + function="Inventory.DoToSelected" + parameter="remove_from_favorites" /> + </menu_item_call> + <menu + label="Upload to folder" + layout="topleft" + name="upload_options"> + <menu_item_call + label="Image..." + layout="topleft" + name="Upload Image"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="upload_texture" /> + <menu_item_call.on_enable + function="File.EnableUpload" /> + <menu_item_call.on_visible + function="Upload.CalculateCosts" + parameter="Upload Image,texture" /> + </menu_item_call> + <menu_item_call + label="Sound (L$[COST])..." + layout="topleft" + name="Upload Sound"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="upload_sound" /> + <menu_item_call.on_enable + function="File.EnableUpload" /> + <menu_item_call.on_visible + function="Upload.CalculateCosts" + parameter="Upload Sound,sound" /> + </menu_item_call> + <menu_item_call + label="Animation (L$[COST])..." + layout="topleft" + name="Upload Animation"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="upload_animation" /> + <menu_item_call.on_enable + function="File.EnableUpload" /> + <menu_item_call.on_visible + function="Upload.CalculateCosts" + parameter="Upload Animation,animation" /> + </menu_item_call> + <menu_item_call + label="Model..." + layout="topleft" + name="Upload Model"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="upload_model" /> + <menu_item_call.on_enable + function="File.EnableUploadModel" /> + <menu_item_call.on_visible + function="File.VisibleUploadModel"/> + </menu_item_call> + <menu_item_call + label="Material..." + layout="topleft" + name="Upload Material"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="upload_pbr_material" /> + <menu_item_call.on_enable + function="File.EnableUploadMaterial" /> + </menu_item_call> + <menu_item_call + label="Bulk..." + layout="topleft" + name="Bulk Upload"> + <menu_item_call.on_click + function="Inventory.FileUploadLocation" + parameter="upload_bulk" /> + <menu_item_call.on_visible + function="Upload.CalculateCosts" + parameter="Bulk Upload,texture" /> + </menu_item_call> + </menu> <menu label="Use as default for" layout="topleft" @@ -961,7 +1054,7 @@ name="Image uploads"> <menu_item_call.on_click function="Inventory.FileUploadLocation" - parameter="texture" /> + parameter="def_texture" /> </menu_item_call> <menu_item_call label="Sound uploads" @@ -969,7 +1062,7 @@ name="Sound uploads"> <menu_item_call.on_click function="Inventory.FileUploadLocation" - parameter="sound" /> + parameter="def_sound" /> </menu_item_call> <menu_item_call label="Animation uploads" @@ -977,7 +1070,7 @@ name="Animation uploads"> <menu_item_call.on_click function="Inventory.FileUploadLocation" - parameter="animation" /> + parameter="def_animation" /> </menu_item_call> <menu_item_call label="Model uploads" @@ -985,7 +1078,7 @@ name="Model uploads"> <menu_item_call.on_click function="Inventory.FileUploadLocation" - parameter="model" /> + parameter="def_model" /> </menu_item_call> <menu_item_call label="PBR material uploads" @@ -993,7 +1086,7 @@ name="PBR uploads"> <menu_item_call.on_click function="Inventory.FileUploadLocation" - parameter="pbr_material" /> + parameter="def_pbr_material" /> </menu_item_call> </menu> <menu_item_separator diff --git a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml index e249acaccd..d17fbf84b3 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml @@ -138,4 +138,15 @@ function="Inventory.GearDefault.Visible" parameter="multi_folder_view" /> </menu_item_call> + <menu_item_separator/> + <menu_item_check + label="Inventory settings..." + name="inv_settings"> + <menu_item_check.on_check + function="Floater.Visible" + parameter="inventory_settings" /> + <menu_item_check.on_click + function="Floater.Toggle" + parameter="inventory_settings" /> + </menu_item_check> </toggleable_menu> diff --git a/indra/newview/skins/default/xui/en/menu_inventory_view_default.xml b/indra/newview/skins/default/xui/en/menu_inventory_view_default.xml index 33cf01493d..97f53d3a17 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory_view_default.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory_view_default.xml @@ -100,15 +100,4 @@ function="Inventory.GearDefault.Visible" parameter="single_folder_view" /> </menu_item_check> - <menu_item_separator/> - <menu_item_check - label="Inventory settings..." - name="inv_settings"> - <menu_item_check.on_check - function="Floater.Visible" - parameter="inventory_settings" /> - <menu_item_check.on_click - function="Floater.Toggle" - parameter="inventory_settings" /> - </menu_item_check> </toggleable_menu> diff --git a/indra/newview/skins/default/xui/en/menu_outfit_gallery_sort.xml b/indra/newview/skins/default/xui/en/menu_outfit_gallery_sort.xml new file mode 100644 index 0000000000..aa4cd1483d --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_outfit_gallery_sort.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<toggleable_menu + layout="topleft" + visible="false" + name="Sort Outfit"> + <menu_item_check + label="Sort favorites to top" + layout="topleft" + visible="true" + name="sort_favorites_to_top"> + <on_click + function="Sort.OnSort" + parameter="favorites_to_top" /> + <on_check + function="Sort.OnEnable" + parameter="favorites_to_top" /> + </menu_item_check> + <menu_item_check + label="Sort images to top" + layout="topleft" + visible="true" + name="sort_images_to_top"> + <on_click + function="Sort.OnSort" + parameter="images_to_top" /> + <on_check + function="Sort.OnEnable" + parameter="images_to_top" /> + </menu_item_check> + <menu_item_check + label="Sort by name" + layout="topleft" + visible="true" + name="sort_by_name"> + <on_click + function="Sort.OnSort" + parameter="by_name" /> + <on_check + function="Sort.OnEnable" + parameter="by_name" /> + </menu_item_check> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/en/menu_outfit_gear.xml b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml index 8f36c7a00a..e333b05d3e 100644 --- a/indra/newview/skins/default/xui/en/menu_outfit_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml @@ -50,6 +50,26 @@ function="Gear.Thumbnail" /> </menu_item_call> <menu_item_call + label="Add to favorite outfits" + layout="topleft" + name="favorites_add"> + <on_visible + function="Gear.OnVisible" + parameter="favorites_add" /> + <on_click + function="Gear.Favorite" /> + </menu_item_call> + <menu_item_call + label="Remove from favorite outfits" + layout="topleft" + name="favorites_remove"> + <on_visible + function="Gear.OnVisible" + parameter="favorites_remove" /> + <on_click + function="Gear.Favorite" /> + </menu_item_call> + <menu_item_call label="Rename outfit" layout="topleft" name="rename"> @@ -89,34 +109,6 @@ function="Gear.OnVisible" parameter="delete" /> </menu_item_call> - <menu_item_separator> - <on_visible - function="Gear.OnVisible"/> - </menu_item_separator> - <menu_item_check - label="Sort folders always by name" - layout="topleft" - name="sort_folders_by_name"> - <on_click - function="Gear.SortByName" /> - <on_check - function="CheckControl" - parameter="OutfitGallerySortByName" /> - </menu_item_check> - <menu_item_call - label="Expand all folders" - layout="topleft" - name="expand"> - <on_click - function="Gear.Expand" /> - </menu_item_call> - <menu_item_call - label="Collapse all folders" - layout="topleft" - name="collapse"> - <on_click - function="Gear.Collapse" /> - </menu_item_call> <menu_item_separator/> <!-- copied (with minor modifications) from menu_inventory_add.xml --> <!-- *TODO: generate dynamically? --> @@ -277,4 +269,19 @@ </menu_item_call> </menu> <!-- copied from menu_inventory_add.xml --> + + <menu_item_separator/> + + <menu_item_check + label="Inventory settings..." + layout="topleft" + visible="true" + name="inventory_settings"> + <menu_item_check.on_check + function="Floater.Visible" + parameter="inventory_settings" /> + <menu_item_check.on_click + function="Floater.Toggle" + parameter="inventory_settings" /> + </menu_item_check> </toggleable_menu> diff --git a/indra/newview/skins/default/xui/en/menu_outfit_list_sort.xml b/indra/newview/skins/default/xui/en/menu_outfit_list_sort.xml new file mode 100644 index 0000000000..0a4d1ea877 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_outfit_list_sort.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<toggleable_menu + layout="topleft" + visible="false" + name="Sort Outfit"> + <menu_item_call + label="Expand all folders" + layout="topleft" + name="expand"> + <on_click + function="Sort.Expand" /> + </menu_item_call> + <menu_item_call + label="Collapse all folders" + layout="topleft" + visible="true" + name="collapse"> + <on_click + function="Sort.Collapse" /> + </menu_item_call> + + <menu_item_separator/> + + <menu_item_check + label="Sort favorites to top" + layout="topleft" + name="sort_favorites_to_top"> + <on_click + function="Sort.OnSort" + parameter="favorites_to_top" /> + <on_check + function="Sort.OnEnable" + parameter="favorites_to_top" /> + </menu_item_check> + + <menu_item_separator/> + + <menu_item_check + label="Show entire outfit in search" + layout="topleft" + name="show_entire_outfit_in_search"> + <on_click + function="Sort.OnSort" + parameter="show_entire_outfit" /> + <on_check + function="Sort.OnEnable" + parameter="show_entire_outfit" /> + </menu_item_check> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/en/menu_outfit_tab.xml b/indra/newview/skins/default/xui/en/menu_outfit_tab.xml index c6805edd63..0d45e7c95c 100644 --- a/indra/newview/skins/default/xui/en/menu_outfit_tab.xml +++ b/indra/newview/skins/default/xui/en/menu_outfit_tab.xml @@ -50,6 +50,26 @@ function="Outfit.Thumbnail" /> </menu_item_call> <menu_item_call + label="Add to favorites" + layout="topleft" + name="favorites_add"> + <on_visible + function="Outfit.OnVisible" + parameter="favorites_add" /> + <on_click + function="Outfit.Favorite" /> + </menu_item_call> + <menu_item_call + label="Remove from favorites" + layout="topleft" + name="favorites_remove"> + <on_visible + function="Outfit.OnVisible" + parameter="favorites_remove" /> + <on_click + function="Outfit.Favorite" /> + </menu_item_call> + <menu_item_call label="Edit outfit" layout="topleft" name="edit"> diff --git a/indra/newview/skins/default/xui/en/menu_settings_gear.xml b/indra/newview/skins/default/xui/en/menu_settings_gear.xml index 57f4aa8655..96cbac4478 100644 --- a/indra/newview/skins/default/xui/en/menu_settings_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_settings_gear.xml @@ -24,6 +24,9 @@ <menu_item_call.on_click function="MyEnvironments.DoApply" parameter="local" /> + <menu_item_call.on_enable + function="MyEnvironments.CanApply" + parameter="local"/> </menu_item_call> <menu_item_call name="Settings Apply Parcel" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 53615968e0..39e4e3220e 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1562,6 +1562,64 @@ function="World.EnvPreset" parameter="RenderDisablePostProcessing" /> </menu_item_check> + + <menu + create_jump_keys="true" + label="Selection level of detail" + name="Selection level of detail" + tear_off="true"> + + <menu_item_check + label="Default" + name="Default lod setting"> + <menu_item_check.on_check + function="Tools.ToolsCheckSelectionLODMode" + parameter="default" /> + <menu_item_check.on_click + function="Tools.SelectionLODMode" + parameter="default" /> + </menu_item_check> + <menu_item_check + label="High" + name="High lod setting"> + <menu_item_check.on_check + function="Tools.ToolsCheckSelectionLODMode" + parameter="high" /> + <menu_item_check.on_click + function="Tools.SelectionLODMode" + parameter="high" /> + </menu_item_check> + <menu_item_check + label="Medium" + name="Medium lod setting"> + <menu_item_check.on_check + function="Tools.ToolsCheckSelectionLODMode" + parameter="medium" /> + <menu_item_check.on_click + function="Tools.SelectionLODMode" + parameter="medium" /> + </menu_item_check> + <menu_item_check + label="Low" + name="Low lod setting"> + <menu_item_check.on_check + function="Tools.ToolsCheckSelectionLODMode" + parameter="low" /> + <menu_item_check.on_click + function="Tools.SelectionLODMode" + parameter="low" /> + </menu_item_check> + <menu_item_check + label="Lowest" + name="Lowest lod setting"> + <menu_item_check.on_check + function="Tools.ToolsCheckSelectionLODMode" + parameter="lowest" /> + <menu_item_check.on_click + function="Tools.SelectionLODMode" + parameter="lowest" /> + </menu_item_check> + </menu> <menu_item_separator/> <menu_item_check diff --git a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml index ee77ef23f0..63d37edf38 100644 --- a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml +++ b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml @@ -80,6 +80,20 @@ function="Attachment.Profile" /> </menu_item_call> <menu_item_call + label="Add to favorites" + layout="topleft" + name="favorites_add"> + <on_click + function="Attachment.Favorite" /> + </menu_item_call> + <menu_item_call + label="Remove from favorites" + layout="topleft" + name="favorites_remove"> + <on_click + function="Attachment.Favorite" /> + </menu_item_call> + <menu_item_call label="Show Original" layout="topleft" visible="false" diff --git a/indra/newview/skins/default/xui/en/menu_wearing_tab.xml b/indra/newview/skins/default/xui/en/menu_wearing_tab.xml index 321e8a0831..9a752a1643 100644 --- a/indra/newview/skins/default/xui/en/menu_wearing_tab.xml +++ b/indra/newview/skins/default/xui/en/menu_wearing_tab.xml @@ -31,6 +31,20 @@ function="Wearing.Detach" parameter="detach"/> </menu_item_call> + <menu_item_call + label="Add to favorites" + layout="topleft" + name="favorites_add"> + <on_click + function="Wearing.Favorite" /> + </menu_item_call> + <menu_item_call + label="Remove from favorites" + layout="topleft" + name="favorites_remove"> + <on_click + function="Wearing.Favorite" /> + </menu_item_call> <menu_item_separator layout="topleft" name="edit_outfit_separator" /> diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 4d74261a9a..053eed6c00 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3129,9 +3129,13 @@ Would you be my friend? <input name="listname" type="text"/> <button default="true" - index="0" + index="1" name="SetName" text="OK"/> + <button + index="0" + name="Cancel" + text="Cancel"/> </form> </notification> @@ -3160,6 +3164,29 @@ Would you be my friend? <notification icon="alertmodal.tga" + label="Rename Auto-Replace List" + name="RemoveAutoReplaceList" + type="alertmodal"> +'[LIST_NAME]' contains [MAP_SIZE] entries. + +Are you sure you want to delete this list? + <tag>confirm</tag> + <form name="form"> + <button + default="true" + index="1" + name="DeleteList" + text="Delete"/> + <button + default="false" + index="0" + name="Cancel" + text="Cancel"/> + </form> + </notification> + + <notification + icon="alertmodal.tga" name="InvalidAutoReplaceEntry" type="alertmodal"> The keyword must be a single word, and the replacement may not be empty. @@ -4618,13 +4645,12 @@ You already have blocked this name. <notification icon="alert.tga" - name="RemoveItemWarn" + name="CantModifyContentInNoModTask" type="alert"> -Though permitted, deleting contents may damage the object. Do you want to delete that item? +You don't have permission to modify content of this object <tag>confirm</tag> <usetemplate - name="okcancelbuttons" - notext="Cancel" + name="okbutton" yestext="OK"/> </notification> diff --git a/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml b/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml index 73cb9b080f..f5906c17fd 100644 --- a/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml +++ b/indra/newview/skins/default/xui/en/panel_inventory_gallery_item.xml @@ -43,6 +43,16 @@ follows="left|top" visible="false" image_name="Inv_Link"/> + <icon + layout="topleft" + follows="left|top" + name="fav_icon" + left="110" + top_pad="-14" + height="14" + width="14" + visible="true" + image_name="Inv_Favorite_Star_Full"/> <panel background_visible="false" background_opaque="true" diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml index 498dab1ef3..6e1e6facbe 100644 --- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml @@ -269,6 +269,22 @@ scroll.reserve_scroll_corner="false"> <folder double_click_override="true"/> </inventory_panel> + <favorites_inventory_panel + bg_opaque_color="DkGray2" + bg_alpha_color="DkGray2" + background_visible="true" + border="false" + bevel_style="none" + follows="all" + label="FAVORITES" + help_topic="recent_inventory_tab" + layout="topleft" + name="Favorites" + show_item_link_overlays="true" + preinitialize_views="false" + scroll.reserve_scroll_corner="false"> + <folder double_click_override="true"/> + </favorites_inventory_panel> </tab_container> </panel> <panel diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml index a8a306bea9..9586957694 100644 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings_inventory.xml @@ -21,5 +21,5 @@ border="false" bevel_style="none" show_item_link_overlays="true"> - <item allow_wear="false"/> + <item marketplace_item="true"/> </inventory_panel> diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings_listed.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings_listed.xml index 0c665fb07e..5f64a5d47a 100644 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings_listed.xml +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings_listed.xml @@ -20,5 +20,5 @@ border="false" bevel_style="none" show_item_link_overlays="true"> - <item allow_wear="false"/> + <item marketplace_item="true"/> </inventory_panel> diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings_unassociated.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings_unassociated.xml index 0be405c5b8..ab4d836ba9 100644 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings_unassociated.xml +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings_unassociated.xml @@ -19,5 +19,5 @@ border="false" bevel_style="none" show_item_link_overlays="true"> - <item allow_wear="false"/> + <item marketplace_item="true"/> </inventory_panel> diff --git a/indra/newview/skins/default/xui/en/panel_marketplace_listings_unlisted.xml b/indra/newview/skins/default/xui/en/panel_marketplace_listings_unlisted.xml index 58122db7f4..303601e65b 100644 --- a/indra/newview/skins/default/xui/en/panel_marketplace_listings_unlisted.xml +++ b/indra/newview/skins/default/xui/en/panel_marketplace_listings_unlisted.xml @@ -20,5 +20,5 @@ border="false" bevel_style="none" show_item_link_overlays="true"> - <item allow_wear="false"/> + <item marketplace_item="true"/> </inventory_panel> diff --git a/indra/newview/skins/default/xui/en/panel_outfit_gallery.xml b/indra/newview/skins/default/xui/en/panel_outfit_gallery.xml index 6bd491f7a3..96624e7aa2 100644 --- a/indra/newview/skins/default/xui/en/panel_outfit_gallery.xml +++ b/indra/newview/skins/default/xui/en/panel_outfit_gallery.xml @@ -35,7 +35,7 @@ </text> <scroll_container follows="all" - height="400" + height="429" width="312" layout="topleft" left="4" @@ -44,49 +44,5 @@ name="gallery_scroll_panel" opaque="false" top_pad="0"> - </scroll_container> - <panel - background_visible="true" - follows="bottom|left|right" - height="28" - layout="topleft" - left="4" - top_pad="0" - visible="true" - name="bottom_panel" - width="312"> - <menu_button - follows="bottom|left" - tool_tip="Show additional options" - height="25" - image_hover_unselected="Toolbar_Left_Over" - image_overlay="OptionsMenu_Off" - image_selected="Toolbar_Left_Selected" - image_unselected="Toolbar_Left_Off" - layout="topleft" - left="0" - name="options_gear_btn" - top="1" - width="31" /> - <icon - follows="bottom|left|right" - height="25" - image_name="Toolbar_Middle_Off" - layout="topleft" - left_pad="1" - name="dummy_icon" - width="243"/> - <button - follows="bottom|right" - height="25" - image_hover_unselected="Toolbar_Right_Over" - image_overlay="TrashItem_Off" - image_selected="Toolbar_Right_Selected" - image_unselected="Toolbar_Right_Off" - layout="topleft" - left_pad="1" - name="trash_btn" - tool_tip="Delete selected outfit" - width="31"/> - </panel> + </scroll_container> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_outfits_list.xml b/indra/newview/skins/default/xui/en/panel_outfits_list.xml index 9281a21fbf..b38e2b2b50 100644 --- a/indra/newview/skins/default/xui/en/panel_outfits_list.xml +++ b/indra/newview/skins/default/xui/en/panel_outfits_list.xml @@ -16,7 +16,7 @@ bg_opaque_color="DkGray2" follows="all" - height="400" + height="428" layout="topleft" left="3" name="outfits_accordion" @@ -30,48 +30,4 @@ name="no_outfits_msg" value="You don't have any outfits yet. Try [secondlife:///app/search/all/ Search]"/> </accordion> - <panel - background_visible="true" - follows="bottom|left|right" - height="28" - layout="topleft" - left="4" - top_pad="0" - visible="true" - name="bottom_panel" - width="312"> - <menu_button - follows="bottom|left" - tool_tip="Show additional options" - height="25" - image_hover_unselected="Toolbar_Left_Over" - image_overlay="OptionsMenu_Off" - image_selected="Toolbar_Left_Selected" - image_unselected="Toolbar_Left_Off" - layout="topleft" - left="0" - name="options_gear_btn" - top="1" - width="31" /> - <icon - follows="bottom|left|right" - height="25" - image_name="Toolbar_Middle_Off" - layout="topleft" - left_pad="1" - name="dummy_icon" - width="243"/> - <button - follows="bottom|right" - height="25" - image_hover_unselected="Toolbar_Right_Over" - image_overlay="TrashItem_Off" - image_selected="Toolbar_Right_Selected" - image_unselected="Toolbar_Right_Off" - layout="topleft" - left_pad="1" - name="trash_btn" - tool_tip="Delete selected outfit" - width="31"/> - </panel> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml index a486c03ac7..ceefe9f6fb 100644 --- a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml +++ b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml @@ -16,7 +16,7 @@ <accordion fit_parent="true" follows="all" - height="400" + height="429" layout="topleft" left="3" single_expansion="true" @@ -62,35 +62,4 @@ </scroll_list> </accordion_tab> </accordion> - <panel - background_visible="true" - follows="bottom|left|right" - height="28" - layout="topleft" - left="4" - name="bottom_panel" - top_pad="0" - width="312"> - <menu_button - follows="bottom|left" - height="25" - image_hover_unselected="Toolbar_Left_Over" - image_overlay="OptionsMenu_Off" - image_selected="Toolbar_Left_Selected" - image_unselected="Toolbar_Left_Off" - layout="topleft" - left="0" - name="options_gear_btn" - tool_tip="Show additional options" - top="1" - width="31" /> - <icon - follows="bottom|left|right" - height="25" - image_name="Toolbar_Right_Off" - layout="topleft" - left_pad="1" - name="dummy_icon" - width="274" /> - </panel> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_places.xml b/indra/newview/skins/default/xui/en/panel_places.xml index a3a2f7c47e..1bda5c019c 100644 --- a/indra/newview/skins/default/xui/en/panel_places.xml +++ b/indra/newview/skins/default/xui/en/panel_places.xml @@ -19,7 +19,7 @@ background_visible="true" value="VISITED" /> <string name="favorites_tab_title" - value="FAVORITES" /> + value="FAVORITES BAR" /> <string name="tooltip_trash_items" value="Remove selected landmark or folder" /> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_move.xml b/indra/newview/skins/default/xui/en/panel_preferences_move.xml index 8a372256dc..3b43b08201 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_move.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_move.xml @@ -113,7 +113,7 @@ control_name="ArrowKeysAlwaysMove" follows="left|top" height="20" - label="Arrow keys always move me" + label="Arrow keys always move me while in chat" layout="topleft" left_delta="5" name="arrow_keys_move_avatar_check" diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml index bd68434aab..34b48574d5 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml @@ -248,29 +248,13 @@ </layout_panel> <layout_panel - name="moon_layout" - border="false" + border="true" bevel_style="in" + name="moon_layout" auto_resize="true" user_resize="false" visible="true" height="400"> - <layout_stack - name="moon_stack" - left="5" - top="5" - right="-5" - bottom="-5" - follows="left|top|right|bottom" - orientation="vertical"> - <layout_panel - border="true" - bevel_style="in" - auto_resize="true" - user_resize="false" - visible="true" - name="moon_layout" - height="220"> <text name="moon_label" follows="left|top" @@ -423,9 +407,7 @@ name="moonbeacon" top_pad="5" left_delta="-8"/> - - </layout_panel> - </layout_stack> + </layout_panel> </layout_stack> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_settings_water.xml b/indra/newview/skins/default/xui/en/panel_settings_water.xml index 5e65b0e8a2..36ec0cb3ea 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_water.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_water.xml @@ -247,7 +247,7 @@ Reflection Wavelet Scale </text> <slider - decimal_digits="1" + decimal_digits="2" follows="left|top" increment="0.01" height="16" @@ -261,7 +261,7 @@ width="150" can_edit_text="true"/> <slider - decimal_digits="1" + decimal_digits="2" follows="left|top" increment="0.01" initial_value="0.7" @@ -274,7 +274,7 @@ width="150" can_edit_text="true"/> <slider - decimal_digits="1" + decimal_digits="2" follows="left|top" increment="0.01" initial_value="0.7" diff --git a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml index c898b0989e..a16b0b58da 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml @@ -64,7 +64,7 @@ width="333"> font="SansSerifSmall" text_color="EmphasisColor" width="300" - height="10" + height="13" follows="top|left|right" layout="topleft" left="35" @@ -94,7 +94,7 @@ width="333"> image_overlay="Edit_Wrench" label="" layout="topleft" - left="265" + right="-3" name="edit_outfit_btn" tool_tip="Edit this outfit" top="3" @@ -108,17 +108,100 @@ width="333"> top="6" width="24" /> </panel> - <filter_editor - height="23" - follows="left|top|right" - layout="topleft" - left="10" - label="Filter Outfits" - max_length_chars="300" - name="Filter" - search_button_visible="true" - top_pad="10" - width="307" /> + <layout_stack + animate="false" + border_size="0" + follows="left|top|right" + height="27" + layout="topleft" + orientation="horizontal" + top_pad="6" + left="0" + name="top_menu_panel" + width="320"> + <layout_panel + auto_resize="true" + layout="topleft" + name="filter_panel" + width="193"> + <filter_editor + text_pad_left="10" + follows="left|top|right" + font="SansSerifSmall" + height="23" + layout="topleft" + left="10" + label="Filter Outfits" + max_length_chars="300" + name="Filter" + search_button_visible="true" + tab_group="1" + top="3" + width="181" /> + </layout_panel> + <layout_panel + auto_resize="false" + height="25" + layout="topleft" + name="options_gear_btn_panel" + width="32"> + <menu_button + follows="bottom|left" + tool_tip="Show additional options" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="OptionsMenu_Off" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + menu_position="bottomleft" + layout="topleft" + left="0" + name="options_gear_btn" + top="0" + width="31" /> + </layout_panel> + <layout_panel + auto_resize="false" + height="25" + layout="topleft" + name="options_sort_btn_panel" + width="32"> + <menu_button + follows="bottom|left" + tool_tip="Show sorting options" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="Conv_toolbar_sort" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + menu_position="bottomleft" + layout="topleft" + left="0" + name="sorting_menu_btn" + top="0" + width="31" /> + </layout_panel> + <layout_panel + auto_resize="false" + height="25" + layout="topleft" + name="trash_btn_panel" + width="31"> + <dnd_button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Right_Over" + image_overlay="TrashItem_Off" + image_selected="Toolbar_Right_Selected" + image_unselected="Toolbar_Right_Off" + left="0" + layout="topleft" + name="trash_btn" + tool_tip="Delete selected outfit" + top="0" + width="31"/> + </layout_panel> + </layout_stack> <panel class="panel_outfits_inventory" filename="panel_outfits_inventory.xml" @@ -129,7 +212,7 @@ width="333"> visible="false" left="0" tab_group="1" - top_pad="6" + top_pad="4" follows="all" /> <panel class="panel_outfit_edit" diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 9be4a8f737..1a81e67e3d 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2324,6 +2324,7 @@ For AI Character: Get the closest navigable point to the point provided. <!-- inventory --> <string name="InventoryNoMatchingItems">Didn't find what you're looking for? Try [secondlife:///app/search/all/[SEARCH_TERM] Search].</string> <string name="InventoryNoMatchingRecentItems">Didn't find what you're looking for? Try [secondlife:///app/inventory/filters Show filters].</string> + <string name="InventoryNoMatchingFavorites">You haven't marked any items as favorites.</string> <string name="PlacesNoMatchingItems">To add a place to your landmarks, click the star to the right of the location name.</string> <string name="FavoritesNoMatchingItems">To add a place to your favorites, click the star to the right of the location name, then save the landmark to "Favorites bar".</string> <string name="MarketplaceNoListing">You have no listings yet.</string> diff --git a/indra/newview/skins/default/xui/en/widgets/folder_view_item.xml b/indra/newview/skins/default/xui/en/widgets/folder_view_item.xml index b598bbccd8..50c5285e04 100644 --- a/indra/newview/skins/default/xui/en/widgets/folder_view_item.xml +++ b/indra/newview/skins/default/xui/en/widgets/folder_view_item.xml @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <folder_view_item folder_arrow_image="Folder_Arrow" + favorite_image="Inv_Favorite_Star_Full" + favorite_content_image="Inv_Favorite_Star_Content" folder_indentation="8" item_height="20" item_top_pad="4" diff --git a/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml index 27ec6ded81..865c145022 100644 --- a/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml +++ b/indra/newview/skins/default/xui/en/widgets/inbox_folder_view_folder.xml @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <inbox_folder_view_folder folder_arrow_image="Folder_Arrow" + favorite_image="Inv_Favorite_Star_Full" + favorite_content_image="Inv_Favorite_Star_Content" folder_indentation="8" item_height="20" item_top_pad="4" diff --git a/indra/newview/skins/default/xui/ja/panel_settings_sky_sunmoon.xml b/indra/newview/skins/default/xui/ja/panel_settings_sky_sunmoon.xml index f8837c40a7..844a556af1 100644 --- a/indra/newview/skins/default/xui/ja/panel_settings_sky_sunmoon.xml +++ b/indra/newview/skins/default/xui/ja/panel_settings_sky_sunmoon.xml @@ -44,8 +44,6 @@ <check_box label="ビーコンを表示" name="sunbeacon"/> </layout_panel> <layout_panel name="moon_layout"> - <layout_stack name="moon_stack"> - <layout_panel name="moon_layout"> <text name="moon_label"> 月 </text> @@ -74,8 +72,6 @@ </text> <slider name="moon_brightness"/> <check_box label="ビーコンを表示" name="moonbeacon"/> - </layout_panel> - </layout_stack> </layout_panel> </layout_stack> </panel> diff --git a/indra/newview/skins/default/xui/ja/strings.xml b/indra/newview/skins/default/xui/ja/strings.xml index ff3b1a53a2..abc5932943 100644 --- a/indra/newview/skins/default/xui/ja/strings.xml +++ b/indra/newview/skins/default/xui/ja/strings.xml @@ -66,7 +66,6 @@ SLURL:<nolink>[SLURL]</nolink> 帯域幅:[NET_BANDWITH]kbit/秒 LOD係数:[LOD_FACTOR] 描画の質:[RENDER_QUALITY] -高度な光源モデル:[GPU_SHADERS] テクスチャメモリ:[TEXTURE_MEMORY]㎆ </string> <string name="AboutOSXHiDPI"> diff --git a/indra/newview/skins/default/xui/pl/panel_settings_sky_sunmoon.xml b/indra/newview/skins/default/xui/pl/panel_settings_sky_sunmoon.xml index f807148617..7f9dee2369 100644 --- a/indra/newview/skins/default/xui/pl/panel_settings_sky_sunmoon.xml +++ b/indra/newview/skins/default/xui/pl/panel_settings_sky_sunmoon.xml @@ -35,8 +35,6 @@ <check_box label="Pokaż emiter" name="sunbeacon" /> </layout_panel> <layout_panel name="moon_layout"> - <layout_stack name="moon_stack"> - <layout_panel name="moon_layout"> <text name="moon_label"> Księżyc </text> @@ -59,8 +57,6 @@ Jasność: </text> <check_box label="Pokaż emiter" name="moonbeacon" /> - </layout_panel> - </layout_stack> </layout_panel> </layout_stack> </panel> diff --git a/indra/newview/skins/default/xui/zh/strings.xml b/indra/newview/skins/default/xui/zh/strings.xml index a3a9915dc4..59ba2a7e19 100644 --- a/indra/newview/skins/default/xui/zh/strings.xml +++ b/indra/newview/skins/default/xui/zh/strings.xml @@ -69,7 +69,6 @@ 頻寬:[NET_BANDWITH]千位元/秒 細節層次率:[LOD_FACTOR] 呈像品質:[RENDER_QUALITY] -進階照明模型:[GPU_SHADERS] 材質記憶體:[TEXTURE_MEMORY]MB </string> <string name="AboutOSXHiDPI"> |