diff options
Diffstat (limited to 'indra')
127 files changed, 2137 insertions, 1887 deletions
diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index bb7998c0a8..3b9758f996 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -159,6 +159,7 @@ void LLMemory::logMemoryInfo(BOOL update) if(update) { updateMemoryInfo() ; + LLPrivateMemoryPoolManager::getInstance()->updateStatistics() ; } llinfos << "Current allocated physical memory(KB): " << sAllocatedMemInKB << llendl ; diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index 6ca0737445..e295e3c621 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -24,6 +24,9 @@ * $/LicenseInfo$ */ +// Must turn on conditional declarations in header file so definitions end up +// with proper linkage. +#define LLSD_DEBUG_INFO #include "linden_common.h" #include "llsd.h" @@ -31,6 +34,7 @@ #include "../llmath/llmath.h" #include "llformat.h" #include "llsdserialize.h" +#include "stringize.h" #ifndef LL_RELEASE_FOR_DOWNLOAD #define NAME_UNNAMED_NAMESPACE @@ -50,6 +54,18 @@ namespace using namespace LLSDUnnamedNamespace; #endif +namespace llsd +{ + +// statics +S32 sLLSDAllocationCount = 0; +S32 sLLSDNetObjects = 0; + +} // namespace llsd + +#define ALLOC_LLSD_OBJECT { llsd::sLLSDNetObjects++; llsd::sLLSDAllocationCount++; } +#define FREE_LLSD_OBJECT { llsd::sLLSDNetObjects--; } + class LLSD::Impl /**< This class is the abstract base class of the implementation of LLSD It provides the reference counting implementation, and the default @@ -58,13 +74,10 @@ class LLSD::Impl */ { -private: - U32 mUseCount; - protected: Impl(); - enum StaticAllocationMarker { STATIC }; + enum StaticAllocationMarker { STATIC_USAGE_COUNT = 0xFFFFFFFF }; Impl(StaticAllocationMarker); ///< This constructor is used for static objects and causes the // suppresses adjusting the debugging counters when they are @@ -72,8 +85,10 @@ protected: virtual ~Impl(); - bool shared() const { return mUseCount > 1; } + bool shared() const { return (mUseCount > 1) && (mUseCount != STATIC_USAGE_COUNT); } + U32 mUseCount; + public: static void reset(Impl*& var, Impl* impl); ///< safely set var to refer to the new impl (possibly shared) @@ -128,6 +143,18 @@ public: virtual LLSD::array_const_iterator beginArray() const { return endArray(); } virtual LLSD::array_const_iterator endArray() const { static const std::vector<LLSD> empty; return empty.end(); } + virtual void dumpStats() const; + virtual void calcStats(S32 type_counts[], S32 share_counts[]) const; + // Container subclasses contain LLSD objects, rather than directly + // containing Impl objects. This helper forwards through LLSD. + void calcStats(const LLSD& llsd, S32 type_counts[], S32 share_counts[]) const + { + safe(llsd.impl).calcStats(type_counts, share_counts); + } + + static const Impl& getImpl(const LLSD& llsd) { return safe(llsd.impl); } + static Impl& getImpl(LLSD& llsd) { return safe(llsd.impl); } + static const LLSD& undef(); static U32 sAllocationCount; @@ -360,6 +387,9 @@ namespace LLSD::map_iterator endMap() { return mData.end(); } virtual LLSD::map_const_iterator beginMap() const { return mData.begin(); } virtual LLSD::map_const_iterator endMap() const { return mData.end(); } + + virtual void dumpStats() const; + virtual void calcStats(S32 type_counts[], S32 share_counts[]) const; }; ImplMap& ImplMap::makeMap(LLSD::Impl*& var) @@ -414,6 +444,34 @@ namespace return i->second; } + void ImplMap::dumpStats() const + { + std::cout << "Map size: " << mData.size() << std::endl; + + std::cout << "LLSD Net Objects: " << llsd::sLLSDNetObjects << std::endl; + std::cout << "LLSD allocations: " << llsd::sLLSDAllocationCount << std::endl; + + std::cout << "LLSD::Impl Net Objects: " << sOutstandingCount << std::endl; + std::cout << "LLSD::Impl allocations: " << sAllocationCount << std::endl; + + Impl::dumpStats(); + } + + void ImplMap::calcStats(S32 type_counts[], S32 share_counts[]) const + { + LLSD::map_const_iterator iter = beginMap(); + while (iter != endMap()) + { + //std::cout << " " << (*iter).first << ": " << (*iter).second << std::endl; + Impl::calcStats((*iter).second, type_counts, share_counts); + iter++; + } + + // Add in the values for this map + Impl::calcStats(type_counts, share_counts); + } + + class ImplArray : public LLSD::Impl { private: @@ -449,6 +507,8 @@ namespace LLSD::array_iterator endArray() { return mData.end(); } virtual LLSD::array_const_iterator beginArray() const { return mData.begin(); } virtual LLSD::array_const_iterator endArray() const { return mData.end(); } + + virtual void calcStats(S32 type_counts[], S32 share_counts[]) const; }; ImplArray& ImplArray::makeArray(Impl*& var) @@ -490,12 +550,13 @@ namespace void ImplArray::insert(LLSD::Integer i, const LLSD& v) { - if (i < 0) { + if (i < 0) + { return; } DataVector::size_type index = i; - if (index >= mData.size()) + if (index >= mData.size()) // tbd - sanity check limit for index ? { mData.resize(index + 1); } @@ -543,6 +604,19 @@ namespace return mData[index]; } + + void ImplArray::calcStats(S32 type_counts[], S32 share_counts[]) const + { + LLSD::array_const_iterator iter = beginArray(); + while (iter != endArray()) + { // Add values for all items held in the array + Impl::calcStats((*iter), type_counts, share_counts); + iter++; + } + + // Add in the values for this array + Impl::calcStats(type_counts, share_counts); + } } LLSD::Impl::Impl() @@ -564,8 +638,11 @@ LLSD::Impl::~Impl() void LLSD::Impl::reset(Impl*& var, Impl* impl) { - if (impl) ++impl->mUseCount; - if (var && --var->mUseCount == 0) + if (impl && impl->mUseCount != STATIC_USAGE_COUNT) + { + ++impl->mUseCount; + } + if (var && var->mUseCount != STATIC_USAGE_COUNT && --var->mUseCount == 0) { delete var; } @@ -574,13 +651,13 @@ void LLSD::Impl::reset(Impl*& var, Impl* impl) LLSD::Impl& LLSD::Impl::safe(Impl* impl) { - static Impl theUndefined(STATIC); + static Impl theUndefined(STATIC_USAGE_COUNT); return impl ? *impl : theUndefined; } const LLSD::Impl& LLSD::Impl::safe(const Impl* impl) { - static Impl theUndefined(STATIC); + static Impl theUndefined(STATIC_USAGE_COUNT); return impl ? *impl : theUndefined; } @@ -656,6 +733,43 @@ const LLSD& LLSD::Impl::undef() return immutableUndefined; } +void LLSD::Impl::dumpStats() const +{ + S32 type_counts[LLSD::TypeLLSDNumTypes + 1]; + memset(&type_counts, 0, sizeof(type_counts)); + + S32 share_counts[LLSD::TypeLLSDNumTypes + 1]; + memset(&share_counts, 0, sizeof(share_counts)); + + // Add info from all the values this object has + calcStats(type_counts, share_counts); + + S32 type_index = LLSD::TypeLLSDTypeBegin; + while (type_index != LLSD::TypeLLSDTypeEnd) + { + std::cout << LLSD::typeString((LLSD::Type)type_index) << " type " + << type_counts[type_index] << " objects, " + << share_counts[type_index] << " shared" + << std::endl; + type_index++; + } +} + + +void LLSD::Impl::calcStats(S32 type_counts[], S32 share_counts[]) const +{ + S32 tp = S32(type()); + if (0 <= tp && tp < LLSD::TypeLLSDNumTypes) + { + type_counts[tp]++; + if (shared()) + { + share_counts[tp]++; + } + } +} + + U32 LLSD::Impl::sAllocationCount = 0; U32 LLSD::Impl::sOutstandingCount = 0; @@ -681,10 +795,10 @@ namespace } -LLSD::LLSD() : impl(0) { } -LLSD::~LLSD() { Impl::reset(impl, 0); } +LLSD::LLSD() : impl(0) { ALLOC_LLSD_OBJECT; } +LLSD::~LLSD() { FREE_LLSD_OBJECT; Impl::reset(impl, 0); } -LLSD::LLSD(const LLSD& other) : impl(0) { assign(other); } +LLSD::LLSD(const LLSD& other) : impl(0) { ALLOC_LLSD_OBJECT; assign(other); } void LLSD::assign(const LLSD& other) { Impl::assign(impl, other.impl); } @@ -692,18 +806,18 @@ void LLSD::clear() { Impl::assignUndefined(impl); } LLSD::Type LLSD::type() const { return safe(impl).type(); } -// Scaler Constructors -LLSD::LLSD(Boolean v) : impl(0) { assign(v); } -LLSD::LLSD(Integer v) : impl(0) { assign(v); } -LLSD::LLSD(Real v) : impl(0) { assign(v); } -LLSD::LLSD(const UUID& v) : impl(0) { assign(v); } -LLSD::LLSD(const String& v) : impl(0) { assign(v); } -LLSD::LLSD(const Date& v) : impl(0) { assign(v); } -LLSD::LLSD(const URI& v) : impl(0) { assign(v); } -LLSD::LLSD(const Binary& v) : impl(0) { assign(v); } +// Scalar Constructors +LLSD::LLSD(Boolean v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(Integer v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(Real v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(const UUID& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(const String& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(const Date& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(const URI& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(const Binary& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } // Convenience Constructors -LLSD::LLSD(F32 v) : impl(0) { assign((Real)v); } +LLSD::LLSD(F32 v) : impl(0) { ALLOC_LLSD_OBJECT; assign((Real)v); } // Scalar Assignment void LLSD::assign(Boolean v) { safe(impl).assign(impl, v); } @@ -726,7 +840,7 @@ LLSD::URI LLSD::asURI() const { return safe(impl).asURI(); } LLSD::Binary LLSD::asBinary() const { return safe(impl).asBinary(); } // const char * helpers -LLSD::LLSD(const char* v) : impl(0) { assign(v); } +LLSD::LLSD(const char* v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } void LLSD::assign(const char* v) { if(v) assign(std::string(v)); @@ -784,9 +898,6 @@ LLSD& LLSD::operator[](Integer i) const LLSD& LLSD::operator[](Integer i) const { return safe(impl).ref(i); } -U32 LLSD::allocationCount() { return Impl::sAllocationCount; } -U32 LLSD::outstandingCount() { return Impl::sOutstandingCount; } - static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat) { // sStorage is used to hold the string representation of the llsd last @@ -801,15 +912,9 @@ static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat) { std::ostringstream out; if (useXMLFormat) - { - LLSDXMLStreamer xml_streamer(llsd); - out << xml_streamer; - } + out << LLSDXMLStreamer(llsd); else - { - LLSDNotationStreamer notation_streamer(llsd); - out << notation_streamer; - } + out << LLSDNotationStreamer(llsd); out_string = out.str(); } int len = out_string.length(); @@ -840,3 +945,38 @@ LLSD::array_iterator LLSD::beginArray() { return makeArray(impl).beginArray(); LLSD::array_iterator LLSD::endArray() { return makeArray(impl).endArray(); } LLSD::array_const_iterator LLSD::beginArray() const{ return safe(impl).beginArray(); } LLSD::array_const_iterator LLSD::endArray() const { return safe(impl).endArray(); } + +namespace llsd +{ + +U32 allocationCount() { return LLSD::Impl::sAllocationCount; } +U32 outstandingCount() { return LLSD::Impl::sOutstandingCount; } + +// Diagnostic dump of contents in an LLSD object +void dumpStats(const LLSD& llsd) { LLSD::Impl::getImpl(llsd).dumpStats(); } + +} // namespace llsd + +// static +std::string LLSD::typeString(Type type) +{ + static const char * sTypeNameArray[] = { + "Undefined", + "Boolean", + "Integer", + "Real", + "String", + "UUID", + "Date", + "URI", + "Binary", + "Map", + "Array" + }; + + if (0 <= type && type < LL_ARRAY_SIZE(sTypeNameArray)) + { + return sTypeNameArray[type]; + } + return STRINGIZE("** invalid type value " << type); +} diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index 90d0f97873..5eb69059ac 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -40,10 +40,10 @@ /** LLSD provides a flexible data system similar to the data facilities of dynamic languages like Perl and Python. It is created to support exchange - of structured data between loosly coupled systems. (Here, "loosly coupled" + of structured data between loosely coupled systems. (Here, "loosely coupled" means not compiled together into the same module.) - Data in such exchanges must be highly tollerant of changes on either side + Data in such exchanges must be highly tolerant of changes on either side such as: - recompilation - implementation in a different langauge @@ -51,19 +51,19 @@ - execution of older versions (with fewer parameters) To this aim, the C++ API of LLSD strives to be very easy to use, and to - default to "the right thing" whereever possible. It is extremely tollerant + default to "the right thing" wherever possible. It is extremely tolerant of errors and unexpected situations. - The fundimental class is LLSD. LLSD is a value holding object. It holds + The fundamental class is LLSD. LLSD is a value holding object. It holds one value that is either undefined, one of the scalar types, or a map or an array. LLSD objects have value semantics (copying them copies the value, - though it can be considered efficient, due to shareing.), and mutable. + though it can be considered efficient, due to sharing), and mutable. Undefined is the singular value given to LLSD objects that are not initialized with any data. It is also used as the return value for - operations that return an LLSD, + operations that return an LLSD. - The sclar data types are: + The scalar data types are: - Boolean - true or false - Integer - a 32 bit signed integer - Real - a 64 IEEE 754 floating point value @@ -80,9 +80,73 @@ An array is a sequence of zero or more LLSD values. + Thread Safety + + In general, these LLSD classes offer *less* safety than STL container + classes. Implementations prior to this one were unsafe even when + completely unrelated LLSD trees were in two threads due to reference + sharing of special 'undefined' values that participated in the reference + counting mechanism. + + The dereference-before-refcount and aggressive tree sharing also make + it impractical to share an LLSD across threads. A strategy of passing + ownership or a copy to another thread is still difficult due to a lack + of a cloning interface but it can be done with some care. + + One way of transferring ownership is as follows: + + void method(const LLSD input) { + ... + LLSD * xfer_tree = new LLSD(); + { + // Top-level values + (* xfer_tree)['label'] = "Some text"; + (* xfer_tree)['mode'] = APP_MODE_CONSTANT; + + // There will be a second-level + LLSD subtree(LLSD::emptyMap()); + (* xfer_tree)['subtree'] = subtree; + + // Do *not* copy from LLSD objects via LLSD + // intermediaries. Only use plain-old-data + // types as intermediaries to prevent reference + // sharing. + subtree['value1'] = input['value1'].asInteger(); + subtree['value2'] = input['value2'].asString(); + + // Close scope and drop 'subtree's reference. + // Only xfer_tree has a reference to the second + // level data. + } + ... + // Transfer the LLSD pointer to another thread. Ownership + // transfers, this thread no longer has a reference to any + // part of the xfer_tree and there's nothing to free or + // release here. Receiving thread does need to delete the + // pointer when it is done with the LLSD. Transfer + // mechanism must perform correct data ordering operations + // as dictated by architecture. + other_thread.sendMessageAndPointer("Take This", xfer_tree); + xfer_tree = NULL; + + + Avoid this pattern which provides half of a race condition: + + void method(const LLSD input) { + ... + LLSD xfer_tree(LLSD::emptyMap()); + xfer_tree['label'] = "Some text"; + xfer_tree['mode'] = APP_MODE_CONSTANT; + ... + other_thread.sendMessageAndPointer("Take This", xfer_tree); + + @nosubgrouping */ +// Normally undefined, used for diagnostics +//#define LLSD_DEBUG_INFO 1 + class LL_COMMON_API LLSD { public: @@ -202,7 +266,7 @@ public: //@} /** @name Character Pointer Helpers - These are helper routines to make working with char* the same as easy as + These are helper routines to make working with char* as easy as working with strings. */ //@{ @@ -266,7 +330,7 @@ public: /** @name Type Testing */ //@{ enum Type { - TypeUndefined, + TypeUndefined = 0, TypeBoolean, TypeInteger, TypeReal, @@ -276,7 +340,10 @@ public: TypeURI, TypeBinary, TypeMap, - TypeArray + TypeArray, + TypeLLSDTypeEnd, + TypeLLSDTypeBegin = TypeUndefined, + TypeLLSDNumTypes = (TypeLLSDTypeEnd - TypeLLSDTypeBegin) }; Type type() const; @@ -302,7 +369,7 @@ public: If you get a linker error about these being missing, you have made mistake in your code. DO NOT IMPLEMENT THESE FUNCTIONS as a fix. - All of thse problems stem from trying to support char* in LLSD or in + All of these problems stem from trying to support char* in LLSD or in std::string. There are too many automatic casts that will lead to using an arbitrary pointer or scalar type to std::string. */ @@ -311,7 +378,7 @@ public: void assign(const void*); ///< assign from arbitrary pointers LLSD& operator=(const void*); ///< assign from arbitrary pointers - bool has(Integer) const; ///< has only works for Maps + bool has(Integer) const; ///< has() only works for Maps //@} /** @name Implementation */ @@ -320,13 +387,7 @@ public: class Impl; private: Impl* impl; - //@} - - /** @name Unit Testing Interface */ - //@{ -public: - static U32 allocationCount(); ///< how many Impls have been made - static U32 outstandingCount(); ///< how many Impls are still alive + friend class LLSD::Impl; //@} private: @@ -338,6 +399,10 @@ private: /// Returns Notation version of llsd -- only to be called from debugger static const char *dump(const LLSD &llsd); //@} + +public: + + static std::string typeString(Type type); // Return human-readable type as a string }; struct llsd_select_bool : public std::unary_function<LLSD, LLSD::Boolean> @@ -385,9 +450,32 @@ struct llsd_select_string : public std::unary_function<LLSD, LLSD::String> LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLSD& llsd); +namespace llsd +{ + +#ifdef LLSD_DEBUG_INFO +/** @name Unit Testing Interface */ +//@{ + LL_COMMON_API void dumpStats(const LLSD&); ///< Output information on object and usage + + /// @warn THE FOLLOWING COUNTS WILL NOT BE ACCURATE IN A MULTI-THREADED + /// ENVIRONMENT. + /// + /// These counts track LLSD::Impl (hidden) objects. + LL_COMMON_API U32 allocationCount(); ///< how many Impls have been made + LL_COMMON_API U32 outstandingCount(); ///< how many Impls are still alive + + /// These counts track LLSD (public) objects. + LL_COMMON_API extern S32 sLLSDAllocationCount; ///< Number of LLSD objects ever created + LL_COMMON_API extern S32 sLLSDNetObjects; ///< Number of LLSD objects that exist +#endif +//@} + +} // namespace llsd + /** QUESTIONS & TO DOS - - Would Binary be more convenient as usigned char* buffer semantics? - - Should Binary be convertable to/from String, and if so how? + - Would Binary be more convenient as unsigned char* buffer semantics? + - Should Binary be convertible to/from String, and if so how? - as UTF8 encoded strings (making not like UUID<->String) - as Base64 or Base96 encoded (making like UUID<->String) - Conversions to std::string and LLUUID do not result in easy assignment diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index deac3d1780..ec378761c2 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 3; const S32 LL_VERSION_MINOR = 2; -const S32 LL_VERSION_PATCH = 5; +const S32 LL_VERSION_PATCH = 6; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index c239e3df88..56e01ac851 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -195,7 +195,7 @@ U8* LLImageBase::allocateData(S32 size) mData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); if (!mData) { - llwarns << "allocate image data: " << size << llendl; + llwarns << "Failed to allocate image data size [" << size << "]" << llendl; size = 0 ; mWidth = mHeight = 0 ; mBadBufferAllocation = true ; diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 330028c926..7ca25d07fc 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -86,9 +86,7 @@ S32 gCurlMultiCount = 0; std::vector<LLMutex*> LLCurl::sSSLMutex; std::string LLCurl::sCAPath; std::string LLCurl::sCAFile; - -bool LLCurl::sMultiThreaded = false; -static U32 sMainThreadID = 0; +LLCurlThread* LLCurl::sCurlThread = NULL ; void check_curl_code(CURLcode code) { @@ -221,14 +219,11 @@ namespace boost std::set<CURL*> LLCurl::Easy::sFreeHandles; std::set<CURL*> LLCurl::Easy::sActiveHandles; -LLMutex* LLCurl::Easy::sHandleMutex = NULL; -LLMutex* LLCurl::Easy::sMultiMutex = NULL; //static CURL* LLCurl::Easy::allocEasyHandle() { CURL* ret = NULL; - LLMutexLock lock(sHandleMutex); if (sFreeHandles.empty()) { ret = curl_easy_init(); @@ -256,8 +251,6 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle) llerrs << "handle cannot be NULL!" << llendl; } - LLMutexLock lock(sHandleMutex); - if (sActiveHandles.find(handle) != sActiveHandles.end()) { sActiveHandles.erase(handle); @@ -521,23 +514,13 @@ void LLCurl::Easy::prepRequest(const std::string& url, //////////////////////////////////////////////////////////////////////////// LLCurl::Multi::Multi() - : LLThread("Curl Multi"), - mQueued(0), + : mQueued(0), mErrorCount(0), - mPerformState(PERFORM_STATE_READY) + mState(STATE_READY), + mDead(FALSE), + mMutexp(NULL), + mDeletionMutexp(NULL) { - mQuitting = false; - - mThreaded = LLCurl::sMultiThreaded && LLThread::currentID() == sMainThreadID; - if (mThreaded) - { - mSignal = new LLCondition(NULL); - } - else - { - mSignal = NULL; - } - mCurlMultiHandle = curl_multi_init(); if (!mCurlMultiHandle) { @@ -545,22 +528,20 @@ LLCurl::Multi::Multi() mCurlMultiHandle = curl_multi_init(); } - llassert_always(mCurlMultiHandle); - ++gCurlMultiCount; -} - -LLCurl::Multi::~Multi() -{ - llassert(isStopped()); + llassert_always(mCurlMultiHandle); - if (LLCurl::sMultiThreaded) + if(LLCurl::getCurlThread()->getThreaded()) { - LLCurl::Easy::sMultiMutex->lock(); + mMutexp = new LLMutex(NULL) ; + mDeletionMutexp = new LLMutex(NULL) ; } + LLCurl::getCurlThread()->addMulti(this) ; - delete mSignal; - mSignal = NULL; + ++gCurlMultiCount; +} +LLCurl::Multi::~Multi() +{ // Clean up active for(easy_active_list_t::iterator iter = mEasyActiveList.begin(); iter != mEasyActiveList.end(); ++iter) @@ -577,75 +558,149 @@ LLCurl::Multi::~Multi() mEasyFreeList.clear(); check_curl_multi_code(curl_multi_cleanup(mCurlMultiHandle)); + + delete mMutexp ; + mMutexp = NULL ; + delete mDeletionMutexp ; + mDeletionMutexp = NULL ; + --gCurlMultiCount; +} - if (LLCurl::sMultiThreaded) +void LLCurl::Multi::lock() +{ + if(mMutexp) { - LLCurl::Easy::sMultiMutex->unlock(); + mMutexp->lock() ; } } -CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue) +void LLCurl::Multi::unlock() { - CURLMsg* curlmsg = curl_multi_info_read(mCurlMultiHandle, msgs_in_queue); - return curlmsg; + if(mMutexp) + { + mMutexp->unlock() ; + } } -void LLCurl::Multi::perform() +void LLCurl::Multi::markDead() { - if (mThreaded) + if(mDeletionMutexp) { - if (mPerformState == PERFORM_STATE_READY) - { - mSignal->signal(); - } + mDeletionMutexp->lock() ; } - else + + mDead = TRUE ; + + if(mDeletionMutexp) + { + mDeletionMutexp->unlock() ; + } +} + +void LLCurl::Multi::setState(LLCurl::Multi::ePerformState state) +{ + lock() ; + mState = state ; + if(mState == STATE_READY) { - doPerform(); + LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_NORMAL) ; } + unlock() ; +} + +LLCurl::Multi::ePerformState LLCurl::Multi::getState() +{ + ePerformState state ; + + lock() ; + state = mState ; + unlock() ; + + return state ; +} + +bool LLCurl::Multi::isCompleted() +{ + return STATE_COMPLETED == getState() ; } -void LLCurl::Multi::run() +bool LLCurl::Multi::waitToComplete() { - llassert(mThreaded); + if(!mMutexp) //not threaded + { + doPerform() ; + return true ; + } - while (!mQuitting) + bool completed ; + + lock() ; + completed = (STATE_COMPLETED == mState) ; + if(!completed) { - mSignal->wait(); - mPerformState = PERFORM_STATE_PERFORMING; - if (!mQuitting) - { - LLMutexLock lock(LLCurl::Easy::sMultiMutex); - doPerform(); - } + LLCurl::getCurlThread()->setPriority(mHandle, LLQueuedThread::PRIORITY_URGENT) ; } + unlock() ; + + return completed; } -void LLCurl::Multi::doPerform() +CURLMsg* LLCurl::Multi::info_read(S32* msgs_in_queue) { - S32 q = 0; - for (S32 call_count = 0; - call_count < MULTI_PERFORM_CALL_REPEAT; - call_count += 1) + CURLMsg* curlmsg = curl_multi_info_read(mCurlMultiHandle, msgs_in_queue); + return curlmsg; +} + +//return true if dead +bool LLCurl::Multi::doPerform() +{ + if(mDeletionMutexp) { - CURLMcode code = curl_multi_perform(mCurlMultiHandle, &q); - if (CURLM_CALL_MULTI_PERFORM != code || q == 0) + mDeletionMutexp->lock() ; + } + bool dead = mDead ; + + if(mDead) + { + setState(STATE_COMPLETED); + mQueued = 0 ; + } + else if(getState() != STATE_COMPLETED) + { + setState(STATE_PERFORMING); + + S32 q = 0; + for (S32 call_count = 0; + call_count < MULTI_PERFORM_CALL_REPEAT; + call_count++) { - check_curl_multi_code(code); - break; + CURLMcode code = curl_multi_perform(mCurlMultiHandle, &q); + if (CURLM_CALL_MULTI_PERFORM != code || q == 0) + { + check_curl_multi_code(code); + + break; + } } - + + mQueued = q; + setState(STATE_COMPLETED) ; } - mQueued = q; - mPerformState = PERFORM_STATE_COMPLETED; + + if(mDeletionMutexp) + { + mDeletionMutexp->unlock() ; + } + + return dead ; } S32 LLCurl::Multi::process() { - perform(); + waitToComplete() ; - if (mPerformState != PERFORM_STATE_COMPLETED) + if (getState() != STATE_COMPLETED) { return 0; } @@ -681,7 +736,8 @@ S32 LLCurl::Multi::process() } } - mPerformState = PERFORM_STATE_READY; + setState(STATE_READY); + return processed; } @@ -739,6 +795,87 @@ void LLCurl::Multi::removeEasy(Easy* easy) easyFree(easy); } +//------------------------------------------------------------ +//LLCurlThread +LLCurlThread::CurlRequest::CurlRequest(handle_t handle, LLCurl::Multi* multi, LLCurlThread* curl_thread) : + LLQueuedThread::QueuedRequest(handle, LLQueuedThread::PRIORITY_NORMAL, FLAG_AUTO_COMPLETE), + mMulti(multi), + mCurlThread(curl_thread) +{ +} + +LLCurlThread::CurlRequest::~CurlRequest() +{ + if(mMulti) + { + mCurlThread->deleteMulti(mMulti) ; + mMulti = NULL ; + } +} + +bool LLCurlThread::CurlRequest::processRequest() +{ + bool completed = true ; + if(mMulti) + { + completed = mCurlThread->doMultiPerform(mMulti) ; + setPriority(LLQueuedThread::PRIORITY_LOW) ; + } + + return completed ; +} + +void LLCurlThread::CurlRequest::finishRequest(bool completed) +{ + mCurlThread->deleteMulti(mMulti) ; + mMulti = NULL ; +} + +LLCurlThread::LLCurlThread(bool threaded) : + LLQueuedThread("curlthread", threaded) +{ +} + +//virtual +LLCurlThread::~LLCurlThread() +{ +} + +S32 LLCurlThread::update(U32 max_time_ms) +{ + return LLQueuedThread::update(max_time_ms); +} + +void LLCurlThread::addMulti(LLCurl::Multi* multi) +{ + multi->mHandle = generateHandle() ; + + CurlRequest* req = new CurlRequest(multi->mHandle, multi, this) ; + + if (!addRequest(req)) + { + llwarns << "curl request added when the thread is quitted" << llendl; + } +} + +void LLCurlThread::killMulti(LLCurl::Multi* multi) +{ + multi->markDead() ; +} + +//private +bool LLCurlThread::doMultiPerform(LLCurl::Multi* multi) +{ + return multi->doPerform() ; +} + +//private +void LLCurlThread::deleteMulti(LLCurl::Multi* multi) +{ + delete multi ; +} +//------------------------------------------------------------ + //static std::string LLCurl::strerror(CURLcode errorcode) { @@ -753,39 +890,23 @@ LLCurlRequest::LLCurlRequest() : mActiveMulti(NULL), mActiveRequestCount(0) { - mThreadID = LLThread::currentID(); mProcessing = FALSE; } LLCurlRequest::~LLCurlRequest() { - llassert_always(mThreadID == LLThread::currentID()); - //stop all Multi handle background threads for (curlmulti_set_t::iterator iter = mMultiSet.begin(); iter != mMultiSet.end(); ++iter) { - LLCurl::Multi* multi = *iter; - multi->mQuitting = true; - if (multi->mThreaded) - { - while (!multi->isStopped()) - { - multi->mSignal->signal(); - apr_sleep(1000); - } - } + LLCurl::getCurlThread()->killMulti(*iter) ; } - for_each(mMultiSet.begin(), mMultiSet.end(), DeletePointer()); + mMultiSet.clear() ; } void LLCurlRequest::addMulti() { - llassert_always(mThreadID == LLThread::currentID()); LLCurl::Multi* multi = new LLCurl::Multi(); - if (multi->mThreaded) - { - multi->start(); - } + mMultiSet.insert(multi); mActiveMulti = multi; mActiveRequestCount = 0; @@ -901,7 +1022,6 @@ bool LLCurlRequest::post(const std::string& url, // Note: call once per frame S32 LLCurlRequest::process() { - llassert_always(mThreadID == LLThread::currentID()); S32 res = 0; mProcessing = TRUE; @@ -915,17 +1035,7 @@ S32 LLCurlRequest::process() if (multi != mActiveMulti && tres == 0 && multi->mQueued == 0) { mMultiSet.erase(curiter); - multi->mQuitting = true; - if (multi->mThreaded) - { - while (!multi->isStopped()) - { - multi->mSignal->signal(); - apr_sleep(1000); - } - } - - delete multi; + LLCurl::getCurlThread()->killMulti(multi); } } mProcessing = FALSE; @@ -934,7 +1044,6 @@ S32 LLCurlRequest::process() S32 LLCurlRequest::getQueued() { - llassert_always(mThreadID == LLThread::currentID()); S32 queued = 0; for (curlmulti_set_t::iterator iter = mMultiSet.begin(); iter != mMultiSet.end(); ) @@ -942,7 +1051,7 @@ S32 LLCurlRequest::getQueued() curlmulti_set_t::iterator curiter = iter++; LLCurl::Multi* multi = *curiter; queued += multi->mQueued; - if (multi->mPerformState != LLCurl::Multi::PERFORM_STATE_READY) + if (multi->getState() != LLCurl::Multi::STATE_READY) { ++queued; } @@ -959,10 +1068,7 @@ LLCurlEasyRequest::LLCurlEasyRequest() mResultReturned(false) { mMulti = new LLCurl::Multi(); - if (mMulti->mThreaded) - { - mMulti->start(); - } + mEasy = mMulti->allocEasy(); if (mEasy) { @@ -975,16 +1081,7 @@ LLCurlEasyRequest::LLCurlEasyRequest() LLCurlEasyRequest::~LLCurlEasyRequest() { - mMulti->mQuitting = true; - if (mMulti->mThreaded) - { - while (!mMulti->isStopped()) - { - mMulti->mSignal->signal(); - apr_sleep(1000); - } - } - delete mMulti; + LLCurl::getCurlThread()->killMulti(mMulti) ; } void LLCurlEasyRequest::setopt(CURLoption option, S32 value) @@ -1080,19 +1177,14 @@ void LLCurlEasyRequest::requestComplete() } } -void LLCurlEasyRequest::perform() -{ - mMulti->perform(); -} - // Usage: Call getRestult until it returns false (no more messages) bool LLCurlEasyRequest::getResult(CURLcode* result, LLCurl::TransferInfo* info) { - if (mMulti->mPerformState != LLCurl::Multi::PERFORM_STATE_COMPLETED) + if (!mMulti->isCompleted()) { //we're busy, try again later return false; } - mMulti->mPerformState = LLCurl::Multi::PERFORM_STATE_READY; + mMulti->setState(LLCurl::Multi::STATE_READY) ; if (!mEasy) { @@ -1180,8 +1272,6 @@ unsigned long LLCurl::ssl_thread_id(void) void LLCurl::initClass(bool multi_threaded) { - sMainThreadID = LLThread::currentID(); - sMultiThreaded = multi_threaded; // Do not change this "unless you are familiar with and mean to control // internal operations of libcurl" // - http://curl.haxx.se/libcurl/c/curl_global_init.html @@ -1189,9 +1279,6 @@ void LLCurl::initClass(bool multi_threaded) check_curl_code(code); - Easy::sHandleMutex = new LLMutex(NULL); - Easy::sMultiMutex = new LLMutex(NULL); - #if SAFE_SSL S32 mutex_count = CRYPTO_num_locks(); for (S32 i=0; i<mutex_count; i++) @@ -1201,20 +1288,29 @@ void LLCurl::initClass(bool multi_threaded) CRYPTO_set_id_callback(&LLCurl::ssl_thread_id); CRYPTO_set_locking_callback(&LLCurl::ssl_locking_callback); #endif + + sCurlThread = new LLCurlThread(multi_threaded) ; } void LLCurl::cleanupClass() { + //shut down curl thread + while(1) + { + if(!sCurlThread->update(1)) //finish all tasks + { + break ; + } + } + sCurlThread->shutdown() ; + delete sCurlThread ; + sCurlThread = NULL ; + #if SAFE_SSL CRYPTO_set_locking_callback(NULL); for_each(sSSLMutex.begin(), sSSLMutex.end(), DeletePointer()); #endif - delete Easy::sHandleMutex; - Easy::sHandleMutex = NULL; - delete Easy::sMultiMutex; - Easy::sMultiMutex = NULL; - for (std::set<CURL*>::iterator iter = Easy::sFreeHandles.begin(); iter != Easy::sFreeHandles.end(); ++iter) { CURL* curl = *iter; diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 87de202717..a275db3e53 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -42,8 +42,10 @@ #include "lliopipe.h" #include "llsd.h" #include "llthread.h" +#include "llqueuedthread.h" class LLMutex; +class LLCurlThread; // For whatever reason, this is not typedef'd in curl.h typedef size_t (*curl_header_callback)(void *ptr, size_t size, size_t nmemb, void *stream); @@ -56,8 +58,6 @@ public: class Easy; class Multi; - static bool sMultiThreaded; - struct TransferInfo { TransferInfo() : mSizeDownload(0.0), mTotalTime(0.0), mSpeedDownload(0.0) {} @@ -181,10 +181,12 @@ public: static void ssl_locking_callback(int mode, int type, const char *file, int line); static unsigned long ssl_thread_id(void); + static LLCurlThread* getCurlThread() { return sCurlThread ;} private: static std::string sCAPath; static std::string sCAFile; static const unsigned int MAX_REDIRECTS; + static LLCurlThread* sCurlThread; }; class LLCurl::Easy @@ -216,7 +218,7 @@ public: U32 report(CURLcode); void getTransferInfo(LLCurl::TransferInfo* info); - void prepRequest(const std::string& url, const std::vector<std::string>& headers, ResponderPtr, S32 time_out = 0, bool post = false); + void prepRequest(const std::string& url, const std::vector<std::string>& headers, LLCurl::ResponderPtr, S32 time_out = 0, bool post = false); const char* getErrorBuffer(); @@ -247,64 +249,111 @@ private: // Note: char*'s not strings since we pass pointers to curl std::vector<char*> mStrings; - ResponderPtr mResponder; + LLCurl::ResponderPtr mResponder; static std::set<CURL*> sFreeHandles; static std::set<CURL*> sActiveHandles; - static LLMutex* sHandleMutex; - static LLMutex* sMultiMutex; }; -class LLCurl::Multi : public LLThread +class LLCurl::Multi { LOG_CLASS(Multi); + + friend class LLCurlThread ; + +private: + ~Multi(); + + void markDead() ; + bool doPerform(); + public: typedef enum { - PERFORM_STATE_READY=0, - PERFORM_STATE_PERFORMING=1, - PERFORM_STATE_COMPLETED=2 + STATE_READY=0, + STATE_PERFORMING=1, + STATE_COMPLETED=2 } ePerformState; - Multi(); - ~Multi(); + Multi(); - Easy* allocEasy(); - bool addEasy(Easy* easy); + LLCurl::Easy* allocEasy(); + bool addEasy(LLCurl::Easy* easy); + void removeEasy(LLCurl::Easy* easy); - void removeEasy(Easy* easy); + void lock() ; + void unlock() ; + + void setState(ePerformState state) ; + ePerformState getState() ; + bool isCompleted() ; + + bool waitToComplete() ; S32 process(); - void perform(); - void doPerform(); - virtual void run(); - CURLMsg* info_read(S32* msgs_in_queue); S32 mQueued; S32 mErrorCount; - S32 mPerformState; - - LLCondition* mSignal; - bool mQuitting; - bool mThreaded; - private: - void easyFree(Easy*); + void easyFree(LLCurl::Easy*); CURLM* mCurlMultiHandle; - typedef std::set<Easy*> easy_active_list_t; + typedef std::set<LLCurl::Easy*> easy_active_list_t; easy_active_list_t mEasyActiveList; - typedef std::map<CURL*, Easy*> easy_active_map_t; + typedef std::map<CURL*, LLCurl::Easy*> easy_active_map_t; easy_active_map_t mEasyActiveMap; - typedef std::set<Easy*> easy_free_list_t; + typedef std::set<LLCurl::Easy*> easy_free_list_t; easy_free_list_t mEasyFreeList; + + LLQueuedThread::handle_t mHandle ; + ePerformState mState; + + BOOL mDead ; + LLMutex* mMutexp ; + LLMutex* mDeletionMutexp ; }; +class LLCurlThread : public LLQueuedThread +{ +public: + + class CurlRequest : public LLQueuedThread::QueuedRequest + { + protected: + virtual ~CurlRequest(); // use deleteRequest() + + public: + CurlRequest(handle_t handle, LLCurl::Multi* multi, LLCurlThread* curl_thread); + + /*virtual*/ bool processRequest(); + /*virtual*/ void finishRequest(bool completed); + + private: + // input + LLCurl::Multi* mMulti; + LLCurlThread* mCurlThread; + }; + friend class CurlRequest; + +public: + LLCurlThread(bool threaded = true) ; + virtual ~LLCurlThread() ; + + S32 update(U32 max_time_ms); + + void addMulti(LLCurl::Multi* multi) ; + void killMulti(LLCurl::Multi* multi) ; + +private: + bool doMultiPerform(LLCurl::Multi* multi) ; + void deleteMulti(LLCurl::Multi* multi) ; +} ; + namespace boost { void intrusive_ptr_add_ref(LLCurl::Responder* p); @@ -339,7 +388,6 @@ private: LLCurl::Multi* mActiveMulti; S32 mActiveRequestCount; BOOL mProcessing; - U32 mThreadID; // debug }; class LLCurlEasyRequest @@ -357,9 +405,10 @@ public: void slist_append(const char* str); void sendRequest(const std::string& url); void requestComplete(); - void perform(); bool getResult(CURLcode* result, LLCurl::TransferInfo* info = NULL); std::string getErrorString(); + bool isCompleted() {return mMulti->isCompleted() ;} + bool wait() { return mMulti->waitToComplete(); } LLCurl::Easy* getEasy() const { return mEasy; } diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp index 304a692cdf..3d8ca2ad9f 100644 --- a/indra/llmessage/llsdmessagereader.cpp +++ b/indra/llmessage/llsdmessagereader.cpp @@ -291,9 +291,10 @@ S32 getElementSize(const LLSD& llsd) case LLSD::TypeMap: case LLSD::TypeArray: case LLSD::TypeUndefined: + default: // TypeLLSDTypeEnd, TypeLLSDNumTypes, etc. return 0; } - return 0; + //return 0; } //virtual diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index fa03bb7512..a3a2b2b1b8 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -170,6 +170,7 @@ LLURLRequest::~LLURLRequest() { LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST); delete mDetail; + mDetail = NULL ; } void LLURLRequest::setURL(const std::string& url) @@ -344,7 +345,10 @@ LLIOPipe::EStatus LLURLRequest::process_impl( static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform"); { LLFastTimer t(FTM_URL_PERFORM); - mDetail->mCurlRequest->perform(); + if(!mDetail->mCurlRequest->wait()) + { + return status ; + } } while(1) diff --git a/indra/llplugin/llpluginmessagepipe.cpp b/indra/llplugin/llpluginmessagepipe.cpp index 8d13e38ad5..091e93ea4b 100644 --- a/indra/llplugin/llpluginmessagepipe.cpp +++ b/indra/llplugin/llpluginmessagepipe.cpp @@ -94,10 +94,10 @@ void LLPluginMessagePipeOwner::killMessagePipe(void) LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSocket::ptr_t socket): mInputMutex(gAPRPoolp), mOutputMutex(gAPRPoolp), + mOutputStartIndex(0), mOwner(owner), mSocket(socket) { - mOwner->setMessagePipe(this); } @@ -113,6 +113,14 @@ bool LLPluginMessagePipe::addMessage(const std::string &message) { // queue the message for later output LLMutexLock lock(&mOutputMutex); + + // If we're starting to use up too much memory, clear + if (mOutputStartIndex > 1024 * 1024) + { + mOutput = mOutput.substr(mOutputStartIndex); + mOutputStartIndex = 0; + } + mOutput += message; mOutput += MESSAGE_DELIMITER; // message separator @@ -165,35 +173,44 @@ bool LLPluginMessagePipe::pumpOutput() if(mSocket) { apr_status_t status; - apr_size_t size; + apr_size_t in_size, out_size; LLMutexLock lock(&mOutputMutex); - if(!mOutput.empty()) + + const char * output_data = &(mOutput.data()[mOutputStartIndex]); + if(*output_data != '\0') { // write any outgoing messages - size = (apr_size_t)mOutput.size(); + in_size = (apr_size_t) (mOutput.size() - mOutputStartIndex); + out_size = in_size; setSocketTimeout(0); // LL_INFOS("Plugin") << "before apr_socket_send, size = " << size << LL_ENDL; - status = apr_socket_send( - mSocket->getSocket(), - (const char*)mOutput.data(), - &size); + status = apr_socket_send(mSocket->getSocket(), + output_data, + &out_size); // LL_INFOS("Plugin") << "after apr_socket_send, size = " << size << LL_ENDL; - if(status == APR_SUCCESS) + if((status == APR_SUCCESS) || APR_STATUS_IS_EAGAIN(status)) { - // success - mOutput = mOutput.substr(size); - } - else if(APR_STATUS_IS_EAGAIN(status)) - { - // Socket buffer is full... - // remove the written part from the buffer and try again later. - mOutput = mOutput.substr(size); + // Success or Socket buffer is full... + + // If we've pumped the entire string, clear it + if (out_size == in_size) + { + mOutputStartIndex = 0; + mOutput.clear(); + } + else + { + llassert(in_size > out_size); + + // Remove the written part from the buffer and try again later. + mOutputStartIndex += out_size; + } } else if(APR_STATUS_IS_EOF(status)) { diff --git a/indra/llplugin/llpluginmessagepipe.h b/indra/llplugin/llpluginmessagepipe.h index c6f1686bf4..c3498beac0 100644 --- a/indra/llplugin/llpluginmessagepipe.h +++ b/indra/llplugin/llpluginmessagepipe.h @@ -86,6 +86,7 @@ protected: std::string mInput; LLMutex mOutputMutex; std::string mOutput; + std::string::size_type mOutputStartIndex; LLPluginMessagePipeOwner *mOwner; LLSocket::ptr_t mSocket; diff --git a/indra/llprimitive/lltextureanim.cpp b/indra/llprimitive/lltextureanim.cpp index 398af4e6e8..185a3f69c0 100644 --- a/indra/llprimitive/lltextureanim.cpp +++ b/indra/llprimitive/lltextureanim.cpp @@ -168,8 +168,8 @@ void LLTextureAnim::unpackTAMessage(LLDataPacker &dp) mMode = data[0]; mFace = data[1]; - mSizeX = llmax((U8)1, data[2]); - mSizeY = llmax((U8)1, data[3]); + mSizeX = data[2]; + mSizeY = data[3]; htonmemcpy(&mStart, data + 4, MVT_F32, sizeof(F32)); htonmemcpy(&mLength, data + 8, MVT_F32, sizeof(F32)); htonmemcpy(&mRate, data + 12, MVT_F32, sizeof(F32)); diff --git a/indra/llprimitive/llvolumexml.cpp b/indra/llprimitive/llvolumexml.cpp index f4f9d4d713..bf2297a029 100644 --- a/indra/llprimitive/llvolumexml.cpp +++ b/indra/llprimitive/llvolumexml.cpp @@ -34,9 +34,9 @@ //============================================================================ -LLXMLNode *LLVolumeXml::exportProfileParams(const LLProfileParams* params) +LLPointer<LLXMLNode> LLVolumeXml::exportProfileParams(const LLProfileParams* params) { - LLXMLNode *ret = new LLXMLNode("profile", FALSE); + LLPointer<LLXMLNode> ret = new LLXMLNode("profile", FALSE); ret->createChild("curve_type", TRUE)->setByteValue(1, ¶ms->getCurveType()); ret->createChild("interval", FALSE)->setFloatValue(2, ¶ms->getBegin()); @@ -46,9 +46,9 @@ LLXMLNode *LLVolumeXml::exportProfileParams(const LLProfileParams* params) } -LLXMLNode *LLVolumeXml::exportPathParams(const LLPathParams* params) +LLPointer<LLXMLNode> LLVolumeXml::exportPathParams(const LLPathParams* params) { - LLXMLNode *ret = new LLXMLNode("path", FALSE); + LLPointer<LLXMLNode> ret = new LLXMLNode("path", FALSE); ret->createChild("curve_type", TRUE)->setByteValue(1, ¶ms->getCurveType()); ret->createChild("interval", FALSE)->setFloatValue(2, ¶ms->getBegin()); ret->createChild("scale", FALSE)->setFloatValue(2, params->getScale().mV); @@ -63,12 +63,15 @@ LLXMLNode *LLVolumeXml::exportPathParams(const LLPathParams* params) } -LLXMLNode *LLVolumeXml::exportVolumeParams(const LLVolumeParams* params) +LLPointer<LLXMLNode> LLVolumeXml::exportVolumeParams(const LLVolumeParams* params) { - LLXMLNode *ret = new LLXMLNode("shape", FALSE); + LLPointer<LLXMLNode> ret = new LLXMLNode("shape", FALSE); - exportPathParams(¶ms->getPathParams())->setParent(ret); - exportProfileParams(¶ms->getProfileParams())->setParent(ret); + LLPointer<LLXMLNode> node ; + node = exportPathParams(¶ms->getPathParams()) ; + node->setParent(ret); + node = exportProfileParams(¶ms->getProfileParams()) ; + node->setParent(ret); return ret; } diff --git a/indra/llprimitive/llvolumexml.h b/indra/llprimitive/llvolumexml.h index 5e79205d9a..9d4d989475 100644 --- a/indra/llprimitive/llvolumexml.h +++ b/indra/llprimitive/llvolumexml.h @@ -34,11 +34,11 @@ class LLVolumeXml { public: - static LLXMLNode* exportProfileParams(const LLProfileParams* params); + static LLPointer<LLXMLNode> exportProfileParams(const LLProfileParams* params); - static LLXMLNode* exportPathParams(const LLPathParams* params); + static LLPointer<LLXMLNode> exportPathParams(const LLPathParams* params); - static LLXMLNode* exportVolumeParams(const LLVolumeParams* params); + static LLPointer<LLXMLNode> exportVolumeParams(const LLVolumeParams* params); }; #endif // LL_LLVOLUMEXML_H diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 812fa7024b..cd827f5091 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1444,6 +1444,11 @@ const glh::matrix4f& LLRender::getModelviewMatrix() return mMatrix[MM_MODELVIEW][mMatIdx[MM_MODELVIEW]]; } +const glh::matrix4f& LLRender::getProjectionMatrix() +{ + return mMatrix[MM_PROJECTION][mMatIdx[MM_PROJECTION]]; +} + void LLRender::translateUI(F32 x, F32 y, F32 z) { if (mUIOffset.empty()) diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 7581b9f908..fa5f7f311d 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -348,6 +348,7 @@ public: void matrixMode(U32 mode); const glh::matrix4f& getModelviewMatrix(); + const glh::matrix4f& getProjectionMatrix(); void syncMatrices(); void syncLightState(); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index eea768a3ea..ac9dc9544d 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -845,28 +845,42 @@ BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors) LL_WARNS("ShaderLoading") << "GLSL Linker Error:" << LL_ENDL; } -// NOTE: Removing LL_DARWIN block as it doesn't seem to actually give the correct answer, -// but want it for reference once I move it. -#if 0 - // Force an evaluation of the gl state so the driver can tell if the shader will run in hardware or software - // per Apple's suggestion - glBegin(gGL.mMode); - glEnd(); - - // Query whether the shader can or cannot run in hardware - // http://developer.apple.com/qa/qa2007/qa1502.html - long vertexGPUProcessing; - CGLContextObj ctx = CGLGetCurrentContext(); - CGLGetParameter (ctx, kCGLCPGPUVertexProcessing, &vertexGPUProcessing); - long fragmentGPUProcessing; - CGLGetParameter (ctx, kCGLCPGPUFragmentProcessing, &fragmentGPUProcessing); - if (!fragmentGPUProcessing || !vertexGPUProcessing) +#if LL_DARWIN + + // For some reason this absolutely kills the frame rate when VBO's are enabled + if (0) { - LL_WARNS("ShaderLoading") << "GLSL Linker: Running in Software:" << LL_ENDL; - success = GL_FALSE; - suppress_errors = FALSE; + // Force an evaluation of the gl state so the driver can tell if the shader will run in hardware or software + // per Apple's suggestion + LLGLSLShader::sNoFixedFunction = false; + + glUseProgramObjectARB(obj); + + gGL.begin(LLRender::TRIANGLES); + gGL.vertex3f(0.0f, 0.0f, 0.0f); + gGL.vertex3f(0.0f, 0.0f, 0.0f); + gGL.vertex3f(0.0f, 0.0f, 0.0f); + gGL.end(); + gGL.flush(); + + glUseProgramObjectARB(0); + + LLGLSLShader::sNoFixedFunction = true; + + // Query whether the shader can or cannot run in hardware + // http://developer.apple.com/qa/qa2007/qa1502.html + GLint vertexGPUProcessing, fragmentGPUProcessing; + CGLContextObj ctx = CGLGetCurrentContext(); + CGLGetParameter(ctx, kCGLCPGPUVertexProcessing, &vertexGPUProcessing); + CGLGetParameter(ctx, kCGLCPGPUFragmentProcessing, &fragmentGPUProcessing); + if (!fragmentGPUProcessing || !vertexGPUProcessing) + { + LL_WARNS("ShaderLoading") << "GLSL Linker: Running in Software:" << LL_ENDL; + success = GL_FALSE; + suppress_errors = FALSE; + } } - + #else std::string log = get_object_log(obj); LLStringUtil::toLower(log); diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index ede6149a80..3b308a359d 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -191,13 +191,12 @@ public: return min_dim; } + F32 getCollapseFactor(); void setOrientation(LLLayoutStack::ELayoutOrientation orientation) { mOrientation = orientation; } protected: LLLayoutPanel(const Params& p); - F32 getCollapseFactor(); - bool mExpandedMinDimSpecified; S32 mExpandedMinDim; diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index cd33938226..f620201020 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -135,6 +135,8 @@ public: const LLColor4& getBackgroundColor() const { return mBgOpaqueColor; } void setTransparentColor(const LLColor4& color) { mBgAlphaColor = color; } const LLColor4& getTransparentColor() const { return mBgAlphaColor; } + void setBackgroundImage(LLUIImage* image) { mBgOpaqueImage = image; } + void setTransparentImage(LLUIImage* image) { mBgAlphaImage = image; } LLPointer<LLUIImage> getBackgroundImage() const { return mBgOpaqueImage; } LLPointer<LLUIImage> getTransparentImage() const { return mBgAlphaImage; } LLColor4 getBackgroundImageOverlay() { return mBgOpaqueImageOverlay; } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 622f3e215c..466fac33ea 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -175,6 +175,7 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mBorder(NULL), mSortCallback(NULL), mPopupMenu(NULL), + mCommentTextView(NULL), mNumDynamicWidthColumns(0), mTotalStaticColumnWidth(0), mTotalColumnPadding(0), @@ -476,7 +477,12 @@ void LLScrollListCtrl::updateLayout() getRect().getWidth() - 2 * mBorderThickness, getRect().getHeight() - (2 * mBorderThickness ) - heading_size ); - getChildView("comment_text")->setShape(mItemListRect); + if (mCommentTextView == NULL) + { + mCommentTextView = getChildView("comment_text"); + } + + mCommentTextView->setShape(mItemListRect); // how many lines of content in a single "page" S32 page_lines = getLinesPerPage(); diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 09ab89960d..ae8aea9245 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -480,6 +480,8 @@ private: S32 mHighlightedItem; class LLViewBorder* mBorder; LLContextMenu *mPopupMenu; + + LLView *mCommentTextView; LLWString mSearchString; LLFrameTimer mSearchTimer; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 33bc247987..6b74c5a6be 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1833,9 +1833,12 @@ void LLUI::setupPaths() LLXMLNodePtr root; BOOL success = LLXMLNode::parseFile(filename, root, NULL); Paths paths; - LLXUIParser parser; - parser.readXUI(root, paths, filename); + if(success) + { + LLXUIParser parser; + parser.readXUI(root, paths, filename); + } sXUIPaths.clear(); if (success && paths.validateBlock()) diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index b21c088a1f..f39499e50c 100644 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp @@ -37,10 +37,13 @@ const S32 MIN_NOTIFICATION_AREA_HEIGHT = 30; const S32 MAX_NOTIFICATION_AREA_HEIGHT = 100; +static LLDefaultChildRegistry::Register<LLWindowShade> r("window_shade"); + LLWindowShade::Params::Params() : bg_image("bg_image"), modal("modal", false), text_color("text_color"), + shade_color("shade_color"), can_close("can_close", true) { changeDefault(mouse_opaque, false); @@ -48,7 +51,6 @@ LLWindowShade::Params::Params() LLWindowShade::LLWindowShade(const LLWindowShade::Params& params) : LLUICtrl(params), - mNotification(params.notification), mModal(params.modal), mFormHeight(0), mTextColor(params.text_color) @@ -72,7 +74,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) addChild(stackp); LLLayoutPanel::Params panel_p; - panel_p.rect = LLRect(0, 30, 800, 0); + panel_p.rect = LLRect(0, MIN_NOTIFICATION_AREA_HEIGHT, 800, 0); panel_p.name = "notification_area"; panel_p.visible = false; panel_p.user_resize = false; @@ -89,7 +91,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) panel_p.name = "background_area"; panel_p.mouse_opaque = false; panel_p.background_visible = false; - panel_p.bg_alpha_color = LLColor4(0.f, 0.f, 0.f, 0.2f); + panel_p.bg_alpha_color = params.shade_color; LLLayoutPanel* dummy_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p); stackp->addChild(dummy_panel); @@ -107,11 +109,11 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) LLIconCtrl::Params icon_p; icon_p.name = "notification_icon"; - icon_p.rect = LLRect(5, 23, 21, 8); + icon_p.rect = LLRect(5, 25, 21, 10); panel->addChild(LLUICtrlFactory::create<LLIconCtrl>(icon_p)); LLTextBox::Params text_p; - text_p.rect = LLRect(31, 20, panel->getRect().getWidth() - 5, 0); + text_p.rect = LLRect(31, 23, panel->getRect().getWidth() - 5, 3); text_p.follows.flags = FOLLOWS_ALL; text_p.text_color = mTextColor; text_p.font = LLFontGL::getFontSansSerifSmall(); @@ -125,41 +127,132 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) panel_p.auto_resize = false; panel_p.user_resize = false; panel_p.name="form_elements"; - panel_p.rect = LLRect(0, 30, 130, 0); + panel_p.rect = LLRect(0, MIN_NOTIFICATION_AREA_HEIGHT, 130, 0); LLLayoutPanel* form_elements_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p); stackp->addChild(form_elements_panel); - if (params.can_close) + panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>(); + panel_p.auto_resize = false; + panel_p.user_resize = false; + panel_p.rect = LLRect(0, MIN_NOTIFICATION_AREA_HEIGHT, 25, 0); + panel_p.name = "close_panel"; + LLLayoutPanel* close_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p); + stackp->addChild(close_panel); + + LLButton::Params button_p; + button_p.name = "close_notification"; + button_p.rect = LLRect(5, 23, 21, 7); + button_p.image_color.control="DkGray_66"; + button_p.image_unselected.name="Icon_Close_Foreground"; + button_p.image_selected.name="Icon_Close_Press"; + button_p.click_callback.function = boost::bind(&LLWindowShade::onCloseNotification, this); + + close_panel->addChild(LLUICtrlFactory::create<LLButton>(button_p)); + + close_panel->setVisible(params.can_close); +} + +void LLWindowShade::draw() +{ + LLRect message_rect = getChild<LLTextBox>("notification_text")->getTextBoundingRect(); + + LLLayoutPanel* notification_area = getChild<LLLayoutPanel>("notification_area"); + + notification_area->reshape(notification_area->getRect().getWidth(), + llclamp(message_rect.getHeight() + 15, + llmin(mFormHeight, MAX_NOTIFICATION_AREA_HEIGHT), + MAX_NOTIFICATION_AREA_HEIGHT)); + + LLUICtrl::draw(); + + while(!mNotifications.empty() && !mNotifications.back()->isActive()) { - panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>(); - panel_p.auto_resize = false; - panel_p.user_resize = false; - panel_p.rect = LLRect(0, 30, 25, 0); - LLLayoutPanel* close_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p); - stackp->addChild(close_panel); - - LLButton::Params button_p; - button_p.name = "close_notification"; - button_p.rect = LLRect(5, 23, 21, 7); - button_p.image_color.control="DkGray_66"; - button_p.image_unselected.name="Icon_Close_Foreground"; - button_p.image_selected.name="Icon_Close_Press"; - button_p.click_callback.function = boost::bind(&LLWindowShade::onCloseNotification, this); - - close_panel->addChild(LLUICtrlFactory::create<LLButton>(button_p)); + mNotifications.pop_back(); + // go ahead and hide + hide(); } - LLSD payload = mNotification->getPayload(); + if (mNotifications.empty()) + { + hide(); + } + else if (notification_area->getCollapseFactor() < 0.01f) + { + displayLatestNotification(); + } - LLNotificationFormPtr formp = mNotification->getForm(); + if (!notification_area->getVisible() && (notification_area->getCollapseFactor() < 0.001f)) + { + getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(false); + setMouseOpaque(false); + } +} + +void LLWindowShade::hide() +{ + getChildRef<LLLayoutPanel>("notification_area").setVisible(false); +} + +void LLWindowShade::onCloseNotification() +{ + if (!mNotifications.empty()) + LLNotifications::instance().cancel(mNotifications.back()); +} + +void LLWindowShade::onClickIgnore(LLUICtrl* ctrl) +{ + LLNotificationPtr notify = getCurrentNotification(); + if (!notify) return; + + bool check = ctrl->getValue().asBoolean(); + if (notify->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN) + { + // question was "show again" so invert value to get "ignore" + check = !check; + } + notify->setIgnored(check); +} + +void LLWindowShade::onClickNotificationButton(const std::string& name) +{ + LLNotificationPtr notify = getCurrentNotification(); + if (!notify) return; + + mNotificationResponse[name] = true; + + notify->respond(mNotificationResponse); +} + +void LLWindowShade::onEnterNotificationText(LLUICtrl* ctrl, const std::string& name) +{ + mNotificationResponse[name] = ctrl->getValue().asString(); +} + +void LLWindowShade::show(LLNotificationPtr notification) +{ + mNotifications.push_back(notification); + + displayLatestNotification(); +} + +void LLWindowShade::displayLatestNotification() +{ + if (mNotifications.empty()) return; + + LLNotificationPtr notification = mNotifications.back(); + + LLSD payload = notification->getPayload(); + + LLNotificationFormPtr formp = notification->getForm(); LLLayoutPanel& notification_area = getChildRef<LLLayoutPanel>("notification_area"); - notification_area.getChild<LLUICtrl>("notification_icon")->setValue(mNotification->getIcon()); - notification_area.getChild<LLUICtrl>("notification_text")->setValue(mNotification->getMessage()); - notification_area.getChild<LLUICtrl>("notification_text")->setToolTip(mNotification->getMessage()); + notification_area.getChild<LLUICtrl>("notification_icon")->setValue(notification->getIcon()); + notification_area.getChild<LLUICtrl>("notification_text")->setValue(notification->getMessage()); + notification_area.getChild<LLUICtrl>("notification_text")->setToolTip(notification->getMessage()); LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType(); LLLayoutPanel& form_elements = notification_area.getChildRef<LLLayoutPanel>("form_elements"); form_elements.deleteAllChildren(); + form_elements.reshape(form_elements.getRect().getWidth(), MIN_NOTIFICATION_AREA_HEIGHT); const S32 FORM_PADDING_HORIZONTAL = 10; const S32 FORM_PADDING_VERTICAL = 3; @@ -229,7 +322,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) label_p.v_pad = 5; LLTextBox* textbox = LLUICtrlFactory::create<LLTextBox>(label_p); textbox->reshapeToFitText(); - textbox->reshape(textbox->getRect().getWidth(), form_elements.getRect().getHeight() - 2 * FORM_PADDING_VERTICAL); + textbox->reshape(textbox->getRect().getWidth(), MIN_NOTIFICATION_AREA_HEIGHT - 2 * FORM_PADDING_VERTICAL); form_elements.addChild(textbox); cur_x = textbox->getRect().mRight + FORM_PADDING_HORIZONTAL; @@ -249,7 +342,7 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) } } - mFormHeight = form_elements.getRect().getHeight() - (cur_y - FORM_PADDING_VERTICAL) + WIDGET_HEIGHT; + mFormHeight = form_elements.getRect().getHeight() - (cur_y - WIDGET_HEIGHT - FORM_PADDING_VERTICAL); form_elements.reshape(form_width, mFormHeight); form_elements.setMinDim(form_width); @@ -261,40 +354,21 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params) { (*it)->translate(0, delta_y); } -} -void LLWindowShade::show() -{ getChildRef<LLLayoutPanel>("notification_area").setVisible(true); getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(mModal); setMouseOpaque(mModal); } -void LLWindowShade::draw() +void LLWindowShade::setBackgroundImage(LLUIImage* image) { - LLRect message_rect = getChild<LLTextBox>("notification_text")->getTextBoundingRect(); - - LLLayoutPanel* notification_area = getChild<LLLayoutPanel>("notification_area"); - - notification_area->reshape(notification_area->getRect().getWidth(), - llclamp(message_rect.getHeight() + 10, - llmin(mFormHeight, MAX_NOTIFICATION_AREA_HEIGHT), - MAX_NOTIFICATION_AREA_HEIGHT)); - - LLUICtrl::draw(); - if (mNotification && !mNotification->isActive()) - { - hide(); - } + getChild<LLLayoutPanel>("notification_area")->setTransparentImage(image); } -void LLWindowShade::hide() +void LLWindowShade::setTextColor(LLColor4 color) { - getChildRef<LLLayoutPanel>("notification_area").setVisible(false); - getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(false); - - setMouseOpaque(false); + getChild<LLTextBox>("notification_text")->setColor(color); } bool LLWindowShade::isShown() const @@ -302,32 +376,17 @@ bool LLWindowShade::isShown() const return getChildRef<LLLayoutPanel>("notification_area").getVisible(); } -void LLWindowShade::onCloseNotification() +void LLWindowShade::setCanClose(bool can_close) { - LLNotifications::instance().cancel(mNotification); + getChildView("close_panel")->setVisible(can_close); } -void LLWindowShade::onClickIgnore(LLUICtrl* ctrl) +LLNotificationPtr LLWindowShade::getCurrentNotification() { - bool check = ctrl->getValue().asBoolean(); - if (mNotification && mNotification->getForm()->getIgnoreType() == LLNotificationForm::IGNORE_SHOW_AGAIN) + if (mNotifications.empty()) { - // question was "show again" so invert value to get "ignore" - check = !check; + return LLNotificationPtr(); } - mNotification->setIgnored(check); -} - -void LLWindowShade::onClickNotificationButton(const std::string& name) -{ - if (!mNotification) return; - - mNotificationResponse[name] = true; - - mNotification->respond(mNotificationResponse); + return mNotifications.back(); } -void LLWindowShade::onEnterNotificationText(LLUICtrl* ctrl, const std::string& name) -{ - mNotificationResponse[name] = ctrl->getValue().asString(); -} diff --git a/indra/llui/llwindowshade.h b/indra/llui/llwindowshade.h index cb8f223a84..6d753d1161 100644 --- a/indra/llui/llwindowshade.h +++ b/indra/llui/llwindowshade.h @@ -36,22 +36,28 @@ class LLWindowShade : public LLUICtrl public: struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { - Mandatory<LLNotificationPtr> notification; Optional<LLUIImage*> bg_image; - Optional<LLUIColor> text_color; + Optional<LLUIColor> text_color, + shade_color; Optional<bool> modal, can_close; Params(); }; - void show(); + void show(LLNotificationPtr); /*virtual*/ void draw(); void hide(); bool isShown() const; + void setBackgroundImage(LLUIImage* image); + void setTextColor(LLColor4 color); + void setCanClose(bool can_close); + private: + void displayLatestNotification(); + LLNotificationPtr getCurrentNotification(); friend class LLUICtrlFactory; LLWindowShade(const Params& p); @@ -62,7 +68,7 @@ private: void onEnterNotificationText(LLUICtrl* ctrl, const std::string& name); void onClickIgnore(LLUICtrl* ctrl); - LLNotificationPtr mNotification; + std::vector<LLNotificationPtr> mNotifications; LLSD mNotificationResponse; bool mModal; S32 mFormHeight; diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index de7ce3db77..1351bed547 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -108,6 +108,7 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags) mSupportedResolutions(NULL), mNumSupportedResolutions(0), mCurrentCursor(UI_CURSOR_ARROW), + mNextCursor(UI_CURSOR_ARROW), mCursorHidden(FALSE), mBusyCount(0), mIsMouseClipping(FALSE), diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index ec41f24465..cab2d0a8fb 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -92,8 +92,9 @@ public: virtual S32 getBusyCount() const; // Sets cursor, may set to arrow+hourglass - virtual void setCursor(ECursorType cursor) = 0; + virtual void setCursor(ECursorType cursor) { mNextCursor = cursor; }; virtual ECursorType getCursor() const; + virtual void updateCursor() = 0; virtual void captureMouse() = 0; virtual void releaseMouse() = 0; @@ -184,6 +185,7 @@ protected: LLWindowResolution* mSupportedResolutions; S32 mNumSupportedResolutions; ECursorType mCurrentCursor; + ECursorType mNextCursor; BOOL mCursorHidden; S32 mBusyCount; // how deep is the "cursor busy" stack? BOOL mIsMouseClipping; // Is this window currently clipping the mouse diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h index 01f1d4fcd3..d4a778cb85 100644 --- a/indra/llwindow/llwindowheadless.h +++ b/indra/llwindow/llwindowheadless.h @@ -55,7 +55,7 @@ public: /*virtual*/ void showCursorFromMouseMove() {}; /*virtual*/ void hideCursorUntilMouseMove() {}; /*virtual*/ BOOL isCursorHidden() {return FALSE;}; - /*virtual*/ void setCursor(ECursorType cursor) {}; + /*virtual*/ void updateCursor() {}; //virtual ECursorType getCursor() { return mCurrentCursor; }; /*virtual*/ void captureMouse() {}; /*virtual*/ void releaseMouse() {}; diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 62958b4702..c952f8bbcf 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1164,6 +1164,8 @@ void LLWindowMacOSX::gatherInput() } } + + updateCursor(); } BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) @@ -2841,7 +2843,7 @@ static void initPixmapCursor(int cursorid, int hotspotX, int hotspotY) gCursors[cursorid] = createImageCursor(fullpath.c_str(), hotspotX, hotspotY); } -void LLWindowMacOSX::setCursor(ECursorType cursor) +void LLWindowMacOSX::updateCursor() { OSStatus result = noErr; @@ -2849,30 +2851,30 @@ void LLWindowMacOSX::setCursor(ECursorType cursor) { // A drag is in progress...remember the requested cursor and we'll // restore it when it is done - mCurrentCursor = cursor; + mCurrentCursor = mNextCursor; return; } - - if (cursor == UI_CURSOR_ARROW + + if (mNextCursor == UI_CURSOR_ARROW && mBusyCount > 0) { - cursor = UI_CURSOR_WORKING; + mNextCursor = UI_CURSOR_WORKING; } - - if(mCurrentCursor == cursor) + + if(mCurrentCursor == mNextCursor) return; // RN: replace multi-drag cursors with single versions - if (cursor == UI_CURSOR_ARROWDRAGMULTI) + if (mNextCursor == UI_CURSOR_ARROWDRAGMULTI) { - cursor = UI_CURSOR_ARROWDRAG; + mNextCursor = UI_CURSOR_ARROWDRAG; } - else if (cursor == UI_CURSOR_ARROWCOPYMULTI) + else if (mNextCursor == UI_CURSOR_ARROWCOPYMULTI) { - cursor = UI_CURSOR_ARROWCOPY; + mNextCursor = UI_CURSOR_ARROWCOPY; } - switch(cursor) + switch(mNextCursor) { default: case UI_CURSOR_ARROW: @@ -2923,7 +2925,7 @@ void LLWindowMacOSX::setCursor(ECursorType cursor) case UI_CURSOR_TOOLSIT: case UI_CURSOR_TOOLBUY: case UI_CURSOR_TOOLOPEN: - result = setImageCursor(gCursors[cursor]); + result = setImageCursor(gCursors[mNextCursor]); break; } @@ -2933,7 +2935,7 @@ void LLWindowMacOSX::setCursor(ECursorType cursor) InitCursor(); } - mCurrentCursor = cursor; + mCurrentCursor = mNextCursor; } ECursorType LLWindowMacOSX::getCursor() const diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index b3010cee24..073f294b54 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -67,7 +67,7 @@ public: /*virtual*/ void showCursorFromMouseMove(); /*virtual*/ void hideCursorUntilMouseMove(); /*virtual*/ BOOL isCursorHidden(); - /*virtual*/ void setCursor(ECursorType cursor); + /*virtual*/ void updateCursor(); /*virtual*/ ECursorType getCursor() const; /*virtual*/ void captureMouse(); /*virtual*/ void releaseMouse(); diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h index 45f96d2a0c..8f70aee4f6 100644 --- a/indra/llwindow/llwindowmesaheadless.h +++ b/indra/llwindow/llwindowmesaheadless.h @@ -59,7 +59,7 @@ public: /*virtual*/ void showCursorFromMouseMove() {}; /*virtual*/ void hideCursorUntilMouseMove() {}; /*virtual*/ BOOL isCursorHidden() {return FALSE;}; - /*virtual*/ void setCursor(ECursorType cursor) {}; + /*virtual*/ void updateCursor() {}; //virtual ECursorType getCursor() { return mCurrentCursor; }; /*virtual*/ void captureMouse() {}; /*virtual*/ void releaseMouse() {}; diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 6d593c807e..5f5baceef8 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -1936,6 +1936,8 @@ void LLWindowSDL::gatherInput() break; } } + + updateCursor(); #if LL_X11 // This is a good time to stop flashing the icon if our mFlashTimer has @@ -2022,7 +2024,7 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty return sdlcursor; } -void LLWindowSDL::setCursor(ECursorType cursor) +void LLWindowSDL::updateCursor() { if (ATIbug) { // cursor-updating is very flaky when this bug is @@ -2030,11 +2032,11 @@ void LLWindowSDL::setCursor(ECursorType cursor) return; } - if (mCurrentCursor != cursor) + if (mCurrentCursor != mNextCursor) { - if (cursor < UI_CURSOR_COUNT) + if (mNextCursor < UI_CURSOR_COUNT) { - SDL_Cursor *sdlcursor = mSDLCursors[cursor]; + SDL_Cursor *sdlcursor = mSDLCursors[mNextCursor]; // Try to default to the arrow for any cursors that // did not load correctly. if (!sdlcursor && mSDLCursors[UI_CURSOR_ARROW]) @@ -2042,9 +2044,9 @@ void LLWindowSDL::setCursor(ECursorType cursor) if (sdlcursor) SDL_SetCursor(sdlcursor); } else { - llwarns << "Tried to set invalid cursor number " << cursor << llendl; + llwarns << "Tried to set invalid cursor number " << mNextCursor << llendl; } - mCurrentCursor = cursor; + mCurrentCursor = mNextCursor; } } diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 14bc0b399d..59719e4046 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -72,7 +72,7 @@ public: /*virtual*/ void showCursorFromMouseMove(); /*virtual*/ void hideCursorUntilMouseMove(); /*virtual*/ BOOL isCursorHidden(); - /*virtual*/ void setCursor(ECursorType cursor); + /*virtual*/ void updateCursor(); /*virtual*/ void captureMouse(); /*virtual*/ void releaseMouse(); /*virtual*/ void setMouseClipping( BOOL b ); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 0130e24136..52c27b6736 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1667,18 +1667,18 @@ void LLWindowWin32::initCursors() -void LLWindowWin32::setCursor(ECursorType cursor) +void LLWindowWin32::updateCursor() { - if (cursor == UI_CURSOR_ARROW + if (mNextCursor == UI_CURSOR_ARROW && mBusyCount > 0) { - cursor = UI_CURSOR_WORKING; + mNextCursor = UI_CURSOR_WORKING; } - if( mCurrentCursor != cursor ) + if( mCurrentCursor != mNextCursor ) { - mCurrentCursor = cursor; - SetCursor( mCursor[cursor] ); + mCurrentCursor = mNextCursor; + SetCursor( mCursor[mNextCursor] ); } } @@ -1760,6 +1760,8 @@ void LLWindowWin32::gatherInput() mInputProcessingPaused = FALSE; + updateCursor(); + // clear this once we've processed all mouse messages that might have occurred after // we slammed the mouse position mMousePositionModified = FALSE; diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index fa4a0ec1d3..b3602be8b7 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -66,7 +66,7 @@ public: /*virtual*/ void showCursorFromMouseMove(); /*virtual*/ void hideCursorUntilMouseMove(); /*virtual*/ BOOL isCursorHidden(); - /*virtual*/ void setCursor(ECursorType cursor); + /*virtual*/ void updateCursor(); /*virtual*/ ECursorType getCursor() const; /*virtual*/ void captureMouse(); /*virtual*/ void releaseMouse(); diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 9f1e249ddd..2b4a0fc2a1 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -693,7 +693,7 @@ bool LLXMLNode::parseFile(const std::string& filename, LLXMLNodePtr& node, LLXML LLFILE* fp = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ if (fp == NULL) { - node = new LLXMLNode(); + node = NULL ; return false; } fseek(fp, 0, SEEK_END); @@ -746,7 +746,7 @@ bool LLXMLNode::parseBuffer( { llwarns << "Parse failure - wrong number of top-level nodes xml." << llendl; - node = new LLXMLNode(); + node = NULL ; return false; } @@ -805,7 +805,7 @@ bool LLXMLNode::parseStream( { llwarns << "Parse failure - wrong number of top-level nodes xml." << llendl; - node = new LLXMLNode(); + node = NULL; return false; } @@ -1206,7 +1206,7 @@ bool LLXMLNode::getChild(const LLStringTableEntry* name, LLXMLNodePtr& node, BOO { return mDefault->getChild(name, node, FALSE); } - node = new LLXMLNode(); + node = NULL; return false; } @@ -1277,7 +1277,7 @@ bool LLXMLNode::getAttribute(const LLStringTableEntry* name, LLXMLNodePtr& node, { return mDefault->getAttribute(name, node, FALSE); } - node = new LLXMLNode(); + return false; } diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index 58654dcc21..afc76024d1 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -1381,6 +1381,7 @@ bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBl if( !file.isOpen() ) { LL_WARNS("ReadXUI") << "Unable to open file " << filename << LL_ENDL; + XML_ParserFree( mParser ); return false; } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c1a3f8480d..aa8ad53a3d 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7858,18 +7858,6 @@ <integer>0</integer> </map> - <key>RenderAnimateTrees</key> - <map> - <key>Comment</key> - <string>Use GL matrix ops to animate tree branches.</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> - <key>RenderMinimumLODTriangleCount</key> <map> <key>Comment</key> @@ -10379,39 +10367,6 @@ <key>Value</key> <integer>0</integer> </map> - <key>SnapshotLocalLastResolution</key> - <map> - <key>Comment</key> - <string>Take next local snapshot at this resolution</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>S32</string> - <key>Value</key> - <integer>0</integer> - </map> - <key>SnapshotProfileLastResolution</key> - <map> - <key>Comment</key> - <string>Take next profile snapshot at this resolution</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>S32</string> - <key>Value</key> - <integer>0</integer> - </map> - <key>SnapshotPostcardLastResolution</key> - <map> - <key>Comment</key> - <string>Take next postcard snapshot at this resolution</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>S32</string> - <key>Value</key> - <integer>0</integer> - </map> <key>SnapshotQuality</key> <map> <key>Comment</key> @@ -10445,17 +10400,6 @@ <key>Value</key> <string>http://photos.apps.staging.avatarsunited.com/viewer_config</string> </map> - <key>SnapshotTextureLastResolution</key> - <map> - <key>Comment</key> - <string>Take next texture snapshot at this resolution</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>S32</string> - <key>Value</key> - <integer>0</integer> - </map> <key>SpeedTest</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 4cca287356..c012efa056 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -51,19 +51,6 @@ VARYING vec2 vary_texcoord0; uniform mat4 inv_proj; -vec4 getPosition(vec2 pos_screen) -{ - float depth = texture2DRect(depthMap, pos_screen.xy).a; - vec2 sc = pos_screen.xy*2.0; - sc /= screen_res; - sc -= vec2(1.0,1.0); - vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); - vec4 pos = inv_proj * ndc; - pos /= pos.w; - pos.w = 1.0; - return pos; -} - void main() { vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl index 46d42d2a4a..c1fb7b55d4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl @@ -37,7 +37,7 @@ VARYING vec2 vary_texcoord0; void main() { - float alpha = texture2D(diffuseMap, vary_texcoord0.xy).a * vertex_color.a; + float alpha = diffuseLookup(vary_texcoord0.xy).a * vertex_color.a; if (alpha < minimum_alpha) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl index 6a3cba771b..7d3b06c56e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl @@ -34,15 +34,18 @@ VARYING vec4 post_pos; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; +void passTextureIndex(); + void main() { //transform vertex vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0); - post_pos = pos; gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); + passTextureIndex(); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 60952ea38e..51110ae4df 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -35,7 +35,6 @@ uniform sampler2DRect positionMap; uniform sampler2DRect normalMap; uniform sampler2DRect lightMap; uniform sampler2DRect depthMap; -uniform sampler2D noiseMap; uniform samplerCube environmentMap; uniform sampler2D lightFunc; @@ -60,9 +59,7 @@ uniform vec4 distance_multiplier; uniform vec4 max_y; uniform vec4 glow; uniform float scene_light_strength; -uniform vec3 env_mat[3]; -//uniform mat4 shadow_matrix[3]; -//uniform vec4 shadow_clip; +uniform mat3 env_mat; uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; @@ -279,8 +276,7 @@ void main() vec3 pos = getPosition_d(tc, depth).xyz; vec3 norm = texture2DRect(normalMap, tc).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - //vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz; - + float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); vec4 diffuse = texture2DRect(diffuseRect, tc); @@ -309,6 +305,11 @@ void main() vec3 spec_contrib = dumbshiny * spec.rgb; bloom = dot(spec_contrib, spec_contrib); col += spec_contrib; + + //add environmentmap + vec3 env_vec = env_mat * refnormpersp; + col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb, + max(spec.a-diffuse.a*2.0, 0.0)); } col = atmosLighting(col); diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl index e014e53d25..5522e6c41d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl @@ -52,7 +52,7 @@ void main() vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); gl_FragData[0] = vec4(outColor.rgb, 0.0); - gl_FragData[1] = vec4(outColor.rgb*0.2, 0.2); + gl_FragData[1] = vec4(0,0,0,0); vec3 nvn = normalize(vary_normal); gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index 8d88e93698..1179b212ae 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -56,19 +56,6 @@ uniform float shadow_bias; uniform mat4 inv_proj; -vec4 getPosition(vec2 pos_screen) -{ - float depth = texture2DRect(depthMap, pos_screen.xy).a; - vec2 sc = pos_screen.xy*2.0; - sc /= screen_res; - sc -= vec2(1.0,1.0); - vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); - vec4 pos = inv_proj * ndc; - pos.xyz /= pos.w; - pos.w = 1.0; - return pos; -} - float pcfShadow(sampler2DRectShadow shadowMap, vec4 stc, float scl) { stc.xyz /= stc.w; diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index eb367d4ad6..97f3063a9e 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -34,7 +34,6 @@ uniform sampler2DRect specularRect; uniform sampler2DRect normalMap; uniform sampler2DRect lightMap; uniform sampler2DRect depthMap; -uniform sampler2D noiseMap; uniform samplerCube environmentMap; uniform sampler2D lightFunc; uniform vec3 gi_quad; @@ -60,7 +59,7 @@ uniform vec4 distance_multiplier; uniform vec4 max_y; uniform vec4 glow; uniform float scene_light_strength; -uniform vec3 env_mat[3]; +uniform mat3 env_mat; uniform vec4 shadow_clip; uniform mat3 ssao_effect_mat; @@ -279,8 +278,7 @@ void main() vec3 pos = getPosition_d(tc, depth).xyz; vec3 norm = texture2DRect(normalMap, tc).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - //vec3 nz = texture2D(noiseMap, vary_fragcoord.xy/128.0).xyz; - + float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); vec4 diffuse = texture2DRect(diffuseRect, tc); @@ -315,6 +313,11 @@ void main() vec3 spec_contrib = dumbshiny * spec.rgb; bloom = dot(spec_contrib, spec_contrib); col += spec_contrib; + + //add environmentmap + vec3 env_vec = env_mat * refnormpersp; + col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb, + max(spec.a-diffuse.a*2.0, 0.0)); } col = atmosLighting(col); diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index 6641c80b94..99dbfcae51 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -395,7 +395,7 @@ <attachment_point id="39" - group="9" + group="6" pie_slice="1" name="Neck" joint="mNeck" @@ -405,7 +405,7 @@ <attachment_point id="40" - group="9" + group="6" pie_slice="2" name="Avatar Center" joint="mRoot" diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 390da2273d..942c043081 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 31 +version 32 // The version number above should be implemented IF AND ONLY IF some // change has been made that is sufficiently important to justify // resetting the graphics preferences of all users to the recommended @@ -51,7 +51,7 @@ RenderTerrainLODFactor 1 2.0 RenderTransparentWater 1 1 RenderTreeLODFactor 1 1.0 RenderUseImpostors 1 1 -RenderVBOEnable 1 0 +RenderVBOEnable 1 1 RenderVBOMappingDisable 1 1 RenderVolumeLODFactor 1 2.0 UseStartScreen 1 1 @@ -67,7 +67,7 @@ RenderDeferred 1 1 RenderDeferredSSAO 1 1 RenderShadowDetail 1 2 WatchdogDisabled 1 1 -RenderUseStreamVBO 1 0 +RenderUseStreamVBO 1 1 RenderFSAASamples 1 16 RenderMaxTextureIndex 1 16 diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 401e9ef600..adbc55bf6c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1382,6 +1382,11 @@ bool LLAppViewer::mainLoop() } } gMeshRepo.update() ; + + if(!LLCurl::getCurlThread()->update(1)) + { + LLCurl::getCurlThread()->pause() ; //nothing in the curl thread. + } if(!total_work_pending) //pause texture fetching threads if nothing to process. { @@ -1777,6 +1782,7 @@ bool LLAppViewer::cleanup() pending += LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread pending += LLVFSThread::updateClass(0); pending += LLLFSThread::updateClass(0); + pending += LLCurl::getCurlThread()->update(1) ; F64 idle_time = idleTimer.getElapsedTimeF64(); if(!pending) { @@ -1788,6 +1794,7 @@ bool LLAppViewer::cleanup() break; } } + LLCurl::getCurlThread()->pause() ; // Delete workers first // shotdown all worker threads before deleting them in case of co-dependencies diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index a076374903..9626b93690 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -296,6 +296,13 @@ void LLIMWellChiclet::createMenu() void LLIMWellChiclet::messageCountChanged(const LLSD& session_data) { + // The singleton class LLChicletBar instance might be already deleted + // so don't create a new one. + if (!LLChicletBar::instanceExists()) + { + return; + } + const LLUUID& session_id = session_data["session_id"]; const S32 counter = LLChicletBar::getInstance()->getTotalUnreadIMCount(); const bool im_not_visible = !LLFloaterReg::instanceVisible("im_container") diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index ba511a3693..7d3170cb76 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -55,9 +55,23 @@ LLDebugView* gDebugView = NULL; static LLDefaultChildRegistry::Register<LLDebugView> r("debug_view"); LLDebugView::LLDebugView(const LLDebugView::Params& p) -: LLView(p) +: LLView(p), + mFastTimerView(NULL), + mMemoryView(NULL), + mDebugConsolep(NULL), + mFloaterSnapRegion(NULL) {} +LLDebugView::~LLDebugView() +{ + // These have already been deleted. Fix the globals appropriately. + gDebugView = NULL; + gTextureView = NULL; + gSceneView = NULL; + gTextureSizeView = NULL; + gTextureCategoryView = NULL; +} + void LLDebugView::init() { LLRect r; @@ -109,8 +123,6 @@ void LLDebugView::init() addChild(gTextureView); //gTextureView->reshape(r.getWidth(), r.getHeight(), TRUE); - - if(gAuditTexture) { @@ -136,22 +148,15 @@ void LLDebugView::init() } } - -LLDebugView::~LLDebugView() -{ - // These have already been deleted. Fix the globals appropriately. - gDebugView = NULL; - gTextureView = NULL; - gSceneView = NULL; - gTextureSizeView = NULL; - gTextureCategoryView = NULL; -} - void LLDebugView::draw() { - LLView* floater_snap_region = getRootView()->getChildView("floater_snap_region"); + if (mFloaterSnapRegion == NULL) + { + mFloaterSnapRegion = getRootView()->getChildView("floater_snap_region"); + } + LLRect debug_rect; - floater_snap_region->localRectToOtherView(floater_snap_region->getLocalRect(), &debug_rect, getParent()); + mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &debug_rect, getParent()); setShape(debug_rect); LLView::draw(); diff --git a/indra/newview/lldebugview.h b/indra/newview/lldebugview.h index 907a42c981..5aec77ad62 100644 --- a/indra/newview/lldebugview.h +++ b/indra/newview/lldebugview.h @@ -51,17 +51,19 @@ public: changeDefault(mouse_opaque, false); } }; + LLDebugView(const Params&); ~LLDebugView(); void init(); void draw(); - + void setStatsVisible(BOOL visible); LLFastTimerView* mFastTimerView; LLMemoryView* mMemoryView; LLConsole* mDebugConsolep; + LLView* mFloaterSnapRegion; }; extern LLDebugView* gDebugView; diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index c7acbb42c6..5a2981e749 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -133,7 +133,6 @@ public: PASS_ALPHA, PASS_ALPHA_MASK, PASS_FULLBRIGHT_ALPHA_MASK, - PASS_ALPHA_SHADOW, NUM_RENDER_TYPES, }; diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index d198e28c14..3165a3516c 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -97,25 +97,18 @@ void LLDrawPoolTree::render(S32 pass) LLGLState test(GL_ALPHA_TEST, LLGLSLShader::sNoFixedFunction ? 0 : 1); LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f); - if (gSavedSettings.getBOOL("RenderAnimateTrees")) - { - renderTree(); - } - else + gGL.getTexUnit(sDiffTex)->bind(mTexturep); + + for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) { - gGL.getTexUnit(sDiffTex)->bind(mTexturep); - - for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) + LLFace *face = *iter; + LLVertexBuffer* buff = face->getVertexBuffer(); + if(buff) { - LLFace *face = *iter; - LLVertexBuffer* buff = face->getVertexBuffer(); - if(buff) - { - buff->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK); - buff->drawRange(LLRender::TRIANGLES, 0, buff->getNumVerts()-1, buff->getNumIndices(), 0); - gPipeline.addTrianglesDrawn(buff->getNumIndices()); - } + buff->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK); + buff->drawRange(LLRender::TRIANGLES, 0, buff->getNumVerts()-1, buff->getNumIndices(), 0); + gPipeline.addTrianglesDrawn(buff->getNumIndices()); } } } @@ -187,133 +180,6 @@ void LLDrawPoolTree::endShadowPass(S32 pass) gDeferredTreeShadowProgram.unbind(); } - -void LLDrawPoolTree::renderTree(BOOL selecting) -{ - LLGLState normalize(GL_NORMALIZE, TRUE); - - // Bind the texture for this tree. - gGL.getTexUnit(sDiffTex)->bind(mTexturep.get(), TRUE); - - U32 indices_drawn = 0; - - gGL.matrixMode(LLRender::MM_MODELVIEW); - - for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - LLDrawable *drawablep = face->getDrawable(); - - if (drawablep->isDead() || !face->getVertexBuffer()) - { - continue; - } - - face->getVertexBuffer()->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK); - U16* indicesp = (U16*) face->getVertexBuffer()->getIndicesPointer(); - - // Render each of the trees - LLVOTree *treep = (LLVOTree *)drawablep->getVObj().get(); - - LLColor4U color(255,255,255,255); - - if (!selecting || treep->mGLName != 0) - { - if (selecting) - { - S32 name = treep->mGLName; - - color = LLColor4U((U8)(name >> 16), (U8)(name >> 8), (U8)name, 255); - } - - gGLLastMatrix = NULL; - gGL.loadMatrix(gGLModelView); - //gGL.pushMatrix(); - F32 mat[16]; - for (U32 i = 0; i < 16; i++) - mat[i] = (F32) gGLModelView[i]; - - LLMatrix4 matrix(mat); - - // Translate to tree base HACK - adjustment in Z plants tree underground - const LLVector3 &pos_agent = treep->getPositionAgent(); - //gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f); - LLMatrix4 trans_mat; - trans_mat.setTranslation(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f); - trans_mat *= matrix; - - // Rotate to tree position and bend for current trunk/wind - // Note that trunk stiffness controls the amount of bend at the trunk as - // opposed to the crown of the tree - // - const F32 TRUNK_STIFF = 22.f; - - LLQuaternion rot = - LLQuaternion(treep->mTrunkBend.magVec()*TRUNK_STIFF*DEG_TO_RAD, LLVector4(treep->mTrunkBend.mV[VX], treep->mTrunkBend.mV[VY], 0)) * - LLQuaternion(90.f*DEG_TO_RAD, LLVector4(0,0,1)) * - treep->getRotation(); - - LLMatrix4 rot_mat(rot); - rot_mat *= trans_mat; - - F32 radius = treep->getScale().magVec()*0.05f; - LLMatrix4 scale_mat; - scale_mat.mMatrix[0][0] = - scale_mat.mMatrix[1][1] = - scale_mat.mMatrix[2][2] = radius; - - scale_mat *= rot_mat; - - const F32 THRESH_ANGLE_FOR_BILLBOARD = 15.f; - const F32 BLEND_RANGE_FOR_BILLBOARD = 3.f; - - F32 droop = treep->mDroop + 25.f*(1.f - treep->mTrunkBend.magVec()); - - S32 stop_depth = 0; - F32 app_angle = treep->getAppAngle()*LLVOTree::sTreeFactor; - F32 alpha = 1.0; - S32 trunk_LOD = LLVOTree::sMAX_NUM_TREE_LOD_LEVELS; - - for (S32 j = 0; j < 4; j++) - { - - if (app_angle > LLVOTree::sLODAngles[j]) - { - trunk_LOD = j; - break; - } - } - if(trunk_LOD >= LLVOTree::sMAX_NUM_TREE_LOD_LEVELS) - { - continue ; //do not render. - } - - if (app_angle < (THRESH_ANGLE_FOR_BILLBOARD - BLEND_RANGE_FOR_BILLBOARD)) - { - // - // Draw only the billboard - // - // Only the billboard, can use closer to normal alpha func. - stop_depth = -1; - LLFacePool::LLOverrideFaceColor clr(this, color); - indices_drawn += treep->drawBranchPipeline(scale_mat, indicesp, trunk_LOD, stop_depth, treep->mDepth, treep->mTrunkDepth, 1.0, treep->mTwist, droop, treep->mBranches, alpha); - } - else // if (app_angle > (THRESH_ANGLE_FOR_BILLBOARD + BLEND_RANGE_FOR_BILLBOARD)) - { - // - // Draw only the full geometry tree - // - //stop_depth = (app_angle < THRESH_ANGLE_FOR_RECURSION_REDUCTION); - LLFacePool::LLOverrideFaceColor clr(this, color); - indices_drawn += treep->drawBranchPipeline(scale_mat, indicesp, trunk_LOD, stop_depth, treep->mDepth, treep->mTrunkDepth, 1.0, treep->mTwist, droop, treep->mBranches, alpha); - } - - //gGL.popMatrix(); - } - } -} - BOOL LLDrawPoolTree::verify() const { /* BOOL ok = TRUE; diff --git a/indra/newview/lldrawpooltree.h b/indra/newview/lldrawpooltree.h index ddb259bb82..e7e25453cf 100644 --- a/indra/newview/lldrawpooltree.h +++ b/indra/newview/lldrawpooltree.h @@ -68,9 +68,6 @@ public: /*virtual*/ LLColor3 getDebugColor() const; // For AGP debug display static S32 sDiffTex; - -private: - void renderTree(BOOL selecting = FALSE); }; #endif // LL_LLDRAWPOOLTREE_H diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index a09b9ea235..cece8d299c 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -37,6 +37,7 @@ #include "llselectmgr.h" #include "lltoolcomp.h" #include "lltoolmgr.h" +#include "lltrans.h" #include "llviewercontrol.h" #include "llviewerobject.h" #include "lluictrlfactory.h" @@ -166,6 +167,15 @@ LLUUID LLFloaterInspect::getSelectedUUID() return LLUUID::null; } +void LLFloaterInspect::onGetAvNameCallback(const LLUUID& idCreator, const LLAvatarName& av_name, void* FloaterPtr) +{ + if (FloaterPtr) + { + LLFloaterInspect* floater = (LLFloaterInspect*)FloaterPtr; + floater->dirty(); + } +} + void LLFloaterInspect::refresh() { LLUUID creator_id; @@ -205,11 +215,32 @@ void LLFloaterInspect::refresh() substitution["datetime"] = (S32) timestamp; LLStringUtil::format (timeStr, substitution); + const LLUUID& idOwner = obj->mPermissions->getOwner(); + const LLUUID& idCreator = obj->mPermissions->getCreator(); LLAvatarName av_name; - LLAvatarNameCache::get(obj->mPermissions->getOwner(), &av_name); - owner_name = av_name.getCompleteName(); - LLAvatarNameCache::get(obj->mPermissions->getCreator(), &av_name); - creator_name = av_name.getCompleteName(); + + // Only work with the names if we actually get a result + // from the name cache. If not, defer setting the + // actual name and set a placeholder. + if (LLAvatarNameCache::get(idOwner, &av_name)) + { + owner_name = av_name.getCompleteName(); + } + else + { + owner_name = LLTrans::getString("RetrievingData"); + LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this)); + } + + if (LLAvatarNameCache::get(idCreator, &av_name)) + { + creator_name = av_name.getCompleteName(); + } + else + { + creator_name = LLTrans::getString("RetrievingData"); + LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this)); + } row["id"] = obj->getObject()->getID(); row["columns"][0]["column"] = "object_name"; diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h index d9ffdf114b..7ee83ccdb4 100644 --- a/indra/newview/llfloaterinspect.h +++ b/indra/newview/llfloaterinspect.h @@ -29,6 +29,7 @@ #ifndef LL_LLFLOATERINSPECT_H #define LL_LLFLOATERINSPECT_H +#include "llavatarname.h" #include "llfloater.h" //class LLTool; @@ -53,6 +54,9 @@ public: void onClickCreatorProfile(); void onClickOwnerProfile(); void onSelectObject(); + + static void onGetAvNameCallback(const LLUUID& idCreator, const LLAvatarName& av_name, void* FloaterPtr); + LLScrollListCtrl* mObjectList; protected: // protected members diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 4d8d6d9a8c..64bdcccd9f 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1014,38 +1014,38 @@ void LLFloaterModelPreview::onPhysicsBrowse(LLUICtrl* ctrl, void* userdata) //static void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata) { - S32 num_modes = 4; - S32 which_mode = 3; - static S32 previous_mode = which_mode; + S32 num_lods = 4; + S32 which_mode; LLCtrlSelectionInterface* iface = sInstance->childGetSelectionInterface("physics_lod_combo"); if (iface) { which_mode = iface->getFirstSelectedIndex(); } + else + { + llwarns << "no iface" << llendl; + return; + } - S32 file_mode = iface->getItemCount() - 1; - bool file_browse = which_mode == file_mode; - bool lod_to_file = file_browse && (previous_mode != file_mode); - bool file_to_lod = !file_browse && (previous_mode == file_mode); - - if (!lod_to_file) + if (which_mode <= 0) { - which_mode = num_modes - which_mode; - sInstance->mModelPreview->setPhysicsFromLOD(which_mode); + llwarns << "which_mode out of range, " << which_mode << llendl; } - if (lod_to_file || file_to_lod) + S32 file_mode = iface->getItemCount() - 1; + if (which_mode < file_mode) { - LLModelPreview *model_preview = sInstance->mModelPreview; - if (model_preview) - { - model_preview->refresh(); - model_preview->updateStatusMessages(); - } + S32 which_lod = num_lods - which_mode; + sInstance->mModelPreview->setPhysicsFromLOD(which_lod); } - previous_mode = which_mode; + LLModelPreview *model_preview = sInstance->mModelPreview; + if (model_preview) + { + model_preview->refresh(); + model_preview->updateStatusMessages(); + } } //static diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index cfa35fa561..1b3290d5a8 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -100,9 +100,6 @@ S32 BORDER_WIDTH = 6; const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 -static std::string lastSnapshotWidthName(S32 shot_type); -static std::string lastSnapshotHeightName(S32 shot_type); - static LLDefaultChildRegistry::Register<LLSnapshotFloaterView> r("snapshot_floater_view"); ///---------------------------------------------------------------------------- @@ -138,7 +135,11 @@ public: /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); void setSize(S32 w, S32 h); + void setWidth(S32 w) { mWidth[mCurImageIndex] = w; } + void setHeight(S32 h) { mHeight[mCurImageIndex] = h; } void getSize(S32& w, S32& h) const; + S32 getWidth() const { return mWidth[mCurImageIndex]; } + S32 getHeight() const { return mHeight[mCurImageIndex]; } S32 getDataSize() const { return mDataSize; } void setMaxImageSize(S32 size) ; S32 getMaxImageSize() {return mMaxImageSize ;} @@ -155,8 +156,9 @@ public: LLViewerTexture* getCurrentImage(); F32 getImageAspect(); F32 getAspect() ; - LLRect getImageRect(); - BOOL isImageScaled(); + const LLRect& getImageRect() const { return mImageRect[mCurImageIndex]; } + BOOL isImageScaled() const { return mImageScaled[mCurImageIndex]; } + void setImageScaled(BOOL scaled) { mImageScaled[mCurImageIndex] = scaled; } const LLVector3d& getPosTakenGlobal() const { return mPosTakenGlobal; } void setSnapshotType(ESnapshotType type) { mSnapshotType = type; } @@ -171,6 +173,7 @@ public: LLPointer<LLImageFormatted> getFormattedImage() const { return mFormattedImage; } LLPointer<LLImageRaw> getEncodedImage() const { return mPreviewImageEncoded; } + /// Sets size of preview thumbnail image and thhe surrounding rect. BOOL setThumbnailImageSize() ; void generateThumbnailImage(BOOL force_update = FALSE) ; void resetThumbnailImage() { mThumbnailImage = NULL ; } @@ -299,7 +302,7 @@ LLViewerTexture* LLSnapshotLivePreview::getCurrentImage() F32 LLSnapshotLivePreview::getAspect() { - F32 image_aspect_ratio = ((F32)mWidth[mCurImageIndex]) / ((F32)mHeight[mCurImageIndex]); + F32 image_aspect_ratio = ((F32)getWidth()) / ((F32)getHeight()); F32 window_aspect_ratio = ((F32)getRect().getWidth()) / ((F32)getRect().getHeight()); if (!mKeepAspectRatio)//gSavedSettings.getBOOL("KeepAspectForSnapshot")) @@ -314,7 +317,7 @@ F32 LLSnapshotLivePreview::getAspect() F32 LLSnapshotLivePreview::getImageAspect() { - if (!mViewerImage[mCurImageIndex]) + if (!getCurrentImage()) { return 0.f; } @@ -322,33 +325,25 @@ F32 LLSnapshotLivePreview::getImageAspect() return getAspect() ; } -LLRect LLSnapshotLivePreview::getImageRect() -{ - return mImageRect[mCurImageIndex]; -} - -BOOL LLSnapshotLivePreview::isImageScaled() -{ - return mImageScaled[mCurImageIndex]; -} - void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail, F32 delay) { - lldebugs << "updateSnapshot: mSnapshotUpToDate = " << mSnapshotUpToDate << llendl; - if (mSnapshotUpToDate) + // Invalidate current image. + lldebugs << "updateSnapshot: mSnapshotUpToDate = " << getSnapshotUpToDate() << llendl; + if (getSnapshotUpToDate()) { S32 old_image_index = mCurImageIndex; mCurImageIndex = (mCurImageIndex + 1) % 2; - mWidth[mCurImageIndex] = mWidth[old_image_index]; - mHeight[mCurImageIndex] = mHeight[old_image_index]; + setWidth(mWidth[old_image_index]); + setHeight(mHeight[old_image_index]); mFallAnimTimer.start(); } mSnapshotUpToDate = FALSE; + // Update snapshot source rect depending on whether we keep the aspect ratio. LLRect& rect = mImageRect[mCurImageIndex]; rect.set(0, getRect().getHeight(), getRect().getWidth(), 0); - F32 image_aspect_ratio = ((F32)mWidth[mCurImageIndex]) / ((F32)mHeight[mCurImageIndex]); + F32 image_aspect_ratio = ((F32)getWidth()) / ((F32)getHeight()); F32 window_aspect_ratio = ((F32)getRect().getWidth()) / ((F32)getRect().getHeight()); if (mKeepAspectRatio)//gSavedSettings.getBOOL("KeepAspectForSnapshot")) @@ -369,13 +364,18 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail } } + // Stop shining animation. mShineAnimTimer.stop(); + + // Update snapshot if requested. if (new_snapshot) { mSnapshotDelayTimer.start(); mSnapshotDelayTimer.setTimerExpirySec(delay); LLFloaterSnapshot::preUpdate(); } + + // Update thumbnail if requested. if(new_thumbnail) { mThumbnailUpToDate = FALSE ; @@ -435,23 +435,23 @@ void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y) //called when the frame is frozen. void LLSnapshotLivePreview::draw() { - if (mViewerImage[mCurImageIndex].notNull() && + if (getCurrentImage() && mPreviewImageEncoded.notNull() && - mSnapshotUpToDate) + getSnapshotUpToDate()) { LLColor4 bg_color(0.f, 0.f, 0.3f, 0.4f); gl_rect_2d(getRect(), bg_color); - LLRect &rect = mImageRect[mCurImageIndex]; - LLRect shadow_rect = mImageRect[mCurImageIndex]; + const LLRect& rect = getImageRect(); + LLRect shadow_rect = rect; shadow_rect.stretch(BORDER_WIDTH); gl_drop_shadow(shadow_rect.mLeft, shadow_rect.mTop, shadow_rect.mRight, shadow_rect.mBottom, LLColor4(0.f, 0.f, 0.f, mNeedsFlash ? 0.f :0.5f), 10); LLColor4 image_color(1.f, 1.f, 1.f, 1.f); gGL.color4fv(image_color.mV); - gGL.getTexUnit(0)->bind(mViewerImage[mCurImageIndex]); + gGL.getTexUnit(0)->bind(getCurrentImage()); // calculate UV scale - F32 uv_width = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mWidth[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f); - F32 uv_height = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mHeight[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f); + F32 uv_width = isImageScaled() ? 1.f : llmin((F32)getWidth() / (F32)getCurrentImage()->getWidth(), 1.f); + F32 uv_height = isImageScaled() ? 1.f : llmin((F32)getHeight() / (F32)getCurrentImage()->getHeight(), 1.f); gGL.pushMatrix(); { gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f); @@ -491,6 +491,7 @@ void LLSnapshotLivePreview::draw() mFlashAlpha = lerp(mFlashAlpha, 0.f, LLCriticalDamp::getInterpolant(0.15f)); } + // Draw shining animation if appropriate. if (mShineCountdown > 0) { mShineCountdown--; @@ -501,6 +502,7 @@ void LLSnapshotLivePreview::draw() } else if (mShineAnimTimer.getStarted()) { + lldebugs << "Drawing shining animation" << llendl; F32 shine_interp = llmin(1.f, mShineAnimTimer.getElapsedTimeF32() / SHINE_TIME); // draw "shine" effect @@ -545,7 +547,7 @@ void LLSnapshotLivePreview::draw() { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f(1.f, 1.f, 1.f, 1.f); - LLRect outline_rect = mImageRect[mCurImageIndex]; + const LLRect& outline_rect = getImageRect(); gGL.begin(LLRender::QUADS); { gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); @@ -577,6 +579,7 @@ void LLSnapshotLivePreview::draw() S32 old_image_index = (mCurImageIndex + 1) % 2; if (mViewerImage[old_image_index].notNull() && mFallAnimTimer.getElapsedTimeF32() < FALL_TIME) { + lldebugs << "Drawing fall animation" << llendl; F32 fall_interp = mFallAnimTimer.getElapsedTimeF32() / FALL_TIME; F32 alpha = clamp_rescale(fall_interp, 0.f, 1.f, 0.8f, 0.4f); LLColor4 image_color(1.f, 1.f, 1.f, alpha); @@ -620,13 +623,14 @@ void LLSnapshotLivePreview::reshape(S32 width, S32 height, BOOL called_from_pare LLView::reshape(width, height, called_from_parent); if (old_rect.getWidth() != width || old_rect.getHeight() != height) { + lldebugs << "window reshaped, updating thumbnail" << llendl; updateSnapshot(FALSE, TRUE); } } BOOL LLSnapshotLivePreview::setThumbnailImageSize() { - if(mWidth[mCurImageIndex] < 10 || mHeight[mCurImageIndex] < 10) + if(getWidth() < 10 || getHeight() < 10) { return FALSE ; } @@ -662,11 +666,11 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize() S32 left = 0 , top = mThumbnailHeight, right = mThumbnailWidth, bottom = 0 ; if(!mKeepAspectRatio) { - F32 ratio_x = (F32)mWidth[mCurImageIndex] / window_width ; - F32 ratio_y = (F32)mHeight[mCurImageIndex] / window_height ; + F32 ratio_x = (F32)getWidth() / window_width ; + F32 ratio_y = (F32)getHeight() / window_height ; - //if(mWidth[mCurImageIndex] > window_width || - // mHeight[mCurImageIndex] > window_height ) + //if(getWidth() > window_width || + // getHeight() > window_height ) { if(ratio_x > ratio_y) { @@ -698,11 +702,11 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) { return ; } - if(mThumbnailUpToDate && !force_update)//already updated + if(getThumbnailUpToDate() && !force_update)//already updated { return ; } - if(mWidth[mCurImageIndex] < 10 || mHeight[mCurImageIndex] < 10) + if(getWidth() < 10 || getHeight() < 10) { return ; } @@ -750,15 +754,13 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) { LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview; - -#if 1 // XXX tmp - if (previewp->mWidth[previewp->mCurImageIndex] == 0 || previewp->mHeight[previewp->mCurImageIndex] == 0) + if (previewp->getWidth() == 0 || previewp->getHeight() == 0) { - llwarns << "Incorrect dimensions: " << previewp->mWidth[previewp->mCurImageIndex] << "x" << previewp->mHeight[previewp->mCurImageIndex] << llendl; + llwarns << "Incorrect dimensions: " << previewp->getWidth() << "x" << previewp->getHeight() << llendl; return FALSE; } -#endif + // If we're in freeze-frame mode and camera has moved, update snapshot. LLVector3 new_camera_pos = LLViewerCamera::getInstance()->getOrigin(); LLQuaternion new_camera_rot = LLViewerCamera::getInstance()->getQuaternion(); if (gSavedSettings.getBOOL("FreezeTime") && @@ -768,6 +770,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mCameraRot = new_camera_rot; // request a new snapshot whenever the camera moves, with a time delay BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot"); + lldebugs << "camera moved, updating thumbnail" << llendl; previewp->updateSnapshot( autosnap, // whether a new snapshot is needed or merely invalidate the existing one FALSE, // or if 1st arg is false, whether to produce a new thumbnail image. @@ -801,13 +804,13 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->setEnabled(FALSE); previewp->getWindow()->incBusyCount(); - previewp->mImageScaled[previewp->mCurImageIndex] = FALSE; + previewp->setImageScaled(FALSE); // grab the raw image and encode it into desired format if(gViewerWindow->rawSnapshot( previewp->mPreviewImage, - previewp->mWidth[previewp->mCurImageIndex], - previewp->mHeight[previewp->mCurImageIndex], + previewp->getWidth(), + previewp->getHeight(), previewp->mKeepAspectRatio,//gSavedSettings.getBOOL("KeepAspectForSnapshot"), previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_TEXTURE, gSavedSettings.getBOOL("RenderUIInSnapshot"), @@ -831,7 +834,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mPreviewImage->getComponents()); scaled->biasedScaleToPowerOfTwo(512); - previewp->mImageScaled[previewp->mCurImageIndex] = TRUE; + previewp->setImageScaled(TRUE); if (formatted->encode(scaled, 0.f)) { previewp->mDataSize = formatted->getDataSize(); @@ -886,7 +889,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) { // go ahead and shrink image to appropriate power of 2 for display scaled->biasedScaleToPowerOfTwo(1024); - previewp->mImageScaled[previewp->mCurImageIndex] = TRUE; + previewp->setImageScaled(TRUE); } else { @@ -933,14 +936,14 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) void LLSnapshotLivePreview::setSize(S32 w, S32 h) { lldebugs << "setSize(" << w << ", " << h << ")" << llendl; - mWidth[mCurImageIndex] = w; - mHeight[mCurImageIndex] = h; + setWidth(w); + setHeight(h); } void LLSnapshotLivePreview::getSize(S32& w, S32& h) const { - w = mWidth[mCurImageIndex]; - h = mHeight[mCurImageIndex]; + w = getWidth(); + h = getHeight(); } void LLSnapshotLivePreview::saveTexture() @@ -959,7 +962,7 @@ void LLSnapshotLivePreview::saveTexture() scaled->biasedScaleToPowerOfTwo(512); lldebugs << "scaled texture to " << scaled->getWidth() << "x" << scaled->getHeight() << llendl; - + if (formatted->encode(scaled, 0.0f)) { LLVFile::writeFile(formatted->getData(), formatted->getDataSize(), gVFS, new_asset_id, LLAssetType::AT_TEXTURE); @@ -1068,24 +1071,18 @@ public: static void onClickMore(void* data) ; static void onClickUICheck(LLUICtrl *ctrl, void* data); static void onClickHUDCheck(LLUICtrl *ctrl, void* data); -#if 0 - static void onClickKeepAspectCheck(LLUICtrl *ctrl, void* data); -#endif static void applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL checked); static void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE); static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data); static void onCommitLayerTypes(LLUICtrl* ctrl, void*data); static void onImageQualityChange(LLFloaterSnapshot* view, S32 quality_val); static void onImageFormatChange(LLFloaterSnapshot* view); -#if 0 - static void onCommitSnapshotType(LLUICtrl* ctrl, void* data); - static void onCommitCustomResolution(LLUICtrl *ctrl, void* data); -#endif static void applyCustomResolution(LLFloaterSnapshot* view, S32 w, S32 h); static void onSnapshotUploadFinished(bool status); static void onSendingPostcardFinished(bool status); - static void resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) ; static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value); + static void setImageSizeSpinnersValues(LLFloaterSnapshot *view, S32 width, S32 height) ; + static void updateSpinners(LLFloaterSnapshot* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed); static LLPanelSnapshot* getActivePanel(LLFloaterSnapshot* floater, bool ok_if_not_found = true); static LLSnapshotLivePreview::ESnapshotType getActiveSnapshotType(LLFloaterSnapshot* floater); @@ -1256,16 +1253,9 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) previewp->mKeepAspectRatio = TRUE; floaterp->getChild<LLComboBox>("profile_size_combo")->setCurrentByIndex(0); - gSavedSettings.setS32("SnapshotProfileLastResolution", 0); - floaterp->getChild<LLComboBox>("postcard_size_combo")->setCurrentByIndex(0); - gSavedSettings.setS32("SnapshotPostcardLastResolution", 0); - floaterp->getChild<LLComboBox>("texture_size_combo")->setCurrentByIndex(0); - gSavedSettings.setS32("SnapshotTextureLastResolution", 0); - floaterp->getChild<LLComboBox>("local_size_combo")->setCurrentByIndex(0); - gSavedSettings.setS32("SnapshotLocalLastResolution", 0); LLSnapshotLivePreview* previewp = getPreviewView(floaterp); previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); @@ -1349,19 +1339,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) floater->getChildView("share_to_web")->setVisible( gSavedSettings.getBOOL("SnapshotSharingEnabled")); #endif -#if 0 - floater->getChildView("postcard_size_combo")->setVisible( FALSE); - floater->getChildView("texture_size_combo")->setVisible( FALSE); - floater->getChildView("local_size_combo")->setVisible( FALSE); -#endif - - floater->getChild<LLComboBox>("profile_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotProfileLastResolution")); - floater->getChild<LLComboBox>("postcard_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotPostcardLastResolution")); - floater->getChild<LLComboBox>("texture_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotTextureLastResolution")); - floater->getChild<LLComboBox>("local_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution")); floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); - - // *TODO: Separate settings for Web images from postcards enableAspectRatioCheckbox(floater, !floater->impl.mAspectRatioCheckOff); setAspectRatioCheckboxValue(floater, gSavedSettings.getBOOL("KeepAspectForSnapshot")); floater->getChildView("layer_types")->setEnabled(shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); @@ -1375,19 +1353,20 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) // Initialize spinners. if (width_ctrl->getValue().asInteger() == 0) { - S32 w = gSavedSettings.getS32(lastSnapshotWidthName(shot_type)); + S32 w = gViewerWindow->getWindowWidthRaw(); lldebugs << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << llendl; width_ctrl->setValue(w); } if (height_ctrl->getValue().asInteger() == 0) { - S32 h = gSavedSettings.getS32(lastSnapshotHeightName(shot_type)); + S32 h = gViewerWindow->getWindowHeightRaw(); lldebugs << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << llendl; height_ctrl->setValue(h); } + // Сlamp snapshot resolution to window size when showing UI or HUD in snapshot. if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot")) - { //clamp snapshot resolution to window size when showing UI or HUD in snapshot + { S32 width = gViewerWindow->getWindowWidthRaw(); S32 height = gViewerWindow->getWindowHeightRaw(); @@ -1416,7 +1395,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); // *TODO: Separate maximum size for Web images from postcards - //lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; + lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; LLLocale locale(LLLocale::USER_LOCALE); std::string bytes_string; @@ -1441,6 +1420,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) && got_bytes && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); + // Update the width and height spinners based on the corresponding resolution combos. (?) switch(shot_type) { case LLSnapshotLivePreview::SNAPSHOT_WEB: @@ -1520,6 +1500,7 @@ void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, if (previewp) { BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot"); + lldebugs << "updating " << (autosnap ? "snapshot" : "thumbnail") << llendl; previewp->updateSnapshot(autosnap, update_thumbnail, autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); } } @@ -1532,6 +1513,7 @@ void LLFloaterSnapshot::Impl::onClickNewSnapshot(void* data) if (previewp && view) { view->impl.setStatus(Impl::STATUS_READY); + lldebugs << "updating snapshot" << llendl; previewp->updateSnapshot(TRUE); } } @@ -1559,17 +1541,8 @@ void LLFloaterSnapshot::Impl::onClickMore(void* data) { view->impl.setStatus(Impl::STATUS_READY); gSavedSettings.setBOOL("AdvanceSnapshot", !visible); -#if 0 - view->translate( 0, view->getUIWinHeightShort() - view->getUIWinHeightLong() ); - view->reshape(view->getRect().getWidth(), view->getUIWinHeightLong()); -#endif updateControls(view) ; updateLayout(view) ; - // *TODO: redundant? - if(getPreviewView(view)) - { - getPreviewView(view)->setThumbnailImageSize() ; - } } } @@ -1601,16 +1574,6 @@ void LLFloaterSnapshot::Impl::onClickHUDCheck(LLUICtrl *ctrl, void* data) } } -#if 0 -// static -void LLFloaterSnapshot::Impl::onClickKeepAspectCheck(LLUICtrl* ctrl, void* data) -{ - LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; - applyKeepAspectCheck(view, check->get()); -} -#endif - // static void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL checked) { @@ -1625,11 +1588,9 @@ void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL S32 w, h ; previewp->getSize(w, h) ; - if(checkImageSize(previewp, w, h, TRUE, previewp->getMaxImageSize())) - { - resetSnapshotSizeOnUI(view, w, h) ; - } + updateSpinners(view, previewp, w, h, TRUE); // may change w and h + lldebugs << "updating thumbnail" << llendl; previewp->setSize(w, h) ; previewp->updateSnapshot(FALSE, TRUE); checkAutoSnapshot(previewp, TRUE); @@ -1664,39 +1625,31 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde previewp->mKeepAspectRatio = FALSE ; return ; } - - if(0 == index) //current window size - { - view->impl.mAspectRatioCheckOff = true ; - enableAspectRatioCheckbox(view, FALSE); - if(previewp) - { - previewp->mKeepAspectRatio = TRUE ; - } + BOOL keep_aspect = FALSE, enable_cb = FALSE; + + if (0 == index) // current window size + { + enable_cb = FALSE; + keep_aspect = TRUE; } - else if(-1 == index) //custom + else if (-1 == index) // custom { - view->impl.mAspectRatioCheckOff = false ; - enableAspectRatioCheckbox(view, TRUE); - - if(previewp) - { - previewp->mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ; - } + enable_cb = TRUE; + keep_aspect = gSavedSettings.getBOOL("KeepAspectForSnapshot"); } - else + else // predefined resolution { - view->impl.mAspectRatioCheckOff = true ; - enableAspectRatioCheckbox(view, FALSE); - - if(previewp) - { - previewp->mKeepAspectRatio = FALSE ; - } + enable_cb = FALSE; + keep_aspect = FALSE; } - return ; + view->impl.mAspectRatioCheckOff = !enable_cb; + enableAspectRatioCheckbox(view, enable_cb); + if (previewp) + { + previewp->mKeepAspectRatio = keep_aspect; + } } // Show/hide upload progress indicators. @@ -1743,27 +1696,6 @@ void LLFloaterSnapshot::Impl::setFinished(LLFloaterSnapshot* floater, bool finis } } -static std::string lastSnapshotWidthName(S32 shot_type) -{ - switch (shot_type) - { - case LLSnapshotLivePreview::SNAPSHOT_WEB: return "LastSnapshotToProfileWidth"; - case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailWidth"; - case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: return "LastSnapshotToInventoryWidth"; - default: return "LastSnapshotToDiskWidth"; - } -} -static std::string lastSnapshotHeightName(S32 shot_type) -{ - switch (shot_type) - { - case LLSnapshotLivePreview::SNAPSHOT_WEB: return "LastSnapshotToProfileHeight"; - case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailHeight"; - case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: return "LastSnapshotToInventoryHeight"; - default: return "LastSnapshotToDiskHeight"; - } -} - // static void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update) { @@ -1776,12 +1708,6 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL return; } - // save off all selected resolution values - gSavedSettings.setS32("SnapshotProfileLastResolution", view->getChild<LLComboBox>("profile_size_combo")->getCurrentIndex()); - gSavedSettings.setS32("SnapshotPostcardLastResolution", view->getChild<LLComboBox>("postcard_size_combo")->getCurrentIndex()); - gSavedSettings.setS32("SnapshotTextureLastResolution", view->getChild<LLComboBox>("texture_size_combo")->getCurrentIndex()); - gSavedSettings.setS32("SnapshotLocalLastResolution", view->getChild<LLComboBox>("local_size_combo")->getCurrentIndex()); - std::string sdstring = combobox->getSelectedValue(); LLSD sdres; std::stringstream sstream(sdstring); @@ -1805,7 +1731,6 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL else if (width == -1 || height == -1) { // load last custom value -#if 1 S32 new_width = 0, new_height = 0; LLPanelSnapshot* spanel = getActivePanel(view); if (spanel) @@ -1816,23 +1741,14 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL } else { - const S32 shot_type = getActiveSnapshotType(view); - lldebugs << "Loading saved res for shot_type " << shot_type << llendl; - new_width = gSavedSettings.getS32(lastSnapshotWidthName(shot_type)); - new_height = gSavedSettings.getS32(lastSnapshotHeightName(shot_type)); + lldebugs << "No custom res chosen, setting preview res from window: " + << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << llendl; + new_width = gViewerWindow->getWindowWidthRaw(); + new_height = gViewerWindow->getWindowHeightRaw(); } llassert(new_width > 0 && new_height > 0); previewp->setSize(new_width, new_height); -#else - LLPanelSnapshot* spanel = getActivePanel(view); - if (spanel) - { - lldebugs << "Setting custom preview res : " << spanel->getTypedPreviewWidth() << "x" << spanel->getTypedPreviewHeight() << llendl; - previewp->setSize(spanel->getTypedPreviewWidth(), spanel->getTypedPreviewHeight()); - } - //previewp->setSize(gSavedSettings.getS32(lastSnapshotWidthName()), gSavedSettings.getS32(lastSnapshotHeightName())); -#endif } else { @@ -1851,11 +1767,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL height = llmin(height, gViewerWindow->getWindowHeightRaw()); } - - if(checkImageSize(previewp, width, height, TRUE, previewp->getMaxImageSize())) - { - resetSnapshotSizeOnUI(view, width, height) ; - } + updateSpinners(view, previewp, width, height, TRUE); // may change width and height if(getWidthSpinner(view)->getValue().asInteger() != width || getHeightSpinner(view)->getValue().asInteger() != height) { @@ -1869,9 +1781,11 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL // hide old preview as the aspect ratio could be wrong checkAutoSnapshot(previewp, FALSE); + lldebugs << "updating thumbnail" << llendl; getPreviewView(view)->updateSnapshot(FALSE, TRUE); if(do_update) { + lldebugs << "Will update controls" << llendl; updateControls(view); setNeedRefresh(view, true); } @@ -1914,93 +1828,29 @@ void LLFloaterSnapshot::Impl::onImageFormatChange(LLFloaterSnapshot* view) if (view) { gSavedSettings.setS32("SnapshotFormat", getImageFormat(view)); + lldebugs << "image format changed, updating snapshot" << llendl; getPreviewView(view)->updateSnapshot(TRUE); updateControls(view); setNeedRefresh(view, false); // we're refreshing } } -#if 0 -//static -void LLFloaterSnapshot::Impl::onCommitSnapshotType(LLUICtrl* ctrl, void* data) -{ - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; - if (view) - { - gSavedSettings.setS32("LastSnapshotType", getTypeIndex(view)); - getPreviewView(view)->updateSnapshot(TRUE); - updateControls(view); - } -} -#endif - // Sets the named size combo to "custom" mode. // static void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname) { LLComboBox* combo = floater->getChild<LLComboBox>(comboname); - combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index - - if(comboname == "postcard_size_combo") - { - gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex()); - } - else if(comboname == "profile_size_combo") - { - gSavedSettings.setS32("SnapshotProfileLastResolution", combo->getCurrentIndex()); - } - else if(comboname == "texture_size_combo") - { - gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex()); - } - else if(comboname == "local_size_combo") - { - gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex()); - } - checkAspectRatio(floater, -1); // -1 means custom } - - +// Update supplied width and height according to the constrain proportions flag; limit them by max_val. //static BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value) { S32 w = width ; S32 h = height ; - //if texture, ignore aspect ratio setting, round image size to power of 2. -#if 0 // Don't round texture sizes; textures are commonly stretched in world, profiles, etc and need to be "squashed" during upload, not cropped here - if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE == gSavedSettings.getS32("LastSnapshotType")) - { - if(width > max_value) - { - width = max_value ; - } - if(height > max_value) - { - height = max_value ; - } - - //round to nearest power of 2 based on the direction of movement - // i.e. higher power of two if increasing texture resolution - if(gSavedSettings.getS32("LastSnapshotToInventoryWidth") < width || - gSavedSettings.getS32("LastSnapshotToInventoryHeight") < height) - { - // Up arrow pressed - width = get_next_power_two(width, MAX_TEXTURE_SIZE) ; - height = get_next_power_two(height, MAX_TEXTURE_SIZE) ; - } - else - { - // Down or no change - width = get_lower_power_two(width, MAX_TEXTURE_SIZE) ; - height = get_lower_power_two(height, MAX_TEXTURE_SIZE) ; - } - } - else -#endif if(previewp && previewp->mKeepAspectRatio) { if(gViewerWindow->getWindowWidthRaw() < 1 || gViewerWindow->getWindowHeightRaw() < 1) @@ -2036,32 +1886,25 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3 } } } - else - { - } return (w != width || h != height) ; } //static -void LLFloaterSnapshot::Impl::resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) +void LLFloaterSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterSnapshot *view, S32 width, S32 height) { getWidthSpinner(view)->forceSetValue(width); getHeightSpinner(view)->forceSetValue(height); - gSavedSettings.setS32(lastSnapshotWidthName(getActiveSnapshotType(view)), width); - gSavedSettings.setS32(lastSnapshotHeightName(getActiveSnapshotType(view)), height); } -#if 0 -//static -void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* data) +// static +void LLFloaterSnapshot::Impl::updateSpinners(LLFloaterSnapshot* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed) { - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; - S32 w = llfloor((F32)getWidthSpinner(view)->getValue().asReal()); - S32 h = llfloor((F32)getHeightSpinner(view)->getValue().asReal()); - applyCustomResolution(view, w, h); + if (checkImageSize(previewp, width, height, is_width_changed, previewp->getMaxImageSize())) + { + setImageSizeSpinnersValues(view, width, height); + } } -#endif // static void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshot* view, S32 w, S32 h) @@ -2069,68 +1912,38 @@ void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshot* view, S32 bool need_refresh = false; lldebugs << "applyCustomResolution(" << w << ", " << h << ")" << llendl; - if (view) + if (!view) return; + + LLSnapshotLivePreview* previewp = getPreviewView(view); + if (previewp) { - LLSnapshotLivePreview* previewp = getPreviewView(view); - if (previewp) - { - S32 curw,curh; - previewp->getSize(curw, curh); - - if (w != curw || h != curh) - { - BOOL update_ = FALSE ; - //if to upload a snapshot, process spinner input in a special way. -#if 0 // Don't round texture sizes; textures are commonly stretched in world, profiles, etc and need to be "squashed" during upload, not cropped here - if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE == gSavedSettings.getS32("LastSnapshotType")) - { - S32 spinner_increment = (S32)((LLSpinCtrl*)ctrl)->getIncrement() ; - S32 dw = w - curw ; - S32 dh = h - curh ; - dw = (dw == spinner_increment) ? 1 : ((dw == -spinner_increment) ? -1 : 0) ; - dh = (dh == spinner_increment) ? 1 : ((dh == -spinner_increment) ? -1 : 0) ; - - if(dw) - { - w = (dw > 0) ? curw << dw : curw >> -dw ; - update_ = TRUE ; - } - if(dh) - { - h = (dh > 0) ? curh << dh : curh >> -dh ; - update_ = TRUE ; - } - } -#endif - previewp->setMaxImageSize((S32) getWidthSpinner(view)->getMaxValue()) ; - - // Check image size changes the value of height and width - if(checkImageSize(previewp, w, h, w != curw, previewp->getMaxImageSize()) - || update_) - { - resetSnapshotSizeOnUI(view, w, h) ; - } + S32 curw,curh; + previewp->getSize(curw, curh); - previewp->setSize(w,h); - checkAutoSnapshot(previewp, FALSE); - previewp->updateSnapshot(FALSE, TRUE); - comboSetCustom(view, "profile_size_combo"); - comboSetCustom(view, "postcard_size_combo"); - comboSetCustom(view, "texture_size_combo"); - comboSetCustom(view, "local_size_combo"); - need_refresh = true; - } - } + if (w != curw || h != curh) + { + //if to upload a snapshot, process spinner input in a special way. + previewp->setMaxImageSize((S32) getWidthSpinner(view)->getMaxValue()) ; - gSavedSettings.setS32(lastSnapshotWidthName(getActiveSnapshotType(view)), w); - gSavedSettings.setS32(lastSnapshotHeightName(getActiveSnapshotType(view)), h); + updateSpinners(view, previewp, w, h, w != curw); // may change w and h - updateControls(view); - if (need_refresh) - { - setNeedRefresh(view, true); // need to do this after updateControls() + previewp->setSize(w,h); + checkAutoSnapshot(previewp, FALSE); + lldebugs << "applied custom resolution, updating thumbnail" << llendl; + previewp->updateSnapshot(FALSE, TRUE); + comboSetCustom(view, "profile_size_combo"); + comboSetCustom(view, "postcard_size_combo"); + comboSetCustom(view, "texture_size_combo"); + comboSetCustom(view, "local_size_combo"); + need_refresh = true; } } + + updateControls(view); + if (need_refresh) + { + setNeedRefresh(view, true); // need to do this after updateControls() + } } // static @@ -2186,10 +1999,6 @@ BOOL LLFloaterSnapshot::postBuild() LLWebSharing::instance().init(); } -#if 0 - childSetCommitCallback("snapshot_type_radio", Impl::onCommitSnapshotType, this); -#endif - mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn"); childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this); mRefreshLabel = getChild<LLUICtrl>("refresh_lbl"); @@ -2198,31 +2007,18 @@ BOOL LLFloaterSnapshot::postBuild() childSetAction("advanced_options_btn", Impl::onClickMore, this); -#if 0 - childSetCommitCallback("snapshot_width", Impl::onCommitCustomResolution, this); - childSetCommitCallback("snapshot_height", Impl::onCommitCustomResolution, this); -#endif - childSetCommitCallback("ui_check", Impl::onClickUICheck, this); getChild<LLUICtrl>("ui_check")->setValue(gSavedSettings.getBOOL("RenderUIInSnapshot")); childSetCommitCallback("hud_check", Impl::onClickHUDCheck, this); getChild<LLUICtrl>("hud_check")->setValue(gSavedSettings.getBOOL("RenderHUDInSnapshot")); -#if 0 - childSetCommitCallback("keep_aspect_check", Impl::onClickKeepAspectCheck, this); -#endif impl.setAspectRatioCheckboxValue(this, gSavedSettings.getBOOL("KeepAspectForSnapshot")); childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this); getChild<LLUICtrl>("layer_types")->setValue("colors"); getChildView("layer_types")->setEnabled(FALSE); -#if 0 // leads to crash later if one of the settings values is 0 - impl.getWidthSpinner(this)->setValue(gSavedSettings.getS32(lastSnapshotWidthName())); - impl.getHeightSpinner(this)->setValue(gSavedSettings.getS32(lastSnapshotHeightName())); -#endif - getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame")); childSetCommitCallback("freeze_frame_check", Impl::onCommitFreezeFrame, this); @@ -2341,6 +2137,7 @@ void LLFloaterSnapshot::onOpen(const LLSD& key) LLSnapshotLivePreview* preview = LLFloaterSnapshot::Impl::getPreviewView(this); if(preview) { + lldebugs << "opened, updating snapshot" << llendl; preview->updateSnapshot(TRUE); } focusFirstItem(FALSE); @@ -2422,6 +2219,7 @@ void LLFloaterSnapshot::update() return; BOOL changed = FALSE; + lldebugs << "npreviews: " << LLSnapshotLivePreview::sList.size() << llendl; for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin(); iter != LLSnapshotLivePreview::sList.end(); ++iter) { @@ -2429,6 +2227,7 @@ void LLFloaterSnapshot::update() } if(changed) { + lldebugs << "changed" << llendl; inst->impl.updateControls(inst); } } diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp index 959edff713..428a02e9f0 100644 --- a/indra/newview/llfloatertranslationsettings.cpp +++ b/indra/newview/llfloatertranslationsettings.cpp @@ -29,6 +29,7 @@ #include "llfloatertranslationsettings.h" // Viewer includes +#include "llnearbychatbar.h" #include "lltranslate.h" #include "llviewercontrol.h" // for gSavedSettings @@ -292,5 +293,6 @@ void LLFloaterTranslationSettings::onBtnOK() gSavedSettings.setString("TranslationService", getSelectedService()); gSavedSettings.setString("BingTranslateAPIKey", getEnteredBingKey()); gSavedSettings.setString("GoogleTranslateAPIKey", getEnteredGoogleKey()); + LLNearbyChatBar::getInstance()->enableTranslationCheckbox(LLTranslate::isTranslationConfigured()); closeFloater(false); } diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index f3beacea4f..3b5c3663fb 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -55,6 +55,15 @@ LLFloaterWebContent::_Params::_Params() LLFloaterWebContent::LLFloaterWebContent( const Params& params ) : LLFloater( params ), LLInstanceTracker<LLFloaterWebContent, std::string>(params.id()), + mWebBrowser(NULL), + mAddressCombo(NULL), + mSecureLockIcon(NULL), + mStatusBarText(NULL), + mStatusBarProgress(NULL), + mBtnBack(NULL), + mBtnForward(NULL), + mBtnReload(NULL), + mBtnStop(NULL), mUUID(params.id()), mShowPageTitle(params.show_page_title) { @@ -74,11 +83,16 @@ BOOL LLFloaterWebContent::postBuild() mStatusBarText = getChild< LLTextBox >( "statusbartext" ); mStatusBarProgress = getChild<LLProgressBar>("statusbarprogress" ); + mBtnBack = getChildView( "back" ); + mBtnForward = getChildView( "forward" ); + mBtnReload = getChildView( "reload" ); + mBtnStop = getChildView( "stop" ); + // observe browser events mWebBrowser->addObserver( this ); // these buttons are always enabled - getChildView("reload")->setEnabled( true ); + mBtnReload->setEnabled( true ); getChildView("popexternal")->setEnabled( true ); // cache image for secure browsing @@ -281,8 +295,8 @@ void LLFloaterWebContent::onClose(bool app_quitting) void LLFloaterWebContent::draw() { // this is asynchronous so we need to keep checking - getChildView( "back" )->setEnabled( mWebBrowser->canNavigateBack() ); - getChildView( "forward" )->setEnabled( mWebBrowser->canNavigateForward() ); + mBtnBack->setEnabled( mWebBrowser->canNavigateBack() ); + mBtnForward->setEnabled( mWebBrowser->canNavigateForward() ); LLFloater::draw(); } @@ -302,12 +316,12 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent else if(event == MEDIA_EVENT_NAVIGATE_BEGIN) { // flags are sent with this event - getChildView("back")->setEnabled( self->getHistoryBackAvailable() ); - getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() ); + mBtnBack->setEnabled( self->getHistoryBackAvailable() ); + mBtnForward->setEnabled( self->getHistoryForwardAvailable() ); // toggle visibility of these buttons based on browser state - getChildView("reload")->setVisible( false ); - getChildView("stop")->setVisible( true ); + mBtnReload->setVisible( false ); + mBtnStop->setVisible( true ); // turn "on" progress bar now we're about to start loading mStatusBarProgress->setVisible( true ); @@ -315,12 +329,12 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent else if(event == MEDIA_EVENT_NAVIGATE_COMPLETE) { // flags are sent with this event - getChildView("back")->setEnabled( self->getHistoryBackAvailable() ); - getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() ); + mBtnBack->setEnabled( self->getHistoryBackAvailable() ); + mBtnForward->setEnabled( self->getHistoryForwardAvailable() ); // toggle visibility of these buttons based on browser state - getChildView("reload")->setVisible( true ); - getChildView("stop")->setVisible( false ); + mBtnReload->setVisible( true ); + mBtnStop->setVisible( false ); // turn "off" progress bar now we're loaded mStatusBarProgress->setVisible( false ); @@ -426,8 +440,8 @@ void LLFloaterWebContent::onClickStop() // still should happen when we catch the navigate complete event // but sometimes (don't know why) that event isn't sent from Qt // and we ghetto a point where the stop button stays active. - getChildView("reload")->setVisible( true ); - getChildView("stop")->setVisible( false ); + mBtnReload->setVisible( true ); + mBtnStop->setVisible( false ); } void LLFloaterWebContent::onEnterAddress() diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h index 2a2a9e110b..cfc87e9015 100644 --- a/indra/newview/llfloaterwebcontent.h +++ b/indra/newview/llfloaterwebcontent.h @@ -99,6 +99,12 @@ protected: LLIconCtrl* mSecureLockIcon; LLTextBox* mStatusBarText; LLProgressBar* mStatusBarProgress; + + LLView* mBtnBack; + LLView* mBtnForward; + LLView* mBtnReload; + LLView* mBtnStop; + std::string mCurrentURL; std::string mUUID; bool mShowPageTitle; diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 74fa5d350a..7650fe9229 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -133,10 +133,15 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : navigateHome(); } - // FIXME: How do we create a bevel now? -// LLRect border_rect( 0, getRect().getHeight() + 2, getRect().getWidth() + 2, 0 ); -// mBorder = new LLViewBorder( std::string("web control border"), border_rect, LLViewBorder::BEVEL_IN ); -// addChild( mBorder ); + LLWindowShade::Params params; + params.name = "notification_shade"; + params.rect = getLocalRect(); + params.follows.flags = FOLLOWS_ALL; + params.modal = true; + + mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params); + + addChild(mWindowShade); } LLMediaCtrl::~LLMediaCtrl() @@ -1092,39 +1097,28 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response) void LLMediaCtrl::showNotification(LLNotificationPtr notify) { - delete mWindowShade; + LLWindowShade* shade = getChild<LLWindowShade>("notification_shade"); - LLWindowShade::Params params; - params.name = "notification_shade"; - params.rect = getLocalRect(); - params.follows.flags = FOLLOWS_ALL; - params.notification = notify; - params.modal = true; - //HACK: don't hardcode this if (notify->getIcon() == "Popup_Caution") { - params.bg_image.name = "Yellow_Gradient"; - params.text_color = LLColor4::black; + shade->setBackgroundImage(LLUI::getUIImage("Yellow_Gradient")); + shade->setTextColor(LLColor4::black); + shade->setCanClose(true); } - else - //HACK: another one since XUI doesn't support what we need right now - if (notify->getName() == "AuthRequest") + else if (notify->getName() == "AuthRequest") { - params.bg_image.name = "Yellow_Gradient"; - params.text_color = LLColor4::black; - params.can_close = false; + shade->setBackgroundImage(LLUI::getUIImage("Yellow_Gradient")); + shade->setTextColor(LLColor4::black); + shade->setCanClose(false); } else { //HACK: make this a property of the notification itself, "cancellable" - params.can_close = false; - params.text_color.control = "LabelTextColor"; + shade->setCanClose(false); + shade->setTextColor(LLUIColorTable::instance().getColor("LabelTextColor")); } - mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params); - - addChild(mWindowShade); - mWindowShade->show(); + mWindowShade->show(notify); } void LLMediaCtrl::hideNotification() diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 114472ba56..eec0965384 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -48,6 +48,7 @@ #include "llrootview.h" #include "llviewerchat.h" #include "llnearbychat.h" +#include "lltranslate.h" #include "llresizehandle.h" @@ -71,9 +72,14 @@ static LLChatTypeTrigger sChatTypeTriggers[] = { }; LLNearbyChatBar::LLNearbyChatBar(const LLSD& key) - : LLFloater(key), - mChatBox(NULL) -{ mSpeakerMgr = LLLocalSpeakerMgr::getInstance(); +: LLFloater(key), + mChatBox(NULL), + mNearbyChat(NULL), + mOutputMonitor(NULL), + mSpeakerMgr(NULL), + mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT) +{ + mSpeakerMgr = LLLocalSpeakerMgr::getInstance(); } //virtual @@ -95,6 +101,7 @@ BOOL LLNearbyChatBar::postBuild() mChatBox->setEnableLineHistory(TRUE); mChatBox->setFont(LLViewerChat::getChatFont()); + mNearbyChat = getChildView("nearby_chat"); LLUICtrl* show_btn = getChild<LLUICtrl>("show_nearby_chat"); show_btn->setCommitCallback(boost::bind(&LLNearbyChatBar::onToggleNearbyChatPanel, this)); @@ -105,19 +112,22 @@ BOOL LLNearbyChatBar::postBuild() // Register for font change notifications LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChatBar::onChatFontChange, this, _1)); - mExpandedHeight = COLLAPSED_HEIGHT + EXPANDED_HEIGHT; - enableResizeCtrls(true, true, false); return TRUE; } +// virtual +void LLNearbyChatBar::onOpen(const LLSD& key) +{ + enableTranslationCheckbox(LLTranslate::isTranslationConfigured()); +} + bool LLNearbyChatBar::applyRectControl() { bool rect_controlled = LLFloater::applyRectControl(); - LLView* nearby_chat = getChildView("nearby_chat"); - if (!nearby_chat->getVisible()) + if (!mNearbyChat->getVisible()) { reshape(getRect().getWidth(), getMinHeight()); enableResizeCtrls(true, true, false); @@ -156,6 +166,11 @@ void LLNearbyChatBar::showHistory() } } +void LLNearbyChatBar::enableTranslationCheckbox(BOOL enable) +{ + getChild<LLUICtrl>("translate_chat_checkbox")->setEnabled(enable); +} + void LLNearbyChatBar::draw() { displaySpeakingIndicator(); diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h index e9734899b3..baf12a06ea 100644 --- a/indra/newview/llnearbychatbar.h +++ b/indra/newview/llnearbychatbar.h @@ -43,6 +43,7 @@ public: ~LLNearbyChatBar() {} virtual BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); static LLNearbyChatBar* getInstance(); @@ -60,6 +61,7 @@ public: static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); void showHistory(); + void enableTranslationCheckbox(BOOL enable); /*virtual*/void setMinimized(BOOL b); protected: @@ -84,9 +86,10 @@ protected: // Which non-zero channel did we last chat on? static S32 sLastSpecialChatChannel; - LLLineEditor* mChatBox; - LLOutputMonitorCtrl* mOutputMonitor; - LLLocalSpeakerMgr* mSpeakerMgr; + LLLineEditor* mChatBox; + LLView* mNearbyChat; + LLOutputMonitorCtrl* mOutputMonitor; + LLLocalSpeakerMgr* mSpeakerMgr; S32 mExpandedHeight; }; diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index 9c3887377a..240a7c7a35 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -366,12 +366,15 @@ void LLNearbyChatScreenChannel::arrangeToasts() if(mStopProcessing || isHovering()) return; - LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region"); - + if (mFloaterSnapRegion == NULL) + { + mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + } + if (!getParent()) { // connect to floater snap region just to get resize events, we don't care about being a proper widget - floater_snap_region->addChild(this); + mFloaterSnapRegion->addChild(this); setFollows(FOLLOWS_ALL); } @@ -379,7 +382,7 @@ void LLNearbyChatScreenChannel::arrangeToasts() updateRect(); LLRect channel_rect; - floater_snap_region->localRectToOtherView(floater_snap_region->getLocalRect(), &channel_rect, gFloaterView); + mFloaterSnapRegion->localRectToOtherView(mFloaterSnapRegion->getLocalRect(), &channel_rect, gFloaterView); channel_rect.mLeft += 10; channel_rect.mRight = channel_rect.mLeft + 300; diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp deleted file mode 100644 index c2bbec0470..0000000000 --- a/indra/newview/lloverlaybar.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/** - * @file lloverlaybar.cpp - * @brief LLOverlayBar class implementation - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// Temporary buttons that appear at the bottom of the screen when you -// are in a mode. - -#include "llviewerprecompiledheaders.h" - -#include "lloverlaybar.h" - -#include "llaudioengine.h" -#include "llrender.h" -#include "llagent.h" -#include "llbutton.h" -#include "llfocusmgr.h" -#include "llimview.h" -#include "llmediaremotectrl.h" -#include "llparcel.h" -#include "lltextbox.h" -#include "llui.h" -#include "llviewercontrol.h" -#include "llviewertexturelist.h" -#include "llviewerjoystick.h" -#include "llviewermedia.h" -#include "llviewermenu.h" // handle_reset_view() -#include "llviewermedia.h" -#include "llviewerparcelmedia.h" -#include "llviewerparcelmgr.h" -#include "lluictrlfactory.h" -#include "llviewerwindow.h" -#include "llvoiceclient.h" -#include "llvoavatarself.h" -#include "llvoiceremotectrl.h" -#include "llmediactrl.h" -#include "llselectmgr.h" - -// -// Globals -// - -LLOverlayBar *gOverlayBar = NULL; - -extern S32 MENU_BAR_HEIGHT; - -// -// Functions -// - - - -void* LLOverlayBar::createMediaRemote(void* userdata) -{ - LLOverlayBar *self = (LLOverlayBar*)userdata; - self->mMediaRemote = new LLMediaRemoteCtrl (); - return self->mMediaRemote; -} - -void* LLOverlayBar::createVoiceRemote(void* userdata) -{ - LLOverlayBar *self = (LLOverlayBar*)userdata; - self->mVoiceRemote = new LLVoiceRemoteCtrl(); - return self->mVoiceRemote; -} - -LLOverlayBar::LLOverlayBar() - : LLPanel(), - mMediaRemote(NULL), - mVoiceRemote(NULL), - mMusicState(STOPPED) -{ - setMouseOpaque(FALSE); - setIsChrome(TRUE); - - mBuilt = false; - - mFactoryMap["media_remote"] = LLCallbackMap(LLOverlayBar::createMediaRemote, this); - mFactoryMap["voice_remote"] = LLCallbackMap(LLOverlayBar::createVoiceRemote, this); - - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml"); -} - -BOOL LLOverlayBar::postBuild() -{ - childSetAction("Set Not Busy",onClickSetNotBusy,this); - childSetAction("Mouselook",onClickMouselook,this); - childSetAction("Stand Up",onClickStandUp,this); - childSetAction("Flycam",onClickFlycam,this); - childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible")); - - mVoiceRemote->expandOrCollapse(); - mMediaRemote->expandOrCollapse(); - - setFocusRoot(TRUE); - mBuilt = true; - - layoutButtons(); - return TRUE; -} - -LLOverlayBar::~LLOverlayBar() -{ - // LLView destructor cleans up children -} - -// virtual -void LLOverlayBar::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - LLView::reshape(width, height, called_from_parent); - - if (mBuilt) - { - layoutButtons(); - } -} - -void LLOverlayBar::layoutButtons() -{ - LLView* state_buttons_panel = getChildView("state_buttons"); - - if (state_buttons_panel->getVisible()) - { - LLViewQuery query; - LLWidgetTypeFilter<LLButton> widget_filter; - query.addPreFilter(LLEnabledFilter::getInstance()); - query.addPreFilter(&widget_filter); - - child_list_t button_list = query(state_buttons_panel); - - const S32 MAX_BAR_WIDTH = 600; - S32 bar_width = llclamp(state_buttons_panel->getRect().getWidth(), 0, MAX_BAR_WIDTH); - - // calculate button widths - const S32 MAX_BUTTON_WIDTH = 150; - const S32 STATUS_BAR_PAD = 10; - S32 segment_width = llclamp(lltrunc((F32)(bar_width) / (F32)button_list.size()), 0, MAX_BUTTON_WIDTH); - S32 btn_width = segment_width - STATUS_BAR_PAD; - - // Evenly space all buttons, starting from left - S32 left = 0; - S32 bottom = 1; - - for (child_list_reverse_iter_t child_iter = button_list.rbegin(); - child_iter != button_list.rend(); ++child_iter) - { - LLView *view = *child_iter; - LLRect r = view->getRect(); - r.setOriginAndSize(left, bottom, btn_width, r.getHeight()); - view->setRect(r); - left += segment_width; - } - } -} - -// Per-frame updates of visibility -void LLOverlayBar::refresh() -{ - BOOL buttons_changed = FALSE; - - BOOL im_received = gIMMgr->getIMReceived(); - LLButton* button = getChild<LLButton>("IM Received"); - if (button && button->getVisible() != im_received) - { - button->setVisible(im_received); - sendChildToFront(button); - moveChildToBackOfTabGroup(button); - buttons_changed = TRUE; - } - - BOOL busy = gAgent.getBusy(); - button = getChild<LLButton>("Set Not Busy"); - if (button && button->getVisible() != busy) - { - button->setVisible(busy); - sendChildToFront(button); - moveChildToBackOfTabGroup(button); - buttons_changed = TRUE; - } - - BOOL flycam = LLViewerJoystick::getInstance()->getOverrideCamera(); - button = getChild<LLButton>("Flycam"); - if (button && button->getVisible() != flycam) - { - button->setVisible(flycam); - sendChildToFront(button); - moveChildToBackOfTabGroup(button); - buttons_changed = TRUE; - } - - BOOL mouselook_grabbed; - mouselook_grabbed = gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX) - || gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX); - button = getChild<LLButton>("Mouselook"); - - if (button && button->getVisible() != mouselook_grabbed) - { - button->setVisible(mouselook_grabbed); - sendChildToFront(button); - moveChildToBackOfTabGroup(button); - buttons_changed = TRUE; - } - - BOOL sitting = FALSE; - if (gAgent.getAvatarObject()) - { - sitting = gAgent.getAvatarObject()->isSitting(); - } - button = getChild<LLButton>("Stand Up"); - - if (button && button->getVisible() != sitting) - { - button->setVisible(sitting); - sendChildToFront(button); - moveChildToBackOfTabGroup(button); - buttons_changed = TRUE; - } - - - moveChildToBackOfTabGroup(mMediaRemote); - moveChildToBackOfTabGroup(mVoiceRemote); - - // turn off the whole bar in mouselook - if (gAgent.cameraMouselook()) - { - childSetVisible("media_remote_container", FALSE); - childSetVisible("voice_remote_container", FALSE); - childSetVisible("state_buttons", FALSE); - } - else - { - // update "remotes" - childSetVisible("media_remote_container", TRUE); - childSetVisible("voice_remote_container", LLVoiceClient::getInstance()->voiceEnabled()); - childSetVisible("state_buttons", TRUE); - } - - // always let user toggle into and out of chatbar - childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible")); - - if (buttons_changed) - { - layoutButtons(); - } -} - -//----------------------------------------------------------------------- -// Static functions -//----------------------------------------------------------------------- - -// static -void LLOverlayBar::onClickSetNotBusy(void*) -{ - gAgent.clearBusy(); -} - - -// static -void LLOverlayBar::onClickFlycam(void*) -{ - LLViewerJoystick::getInstance()->toggleFlycam(); -} - -// static -void LLOverlayBar::onClickResetView(void* data) -{ - handle_reset_view(); -} - -//static -void LLOverlayBar::onClickMouselook(void*) -{ - gAgent.changeCameraToMouselook(); -} - -//static -void LLOverlayBar::onClickStandUp(void*) -{ - LLSelectMgr::getInstance()->deselectAllForStandingUp(); - gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); -} - -//////////////////////////////////////////////////////////////////////////////// -// static media helpers -// *TODO: Move this into an audio manager abstraction -//static -void LLOverlayBar::mediaStop(void*) -{ - if (!gOverlayBar) - { - // return; - } - LLViewerParcelMedia::stop(); -} -//static -void LLOverlayBar::toggleMediaPlay(void*) -{ - if (!gOverlayBar) - { - // return; - } - - - if (LLViewerParcelMedia::getStatus() == LLViewerMediaImpl::MEDIA_PAUSED) - { - LLViewerParcelMedia::start(); - } - else if(LLViewerParcelMedia::getStatus() == LLViewerMediaImpl::MEDIA_PLAYING) - { - LLViewerParcelMedia::pause(); - } - else - { - LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - if (parcel) - { - LLViewerParcelMedia::play(parcel); - } - } -} - -//static -void LLOverlayBar::toggleMusicPlay(void*) -{ - if (gAudiop->isInternetStreamPlaying() != 1) - { - if (gAudiop) - { - LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - if ( parcel ) - { - // this doesn't work properly when crossing parcel boundaries - even when the - // stream is stopped, it doesn't return the right thing - commenting out for now. - // if ( gAudiop->isInternetStreamPlaying() == 0 ) - { - gAudiop->startInternetStream(parcel->getMusicURL()); - } - } - } - } - //else - //{ - // gOverlayBar->mMusicState = PAUSED; // desired state - // if (gAudiop) - // { - // gAudiop->pauseInternetStream(1); - // } - //} - else - { - if (gAudiop) - { - gAudiop->stopInternetStream(); - } - } -} - diff --git a/indra/newview/lloverlaybar.h b/indra/newview/lloverlaybar.h deleted file mode 100644 index b36f5ebb73..0000000000 --- a/indra/newview/lloverlaybar.h +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @file lloverlaybar.h - * @brief LLOverlayBar class definition - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLOVERLAYBAR_H -#define LL_LLOVERLAYBAR_H - -#include "llpanel.h" - -// "Constants" loaded from settings.xml at start time -extern S32 STATUS_BAR_HEIGHT; - -class LLButton; -class LLLineEditor; -class LLMediaRemoteCtrl; -class LLMessageSystem; -class LLTextBox; -class LLTextEditor; -class LLUICtrl; -class LLUUID; -class LLFrameTimer; -class LLStatGraph; -class LLSlider; -class LLVoiceRemoteCtrl; - -class LLOverlayBar -: public LLPanel -{ -public: - LLOverlayBar(); - ~LLOverlayBar(); - - /*virtual*/ void refresh(); - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - /*virtual*/ BOOL postBuild(); - - void layoutButtons(); - - // helpers for returning desired state - BOOL musicPlaying() { return mMusicState == PLAYING; } - - static void onClickSetNotBusy(void* data); - static void onClickMouselook(void* data); - static void onClickStandUp(void* data); - static void onClickResetView(void* data); - static void onClickFlycam(void* data); - - //static media helper functions - static void toggleMediaPlay(void*); - static void toggleMusicPlay(void*); - static void musicPause(void*); - static void musicStop(void*); - static void mediaStop(void*); - - static void toggleAudioVolumeFloater(void*); - -protected: - static void* createMediaRemote(void* userdata); - static void* createVoiceRemote(void* userdata); - - void enableMediaButtons(); - -protected: - LLMediaRemoteCtrl* mMediaRemote; - LLVoiceRemoteCtrl* mVoiceRemote; - bool mBuilt; // dialog constructed yet? - enum { STOPPED=0, PLAYING=1, PAUSED=2 }; - S32 mMusicState; -}; - -extern LLOverlayBar* gOverlayBar; - -#endif diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index 2bbd15ae11..c01adc3c35 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -52,6 +52,7 @@ #include "llvovolume.h" #include "llstatusbar.h" #include "llsdutil.h" +#include "llvieweraudio.h" #include "llfloaterreg.h" #include "llfloaterpreference.h" // for the gear icon @@ -807,14 +808,26 @@ bool LLPanelNearByMedia::setDisabled(const LLUUID &row_id, bool disabled) { if (row_id == PARCEL_AUDIO_LIST_ITEM_UUID) { - if (disabled) onClickParcelAudioStop(); - else onClickParcelAudioStart(); + if (disabled) + { + onClickParcelAudioStop(); + } + else + { + onClickParcelAudioPlay(); + } return true; } else if (row_id == PARCEL_MEDIA_LIST_ITEM_UUID) { - if (disabled) onClickDisableParcelMedia(); - else onClickEnableParcelMedia(); + if (disabled) + { + onClickDisableParcelMedia(); + } + else + { + onClickEnableParcelMedia(); + } return true; } else { @@ -857,24 +870,11 @@ void LLPanelNearByMedia::onClickParcelMediaPause() LLViewerParcelMedia::pause(); } -void LLPanelNearByMedia::onClickParcelAudioStart() -{ - // User *explicitly* started the internet stream, so keep the stream - // playing and updated as they cross to other parcels etc. - mParcelAudioAutoStart = true; - - if (!gAudiop) - return; - - gAudiop->startInternetStream(LLViewerMedia::getParcelAudioURL()); -} - void LLPanelNearByMedia::onClickParcelAudioPlay() { // User *explicitly* started the internet stream, so keep the stream // playing and updated as they cross to other parcels etc. mParcelAudioAutoStart = true; - if (!gAudiop) return; @@ -883,8 +883,9 @@ void LLPanelNearByMedia::onClickParcelAudioPlay() // 'false' means unpause gAudiop->pauseInternetStream(false); } - else { - gAudiop->startInternetStream(LLViewerMedia::getParcelAudioURL()); + else + { + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getParcelAudioURL()); } } @@ -894,11 +895,10 @@ void LLPanelNearByMedia::onClickParcelAudioStop() // re-start audio when i.e. they move to another parcel, until // they explicitly start it again. mParcelAudioAutoStart = false; - if (!gAudiop) return; - gAudiop->stopInternetStream(); + LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade(); } void LLPanelNearByMedia::onClickParcelAudioPause() diff --git a/indra/newview/llpanelnearbymedia.h b/indra/newview/llpanelnearbymedia.h index be4d313743..c3634de9b4 100644 --- a/indra/newview/llpanelnearbymedia.h +++ b/indra/newview/llpanelnearbymedia.h @@ -115,7 +115,6 @@ private: void onClickParcelMediaPause(); void onClickParcelAudioPlay(); void onClickParcelAudioStop(); - void onClickParcelAudioStart(); void onClickParcelAudioPause(); void onCheckAutoPlay(); void onAdvancedButtonClick(); diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 933b40ec79..39c0628cbe 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -1351,7 +1351,6 @@ void LLPanelPrimMediaControls::showNotification(LLNotificationPtr notify) LLWindowShade::Params params; params.rect = mMediaRegion->getLocalRect(); params.follows.flags = FOLLOWS_ALL; - params.notification = notify; //HACK: don't hardcode this if (notify->getIcon() == "Popup_Caution") @@ -1369,7 +1368,7 @@ void LLPanelPrimMediaControls::showNotification(LLNotificationPtr notify) mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params); mMediaRegion->addChild(mWindowShade); - mWindowShade->show(); + mWindowShade->show(notify); } void LLPanelPrimMediaControls::hideNotification() diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index fb1153980a..5c95e805ce 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -468,7 +468,7 @@ void LLParticipantList::setValidateSpeakerCallback(validate_speaker_callback_t c void LLParticipantList::updateRecentSpeakersOrder() { - if (E_SORT_BY_RECENT_SPEAKERS == getSortOrder()) + if (E_SORT_BY_RECENT_SPEAKERS == getSortOrder() && !isHovered()) { // Need to update speakers to sort list correctly mSpeakerMgr->update(true); @@ -477,6 +477,13 @@ void LLParticipantList::updateRecentSpeakersOrder() } } +bool LLParticipantList::isHovered() +{ + S32 x, y; + LLUI::getMousePositionScreen(&x, &y); + return mAvatarList->calcScreenRect().pointInRect(x, y); +} + bool LLParticipantList::onAddItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata) { LLUUID uu_id = event->getValue().asUUID(); diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index e0b3d42c25..a001d29b67 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -251,6 +251,8 @@ private: */ void adjustParticipant(const LLUUID& speaker_id); + bool isHovered(); + LLSpeakerMgr* mSpeakerMgr; LLAvatarList* mAvatarList; diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 15ba5195d9..5301955964 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -53,13 +53,22 @@ LLFastTimer::DeclareTimer FTM_GET_CHANNEL_RECT("Calculate Notification Channel R LLRect LLScreenChannelBase::getChannelRect() { LLFastTimer _(FTM_GET_CHANNEL_RECT); + + if (mFloaterSnapRegion == NULL) + { + mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + } + + if (mChicletRegion == NULL) + { + mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container"); + } + LLRect channel_rect; LLRect chiclet_rect; - LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region"); - floater_snap_region->localRectToScreen(floater_snap_region->getLocalRect(), &channel_rect); - LLView* chiclet_region = gViewerWindow->getRootView()->getChildView("chiclet_container"); - chiclet_region->localRectToScreen(chiclet_region->getLocalRect(), &chiclet_rect); + mFloaterSnapRegion->localRectToScreen(mFloaterSnapRegion->getLocalRect(), &channel_rect); + mChicletRegion->localRectToScreen(mChicletRegion->getLocalRect(), &chiclet_rect); channel_rect.mTop = chiclet_rect.mBottom; return channel_rect; @@ -81,14 +90,31 @@ LLScreenChannelBase::LLScreenChannelBase(const Params& p) mShowToasts(true), mID(p.id), mDisplayToastsAlways(p.display_toasts_always), - mChannelAlignment(p.channel_align) -{ + mChannelAlignment(p.channel_align), + mFloaterSnapRegion(NULL), + mChicletRegion(NULL) +{ mID = p.id; setMouseOpaque( false ); setVisible(FALSE); } +BOOL LLScreenChannelBase::postBuild() +{ + if (mFloaterSnapRegion == NULL) + { + mFloaterSnapRegion = gViewerWindow->getRootView()->getChildView("floater_snap_region"); + } + + if (mChicletRegion == NULL) + { + mChicletRegion = gViewerWindow->getRootView()->getChildView("chiclet_container"); + } + + return TRUE; +} + void LLScreenChannelBase::reshape(S32 width, S32 height, BOOL called_from_parent) { redrawToasts(); @@ -473,12 +499,10 @@ void LLScreenChannel::modifyToastByNotificationID(LLUUID id, LLPanel* panel) //-------------------------------------------------------------------------- void LLScreenChannel::redrawToasts() { - LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region"); - if (!getParent()) { // connect to floater snap region just to get resize events, we don't care about being a proper widget - floater_snap_region->addChild(this); + mFloaterSnapRegion->addChild(this); setFollows(FOLLOWS_ALL); } diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index 2f23552828..c9f8855fe6 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -69,6 +69,8 @@ public: }; LLScreenChannelBase(const Params&); + + BOOL postBuild(); void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); @@ -123,7 +125,7 @@ protected: // Channel's flags bool mControlHovering; - LLToast* mHoveredToast; + LLToast* mHoveredToast; bool mCanStoreToasts; bool mDisplayToastsAlways; // controls whether a channel shows toasts or not @@ -137,6 +139,9 @@ protected: // channel's ID LLUUID mID; + + LLView* mFloaterSnapRegion; + LLView* mChicletRegion; }; diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index 8774482acd..24cb559fd0 100644 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -117,6 +117,42 @@ BOOL LLSidepanelTaskInfo::postBuild() childSetCommitCallback("checkbox next owner can transfer", &LLSidepanelTaskInfo::onCommitNextOwnerTransfer,this); childSetCommitCallback("clickaction", &LLSidepanelTaskInfo::onCommitClickAction,this); childSetCommitCallback("search_check", &LLSidepanelTaskInfo::onCommitIncludeInSearch,this); + + mDAPermModify = getChild<LLUICtrl>("perm_modify"); + mDACreator = getChildView("Creator:"); + mDACreatorName = getChild<LLUICtrl>("Creator Name"); + mDAOwner = getChildView("Owner:"); + mDAOwnerName = getChild<LLUICtrl>("Owner Name"); + mDAGroup = getChildView("Group:"); + mDAGroupName = getChild<LLUICtrl>("Group Name"); + mDAButtonSetGroup = getChildView("button set group"); + mDAObjectName = getChild<LLUICtrl>("Object Name"); + mDAName = getChildView("Name:"); + mDADescription = getChildView("Description:"); + mDAObjectDescription = getChild<LLUICtrl>("Object Description"); + mDAPermissions = getChildView("Permissions:"); + mDACheckboxShareWithGroup = getChild<LLUICtrl>("checkbox share with group"); + mDAButtonDeed = getChildView("button deed"); + mDACheckboxAllowEveryoneMove = getChild<LLUICtrl>("checkbox allow everyone move"); + mDACheckboxAllowEveryoneCopy = getChild<LLUICtrl>("checkbox allow everyone copy"); + mDANextOwnerCan = getChildView("Next owner can:"); + mDACheckboxNextOwnerCanModify = getChild<LLUICtrl>("checkbox next owner can modify"); + mDACheckboxNextOwnerCanCopy = getChild<LLUICtrl>("checkbox next owner can copy"); + mDACheckboxNextOwnerCanTransfer = getChild<LLUICtrl>("checkbox next owner can transfer"); + mDACheckboxForSale = getChild<LLUICtrl>("checkbox for sale"); + mDASearchCheck = getChild<LLUICtrl>("search_check"); + mDAComboSaleType = getChild<LLComboBox>("sale type"); + mDACost = getChild<LLUICtrl>("Cost"); + mDAEditCost = getChild<LLUICtrl>("Edit Cost"); + mDALabelClickAction = getChildView("label click action"); + mDAComboClickAction = getChild<LLComboBox>("clickaction"); + mDAB = getChildView("B:"); + mDAO = getChildView("O:"); + mDAG = getChildView("G:"); + mDAE = getChildView("E:"); + mDAN = getChildView("N:"); + mDAF = getChildView("F:"); + return TRUE; } @@ -138,81 +174,80 @@ BOOL LLSidepanelTaskInfo::postBuild() void LLSidepanelTaskInfo::disableAll() { - getChildView("perm_modify")->setEnabled(FALSE); - getChild<LLUICtrl>("perm_modify")->setValue(LLStringUtil::null); - - getChildView("Creator:")->setEnabled(FALSE); - getChild<LLUICtrl>("Creator Name")->setValue(LLStringUtil::null); - getChildView("Creator Name")->setEnabled(FALSE); - - getChildView("Owner:")->setEnabled(FALSE); - getChild<LLUICtrl>("Owner Name")->setValue(LLStringUtil::null); - getChildView("Owner Name")->setEnabled(FALSE); - - getChildView("Group:")->setEnabled(FALSE); - getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null); - getChildView("Group Name")->setEnabled(FALSE); - getChildView("button set group")->setEnabled(FALSE); - - getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null); - getChildView("Object Name")->setEnabled(FALSE); - getChildView("Name:")->setEnabled(FALSE); - getChild<LLUICtrl>("Group Name")->setValue(LLStringUtil::null); - getChildView("Group Name")->setEnabled(FALSE); - getChildView("Description:")->setEnabled(FALSE); - getChild<LLUICtrl>("Object Description")->setValue(LLStringUtil::null); - getChildView("Object Description")->setEnabled(FALSE); - - getChildView("Permissions:")->setEnabled(FALSE); + mDAPermModify->setEnabled(FALSE); + mDAPermModify->setValue(LLStringUtil::null); + + mDACreator->setEnabled(FALSE); + mDACreatorName->setValue(LLStringUtil::null); + mDACreatorName->setEnabled(FALSE); + + mDAOwner->setEnabled(FALSE); + mDAOwnerName->setValue(LLStringUtil::null); + mDAOwnerName->setEnabled(FALSE); + + mDAGroup->setEnabled(FALSE); + mDAGroupName->setValue(LLStringUtil::null); + mDAGroupName->setEnabled(FALSE); + mDAButtonSetGroup->setEnabled(FALSE); + + mDAObjectName->setValue(LLStringUtil::null); + mDAObjectName->setEnabled(FALSE); + mDAName->setEnabled(FALSE); + mDAGroupName->setValue(LLStringUtil::null); + mDAGroupName->setEnabled(FALSE); + mDADescription->setEnabled(FALSE); + mDAObjectDescription->setValue(LLStringUtil::null); + mDAObjectDescription->setEnabled(FALSE); + + mDAPermissions->setEnabled(FALSE); - getChild<LLUICtrl>("checkbox share with group")->setValue(FALSE); - getChildView("checkbox share with group")->setEnabled(FALSE); - getChildView("button deed")->setEnabled(FALSE); + mDACheckboxShareWithGroup->setValue(FALSE); + mDACheckboxShareWithGroup->setEnabled(FALSE); + mDAButtonDeed->setEnabled(FALSE); - getChild<LLUICtrl>("checkbox allow everyone move")->setValue(FALSE); - getChildView("checkbox allow everyone move")->setEnabled(FALSE); - getChild<LLUICtrl>("checkbox allow everyone copy")->setValue(FALSE); - getChildView("checkbox allow everyone copy")->setEnabled(FALSE); + mDACheckboxAllowEveryoneMove->setValue(FALSE); + mDACheckboxAllowEveryoneMove->setEnabled(FALSE); + mDACheckboxAllowEveryoneCopy->setValue(FALSE); + mDACheckboxAllowEveryoneCopy->setEnabled(FALSE); //Next owner can: - getChildView("Next owner can:")->setEnabled(FALSE); - getChild<LLUICtrl>("checkbox next owner can modify")->setValue(FALSE); - getChildView("checkbox next owner can modify")->setEnabled(FALSE); - getChild<LLUICtrl>("checkbox next owner can copy")->setValue(FALSE); - getChildView("checkbox next owner can copy")->setEnabled(FALSE); - getChild<LLUICtrl>("checkbox next owner can transfer")->setValue(FALSE); - getChildView("checkbox next owner can transfer")->setEnabled(FALSE); + mDANextOwnerCan->setEnabled(FALSE); + mDACheckboxNextOwnerCanModify->setValue(FALSE); + mDACheckboxNextOwnerCanModify->setEnabled(FALSE); + mDACheckboxNextOwnerCanCopy->setValue(FALSE); + mDACheckboxNextOwnerCanCopy->setEnabled(FALSE); + mDACheckboxNextOwnerCanTransfer->setValue(FALSE); + mDACheckboxNextOwnerCanTransfer->setEnabled(FALSE); //checkbox for sale - getChild<LLUICtrl>("checkbox for sale")->setValue(FALSE); - getChildView("checkbox for sale")->setEnabled(FALSE); + mDACheckboxForSale->setValue(FALSE); + mDACheckboxForSale->setEnabled(FALSE); //checkbox include in search - getChild<LLUICtrl>("search_check")->setValue(FALSE); - getChildView("search_check")->setEnabled(FALSE); + mDASearchCheck->setValue(FALSE); + mDASearchCheck->setEnabled(FALSE); - LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type"); - combo_sale_type->setValue(LLSaleInfo::FS_COPY); - combo_sale_type->setEnabled(FALSE); + mDAComboSaleType->setValue(LLSaleInfo::FS_COPY); + mDAComboSaleType->setEnabled(FALSE); - getChildView("Cost")->setEnabled(FALSE); - getChild<LLUICtrl>("Cost")->setValue(getString("Cost Default")); - getChild<LLUICtrl>("Edit Cost")->setValue(LLStringUtil::null); - getChildView("Edit Cost")->setEnabled(FALSE); + mDACost->setEnabled(FALSE); + mDACost->setValue(getString("Cost Default")); + mDAEditCost->setValue(LLStringUtil::null); + mDAEditCost->setEnabled(FALSE); - getChildView("label click action")->setEnabled(FALSE); - LLComboBox* combo_click_action = getChild<LLComboBox>("clickaction"); - if (combo_click_action) + mDALabelClickAction->setEnabled(FALSE); + if (mDAComboClickAction) { - combo_click_action->setEnabled(FALSE); - combo_click_action->clear(); + mDAComboClickAction->setEnabled(FALSE); + mDAComboClickAction->clear(); } - getChildView("B:")->setVisible( FALSE); - getChildView("O:")->setVisible( FALSE); - getChildView("G:")->setVisible( FALSE); - getChildView("E:")->setVisible( FALSE); - getChildView("N:")->setVisible( FALSE); - getChildView("F:")->setVisible( FALSE); + + mDAB->setVisible(FALSE); + mDAO->setVisible(FALSE); + mDAG->setVisible(FALSE); + mDAE->setVisible(FALSE); + mDAN->setVisible(FALSE); + mDAF->setVisible(FALSE); mOpenBtn->setEnabled(FALSE); mPayBtn->setEnabled(FALSE); diff --git a/indra/newview/llsidepaneltaskinfo.h b/indra/newview/llsidepaneltaskinfo.h index 384bc479d6..be0fee2127 100644 --- a/indra/newview/llsidepaneltaskinfo.h +++ b/indra/newview/llsidepaneltaskinfo.h @@ -37,8 +37,9 @@ // Panel for permissions of an object. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLNameBox; class LLCheckBoxCtrl; +class LLComboBox; +class LLNameBox; class LLViewerObject; class LLSidepanelTaskInfo : public LLSidepanelInventorySubpanel @@ -118,6 +119,43 @@ private: LLPointer<LLViewerObject> mObject; LLObjectSelectionHandle mObjectSelection; static LLSidepanelTaskInfo* sActivePanel; + +private: + // Pointers cached here to speed up the "disableAll" function which gets called on idle + LLUICtrl* mDAPermModify; + LLView* mDACreator; + LLUICtrl* mDACreatorName; + LLView* mDAOwner; + LLUICtrl* mDAOwnerName; + LLView* mDAGroup; + LLUICtrl* mDAGroupName; + LLView* mDAButtonSetGroup; + LLUICtrl* mDAObjectName; + LLView* mDAName; + LLView* mDADescription; + LLUICtrl* mDAObjectDescription; + LLView* mDAPermissions; + LLUICtrl* mDACheckboxShareWithGroup; + LLView* mDAButtonDeed; + LLUICtrl* mDACheckboxAllowEveryoneMove; + LLUICtrl* mDACheckboxAllowEveryoneCopy; + LLView* mDANextOwnerCan; + LLUICtrl* mDACheckboxNextOwnerCanModify; + LLUICtrl* mDACheckboxNextOwnerCanCopy; + LLUICtrl* mDACheckboxNextOwnerCanTransfer; + LLUICtrl* mDACheckboxForSale; + LLUICtrl* mDASearchCheck; + LLComboBox* mDAComboSaleType; + LLUICtrl* mDACost; + LLUICtrl* mDAEditCost; + LLView* mDALabelClickAction; + LLComboBox* mDAComboClickAction; + LLView* mDAB; + LLView* mDAO; + LLView* mDAG; + LLView* mDAE; + LLView* mDAN; + LLView* mDAF; }; diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 75db269bde..89240c982f 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -114,6 +114,7 @@ LLStatusBar::LLStatusBar(const LLRect& rect) mTextTime(NULL), mSGBandwidth(NULL), mSGPacketLoss(NULL), + mBtnStats(NULL), mBtnVolume(NULL), mBoxBalance(NULL), mBalance(0), @@ -173,6 +174,8 @@ BOOL LLStatusBar::postBuild() mBoxBalance = getChild<LLTextBox>("balance"); mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, this ); + + mBtnStats = getChildView("stat_btn"); mBtnVolume = getChild<LLButton>( "volume_btn" ); mBtnVolume->setClickedCallback( onClickVolume, this ); @@ -288,7 +291,7 @@ void LLStatusBar::refresh() mSGBandwidth->setVisible(net_stats_visible); mSGPacketLoss->setVisible(net_stats_visible); - getChildView("stat_btn")->setEnabled(net_stats_visible); + mBtnStats->setEnabled(net_stats_visible); // update the master volume button state bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index 4ea3183d18..9d28e6c2bc 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -102,10 +102,11 @@ private: LLStatGraph *mSGBandwidth; LLStatGraph *mSGPacketLoss; + LLView *mBtnStats; LLButton *mBtnVolume; LLTextBox *mBoxBalance; LLButton *mMediaToggle; - LLView* mScriptOut; + LLView *mScriptOut; LLFrameTimer mClockUpdateTimer; S32 mBalance; diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index 7eb54271f4..c1cc9c7bc4 100755 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -95,6 +95,12 @@ bool LLGoogleTranslationHandler::parseResponse( return parseTranslation(root, translation, detected_lang); } +// virtual +bool LLGoogleTranslationHandler::isConfigured() const +{ + return !getAPIKey().empty(); +} + // static void LLGoogleTranslationHandler::parseErrorResponse( const Json::Value& root, @@ -218,6 +224,12 @@ bool LLBingTranslationHandler::parseResponse( return true; } +// virtual +bool LLBingTranslationHandler::isConfigured() const +{ + return !getAPIKey().empty(); +} + // static std::string LLBingTranslationHandler::getAPIKey() { @@ -332,6 +344,12 @@ std::string LLTranslate::getTranslateLanguage() } // static +bool LLTranslate::isTranslationConfigured() +{ + return getPreferredHandler().isConfigured(); +} + +// static const LLTranslationAPIHandler& LLTranslate::getPreferredHandler() { EService service = SERVICE_BING; diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h index c2330daa81..424bc14587 100755 --- a/indra/newview/lltranslate.h +++ b/indra/newview/lltranslate.h @@ -89,6 +89,11 @@ public: std::string& detected_lang, std::string& err_msg) const = 0; + /** + * @return if the handler is configured to function properly + */ + virtual bool isConfigured() const = 0; + virtual ~LLTranslationAPIHandler() {} protected: @@ -115,6 +120,7 @@ public: std::string& translation, std::string& detected_lang, std::string& err_msg) const; + /*virtual*/ bool isConfigured() const; private: static void parseErrorResponse( @@ -148,6 +154,7 @@ public: std::string& translation, std::string& detected_lang, std::string& err_msg) const; + /*virtual*/ bool isConfigured() const; private: static std::string getAPIKey(); }; @@ -275,8 +282,17 @@ public : * @param key Key to verify. */ static void verifyKey(KeyVerificationReceiverPtr& receiver, const std::string& key); + + /** + * @return translation target language + */ static std::string getTranslateLanguage(); + /** + * @return true if translation is configured properly. + */ + static bool isTranslationConfigured(); + private: static const LLTranslationAPIHandler& getPreferredHandler(); static const LLTranslationAPIHandler& getHandler(EService service); diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index f7fa5690d6..2447f5dea8 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -37,9 +37,226 @@ #include "llvoiceclient.h" #include "llviewermedia.h" #include "llprogressview.h" +#include "llcallbacklist.h" +#include "llstartup.h" +#include "llviewerparcelmgr.h" +#include "llparcel.h" ///////////////////////////////////////////////////////// +LLViewerAudio::LLViewerAudio() : + mDone(true), + mFadeState(FADE_IDLE), + mFadeTime(), + mIdleListnerActive(false), + mForcedTeleportFade(false) +{ + mTeleportFailedConnection = LLViewerParcelMgr::getInstance()-> + setTeleportFailedCallback(boost::bind(&LLViewerAudio::onTeleportFailed, this)); +} + +LLViewerAudio::~LLViewerAudio() +{ + mTeleportFailedConnection.disconnect(); +} + +void LLViewerAudio::registerIdleListener() +{ + if(mIdleListnerActive==false) + { + mIdleListnerActive = true; + doOnIdleRepeating(boost::bind(boost::bind(&LLViewerAudio::onIdleUpdate, this))); + } + +} + +void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI) +{ + // Old and new stream are identical + if (mNextStreamURI == streamURI) + { + return; + } + + // Record the URI we are going to be switching to + mNextStreamURI = streamURI; + + switch (mFadeState) + { + case FADE_IDLE: + // If a stream is playing fade it out first + if (!gAudiop->getInternetStreamURL().empty()) + { + // The order of these tests is important, state FADE_OUT will be processed below + mFadeState = FADE_OUT; + } + // Otherwise the new stream can be faded in + else + { + mFadeState = FADE_IN; + gAudiop->startInternetStream(mNextStreamURI); + startFading(); + registerIdleListener(); + break; + } + + case FADE_OUT: + startFading(); + registerIdleListener(); + break; + + case FADE_IN: + registerIdleListener(); + break; + + default: + llwarns << "Unknown fading state: " << mFadeState << llendl; + break; + } +} + +// A return of false from onIdleUpdate means it will be called again next idle update. +// A return of true means we have finished with it and the callback will be deleted. +bool LLViewerAudio::onIdleUpdate() +{ + bool fadeIsFinished = false; + + // There is a delay in the login sequence between when the parcel information has + // arrived and the music stream is started and when the audio system is called to set + // initial volume levels. This code extends the fade time so you hear a full fade in. + if ((LLStartUp::getStartupState() < STATE_STARTED)) + { + stream_fade_timer.reset(); + stream_fade_timer.setTimerExpirySec(mFadeTime); + } + + if (mDone) + { + // This should be a rare or never occurring state. + if (mFadeState == FADE_IDLE) + { + deregisterIdleListener(); + fadeIsFinished = true; // Stop calling onIdleUpdate + } + + // we have finished the current fade operation + if (mFadeState == FADE_OUT) + { + // Clear URI + gAudiop->startInternetStream(LLStringUtil::null); + gAudiop->stopInternetStream(); + + if (!mNextStreamURI.empty()) + { + mFadeState = FADE_IN; + gAudiop->startInternetStream(mNextStreamURI); + startFading(); + } + else + { + mFadeState = FADE_IDLE; + deregisterIdleListener(); + fadeIsFinished = true; // Stop calling onIdleUpdate + } + } + else if (mFadeState == FADE_IN) + { + if (mNextStreamURI != gAudiop->getInternetStreamURL()) + { + mFadeState = FADE_OUT; + startFading(); + } + else + { + mFadeState = FADE_IDLE; + deregisterIdleListener(); + fadeIsFinished = true; // Stop calling onIdleUpdate + } + } + } + + return fadeIsFinished; +} + +void LLViewerAudio::stopInternetStreamWithAutoFade() +{ + mFadeState = FADE_IDLE; + mNextStreamURI = LLStringUtil::null; + mDone = true; + + gAudiop->startInternetStream(LLStringUtil::null); + gAudiop->stopInternetStream(); +} + +void LLViewerAudio::startFading() +{ + const F32 AUDIO_MUSIC_FADE_IN_TIME = 3.0f; + const F32 AUDIO_MUSIC_FADE_OUT_TIME = 2.0f; + // This minimum fade time prevents divide by zero and negative times + const F32 AUDIO_MUSIC_MINIMUM_FADE_TIME = 0.01f; + + if(mDone) + { + // The fade state here should only be one of FADE_IN or FADE_OUT, but, in case it is not, + // rather than check for both states assume a fade in and check for the fade out case. + mFadeTime = AUDIO_MUSIC_FADE_IN_TIME; + if (LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT) + { + mFadeTime = AUDIO_MUSIC_FADE_OUT_TIME; + } + + // Prevent invalid fade time + mFadeTime = llmax(mFadeTime, AUDIO_MUSIC_MINIMUM_FADE_TIME); + + stream_fade_timer.reset(); + stream_fade_timer.setTimerExpirySec(mFadeTime); + mDone = false; + } +} + +F32 LLViewerAudio::getFadeVolume() +{ + F32 fade_volume = 1.0f; + + if (stream_fade_timer.hasExpired()) + { + mDone = true; + // If we have been fading out set volume to 0 until the next fade state occurs to prevent + // an audio transient. + if (LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT) + { + fade_volume = 0.0f; + } + } + + if (!mDone) + { + // Calculate how far we are into the fade time + fade_volume = stream_fade_timer.getElapsedTimeF32() / mFadeTime; + + if (LLViewerAudio::getInstance()->getFadeState() == LLViewerAudio::FADE_OUT) + { + // If we are not fading in then we are fading out, so invert the fade + // direction; start loud and move towards zero volume. + fade_volume = 1.0f - fade_volume; + } + } + + return fade_volume; +} + +void LLViewerAudio::onTeleportFailed() +{ + if (gAudiop) + { + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + if (parcel) + { + mNextStreamURI = parcel->getMusicURL(); + } + } +} + void init_audio() { if (!gAudiop) @@ -142,12 +359,25 @@ void audio_update_volume(bool force_update) // Streaming Music if (gAudiop) - { + { + if (progress_view_visible && !LLViewerAudio::getInstance()->getForcedTeleportFade()) + { + LLViewerAudio::getInstance()->setForcedTeleportFade(true); + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); + LLViewerAudio::getInstance()->setNextStreamURI(LLStringUtil::null); + } + + if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade() == true) + { + LLViewerAudio::getInstance()->setForcedTeleportFade(false); + } + F32 music_volume = gSavedSettings.getF32("AudioLevelMusic"); BOOL music_muted = gSavedSettings.getBOOL("MuteMusic"); - music_volume = mute_volume * master_volume * music_volume; - gAudiop->setInternetStreamGain ( music_muted || progress_view_visible ? 0.f : music_volume ); - + F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume(); + + music_volume = mute_volume * master_volume * music_volume * fade_volume; + gAudiop->setInternetStreamGain (music_muted ? 0.f : music_volume); } // Streaming Media diff --git a/indra/newview/llvieweraudio.h b/indra/newview/llvieweraudio.h index e5916285fb..a3da9fc6b8 100644 --- a/indra/newview/llvieweraudio.h +++ b/indra/newview/llvieweraudio.h @@ -27,6 +27,9 @@ #ifndef LL_VIEWERAUDIO_H #define LL_VIEWERAUDIO_H +#include "llframetimer.h" +#include "llsingleton.h" + // comment out to turn off wind #define kAUDIO_ENABLE_WIND //#define kAUDIO_ENABLE_WATER 1 // comment out to turn off water @@ -38,4 +41,48 @@ void audio_update_volume(bool force_update = true); void audio_update_listener(); void audio_update_wind(bool force_update = true); +class LLViewerAudio : public LLSingleton<LLViewerAudio> +{ +public: + + enum EFadeState + { + FADE_IDLE, + FADE_IN, + FADE_OUT, + }; + + LLViewerAudio(); + virtual ~LLViewerAudio(); + + void startInternetStreamWithAutoFade(std::string streamURI); + void stopInternetStreamWithAutoFade(); + + bool onIdleUpdate(); + + EFadeState getFadeState() { return mFadeState; } + bool isDone() { return mDone; }; + F32 getFadeVolume(); + bool getForcedTeleportFade() { return mForcedTeleportFade; }; + void setForcedTeleportFade(bool fade) { mForcedTeleportFade = fade;} ; + void setNextStreamURI(std::string stream) { mNextStreamURI = stream; } ; + +private: + + bool mDone; + F32 mFadeTime; + std::string mNextStreamURI; + EFadeState mFadeState; + LLFrameTimer stream_fade_timer; + bool mIdleListnerActive; + bool mForcedTeleportFade; + boost::signals2::connection mTeleportFailedConnection; + + void registerIdleListener(); + void deregisterIdleListener() { mIdleListnerActive = false; }; + void startFading(); + void onTeleportFailed(); + +}; + #endif //LL_VIEWER_H diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 73e4d11d7b..093b84413a 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -564,7 +564,6 @@ void settings_setup_listeners() gSavedSettings.getControl("OctreeAttachmentSizeFactor")->getSignal()->connect(boost::bind(&handleRepartition, _2)); gSavedSettings.getControl("RenderMaxTextureIndex")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderUseTriStrips")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); - gSavedSettings.getControl("RenderAnimateTrees")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2)); gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2)); gSavedSettings.getControl("RenderUIBuffer")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2)); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 3f0b5bf3fb..cb40af7061 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -230,7 +230,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) glClear(GL_COLOR_BUFFER_BIT); gViewerWindow->getWindow()->swapBuffers(); LLPipeline::refreshCachedSettings(); - LLPipeline::refreshRenderDeferred(); gPipeline.resizeScreenTexture(); gResizeScreenTexture = FALSE; gWindowResized = FALSE; @@ -617,9 +616,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) //Increment drawable frame counter LLDrawable::incrementVisible(); - LLPipeline::refreshCachedSettings(); - LLPipeline::refreshRenderDeferred(); - LLSpatialGroup::sNoDelete = TRUE; LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName(); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index eb7a4aa538..046360e9e9 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -69,6 +69,9 @@ #include "llwebprofile.h" #include "llwebsharing.h" // For LLWebSharing::setOpenIDCookie(), *TODO: find a better way to do this! #include "llwindow.h" +#include "llvieweraudio.h" + +#include "llfloaterwebcontent.h" // for handling window close requests and geometry change requests in media browser windows. #include <boost/bind.hpp> // for SkinFolder listener #include <boost/signals2.hpp> @@ -985,7 +988,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg) { if(LLViewerMedia::isParcelAudioPlaying() && gAudiop && LLViewerMedia::hasParcelAudio()) { - gAudiop->stopInternetStream(); + LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade(); } } pimpl->setPriority(new_priority); @@ -1089,13 +1092,24 @@ void LLViewerMedia::setAllMediaEnabled(bool val) gAudiop && LLViewerMedia::hasParcelAudio()) { - gAudiop->startInternetStream(LLViewerMedia::getParcelAudioURL()); + if (LLAudioEngine::AUDIO_PAUSED == gAudiop->isInternetStreamPlaying()) + { + // 'false' means unpause + gAudiop->pauseInternetStream(false); + } + else + { + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getParcelAudioURL()); + } } } else { // This actually unloads the impl, as opposed to "stop"ping the media LLViewerParcelMedia::stop(); - if (gAudiop) gAudiop->stopInternetStream(); + if (gAudiop) + { + LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade(); + } } } @@ -1887,7 +1901,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ } } - LL_WARNS("Plugin") << "plugin intialization failed for mime type: " << media_type << LL_ENDL; + LL_WARNS_ONCE("Plugin") << "plugin intialization failed for mime type: " << media_type << LL_ENDL; LLSD args; args["MIME_TYPE"] = media_type; LLNotificationsUtil::add("NoPlugin", args); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index dca5cdd06d..ad333a71ff 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3638,6 +3638,9 @@ void process_teleport_finish(LLMessageSystem* msg, void**) gCacheName->setUpstream(sim); */ + // Make sure we're standing + gAgent.standUp(); + // now, use the circuit info to tell simulator about us! LL_INFOS("Messaging") << "process_teleport_finish() Enabling " << sim_host << " with code " << msg->mOurCircuitCode << LL_ENDL; diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 4f66b63d34..9db784101d 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -67,6 +67,7 @@ #include "llworld.h" #include "roles_constants.h" #include "llweb.h" +#include "llvieweraudio.h" const F32 PARCEL_COLLISION_DRAW_SECS = 1.f; @@ -1727,7 +1728,10 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use } else { - // look for music. + // Check for video + LLViewerParcelMedia::update(parcel); + + // Then check for music if (gAudiop) { if (parcel) @@ -1738,46 +1742,34 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use std::string music_url = music_url_raw; LLStringUtil::trim(music_url); - // On entering a new parcel, stop the last stream if the - // new parcel has a different music url. (Empty URL counts - // as different.) - const std::string& stream_url = gAudiop->getInternetStreamURL(); - - if (music_url.empty() || music_url != stream_url) + // If there is a new music URL and it's valid, play it. + if (music_url.size() > 12) { - // URL is different from one currently playing. - gAudiop->stopInternetStream(); - - // If there is a new music URL and it's valid, play it. - if (music_url.size() > 12) + if (music_url.substr(0,7) == "http://") { - if (music_url.substr(0,7) == "http://") - { - optionally_start_music(music_url); - } - else - { - llinfos << "Stopping parcel music (invalid audio stream URL)" << llendl; - // clears the URL - gAudiop->startInternetStream(LLStringUtil::null); - } + optionally_start_music(music_url); } - else if (!gAudiop->getInternetStreamURL().empty()) + else { - llinfos << "Stopping parcel music (parcel stream URL is empty)" << llendl; - gAudiop->startInternetStream(LLStringUtil::null); + llinfos << "Stopping parcel music (invalid audio stream URL)" << llendl; + // clears the URL + // null value causes fade out + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); } } + else if (!gAudiop->getInternetStreamURL().empty()) + { + llinfos << "Stopping parcel music (parcel stream URL is empty)" << llendl; + // null value causes fade out + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); + } } else { // Public land has no music - gAudiop->stopInternetStream(); + LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade(); } }//if gAudiop - - // now check for video - LLViewerParcelMedia::update( parcel ); }; } @@ -1796,7 +1788,11 @@ void optionally_start_music(const std::string& music_url) gSavedSettings.getBOOL("MediaTentativeAutoPlay"))) { llinfos << "Starting parcel music " << music_url << llendl; - gAudiop->startInternetStream(music_url); + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(music_url); + } + else + { + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); } } } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 18ae83e3b6..bddc07b395 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -1338,6 +1338,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() if (success) { gDeferredShadowAlphaMaskProgram.mName = "Deferred Shadow Alpha Mask Shader"; + gDeferredShadowAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredShadowAlphaMaskProgram.mShaderFiles.clear(); gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredShadowAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/shadowAlphaMaskF.glsl", GL_FRAGMENT_SHADER_ARB)); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 786e2b73b1..f4bbc2b067 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2269,6 +2269,7 @@ void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry: } } mPauseLoadedCallBacks = FALSE ; + mLastCallBackActiveTime = sCurrentTime ; if(need_raw) { mSaveRawImage = TRUE ; @@ -2308,13 +2309,18 @@ void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::s bool LLViewerFetchedTexture::doLoadedCallbacks() { - static const F32 MAX_INACTIVE_TIME = 120.f ; //seconds + static const F32 MAX_INACTIVE_TIME = 900.f ; //seconds if (mNeedsCreateTexture) { return false; } - if(sCurrentTime - mLastCallBackActiveTime > MAX_INACTIVE_TIME) + if(mPauseLoadedCallBacks) + { + destroyRawImage(); + return false; //paused + } + if(sCurrentTime - mLastCallBackActiveTime > MAX_INACTIVE_TIME && !mIsFetching) { clearCallbackEntryList() ; //remove all callbacks. return false ; @@ -2337,12 +2343,8 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() // Remove ourself from the global list of textures with callbacks gTextureList.mCallbackList.erase(this); - } - if(mPauseLoadedCallBacks) - { - destroyRawImage(); - return res; //paused - } + return false ; + } S32 gl_discard = getDiscardLevel(); @@ -2604,7 +2606,11 @@ bool LLViewerFetchedTexture::needsToSaveRawImage() void LLViewerFetchedTexture::destroyRawImage() { - if (mAuxRawImage.notNull()) sAuxCount--; + if (mAuxRawImage.notNull()) + { + sAuxCount--; + mAuxRawImage = NULL; + } if (mRawImage.notNull()) { @@ -2618,12 +2624,12 @@ void LLViewerFetchedTexture::destroyRawImage() } setCachedRawImage() ; } + + mRawImage = NULL; + + mIsRawImageValid = FALSE; + mRawDiscardLevel = INVALID_DISCARD_LEVEL; } - - mRawImage = NULL; - mAuxRawImage = NULL; - mIsRawImageValid = FALSE; - mRawDiscardLevel = INVALID_DISCARD_LEVEL; } //use the mCachedRawImage to (re)generate the gl texture. diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4c33716c32..4767ba2bed 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -690,7 +690,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mFullyLoadedInitialized(FALSE), mSupportsAlphaLayers(FALSE), mLoadedCallbacksPaused(FALSE), - mHasPelvisOffset( FALSE ) + mHasPelvisOffset( FALSE ), + mRenderUnloadedAvatar(LLCachedControl<bool>(gSavedSettings, "RenderUnloadedAvatar")) { LLMemType mt(LLMemType::MTYPE_AVATAR); //VTResume(); // VTune @@ -6493,10 +6494,7 @@ BOOL LLVOAvatar::processFullyLoadedChange(bool loading) BOOL LLVOAvatar::isFullyLoaded() const { - if (gSavedSettings.getBOOL("RenderUnloadedAvatar")) - return TRUE; - else - return mFullyLoaded; + return (mRenderUnloadedAvatar || mFullyLoaded); } bool LLVOAvatar::isTooComplex() const diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index e53b8e3f4b..59796370ae 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -40,6 +40,7 @@ #include "lldrawpoolalpha.h" #include "llviewerobject.h" #include "llcharacter.h" +#include "llcontrol.h" #include "llviewerjointmesh.h" #include "llviewerjointattachment.h" #include "llrendertarget.h" @@ -450,6 +451,8 @@ private: F32 mImpostorDistance; F32 mImpostorPixelArea; LLVector3 mLastAnimExtents[2]; + + LLCachedControl<bool> mRenderUnloadedAvatar; //-------------------------------------------------------------------- // Wind rippling in clothes diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 3959a021fe..df1d3f2955 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -7019,7 +7019,6 @@ void LLVivoxVoiceClient::captureBufferPlayStopSendMessage() LLVivoxProtocolParser::LLVivoxProtocolParser() { - parser = NULL; parser = XML_ParserCreate(NULL); reset(); diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 6486fd24ea..4564207da4 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -341,45 +341,11 @@ U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys, BOOL LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) { - const U16 FRAMES_PER_WIND_UPDATE = 20; // How many frames between wind update per tree - const F32 TREE_WIND_SENSITIVITY = 0.005f; - const F32 TREE_TRUNK_STIFFNESS = 0.1f; - if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_TREE))) { return TRUE; } - if (gSavedSettings.getBOOL("RenderAnimateTrees")) - { - F32 mass_inv; - - // For all tree objects, update the trunk bending with the current wind - // Walk sprite list in order away from viewer - if (!(mFrameCount % FRAMES_PER_WIND_UPDATE)) - { - // If needed, Get latest wind for this tree - mWind = mRegionp->mWind.getVelocity(getPositionRegion()); - } - mFrameCount++; - - mass_inv = 1.f/(5.f + mDepth*mBranches*0.2f); - mTrunkVel += (mWind * mass_inv * TREE_WIND_SENSITIVITY); // Pull in direction of wind - mTrunkVel -= (mTrunkBend * mass_inv * TREE_TRUNK_STIFFNESS); // Restoring force in direction of trunk - mTrunkBend += mTrunkVel; - mTrunkVel *= 0.99f; // Add damping - - if (mTrunkBend.length() > 1.f) - { - mTrunkBend.normalize(); - } - - if (mTrunkVel.length() > 1.f) - { - mTrunkVel.normalize(); - } - } - S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS ; F32 app_angle = getAppAngle()*LLVOTree::sTreeFactor; @@ -392,39 +358,36 @@ BOOL LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) } } - if (!gSavedSettings.getBOOL("RenderAnimateTrees")) + if (mReferenceBuffer.isNull()) { - if (mReferenceBuffer.isNull()) - { - gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE); - } - else if (trunk_LOD != mTrunkLOD) + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE); + } + else if (trunk_LOD != mTrunkLOD) + { + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, FALSE); + } + else + { + // we're not animating but we may *still* need to + // regenerate the mesh if we moved, since position + // and rotation are baked into the mesh. + // *TODO: I don't know what's so special about trees + // that they don't get REBUILD_POSITION automatically + // at a higher level. + const LLVector3 &this_position = getPositionAgent(); + if (this_position != mLastPosition) { - gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, FALSE); + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION); + mLastPosition = this_position; } else { - // we're not animating but we may *still* need to - // regenerate the mesh if we moved, since position - // and rotation are baked into the mesh. - // *TODO: I don't know what's so special about trees - // that they don't get REBUILD_POSITION automatically - // at a higher level. - const LLVector3 &this_position = getPositionAgent(); - if (this_position != mLastPosition) + const LLQuaternion &this_rotation = getRotation(); + + if (this_rotation != mLastRotation) { gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION); - mLastPosition = this_position; - } - else - { - const LLQuaternion &this_rotation = getRotation(); - - if (this_rotation != mLastRotation) - { - gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION); - mLastRotation = this_rotation; - } + mLastRotation = this_rotation; } } } @@ -559,7 +522,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) max_vertices += sLODVertexCount[lod]; } - mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, gSavedSettings.getBOOL("RenderAnimateTrees") ? GL_STATIC_DRAW_ARB : 0); + mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, 0); mReferenceBuffer->allocateBuffer(max_vertices, max_indices, TRUE); LLStrider<LLVector3> vertices; @@ -863,15 +826,8 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) llassert(index_count == max_indices); } - if (gSavedSettings.getBOOL("RenderAnimateTrees")) - { - mDrawable->getFace(0)->setVertexBuffer(mReferenceBuffer); - } - else - { - //generate tree mesh - updateMesh(); - } + //generate tree mesh + updateMesh(); return TRUE; } diff --git a/indra/newview/llvotree.h b/indra/newview/llvotree.h index 1e1deede26..0554935539 100644 --- a/indra/newview/llvotree.h +++ b/indra/newview/llvotree.h @@ -152,7 +152,6 @@ public: friend class LLDrawPoolTree; protected: LLVector3 mTrunkBend; // Accumulated wind (used for blowing trees) - LLVector3 mTrunkVel; // LLVector3 mWind; LLPointer<LLVertexBuffer> mReferenceBuffer; //reference geometry for generating tree mesh diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index baab191cb6..20f8674655 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4624,6 +4624,19 @@ struct CompareBatchBreakerModified void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::vector<LLFace*>& faces, BOOL distance_sort, BOOL batch_textures) { + U32 buffer_usage = group->mBufferUsage; + +#if LL_DARWIN + // HACK from Leslie: + // Disable VBO usage for alpha on Mac OS X because it kills the framerate + // due to implicit calls to glTexSubImage that are beyond our control. + // (this works because the only calls here that sort by distance are alpha) + if (distance_sort) + { + buffer_usage = 0x0; + } +#endif + //calculate maximum number of vertices to store in a single buffer U32 max_vertices = (gSavedSettings.getS32("RenderMaxVBOSize")*1024)/LLVertexBuffer::calcVertexSize(group->mSpatialPartition->mVertexDataMask); max_vertices = llmin(max_vertices, (U32) 65535); @@ -4805,17 +4818,15 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: if (!buffer) { //create new buffer if needed - buffer = createVertexBuffer(mask, - group->mBufferUsage); + buffer = createVertexBuffer(mask, buffer_usage); buffer->allocateBuffer(geom_count, index_count, TRUE); } else { //resize pre-existing buffer - if (LLVertexBuffer::sEnableVBOs && buffer->getUsage() != group->mBufferUsage || + if (LLVertexBuffer::sEnableVBOs && buffer->getUsage() != buffer_usage || buffer->getTypeMask() != mask) { - buffer = createVertexBuffer(mask, - group->mBufferUsage); + buffer = createVertexBuffer(mask, buffer_usage); buffer->allocateBuffer(geom_count, index_count, TRUE); } else @@ -4896,11 +4907,6 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: { registerFace(group, facep, LLRenderPass::PASS_ALPHA); } - - if (LLPipeline::sRenderDeferred) - { - registerFace(group, facep, LLRenderPass::PASS_ALPHA_SHADOW); - } } else if (gPipeline.canUseVertexShaders() && group->mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_HUD diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 6f6e0d2334..676287c0ad 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -818,14 +818,11 @@ void LLWorld::updateWaterObjects() max_x = (S32)region_x + range; max_y = (S32)region_y + range; - F32 height = 0.f; - for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; LLVOWater* waterp = regionp->getLand().getWaterObj(); - height += regionp->getWaterHeight(); if (waterp) { gObjectList.updateActive(waterp); @@ -842,6 +839,7 @@ void LLWorld::updateWaterObjects() // Now, get a list of the holes S32 x, y; + F32 water_height = gAgent.getRegion()->getWaterHeight() + 256.f; for (x = min_x; x <= max_x; x += rwidth) { for (y = min_y; y <= max_y; y += rwidth) @@ -853,7 +851,7 @@ void LLWorld::updateWaterObjects() waterp->setUseTexture(FALSE); waterp->setPositionGlobal(LLVector3d(x + rwidth/2, y + rwidth/2, - 256.f+DEFAULT_WATER_HEIGHT)); + water_height)); waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 512.f)); gPipeline.createObject(waterp); mHoleWaterObjects.push_back(waterp); @@ -910,8 +908,7 @@ void LLWorld::updateWaterObjects() } waterp->setRegion(gAgent.getRegion()); - LLVector3d water_pos(water_center_x, water_center_y, - DEFAULT_WATER_HEIGHT+256.f); + LLVector3d water_pos(water_center_x, water_center_y, water_height) ; LLVector3 water_scale((F32) dim[0], (F32) dim[1], 512.f); //stretch out to horizon diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index f483ba5af8..920a9a3752 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -382,19 +382,11 @@ bool LLXMLRPCTransaction::Impl::process() // continue onward } } - - //const F32 MAX_PROCESSING_TIME = 0.05f; - //LLTimer timer; - - mCurlRequest->perform(); - - /*while (mCurlRequest->perform() > 0) + + if(!mCurlRequest->wait()) { - if (timer.getElapsedTimeF32() >= MAX_PROCESSING_TIME) - { - return false; - } - }*/ + return false ; + } while(1) { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d8e271811a..657cdc0e07 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -509,6 +509,92 @@ void LLPipeline::init() mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0); mDeferredVB->allocateBuffer(8, 0, true); setLightingDetail(-1); + + // + // Update all settings to trigger a cached settings refresh + // + + gSavedSettings.getControl("RenderAutoMaskAlphaDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderAutoMaskAlphaNonDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderUseFarClip")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderAvatarMaxVisible")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderDelayVBUpdate")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + + gSavedSettings.getControl("UseOcclusion")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + + gSavedSettings.getControl("VertexShaderEnable")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderAvatarVP")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("WindLightUseAtmosShaders")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderDeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderDeferredSunWash")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderFSAASamples")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderResolutionDivisor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderUIBuffer")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowDetail")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderDeferredSSAO")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowResolutionScale")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderLocalLights")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderDelayCreation")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderAnimateRes")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("FreezeTime")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("DebugBeaconLineWidth")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderHighlightBrightness")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderHighlightColor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderHighlightThickness")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderSpotLightsInNondeferred")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("PreviewAmbientColor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("PreviewDiffuse0")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("PreviewSpecular0")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("PreviewDiffuse1")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("PreviewSpecular1")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("PreviewDiffuse2")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("PreviewSpecular2")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("PreviewDirection0")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("PreviewDirection1")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("PreviewDirection2")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderGlowMinLuminance")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderGlowMaxExtractAlpha")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderGlowWarmthAmount")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderGlowLumWeights")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderGlowWarmthWeights")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderGlowResolutionPow")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderGlowIterations")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderGlowWidth")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderGlowStrength")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderDepthOfField")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("CameraFocusTransitionTime")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("CameraFNumber")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("CameraFocalLength")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("CameraFieldOfView")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowNoise")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowBlurSize")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderSSAOScale")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderSSAOMaxScale")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderSSAOFactor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderSSAOEffect")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowOffsetError")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowBiasError")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowOffset")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowBias")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderSpotShadowOffset")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderSpotShadowBias")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderEdgeDepthCutoff")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderEdgeNormCutoff")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowGaussian")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowBlurDistFactor")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderDeferredAtmospheric")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderReflectionDetail")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderHighlightFadeTime")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowClipPlanes")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowOrthoClipPlanes")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowNearDist")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderFarClip")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowSplitExponent")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowErrorCutoff")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("RenderShadowFOVCutoff")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("CameraOffset")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("CameraMaxCoF")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); + gSavedSettings.getControl("CameraDoFResScale")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings)); } LLPipeline::~LLPipeline() @@ -707,7 +793,6 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) { refreshCachedSettings(); - refreshRenderDeferred(); // remember these dimensions mScreenWidth = resX; @@ -840,12 +925,6 @@ void LLPipeline::updateRenderDeferred() } //static -void LLPipeline::refreshRenderDeferred() -{ - updateRenderDeferred(); -} - -//static void LLPipeline::refreshCachedSettings() { LLPipeline::sAutoMaskAlphaDeferred = gSavedSettings.getBOOL("RenderAutoMaskAlphaDeferred"); @@ -933,6 +1012,8 @@ void LLPipeline::refreshCachedSettings() CameraOffset = gSavedSettings.getBOOL("CameraOffset"); CameraMaxCoF = gSavedSettings.getF32("CameraMaxCoF"); CameraDoFResScale = gSavedSettings.getF32("CameraDoFResScale"); + + updateRenderDeferred(); } void LLPipeline::releaseGLBuffers() @@ -6159,13 +6240,13 @@ void LLPipeline::resetVertexBuffers() LLVertexBuffer::initClass(LLVertexBuffer::sEnableVBOs, LLVertexBuffer::sDisableVBOMapping); } -void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture) +void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture, BOOL batch_texture) { LLMemType mt_ro(LLMemType::MTYPE_PIPELINE_RENDER_OBJECTS); assertInitialized(); gGL.loadMatrix(gGLModelView); gGLLastMatrix = NULL; - mSimplePool->pushBatches(type, mask); + mSimplePool->pushBatches(type, mask, texture, batch_texture); gGL.loadMatrix(gGLModelView); gGLLastMatrix = NULL; } @@ -7027,13 +7108,12 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 n cube_map->enable(channel); cube_map->bind(); F32* m = gGLModelView; - - + F32 mat[] = { m[0], m[1], m[2], m[4], m[5], m[6], m[8], m[9], m[10] }; - shader.uniform3fv(LLShaderMgr::DEFERRED_ENV_MAT, 3, mat); + shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat); } } @@ -8195,7 +8275,14 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera } LLPipeline::sShadowRender = TRUE; - U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_FULLBRIGHT, LLRenderPass::PASS_SHINY, LLRenderPass::PASS_BUMP, LLRenderPass::PASS_FULLBRIGHT_SHINY }; + U32 types[] = { + LLRenderPass::PASS_SIMPLE, + LLRenderPass::PASS_FULLBRIGHT, + LLRenderPass::PASS_SHINY, + LLRenderPass::PASS_BUMP, + LLRenderPass::PASS_FULLBRIGHT_SHINY + }; + LLGLEnable cull(GL_CULL_FACE); if (use_shader) @@ -8267,7 +8354,15 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera LLFastTimer ftm(FTM_SHADOW_ALPHA); gDeferredShadowAlphaMaskProgram.bind(); gDeferredShadowAlphaMaskProgram.setMinimumAlpha(0.598f); - renderObjects(LLRenderPass::PASS_ALPHA_SHADOW, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR, TRUE); + + U32 mask = LLVertexBuffer::MAP_VERTEX | + LLVertexBuffer::MAP_TEXCOORD0 | + LLVertexBuffer::MAP_COLOR | + LLVertexBuffer::MAP_TEXTURE_INDEX; + + renderObjects(LLRenderPass::PASS_ALPHA_MASK, mask, TRUE, TRUE); + renderObjects(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, mask, TRUE, TRUE); + renderObjects(LLRenderPass::PASS_ALPHA, mask, TRUE, TRUE); gDeferredTreeShadowProgram.bind(); gDeferredTreeShadowProgram.setMinimumAlpha(0.598f); renderObjects(LLRenderPass::PASS_GRASS, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0, TRUE); @@ -8589,7 +8684,9 @@ void LLPipeline::generateSunShadow(LLCamera& camera) LLPipeline::RENDER_TYPE_TERRAIN, LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_VOIDWATER, - LLPipeline::RENDER_TYPE_PASS_ALPHA_SHADOW, + LLPipeline::RENDER_TYPE_PASS_ALPHA, + LLPipeline::RENDER_TYPE_PASS_ALPHA_MASK, + LLPipeline::RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK, LLPipeline::RENDER_TYPE_PASS_GRASS, LLPipeline::RENDER_TYPE_PASS_SIMPLE, LLPipeline::RENDER_TYPE_PASS_BUMP, diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 8b6532ca25..2815d736e4 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -231,7 +231,7 @@ public: void postSort(LLCamera& camera); void forAllVisibleDrawables(void (*func)(LLDrawable*)); - void renderObjects(U32 type, U32 mask, BOOL texture = TRUE); + void renderObjects(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_texture = FALSE); void renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture); void grabReferences(LLCullResult& result); @@ -359,7 +359,6 @@ public: static BOOL getRenderHighlights(void* data); static void updateRenderDeferred(); - static void refreshRenderDeferred(); static void refreshCachedSettings(); static void throttleNewMemoryAllocation(BOOL disable); @@ -408,7 +407,6 @@ public: RENDER_TYPE_PASS_ALPHA = LLRenderPass::PASS_ALPHA, RENDER_TYPE_PASS_ALPHA_MASK = LLRenderPass::PASS_ALPHA_MASK, RENDER_TYPE_PASS_FULLBRIGHT_ALPHA_MASK = LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, - RENDER_TYPE_PASS_ALPHA_SHADOW = LLRenderPass::PASS_ALPHA_SHADOW, // Following are object types (only used in drawable mRenderType) RENDER_TYPE_HUD = LLRenderPass::NUM_RENDER_TYPES, RENDER_TYPE_VOLUME, diff --git a/indra/newview/skins/default/xui/da/strings.xml b/indra/newview/skins/default/xui/da/strings.xml index 165d47c931..11d100eeff 100644 --- a/indra/newview/skins/default/xui/da/strings.xml +++ b/indra/newview/skins/default/xui/da/strings.xml @@ -560,6 +560,9 @@ Prøv venligst om lidt igen. <string name="mesh"> mesh </string> + <string name="AvatarEditingAppearance"> + (Redigering Udseende) + </string> <string name="AvatarAway"> Væk </string> diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index e71b714f25..0c38283d59 100644 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -34,7 +34,7 @@ </string> <string name="profile_succeeded_str"> - Profile feed updated! + Image uploaded </string> <string name="postcard_succeeded_str"> @@ -50,7 +50,7 @@ </string> <string name="profile_failed_str"> - Failed to update your Profile Feed. + Failed to upload image to your Profile Feed. </string> <string name="postcard_failed_str"> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index f5fee9d384..1834be2d48 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1754,12 +1754,6 @@ function="Tools.EnableReleaseKeys" parameter="" /> </menu_item_call> - <menu_item_call - label="Set UI Size to Default" - name="Set UI Size to Default"> - <menu_item_call.on_click - function="View.DefaultUISize" /> - </menu_item_call> <!-- This second, alternative shortcut for Show Advanced Menu is for backward compatibility. The main shortcut has been changed so it's Linux-friendly, where the old shortcut is typically eaten by the window manager. --> <menu_item_check label="Show Advanced Menu - legacy shortcut" diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index b174d51421..39cc1c2cb2 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6960,7 +6960,7 @@ With the following Residents: <usetemplate name="okcancelbuttons" notext="Cancel" - yestext="Ok"/> + yestext="OK"/> </notification> <notification @@ -7156,7 +7156,7 @@ Mute everyone? <usetemplate ignoretext="Confirm before I mute all participants in a group call" name="okcancelignore" - yestext="Ok" + yestext="OK" notext="Cancel"> <unique/> </usetemplate> diff --git a/indra/newview/skins/default/xui/en/panel_postcard_settings.xml b/indra/newview/skins/default/xui/en/panel_postcard_settings.xml index aebbc51be1..2e0bb88f53 100644 --- a/indra/newview/skins/default/xui/en/panel_postcard_settings.xml +++ b/indra/newview/skins/default/xui/en/panel_postcard_settings.xml @@ -113,11 +113,11 @@ label="Image quality" label_width="80" layout="topleft" - left="10" + left="0" max_val="100" name="image_quality_slider" top_pad="7" - width="200" /> + width="190" /> <text type="string" follows="left|top" diff --git a/indra/newview/skins/default/xui/en/panel_region_covenant.xml b/indra/newview/skins/default/xui/en/panel_region_covenant.xml index df16f6fd37..112f12500d 100644 --- a/indra/newview/skins/default/xui/en/panel_region_covenant.xml +++ b/indra/newview/skins/default/xui/en/panel_region_covenant.xml @@ -57,7 +57,7 @@ mouse_opaque="false" name="estate_name_text" top_delta="0" - width="150"> + width="350"> mainland </text> <text @@ -79,7 +79,7 @@ mouse_opaque="false" name="estate_owner_text" top_delta="0" - width="150"> + width="350"> (none) </text> <text diff --git a/indra/newview/skins/default/xui/en/widgets/window_shade.xml b/indra/newview/skins/default/xui/en/widgets/window_shade.xml new file mode 100644 index 0000000000..23eb2f13fb --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/window_shade.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<window_shade shade_color="0 0 0 0.5"/> diff --git a/indra/newview/skins/default/xui/es/panel_navigation_bar.xml b/indra/newview/skins/default/xui/es/panel_navigation_bar.xml index 1b7f5d5a9f..d36c6283bc 100644 --- a/indra/newview/skins/default/xui/es/panel_navigation_bar.xml +++ b/indra/newview/skins/default/xui/es/panel_navigation_bar.xml @@ -3,7 +3,7 @@ <layout_stack name="nvp_stack"> <layout_panel name="navigation_layout_panel"> <panel name="navigation_panel"> - <pull_button name="back_btn" tool_tip="Volver a lo localización anterior"/> + <pull_button name="back_btn" tool_tip="Volver a la localización anterior"/> <pull_button name="forward_btn" tool_tip="Ir una localización adelante"/> <button name="home_btn" tool_tip="Teleportar a mi Base"/> <location_input label="Lugar" name="location_combo"/> diff --git a/indra/newview/skins/default/xui/es/strings.xml b/indra/newview/skins/default/xui/es/strings.xml index 4cae6ce5e8..e3ea4baa6c 100644 --- a/indra/newview/skins/default/xui/es/strings.xml +++ b/indra/newview/skins/default/xui/es/strings.xml @@ -586,6 +586,9 @@ Intenta iniciar sesión de nuevo en unos instantes. <string name="mesh"> red </string> + <string name="AvatarEditingAppearance"> + (Edición de Apariencia) + </string> <string name="AvatarAway"> Ausente </string> diff --git a/indra/newview/skins/default/xui/fr/floater_object_weights.xml b/indra/newview/skins/default/xui/fr/floater_object_weights.xml index f1b063a3da..2667188308 100644 --- a/indra/newview/skins/default/xui/fr/floater_object_weights.xml +++ b/indra/newview/skins/default/xui/fr/floater_object_weights.xml @@ -1,28 +1,28 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <floater name="object_weights" title="AVANCÉ"> <floater.string name="nothing_selected" value="--"/> - <text name="selected_text" value="SELECTIONNÉ"/> + <text name="selected_text" value="SÉLECTION"/> <text name="objects" value="--"/> <text name="objects_label" value="Objets"/> <text name="prims" value="--"/> <text name="prims_label" value="Prims"/> - <text name="weights_of_selected_text" value="POIDS DES OBJETS SELECTIONNÉS"/> + <text name="weights_of_selected_text" value="POIDS DE LA SÉLECTION"/> <text name="download" value="--"/> - <text name="download_label" value="Télécharger"/> + <text name="download_label" value="Téléchargement"/> <text name="physics" value="--"/> - <text name="physics_label" value="Propriétés physiques"/> + <text name="physics_label" value="Physique"/> <text name="server" value="--"/> <text name="server_label" value="Serveur"/> <text name="display" value="--"/> - <text name="display_label" value="Afficher"/> + <text name="display_label" value="Affichage"/> <text name="land_impacts_text" value="IMPACTS SUR LE TERRAIN"/> <text name="selected" value="--"/> <text name="selected_label" value="Sélection"/> <text name="rezzed_on_land" value="--"/> - <text name="rezzed_on_land_label" value="Rezzé sur le terrain"/> + <text name="rezzed_on_land_label" value="Rezzés sur le terrain"/> <text name="remaining_capacity" value="--"/> <text name="remaining_capacity_label" value="Capacité restante"/> <text name="total_capacity" value="--"/> <text name="total_capacity_label" value="Capacité totale"/> - <text name="help_SLURL" value="[secondlife:///app/help/object_weights What is all this?...]"/> + <text name="help_SLURL" value="[secondlife:///app/help/object_weights De quoi s'agit-il ?...]"/> </floater> diff --git a/indra/newview/skins/default/xui/fr/floater_preview_animation.xml b/indra/newview/skins/default/xui/fr/floater_preview_animation.xml index a9407abfde..fdd2ac8beb 100644 --- a/indra/newview/skins/default/xui/fr/floater_preview_animation.xml +++ b/indra/newview/skins/default/xui/fr/floater_preview_animation.xml @@ -6,6 +6,6 @@ <text name="desc txt"> Description : </text> - <button label="Jouer dans Second Life" label_selected="Stop" name="Anim play btn" tool_tip="Lire cette animation de façon à ce que les autres puissent la voir" width="131"/> - <button label="Jouer localement" label_selected="Stop" left="160" name="Anim audition btn" tool_tip="Lire cette animation de façon à ce que vous soyez la seule personne à pouvoir la voir" width="120"/> + <button label="Exécuter dans Second Life" label_selected="Stop" name="Anim play btn" tool_tip="Lire cette animation de façon à ce que les autres puissent la voir" width="131"/> + <button label="Exécuter localement" label_selected="Stop" left="160" name="Anim audition btn" tool_tip="Lire cette animation de façon à ce que vous soyez la seule personne à pouvoir la voir" width="120"/> </floater> diff --git a/indra/newview/skins/default/xui/fr/floater_stats.xml b/indra/newview/skins/default/xui/fr/floater_stats.xml index a74a338bd7..2ce2e6dcd5 100644 --- a/indra/newview/skins/default/xui/fr/floater_stats.xml +++ b/indra/newview/skins/default/xui/fr/floater_stats.xml @@ -38,7 +38,7 @@ <stat_view label="Simulateur" name="sim"> <stat_bar label="Dilatation temporelle" name="simtimedilation"/> <stat_bar label="FPS sim" name="simfps"/> - <stat_bar label="Propriétés physiques FPS" name="simphysicsfps"/> + <stat_bar label="FPS physique" name="simphysicsfps"/> <stat_view label="Détails des propriétés physiques" name="physicsdetail"> <stat_bar label="Objets fixés" name="physicspinnedtasks"/> <stat_bar label="Objets LOD faibles" name="physicslodtasks"/> @@ -53,17 +53,17 @@ <stat_bar label="Événements de scripts" name="simscripteps"/> <stat_bar label="Paquets en entrée" name="siminpps"/> <stat_bar label="Paquets en sortie" name="simoutpps"/> - <stat_bar label="En attente des téléchargements" name="simpendingdownloads"/> - <stat_bar label="En attente des chargements" name="simpendinguploads"/> + <stat_bar label="Téléchargements en attente" name="simpendingdownloads"/> + <stat_bar label="Chargements en attente" name="simpendinguploads"/> <stat_bar label="Total Unacked Bytes" name="simtotalunackedbytes"/> <stat_view label="Temps (ms)" name="simperf"> - <stat_bar label="Durée du cadre totale" name="simframemsec"/> + <stat_bar label="Durée totale de l'image" name="simframemsec"/> <stat_bar label="Durée nette" name="simnetmsec"/> - <stat_bar label="Durée physique" name="simsimphysicsmsec"/> - <stat_bar label="Durée de la simulation" name="simsimothermsec"/> - <stat_bar label="Durée de l'avatar" name="simagentmsec"/> + <stat_bar label="Durée sim (physique)" name="simsimphysicsmsec"/> + <stat_bar label="Durée sim (autre)" name="simsimothermsec"/> + <stat_bar label="Durée des avatars" name="simagentmsec"/> <stat_bar label="Durée des images" name="simimagesmsec"/> - <stat_bar label="Durée du script" name="simscriptmsec"/> + <stat_bar label="Durée des scripts" name="simscriptmsec"/> <stat_bar label="Temps d'inactivité" name="simsparemsec"/> <stat_view label="Détails Temps (ms)" name="timedetails"> <stat_bar label="Etape propr. physiques" name="simsimphysicsstepmsec"/> diff --git a/indra/newview/skins/default/xui/fr/floater_tools.xml b/indra/newview/skins/default/xui/fr/floater_tools.xml index 1ecf47f2e5..af5678ff0e 100644 --- a/indra/newview/skins/default/xui/fr/floater_tools.xml +++ b/indra/newview/skins/default/xui/fr/floater_tools.xml @@ -106,7 +106,7 @@ Aucune sélection effectuée. </text> <text name="remaining_capacity"> - [CAPACITY_STRING] [secondlife:///app/openfloater/object_weights More info] + [CAPACITY_STRING] [secondlife:///app/openfloater/object_weights Plus d'infos] </text> <tab_container name="Object Info Tabs"> <panel label="Général" name="General"> diff --git a/indra/newview/skins/default/xui/fr/floater_toybox.xml b/indra/newview/skins/default/xui/fr/floater_toybox.xml index e6fa212c65..33aea6bb2d 100644 --- a/indra/newview/skins/default/xui/fr/floater_toybox.xml +++ b/indra/newview/skins/default/xui/fr/floater_toybox.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="Toybox" title="PERSONNALISER LA BARRE D'OUTILS"> +<floater name="Toybox" title="PERSONNALISER LES BARRES D'OUTILS"> <text name="toybox label 1"> - Ajouter ou supprimer des boutons en les faisant glisser vers les barres d'outils ou à partir de ces dernières. + Ajouter ou supprimer des boutons : les faire glisser vers ou depuis les barres d'outils. </text> <text name="toybox label 2"> - Les boutons s'afficheront comme indiqué ou comme des icônes, en fonction des paramètres de chaque barre d'outils. + Ils s'afficheront comme indiqué ou comme des icônes, selon les paramètres de barre d'outils. </text> - <button label="Restaurer les choix par défaut" label_selected="Restaurer les choix par défaut" name="btn_restore_defaults"/> + <button label="Valeurs par défaut" label_selected="Valeurs par défaut" name="btn_restore_defaults"/> </floater> diff --git a/indra/newview/skins/default/xui/fr/menu_group_plus.xml b/indra/newview/skins/default/xui/fr/menu_group_plus.xml index 0db5afedc7..ad76f11d79 100644 --- a/indra/newview/skins/default/xui/fr/menu_group_plus.xml +++ b/indra/newview/skins/default/xui/fr/menu_group_plus.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <menu name="menu_group_plus"> - <menu_item_call label="Rejoindre des groupes..." name="item_join"/> + <menu_item_call label="Rejoindre un groupe..." name="item_join"/> <menu_item_call label="Nouveau groupe..." name="item_new"/> </menu> diff --git a/indra/newview/skins/default/xui/fr/menu_inventory.xml b/indra/newview/skins/default/xui/fr/menu_inventory.xml index 53df8d11da..403111c4de 100644 --- a/indra/newview/skins/default/xui/fr/menu_inventory.xml +++ b/indra/newview/skins/default/xui/fr/menu_inventory.xml @@ -71,7 +71,7 @@ <menu_item_call label="Jouer dans Second Life" name="Animation Play"/> <menu_item_call label="Jouer localement" name="Animation Audition"/> <menu_item_call label="Envoyer un message instantané" name="Send Instant Message"/> - <menu_item_call label="Offrir de téléporter..." name="Offer Teleport..."/> + <menu_item_call label="Proposer une téléportation..." name="Offer Teleport..."/> <menu_item_call label="Démarrer le chat conférence" name="Conference Chat"/> <menu_item_call label="Activer" name="Activate"/> <menu_item_call label="Désactiver" name="Deactivate"/> diff --git a/indra/newview/skins/default/xui/fr/menu_people_nearby_view_sort.xml b/indra/newview/skins/default/xui/fr/menu_people_nearby_view_sort.xml index 0aad174fbd..8bb466b8d6 100644 --- a/indra/newview/skins/default/xui/fr/menu_people_nearby_view_sort.xml +++ b/indra/newview/skins/default/xui/fr/menu_people_nearby_view_sort.xml @@ -5,5 +5,5 @@ <menu_item_check label="Trier par distance" name="sort_distance"/> <menu_item_check label="Afficher les icônes des résidents" name="view_icons"/> <menu_item_check label="Afficher la carte" name="view_map"/> - <menu_item_call label="Afficher les résidents et les objets interdits" name="show_blocked_list"/> + <menu_item_call label="Afficher les résidents et les objets ignorés" name="show_blocked_list"/> </toggleable_menu> diff --git a/indra/newview/skins/default/xui/fr/menu_toolbars.xml b/indra/newview/skins/default/xui/fr/menu_toolbars.xml index bbfbe4b9ed..d3e9f92770 100644 --- a/indra/newview/skins/default/xui/fr/menu_toolbars.xml +++ b/indra/newview/skins/default/xui/fr/menu_toolbars.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <context_menu name="Toolbars Popup"> <menu_item_call label="Choisir les boutons..." name="Chose Buttons"/> - <menu_item_check label="Icônes et étiquettes" name="icons_with_text"/> + <menu_item_check label="Icônes et libellés" name="icons_with_text"/> <menu_item_check label="Icônes uniquement" name="icons_only"/> </context_menu> diff --git a/indra/newview/skins/default/xui/fr/menu_viewer.xml b/indra/newview/skins/default/xui/fr/menu_viewer.xml index 64cd463070..e2cb1f999d 100644 --- a/indra/newview/skins/default/xui/fr/menu_viewer.xml +++ b/indra/newview/skins/default/xui/fr/menu_viewer.xml @@ -24,7 +24,7 @@ <menu_item_call label="Acheter des L$" name="Buy and Sell L$"/> <menu_item_call label="Préférences..." name="Preferences"/> <menu_item_call label="Barres d'outils..." name="Toolbars"/> - <menu_item_call label="Cacher tous les contrôles" name="Hide UI"/> + <menu_item_call label="Masquer tous les contrôles" name="Hide UI"/> <menu_item_call label="Quitter [APP_NAME]" name="Quit"/> </menu> <menu label="Communiquer" name="Communicate"> @@ -319,7 +319,7 @@ <menu_item_check label="Pauser l'avatar" name="AgentPause"/> <menu_item_call label="Activer le journal des messages" name="Enable Message Log"/> <menu_item_call label="Désactiver le journal des messages" name="Disable Message Log"/> - <menu_item_check label="Velocity Interpolate Objects" name="Velocity Interpolate Objects"/> + <menu_item_check label="Objets d'interpolation de vitesse" name="Velocity Interpolate Objects"/> <menu_item_check label="Interpolation ping des positions des objets" name="Ping Interpolate Object Positions"/> <menu_item_call label="Abandonner un paquet" name="Drop a Packet"/> </menu> @@ -336,7 +336,7 @@ <menu_item_check label="Ignorer les paramètres du soleil de la sim" name="Sim Sun Override"/> <menu_item_check label="Balise animée" name="Cheesy Beacon"/> <menu_item_check label="Météo fixe" name="Fixed Weather"/> - <menu_item_call label="Dump Region Object Cache" name="Dump Region Object Cache"/> + <menu_item_call label="Vidage de cache d'objet de la région" name="Dump Region Object Cache"/> </menu> <menu label="Interface" name="UI"> <menu_item_call label="Test du navigateur de médias" name="Web Browser Test"/> diff --git a/indra/newview/skins/default/xui/fr/notifications.xml b/indra/newview/skins/default/xui/fr/notifications.xml index 18b9063c00..d8d79d8dde 100644 --- a/indra/newview/skins/default/xui/fr/notifications.xml +++ b/indra/newview/skins/default/xui/fr/notifications.xml @@ -3046,8 +3046,8 @@ Cliquez sur un point dans le monde et faites glisser votre souris pour faire tou <usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/> </notification> <notification label="" name="ConfirmHideUI"> - Cette action cachera tous les objets des menus et boutons. Pour les récupérer, cliquez de nouveau sur [SHORTCUT]. - <usetemplate ignoretext="Confimer avant de cacher l'interface" name="okcancelignore" notext="Annuler" yestext="OK"/> + Cette action masquera tous les boutons et articles de menu. Pour les récupérer, cliquez de nouveau sur [SHORTCUT]. + <usetemplate ignoretext="Confirmer avant de masquer l'interface" name="okcancelignore" notext="Annuler" yestext="OK"/> </notification> <global name="UnsupportedGLRequirements"> Vous semblez ne pas avoir le matériel requis pour utiliser [APP_NAME]. [APP_NAME] requiert une carte graphique OpenGL avec une prise en charge du multitexturing. Si vous avez une telle carte, assurez-vous que vous avez aussi les pilotes les plus récents pour la carte, ainsi que les service packs et les patchs pour votre système d'exploitation. diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_move.xml b/indra/newview/skins/default/xui/fr/panel_preferences_move.xml index efb520bfd3..94d7322b22 100644 --- a/indra/newview/skins/default/xui/fr/panel_preferences_move.xml +++ b/indra/newview/skins/default/xui/fr/panel_preferences_move.xml @@ -24,16 +24,16 @@ Clic simple sur le terrain : </text> <combo_box name="single_click_action_combo"> - <combo_box.item label="Pas d'action" name="0"/> - <combo_box.item label="Bouger vers le point cliqué" name="1"/> + <combo_box.item label="Aucune action" name="0"/> + <combo_box.item label="Déplacement vers le clic" name="1"/> </combo_box> <text name="double_click_action_lbl"> Double-clic sur le terrain : </text> <combo_box name="double_click_action_combo"> - <combo_box.item label="Pas d'action" name="0"/> - <combo_box.item label="Bouger vers le point cliqué" name="1"/> - <combo_box.item label="Téléporter vers le point cliqué" name="2"/> + <combo_box.item label="Aucune action" name="0"/> + <combo_box.item label="Déplacement vers le double clic" name="1"/> + <combo_box.item label="Téléportation vers le double clic" name="2"/> </combo_box> <button label="Autres accessoires" name="joystick_setup_button"/> </panel> diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml index b122db9502..cf1a374da6 100644 --- a/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml +++ b/indra/newview/skins/default/xui/fr/panel_preferences_privacy.xml @@ -20,7 +20,7 @@ <check_box label="Inclure la date et l'heure pour chaque ligne du journal de chat" name="show_timestamps_check_im"/> <check_box label="Inclure la date dans le nom du fichier journal" name="logfile_name_datestamp"/> <text name="log_path_desc"> - Emplacement des journaux : + Emplacement journaux : </text> <line_editor left="308" name="log_path_string" right="-20"/> <button label="Parcourir" label_selected="Parcourir" name="log_path_button" width="150"/> diff --git a/indra/newview/skins/default/xui/fr/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/fr/panel_prim_media_controls.xml index f16fcebd02..ad744b7760 100644 --- a/indra/newview/skins/default/xui/fr/panel_prim_media_controls.xml +++ b/indra/newview/skins/default/xui/fr/panel_prim_media_controls.xml @@ -13,10 +13,10 @@ </layout_stack> <layout_stack name="media_controls"> <layout_panel name="back"> - <button name="back_btn" tool_tip="Naviguer en arrière"/> + <button name="back_btn" tool_tip="Précédente"/> </layout_panel> <layout_panel name="fwd"> - <button name="fwd_btn" tool_tip="Naviguer vers l'avant"/> + <button name="fwd_btn" tool_tip="Suivante"/> </layout_panel> <layout_panel name="home"> <button name="home_btn" tool_tip="Page d'accueil"/> @@ -34,7 +34,7 @@ <button name="play_btn" tool_tip="Lire le média"/> </layout_panel> <layout_panel name="pause"> - <button name="pause_btn" tool_tip="Pauser le média"/> + <button name="pause_btn" tool_tip="Mettre le média sur pause"/> </layout_panel> <layout_panel name="media_address"> <line_editor name="media_address_url" tool_tip="URL du média"/> @@ -48,7 +48,7 @@ </layout_stack> </layout_panel> <layout_panel name="media_play_position"> - <slider_bar initial_value="0.5" name="media_play_slider" tool_tip="Progrès de la lecture du film"/> + <slider_bar initial_value="0.5" name="media_play_slider" tool_tip="Progression de la lecture du film"/> </layout_panel> <layout_panel name="skip_back"> <button name="skip_back_btn" tool_tip="Reculer"/> diff --git a/indra/newview/skins/default/xui/fr/panel_status_bar.xml b/indra/newview/skins/default/xui/fr/panel_status_bar.xml index e836c24a94..ac61eb7e52 100644 --- a/indra/newview/skins/default/xui/fr/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/fr/panel_status_bar.xml @@ -17,12 +17,12 @@ </panel.string> <panel name="balance_bg"> <text name="balance" tool_tip="Cliquer sur ce bouton pour actualiser votre solde en L$." value="20 L$"/> - <button label="Achat de L$" name="buyL" tool_tip="Cliquer pour acheter plus de L$"/> - <button label="Achats" name="goShop" tool_tip="Ouvrir la Place du marché Second Life"/> + <button label="Acheter L$" name="buyL" tool_tip="Cliquer pour acheter plus de L$."/> + <button label="Achats" name="goShop" tool_tip="Ouvrir la Place du marché Second Life."/> </panel> <text name="TimeText" tool_tip="Heure actuelle (Pacifique)"> 00h00 PST </text> - <button name="media_toggle_btn" tool_tip="Arrêter tous les médias (musique, vidéo, pages web)"/> - <button name="volume_btn" tool_tip="Contrôle du volume global"/> + <button name="media_toggle_btn" tool_tip="Arrêter tous les médias (musique, vidéo, pages web)."/> + <button name="volume_btn" tool_tip="Régler le volume global."/> </panel> diff --git a/indra/newview/skins/default/xui/it/strings.xml b/indra/newview/skins/default/xui/it/strings.xml index e58ce0cd70..8f29233825 100644 --- a/indra/newview/skins/default/xui/it/strings.xml +++ b/indra/newview/skins/default/xui/it/strings.xml @@ -592,6 +592,9 @@ Prova ad accedere nuovamente tra un minuto. <string name="mesh"> reticolo </string> + <string name="AvatarEditingAppearance"> + (Modifica Aspetto) + </string> <string name="AvatarAway"> Assente </string> diff --git a/indra/newview/skins/default/xui/pl/strings.xml b/indra/newview/skins/default/xui/pl/strings.xml index 6a8309cca5..f6dec8536b 100644 --- a/indra/newview/skins/default/xui/pl/strings.xml +++ b/indra/newview/skins/default/xui/pl/strings.xml @@ -423,6 +423,9 @@ <string name="symbolic folder link"> link folderu </string> + <string name="AvatarEditingAppearance"> + (Edycja Wygląd) + </string> <string name="AvatarAway"> Śpi </string> diff --git a/indra/newview/skins/default/xui/pt/strings.xml b/indra/newview/skins/default/xui/pt/strings.xml index cc61ad76d7..4535c7aaeb 100644 --- a/indra/newview/skins/default/xui/pt/strings.xml +++ b/indra/newview/skins/default/xui/pt/strings.xml @@ -547,6 +547,9 @@ Titulares de contas gratuitas não poderão acessar o Second Life para acomodar <string name="mesh"> mesh </string> + <string name="AvatarEditingAppearance"> + (Edição Aparência) + </string> <string name="AvatarAway"> Distante </string> diff --git a/indra/test/llsd_new_tut.cpp b/indra/test/llsd_new_tut.cpp index b2fa54a688..f928a1bad0 100644 --- a/indra/test/llsd_new_tut.cpp +++ b/indra/test/llsd_new_tut.cpp @@ -25,6 +25,7 @@ * $/LicenseInfo$ */ +#define LLSD_DEBUG_INFO #include <tut/tut.hpp> #include "linden_common.h" #include "lltut.h" @@ -52,11 +53,11 @@ namespace tut private: U32 mOutstandingAtStart; public: - SDCleanupCheck() : mOutstandingAtStart(LLSD::outstandingCount()) { } + SDCleanupCheck() : mOutstandingAtStart(llsd::outstandingCount()) { } ~SDCleanupCheck() { ensure_equals("SDCleanupCheck", - LLSD::outstandingCount(), mOutstandingAtStart); + llsd::outstandingCount(), mOutstandingAtStart); } }; @@ -70,12 +71,12 @@ namespace tut SDAllocationCheck(const std::string& message, int expectedAllocations) : mMessage(message), mExpectedAllocations(expectedAllocations), - mAllocationAtStart(LLSD::allocationCount()) + mAllocationAtStart(llsd::allocationCount()) { } ~SDAllocationCheck() { ensure_equals(mMessage + " SDAllocationCheck", - LLSD::allocationCount() - mAllocationAtStart, + llsd::allocationCount() - mAllocationAtStart, mExpectedAllocations); } }; @@ -756,6 +757,42 @@ namespace tut { SDAllocationCheck check("shared values test for threaded work", 9); + //U32 start_llsd_count = llsd::outstandingCount(); + + LLSD m = LLSD::emptyMap(); + + m["one"] = 1; + m["two"] = 2; + m["one_copy"] = m["one"]; // 3 (m, "one" and "two") + + m["undef_one"] = LLSD(); + m["undef_two"] = LLSD(); + m["undef_one_copy"] = m["undef_one"]; + + { // Ensure first_array gets freed to avoid counting it + LLSD first_array = LLSD::emptyArray(); + first_array.append(1.0f); + first_array.append(2.0f); + first_array.append(3.0f); // 7 + + m["array"] = first_array; + m["array_clone"] = first_array; + m["array_copy"] = m["array"]; // 7 + } + + m["string_one"] = "string one value"; + m["string_two"] = "string two value"; + m["string_one_copy"] = m["string_one"]; // 9 + + //U32 llsd_object_count = llsd::outstandingCount(); + //std::cout << "Using " << (llsd_object_count - start_llsd_count) << " LLSD objects" << std::endl; + + //m.dumpStats(); + } + + { + SDAllocationCheck check("shared values test for threaded work", 9); + //U32 start_llsd_count = LLSD::outstandingCount(); LLSD m = LLSD::emptyMap(); diff --git a/indra/test/lltut.cpp b/indra/test/lltut.cpp index da7031b52a..c43a8f0c7d 100644 --- a/indra/test/lltut.cpp +++ b/indra/test/lltut.cpp @@ -34,6 +34,7 @@ #include "llformat.h" #include "llsd.h" #include "lluri.h" +#include "stringize.h" namespace tut { @@ -144,6 +145,10 @@ namespace tut } return; } + default: + // should never get here, but compiler produces warning if we + // don't cover this case, and at Linden warnings are fatal. + throw failure(STRINGIZE("invalid type field " << actual.type())); } } |