From f90beef498640a2f7fd083eac687acac16e28613 Mon Sep 17 00:00:00 2001 From: thickbrick Date: Tue, 12 Oct 2010 18:21:07 +0200 Subject: Don't try to fetch http-textures past end of file Treat http texture requests that returned less data than requsted as indication that we have the whole file, even if we did not specifically requested the whole file by using a very large range yet. IMPORTANT: This will fail to load past 599 bytes in OpenSim <= 0.7.0.2, as it has buggy handling of ranged requests. But OpenSim http texture breakage is not new. http://opensimulator.org/mantis/view.php?id=5081 --- linden/indra/newview/lltexturefetch.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/linden/indra/newview/lltexturefetch.cpp b/linden/indra/newview/lltexturefetch.cpp index 5cad14c..bf97584 100644 --- a/linden/indra/newview/lltexturefetch.cpp +++ b/linden/indra/newview/lltexturefetch.cpp @@ -317,7 +317,7 @@ public: mFetcher->mTextureInfo.setRequestCompleteTimeAndLog(mID, timeNow); } - lldebugs << "HTTP COMPLETE: " << mID << llendl; + LL_DEBUGS("TextureFetch") << "HTTP COMPLETE: " << mID << " with status: " << status << LL_ENDL; mFetcher->lockQueue(); LLTextureFetchWorker* worker = mFetcher->getWorker(mID); if (worker) @@ -882,10 +882,11 @@ bool LLTextureFetchWorker::doWork(S32 param) mLoaded = FALSE; mGetStatus = 0; mGetReason.clear(); - lldebugs << "HTTP GET: " << mID << " Offset: " << offset + LL_DEBUGS("TextureFetch") << "HTTP GET: " << mID << " Offset: " << offset << " Bytes: " << mRequestedSize + << " Range: " << offset << "-" << offset+mRequestedSize-1 << " Bandwidth(kbps): " << mFetcher->getTextureBandwidth() << "/" << max_bandwidth - << llendl; + << LL_ENDL; setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); mState = WAIT_HTTP_REQ; @@ -1322,18 +1323,18 @@ void LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels, gImageList.sTextureBits += data_size * 8; // Approximate - does not include header bits - //llinfos << "HTTP RECEIVED: " << mID.asString() << " Bytes: " << data_size << llendl; + LL_DEBUGS("TextureFetch") << "HTTP RECEIVED: " << mID.asString() << " Bytes: " << data_size << " mRequestedSize: " << mRequestedSize << LL_ENDL; if (data_size > 0) { // *TODO: set the formatted image data here directly to avoid the copy mBuffer = new U8[data_size]; buffer->readAfter(channels.in(), NULL, mBuffer, data_size); mBufferSize += data_size; - if (data_size < mRequestedSize && - (mRequestedDiscard == 0 || mRequestedSize >= MAX_IMAGE_DATA_SIZE) ) + if (data_size < mRequestedSize) { // We requested whole image (by discard or by size,) so assume we got it mHaveAllData = TRUE; + mRequestedDiscard = 0; } else if (data_size > mRequestedSize) { -- cgit v1.1 From 202deea1a2480f5a18553f6e60e797a5f2582eb6 Mon Sep 17 00:00:00 2001 From: thickbrick Date: Thu, 14 Oct 2010 20:22:23 +0200 Subject: More robust handling of http texture responses. Specifically allow for status 416 (unsatisfiable range) and scuessful responses without status 216 (i.e. whole file at once). This *should* allow this to work on different servers, as long as they comply with RFC 2616 WRT range requests. --- linden/indra/newview/lltexturefetch.cpp | 97 +++++++++++++++++++++++---------- 1 file changed, 68 insertions(+), 29 deletions(-) diff --git a/linden/indra/newview/lltexturefetch.cpp b/linden/indra/newview/lltexturefetch.cpp index bf97584..80e3bfc 100644 --- a/linden/indra/newview/lltexturefetch.cpp +++ b/linden/indra/newview/lltexturefetch.cpp @@ -157,7 +157,7 @@ public: void callbackHttpGet(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer, - bool last_block, bool success); + bool partial, bool unsatisfiable, bool success); void callbackCacheRead(bool success, LLImageFormatted* image, S32 imagesize, BOOL islocal); void callbackCacheWrite(bool success); @@ -324,6 +324,7 @@ public: { bool success = false; bool partial = false; + bool unsatisfiable = false; if (200 <= status && status < 300) { success = true; @@ -332,18 +333,19 @@ public: partial = true; } } - else + else if (status == HTTP_REQUESTED_RANGE_NOT_SATISFIABLE) { - worker->setGetStatus(status, reason); -// llwarns << status << ": " << reason << llendl; + LL_DEBUGS("TextureFetch") << "Request was an unsatisfiable range: mRequestedSize=" << mRequestedSize << " mOffset=" << mOffset << " for: " << mID << LL_ENDL; + unsatisfiable = true; } + if (!success) { worker->setGetStatus(status, reason); // llwarns << "CURL GET FAILED, status:" << status << " reason:" << reason << llendl; } mFetcher->removeFromHTTPQueue(mID); - worker->callbackHttpGet(channels, buffer, partial, success); + worker->callbackHttpGet(channels, buffer, partial, unsatisfiable, success); } else { @@ -1301,7 +1303,9 @@ bool LLTextureFetchWorker::processSimulatorPackets() void LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer, - bool last_block, bool success) + bool partial, + bool unsatisfiable, + bool success) { LLMutexLock lock(&mWorkMutex); @@ -1316,56 +1320,91 @@ void LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels, llwarns << "Duplicate callback for " << mID.asString() << llendl; return; // ignore duplicate callback } + + S32 data_size = 0; if (success) { // get length of stream: - S32 data_size = buffer->countAfter(channels.in(), NULL); + data_size = buffer->countAfter(channels.in(), NULL); gImageList.sTextureBits += data_size * 8; // Approximate - does not include header bits LL_DEBUGS("TextureFetch") << "HTTP RECEIVED: " << mID.asString() << " Bytes: " << data_size << " mRequestedSize: " << mRequestedSize << LL_ENDL; + if (data_size > 0) { - // *TODO: set the formatted image data here directly to avoid the copy - mBuffer = new U8[data_size]; - buffer->readAfter(channels.in(), NULL, mBuffer, data_size); - mBufferSize += data_size; - if (data_size < mRequestedSize) + bool clean_data = false; + bool done = false; + if (!partial) { - // We requested whole image (by discard or by size,) so assume we got it - mHaveAllData = TRUE; - mRequestedDiscard = 0; + // we got the whole image in one go + done = true; + clean_data = true; + } + else if (data_size < mRequestedSize) + { + // we have the whole image + done = true; + } + else if (data_size == mRequestedSize) + { + if (mRequestedDiscard <= 0) + { + done = true; + } + else + { + // this is the normal case where we get the data we requested, + // but still need to request more data. + } } else if (data_size > mRequestedSize) { // *TODO: This shouldn't be happening any more llwarns << "data_size = " << data_size << " > requested: " << mRequestedSize << llendl; - mHaveAllData = TRUE; + done = true; + clean_data = true; llassert_always(mDecodeHandle == 0); - mFormattedImage = NULL; // discard any previous data we had - mBufferSize = data_size; } - mRequestedSize = data_size; - } - else - { - // We requested data but received none (and no error), - if (mFormattedImage.notNull() && mFormattedImage->getDataSize() > 0) + + if (clean_data) { - // but have earlier data, so presumably we have it all. - mRequestedSize = 0; - mHaveAllData = TRUE; + resetFormattedData(); // discard any previous data we had + llassert(mBufferSize == 0); } - else + if (done) { - mRequestedSize = -1; // treat this fetch as if it failed. + mHaveAllData = TRUE; + mRequestedDiscard = 0; } + + // *TODO: set the formatted image data here directly to avoid the copy + mBuffer = new U8[data_size]; + buffer->readAfter(channels.in(), NULL, mBuffer, data_size); + mBufferSize += data_size; + mRequestedSize = data_size; + } + } + + if ((success && (data_size == 0)) || unsatisfiable) + { + if (mFormattedImage.notNull() && mFormattedImage->getDataSize() > 0) + { + // we already have some data, so we'll assume we have it all + mRequestedSize = 0; + mRequestedDiscard = 0; + mHaveAllData = TRUE; + } + else + { + mRequestedSize = -1; // treat this fetch as if it failed. } } else { mRequestedSize = -1; // error } + mLoaded = TRUE; setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); } -- cgit v1.1 From 4d9f3db24601091947611aa20efbb8432e4f2aa7 Mon Sep 17 00:00:00 2001 From: thickbrick Date: Thu, 14 Oct 2010 20:34:04 +0200 Subject: Work around for buggy range responses in OpenSim Ugly work around for http://opensimulator.org/mantis/view.php?id=5081 by adding 1 to the http request range when on affected versions, and always requesting ranges that start with 0 (viewer2 style). --- linden/indra/newview/lltexturefetch.cpp | 53 ++++++++++++++++++++++++++++++++- linden/indra/newview/lltexturefetch.h | 2 ++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/linden/indra/newview/lltexturefetch.cpp b/linden/indra/newview/lltexturefetch.cpp index 80e3bfc..bd1812e 100644 --- a/linden/indra/newview/lltexturefetch.cpp +++ b/linden/indra/newview/lltexturefetch.cpp @@ -871,6 +871,16 @@ bool LLTextureFetchWorker::doWork(S32 param) return false; } } + + // *TODO: remove this hack when not needed anymore + S32 buggy_range_fudge = 0; + if (LLTextureFetch::hasBuggyHTTPRange()) + { + buggy_range_fudge = 1; + resetFormattedData(); // discard any previous data we had + cur_size = 0 ; + } + mRequestedSize = mDesiredSize; mRequestedDiscard = mDesiredDiscard; mRequestedSize -= cur_size; @@ -896,7 +906,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // Will call callbackHttpGet when curl request completes std::vector headers; headers.push_back("Accept: image/x-j2c"); - res = mFetcher->mCurlGetRequest->getByteRange(mUrl, headers, offset, mRequestedSize, + res = mFetcher->mCurlGetRequest->getByteRange(mUrl, headers, offset, mRequestedSize + buggy_range_fudge, new HTTPGetResponder(mFetcher, mID, LLTimer::getTotalTime(), mRequestedSize, offset)); } if (!res) @@ -2258,3 +2268,44 @@ void LLTextureFetch::dump() } } +// This tries to detect if the sim has this bug: +// http://opensimulator.org/mantis/view.php?id=5081 +// +// *TODO: This is a *HACK and may not work if the grid is heterogenous. +// Remove it once OpenSim versions in the wild are > 0.7.0.2! +#include "hippoGridManager.h" +#include +//static +bool LLTextureFetch::hasBuggyHTTPRange() +{ + static std::string s_version; + static bool buggy = false; + if ((s_version != gLastVersionChannel) && !gLastVersionChannel.empty()) + { + s_version = gLastVersionChannel; + buggy = true; + if (gHippoGridManager->getConnectedGrid()->getPlatform() == HippoGridInfo::PLATFORM_OPENSIM) + { + std::string ver_string; + try + { + const boost::regex re(".*OpenSim.*?([0-9.]+).+"); + ver_string = regex_replace(s_version, re, "\\1", boost::match_default); + } + catch(std::runtime_error) + { + ver_string = "0.0"; + } + LLStringUtil::replaceChar(ver_string, '.', '0'); + ver_string = "0." + ver_string; + F64 version = atof(ver_string.c_str()); + // we look for "0.6.8" < version < "0.7.0.3" + if ((version > 0.00608) && (version < 0.0070003)) + { + buggy = true; + llwarns << "Setting buggy http ranges mode for current sim, because we're on " << s_version << llendl; + } + } + } + return buggy; +} diff --git a/linden/indra/newview/lltexturefetch.h b/linden/indra/newview/lltexturefetch.h index 5eca0ba..61f76bc 100644 --- a/linden/indra/newview/lltexturefetch.h +++ b/linden/indra/newview/lltexturefetch.h @@ -86,6 +86,8 @@ public: LLTextureInfo* getTextureInfo() { return &mTextureInfo; } + static bool hasBuggyHTTPRange(); // *TODO: remove this *HACK once buggy OpenSim versions are gone + protected: void addToNetworkQueue(LLTextureFetchWorker* worker); void removeFromNetworkQueue(LLTextureFetchWorker* worker, bool cancel); -- cgit v1.1 From 7b0ce8e12ac68bfc1eb7524a394aaf3a485b559b Mon Sep 17 00:00:00 2001 From: thickbrick Date: Fri, 15 Oct 2010 01:21:53 +0200 Subject: Fix typo in buggy OpenSim version detection. --- linden/indra/newview/lltexturefetch.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linden/indra/newview/lltexturefetch.cpp b/linden/indra/newview/lltexturefetch.cpp index bd1812e..e307aff 100644 --- a/linden/indra/newview/lltexturefetch.cpp +++ b/linden/indra/newview/lltexturefetch.cpp @@ -896,7 +896,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mGetReason.clear(); LL_DEBUGS("TextureFetch") << "HTTP GET: " << mID << " Offset: " << offset << " Bytes: " << mRequestedSize - << " Range: " << offset << "-" << offset+mRequestedSize-1 + << " Range: " << offset << "-" << offset+mRequestedSize-1+buggy_range_fudge << " Bandwidth(kbps): " << mFetcher->getTextureBandwidth() << "/" << max_bandwidth << LL_ENDL; setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); @@ -2283,7 +2283,7 @@ bool LLTextureFetch::hasBuggyHTTPRange() if ((s_version != gLastVersionChannel) && !gLastVersionChannel.empty()) { s_version = gLastVersionChannel; - buggy = true; + buggy = false; if (gHippoGridManager->getConnectedGrid()->getPlatform() == HippoGridInfo::PLATFORM_OPENSIM) { std::string ver_string; -- cgit v1.1 From f99462872fd9d54658f8702929583bd4a607b21a Mon Sep 17 00:00:00 2001 From: thickbrick Date: Sat, 16 Oct 2010 03:11:19 +0200 Subject: Fix the fix - bad logic for failed http requests --- linden/indra/newview/lltexturefetch.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/linden/indra/newview/lltexturefetch.cpp b/linden/indra/newview/lltexturefetch.cpp index e307aff..a39e2df 100644 --- a/linden/indra/newview/lltexturefetch.cpp +++ b/linden/indra/newview/lltexturefetch.cpp @@ -1395,6 +1395,10 @@ void LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels, mRequestedSize = data_size; } } + else + { + mRequestedSize = -1; // error + } if ((success && (data_size == 0)) || unsatisfiable) { @@ -1410,11 +1414,7 @@ void LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels, mRequestedSize = -1; // treat this fetch as if it failed. } } - else - { - mRequestedSize = -1; // error - } - + mLoaded = TRUE; setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); } -- cgit v1.1 From ee23c250612b9b2da34472c47c740746232c6104 Mon Sep 17 00:00:00 2001 From: thickbrick Date: Sat, 16 Oct 2010 03:16:14 +0200 Subject: Port of SNOW-802: Use UDP for baked textures. Port of SNOW-802 from SG1. Originally ported by Robin cornelius from SG 2.1. Also added a paramter can_use_http to the LLTextureFetchWorker constructor, to avoid messing with locks. --- linden/indra/newview/lltexturefetch.cpp | 12 +++++++----- linden/indra/newview/lltexturefetch.h | 2 +- linden/indra/newview/llviewerimage.cpp | 6 ++++-- linden/indra/newview/llviewerimage.h | 4 ++++ linden/indra/newview/llvoavatar.cpp | 1 + 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/linden/indra/newview/lltexturefetch.cpp b/linden/indra/newview/lltexturefetch.cpp index a39e2df..f63deb8 100644 --- a/linden/indra/newview/lltexturefetch.cpp +++ b/linden/indra/newview/lltexturefetch.cpp @@ -176,7 +176,7 @@ protected: LLTextureFetchWorker(LLTextureFetch* fetcher, const LLUUID& id, const LLHost& host, F32 priority, S32 discard, S32 size); LLTextureFetchWorker(LLTextureFetch* fetcher, const std::string& url, const LLUUID& id, const LLHost& host, - F32 priority, S32 discard, S32 size); + F32 priority, S32 discard, S32 size, bool can_use_http); private: /*virtual*/ void startWork(S32 param); // called from addWork() (MAIN THREAD) @@ -390,7 +390,8 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, const LLHost& host, // Simulator host F32 priority, // Priority S32 discard, // Desired discard - S32 size) // Desired size + S32 size, // Desired size + bool can_use_http) // Try HTTP first : LLWorkerClass(fetcher, "TextureFetch"), mState(INIT), mWriteToCacheState(NOT_WRITE), @@ -422,7 +423,7 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mNeedsAux(FALSE), mHaveAllData(FALSE), mInLocalCache(FALSE), - mCanUseHTTP(true), + mCanUseHTTP(can_use_http), mHTTPFailCount(0), mRetryAttempt(0), mActiveCount(0), @@ -1556,7 +1557,7 @@ LLTextureFetch::~LLTextureFetch() } bool LLTextureFetch::createRequest(const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, - S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux) + S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux, bool can_use_http) { if (mDebugPause) { @@ -1618,6 +1619,7 @@ bool LLTextureFetch::createRequest(const std::string& url, const LLUUID& id, con worker->lockWorkMutex(); worker->setImagePriority(priority); worker->setDesiredDiscard(desired_discard, desired_size); + worker->setCanUseHTTP(can_use_http); worker->unlockWorkMutex(); if (!worker->haveWork()) { @@ -1633,7 +1635,7 @@ bool LLTextureFetch::createRequest(const std::string& url, const LLUUID& id, con } else { - worker = new LLTextureFetchWorker(this, url, id, host, priority, desired_discard, desired_size); + worker = new LLTextureFetchWorker(this, url, id, host, priority, desired_discard, desired_size, can_use_http); mRequestMap[id] = worker; } worker->mActiveCount++; diff --git a/linden/indra/newview/lltexturefetch.h b/linden/indra/newview/lltexturefetch.h index 61f76bc..5fa2d1c 100644 --- a/linden/indra/newview/lltexturefetch.h +++ b/linden/indra/newview/lltexturefetch.h @@ -60,7 +60,7 @@ public: /*virtual*/ S32 update(U32 max_time_ms); bool createRequest(const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, - S32 w, S32 h, S32 c, S32 discard, bool needs_aux); + S32 w, S32 h, S32 c, S32 discard, bool needs_aux, bool use_http); void deleteRequest(const LLUUID& id, bool cancel); bool getRequestFinished(const LLUUID& id, S32& discard_level, LLPointer& raw, LLPointer& aux); diff --git a/linden/indra/newview/llviewerimage.cpp b/linden/indra/newview/llviewerimage.cpp index 400fb2f..4f23a05 100644 --- a/linden/indra/newview/llviewerimage.cpp +++ b/linden/indra/newview/llviewerimage.cpp @@ -346,6 +346,8 @@ void LLViewerImage::init(bool firstinit) mForceToSaveRawImage = FALSE ; mSavedRawDiscardLevel = -1 ; mDesiredSavedRawDiscardLevel = -1 ; + + mCanUseHTTP = true; //default on if cap/settings allows us } // virtual @@ -1213,7 +1215,7 @@ bool LLViewerImage::updateFetch() // bypass texturefetch directly by pulling from LLTextureCache bool fetch_request_created = false; fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mUrl, getID(),getTargetHost(), decode_priority, - w, h, c, desired_discard, needsAux()); + w, h, c, desired_discard, needsAux(), mCanUseHTTP); if (fetch_request_created) { @@ -1292,7 +1294,7 @@ BOOL LLViewerImage::forceFetch() c = getComponents(); } fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mUrl, getID(),getTargetHost(), maxDecodePriority(), - w, h, c, desired_discard, needsAux()); + w, h, c, desired_discard, needsAux(), mCanUseHTTP); if (fetch_request_created) { diff --git a/linden/indra/newview/llviewerimage.h b/linden/indra/newview/llviewerimage.h index c82b68b..3bee51c 100644 --- a/linden/indra/newview/llviewerimage.h +++ b/linden/indra/newview/llviewerimage.h @@ -314,6 +314,8 @@ public: void addFace(LLFace* facep) ; void removeFace(LLFace* facep) ; + void setCanUseHTTP(bool can_use_http) {mCanUseHTTP = can_use_http;}; + friend class LocalBitmap; // tag: vaa emerald local_asset_browser private: @@ -418,6 +420,8 @@ private: typedef std::list ll_face_list_t ; ll_face_list_t mFaceList ; //reverse pointer pointing to the faces using this image as texture + bool mCanUseHTTP; // can this image be fetched by http + public: static const U32 sCurrentFileVersion; // Default textures diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index d2aa3d8..7bbaf48 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp @@ -5196,6 +5196,7 @@ void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerImage* imagep, void LLVOAvatar::addBakedTextureStats( LLViewerImage* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level) { + imagep->setCanUseHTTP(false) ; //turn off http fetching for baked textures. mMaxPixelArea = llmax(pixel_area, mMaxPixelArea); mMinPixelArea = llmin(pixel_area, mMinPixelArea); imagep->addTextureStats(pixel_area / texel_area_ratio); -- cgit v1.1 From 0297f5d55f2ba5975ed3869f387d404638aec88f Mon Sep 17 00:00:00 2001 From: thickbrick Date: Sat, 16 Oct 2010 16:03:31 +0200 Subject: More SNOW-802: disable http for bakes earlier. --- linden/indra/newview/llviewerimage.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linden/indra/newview/llviewerimage.cpp b/linden/indra/newview/llviewerimage.cpp index 4f23a05..671a359 100644 --- a/linden/indra/newview/llviewerimage.cpp +++ b/linden/indra/newview/llviewerimage.cpp @@ -256,6 +256,10 @@ LLViewerImage::LLViewerImage(const LLUUID& id, const LLHost& host, BOOL usemipma { init(true); sImageCount++; + if (host != LLHost::invalid) + { + mCanUseHTTP = false; // this is a baked texture + } } LLViewerImage::LLViewerImage(const std::string& url, const LLUUID& id, BOOL usemipmaps) -- cgit v1.1 From ccf5b667663b01c724014f19c28022498d1b3bb6 Mon Sep 17 00:00:00 2001 From: thickbrick Date: Sun, 17 Oct 2010 23:50:42 +0200 Subject: Ask for at least 512^2 pixels of local texture before bake Not sure this helps with non-baking, but it looked wrong. Also, only bind local texture before they are covered by a bake. --- linden/indra/newview/llvoavatar.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index 7bbaf48..9937ed9 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp @@ -5129,12 +5129,6 @@ void LLVOAvatar::updateTextures() if (texture_dict->mIsLocalTexture) { addLocalTextureStats((ETextureIndex)index, imagep, texel_area_ratio, render_avatar, layer_baked[baked_index]); - // SNOW-8 : temporary snowglobe1.0 fix for baked textures - if (render_avatar && !gGLManager.mIsDisabled ) - { - // bind the texture so that its boost level won't be slammed - gGL.getTexUnit(0)->bind(imagep); - } } else if (texture_dict->mIsBakedTexture) { @@ -5171,8 +5165,14 @@ void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerImage* imagep, F32 desired_pixels; if( mIsSelf ) { - desired_pixels = llmin(mPixelArea, (F32)TEX_IMAGE_AREA_SELF ); + desired_pixels = llmax(mPixelArea, (F32)TEX_IMAGE_AREA_SELF ); imagep->setBoostLevel(LLViewerImageBoostLevel::BOOST_AVATAR_SELF); + // SNOW-8 : temporary snowglobe1.0 fix for baked textures + if (render_avatar && !gGLManager.mIsDisabled ) + { + // bind the texture so that its boost level won't be slammed + gGL.getTexUnit(0)->bind(imagep); + } } else { -- cgit v1.1 From dab62a3fba7b332323131cd038642d006e57f47c Mon Sep 17 00:00:00 2001 From: elektrahesse Date: Mon, 18 Oct 2010 03:36:43 +0200 Subject: Changed default compile settings for Mac. Now SSE3 and SSE4 are enabled by default, gcc-4.2 is used and 10.5 SDK is auto selected. Build from commandline in Release mode now work perfectly (./develop.py -t Release build) without the need for Xcode at all. --- linden/indra/cmake/00-Common.cmake | 4 ++-- linden/indra/cmake/Variables.cmake | 16 +++++----------- linden/indra/develop.py | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/linden/indra/cmake/00-Common.cmake b/linden/indra/cmake/00-Common.cmake index 032a3cf..0e90073 100644 --- a/linden/indra/cmake/00-Common.cmake +++ b/linden/indra/cmake/00-Common.cmake @@ -186,8 +186,8 @@ if (DARWIN) add_definitions(-DLL_DARWIN=1) set(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names,-search_paths_first") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlong-branch") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlong-branch") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlong-branch -msse3 -msse4.1 -msse4.2 -mssse3 -w") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlong-branch -msse3 -msse4.1 -msse4.2 -mssse3 -w") # NOTE: it's critical that the optimization flag is put in front. # NOTE: it's critical to have both CXX_FLAGS and C_FLAGS covered. set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O0 ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") diff --git a/linden/indra/cmake/Variables.cmake b/linden/indra/cmake/Variables.cmake index 5d4dffe..8a06133 100644 --- a/linden/indra/cmake/Variables.cmake +++ b/linden/indra/cmake/Variables.cmake @@ -60,17 +60,11 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # set this dynamically from the build system now - # NOTE: wont have a distributable build unless you add this on the configure line with: # -DCMAKE_OSX_ARCHITECTURES:STRING='i386;ppc' - #set(CMAKE_OSX_ARCHITECTURES i386;ppc) - set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk) - if (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc") - set(ARCH universal) - else (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc") - if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc") - set(ARCH ppc) - else (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc") - set(ARCH i386) - endif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc") - endif (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc") + set(CMAKE_OSX_ARCHITECTURES i386) + set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk) + if (CMAKE_OSX_ARCHITECTURES MATCHES "i386") + set(ARCH i386) + endif (CMAKE_OSX_ARCHITECTURES MATCHES "i386") set(LL_ARCH ${ARCH}_darwin) set(LL_ARCH_DIR universal-darwin) endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") diff --git a/linden/indra/develop.py b/linden/indra/develop.py index 809ac78..2ce9f91 100755 --- a/linden/indra/develop.py +++ b/linden/indra/develop.py @@ -421,7 +421,7 @@ class DarwinSetup(UnixSetup): type=self.build_type.upper() ) if self.unattended == 'ON': - args['universal'] = '-DCMAKE_OSX_ARCHITECTURES:STRING=\'i386;ppc\'' + args['universal'] = '-DCMAKE_OSX_ARCHITECTURES:STRING=\'i386\'' #if simple: # return 'cmake %(opts)s %(dir)r' % args return ('cmake -G %(generator)r ' -- cgit v1.1 From 18e79cb6f6bdb7ab4426869417ccb917990df410 Mon Sep 17 00:00:00 2001 From: elektrahesse Date: Mon, 18 Oct 2010 14:10:38 +0200 Subject: Updated the Info.plist file on Mac to reflect the actual build date of the last weekly. --- linden/indra/newview/Info-Imprudence.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linden/indra/newview/Info-Imprudence.plist b/linden/indra/newview/Info-Imprudence.plist index 419cacd..3fe2000 100644 --- a/linden/indra/newview/Info-Imprudence.plist +++ b/linden/indra/newview/Info-Imprudence.plist @@ -32,7 +32,7 @@ CFBundleVersion - Experimental 2010.09.04 + Experimental 2010.10.17 CSResourcesFileMapped -- cgit v1.1 From cea604cda04d783b989498055102674170864b5c Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 18 Oct 2010 15:55:50 -0700 Subject: Fixed the Vivox license prompt appearing when connecting to non-SL grids on startup --- linden/indra/newview/llstartup.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 08d6d3f..d5adc11 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -1073,10 +1073,11 @@ bool idle_startup() // color init must be after saved settings loaded init_colors(); - if (gSavedSettings.getBOOL("VivoxLicenseAccepted")) + if (gSavedSettings.getBOOL("VivoxLicenseAccepted") || gHippoGridManager->getConnectedGrid()->isSecondLife()) { // skipping over STATE_LOGIN_VOICE_LICENSE since we don't need it // skipping over STATE_UPDATE_CHECK because that just waits for input + // We don't do this on non-SL grids either LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT ); } else -- cgit v1.1 From 5af5d291363298b448cbd755001f0590a16c036c Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 20 Oct 2010 16:45:14 -0700 Subject: Fixed the Preferences > Communication tab options not enabling (happens on OpenSim when a user's personal info isn't sent) --- linden/indra/newview/llprefsim.cpp | 32 +++++++++++++++++--------------- linden/indra/newview/llstartup.h | 3 +++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/linden/indra/newview/llprefsim.cpp b/linden/indra/newview/llprefsim.cpp index 2c8ef4d..e915bd2 100644 --- a/linden/indra/newview/llprefsim.cpp +++ b/linden/indra/newview/llprefsim.cpp @@ -45,6 +45,7 @@ #include "llviewercontrol.h" #include "llviewernetwork.h" #include "lluictrlfactory.h" +#include "llstartup.h" #include "lldirpicker.h" @@ -106,22 +107,23 @@ BOOL LLPrefsIMImpl::postBuild() childSetLabelArg("send_im_to_email", "[EMAIL]", getString("log_in_to_change")); // Don't enable this until we get personal data - childDisable("include_im_in_chat_console"); - childDisable("include_im_in_chat_history"); - childDisable("show_timestamps_check"); - childDisable("friends_online_notify_checkbox"); + // Unless we're already logged in. Some non-SL grids won't send us the data we need -- MC + childSetEnabled("include_im_in_chat_console", LLStartUp::isLoggedIn()); + childSetEnabled("include_im_in_chat_history", LLStartUp::isLoggedIn()); + childSetEnabled("show_timestamps_check", LLStartUp::isLoggedIn()); + childSetEnabled("friends_online_notify_checkbox", LLStartUp::isLoggedIn()); - childDisable("online_visibility"); - childDisable("send_im_to_email"); - childDisable("log_instant_messages"); - childDisable("log_chat"); - childDisable("log_show_history"); - childDisable("log_path_button"); - childDisable("busy_response"); - childDisable("log_instant_messages_timestamp"); - childDisable("log_chat_timestamp"); - childDisable("log_chat_IM"); - childDisable("log_date_timestamp"); + childSetEnabled("online_visibility", LLStartUp::isLoggedIn()); + childSetEnabled("send_im_to_email", LLStartUp::isLoggedIn()); + childSetEnabled("log_instant_messages", LLStartUp::isLoggedIn()); + childSetEnabled("log_chat", LLStartUp::isLoggedIn()); + childSetEnabled("log_show_history", LLStartUp::isLoggedIn()); + childSetEnabled("log_path_button", LLStartUp::isLoggedIn()); + childSetEnabled("busy_response", LLStartUp::isLoggedIn()); + childSetEnabled("log_instant_messages_timestamp", LLStartUp::isLoggedIn()); + childSetEnabled("log_chat_timestamp", LLStartUp::isLoggedIn()); + childSetEnabled("log_chat_IM", LLStartUp::isLoggedIn()); + childSetEnabled("log_date_timestamp", LLStartUp::isLoggedIn()); childSetText("busy_response", getString("log_in_to_change")); diff --git a/linden/indra/newview/llstartup.h b/linden/indra/newview/llstartup.h index 9a3c91c..08862e6 100644 --- a/linden/indra/newview/llstartup.h +++ b/linden/indra/newview/llstartup.h @@ -124,6 +124,9 @@ public: static bool shouldAutoLogin() { return mShouldAutoLogin; }; static void setShouldAutoLogin(bool value) { mShouldAutoLogin = value; }; + // Returns true if startup has been successfully completed + static bool isLoggedIn() { return gStartupState == STATE_STARTED; } + private: static bool mStartedOnce; static bool mShouldAutoLogin; -- cgit v1.1 From 66302fb040782e1c6c5cce51f6a782a007771e37 Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Fri, 22 Oct 2010 23:43:19 +0200 Subject: WhiteStar Magic: update the lscript_library to match OpenSim 0.7 --- linden/indra/lscript/lscript_library/lscript_library.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/linden/indra/lscript/lscript_library/lscript_library.cpp b/linden/indra/lscript/lscript_library/lscript_library.cpp index 68daa50..cc56119 100644 --- a/linden/indra/lscript/lscript_library/lscript_library.cpp +++ b/linden/indra/lscript/lscript_library/lscript_library.cpp @@ -484,8 +484,9 @@ void LLScriptLibrary::init() // documented and therefore the description may be incomplete and require further attention. // OpenSimulator is written in C# and not CPP therefore some values for example "double = float" etc. are different. - // OSSL corrections and syntax additions added + set in same order as found in OSSL_stub.cs of OpenSim Source (February 19, 2010) - // based on OpenSimulator Ver. 0.6.9 DEV Git # af265e001d3bf043590e480cd6574a14193f6de0 - Rev 12239 + // OSSL corrections and syntax additions added + set in same order as found in OSSL_stub.cs of OpenSim Source (Updated PM October-21-2010 + // based on OpenSimulator Ver. 0.7.x DEV/Master Git # a7acb650d400a280a7b9edabd304376dff9c81af - a7acb65-r/14142 + // Updates by WhiteStar Magic addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osSetRegionWaterHeight", NULL, "f", "osSetRegionWaterHeight(float height)\nAdjusts Water Height on region.\n(OpenSim only.)")); addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osSetRegionSunSettings", NULL, "iif", "osSetRegionSunSettings(integer useEstateSun, integer sunFixed, float sunHour)\nChanges the Estate Sun Settings, then Triggers a Sun Update\n'sunFixed' TRUE (1) to keep the sun stationary, FALSE (0) to use global time\n'sunHour' The \"Sun Hour\" that is desired, 0...24, with 0 just after SunRise.\n(OpenSim only.)")); @@ -494,8 +495,11 @@ void LLScriptLibrary::init() addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osSunGetParam","f", "s", "float osSunGetParam(string param)\nReturns current float values for param\nwhere param = day_length, year_length, day_night_offset, update_interval.\n(OpenSim only.)")); addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osSunSetParam", "sf", NULL, "osSunSetParam(string param, float value)\nSet's Sun Param for SunSet,\nosSunSetParam(day_length, 24.0)\nwhere param = day_length, year_length, day_night_offset, update_interval.\n(OpenSim only.)")); addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osWindActiveModelPluginName", "s", NULL, "string osWindActiveModelPluginName()\nReturns the Current Working Wind Module Installed\nThese are SimpleRandomWind or ConfigurableWind, optionally others.\n(OpenSim only.)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osWindParamSet", NULL, "ssf", "osWindParamSet(string plugin, string param, float value)Send Param to Specified Wind Plugin with new value.\n(OpenSim only.)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osWindParamGet", "f", "ss", "float osWindParamGet(string plugin, string param)\n Returns Current param from specified Wind Plugin Module.\n(OpenSim only.)")); + addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osParcelJoin", NULL, "vv", "osParcelJoin(vector pos1, vector pos2))\nJoins Parcels @ X,Y coordinates.\n(OpenSim only.)")); + addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osParcelSubdivide", NULL, "vv", "osParcelSubdivide(vector pos1, vector pos2))\nSubdivides Parcels @ X,Y coordinates.\n(OpenSim only.)")); + addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osParcelSetDetails", NULL, "vv", "osParcelSetDetails(vector pos, list rules))\nSet Parcel details.\n(OpenSim only.)")); + // addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osWindParamSet", NULL, "ssf", "osWindParamSet(string plugin, string param, float value)Send Param to Specified Wind Plugin with new value.\n(OpenSim only.)")); + // addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osWindParamGet", "f", "ss", "float osWindParamGet(string plugin, string param)\n Returns Current param from specified Wind Plugin Module.\n(OpenSim only.)")); addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osList2Double", "f", "si", "double osList2Double(list src, int index)\nReturns Double (float) Value from src at index.\n(OpenSim only.)")); addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureURL", NULL, "ssssi", "osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer )\n(OpenSim only.)")); addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osSetDynamicTextureData", NULL, "ssssi", "osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer)\nWrites text and vector graphics onto a prim face.\n(OpenSim only.)")); @@ -564,7 +568,9 @@ void LLScriptLibrary::init() addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osSetSpeed", NULL, "kf", "osSetSpeed(key AVATAR, float SpeedModifier)\nMultiplies the normal running, walking, and flying speed of the specified avatar.\n(OpenSim only.)")); addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osCauseDamage", NULL, "kf", "osCauseDamage(key AVATAR, float damage)\nCauses damage to specified AVATAR (UUID).\n(OpenSim only.)")); addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osCauseHealing", NULL, "kf", "osCauseHealing(key AVATAR, float healing)\nCauses Healing to specified AVATAR (UUID).\n(OpenSim only.)")); - + addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osGetPrimitiveParams", "l", "kl", "List osGetPrimitiveParams(key prim, list rules)\nGets primitive Params.\n(OpenSim only.)")); + addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osSetPrimitiveParams", NULL, "kl", "osSetPrimitiveParams(key prim, list rules)\nSets primitive Params.\n(OpenSim only.)")); + addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "osSetProjectionParams", NULL, "kikfff", "osSetProjectionParams(key prim. bool projection, key texture, float fov, float focus, float amb)\nSet Projection Paramaters (bool = true / false)\n(OpenSim only.)")); // LightShare functions addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "cmSetWindlightScene", "i", "l", "integer cmSetWindlightScene(list rules)\nSet the current WindLight scene. Restricted to estate managers and owners only.")); -- cgit v1.1 From 36d557ff2a2290ca3f3a66a504852328e6dc32a2 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 21 Oct 2010 23:28:59 -0500 Subject: Fixed #629: Freeze Frame snapshot option breaks the UI. --- linden/indra/newview/llfloatersnapshot.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/linden/indra/newview/llfloatersnapshot.cpp b/linden/indra/newview/llfloatersnapshot.cpp index c0e972d..a58120d 100644 --- a/linden/indra/newview/llfloatersnapshot.cpp +++ b/linden/indra/newview/llfloatersnapshot.cpp @@ -2128,7 +2128,6 @@ BOOL LLFloaterSnapshot::postBuild() //gSnapshotFloaterView->addChild(this); impl.updateControls(this); - impl.updateLayout(this); return TRUE; } -- cgit v1.1 From b41717bc60cf72aef2257c6573201bd74210c428 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 22 Oct 2010 17:20:34 -0500 Subject: Added FontSizeMultiplier and FontSizeRounding settings. Gives more control over font sizes, addresses font being smaller than some users desire. --- linden/indra/llrender/llfontregistry.cpp | 10 +++++++++- linden/indra/newview/app_settings/settings.xml | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/linden/indra/llrender/llfontregistry.cpp b/linden/indra/llrender/llfontregistry.cpp index 9792a91..c5923cd 100644 --- a/linden/indra/llrender/llfontregistry.cpp +++ b/linden/indra/llrender/llfontregistry.cpp @@ -442,7 +442,15 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) std::string font_path = local_path + *file_name_it; BOOL is_fallback = !is_first_found; F32 size_mult = (is_fallback ? 1 : match_desc->getSizeMult()); - F32 size = (F32)llround(point_size * size_mult); + if (gSavedSettings.getF32("FontSizeMultiplier") > 0) + { + size_mult *= gSavedSettings.getF32("FontSizeMultiplier"); + } + F32 size = (F32)(point_size * size_mult); + if (gSavedSettings.getBOOL("FontSizeRounding")) + { + size = (F32)llround(size); + } if (!fontp->loadFace(font_path, size, LLFontGL::sVertDPI, LLFontGL::sHorizDPI, 2, is_fallback)) { diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 8c280d4..7b37bb6 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -396,6 +396,28 @@ Value DroidSans + FontSizeMultiplier + + Comment + Multiply all font sizes by this amount. Requires viewer restart. + Persist + 1 + Type + F32 + Value + 1.0 + + FontSizeRounding + + Comment + Round all font sizes to integer values, to potentially reduce font blurriness. The rounding occurs after FontSizeMultiplier is applied. Requires viewer restart. + Persist + 1 + Type + Boolean + Value + 0 + GoAction Comment -- cgit v1.1 From 22df58bd35e75d420c20707d7dffdd322d35e4dc Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 22 Oct 2010 18:06:59 -0500 Subject: Added FontSizeMultiplier and FontSizeRounding controls to Font prefs. --- linden/indra/newview/impprefsfonts.cpp | 50 ++++++++++++++++++++-- .../default/xui/en-us/panel_preferences_fonts.xml | 10 +++++ 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/linden/indra/newview/impprefsfonts.cpp b/linden/indra/newview/impprefsfonts.cpp index 3ce71eb..bf0b028 100644 --- a/linden/indra/newview/impprefsfonts.cpp +++ b/linden/indra/newview/impprefsfonts.cpp @@ -29,7 +29,9 @@ #include "llviewerprecompiledheaders.h" #include "impprefsfonts.h" +#include "llcheckboxctrl.h" #include "llradiogroup.h" +#include "llspinctrl.h" #include "lluictrlfactory.h" #include "llviewercontrol.h" @@ -61,24 +63,64 @@ void ImpPrefsFonts::refresh() { fonts->setValue( gSavedSettings.getString("FontChoice") ); } + + LLSpinCtrl* font_mult = getChild("font_mult"); + if (font_mult) + { + font_mult->setValue( gSavedSettings.getF32("FontSizeMultiplier") ); + } + + LLCheckBoxCtrl* font_round = getChild("font_round"); + if (font_round) + { + font_round->setValue( gSavedSettings.getBOOL("FontSizeRounding") ); + } } void ImpPrefsFonts::apply() { - LLRadioGroup* fonts = getChild("fonts"); + bool changed = false; + LLRadioGroup* fonts = getChild("fonts"); if (fonts) { std::string font_choice = fonts->getValue().asString(); - if (font_choice != gSavedSettings.getString("FontChoice") && !font_choice.empty()) { gSavedSettings.setString("FontChoice", font_choice); - LLNotifications::instance().add("ChangeFont"); - refresh(); + changed = true; } } + + LLSpinCtrl* font_mult = getChild("font_mult"); + if (font_mult) + { + F32 mult = font_mult->getValue().asReal(); + if (mult != gSavedSettings.getF32("FontSizeMultiplier")) + { + gSavedSettings.setF32("FontSizeMultiplier", mult); + changed = true; + } + } + + LLCheckBoxCtrl* font_round = getChild("font_round"); + if (font_round) + { + bool round = font_round->getValue().asBoolean(); + if (round != gSavedSettings.getBOOL("FontSizeRounding")) + { + gSavedSettings.setBOOL("FontSizeRounding", round); + changed = true; + } + } + + if (changed) + { + refresh(); + LLNotifications::instance().add("ChangeFont"); + } + } void ImpPrefsFonts::cancel() diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_fonts.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_fonts.xml index 5865bec..c64ce9f 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_fonts.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_fonts.xml @@ -46,4 +46,14 @@ Preview: The quick brown fox jumped over the lazy dog. :) + + + + + -- cgit v1.1 From 421f337df1923be1657ccf10e6a96b6aa5d04967 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 22 Oct 2010 18:09:06 -0500 Subject: Changed Small font size back to 8.5. If this causes blurry fonts for a user, they should enable "Force integer font sizes" in Preferences > Fonts. --- linden/indra/newview/skins/default/xui/en-us/fonts.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linden/indra/newview/skins/default/xui/en-us/fonts.xml b/linden/indra/newview/skins/default/xui/en-us/fonts.xml index 5564079..7343ac2 100644 --- a/linden/indra/newview/skins/default/xui/en-us/fonts.xml +++ b/linden/indra/newview/skins/default/xui/en-us/fonts.xml @@ -153,7 +153,7 @@ /> -- cgit v1.1 From 54a6488d3b0399a2d5ba72b73bf4316f32531d1d Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sat, 23 Oct 2010 18:30:35 -0700 Subject: Fixed the Advanced preferences panel not appearing last in the preferences window --- linden/indra/newview/llfloaterpreference.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/linden/indra/newview/llfloaterpreference.cpp b/linden/indra/newview/llfloaterpreference.cpp index 09336cb..f8a0a4f 100644 --- a/linden/indra/newview/llfloaterpreference.cpp +++ b/linden/indra/newview/llfloaterpreference.cpp @@ -134,8 +134,8 @@ LLPreferenceCore::LLPreferenceCore(LLTabContainer* tab_container, LLButton * def mMsgPanel(NULL), mSkinsPanel(NULL), mLCDPanel(NULL), - mPrefsAdvanced(NULL), - mPrefsFonts(NULL) + mPrefsFonts(NULL), + mPrefsAdvanced(NULL) { mGeneralPanel = new LLPanelGeneral(); mTabContainer->addTabPanel(mGeneralPanel, mGeneralPanel->getLabel(), FALSE, onTabChanged, mTabContainer); @@ -195,14 +195,14 @@ LLPreferenceCore::LLPreferenceCore(LLTabContainer* tab_container, LLButton * def mTabContainer->addTabPanel(mSkinsPanel, mSkinsPanel->getLabel(), FALSE, onTabChanged, mTabContainer); mSkinsPanel->setDefaultBtn(default_btn); - mPrefsAdvanced = new LLPrefsAdvanced(); - mTabContainer->addTabPanel(mPrefsAdvanced, mPrefsAdvanced->getLabel(), FALSE, onTabChanged, mTabContainer); - mPrefsAdvanced->setDefaultBtn(default_btn); - mPrefsFonts = new ImpPrefsFonts(); mTabContainer->addTabPanel(mPrefsFonts, mPrefsFonts->getLabel(), FALSE, onTabChanged, mTabContainer); mPrefsFonts->setDefaultBtn(default_btn); + mPrefsAdvanced = new LLPrefsAdvanced(); + mTabContainer->addTabPanel(mPrefsAdvanced, mPrefsAdvanced->getLabel(), FALSE, onTabChanged, mTabContainer); + mPrefsAdvanced->setDefaultBtn(default_btn); + if (!mTabContainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) { mTabContainer->selectFirstTab(); -- cgit v1.1 From cd14d97b90c0b3270310c00e8a105f17a59d0dcf Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 23 Oct 2010 20:38:54 -0500 Subject: Changed several Preferences modal alerts to notifications. CacheWillClear, CacheWillBeMoved, ChangeConnectionPort, ChangeSkin, and ChangeFont. There are many other alerts that should be made non-modal in the future, but this should prevent a focus fight with the Vivox policy window. --- .../skins/default/xui/en-us/notifications.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/linden/indra/newview/skins/default/xui/en-us/notifications.xml b/linden/indra/newview/skins/default/xui/en-us/notifications.xml index 333e362..3b8d19d 100644 --- a/linden/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/linden/indra/newview/skins/default/xui/en-us/notifications.xml @@ -902,32 +902,32 @@ Would you like to disable all popups which can be skipped? + type="notify"> Cache will be cleared after you restart [VIEWER_NAME]. + type="notify"> Cache will be moved after you restart [VIEWER_NAME]. Note: This will clear the cache. + type="notify"> Port settings take effect after you restart [VIEWER_NAME]. + type="notify"> The new skin will appear after you restart [VIEWER_NAME]. @@ -7103,8 +7103,8 @@ Apply this region's settings? ("Ignore" will ignore all region setting + icon="notify.tga" + type="notify"> The new font will appear after you restart [VIEWER_NAME]. -- cgit v1.1 From 36c25f06e38e357716ecd31df58d70b92a3d8e0e Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 21 Oct 2010 22:13:28 -0500 Subject: Prim alignment tool by Qarl, backported by Jacek. Qarl has given permission to use this code under the terms of the GPL v2 + FLOSS exception and/or the LGPL v2.1. --- linden/indra/newview/CMakeLists.txt | 2 + linden/indra/newview/llfloatertools.cpp | 6 +- linden/indra/newview/llfloatertools.h | 1 + linden/indra/newview/qtoolalign.cpp | 585 +++++++++++++++++++++ linden/indra/newview/qtoolalign.h | 50 ++ .../skins/default/xui/en-us/floater_tools.xml | 3 + 6 files changed, 646 insertions(+), 1 deletion(-) create mode 100644 linden/indra/newview/qtoolalign.cpp create mode 100644 linden/indra/newview/qtoolalign.h diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt index dfd35bf..1a6ad30 100644 --- a/linden/indra/newview/CMakeLists.txt +++ b/linden/indra/newview/CMakeLists.txt @@ -484,6 +484,7 @@ set(viewer_SOURCE_FILES panelradarentry.cpp pipeline.cpp primbackup.cpp + qtoolalign.cpp rlvhandler.cpp rlvhelper.cpp rlvcommon.cpp @@ -936,6 +937,7 @@ set(viewer_HEADER_FILES panelradarentry.h pipeline.h primbackup.h + qtoolalign.h randgauss.h rlvdefines.h rlvhandler.h diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp index fc72467..daff573 100644 --- a/linden/indra/newview/llfloatertools.cpp +++ b/linden/indra/newview/llfloatertools.cpp @@ -84,7 +84,7 @@ #include "llvograss.h" #include "llvotree.h" #include "lluictrlfactory.h" - +#include "qtoolalign.h" #include "hippoLimits.h" // Globals @@ -273,6 +273,8 @@ BOOL LLFloaterTools::postBuild() childSetCommitCallback("radio stretch",commit_select_tool,LLToolCompScale::getInstance()); mRadioSelectFace = getChild("radio select face"); childSetCommitCallback("radio select face",commit_select_tool,LLToolFace::getInstance()); + mRadioAlign = getChild("radio align"); + childSetCommitCallback("radio align",commit_select_tool,QToolAlign::getInstance()); mCheckSelectIndividual = getChild("checkbox edit linked parts"); childSetValue("checkbox edit linked parts",(BOOL)gSavedSettings.getBOOL("EditLinkedParts")); childSetCommitCallback("checkbox edit linked parts",commit_select_component,this); @@ -698,6 +700,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) tool == LLToolCompScale::getInstance() || tool == LLToolFace::getInstance() || tool == LLToolIndividual::getInstance() || + tool == QToolAlign::getInstance() || tool == LLToolPipette::getInstance(); mBtnEdit ->setToggleState( edit_visible ); @@ -720,6 +723,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) mRadioPosition ->set( tool == LLToolCompTranslate::getInstance() ); mRadioRotate ->set( tool == LLToolCompRotate::getInstance() ); mRadioStretch ->set( tool == LLToolCompScale::getInstance() ); + mRadioAlign->set( tool == QToolAlign::getInstance() ); if (mComboGridMode) { diff --git a/linden/indra/newview/llfloatertools.h b/linden/indra/newview/llfloatertools.h index ad5be6c..bbf07ec 100644 --- a/linden/indra/newview/llfloatertools.h +++ b/linden/indra/newview/llfloatertools.h @@ -140,6 +140,7 @@ public: LLCheckBoxCtrl *mRadioRotate; LLCheckBoxCtrl *mRadioStretch; LLCheckBoxCtrl *mRadioSelectFace; + LLCheckBoxCtrl *mRadioAlign; LLCheckBoxCtrl *mCheckSelectIndividual; diff --git a/linden/indra/newview/qtoolalign.cpp b/linden/indra/newview/qtoolalign.cpp new file mode 100644 index 0000000..92cab6e --- /dev/null +++ b/linden/indra/newview/qtoolalign.cpp @@ -0,0 +1,585 @@ +/** + * @file qtoolalign.cpp + * @brief A tool to align objects + * @author Karl Stiefvater (Qarl) + * + * Karl has given permission to use this code under the terms of + * the GNU GPL v2 plus FLOSS exception and/or the GNU LGPL v2.1. + * + * Backported for Viewer 1.X code base by Jacek Antonelli. + */ + +#include "llviewerprecompiledheaders.h" + +// File includes +#include "qtoolalign.h" + +// Library includes +#include "llbbox.h" +#include "v3math.h" + +// Viewer includes +#include "llagent.h" +#include "llbox.h" +#include "llcylinder.h" +#include "llfloatertools.h" +#include "llselectmgr.h" +#include "llviewercamera.h" +#include "llviewercontrol.h" +#include "llviewerobject.h" +#include "llviewerwindow.h" + + +const F32 MANIPULATOR_SIZE = 5.0; +const F32 MANIPULATOR_SELECT_SIZE = 20.0; + + + +QToolAlign::QToolAlign() +: LLTool(std::string("Align")) +{ +} + + +QToolAlign::~QToolAlign() +{ +} + + + +BOOL QToolAlign::handleMouseDown(S32 x, S32 y, MASK mask) +{ + if (mHighlightedAxis != -1) + { + align(); + } + else + { + gViewerWindow->pickAsync(x, y, mask, pickCallback); + } + + return TRUE; +} + + + +void QToolAlign::pickCallback(const LLPickInfo& pick_info) +{ + LLViewerObject* object = pick_info.getObject(); + + if (object) + { + if (object->isAvatar()) + { + return; + } + + if (pick_info.mKeyMask & MASK_SHIFT) + { + // If object not selected, select it + if ( !object->isSelected() ) + { + LLSelectMgr::getInstance()->selectObjectAndFamily(object); + } + else + { + LLSelectMgr::getInstance()->deselectObjectAndFamily(object); + } + } + else + { + LLSelectMgr::getInstance()->deselectAll(); + LLSelectMgr::getInstance()->selectObjectAndFamily(object); + } + + } + else + { + if (!(pick_info.mKeyMask == MASK_SHIFT)) + { + LLSelectMgr::getInstance()->deselectAll(); + } + } + + LLSelectMgr::getInstance()->promoteSelectionToRoot(); +} + + + +void QToolAlign::handleSelect() +{ + // no parts, please + + llwarns << "in select" << llendl; + LLSelectMgr::getInstance()->promoteSelectionToRoot(); +} + + +void QToolAlign::handleDeselect() +{ +} + + +BOOL QToolAlign::findSelectedManipulator(S32 x, S32 y) +{ + mHighlightedAxis = -1; + mHighlightedDirection = 0; + + LLMatrix4 transform; + if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD) + { + LLVector4 translation(mBBox.getCenterAgent()); + transform.initRotTrans(mBBox.getRotation(), translation); + LLMatrix4 cfr(OGL_TO_CFR_ROTATION); + transform *= cfr; + LLMatrix4 window_scale; + F32 zoom_level = 2.f * gAgent.mHUDCurZoom; + window_scale.initAll(LLVector3(zoom_level / LLViewerCamera::getInstance()->getAspect(), zoom_level, 0.f), + LLQuaternion::DEFAULT, + LLVector3::zero); + transform *= window_scale; + } + else + { + transform.initAll(LLVector3(1.f, 1.f, 1.f), mBBox.getRotation(), mBBox.getCenterAgent()); + + LLMatrix4 projection_matrix = LLViewerCamera::getInstance()->getProjection(); + LLMatrix4 model_matrix = LLViewerCamera::getInstance()->getModelview(); + + transform *= model_matrix; + transform *= projection_matrix; + } + + + //LLRect world_view_rect = getWorldViewRectScaled(); + F32 half_width = (F32)gViewerWindow->getWindowWidth() / 2.f; + F32 half_height = (F32)gViewerWindow->getWindowHeight() / 2.f; + LLVector2 manip2d; + LLVector2 mousePos((F32)x - half_width, (F32)y - half_height); + LLVector2 delta; + + LLVector3 bbox_scale = mBBox.getMaxLocal() - mBBox.getMinLocal(); + + for (S32 axis = VX; axis <= VZ; axis++) + { + for (F32 direction = -1.0; direction <= 1.0; direction += 2.0) + { + LLVector3 axis_vector = LLVector3(0,0,0); + axis_vector.mV[axis] = direction * bbox_scale.mV[axis] / 2.0; + + LLVector4 manipulator_center = LLVector4(axis_vector); + + LLVector4 screen_center = manipulator_center * transform; + screen_center /= screen_center.mV[VW]; + + manip2d.setVec(screen_center.mV[VX] * half_width, screen_center.mV[VY] * half_height); + + delta = manip2d - mousePos; + + if (delta.magVecSquared() < MANIPULATOR_SELECT_SIZE * MANIPULATOR_SELECT_SIZE) + { + mHighlightedAxis = axis; + mHighlightedDirection = direction; + return TRUE; + } + + } + } + + return FALSE; +} + + +BOOL QToolAlign::handleHover(S32 x, S32 y, MASK mask) +{ + if (mask & MASK_SHIFT) + { + mForce = FALSE; + } + else + { + mForce = TRUE; + } + + gViewerWindow->setCursor(UI_CURSOR_ARROW); + return findSelectedManipulator(x, y); +} + + + +void setup_transforms_bbox(LLBBox bbox) +{ + // translate to center + LLVector3 center = bbox.getCenterAgent(); + gGL.translatef(center.mV[VX], center.mV[VY], center.mV[VZ]); + + // rotate + LLQuaternion rotation = bbox.getRotation(); + F32 angle_radians, x, y, z; + rotation.getAngleAxis(&angle_radians, &x, &y, &z); + // gGL has no rotate method (despite having translate and scale) presumably because + // its authors smoke crack. so we hack. + gGL.flush(); + glRotatef(angle_radians * RAD_TO_DEG, x, y, z); + + // scale + LLVector3 scale = bbox.getMaxLocal() - bbox.getMinLocal(); + gGL.scalef(scale.mV[VX], scale.mV[VY], scale.mV[VZ]); +} + + +void render_bbox(LLBBox bbox) +{ + glMatrixMode(GL_MODELVIEW); + gGL.pushMatrix(); + + setup_transforms_bbox(bbox); + + gGL.flush(); + gBox.render(); + + gGL.popMatrix(); +} + +void render_cone_bbox(LLBBox bbox) +{ + glMatrixMode(GL_MODELVIEW); + gGL.pushMatrix(); + + setup_transforms_bbox(bbox); + + gGL.flush(); + gCone.render(CONE_LOD_HIGHEST); + + gGL.popMatrix(); +} + + + +// the selection bbox isn't axis aligned, so we must construct one +// should this be cached in the selection manager? yes. +LLBBox get_selection_axis_aligned_bbox() +{ + LLBBox selection_bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); + LLVector3 position = selection_bbox.getPositionAgent(); + + LLBBox axis_aligned_bbox = LLBBox(position, LLQuaternion(), LLVector3(), LLVector3()); + axis_aligned_bbox.addPointLocal(LLVector3()); + + // cycle over the nodes in selection + for (LLObjectSelection::iterator selection_iter = LLSelectMgr::getInstance()->getSelection()->begin(); + selection_iter != LLSelectMgr::getInstance()->getSelection()->end(); + ++selection_iter) + { + LLSelectNode *select_node = *selection_iter; + if (select_node) + { + LLViewerObject* object = select_node->getObject(); + if (object) + { + axis_aligned_bbox.addBBoxAgent(object->getBoundingBoxAgent()); + } + } + } + + + return axis_aligned_bbox; +} + + + +void QToolAlign::computeManipulatorSize() +{ + if (LLSelectMgr::getInstance()->getSelection()->getSelectType() == SELECT_TYPE_HUD) + { + mManipulatorSize = MANIPULATOR_SIZE / (LLViewerCamera::getInstance()->getViewHeightInPixels() * + gAgent.mHUDCurZoom); + } + else + { + F32 distance = dist_vec(gAgent.getCameraPositionAgent(), mBBox.getCenterAgent()); + + if (distance > 0.001f) + { + // range != zero + F32 fraction_of_fov = MANIPULATOR_SIZE /LLViewerCamera::getInstance()->getViewHeightInPixels(); + F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians + mManipulatorSize = MANIPULATOR_SIZE * distance * tan(apparent_angle); + } + else + { + // range == zero + mManipulatorSize = MANIPULATOR_SIZE; + } + } +} + + +LLColor4 manipulator_color[3] = { LLColor4(0.7f, 0.0f, 0.0f, 0.5f), + LLColor4(0.0f, 0.7f, 0.0f, 0.5f), + LLColor4(0.0f, 0.0f, 0.7f, 0.5f) }; + + +void QToolAlign::renderManipulators() +{ + computeManipulatorSize(); + LLVector3 bbox_center = mBBox.getCenterAgent(); + LLVector3 bbox_scale = mBBox.getMaxLocal() - mBBox.getMinLocal(); + + for (S32 axis = VX; axis <= VZ; axis++) + for (F32 direction = -1.0; direction <= 1.0; direction += 2.0) + { + F32 size = mManipulatorSize; + LLColor4 color = manipulator_color[axis]; + + if ((axis == mHighlightedAxis) && (direction == mHighlightedDirection)) + { + size *= 2.0; + color *= 1.5; + } + + S32 arrows = 1; + if (mForce) + { + arrows = 2; + } + + for (S32 i = 0; i < arrows; i++) + { + LLVector3 axis_vector = LLVector3(0,0,0); + axis_vector.mV[axis] = direction * (bbox_scale.mV[axis] / 2.0 + i * (size/3.0)); + + LLVector3 manipulator_center = bbox_center + axis_vector; + + LLQuaternion manipulator_rotation; + manipulator_rotation.shortestArc(LLVector3(0,0,1), -1.0 * axis_vector); + + LLBBox manipulator_bbox = LLBBox(manipulator_center, manipulator_rotation, + LLVector3(), LLVector3()); + + manipulator_bbox.addPointLocal(LLVector3(-1, -1, -0.75) * size * 0.5); + manipulator_bbox.addPointLocal(LLVector3(1, 1, 0.75) * size * 0.5); + + gGL.color4fv(color.mV); + // sadly, gCone doesn't use gGL like gBox does (presumably because its author smokes crack) so we + // also set the raw GL color. hopefully this won't screw-up later rendering. + glColor4fv(color.mV); + + render_cone_bbox(manipulator_bbox); + } + } +} + + +void QToolAlign::render() +{ + mBBox = get_selection_axis_aligned_bbox(); + + // Draw bounding box + LLGLSUIDefault gls_ui; + LLGLEnable gl_blend(GL_BLEND); + LLGLEnable gls_alpha_test(GL_ALPHA_TEST); + LLGLDepthTest gls_depth(GL_FALSE); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + // render box + LLColor4 default_normal_color( 0.7f, 0.7f, 0.7f, 0.1f ); + gGL.color4fv( default_normal_color.mV ); + + render_bbox(mBBox); + renderManipulators(); +} + +// only works for our specialized (AABB, position centered) bboxes +BOOL bbox_overlap(LLBBox bbox1, LLBBox bbox2) +{ + const F32 FUDGE = 0.001; // because of stupid SL precision/rounding + + LLVector3 delta = bbox1.getCenterAgent() - bbox2.getCenterAgent(); + + LLVector3 half_extent = (bbox1.getExtentLocal() + bbox2.getExtentLocal()) / 2.0; + + return ((fabs(delta.mV[VX]) < half_extent.mV[VX] - FUDGE) && + (fabs(delta.mV[VY]) < half_extent.mV[VY] - FUDGE) && + (fabs(delta.mV[VZ]) < half_extent.mV[VZ] - FUDGE)); +} + + + +// used to sort bboxes before packing +class BBoxCompare +{ +public: + BBoxCompare(S32 axis, F32 direction, std::map, LLBBox >& bboxes) : + mAxis(axis), mDirection(direction), mBBoxes(bboxes) {} + + BOOL operator() (LLViewerObject* object1, LLViewerObject* object2) + { + LLVector3 corner1 = mBBoxes[object1].getCenterAgent() - + mDirection * mBBoxes[object1].getExtentLocal()/2.0; + + LLVector3 corner2 = mBBoxes[object2].getCenterAgent() - + mDirection * mBBoxes[object2].getExtentLocal()/2.0; + + + return mDirection * corner1.mV[mAxis] < mDirection * corner2.mV[mAxis]; + } + + S32 mAxis; + F32 mDirection; + std::map, LLBBox >& mBBoxes; +}; + + +void QToolAlign::align() +{ + // no linkset parts, please + LLSelectMgr::getInstance()->promoteSelectionToRoot(); + + std::vector > objects; + std::map, LLBBox > original_bboxes; + + // cycle over the nodes in selection and collect them into an array + for (LLObjectSelection::root_iterator selection_iter = LLSelectMgr::getInstance()->getSelection()->root_begin(); + selection_iter != LLSelectMgr::getInstance()->getSelection()->root_end(); + ++selection_iter) + { + LLSelectNode *select_node = *selection_iter; + if (select_node) + { + LLViewerObject* object = select_node->getObject(); + if (object) + { + LLVector3 position = object->getPositionAgent(); + + LLBBox bbox = LLBBox(position, LLQuaternion(), LLVector3(), LLVector3()); + bbox.addPointLocal(LLVector3()); + + // add the parent's bbox + bbox.addBBoxAgent(object->getBoundingBoxAgent()); + LLViewerObject::const_child_list_t& children = object->getChildren(); + + for (LLViewerObject::const_child_list_t::const_iterator i = children.begin(); + i != children.end(); i++) + { + // add the child's bbox + LLViewerObject* child = *i; + bbox.addBBoxAgent(child->getBoundingBoxAgent()); + } + + objects.push_back(object); + original_bboxes[object] = bbox; + } + } + } + + S32 axis = mHighlightedAxis; + F32 direction = mHighlightedDirection; + + // sort them into positional order for proper packing + BBoxCompare compare(axis, direction, original_bboxes); + sort(objects.begin(), objects.end(), compare); + + // storage for their new position after alignment - start with original position first + std::map, LLBBox > new_bboxes = original_bboxes; + + // find new positions + for (S32 i = 0; i < objects.size(); i++) + { + LLBBox target_bbox = mBBox; + LLVector3 target_corner = target_bbox.getCenterAgent() - + direction * target_bbox.getExtentLocal() / 2.0; + + LLViewerObject* object = objects[i]; + + LLBBox this_bbox = original_bboxes[object]; + LLVector3 this_corner = this_bbox.getCenterAgent() - + direction * this_bbox.getExtentLocal() / 2.0; + + // for packing, we cycle over several possible positions, taking the smallest that does not overlap + F32 smallest = direction * 9999999; // 999999 guarenteed not to be the smallest + for (S32 j = 0; j <= i; j++) + { + // how far must it move? + LLVector3 delta = target_corner - this_corner; + + // new position moves only on one axis, please + LLVector3 delta_one_axis = LLVector3(0,0,0); + delta_one_axis.mV[axis] = delta.mV[axis]; + + LLVector3 new_position = this_bbox.getCenterAgent() + delta_one_axis; + + // construct the new bbox + LLBBox new_bbox = LLBBox(new_position, LLQuaternion(), LLVector3(), LLVector3()); + new_bbox.addPointLocal(this_bbox.getExtentLocal() / 2.0); + new_bbox.addPointLocal(-1.0 * this_bbox.getExtentLocal() / 2.0); + + // check to see if it overlaps the previously placed objects + BOOL overlap = FALSE; + + llwarns << "i=" << i << " j=" << j << llendl; + + if (!mForce) // well, don't check if in force mode + { + for (S32 k = 0; k < i; k++) + { + LLViewerObject* other_object = objects[k]; + LLBBox other_bbox = new_bboxes[other_object]; + + BOOL overlaps_this = bbox_overlap(other_bbox, new_bbox); + + if (overlaps_this) + { + llwarns << "overlap" << new_bbox.getCenterAgent() << other_bbox.getCenterAgent() << llendl; + llwarns << "extent" << new_bbox.getExtentLocal() << other_bbox.getExtentLocal() << llendl; + } + + overlap = (overlap || overlaps_this); + } + } + + if (!overlap) + { + F32 this_value = (new_bbox.getCenterAgent() - + direction * new_bbox.getExtentLocal() / 2.0).mV[axis]; + + if (direction * this_value < direction * smallest) + { + smallest = this_value; + // store it + new_bboxes[object] = new_bbox; + } + } + + // update target for next time through the loop + if (j < objects.size()) + { + LLBBox next_bbox = new_bboxes[objects[j]]; + target_corner = next_bbox.getCenterAgent() + + direction * next_bbox.getExtentLocal() / 2.0; + } + } + } + + + // now move them + for (S32 i = 0; i < objects.size(); i++) + { + LLViewerObject* object = objects[i]; + + LLBBox original_bbox = original_bboxes[object]; + LLBBox new_bbox = new_bboxes[object]; + + LLVector3 delta = new_bbox.getCenterAgent() - original_bbox.getCenterAgent(); + + LLVector3 original_position = object->getPositionAgent(); + LLVector3 new_position = original_position + delta; + + object->setPosition(new_position); + } + + + LLSelectMgr::getInstance()->sendMultipleUpdate(UPD_POSITION); +} + + diff --git a/linden/indra/newview/qtoolalign.h b/linden/indra/newview/qtoolalign.h new file mode 100644 index 0000000..b2c18b7 --- /dev/null +++ b/linden/indra/newview/qtoolalign.h @@ -0,0 +1,50 @@ +/** + * @file qtoolalign.h + * @brief A tool to align objects + * @author Karl Stiefvater (Qarl) + * + * Karl has given permission to use this code under the terms of + * the GNU GPL v2 plus FLOSS exception and/or the GNU LGPL v2.1. + * + * Backported for Viewer 1.X code base by Jacek Antonelli. + */ + +#ifndef Q_QTOOLALIGN_H +#define Q_QTOOLALIGN_H + +#include "lltool.h" +#include "llbbox.h" + +class LLViewerObject; +class LLPickInfo; +class LLToolSelectRect; + +class QToolAlign +: public LLTool, public LLSingleton +{ +public: + QToolAlign(); + virtual ~QToolAlign(); + + virtual void handleSelect(); + virtual void handleDeselect(); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual void render(); + + static void pickCallback(const LLPickInfo& pick_info); + +private: + void align(); + void computeManipulatorSize(); + void renderManipulators(); + BOOL findSelectedManipulator(S32 x, S32 y); + + LLBBox mBBox; + F32 mManipulatorSize; + S32 mHighlightedAxis; + F32 mHighlightedDirection; + BOOL mForce; +}; + +#endif // Q_QTOOLALIGN_H diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml index 3e0a5fa..7438329 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml @@ -79,6 +79,9 @@ + , LLBBox > new_bboxes = original_bboxes; // find new positions - for (S32 i = 0; i < objects.size(); i++) + for (S32 i = 0; i < (S32)objects.size(); i++) { LLBBox target_bbox = mBBox; LLVector3 target_corner = target_bbox.getCenterAgent() - @@ -552,7 +552,7 @@ void QToolAlign::align() } // update target for next time through the loop - if (j < objects.size()) + if (j < (S32)objects.size()) { LLBBox next_bbox = new_bboxes[objects[j]]; target_corner = next_bbox.getCenterAgent() + @@ -563,7 +563,7 @@ void QToolAlign::align() // now move them - for (S32 i = 0; i < objects.size(); i++) + for (S32 i = 0; i < (S32)objects.size(); i++) { LLViewerObject* object = objects[i]; -- cgit v1.1 From a02b7f5f7385884d3832f633c0c096c685ba866b Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sat, 23 Oct 2010 18:53:57 -0700 Subject: Fixed Windows compile error in impprefsfonts.cpp (unsafe mix of type 'bool' and type 'BOOL' in operation) --- linden/indra/newview/impprefsfonts.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linden/indra/newview/impprefsfonts.cpp b/linden/indra/newview/impprefsfonts.cpp index bf0b028..a4dcd34 100644 --- a/linden/indra/newview/impprefsfonts.cpp +++ b/linden/indra/newview/impprefsfonts.cpp @@ -107,7 +107,7 @@ void ImpPrefsFonts::apply() LLCheckBoxCtrl* font_round = getChild("font_round"); if (font_round) { - bool round = font_round->getValue().asBoolean(); + BOOL round = font_round->getValue().asBoolean(); if (round != gSavedSettings.getBOOL("FontSizeRounding")) { gSavedSettings.setBOOL("FontSizeRounding", round); -- cgit v1.1 From 217abd5a4a491a2210bc05deb3fa5f84be51fc59 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sat, 23 Oct 2010 19:04:43 -0700 Subject: Fixed the link number label overwriting the selected objects when more than one prim is selected with Edit linked parts enabled --- linden/indra/newview/llfloatertools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linden/indra/newview/llfloatertools.cpp b/linden/indra/newview/llfloatertools.cpp index daff573..6744faf 100644 --- a/linden/indra/newview/llfloatertools.cpp +++ b/linden/indra/newview/llfloatertools.cpp @@ -931,7 +931,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) childSetVisible("Strength:", land_visible); } - if (gSavedSettings.getBOOL("EditLinkedParts")) + if (gSavedSettings.getBOOL("EditLinkedParts") && LLSelectMgr::getInstance()->getEditSelection()->getObjectCount() == 1) { childSetVisible("link_num", !land_visible); } -- cgit v1.1 From 6f81d6f3e0c128480a90b0baa509834c4a88b28e Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sat, 23 Oct 2010 19:26:37 -0700 Subject: Updated the Align tool's label with info about Pack --- linden/indra/newview/skins/default/xui/en-us/floater_tools.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml index 7438329..d7a2013 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_tools.xml @@ -80,8 +80,9 @@ initial_value="false" label="Select faces to texture" left="4" mouse_opaque="true" name="radio select face" radio_style="true" width="114" /> + initial_value="false" label="Align (Shift to Pack)" left="4" mouse_opaque="true" + name="radio align" radio_style="true" width="114" + tool_tip="Align aligns all selected prims' edges along an axis, Pack moves all selected prims' edges so they're touching" /> -