From e045d212d35354d679c2d2e05c6d4689f9f8ac95 Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Mon, 27 Sep 2010 22:56:08 -0400 Subject: STORM-1126 WIP Windlight Estate Settings port from 1.23: first pass at merging in windlight estate settings to viewer-dev codebase. not built, not tested. Probably needs a bunch of fixes to be able to be integrated. (resubmitted by Vadim ProductEngine) --- indra/newview/CMakeLists.txt | 21 + indra/newview/app_settings/settings.xml | 11 + indra/newview/featuretable.txt | 2 +- indra/newview/featuretable_linux.txt | 2 +- indra/newview/featuretable_mac.txt | 2 +- indra/newview/llagent.cpp | 19 + indra/newview/lldrawpoolwlsky.cpp | 8 +- indra/newview/llenvmanager.cpp | 474 +++++++++++++++ indra/newview/llenvmanager.h | 214 +++++++ indra/newview/llfloaterdaycycle.cpp | 436 +++++++++----- indra/newview/llfloaterdaycycle.h | 117 ++-- indra/newview/llfloaterenvsettings.cpp | 353 +++++++---- indra/newview/llfloaterenvsettings.h | 93 ++- indra/newview/llfloaterregioninfo.cpp | 148 ++++- indra/newview/llfloaterregioninfo.h | 35 +- indra/newview/llfloaterwater.cpp | 80 +-- indra/newview/llfloaterwater.h | 2 + indra/newview/llfloaterwindlight.cpp | 697 +++++++++++++--------- indra/newview/llfloaterwindlight.h | 113 ++-- indra/newview/llstartup.cpp | 2 - indra/newview/llviewerdisplay.cpp | 4 +- indra/newview/llviewermenu.cpp | 47 +- indra/newview/llviewerregion.cpp | 6 + indra/newview/llviewerregion.h | 5 + indra/newview/llviewershadermgr.cpp | 14 +- indra/newview/llviewershadermgr.h | 16 +- indra/newview/llvosky.cpp | 42 +- indra/newview/llvowlsky.cpp | 4 +- indra/newview/llwaterparammanager.cpp | 33 +- indra/newview/llwaterparammanager.h | 19 +- indra/newview/llwaterparamset.cpp | 43 ++ indra/newview/llwlanimator.cpp | 200 ++++++- indra/newview/llwlanimator.h | 86 ++- indra/newview/llwldaycycle.cpp | 210 ++++--- indra/newview/llwldaycycle.h | 38 +- indra/newview/llwlhandlers.cpp | 159 +++++ indra/newview/llwlhandlers.h | 89 +++ indra/newview/llwlparammanager.cpp | 441 +++++++++----- indra/newview/llwlparammanager.h | 189 ++++-- indra/newview/llwlparamset.cpp | 59 +- indra/newview/llwlparamset.h | 2 +- indra/newview/tests/lldir_stub.cpp | 45 ++ indra/newview/tests/llfloaterdaycycle_stub.cpp | 20 + indra/newview/tests/llfloaterenvsettings_stub.cpp | 20 + indra/newview/tests/llfloaterwindlight_stub.cpp | 20 + indra/newview/tests/llglslshader_stub.cpp | 22 + indra/newview/tests/llpipeline_stub.cpp | 15 + indra/newview/tests/llsky_stub.cpp | 20 + indra/newview/tests/llviewershadermgr_stub.cpp | 33 + indra/newview/tests/llwlanimator_stub.cpp | 12 + indra/newview/tests/llwldaycycle_stub.cpp | 35 ++ indra/newview/tests/llwlparammanager_test.cpp | 257 ++++++++ indra/newview/tests/llwlparamset_stub.cpp | 24 + 53 files changed, 3854 insertions(+), 1204 deletions(-) create mode 100644 indra/newview/llenvmanager.cpp create mode 100644 indra/newview/llenvmanager.h create mode 100644 indra/newview/llwlhandlers.cpp create mode 100644 indra/newview/llwlhandlers.h create mode 100644 indra/newview/tests/lldir_stub.cpp create mode 100644 indra/newview/tests/llfloaterdaycycle_stub.cpp create mode 100644 indra/newview/tests/llfloaterenvsettings_stub.cpp create mode 100644 indra/newview/tests/llfloaterwindlight_stub.cpp create mode 100644 indra/newview/tests/llglslshader_stub.cpp create mode 100644 indra/newview/tests/llpipeline_stub.cpp create mode 100644 indra/newview/tests/llsky_stub.cpp create mode 100644 indra/newview/tests/llviewershadermgr_stub.cpp create mode 100644 indra/newview/tests/llwlanimator_stub.cpp create mode 100644 indra/newview/tests/llwldaycycle_stub.cpp create mode 100644 indra/newview/tests/llwlparammanager_test.cpp create mode 100644 indra/newview/tests/llwlparamset_stub.cpp (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 1f4302d870..533eea7420 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -139,6 +139,7 @@ set(viewer_SOURCE_FILES lldrawpoolwlsky.cpp lldriverparam.cpp lldynamictexture.cpp + llenvmanager.cpp llemote.cpp lleventinfo.cpp lleventnotifier.cpp @@ -562,6 +563,7 @@ set(viewer_SOURCE_FILES llwind.cpp llwlanimator.cpp llwldaycycle.cpp + llwlhandlers.cpp llwlparammanager.cpp llwlparamset.cpp llworld.cpp @@ -670,6 +672,7 @@ set(viewer_HEADER_FILES lldriverparam.h lldynamictexture.h llemote.h + llenvmanager.h lleventinfo.h lleventnotifier.h lleventpoll.h @@ -1088,6 +1091,7 @@ set(viewer_HEADER_FILES llwind.h llwlanimator.h llwldaycycle.h + llwlhandlers.h llwlparammanager.h llwlparamset.h llworld.h @@ -1933,6 +1937,23 @@ if (LL_TESTS) #ADD_VIEWER_BUILD_TEST(lltextureinfodetails viewer) #ADD_VIEWER_BUILD_TEST(lltexturestatsuploader viewer) +include(LLAddBuildTest) +SET(viewer_TEST_SOURCE_FILES + llagentaccess.cpp + llwlparammanager.cpp + # Not *actually* a unit test, it's an integration test. + # Because it won't work in the new unit test iface, i've commented out + # and notified Nat. Delete this when it's replaced! + # + poppy & brad 2009-06-05 + # llcapabilitylistener.cpp + ) +set_source_files_properties( + ${viewer_TEST_SOURCE_FILES} + PROPERTIES + LL_TEST_ADDITIONAL_SOURCE_FILES llviewerprecompiledheaders.cpp + ) +LL_ADD_PROJECT_UNIT_TESTS(${VIEWER_BINARY_NAME} "${viewer_TEST_SOURCE_FILES}") + endif (LL_TESTS) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 742a20a849..d21e978ca5 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11046,6 +11046,17 @@ Value 1 + UseEnvironmentFromRegion + + Comment + Choose whether to use the region's environment settings, or override them with the local settings. + Persist + 1 + Type + Boolean + Value + 0 + UseExternalBrowser Comment diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 721fe81a3c..173e81733c 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -1,4 +1,4 @@ -version 23 +version 24 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt index 1bad7e5260..602f62cf69 100644 --- a/indra/newview/featuretable_linux.txt +++ b/indra/newview/featuretable_linux.txt @@ -1,4 +1,4 @@ -version 22 +version 23 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 4fba47e3df..bbe63be5ae 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 22 +version 23 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index c9bd7851ed..56d2c76dc7 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -36,8 +36,10 @@ #include "llanimationstates.h" #include "llbottomtray.h" #include "llcallingcard.h" +#include "llcapabilitylistener.h" #include "llchannelmanager.h" #include "llconsole.h" +#include "llenvmanager.h" #include "llfirstuse.h" #include "llfloatercamera.h" #include "llfloaterreg.h" @@ -76,6 +78,7 @@ #include "llwindow.h" #include "llworld.h" #include "llworldmap.h" +#include "stringize.h" using namespace LLVOAvatarDefines; @@ -620,6 +623,16 @@ void LLAgent::setRegion(LLViewerRegion *regionp) gSky.mVOGroundp->setRegion(regionp); } + // Notify windlight managers + bool teleport = (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE); + if (teleport) + { + LLEnvManager::getInstance()->notifyTP(); + } + else + { + LLEnvManager::getInstance()->notifyCrossing(); + } } else { @@ -636,6 +649,9 @@ void LLAgent::setRegion(LLViewerRegion *regionp) // Update all of the regions. LLWorld::getInstance()->updateAgentOffset(mAgentOriginGlobal); + + // Notify windlight managers about login + LLEnvManager::getInstance()->notifyLogin(); } } mRegionp = regionp; @@ -653,6 +669,9 @@ void LLAgent::setRegion(LLViewerRegion *regionp) LLSelectMgr::getInstance()->updateSelectionCenter(); LLFloaterMove::sUpdateFlyingStatus(); + + // notify EnvManager that a refresh is needed + LLEnvManager::instance().refreshFromStorage(LLEnvKey::SCOPE_REGION); } diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 41a299151e..0910d920f2 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -34,6 +34,8 @@ #include "llviewercamera.h" #include "llimage.h" #include "llwlparammanager.h" +#include "llviewershadermgr.h" +#include "llglslshader.h" #include "llsky.h" #include "llvowlsky.h" #include "llviewerregion.h" @@ -66,7 +68,7 @@ LLDrawPoolWLSky::LLDrawPoolWLSky(void) : sCloudNoiseTexture = LLViewerTextureManager::getLocalTexture(sCloudNoiseRawImage.get(), TRUE); - LLWLParamManager::instance()->propagateParameters(); + LLWLParamManager::getInstance()->propagateParameters(); } LLDrawPoolWLSky::~LLDrawPoolWLSky() @@ -161,7 +163,7 @@ void LLDrawPoolWLSky::renderStars(void) const // clamping and allow the star_alpha param to brighten the stars. bool error; LLColor4 star_alpha(LLColor4::black); - star_alpha.mV[3] = LLWLParamManager::instance()->mCurParams.getFloat("star_brightness", error) / 2.f; + star_alpha.mV[3] = LLWLParamManager::getInstance()->mCurParams.getFloat("star_brightness", error) / 2.f; llassert_always(!error); gGL.getTexUnit(0)->bind(gSky.mVOSkyp->getBloomTex()); @@ -254,7 +256,7 @@ void LLDrawPoolWLSky::render(S32 pass) } LLFastTimer ftm(FTM_RENDER_WL_SKY); - const F32 camHeightLocal = LLWLParamManager::instance()->getDomeOffset() * LLWLParamManager::instance()->getDomeRadius(); + const F32 camHeightLocal = LLWLParamManager::getInstance()->getDomeOffset() * LLWLParamManager::getInstance()->getDomeRadius(); LLGLSNoFog disableFog; LLGLDepthTest depth(GL_TRUE, GL_FALSE); diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp new file mode 100644 index 0000000000..f551aa6c8a --- /dev/null +++ b/indra/newview/llenvmanager.cpp @@ -0,0 +1,474 @@ +/** + * @file llenvmanager.cpp + * @brief Implementation of classes managing WindLight and water settings. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llenvmanager.h" + +#include "llagent.h" +#include "llviewerregion.h" + +#include "llfloaterwindlight.h" +#include "llfloaterwater.h" +#include "llfloaterenvsettings.h" +#include "llwlparammanager.h" +#include "llwaterparammanager.h" +#include "llfloaterregioninfo.h" +#include "llwindlightscrubbers.h" +#include "llwlhandlers.h" + +extern LLControlGroup gSavedSettings; + +/*virtual*/ void LLEnvManager::initSingleton() +{ + mOrigSettingStore[LLEnvKey::SCOPE_LOCAL] = lindenDefaults(); + mCurNormalScope = (gSavedSettings.getBOOL("UseEnvironmentFromRegion") ? LLEnvKey::SCOPE_REGION : LLEnvKey::SCOPE_LOCAL); + mInterpNextChangeMessage = true; + mPendingOutgoingMessage = false; + mIsEditing = false; +} + +/******* + * Region Changes + *******/ + +void LLEnvManager::notifyLogin() +{ + changedRegion(false); +} +void LLEnvManager::notifyCrossing() +{ + changedRegion(true); +} +void LLEnvManager::notifyTP() +{ + changedRegion(false); +} +void LLEnvManager::changedRegion(bool interp) +{ + mInterpNextChangeMessage = interp; + mPendingOutgoingMessage = false; + + LLFloaterEnvSettings::instance()->close(); + + resetInternalsToDefault(LLEnvKey::SCOPE_REGION); + + maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false); +} + +/******* + * Editing settings / UI mode + *******/ + +void LLEnvManager::startEditingScope(LLEnvKey::EScope scope) +{ + if (mIsEditing) + { + LL_WARNS("Windlight") << "Tried to start editing windlight settings while already editing some settings (possibly others)! Ignoring..." << LL_ENDL; + return; + } + if (!canEdit(scope)) + { + LL_WARNS("Windlight") << "Tried to start editing windlight settings while not allowed to! Ignoring..." << LL_ENDL; + return; + } + + mIsEditing = true; + mCurEditingScope = scope; + + // show scope being edited + loadSettingsIntoManagers(scope, false); + + switch (scope) + { + case LLEnvKey::SCOPE_LOCAL: + // not implemented here (yet) + return; + case LLEnvKey::SCOPE_REGION: + LLPanelRegionTerrainInfo::instance()->setCommitControls(true); + break; + default: + return; + } +} + +void LLEnvManager::maybeClearEditingScope(LLEnvKey::EScope scope, bool user_initiated, bool was_commit) +{ + if (mIsEditing && mCurEditingScope == scope) + { + maybeClearEditingScope(user_initiated, was_commit); // handles UI, updating managers, etc. + } +} + +void LLEnvManager::maybeClearEditingScope(bool user_initiated, bool was_commit) +{ + bool clear_now = true; + if (mIsEditing && !was_commit) + { + if(user_initiated) + { + LLSD args; + args["SCOPE"] = getScopeString(mCurEditingScope); + LLNotifications::instance().add("EnvEditUnsavedChangesCancel", args, LLSD(), + boost::bind(&LLEnvManager::clearEditingScope, this, _1, _2)); + clear_now = false; + } + else + { + LLNotifications::instance().add("EnvEditExternalCancel", LLSD()); + } + } + + if(clear_now) + { + clearEditingScope(LLSD(), LLSD()); + } +} + +void LLEnvManager::clearEditingScope(const LLSD& notification, const LLSD& response) +{ + if(notification.isDefined() && response.isDefined() && LLNotification::getSelectedOption(notification, response) != 0) + { + // *TODO: select terrain panel here + mIsEditing = false; + LLFloaterRegionInfo::showInstance(); + return; + } + + mIsEditing = false; + + updateUIFromEditability(); + LLPanelRegionTerrainInfo::instance()->cancelChanges(); + + loadSettingsIntoManagers(mCurNormalScope, true); +} + +void LLEnvManager::updateUIFromEditability() +{ + // *TODO When the checkbox from LLFloaterEnvSettings is moved elsewhere, opening the local environment settings window should auto-display local settings + // Currently, disable all editing to ensure region settings are hidden from those that can't edit them (to preserve possibility of future tradable assets) + // Remove "!gSavedSettings.getBOOL(...)" when the desired behavior is implemented + LLFloaterEnvSettings::instance()->setControlsEnabled(canEdit(LLEnvKey::SCOPE_LOCAL) && !gSavedSettings.getBOOL("UseEnvironmentFromRegion")); + LLPanelRegionTerrainInfo::instance()->setEnvControls(canEdit(LLEnvKey::SCOPE_REGION)); + // enable estate UI iff canEdit(LLEnvKey::SCOPE_ESTATE), etc. +} + +bool LLEnvManager::regionCapable() +{ + return !gAgent.getRegion()->getCapability("EnvironmentSettings").empty(); +} + +const std::string LLEnvManager::getScopeString(LLEnvKey::EScope scope) +{ + switch(scope) + { + case LLEnvKey::SCOPE_LOCAL: + return LLTrans::getString("LocalSettings"); + case LLEnvKey::SCOPE_REGION: + return LLTrans::getString("RegionSettings"); + default: + return " (?)"; + } +} + +bool LLEnvManager::canEdit(LLEnvKey::EScope scope) +{ + // can't edit while a message is being sent or if already editing + if (mPendingOutgoingMessage || mIsEditing) + { + return false; + } + + // check permissions and caps + switch (scope) + { + case LLEnvKey::SCOPE_LOCAL: + return true; // always permitted to edit local + case LLEnvKey::SCOPE_REGION: + bool owner_or_god_or_manager; + { + LLViewerRegion* region = gAgent.getRegion(); + if (NULL == region || region->getCapability("EnvironmentSettings").empty()) + { + // not a windlight-aware region + return false; + } + owner_or_god_or_manager = gAgent.isGodlike() + || (region && (region->getOwner() == gAgent.getID())) + || (region && region->isEstateManager()); + } + return owner_or_god_or_manager; + default: + return false; + } +} + +/******* + * Incoming Messaging + *******/ + +void LLEnvManager::refreshFromStorage(LLEnvKey::EScope scope) +{ + switch (scope) + { + case LLEnvKey::SCOPE_LOCAL: + break; + case LLEnvKey::SCOPE_REGION: + if (!LLEnvironmentRequestResponder::initiateRequest()) + { + // don't have a cap for this, presume invalid response + processIncomingMessage(LLSD(), scope); + } + break; + default: + processIncomingMessage(LLSD(), scope); + break; + } +} + +bool LLEnvManager::processIncomingMessage(const LLSD& unvalidated_content, const LLEnvKey::EScope scope) +{ + if (scope != LLEnvKey::SCOPE_REGION) + { + return false; + } + + // Start out with defaults + resetInternalsToDefault(scope); + updateUIFromEditability(); + + // Validate + std::set empty_set; + LLWLPacketScrubber scrubber(scope, empty_set); + LLSD windlight_llsd = scrubber.scrub(unvalidated_content); + + bool valid = windlight_llsd.isDefined(); // successful scrub + + mLastReceivedID = unvalidated_content[0]["messageID"].asUUID(); // if the message was valid, grab the UUID from it and save it for next outbound update message + + if (valid) + { + F32 sun_hour = LLPanelRegionTerrainInfo::instance()->getSunHour(); // this slider is kept up to date + LLWLParamManager::getInstance()->addAllSkies(scope, windlight_llsd[2]); + LLEnvironmentSettings newSettings(windlight_llsd[1], windlight_llsd[2], windlight_llsd[3], sun_hour); + mOrigSettingStore[scope] = newSettings; + } + else + { + LL_WARNS("Windlight Sync") << "Failed to parse windlight settings!" << LL_ENDL; + // presume defaults (already reset above) + } + + maybeClearEditingScope(scope, false, false); + + // refresh display with new settings, if applicable + if (mCurNormalScope == scope && !mIsEditing) // if mIsEditing still, must be editing some other scope, so don't load + { + loadSettingsIntoManagers(scope, mInterpNextChangeMessage); + } + + mInterpNextChangeMessage = true; // reset flag + + return valid; +} + + +/******* + * Outgoing Messaging + *******/ + +void LLEnvManager::commitSettings(LLEnvKey::EScope scope) +{ + bool success = true; + switch (scope) + { + case (LLEnvKey::SCOPE_LOCAL): + // not implemented - LLWLParamManager and LLWaterParamManager currently manage local storage themselves + break; + case (LLEnvKey::SCOPE_REGION): + mPendingOutgoingMessage = true; + LLSD metadata(LLSD::emptyMap()); + metadata["regionID"] = gAgent.getRegion()->getRegionID(); + metadata["messageID"] = mLastReceivedID; // add last received update ID to outbound message so simulator can handle concurrent updates + + saveSettingsFromManagers(scope); // save current settings into settings store before grabbing from settings store and sending + success = LLEnvironmentApplyResponder::initiateRequest(makePacket(LLEnvKey::SCOPE_REGION, metadata)); + if(success) + { + // while waiting for the return message, render old settings + // (as of Aug 09, we should get an updated RegionInfo packet, which triggers a re-request of Windlight data, which causes us to show new settings) + loadSettingsIntoManagers(LLEnvKey::SCOPE_REGION, true); + } + break; + } + + if(success) + { + // with mPendingOutgoingMessage = true, nothing is editable + updateUIFromEditability(); + maybeClearEditingScope(true, true); + } + else + { + mPendingOutgoingMessage = false; + } +} + +LLSD LLEnvManager::makePacket(LLEnvKey::EScope scope, const LLSD& metadata) +{ + return mOrigSettingStore[scope].makePacket(metadata); +} + +void LLEnvManager::commitSettingsFinished(LLEnvKey::EScope scope) +{ + mPendingOutgoingMessage = false; + + updateUIFromEditability(); +} + +/******* + * Loading defaults + *******/ + +void LLEnvManager::resetInternalsToDefault(LLEnvKey::EScope scope) +{ + if (LLEnvKey::SCOPE_LOCAL != scope) + { + LLWLParamManager::getInstance()->clearParamSetsOfScope(scope); + } + + mOrigSettingStore[scope] = lindenDefaults(); + LLWLParamManager::getInstance()->mAnimator.setTimeType(LLWLAnimator::TIME_LINDEN); +} + +const LLEnvironmentSettings& LLEnvManager::lindenDefaults() +{ + static bool loaded = false; + static LLEnvironmentSettings defSettings; + + if (!loaded) + { + LLWaterParamSet defaultWater; + LLWaterParamManager::instance().getParamSet("default", defaultWater); + + // *TODO save default skies (remove hack in LLWLDayCycle::loadDayCycle when this is done) + + defSettings.saveParams( + LLWLDayCycle::loadCycleDataFromFile("default.xml"), // frames will refer to local presets, which is okay + LLSD(LLSD::emptyMap()), // should never lose the default sky presets (read-only) + defaultWater.getAll(), + 0.0); + + loaded = true; + } + + return defSettings; +} + +/******* + * Manipulation of Param Managers + *******/ + +void LLEnvManager::loadSettingsIntoManagers(LLEnvKey::EScope scope, bool interpolate) +{ + LLEnvironmentSettings settings = mOrigSettingStore[scope]; + + if(interpolate) + { + LLWLParamManager::getInstance()->mAnimator.startInterpolation(settings.getWaterParams()); + } + + LLWLParamManager::getInstance()->addAllSkies(scope, settings.getSkyMap()); + LLWLParamManager::getInstance()->mDay.loadDayCycle(settings.getWLDayCycle(), scope); + LLWLParamManager::getInstance()->resetAnimator(settings.getDayTime(), true); + + LLWaterParamManager::getInstance()->mCurParams.setAll(settings.getWaterParams()); +} + +void LLEnvManager::saveSettingsFromManagers(LLEnvKey::EScope scope) +{ + switch (scope) + { + case LLEnvKey::SCOPE_LOCAL: + mOrigSettingStore[scope].saveParams( + LLWLParamManager::getInstance()->mDay.asLLSD(), + LLSD(LLSD::emptyMap()), // never overwrite + LLWaterParamManager::getInstance()->mCurParams.getAll(), + LLWLParamManager::getInstance()->mAnimator.mDayTime); + break; + case LLEnvKey::SCOPE_REGION: + { + // ensure only referenced region-scope skies are saved, resolve naming collisions, etc. + std::map final_references = LLWLParamManager::getInstance()->finalizeFromDayCycle(scope); + LLSD referenced_skies = LLWLParamManager::getInstance()->createSkyMap(final_references); + mOrigSettingStore[scope].saveParams( + LLWLParamManager::getInstance()->mDay.asLLSD(), + referenced_skies, + LLWaterParamManager::getInstance()->mCurParams.getAll(), + LLWLParamManager::getInstance()->mAnimator.mDayTime); + } + break; + default: + return; + } +} + +/******* + * Setting desired display level + *******/ + +void LLEnvManager::setNormallyDisplayedScope(LLEnvKey::EScope new_scope) +{ + // temp, just save the scope directly as a value in the future when there's more than two + bool want_region = (LLEnvKey::SCOPE_REGION == new_scope); + gSavedSettings.setBOOL("UseEnvironmentFromRegion", want_region); + + if (mCurNormalScope != new_scope) + { + mCurNormalScope = new_scope; + notifyOptInChange(); + } +} + +void LLEnvManager::notifyOptInChange() +{ + bool opt_in = gSavedSettings.getBOOL("UseEnvironmentFromRegion"); + + // Save local settings if switching to region + if(opt_in) + { + LL_INFOS("Windlight") << "Saving currently-displayed settings as current local settings..." << LL_ENDL; + saveSettingsFromManagers(LLEnvKey::SCOPE_LOCAL); + } + + maybeClearEditingScope(true, false); +} diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h new file mode 100644 index 0000000000..1ff4654003 --- /dev/null +++ b/indra/newview/llenvmanager.h @@ -0,0 +1,214 @@ +/** + * @file llenvmanager.h + * @brief Declaration of classes managing WindLight and water settings. + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLENVMANAGER_H +#define LL_LLENVMANAGER_H + +#include "llmemory.h" +#include "llsd.h" + +class LLWLParamManager; +class LLWaterParamManager; +class LLWLAnimator; + +// generic key +struct LLEnvKey +{ +public: + // Note: enum ordering is important; for example, a region-level floater (1) will see local and region (all values that are <=) + typedef enum e_scope + { + SCOPE_LOCAL, // 0 + SCOPE_REGION//, // 1 + // SCOPE_ESTATE, // 2 + // etc. + } EScope; +}; + +class LLEnvironmentSettings +{ +public: + LLEnvironmentSettings() : + mWLDayCycle(LLSD::emptyMap()), + mSkyMap(LLSD::emptyMap()), + mWaterParams(LLSD::emptyMap()), + mDayTime(0.f) + {} + LLEnvironmentSettings(const LLSD& dayCycle, const LLSD& skyMap, const LLSD& waterParams, F64 dayTime) : + mWLDayCycle(dayCycle), + mSkyMap(skyMap), + mWaterParams(waterParams), + mDayTime(dayTime) + {} + ~LLEnvironmentSettings() {} + + void saveParams(const LLSD& dayCycle, const LLSD& skyMap, const LLSD& waterParams, F64 dayTime) + { + mWLDayCycle = dayCycle; + mSkyMap = skyMap; + mWaterParams = waterParams; + mDayTime = dayTime; + } + + LLSD& getWLDayCycle() + { + return mWLDayCycle; + } + + LLSD& getWaterParams() + { + return mWaterParams; + } + + LLSD& getSkyMap() + { + return mSkyMap; + } + + F64 getDayTime() + { + return mDayTime; + } + + LLSD makePacket(const LLSD& metadata) + { + LLSD full_packet = LLSD::emptyArray(); + + // 0: metadata + full_packet.append(metadata); + + // 1: day cycle + full_packet.append(mWLDayCycle); + + // 2: map of sky setting names to sky settings (as LLSD) + full_packet.append(mSkyMap); + + // 3: water params + full_packet.append(mWaterParams); + + return full_packet; + } + +private: + LLSD mWLDayCycle, mWaterParams, mSkyMap; + F64 mDayTime; +}; + +// not thread-safe +class LLEnvManager : public LLSingleton +{ +public: + // sets scopes (currently, only region-scope) to startup states + // delay calling these until as close as possible to knowing whether the remote service is capable of holding windlight settings + void notifyCrossing(); + // these avoid interpolation on the next incoming message (if it comes) + void notifyLogin(); + void notifyTP(); + + // request settings again from remote storage (currently implemented only for region) + void refreshFromStorage(LLEnvKey::EScope scope); + // stores settings and starts transitions (as necessary) + // validates packet and returns whether it was valid + // loads defaults if not valid + // returns whether or not arguments were valid + bool processIncomingMessage(const LLSD& packet, LLEnvKey::EScope scope); + // saves settings in the given scope to persistent storage appropriate for that scope + void commitSettings(LLEnvKey::EScope scope); + // called back when the commit finishes + void commitSettingsFinished(LLEnvKey::EScope scope); + + /* + * notify of changes in god/not-god mode, estate ownership, etc. + * should be called every time after entering new region (after receiving new caps) + */ + void notifyPermissionChange(); + + bool regionCapable(); + static const std::string getScopeString(LLEnvKey::EScope scope); + bool canEdit(LLEnvKey::EScope scope); + // enables and populates UI + // populates display (param managers) with scope's settings + // silently fails if canEdit(scope) is false! + void startEditingScope(LLEnvKey::EScope scope); + // cancel and close UI as necessary + // reapplies unedited settings + // displays the settings from the scope that user has set (i.e. opt-in setting for now) + void maybeClearEditingScope(bool user_initiated, bool was_commit); + // clear the scope only if was editing that scope + void maybeClearEditingScope(LLEnvKey::EScope scope, bool user_initiated, bool was_commit); + // actually do the clearing + void clearEditingScope(const LLSD& notification, const LLSD& response); + + // clear and reload defaults into scope + void resetInternalsToDefault(LLEnvKey::EScope scope); + + // sets which scope is to be displayed + // fix me if/when adding more levels of scope + void setNormallyDisplayedScope(LLEnvKey::EScope scope); + +private: + // overriden initializer + friend class LLSingleton; + virtual void initSingleton(); + // helper function (when region changes, but before caps are received) + void changedRegion(bool interpolate); + // apply to current display and UI + void loadSettingsIntoManagers(LLEnvKey::EScope scope, bool interpolate); + // save from current display and UI into memory (mOrigSettingStore) + void saveSettingsFromManagers(LLEnvKey::EScope scope); + + // Save copy of settings from the current ones in the param managers + LLEnvironmentSettings collateFromParamManagers(); + // bundle settings (already committed from UI) into an LLSD + LLSD makePacket(LLEnvKey::EScope scope, const LLSD& metadata); + + void updateUIFromEditability(); + + // only call when setting *changes*, not just when it might have changed + // saves local settings into mOrigSettingStore when necessary + void notifyOptInChange(); + + // calculate Linden default settings + static const LLEnvironmentSettings& lindenDefaults(); + + std::map mOrigSettingStore; // settings which have been committed from UI + + bool mInterpNextChangeMessage; + bool mPendingOutgoingMessage; + bool mIsEditing; + LLEnvKey::EScope mCurNormalScope; // scope being displayed when not editing (i.e. most of the time) + LLEnvKey::EScope mCurEditingScope; + LLUUID mLastReceivedID; +}; + +#endif // LL_LLENVMANAGER_H + diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index 22816ee802..efaac5cfc5 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -2,25 +2,31 @@ * @file llfloaterdaycycle.cpp * @brief LLFloaterDayCycle class definition * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, 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. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * 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. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * 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 + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -51,34 +57,23 @@ #include "llwlparammanager.h" #include "llpostprocess.h" #include "llfloaterwindlight.h" +#include "llwindlightscrubbers.h" +#include "llenvmanager.h" - -std::map LLFloaterDayCycle::sSliderToKey; +LLFloaterDayCycle* LLFloaterDayCycle::sDayCycle = NULL; const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f; +std::map LLFloaterDayCycle::sSliderToKey; +LLEnvKey::EScope LLFloaterDayCycle::sScope; +std::string LLFloaterDayCycle::sOriginalTitle; +LLWLAnimator::ETime LLFloaterDayCycle::sPreviousTimeType = LLWLAnimator::TIME_LINDEN; -LLFloaterDayCycle::LLFloaterDayCycle(const LLSD& key) -: LLFloater(key) +LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater(std::string("Day Cycle Floater")) { -} + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml", NULL, FALSE); + sOriginalTitle = getTitle(); -BOOL LLFloaterDayCycle::postBuild() -{ - // add the combo boxes - LLComboBox* keyCombo = getChild("WLKeyPresets"); - - if(keyCombo != NULL) - { - keyCombo->removeall(); - std::map::iterator mIt = - LLWLParamManager::instance()->mParamList.begin(); - for(; mIt != LLWLParamManager::instance()->mParamList.end(); mIt++) - { - keyCombo->add(std::string(mIt->first)); - } - - // set defaults on combo boxes - keyCombo->selectFirstItem(); - } + llassert(MAX_LOCAL_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxSliderCount() && + MAX_REGION_KEYFRAMES <= getChild("WLDayCycleKeys")->getMaxSliderCount()); // add the time slider LLMultiSliderCtrl* sldr = getChild("WLTimeSlider"); @@ -87,57 +82,67 @@ BOOL LLFloaterDayCycle::postBuild() // load it up initCallbacks(); - - syncMenu(); - syncSliderTrack(); - - return TRUE; } LLFloaterDayCycle::~LLFloaterDayCycle() { } +void LLFloaterDayCycle::onClickHelp(void* data) +{ + LLFloaterDayCycle* self = LLFloaterDayCycle::instance(); + + std::string xml_alert = *(std::string *) data; + LLNotifications::instance().add(self->contextualNotification(xml_alert)); +} + +void LLFloaterDayCycle::initHelpBtn(const std::string& name, const std::string& xml_alert) +{ + childSetAction(name, onClickHelp, new std::string(xml_alert)); +} + void LLFloaterDayCycle::initCallbacks(void) { + initHelpBtn("WLDayCycleHelp", "HelpDayCycle"); + // WL Day Cycle - getChild("WLTimeSlider")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeSliderMoved, this, _1)); - getChild("WLDayCycleKeys")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeMoved, this, _1)); - getChild("WLCurKeyHour")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeChanged, this, _1)); - getChild("WLCurKeyMin")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeChanged, this, _1)); - getChild("WLKeyPresets")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyPresetChanged, this, _1)); - - getChild("WLLengthOfDayHour")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1)); - getChild("WLLengthOfDayMin")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1)); - getChild("WLLengthOfDaySec")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1)); - getChild("WLUseLindenTime")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onUseLindenTime, this, _1)); - getChild("WLAnimSky")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onRunAnimSky, this, _1)); - getChild("WLStopAnimSky")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onStopAnimSky, this, _1)); - - getChild("WLLoadDayCycle")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onLoadDayCycle, this, _1)); - getChild("WLSaveDayCycle")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onSaveDayCycle, this, _1)); - - getChild("WLAddKey")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onAddKey, this, _1)); - getChild("WLDeleteKey")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onDeleteKey, this, _1)); + childSetCommitCallback("WLTimeSlider", onTimeSliderMoved, NULL); + childSetCommitCallback("WLDayCycleKeys", onKeyTimeMoved, NULL); + childSetCommitCallback("WLCurKeyHour", onKeyTimeChanged, NULL); + childSetCommitCallback("WLCurKeyMin", onKeyTimeChanged, NULL); + childSetCommitCallback("WLKeyPresets", onKeyPresetChanged, NULL); + + childSetCommitCallback("WLLengthOfDayHour", onTimeRateChanged, NULL); + childSetCommitCallback("WLLengthOfDayMin", onTimeRateChanged, NULL); + childSetCommitCallback("WLLengthOfDaySec", onTimeRateChanged, NULL); + childSetAction("WLUseLindenTime", onUseLindenTime, NULL); + childSetAction("WLAnimSky", onRunAnimSky, NULL); + childSetAction("WLStopAnimSky", onStopAnimSky, NULL); + + childSetAction("WLLoadDayCycle", onLoadDayCycle, NULL); + childSetAction("WLSaveDayCycle", onSaveDayCycle, NULL); + + childSetAction("WLAddKey", onAddKey, NULL); + childSetAction("WLDeleteKey", onDeleteKey, NULL); } void LLFloaterDayCycle::syncMenu() { -// std::map & currentParams = LLWLParamManager::instance()->mCurParams.mParamValues; +// std::map & currentParams = LLWLParamManager::getInstance()->mCurParams.mParamValues; // set time - LLMultiSliderCtrl* sldr = getChild("WLTimeSlider"); - sldr->setCurSliderValue((F32)LLWLParamManager::instance()->mAnimator.getDayTime() * sHoursPerDay); + LLMultiSliderCtrl* sldr = LLFloaterDayCycle::sDayCycle->getChild("WLTimeSlider"); + sldr->setCurSliderValue((F32)LLWLParamManager::getInstance()->mAnimator.getDayTime() * sHoursPerDay); - LLSpinCtrl* secSpin = getChild("WLLengthOfDaySec"); - LLSpinCtrl* minSpin = getChild("WLLengthOfDayMin"); - LLSpinCtrl* hourSpin = getChild("WLLengthOfDayHour"); + LLSpinCtrl* secSpin = sDayCycle->getChild("WLLengthOfDaySec"); + LLSpinCtrl* minSpin = sDayCycle->getChild("WLLengthOfDayMin"); + LLSpinCtrl* hourSpin = sDayCycle->getChild("WLLengthOfDayHour"); F32 curRate; F32 hours, min, sec; // get the current rate - curRate = LLWLParamManager::instance()->mDay.mDayRate; + curRate = LLWLParamManager::getInstance()->mDay.mDayRate; hours = (F32)((int)(curRate / 60 / 60)); curRate -= (hours * 60 * 60); min = (F32)((int)(curRate / 60)); @@ -149,28 +154,28 @@ void LLFloaterDayCycle::syncMenu() secSpin->setValue(sec); // turn off Use Estate Time button if it's already being used - if( LLWLParamManager::instance()->mAnimator.mUseLindenTime == true) + if( LLWLParamManager::getInstance()->mAnimator.getUseLindenTime()) { - getChildView("WLUseLindenTime")->setEnabled(FALSE); + LLFloaterDayCycle::sDayCycle->childDisable("WLUseLindenTime"); } else { - getChildView("WLUseLindenTime")->setEnabled(TRUE); + LLFloaterDayCycle::sDayCycle->childEnable("WLUseLindenTime"); } } void LLFloaterDayCycle::syncSliderTrack() { // clear the slider - LLMultiSliderCtrl* kSldr = getChild("WLDayCycleKeys"); + LLMultiSliderCtrl* kSldr = sDayCycle->getChild("WLDayCycleKeys"); kSldr->clear(); sSliderToKey.clear(); // add sliders - std::map::iterator mIt = - LLWLParamManager::instance()->mDay.mTimeMap.begin(); - for(; mIt != LLWLParamManager::instance()->mDay.mTimeMap.end(); mIt++) + std::map::iterator mIt = + LLWLParamManager::getInstance()->mDay.mTimeMap.begin(); + for(; mIt != LLWLParamManager::getInstance()->mDay.mTimeMap.end(); mIt++) { addSliderKey(mIt->first * sHoursPerDay, mIt->second); } @@ -185,34 +190,115 @@ void LLFloaterDayCycle::syncTrack() } LLMultiSliderCtrl* sldr; - sldr = getChild( + sldr = sDayCycle->getChild( "WLDayCycleKeys"); llassert_always(sSliderToKey.size() == sldr->getValue().size()); LLMultiSliderCtrl* tSldr; - tSldr = getChild( + tSldr = sDayCycle->getChild( "WLTimeSlider"); // create a new animation track - LLWLParamManager::instance()->mDay.clearKeys(); + LLWLParamManager::getInstance()->mDay.clearKeyframes(); // add the keys one by one - std::map::iterator mIt = sSliderToKey.begin(); + std::map::iterator mIt = sSliderToKey.begin(); for(; mIt != sSliderToKey.end(); mIt++) { - LLWLParamManager::instance()->mDay.addKey(mIt->second.time / sHoursPerDay, - mIt->second.presetName); + LLWLParamManager::getInstance()->mDay.addKeyframe(mIt->second.time / sHoursPerDay, + mIt->second.keyframe); } // set the param manager's track to the new one - LLWLParamManager::instance()->resetAnimator( + LLWLParamManager::getInstance()->resetAnimator( tSldr->getCurSliderValue() / sHoursPerDay, false); - LLWLParamManager::instance()->mAnimator.update( - LLWLParamManager::instance()->mCurParams); + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); +} + +void LLFloaterDayCycle::refreshPresetsFromParamManager() +{ + LLComboBox* keyCombo = sDayCycle->getChild("WLKeyPresets"); + + if(keyCombo != NULL) + { + std::map::iterator mIt = + LLWLParamManager::getInstance()->mParamList.begin(); + for(; mIt != LLWLParamManager::getInstance()->mParamList.end(); mIt++) + { + if(mIt->first.scope <= sScope) + { + llinfos << "Adding key: " << mIt->first.toString() << llendl; + keyCombo->add(mIt->first.toString(), LLSD(mIt->first.toStringVal())); + } + } + + // set defaults on combo boxes + keyCombo->selectFirstItem(); + } } -void LLFloaterDayCycle::onRunAnimSky(LLUICtrl* ctrl) +// static +LLFloaterDayCycle* LLFloaterDayCycle::instance() +{ + if (!sDayCycle) + { + sDayCycle = new LLFloaterDayCycle(); + // sDayCycle->open(); + // sDayCycle->setFocus(TRUE); + } + return sDayCycle; +} + +bool LLFloaterDayCycle::isOpen() +{ + if (sDayCycle != NULL) + { + return true; + } + return false; +} + +void LLFloaterDayCycle::show(LLEnvKey::EScope scope) +{ + LLFloaterDayCycle* dayCycle = instance(); + if(scope != sScope && ((LLView*)dayCycle)->getVisible()) + { + LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD()); + return; + } + sScope = scope; + std::string title = sOriginalTitle + " (" + LLEnvManager::getScopeString(sScope) + ")"; + dayCycle->setTitle(title); + refreshPresetsFromParamManager(); + dayCycle->syncMenu(); + syncSliderTrack(); + + // set drop-down menu to match preset of currently-selected keyframe (one is automatically selected initially) + const std::string& curSldr = sDayCycle->getChild("WLDayCycleKeys")->getCurSlider(); + if(strlen(curSldr.c_str()) > 0) // only do this if there is a curSldr, otherwise we put an invalid entry into the map + { + sDayCycle->getChild("WLKeyPresets")->selectByValue(sSliderToKey[curSldr].keyframe.toStringVal()); + } + + // comment in if you want the menu to rebuild each time + //LLUICtrlFactory::getInstance()->buildFloater(dayCycle, "floater_day_cycle_options.xml"); + //dayCycle->initCallbacks(); + + dayCycle->open(); +} + +// virtual +void LLFloaterDayCycle::onClose(bool app_quitting) +{ + if (sDayCycle) + { + sDayCycle->setVisible(FALSE); + } +} + +void LLFloaterDayCycle::onRunAnimSky(void* userData) { // if no keys, do nothing if(sSliderToKey.size() == 0) @@ -221,46 +307,47 @@ void LLFloaterDayCycle::onRunAnimSky(LLUICtrl* ctrl) } LLMultiSliderCtrl* sldr; - sldr = getChild("WLDayCycleKeys"); + sldr = sDayCycle->getChild("WLDayCycleKeys"); llassert_always(sSliderToKey.size() == sldr->getValue().size()); - LLMultiSliderCtrl* tSldr; - tSldr = getChild("WLTimeSlider"); + LLMultiSliderCtrl* tSldr = sDayCycle->getChild("WLTimeSlider"); + + sPreviousTimeType = LLWLParamManager::getInstance()->mAnimator.getTimeType(); // turn off linden time - LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + LLWLParamManager::getInstance()->mAnimator.setTimeType(LLWLAnimator::TIME_CUSTOM); // set the param manager's track to the new one - LLWLParamManager::instance()->resetAnimator( - tSldr->getCurSliderValue() / sHoursPerDay, true); + LLWLParamManager::getInstance()->resetAnimator(tSldr->getCurSliderValue() / sHoursPerDay, true); - llassert_always(LLWLParamManager::instance()->mAnimator.mTimeTrack.size() == sldr->getValue().size()); + llassert_always(LLWLParamManager::getInstance()->mAnimator.mTimeTrack.size() == sldr->getValue().size()); } -void LLFloaterDayCycle::onStopAnimSky(LLUICtrl* ctrl) +void LLFloaterDayCycle::onStopAnimSky(void* userData) { // if no keys, do nothing if(sSliderToKey.size() == 0) { return; } - // turn off animation and using linden time - LLWLParamManager::instance()->mAnimator.mIsRunning = false; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + LLWLParamManager::getInstance()->mAnimator.deactivate(); // turn off animation and using linden time + LLMultiSliderCtrl* tSldr = sDayCycle->getChild("WLTimeSlider"); + LLWLParamManager::getInstance()->resetAnimator(tSldr->getCurSliderValue() / sHoursPerDay, false); + LLWLParamManager::getInstance()->mAnimator.setTimeType(sPreviousTimeType); } -void LLFloaterDayCycle::onUseLindenTime(LLUICtrl* ctrl) +void LLFloaterDayCycle::onUseLindenTime(void* userData) { - LLComboBox* box = getChild("WLPresetsCombo"); + LLFloaterWindLight* wl = LLFloaterWindLight::instance(); + LLComboBox* box = wl->getChild("WLPresetsCombo"); box->selectByValue(""); - LLWLParamManager::instance()->mAnimator.mIsRunning = true; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = true; + LLWLParamManager::getInstance()->mAnimator.deactivate(); } -void LLFloaterDayCycle::onLoadDayCycle(LLUICtrl* ctrl) +void LLFloaterDayCycle::onLoadDayCycle(void* userData) { - LLWLParamManager::instance()->mDay.loadDayCycle("Default.xml"); + LLWLParamManager::getInstance()->mDay.loadDayCycleFromFile("Default.xml"); // sync it all up syncSliderTrack(); @@ -268,46 +355,45 @@ void LLFloaterDayCycle::onLoadDayCycle(LLUICtrl* ctrl) // set the param manager's track to the new one LLMultiSliderCtrl* tSldr; - tSldr = getChild( + tSldr = sDayCycle->getChild( "WLTimeSlider"); - LLWLParamManager::instance()->resetAnimator( + LLWLParamManager::getInstance()->resetAnimator( tSldr->getCurSliderValue() / sHoursPerDay, false); // and draw it - LLWLParamManager::instance()->mAnimator.update( - LLWLParamManager::instance()->mCurParams); + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); } -void LLFloaterDayCycle::onSaveDayCycle(LLUICtrl* ctrl) +void LLFloaterDayCycle::onSaveDayCycle(void* userData) { - LLWLParamManager::instance()->mDay.saveDayCycle("Default.xml"); + LLWLParamManager::getInstance()->mDay.saveDayCycle("Default.xml"); } -void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl) +void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData) { - LLMultiSliderCtrl* sldr = getChild( + LLMultiSliderCtrl* sldr = sDayCycle->getChild( "WLTimeSlider"); /// get the slider value F32 val = sldr->getCurSliderValue() / sHoursPerDay; // set the value, turn off animation - LLWLParamManager::instance()->mAnimator.setDayTime((F64)val); - LLWLParamManager::instance()->mAnimator.mIsRunning = false; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val); + LLWLParamManager::getInstance()->mAnimator.deactivate(); // then call update once - LLWLParamManager::instance()->mAnimator.update( - LLWLParamManager::instance()->mCurParams); + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); } -void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl) +void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData) { - LLComboBox* comboBox = getChild("WLKeyPresets"); - LLMultiSliderCtrl* sldr = getChild("WLDayCycleKeys"); - LLSpinCtrl* hourSpin = getChild("WLCurKeyHour"); - LLSpinCtrl* minSpin = getChild("WLCurKeyMin"); + LLComboBox* comboBox = sDayCycle->getChild("WLKeyPresets"); + LLMultiSliderCtrl* sldr = sDayCycle->getChild("WLDayCycleKeys"); + LLSpinCtrl* hourSpin = sDayCycle->getChild("WLCurKeyHour"); + LLSpinCtrl* minSpin = sDayCycle->getChild("WLCurKeyMin"); if(sldr->getValue().size() == 0) { return; @@ -322,11 +408,11 @@ void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl) F32 time = sldr->getCurSliderValue(); // check to see if a key exists - std::string presetName = sSliderToKey[curSldr].presetName; + LLWLParamKey key = sSliderToKey[curSldr].keyframe; sSliderToKey[curSldr].time = time; // if it exists, turn on check box - comboBox->selectByValue(presetName); + comboBox->selectByValue(key.toStringVal()); // now set the spinners F32 hour = (F32)((S32)time); @@ -345,18 +431,18 @@ void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl) } -void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl) +void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData) { // if no keys, skipped if(sSliderToKey.size() == 0) { return; } - LLMultiSliderCtrl* sldr = getChild( + LLMultiSliderCtrl* sldr = sDayCycle->getChild( "WLDayCycleKeys"); - LLSpinCtrl* hourSpin = getChild( + LLSpinCtrl* hourSpin = sDayCycle->getChild( "WLCurKeyHour"); - LLSpinCtrl* minSpin = getChild( + LLSpinCtrl* minSpin = sDayCycle->getChild( "WLCurKeyMin"); F32 hour = hourSpin->get(); @@ -368,18 +454,17 @@ void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl) F32 time = sldr->getCurSliderValue() / sHoursPerDay; // now set the key's time in the sliderToKey map - std::string presetName = sSliderToKey[curSldr].presetName; sSliderToKey[curSldr].time = time; syncTrack(); } -void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl) +void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) { // get the time - LLComboBox* comboBox = getChild( + LLComboBox* comboBox = sDayCycle->getChild( "WLKeyPresets"); - LLMultiSliderCtrl* sldr = getChild( + LLMultiSliderCtrl* sldr = sDayCycle->getChild( "WLDayCycleKeys"); // do nothing if no sliders @@ -388,7 +473,9 @@ void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl) } // change the map - std::string newPreset(comboBox->getSelectedValue().asString()); + + std::string stringVal = comboBox->getSelectedValue().asString(); + LLWLParamKey newKey(stringVal); const std::string& curSldr = sldr->getCurSlider(); // if null, don't use @@ -396,21 +483,21 @@ void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl) return; } - sSliderToKey[curSldr].presetName = newPreset; + sSliderToKey[curSldr].keyframe = newKey; syncTrack(); } -void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl) +void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl, void* userData) { // get the time - LLSpinCtrl* secSpin = getChild( + LLSpinCtrl* secSpin = sDayCycle->getChild( "WLLengthOfDaySec"); - LLSpinCtrl* minSpin = getChild( + LLSpinCtrl* minSpin = sDayCycle->getChild( "WLLengthOfDayMin"); - LLSpinCtrl* hourSpin = getChild( + LLSpinCtrl* hourSpin = sDayCycle->getChild( "WLLengthOfDayHour"); F32 hour; @@ -424,34 +511,57 @@ void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl) if(time <= 0) { time = 1; } - LLWLParamManager::instance()->mDay.mDayRate = time; + LLWLParamManager::getInstance()->mDay.mDayRate = time; syncTrack(); } -void LLFloaterDayCycle::onAddKey(LLUICtrl* ctrl) +void LLFloaterDayCycle::onAddKey(void* userData) { - LLComboBox* comboBox = getChild( + LLComboBox* comboBox = sDayCycle->getChild( "WLKeyPresets"); - LLMultiSliderCtrl* kSldr = getChild( + LLMultiSliderCtrl* kSldr = sDayCycle->getChild( "WLDayCycleKeys"); - LLMultiSliderCtrl* tSldr = getChild( + LLMultiSliderCtrl* tSldr = sDayCycle->getChild( "WLTimeSlider"); llassert_always(sSliderToKey.size() == kSldr->getValue().size()); + S32 max_sliders; + switch(sScope) + { + case LLEnvKey::SCOPE_LOCAL: + max_sliders = LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES; + break; + case LLEnvKey::SCOPE_REGION: + max_sliders = LLWLPacketScrubber::MAX_REGION_KEY_FRAMES; + break; + default: + max_sliders = kSldr->getMaxSliderCount(); + break; + } + + if(kSldr->getSliderCount() >= max_sliders) + { + LLSD args; + args["SCOPE"] = LLEnvManager::getScopeString(sScope); + args["MAX"] = max_sliders; + LLNotifications::instance().add("DayCycleTooManyKeyframes", args); + return; + } + // get the values - std::string newPreset(comboBox->getSelectedValue().asString()); + LLWLParamKey newKeyframe(comboBox->getSelectedValue()); // add the slider key - addSliderKey(tSldr->getCurSliderValue(), newPreset); + addSliderKey(tSldr->getCurSliderValue(), newKeyframe); syncTrack(); } -void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName) +void LLFloaterDayCycle::addSliderKey(F32 time, LLWLParamKey keyframe) { - LLMultiSliderCtrl* kSldr = getChild( + LLMultiSliderCtrl* kSldr = sDayCycle->getChild( "WLDayCycleKeys"); // make a slider @@ -461,30 +571,28 @@ void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName) } // set the key - LLWLSkyKey newKey; - newKey.presetName = presetName; - newKey.time = kSldr->getCurSliderValue(); + LLWLCycleSliderKey newKey(keyframe, kSldr->getCurSliderValue()); llassert_always(sldrName != LLStringUtil::null); // add to map - sSliderToKey.insert(std::pair(sldrName, newKey)); + sSliderToKey.insert(std::pair(sldrName, newKey)); llassert_always(sSliderToKey.size() == kSldr->getValue().size()); } -void LLFloaterDayCycle::deletePreset(std::string& presetName) +void LLFloaterDayCycle::deletePreset(LLWLParamKey keyframe) { - LLMultiSliderCtrl* sldr = getChild("WLDayCycleKeys"); + LLMultiSliderCtrl* sldr = sDayCycle->getChild("WLDayCycleKeys"); /// delete any reference - std::map::iterator curr_preset, next_preset; + std::map::iterator curr_preset, next_preset; for(curr_preset = sSliderToKey.begin(); curr_preset != sSliderToKey.end(); curr_preset = next_preset) { next_preset = curr_preset; ++next_preset; - if (curr_preset->second.presetName == presetName) + if (curr_preset->second.keyframe == keyframe) { sldr->deleteSlider(curr_preset->first); sSliderToKey.erase(curr_preset); @@ -492,19 +600,25 @@ void LLFloaterDayCycle::deletePreset(std::string& presetName) } } -void LLFloaterDayCycle::onDeleteKey(LLUICtrl* ctrl) +void LLFloaterDayCycle::onDeleteKey(void* userData) { - if(sSliderToKey.size() == 0) { + if(sSliderToKey.size() == 0) + { + return; + } + else if(sSliderToKey.size() == 1) + { + LLNotifications::instance().add("EnvCannotDeleteLastDayCycleKey", LLSD()); return; } - LLComboBox* comboBox = getChild( + LLComboBox* comboBox = sDayCycle->getChild( "WLKeyPresets"); - LLMultiSliderCtrl* sldr = getChild("WLDayCycleKeys"); + LLMultiSliderCtrl* sldr = sDayCycle->getChild("WLDayCycleKeys"); // delete from map const std::string& sldrName = sldr->getCurSlider(); - std::map::iterator mIt = sSliderToKey.find(sldrName); + std::map::iterator mIt = sSliderToKey.find(sldrName); sSliderToKey.erase(mIt); sldr->deleteCurSlider(); @@ -514,11 +628,11 @@ void LLFloaterDayCycle::onDeleteKey(LLUICtrl* ctrl) } const std::string& name = sldr->getCurSlider(); - comboBox->selectByValue(sSliderToKey[name].presetName); + comboBox->selectByValue(sSliderToKey[name].keyframe.toLLSD()); F32 time = sSliderToKey[name].time; - LLSpinCtrl* hourSpin = getChild("WLCurKeyHour"); - LLSpinCtrl* minSpin = getChild("WLCurKeyMin"); + LLSpinCtrl* hourSpin = sDayCycle->getChild("WLCurKeyHour"); + LLSpinCtrl* minSpin = sDayCycle->getChild("WLCurKeyMin"); // now set the spinners F32 hour = (F32)((S32)time); diff --git a/indra/newview/llfloaterdaycycle.h b/indra/newview/llfloaterdaycycle.h index 993ddb8f07..1c021f0c6a 100644 --- a/indra/newview/llfloaterdaycycle.h +++ b/indra/newview/llfloaterdaycycle.h @@ -2,25 +2,31 @@ * @file llfloaterdaycycle.h * @brief LLFloaterDayCycle class definition * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, 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. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * 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. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * 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 + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -32,15 +38,19 @@ #include #include "llwlparamset.h" #include "llwlanimator.h" +#include "llwlparammanager.h" struct WLColorControl; struct WLFloatControl; -/// convenience class for holding keys mapped to sliders -struct LLWLSkyKey +/// convenience class for holding keyframes mapped to sliders +struct LLWLCycleSliderKey { public: - std::string presetName; + LLWLCycleSliderKey(LLWLParamKey kf, F32 t) : keyframe(kf), time(t) {} + LLWLCycleSliderKey() : keyframe(), time(0.f) {} // Don't use this default constructor + + LLWLParamKey keyframe; F32 time; }; @@ -49,71 +59,94 @@ public: class LLFloaterDayCycle : public LLFloater { public: - - LLFloaterDayCycle(const LLSD& key); + LLFloaterDayCycle(); virtual ~LLFloaterDayCycle(); - /*virtual*/ BOOL postBuild(); + + // map of sliders to parameters + static std::map sSliderToKey; + + /// help button stuff + static void onClickHelp(void* data); + void initHelpBtn(const std::string& name, const std::string& xml_alert); /// initialize all void initCallbacks(void); + /// one and one instance only + static LLFloaterDayCycle* instance(); + /// on time slider moved - void onTimeSliderMoved(LLUICtrl* ctrl); + static void onTimeSliderMoved(LLUICtrl* ctrl, void* userData); /// what happens when you move the key frame - void onKeyTimeMoved(LLUICtrl* ctrl); + static void onKeyTimeMoved(LLUICtrl* ctrl, void* userData); /// what happens when you change the key frame's time - void onKeyTimeChanged(LLUICtrl* ctrl); + static void onKeyTimeChanged(LLUICtrl* ctrl, void* userData); /// if you change the combo box, change the frame - void onKeyPresetChanged(LLUICtrl* ctrl); + static void onKeyPresetChanged(LLUICtrl* ctrl, void* userData); /// run this when user says to run the sky animation - void onRunAnimSky(LLUICtrl* ctrl); + static void onRunAnimSky(void* userData); /// run this when user says to stop the sky animation - void onStopAnimSky(LLUICtrl* ctrl); + static void onStopAnimSky(void* userData); /// if you change the combo box, change the frame - void onTimeRateChanged(LLUICtrl* ctrl); + static void onTimeRateChanged(LLUICtrl* ctrl, void* userData); /// add a new key on slider - void onAddKey(LLUICtrl* ctrl); + static void onAddKey(void* userData); /// delete any and all reference to a preset - void deletePreset(std::string& presetName); + void deletePreset(LLWLParamKey keyframe); /// delete a key frame - void onDeleteKey(LLUICtrl* ctrl); + static void onDeleteKey(void* userData); /// button to load day - void onLoadDayCycle(LLUICtrl* ctrl); + static void onLoadDayCycle(void* userData); /// button to save day - void onSaveDayCycle(LLUICtrl* ctrl); + static void onSaveDayCycle(void* userData); /// toggle for Linden time - void onUseLindenTime(LLUICtrl* ctrl); + static void onUseLindenTime(void* userData); + + + //// menu management + + /// show off our menu + static void show(LLEnvKey::EScope scope = LLEnvKey::SCOPE_LOCAL); + + /// return if the menu exists or not + static bool isOpen(); + + /// stuff to do on exit + virtual void onClose(bool app_quitting); /// sync up sliders with day cycle structure - void syncMenu(); + static void syncMenu(); // makes sure key slider has what's in day cycle - void syncSliderTrack(); + static void syncSliderTrack(); /// makes sure day cycle data structure has what's in menu - void syncTrack(); + static void syncTrack(); + + /// refresh combox box from param manager + static void refreshPresetsFromParamManager(); /// add a slider to the track - void addSliderKey(F32 time, const std::string& presetName); + static void addSliderKey(F32 time, LLWLParamKey keyframe); private: - - // map of sliders to parameters - static std::map sSliderToKey; - + static LLFloaterDayCycle* sDayCycle; // one instance on the inside static const F32 sHoursPerDay; + static LLEnvKey::EScope sScope; + static std::string sOriginalTitle; + static LLWLAnimator::ETime sPreviousTimeType; }; diff --git a/indra/newview/llfloaterenvsettings.cpp b/indra/newview/llfloaterenvsettings.cpp index fcaef1f34b..6d1b27db07 100644 --- a/indra/newview/llfloaterenvsettings.cpp +++ b/indra/newview/llfloaterenvsettings.cpp @@ -2,25 +2,31 @@ * @file llfloaterenvsettings.cpp * @brief LLFloaterEnvSettings class definition * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, 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. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * 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. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * 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 + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -28,9 +34,10 @@ #include "llfloaterenvsettings.h" -#include "llfloaterreg.h" #include "llfloaterwindlight.h" #include "llfloaterwater.h" +#include "llfloaterdaycycle.h" +#include "llfloaterregioninfo.h" #include "lluictrlfactory.h" #include "llsliderctrl.h" #include "llcombobox.h" @@ -42,57 +49,89 @@ #include "llwaterparammanager.h" #include "llmath.h" #include "llviewerwindow.h" +#include "llviewercontrol.h" + +#include "llcheckboxctrl.h" #include "pipeline.h" #include -LLFloaterEnvSettings::LLFloaterEnvSettings(const LLSD& key) - : LLFloater(key) +LLFloaterEnvSettings* LLFloaterEnvSettings::sEnvSettings = NULL; + +LLFloaterEnvSettings::LLFloaterEnvSettings() : LLFloater(std::string("Environment Settings Floater")) { + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_env_settings.xml", NULL, FALSE); + + // load it up + initCallbacks(); } -// virtual + LLFloaterEnvSettings::~LLFloaterEnvSettings() { } -// virtual -BOOL LLFloaterEnvSettings::postBuild() -{ - // load it up - initCallbacks(); - syncMenu(); - return TRUE; + +void LLFloaterEnvSettings::onClickHelp(void* data) +{ + LLFloaterEnvSettings* self = (LLFloaterEnvSettings*)data; + LLNotifications::instance().add(self->contextualNotification("EnvSettingsHelpButton")); +} + +void LLFloaterEnvSettings::onUseRegionEnvironment(LLUICtrl* ctrl, void* data) +{ + LLFloaterEnvSettings* self = (LLFloaterEnvSettings*)data; + LLCheckBoxCtrl* checkbox = (LLCheckBoxCtrl*)self->getChildView("RegionWLOptIn"); + setOptIn(checkbox->getValue().asBoolean()); +} + +void LLFloaterEnvSettings::setOptIn(bool opt_in) +{ + if (opt_in) + { + LLEnvManager::getInstance()->setNormallyDisplayedScope(LLEnvKey::SCOPE_REGION); + } + else + { + LLEnvManager::getInstance()->setNormallyDisplayedScope(LLEnvKey::SCOPE_LOCAL); + } } void LLFloaterEnvSettings::initCallbacks(void) { // our three sliders - getChild("EnvTimeSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeDayTime, this, _1)); - getChild("EnvCloudSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeCloudCoverage, this, _1)); - getChild("EnvWaterFogSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeWaterFogDensity, this, _1, &LLWaterParamManager::instance()->mFogDensity)); + childSetCommitCallback("EnvTimeSlider", onChangeDayTime, NULL); + childSetCommitCallback("EnvCloudSlider", onChangeCloudCoverage, NULL); + childSetCommitCallback("EnvWaterFogSlider", onChangeWaterFogDensity, + &LLWaterParamManager::getInstance()->mFogDensity); // color picker - getChild("EnvWaterColor")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeWaterColor, this, _1, &LLWaterParamManager::instance()->mFogColor)); + childSetCommitCallback("EnvWaterColor", onChangeWaterColor, + &LLWaterParamManager::getInstance()->mFogColor); // WL Top - getChild("EnvAdvancedSkyButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onOpenAdvancedSky, this)); - getChild("EnvAdvancedWaterButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onOpenAdvancedWater, this)); - getChild("EnvUseEstateTimeButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onUseEstateTime, this)); + childSetAction("EnvAdvancedSkyButton", onOpenAdvancedSky, NULL); + childSetAction("EnvAdvancedWaterButton", onOpenAdvancedWater, NULL); + childSetAction("EnvUseEstateTimeButton", onUseEstateTime, NULL); + childSetAction("EnvUseLocalTimeButton", onUseLocalTime, NULL); + childSetAction("EnvSettingsHelpButton", onClickHelp, this); + + childSetCommitCallback("RegionWLOptIn", onUseRegionEnvironment, this); } + // menu maintenance functions void LLFloaterEnvSettings::syncMenu() { LLSliderCtrl* sldr; - sldr = getChild("EnvTimeSlider"); + sldr = sEnvSettings->getChild("EnvTimeSlider"); // sync the clock - F32 val = (F32)LLWLParamManager::instance()->mAnimator.getDayTime(); - std::string timeStr = timeToString(val); + F32 val = (F32)LLWLParamManager::getInstance()->mAnimator.getDayTime(); + std::string timeStr = LLWLAnimator::timeToString(val); LLTextBox* textBox; - textBox = getChild("EnvTimeText"); + textBox = sEnvSettings->getChild("EnvTimeText"); textBox->setValue(timeStr); @@ -106,62 +145,159 @@ void LLFloaterEnvSettings::syncMenu() // sync cloud coverage bool err; - getChild("EnvCloudSlider")->setValue(LLWLParamManager::instance()->mCurParams.getFloat("cloud_shadow", err)); + childSetValue("EnvCloudSlider", LLWLParamManager::getInstance()->mCurParams.getFloat("cloud_shadow", err)); - LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); + LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); // sync water params LLColor4 col = param_mgr->getFogColor(); - LLColorSwatchCtrl* colCtrl = getChild("EnvWaterColor"); + LLColorSwatchCtrl* colCtrl = sEnvSettings->getChild("EnvWaterColor"); col.mV[3] = 1.0f; colCtrl->set(col); - getChild("EnvWaterFogSlider")->setValue(param_mgr->mFogDensity.mExp); + childSetValue("EnvWaterFogSlider", param_mgr->mFogDensity.mExp); param_mgr->setDensitySliderValue(param_mgr->mFogDensity.mExp); - // turn off Use Estate Time button if it's already being used - if(LLWLParamManager::instance()->mAnimator.mUseLindenTime) + // turn off Use Estate/Local Time buttons if already being used + + if(LLWLParamManager::getInstance()->mAnimator.getUseLindenTime()) { - getChildView("EnvUseEstateTimeButton")->setEnabled(FALSE); - } else { - getChildView("EnvUseEstateTimeButton")->setEnabled(TRUE); + childDisable("EnvUseEstateTimeButton"); + } + else + { + childEnable("EnvUseEstateTimeButton"); + } + + if(LLWLParamManager::getInstance()->mAnimator.getUseLocalTime()) + { + childDisable("EnvUseLocalTimeButton"); + } + else + { + childEnable("EnvUseLocalTimeButton"); } if(!gPipeline.canUseVertexShaders()) { - getChildView("EnvWaterColor")->setEnabled(FALSE); - getChildView("EnvWaterColorText")->setEnabled(FALSE); - //getChildView("EnvAdvancedWaterButton")->setEnabled(FALSE); + childDisable("EnvWaterColor"); + childDisable("EnvWaterColorText"); + //childDisable("EnvAdvancedWaterButton"); } else { - getChildView("EnvWaterColor")->setEnabled(TRUE); - getChildView("EnvWaterColorText")->setEnabled(TRUE); - //getChildView("EnvAdvancedWaterButton")->setEnabled(TRUE); + childEnable("EnvWaterColor"); + childEnable("EnvWaterColorText"); + //childEnable("EnvAdvancedWaterButton"); } // only allow access to these if they are using windlight if(!gPipeline.canUseWindLightShaders()) { - getChildView("EnvCloudSlider")->setEnabled(FALSE); - getChildView("EnvCloudText")->setEnabled(FALSE); - //getChildView("EnvAdvancedSkyButton")->setEnabled(FALSE); + childDisable("EnvCloudSlider"); + childDisable("EnvCloudText"); + //childDisable("EnvAdvancedSkyButton"); + } + else + { + childEnable("EnvCloudSlider"); + childEnable("EnvCloudText"); + //childEnable("EnvAdvancedSkyButton"); + } +} + + +// static instance of it +LLFloaterEnvSettings* LLFloaterEnvSettings::instance() +{ + if (!sEnvSettings) + { + sEnvSettings = new LLFloaterEnvSettings(); + // sEnvSettings->open(); + // sEnvSettings->setFocus(TRUE); + } + return sEnvSettings; +} + +void LLFloaterEnvSettings::setControlsEnabled(bool enable) +{ + if(enable) + { + // reenable UI elements, resync sliders, and reload saved settings + childEnable("EnvAdvancedSkyButton"); + childEnable("EnvAdvancedWaterButton"); + childEnable("EnvUseEstateTimeButton"); + childShow("EnvTimeText"); + childShow("EnvWaterColor"); + childShow("EnvTimeSlider"); + childShow("EnvCloudSlider"); + childShow("EnvWaterFogSlider"); + syncMenu(); } else { - getChildView("EnvCloudSlider")->setEnabled(TRUE); - getChildView("EnvCloudText")->setEnabled(TRUE); - //getChildView("EnvAdvancedSkyButton")->setEnabled(TRUE); + // disable UI elements the user shouldn't be able to see to protect potentially proprietary WL region settings from being visible + LLFloaterWindLight::instance()->close(); + LLFloaterWater::instance()->close(); + LLFloaterDayCycle::instance()->close(); + childDisable("EnvAdvancedSkyButton"); + childDisable("EnvAdvancedWaterButton"); + childDisable("EnvUseEstateTimeButton"); + childHide("EnvTimeText"); + childHide("EnvWaterColor"); + childHide("EnvTimeSlider"); + childHide("EnvCloudSlider"); + childHide("EnvWaterFogSlider"); } } -void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl) + +void LLFloaterEnvSettings::show() +{ + LLFloaterEnvSettings* envSettings = instance(); + envSettings->syncMenu(); + + // comment in if you want the menu to rebuild each time + //LLUICtrlFactory::getInstance()->buildFloater(envSettings, "floater_env_settings.xml"); + //envSettings->initCallbacks(); + + // Set environment opt-in checkbox based on saved value -- only need to do once, not every time syncMenu is called + + bool opt_in = gSavedSettings.getBOOL("UseEnvironmentFromRegion"); + + sEnvSettings->childSetVisible("RegionWLOptIn", LLEnvManager::getInstance()->regionCapable()); + sEnvSettings->setOptIn(opt_in); + sEnvSettings->getChildView("RegionWLOptIn")->setValue(LLSD::Boolean(opt_in)); + sEnvSettings->getChildView("RegionWLOptIn")->setToolTip(sEnvSettings->getString("region_environment_tooltip")); + envSettings->open(); +} + +bool LLFloaterEnvSettings::isOpen() { - LLSliderCtrl* sldr = static_cast(ctrl); + if (sEnvSettings != NULL) + { + return true; + } + return false; +} + +// virtual +void LLFloaterEnvSettings::onClose(bool app_quitting) +{ + if (sEnvSettings) + { + sEnvSettings->setVisible(FALSE); + } +} + + +void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl, void* userData) +{ + LLSliderCtrl* sldr; + sldr = sEnvSettings->getChild("EnvTimeSlider"); // deactivate animator - LLWLParamManager::instance()->mAnimator.mIsRunning = false; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + LLWLParamManager::getInstance()->mAnimator.deactivate(); F32 val = sldr->getValueF32() + 0.25f; if(val > 1.0) @@ -169,100 +305,81 @@ void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl) val--; } - LLWLParamManager::instance()->mAnimator.setDayTime((F64)val); - LLWLParamManager::instance()->mAnimator.update( - LLWLParamManager::instance()->mCurParams); + LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val); + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); } -void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl) +void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl, void* userData) { - LLSliderCtrl* sldr = static_cast(ctrl); + LLSliderCtrl* sldr; + sldr = sEnvSettings->getChild("EnvCloudSlider"); // deactivate animator - //LLWLParamManager::instance()->mAnimator.mIsRunning = false; - //LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + //LLWLParamManager::getInstance()->mAnimator.mIsRunning = false; + //LLWLParamManager::getInstance()->mAnimator.mUseLindenTime = false; F32 val = sldr->getValueF32(); - LLWLParamManager::instance()->mCurParams.set("cloud_shadow", val); + LLWLParamManager::getInstance()->mCurParams.set("cloud_shadow", val); } -void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl) +void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, void* userData) { LLSliderCtrl* sldr; - sldr = getChild("EnvWaterFogSlider"); + sldr = sEnvSettings->getChild("EnvWaterFogSlider"); + + if(NULL == userData) + { + return; + } + + WaterExpFloatControl * expFloatControl = static_cast(userData); F32 val = sldr->getValueF32(); expFloatControl->mExp = val; - LLWaterParamManager::instance()->setDensitySliderValue(val); + LLWaterParamManager::getInstance()->setDensitySliderValue(val); - expFloatControl->update(LLWaterParamManager::instance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + expFloatControl->update(LLWaterParamManager::getInstance()->mCurParams); + LLWaterParamManager::getInstance()->propagateParameters(); } -void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, WaterColorControl* colorControl) +void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, void* userData) { LLColorSwatchCtrl* swatch = static_cast(ctrl); + WaterColorControl * colorControl = static_cast(userData); *colorControl = swatch->get(); - colorControl->update(LLWaterParamManager::instance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + colorControl->update(LLWaterParamManager::getInstance()->mCurParams); + LLWaterParamManager::getInstance()->propagateParameters(); } -void LLFloaterEnvSettings::onOpenAdvancedSky() +void LLFloaterEnvSettings::onOpenAdvancedSky(void* userData) { - LLFloaterReg::showInstance("env_windlight"); + LLFloaterWindLight::show(); } -void LLFloaterEnvSettings::onOpenAdvancedWater() +void LLFloaterEnvSettings::onOpenAdvancedWater(void* userData) { - LLFloaterReg::showInstance("env_water"); + LLFloaterWater::show(); } -void LLFloaterEnvSettings::onUseEstateTime() +void LLFloaterEnvSettings::onUseEstateTime(void* userData) { - LLFloaterWindLight* wl = LLFloaterReg::findTypedInstance("env_windlight"); - if(wl) + if(LLFloaterWindLight::isOpen()) { + // select the blank value in + LLFloaterWindLight* wl = LLFloaterWindLight::instance(); LLComboBox* box = wl->getChild("WLPresetsCombo"); box->selectByValue(""); } - LLWLParamManager::instance()->mAnimator.mIsRunning = true; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = true; + LLWLParamManager::getInstance()->mAnimator.activate(LLWLAnimator::TIME_LINDEN); } -std::string LLFloaterEnvSettings::timeToString(F32 curTime) +void LLFloaterEnvSettings::onUseLocalTime(void* userData) { - S32 hours; - S32 min; - - // get hours and minutes - hours = (S32) (24.0 * curTime); - curTime -= ((F32) hours / 24.0f); - min = llround(24.0f * 60.0f * curTime); - - // handle case where it's 60 - if(min == 60) - { - hours++; - min = 0; - } - - std::string newTime = getString("timeStr"); - struct tm * timeT; - time_t secT = time(0); - timeT = gmtime (&secT); - - timeT->tm_hour = hours; - timeT->tm_min = min; - secT = mktime (timeT); - secT -= LLStringOps::getLocalTimeOffset (); - - LLSD substitution; - substitution["datetime"] = (S32) secT; - - LLStringUtil::format (newTime, substitution); - return newTime; + LLWLParamManager::getInstance()->mAnimator.setDayTime(LLWLAnimator::getLocalTime()); + LLWLParamManager::getInstance()->mAnimator.activate(LLWLAnimator::TIME_LOCAL); } diff --git a/indra/newview/llfloaterenvsettings.h b/indra/newview/llfloaterenvsettings.h index a6280cfb97..0bf3e48676 100644 --- a/indra/newview/llfloaterenvsettings.h +++ b/indra/newview/llfloaterenvsettings.h @@ -2,25 +2,31 @@ * @file llfloaterskysettings.h * @brief LLFloaterEnvSettings class definition * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, 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. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * 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. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * 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 + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -33,50 +39,77 @@ #include "llfloater.h" -struct WaterColorControl; -struct WaterExpFloatControl; /// Menuing system for all of windlight's functionality class LLFloaterEnvSettings : public LLFloater { public: - LLFloaterEnvSettings(const LLSD& key); - /*virtual*/ ~LLFloaterEnvSettings(); - /*virtual*/ BOOL postBuild(); + LLFloaterEnvSettings(); + virtual ~LLFloaterEnvSettings(); + /// initialize all the callbacks for the menu void initCallbacks(void); + /// one and one instance only + static LLFloaterEnvSettings* instance(); + + /// callback for the menus help button + static void onClickHelp(void* data); + /// handle if time of day is changed - void onChangeDayTime(LLUICtrl* ctrl); + static void onChangeDayTime(LLUICtrl* ctrl, void* userData); /// handle if cloud coverage is changed - void onChangeCloudCoverage(LLUICtrl* ctrl); + static void onChangeCloudCoverage(LLUICtrl* ctrl, void* userData); /// handle change in water fog density - void onChangeWaterFogDensity(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl); + static void onChangeWaterFogDensity(LLUICtrl* ctrl, void* userData); + + /// handle change in under water fog density + static void onChangeUnderWaterFogMod(LLUICtrl* ctrl, void* userData); /// handle change in water fog color - void onChangeWaterColor(LLUICtrl* ctrl, WaterColorControl* colorControl); + static void onChangeWaterColor(LLUICtrl* ctrl, void* userData); /// open the advanced sky settings menu - void onOpenAdvancedSky(); + static void onOpenAdvancedSky(void* userData); /// open the advanced water settings menu - void onOpenAdvancedWater(); + static void onOpenAdvancedWater(void* userData); /// sync time with the server - void onUseEstateTime(); + static void onUseEstateTime(void* userData); + + /// sync time with local clock + static void onUseLocalTime(void* userData); + + // opt-in for region Windlight settings + //static void onUseRegionEnvironment(LLUICtrl* ctrl, void* userData); + static void onUseRegionEnvironment(LLUICtrl*, void*); //// menu management + /// enables or disable all controls + void setControlsEnabled(bool enable); + + /// show off our menu + static void show(); + + /// return if the menu exists or not + static bool isOpen(); + + /// stuff to do on exit + virtual void onClose(bool app_quitting); + /// sync up sliders with parameters void syncMenu(); - /// convert the present time to a digital clock time - std::string timeToString(F32 curTime); - private: + // one instance on the inside + static LLFloaterEnvSettings* sEnvSettings; + + static void setOptIn(bool opt_in); }; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index ed81fdec16..f6377d50fa 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -40,6 +40,8 @@ #include "llxfermanager.h" #include "indra_constants.h" #include "message.h" +#include "llsd.h" +#include "llsdserialize.h" #include "llagent.h" #include "llappviewer.h" @@ -47,6 +49,7 @@ #include "llbutton.h" #include "llcheckboxctrl.h" #include "llcombobox.h" +#include "llenvmanager.h" #include "llfilepicker.h" #include "llfloatergodtools.h" // for send_sim_wide_deletes() #include "llfloatertopobjects.h" // added to fix SL-32336 @@ -81,6 +84,9 @@ #include "lltrans.h" #include "llagentui.h" +// contains includes needed for WL estate settings +#include "llfloaterwater.h" + const S32 TERRAIN_TEXTURE_COUNT = 4; const S32 CORNER_COUNT = 4; @@ -287,6 +293,10 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) return; } + + // currently, region can send this message when its windlight settings change + LLEnvManager::instance().refreshFromStorage(LLEnvKey::SCOPE_REGION); + LLTabContainer* tab = floater->getChild("region_panels"); LLViewerRegion* region = gAgent.getRegion(); @@ -1144,9 +1154,32 @@ void LLPanelRegionTextureInfo::onClickDump(void* data) ///////////////////////////////////////////////////////////////////////////// // LLPanelRegionTerrainInfo ///////////////////////////////////////////////////////////////////////////// +// Initialize statics +LLPanelRegionTerrainInfo* LLPanelRegionTerrainInfo::sPanelRegionTerrainInfo = NULL; + +LLPanelRegionTerrainInfo* LLPanelRegionTerrainInfo::instance() +{ + if (!sPanelRegionTerrainInfo) + { + sPanelRegionTerrainInfo = new LLPanelRegionTerrainInfo(); + } + return sPanelRegionTerrainInfo; +} + +// virtual +void LLPanelRegionTerrainInfo::close(bool app_quitting) +{ + if (sPanelRegionTerrainInfo) + { + sPanelRegionTerrainInfo = NULL; + } +} + BOOL LLPanelRegionTerrainInfo::postBuild() { LLPanelRegionInfo::postBuild(); + + sPanelRegionTerrainInfo = this; // singleton instance pointer initCtrl("water_height_spin"); initCtrl("terrain_raise_spin"); @@ -1161,20 +1194,42 @@ BOOL LLPanelRegionTerrainInfo::postBuild() childSetAction("upload_raw_btn", onClickUploadRaw, this); childSetAction("bake_terrain_btn", onClickBakeTerrain, this); + // WL advanced buttons + childSetAction("EnvAdvancedSkyButton", onOpenAdvancedSky, this); + childSetAction("EnvAdvancedWaterButton", onOpenAdvancedWater, this); + childSetAction("EnvUseEstateTimeButton", onUseEstateTime, this); + + // Commit, cancel, and default + childSetAction("WLRegionApply", onCommitRegionWL, this); + childSetAction("WLRegionCancel", onCancelRegionWL, this); + childSetAction("WLRegionDefault", onSetRegionToDefaultWL, this); + return TRUE; } +F32 LLPanelRegionTerrainInfo::getSunHour() +{ + if (childIsEnabled("sun_hour_slider")) + { + return (F32)childGetValue("sun_hour_slider").asReal(); + } + return 0.f; +} + // virtual bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) { - llinfos << "LLPanelRegionTerrainInfo::refreshFromRegion" << llendl; - BOOL owner_or_god = gAgent.isGodlike() || (region && (region->getOwner() == gAgent.getID())); BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); setCtrlsEnabled(owner_or_god_or_manager); + + // Disable select children + LLPanelRegionTerrainInfo::instance()->setCommitControls(false); + LLPanelRegionTerrainInfo::instance()->setEnvControls(LLEnvManager::getInstance()->regionCapable()); getChildView("apply_btn")->setEnabled(FALSE); + LLEnvManager::instance().maybeClearEditingScope(LLEnvKey::SCOPE_REGION, false, false); getChildView("download_raw_btn")->setEnabled(owner_or_god); getChildView("upload_raw_btn")->setEnabled(owner_or_god); @@ -1183,6 +1238,24 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) return LLPanelRegionInfo::refreshFromRegion(region); } +void LLPanelRegionTerrainInfo::setEnvControls(bool available) +{ + getChildView("EnvUseEstateTimeButton")->setVisible(available); + getChildView("EnvAdvancedSkyButton")->setVisible(available); + getChildView("EnvAdvancedWaterButton")->setVisible(available); + getChildView("WLRegionApply")->setVisible(available); + getChildView("WLRegionCancel")->setVisible(available); + getChildView("WLRegionDefault")->setVisible(available); + getChildView("wl_settings_unavailable")->setVisible(!available); +} + +void LLPanelRegionTerrainInfo::setCommitControls(bool available) +{ + getChildView("WLRegionApply")->setEnabled(available); + getChildView("WLRegionCancel")->setEnabled(available); + refresh(); +} + // virtual BOOL LLPanelRegionTerrainInfo::sendUpdate() { @@ -1320,9 +1393,70 @@ bool LLPanelRegionTerrainInfo::callbackBakeTerrain(const LLSD& notification, con strings.push_back("bake"); LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); sendEstateOwnerMessage(gMessageSystem, "terrain", invoice, strings); + return false; } +/////////////////////////////////////////////////////////////// +// Callbacks for WindLight additions to Region terrain panel + +void LLPanelRegionTerrainInfo::onOpenAdvancedSky(void* userData) +{ + LLFloaterWindLight::show(LLEnvKey::SCOPE_REGION); +} + +void LLPanelRegionTerrainInfo::onOpenAdvancedWater(void* userData) +{ + LLFloaterWater::show(LLEnvKey::SCOPE_REGION); +} + + +void LLPanelRegionTerrainInfo::onUseEstateTime(void* userData) +{ + if(LLFloaterWindLight::isOpen()) + { + // select the blank value in + LLFloaterWindLight* wl = LLFloaterWindLight::instance(); + LLComboBox* box = wl->getChild("WLPresetsCombo"); + box->selectByValue(""); + } + + LLWLParamManager::getInstance()->mAnimator.activate(LLWLAnimator::TIME_LINDEN); +} + +/////////////////////////////////////////////////////// +// Advanced handling for WL region estate integration + +// Handle commit of WL settings to region +void LLPanelRegionTerrainInfo::onCommitRegionWL(void* userData) +{ + LLEnvManager::getInstance()->commitSettings(LLEnvKey::SCOPE_REGION); + LLEnvManager::getInstance()->maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false); +} + +// Handle cancel of WL settings for region +void LLPanelRegionTerrainInfo::onCancelRegionWL(void* userData) +{ + LLEnvManager::getInstance()->maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false); +} + +// Handle reversion of region WL settings to default +void LLPanelRegionTerrainInfo::onSetRegionToDefaultWL(void* userData) +{ + LLEnvManager::instance().resetInternalsToDefault(LLEnvKey::SCOPE_REGION); + LLEnvManager::instance().startEditingScope(LLEnvKey::SCOPE_REGION); +} + +void LLPanelRegionTerrainInfo::cancelChanges() +{ + LLFloaterWindLight::instance()->close(); + LLFloaterWater::instance()->close(); + LLFloaterDayCycle::instance()->close(); + + // disable commmit and cancel + LLPanelRegionTerrainInfo::instance()->setCommitControls(false); +} + ///////////////////////////////////////////////////////////////////////////// // LLPanelEstateInfo // @@ -1996,6 +2130,16 @@ bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) return rv; } +void LLFloaterRegionInfo::close(bool app_quitting) +{ + if(!app_quitting) + { + LLEnvManager::getInstance()->maybeClearEditingScope(true, false); + LLPanelRegionTerrainInfo::close(app_quitting); + } + LLFloater::close(app_quitting); +} + void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl) { if (checkRemovalButton(child_ctrl->getName())) diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 2393c74c45..2fdec5a944 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -57,6 +57,13 @@ class LLPanelRegionTerrainInfo; class LLPanelEstateInfo; class LLPanelEstateCovenant; +class LLEventTimer; +class LLEnvironmentSettings; +class LLWLParamManager; +class LLWaterParamManager; +class LLWLParamSet; +class LLWaterParamSet; + class LLFloaterRegionInfo : public LLFloater { friend class LLFloaterReg; @@ -221,19 +228,27 @@ protected: }; ///////////////////////////////////////////////////////////////////////////// - class LLPanelRegionTerrainInfo : public LLPanelRegionInfo { public: - LLPanelRegionTerrainInfo() - : LLPanelRegionInfo() {} + LLPanelRegionTerrainInfo() : LLPanelRegionInfo() {} ~LLPanelRegionTerrainInfo() {} - // LLPanel - virtual BOOL postBuild(); - virtual bool refreshFromRegion(LLViewerRegion* region); + static LLPanelRegionTerrainInfo* instance(); + virtual BOOL postBuild(); // LLPanel + static void close(bool app_quitting); + + F32 getSunHour(); + virtual bool refreshFromRegion(LLViewerRegion* region); // refresh local settings from region update from simulator + void setEnvControls(bool available); // Whether environment settings are available for this region + void setCommitControls(bool available); // Whether user can currently commit (whether they changed anything) + void cancelChanges(); // cancels changes, reverts local settings, and resyncs UI + + //static void onChangeAnything(LLUICtrl* ctrl, void* userData); // callback for any change, to enable commit button protected: + static LLPanelRegionTerrainInfo* sPanelRegionTerrainInfo; // static instance pointer for singleton + virtual BOOL sendUpdate(); void onChangeUseEstateTime(); @@ -244,6 +259,13 @@ protected: static void onClickUploadRaw(void*); static void onClickBakeTerrain(void*); bool callbackBakeTerrain(const LLSD& notification, const LLSD& response); + + static void onOpenAdvancedSky(void* userData); // open the advanced sky settings menu + static void onOpenAdvancedWater(void* userData); // open the advanced water settings menu + static void onUseEstateTime(void* userData); // sync time with the server + static void onCommitRegionWL(void* userData); // commit region information to server + static void onCancelRegionWL(void* userData); // cancel changes to region + static void onSetRegionToDefaultWL(void* userData); // revert region WL settings to default }; ///////////////////////////////////////////////////////////////////////////// @@ -332,6 +354,7 @@ public: // are ignored, so must disable UI. void setAccessAllowedEnabled(bool enable_agent, bool enable_group, bool enable_ban); + virtual void close(bool app_quitting = false); protected: virtual BOOL sendUpdate(); // confirmation dialog callback diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp index be4b144f41..a443b788fb 100644 --- a/indra/newview/llfloaterwater.cpp +++ b/indra/newview/llfloaterwater.cpp @@ -59,6 +59,8 @@ #undef max std::set LLFloaterWater::sDefaultPresets; +LLEnvKey::EScope LLFloaterWater::sScope; +std::string LLFloaterWater::sOriginalTitle; LLFloaterWater::LLFloaterWater(const LLSD& key) : LLFloater(key) @@ -70,7 +72,7 @@ LLFloaterWater::~LLFloaterWater() } BOOL LLFloaterWater::postBuild() { - + sOriginalTitle=getTitle(); std::string def_water = getString("WLDefaultWaterNames"); // no editing or deleting of the blank string @@ -88,8 +90,8 @@ BOOL LLFloaterWater::postBuild() if(comboBox != NULL) { std::map::iterator mIt = - LLWaterParamManager::instance()->mParamList.begin(); - for(; mIt != LLWaterParamManager::instance()->mParamList.end(); mIt++) + LLWaterParamManager::getInstance()->mParamList.begin(); + for(; mIt != LLWaterParamManager::getInstance()->mParamList.end(); mIt++) { comboBox->add(mIt->first); } @@ -104,7 +106,7 @@ BOOL LLFloaterWater::postBuild() } void LLFloaterWater::initCallbacks(void) { - LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); + LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); getChild("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterWater::onWaterFogColorMoved, this, _1, ¶m_mgr->mFogColor)); @@ -163,7 +165,7 @@ bool LLFloaterWater::newPromptCallback(const LLSD& notification, const LLSD& res if(option == 0) { LLComboBox* comboBox = getChild( "WaterPresetsCombo"); - LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); + LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); // add the current parameters to the list // see if it's there first @@ -195,7 +197,7 @@ void LLFloaterWater::syncMenu() { bool err; - LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); + LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); LLWaterParamSet & current_params = param_mgr->mCurParams; @@ -262,9 +264,9 @@ void LLFloaterWater::onVector3ControlXMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl->mX = sldrCtrl->getValueF32(); - vectorControl->update(LLWaterParamManager::instance()->mCurParams); + vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + LLWaterParamManager::getInstance()->propagateParameters(); } // vector control callbacks @@ -274,9 +276,9 @@ void LLFloaterWater::onVector3ControlYMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl->mY = sldrCtrl->getValueF32(); - vectorControl->update(LLWaterParamManager::instance()->mCurParams); + vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + LLWaterParamManager::getInstance()->propagateParameters(); } // vector control callbacks @@ -286,9 +288,9 @@ void LLFloaterWater::onVector3ControlZMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl->mZ = sldrCtrl->getValueF32(); - vectorControl->update(LLWaterParamManager::instance()->mCurParams); + vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + LLWaterParamManager::getInstance()->propagateParameters(); } @@ -299,9 +301,9 @@ void LLFloaterWater::onVector2ControlXMoved(LLUICtrl* ctrl, WaterVector2Control* vectorControl->mX = sldrCtrl->getValueF32(); - vectorControl->update(LLWaterParamManager::instance()->mCurParams); + vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + LLWaterParamManager::getInstance()->propagateParameters(); } // vector control callbacks @@ -311,9 +313,9 @@ void LLFloaterWater::onVector2ControlYMoved(LLUICtrl* ctrl, WaterVector2Control* vectorControl->mY = sldrCtrl->getValueF32(); - vectorControl->update(LLWaterParamManager::instance()->mCurParams); + vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + LLWaterParamManager::getInstance()->propagateParameters(); } // color control callbacks @@ -335,9 +337,9 @@ void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, WaterColorControl* col getChild(name)->setValue(colorControl->mR); } - colorControl->update(LLWaterParamManager::instance()->mCurParams); + colorControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + LLWaterParamManager::getInstance()->propagateParameters(); } void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) @@ -359,9 +361,9 @@ void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* col } - colorControl->update(LLWaterParamManager::instance()->mCurParams); + colorControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + LLWaterParamManager::getInstance()->propagateParameters(); } void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) @@ -382,9 +384,9 @@ void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* col getChild(name)->setValue(colorControl->mB); } - colorControl->update(LLWaterParamManager::instance()->mCurParams); + colorControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + LLWaterParamManager::getInstance()->propagateParameters(); } void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) @@ -393,9 +395,9 @@ void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* col colorControl->mA = sldrCtrl->getValueF32(); - colorControl->update(LLWaterParamManager::instance()->mCurParams); + colorControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + LLWaterParamManager::getInstance()->propagateParameters(); } @@ -454,8 +456,8 @@ void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, WaterColorControl* col } // now update the current parameters and send them to shaders - colorControl->update(LLWaterParamManager::instance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + colorControl->update(LLWaterParamManager::getInstance()->mCurParams); + LLWaterParamManager::getInstance()->propagateParameters(); } void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl) @@ -464,10 +466,10 @@ void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl F32 val = sldrCtrl->getValueF32(); expFloatControl->mExp = val; - LLWaterParamManager::instance()->setDensitySliderValue(val); + LLWaterParamManager::getInstance()->setDensitySliderValue(val); - expFloatControl->update(LLWaterParamManager::instance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + expFloatControl->update(LLWaterParamManager::getInstance()->mCurParams); + LLWaterParamManager::getInstance()->propagateParameters(); } void LLFloaterWater::onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floatControl) @@ -476,23 +478,23 @@ void LLFloaterWater::onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floa floatControl->mX = sldrCtrl->getValueF32() / floatControl->mMult; - floatControl->update(LLWaterParamManager::instance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + floatControl->update(LLWaterParamManager::getInstance()->mCurParams); + LLWaterParamManager::getInstance()->propagateParameters(); } void LLFloaterWater::onWaterFogColorMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) { LLColorSwatchCtrl* swatch = static_cast(ctrl); *colorControl = swatch->get(); - colorControl->update(LLWaterParamManager::instance()->mCurParams); - LLWaterParamManager::instance()->propagateParameters(); + colorControl->update(LLWaterParamManager::getInstance()->mCurParams); + LLWaterParamManager::getInstance()->propagateParameters(); } void LLFloaterWater::onNormalMapPicked(LLUICtrl* ctrl) { LLTextureCtrl* textCtrl = static_cast(ctrl); LLUUID textID = textCtrl->getImageAssetID(); - LLWaterParamManager::instance()->setNormalMapID(textID); + LLWaterParamManager::getInstance()->setNormalMapID(textID); } void LLFloaterWater::onNewPreset() @@ -511,7 +513,7 @@ void LLFloaterWater::onSavePreset() return; } - LLWaterParamManager::instance()->mCurParams.mName = + LLWaterParamManager::getInstance()->mCurParams.mName = comboBox->getSelectedItemLabel(); // check to see if it's a default and shouldn't be overwritten @@ -532,7 +534,7 @@ bool LLFloaterWater::saveAlertCallback(const LLSD& notification, const LLSD& res // if they choose save, do it. Otherwise, don't do anything if(option == 0) { - LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); + LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); param_mgr->setParamSet( param_mgr->mCurParams.mName, @@ -583,7 +585,7 @@ bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& r return false; } - LLWaterParamManager::instance()->removeParamSet(name, true); + LLWaterParamManager::getInstance()->removeParamSet(name, true); // remove and choose another S32 new_index = combo_box->getCurrentIndex(); @@ -594,8 +596,8 @@ bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& r { key_combo->remove(name); - // remove from slider, as well - day_cycle->deletePreset(name); + // water is not part of day cycles, yet + //day_cycle->deletePreset(name); } // pick the previously selected index after delete diff --git a/indra/newview/llfloaterwater.h b/indra/newview/llfloaterwater.h index e3db91e80d..57fb9745b1 100644 --- a/indra/newview/llfloaterwater.h +++ b/indra/newview/llfloaterwater.h @@ -101,6 +101,8 @@ public: private: static std::set sDefaultPresets; + static LLEnvKey::EScope sScope; + static std::string sOriginalTitle; }; diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp index ae98b2cf99..960a552b3d 100644 --- a/indra/newview/llfloaterwindlight.cpp +++ b/indra/newview/llfloaterwindlight.cpp @@ -2,25 +2,31 @@ * @file llfloaterwindlight.cpp * @brief LLFloaterWindLight class definition * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, 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. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * 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. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * 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 + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -31,11 +37,9 @@ #include "pipeline.h" #include "llsky.h" -#include "llfloaterreg.h" #include "llsliderctrl.h" #include "llmultislider.h" #include "llmultisliderctrl.h" -#include "llnotificationsutil.h" #include "llspinctrl.h" #include "llcheckboxctrl.h" #include "lluictrlfactory.h" @@ -54,48 +58,31 @@ #include "llwlparamset.h" #include "llwlparammanager.h" #include "llpostprocess.h" -#include "lltabcontainer.h" - #undef max -std::set LLFloaterWindLight::sDefaultPresets; +LLFloaterWindLight* LLFloaterWindLight::sWindLight = NULL; +std::set LLFloaterWindLight::sDefaultPresets; +LLEnvKey::EScope LLFloaterWindLight::sScope; +std::string LLFloaterWindLight::sOriginalTitle; static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f; -LLFloaterWindLight::LLFloaterWindLight(const LLSD& key) - : LLFloater(key) +LLFloaterWindLight::LLFloaterWindLight() : LLFloater(std::string("windlight floater")) { -} - -LLFloaterWindLight::~LLFloaterWindLight() -{ -} - -BOOL LLFloaterWindLight::postBuild() -{ - // add the list of presets - std::string def_days = getString("WLDefaultSkyNames"); - - // no editing or deleting of the blank string - sDefaultPresets.insert(""); - boost_tokenizer tokens(def_days, boost::char_separator(":")); - for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) - { - std::string tok(*token_iter); - sDefaultPresets.insert(tok); - } - + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_windlight_options.xml", NULL, FALSE); + sOriginalTitle = getTitle(); + // add the combo boxes LLComboBox* comboBox = getChild("WLPresetsCombo"); if(comboBox != NULL) { - - std::map::iterator mIt = - LLWLParamManager::instance()->mParamList.begin(); - for(; mIt != LLWLParamManager::instance()->mParamList.end(); mIt++) + + std::map::iterator mIt = + LLWLParamManager::getInstance()->mParamList.begin(); + for(; mIt != LLWLParamManager::getInstance()->mParamList.end(); mIt++) { - comboBox->add(mIt->first); + comboBox->add(mIt->first.toString(), mIt->first.toLLSD()); } // entry for when we're in estate time @@ -104,107 +91,167 @@ BOOL LLFloaterWindLight::postBuild() // set defaults on combo boxes comboBox->selectByValue(LLSD("Default")); } + + // add the list of presets + std::string def_days = getString("WLDefaultSkyNames"); + + // no editing or deleting of the blank string + LLWLParamKey blank("", LLEnvKey::SCOPE_LOCAL); + sDefaultPresets.insert(blank); + boost_tokenizer tokens(def_days, boost::char_separator(":")); + for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) + { + std::string tok(*token_iter); + LLWLParamKey key(tok, LLEnvKey::SCOPE_LOCAL); + sDefaultPresets.insert(key); + } + // load it up initCallbacks(); +} - syncMenu(); - - return TRUE; +LLFloaterWindLight::~LLFloaterWindLight() +{ } + void LLFloaterWindLight::initCallbacks(void) { - LLWLParamManager * param_mgr = LLWLParamManager::instance(); + // help buttons + initHelpBtn("WLBlueHorizonHelp", "HelpBlueHorizon"); + initHelpBtn("WLHazeHorizonHelp", "HelpHazeHorizon"); + initHelpBtn("WLBlueDensityHelp", "HelpBlueDensity"); + initHelpBtn("WLHazeDensityHelp", "HelpHazeDensity"); + + initHelpBtn("WLDensityMultHelp", "HelpDensityMult"); + initHelpBtn("WLDistanceMultHelp", "HelpDistanceMult"); + initHelpBtn("WLMaxAltitudeHelp", "HelpMaxAltitude"); + + initHelpBtn("WLSunlightColorHelp", "HelpSunlightColor"); + initHelpBtn("WLAmbientHelp", "HelpSunAmbient"); + initHelpBtn("WLSunGlowHelp", "HelpSunGlow"); + initHelpBtn("WLTimeOfDayHelp", "HelpTimeOfDay"); + initHelpBtn("WLEastAngleHelp", "HelpEastAngle"); + + initHelpBtn("WLSceneGammaHelp", "HelpSceneGamma"); + initHelpBtn("WLStarBrightnessHelp", "HelpStarBrightness"); + + initHelpBtn("WLCloudColorHelp", "HelpCloudColor"); + initHelpBtn("WLCloudDetailHelp", "HelpCloudDetail"); + initHelpBtn("WLCloudDensityHelp", "HelpCloudDensity"); + initHelpBtn("WLCloudCoverageHelp", "HelpCloudCoverage"); + + initHelpBtn("WLCloudScaleHelp", "HelpCloudScale"); + initHelpBtn("WLCloudScrollXHelp", "HelpCloudScrollX"); + initHelpBtn("WLCloudScrollYHelp", "HelpCloudScrollY"); + + initHelpBtn("WLClassicCloudsHelp", "HelpClassicClouds"); + + LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); // blue horizon - getChild("WLBlueHorizonR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mBlueHorizon)); - getChild("WLBlueHorizonG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mBlueHorizon)); - getChild("WLBlueHorizonB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mBlueHorizon)); - getChild("WLBlueHorizonI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr->mBlueHorizon)); + childSetCommitCallback("WLBlueHorizonR", onColorControlRMoved, ¶m_mgr->mBlueHorizon); + childSetCommitCallback("WLBlueHorizonG", onColorControlGMoved, ¶m_mgr->mBlueHorizon); + childSetCommitCallback("WLBlueHorizonB", onColorControlBMoved, ¶m_mgr->mBlueHorizon); + childSetCommitCallback("WLBlueHorizonI", onColorControlIMoved, ¶m_mgr->mBlueHorizon); // haze density, horizon, mult, and altitude - getChild("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mHazeDensity)); - getChild("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mHazeHorizon)); - getChild("WLDensityMult")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr->mDensityMult)); - getChild("WLMaxAltitude")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr->mMaxAlt)); + childSetCommitCallback("WLHazeDensity", onColorControlRMoved, ¶m_mgr->mHazeDensity); + childSetCommitCallback("WLHazeHorizon", onColorControlRMoved, ¶m_mgr->mHazeHorizon); + childSetCommitCallback("WLDensityMult", onFloatControlMoved, ¶m_mgr->mDensityMult); + childSetCommitCallback("WLMaxAltitude", onFloatControlMoved, ¶m_mgr->mMaxAlt); // blue density - getChild("WLBlueDensityR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mBlueDensity)); - getChild("WLBlueDensityG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mBlueDensity)); - getChild("WLBlueDensityB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mBlueDensity)); - getChild("WLBlueDensityI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr->mBlueDensity)); + childSetCommitCallback("WLBlueDensityR", onColorControlRMoved, ¶m_mgr->mBlueDensity); + childSetCommitCallback("WLBlueDensityG", onColorControlGMoved, ¶m_mgr->mBlueDensity); + childSetCommitCallback("WLBlueDensityB", onColorControlBMoved, ¶m_mgr->mBlueDensity); + childSetCommitCallback("WLBlueDensityI", onColorControlIMoved, ¶m_mgr->mBlueDensity); // Lighting // sunlight - getChild("WLSunlightR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mSunlight)); - getChild("WLSunlightG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mSunlight)); - getChild("WLSunlightB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mSunlight)); - getChild("WLSunlightI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr->mSunlight)); + childSetCommitCallback("WLSunlightR", onColorControlRMoved, ¶m_mgr->mSunlight); + childSetCommitCallback("WLSunlightG", onColorControlGMoved, ¶m_mgr->mSunlight); + childSetCommitCallback("WLSunlightB", onColorControlBMoved, ¶m_mgr->mSunlight); + childSetCommitCallback("WLSunlightI", onColorControlIMoved, ¶m_mgr->mSunlight); // glow - getChild("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onGlowRMoved, this, _1, ¶m_mgr->mGlow)); - getChild("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onGlowBMoved, this, _1, ¶m_mgr->mGlow)); + childSetCommitCallback("WLGlowR", onGlowRMoved, ¶m_mgr->mGlow); + childSetCommitCallback("WLGlowB", onGlowBMoved, ¶m_mgr->mGlow); // ambient - getChild("WLAmbientR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mAmbient)); - getChild("WLAmbientG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mAmbient)); - getChild("WLAmbientB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mAmbient)); - getChild("WLAmbientI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr->mAmbient)); + childSetCommitCallback("WLAmbientR", onColorControlRMoved, ¶m_mgr->mAmbient); + childSetCommitCallback("WLAmbientG", onColorControlGMoved, ¶m_mgr->mAmbient); + childSetCommitCallback("WLAmbientB", onColorControlBMoved, ¶m_mgr->mAmbient); + childSetCommitCallback("WLAmbientI", onColorControlIMoved, ¶m_mgr->mAmbient); // time of day - getChild("WLSunAngle")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSunMoved, this, _1, ¶m_mgr->mLightnorm)); - getChild("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSunMoved, this, _1, ¶m_mgr->mLightnorm)); + childSetCommitCallback("WLSunAngle", onSunMoved, ¶m_mgr->mLightnorm); + childSetCommitCallback("WLEastAngle", onSunMoved, ¶m_mgr->mLightnorm); // Clouds // Cloud Color - getChild("WLCloudColorR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mCloudColor)); - getChild("WLCloudColorG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mCloudColor)); - getChild("WLCloudColorB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mCloudColor)); - getChild("WLCloudColorI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr->mCloudColor)); + childSetCommitCallback("WLCloudColorR", onColorControlRMoved, ¶m_mgr->mCloudColor); + childSetCommitCallback("WLCloudColorG", onColorControlGMoved, ¶m_mgr->mCloudColor); + childSetCommitCallback("WLCloudColorB", onColorControlBMoved, ¶m_mgr->mCloudColor); + childSetCommitCallback("WLCloudColorI", onColorControlIMoved, ¶m_mgr->mCloudColor); // Cloud - getChild("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mCloudMain)); - getChild("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mCloudMain)); - getChild("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mCloudMain)); + childSetCommitCallback("WLCloudX", onColorControlRMoved, ¶m_mgr->mCloudMain); + childSetCommitCallback("WLCloudY", onColorControlGMoved, ¶m_mgr->mCloudMain); + childSetCommitCallback("WLCloudDensity", onColorControlBMoved, ¶m_mgr->mCloudMain); // Cloud Detail - getChild("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mCloudDetail)); - getChild("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mCloudDetail)); - getChild("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mCloudDetail)); + childSetCommitCallback("WLCloudDetailX", onColorControlRMoved, ¶m_mgr->mCloudDetail); + childSetCommitCallback("WLCloudDetailY", onColorControlGMoved, ¶m_mgr->mCloudDetail); + childSetCommitCallback("WLCloudDetailDensity", onColorControlBMoved, ¶m_mgr->mCloudDetail); // Cloud extras - getChild("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr->mCloudCoverage)); - getChild("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr->mCloudScale)); - getChild("WLCloudLockX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollXToggled, this, _1)); - getChild("WLCloudLockY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollYToggled, this, _1)); - getChild("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollXMoved, this, _1)); - getChild("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollYMoved, this, _1)); - getChild("WLDistanceMult")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr->mDistanceMult)); - getChild("DrawClassicClouds")->setCommitCallback(boost::bind(LLSavedSettingsGlue::setBOOL, _1, "SkyUseClassicClouds")); + childSetCommitCallback("WLCloudCoverage", onFloatControlMoved, ¶m_mgr->mCloudCoverage); + childSetCommitCallback("WLCloudScale", onFloatControlMoved, ¶m_mgr->mCloudScale); + childSetCommitCallback("WLCloudLockX", onCloudScrollXToggled, NULL); + childSetCommitCallback("WLCloudLockY", onCloudScrollYToggled, NULL); + childSetCommitCallback("WLCloudScrollX", onCloudScrollXMoved, NULL); + childSetCommitCallback("WLCloudScrollY", onCloudScrollYMoved, NULL); + childSetCommitCallback("WLDistanceMult", onFloatControlMoved, ¶m_mgr->mDistanceMult); + childSetCommitCallback("DrawClassicClouds", LLSavedSettingsGlue::setBOOL, (void*)"SkyUseClassicClouds"); // WL Top - getChild("WLDayCycleMenuButton")->setCommitCallback(boost::bind(&LLFloaterWindLight::onOpenDayCycle, this)); + childSetAction("WLDayCycleMenuButton", onOpenDayCycle, NULL); // Load/save LLComboBox* comboBox = getChild("WLPresetsCombo"); //childSetAction("WLLoadPreset", onLoadPreset, comboBox); - getChild("WLNewPreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onNewPreset, this)); - getChild("WLSavePreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSavePreset, this)); - getChild("WLDeletePreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onDeletePreset, this)); + childSetAction("WLNewPreset", onNewPreset, comboBox); + childSetAction("WLSavePreset", onSavePreset, comboBox); + childSetAction("WLDeletePreset", onDeletePreset, comboBox); - comboBox->setCommitCallback(boost::bind(&LLFloaterWindLight::onChangePresetName, this, _1)); + comboBox->setCommitCallback(onChangePresetName); // Dome - getChild("WLGamma")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr->mWLGamma)); - getChild("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterWindLight::onStarAlphaMoved, this, _1)); + childSetCommitCallback("WLGamma", onFloatControlMoved, ¶m_mgr->mWLGamma); + childSetCommitCallback("WLStarAlpha", onStarAlphaMoved, NULL); +} + +void LLFloaterWindLight::onClickHelp(void* data) +{ + LLFloaterWindLight* self = LLFloaterWindLight::instance(); + + const std::string xml_alert = *(std::string*)data; + LLNotifications::instance().add(self->contextualNotification(xml_alert)); +} + +void LLFloaterWindLight::initHelpBtn(const std::string& name, const std::string& xml_alert) +{ + childSetAction(name, onClickHelp, new std::string(xml_alert)); } bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& response) { std::string text = response["message"].asString(); - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + LLWLParamKey newKey(text, LLEnvKey::SCOPE_LOCAL); + S32 option = LLNotification::getSelectedOption(notification, response); if(text == "") { @@ -212,26 +259,29 @@ bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& } if(option == 0) { - LLComboBox* comboBox = getChild("WLPresetsCombo"); + LLComboBox* comboBox = sWindLight->getChild( + "WLPresetsCombo"); - LLFloaterDayCycle* day_cycle = LLFloaterReg::findTypedInstance("env_day_cycle"); + LLFloaterDayCycle* sDayCycle = NULL; LLComboBox* keyCombo = NULL; - if(day_cycle) + if(LLFloaterDayCycle::isOpen()) { - keyCombo = day_cycle->getChild("WLKeyPresets"); + sDayCycle = LLFloaterDayCycle::instance(); + keyCombo = sDayCycle->getChild( + "WLKeyPresets"); } // add the current parameters to the list // see if it's there first - std::map::iterator mIt = - LLWLParamManager::instance()->mParamList.find(text); + std::map::iterator mIt = + LLWLParamManager::getInstance()->mParamList.find(newKey); // if not there, add a new one - if(mIt == LLWLParamManager::instance()->mParamList.end()) + if(mIt == LLWLParamManager::getInstance()->mParamList.end()) { - LLWLParamManager::instance()->addParamSet(text, - LLWLParamManager::instance()->mCurParams); - comboBox->add(text); + LLWLParamManager::getInstance()->addParamSet(newKey, + LLWLParamManager::getInstance()->mCurParams); + comboBox->add(newKey.toString(), newKey.toLLSD()); comboBox->sortByName(); // add a blank to the bottom @@ -243,18 +293,18 @@ bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& comboBox->add(LLStringUtil::null); comboBox->setSelectedByValue(text, true); - if(keyCombo) + if(LLFloaterDayCycle::isOpen()) { keyCombo->add(text); keyCombo->sortByName(); } - LLWLParamManager::instance()->savePreset(text); + LLWLParamManager::getInstance()->savePreset(newKey); // otherwise, send a message to the user } else { - LLNotificationsUtil::add("ExistsSkyPresetAlert"); + LLNotifications::instance().add("ExistsSkyPresetAlert"); } } return false; @@ -264,38 +314,38 @@ void LLFloaterWindLight::syncMenu() { bool err; - LLWLParamManager * param_mgr = LLWLParamManager::instance(); + LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); LLWLParamSet& currentParams = param_mgr->mCurParams; //std::map & currentParams = param_mgr->mCurParams.mParamValues; // blue horizon param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.mName, err); - getChild("WLBlueHorizonR")->setValue(param_mgr->mBlueHorizon.r / 2.0); - getChild("WLBlueHorizonG")->setValue(param_mgr->mBlueHorizon.g / 2.0); - getChild("WLBlueHorizonB")->setValue(param_mgr->mBlueHorizon.b / 2.0); - getChild("WLBlueHorizonI")->setValue( + childSetValue("WLBlueHorizonR", param_mgr->mBlueHorizon.r / 2.0); + childSetValue("WLBlueHorizonG", param_mgr->mBlueHorizon.g / 2.0); + childSetValue("WLBlueHorizonB", param_mgr->mBlueHorizon.b / 2.0); + childSetValue("WLBlueHorizonI", std::max(param_mgr->mBlueHorizon.r / 2.0, std::max(param_mgr->mBlueHorizon.g / 2.0, param_mgr->mBlueHorizon.b / 2.0))); // haze density, horizon, mult, and altitude param_mgr->mHazeDensity = currentParams.getVector(param_mgr->mHazeDensity.mName, err); - getChild("WLHazeDensity")->setValue(param_mgr->mHazeDensity.r); + childSetValue("WLHazeDensity", param_mgr->mHazeDensity.r); param_mgr->mHazeHorizon = currentParams.getVector(param_mgr->mHazeHorizon.mName, err); - getChild("WLHazeHorizon")->setValue(param_mgr->mHazeHorizon.r); + childSetValue("WLHazeHorizon", param_mgr->mHazeHorizon.r); param_mgr->mDensityMult = currentParams.getVector(param_mgr->mDensityMult.mName, err); - getChild("WLDensityMult")->setValue(param_mgr->mDensityMult.x * + childSetValue("WLDensityMult", param_mgr->mDensityMult.x * param_mgr->mDensityMult.mult); param_mgr->mMaxAlt = currentParams.getVector(param_mgr->mMaxAlt.mName, err); - getChild("WLMaxAltitude")->setValue(param_mgr->mMaxAlt.x); + childSetValue("WLMaxAltitude", param_mgr->mMaxAlt.x); // blue density param_mgr->mBlueDensity = currentParams.getVector(param_mgr->mBlueDensity.mName, err); - getChild("WLBlueDensityR")->setValue(param_mgr->mBlueDensity.r / 2.0); - getChild("WLBlueDensityG")->setValue(param_mgr->mBlueDensity.g / 2.0); - getChild("WLBlueDensityB")->setValue(param_mgr->mBlueDensity.b / 2.0); - getChild("WLBlueDensityI")->setValue( + childSetValue("WLBlueDensityR", param_mgr->mBlueDensity.r / 2.0); + childSetValue("WLBlueDensityG", param_mgr->mBlueDensity.g / 2.0); + childSetValue("WLBlueDensityB", param_mgr->mBlueDensity.b / 2.0); + childSetValue("WLBlueDensityI", std::max(param_mgr->mBlueDensity.r / 2.0, std::max(param_mgr->mBlueDensity.g / 2.0, param_mgr->mBlueDensity.b / 2.0))); @@ -303,107 +353,161 @@ void LLFloaterWindLight::syncMenu() // sunlight param_mgr->mSunlight = currentParams.getVector(param_mgr->mSunlight.mName, err); - getChild("WLSunlightR")->setValue(param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE); - getChild("WLSunlightG")->setValue(param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE); - getChild("WLSunlightB")->setValue(param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE); - getChild("WLSunlightI")->setValue( + childSetValue("WLSunlightR", param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue("WLSunlightG", param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue("WLSunlightB", param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue("WLSunlightI", std::max(param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE, std::max(param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE))); // glow param_mgr->mGlow = currentParams.getVector(param_mgr->mGlow.mName, err); - getChild("WLGlowR")->setValue(2 - param_mgr->mGlow.r / 20.0f); - getChild("WLGlowB")->setValue(-param_mgr->mGlow.b / 5.0f); + childSetValue("WLGlowR", 2 - param_mgr->mGlow.r / 20.0f); + childSetValue("WLGlowB", -param_mgr->mGlow.b / 5.0f); // ambient param_mgr->mAmbient = currentParams.getVector(param_mgr->mAmbient.mName, err); - getChild("WLAmbientR")->setValue(param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE); - getChild("WLAmbientG")->setValue(param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE); - getChild("WLAmbientB")->setValue(param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE); - getChild("WLAmbientI")->setValue( + childSetValue("WLAmbientR", param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue("WLAmbientG", param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue("WLAmbientB", param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue("WLAmbientI", std::max(param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE, std::max(param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE))); - getChild("WLSunAngle")->setValue(param_mgr->mCurParams.getFloat("sun_angle",err) / F_TWO_PI); - getChild("WLEastAngle")->setValue(param_mgr->mCurParams.getFloat("east_angle",err) / F_TWO_PI); + childSetValue("WLSunAngle", param_mgr->mCurParams.getFloat("sun_angle",err) / F_TWO_PI); + childSetValue("WLEastAngle", param_mgr->mCurParams.getFloat("east_angle",err) / F_TWO_PI); // Clouds // Cloud Color param_mgr->mCloudColor = currentParams.getVector(param_mgr->mCloudColor.mName, err); - getChild("WLCloudColorR")->setValue(param_mgr->mCloudColor.r); - getChild("WLCloudColorG")->setValue(param_mgr->mCloudColor.g); - getChild("WLCloudColorB")->setValue(param_mgr->mCloudColor.b); - getChild("WLCloudColorI")->setValue( + childSetValue("WLCloudColorR", param_mgr->mCloudColor.r); + childSetValue("WLCloudColorG", param_mgr->mCloudColor.g); + childSetValue("WLCloudColorB", param_mgr->mCloudColor.b); + childSetValue("WLCloudColorI", std::max(param_mgr->mCloudColor.r, std::max(param_mgr->mCloudColor.g, param_mgr->mCloudColor.b))); // Cloud param_mgr->mCloudMain = currentParams.getVector(param_mgr->mCloudMain.mName, err); - getChild("WLCloudX")->setValue(param_mgr->mCloudMain.r); - getChild("WLCloudY")->setValue(param_mgr->mCloudMain.g); - getChild("WLCloudDensity")->setValue(param_mgr->mCloudMain.b); + childSetValue("WLCloudX", param_mgr->mCloudMain.r); + childSetValue("WLCloudY", param_mgr->mCloudMain.g); + childSetValue("WLCloudDensity", param_mgr->mCloudMain.b); // Cloud Detail param_mgr->mCloudDetail = currentParams.getVector(param_mgr->mCloudDetail.mName, err); - getChild("WLCloudDetailX")->setValue(param_mgr->mCloudDetail.r); - getChild("WLCloudDetailY")->setValue(param_mgr->mCloudDetail.g); - getChild("WLCloudDetailDensity")->setValue(param_mgr->mCloudDetail.b); + childSetValue("WLCloudDetailX", param_mgr->mCloudDetail.r); + childSetValue("WLCloudDetailY", param_mgr->mCloudDetail.g); + childSetValue("WLCloudDetailDensity", param_mgr->mCloudDetail.b); // Cloud extras param_mgr->mCloudCoverage = currentParams.getVector(param_mgr->mCloudCoverage.mName, err); param_mgr->mCloudScale = currentParams.getVector(param_mgr->mCloudScale.mName, err); - getChild("WLCloudCoverage")->setValue(param_mgr->mCloudCoverage.x); - getChild("WLCloudScale")->setValue(param_mgr->mCloudScale.x); + childSetValue("WLCloudCoverage", param_mgr->mCloudCoverage.x); + childSetValue("WLCloudScale", param_mgr->mCloudScale.x); // cloud scrolling bool lockX = !param_mgr->mCurParams.getEnableCloudScrollX(); bool lockY = !param_mgr->mCurParams.getEnableCloudScrollY(); - getChild("WLCloudLockX")->setValue(lockX); - getChild("WLCloudLockY")->setValue(lockY); - getChild("DrawClassicClouds")->setValue(gSavedSettings.getBOOL("SkyUseClassicClouds")); + childSetValue("WLCloudLockX", lockX); + childSetValue("WLCloudLockY", lockY); + childSetValue("DrawClassicClouds", gSavedSettings.getBOOL("SkyUseClassicClouds")); // disable if locked, enable if not if(lockX) { - getChildView("WLCloudScrollX")->setEnabled(FALSE); + childDisable("WLCloudScrollX"); } else { - getChildView("WLCloudScrollX")->setEnabled(TRUE); + childEnable("WLCloudScrollX"); } if(lockY) { - getChildView("WLCloudScrollY")->setEnabled(FALSE); + childDisable("WLCloudScrollY"); } else { - getChildView("WLCloudScrollY")->setEnabled(TRUE); + childEnable("WLCloudScrollY"); } // *HACK cloud scrolling is off my an additive of 10 - getChild("WLCloudScrollX")->setValue(param_mgr->mCurParams.getCloudScrollX() - 10.0f); - getChild("WLCloudScrollY")->setValue(param_mgr->mCurParams.getCloudScrollY() - 10.0f); + childSetValue("WLCloudScrollX", param_mgr->mCurParams.getCloudScrollX() - 10.0f); + childSetValue("WLCloudScrollY", param_mgr->mCurParams.getCloudScrollY() - 10.0f); param_mgr->mDistanceMult = currentParams.getVector(param_mgr->mDistanceMult.mName, err); - getChild("WLDistanceMult")->setValue(param_mgr->mDistanceMult.x); + childSetValue("WLDistanceMult", param_mgr->mDistanceMult.x); // Tweak extras param_mgr->mWLGamma = currentParams.getVector(param_mgr->mWLGamma.mName, err); - getChild("WLGamma")->setValue(param_mgr->mWLGamma.x); + childSetValue("WLGamma", param_mgr->mWLGamma.x); - getChild("WLStarAlpha")->setValue(param_mgr->mCurParams.getStarBrightness()); + childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness()); +} - LLTabContainer* tab = getChild("WindLight Tabs"); - LLPanel* panel = getChild("Scattering"); - tab->enableTabButton(tab->getIndexForPanel(panel), gSavedSettings.getBOOL("RenderDeferredGI")); +// static +LLFloaterWindLight* LLFloaterWindLight::instance() +{ + if (!sWindLight) + { + sWindLight = new LLFloaterWindLight(); + } + return sWindLight; +} +void LLFloaterWindLight::show(LLEnvKey::EScope scope) +{ + LLFloaterWindLight* windLight = instance(); + if(scope != sScope && ((LLView*)windLight)->getVisible()) + { + LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD()); + return; + } + sScope = scope; + std::string scope_str = ""; + switch(sScope) + { + case LLEnvKey::SCOPE_LOCAL: + scope_str = LLTrans::getString("LocalSettings"); + break; + case LLEnvKey::SCOPE_REGION: + scope_str = LLTrans::getString("RegionSettings"); + break; + } + std::string title = sOriginalTitle + " (" + scope_str + ")"; + windLight->setTitle(title); + windLight->syncMenu(); + + LLEnvManager::instance().startEditingScope(scope); + + // comment in if you want the menu to rebuild each time + //LLUICtrlFactory::getInstance()->buildFloater(windLight, "floater_windlight_options.xml"); + //windLight->initCallbacks(); + + windLight->open(); } +bool LLFloaterWindLight::isOpen() +{ + if (sWindLight != NULL) { + return true; + } + return false; +} + +// virtual +void LLFloaterWindLight::onClose(bool app_quitting) +{ + if (sWindLight) + { + sWindLight->setVisible(FALSE); + } +} // color control callbacks -void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, WLColorControl* colorControl) +void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); LLSliderCtrl* sldrCtrl = static_cast(ctrl); + WLColorControl * colorControl = static_cast(userData); colorControl->r = sldrCtrl->getValueF32(); if(colorControl->isSunOrAmbientColor) { @@ -421,24 +525,25 @@ void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, WLColorControl* co name.append("I"); if(colorControl->isSunOrAmbientColor) { - getChild(name)->setValue(colorControl->r / 3); + sWindLight->childSetValue(name, colorControl->r / 3); } else if(colorControl->isBlueHorizonOrDensity) { - getChild(name)->setValue(colorControl->r / 2); + sWindLight->childSetValue(name, colorControl->r / 2); } else { - getChild(name)->setValue(colorControl->r); + sWindLight->childSetValue(name, colorControl->r); } } - colorControl->update(LLWLParamManager::instance()->mCurParams); + colorControl->update(LLWLParamManager::getInstance()->mCurParams); - LLWLParamManager::instance()->propagateParameters(); + LLWLParamManager::getInstance()->propagateParameters(); } -void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, WLColorControl* colorControl) +void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); LLSliderCtrl* sldrCtrl = static_cast(ctrl); + WLColorControl * colorControl = static_cast(userData); colorControl->g = sldrCtrl->getValueF32(); if(colorControl->isSunOrAmbientColor) { @@ -456,24 +561,25 @@ void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, WLColorControl* co name.append("I"); if(colorControl->isSunOrAmbientColor) { - getChild(name)->setValue(colorControl->g / 3); + sWindLight->childSetValue(name, colorControl->g / 3); } else if(colorControl->isBlueHorizonOrDensity) { - getChild(name)->setValue(colorControl->g / 2); + sWindLight->childSetValue(name, colorControl->g / 2); } else { - getChild(name)->setValue(colorControl->g); + sWindLight->childSetValue(name, colorControl->g); } } - colorControl->update(LLWLParamManager::instance()->mCurParams); + colorControl->update(LLWLParamManager::getInstance()->mCurParams); - LLWLParamManager::instance()->propagateParameters(); + LLWLParamManager::getInstance()->propagateParameters(); } -void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, WLColorControl* colorControl) +void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); LLSliderCtrl* sldrCtrl = static_cast(ctrl); + WLColorControl * colorControl = static_cast(userData); colorControl->b = sldrCtrl->getValueF32(); if(colorControl->isSunOrAmbientColor) { @@ -491,24 +597,25 @@ void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, WLColorControl* co name.append("I"); if(colorControl->isSunOrAmbientColor) { - getChild(name)->setValue(colorControl->b / 3); + sWindLight->childSetValue(name, colorControl->b / 3); } else if(colorControl->isBlueHorizonOrDensity) { - getChild(name)->setValue(colorControl->b / 2); + sWindLight->childSetValue(name, colorControl->b / 2); } else { - getChild(name)->setValue(colorControl->b); + sWindLight->childSetValue(name, colorControl->b); } } - colorControl->update(LLWLParamManager::instance()->mCurParams); + colorControl->update(LLWLParamManager::getInstance()->mCurParams); - LLWLParamManager::instance()->propagateParameters(); + LLWLParamManager::getInstance()->propagateParameters(); } -void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, WLColorControl* colorControl) +void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); LLSliderCtrl* sldrCtrl = static_cast(ctrl); + WLColorControl * colorControl = static_cast(userData); colorControl->i = sldrCtrl->getValueF32(); @@ -565,84 +672,100 @@ void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, WLColorControl* co // divide sun color vals by three if(colorControl->isSunOrAmbientColor) { - getChild(rName)->setValue(colorControl->r/3); - getChild(gName)->setValue(colorControl->g/3); - getChild(bName)->setValue(colorControl->b/3); + sWindLight->childSetValue(rName, colorControl->r/3); + sWindLight->childSetValue(gName, colorControl->g/3); + sWindLight->childSetValue(bName, colorControl->b/3); } else if(colorControl->isBlueHorizonOrDensity) { - getChild(rName)->setValue(colorControl->r/2); - getChild(gName)->setValue(colorControl->g/2); - getChild(bName)->setValue(colorControl->b/2); + sWindLight->childSetValue(rName, colorControl->r/2); + sWindLight->childSetValue(gName, colorControl->g/2); + sWindLight->childSetValue(bName, colorControl->b/2); } else { // set the sliders to the new vals - getChild(rName)->setValue(colorControl->r); - getChild(gName)->setValue(colorControl->g); - getChild(bName)->setValue(colorControl->b); + sWindLight->childSetValue(rName, colorControl->r); + sWindLight->childSetValue(gName, colorControl->g); + sWindLight->childSetValue(bName, colorControl->b); } } // now update the current parameters and send them to shaders - colorControl->update(LLWLParamManager::instance()->mCurParams); - LLWLParamManager::instance()->propagateParameters(); + colorControl->update(LLWLParamManager::getInstance()->mCurParams); + LLWLParamManager::getInstance()->propagateParameters(); } /// GLOW SPECIFIC CODE -void LLFloaterWindLight::onGlowRMoved(LLUICtrl* ctrl, WLColorControl* colorControl) +void LLFloaterWindLight::onGlowRMoved(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); LLSliderCtrl* sldrCtrl = static_cast(ctrl); + WLColorControl * colorControl = static_cast(userData); // scaled by 20 colorControl->r = (2 - sldrCtrl->getValueF32()) * 20; - colorControl->update(LLWLParamManager::instance()->mCurParams); - LLWLParamManager::instance()->propagateParameters(); + colorControl->update(LLWLParamManager::getInstance()->mCurParams); + LLWLParamManager::getInstance()->propagateParameters(); } /// \NOTE that we want NEGATIVE (-) B -void LLFloaterWindLight::onGlowBMoved(LLUICtrl* ctrl, WLColorControl* colorControl) +void LLFloaterWindLight::onGlowBMoved(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); LLSliderCtrl* sldrCtrl = static_cast(ctrl); + WLColorControl * colorControl = static_cast(userData); /// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big colorControl->b = -sldrCtrl->getValueF32() * 5; - colorControl->update(LLWLParamManager::instance()->mCurParams); - LLWLParamManager::instance()->propagateParameters(); + colorControl->update(LLWLParamManager::getInstance()->mCurParams); + LLWLParamManager::getInstance()->propagateParameters(); } -void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* floatControl) +void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); LLSliderCtrl* sldrCtrl = static_cast(ctrl); + WLFloatControl * floatControl = static_cast(userData); floatControl->x = sldrCtrl->getValueF32() / floatControl->mult; - floatControl->update(LLWLParamManager::instance()->mCurParams); - LLWLParamManager::instance()->propagateParameters(); + floatControl->update(LLWLParamManager::getInstance()->mCurParams); + LLWLParamManager::getInstance()->propagateParameters(); +} + +void LLFloaterWindLight::onBoolToggle(LLUICtrl* ctrl, void* userData) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLCheckBoxCtrl* cbCtrl = static_cast(ctrl); + + bool value = cbCtrl->get(); + (*(static_cast(userData))) = value; } + // Lighting callbacks // time of day -void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, WLColorControl* colorControl) +void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); - LLSliderCtrl* sunSldr = getChild("WLSunAngle"); - LLSliderCtrl* eastSldr = getChild("WLEastAngle"); + LLSliderCtrl* sunSldr = sWindLight->getChild("WLSunAngle"); + LLSliderCtrl* eastSldr = sWindLight->getChild("WLEastAngle"); + WLColorControl * colorControl = static_cast(userData); + // get the two angles - LLWLParamManager * param_mgr = LLWLParamManager::instance(); + LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); param_mgr->mCurParams.setSunAngle(F_TWO_PI * sunSldr->getValueF32()); param_mgr->mCurParams.setEastAngle(F_TWO_PI * eastSldr->getValueF32()); @@ -659,24 +782,35 @@ void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, WLColorControl* colorControl param_mgr->propagateParameters(); } -void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl) +void LLFloaterWindLight::onFloatTweakMoved(LLUICtrl* ctrl, void* userData) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLSliderCtrl* sldrCtrl = static_cast(ctrl); + F32 * tweak = static_cast(userData); + + (*tweak) = sldrCtrl->getValueF32(); + LLWLParamManager::getInstance()->propagateParameters(); +} + +void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); LLSliderCtrl* sldrCtrl = static_cast(ctrl); - LLWLParamManager::instance()->mCurParams.setStarBrightness(sldrCtrl->getValueF32()); + LLWLParamManager::getInstance()->mCurParams.setStarBrightness(sldrCtrl->getValueF32()); } -void LLFloaterWindLight::onNewPreset() +void LLFloaterWindLight::onNewPreset(void* userData) { - LLNotificationsUtil::add("NewSkyPreset", LLSD(), LLSD(), boost::bind(&LLFloaterWindLight::newPromptCallback, this, _1, _2)); + LLNotifications::instance().add("NewSkyPreset", LLSD(), LLSD(), newPromptCallback); } -void LLFloaterWindLight::onSavePreset() +void LLFloaterWindLight::onSavePreset(void* userData) { // get the name - LLComboBox* comboBox = getChild( + LLComboBox* comboBox = sWindLight->getChild( "WLPresetsCombo"); // don't save the empty name @@ -686,90 +820,98 @@ void LLFloaterWindLight::onSavePreset() } // check to see if it's a default and shouldn't be overwritten - std::set::iterator sIt = sDefaultPresets.find( - comboBox->getSelectedItemLabel()); + std::set::iterator sIt = sDefaultPresets.find( + LLWLParamKey(comboBox->getSelectedValue())); if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets")) { - LLNotificationsUtil::add("WLNoEditDefault"); + LLNotifications::instance().add("WLNoEditDefault"); return; } - LLWLParamManager::instance()->mCurParams.mName = + LLWLParamManager::getInstance()->mCurParams.mName = comboBox->getSelectedItemLabel(); - LLNotificationsUtil::add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterWindLight::saveAlertCallback, this, _1, _2)); + LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback); } bool LLFloaterWindLight::saveAlertCallback(const LLSD& notification, const LLSD& response) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + S32 option = LLNotification::getSelectedOption(notification, response); // if they choose save, do it. Otherwise, don't do anything if(option == 0) { - LLWLParamManager * param_mgr = LLWLParamManager::instance(); + LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); + + // we should only "save" local presets; those with other scopes should be "save as" + LLWLParamKey key(param_mgr->mCurParams.mName, LLEnvKey::SCOPE_LOCAL); - param_mgr->setParamSet(param_mgr->mCurParams.mName, param_mgr->mCurParams); + param_mgr->setParamSet(key, param_mgr->mCurParams); // comment this back in to save to file - param_mgr->savePreset(param_mgr->mCurParams.mName); + param_mgr->savePreset(key); } return false; } -void LLFloaterWindLight::onDeletePreset() +void LLFloaterWindLight::onDeletePreset(void* userData) { - LLComboBox* combo_box = getChild( + LLComboBox* combo_box = sWindLight->getChild( "WLPresetsCombo"); - if(combo_box->getSelectedValue().asString() == "") + if(combo_box->getSelectedValue().isUndefined()) { return; } LLSD args; - args["SKY"] = combo_box->getSelectedValue().asString(); - LLNotificationsUtil::add("WLDeletePresetAlert", args, LLSD(), - boost::bind(&LLFloaterWindLight::deleteAlertCallback, this, _1, _2)); + args["SKY"] = combo_box->getSelectedValue()[0].asString(); + LLNotifications::instance().add("WLDeletePresetAlert", args, LLSD(), + boost::bind(&LLFloaterWindLight::deleteAlertCallback, sWindLight, _1, _2)); } bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLSD& response) { - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + S32 option = LLNotification::getSelectedOption(notification, response); // if they choose delete, do it. Otherwise, don't do anything if(option == 0) { - LLComboBox* combo_box = getChild("WLPresetsCombo"); - LLFloaterDayCycle* day_cycle = LLFloaterReg::findTypedInstance("env_day_cycle"); + LLComboBox* combo_box = getChild( + "WLPresetsCombo"); + LLFloaterDayCycle* day_cycle = NULL; LLComboBox* key_combo = NULL; + LLMultiSliderCtrl* mult_sldr = NULL; - if (day_cycle) + if(LLFloaterDayCycle::isOpen()) { - key_combo = day_cycle->getChild("WLKeyPresets"); + day_cycle = LLFloaterDayCycle::instance(); + key_combo = day_cycle->getChild( + "WLKeyPresets"); + mult_sldr = day_cycle->getChild("WLDayCycleKeys"); } - std::string name(combo_box->getSelectedValue().asString()); + LLWLParamKey key(combo_box->getSelectedValue()); // check to see if it's a default and shouldn't be deleted - std::set::iterator sIt = sDefaultPresets.find(name); + std::set::iterator sIt = sDefaultPresets.find(key); if(sIt != sDefaultPresets.end()) { - LLNotificationsUtil::add("WLNoEditDefault"); + LLNotifications::instance().add("WLNoEditDefault"); return false; } - LLWLParamManager::instance()->removeParamSet(name, true); + LLWLParamManager::getInstance()->removeParamSet(key, true); // remove and choose another S32 new_index = combo_box->getCurrentIndex(); - combo_box->remove(name); + combo_box->remove(key.toString()); if(key_combo != NULL) { - key_combo->remove(name); + key_combo->remove(key.toString()); // remove from slider, as well - day_cycle->deletePreset(name); + day_cycle->deletePreset(key); } // pick the previously selected index after delete @@ -787,53 +929,56 @@ bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLS } -void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl) +void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl, void * userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); - std::string data = ctrl->getValue().asString(); - if(!data.empty()) + LLComboBox * combo_box = static_cast(ctrl); + + if(combo_box->getSimple() == "") { - LLWLParamManager::instance()->loadPreset( data); - syncMenu(); + return; } + + LLWLParamManager::getInstance()->loadPreset(LLWLParamKey(combo_box->getSelectedValue())); + sWindLight->syncMenu(); } -void LLFloaterWindLight::onOpenDayCycle() +void LLFloaterWindLight::onOpenDayCycle(void* userData) { - LLFloaterReg::showInstance("env_day_cycle"); + LLFloaterDayCycle::show(sScope); } // Clouds -void LLFloaterWindLight::onCloudScrollXMoved(LLUICtrl* ctrl) +void LLFloaterWindLight::onCloudScrollXMoved(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); LLSliderCtrl* sldrCtrl = static_cast(ctrl); // *HACK all cloud scrolling is off by an additive of 10. - LLWLParamManager::instance()->mCurParams.setCloudScrollX(sldrCtrl->getValueF32() + 10.0f); + LLWLParamManager::getInstance()->mCurParams.setCloudScrollX(sldrCtrl->getValueF32() + 10.0f); } -void LLFloaterWindLight::onCloudScrollYMoved(LLUICtrl* ctrl) +void LLFloaterWindLight::onCloudScrollYMoved(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); LLSliderCtrl* sldrCtrl = static_cast(ctrl); // *HACK all cloud scrolling is off by an additive of 10. - LLWLParamManager::instance()->mCurParams.setCloudScrollY(sldrCtrl->getValueF32() + 10.0f); + LLWLParamManager::getInstance()->mCurParams.setCloudScrollY(sldrCtrl->getValueF32() + 10.0f); } -void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl) +void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); LLCheckBoxCtrl* cbCtrl = static_cast(ctrl); bool lock = cbCtrl->get(); - LLWLParamManager::instance()->mCurParams.setEnableCloudScrollX(!lock); + LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollX(!lock); - LLSliderCtrl* sldr = getChild( + LLSliderCtrl* sldr = sWindLight->getChild( "WLCloudScrollX"); if(cbCtrl->get()) @@ -847,15 +992,15 @@ void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl) } -void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl) +void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl, void* userData) { - deactivateAnimator(); + LLWLParamManager::getInstance()->mAnimator.deactivate(); LLCheckBoxCtrl* cbCtrl = static_cast(ctrl); bool lock = cbCtrl->get(); - LLWLParamManager::instance()->mCurParams.setEnableCloudScrollY(!lock); + LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollY(!lock); - LLSliderCtrl* sldr = getChild( + LLSliderCtrl* sldr = sWindLight->getChild( "WLCloudScrollY"); if(cbCtrl->get()) @@ -867,9 +1012,3 @@ void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl) sldr->setEnabled(true); } } - -void LLFloaterWindLight::deactivateAnimator() -{ - LLWLParamManager::instance()->mAnimator.mIsRunning = false; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; -} diff --git a/indra/newview/llfloaterwindlight.h b/indra/newview/llfloaterwindlight.h index b43edc2c11..c0fea2558c 100644 --- a/indra/newview/llfloaterwindlight.h +++ b/indra/newview/llfloaterwindlight.h @@ -2,25 +2,31 @@ * @file llfloaterwindlight.h * @brief LLFloaterWindLight class definition * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, 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. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * 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. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * 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 + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -35,77 +41,98 @@ #include #include "llwlparamset.h" +#include "llwlparammanager.h" struct WLColorControl; struct WLFloatControl; - /// Menuing system for all of windlight's functionality class LLFloaterWindLight : public LLFloater { public: - - LLFloaterWindLight(const LLSD& key); + LLFloaterWindLight(); virtual ~LLFloaterWindLight(); - /*virtual*/ BOOL postBuild(); + /// initialize all void initCallbacks(void); - bool newPromptCallback(const LLSD& notification, const LLSD& response); + /// one and one instance only + static LLFloaterWindLight* instance(); + + // help button stuff + static void onClickHelp(void* data); + void initHelpBtn(const std::string& name, const std::string& xml_alert); + + static bool newPromptCallback(const LLSD& notification, const LLSD& response); /// general purpose callbacks for dealing with color controllers - void onColorControlRMoved(LLUICtrl* ctrl, WLColorControl* userData); - void onColorControlGMoved(LLUICtrl* ctrl, WLColorControl* userData); - void onColorControlBMoved(LLUICtrl* ctrl, WLColorControl* userData); - void onColorControlIMoved(LLUICtrl* ctrl, WLColorControl* userData); - void onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* userData); + static void onColorControlRMoved(LLUICtrl* ctrl, void* userData); + static void onColorControlGMoved(LLUICtrl* ctrl, void* userData); + static void onColorControlBMoved(LLUICtrl* ctrl, void* userData); + static void onColorControlIMoved(LLUICtrl* ctrl, void* userData); + static void onFloatControlMoved(LLUICtrl* ctrl, void* userData); + static void onBoolToggle(LLUICtrl* ctrl, void* userData); /// lighting callbacks for glow - void onGlowRMoved(LLUICtrl* ctrl, WLColorControl* userData); + static void onGlowRMoved(LLUICtrl* ctrl, void* userData); //static void onGlowGMoved(LLUICtrl* ctrl, void* userData); - void onGlowBMoved(LLUICtrl* ctrl, WLColorControl* userData); + static void onGlowBMoved(LLUICtrl* ctrl, void* userData); /// lighting callbacks for sun - void onSunMoved(LLUICtrl* ctrl, WLColorControl* userData); + static void onSunMoved(LLUICtrl* ctrl, void* userData); + + /// handle if float is changed + static void onFloatTweakMoved(LLUICtrl* ctrl, void* userData); /// for handling when the star slider is moved to adjust the alpha - void onStarAlphaMoved(LLUICtrl* ctrl); + static void onStarAlphaMoved(LLUICtrl* ctrl, void* userData); /// when user hits the load preset button - void onNewPreset(); + static void onNewPreset(void* userData); /// when user hits the save preset button - void onSavePreset(); + static void onSavePreset(void* userData); /// prompts a user when overwriting a preset - bool saveAlertCallback(const LLSD& notification, const LLSD& response); + static bool saveAlertCallback(const LLSD& notification, const LLSD& response); /// when user hits the save preset button - void onDeletePreset(); + static void onDeletePreset(void* userData); /// prompts a user when overwriting a preset bool deleteAlertCallback(const LLSD& notification, const LLSD& response); /// what to do when you change the preset name - void onChangePresetName(LLUICtrl* ctrl); + static void onChangePresetName(LLUICtrl* ctrl, void* userData); /// when user hits the save preset button - void onOpenDayCycle(); + static void onOpenDayCycle(void* userData); /// handle cloud scrolling - void onCloudScrollXMoved(LLUICtrl* ctrl); - void onCloudScrollYMoved(LLUICtrl* ctrl); - void onCloudScrollXToggled(LLUICtrl* ctrl); - void onCloudScrollYToggled(LLUICtrl* ctrl); + static void onCloudScrollXMoved(LLUICtrl* ctrl, void* userData); + static void onCloudScrollYMoved(LLUICtrl* ctrl, void* userData); + static void onCloudScrollXToggled(LLUICtrl* ctrl, void* userData); + static void onCloudScrollYToggled(LLUICtrl* ctrl, void* userData); + + //// menu management + + /// show off our menu + static void show(LLEnvKey::EScope scope = LLEnvKey::SCOPE_LOCAL); + + /// return if the menu exists or not + static bool isOpen(); + + /// stuff to do on exit + virtual void onClose(bool app_quitting); /// sync up sliders with parameters void syncMenu(); - /// turn off animated skies - static void deactivateAnimator(); - private: - static std::set sDefaultPresets; + static LLFloaterWindLight* sWindLight; // one instance on the inside + static std::set sDefaultPresets; + static LLEnvKey::EScope sScope; + static std::string sOriginalTitle; }; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index c56cacd12b..7fa78ab386 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1153,8 +1153,6 @@ bool idle_startup() // init the shader managers LLPostProcess::initClass(); - LLWLParamManager::initClass(); - LLWaterParamManager::initClass(); LLViewerObject::initVOClasses(); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 916cbe2267..5b0cf72ac5 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -178,8 +178,8 @@ void display_update_camera() gViewerWindow->setup3DRender(); // update all the sky/atmospheric/water settings - LLWLParamManager::instance()->update(LLViewerCamera::getInstance()); - LLWaterParamManager::instance()->update(LLViewerCamera::getInstance()); + LLWLParamManager::getInstance()->update(LLViewerCamera::getInstance()); + LLWaterParamManager::getInstance()->update(LLViewerCamera::getInstance()); // Update land visibility too LLWorld::getInstance()->setLandFarClip(final_far); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index d4af5048c3..614eb6ed88 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7628,55 +7628,56 @@ class LLWorldEnvSettings : public view_listener_t LLFloaterReg::toggleInstance("env_settings"); return true; } - + else if(gSavedSettings.getBOOL("UseEnvironmentFromRegion")) + { + LLNotifications::instance().add("EnvLockedUsingRegion", LLSD()); + } + else + { if (tod == "sunrise") { // set the value, turn off animation - LLWLParamManager::instance()->mAnimator.setDayTime(0.25); - LLWLParamManager::instance()->mAnimator.mIsRunning = false; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + LLWLParamManager::getInstance()->mAnimator.setDayTime(0.25); + LLWLParamManager::getInstance()->mAnimator.deactivate(); // then call update once - LLWLParamManager::instance()->mAnimator.update( - LLWLParamManager::instance()->mCurParams); + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); } else if (tod == "noon") { // set the value, turn off animation - LLWLParamManager::instance()->mAnimator.setDayTime(0.567); - LLWLParamManager::instance()->mAnimator.mIsRunning = false; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + LLWLParamManager::getInstance()->mAnimator.setDayTime(0.567); + LLWLParamManager::getInstance()->mAnimator.deactivate(); // then call update once - LLWLParamManager::instance()->mAnimator.update( - LLWLParamManager::instance()->mCurParams); + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); } else if (tod == "sunset") { // set the value, turn off animation - LLWLParamManager::instance()->mAnimator.setDayTime(0.75); - LLWLParamManager::instance()->mAnimator.mIsRunning = false; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + LLWLParamManager::getInstance()->mAnimator.setDayTime(0.75); + LLWLParamManager::getInstance()->mAnimator.deactivate(); // then call update once - LLWLParamManager::instance()->mAnimator.update( - LLWLParamManager::instance()->mCurParams); + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); } else if (tod == "midnight") { // set the value, turn off animation - LLWLParamManager::instance()->mAnimator.setDayTime(0.0); - LLWLParamManager::instance()->mAnimator.mIsRunning = false; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; + LLWLParamManager::getInstance()->mAnimator.setDayTime(0.0); + LLWLParamManager::getInstance()->mAnimator.deactivate(); // then call update once - LLWLParamManager::instance()->mAnimator.update( - LLWLParamManager::instance()->mCurParams); + LLWLParamManager::getInstance()->mAnimator.update( + LLWLParamManager::getInstance()->mCurParams); } else { - LLWLParamManager::instance()->mAnimator.mIsRunning = true; - LLWLParamManager::instance()->mAnimator.mUseLindenTime = true; + LLWLParamManager::getInstance()->mAnimator.activate(LLWLAnimator::TIME_LINDEN); + } } return true; } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 98f16757b2..0ed254bbc5 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1365,6 +1365,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("DispatchRegionInfo"); capabilityNames.append("EstateChangeInfo"); capabilityNames.append("EventQueueGet"); + capabilityNames.append("EnvironmentSettings"); capabilityNames.append("FetchInventory"); capabilityNames.append("ObjectMedia"); capabilityNames.append("ObjectMediaNavigate"); @@ -1494,3 +1495,8 @@ std::string LLViewerRegion::getDescription() const { return stringize(*this); } + +std::string LLViewerRegion::getDescription() const +{ + return stringize(*this); +} diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 038c831e59..307e2cf3a2 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -405,6 +405,11 @@ private: /// (https://wiki.lindenlab.com/wiki/Viewer:Messaging/Messaging_Notes#Capabilities) LLCapabilityListener mCapabilityListener; + /// Post an event to this LLCapabilityListener to invoke a capability message on + /// this LLViewerRegion's server + /// (https://wiki.lindenlab.com/wiki/Viewer:Messaging/Messaging_Notes#Capabilities) + LLCapabilityListener mCapabilityListener; + private: bool mAlive; // can become false if circuit disconnects diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index d078c15316..fa30c1ae9e 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -1492,6 +1492,16 @@ std::string LLViewerShaderMgr::getShaderDirPrefix(void) void LLViewerShaderMgr::updateShaderUniforms(LLGLSLShader * shader) { - LLWLParamManager::instance()->updateShaderUniforms(shader); - LLWaterParamManager::instance()->updateShaderUniforms(shader); + LLWLParamManager::getInstance()->updateShaderUniforms(shader); + LLWaterParamManager::getInstance()->updateShaderUniforms(shader); +} + +LLViewerShaderMgr::shader_iter LLViewerShaderMgr::beginShaders() const +{ + return mShaderList.begin(); +} + +LLViewerShaderMgr::shader_iter LLViewerShaderMgr::endShaders() const +{ + return mShaderList.end(); } diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index db880fded6..e958cf1172 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -240,20 +240,12 @@ public: base_iter_t mIter; }; - shader_iter beginShaders() const - { - return mShaderList.begin(); - } - - shader_iter endShaders() const - { - return mShaderList.end(); - } - + shader_iter beginShaders() const; + shader_iter endShaders() const; - /* virtual */ std::string getShaderDirPrefix(void); // Virtual + /* virtual */ std::string getShaderDirPrefix(void); - /* virtual */ void updateShaderUniforms(LLGLSLShader * shader); // Virtual + /* virtual */ void updateShaderUniforms(LLGLSLShader * shader); private: diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 7ae8c2c07d..a6465f1c4f 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -356,7 +356,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) mAtmHeight = ATM_HEIGHT; mEarthCenter = LLVector3(mCameraPosAgent.mV[0], mCameraPosAgent.mV[1], -EARTH_RADIUS); - mSunDefaultPosition = LLVector3(LLWLParamManager::instance()->mCurParams.getVector("lightnorm", error)); + mSunDefaultPosition = LLVector3(LLWLParamManager::getInstance()->mCurParams.getVector("lightnorm", error)); if (gSavedSettings.getBOOL("SkyOverrideSimSunPosition")) { initSunDirection(mSunDefaultPosition, LLVector3(0, 0, 0)); @@ -638,24 +638,24 @@ void LLVOSky::initAtmospherics(void) bool error; // uniform parameters for convenience - dome_radius = LLWLParamManager::instance()->getDomeRadius(); - dome_offset_ratio = LLWLParamManager::instance()->getDomeOffset(); - sunlight_color = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("sunlight_color", error)); - ambient = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("ambient", error)); - //lightnorm = LLWLParamManager::instance()->mCurParams.getVector("lightnorm", error); - gamma = LLWLParamManager::instance()->mCurParams.getVector("gamma", error)[0]; - blue_density = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("blue_density", error)); - blue_horizon = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("blue_horizon", error)); - haze_density = LLWLParamManager::instance()->mCurParams.getVector("haze_density", error)[0]; - haze_horizon = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("haze_horizon", error)); - density_multiplier = LLWLParamManager::instance()->mCurParams.getVector("density_multiplier", error)[0]; - max_y = LLWLParamManager::instance()->mCurParams.getVector("max_y", error)[0]; - glow = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("glow", error)); - cloud_shadow = LLWLParamManager::instance()->mCurParams.getVector("cloud_shadow", error)[0]; - cloud_color = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("cloud_color", error)); - cloud_scale = LLWLParamManager::instance()->mCurParams.getVector("cloud_scale", error)[0]; - cloud_pos_density1 = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("cloud_pos_density1", error)); - cloud_pos_density2 = LLColor3(LLWLParamManager::instance()->mCurParams.getVector("cloud_pos_density2", error)); + dome_radius = LLWLParamManager::getInstance()->getDomeRadius(); + dome_offset_ratio = LLWLParamManager::getInstance()->getDomeOffset(); + sunlight_color = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("sunlight_color", error)); + ambient = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("ambient", error)); + //lightnorm = LLWLParamManager::getInstance()->mCurParams.getVector("lightnorm", error); + gamma = LLWLParamManager::getInstance()->mCurParams.getVector("gamma", error)[0]; + blue_density = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("blue_density", error)); + blue_horizon = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("blue_horizon", error)); + haze_density = LLWLParamManager::getInstance()->mCurParams.getVector("haze_density", error)[0]; + haze_horizon = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("haze_horizon", error)); + density_multiplier = LLWLParamManager::getInstance()->mCurParams.getVector("density_multiplier", error)[0]; + max_y = LLWLParamManager::getInstance()->mCurParams.getVector("max_y", error)[0]; + glow = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("glow", error)); + cloud_shadow = LLWLParamManager::getInstance()->mCurParams.getVector("cloud_shadow", error)[0]; + cloud_color = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("cloud_color", error)); + cloud_scale = LLWLParamManager::getInstance()->mCurParams.getVector("cloud_scale", error)[0]; + cloud_pos_density1 = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("cloud_pos_density1", error)); + cloud_pos_density2 = LLColor3(LLWLParamManager::getInstance()->mCurParams.getVector("cloud_pos_density2", error)); // light norm is different. We need the sun's direction, not the light direction // which could be from the moon. And we need to clamp it @@ -1025,7 +1025,7 @@ void LLVOSky::calcAtmospherics(void) // Since WL scales everything by 2, there should always be at least a 2:1 brightness ratio // between sunlight and point lights in windlight to normalize point lights. F32 sun_dynamic_range = llmax(gSavedSettings.getF32("RenderSunDynamicRange"), 0.0001f); - LLWLParamManager::instance()->mSceneLightStrength = 2.0f * (1.0f + sun_dynamic_range * dp); + LLWLParamManager::getInstance()->mSceneLightStrength = 2.0f * (1.0f + sun_dynamic_range * dp); mSunDiffuse = vary_SunlightColor; mSunAmbient = vary_AmbientColor; @@ -2115,7 +2115,7 @@ void LLVOSky::updateFog(const F32 distance) F32 depth = water_height - camera_height; // get the water param manager variables - float water_fog_density = LLWaterParamManager::instance()->getFogDensity(); + float water_fog_density = LLWaterParamManager::getInstance()->getFogDensity(); LLColor4 water_fog_color = LLDrawPoolWater::sWaterFogColor.mV; // adjust the color based on depth. We're doing linear approximations diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp index ca57c0144b..5cb61b8734 100644 --- a/indra/newview/llvowlsky.cpp +++ b/indra/newview/llvowlsky.cpp @@ -568,7 +568,7 @@ void LLVOWLSky::buildFanBuffer(LLStrider & vertices, LLStrider & texCoords, LLStrider & indices) { - const F32 RADIUS = LLWLParamManager::instance()->getDomeRadius(); + const F32 RADIUS = LLWLParamManager::getInstance()->getDomeRadius(); U32 i, num_slices; F32 phi0, theta, x0, y0, z0; @@ -629,7 +629,7 @@ void LLVOWLSky::buildStripsBuffer(U32 begin_stack, U32 end_stack, LLStrider & texCoords, LLStrider & indices) { - const F32 RADIUS = LLWLParamManager::instance()->getDomeRadius(); + const F32 RADIUS = LLWLParamManager::getInstance()->getDomeRadius(); U32 i, j, num_slices, num_stacks; F32 phi0, theta, x0, y0, z0; diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 7314894c2e..c984938303 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -57,8 +57,6 @@ #include "curl/curl.h" -LLWaterParamManager * LLWaterParamManager::sInstance = NULL; - LLWaterParamManager::LLWaterParamManager() : mFogColor(22.f/255.f, 43.f/255.f, 54.f/255.f, 0.0f, 0.0f, "waterFogColor", "WaterFogColor"), mFogDensity(4, "waterFogDensity", 2), @@ -246,7 +244,7 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader) { if (shader->mShaderGroup == LLGLSLShader::SG_WATER) { - shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, LLWLParamManager::instance()->getRotatedLightDir().mV); + shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, LLWLParamManager::getInstance()->getRotatedLightDir().mV); shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV); shader->uniform4fv("waterFogColor", 1, LLDrawPoolWater::sWaterFogColor.mV); shader->uniform4fv("waterPlane", 1, mWaterPlane.mV); @@ -320,19 +318,6 @@ void LLWaterParamManager::update(LLViewerCamera * cam) } } -// static -void LLWaterParamManager::initClass(void) -{ - instance(); -} - -// static -void LLWaterParamManager::cleanupClass(void) -{ - delete sInstance; - sInstance = NULL; -} - bool LLWaterParamManager::addParamSet(const std::string& name, LLWaterParamSet& param) { // add a new one if not one there already @@ -439,17 +424,9 @@ F32 LLWaterParamManager::getFogDensity(void) return fogDensity; } -// static -LLWaterParamManager * LLWaterParamManager::instance() +// virtual static +void LLWaterParamManager::initSingleton() { - if(NULL == sInstance) - { - sInstance = new LLWaterParamManager(); - - sInstance->loadAllPresets(LLStringUtil::null); - - sInstance->getParamSet("Default", sInstance->mCurParams); - } - - return sInstance; + loadAllPresets(LLStringUtil::null); + getParamSet("Default", mCurParams); } diff --git a/indra/newview/llwaterparammanager.h b/indra/newview/llwaterparammanager.h index c479f1861c..d5919bbf68 100644 --- a/indra/newview/llwaterparammanager.h +++ b/indra/newview/llwaterparammanager.h @@ -212,13 +212,10 @@ struct WaterExpFloatControl /// WindLight parameter manager class - what controls all the wind light shaders -class LLWaterParamManager +class LLWaterParamManager : public LLSingleton { public: - LLWaterParamManager(); - ~LLWaterParamManager(); - /// load a preset file void loadAllPresets(const std::string & fileName); @@ -238,9 +235,6 @@ public: /// Update shader uniforms that have changed. void updateShaderUniforms(LLGLSLShader * shader); - /// Perform global initialization for this class. - static void initClass(void); - // Cleanup of global data that's only inited once per class. static void cleanupClass(); @@ -281,9 +275,6 @@ public: F32 getFogDensity(void); LLColor4 getFogColor(void); - // singleton pattern implementation - static LLWaterParamManager * instance(); - public: LLWaterParamSet mCurParams; @@ -311,11 +302,13 @@ public: F32 mDensitySliderValue; private: + friend class LLSingleton; + /*virtual*/ void initSingleton(); + LLWaterParamManager(); + ~LLWaterParamManager(); + LLVector4 mWaterPlane; F32 mWaterFogKS; - - // our parameter manager singleton instance - static LLWaterParamManager * sInstance; }; inline void LLWaterParamManager::setDensitySliderValue(F32 val) diff --git a/indra/newview/llwaterparamset.cpp b/indra/newview/llwaterparamset.cpp index 9457d631be..488b189e94 100644 --- a/indra/newview/llwaterparamset.cpp +++ b/indra/newview/llwaterparamset.cpp @@ -224,3 +224,46 @@ F32 LLWaterParamSet::getFloat(const std::string& paramName, bool& error) return 0; } +// Added for interpolation effect in DEV-33645 +// Based on LLWLParamSet::mix, but written by Jacob without an intimate knowledge of how WindLight works. +// The function definition existed in the header but was never implemented. If you think there is something +// wrong with this, you're probably right. Ask Jacob, Q, or a member of the original WindLight team. +void LLWaterParamSet::mix(LLWaterParamSet& src, LLWaterParamSet& dest, F32 weight) +{ + // Setup + LLSD srcVal, destVal; // LLSD holders for get/set calls, reusable + + // Iterate through values + for(LLSD::map_iterator iter = mParamValues.beginMap(); iter != mParamValues.endMap(); ++iter) + { + // If param exists in both src and dest, set the holder variables, otherwise skip + if(src.mParamValues.has(iter->first) && dest.mParamValues.has(iter->first)) + { + srcVal = src.mParamValues[iter->first]; + destVal = dest.mParamValues[iter->first]; + } + else + { + continue; + } + + if(iter->second.isReal()) // If it's a real, interpolate directly + { + iter->second = srcVal.asReal() + ((destVal.asReal() - srcVal.asReal()) * weight); + } + else if(iter->second.isArray() && iter->second[0].isReal() // If it's an array of reals, loop through the reals and interpolate on those + && iter->second.size() == srcVal.size() && iter->second.size() == destVal.size()) + { + // Actually do interpolation: old value + (difference in values * factor) + for(int i=0; i < iter->second.size(); ++i) + { + // iter->second[i] = (1.f-weight)*(F32)srcVal[i].asReal() + weight*(F32)destVal[i].asReal(); // old way of doing it -- equivalent but one more operation + iter->second[i] = srcVal[i].asReal() + ((destVal[i].asReal() - srcVal[i].asReal()) * weight); + } + } + else // Else, skip + { + continue; + } + } +} diff --git a/indra/newview/llwlanimator.cpp b/indra/newview/llwlanimator.cpp index a94a2e41aa..2e249b9701 100644 --- a/indra/newview/llwlanimator.cpp +++ b/indra/newview/llwlanimator.cpp @@ -30,20 +30,31 @@ #include "llsky.h" #include "pipeline.h" #include "llwlparammanager.h" +#include "llwaterparammanager.h" -LLWLAnimator::LLWLAnimator() : mStartTime(0), mDayRate(1), mDayTime(0), - mIsRunning(FALSE), mUseLindenTime(false) +extern LLControlGroup gSavedSettings; + +F64 LLWLAnimator::INTERP_TOTAL_SECONDS = 3.f; + +LLWLAnimator::LLWLAnimator() : mStartTime(0.f), mDayRate(1.f), mDayTime(0.f), + mIsRunning(FALSE), mIsInterpolating(FALSE), mTimeType(TIME_LINDEN), + mInterpStartTime(), mInterpEndTime() { - mDayTime = 0; + mInterpBeginWL = new LLWLParamSet(); + mInterpBeginWater = new LLWaterParamSet(); + mInterpEndWater = new LLWaterParamSet(); } void LLWLAnimator::update(LLWLParamSet& curParams) { + llassert(mUseLindenTime != mUseLocalTime); + F64 curTime; curTime = getDayTime(); // don't do anything if empty - if(mTimeTrack.size() == 0) { + if(mTimeTrack.size() == 0) + { return; } @@ -53,13 +64,15 @@ void LLWLAnimator::update(LLWLParamSet& curParams) mSecondIt++; // grab the two tween iterators - while(mSecondIt != mTimeTrack.end() && curTime > mSecondIt->first) { + while(mSecondIt != mTimeTrack.end() && curTime > mSecondIt->first) + { mFirstIt++; mSecondIt++; } // scroll it around when you get to the end - if(mSecondIt == mTimeTrack.end() || mFirstIt->first > curTime) { + if(mSecondIt == mTimeTrack.end() || mFirstIt->first > curTime) + { mSecondIt = mTimeTrack.begin(); mFirstIt = mTimeTrack.end(); mFirstIt--; @@ -67,70 +80,109 @@ void LLWLAnimator::update(LLWLParamSet& curParams) F32 weight = 0; - if(mFirstIt->first < mSecondIt->first) { + if(mFirstIt->first < mSecondIt->first) + { // get the delta time and the proper weight weight = F32 (curTime - mFirstIt->first) / (mSecondIt->first - mFirstIt->first); // handle the ends - } else if(mFirstIt->first > mSecondIt->first) { + } + else if(mFirstIt->first > mSecondIt->first) + { // right edge of time line - if(curTime >= mFirstIt->first) { + if(curTime >= mFirstIt->first) + { weight = F32 (curTime - mFirstIt->first) / ((1 + mSecondIt->first) - mFirstIt->first); - // left edge of time line - } else { + } + else + { weight = F32 ((1 + curTime) - mFirstIt->first) / ((1 + mSecondIt->first) - mFirstIt->first); } - // handle same as whatever the last one is - } else { + } + else + { weight = 1; } + if(mIsInterpolating) + { + // *TODO_JACOB: this is kind of laggy. Not sure why. The part that lags is the curParams.mix call, and none of the other mixes. It works, though. + clock_t current = clock(); + if(current >= mInterpEndTime) + { + mIsInterpolating = false; + return; + } + + // determine moving target for final interpolation value + LLWLParamSet buf = LLWLParamSet(); + buf.setAll(LLWLParamManager::getInstance()->mParamList[mFirstIt->second].getAll()); // just give it some values, otherwise it has no params to begin with (see comment in constructor) + buf.mix(LLWLParamManager::getInstance()->mParamList[mFirstIt->second], LLWLParamManager::getInstance()->mParamList[mSecondIt->second], weight); // mix to determine moving target for interpolation finish (as below) + + // mix from previous value to moving target + weight = (current - mInterpStartTime) / (INTERP_TOTAL_SECONDS * CLOCKS_PER_SEC); + curParams.mix(*mInterpBeginWL, buf, weight); + + // mix water + LLWaterParamManager::getInstance()->mCurParams.mix(*mInterpBeginWater, *mInterpEndWater, weight); + } + else + { // do the interpolation and set the parameters - curParams.mix(LLWLParamManager::instance()->mParamList[mFirstIt->second], - LLWLParamManager::instance()->mParamList[mSecondIt->second], weight); + curParams.mix(LLWLParamManager::getInstance()->mParamList[mFirstIt->second], LLWLParamManager::getInstance()->mParamList[mSecondIt->second], weight); + } } F64 LLWLAnimator::getDayTime() { - if(!mIsRunning) { + if(!mIsRunning) + { return mDayTime; } - - if(mUseLindenTime) { - + else if(mTimeType == TIME_LINDEN) + { F32 phase = gSky.getSunPhase() / F_PI; // we're not solving the non-linear equation that determines sun phase // we're just linearly interpolating between the major points if (phase <= 5.0 / 4.0) { mDayTime = (1.0 / 3.0) * phase + (1.0 / 3.0); - } else { + } + else + { mDayTime = phase - (1.0 / 2.0); } - if(mDayTime > 1) { + if(mDayTime > 1) + { mDayTime--; } return mDayTime; } + else if(mTimeType == TIME_LOCAL) + { + return getLocalTime(); + } // get the time; mDayTime = (LLTimer::getElapsedSeconds() - mStartTime) / mDayRate; // clamp it - if(mDayTime < 0) { + if(mDayTime < 0) + { mDayTime = 0; } - while(mDayTime > 1) { + while(mDayTime > 1) + { mDayTime--; } @@ -144,15 +196,18 @@ void LLWLAnimator::setDayTime(F64 dayTime) mDayTime = dayTime; // clamp it - if(mDayTime < 0) { + if(mDayTime < 0) + { mDayTime = 0; - } else if(mDayTime > 1) { + } + else if(mDayTime > 1) + { mDayTime = 1; } } -void LLWLAnimator::setTrack(std::map& curTrack, +void LLWLAnimator::setTrack(std::map& curTrack, F32 dayRate, F64 dayTime, bool run) { mTimeTrack = curTrack; @@ -161,3 +216,96 @@ void LLWLAnimator::setTrack(std::map& curTrack, mIsRunning = run; } + +void LLWLAnimator::startInterpolation(LLSD& targetWater) +{ + mInterpBeginWL->setAll(LLWLParamManager::getInstance()->mCurParams.getAll()); + mInterpBeginWater->setAll(LLWaterParamManager::getInstance()->mCurParams.getAll()); + + mInterpStartTime = clock(); + mInterpEndTime = mInterpStartTime + clock_t(INTERP_TOTAL_SECONDS) * CLOCKS_PER_SEC; + + // Don't set any ending WL -- this is continuously calculated as the animator updates since it's a moving target + mInterpEndWater->setAll(targetWater); + + mIsInterpolating = true; +} + +std::string LLWLAnimator::timeToString(F32 curTime) +{ + S32 hours; + S32 min; + bool isPM = false; + + // get hours and minutes + hours = (S32) (24.0 * curTime); + curTime -= ((F32) hours / 24.0f); + min = llround(24.0f * 60.0f * curTime); + + // handle case where it's 60 + if(min == 60) + { + hours++; + min = 0; + } + + // set for PM + if(hours >= 12 && hours < 24) + { + isPM = true; + } + + // convert to non-military notation + if(hours >= 24) + { + hours = 12; + } + else if(hours > 12) + { + hours -= 12; + } + else if(hours == 0) + { + hours = 12; + } + + // make the string + std::stringstream newTime; + newTime << hours << ":"; + + // double 0 + if(min < 10) + { + newTime << 0; + } + + // finish it + newTime << min << " "; + if(isPM) + { + newTime << "PM"; + } + else + { + newTime << "AM"; + } + + return newTime.str(); +} + +F64 LLWLAnimator::getLocalTime() +{ + char buffer[9]; + time_t rawtime; + struct tm* timeinfo; + + time(&rawtime); + timeinfo = localtime(&rawtime); + strftime(buffer, 9, "%H:%M:%S", timeinfo); + std::string timeStr(buffer); + + F64 tod = ((F64)atoi(timeStr.substr(0,2).c_str())) / 24.f + + ((F64)atoi(timeStr.substr(3,2).c_str())) / 1440.f + + ((F64)atoi(timeStr.substr(6,2).c_str())) / 86400.f; + return tod; +} diff --git a/indra/newview/llwlanimator.h b/indra/newview/llwlanimator.h index 5677290213..07c2fa2328 100644 --- a/indra/newview/llwlanimator.h +++ b/indra/newview/llwlanimator.h @@ -28,28 +28,39 @@ #define LL_WL_ANIMATOR_H #include "llwlparamset.h" +#include "llwaterparamset.h" #include #include +struct LLWLParamKey; + class LLWLAnimator { public: + typedef enum e_time + { + TIME_LINDEN, + TIME_LOCAL, + TIME_CUSTOM + } ETime; + F64 mStartTime; F32 mDayRate; F64 mDayTime; // track to play - std::map mTimeTrack; - std::map::iterator mFirstIt, mSecondIt; - - // params to use - //std::map mParamList; - - bool mIsRunning; - bool mUseLindenTime; + std::map mTimeTrack; + std::map::iterator mFirstIt, mSecondIt; // simple constructor LLWLAnimator(); + ~LLWLAnimator() + { + delete mInterpBeginWL; + delete mInterpBeginWater; + delete mInterpEndWater; + } + // update the parameters void update(LLWLParamSet& curParams); @@ -63,9 +74,66 @@ public: void setDayTime(F64 dayTime); // set an animation track - void setTrack(std::map& track, + void setTrack(std::map& track, F32 dayRate, F64 dayTime = 0, bool run = true); + void deactivate() + { + mIsRunning = false; + } + + void activate(ETime time) + { + mIsRunning = true; + mTimeType = time; + } + + void startInterpolation(LLSD& targetWater); + + bool getIsRunning() + { + return mIsRunning; + } + + bool getUseCustomTime() + { + return mTimeType == TIME_CUSTOM; + } + + bool getUseLocalTime() + { + return mTimeType == TIME_LOCAL; + } + + bool getUseLindenTime() + { + return mTimeType == TIME_LINDEN; + } + + void setTimeType(ETime time) + { + mTimeType = time; + } + + ETime getTimeType() + { + return mTimeType; + } + + /// convert the present time to a digital clock time + static std::string timeToString(F32 curTime); + + /// get local time between 0 and 1 + static F64 getLocalTime(); + +private: + ETime mTimeType; + bool mIsRunning, mIsInterpolating; + LLWLParamSet *mInterpBeginWL; + LLWaterParamSet *mInterpBeginWater, *mInterpEndWater; + clock_t mInterpStartTime, mInterpEndTime; + + static F64 INTERP_TOTAL_SECONDS; }; #endif // LL_WL_ANIMATOR_H diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp index 85b3d62a49..52bbb4b5fc 100644 --- a/indra/newview/llwldaycycle.cpp +++ b/indra/newview/llwldaycycle.cpp @@ -2,37 +2,42 @@ * @file llwldaycycle.cpp * @brief Implementation for the LLWLDayCycle class. * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, 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. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * 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. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * 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 + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ #include "llviewerprecompiledheaders.h" #include "llwldaycycle.h" - -#include "llnotificationsutil.h" #include "llsdserialize.h" -#include "llxmlnode.h" - #include "llwlparammanager.h" +#include "llfloaterdaycycle.h" + +#include "llviewerwindow.h" #include @@ -45,85 +50,111 @@ LLWLDayCycle::~LLWLDayCycle() { } -void LLWLDayCycle::loadDayCycle(const std::string & fileName) +void LLWLDayCycle::loadDayCycle(const LLSD& day_data, LLWLParamKey::EScope scope) { - // clear the first few things mTimeMap.clear(); - // now load the file - std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, - "windlight/days", fileName)); - llinfos << "Loading DayCycle settings from " << pathName << llendl; - - llifstream day_cycle_xml(pathName); - if (day_cycle_xml.is_open()) + // add each key frame + for(S32 i = 0; i < day_data.size(); ++i) { - // load and parse it - LLSD day_data(LLSD::emptyArray()); - LLPointer parser = new LLSDXMLParser(); - parser->parse(day_cycle_xml, day_data, LLSDSerialize::SIZE_UNLIMITED); - - // add each key - for(S32 i = 0; i < day_data.size(); ++i) + // make sure it's a two array + if(day_data[i].size() != 2) + { + continue; + } + + // check each param key exists in param manager + bool success; + LLWLParamSet pset; + LLWLParamKey frame = LLWLParamKey(day_data[i][1].asString(), scope); + success = + LLWLParamManager::getInstance()->getParamSet(frame, pset); + if(!success) { - // make sure it's a two array - if(day_data[i].size() != 2) + // *HACK try the local-scope ones for "A-something" defaults + // (because our envManager.lindenDefault() doesn't have the skies yet) + if (frame.name.find("A-") == 0) { - continue; + frame.scope = LLEnvKey::SCOPE_LOCAL; + success = LLWLParamManager::getInstance()->getParamSet(frame, pset); } - - // check each param name exists in param manager - bool success; - LLWLParamSet pset; - success = LLWLParamManager::instance()->getParamSet(day_data[i][1].asString(), pset); - if(!success) + + if (!success) { // alert the user LLSD args; args["SKY"] = day_data[i][1].asString(); - LLNotificationsUtil::add("WLMissingSky", args); + LLNotifications::instance().add("WLMissingSky", args); continue; } - - // then add the key - addKey((F32)day_data[i][0].asReal(), day_data[i][1].asString()); } + + // then add the keyframe + addKeyframe((F32)day_data[i][0].asReal(), frame); + } +} + +void LLWLDayCycle::loadDayCycleFromFile(const std::string & fileName) +{ + loadDayCycle(loadCycleDataFromFile(fileName), LLWLParamKey::SCOPE_LOCAL); +} +/*static*/ LLSD LLWLDayCycle::loadCycleDataFromFile(const std::string & fileName) +{ + // now load the file + std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, + "windlight/days", fileName)); + llinfos << "Loading DayCycle settings from " << pathName << llendl; + + llifstream day_cycle_xml(pathName); + if (day_cycle_xml.is_open()) + { + // load and parse it + LLSD day_data(LLSD::emptyArray()); + LLPointer parser = new LLSDXMLParser(); + parser->parse(day_cycle_xml, day_data, LLSDSerialize::SIZE_UNLIMITED); day_cycle_xml.close(); + return day_data; + } + else + { + return LLSD(); } } void LLWLDayCycle::saveDayCycle(const std::string & fileName) { - LLSD day_data(LLSD::emptyArray()); + LLSD day_data = asLLSD(); std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", fileName)); //llinfos << "Saving WindLight settings to " << pathName << llendl; - for(std::map::const_iterator mIt = mTimeMap.begin(); - mIt != mTimeMap.end(); - ++mIt) - { - LLSD key(LLSD::emptyArray()); - key.append(mIt->first); - key.append(mIt->second); - day_data.append(key); - } - llofstream day_cycle_xml(pathName); LLPointer formatter = new LLSDXMLFormatter(); formatter->format(day_data, day_cycle_xml, LLSDFormatter::OPTIONS_PRETTY); day_cycle_xml.close(); } +LLSD LLWLDayCycle::asLLSD() +{ + LLSD day_data(LLSD::emptyArray()); + for(std::map::const_iterator mIt = mTimeMap.begin(); mIt != mTimeMap.end(); ++mIt) + { + LLSD key(LLSD::emptyArray()); + key.append(mIt->first); + key.append(mIt->second.name); + day_data.append(key); + } + return day_data; +} -void LLWLDayCycle::clearKeys() +void LLWLDayCycle::clearKeyframes() { mTimeMap.clear(); } -bool LLWLDayCycle::addKey(F32 newTime, const std::string & paramName) +bool LLWLDayCycle::addKeyframe(F32 newTime, LLWLParamKey frame) { // no adding negative time if(newTime < 0) @@ -134,7 +165,7 @@ bool LLWLDayCycle::addKey(F32 newTime, const std::string & paramName) // if time not being used, add it and return true if(mTimeMap.find(newTime) == mTimeMap.end()) { - mTimeMap.insert(std::pair(newTime, paramName)); + mTimeMap.insert(std::pair(newTime, frame)); return true; } @@ -142,40 +173,40 @@ bool LLWLDayCycle::addKey(F32 newTime, const std::string & paramName) return false; } -bool LLWLDayCycle::changeKeyTime(F32 oldTime, F32 newTime) +bool LLWLDayCycle::changeKeyframeTime(F32 oldTime, F32 newTime) { // just remove and add back - std::string name = mTimeMap[oldTime]; + LLWLParamKey frame = mTimeMap[oldTime]; - bool stat = removeKey(oldTime); + bool stat = removeKeyframe(oldTime); if(stat == false) { return stat; } - return addKey(newTime, name); + return addKeyframe(newTime, frame); } -bool LLWLDayCycle::changeKeyParam(F32 time, const std::string & name) +bool LLWLDayCycle::changeKeyframeParam(F32 time, LLWLParamKey key) { // just remove and add back // make sure param exists LLWLParamSet tmp; - bool stat = LLWLParamManager::instance()->getParamSet(name, tmp); + bool stat = LLWLParamManager::getInstance()->getParamSet(key, tmp); if(stat == false) { return stat; } - mTimeMap[time] = name; + mTimeMap[time] = key; return true; } -bool LLWLDayCycle::removeKey(F32 time) +bool LLWLDayCycle::removeKeyframe(F32 time) { // look for the time. If there, erase it - std::map::iterator mIt = mTimeMap.find(time); + std::map::iterator mIt = mTimeMap.find(time); if(mIt != mTimeMap.end()) { mTimeMap.erase(mIt); @@ -185,15 +216,15 @@ bool LLWLDayCycle::removeKey(F32 time) return false; } -bool LLWLDayCycle::getKey(const std::string & name, F32& key) +bool LLWLDayCycle::getKeytime(LLWLParamKey frame, F32& key_time) { - // scroll through till we find the - std::map::iterator mIt = mTimeMap.begin(); + // scroll through till we find the correct value in the map + std::map::iterator mIt = mTimeMap.begin(); for(; mIt != mTimeMap.end(); ++mIt) { - if(name == mIt->second) + if(frame == mIt->second) { - key = mIt->first; + key_time = mIt->first; return true; } } @@ -204,10 +235,10 @@ bool LLWLDayCycle::getKey(const std::string & name, F32& key) bool LLWLDayCycle::getKeyedParam(F32 time, LLWLParamSet& param) { // just scroll on through till you find it - std::map::iterator mIt = mTimeMap.find(time); - if(mIt != mTimeMap.end()) + std::map::iterator mIt = mTimeMap.find(time); + if(mIt != mTimeMap.end()) { - return LLWLParamManager::instance()->getParamSet(mIt->second, param); + return LLWLParamManager::getInstance()->getParamSet(mIt->second, param); } // return error if not found @@ -217,13 +248,30 @@ bool LLWLDayCycle::getKeyedParam(F32 time, LLWLParamSet& param) bool LLWLDayCycle::getKeyedParamName(F32 time, std::string & name) { // just scroll on through till you find it - std::map::iterator mIt = mTimeMap.find(time); + std::map::iterator mIt = mTimeMap.find(time); if(mIt != mTimeMap.end()) { - name = mTimeMap[time]; + name = mTimeMap[time].name; return true; } // return error if not found return false; } + +void LLWLDayCycle::removeReferencesTo(const LLWLParamKey& keyframe) +{ + F32 keytime; + bool might_exist; + do + { + // look for it + might_exist = getKeytime(keyframe, keytime); + if(!might_exist) + { + return; + } + might_exist = removeKeyframe(keytime); + + } while(might_exist); // might be another one +} diff --git a/indra/newview/llwldaycycle.h b/indra/newview/llwldaycycle.h index 5cbf72191d..d56194a74a 100644 --- a/indra/newview/llwldaycycle.h +++ b/indra/newview/llwldaycycle.h @@ -34,13 +34,15 @@ class LLWLDayCycle; #include #include "llwlparamset.h" #include "llwlanimator.h" +struct LLWLParamKey; +#include "llenvmanager.h" // for LLEnvKey::EScope class LLWLDayCycle { public: // lists what param sets are used when during the day - std::map mTimeMap; + std::map mTimeMap; // how long is my day F32 mDayRate; @@ -54,35 +56,44 @@ public: ~LLWLDayCycle(); /// load a day cycle - void loadDayCycle(const std::string & fileName); + void loadDayCycle(const LLSD& llsd, LLEnvKey::EScope scope); + + /// load a day cycle + void loadDayCycleFromFile(const std::string & fileName); /// load a day cycle void saveDayCycle(const std::string & fileName); - /// clear keys - void clearKeys(); + /// load the LLSD data from a file (returns the undefined LLSD if not found) + static LLSD loadCycleDataFromFile(const std::string & fileName); + + /// get the LLSD data for this day cycle + LLSD asLLSD(); + + /// clear keyframes + void clearKeyframes(); /// Getters and Setters /// add a new key frame to the day cycle /// returns true if successful /// no negative time - bool addKey(F32 newTime, const std::string & paramName); + bool addKeyframe(F32 newTime, LLWLParamKey key); - /// adjust a key's placement in the day cycle + /// adjust a keyframe's placement in the day cycle /// returns true if successful - bool changeKeyTime(F32 oldTime, F32 newTime); + bool changeKeyframeTime(F32 oldTime, F32 newTime); - /// adjust a key's parameter used + /// adjust a keyframe's parameter used /// returns true if successful - bool changeKeyParam(F32 time, const std::string & paramName); + bool changeKeyframeParam(F32 time, LLWLParamKey key); - /// remove a key from the day cycle + /// remove a key frame from the day cycle /// returns true if successful - bool removeKey(F32 time); + bool removeKeyframe(F32 time); /// get the first key time for a parameter /// returns false if not there - bool getKey(const std::string & name, F32& key); + bool getKeytime(LLWLParamKey keyFrame, F32& keyTime); /// get the param set at a given time /// returns true if found one @@ -92,6 +103,9 @@ public: /// returns true if it found one bool getKeyedParamName(F32 time, std::string & name); + /// removes all references to the sky (paramkey) + /// does nothing if the sky doesn't exist in the day + void removeReferencesTo(const LLWLParamKey& keyframe); }; diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp new file mode 100644 index 0000000000..c4f11cf00a --- /dev/null +++ b/indra/newview/llwlhandlers.cpp @@ -0,0 +1,159 @@ +/** + * @file llwlhandlers.cpp + * @brief Various classes which handle Windlight-related messaging + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llwlhandlers.h" + +#include "llagent.h" +#include "llviewerregion.h" +#include "llenvmanager.h" + +/**** + * LLEnvironmentRequestResponder + ****/ +int LLEnvironmentRequestResponder::sCount = 0; // init to 0 + +/*static*/ bool LLEnvironmentRequestResponder::initiateRequest() +{ + std::string url = gAgent.getRegion()->getCapability("EnvironmentSettings"); + if (url.empty()) + { + LL_INFOS("WindlightCaps") << "Skipping windlight setting request - we don't have this capability" << LL_ENDL; + // region is apparently not capable of this; don't respond at all + return false; + } + else + { + LL_DEBUGS("WindlightCaps") << "Requesting windlight settings via " << url << LL_ENDL; + LLHTTPClient::get(url, new LLEnvironmentRequestResponder()); + return true; + } +} +LLEnvironmentRequestResponder::LLEnvironmentRequestResponder() +{ + mID = ++sCount; +} +/*virtual*/ void LLEnvironmentRequestResponder::result(const LLSD& unvalidated_content) +{ + LL_DEBUGS("WindlightCaps") << "Receiving windlight settings..." << LL_ENDL; + + if (mID != sCount) + { + LL_INFOS("WindlightCaps") << "Got superseded by another responder; ignoring..." << LL_ENDL; + return; + } + + if (unvalidated_content[0]["regionID"].asUUID() != gAgent.getRegion()->getRegionID()) + { + LL_WARNS("WindlightCaps") << "Not in the region from where this data was received (wanting " + << gAgent.getRegion()->getRegionID() << " but got " << unvalidated_content[0]["regionID"].asUUID() + << ") - ignoring..." << LL_ENDL; + return; + } + + LLEnvManager::getInstance()->processIncomingMessage(unvalidated_content, LLEnvKey::SCOPE_REGION); +} +/*virtual*/ void LLEnvironmentRequestResponder::error(U32 status, const std::string& reason) +{ + LL_INFOS("WindlightCaps") << "Got an error, not using region windlight..." << LL_ENDL; + // notify manager that region settings are undefined + LLEnvManager::getInstance()->processIncomingMessage(LLSD(), LLEnvKey::SCOPE_REGION); +} + + +/**** + * LLEnvironmentApplyResponder + ****/ +clock_t LLEnvironmentApplyResponder::UPDATE_WAIT_SECONDS = clock_t(3.f); +clock_t LLEnvironmentApplyResponder::sLastUpdate = clock_t(0.f); + +bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content) +{ + clock_t current = clock(); + if(current >= sLastUpdate + (UPDATE_WAIT_SECONDS * CLOCKS_PER_SEC)) + { + sLastUpdate = current; + } + else + { + LLSD args(LLSD::emptyMap()); + args["WAIT"] = (F64)UPDATE_WAIT_SECONDS; + LLNotifications::instance().add("EnvUpdateRate", args); + return false; + } + + std::string url = gAgent.getRegion()->getCapability("EnvironmentSettings"); + if (!url.empty()) + { + LL_INFOS("WindlightCaps") << "Sending windlight settings to " << url << LL_ENDL; + LLHTTPClient::post(url, content, new LLEnvironmentApplyResponder()); + return true; + } + return false; +} +/*virtual*/ void LLEnvironmentApplyResponder::result(const LLSD& content) +{ + if (content["regionID"].asUUID() != gAgent.getRegion()->getRegionID()) + { + LL_WARNS("WindlightCaps") << "No longer in the region where data was sent (currently " + << gAgent.getRegion()->getRegionID() << ", reply is from " << content["regionID"].asUUID() + << "); ignoring..." << LL_ENDL; + return; + } + else if (content["success"].asBoolean()) + { + LL_DEBUGS("WindlightCaps") << "Success in applying windlight settings to region " << content["regionID"].asUUID() << LL_ENDL; + } + else + { + LL_WARNS("WindlightCaps") << "Region couldn't apply windlight settings! Reason from sim: " << content["fail_reason"].asString() << LL_ENDL; + LLSD args(LLSD::emptyMap()); + args["FAIL_REASON"] = content["fail_reason"].asString(); + LLNotifications::instance().add("WLRegionApplyFail", args); + } + + LLEnvManager::getInstance()->commitSettingsFinished(LLEnvKey::SCOPE_REGION); +} +/*virtual*/ void LLEnvironmentApplyResponder::error(U32 status, const std::string& reason) +{ + std::stringstream msg; + msg << reason << " (Code " << status << ")"; + + LL_WARNS("WindlightCaps") << "Couldn't apply windlight settings to region! Reason: " << msg << LL_ENDL; + + LLSD args(LLSD::emptyMap()); + args["FAIL_REASON"] = msg.str(); + LLNotifications::instance().add("WLRegionApplyFail", args); + + LLEnvManager::getInstance()->commitSettingsFinished(LLEnvKey::SCOPE_REGION); +} diff --git a/indra/newview/llwlhandlers.h b/indra/newview/llwlhandlers.h new file mode 100644 index 0000000000..a50404f2e1 --- /dev/null +++ b/indra/newview/llwlhandlers.h @@ -0,0 +1,89 @@ +/** + * @file llwlhandlers.h + * @brief Headers for classes in llwlhandlers.cpp + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLWLHANDLERS_H +#define LL_LLWLHANDLERS_H + +#include "llviewerprecompiledheaders.h" + +class LLEnvManager; + +class LLEnvironmentRequestResponder: public LLHTTPClient::Responder +{ +public: + virtual void result(const LLSD& content); + virtual void error(U32 status, const std::string& reason); + +private: + friend class LLEnvManager; + // returns true if request was sucessfully sent + static bool initiateRequest(); + + LLEnvironmentRequestResponder(); + static int sCount; + int mID; +}; + +class LLEnvironmentApplyResponder: public LLHTTPClient::Responder +{ +public: + /* + * Expecting reply from sim in form of: + * { + * regionID : uuid, + * messageID: uuid, + * success : true + * } + * or + * { + * regionID : uuid, + * success : false, + * fail_reason : string + * } + */ + virtual void result(const LLSD& content); + + virtual void error(U32 status, const std::string& reason); // non-200 errors only + +private: + friend class LLEnvManager; + + static clock_t sLastUpdate; + static clock_t UPDATE_WAIT_SECONDS; + + // for format of packet expected, see llwlscrubbers.cpp in llmessage + static bool initiateRequest(const LLSD& packet); + + LLEnvironmentApplyResponder() {} +}; + +#endif // LL_LLWLHANDLERS_H diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index 9b6047395a..493d066942 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -2,25 +2,31 @@ * @file llwlparammanager.cpp * @brief Implementation for the LLWLParamManager class. * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, 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. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * 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. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * 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 + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -31,28 +37,34 @@ #include "pipeline.h" #include "llsky.h" -#include "llfloaterreg.h" #include "llsliderctrl.h" #include "llspinctrl.h" #include "llcheckboxctrl.h" #include "lluictrlfactory.h" +#include "llviewercamera.h" #include "llcombobox.h" #include "lllineeditor.h" #include "llsdserialize.h" #include "v4math.h" +#include "llviewerdisplay.h" #include "llviewercontrol.h" +#include "llviewerwindow.h" +#include "lldrawpoolwater.h" +#include "llagent.h" +#include "llviewerregion.h" +#include "llenvmanager.h" #include "llwlparamset.h" #include "llpostprocess.h" #include "llfloaterwindlight.h" #include "llfloaterdaycycle.h" #include "llfloaterenvsettings.h" +#include "llviewershadermgr.h" +#include "llglslshader.h" #include "curl/curl.h" - -LLWLParamManager * LLWLParamManager::sInstance = NULL; -static LLFastTimer::DeclareTimer FTM_UPDATE_WLPARAM("Update Windlight Params"); +#include "llstreamtools.h" LLWLParamManager::LLWLParamManager() : @@ -95,19 +107,150 @@ LLWLParamManager::~LLWLParamManager() { } +void LLWLParamManager::clearParamSetsOfScope(LLWLParamKey::EScope scope) +{ + if (LLWLParamKey::SCOPE_LOCAL == scope) + { + LL_WARNS("Windlight") << "Tried to clear windlight sky presets from local system! This shouldn't be called..." << LL_ENDL; + return; + } + + std::set to_remove; + for(std::map::iterator iter = mParamList.begin(); iter != mParamList.end(); ++iter) + { + if(iter->first.scope == scope) + { + to_remove.insert(iter->first); + } + } + + for(std::set::iterator iter = to_remove.begin(); iter != to_remove.end(); ++iter) + { + mParamList.erase(*iter); + } +} + +// returns all skies referenced by the day cycle, with their final names +// side effect: applies changes to all internal structures! +std::map LLWLParamManager::finalizeFromDayCycle(LLWLParamKey::EScope scope) +{ + std::map final_references; + + // Move all referenced to desired scope, renaming if necessary + // First, save skies referenced + std::map current_references; // all skies referenced by the day cycle, with their current names + // guard against skies with same name and different scopes + std::set inserted_names; + std::map conflicted_names; // integer later used as a count, for uniquely renaming conflicts + + LLWLDayCycle& cycle = mDay; + for(std::map::iterator iter = cycle.mTimeMap.begin(); + iter != cycle.mTimeMap.end(); + ++iter) + { + LLWLParamKey& key = iter->second; + std::string desired_name = key.name; + replace_newlines_with_whitespace(desired_name); // already shouldn't have newlines, but just in case + if(inserted_names.find(desired_name) == inserted_names.end()) + { + inserted_names.insert(desired_name); + } + else + { + // make exist in map + conflicted_names[desired_name] = 0; + } + current_references[key] = mParamList[key]; + } + + // forget all old skies in target scope, and rebuild, renaming as needed + clearParamSetsOfScope(scope); + for(std::map::iterator iter = current_references.begin(); iter != current_references.end(); ++iter) + { + const LLWLParamKey& old_key = iter->first; + + std::string desired_name(old_key.name); + replace_newlines_with_whitespace(desired_name); + + LLWLParamKey new_key(desired_name, scope); // name will be replaced later if necessary + + // if this sky is one with a non-unique name, rename via appending a number + // an existing preset of the target scope gets to keep its name + if (scope != old_key.scope && conflicted_names.find(desired_name) != conflicted_names.end()) + { + std::string& new_name = new_key.name; + + do + { + // if this executes more than once, this is an absurdly pathological case + // (e.g. "x" repeated twice, but "x 1" already exists, so need to use "x 2") + std::stringstream temp; + temp << desired_name << " " << (++conflicted_names[desired_name]); + new_name = temp.str(); + } while (inserted_names.find(new_name) != inserted_names.end()); + + // yay, found one that works + inserted_names.insert(new_name); // track names we consume here; shouldn't be necessary due to ++int? but just in case + + // *TODO factor out below into a rename()? + + LL_INFOS("Windlight") << "Renamed " << old_key.name << " (scope" << old_key.scope << ") to " + << new_key.name << " (scope " << new_key.scope << ")" << LL_ENDL; + + // update name in sky + iter->second.mName = new_name; + + // update keys in day cycle + for(std::map::iterator frame = cycle.mTimeMap.begin(); frame != cycle.mTimeMap.end(); ++frame) + { + if (frame->second == old_key) + { + frame->second = new_key; + } + } + + // add to master sky map + mParamList[new_key] = iter->second; + } + + final_references[new_key] = iter->second; + } + + return final_references; +} + +LLSD LLWLParamManager::createSkyMap(std::map refs) +{ + LLSD skies = LLSD::emptyMap(); + for(std::map::iterator iter = refs.begin(); iter != refs.end(); ++iter) + { + skies.insert(iter->first.name, iter->second.getAll()); + } + return skies; +} + +void LLWLParamManager::addAllSkies(const LLWLParamKey::EScope scope, const LLSD& sky_presets) +{ + for(LLSD::map_const_iterator iter = sky_presets.beginMap(); iter != sky_presets.endMap(); ++iter) + { + LLWLParamSet set; + set.setAll(iter->second); + mParamList[LLWLParamKey(iter->first, scope)] = set; + } +} + void LLWLParamManager::loadPresets(const std::string& file_name) { std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); - LL_DEBUGS2("AppInit", "Shaders") << "Loading Default WindLight settings from " << path_name << LL_ENDL; - - bool found = true; + LL_INFOS2("AppInit", "Shaders") << "Loading Default WindLight settings from " << path_name << LL_ENDL; + + bool found = true; while(found) { std::string name; found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false); if(found) { - name=name.erase(name.length()-4); // bugfix for SL-46920: preventing filenames that break stuff. @@ -117,16 +260,16 @@ void LLWLParamManager::loadPresets(const std::string& file_name) curl_str = NULL; LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL; - loadPreset(unescaped_name,FALSE); + loadPreset(LLWLParamKey(unescaped_name, LLWLParamKey::SCOPE_LOCAL),FALSE); } } // And repeat for user presets, note the user presets will modify any system presets already loaded std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); - LL_DEBUGS2("AppInit", "Shaders") << "Loading User WindLight settings from " << path_name2 << LL_ENDL; - - found = true; + LL_INFOS2("AppInit", "Shaders") << "Loading User WindLight settings from " << path_name2 << LL_ENDL; + + found = true; while(found) { std::string name; @@ -142,12 +285,14 @@ void LLWLParamManager::loadPresets(const std::string& file_name) curl_str = NULL; LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL; - loadPreset(unescaped_name,FALSE); + loadPreset(LLWLParamKey(unescaped_name,LLWLParamKey::SCOPE_LOCAL),FALSE); } } } +// untested and unmaintained! sanity-check me before using +/* void LLWLParamManager::savePresets(const std::string & fileName) { //Nobody currently calls me, but if they did, then its reasonable to write the data out to the user's folder @@ -157,11 +302,11 @@ void LLWLParamManager::savePresets(const std::string & fileName) std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", fileName)); - for(std::map::iterator mIt = mParamList.begin(); + for(std::map::iterator mIt = mParamList.begin(); mIt != mParamList.end(); ++mIt) { - paramsData[mIt->first] = mIt->second.getAll(); + paramsData[mIt->first.name] = mIt->second.getAll(); } llofstream presetsXML(pathName); @@ -172,70 +317,78 @@ void LLWLParamManager::savePresets(const std::string & fileName) presetsXML.close(); } +*/ -void LLWLParamManager::loadPreset(const std::string & name,bool propagate) +void LLWLParamManager::loadPreset(const LLWLParamKey key, bool propagate) { - - // bugfix for SL-46920: preventing filenames that break stuff. - char * curl_str = curl_escape(name.c_str(), name.size()); - std::string escaped_filename(curl_str); - curl_free(curl_str); - curl_str = NULL; - - escaped_filename += ".xml"; - - std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename)); - LL_DEBUGS2("AppInit", "Shaders") << "Loading WindLight sky setting from " << pathName << LL_ENDL; - - llifstream presetsXML; - presetsXML.open(pathName.c_str()); - - // That failed, try loading from the users area instead. - if(!presetsXML) + if(mParamList.find(key) == mParamList.end()) // key does not already exist in mapping { - pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename); - LL_DEBUGS2("AppInit", "Shaders") << "Loading User WindLight sky setting from " << pathName << LL_ENDL; - presetsXML.clear(); - presetsXML.open(pathName.c_str()); - } + if(key.scope == LLWLParamKey::SCOPE_LOCAL) // local scope, so try to load from file + { + // bugfix for SL-46920: preventing filenames that break stuff. + char * curl_str = curl_escape(key.name.c_str(), key.name.size()); + std::string escaped_filename(curl_str); + curl_free(curl_str); + curl_str = NULL; - if (presetsXML) - { - LLSD paramsData(LLSD::emptyMap()); + escaped_filename += ".xml"; - LLPointer parser = new LLSDXMLParser(); + std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename)); + llinfos << "Loading WindLight sky setting from " << pathName << llendl; - parser->parse(presetsXML, paramsData, LLSDSerialize::SIZE_UNLIMITED); + llifstream presetsXML; + presetsXML.open(pathName.c_str()); - std::map::iterator mIt = mParamList.find(name); - if(mIt == mParamList.end()) - { - addParamSet(name, paramsData); + // That failed, try loading from the users area instead. + if(!presetsXML) + { + pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename); + llinfos << "Loading User WindLight sky setting from " << pathName << llendl; + presetsXML.open(pathName.c_str()); + } + + if (presetsXML) + { + loadPresetFromXML(key, presetsXML); + presetsXML.close(); + } + else + { + llwarns << "Could not load local WindLight sky setting " << key.toString() << llendl; + return; + } } - else + else { - setParamSet(name, paramsData); - } - presetsXML.close(); - } - else - { - llwarns << "Can't find " << name << llendl; - return; + llwarns << "Attempted to load non-local WindLight sky settings " << key.toString() << "; not found in parameter mapping." << llendl; + return; + } } - if(propagate) { - getParamSet(name, mCurParams); + getParamSet(key, mCurParams); propagateParameters(); } -} +} -void LLWLParamManager::savePreset(const std::string & name) +void LLWLParamManager::loadPresetFromXML(LLWLParamKey key, std::istream & presetsXML) +{ + LLSD paramsData(LLSD::emptyMap()); + LLPointer parser = new LLSDXMLParser(); + + parser->parse(presetsXML, paramsData, LLSDSerialize::SIZE_UNLIMITED); + + std::map::iterator mIt = mParamList.find(key); + + if(mIt == mParamList.end()) addParamSet(key, paramsData); + else setParamSet(key, paramsData); +} + +void LLWLParamManager::savePreset(LLWLParamKey key) { // bugfix for SL-46920: preventing filenames that break stuff. - char * curl_str = curl_escape(name.c_str(), name.size()); + char * curl_str = curl_escape(key.name.c_str(), key.name.size()); std::string escaped_filename(curl_str); curl_free(curl_str); curl_str = NULL; @@ -247,7 +400,7 @@ void LLWLParamManager::savePreset(const std::string & name) std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename)); // fill it with LLSD windlight params - paramsData = mParamList[name].getAll(); + paramsData = mParamList[key].getAll(); // write to file llofstream presetsXML(pathName); @@ -282,7 +435,7 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader) void LLWLParamManager::propagateParameters(void) { - LLFastTimer ftm(FTM_UPDATE_WLPARAM); + LLFastTimer ftm(LLFastTimer::FTM_UPDATE_WLPARAM); LLVector4 sunDir; LLVector4 moonDir; @@ -306,7 +459,7 @@ void LLWLParamManager::propagateParameters(void) { mLightDir = sunDir; } - else if(sunDir.mV[1] < 0 && sunDir.mV[1] > LLSky::NIGHTTIME_ELEVATION_COS) + else if(sunDir.mV[1] < 0 && sunDir.mV[1] > NIGHTTIME_ELEVATION_COS) { // clamp v1 to 0 so sun never points up and causes weirdness on some machines LLVector3 vec(sunDir.mV[0], sunDir.mV[1], sunDir.mV[2]); @@ -353,13 +506,13 @@ void LLWLParamManager::propagateParameters(void) void LLWLParamManager::update(LLViewerCamera * cam) { - LLFastTimer ftm(FTM_UPDATE_WLPARAM); + LLFastTimer ftm(LLFastTimer::FTM_UPDATE_WLPARAM); // update clouds, sun, and general mCurParams.updateCloudScrolling(); // update only if running - if(mAnimator.mIsRunning) + if(mAnimator.getIsRunning()) { mAnimator.update(mCurParams); } @@ -368,30 +521,29 @@ void LLWLParamManager::update(LLViewerCamera * cam) propagateParameters(); // sync menus if they exist - LLFloaterWindLight* wlfloater = LLFloaterReg::findTypedInstance("env_windlight"); - if (wlfloater) + if(LLFloaterWindLight::isOpen()) { - wlfloater->syncMenu(); + LLFloaterWindLight::instance()->syncMenu(); } - LLFloaterDayCycle* dlfloater = LLFloaterReg::findTypedInstance("env_day_cycle"); - if (dlfloater) + if(LLFloaterDayCycle::isOpen()) { - dlfloater->syncMenu(); + LLFloaterDayCycle::instance()->syncMenu(); } - LLFloaterEnvSettings* envfloater = LLFloaterReg::findTypedInstance("env_settings"); - if (envfloater) + if(LLFloaterEnvSettings::isOpen()) { - envfloater->syncMenu(); + LLFloaterEnvSettings::instance()->syncMenu(); } F32 camYaw = cam->getYaw(); + stop_glerror(); + // *TODO: potential optimization - this block may only need to be // executed some of the time. For example for water shaders only. { F32 camYawDelta = mSunDeltaYaw * DEG_TO_RAD; - LLVector3 lightNorm3(mLightDir); + LLVector3 lightNorm3(mLightDir); lightNorm3 *= LLQuaternion(-(camYaw + camYawDelta), LLVector3(0.f, 1.f, 0.f)); mRotatedLightDir = LLVector4(lightNorm3, 0.f); @@ -409,19 +561,6 @@ void LLWLParamManager::update(LLViewerCamera * cam) } } -// static -void LLWLParamManager::initClass(void) -{ - instance(); -} - -// static -void LLWLParamManager::cleanupClass() -{ - delete sInstance; - sInstance = NULL; -} - void LLWLParamManager::resetAnimator(F32 curTime, bool run) { mAnimator.setTrack(mDay.mTimeMap, mDay.mDayRate, @@ -429,26 +568,27 @@ void LLWLParamManager::resetAnimator(F32 curTime, bool run) return; } -bool LLWLParamManager::addParamSet(const std::string& name, LLWLParamSet& param) + +bool LLWLParamManager::addParamSet(const LLWLParamKey& key, LLWLParamSet& param) { // add a new one if not one there already - std::map::iterator mIt = mParamList.find(name); + std::map::iterator mIt = mParamList.find(key); if(mIt == mParamList.end()) { - mParamList[name] = param; + mParamList[key] = param; return true; } return false; } -BOOL LLWLParamManager::addParamSet(const std::string& name, LLSD const & param) +BOOL LLWLParamManager::addParamSet(const LLWLParamKey& key, LLSD const & param) { // add a new one if not one there already - std::map::const_iterator finder = mParamList.find(name); + std::map::const_iterator finder = mParamList.find(key); if(finder == mParamList.end()) { - mParamList[name].setAll(param); + mParamList[key].setAll(param); return TRUE; } else @@ -457,105 +597,88 @@ BOOL LLWLParamManager::addParamSet(const std::string& name, LLSD const & param) } } -bool LLWLParamManager::getParamSet(const std::string& name, LLWLParamSet& param) +bool LLWLParamManager::getParamSet(const LLWLParamKey& key, LLWLParamSet& param) { // find it and set it - std::map::iterator mIt = mParamList.find(name); + std::map::iterator mIt = mParamList.find(key); if(mIt != mParamList.end()) { - param = mParamList[name]; - param.mName = name; + param = mParamList[key]; + param.mName = key.name; return true; } return false; } -bool LLWLParamManager::setParamSet(const std::string& name, LLWLParamSet& param) +bool LLWLParamManager::setParamSet(const LLWLParamKey& key, LLWLParamSet& param) { - mParamList[name] = param; + mParamList[key] = param; return true; } -bool LLWLParamManager::setParamSet(const std::string& name, const LLSD & param) +bool LLWLParamManager::setParamSet(const LLWLParamKey& key, const LLSD & param) { // quick, non robust (we won't be working with files, but assets) check + // this might not actually be true anymore.... if(!param.isMap()) { return false; } - mParamList[name].setAll(param); + mParamList[key].setAll(param); return true; } -bool LLWLParamManager::removeParamSet(const std::string& name, bool delete_from_disk) +void LLWLParamManager::removeParamSet(const LLWLParamKey& key, bool delete_from_disk) { // remove from param list - std::map::iterator mIt = mParamList.find(name); + std::map::iterator mIt = mParamList.find(key); if(mIt != mParamList.end()) { mParamList.erase(mIt); } - - F32 key; - - // remove all references - bool stat = true; - do + else { - // get it - stat = mDay.getKey(name, key); - if(stat == false) - { - break; - } + LL_WARNS("WindLight") << "Unable to delete key " << key.toString() << "; not found." << LL_ENDL; + } - // and remove - stat = mDay.removeKey(key); + mDay.removeReferencesTo(key); - } while(stat == true); - - if(delete_from_disk) + if(delete_from_disk && key.scope == LLWLParamKey::SCOPE_LOCAL) { std::string path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); // use full curl escaped name - char * curl_str = curl_escape(name.c_str(), name.size()); + char * curl_str = curl_escape(key.name.c_str(), key.name.size()); std::string escaped_name(curl_str); curl_free(curl_str); curl_str = NULL; - gDirUtilp->deleteFilesInDir(path_name, escaped_name + ".xml"); + if(gDirUtilp->deleteFilesInDir(path_name, escaped_name + ".xml") < 1) + { + LL_WARNS("WindLight") << "Unable to delete key " << key.toString() << " from disk; not found." << LL_ENDL; + } } - - return true; } -// static -LLWLParamManager * LLWLParamManager::instance() +// virtual static +void LLWLParamManager::initSingleton() { - if(NULL == sInstance) - { - sInstance = new LLWLParamManager(); + loadPresets(LLStringUtil::null); - sInstance->loadPresets(LLStringUtil::null); + // load the day + mDay.loadDayCycleFromFile(std::string("Default.xml")); - // load the day - sInstance->mDay.loadDayCycle(std::string("Default.xml")); + // *HACK - sets cloud scrolling to what we want... fix this better in the future + getParamSet(LLWLParamKey("Default", LLWLParamKey::SCOPE_LOCAL), mCurParams); - // *HACK - sets cloud scrolling to what we want... fix this better in the future - sInstance->getParamSet("Default", sInstance->mCurParams); - - // set it to noon - sInstance->resetAnimator(0.5, true); - - // but use linden time sets it to what the estate is - sInstance->mAnimator.mUseLindenTime = true; - } + // set it to noon + resetAnimator(0.5, true); - return sInstance; + // but use linden time sets it to what the estate is + mAnimator.setTimeType(LLWLAnimator::TIME_LINDEN); } diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h index 8c6329e769..1951366939 100644 --- a/indra/newview/llwlparammanager.h +++ b/indra/newview/llwlparammanager.h @@ -2,25 +2,31 @@ * @file llwlparammanager.h * @brief Implementation for the LLWLParamManager class. * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2007&license=viewergpl$ + * + * Copyright (c) 2007-2009, 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. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * 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. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * 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 + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -29,10 +35,12 @@ #include #include +#include "llenvmanager.h" #include "llwlparamset.h" #include "llwlanimator.h" #include "llwldaycycle.h" #include "llviewercamera.h" +#include "lltrans.h" class LLGLSLShader; @@ -72,7 +80,7 @@ struct WLColorControl { r = val.mV[0]; g = val.mV[1]; b = val.mV[2]; - i = val.mV[3]; + i = val.mV[3]; return *this; } @@ -115,25 +123,110 @@ struct WLFloatControl { } }; -/// WindLight parameter manager class - what controls all the wind light shaders -class LLWLParamManager +struct LLWLParamKey : LLEnvKey { public: + // scope and source of a param set (WL sky preset) + std::string name; + EScope scope; - LLWLParamManager(); - ~LLWLParamManager(); + // for conversion from LLSD + static const int NAME_IDX = 0; + static const int SCOPE_IDX = 1; + + inline LLWLParamKey(const std::string& n, EScope s) + : name(n), scope(s) + { + } + inline LLWLParamKey(LLSD llsd) + : name(llsd[NAME_IDX].asString()), scope(EScope(llsd[SCOPE_IDX].asInteger())) + { + } + + inline LLWLParamKey() // NOT really valid, just so std::maps can return a default of some sort + : name(NULL), scope(SCOPE_LOCAL) + { + } + + inline LLWLParamKey(std::string& stringVal) + : name(stringVal.substr(0, stringVal.length()-1)), + scope((EScope)atoi(stringVal.substr(stringVal.length()-1, stringVal.length()).c_str())) + { + } + + inline std::string toStringVal() const + { + std::stringstream str; + str << name << scope; + return str.str(); + } + + inline LLSD toLLSD() const + { + LLSD llsd = LLSD::emptyArray(); + llsd.append(LLSD(name)); + llsd.append(LLSD(scope)); + return llsd; + } + + inline bool operator <(const LLWLParamKey other) const + { + if (name < other.name) + { + return true; + } + else if (name > other.name) + { + return false; + } + else + { + return scope < other.scope; + } + } + + inline bool operator ==(const LLWLParamKey other) const + { + return (name == other.name) && (scope == other.scope); + } + + inline std::string toString() const + { + switch (scope) + { + case SCOPE_LOCAL: + return name + std::string(" (") + LLTrans::getString("Local") + std::string(")"); + break; + case SCOPE_REGION: + return name + std::string(" (") + LLTrans::getString("Region") + std::string(")"); + break; + default: + return name + " (?)"; + } + } +}; + +/// WindLight parameter manager class - what controls all the wind light shaders +class LLWLParamManager : public LLSingleton +{ +public: /// load a preset file void loadPresets(const std::string & fileName); /// save the preset file + // the implementation of this method was unmaintained and is commented out + // *NOTE test and sanity-check before uncommenting and using! void savePresets(const std::string & fileName); /// load an individual preset into the sky - void loadPreset(const std::string & name,bool propogate=true); + void loadPreset(const LLWLParamKey key, bool propogate=true); + + /// load an individual preset from a stream of XML + void loadPresetFromXML(const LLWLParamKey key, std::istream & presetXML); /// save the parameter presets to file - void savePreset(const std::string & name); + void savePreset(const LLWLParamKey key); /// Set shader uniforms dirty, so they'll update automatically. void propagateParameters(void); @@ -161,36 +254,38 @@ public: /// get the radius of the dome inline F32 getDomeRadius(void) const; - - /// Perform global initialization for this class. - static void initClass(void); - - // Cleanup of global data that's only inited once per class. - static void cleanupClass(); - /// add a param to the list - bool addParamSet(const std::string& name, LLWLParamSet& param); + /// add a param set (preset) to the list + bool addParamSet(const LLWLParamKey& key, LLWLParamSet& param); - /// add a param to the list - BOOL addParamSet(const std::string& name, LLSD const & param); + /// add a param set (preset) to the list + BOOL addParamSet(const LLWLParamKey& key, LLSD const & param); - /// get a param from the list - bool getParamSet(const std::string& name, LLWLParamSet& param); + /// get a param set (preset) from the list + bool getParamSet(const LLWLParamKey& key, LLWLParamSet& param); /// set the param in the list with a new param - bool setParamSet(const std::string& name, LLWLParamSet& param); + bool setParamSet(const LLWLParamKey& key, LLWLParamSet& param); /// set the param in the list with a new param - bool setParamSet(const std::string& name, LLSD const & param); - + bool setParamSet(const LLWLParamKey& key, LLSD const & param); + /// gets rid of a parameter and any references to it - /// returns true if successful - bool removeParamSet(const std::string& name, bool delete_from_disk); + /// ignores "delete_from_disk" if the scope is not local + void removeParamSet(const LLWLParamKey& key, bool delete_from_disk); - // singleton pattern implementation - static LLWLParamManager * instance(); + /// clear parameter mapping of a given scope + void clearParamSetsOfScope(LLEnvKey::EScope scope); -public: + /// add all skies in LLSD using the given scope + void addAllSkies(LLEnvKey::EScope scope, const LLSD& preset_map); + + // returns all skies referenced by the current day cycle (in mDay), with their final names + // side effect: applies changes to all internal structures! (trashes all unreferenced skies in scope, keys in day cycle rescoped to scope, etc.) + std::map finalizeFromDayCycle(LLWLParamKey::EScope scope); + + // returns all skies in map (intended to be called with output from a finalize) + LLSD createSkyMap(std::map map); // helper variables LLWLAnimator mAnimator; @@ -244,13 +339,13 @@ public: F32 mDomeRadius; // list of all the parameters, listed by name - std::map mParamList; - + std::map mParamList; private: - // our parameter manager singleton instance - static LLWLParamManager * sInstance; - + friend class LLSingleton; + /*virtual*/ void initSingleton(); + LLWLParamManager(); + ~LLWLParamManager(); }; inline F32 LLWLParamManager::getDomeOffset(void) const diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp index cf06766d73..a027d635e6 100644 --- a/indra/newview/llwlparamset.cpp +++ b/indra/newview/llwlparamset.cpp @@ -31,6 +31,7 @@ #include "llfloaterwindlight.h" #include "llwlparammanager.h" +#include "llglslshader.h" #include "lluictrlfactory.h" #include "llsliderctrl.h" @@ -94,7 +95,7 @@ void LLWLParamSet::update(LLGLSLShader * shader) const shader->uniform4fv(param, 1, val.mV); } - else + else // param is the uniform name { LLVector4 val; @@ -119,7 +120,6 @@ void LLWLParamSet::update(LLGLSLShader * shader) const val.mV[0] = i->second.asBoolean(); } - shader->uniform4fv(param, 1, val.mV); } } @@ -260,7 +260,6 @@ void LLWLParamSet::setEastAngle(float val) void LLWLParamSet::mix(LLWLParamSet& src, LLWLParamSet& dest, F32 weight) { // set up the iterators - LLSD::map_iterator cIt = mParamValues.beginMap(); // keep cloud positions and coverage the same /// TODO masking will do this later @@ -273,55 +272,39 @@ void LLWLParamSet::mix(LLWLParamSet& src, LLWLParamSet& dest, F32 weight) LLSD srcVal; LLSD destVal; - // do the interpolation for all the ones saved as vectors - // skip the weird ones - for(; cIt != mParamValues.endMap(); cIt++) { + // Iterate through values + for(LLSD::map_iterator iter = mParamValues.beginMap(); iter != mParamValues.endMap(); ++iter) + { - // check params to make sure they're actually there - if(src.mParamValues.has(cIt->first)) + // If param exists in both src and dest, set the holder variables, otherwise skip + if(src.mParamValues.has(iter->first) && dest.mParamValues.has(iter->first)) { - srcVal = src.mParamValues[cIt->first]; + srcVal = src.mParamValues[iter->first]; + destVal = dest.mParamValues[iter->first]; } else { continue; } - if(dest.mParamValues.has(cIt->first)) + if(iter->second.isReal()) // If it's a real, interpolate directly { - destVal = dest.mParamValues[cIt->first]; + iter->second = srcVal.asReal() + ((destVal.asReal() - srcVal.asReal()) * weight); } - else - { - continue; - } - - // skip if not a vector - if(!cIt->second.isArray()) - { - continue; - } - - // only Real vectors allowed - if(!cIt->second[0].isReal()) + else if(iter->second.isArray() && iter->second[0].isReal() // If it's an array of reals, loop through the reals and interpolate on those + && iter->second.size() == srcVal.size() && iter->second.size() == destVal.size()) { - continue; + // Actually do interpolation: old value + (difference in values * factor) + for(int i=0; i < iter->second.size(); ++i) + { + // iter->second[i] = (1.f-weight)*(F32)srcVal[i].asReal() + weight*(F32)destVal[i].asReal(); // old way of doing it -- equivalent but one more operation + iter->second[i] = srcVal[i].asReal() + ((destVal[i].asReal() - srcVal[i].asReal()) * weight); + } } - - // make sure all the same size - if( cIt->second.size() != srcVal.size() || - cIt->second.size() != destVal.size()) + else // Else, skip { continue; - } - - // more error checking might be necessary; - - for(int i=0; i < cIt->second.size(); ++i) - { - cIt->second[i] = (1.0f - weight) * (F32) srcVal[i].asReal() + - weight * (F32) destVal[i].asReal(); - } + } } // now mix the extra parameters diff --git a/indra/newview/llwlparamset.h b/indra/newview/llwlparamset.h index 487e2bf922..1358502032 100644 --- a/indra/newview/llwlparamset.h +++ b/indra/newview/llwlparamset.h @@ -32,10 +32,10 @@ #include "v4math.h" #include "v4color.h" -#include "llviewershadermgr.h" class LLFloaterWindLight; class LLWLParamSet; +class LLGLSLShader; /// A class representing a set of parameter values for the WindLight shaders. class LLWLParamSet { diff --git a/indra/newview/tests/lldir_stub.cpp b/indra/newview/tests/lldir_stub.cpp new file mode 100644 index 0000000000..6646860b5e --- /dev/null +++ b/indra/newview/tests/lldir_stub.cpp @@ -0,0 +1,45 @@ +/** + * @file lldir_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Use me only if you need to stub out some helper functions, not if you e.g. need sane numbers from countFilesInDir + +LLDir::LLDir() {} +LLDir::~LLDir() {} +BOOL LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask) { return true; } +void LLDir::setChatLogsDir(const std::string &path) {} +void LLDir::setPerAccountChatLogsDir(const std::string &first, const std::string &last) {} +void LLDir::setLindenUserDir(const std::string &first, const std::string &last) {} +void LLDir::setSkinFolder(const std::string &skin_folder) {} +bool LLDir::setCacheDir(const std::string &path) { return true; } +void LLDir::dumpCurrentDirectories() {} + +class LLDir_stub : public LLDir +{ +public: + LLDir_stub() {} + ~LLDir_stub() {} + + /*virtual*/ void initAppDirs(const std::string &app_name) {} + + /*virtual*/ std::string getCurPath() { return "CUR_PATH_FROM_LLDIR"; } + /*virtual*/ U32 countFilesInDir(const std::string &dirname, const std::string &mask) { return 42; } + /*virtual*/ BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname, BOOL wrap) { fname = fname + "_NEXT"; return false; } + /*virtual*/ void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname) { fname = "RANDOM_FILE"; } + /*virtual*/ BOOL fileExists(const std::string &filename) const { return false; } +}; + +LLDir_stub gDirUtil; + +LLDir* gDirUtilp = &gDirUtil; + +std::string LLDir::getExpandedFilename(ELLPath loc, const std::string& subdir, const std::string& filename) const +{ + return subdir + " --- " + filename + " --- expanded!"; +} + diff --git a/indra/newview/tests/llfloaterdaycycle_stub.cpp b/indra/newview/tests/llfloaterdaycycle_stub.cpp new file mode 100644 index 0000000000..e6b145bcfc --- /dev/null +++ b/indra/newview/tests/llfloaterdaycycle_stub.cpp @@ -0,0 +1,20 @@ +/** + * @file llfloaterdaycycle_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +class LLFloaterDayCycle +{ +public: + static bool isOpen(void); + static LLFloaterDayCycle* instance(void); + static void syncMenu(void); +}; + +bool LLFloaterDayCycle::isOpen() { return true; } +LLFloaterDayCycle* LLFloaterDayCycle::instance() { return NULL; } +void LLFloaterDayCycle::syncMenu(void) {} diff --git a/indra/newview/tests/llfloaterenvsettings_stub.cpp b/indra/newview/tests/llfloaterenvsettings_stub.cpp new file mode 100644 index 0000000000..e9e792521f --- /dev/null +++ b/indra/newview/tests/llfloaterenvsettings_stub.cpp @@ -0,0 +1,20 @@ +/** + * @file llfloaterenvsettings_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +class LLFloaterEnvSettings +{ +public: + static bool isOpen(void); + static LLFloaterEnvSettings* instance(void); + void syncMenu(void); +}; + +bool LLFloaterEnvSettings::isOpen() { return true; } +LLFloaterEnvSettings* LLFloaterEnvSettings::instance() { return NULL; } +void LLFloaterEnvSettings::syncMenu(void) {} diff --git a/indra/newview/tests/llfloaterwindlight_stub.cpp b/indra/newview/tests/llfloaterwindlight_stub.cpp new file mode 100644 index 0000000000..f1891eaf21 --- /dev/null +++ b/indra/newview/tests/llfloaterwindlight_stub.cpp @@ -0,0 +1,20 @@ +/** + * @file llfloaterwindlight_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +class LLFloaterWindLight +{ +public: + static bool isOpen(void); + static LLFloaterWindLight* instance(void); + void syncMenu(void); +}; + +bool LLFloaterWindLight::isOpen() { return true; } +LLFloaterWindLight* LLFloaterWindLight::instance() { return NULL; } +void LLFloaterWindLight::syncMenu(void) {} diff --git a/indra/newview/tests/llglslshader_stub.cpp b/indra/newview/tests/llglslshader_stub.cpp new file mode 100644 index 0000000000..5333c8a361 --- /dev/null +++ b/indra/newview/tests/llglslshader_stub.cpp @@ -0,0 +1,22 @@ +/** + * @file llglslshader_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#include "llglslshader.h" + +void LLGLSLShader::uniform1f(const std::string& uniform, F32 num) +{ +} + +void LLGLSLShader::uniform3fv(const std::string& uniform, U32 count, const GLfloat *v) +{ +} + +void LLGLSLShader::uniform4fv(U32 index, U32 count, const GLfloat* v) +{ +} diff --git a/indra/newview/tests/llpipeline_stub.cpp b/indra/newview/tests/llpipeline_stub.cpp new file mode 100644 index 0000000000..85bf0ae3fb --- /dev/null +++ b/indra/newview/tests/llpipeline_stub.cpp @@ -0,0 +1,15 @@ +/** + * @file llpipeline_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +class LLPipeline +{ +public: BOOL canUseWindLightShaders() const; +}; +BOOL LLPipeline::canUseWindLightShaders() const {return TRUE;} +LLPipeline gPipeline; diff --git a/indra/newview/tests/llsky_stub.cpp b/indra/newview/tests/llsky_stub.cpp new file mode 100644 index 0000000000..35f4944a95 --- /dev/null +++ b/indra/newview/tests/llsky_stub.cpp @@ -0,0 +1,20 @@ +/** + * @file llsky_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +class LLSky +{ +public: + void setOverrideSun(BOOL override); + void setSunDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity); +}; + +void LLSky::setOverrideSun(BOOL override) {} +void LLSky::setSunDirection(const LLVector3 &sun_direction, const LLVector3 &sun_ang_velocity) {} + +LLSky gSky; diff --git a/indra/newview/tests/llviewershadermgr_stub.cpp b/indra/newview/tests/llviewershadermgr_stub.cpp new file mode 100644 index 0000000000..0dae527035 --- /dev/null +++ b/indra/newview/tests/llviewershadermgr_stub.cpp @@ -0,0 +1,33 @@ +/** + * @file llglslshader_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#include "../llviewershadermgr.h" + +LLShaderMgr::LLShaderMgr() {} +LLShaderMgr::~LLShaderMgr() {} + +LLViewerShaderMgr::LLViewerShaderMgr() {} +LLViewerShaderMgr::~LLViewerShaderMgr() {} + +LLViewerShaderMgr* stub_instance = NULL; + +LLViewerShaderMgr* LLViewerShaderMgr::instance() { + if(NULL == stub_instance) + { + stub_instance = new LLViewerShaderMgr(); + } + + return stub_instance; +} +LLViewerShaderMgr::shader_iter fake_iter; +LLViewerShaderMgr::shader_iter LLViewerShaderMgr::beginShaders() const {return fake_iter;} +LLViewerShaderMgr::shader_iter LLViewerShaderMgr::endShaders() const {return fake_iter;} + +void LLViewerShaderMgr::updateShaderUniforms(LLGLSLShader* shader) {return;} +std::string LLViewerShaderMgr::getShaderDirPrefix() {return "SHADER_DIR_PREFIX-";} diff --git a/indra/newview/tests/llwlanimator_stub.cpp b/indra/newview/tests/llwlanimator_stub.cpp new file mode 100644 index 0000000000..4d1bb85544 --- /dev/null +++ b/indra/newview/tests/llwlanimator_stub.cpp @@ -0,0 +1,12 @@ +/** + * @file llwlanimator_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +LLWLAnimator::LLWLAnimator(void) {} +void LLWLAnimator::update(LLWLParamSet& set) {} +void LLWLAnimator::setTrack(std::map& track, F32 dayRate, F64 dayTime, bool run) {} diff --git a/indra/newview/tests/llwldaycycle_stub.cpp b/indra/newview/tests/llwldaycycle_stub.cpp new file mode 100644 index 0000000000..d98c9614b4 --- /dev/null +++ b/indra/newview/tests/llwldaycycle_stub.cpp @@ -0,0 +1,35 @@ +/** + * @file llwldaycycle_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +LLWLDayCycle::LLWLDayCycle(void) +{ +} + +LLWLDayCycle::~LLWLDayCycle(void) +{ +} + +bool LLWLDayCycle::getKeytime(LLWLParamKey keyFrame, F32& keyTime) +{ + keyTime = 0.5; + return true; +} + +bool LLWLDayCycle::removeKeyframe(F32 time) +{ + return true; +} + +void LLWLDayCycle::loadDayCycleFromFile(const std::string& fileName) +{ +} + +void LLWLDayCycle::removeReferencesTo(const LLWLParamKey &keyframe) +{ +} diff --git a/indra/newview/tests/llwlparammanager_test.cpp b/indra/newview/tests/llwlparammanager_test.cpp new file mode 100644 index 0000000000..3d31567335 --- /dev/null +++ b/indra/newview/tests/llwlparammanager_test.cpp @@ -0,0 +1,257 @@ +/** + * @file llwlparammanager_test.cpp + * @brief LLWLParamManager tests + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled headers +#include "../llviewerprecompiledheaders.h" + +// Class to test +#include "../llwlparammanager.h" + +// Dependencies +#include "linden_common.h" + +// TUT header +#include "lltut.h" + +// Stubs +#include "llwldaycycle_stub.cpp" +#include "llwlparamset_stub.cpp" +#include "llwlanimator_stub.cpp" +#include "llglslshader_stub.cpp" +#include "lldir_stub.cpp" +#include "llsky_stub.cpp" +#include "llfloaterdaycycle_stub.cpp" +#include "llfloaterenvsettings_stub.cpp" +#include "llfloaterwindlight_stub.cpp" +#include "llpipeline_stub.cpp" +#include "llviewershadermgr_stub.cpp" + +void assert_glerror(void) {} +LLViewerCamera::LLViewerCamera() {} +void LLViewerCamera::setView(F32 vertical_fov_rads) {} +std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args) { return std::string(""); } + +char* curl_unescape(const char* c_str, int length) +{ + char* copy = new char[length+4]; + memcpy(copy, c_str, length); + copy[length+0] = 'E'; + copy[length+1] = 'S'; + copy[length+2] = 'C'; + copy[length+3] = '\0'; + return copy; +} +void curl_free(void* p) {delete[] ((char*)p);} +char* curl_escape(const char* c_str, int length) { + char* copy = new char[length+6]; + memcpy(copy, c_str, length); + copy[length+0] = 'U'; + copy[length+1] = 'N'; + copy[length+2] = 'E'; + copy[length+3] = 'S'; + copy[length+4] = 'C'; + copy[length+5] = '\0'; + return copy; +} + +namespace tut +{ + // Main Setup + struct LLWLParamManagerFixture + { + class LLWLParamManagerTest + { + }; + + LLWLParamManager* mTestManager; + + LLWLParamManagerFixture() + : mTestManager(LLWLParamManager::getInstance()) + { + } + + ~LLWLParamManagerFixture() + { + } + }; + typedef test_group factory; + typedef factory::object object; + factory tf("LLWLParamManager test"); + + // Tests + template<> template<> + void object::test<1>() + { + try + { + std::string preset = + "\ + \ + ambient\ + \ + 1.0499999523162842\ + 1.0499999523162842\ + 1.0499999523162842\ + 0.34999999403953552\ + \ + blue_density\ + \ + 0.2447581488182351\ + 0.44872328639030457\ + 0.75999999046325684\ + 0.38000004053115788\ + \ + blue_horizon\ + \ + 0.49548382097675159\ + 0.49548381382419748\ + 0.63999999284744291\ + 0.31999999642372146\ + \ + cloud_color\ + \ + 0.40999999165535073\ + 0.40999999165535073\ + 0.40999999165535073\ + 0.40999999165535073\ + \ + cloud_pos_density1\ + \ + 1.6884100437164307\ + 0.52609699964523315\ + 0.99999999999999289\ + 1\ + \ + cloud_pos_density2\ + \ + 1.6884100437164307\ + 0.52609699964523315\ + 0.125\ + 1\ + \ + cloud_scale\ + \ + 0.4199999868869746\ + 0\ + 0\ + 1\ + \ + cloud_scroll_rate\ + \ + 10.199999809265137\ + 10.01099967956543\ + \ + cloud_shadow\ + \ + 0.26999998092651367\ + 0\ + 0\ + 1\ + \ + density_multiplier\ + \ + 0.00017999998817685818\ + 0\ + 0\ + 1\ + \ + distance_multiplier\ + \ + 0.80000001192093606\ + 0\ + 0\ + 1\ + \ + east_angle\ + 0\ + enable_cloud_scroll\ + \ + 1\ + 1\ + \ + gamma\ + \ + 1\ + 0\ + 0\ + 1\ + \ + glow\ + \ + 5\ + 0.0010000000474974513\ + -0.47999998927116394\ + 1\ + \ + haze_density\ + \ + 0.69999998807907104\ + 0\ + 0\ + 1\ + \ + haze_horizon\ + \ + 0.18999999761581243\ + 0.19915600121021271\ + 0.19915600121021271\ + 1\ + \ + lightnorm\ + \ + 0\ + 0.70710659027099609\ + -0.70710694789886475\ + 0\ + \ + max_y\ + \ + 1605\ + 0\ + 0\ + 1\ + \ + preset_num\ + 22\ + star_brightness\ + 0\ + sun_angle\ + 2.3561947345733643\ + sunlight_color\ + \ + 0.73421055078505759\ + 0.78157895803450828\ + 0.89999997615813498\ + 0.29999998211860301\ + \ + \ + "; + + std::stringstream preset_stream(preset); + mTestManager->loadPresetFromXML(LLWLParamKey("test1", LLWLParamKey::SCOPE_LOCAL), preset_stream); + LLWLParamSet dummy; + ensure("Couldn't get ParamSet after loading it", mTestManager->getParamSet(LLWLParamKey("test1", LLWLParamKey::SCOPE_LOCAL), dummy)); + } + catch (...) + { + fail("loadPresetFromXML test crashed!"); + } + } + + template<> template<> + void object::test<2>() + { + mTestManager->propagateParameters(); + ensure_equals("Wrong value from getDomeOffset()", mTestManager->getDomeOffset(), 0.96f); + ensure_equals("Wrong value from getDomeRadius()", mTestManager->getDomeRadius(), 15000.f); + ensure_equals("Wrong value from getLightDir()", mTestManager->getLightDir(), LLVector4(-0,0,1,0)); + ensure_equals("Wrong value from getClampedLightDir()", mTestManager->getClampedLightDir(), LLVector4(-0,0,1,0)); + ensure_equals("Wrong value from getRotatedLightDir()", mTestManager->getRotatedLightDir(), LLVector4(0,0,0,1)); + } +} diff --git a/indra/newview/tests/llwlparamset_stub.cpp b/indra/newview/tests/llwlparamset_stub.cpp new file mode 100644 index 0000000000..6ce4b5827d --- /dev/null +++ b/indra/newview/tests/llwlparamset_stub.cpp @@ -0,0 +1,24 @@ +/** + * @file llwlparamset_stub.cpp + * @brief stub class to allow unit testing + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * Copyright (c) 2009, Linden Research, Inc. + * $/LicenseInfo$ + */ + +LLWLParamSet::LLWLParamSet(void) +{ +} + +void LLWLParamSet::updateCloudScrolling() +{ +} + +void LLWLParamSet::set(const std::string& name, const LLVector4& val) +{ +} + +void LLWLParamSet::update(LLGLSLShader *shader) const +{ +} -- cgit v1.2.3 From 2fb337bc12984f9abecfbc7f3918c372a7b5ac6c Mon Sep 17 00:00:00 2001 From: "Nyx (Neal Orman)" Date: Thu, 30 Sep 2010 23:21:23 -0400 Subject: STORM-1126 WIP Windlight Estate Settings port from 1.23: second pass at getting windlight ported to V2. Lots of cleanup in the floater classes. Not sure every decision was correct but it compiles now. Doesn't link yet. (resubmitted by Vadim ProductEngine) --- indra/newview/llappviewer.cpp | 1 - indra/newview/lldrawpoolwater.cpp | 4 +- indra/newview/llenvmanager.cpp | 8 +- indra/newview/llfloaterdaycycle.cpp | 27 +- indra/newview/llfloaterdaycycle.h | 2 +- indra/newview/llfloaterenvsettings.cpp | 25 +- indra/newview/llfloaterenvsettings.h | 2 +- indra/newview/llfloaterregioninfo.cpp | 17 +- indra/newview/llfloaterregioninfo.h | 4 +- indra/newview/llfloaterwater.cpp | 44 +- indra/newview/llfloaterwater.h | 8 + indra/newview/llfloaterwindlight.cpp | 28 +- indra/newview/llfloaterwindlight.h | 2 +- indra/newview/llviewermenu.cpp | 2 +- indra/newview/llviewerregion.cpp | 5 - indra/newview/llviewerregion.h | 5 - indra/newview/llwaterparammanager.cpp | 9 +- indra/newview/llwlanimator.cpp | 2 +- indra/newview/llwldaycycle.cpp | 3 +- indra/newview/llwlhandlers.cpp | 7 +- indra/newview/llwlhandlers.h | 1 + indra/newview/llwlparammanager.cpp | 8 +- .../default/xui/en/floater_day_cycle_options.xml | 804 +++------ .../skins/default/xui/en/floater_env_settings.xml | 231 +-- .../default/xui/en/floater_windlight_options.xml | 1874 ++++++-------------- 25 files changed, 1041 insertions(+), 2082 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 333c92e50d..aa781122ce 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1471,7 +1471,6 @@ bool LLAppViewer::cleanup() LLViewerObject::cleanupVOClasses(); LLWaterParamManager::cleanupClass(); - LLWLParamManager::cleanupClass(); LLPostProcess::cleanupClass(); LLTracker::cleanupInstance(); diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index ce1b899d55..213b95b119 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -103,7 +103,7 @@ void LLDrawPoolWater::prerender() // got rid of modulation by light color since it got a little too // green at sunset and sl-57047 (underwater turns black at 8:00) - sWaterFogColor = LLWaterParamManager::instance()->getFogColor(); + sWaterFogColor = LLWaterParamManager::instance().getFogColor(); sWaterFogColor.mV[3] = 0; } @@ -433,7 +433,7 @@ void LLDrawPoolWater::shade() //bind normal map S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP); - LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); + LLWaterParamManager * param_mgr = &LLWaterParamManager::instance(); // change mWaterNormp if needed if (mWaterNormp->getID() != param_mgr->getNormalMapID()) diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index f551aa6c8a..a257e4ea24 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -37,6 +37,7 @@ #include "llagent.h" #include "llviewerregion.h" +#include "llfloaterreg.h" #include "llfloaterwindlight.h" #include "llfloaterwater.h" #include "llfloaterenvsettings.h" @@ -45,6 +46,7 @@ #include "llfloaterregioninfo.h" #include "llwindlightscrubbers.h" #include "llwlhandlers.h" +#include "llnotifications.h" extern LLControlGroup gSavedSettings; @@ -78,7 +80,7 @@ void LLEnvManager::changedRegion(bool interp) mInterpNextChangeMessage = interp; mPendingOutgoingMessage = false; - LLFloaterEnvSettings::instance()->close(); + LLFloaterEnvSettings::instance()->closeFloater(); resetInternalsToDefault(LLEnvKey::SCOPE_REGION); @@ -144,7 +146,7 @@ void LLEnvManager::maybeClearEditingScope(bool user_initiated, bool was_commit) } else { - LLNotifications::instance().add("EnvEditExternalCancel", LLSD()); + LLNotifications::instance().add("EnvEditExternalCancel", LLSD(), LLSD()); } } @@ -160,7 +162,7 @@ void LLEnvManager::clearEditingScope(const LLSD& notification, const LLSD& respo { // *TODO: select terrain panel here mIsEditing = false; - LLFloaterRegionInfo::showInstance(); + LLFloaterReg::showTypedInstance("regioninfo"); return; } diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index efaac5cfc5..48f91aa64a 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -47,6 +47,7 @@ #include "llcombobox.h" #include "lllineeditor.h" #include "llwlanimator.h" +#include "llnotifications.h" #include "v4math.h" #include "llviewerdisplay.h" @@ -59,6 +60,7 @@ #include "llfloaterwindlight.h" #include "llwindlightscrubbers.h" #include "llenvmanager.h" +#include "llfloaterreg.h" LLFloaterDayCycle* LLFloaterDayCycle::sDayCycle = NULL; const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f; @@ -67,13 +69,12 @@ LLEnvKey::EScope LLFloaterDayCycle::sScope; std::string LLFloaterDayCycle::sOriginalTitle; LLWLAnimator::ETime LLFloaterDayCycle::sPreviousTimeType = LLWLAnimator::TIME_LINDEN; -LLFloaterDayCycle::LLFloaterDayCycle() : LLFloater(std::string("Day Cycle Floater")) +LLFloaterDayCycle::LLFloaterDayCycle(const LLSD &key) : LLFloater(key) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml", NULL, FALSE); sOriginalTitle = getTitle(); - llassert(MAX_LOCAL_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxSliderCount() && - MAX_REGION_KEYFRAMES <= getChild("WLDayCycleKeys")->getMaxSliderCount()); + llassert(LLWLPacketScrubber::MAX_LOCAL_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxValue() && + LLWLPacketScrubber::MAX_REGION_KEY_FRAMES <= getChild("WLDayCycleKeys")->getMaxValue()); // add the time slider LLMultiSliderCtrl* sldr = getChild("WLTimeSlider"); @@ -90,10 +91,8 @@ LLFloaterDayCycle::~LLFloaterDayCycle() void LLFloaterDayCycle::onClickHelp(void* data) { - LLFloaterDayCycle* self = LLFloaterDayCycle::instance(); - std::string xml_alert = *(std::string *) data; - LLNotifications::instance().add(self->contextualNotification(xml_alert)); + LLNotifications::instance().add(xml_alert, LLSD(), LLSD()); } void LLFloaterDayCycle::initHelpBtn(const std::string& name, const std::string& xml_alert) @@ -244,7 +243,7 @@ LLFloaterDayCycle* LLFloaterDayCycle::instance() { if (!sDayCycle) { - sDayCycle = new LLFloaterDayCycle(); + sDayCycle = new LLFloaterDayCycle("Day Cycle Floater"); // sDayCycle->open(); // sDayCycle->setFocus(TRUE); } @@ -265,7 +264,7 @@ void LLFloaterDayCycle::show(LLEnvKey::EScope scope) LLFloaterDayCycle* dayCycle = instance(); if(scope != sScope && ((LLView*)dayCycle)->getVisible()) { - LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD()); + LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD(), LLSD()); return; } sScope = scope; @@ -286,7 +285,7 @@ void LLFloaterDayCycle::show(LLEnvKey::EScope scope) //LLUICtrlFactory::getInstance()->buildFloater(dayCycle, "floater_day_cycle_options.xml"); //dayCycle->initCallbacks(); - dayCycle->open(); + dayCycle->openFloater(); } // virtual @@ -537,16 +536,16 @@ void LLFloaterDayCycle::onAddKey(void* userData) max_sliders = LLWLPacketScrubber::MAX_REGION_KEY_FRAMES; break; default: - max_sliders = kSldr->getMaxSliderCount(); + max_sliders = (S32)kSldr->getMaxValue(); break; } - if(kSldr->getSliderCount() >= max_sliders) + if(kSldr->getValue().asInteger() >= max_sliders) { LLSD args; args["SCOPE"] = LLEnvManager::getScopeString(sScope); args["MAX"] = max_sliders; - LLNotifications::instance().add("DayCycleTooManyKeyframes", args); + LLNotifications::instance().add("DayCycleTooManyKeyframes", LLSD(), args); return; } @@ -608,7 +607,7 @@ void LLFloaterDayCycle::onDeleteKey(void* userData) } else if(sSliderToKey.size() == 1) { - LLNotifications::instance().add("EnvCannotDeleteLastDayCycleKey", LLSD()); + LLNotifications::instance().add("EnvCannotDeleteLastDayCycleKey", LLSD(), LLSD()); return; } diff --git a/indra/newview/llfloaterdaycycle.h b/indra/newview/llfloaterdaycycle.h index 1c021f0c6a..246a0357ba 100644 --- a/indra/newview/llfloaterdaycycle.h +++ b/indra/newview/llfloaterdaycycle.h @@ -59,7 +59,7 @@ public: class LLFloaterDayCycle : public LLFloater { public: - LLFloaterDayCycle(); + LLFloaterDayCycle(const LLSD &key); virtual ~LLFloaterDayCycle(); // map of sliders to parameters diff --git a/indra/newview/llfloaterenvsettings.cpp b/indra/newview/llfloaterenvsettings.cpp index 6d1b27db07..eea333745f 100644 --- a/indra/newview/llfloaterenvsettings.cpp +++ b/indra/newview/llfloaterenvsettings.cpp @@ -43,6 +43,7 @@ #include "llcombobox.h" #include "llcolorswatch.h" #include "llwlanimator.h" +#include "llnotifications.h" #include "llwlparamset.h" #include "llwlparammanager.h" @@ -59,10 +60,8 @@ LLFloaterEnvSettings* LLFloaterEnvSettings::sEnvSettings = NULL; -LLFloaterEnvSettings::LLFloaterEnvSettings() : LLFloater(std::string("Environment Settings Floater")) -{ - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_env_settings.xml", NULL, FALSE); - +LLFloaterEnvSettings::LLFloaterEnvSettings(const LLSD &key) : LLFloater(key) +{ // load it up initCallbacks(); } @@ -73,8 +72,7 @@ LLFloaterEnvSettings::~LLFloaterEnvSettings() void LLFloaterEnvSettings::onClickHelp(void* data) { - LLFloaterEnvSettings* self = (LLFloaterEnvSettings*)data; - LLNotifications::instance().add(self->contextualNotification("EnvSettingsHelpButton")); + LLNotifications::instance().add("EnvSettingsHelpButton", LLSD(), LLSD()); } void LLFloaterEnvSettings::onUseRegionEnvironment(LLUICtrl* ctrl, void* data) @@ -212,7 +210,7 @@ LLFloaterEnvSettings* LLFloaterEnvSettings::instance() { if (!sEnvSettings) { - sEnvSettings = new LLFloaterEnvSettings(); + sEnvSettings = new LLFloaterEnvSettings("Environment Editor Floater"); // sEnvSettings->open(); // sEnvSettings->setFocus(TRUE); } @@ -237,9 +235,9 @@ void LLFloaterEnvSettings::setControlsEnabled(bool enable) else { // disable UI elements the user shouldn't be able to see to protect potentially proprietary WL region settings from being visible - LLFloaterWindLight::instance()->close(); - LLFloaterWater::instance()->close(); - LLFloaterDayCycle::instance()->close(); + LLFloaterWindLight::instance()->closeFloater(); + LLFloaterWater::instance()->closeFloater(); + LLFloaterDayCycle::instance()->closeFloater(); childDisable("EnvAdvancedSkyButton"); childDisable("EnvAdvancedWaterButton"); childDisable("EnvUseEstateTimeButton"); @@ -267,9 +265,10 @@ void LLFloaterEnvSettings::show() sEnvSettings->childSetVisible("RegionWLOptIn", LLEnvManager::getInstance()->regionCapable()); sEnvSettings->setOptIn(opt_in); - sEnvSettings->getChildView("RegionWLOptIn")->setValue(LLSD::Boolean(opt_in)); + LLCheckBoxCtrl* checkbox = (LLCheckBoxCtrl*)envSettings->getChildView("RegionWLOptIn"); + checkbox->setValue(LLSD::Boolean(opt_in)); sEnvSettings->getChildView("RegionWLOptIn")->setToolTip(sEnvSettings->getString("region_environment_tooltip")); - envSettings->open(); + envSettings->openFloater(); } bool LLFloaterEnvSettings::isOpen() @@ -361,7 +360,7 @@ void LLFloaterEnvSettings::onOpenAdvancedSky(void* userData) void LLFloaterEnvSettings::onOpenAdvancedWater(void* userData) { - LLFloaterWater::show(); + LLFloaterWater::instance()->openFloater(); } diff --git a/indra/newview/llfloaterenvsettings.h b/indra/newview/llfloaterenvsettings.h index 0bf3e48676..54611a81c3 100644 --- a/indra/newview/llfloaterenvsettings.h +++ b/indra/newview/llfloaterenvsettings.h @@ -45,7 +45,7 @@ class LLFloaterEnvSettings : public LLFloater { public: - LLFloaterEnvSettings(); + LLFloaterEnvSettings(const LLSD &key); virtual ~LLFloaterEnvSettings(); /// initialize all the callbacks for the menu diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index f6377d50fa..7617b98f20 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -51,6 +51,7 @@ #include "llcombobox.h" #include "llenvmanager.h" #include "llfilepicker.h" +#include "llfloaterdaycycle.h" #include "llfloatergodtools.h" // for send_sim_wide_deletes() #include "llfloatertopobjects.h" // added to fix SL-32336 #include "llfloatergroups.h" @@ -1167,7 +1168,7 @@ LLPanelRegionTerrainInfo* LLPanelRegionTerrainInfo::instance() } // virtual -void LLPanelRegionTerrainInfo::close(bool app_quitting) +void LLPanelRegionTerrainInfo::closeFloater(bool app_quitting) { if (sPanelRegionTerrainInfo) { @@ -1407,7 +1408,7 @@ void LLPanelRegionTerrainInfo::onOpenAdvancedSky(void* userData) void LLPanelRegionTerrainInfo::onOpenAdvancedWater(void* userData) { - LLFloaterWater::show(LLEnvKey::SCOPE_REGION); + LLFloaterWater::instance()->show(LLEnvKey::SCOPE_REGION); } @@ -1449,9 +1450,9 @@ void LLPanelRegionTerrainInfo::onSetRegionToDefaultWL(void* userData) void LLPanelRegionTerrainInfo::cancelChanges() { - LLFloaterWindLight::instance()->close(); - LLFloaterWater::instance()->close(); - LLFloaterDayCycle::instance()->close(); + LLFloaterWindLight::instance()->closeFloater(); + LLFloaterWater::instance()->closeFloater(); + LLFloaterDayCycle::instance()->closeFloater(); // disable commmit and cancel LLPanelRegionTerrainInfo::instance()->setCommitControls(false); @@ -2130,14 +2131,14 @@ bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) return rv; } -void LLFloaterRegionInfo::close(bool app_quitting) +void LLFloaterRegionInfo::closeFloater(bool app_quitting) { if(!app_quitting) { LLEnvManager::getInstance()->maybeClearEditingScope(true, false); - LLPanelRegionTerrainInfo::close(app_quitting); + LLPanelRegionTerrainInfo::closeFloater(app_quitting); } - LLFloater::close(app_quitting); + LLFloater::closeFloater(app_quitting); } void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl) diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 2fdec5a944..b1f7e88d33 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -73,6 +73,8 @@ public: /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ BOOL postBuild(); + /*virtual*/void closeFloater(bool app_quitting); + static void processEstateOwnerRequest(LLMessageSystem* msg, void**); // get and process region info if necessary. @@ -236,7 +238,7 @@ public: static LLPanelRegionTerrainInfo* instance(); virtual BOOL postBuild(); // LLPanel - static void close(bool app_quitting); + static void closeFloater(bool app_quitting); F32 getSunHour(); virtual bool refreshFromRegion(LLViewerRegion* region); // refresh local settings from region update from simulator diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp index a443b788fb..4bc8523d0a 100644 --- a/indra/newview/llfloaterwater.cpp +++ b/indra/newview/llfloaterwater.cpp @@ -45,6 +45,7 @@ #include "llfloaterdaycycle.h" #include "llboost.h" #include "llmultisliderctrl.h" +#include "llnotifications.h" #include "v4math.h" #include "llviewerdisplay.h" @@ -104,6 +105,47 @@ BOOL LLFloaterWater::postBuild() syncMenu(); return TRUE; } + +//static +LLFloaterWater* LLFloaterWater::instance() +{ + if (!sWater) + { + sWater = new LLFloaterWater(LLSD()); + } + return sWater; +} + +void LLFloaterWater::show(LLEnvKey::EScope scope) +{ + LLFloaterWater* water = instance(); + + if(scope != sScope && ((LLView*)water)->getVisible()) + { + LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD(), LLSD()); + return; + } + sScope = scope; + std::string scope_str = ""; + switch(sScope) + { + case LLEnvKey::SCOPE_LOCAL: + scope_str = LLTrans::getString("LocalSettings"); + break; + case LLEnvKey::SCOPE_REGION: + scope_str = LLTrans::getString("RegionSettings"); + break; + } + std::string title = sOriginalTitle + " (" + scope_str + ")"; + water->setTitle(title); + water->syncMenu(); + + LLEnvManager::instance().startEditingScope(scope); + + water->openFloater(); + +} + void LLFloaterWater::initCallbacks(void) { LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); @@ -620,7 +662,7 @@ void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl) std::string data = ctrl->getValue().asString(); if(!data.empty()) { - LLWaterParamManager::instance()->loadPreset(data); + LLWaterParamManager::instance().loadPreset(data); syncMenu(); } } diff --git a/indra/newview/llfloaterwater.h b/indra/newview/llfloaterwater.h index 57fb9745b1..8b3915bfe9 100644 --- a/indra/newview/llfloaterwater.h +++ b/indra/newview/llfloaterwater.h @@ -35,6 +35,7 @@ #include #include "llwlparamset.h" +#include "llenvmanager.h" struct WaterVector2Control; struct WaterVector3Control; @@ -53,6 +54,11 @@ public: /// initialize all void initCallbacks(void); + // one instance only + static LLFloaterWater* instance(); + + void show(LLEnvKey::EScope scope); + bool newPromptCallback(const LLSD& notification, const LLSD& response); /// general purpose callbacks for dealing with color controllers @@ -103,6 +109,8 @@ private: static std::set sDefaultPresets; static LLEnvKey::EScope sScope; static std::string sOriginalTitle; + + static LLFloaterWater* sWater; }; diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp index 960a552b3d..d5ba0befec 100644 --- a/indra/newview/llfloaterwindlight.cpp +++ b/indra/newview/llfloaterwindlight.cpp @@ -48,6 +48,7 @@ #include "lllineeditor.h" #include "llfloaterdaycycle.h" #include "llboost.h" +#include "llnotifications.h" #include "v4math.h" #include "llviewerdisplay.h" @@ -68,9 +69,8 @@ std::string LLFloaterWindLight::sOriginalTitle; static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f; -LLFloaterWindLight::LLFloaterWindLight() : LLFloater(std::string("windlight floater")) +LLFloaterWindLight::LLFloaterWindLight(const LLSD &key) : LLFloater(key) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_windlight_options.xml", NULL, FALSE); sOriginalTitle = getTitle(); // add the combo boxes @@ -207,6 +207,8 @@ void LLFloaterWindLight::initCallbacks(void) { childSetCommitCallback("WLCloudDetailDensity", onColorControlBMoved, ¶m_mgr->mCloudDetail); // Cloud extras + static std::string use_classic_clouds = "SkyUseClassicClouds"; + childSetCommitCallback("WLCloudCoverage", onFloatControlMoved, ¶m_mgr->mCloudCoverage); childSetCommitCallback("WLCloudScale", onFloatControlMoved, ¶m_mgr->mCloudScale); childSetCommitCallback("WLCloudLockX", onCloudScrollXToggled, NULL); @@ -214,7 +216,7 @@ void LLFloaterWindLight::initCallbacks(void) { childSetCommitCallback("WLCloudScrollX", onCloudScrollXMoved, NULL); childSetCommitCallback("WLCloudScrollY", onCloudScrollYMoved, NULL); childSetCommitCallback("WLDistanceMult", onFloatControlMoved, ¶m_mgr->mDistanceMult); - childSetCommitCallback("DrawClassicClouds", LLSavedSettingsGlue::setBOOL, (void*)"SkyUseClassicClouds"); + //childSetCommitCallback("DrawClassicClouds", LLSavedSettingsGlue::setBOOL, (void*)&use_classic_clouds); // WL Top childSetAction("WLDayCycleMenuButton", onOpenDayCycle, NULL); @@ -226,8 +228,7 @@ void LLFloaterWindLight::initCallbacks(void) { childSetAction("WLSavePreset", onSavePreset, comboBox); childSetAction("WLDeletePreset", onDeletePreset, comboBox); - comboBox->setCommitCallback(onChangePresetName); - + //childSetAction("WLPresetsCombo", onChangePresetName, comboBox); // Dome childSetCommitCallback("WLGamma", onFloatControlMoved, ¶m_mgr->mWLGamma); @@ -236,10 +237,8 @@ void LLFloaterWindLight::initCallbacks(void) { void LLFloaterWindLight::onClickHelp(void* data) { - LLFloaterWindLight* self = LLFloaterWindLight::instance(); - const std::string xml_alert = *(std::string*)data; - LLNotifications::instance().add(self->contextualNotification(xml_alert)); + LLNotifications::instance().add(xml_alert, LLSD(), LLSD()); } void LLFloaterWindLight::initHelpBtn(const std::string& name, const std::string& xml_alert) @@ -304,7 +303,7 @@ bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& } else { - LLNotifications::instance().add("ExistsSkyPresetAlert"); + LLNotifications::instance().add("ExistsSkyPresetAlert", LLSD(), LLSD()); } } return false; @@ -448,16 +447,17 @@ LLFloaterWindLight* LLFloaterWindLight::instance() { if (!sWindLight) { - sWindLight = new LLFloaterWindLight(); + sWindLight = new LLFloaterWindLight("WindLight floater"); } return sWindLight; } + void LLFloaterWindLight::show(LLEnvKey::EScope scope) { LLFloaterWindLight* windLight = instance(); if(scope != sScope && ((LLView*)windLight)->getVisible()) { - LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD()); + LLNotifications::instance().add("EnvOtherScopeAlreadyOpen", LLSD(), LLSD()); return; } sScope = scope; @@ -481,7 +481,7 @@ void LLFloaterWindLight::show(LLEnvKey::EScope scope) //LLUICtrlFactory::getInstance()->buildFloater(windLight, "floater_windlight_options.xml"); //windLight->initCallbacks(); - windLight->open(); + windLight->openFloater(); } bool LLFloaterWindLight::isOpen() @@ -824,7 +824,7 @@ void LLFloaterWindLight::onSavePreset(void* userData) LLWLParamKey(comboBox->getSelectedValue())); if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets")) { - LLNotifications::instance().add("WLNoEditDefault"); + LLNotifications::instance().add("WLNoEditDefault", LLSD(), LLSD()); return; } @@ -896,7 +896,7 @@ bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLS std::set::iterator sIt = sDefaultPresets.find(key); if(sIt != sDefaultPresets.end()) { - LLNotifications::instance().add("WLNoEditDefault"); + LLNotifications::instance().add("WLNoEditDefault", LLSD(), LLSD()); return false; } diff --git a/indra/newview/llfloaterwindlight.h b/indra/newview/llfloaterwindlight.h index c0fea2558c..3b137e601f 100644 --- a/indra/newview/llfloaterwindlight.h +++ b/indra/newview/llfloaterwindlight.h @@ -50,7 +50,7 @@ struct WLFloatControl; class LLFloaterWindLight : public LLFloater { public: - LLFloaterWindLight(); + LLFloaterWindLight(const LLSD &key); virtual ~LLFloaterWindLight(); /// initialize all diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 614eb6ed88..808ab1e344 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7630,7 +7630,7 @@ class LLWorldEnvSettings : public view_listener_t } else if(gSavedSettings.getBOOL("UseEnvironmentFromRegion")) { - LLNotifications::instance().add("EnvLockedUsingRegion", LLSD()); + LLNotifications::instance().add("EnvLockedUsingRegion", LLSD(), LLSD()); } else { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0ed254bbc5..9b4c85fb0c 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1495,8 +1495,3 @@ std::string LLViewerRegion::getDescription() const { return stringize(*this); } - -std::string LLViewerRegion::getDescription() const -{ - return stringize(*this); -} diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 307e2cf3a2..284503361a 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -400,11 +400,6 @@ private: LLEventPoll* mEventPoll; - /// Post an event to this LLCapabilityListener to invoke a capability message on - /// this LLViewerRegion's server - /// (https://wiki.lindenlab.com/wiki/Viewer:Messaging/Messaging_Notes#Capabilities) - LLCapabilityListener mCapabilityListener; - /// Post an event to this LLCapabilityListener to invoke a capability message on /// this LLViewerRegion's server /// (https://wiki.lindenlab.com/wiki/Viewer:Messaging/Messaging_Notes#Capabilities) diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index c984938303..61a69bdde1 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -78,6 +78,11 @@ LLWaterParamManager::~LLWaterParamManager() { } +LLWaterParamManager::cleanupClass() +{ + // TODO: what needs to be cleaned up? +} + void LLWaterParamManager::loadAllPresets(const std::string& file_name) { std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", "")); @@ -254,11 +259,11 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader) } } -static LLFastTimer::DeclareTimer FTM_UPDATE_WLPARAM("Update Windlight Params"); +static LLFastTimer::DeclareTimer FTM_UPDATE_WATERPARAM("Update Water Params"); void LLWaterParamManager::update(LLViewerCamera * cam) { - LLFastTimer ftm(FTM_UPDATE_WLPARAM); + LLFastTimer ftm(FTM_UPDATE_WATERPARAM); // update the shaders and the menu propagateParameters(); diff --git a/indra/newview/llwlanimator.cpp b/indra/newview/llwlanimator.cpp index 2e249b9701..3d51ad89ff 100644 --- a/indra/newview/llwlanimator.cpp +++ b/indra/newview/llwlanimator.cpp @@ -47,7 +47,7 @@ LLWLAnimator::LLWLAnimator() : mStartTime(0.f), mDayRate(1.f), mDayTime(0.f), void LLWLAnimator::update(LLWLParamSet& curParams) { - llassert(mUseLindenTime != mUseLocalTime); + //llassert(mUseLindenTime != mUseLocalTime); F64 curTime; curTime = getDayTime(); diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp index 52bbb4b5fc..b36fa5c485 100644 --- a/indra/newview/llwldaycycle.cpp +++ b/indra/newview/llwldaycycle.cpp @@ -36,6 +36,7 @@ #include "llsdserialize.h" #include "llwlparammanager.h" #include "llfloaterdaycycle.h" +#include "llnotifications.h" #include "llviewerwindow.h" @@ -84,7 +85,7 @@ void LLWLDayCycle::loadDayCycle(const LLSD& day_data, LLWLParamKey::EScope scope // alert the user LLSD args; args["SKY"] = day_data[i][1].asString(); - LLNotifications::instance().add("WLMissingSky", args); + LLNotifications::instance().add("WLMissingSky", LLSD(), args); continue; } } diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp index c4f11cf00a..f09692b2b7 100644 --- a/indra/newview/llwlhandlers.cpp +++ b/indra/newview/llwlhandlers.cpp @@ -37,6 +37,7 @@ #include "llagent.h" #include "llviewerregion.h" #include "llenvmanager.h" +#include "llnotifications.h" /**** * LLEnvironmentRequestResponder @@ -108,7 +109,7 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content) { LLSD args(LLSD::emptyMap()); args["WAIT"] = (F64)UPDATE_WAIT_SECONDS; - LLNotifications::instance().add("EnvUpdateRate", args); + LLNotifications::instance().add("EnvUpdateRate", LLSD(), args); return false; } @@ -139,7 +140,7 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content) LL_WARNS("WindlightCaps") << "Region couldn't apply windlight settings! Reason from sim: " << content["fail_reason"].asString() << LL_ENDL; LLSD args(LLSD::emptyMap()); args["FAIL_REASON"] = content["fail_reason"].asString(); - LLNotifications::instance().add("WLRegionApplyFail", args); + LLNotifications::instance().add("WLRegionApplyFail", LLSD(), args); } LLEnvManager::getInstance()->commitSettingsFinished(LLEnvKey::SCOPE_REGION); @@ -153,7 +154,7 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content) LLSD args(LLSD::emptyMap()); args["FAIL_REASON"] = msg.str(); - LLNotifications::instance().add("WLRegionApplyFail", args); + LLNotifications::instance().add("WLRegionApplyFail", LLSD(), args); LLEnvManager::getInstance()->commitSettingsFinished(LLEnvKey::SCOPE_REGION); } diff --git a/indra/newview/llwlhandlers.h b/indra/newview/llwlhandlers.h index a50404f2e1..811dc4bb73 100644 --- a/indra/newview/llwlhandlers.h +++ b/indra/newview/llwlhandlers.h @@ -34,6 +34,7 @@ #define LL_LLWLHANDLERS_H #include "llviewerprecompiledheaders.h" +#include "llhttpclient.h" class LLEnvManager; diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index 493d066942..3070fed81f 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -433,9 +433,11 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader) } +static LLFastTimer::DeclareTimer FTM_UPDATE_WLPARAM("Update Windlight Params"); + void LLWLParamManager::propagateParameters(void) { - LLFastTimer ftm(LLFastTimer::FTM_UPDATE_WLPARAM); + LLFastTimer ftm(FTM_UPDATE_WLPARAM); LLVector4 sunDir; LLVector4 moonDir; @@ -459,7 +461,7 @@ void LLWLParamManager::propagateParameters(void) { mLightDir = sunDir; } - else if(sunDir.mV[1] < 0 && sunDir.mV[1] > NIGHTTIME_ELEVATION_COS) + else if(sunDir.mV[1] < 0 && sunDir.mV[1] > LLSky::NIGHTTIME_ELEVATION_COS) { // clamp v1 to 0 so sun never points up and causes weirdness on some machines LLVector3 vec(sunDir.mV[0], sunDir.mV[1], sunDir.mV[2]); @@ -506,7 +508,7 @@ void LLWLParamManager::propagateParameters(void) void LLWLParamManager::update(LLViewerCamera * cam) { - LLFastTimer ftm(LLFastTimer::FTM_UPDATE_WLPARAM); + LLFastTimer ftm(FTM_UPDATE_WLPARAM); // update clouds, sun, and general mCurParams.updateCloudScrolling(); diff --git a/indra/newview/skins/default/xui/en/floater_day_cycle_options.xml b/indra/newview/skins/default/xui/en/floater_day_cycle_options.xml index 65e2462ef8..84812b9de6 100644 --- a/indra/newview/skins/default/xui/en/floater_day_cycle_options.xml +++ b/indra/newview/skins/default/xui/en/floater_day_cycle_options.xml @@ -1,558 +1,250 @@ - - - - - - - 12am - - - 3am - - - 6am - - - 9am - - - 12pm - - - 3pm - - - 6pm - - - 9pm - - - 12am - - - | - - - I - - - | - - - I - - - | - - - I - - - | - - - I - - - | - - + + Cache location: + + + + + UI size: diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index bdc21960cd..1c22a5c02e 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -93,98 +93,6 @@ name="connection_port" top_delta="3" width="170" /> - - Cache size - - - - MB - - - Cache location: - - - - Date: Fri, 20 May 2011 17:19:03 -0400 Subject: fix more DOS line endings --- indra/newview/lldrawpoolbump.cpp | 6 +- indra/newview/llfloaterbuyland.cpp | 18 +- indra/newview/llviewermessage.cpp | 8 +- indra/newview/llviewerparcelmgr.cpp | 6 +- indra/newview/llviewerprecompiledheaders.h | 4 +- indra/newview/llviewertexturelist.cpp | 4 +- indra/newview/skins/default/xui/en/strings.xml | 150 +- .../skins/default/xui/es/floater_about_land.xml | 968 +-- .../skins/default/xui/es/floater_report_abuse.xml | 206 +- .../newview/skins/default/xui/es/notifications.xml | 5904 ++++++------- .../skins/default/xui/es/panel_group_general.xml | 116 +- .../default/xui/es/panel_preferences_general.xml | 146 +- .../skins/default/xui/es/panel_region_covenant.xml | 166 +- indra/newview/skins/default/xui/es/strings.xml | 8692 ++++++++++---------- 14 files changed, 8197 insertions(+), 8197 deletions(-) (limited to 'indra') diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 29b50761d8..5f89d11391 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -889,9 +889,9 @@ void LLBumpImageList::destroyGL() void LLBumpImageList::restoreGL() { - if(!gTextureList.isInitialized()) - { - return ; + if(!gTextureList.isInitialized()) + { + return ; } LLStandardBumpmap::restoreGL(); diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 50b19a4221..610142b5a9 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -461,15 +461,15 @@ void LLFloaterBuyLandUI::updateParcelInfo() if (!authorizedBuyer.isNull() && buyer != authorizedBuyer) { - // Maybe the parcel is set for sale to a group we are in. - bool authorized_group = - gAgent.hasPowerInGroup(authorizedBuyer,GP_LAND_DEED) - && gAgent.hasPowerInGroup(authorizedBuyer,GP_LAND_SET_SALE_INFO); - - if (!authorized_group) - { - mCannotBuyReason = getString("set_to_sell_to_other"); - return; + // Maybe the parcel is set for sale to a group we are in. + bool authorized_group = + gAgent.hasPowerInGroup(authorizedBuyer,GP_LAND_DEED) + && gAgent.hasPowerInGroup(authorizedBuyer,GP_LAND_SET_SALE_INFO); + + if (!authorized_group) + { + mCannotBuyReason = getString("set_to_sell_to_other"); + return; } } } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 86b56df556..fdd1199b78 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5376,10 +5376,10 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) { // notification was specified using the new mechanism, so we can just handle it here std::string notificationID; - msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, notificationID); - if (!LLNotifications::getInstance()->templateExists(notificationID)) - { - return false; + msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, notificationID); + if (!LLNotifications::getInstance()->templateExists(notificationID)) + { + return false; } std::string llsdRaw; diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 5ae4e872f3..8db72da1ee 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -2202,9 +2202,9 @@ bool LLViewerParcelMgr::canAgentBuyParcel(LLParcel* parcel, bool forGroup) const = parcelOwner == (forGroup ? gAgent.getGroupID() : gAgent.getID()); bool isAuthorized - = (authorizeBuyer.isNull() - || (gAgent.getID() == authorizeBuyer) - || (gAgent.hasPowerInGroup(authorizeBuyer,GP_LAND_DEED) + = (authorizeBuyer.isNull() + || (gAgent.getID() == authorizeBuyer) + || (gAgent.hasPowerInGroup(authorizeBuyer,GP_LAND_DEED) && gAgent.hasPowerInGroup(authorizeBuyer,GP_LAND_SET_SALE_INFO))); return isForSale && !isOwner && isAuthorized && isEmpowered; diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 45c9b3e91f..faa86d43dd 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -118,8 +118,8 @@ // Library includes from llvfs #include "lldir.h" - -// Library includes from llmessage project + +// Library includes from llmessage project #include "llcachename.h" #endif diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index d9ff931575..cd6653b0c7 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -110,8 +110,8 @@ void LLViewerTextureList::doPreloadImages() { LL_DEBUGS("ViewerImages") << "Preloading images..." << LL_ENDL; - llassert_always(mInitialized) ; - llassert_always(mImageList.empty()) ; + llassert_always(mInitialized) ; + llassert_always(mImageList.empty()) ; llassert_always(mUUIDMap.empty()) ; // Set the "missing asset" image diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 2a6af23d3a..f8c90106b7 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -58,81 +58,81 @@ Quit http://join.secondlife.com/ - -The viewer you are using can no longer access Second Life. Please visit the following page to download a new viewer: -http://secondlife.com/download - -For more information, see our FAQ below: -http://secondlife.com/viewer-access-faq - Optional viewer update available: [VERSION] - Required viewer update: [VERSION] - This agent is already logged in. - - Sorry! We couldn't log you in. -Please check to make sure you entered the right - * Username (like bobsmith12 or steller.sunshine) - * Password -Also, please make sure your Caps Lock key is off. - As a security precaution your password has been changed. -Please go to your account page at http://secondlife.com/password -and answer the security question to reset your password. -We are very sorry for the inconvenience. - We made some changes to our system and you will need to reset your password. -Please go to your account page at http://secondlife.com/password -and answer the security question to reset your password. -We are very sorry for the inconvenience. - Second Life is temporarily closed for maintenance. -Logins are currently restricted to employees only. -Check www.secondlife.com/status for updates. - Second Life logins are temporarily restricted in order to make sure that those in-world have the best possible experience. - -People with free accounts will not be able to access Second Life during this time, to make room for those who have paid for Second Life. - Second Life cannot be accessed from this computer. -If you feel this is an error, please contact -support@secondlife.com. - Your account is not accessible until -[TIME] Pacific Time. - We are unable to complete your request at this time. -Please contact Second Life support for assistance at http://secondlife.com/support. -If you are unable to change your password, please call (866) 476-9763. - Data inconsistency found during login. -Please contact support@secondlife.com. - Your account is undergoing minor maintenance. -Your account is not accessible until -[TIME] Pacific Time. -If you feel this is an error, please contact support@secondlife.com. - Request for logout responded with a fault from simulator. - The system is logging you out right now. -Your Account will not be available until -[TIME] Pacific Time. - Unable to create valid session. - Unable to connect to a simulator. - Your account can only access Second Life -between [START] and [END] Pacific Time. -Please come back during those hours. -If you feel this is an error, please contact support@secondlife.com. - Incorrect parameters. -If you feel this is an error, please contact support@secondlife.com. - First name parameter must be alphanumeric. -If you feel this is an error, please contact support@secondlife.com. - Last name parameter must be alphanumeric. -If you feel this is an error, please contact support@secondlife.com. - Region is going offline. -Please try logging in again in a minute. - Agent not in region. -Please try logging in again in a minute. - The region was logging in another session. -Please try logging in again in a minute. - The region was logging out the previous session. -Please try logging in again in a minute. - The region is still logging out the previous session. -Please try logging in again in a minute. - Region has logged out last session. -Please try logging in again in a minute. - Region has begun the logout process. -Please try logging in again in a minute. - The system has begun logging out your last session. -Please try logging in again in a minute. + +The viewer you are using can no longer access Second Life. Please visit the following page to download a new viewer: +http://secondlife.com/download + +For more information, see our FAQ below: +http://secondlife.com/viewer-access-faq + Optional viewer update available: [VERSION] + Required viewer update: [VERSION] + This agent is already logged in. + + Sorry! We couldn't log you in. +Please check to make sure you entered the right + * Username (like bobsmith12 or steller.sunshine) + * Password +Also, please make sure your Caps Lock key is off. + As a security precaution your password has been changed. +Please go to your account page at http://secondlife.com/password +and answer the security question to reset your password. +We are very sorry for the inconvenience. + We made some changes to our system and you will need to reset your password. +Please go to your account page at http://secondlife.com/password +and answer the security question to reset your password. +We are very sorry for the inconvenience. + Second Life is temporarily closed for maintenance. +Logins are currently restricted to employees only. +Check www.secondlife.com/status for updates. + Second Life logins are temporarily restricted in order to make sure that those in-world have the best possible experience. + +People with free accounts will not be able to access Second Life during this time, to make room for those who have paid for Second Life. + Second Life cannot be accessed from this computer. +If you feel this is an error, please contact +support@secondlife.com. + Your account is not accessible until +[TIME] Pacific Time. + We are unable to complete your request at this time. +Please contact Second Life support for assistance at http://secondlife.com/support. +If you are unable to change your password, please call (866) 476-9763. + Data inconsistency found during login. +Please contact support@secondlife.com. + Your account is undergoing minor maintenance. +Your account is not accessible until +[TIME] Pacific Time. +If you feel this is an error, please contact support@secondlife.com. + Request for logout responded with a fault from simulator. + The system is logging you out right now. +Your Account will not be available until +[TIME] Pacific Time. + Unable to create valid session. + Unable to connect to a simulator. + Your account can only access Second Life +between [START] and [END] Pacific Time. +Please come back during those hours. +If you feel this is an error, please contact support@secondlife.com. + Incorrect parameters. +If you feel this is an error, please contact support@secondlife.com. + First name parameter must be alphanumeric. +If you feel this is an error, please contact support@secondlife.com. + Last name parameter must be alphanumeric. +If you feel this is an error, please contact support@secondlife.com. + Region is going offline. +Please try logging in again in a minute. + Agent not in region. +Please try logging in again in a minute. + The region was logging in another session. +Please try logging in again in a minute. + The region was logging out the previous session. +Please try logging in again in a minute. + The region is still logging out the previous session. +Please try logging in again in a minute. + Region has logged out last session. +Please try logging in again in a minute. + Region has begun the logout process. +Please try logging in again in a minute. + The system has begun logging out your last session. +Please try logging in again in a minute. diff --git a/indra/newview/skins/default/xui/es/floater_about_land.xml b/indra/newview/skins/default/xui/es/floater_about_land.xml index 9ec9fcc581..c3f4310103 100644 --- a/indra/newview/skins/default/xui/es/floater_about_land.xml +++ b/indra/newview/skins/default/xui/es/floater_about_land.xml @@ -1,484 +1,484 @@ - - - - "Parcel_PG_Dark" - - - "Parcel_M_Dark" - - - "Parcel_R_Dark" - - - [MINUTES] minutos - - - minuto - - - [SECONDS] segundos - - - restantes - - - - - Sólo nuevos Residentes - - - Cualquiera - - - Superficie - - - [AREA] m² - - - ID de la subasta: [ID] - - - Debe aprobar su compra para modificar este terreno. - - - (Propiedad del grupo) - - - Perfil... - - - Información... - - - (público) - - - (ninguno) - - - (Venta pendiente) - - - No se ha seleccionado una parcela. -Vaya al menú Mundo > Acerca del terreno o seleccione otra parcela para ver sus características. - - - [wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local] - - - Nombre: - - - Descripción: - - - Tipo: - - - Mainland / Homestead - - - Calificación: - - - Adulto - - - Propietario: - - - Grupo: - - Just a panel - + + + + + - Just a panel 2 - - - - - - + Just a panel + + Date: Mon, 23 May 2011 17:12:08 -0700 Subject: EXP-826 FIX Help -> About Secondlife Info is corrupted. --- indra/llkdu/llimagej2ckdu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index 39ae09650e..c156ed0cef 100644 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -73,7 +73,7 @@ void set_default_colour_weights(kdu_params *siz); const char* engineInfoLLImageJ2CKDU() { - std::string version = llformat("KDU %s", KDU_CORE_VERSION); + static std::string version = llformat("KDU %s", KDU_CORE_VERSION); return version.c_str(); } -- cgit v1.2.3 From 4719cb1efe25384b01b7243805e69ff13322ff4b Mon Sep 17 00:00:00 2001 From: eli_linden Date: Mon, 23 May 2011 17:33:52 -0700 Subject: FIX VWR-25027 --- indra/newview/skins/default/xui/it/floater_water.xml | 4 ++-- indra/newview/skins/default/xui/it/floater_windlight_options.xml | 3 ++- indra/newview/skins/default/xui/pt/floater_water.xml | 4 ++-- indra/newview/skins/default/xui/pt/floater_windlight_options.xml | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/it/floater_water.xml b/indra/newview/skins/default/xui/it/floater_water.xml index c6ab646fbf..b25f0a6266 100644 --- a/indra/newview/skins/default/xui/it/floater_water.xml +++ b/indra/newview/skins/default/xui/it/floater_water.xml @@ -1,9 +1,9 @@ - + Impostazioni predeterminate dell'acqua: - + - - Just a panel - - - - - - - - + + + + + + + - Just a panel + -- cgit v1.2.3 From a0af5e972a4c293cb8b2aff5d6d98baa7015f864 Mon Sep 17 00:00:00 2001 From: eli_linden Date: Wed, 25 May 2011 11:53:02 -0700 Subject: FIX VWR-25039 en_xui_change --- indra/newview/skins/default/xui/de/panel_group_notices.xml | 2 +- indra/newview/skins/default/xui/en/panel_group_notices.xml | 10 +++++----- indra/newview/skins/default/xui/it/panel_group_notices.xml | 9 +++------ indra/newview/skins/default/xui/nl/panel_group_notices.xml | 9 +++------ indra/newview/skins/default/xui/pl/panel_group_notices.xml | 2 +- indra/newview/skins/default/xui/pt/panel_group_notices.xml | 9 +++------ 6 files changed, 16 insertions(+), 25 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/de/panel_group_notices.xml b/indra/newview/skins/default/xui/de/panel_group_notices.xml index 8c1df04ed8..df423cc69a 100644 --- a/indra/newview/skins/default/xui/de/panel_group_notices.xml +++ b/indra/newview/skins/default/xui/de/panel_group_notices.xml @@ -49,7 +49,7 @@ Maximal 200 pro Gruppe täglich Archivierte Mitteilung - Um eine neue Mitteilung zu senden, klicken Sie die Schaltfläche + + Um eine neue Mitteilung zu senden, klicken Sie die + Neue Mitteilung Betreff: diff --git a/indra/newview/skins/default/xui/en/panel_group_notices.xml b/indra/newview/skins/default/xui/en/panel_group_notices.xml index 600b0e3b71..607e1bb213 100644 --- a/indra/newview/skins/default/xui/en/panel_group_notices.xml +++ b/indra/newview/skins/default/xui/en/panel_group_notices.xml @@ -84,7 +84,7 @@ Maximum 200 per group daily name="create_new_notice" tool_tip="Create a new notice" top_delta="0" - width="93" /> + width="127" /> - - - - - - - - - Upload Model - - - - This wizard will help you import mesh models to Second Life. First specify a file containing the model you wish to import. Second Life supports COLLADA (.dae) files. - - - - Filename: - - - - - Model Preview: - - - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - - Note: - - -Advanced users familiar with 3d content creation tools may prefer to use the [secondlife:///app/floater/upload_model Advanced Mesh Import Window] . - - - - - - - - - Optimize - - - - This wizard has optimized your model to improve performance. You may adjust the results of the optimization process bellow or click Next to continue. - - - Generating Level of Detail - - - Generate Level of Detail: High - - Generate Level of Detail: Medium - - Generate Level of Detail: Low - - Generate Level of Detail: Lowest - - - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - Higher Performance - Faster rendering but less detailed; lowers Resource (prim) cost. - Higher Accuracy - More detailed model but slower; increases Resource (prim) cost. - - - ' - - - - - - Resource Cost: [COST] - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - - - - - - - Physics - - - - The wizard will create a physical shape, which determines how the object interacts with other objects and avatars. Set the slider to the detail level most appropriate for how your object will be used: - - - Performance - Faster rendering but less detailed; lowers Resource (prim) cost. - Accuracy - More detailed model but slower; increases Resource (prim) cost. - - - ' ' ' ' ' ' ' ' ' ' ' - Recommended for solid objects - Recommended for buildings - Recommended for vehicles - - - - - Resource Cost: [COST] - - - - - - - - Physics - - - - Preview the physics shape below then click Next to continue. To modify the physics shape, click the Back button. - - - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - Resource Cost: [COST] - - - - - - - Review - - - - Review the details below then click. Upload to upload your model. Your L$ balance will be charged when you click Upload. - - - - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - - Resource Cost: [COST] - This is the cost to your Region's prim/object limit, at default scale - Physics Cost: [COST] - This is the cost to your Region's prim/object limit, at default scale - Upload Fee: - This is the amount the upload will cost. - - I confirm that I have the appropriate rights to the material contained in this model. [secondlife:///app/floater/learn_more Learn more] - - - - - - - - - Upload Complete! - - - - Congratulations! Your model has been sucessfully uploaded. You will find the model in the Objects folder in your inventory. - - - - - - - + + + + + + + + + Upload Model + + + + This wizard will help you import mesh models to Second Life. First specify a file containing the model you wish to import. Second Life supports COLLADA (.dae) files. + + + + Filename: + + + + + Model Preview: + + + + + + Dimensions (meters): + + + X: Y: Z: + + + | | + + + + + + Note: + + +Advanced users familiar with 3d content creation tools may prefer to use the [secondlife:///app/floater/upload_model Advanced Mesh Import Window] . + + + + + + + + + Optimize + + + + This wizard has optimized your model to improve performance. You may adjust the results of the optimization process bellow or click Next to continue. + + + Generating Level of Detail + + + Generate Level of Detail: High + + Generate Level of Detail: Medium + + Generate Level of Detail: Low + + Generate Level of Detail: Lowest + + + + Model Preview: + + + + High + + + Medium + + + Low + + + Lowest + + + + + Higher Performance + Faster rendering but less detailed; lowers Resource (prim) cost. + Higher Accuracy + More detailed model but slower; increases Resource (prim) cost. + + + ' + + + + + + Resource Cost: [COST] + + Dimensions (meters): + + + X: Y: Z: + + + | | + + + + + + + + + + + Physics + + + + The wizard will create a physical shape, which determines how the object interacts with other objects and avatars. Set the slider to the detail level most appropriate for how your object will be used: + + + Higher Performance + Faster rendering but less detailed; lowers Resource (prim) cost. + Higher Accuracy + More detailed model but slower; increases Resource (prim) cost. + + + ' ' ' ' ' ' ' ' ' ' ' + Recommended for solid objects + Recommended for buildings + Recommended for vehicles + + + + + Resource Cost: [COST] + + + + + + + + Physics + + + + Preview the physics shape below then click Next to continue. To modify the physics shape, click the Back button. + + + + Model Preview: + + + + High + + + Medium + + + Low + + + Lowest + + + + + + Dimensions (meters): + + + X: Y: Z: + + + | | + + + + + Resource Cost: [COST] + + + + + + + Review + + + + Review the details below then click. Upload to upload your model. Your L$ balance will be charged when you click Upload. + + + + + Model Preview: + + + + High + + + Medium + + + Low + + + Lowest + + + + + + Dimensions (meters): + + + X: Y: Z: + + + | | + + + + + + Resource Cost: [COST] + This is the cost to your Region's prim/object limit, at default scale + Physics Cost: [COST] + This is the cost to your Region's prim/object limit, at default scale + Upload Fee: + This is the amount the upload will cost. + + I confirm that I have the appropriate rights to the material contained in this model. [secondlife:///app/floater/learn_more Learn more] + + + + + + + + + Upload Complete! + + + + Congratulations! Your model has been sucessfully uploaded. You will find the model in the Objects folder in your inventory. + + + + + + + - - - - - - Drag to move, shift-drag to copy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - þ: [COUNT] - - - - Stretch Both Sides - - - - - - - - - - - - - Objects: [COUNT] - - - Prims: [COUNT] - - - Linked Sets: [COUNT] - - - Cost: [COST] / [PHYSICS] - - - Objects: [COUNT] - - - Cost: [COST] / [PHYSICS] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deed - - - Deed - - - You can modify this object - - - You can modify these objects - - - You can't modify this object - - - You can't modify these objects - - - You must select entire object to set permissions - - - Price: L$ - - - Total Price: L$ - - - Price Per: L$ - - - Mixed Price - - - Mixed Sale - - - Name: - - - - Description: - - - - Creator: - - - - TestString PleaseIgnore (please.ignore) - - - Owner: - - - - TestString PleaseIgnore (please.ignore) - - - Group: - - - - - - - - + + + + + + Drag to move, shift-drag to copy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + þ: [COUNT] + + + + Stretch Both Sides + + + + + + + + + + + + + Objects: [COUNT] + + + Prims: [COUNT] + + + Linked Sets: [COUNT] + + + Cost: [COST] / [PHYSICS] + + + Objects: [COUNT] + + + Cost: [COST] / [PHYSICS] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deed + + + Deed + + + You can modify this object + + + You can modify these objects + + + You can't modify this object + + + You can't modify these objects + + + You must select entire object to set permissions + + + Price: L$ + + + Total Price: L$ + + + Price Per: L$ + + + Mixed Price + + + Mixed Sale + + + Name: + + + + Description: + + + + Creator: + + + + TestString PleaseIgnore (please.ignore) + + + Owner: + + + + TestString PleaseIgnore (please.ignore) + + + Group: + + + + + + + + - - - - - - - - - Upload Model - - - - This wizard will help you import mesh models to Second Life. First specify a file containing the model you wish to import. Second Life supports COLLADA (.dae) files. - - - - Filename: - - - - - Model Preview: - - - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - - Note: - - -Advanced users familiar with 3d content creation tools may prefer to use the [secondlife:///app/floater/upload_model Advanced Mesh Import Window] . - - - - - - - - - Optimize - - - - This wizard has optimized your model to improve performance. You may adjust the results of the optimization process bellow or click Next to continue. - - - Generating Level of Detail - - - Generate Level of Detail: High - - Generate Level of Detail: Medium - - Generate Level of Detail: Low - - Generate Level of Detail: Lowest - - - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - Higher Performance - Faster rendering but less detailed; lowers Resource (prim) cost. - Higher Accuracy - More detailed model but slower; increases Resource (prim) cost. - - - ' - - - - - - Resource Cost: [COST] - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - - - - - - - Physics - - - - The wizard will create a physical shape, which determines how the object interacts with other objects and avatars. Set the slider to the detail level most appropriate for how your object will be used: - - - Higher Performance - Faster rendering but less detailed; lowers Resource (prim) cost. - Higher Accuracy - More detailed model but slower; increases Resource (prim) cost. - - - ' ' ' ' ' ' ' ' ' ' ' - Recommended for solid objects - Recommended for buildings - Recommended for vehicles - - - - - Resource Cost: [COST] - - - - - - - - Physics - - - - Preview the physics shape below then click Next to continue. To modify the physics shape, click the Back button. - - - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - Resource Cost: [COST] - - - - - - - Review - - - - Review the details below then click. Upload to upload your model. Your L$ balance will be charged when you click Upload. - - - - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - - Resource Cost: [COST] - This is the cost to your Region's prim/object limit, at default scale - Physics Cost: [COST] - This is the cost to your Region's prim/object limit, at default scale - Upload Fee: - This is the amount the upload will cost. - - I confirm that I have the appropriate rights to the material contained in this model. [secondlife:///app/floater/learn_more Learn more] - - - - - - - - - Upload Complete! - - - - Congratulations! Your model has been sucessfully uploaded. You will find the model in the Objects folder in your inventory. - - - - - - - + + + + + + + + + Upload Model + + + + This wizard will help you import mesh models to Second Life. First specify a file containing the model you wish to import. Second Life supports COLLADA (.dae) files. + + + + Filename: + + + + + Model Preview: + + + + + + Dimensions (meters): + + + X: Y: Z: + + + | | + + + + + + Note: + + +Advanced users familiar with 3d content creation tools may prefer to use the [secondlife:///app/floater/upload_model Advanced Mesh Import Window] . + + + + + + + + + Optimize + + + + This wizard has optimized your model to improve performance. You may adjust the results of the optimization process bellow or click Next to continue. + + + Generating Level of Detail + + + Generate Level of Detail: High + + Generate Level of Detail: Medium + + Generate Level of Detail: Low + + Generate Level of Detail: Lowest + + + + Model Preview: + + + + High + + + Medium + + + Low + + + Lowest + + + + + Higher Performance + Faster rendering but less detailed; lowers Resource (prim) cost. + Higher Accuracy + More detailed model but slower; increases Resource (prim) cost. + + + ' + + + + + + Resource Cost: [COST] + + Dimensions (meters): + + + X: Y: Z: + + + | | + + + + + + + + + + + Physics + + + + The wizard will create a physical shape, which determines how the object interacts with other objects and avatars. Set the slider to the detail level most appropriate for how your object will be used: + + + Higher Performance + Faster rendering but less detailed; lowers Resource (prim) cost. + Higher Accuracy + More detailed model but slower; increases Resource (prim) cost. + + + ' ' ' ' ' ' ' ' ' ' ' + Recommended for solid objects + Recommended for buildings + Recommended for vehicles + + + + + Resource Cost: [COST] + + + + + + + + Physics + + + + Preview the physics shape below then click Next to continue. To modify the physics shape, click the Back button. + + + + Model Preview: + + + + High + + + Medium + + + Low + + + Lowest + + + + + + Dimensions (meters): + + + X: Y: Z: + + + | | + + + + + Resource Cost: [COST] + + + + + + + Review + + + + Review the details below then click. Upload to upload your model. Your L$ balance will be charged when you click Upload. + + + + + Model Preview: + + + + High + + + Medium + + + Low + + + Lowest + + + + + + Dimensions (meters): + + + X: Y: Z: + + + | | + + + + + + Resource Cost: [COST] + This is the cost to your Region's prim/object limit, at default scale + Physics Cost: [COST] + This is the cost to your Region's prim/object limit, at default scale + Upload Fee: + This is the amount the upload will cost. + + I confirm that I have the appropriate rights to the material contained in this model. [secondlife:///app/floater/learn_more Learn more] + + + + + + + + + Upload Complete! + + + + Congratulations! Your model has been sucessfully uploaded. You will find the model in the Objects folder in your inventory. + + + + + + + - - - - - - Drag to move, shift-drag to copy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - þ: [COUNT] - - - - Stretch Both Sides - - - - - - - - - - - - - Objects: [COUNT] - - - Prims: [COUNT] - - - Linked Sets: [COUNT] - - - Cost: [COST] / [PHYSICS] - - - Objects: [COUNT] - - - Cost: [COST] / [PHYSICS] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deed - - - Deed - - - You can modify this object - - - You can modify these objects - - - You can't modify this object - - - You can't modify these objects - - - You must select entire object to set permissions - - - Price: L$ - - - Total Price: L$ - - - Price Per: L$ - - - Mixed Price - - - Mixed Sale - - - Name: - - - - Description: - - - - Creator: - - - - TestString PleaseIgnore (please.ignore) - - - Owner: - - - - TestString PleaseIgnore (please.ignore) - - - Group: - - - - - - - - + + + + + + Drag to move, shift-drag to copy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + þ: [COUNT] + + + + Stretch Both Sides + + + + + + + + + + + + + Objects: [COUNT] + + + Prims: [COUNT] + + + Linked Sets: [COUNT] + + + Cost: [COST] / [PHYSICS] + + + Objects: [COUNT] + + + Cost: [COST] / [PHYSICS] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deed + + + Deed + + + You can modify this object + + + You can modify these objects + + + You can't modify this object + + + You can't modify these objects + + + You must select entire object to set permissions + + + Price: L$ + + + Total Price: L$ + + + Price Per: L$ + + + Mixed Price + + + Mixed Sale + + + Name: + + + + Description: + + + + Creator: + + + + TestString PleaseIgnore (please.ignore) + + + Owner: + + + + TestString PleaseIgnore (please.ignore) + + + Group: + + + + + + + + - - - - - - - - - Upload Model - - - - This wizard will help you import mesh models to Second Life. First specify a file containing the model you wish to import. Second Life supports COLLADA (.dae) files. - - - - Filename: - - - - - Model Preview: - - - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - - Note: - - -Advanced users familiar with 3d content creation tools may prefer to use the [secondlife:///app/floater/upload_model Advanced Mesh Import Window] . - - - - - - - - - Optimize - - - - This wizard has optimized your model to improve performance. You may adjust the results of the optimization process bellow or click Next to continue. - - - Generating Level of Detail - - - Generate Level of Detail: High - - Generate Level of Detail: Medium - - Generate Level of Detail: Low - - Generate Level of Detail: Lowest - - - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - Higher Performance - Faster rendering but less detailed; lowers Resource (prim) cost. - Higher Accuracy - More detailed model but slower; increases Resource (prim) cost. - - - ' - - - - - - Resource Cost: [COST] - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - - - - - - - Physics - - - - The wizard will create a physical shape, which determines how the object interacts with other objects and avatars. Set the slider to the detail level most appropriate for how your object will be used: - - - Higher Performance - Faster rendering but less detailed; lowers Resource (prim) cost. - Higher Accuracy - More detailed model but slower; increases Resource (prim) cost. - - - ' ' ' ' ' ' ' ' ' ' ' - Recommended for solid objects - Recommended for buildings - Recommended for vehicles - - - - - Resource Cost: [COST] - - - - - - - - Physics - - - - Preview the physics shape below then click Next to continue. To modify the physics shape, click the Back button. - - - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - Resource Cost: [COST] - - - - - - - Review - - - - Review the details below then click. Upload to upload your model. Your L$ balance will be charged when you click Upload. - - - - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - - Resource Cost: [COST] - This is the cost to your Region's prim/object limit, at default scale - Physics Cost: [COST] - This is the cost to your Region's prim/object limit, at default scale - Upload Fee: - This is the amount the upload will cost. - - I confirm that I have the appropriate rights to the material contained in this model. [secondlife:///app/floater/learn_more Learn more] - - - - - - - - - Upload Complete! - - - - Congratulations! Your model has been sucessfully uploaded. You will find the model in the Objects folder in your inventory. - - - - - - - + + + + + + + + + Upload Model + + + + This wizard will help you import mesh models to Second Life. First specify a file containing the model you wish to import. Second Life supports COLLADA (.dae) files. + + + + Filename: + + + + + Model Preview: + + + + + + Dimensions (meters): + + + X: Y: Z: + + + | | + + + + + + Note: + + +Advanced users familiar with 3d content creation tools may prefer to use the [secondlife:///app/floater/upload_model Advanced Mesh Import Window] . + + + + + + + + + Optimize + + + + This wizard has optimized your model to improve performance. You may adjust the results of the optimization process bellow or click Next to continue. + + + Generating Level of Detail + + + Generate Level of Detail: High + + Generate Level of Detail: Medium + + Generate Level of Detail: Low + + Generate Level of Detail: Lowest + + + + Model Preview: + + + + High + + + Medium + + + Low + + + Lowest + + + + + Higher Performance + Faster rendering but less detailed; lowers Resource (prim) cost. + Higher Accuracy + More detailed model but slower; increases Resource (prim) cost. + + + ' + + + + + + Resource Cost: [COST] + + Dimensions (meters): + + + X: Y: Z: + + + | | + + + + + + + + + + + Physics + + + + The wizard will create a physical shape, which determines how the object interacts with other objects and avatars. Set the slider to the detail level most appropriate for how your object will be used: + + + Higher Performance + Faster rendering but less detailed; lowers Resource (prim) cost. + Higher Accuracy + More detailed model but slower; increases Resource (prim) cost. + + + ' ' ' ' ' ' ' ' ' ' ' + Recommended for solid objects + Recommended for buildings + Recommended for vehicles + + + + + Resource Cost: [COST] + + + + + + + + Physics + + + + Preview the physics shape below then click Next to continue. To modify the physics shape, click the Back button. + + + + Model Preview: + + + + High + + + Medium + + + Low + + + Lowest + + + + + + Dimensions (meters): + + + X: Y: Z: + + + | | + + + + + Resource Cost: [COST] + + + + + + + Review + + + + Review the details below then click. Upload to upload your model. Your L$ balance will be charged when you click Upload. + + + + + Model Preview: + + + + High + + + Medium + + + Low + + + Lowest + + + + + + Dimensions (meters): + + + X: Y: Z: + + + | | + + + + + + Resource Cost: [COST] + This is the cost to your Region's prim/object limit, at default scale + Physics Cost: [COST] + This is the cost to your Region's prim/object limit, at default scale + Upload Fee: + This is the amount the upload will cost. + + I confirm that I have the appropriate rights to the material contained in this model. [secondlife:///app/floater/learn_more Learn more] + + + + + + + + + Upload Complete! + + + + Congratulations! Your model has been sucessfully uploaded. You will find the model in the Objects folder in your inventory. + + + + + + + - - - - - - Drag to move, shift-drag to copy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - þ: [COUNT] - - - - Stretch Both Sides - - - - - - - - - - - - - Objects: [COUNT] - - - Prims: [COUNT] - - - Linked Sets: [COUNT] - - - Cost: [COST] / [PHYSICS] - - - Objects: [COUNT] - - - Cost: [COST] / [PHYSICS] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Deed - - - Deed - - - You can modify this object - - - You can modify these objects - - - You can't modify this object - - - You can't modify these objects - - - You must select entire object to set permissions - - - Price: L$ - - - Total Price: L$ - - - Price Per: L$ - - - Mixed Price - - - Mixed Sale - - - Name: - - - - Description: - - - - Creator: - - - - TestString PleaseIgnore (please.ignore) - - - Owner: - - - - TestString PleaseIgnore (please.ignore) - - - Group: - - - - - - - - + + + + + + Drag to move, shift-drag to copy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + þ: [COUNT] + + + + Stretch Both Sides + + + + + + + + + + + + + Objects: [COUNT] + + + Prims: [COUNT] + + + Linked Sets: [COUNT] + + + Cost: [COST] / [PHYSICS] + + + Objects: [COUNT] + + + Cost: [COST] / [PHYSICS] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deed + + + Deed + + + You can modify this object + + + You can modify these objects + + + You can't modify this object + + + You can't modify these objects + + + You must select entire object to set permissions + + + Price: L$ + + + Total Price: L$ + + + Price Per: L$ + + + Mixed Price + + + Mixed Sale + + + Name: + + + + Description: + + + + Creator: + + + + TestString PleaseIgnore (please.ignore) + + + Owner: + + + + TestString PleaseIgnore (please.ignore) + + + Group: + + + + + + + + + + Cache location: + + + + + UI size: diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index 901a1257e0..1c22a5c02e 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -93,98 +93,6 @@ name="connection_port" top_delta="3" width="170" /> - - Cache size - - - - MB - - - Cache location: - - - - spanish + es_ES.UTF-8 es_ES.UTF-8 es_ES.UTF-8 diff --git a/indra/newview/skins/default/xui/fr/language_settings.xml b/indra/newview/skins/default/xui/fr/language_settings.xml index bd272e1f28..fdac9d65a7 100644 --- a/indra/newview/skins/default/xui/fr/language_settings.xml +++ b/indra/newview/skins/default/xui/fr/language_settings.xml @@ -4,6 +4,7 @@ french + fr_FR.UTF-8 fr_FR.UTF-8 fr_FR.UTF-8 diff --git a/indra/newview/skins/default/xui/it/language_settings.xml b/indra/newview/skins/default/xui/it/language_settings.xml index 312b8e21aa..5f448fa828 100644 --- a/indra/newview/skins/default/xui/it/language_settings.xml +++ b/indra/newview/skins/default/xui/it/language_settings.xml @@ -4,6 +4,7 @@ italian + it_IT.UTF-8 it_IT.UTF-8 it_IT.UTF-8 diff --git a/indra/newview/skins/default/xui/ja/language_settings.xml b/indra/newview/skins/default/xui/ja/language_settings.xml index a6023f9b56..91e8f4be7c 100644 --- a/indra/newview/skins/default/xui/ja/language_settings.xml +++ b/indra/newview/skins/default/xui/ja/language_settings.xml @@ -4,6 +4,7 @@ japanese + ja_JP.UTF-8 ja_JP.UTF-8 ja_JP.UTF-8 diff --git a/indra/newview/skins/default/xui/nl/language_settings.xml b/indra/newview/skins/default/xui/nl/language_settings.xml index 53501d5dcb..40f4d9178a 100644 --- a/indra/newview/skins/default/xui/nl/language_settings.xml +++ b/indra/newview/skins/default/xui/nl/language_settings.xml @@ -4,6 +4,7 @@ dutch + nl_NL.UTF-8 nl_NL.UTF-8 nl_NL.UTF-8 diff --git a/indra/newview/skins/default/xui/pl/language_settings.xml b/indra/newview/skins/default/xui/pl/language_settings.xml index 681b38e9cf..93051d1317 100644 --- a/indra/newview/skins/default/xui/pl/language_settings.xml +++ b/indra/newview/skins/default/xui/pl/language_settings.xml @@ -4,6 +4,7 @@ polish + pl_PL.UTF-8 pl_PL.UTF-8 pl_PL.UTF-8 diff --git a/indra/newview/skins/default/xui/pt/language_settings.xml b/indra/newview/skins/default/xui/pt/language_settings.xml index e1de6ffea7..8799475ace 100644 --- a/indra/newview/skins/default/xui/pt/language_settings.xml +++ b/indra/newview/skins/default/xui/pt/language_settings.xml @@ -4,6 +4,7 @@ portuguese + pt_PT.UTF-8 pt_PT.UTF-8 pt_PT.UTF-8 -- cgit v1.2.3 From 156e1c1dcaa24d794190ece5ffa5ef83326b7a4c Mon Sep 17 00:00:00 2001 From: eli_linden Date: Mon, 6 Jun 2011 12:08:30 -0700 Subject: FIX VWR-18950 en_xui_change --- indra/newview/skins/default/xui/en/floater_windlight_options.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_windlight_options.xml b/indra/newview/skins/default/xui/en/floater_windlight_options.xml index 249ad95c41..7923dd87fa 100644 --- a/indra/newview/skins/default/xui/en/floater_windlight_options.xml +++ b/indra/newview/skins/default/xui/en/floater_windlight_options.xml @@ -22,13 +22,13 @@ left="10" name="KeyFramePresetsText" top="34" - width="85"> + width="135"> Sky Presets: -- cgit v1.2.3 From 88407a0f0c19f1ee36c176f2fdc2117646d65b80 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 6 Jun 2011 15:52:16 -0400 Subject: STORM-1308: add help buttons and IDs to environment floaters --- indra/newview/skins/default/xui/en/floater_edit_day_cycle.xml | 2 +- indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml | 8 ++++---- indra/newview/skins/default/xui/en/floater_edit_water_preset.xml | 2 +- indra/newview/skins/default/xui/en/panel_region_environment.xml | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_edit_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_day_cycle.xml index 6cfa67f766..b93406053c 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_day_cycle.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_day_cycle.xml @@ -4,7 +4,7 @@ height="450" layout="topleft" name="Edit Day cycle" - help_topic="" + help_topic="day_presets" save_rect="true" title="Edit Day Cycle" width="800"> diff --git a/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml b/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml index ae7e83ee56..6ffb3480ad 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml @@ -4,7 +4,7 @@ height="375" layout="topleft" name="Edit Sky Preset" - help_topic="" + help_topic="sky_preset" save_rect="true" title="Edit Sky Preset" width="900"> @@ -98,7 +98,7 @@ layout="topleft" left="1" mouse_opaque="false" - help_topic="windlight_atmosphere_tab" + help_topic="sky_preset_atmosphere" name="Atmosphere" top="60" width="698"> @@ -379,7 +379,7 @@ label="LIGHTING" layout="topleft" left_delta="0" - help_topic="windlight_lighting_tab" + help_topic="sky_preset_lighting" name="Lighting" top_delta="4" width="698"> @@ -685,7 +685,7 @@ layout="topleft" left_delta="0" mouse_opaque="false" - help_topic="windlight_clouds_tab" + help_topic="sky_preset_clouds" name="Clouds" top_delta="4" width="698"> diff --git a/indra/newview/skins/default/xui/en/floater_edit_water_preset.xml b/indra/newview/skins/default/xui/en/floater_edit_water_preset.xml index cf4e224835..f107e67f74 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_water_preset.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_water_preset.xml @@ -4,7 +4,7 @@ height="450" layout="topleft" name="Edit Water Preset" - help_topic="" + help_topic="water_preset" save_rect="true" title="Edit Water Preset" width="900"> diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml index caa12010ca..5bcc19356d 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -5,6 +5,7 @@ height="300" label="Environment" layout="topleft" + help_topic="panel_region_environment_tab" name="panel_env_info" width="530"> Date: Mon, 6 Jun 2011 23:46:35 +0300 Subject: STORM-1255 WIP Made the check for region permissions reusable. --- indra/newview/llenvmanager.cpp | 11 +++++++++++ indra/newview/llenvmanager.h | 2 ++ indra/newview/llfloatereditdaycycle.cpp | 15 ++------------- indra/newview/llfloatereditdaycycle.h | 1 - 4 files changed, 15 insertions(+), 14 deletions(-) (limited to 'indra') diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index 8e4b7197d6..58d1349a63 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -923,6 +923,17 @@ boost::signals2::connection LLEnvManagerNew::setRegionSettingsAppliedCallback(co return mRegionSettingsAppliedSignal.connect(cb); } +// static +bool LLEnvManagerNew::canEditRegionSettings() +{ + LLViewerRegion* region = gAgent.getRegion(); + BOOL owner_or_god = gAgent.isGodlike() || (region && region->getOwner() == gAgent.getID()); + BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); + + LL_DEBUGS("Windlight") << "Can edit region settings: " << (bool) owner_or_god_or_manager << LL_ENDL; + return owner_or_god_or_manager; +} + void LLEnvManagerNew::onRegionCrossing() { LL_DEBUGS("Windlight") << "Crossed region" << LL_ENDL; diff --git a/indra/newview/llenvmanager.h b/indra/newview/llenvmanager.h index 7d4e647e90..de82787a08 100644 --- a/indra/newview/llenvmanager.h +++ b/indra/newview/llenvmanager.h @@ -328,6 +328,8 @@ public: boost::signals2::connection setRegionChangeCallback(const region_change_signal_t::slot_type& cb); boost::signals2::connection setRegionSettingsAppliedCallback(const region_settings_applied_signal_t::slot_type& cb); + static bool canEditRegionSettings(); /// @return true if we have access to editing region environment + // Public callbacks. void onRegionCrossing(); void onTeleport(); diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 28ff353369..f6bd4ad6b9 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -660,7 +660,7 @@ void LLFloaterEditDayCycle::onRegionInfoUpdate() if (getSelectedDayCycle().scope == LLEnvKey::SCOPE_REGION) { // check whether we have the access - can_edit = canEditRegionSettings(); + can_edit = LLEnvManagerNew::canEditRegionSettings(); } enableEditing(can_edit); @@ -697,7 +697,7 @@ void LLFloaterEditDayCycle::onDayCycleSelected() return; } - can_edit = canEditRegionSettings(); + can_edit = LLEnvManagerNew::canEditRegionSettings(); } // We may need to add or remove region skies from the list. @@ -799,14 +799,3 @@ std::string LLFloaterEditDayCycle::getRegionName() { return gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown"); } - -// static -bool LLFloaterEditDayCycle::canEditRegionSettings() -{ - LLViewerRegion* region = gAgent.getRegion(); - BOOL owner_or_god = gAgent.isGodlike() || (region && region->getOwner() == gAgent.getID()); - BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); - - LL_DEBUGS("Windlight") << "Can edit region settings: " << owner_or_god_or_manager << LL_ENDL; - return owner_or_god_or_manager; -} diff --git a/indra/newview/llfloatereditdaycycle.h b/indra/newview/llfloatereditdaycycle.h index 3b467b2939..6dc7333039 100644 --- a/indra/newview/llfloatereditdaycycle.h +++ b/indra/newview/llfloatereditdaycycle.h @@ -106,7 +106,6 @@ private: void onDayCycleListChange(); static std::string getRegionName(); - static bool canEditRegionSettings(); /// convenience class for holding keyframes mapped to sliders struct SliderKey -- cgit v1.2.3 From 4a8109476cfdb1505e9dc122526caacd6cdda374 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 6 Jun 2011 17:16:14 -0400 Subject: STORM-1618: re-enable deferred rendering on ATI Macs --- indra/newview/featuretable_mac.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 45090c4c31..e2b979d9e9 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 24 +version 23 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -282,7 +282,6 @@ list TexUnit8orLess RenderDeferredSSAO 0 0 list ATI -RenderDeferred 0 0 RenderDeferredSSAO 0 0 list Intel -- cgit v1.2.3 From 4e05ea6ebda88f3e2af4b585f629b11f3729096e Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 7 Jun 2011 00:17:21 +0300 Subject: STORM-1255 WIP Implemented creating, editing and removing local sky presets. --- indra/newview/llfloaterdeleteenvpreset.cpp | 37 +- indra/newview/llfloaterdeleteenvpreset.h | 2 + indra/newview/llfloatereditsky.cpp | 843 ++++++++++++++++++++- indra/newview/llfloatereditsky.h | 60 ++ indra/newview/llfloaterwindlight.cpp | 2 + indra/newview/llwlparammanager.cpp | 230 +++--- indra/newview/llwlparammanager.h | 32 +- .../default/xui/en/floater_edit_sky_preset.xml | 17 +- 8 files changed, 1045 insertions(+), 178 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index d791c29a96..74c837af53 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -89,7 +89,6 @@ void LLFloaterDeleteEnvPreset::onOpen(const LLSD& key) else if (param == "sky") { populateSkyPresetsList(); - getChild("delete")->setEnabled(FALSE); // not implemented yet } else if (param == "day_cycle") { @@ -104,6 +103,7 @@ void LLFloaterDeleteEnvPreset::onOpen(const LLSD& key) void LLFloaterDeleteEnvPreset::onBtnDelete() { std::string param = mKey.asString(); + std::string preset_name = mPresetCombo->getValue().asString(); boost::function confirm_cb; if (param == "water") @@ -113,13 +113,20 @@ void LLFloaterDeleteEnvPreset::onBtnDelete() } else if (param == "sky") { - llwarns << "Deleting sky presets not implemented" << llendl; - return; + LLWLParamManager& wl_mgr = LLWLParamManager::instance(); + + // Don't allow deleting system presets. + if (wl_mgr.isSystemPreset(preset_name)) + { + LLNotificationsUtil::add("WLNoEditDefault"); + return; + } + + confirm_cb = boost::bind(&LLFloaterDeleteEnvPreset::onDeleteSkyPresetConfirmation, this); } else if (param == "day_cycle") { LLDayCycleManager& day_mgr = LLDayCycleManager::instance(); - std::string preset_name = mPresetCombo->getValue().asString(); // Don't allow deleting system presets. if (day_mgr.isSystemPreset(preset_name)) @@ -167,16 +174,22 @@ void LLFloaterDeleteEnvPreset::populateSkyPresetsList() { mPresetCombo->removeall(); + std::string cur_preset; + LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); + if (!env_mgr.getUseRegionSettings() && env_mgr.getUseFixedSky()) + { + cur_preset = env_mgr.getSkyPresetName(); + } + // *TODO: Reload the list when user preferences change. LLWLParamManager& sky_mgr = LLWLParamManager::instance(); - LL_DEBUGS("Windlight") << "Current sky preset: " << sky_mgr.mCurParams.mName << LL_ENDL; - const std::map &sky_params_map = sky_mgr.mParamList; for (std::map::const_iterator it = sky_params_map.begin(); it != sky_params_map.end(); it++) { - if (it->first.scope == LLEnvKey::SCOPE_REGION) continue; // list only local presets - bool enabled = (it->first.name != sky_mgr.mCurParams.mName); - mPresetCombo->add(it->first.name, ADD_BOTTOM, enabled); + const LLWLParamKey& key = it->first; + if (key.scope == LLEnvKey::SCOPE_REGION) continue; // list only local presets + bool enabled = key.name != cur_preset && !sky_mgr.isSystemPreset(key.name); + mPresetCombo->add(key.name, ADD_BOTTOM, enabled); } } @@ -197,6 +210,12 @@ void LLFloaterDeleteEnvPreset::onDeleteDayCycleConfirmation() LLDayCycleManager::instance().deletePreset(mPresetCombo->getValue().asString()); } +void LLFloaterDeleteEnvPreset::onDeleteSkyPresetConfirmation() +{ + LLWLParamKey key(mPresetCombo->getValue().asString(), LLEnvKey::SCOPE_LOCAL); + LLWLParamManager::instance().removeParamSet(key, true); +} + void LLFloaterDeleteEnvPreset::onDayCycleListChange() { populateDayCyclesList(); diff --git a/indra/newview/llfloaterdeleteenvpreset.h b/indra/newview/llfloaterdeleteenvpreset.h index aaa4143233..26e3b0728e 100644 --- a/indra/newview/llfloaterdeleteenvpreset.h +++ b/indra/newview/llfloaterdeleteenvpreset.h @@ -50,6 +50,8 @@ private: void populateDayCyclesList(); void onDeleteDayCycleConfirmation(); + void onDeleteSkyPresetConfirmation(); + void onDayCycleListChange(); LLComboBox* mPresetCombo; diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp index 312479951e..96dfb7a8a9 100644 --- a/indra/newview/llfloatereditsky.cpp +++ b/indra/newview/llfloatereditsky.cpp @@ -30,22 +30,41 @@ // libs #include "llbutton.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "llnotifications.h" +#include "llnotificationsutil.h" +#include "llsliderctrl.h" +#include "lltabcontainer.h" // newview +#include "llagent.h" +#include "llviewerregion.h" + +#undef max + +static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f; + +//================================================================================================= LLFloaterEditSky::LLFloaterEditSky(const LLSD &key) : LLFloater(key) +, mSkyPresetNameEditor(NULL) +, mSkyPresetCombo(NULL) +, mMakeDefaultCheckBox(NULL) +, mSaveButton(NULL) { } // virtual BOOL LLFloaterEditSky::postBuild() { - getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnCancel, this)); + mSkyPresetNameEditor = getChild("sky_preset_name"); + mSkyPresetCombo = getChild("sky_preset_combo"); + mMakeDefaultCheckBox = getChild("make_default_cb"); + mSaveButton = getChild("save"); - // Disable some non-functional controls. - getChildView("sky_preset_combo")->setEnabled(FALSE); - getChildView("save")->setEnabled(FALSE); + initCallbacks(); return TRUE; } @@ -53,6 +72,7 @@ BOOL LLFloaterEditSky::postBuild() // virtual void LLFloaterEditSky::onOpen(const LLSD& key) { + bool new_preset = isNewPreset(); std::string param = key.asString(); std::string floater_title = getString(std::string("title_") + param); std::string hint = getString(std::string("hint_" + param)); @@ -64,10 +84,823 @@ void LLFloaterEditSky::onOpen(const LLSD& key) getChild("hint")->setValue(hint); // Hide the hint to the right of the combo if we're invoked to create a new preset. - getChildView("note")->setVisible(param == "edit"); + getChildView("note")->setVisible(!new_preset); + + // Switch between the sky presets combobox and preset name input field. + mSkyPresetCombo->setVisible(!new_preset); + mSkyPresetNameEditor->setVisible(new_preset); + + if (isNewPreset()) + { + mSkyPresetNameEditor->setValue(LLSD()); + mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name + } + else + { + refreshSkyPresetsList(); + + // Disable controls until a sky preset to edit is selected. + enableEditing(false); + } +} + +// virtual +void LLFloaterEditSky::onClose(bool app_quitting) +{ + if (!app_quitting) // there's no point to change environment if we're quitting + { + LLEnvManagerNew::instance().usePrefs(); // revert changes made to current environment + } +} + +// virtual +void LLFloaterEditSky::draw() +{ + syncControls(); + LLFloater::draw(); +} + +void LLFloaterEditSky::initCallbacks(void) +{ + // *TODO: warn user if a region environment update comes while we're editing a region sky preset. + + mSkyPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this), NULL); + mSkyPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditSky::onSkyPresetSelected, this)); + mSkyPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this)); + + mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnSave, this)); + getChild("cancel")->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnCancel, this)); + + //------------------------------------------------------------------------- + + LLWLParamManager& param_mgr = LLWLParamManager::instance(); + + // blue horizon + getChild("WLBlueHorizonR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, ¶m_mgr.mBlueHorizon)); + getChild("WLBlueHorizonR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, ¶m_mgr.mBlueHorizon)); + getChild("WLBlueHorizonG")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, ¶m_mgr.mBlueHorizon)); + getChild("WLBlueHorizonB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, ¶m_mgr.mBlueHorizon)); + getChild("WLBlueHorizonI")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlIMoved, this, _1, ¶m_mgr.mBlueHorizon)); + + // haze density, horizon, mult, and altitude + getChild("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, ¶m_mgr.mHazeDensity)); + getChild("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, ¶m_mgr.mHazeHorizon)); + getChild("WLDensityMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, ¶m_mgr.mDensityMult)); + getChild("WLMaxAltitude")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, ¶m_mgr.mMaxAlt)); + + // blue density + getChild("WLBlueDensityR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, ¶m_mgr.mBlueDensity)); + getChild("WLBlueDensityG")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, ¶m_mgr.mBlueDensity)); + getChild("WLBlueDensityB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, ¶m_mgr.mBlueDensity)); + getChild("WLBlueDensityI")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlIMoved, this, _1, ¶m_mgr.mBlueDensity)); + + // Lighting + + // sunlight + getChild("WLSunlightR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, ¶m_mgr.mSunlight)); + getChild("WLSunlightG")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, ¶m_mgr.mSunlight)); + getChild("WLSunlightB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, ¶m_mgr.mSunlight)); + getChild("WLSunlightI")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlIMoved, this, _1, ¶m_mgr.mSunlight)); + + // glow + getChild("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowRMoved, this, _1, ¶m_mgr.mGlow)); + getChild("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowBMoved, this, _1, ¶m_mgr.mGlow)); + + // ambient + getChild("WLAmbientR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, ¶m_mgr.mAmbient)); + getChild("WLAmbientG")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, ¶m_mgr.mAmbient)); + getChild("WLAmbientB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, ¶m_mgr.mAmbient)); + getChild("WLAmbientI")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlIMoved, this, _1, ¶m_mgr.mAmbient)); + + // time of day + getChild("WLSunAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, ¶m_mgr.mLightnorm)); + getChild("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, ¶m_mgr.mLightnorm)); + + // Clouds + + // Cloud Color + getChild("WLCloudColorR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, ¶m_mgr.mCloudColor)); + getChild("WLCloudColorG")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, ¶m_mgr.mCloudColor)); + getChild("WLCloudColorB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, ¶m_mgr.mCloudColor)); + getChild("WLCloudColorI")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlIMoved, this, _1, ¶m_mgr.mCloudColor)); + + // Cloud + getChild("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, ¶m_mgr.mCloudMain)); + getChild("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, ¶m_mgr.mCloudMain)); + getChild("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, ¶m_mgr.mCloudMain)); + + // Cloud Detail + getChild("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, ¶m_mgr.mCloudDetail)); + getChild("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, ¶m_mgr.mCloudDetail)); + getChild("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, ¶m_mgr.mCloudDetail)); + + // Cloud extras + getChild("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, ¶m_mgr.mCloudCoverage)); + getChild("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, ¶m_mgr.mCloudScale)); + getChild("WLCloudLockX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXToggled, this, _1)); + getChild("WLCloudLockY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYToggled, this, _1)); + getChild("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXMoved, this, _1)); + getChild("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYMoved, this, _1)); + getChild("WLDistanceMult")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, ¶m_mgr.mDistanceMult)); + + // Dome + getChild("WLGamma")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, ¶m_mgr.mWLGamma)); + getChild("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterEditSky::onStarAlphaMoved, this, _1)); +} + +void LLFloaterEditSky::syncControls() +{ + bool err; + + LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); + + LLWLParamSet& cur_params = param_mgr->mCurParams; + + // blue horizon + param_mgr->mBlueHorizon = cur_params.getVector(param_mgr->mBlueHorizon.mName, err); + childSetValue("WLBlueHorizonR", param_mgr->mBlueHorizon.r / 2.0); + childSetValue("WLBlueHorizonG", param_mgr->mBlueHorizon.g / 2.0); + childSetValue("WLBlueHorizonB", param_mgr->mBlueHorizon.b / 2.0); + childSetValue("WLBlueHorizonI", + std::max(param_mgr->mBlueHorizon.r / 2.0, + std::max(param_mgr->mBlueHorizon.g / 2.0, + param_mgr->mBlueHorizon.b / 2.0))); + + // haze density, horizon, mult, and altitude + param_mgr->mHazeDensity = cur_params.getVector(param_mgr->mHazeDensity.mName, err); + childSetValue("WLHazeDensity", param_mgr->mHazeDensity.r); + param_mgr->mHazeHorizon = cur_params.getVector(param_mgr->mHazeHorizon.mName, err); + childSetValue("WLHazeHorizon", param_mgr->mHazeHorizon.r); + param_mgr->mDensityMult = cur_params.getVector(param_mgr->mDensityMult.mName, err); + childSetValue("WLDensityMult", param_mgr->mDensityMult.x * + param_mgr->mDensityMult.mult); + param_mgr->mMaxAlt = cur_params.getVector(param_mgr->mMaxAlt.mName, err); + childSetValue("WLMaxAltitude", param_mgr->mMaxAlt.x); + + // blue density + param_mgr->mBlueDensity = cur_params.getVector(param_mgr->mBlueDensity.mName, err); + childSetValue("WLBlueDensityR", param_mgr->mBlueDensity.r / 2.0); + childSetValue("WLBlueDensityG", param_mgr->mBlueDensity.g / 2.0); + childSetValue("WLBlueDensityB", param_mgr->mBlueDensity.b / 2.0); + childSetValue("WLBlueDensityI", + std::max(param_mgr->mBlueDensity.r / 2.0, + std::max(param_mgr->mBlueDensity.g / 2.0, param_mgr->mBlueDensity.b / 2.0))); + + // Lighting + + // sunlight + param_mgr->mSunlight = cur_params.getVector(param_mgr->mSunlight.mName, err); + childSetValue("WLSunlightR", param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue("WLSunlightG", param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue("WLSunlightB", param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue("WLSunlightI", + std::max(param_mgr->mSunlight.r / WL_SUN_AMBIENT_SLIDER_SCALE, + std::max(param_mgr->mSunlight.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mSunlight.b / WL_SUN_AMBIENT_SLIDER_SCALE))); + + // glow + param_mgr->mGlow = cur_params.getVector(param_mgr->mGlow.mName, err); + childSetValue("WLGlowR", 2 - param_mgr->mGlow.r / 20.0f); + childSetValue("WLGlowB", -param_mgr->mGlow.b / 5.0f); + + // ambient + param_mgr->mAmbient = cur_params.getVector(param_mgr->mAmbient.mName, err); + childSetValue("WLAmbientR", param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue("WLAmbientG", param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue("WLAmbientB", param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue("WLAmbientI", + std::max(param_mgr->mAmbient.r / WL_SUN_AMBIENT_SLIDER_SCALE, + std::max(param_mgr->mAmbient.g / WL_SUN_AMBIENT_SLIDER_SCALE, param_mgr->mAmbient.b / WL_SUN_AMBIENT_SLIDER_SCALE))); + + childSetValue("WLSunAngle", param_mgr->mCurParams.getFloat("sun_angle",err) / F_TWO_PI); + childSetValue("WLEastAngle", param_mgr->mCurParams.getFloat("east_angle",err) / F_TWO_PI); + + // Clouds + + // Cloud Color + param_mgr->mCloudColor = cur_params.getVector(param_mgr->mCloudColor.mName, err); + childSetValue("WLCloudColorR", param_mgr->mCloudColor.r); + childSetValue("WLCloudColorG", param_mgr->mCloudColor.g); + childSetValue("WLCloudColorB", param_mgr->mCloudColor.b); + childSetValue("WLCloudColorI", + std::max(param_mgr->mCloudColor.r, + std::max(param_mgr->mCloudColor.g, param_mgr->mCloudColor.b))); + + // Cloud + param_mgr->mCloudMain = cur_params.getVector(param_mgr->mCloudMain.mName, err); + childSetValue("WLCloudX", param_mgr->mCloudMain.r); + childSetValue("WLCloudY", param_mgr->mCloudMain.g); + childSetValue("WLCloudDensity", param_mgr->mCloudMain.b); + + // Cloud Detail + param_mgr->mCloudDetail = cur_params.getVector(param_mgr->mCloudDetail.mName, err); + childSetValue("WLCloudDetailX", param_mgr->mCloudDetail.r); + childSetValue("WLCloudDetailY", param_mgr->mCloudDetail.g); + childSetValue("WLCloudDetailDensity", param_mgr->mCloudDetail.b); + + // Cloud extras + param_mgr->mCloudCoverage = cur_params.getVector(param_mgr->mCloudCoverage.mName, err); + param_mgr->mCloudScale = cur_params.getVector(param_mgr->mCloudScale.mName, err); + childSetValue("WLCloudCoverage", param_mgr->mCloudCoverage.x); + childSetValue("WLCloudScale", param_mgr->mCloudScale.x); + + // cloud scrolling + bool lockX = !param_mgr->mCurParams.getEnableCloudScrollX(); + bool lockY = !param_mgr->mCurParams.getEnableCloudScrollY(); + childSetValue("WLCloudLockX", lockX); + childSetValue("WLCloudLockY", lockY); + + // disable if locked, enable if not + if (lockX) + { + childDisable("WLCloudScrollX"); + } + else + { + childEnable("WLCloudScrollX"); + } + if (lockY) + { + childDisable("WLCloudScrollY"); + } + else + { + childEnable("WLCloudScrollY"); + } + + // *HACK cloud scrolling is off my an additive of 10 + childSetValue("WLCloudScrollX", param_mgr->mCurParams.getCloudScrollX() - 10.0f); + childSetValue("WLCloudScrollY", param_mgr->mCurParams.getCloudScrollY() - 10.0f); + + param_mgr->mDistanceMult = cur_params.getVector(param_mgr->mDistanceMult.mName, err); + childSetValue("WLDistanceMult", param_mgr->mDistanceMult.x); + + // Tweak extras + + param_mgr->mWLGamma = cur_params.getVector(param_mgr->mWLGamma.mName, err); + childSetValue("WLGamma", param_mgr->mWLGamma.x); + + childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness()); +} + + +// color control callbacks +void LLFloaterEditSky::onColorControlRMoved(LLUICtrl* ctrl, void* userdata) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + WLColorControl* color_ctrl = static_cast(userdata); + + color_ctrl->r = sldr_ctrl->getValueF32(); + if (color_ctrl->isSunOrAmbientColor) + { + color_ctrl->r *= 3; + } + if (color_ctrl->isBlueHorizonOrDensity) + { + color_ctrl->r *= 2; + } + + // move i if it's the max + if (color_ctrl->r >= color_ctrl->g && color_ctrl->r >= color_ctrl->b && color_ctrl->hasSliderName) + { + color_ctrl->i = color_ctrl->r; + std::string name = color_ctrl->mSliderName; + name.append("I"); + + if (color_ctrl->isSunOrAmbientColor) + { + childSetValue(name, color_ctrl->r / 3); + } + else if (color_ctrl->isBlueHorizonOrDensity) + { + childSetValue(name, color_ctrl->r / 2); + } + else + { + childSetValue(name, color_ctrl->r); + } + } + + color_ctrl->update(LLWLParamManager::getInstance()->mCurParams); + + LLWLParamManager::getInstance()->propagateParameters(); +} + +void LLFloaterEditSky::onColorControlGMoved(LLUICtrl* ctrl, void* userdata) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + WLColorControl* color_ctrl = static_cast(userdata); + + color_ctrl->g = sldr_ctrl->getValueF32(); + if (color_ctrl->isSunOrAmbientColor) + { + color_ctrl->g *= 3; + } + if (color_ctrl->isBlueHorizonOrDensity) + { + color_ctrl->g *= 2; + } + + // move i if it's the max + if (color_ctrl->g >= color_ctrl->r && color_ctrl->g >= color_ctrl->b && color_ctrl->hasSliderName) + { + color_ctrl->i = color_ctrl->g; + std::string name = color_ctrl->mSliderName; + name.append("I"); + + if (color_ctrl->isSunOrAmbientColor) + { + childSetValue(name, color_ctrl->g / 3); + } + else if (color_ctrl->isBlueHorizonOrDensity) + { + childSetValue(name, color_ctrl->g / 2); + } + else + { + childSetValue(name, color_ctrl->g); + } + } + + color_ctrl->update(LLWLParamManager::getInstance()->mCurParams); + + LLWLParamManager::getInstance()->propagateParameters(); +} + +void LLFloaterEditSky::onColorControlBMoved(LLUICtrl* ctrl, void* userdata) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + WLColorControl* color_ctrl = static_cast(userdata); + + color_ctrl->b = sldr_ctrl->getValueF32(); + if (color_ctrl->isSunOrAmbientColor) + { + color_ctrl->b *= 3; + } + if (color_ctrl->isBlueHorizonOrDensity) + { + color_ctrl->b *= 2; + } + + // move i if it's the max + if (color_ctrl->b >= color_ctrl->r && color_ctrl->b >= color_ctrl->g && color_ctrl->hasSliderName) + { + color_ctrl->i = color_ctrl->b; + std::string name = color_ctrl->mSliderName; + name.append("I"); + + if (color_ctrl->isSunOrAmbientColor) + { + childSetValue(name, color_ctrl->b / 3); + } + else if (color_ctrl->isBlueHorizonOrDensity) + { + childSetValue(name, color_ctrl->b / 2); + } + else + { + childSetValue(name, color_ctrl->b); + } + } + + color_ctrl->update(LLWLParamManager::getInstance()->mCurParams); + + LLWLParamManager::getInstance()->propagateParameters(); +} + +void LLFloaterEditSky::onColorControlIMoved(LLUICtrl* ctrl, void* userdata) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + WLColorControl* color_ctrl = static_cast(userdata); + + color_ctrl->i = sldr_ctrl->getValueF32(); + + // only for sliders where we pass a name + if (color_ctrl->hasSliderName) + { + // set it to the top + F32 maxVal = std::max(std::max(color_ctrl->r, color_ctrl->g), color_ctrl->b); + F32 iVal; + + if (color_ctrl->isSunOrAmbientColor) + { + iVal = color_ctrl->i * 3; + } + else if (color_ctrl->isBlueHorizonOrDensity) + { + iVal = color_ctrl->i * 2; + } + else + { + iVal = color_ctrl->i; + } + + // get the names of the other sliders + std::string rName = color_ctrl->mSliderName; + rName.append("R"); + std::string gName = color_ctrl->mSliderName; + gName.append("G"); + std::string bName = color_ctrl->mSliderName; + bName.append("B"); + + // handle if at 0 + if (iVal == 0) + { + color_ctrl->r = 0; + color_ctrl->g = 0; + color_ctrl->b = 0; + + // if all at the start + // set them all to the intensity + } + else if (maxVal == 0) + { + color_ctrl->r = iVal; + color_ctrl->g = iVal; + color_ctrl->b = iVal; + + } + else + { + // add delta amounts to each + F32 delta = (iVal - maxVal) / maxVal; + color_ctrl->r *= (1.0f + delta); + color_ctrl->g *= (1.0f + delta); + color_ctrl->b *= (1.0f + delta); + } + + // divide sun color vals by three + if (color_ctrl->isSunOrAmbientColor) + { + childSetValue(rName, color_ctrl->r/3); + childSetValue(gName, color_ctrl->g/3); + childSetValue(bName, color_ctrl->b/3); + } + else if (color_ctrl->isBlueHorizonOrDensity) + { + childSetValue(rName, color_ctrl->r/2); + childSetValue(gName, color_ctrl->g/2); + childSetValue(bName, color_ctrl->b/2); + } + else + { + // set the sliders to the new vals + childSetValue(rName, color_ctrl->r); + childSetValue(gName, color_ctrl->g); + childSetValue(bName, color_ctrl->b); + } + } + + // now update the current parameters and send them to shaders + color_ctrl->update(LLWLParamManager::getInstance()->mCurParams); + LLWLParamManager::getInstance()->propagateParameters(); +} + +/// GLOW SPECIFIC CODE +void LLFloaterEditSky::onGlowRMoved(LLUICtrl* ctrl, void* userdata) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + WLColorControl* color_ctrl = static_cast(userdata); + + // scaled by 20 + color_ctrl->r = (2 - sldr_ctrl->getValueF32()) * 20; + + color_ctrl->update(LLWLParamManager::getInstance()->mCurParams); + LLWLParamManager::getInstance()->propagateParameters(); +} + +/// \NOTE that we want NEGATIVE (-) B +void LLFloaterEditSky::onGlowBMoved(LLUICtrl* ctrl, void* userdata) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + WLColorControl* color_ctrl = static_cast(userdata); + + /// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big + color_ctrl->b = -sldr_ctrl->getValueF32() * 5; + + color_ctrl->update(LLWLParamManager::getInstance()->mCurParams); + LLWLParamManager::getInstance()->propagateParameters(); +} + +void LLFloaterEditSky::onFloatControlMoved(LLUICtrl* ctrl, void* userdata) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + WLFloatControl * floatControl = static_cast(userdata); + + floatControl->x = sldr_ctrl->getValueF32() / floatControl->mult; + + floatControl->update(LLWLParamManager::getInstance()->mCurParams); + LLWLParamManager::getInstance()->propagateParameters(); +} + + +// Lighting callbacks + +// time of day +void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLSliderCtrl* sun_sldr = getChild("WLSunAngle"); + LLSliderCtrl* east_sldr = getChild("WLEastAngle"); + + WLColorControl* color_ctrl = static_cast(userdata); + + // get the two angles + LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); + + param_mgr->mCurParams.setSunAngle(F_TWO_PI * sun_sldr->getValueF32()); + param_mgr->mCurParams.setEastAngle(F_TWO_PI * east_sldr->getValueF32()); + + // set the sun vector + color_ctrl->r = -sin(param_mgr->mCurParams.getEastAngle()) * + cos(param_mgr->mCurParams.getSunAngle()); + color_ctrl->g = sin(param_mgr->mCurParams.getSunAngle()); + color_ctrl->b = cos(param_mgr->mCurParams.getEastAngle()) * + cos(param_mgr->mCurParams.getSunAngle()); + color_ctrl->i = 1.f; + + color_ctrl->update(param_mgr->mCurParams); + param_mgr->propagateParameters(); +} + +void LLFloaterEditSky::onStarAlphaMoved(LLUICtrl* ctrl) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + + LLWLParamManager::getInstance()->mCurParams.setStarBrightness(sldr_ctrl->getValueF32()); +} + +// Clouds +void LLFloaterEditSky::onCloudScrollXMoved(LLUICtrl* ctrl) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + // *HACK all cloud scrolling is off by an additive of 10. + LLWLParamManager::getInstance()->mCurParams.setCloudScrollX(sldr_ctrl->getValueF32() + 10.0f); +} + +void LLFloaterEditSky::onCloudScrollYMoved(LLUICtrl* ctrl) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + + // *HACK all cloud scrolling is off by an additive of 10. + LLWLParamManager::getInstance()->mCurParams.setCloudScrollY(sldr_ctrl->getValueF32() + 10.0f); +} + +void LLFloaterEditSky::onCloudScrollXToggled(LLUICtrl* ctrl) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLCheckBoxCtrl* cb_ctrl = static_cast(ctrl); + + bool lock = cb_ctrl->get(); + LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollX(!lock); + + LLSliderCtrl* sldr = getChild("WLCloudScrollX"); + + if (cb_ctrl->get()) + { + sldr->setEnabled(false); + } + else + { + sldr->setEnabled(true); + } + +} + +void LLFloaterEditSky::onCloudScrollYToggled(LLUICtrl* ctrl) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + LLCheckBoxCtrl* cb_ctrl = static_cast(ctrl); + bool lock = cb_ctrl->get(); + LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollY(!lock); + + LLSliderCtrl* sldr = getChild("WLCloudScrollY"); + + if (cb_ctrl->get()) + { + sldr->setEnabled(false); + } + else + { + sldr->setEnabled(true); + } +} + +//================================================================================================= + +bool LLFloaterEditSky::isNewPreset() const +{ + return mKey.asString() == "new"; +} + +void LLFloaterEditSky::refreshSkyPresetsList() +{ + mSkyPresetCombo->removeall(); + + std::string region_name = gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown"); + const std::map &sky_params_map = LLWLParamManager::getInstance()->mParamList; + for (std::map::const_iterator it = sky_params_map.begin(); it != sky_params_map.end(); it++) + { + const LLWLParamKey& key = it->first; + std::string item_title = key.name; + if (key.scope == LLEnvKey::SCOPE_REGION) + { + item_title += " (" + region_name + ")"; + } + mSkyPresetCombo->add(item_title, key.toLLSD()); + } + + mSkyPresetCombo->setLabel(getString("combo_label")); +} + +void LLFloaterEditSky::enableEditing(bool enable) +{ + // Enable/disable the tab and their contents. + LLTabContainer* tab_container = getChild("WindLight Tabs"); + tab_container->setEnabled(enable); + for (S32 i = 0; i < tab_container->getTabCount(); ++i) + { + tab_container->enableTabButton(i, enable); + tab_container->getPanelByIndex(i)->setCtrlsEnabled(enable); + } + + // Enable/disable saving. + mSaveButton->setEnabled(enable); + mMakeDefaultCheckBox->setEnabled(enable); +} + +void LLFloaterEditSky::saveRegionSky() +{ + LLWLParamKey key(getSelectedSkyPreset()); + llassert(key.scope == LLEnvKey::SCOPE_REGION); + + LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << llendl; + LLWLParamManager& wl_mgr = LLWLParamManager::instance(); + wl_mgr.mCurParams.mName = key.name; + wl_mgr.setParamSet(key, wl_mgr.mCurParams); + + // *TODO: save to cached region settings. + LL_WARNS("Windlight") << "Saving region sky is not fully implemented yet" << LL_ENDL; +} + +LLWLParamKey LLFloaterEditSky::getSelectedSkyPreset() +{ + LLWLParamKey key; + + if (mSkyPresetNameEditor->getVisible()) + { + key.name = mSkyPresetNameEditor->getText(); + key.scope = LLEnvKey::SCOPE_LOCAL; + } + else + { + LLSD combo_val = mSkyPresetCombo->getValue(); + + if (!combo_val.isArray()) // manually typed text + { + key.name = combo_val.asString(); + key.scope = LLEnvKey::SCOPE_LOCAL; + } + else + { + key.fromLLSD(combo_val); + } + } + + return key; +} + +void LLFloaterEditSky::onSkyPresetNameEdited() +{ + // Disable saving a sky preset having empty name. + LLWLParamKey key = getSelectedSkyPreset(); + mSaveButton->setEnabled(!key.name.empty()); +} + +void LLFloaterEditSky::onSkyPresetSelected() +{ + LLWLParamKey key = getSelectedSkyPreset(); + LLWLParamSet sky_params; + + if (!LLWLParamManager::instance().getParamSet(key, sky_params)) + { + llwarns << "No sky preset named " << key.toString() << llendl; + llassert(false); + return; + } + + LLEnvManagerNew::instance().useSkyParams(sky_params.getAll()); + //syncControls(); + + bool can_edit = (key.scope == LLEnvKey::SCOPE_LOCAL || LLEnvManagerNew::canEditRegionSettings()); + enableEditing(can_edit); + + mMakeDefaultCheckBox->setEnabled(key.scope == LLEnvKey::SCOPE_LOCAL); +} + +void LLFloaterEditSky::onBtnSave() +{ + LLWLParamKey selected_sky = getSelectedSkyPreset(); + LLWLParamManager& wl_mgr = LLWLParamManager::instance(); + + if (selected_sky.scope == LLEnvKey::SCOPE_REGION) + { + saveRegionSky(); + closeFloater(); + return; + } + + std::string name = selected_sky.name; + if (name.empty()) + { + // *TODO: show an alert + llwarns << "Empty sky preset name" << llendl; + return; + } + + // Don't allow overwriting system presets. + if (wl_mgr.isSystemPreset(name)) + { + LLNotificationsUtil::add("WLNoEditDefault"); + return; + } + + // Save, ask for confirmation for overwriting an existing preset. + if (wl_mgr.hasParamSet(selected_sky)) + { + LLNotificationsUtil::add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterEditSky::onSaveAnswer, this, _1, _2)); + } + else + { + // new preset, hence no confirmation needed + onSaveConfirmed(); + } } void LLFloaterEditSky::onBtnCancel() { closeFloater(); } + +bool LLFloaterEditSky::onSaveAnswer(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + // If they choose save, do it. Otherwise, don't do anything + if (option == 0) + { + onSaveConfirmed(); + } + + return false; +} + +void LLFloaterEditSky::onSaveConfirmed() +{ + // Save current params to the selected preset. + LLWLParamKey key(getSelectedSkyPreset()); + + LL_DEBUGS("Windlight") << "Saving sky preset " << key.name << LL_ENDL; + LLWLParamManager& wl_mgr = LLWLParamManager::instance(); + if (wl_mgr.hasParamSet(key)) + { + wl_mgr.setParamSet(key, wl_mgr.mCurParams); + } + else + { + wl_mgr.addParamSet(key, wl_mgr.mCurParams); + } + + wl_mgr.savePreset(key); + + // Change preference if requested. + if (mMakeDefaultCheckBox->getValue()) + { + LL_DEBUGS("Windlight") << key.name << " is now the new preferred sky preset" << llendl; + LLEnvManagerNew::instance().setUseSkyPreset(key.name); + } + + closeFloater(); +} diff --git a/indra/newview/llfloatereditsky.h b/indra/newview/llfloatereditsky.h index a78f049d84..9a8feb5188 100644 --- a/indra/newview/llfloatereditsky.h +++ b/indra/newview/llfloatereditsky.h @@ -28,7 +28,16 @@ #define LL_LLFLOATEREDITSKY_H #include "llfloater.h" +#include "llwlparammanager.h" +class LLButton; +class LLCheckBoxCtrl; +class LLComboBox; +class LLLineEditor; + +/** + * Floater for creating or editing a sky preset. + */ class LLFloaterEditSky : public LLFloater { LOG_CLASS(LLFloaterEditSky); @@ -38,8 +47,59 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onClose(bool app_quitting); + /*virtual*/ void draw(); + +private: + void initCallbacks(void); + + //-- WL stuff begins ------------------------------------------------------ + + // general purpose callbacks for dealing with color controllers + void onColorControlRMoved(LLUICtrl* ctrl, void* userdata); + void onColorControlGMoved(LLUICtrl* ctrl, void* userdata); + void onColorControlBMoved(LLUICtrl* ctrl, void* userdata); + void onColorControlIMoved(LLUICtrl* ctrl, void* userdata); + void onFloatControlMoved(LLUICtrl* ctrl, void* userdata); + + // lighting callbacks for glow + void onGlowRMoved(LLUICtrl* ctrl, void* userdata); + void onGlowBMoved(LLUICtrl* ctrl, void* userdata); + + // lighting callbacks for sun + void onSunMoved(LLUICtrl* ctrl, void* userdata); + // for handling when the star slider is moved to adjust the alpha + void onStarAlphaMoved(LLUICtrl* ctrl); + + // handle cloud scrolling + void onCloudScrollXMoved(LLUICtrl* ctrl); + void onCloudScrollYMoved(LLUICtrl* ctrl); + void onCloudScrollXToggled(LLUICtrl* ctrl); + void onCloudScrollYToggled(LLUICtrl* ctrl); + + void syncControls(); /// sync up sliders with parameters + + //-- WL stuff ends -------------------------------------------------------- + + bool isNewPreset() const; + void refreshSkyPresetsList(); + void enableEditing(bool enable); + void saveRegionSky(); + LLWLParamKey getSelectedSkyPreset(); + + void onSkyPresetNameEdited(); + void onSkyPresetSelected(); + bool onSaveAnswer(const LLSD& notification, const LLSD& response); + void onSaveConfirmed(); + + void onBtnSave(); void onBtnCancel(); + + LLLineEditor* mSkyPresetNameEditor; + LLComboBox* mSkyPresetCombo; + LLCheckBoxCtrl* mMakeDefaultCheckBox; + LLButton* mSaveButton; }; #endif // LL_LLFLOATEREDITSKY_H diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp index 16cb0f5e57..f78fada155 100644 --- a/indra/newview/llfloaterwindlight.cpp +++ b/indra/newview/llfloaterwindlight.cpp @@ -57,6 +57,8 @@ #undef max +// *TODO: Remove this class in favor of LLFloaterEditSky + LLFloaterWindLight* LLFloaterWindLight::sWindLight = NULL; std::set LLFloaterWindLight::sDefaultPresets; LLEnvKey::EScope LLFloaterWindLight::sScope; diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index 5980410e64..01aed7c0f1 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -265,167 +265,74 @@ void LLWLParamManager::refreshRegionPresets() addAllSkies(LLEnvKey::SCOPE_REGION, LLEnvManagerNew::instance().getRegionSettings().getSkyMap()); } -void LLWLParamManager::loadPresets(const std::string& file_name) +void LLWLParamManager::loadAllPresets() { - std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", "")); - LL_INFOS2("AppInit", "Shaders") << "Loading Default WindLight settings from " << path_name << LL_ENDL; - - bool found = true; - LLDirIterator app_settings_iter(path_name, "*.xml"); - while(found) - { - std::string name; - found = app_settings_iter.next(name); - if(found) - { - name=name.erase(name.length()-4); + // First, load system (coming out of the box) sky presets. + loadPresetsFromDir(getSysDir()); - // bugfix for SL-46920: preventing filenames that break stuff. - char * curl_str = curl_unescape(name.c_str(), name.size()); - std::string unescaped_name(curl_str); - curl_free(curl_str); - curl_str = NULL; - - LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL; - loadPreset(LLWLParamKey(unescaped_name, LLWLParamKey::SCOPE_LOCAL),FALSE); - } - } + // Then load user presets. Note that user day presets will modify any system ones already loaded. + loadPresetsFromDir(getUserDir()); +} - // And repeat for user presets, note the user presets will modify any system presets already loaded +void LLWLParamManager::loadPresetsFromDir(const std::string& dir) +{ + LL_INFOS2("AppInit", "Shaders") << "Loading sky presets from " << dir << LL_ENDL; - std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); - LL_INFOS2("AppInit", "Shaders") << "Loading User WindLight settings from " << path_name2 << LL_ENDL; - - found = true; - LLDirIterator user_settings_iter(path_name2, "*.xml"); - while(found) + LLDirIterator dir_iter(dir, "*.xml"); + while (1) { - std::string name; - found = user_settings_iter.next(name); - if(found) + std::string file; + if (!dir_iter.next(file)) { - name=name.erase(name.length()-4); - - // bugfix for SL-46920: preventing filenames that break stuff. - char * curl_str = curl_unescape(name.c_str(), name.size()); - std::string unescaped_name(curl_str); - curl_free(curl_str); - curl_str = NULL; + break; // no more files + } - LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL; - loadPreset(LLWLParamKey(unescaped_name,LLWLParamKey::SCOPE_LOCAL),FALSE); + std::string path = dir + file; + if (!loadPreset(path)) + { + llwarns << "Error loading sky preset from " << path << llendl; } } - } -// untested and unmaintained! sanity-check me before using -/* -void LLWLParamManager::savePresets(const std::string & fileName) +bool LLWLParamManager::loadPreset(const std::string& path) { - //Nobody currently calls me, but if they did, then its reasonable to write the data out to the user's folder - //and not over the RO system wide version. - - LLSD paramsData(LLSD::emptyMap()); - - std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", fileName)); + llifstream xml_file; + std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true)); - for(std::map::iterator mIt = mParamList.begin(); - mIt != mParamList.end(); - ++mIt) + xml_file.open(path.c_str()); + if (!xml_file) { - paramsData[mIt->first.name] = mIt->second.getAll(); + return false; } - llofstream presetsXML(pathName); - - LLPointer formatter = new LLSDXMLFormatter(); - - formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); + LL_DEBUGS2("AppInit", "Shaders") << "Loading sky " << name << LL_ENDL; - presetsXML.close(); -} -*/ + LLSD params_data; + LLPointer parser = new LLSDXMLParser(); + parser->parse(xml_file, params_data, LLSDSerialize::SIZE_UNLIMITED); + xml_file.close(); -void LLWLParamManager::loadPreset(const LLWLParamKey key, bool propagate) -{ - if(mParamList.find(key) == mParamList.end()) // key does not already exist in mapping + LLWLParamKey key(name, LLEnvKey::SCOPE_LOCAL); + if (hasParamSet(key)) { - if(key.scope == LLWLParamKey::SCOPE_LOCAL) // local scope, so try to load from file - { - // bugfix for SL-46920: preventing filenames that break stuff. - char * curl_str = curl_escape(key.name.c_str(), key.name.size()); - std::string escaped_filename(curl_str); - curl_free(curl_str); - curl_str = NULL; - - escaped_filename += ".xml"; - - std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename)); - llinfos << "Loading WindLight sky setting from " << pathName << llendl; - - llifstream presetsXML; - presetsXML.open(pathName.c_str()); - - // That failed, try loading from the users area instead. - if(!presetsXML) - { - pathName=gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename); - llinfos << "Loading User WindLight sky setting from " << pathName << llendl; - presetsXML.open(pathName.c_str()); - } - - if (presetsXML) - { - loadPresetFromXML(key, presetsXML); - presetsXML.close(); - } - else - { - llwarns << "Could not load local WindLight sky setting " << key.toString() << llendl; - return; - } - } - else - { - llwarns << "Attempted to load non-local WindLight sky settings " << key.toString() << "; not found in parameter mapping." << llendl; - return; - } + setParamSet(key, params_data); } - - if(propagate) + else { - getParamSet(key, mCurParams); - propagateParameters(); + addParamSet(key, params_data); } -} - -void LLWLParamManager::loadPresetFromXML(LLWLParamKey key, std::istream & presetsXML) -{ - LLSD paramsData(LLSD::emptyMap()); - LLPointer parser = new LLSDXMLParser(); - - parser->parse(presetsXML, paramsData, LLSDSerialize::SIZE_UNLIMITED); - - std::map::iterator mIt = mParamList.find(key); - if(mIt == mParamList.end()) addParamSet(key, paramsData); - else setParamSet(key, paramsData); + return true; } void LLWLParamManager::savePreset(LLWLParamKey key) { - // bugfix for SL-46920: preventing filenames that break stuff. - char * curl_str = curl_escape(key.name.c_str(), key.name.size()); - std::string escaped_filename(curl_str); - curl_free(curl_str); - curl_str = NULL; - - escaped_filename += ".xml"; + llassert(key.scope == LLEnvKey::SCOPE_LOCAL && !key.name.empty()); // make an empty llsd LLSD paramsData(LLSD::emptyMap()); - std::string pathName(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", escaped_filename)); + std::string pathName(getUserDir() + escapeString(key.name) + ".xml"); // fill it with LLSD windlight params paramsData = mParamList[key].getAll(); @@ -718,6 +625,12 @@ bool LLWLParamManager::getParamSet(const LLWLParamKey& key, LLWLParamSet& param) return false; } +bool LLWLParamManager::hasParamSet(const LLWLParamKey& key) +{ + LLWLParamSet dummy; + return getParamSet(key, dummy); +} + bool LLWLParamManager::setParamSet(const LLWLParamKey& key, LLWLParamSet& param) { llassert(!key.name.empty()); @@ -746,6 +659,15 @@ bool LLWLParamManager::setParamSet(const LLWLParamKey& key, const LLSD & param) void LLWLParamManager::removeParamSet(const LLWLParamKey& key, bool delete_from_disk) { + // *TODO: notify interested parties that a sky preset has been removed. + + if (key.scope == LLEnvKey::SCOPE_REGION) + { + llwarns << "Removing region skies not supported" << llendl; + llassert(key.scope == LLEnvKey::SCOPE_LOCAL); + return; + } + // remove from param list std::map::iterator mIt = mParamList.find(key); if(mIt != mParamList.end()) @@ -759,30 +681,30 @@ void LLWLParamManager::removeParamSet(const LLWLParamKey& key, bool delete_from_ mDay.removeReferencesTo(key); - if(delete_from_disk && key.scope == LLWLParamKey::SCOPE_LOCAL) + if (delete_from_disk) { - std::string path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/skies", "")); - - // use full curl escaped name - char * curl_str = curl_escape(key.name.c_str(), key.name.size()); - std::string escaped_name(curl_str); - curl_free(curl_str); - curl_str = NULL; - + std::string path_name(getUserDir()); + std::string escaped_name = escapeString(key.name); + if(gDirUtilp->deleteFilesInDir(path_name, escaped_name + ".xml") < 1) { - LL_WARNS("WindLight") << "Unable to delete key " << key.toString() << " from disk; not found." << LL_ENDL; + LL_WARNS("WindLight") << "Error removing sky preset " << key.name << " from disk" << LL_ENDL; } } } +bool LLWLParamManager::isSystemPreset(const std::string& preset_name) +{ + // *TODO: file system access is excessive here. + return gDirUtilp->fileExists(getSysDir() + escapeString(preset_name) + ".xml"); +} // virtual static void LLWLParamManager::initSingleton() { LL_DEBUGS("Windlight") << "Initializing sky" << LL_ENDL; - loadPresets(LLStringUtil::null); + loadAllPresets(); // load the day std::string preferred_day = LLEnvManagerNew::instance().getDayCycleName(); @@ -813,3 +735,27 @@ void LLWLParamManager::initSingleton() applyUserPrefs(false); } + +// static +std::string LLWLParamManager::getSysDir() +{ + return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", ""); +} + +// static +std::string LLWLParamManager::getUserDir() +{ + return gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS , "windlight/skies", ""); +} + +// static +std::string LLWLParamManager::escapeString(const std::string& str) +{ + // Don't use LLURI::escape() because it doesn't encode '-' characters + // which may break handling of some system presets like "A-12AM". + char* curl_str = curl_escape(str.c_str(), str.size()); + std::string escaped_str(curl_str); + curl_free(curl_str); + + return escaped_str; +} diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h index 30fc8cd68f..06f56851b6 100644 --- a/indra/newview/llwlparammanager.h +++ b/indra/newview/llwlparammanager.h @@ -216,19 +216,6 @@ class LLWLParamManager : public LLSingleton { LOG_CLASS(LLWLParamManager); public: - /// load a preset file - void loadPresets(const std::string & fileName); - - /// save the preset file - // the implementation of this method was unmaintained and is commented out - // *NOTE test and sanity-check before uncommenting and using! - void savePresets(const std::string & fileName); - - /// load an individual preset into the sky - void loadPreset(const LLWLParamKey key, bool propogate=true); - - /// load an individual preset from a stream of XML - void loadPresetFromXML(const LLWLParamKey key, std::istream & presetXML); /// save the parameter presets to file void savePreset(const LLWLParamKey key); @@ -281,12 +268,15 @@ public: /// get a param set (preset) from the list bool getParamSet(const LLWLParamKey& key, LLWLParamSet& param); + /// get a param set (preset) from the list + bool hasParamSet(const LLWLParamKey& key); + /// set the param in the list with a new param bool setParamSet(const LLWLParamKey& key, LLWLParamSet& param); /// set the param in the list with a new param bool setParamSet(const LLWLParamKey& key, LLSD const & param); - + /// gets rid of a parameter and any references to it /// ignores "delete_from_disk" if the scope is not local void removeParamSet(const LLWLParamKey& key, bool delete_from_disk); @@ -294,6 +284,9 @@ public: /// clear parameter mapping of a given scope void clearParamSetsOfScope(LLEnvKey::EScope scope); + /// @return true if the preset comes out of the box + bool isSystemPreset(const std::string& preset_name); + /// add all skies in LLSD using the given scope void addAllSkies(LLEnvKey::EScope scope, const LLSD& preset_map); @@ -307,6 +300,9 @@ public: // returns all skies in map (intended to be called with output from a finalize) static LLSD createSkyMap(std::map map); + /// escape string in a way different from LLURI::escape() + static std::string escapeString(const std::string& str); + // helper variables LLWLAnimator mAnimator; @@ -362,6 +358,14 @@ public: std::map mParamList; private: + + void loadAllPresets(); + void loadPresetsFromDir(const std::string& dir); + bool loadPreset(const std::string& path); + + static std::string getSysDir(); + static std::string getUserDir(); + friend class LLSingleton; /*virtual*/ void initSingleton(); LLWLParamManager(); diff --git a/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml b/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml index 6ffb3480ad..fa51059d44 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_sky_preset.xml @@ -13,6 +13,7 @@ Edit Sky Preset Name your preset, adjust the controls to create it, and click "Save". To edit your sky preset, adjust the controls and click "Save". + -Select a preset- - - + width="200"/> + + Date: Sun, 12 Jun 2011 19:59:06 -0400 Subject: STORM-787 Mute Gestures Button --- indra/newview/skins/default/xui/en/panel_preferences_sound.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml index 1bdd2ccefb..baa8d485ef 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml @@ -322,7 +322,7 @@ follows="left|bottom|right" height="15" tool_tip="Check this to hear sounds from gestures" - label="Enable sounds from gestures" + label="Play sounds from gestures" top_pad="1" left="25"/> Date: Mon, 13 Jun 2011 08:24:32 -0400 Subject: increment viewer version to 2.7.4 --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index fa92a3a75b..cfafbf0470 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 2; const S32 LL_VERSION_MINOR = 7; -const S32 LL_VERSION_PATCH = 3; +const S32 LL_VERSION_PATCH = 4; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3 From f1ec7a821b82df5361864ecfef49ee8cee4ba7d8 Mon Sep 17 00:00:00 2001 From: eli_linden Date: Mon, 13 Jun 2011 15:28:24 -0700 Subject: FIX CT-636 CT-640 DA translation for Set22 and Set1 --- .../skins/default/xui/da/floater_about_land.xml | 4 +- indra/newview/skins/default/xui/da/floater_map.xml | 3 + .../newview/skins/default/xui/da/floater_tools.xml | 2 + .../skins/default/xui/da/menu_attachment_self.xml | 2 +- .../skins/default/xui/da/menu_avatar_self.xml | 2 +- .../skins/default/xui/da/menu_bottomtray.xml | 2 +- .../default/xui/da/menu_inspect_avatar_gear.xml | 6 +- .../default/xui/da/menu_inspect_self_gear.xml | 39 +- .../default/xui/da/menu_inventory_gear_default.xml | 1 + indra/newview/skins/default/xui/da/menu_object.xml | 4 +- .../default/xui/da/menu_places_gear_folder.xml | 5 +- .../default/xui/da/menu_places_gear_landmark.xml | 5 +- indra/newview/skins/default/xui/da/menu_viewer.xml | 8 +- .../newview/skins/default/xui/da/notifications.xml | 50 +- indra/newview/skins/default/xui/da/panel_login.xml | 7 + .../skins/default/xui/da/panel_nearby_media.xml | 2 +- .../newview/skins/default/xui/da/panel_people.xml | 2 + .../default/xui/da/panel_preferences_sound.xml | 4 +- .../newview/skins/default/xui/da/panel_profile.xml | 8 +- .../skins/default/xui/da/panel_script_ed.xml | 3 + indra/newview/skins/default/xui/da/strings.xml | 357 +++- .../skins/minimal/xui/da/floater_camera.xml | 65 + .../skins/minimal/xui/da/floater_help_browser.xml | 9 + .../skins/minimal/xui/da/floater_media_browser.xml | 19 + .../skins/minimal/xui/da/floater_nearby_chat.xml | 4 + .../skins/minimal/xui/da/floater_web_content.xml | 14 + .../skins/minimal/xui/da/inspect_avatar.xml | 24 + .../skins/minimal/xui/da/inspect_object.xml | 41 + .../minimal/xui/da/menu_add_wearable_gear.xml | 6 + .../skins/minimal/xui/da/menu_attachment_other.xml | 17 + .../skins/minimal/xui/da/menu_attachment_self.xml | 16 + .../skins/minimal/xui/da/menu_avatar_icon.xml | 7 + .../skins/minimal/xui/da/menu_avatar_other.xml | 16 + .../skins/minimal/xui/da/menu_avatar_self.xml | 31 + .../skins/minimal/xui/da/menu_bottomtray.xml | 17 + .../skins/minimal/xui/da/menu_cof_attachment.xml | 4 + .../skins/minimal/xui/da/menu_cof_body_part.xml | 5 + .../skins/minimal/xui/da/menu_cof_clothing.xml | 6 + .../newview/skins/minimal/xui/da/menu_cof_gear.xml | 5 + indra/newview/skins/minimal/xui/da/menu_edit.xml | 12 + .../skins/minimal/xui/da/menu_favorites.xml | 10 + .../skins/minimal/xui/da/menu_gesture_gear.xml | 10 + .../skins/minimal/xui/da/menu_group_plus.xml | 5 + .../skins/minimal/xui/da/menu_hide_navbar.xml | 6 + .../skins/minimal/xui/da/menu_im_well_button.xml | 4 + .../skins/minimal/xui/da/menu_imchiclet_adhoc.xml | 4 + .../skins/minimal/xui/da/menu_imchiclet_group.xml | 6 + .../skins/minimal/xui/da/menu_imchiclet_p2p.xml | 7 + .../minimal/xui/da/menu_inspect_avatar_gear.xml | 21 + .../minimal/xui/da/menu_inspect_object_gear.xml | 18 + .../minimal/xui/da/menu_inspect_self_gear.xml | 31 + .../minimal/xui/da/menu_inv_offer_chiclet.xml | 4 + .../skins/minimal/xui/da/menu_inventory.xml | 84 + .../skins/minimal/xui/da/menu_inventory_add.xml | 33 + .../minimal/xui/da/menu_inventory_gear_default.xml | 17 + indra/newview/skins/minimal/xui/da/menu_land.xml | 9 + .../newview/skins/minimal/xui/da/menu_landmark.xml | 7 + indra/newview/skins/minimal/xui/da/menu_login.xml | 24 + .../newview/skins/minimal/xui/da/menu_mini_map.xml | 11 + indra/newview/skins/minimal/xui/da/menu_navbar.xml | 11 + .../skins/minimal/xui/da/menu_nearby_chat.xml | 9 + .../xui/da/menu_notification_well_button.xml | 4 + indra/newview/skins/minimal/xui/da/menu_object.xml | 29 + .../skins/minimal/xui/da/menu_object_icon.xml | 5 + .../skins/minimal/xui/da/menu_outfit_gear.xml | 27 + .../skins/minimal/xui/da/menu_outfit_tab.xml | 9 + .../skins/minimal/xui/da/menu_participant_list.xml | 21 + .../xui/da/menu_people_friends_view_sort.xml | 8 + .../skins/minimal/xui/da/menu_people_groups.xml | 8 + .../xui/da/menu_people_groups_view_sort.xml | 5 + .../skins/minimal/xui/da/menu_people_nearby.xml | 13 + .../xui/da/menu_people_nearby_multiselect.xml | 10 + .../xui/da/menu_people_nearby_view_sort.xml | 8 + .../xui/da/menu_people_recent_view_sort.xml | 7 + indra/newview/skins/minimal/xui/da/menu_picks.xml | 8 + .../skins/minimal/xui/da/menu_picks_plus.xml | 5 + indra/newview/skins/minimal/xui/da/menu_place.xml | 7 + .../skins/minimal/xui/da/menu_place_add_button.xml | 5 + .../minimal/xui/da/menu_places_gear_folder.xml | 16 + .../minimal/xui/da/menu_places_gear_landmark.xml | 19 + .../skins/minimal/xui/da/menu_profile_overflow.xml | 12 + .../skins/minimal/xui/da/menu_save_outfit.xml | 5 + .../skins/minimal/xui/da/menu_script_chiclet.xml | 4 + indra/newview/skins/minimal/xui/da/menu_slurl.xml | 6 + .../minimal/xui/da/menu_teleport_history_gear.xml | 6 + .../minimal/xui/da/menu_teleport_history_item.xml | 6 + .../minimal/xui/da/menu_teleport_history_tab.xml | 5 + .../skins/minimal/xui/da/menu_text_editor.xml | 8 + .../skins/minimal/xui/da/menu_topinfobar.xml | 7 + .../skins/minimal/xui/da/menu_url_agent.xml | 6 + .../skins/minimal/xui/da/menu_url_group.xml | 6 + .../newview/skins/minimal/xui/da/menu_url_http.xml | 7 + .../skins/minimal/xui/da/menu_url_inventory.xml | 6 + .../newview/skins/minimal/xui/da/menu_url_map.xml | 6 + .../skins/minimal/xui/da/menu_url_objectim.xml | 8 + .../skins/minimal/xui/da/menu_url_parcel.xml | 6 + .../skins/minimal/xui/da/menu_url_slapp.xml | 5 + .../skins/minimal/xui/da/menu_url_slurl.xml | 7 + .../skins/minimal/xui/da/menu_url_teleport.xml | 6 + indra/newview/skins/minimal/xui/da/menu_viewer.xml | 14 + .../minimal/xui/da/menu_wearable_list_item.xml | 14 + .../skins/minimal/xui/da/menu_wearing_gear.xml | 5 + .../skins/minimal/xui/da/menu_wearing_tab.xml | 6 + .../newview/skins/minimal/xui/da/notifications.xml | 1833 ++++++++++++++++++++ .../minimal/xui/da/panel_adhoc_control_panel.xml | 14 + .../skins/minimal/xui/da/panel_bottomtray.xml | 39 + .../minimal/xui/da/panel_group_control_panel.xml | 17 + .../minimal/xui/da/panel_im_control_panel.xml | 29 + indra/newview/skins/minimal/xui/da/panel_login.xml | 48 + .../skins/minimal/xui/da/panel_navigation_bar.xml | 18 + .../newview/skins/minimal/xui/da/panel_people.xml | 94 + .../minimal/xui/da/panel_side_tray_tab_caption.xml | 7 + .../skins/minimal/xui/da/panel_status_bar.xml | 33 + 113 files changed, 3625 insertions(+), 47 deletions(-) create mode 100644 indra/newview/skins/minimal/xui/da/floater_camera.xml create mode 100644 indra/newview/skins/minimal/xui/da/floater_help_browser.xml create mode 100644 indra/newview/skins/minimal/xui/da/floater_media_browser.xml create mode 100644 indra/newview/skins/minimal/xui/da/floater_nearby_chat.xml create mode 100644 indra/newview/skins/minimal/xui/da/floater_web_content.xml create mode 100644 indra/newview/skins/minimal/xui/da/inspect_avatar.xml create mode 100644 indra/newview/skins/minimal/xui/da/inspect_object.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_add_wearable_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_attachment_other.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_attachment_self.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_avatar_icon.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_avatar_other.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_avatar_self.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_bottomtray.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_cof_attachment.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_cof_body_part.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_cof_clothing.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_cof_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_edit.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_favorites.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_gesture_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_group_plus.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_hide_navbar.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_im_well_button.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_imchiclet_adhoc.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_imchiclet_group.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_imchiclet_p2p.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inspect_avatar_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inspect_object_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inspect_self_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inv_offer_chiclet.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inventory.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inventory_add.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_inventory_gear_default.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_land.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_landmark.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_login.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_mini_map.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_navbar.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_nearby_chat.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_notification_well_button.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_object.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_object_icon.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_outfit_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_outfit_tab.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_participant_list.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_friends_view_sort.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_groups.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_groups_view_sort.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_nearby.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_nearby_multiselect.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_nearby_view_sort.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_people_recent_view_sort.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_picks.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_picks_plus.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_place.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_place_add_button.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_places_gear_folder.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_places_gear_landmark.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_profile_overflow.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_save_outfit.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_script_chiclet.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_slurl.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_teleport_history_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_teleport_history_item.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_teleport_history_tab.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_text_editor.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_topinfobar.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_agent.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_group.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_http.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_inventory.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_map.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_objectim.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_parcel.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_slapp.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_slurl.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_url_teleport.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_viewer.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_wearable_list_item.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_wearing_gear.xml create mode 100644 indra/newview/skins/minimal/xui/da/menu_wearing_tab.xml create mode 100644 indra/newview/skins/minimal/xui/da/notifications.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_adhoc_control_panel.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_bottomtray.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_group_control_panel.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_im_control_panel.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_login.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_navigation_bar.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_people.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_side_tray_tab_caption.xml create mode 100644 indra/newview/skins/minimal/xui/da/panel_status_bar.xml (limited to 'indra') diff --git a/indra/newview/skins/default/xui/da/floater_about_land.xml b/indra/newview/skins/default/xui/da/floater_about_land.xml index 46e1eca126..5b9e618666 100644 --- a/indra/newview/skins/default/xui/da/floater_about_land.xml +++ b/indra/newview/skins/default/xui/da/floater_about_land.xml @@ -346,6 +346,7 @@ Kun større parceller kan vises i søgning. + @@ -360,6 +361,7 @@ Kun større parceller kan vises i søgning. + @@ -426,7 +428,7 @@ Kun større parceller kan vises i søgning. (Defineret via estate) - Tillad adgang for alle ([MATURITY]) + Tillad offentlig adgang ([MATURITY]) (Bemærk: Ellers oprettes blokeringslinier) En eller flere af disse valg er indstillet pÃ¥ estate niveau diff --git a/indra/newview/skins/default/xui/da/floater_map.xml b/indra/newview/skins/default/xui/da/floater_map.xml index 5df9bb5f6e..4912d73ba0 100644 --- a/indra/newview/skins/default/xui/da/floater_map.xml +++ b/indra/newview/skins/default/xui/da/floater_map.xml @@ -3,6 +3,9 @@ [REGION](Dobbeltklik for at Ã¥bne kort, klik-og-træk for at panorere) + + [REGION](Dobbeltklik for at teleportere, træk for at panorere) + MINIKORT diff --git a/indra/newview/skins/default/xui/da/floater_tools.xml b/indra/newview/skins/default/xui/da/floater_tools.xml index 9e673d0d5b..8264e366c0 100644 --- a/indra/newview/skins/default/xui/da/floater_tools.xml +++ b/indra/newview/skins/default/xui/da/floater_tools.xml @@ -64,6 +64,8 @@ + - + Friends All + No attachments worn + Buy -- cgit v1.2.3 From cc6e80412949639f52138adde5b909a298cd2242 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 16 Jun 2011 15:58:34 -0400 Subject: SH-1166 FIX --- indra/newview/skins/default/xui/en/notifications.xml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index c8d1d6c9fd..09105c1d28 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6824,6 +6824,8 @@ Select residents to share with. icon="alert.tga" type="alert"> [LABEL] failed to upload: [MESSAGE] [IDENTIFIER] + +See the log file for details. Date: Thu, 16 Jun 2011 23:53:41 +0300 Subject: STORM-1352 WIP Attempting to fix a crash in LLNearbyChatScreenChannel::showToastsBottom(). Apparently, a nearby chat toast got somehow destroyed while still remaining in the list of active toasts. Attempt to sort active toasts in showToastsBottom() then triggered the crash. I don't know how to reproduce the crash, i.e. force destroying a toast in a way that its onClose() method (which would remove references to the toast) isn't called. So we'll just remove references to the toast whenever it's destroyed. --- indra/newview/llnearbychathandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra') diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index 11dc496311..ae44c76038 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -268,6 +268,9 @@ bool LLNearbyChatScreenChannel::createPoolToast() toast->setOnFadeCallback(boost::bind(&LLNearbyChatScreenChannel::onToastFade, this, _1)); + // If the toast gets somehow prematurely destroyed, deactivate it to prevent crash (STORM-1352). + toast->setOnToastDestroyedCallback(boost::bind(&LLNearbyChatScreenChannel::onToastDestroyed, this, _1, false)); + LL_DEBUGS("NearbyChat") << "Creating and pooling toast" << llendl; m_toast_pool.push_back(toast->getHandle()); return true; @@ -371,6 +374,8 @@ void LLNearbyChatScreenChannel::arrangeToasts() int sort_toasts_predicate(LLHandle first, LLHandle second) { + if (!first.get() || !second.get()) return 0; // STORM-1352 + F32 v1 = first.get()->getTimeLeftToLive(); F32 v2 = second.get()->getTimeLeftToLive(); return v1 > v2; -- cgit v1.2.3 From 6c5ae7f6ab3b844a135c6662a2f015eca684ab14 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 16 Jun 2011 17:00:12 -0400 Subject: Fix for linux build failure, hopefully --- indra/newview/llmeshrepository.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 76079b2bf5..6e0722bcf9 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1455,7 +1455,7 @@ void dump_llsd_to_file(const LLSD& content, std::string filename) LLSD llsd_from_file(std::string filename) { - std::ifstream ifs(filename); + std::ifstream ifs(filename.c_str()); LLSD result; LLSDSerialize::fromXML(result,ifs); return result; -- cgit v1.2.3 From e63f6311be2b2bca9b45ddbf43b675200dc51486 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 16 Jun 2011 15:55:22 -0600 Subject: fix for STORM-1274: crash at LLVOCacheEntry::~LLVOCacheEntry() line 138 --- indra/newview/llvocache.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index bbb19a63f1..f0b5b50feb 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -137,10 +137,6 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) LLVOCacheEntry::~LLVOCacheEntry() { - if(mBuffer != mDP.getBuffer()) - { - delete[] mBuffer ; //just in case - } mDP.freeBuffer(); } -- cgit v1.2.3 From f42d2607be4aad88f432346787e556836b58a757 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 16 Jun 2011 16:38:31 -0700 Subject: EXP-905 Missing items from right click context menus in My Inbox EXP-892 No way to delete items in Inbox without moving them to Inventory --- indra/newview/llinventorybridge.cpp | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 88475bd942..f4670731ad 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -571,7 +571,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, } } - // Don't allow items to be pasted directly into the COF. + // Don't allow items to be pasted directly into the COF or the inbox if (!isCOFFolder() && !isInboxFolder()) { items.push_back(std::string("Paste")); @@ -2530,6 +2530,7 @@ void LLFolderBridge::folderOptionsMenu() { mItems.push_back(std::string("Add To Outfit")); } + mItems.push_back(std::string("Replace Outfit")); } if (is_ensemble) @@ -2617,17 +2618,19 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) LLViewerInventoryCategory *cat = getCategory(); // BAP removed protected check to re-enable standard ops in untyped folders. // Not sure what the right thing is to do here. - if (!isCOFFolder() && !isInboxFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT)) + if (!isCOFFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT)) { - // Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694. - if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat)) - mItems.push_back(std::string("New Folder")); - mItems.push_back(std::string("New Script")); - mItems.push_back(std::string("New Note")); - mItems.push_back(std::string("New Gesture")); - mItems.push_back(std::string("New Clothes")); - mItems.push_back(std::string("New Body Parts")); - + if (!isInboxFolder()) // don't allow creation in inbox + { + // Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694. + if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat)) + mItems.push_back(std::string("New Folder")); + mItems.push_back(std::string("New Script")); + mItems.push_back(std::string("New Note")); + mItems.push_back(std::string("New Gesture")); + mItems.push_back(std::string("New Clothes")); + mItems.push_back(std::string("New Body Parts")); + } #if SUPPORT_ENSEMBLES // Changing folder types is an unfinished unsupported feature // and can lead to unexpected behavior if enabled. @@ -2643,7 +2646,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) else { // Want some but not all of the items from getClipboardEntries for outfits. - if (cat && (cat->getPreferredType() == LLFolderType::FT_OUTFIT) || (cat->getPreferredType() == LLFolderType::FT_INBOX)) + if (cat && (cat->getPreferredType() == LLFolderType::FT_OUTFIT)) { mItems.push_back(std::string("Rename")); @@ -4320,7 +4323,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) items.push_back(std::string("Wearable And Object Separator")); items.push_back(std::string("Detach From Yourself")); } - else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing() && !isCOFFolder() && !isInboxFolder()) + else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing() && !isCOFFolder()) { items.push_back(std::string("Wearable And Object Separator")); items.push_back(std::string("Wearable And Object Wear")); @@ -4672,7 +4675,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) disabled_items.push_back(std::string("Wearable Edit")); } // Don't allow items to be worn if their baseobj is in the trash. - if (isLinkedObjectInTrash() || isLinkedObjectMissing() || isCOFFolder() || isInboxFolder()) + if (isLinkedObjectInTrash() || isLinkedObjectMissing() || isCOFFolder()) { disabled_items.push_back(std::string("Wearable And Object Wear")); disabled_items.push_back(std::string("Wearable Add")); -- cgit v1.2.3 From 64f978dc81cf6b3dad42fc5f1cf3896208efc8ac Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 16 Jun 2011 16:39:30 -0700 Subject: EXP-891 Right click on Inbox or Outbox toggles up down arrow but has no action --- indra/llui/llbutton.cpp | 57 ++++++++++++---------- indra/llui/llbutton.h | 4 ++ .../skins/default/xui/en/sidepanel_inventory.xml | 2 + .../skins/default/xui/en/widgets/button.xml | 1 + 4 files changed, 39 insertions(+), 25 deletions(-) (limited to 'indra') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 637024e513..7b015bd576 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -100,7 +100,8 @@ LLButton::Params::Params() hover_glow_amount("hover_glow_amount"), commit_on_return("commit_on_return", true), use_draw_context_alpha("use_draw_context_alpha", true), - badge("badge") + badge("badge"), + handle_right_mouse("handle_right_mouse") { addSynonym(is_toggle, "toggle"); held_down_delay.seconds = 0.5f; @@ -162,7 +163,8 @@ LLButton::LLButton(const LLButton::Params& p) mMouseDownSignal(NULL), mMouseUpSignal(NULL), mHeldDownSignal(NULL), - mUseDrawContextAlpha(p.use_draw_context_alpha) + mUseDrawContextAlpha(p.use_draw_context_alpha), + mHandleRightMouse(p.handle_right_mouse) { static LLUICachedControl llbutton_orig_h_pad ("UIButtonOrigHPad", 0); static Params default_params(LLUICtrlFactory::getDefaultParams()); @@ -457,7 +459,7 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) { - if (!childrenHandleRightMouseDown(x, y, mask)) + if (mHandleRightMouse && !childrenHandleRightMouseDown(x, y, mask)) { // Route future Mouse messages here preemptively. (Release on mouse up.) gFocusMgr.setMouseCapture( this ); @@ -470,37 +472,42 @@ BOOL LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) // if (pointInView(x, y)) // { // } + // send the mouse down signal + LLUICtrl::handleRightMouseDown(x,y,mask); + // *TODO: Return result of LLUICtrl call above? Should defer to base class + // but this might change the mouse handling of existing buttons in a bad way + // if they are not mouse opaque. } - // send the mouse down signal - LLUICtrl::handleRightMouseDown(x,y,mask); - // *TODO: Return result of LLUICtrl call above? Should defer to base class - // but this might change the mouse handling of existing buttons in a bad way - // if they are not mouse opaque. + return TRUE; } BOOL LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) { - // We only handle the click if the click both started and ended within us - if( hasMouseCapture() ) + if (mHandleRightMouse) { - // Always release the mouse - gFocusMgr.setMouseCapture( NULL ); + // We only handle the click if the click both started and ended within us + if( hasMouseCapture() ) + { + // Always release the mouse + gFocusMgr.setMouseCapture( NULL ); -// if (pointInView(x, y)) -// { -// mRightMouseUpSignal(this, x,y,mask); -// } - } - else - { - childrenHandleRightMouseUp(x, y, mask); + // if (pointInView(x, y)) + // { + // mRightMouseUpSignal(this, x,y,mask); + // } + } + else + { + childrenHandleRightMouseUp(x, y, mask); + } + + // send the mouse up signal + LLUICtrl::handleRightMouseUp(x,y,mask); + // *TODO: Return result of LLUICtrl call above? Should defer to base class + // but this might change the mouse handling of existing buttons in a bad way. + // if they are not mouse opaque. } - // send the mouse up signal - LLUICtrl::handleRightMouseUp(x,y,mask); - // *TODO: Return result of LLUICtrl call above? Should defer to base class - // but this might change the mouse handling of existing buttons in a bad way. - // if they are not mouse opaque. return TRUE; } diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 5880a0e1f2..5968916006 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -129,6 +129,8 @@ public: Optional badge; + Optional handle_right_mouse; + Params(); }; @@ -359,6 +361,8 @@ private: bool mForcePressedState; LLFrameTimer mFlashingTimer; + + bool mHandleRightMouse; }; // Build time optimization, generate once in .cpp file diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index 9a91f90f79..1fedd6aab8 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -76,6 +76,7 @@ image_unselected="MarketplaceBtn_Off" image_selected="MarketplaceBtn_Selected" halign="left" + handle_right_mouse="false" follows="top|left|right" is_toggle="true" tab_stop="false" @@ -154,6 +155,7 @@ -- cgit v1.2.3 From 0d246c0c5fc3ddef2022572b560eaec0018a722e Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 16 Jun 2011 17:14:51 -0700 Subject: EXP-872 PROGRESS -- Hide Inbox unless applicable EXP-910 FIX -- Newness badge shown on suitcase inventory icon when InventoryDisplayInbox is set to False EXP-895 FIX -- Selecting items in Marketplace Inbox does not change focus in inventory panel away from items selected in inventory panel * Main inventory, outbox and inbox all clear the selection of the others when they gain focus * The Fresh Item Count badge is no longer displayed on the inventory side tab button when the inbox is disabled * The New Item Count text is no longer displayed. (we will enable it again when freshness is supported) --- indra/newview/llpanelmaininventory.cpp | 20 ++++++++++++++++ indra/newview/llpanelmaininventory.h | 2 ++ indra/newview/llpanelmarketplaceinbox.cpp | 38 ++++++++++++++++++++++++++++-- indra/newview/llpanelmarketplaceinbox.h | 2 ++ indra/newview/llpanelmarketplaceoutbox.cpp | 28 ++++++++++++++++++++++ indra/newview/llpanelmarketplaceoutbox.h | 2 ++ indra/newview/llsidepanelinventory.cpp | 37 ++++++++++++++++++++--------- indra/newview/llsidepanelinventory.h | 8 ++++++- 8 files changed, 123 insertions(+), 14 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index bc4998dd0c..9f797eb147 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -193,6 +193,9 @@ BOOL LLPanelMainInventory::postBuild() mMenuAdd->getChild("Upload Animation")->setLabelArg("[COST]", upload_cost); mMenuAdd->getChild("Bulk Upload")->setLabelArg("[COST]", upload_cost); + // Trigger callback for focus received so we can deselect items in inbox/outbox + LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMainInventory::onFocusReceived, this)); + return TRUE; } @@ -572,6 +575,23 @@ void LLPanelMainInventory::updateItemcountText() getChild("ItemcountText")->setValue(text); } +void LLPanelMainInventory::onFocusReceived() +{ + LLInventoryPanel * inbox_panel = findChild("inventory_inbox"); + + if (inbox_panel) + { + inbox_panel->clearSelection(); + } + + LLInventoryPanel * outbox_panel = findChild("inventory_outbox"); + + if (outbox_panel) + { + outbox_panel->clearSelection(); + } +} + void LLPanelMainInventory::setFilterTextFromFilter() { mFilterText = mActivePanel->getFilter()->getFilterText(); diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 2b2ee1c0c9..86b2c87e0b 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -114,6 +114,8 @@ protected: bool isSaveTextureEnabled(const LLSD& userdata); void updateItemcountText(); + void onFocusReceived(); + private: LLFloaterInventoryFinder* getFinder(); diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 0fe2560fbf..eff27aa541 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -31,6 +31,11 @@ #include "llappviewer.h" #include "llbutton.h" #include "llinventorypanel.h" +#include "llsidepanelinventory.h" + + +#define SUPPORTING_FRESH_ITEM_COUNT 0 + static LLRegisterPanelClassWrapper t_panel_marketplace_inbox("panel_marketplace_inbox"); @@ -59,6 +64,8 @@ BOOL LLPanelMarketplaceInbox::postBuild() LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this)); + LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this)); + return TRUE; } @@ -68,6 +75,28 @@ void LLPanelMarketplaceInbox::handleLoginComplete() LLSideTray::getInstance()->setTabButtonBadgeDriver("sidebar_inventory", this); } +void LLPanelMarketplaceInbox::onFocusReceived() +{ + LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); + + if (sidepanel_inventory) + { + LLInventoryPanel * inv_panel = sidepanel_inventory->getActivePanel(); + + if (inv_panel) + { + inv_panel->clearSelection(); + } + + LLInventoryPanel * outbox_panel = sidepanel_inventory->findChild("inventory_outbox"); + + if (outbox_panel) + { + outbox_panel->clearSelection(); + } + } +} + BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { *accept = ACCEPT_NO; @@ -126,8 +155,9 @@ std::string LLPanelMarketplaceInbox::getBadgeString() const { std::string item_count_str(""); - // If side panel collapsed or expanded and not inventory - if (LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory")) + // If the inbox is visible, and the side panel is collapsed or expanded and not the inventory panel + if (getParent()->getVisible() && + (LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory"))) { U32 item_count = getFreshItemCount(); @@ -154,6 +184,7 @@ void LLPanelMarketplaceInbox::draw() args["[NUM]"] = item_count_str; getChild("inbox_btn")->setLabel(getString("InboxLabelWithArg", args)); +#if SUPPORTING_FRESH_ITEM_COUNT // set green text to fresh item count U32 fresh_item_count = getFreshItemCount(); fresh_new_count_view->setVisible((fresh_item_count > 0)); @@ -162,6 +193,9 @@ void LLPanelMarketplaceInbox::draw() { getChild("inbox_fresh_new_count")->setTextArg("[NUM]", llformat("%d", fresh_item_count)); } +#else + fresh_new_count_view->setVisible(FALSE); +#endif } else { diff --git a/indra/newview/llpanelmarketplaceinbox.h b/indra/newview/llpanelmarketplaceinbox.h index 21069a0ea1..d5b216b56d 100644 --- a/indra/newview/llpanelmarketplaceinbox.h +++ b/indra/newview/llpanelmarketplaceinbox.h @@ -63,6 +63,8 @@ public: private: void handleLoginComplete(); + void onFocusReceived(); + private: LLInventoryPanel* mInventoryPanel; }; diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp index 96695becf0..c8752b3e0f 100644 --- a/indra/newview/llpanelmarketplaceoutbox.cpp +++ b/indra/newview/llpanelmarketplaceoutbox.cpp @@ -31,7 +31,11 @@ #include "llbutton.h" #include "llcoros.h" #include "lleventcoro.h" +#include "llinventorypanel.h" #include "llloadingindicator.h" +#include "llpanelmarketplaceinbox.h" +#include "llsidepanelinventory.h" +#include "llsidetray.h" #include "lltimer.h" @@ -60,9 +64,33 @@ BOOL LLPanelMarketplaceOutbox::postBuild() mSyncButton->setEnabled(!isOutboxEmpty()); + LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceOutbox::onFocusReceived, this)); + return TRUE; } +void LLPanelMarketplaceOutbox::onFocusReceived() +{ + LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); + + if (sidepanel_inventory) + { + LLInventoryPanel * inv_panel = sidepanel_inventory->getActivePanel(); + + if (inv_panel) + { + inv_panel->clearSelection(); + } + + LLInventoryPanel * inbox_panel = sidepanel_inventory->findChild("inventory_inbox"); + + if (inbox_panel) + { + inbox_panel->clearSelection(); + } + } +} + bool LLPanelMarketplaceOutbox::isOutboxEmpty() const { // TODO: Check for contents of outbox diff --git a/indra/newview/llpanelmarketplaceoutbox.h b/indra/newview/llpanelmarketplaceoutbox.h index 2fbe819762..94bc066224 100644 --- a/indra/newview/llpanelmarketplaceoutbox.h +++ b/indra/newview/llpanelmarketplaceoutbox.h @@ -54,6 +54,8 @@ protected: void onSyncButtonClicked(); void updateSyncButtonStatus(); + void onFocusReceived(); + private: LLButton * mSyncButton; LLLoadingIndicator * mSyncIndicator; diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index d916c430a8..32394da042 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -32,10 +32,10 @@ #include "llappviewer.h" #include "llavataractions.h" #include "llbutton.h" -#include "llcurl.h" #include "lldate.h" #include "llfirstuse.h" #include "llfoldertype.h" +#include "llhttpclient.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" @@ -69,6 +69,9 @@ static const char * const INBOX_LAYOUT_PANEL_NAME = "inbox_layout_panel"; static const char * const OUTBOX_LAYOUT_PANEL_NAME = "outbox_layout_panel"; static const char * const MAIN_INVENTORY_LAYOUT_PANEL = "main_inventory_layout_panel"; +static const char * const INBOX_INVENTORY_PANEL = "inventory_inbox"; +static const char * const OUTBOX_INVENTORY_PANEL = "inventory_outbox"; + static const char * const INVENTORY_LAYOUT_STACK_NAME = "inventory_layout_stack"; // @@ -84,14 +87,23 @@ public: { } - void errorWithContent(U32 status, const std::string& reason, const LLSD& content) + void completed(U32 status, const std::string& reason, const LLSD& content) { - llinfos << "Marketplace Inbox Disabled" << llendl; - } - - void result(const LLSD& content) - { - mSidepanelInventory->enableInbox(true); + if (isGoodStatus(status)) + { + // Complete success + mSidepanelInventory->enableInbox(true); + } + else if (status == 401) + { + // API is available for use but OpenID authorization failed + mSidepanelInventory->enableInbox(true); + } + else + { + // API in unavailable + llinfos << "Marketplace API is unavailable -- Inbox Disabled" << llendl; + } } private: @@ -106,7 +118,8 @@ LLSidepanelInventory::LLSidepanelInventory() : LLPanel() , mItemPanel(NULL) , mPanelMainInventory(NULL) - , mInventoryFetched(false) + , mInboxEnabled(false) + , mOutboxEnabled(false) , mCategoriesObserver(NULL) { //buildFromFile( "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() @@ -205,8 +218,8 @@ BOOL LLSidepanelInventory::postBuild() outbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleOutboxBtn, this)); // Set the inbox and outbox visible based on debug settings (final setting comes from http request below) - inbox_panel->setVisible(gSavedSettings.getBOOL("InventoryDisplayInbox")); - outbox_panel->setVisible(gSavedSettings.getBOOL("InventoryDisplayOutbox")); + enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox")); + enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox")); // Trigger callback for after login so we can setup to track inbox and outbox changes after initial inventory load LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::handleLoginComplete, this)); @@ -258,11 +271,13 @@ void LLSidepanelInventory::handleLoginComplete() void LLSidepanelInventory::enableInbox(bool enabled) { + mInboxEnabled = enabled; getChild(INBOX_LAYOUT_PANEL_NAME)->setVisible(enabled); } void LLSidepanelInventory::enableOutbox(bool enabled) { + mOutboxEnabled = enabled; getChild(OUTBOX_LAYOUT_PANEL_NAME)->setVisible(enabled); } diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index 25fc28d56b..b68abd65cc 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -43,8 +43,10 @@ public: LLSidepanelInventory(); virtual ~LLSidepanelInventory(); +private: void handleLoginComplete(); +public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); @@ -65,6 +67,9 @@ public: void enableInbox(bool enabled); void enableOutbox(bool enabled); + bool isInboxEnabled() const { return mInboxEnabled; } + bool isOutboxEnabled() const { return mOutboxEnabled; } + protected: // Tracks highlighted (selected) item in inventory panel. LLInventoryItem *getSelectedItem(); @@ -107,7 +112,8 @@ private: LLButton* mOverflowBtn; LLButton* mShopBtn; - bool mInventoryFetched; + bool mInboxEnabled; + bool mOutboxEnabled; LLInventoryCategoriesObserver* mCategoriesObserver; }; -- cgit v1.2.3 From 274266badcddc3733c9dc145b2df57dab0455858 Mon Sep 17 00:00:00 2001 From: LanceCorrimal Date: Fri, 17 Jun 2011 09:19:42 +0200 Subject: Changed popups for accepting inv offers from SystemMessage to SystemMessageTip: STORM-323 --- indra/newview/llviewermessage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 01a5cb18db..743e4e1469 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1502,7 +1502,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString("."); LLSD args; args["MESSAGE"] = log_message; - LLNotificationsUtil::add("SystemMessage", args); + LLNotificationsUtil::add("SystemMessageTip", args); } break; @@ -1676,7 +1676,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString("."); LLSD args; args["MESSAGE"] = log_message; - LLNotificationsUtil::add("SystemMessage", args); + LLNotificationsUtil::add("SystemMessageTip", args); } // we will want to open this item when it comes back. @@ -1727,7 +1727,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const LLSD args; args["MESSAGE"] = log_message; - LLNotificationsUtil::add("SystemMessage", args); + LLNotificationsUtil::add("SystemMessageTip", args); } if (busy && (!mFromGroup && !mFromObject)) -- cgit v1.2.3 From ec6be3fdb91ed5f4fb0e50977a7b0814a678af0a Mon Sep 17 00:00:00 2001 From: prep linden Date: Fri, 17 Jun 2011 10:47:33 -0400 Subject: Fix for sh-1586 & sh-1654 # Alt-zooming camera flipping --- indra/newview/llagentcamera.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index c30d3b9aa3..f195c985c0 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -393,8 +393,6 @@ LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, LLVector3 origi LLQuaternion inv_obj_rot = ~obj_rot; // get inverse of rotation LLVector3 object_extents = object->getScale(); - const LLVector4a* oe4 = object->mDrawable->getSpatialExtents(); - object_extents.set( oe4[1][0], oe4[1][1], oe4[1][2] ); // make sure they object extents are non-zero object_extents.clamp(0.001f, F32_MAX); -- cgit v1.2.3 From fe022adfa637d4f4f08d48576c75b5148573c8ed Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 17 Jun 2011 09:59:37 -0600 Subject: fix for SH-1783: [PUBLIC] Crash when adding a physics shape. --- indra/newview/llfloatermodelpreview.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index ab6753b4be..75728fdeeb 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3107,18 +3107,20 @@ void LLModelPreview::rebuildUploadData() } } - for (U32 i = 0; i < LLModel::NUM_LODS; i++) - { //fill LOD slots based on reference model index - if (!mModel[i].empty()) - { - instance.mLOD[i] = mModel[i][idx]; - } - else - { - instance.mLOD[i] = NULL; + if(idx < mBaseModel.size()) + { + for (U32 i = 0; i < LLModel::NUM_LODS; i++) + { //fill LOD slots based on reference model index + if (mModel[i].size() > idx) + { + instance.mLOD[i] = mModel[i][idx]; + } + else + { + instance.mLOD[i] = NULL; + } } } - instance.mTransform = mat; mUploadData.push_back(instance); } -- cgit v1.2.3 From f86a488231dc9a629d44a9f6aa6bfc9aa0eb57b4 Mon Sep 17 00:00:00 2001 From: Squire Date: Fri, 17 Jun 2011 11:05:31 -0700 Subject: CHOP-662 - initial fix to problems with regex characters in Group names causing the LLDirIterator to crash the viewer when opening chat logs --- indra/llvfs/CMakeLists.txt | 1 + indra/llvfs/lldiriterator.cpp | 21 ++++++++--- indra/llvfs/tests/lldiriterator_test.cpp | 62 ++++++++++++++++++++++++++++++++ indra/newview/lllogchat.cpp | 2 +- 4 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 indra/llvfs/tests/lldiriterator_test.cpp (limited to 'indra') diff --git a/indra/llvfs/CMakeLists.txt b/indra/llvfs/CMakeLists.txt index b6d1ce61e5..f89da4d6c5 100644 --- a/indra/llvfs/CMakeLists.txt +++ b/indra/llvfs/CMakeLists.txt @@ -80,6 +80,7 @@ if (LL_TESTS) # UNIT TESTS SET(llvfs_TEST_SOURCE_FILES # none so far + lldiriterator.cpp ) LL_ADD_PROJECT_UNIT_TESTS(llvfs "${llvfs_TEST_SOURCE_FILES}") diff --git a/indra/llvfs/lldiriterator.cpp b/indra/llvfs/lldiriterator.cpp index 041436ed92..3b132862ad 100644 --- a/indra/llvfs/lldiriterator.cpp +++ b/indra/llvfs/lldiriterator.cpp @@ -121,6 +121,14 @@ bool LLDirIterator::Impl::next(std::string &fname) return found; } +/* +converts the incoming glob into a regex. This involves +converting incoming glob expressions to regex equivilents and +at the same time, escaping any regex meaningful characters which +do not have glob meaning, i.e. + .()+|^$ +in the input +*/ std::string glob_to_regex(const std::string& glob) { std::string regex; @@ -135,9 +143,6 @@ std::string glob_to_regex(const std::string& glob) switch (c) { - case '.': - regex+="\\."; - break; case '*': if (glob.begin() == i) { @@ -170,7 +175,15 @@ std::string glob_to_regex(const std::string& glob) case '!': regex+= square_brace_open ? '^' : c; break; - default: + case '.': // This collection have different regex meaning + case '^': // And so need escaping + case '(': + case ')': + case '+': + case '|': + case '$': + regex+='\\'; + default: regex+=c; break; } diff --git a/indra/llvfs/tests/lldiriterator_test.cpp b/indra/llvfs/tests/lldiriterator_test.cpp new file mode 100644 index 0000000000..7c2cd49e41 --- /dev/null +++ b/indra/llvfs/tests/lldiriterator_test.cpp @@ -0,0 +1,62 @@ +/** + * @file lldiriterator_test.cpp + * @date 2011-06 + * @brief LLDirIterator test cases. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only., + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "lltut.h" +#include "../lldiriterator.h" + + +namespace tut +{ + + struct LLDirIteratorFixture + { + LLDirIteratorFixture() + { + } + }; + typedef test_group LLDirIteratorTest_factory; + typedef LLDirIteratorTest_factory::object LLDirIteratorTest_t; + LLDirIteratorTest_factory tf("LLDirIterator"); + + /* + CHOP-662 was originally introduced to deal with crashes deleting files from + a directory (VWR-25500). However, this introduced a crash looking for + old chat logs as the glob_to_regex function in lldiriterator wasn't escaping lots of regexp characters + */ + void test_chop_662(void) + { + LLDirIterator iter(".","+bad-group-name]+??-??.*"); + } + + template<> template<> + void LLDirIteratorTest_t::test<1>() + { + test_chop_662(); + } + +} \ No newline at end of file diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index efc4e23838..ebb5912ace 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -230,7 +230,7 @@ std::string LLLogChat::makeLogFileName(std::string filename) std::string LLLogChat::cleanFileName(std::string filename) { - std::string invalidChars = "\"\'\\/?*:.<>|"; + std::string invalidChars = "\"\'\\/?*:.<>|[]{}~"; // Cannot match glob or illegal filename chars std::string::size_type position = filename.find_first_of(invalidChars); while (position != filename.npos) { -- cgit v1.2.3 From c4d37c3cae78ee785043c022344e1c4a68239dc8 Mon Sep 17 00:00:00 2001 From: eli_linden Date: Fri, 17 Jun 2011 11:34:11 -0700 Subject: WIP INTL-46 Traditional Chinese translation update 6/17 --- .../newview/skins/default/xui/zh/floater_about.xml | 10 +- .../skins/default/xui/zh/floater_about_land.xml | 26 +-- .../default/xui/zh/floater_animation_preview.xml | 6 +- .../skins/default/xui/zh/floater_avatar_picker.xml | 8 +- .../default/xui/zh/floater_avatar_textures.xml | 8 +- .../skins/default/xui/zh/floater_buy_currency.xml | 2 +- .../skins/default/xui/zh/floater_buy_land.xml | 6 +- .../default/xui/zh/floater_day_cycle_options.xml | 2 +- .../skins/default/xui/zh/floater_gesture.xml | 8 +- .../skins/default/xui/zh/floater_god_tools.xml | 2 +- .../skins/default/xui/zh/floater_image_preview.xml | 2 +- .../skins/default/xui/zh/floater_incoming_call.xml | 6 +- .../xui/zh/floater_inventory_view_finder.xml | 4 +- .../skins/default/xui/zh/floater_media_browser.xml | 18 +- .../skins/default/xui/zh/floater_mem_leaking.xml | 2 +- .../skins/default/xui/zh/floater_nearby_chat.xml | 2 +- indra/newview/skins/default/xui/zh/floater_pay.xml | 8 +- .../skins/default/xui/zh/floater_pay_object.xml | 8 +- .../default/xui/zh/floater_preview_animation.xml | 6 +- .../default/xui/zh/floater_preview_gesture.xml | 14 +- .../skins/default/xui/zh/floater_script_debug.xml | 2 +- .../skins/default/xui/zh/floater_sell_land.xml | 2 +- .../skins/default/xui/zh/floater_snapshot.xml | 2 +- .../newview/skins/default/xui/zh/floater_stats.xml | 28 +-- .../newview/skins/default/xui/zh/floater_tools.xml | 204 ++++++++++----------- .../skins/default/xui/zh/floater_top_objects.xml | 16 +- .../skins/default/xui/zh/floater_url_entry.xml | 2 +- .../skins/default/xui/zh/floater_voice_effect.xml | 2 +- .../newview/skins/default/xui/zh/floater_water.xml | 2 +- .../skins/default/xui/zh/floater_web_content.xml | 4 +- .../skins/default/xui/zh/floater_window_size.xml | 2 +- .../skins/default/xui/zh/floater_world_map.xml | 4 +- .../newview/skins/default/xui/zh/inspect_group.xml | 6 +- .../skins/default/xui/zh/inspect_object.xml | 2 +- .../skins/default/xui/zh/menu_attachment_other.xml | 2 +- .../skins/default/xui/zh/menu_avatar_icon.xml | 2 +- .../skins/default/xui/zh/menu_avatar_other.xml | 2 +- .../skins/default/xui/zh/menu_gesture_gear.xml | 2 +- .../default/xui/zh/menu_inspect_avatar_gear.xml | 2 +- .../default/xui/zh/menu_inspect_object_gear.xml | 14 +- .../skins/default/xui/zh/menu_inventory.xml | 24 +-- .../default/xui/zh/menu_inventory_gear_default.xml | 8 +- .../newview/skins/default/xui/zh/menu_landmark.xml | 2 +- indra/newview/skins/default/xui/zh/menu_login.xml | 14 +- .../skins/default/xui/zh/menu_outfit_gear.xml | 8 +- .../skins/default/xui/zh/menu_participant_list.xml | 2 +- .../xui/zh/menu_people_groups_view_sort.xml | 2 +- .../skins/default/xui/zh/menu_people_nearby.xml | 2 +- .../xui/zh/menu_people_nearby_multiselect.xml | 2 +- .../skins/default/xui/zh/menu_picks_plus.xml | 2 +- indra/newview/skins/default/xui/zh/menu_place.xml | 2 +- .../default/xui/zh/menu_places_gear_folder.xml | 2 +- .../default/xui/zh/menu_places_gear_landmark.xml | 2 +- .../skins/default/xui/zh/menu_profile_overflow.xml | 2 +- indra/newview/skins/default/xui/zh/menu_viewer.xml | 52 +++--- indra/newview/skins/default/xui/zh/mime_types.xml | 2 +- .../newview/skins/default/xui/zh/notifications.xml | 36 ++-- .../default/xui/zh/panel_adhoc_control_panel.xml | 2 +- .../default/xui/zh/panel_avatar_list_item.xml | 2 +- .../skins/default/xui/zh/panel_edit_hair.xml | 2 +- .../skins/default/xui/zh/panel_edit_pants.xml | 2 +- .../skins/default/xui/zh/panel_edit_pick.xml | 12 +- .../skins/default/xui/zh/panel_edit_shape.xml | 22 +-- .../skins/default/xui/zh/panel_edit_shirt.xml | 2 +- .../skins/default/xui/zh/panel_edit_skirt.xml | 2 +- .../skins/default/xui/zh/panel_edit_socks.xml | 2 +- .../skins/default/xui/zh/panel_edit_tattoo.xml | 8 +- .../skins/default/xui/zh/panel_edit_wearable.xml | 8 +- .../skins/default/xui/zh/panel_group_general.xml | 6 +- .../skins/default/xui/zh/panel_group_invite.xml | 2 +- .../default/xui/zh/panel_group_land_money.xml | 6 +- .../skins/default/xui/zh/panel_group_notices.xml | 16 +- .../skins/default/xui/zh/panel_group_roles.xml | 2 +- .../default/xui/zh/panel_im_control_panel.xml | 2 +- indra/newview/skins/default/xui/zh/panel_me.xml | 2 +- .../xui/zh/panel_media_settings_general.xml | 2 +- .../xui/zh/panel_media_settings_permissions.xml | 10 +- .../skins/default/xui/zh/panel_nearby_chat_bar.xml | 4 +- .../skins/default/xui/zh/panel_nearby_media.xml | 6 +- .../skins/default/xui/zh/panel_notify_textbox.xml | 6 +- .../skins/default/xui/zh/panel_outfit_edit.xml | 6 +- .../skins/default/xui/zh/panel_pick_info.xml | 2 +- indra/newview/skins/default/xui/zh/panel_picks.xml | 14 +- .../skins/default/xui/zh/panel_place_profile.xml | 12 +- .../default/xui/zh/panel_preferences_chat.xml | 2 +- .../default/xui/zh/panel_preferences_general.xml | 34 ++-- .../default/xui/zh/panel_preferences_move.xml | 4 +- .../default/xui/zh/panel_preferences_sound.xml | 32 ++-- .../default/xui/zh/panel_prim_media_controls.xml | 2 +- .../newview/skins/default/xui/zh/panel_profile.xml | 4 +- .../skins/default/xui/zh/panel_profile_view.xml | 2 +- .../skins/default/xui/zh/panel_region_covenant.xml | 10 +- .../skins/default/xui/zh/panel_region_debug.xml | 14 +- .../skins/default/xui/zh/panel_region_estate.xml | 2 +- .../skins/default/xui/zh/panel_region_general.xml | 12 +- .../skins/default/xui/zh/panel_side_tray.xml | 2 +- .../default/xui/zh/panel_teleport_history.xml | 2 +- .../skins/default/xui/zh/sidepanel_appearance.xml | 2 +- .../skins/default/xui/zh/sidepanel_task_info.xml | 20 +- indra/newview/skins/default/xui/zh/strings.xml | 176 +++++++++--------- .../skins/default/xui/zh/teleport_strings.xml | 2 +- 101 files changed, 549 insertions(+), 549 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/zh/floater_about.xml b/indra/newview/skins/default/xui/zh/floater_about.xml index 58e8c41c38..bee940ddc1 100644 --- a/indra/newview/skins/default/xui/zh/floater_about.xml +++ b/indra/newview/skins/default/xui/zh/floater_about.xml @@ -25,11 +25,11 @@ OpenGL Version: [OPENGL_VERSION] -libcurl Version: [LIBCURL_VERSION] -J2C Decoder Version: [J2C_VERSION] -Audio Driver Version: [AUDIO_DRIVER_VERSION] -Qt Webkit Version: [QT_WEBKIT_VERSION] -Voice Server Version: [VOICE_VERSION] +libcurl 版本: [LIBCURL_VERSION] +J2C 解碼器版本: [J2C_VERSION] +音效驅動程å¼ç‰ˆæœ¬ï¼š [AUDIO_DRIVER_VERSION] +Qt Webkit 版本: [QT_WEBKIT_VERSION] +語音伺æœå™¨ç‰ˆæœ¬ï¼š [VOICE_VERSION] (無) diff --git a/indra/newview/skins/default/xui/zh/floater_about_land.xml b/indra/newview/skins/default/xui/zh/floater_about_land.xml index a9142b22ad..efd8909e67 100644 --- a/indra/newview/skins/default/xui/zh/floater_about_land.xml +++ b/indra/newview/skins/default/xui/zh/floater_about_land.xml @@ -81,7 +81,7 @@ 分級: - Adult + æˆäºº æ“有者: @@ -186,7 +186,7 @@ 分級: - Adult + æˆäºº Resale: @@ -289,7 +289,7 @@ Only large parcels can be listed in search. Moderate Content - Adult Content + æˆäººå…§å®¹ Your parcel information or content is considered moderate. @@ -307,35 +307,35 @@ Only large parcels can be listed in search. ç¦æ­¢æŽ¨æ’žï¼ˆåœ°å€è¨­å®šè¦†è“‹ï¼‰ - Allow other Residents to: + å…許其他居民去: - - + + 建造: - Object Entry: + 物件進入: - Run Scripts: + 執行腳本: - Land Options: + 土地é¸é …: - - + + - + @@ -467,7 +467,7 @@ Only large parcels can be listed in search. - Banned Residents + 被å°éŽ–çš„å±…æ°‘ @@ -385,7 +349,7 @@ left="10" name="ToolCube" tool_tip="Cube" - top="51" + top="58" width="20" /> + + Nothing selected. + - Objects: [COUNT] + left="10" + name="selection_count" + top_delta="0" + visible="false" + width="280"> - Prims: [COUNT] + text_color="LtGray_50" + type="string" + length="1" + height="16" + follows="left|top" + font="SansSerifSmall" + layout="topleft" + left="10" + name="selection_weight" + top_pad="0" + visible="false" + width="280"> + Physics weight [PHYS_WEIGHT], Display weight [DISP_WEIGHT]. - - Linked Sets: [COUNT] - - - Cost: [COST] / [PHYSICS] - - - Objects: [COUNT] - - - Cost: [COST] / [PHYSICS] - @@ -858,6 +782,15 @@ + Date: Tue, 21 Jun 2011 12:00:38 -0600 Subject: debug code for SH-692: Viewer Crash when enabling Render Metadata > Physics Shapes on Mesh Sandbox 25 on Windows XP --- indra/llrender/llvertexbuffer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 4a0b964e61..d5a7159ee3 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -240,7 +240,8 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) void LLVertexBuffer::drawArrays(U32 mode, const std::vector& pos, const std::vector& norm) { U32 count = pos.size(); - llassert(norm.size() >= pos.size()); + llassert_always(norm.size() >= pos.size()); + llassert_always(count > 0) ; unbind(); -- cgit v1.2.3 From 6977c09a88f5591c135df2f8f37eaa544402e69a Mon Sep 17 00:00:00 2001 From: eli_linden Date: Tue, 21 Jun 2011 11:58:54 -0700 Subject: FIX VWR-25071 --- .../newview/skins/default/xui/ja/floater_tools.xml | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/ja/floater_tools.xml b/indra/newview/skins/default/xui/ja/floater_tools.xml index b29f744a68..f7d77d351e 100644 --- a/indra/newview/skins/default/xui/ja/floater_tools.xml +++ b/indra/newview/skins/default/xui/ja/floater_tools.xml @@ -74,8 +74,8 @@ 両å´ã‚’延ã°ã™ - - + + @@ -137,7 +137,7 @@ 料金: [COST] / [PHYSICS] - + 譲渡 @@ -379,22 +379,22 @@ オブジェクトã®ç‰¹å¾´ã‚’編集: - - - - - - - - + + + + + + + + - + - + - + - + 実åƒã®ç¨®é¡žï¼š @@ -496,18 +496,18 @@ - - - Filename: + width="320"> + Choose model file to upload + width="230" /> - Model Preview: + left="10" + name="Cache location" + width="320"> + Second Life supports COLLADA (.dae) files @@ -225,7 +220,7 @@ top_pad="10" width="130" height="14" - left="340" + left_delta="0" text_color="White" word_wrap="true"> Dimensions (meters): @@ -238,15 +233,7 @@ text_color="White" name="dimensions" left_delta="0"> - X: Y: Z: - - - | | + X Y Z - - Note: - - -Advanced users familiar with 3d content creation tools may prefer to use the [secondlife:///app/openfloater/upload_model Advanced Mesh Import Window] . - + + WARNING: + + + You will not be able to complete the final step of uploading this model to the Second Life servers. [secondlife:///app/floater/learn_more Find out how] to set up y + @@ -291,7 +281,7 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se height="388" top_delta="0" name="optimize_panel" - visible="false" + visible="true" width="535" left="0"> - Optimize + Optimize model - This wizard has optimized your model to improve performance. You may adjust the results of the optimization process bellow or click Next to continue. + We have optimized the model for performance. Adjust it further if you wish. - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - Higher Performance - Faster rendering but less detailed; lowers Resource (prim) cost. - Higher Accuracy - More detailed model but slower; increases Resource (prim) cost. + Performance + Faster rendering +Less detail +Lower prim weight + Accuracy + Slower rendering +More detail +Higher prim weight - - ' - - - - - - Resource Cost: [COST] - - Dimensions (meters): - - - X: Y: Z: - - - | | + + ' + + ' + + + + Geometry preview - - - + + + + + High detail + + + Medium detail + + + Low detail + + + Lowest detail + + @@ -549,7 +512,7 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se font="SansSerifBig" text_color="White" layout="topleft"> - Physics + Adjust physics - The wizard will create a physical shape, which determines how the object interacts with other objects and avatars. Set the slider to the detail level most appropriate for how your object will be used: + We will create a shape for the outer hull of the model. Adjust the shape's detail level as needed for the intended purpose of your model. - Higher Performance - Faster rendering but less detailed; lowers Resource (prim) cost. - Higher Accuracy - More detailed model but slower; increases Resource (prim) cost. + Performance + Faster rendering +Less detail +Lower prim weight + Accuracy + Slower rendering +More detail +Higher prim weight - ' ' ' ' ' ' ' ' ' ' ' - Recommended for solid objects - Recommended for buildings - Recommended for vehicles - - - - - Resource Cost: [COST] - - - - - - - - Physics - - - - Preview the physics shape below then click Next to continue. To modify the physics shape, click the Back button. - - - - Model Preview: + top="25" + width="22" /> + Examples: +Moving objects +Flying objects +Vehicles + Examples: +Small static objects +Less detailed objects +Simple furniture + Examples: +Static objects +Detailed objects +Buildings + + + + Physics preview - + + + - High + High detail - Medium + Medium detail - Low + Low detail - Lowest + Lowest detail - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - - Resource Cost: [COST] - + - - Review the details below then click. Upload to upload your model. Your L$ balance will be charged when you click Upload. - - - - - Model Preview: - - - - High - - - Medium - - - Low - - - Lowest - - - - - - Dimensions (meters): - - - X: Y: Z: - - - | | - - - - + name="content" + bg_opaque_color="DkGray2" + background_visible="true" + background_opaque="true"> + Impact to parcel/region: [EQUIV] prim equivalents + + Your account will be charged an upload fee of L$ [FEE]. + + By clicking the upload button, you confirm that you have the appropriate rights to the material contained in the model. + - Resource Cost: [COST] - This is the cost to your Region's prim/object limit, at default scale - Physics Cost: [COST] - This is the cost to your Region's prim/object limit, at default scale - Upload Fee: - This is the amount the upload will cost. - - I confirm that I have the appropriate rights to the material contained in this model. [secondlife:///app/floater/learn_more Learn more] @@ -954,44 +721,76 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se height="10" font="SansSerifBig" layout="topleft"> - Upload Complete! + Upload complete - Congratulations! Your model has been sucessfully uploaded. You will find the model in the Objects folder in your inventory. + left="25"> + Your model has been uploaded. + + + You will find it in the Objects folder in your inventory. + + Your account has been charged L$ [FEE]. - -- cgit v1.2.3 From 71b6d9d842e03a4a1eece88ec20a50b041b6137f Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 23 Jun 2011 17:50:52 -0700 Subject: fixing non-dnd portion of EXT-895 --- indra/newview/llpanelmaininventory.cpp | 4 +++- indra/newview/llpanelmarketplaceinbox.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 728642e4c7..f23ae8c8ff 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -1,4 +1,4 @@ -/** +n/** * @file llsidepanelmaininventory.cpp * @brief Implementation of llsidepanelmaininventory. * @@ -592,6 +592,8 @@ void LLPanelMainInventory::onFocusReceived() { outbox_panel->clearSelection(); } + + sidepanel_inventory->updateVerbs(); } void LLPanelMainInventory::setFilterTextFromFilter() diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 1f3fbb40b4..2b04987084 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -69,7 +69,7 @@ BOOL LLPanelMarketplaceInbox::postBuild() mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this)); // Set up the note to display when the inbox is empty - mInventoryPanel->getFilter()->setEmptyLookupMessage("InboxNoItems"); + //mInventoryPanel->getFilter()->setEmptyLookupMessage("InboxNoItems"); return TRUE; } @@ -108,6 +108,8 @@ void LLPanelMarketplaceInbox::onFocusReceived() outbox_panel->clearSelection(); } } + + sidepanel_inventory->updateVerbs(); } BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) -- cgit v1.2.3 From 253642ccff9b08da5e62449ff62b23e986dcb77d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 23 Jun 2011 23:06:36 -0500 Subject: SH-1903 Don't use indexed texture rendering when GL version is < 3.1 (fixes bad performance on cards with old drivers) --- indra/llrender/llglslshader.cpp | 10 ++++++++++ indra/llrender/llshadermgr.cpp | 7 ++++++- indra/newview/llvovolume.cpp | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 8e99f62de6..ad2c662dfc 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -109,6 +109,11 @@ BOOL LLGLSLShader::createShader(vector * attributes, // Create program mProgramObject = glCreateProgramObjectARB(); + if (gGLManager.mGLVersion < 3.1f) + { //force indexed texture channels to 1 if GL version is old (performance improvement for drivers with poor branching shader model support) + mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1); + } + //compile new source vector< pair >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) @@ -131,6 +136,11 @@ BOOL LLGLSLShader::createShader(vector * attributes, return FALSE; } + if (gGLManager.mGLVersion < 3.1f) + { //attachShaderFeatures may have set the number of indexed texture channels, so set to 1 again + mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1); + } + // Map attributes and uniforms if (success) { diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index bdc103b917..3910cd779c 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -524,7 +524,12 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade text[count++] = strdup("{\n"); - if (gGLManager.mGLVersion >= 3.f) + if (texture_index_channels == 1) + { //don't use flow control, that's silly + text[count++] = strdup("return texture2D(tex0, texcoord);\n"); + text[count++] = strdup("}\n"); + } + else if (gGLManager.mGLVersion >= 3.f) { text[count++] = strdup("\tswitch (int(vary_texture_index+0.25))\n"); text[count++] = strdup("\t{\n"); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c5e2c56e4b..e6da8eb89d 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4495,6 +4495,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: S32 texture_index_channels = gGLManager.mNumTextureImageUnits-1; //always reserve one for shiny for now just for simplicity + if (gGLManager.mGLVersion < 3.1f) + { + texture_index_channels = 1; + } + if (LLPipeline::sRenderDeferred && distance_sort) { texture_index_channels = gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels; -- cgit v1.2.3 From 019eae669eee8b3f877730b30c4f23b723fb907a Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 24 Jun 2011 10:32:58 -0400 Subject: Removing mysterious "n" at the start of the file to fix the build. --- indra/newview/llpanelmaininventory.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index f23ae8c8ff..f39fbfc498 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -1,6 +1,6 @@ -n/** - * @file llsidepanelmaininventory.cpp - * @brief Implementation of llsidepanelmaininventory. +/** + * @file llpanelmaininventory.cpp + * @brief Implementation of llpanelmaininventory. * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -592,7 +592,7 @@ void LLPanelMainInventory::onFocusReceived() { outbox_panel->clearSelection(); } - + sidepanel_inventory->updateVerbs(); } -- cgit v1.2.3 From 2619f3db1f781489b9efab0c5ed26c526b013158 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 24 Jun 2011 10:46:38 -0400 Subject: CHOP-753: add timestamp and marker to memory stats log lines --- indra/llcommon/llsys.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 4190c91fd8..015a24cf23 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -36,6 +36,7 @@ #endif #include "llprocessor.h" +#include "llerrorcontrol.h" #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN @@ -778,18 +779,24 @@ void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_v void LLMemoryInfo::stream(std::ostream& s) const { + // We want these memory stats to be easy to grep from the log, along with + // the timestamp. So preface each line with the timestamp and a + // distinctive marker. Without that, we'd have to search the log for the + // introducer line, then read subsequent lines, etc... + std::string pfx(LLError::utcTime() + " "); + #if LL_WINDOWS MEMORYSTATUSEX state; state.dwLength = sizeof(state); GlobalMemoryStatusEx(&state); - s << "Percent Memory use: " << (U32)state.dwMemoryLoad << '%' << std::endl; - s << "Total Physical KB: " << (U32)(state.ullTotalPhys/1024) << std::endl; - s << "Avail Physical KB: " << (U32)(state.ullAvailPhys/1024) << std::endl; - s << "Total page KB: " << (U32)(state.ullTotalPageFile/1024) << std::endl; - s << "Avail page KB: " << (U32)(state.ullAvailPageFile/1024) << std::endl; - s << "Total Virtual KB: " << (U32)(state.ullTotalVirtual/1024) << std::endl; - s << "Avail Virtual KB: " << (U32)(state.ullAvailVirtual/1024) << std::endl; + s << pfx << "Percent Memory use: " << (U32)state.dwMemoryLoad << '%' << std::endl; + s << pfx << "Total Physical KB: " << (U32)(state.ullTotalPhys/1024) << std::endl; + s << pfx << "Avail Physical KB: " << (U32)(state.ullAvailPhys/1024) << std::endl; + s << pfx << "Total page KB: " << (U32)(state.ullTotalPageFile/1024) << std::endl; + s << pfx << "Avail page KB: " << (U32)(state.ullAvailPageFile/1024) << std::endl; + s << pfx << "Total Virtual KB: " << (U32)(state.ullTotalVirtual/1024) << std::endl; + s << pfx << "Avail Virtual KB: " << (U32)(state.ullAvailVirtual/1024) << std::endl; #elif LL_DARWIN uint64_t phys = 0; @@ -798,7 +805,7 @@ void LLMemoryInfo::stream(std::ostream& s) const if(sysctlbyname("hw.memsize", &phys, &len, NULL, 0) == 0) { - s << "Total Physical KB: " << phys/1024 << std::endl; + s << pfx << "Total Physical KB: " << phys/1024 << std::endl; } else { @@ -816,7 +823,7 @@ void LLMemoryInfo::stream(std::ostream& s) const char line[100]; while (fgets(line, sizeof(line), pout)) { - s << line; + s << pfx << line; } fclose(pout); } @@ -826,7 +833,7 @@ void LLMemoryInfo::stream(std::ostream& s) const phys = (U64)(sysconf(_SC_PHYS_PAGES)) * (U64)(sysconf(_SC_PAGESIZE)/1024); - s << "Total Physical KB: " << phys << std::endl; + s << pfx << "Total Physical KB: " << phys << std::endl; #elif LL_LINUX LLFILE* meminfo = LLFile::fopen(MEMINFO_FILE,"rb"); @@ -837,7 +844,7 @@ void LLMemoryInfo::stream(std::ostream& s) const while(fgets(line, sizeof(line), meminfo)) { line[strlen(line)-1] = ' '; /*Flawfinder: ignore*/ - s << line; + s << pfx << line; } fclose(meminfo); } -- cgit v1.2.3 From 44308a50c2389b3d021d5f6bfa125b06f1b643d1 Mon Sep 17 00:00:00 2001 From: eli_linden Date: Fri, 24 Jun 2011 11:09:26 -0700 Subject: sync with viewer-development --- indra/newview/skins/default/xui/en/panel_cof_wearables.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml index bbeb592e96..9e70706603 100644 --- a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml +++ b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml @@ -52,7 +52,7 @@ multi_select="true" name="list_attachments" top="0" - width="311"> + width="311"/> Date: Fri, 24 Jun 2011 15:21:50 -0400 Subject: Bug fixes for SH-1791 --- indra/newview/llviewerobject.cpp | 47 ++++++++++++++++++++------------- indra/newview/llviewerparceloverlay.cpp | 27 +++++++++++++++++++ indra/newview/llviewerparceloverlay.h | 1 + indra/newview/llviewerregion.cpp | 3 +-- 4 files changed, 58 insertions(+), 20 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index a3a6ef1888..c3a7d345f5 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -104,7 +104,6 @@ #include "llaccountingquota.h" //#define DEBUG_UPDATE_TYPE -#define EXTENDED_ENCROACHMENT_CHECK //temp: BOOL LLViewerObject::sVelocityInterpolate = TRUE; BOOL LLViewerObject::sPingInterpolate = TRUE; @@ -528,6 +527,7 @@ bool LLViewerObject::isReturnable() { return false; } + std::vector boxes; boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned()); for (child_list_t::iterator iter = mChildList.begin(); @@ -538,13 +538,11 @@ bool LLViewerObject::isReturnable() } bool result = (mRegionp && mRegionp->objectIsReturnable(getPositionRegion(), boxes)) ? 1 : 0; - -#ifdef EXTENDED_ENCROACHMENT_CHECK if ( !result ) { - std::vector uniqueRegions; //Get list of neighboring regions relative to this vo's region + std::vector uniqueRegions; mRegionp->getNeighboringRegions( uniqueRegions ); //Build aabb's - for root and all children @@ -552,9 +550,14 @@ bool LLViewerObject::isReturnable() typedef std::vector::iterator RegionIt; RegionIt regionStart = uniqueRegions.begin(); RegionIt regionEnd = uniqueRegions.end(); + for (; regionStart != regionEnd; ++regionStart ) { LLViewerRegion* pTargetRegion = *regionStart; + //Add the root vo as there may be no children and we still want + //to test for any edge overlap + buildReturnablesForChildrenVO( returnables, this, pTargetRegion ); + //Add it's children for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) { LLViewerObject* pChild = *iter; @@ -562,7 +565,7 @@ bool LLViewerObject::isReturnable() } } - //TBD# Should probably create a region -> box list map + //TBD#Eventually create a region -> box list map typedef std::vector::iterator ReturnablesIt; ReturnablesIt retCurrentIt = returnables.begin(); ReturnablesIt retEndIt = returnables.end(); @@ -572,10 +575,7 @@ bool LLViewerObject::isReturnable() boxes.clear(); LLViewerRegion* pRegion = (*retCurrentIt).pRegion; boxes.push_back( (*retCurrentIt).box ); - //LLVector3 boxPos = (*retCurrentIt).box.getPositionAgent(); - //TBD# Should we just use pRegion->objectIsReturnable, instead? - //As it does various other checks, childrenObjectReturnable does not. - bool retResult = (mRegionp && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; + bool retResult = (pRegion && pRegion->childrenObjectReturnable( boxes )) ? 1 : 0; if ( retResult ) { result = true; @@ -583,7 +583,6 @@ bool LLViewerObject::isReturnable() } } } -#endif return result; } @@ -606,16 +605,28 @@ void LLViewerObject::buildReturnablesForChildrenVO( std::vector& returnables, LLViewerObject* pChild, LLViewerRegion* pTargetRegion ) { - PotentialReturnableObject returnableObj; - - LLViewerRegion* pRegion = pChild->getRegion(); - LLVector3d posGlobal = pRegion->getPosGlobalFromRegion( pChild->getPositionRegion() ); - LLVector3 targetRegionPos = pTargetRegion->getPosRegionFromGlobal( posGlobal ); - returnableObj.box = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f, + LLVector3 targetRegionPos; + targetRegionPos.setVec( pChild->getPositionGlobal() ); + + LLBBox childBBox = LLBBox( targetRegionPos, pChild->getRotationRegion(), pChild->getScale() * -0.5f, pChild->getScale() * 0.5f).getAxisAligned(); - returnableObj.pRegion = pTargetRegion; - returnables.push_back( returnableObj ); + + LLVector3 edgeA = targetRegionPos + childBBox.getMinLocal(); + LLVector3 edgeB = targetRegionPos + childBBox.getMaxLocal(); + + LLVector3d edgeAd, edgeBd; + edgeAd.setVec(edgeA); + edgeBd.setVec(edgeB); + + //Only add the box when either of the extents are in a neighboring region + if ( pTargetRegion->pointInRegionGlobal( edgeAd ) || pTargetRegion->pointInRegionGlobal( edgeBd ) ) + { + PotentialReturnableObject returnableObj; + returnableObj.box = childBBox; + returnableObj.pRegion = pTargetRegion; + returnables.push_back( returnableObj ); + } } BOOL LLViewerObject::setParent(LLViewerObject* parent) diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index 26765bdd01..eff16b6a6e 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -173,6 +173,33 @@ bool LLViewerParcelOverlay::encroachesOwned(const std::vector& boxes) co } return false; } +bool LLViewerParcelOverlay::encroachesOnUnowned(const std::vector& boxes) const +{ + // boxes are expected to already be axis aligned + for (U32 i = 0; i < boxes.size(); ++i) + { + LLVector3 min = boxes[i].getMinAgent(); + LLVector3 max = boxes[i].getMaxAgent(); + + S32 left = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); + S32 right = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); + S32 top = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); + S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1)); + + for (S32 row = top; row <= bottom; row++) + { + for (S32 column = left; column <= right; column++) + { + U8 type = ownership(row, column); + if ((PARCEL_SELF != type)) + { + return true; + } + } + } + } + return false; +} BOOL LLViewerParcelOverlay::isSoundLocal(const LLVector3& pos) const { diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index c80baedda6..3c6794e7d0 100644 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -60,6 +60,7 @@ public: // might be in another parcel. for now, we simply test axis aligned // bounding boxes which isn't perfect, but is close bool encroachesOwned(const std::vector& boxes) const; + bool encroachesOnUnowned(const std::vector& boxes) const; BOOL isSoundLocal(const LLVector3& pos) const; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0df97d6050..85b4b60bf7 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1702,8 +1702,7 @@ bool LLViewerRegion::objectIsReturnable(const LLVector3& pos, const std::vector< bool LLViewerRegion::childrenObjectReturnable( const std::vector& boxes ) const { bool result = false; - //TBD# Do we need similar checks to objectIsReturnable? if so just use objectisreturnable - result = ( mParcelOverlay && mParcelOverlay->encroachesOwned( boxes ) ) ? 1 : 0; + result = ( mParcelOverlay && mParcelOverlay->encroachesOnUnowned( boxes ) ) ? 1 : 0; return result; } -- cgit v1.2.3 From ad4b559f9fb7c39a090898207c46d4c77d3560bf Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 24 Jun 2011 15:30:48 -0500 Subject: SH-1903 Fix for silly shader compiler error. --- indra/llrender/llshadermgr.cpp | 29 +++++++++++++++++++++-------- indra/newview/llviewershadermgr.cpp | 5 +++++ 2 files changed, 26 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 3910cd779c..b4e7aaa9b4 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -542,6 +542,8 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade } text[count++] = strdup("\t}\n"); + text[count++] = strdup("\treturn vec4(0,0,0,0);\n"); + text[count++] = strdup("}\n"); } else { @@ -562,10 +564,10 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade std::string if_str = llformat("if (ti == %d) return texture2D(tex%d, texcoord);\n", i, i); text[count++] = strdup(if_str.c_str()); } - } - text[count++] = strdup("\treturn vec4(0,0,0,0);\n"); - text[count++] = strdup("}\n"); + text[count++] = strdup("\treturn vec4(0,0,0,0);\n"); + text[count++] = strdup("}\n"); + } } //copy file into memory @@ -610,11 +612,6 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade } } - //free memory - for (GLuint i = 0; i < count; i++) - { - free(text[i]); - } if (error == GL_NO_ERROR) { //check for errors @@ -628,6 +625,16 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade //an error occured, print log LL_WARNS("ShaderLoading") << "GLSL Compilation Error: (" << error << ") in " << filename << LL_ENDL; dumpObjectLog(ret); + + std::stringstream ostr; + //dump shader source for debugging + for (GLuint i = 0; i < count; i++) + { + ostr << i << ": " << text[i]; + } + + LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl; + ret = 0; } } @@ -638,6 +645,12 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade } stop_glerror(); + //free memory + for (GLuint i = 0; i < count; i++) + { + free(text[i]); + } + //successfully loaded, save results if (ret) { diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 0e3a0ef507..592923ee07 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -722,6 +722,11 @@ BOOL LLViewerShaderMgr::loadBasicShaders() shaders.reserve(13); S32 ch = gGLManager.mNumTextureImageUnits-1; + if (gGLManager.mGLVersion < 3.1f) + { //force to 1 texture index channel for old drivers + ch = 1; + } + std::vector index_channels; index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/gammaF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT]) ); -- cgit v1.2.3 From f83b08b69c84d6df9cebb79167804cd295555481 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 24 Jun 2011 15:09:10 -0600 Subject: fix for SH-1878: Viewer hang in GLOD_Group::adaptTriangleBudget during LLModelPreview::genLODs; SH-1891: viewer crashes while previewing "RYOMA 3D XML File.dae"; SH-1890: Crash loading palm tree --- indra/llmath/llvolume.cpp | 58 ++++++++++++++++++++++----------- indra/llprimitive/llmodel.cpp | 10 +++--- indra/newview/llfloatermodelpreview.cpp | 11 +------ 3 files changed, 45 insertions(+), 34 deletions(-) (limited to 'indra') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index d401ce7de7..bddb8d8c66 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2774,11 +2774,13 @@ void LLVolume::makeTetrahedron() n[2] = cv[2].getNormal(); n += 3; - tc[0] = cv[0].mTexCoord; - tc[1] = cv[1].mTexCoord; - tc[2] = cv[2].mTexCoord; - tc += 3; - + if(tc) + { + tc[0] = cv[0].mTexCoord; + tc[1] = cv[1].mTexCoord; + tc[2] = cv[2].mTexCoord; + tc += 3; + } //side 2 cv[0].setPosition(p[3]); @@ -2797,11 +2799,14 @@ void LLVolume::makeTetrahedron() n[2] = cv[2].getNormal(); n += 3; - tc[0] = cv[0].mTexCoord; - tc[1] = cv[1].mTexCoord; - tc[2] = cv[2].mTexCoord; - tc += 3; - + if(tc) + { + tc[0] = cv[0].mTexCoord; + tc[1] = cv[1].mTexCoord; + tc[2] = cv[2].mTexCoord; + tc += 3; + } + //side 3 cv[0].setPosition(p[3]); cv[1].setPosition(p[1]); @@ -2819,10 +2824,13 @@ void LLVolume::makeTetrahedron() n[2] = cv[2].getNormal(); n += 3; - tc[0] = cv[0].mTexCoord; - tc[1] = cv[1].mTexCoord; - tc[2] = cv[2].mTexCoord; - tc += 3; + if(tc) + { + tc[0] = cv[0].mTexCoord; + tc[1] = cv[1].mTexCoord; + tc[2] = cv[2].mTexCoord; + tc += 3; + } //side 4 cv[0].setPosition(p[2]); @@ -2841,10 +2849,13 @@ void LLVolume::makeTetrahedron() n[2] = cv[2].getNormal(); n += 3; - tc[0] = cv[0].mTexCoord; - tc[1] = cv[1].mTexCoord; - tc[2] = cv[2].mTexCoord; - tc += 3; + if(tc) + { + tc[0] = cv[0].mTexCoord; + tc[1] = cv[1].mTexCoord; + tc[2] = cv[2].mTexCoord; + tc += 3; + } //set index buffer for (U16 i = 0; i < 12; i++) @@ -5613,7 +5624,16 @@ LLVolumeFace& LLVolumeFace::operator=(const LLVolumeFace& src) LLVector4a::memcpyNonAliased16((F32*) mPositions, (F32*) src.mPositions, vert_size); LLVector4a::memcpyNonAliased16((F32*) mNormals, (F32*) src.mNormals, vert_size); - LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) src.mTexCoords, tc_size); + + if(src.mTexCoords) + { + LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) src.mTexCoords, tc_size); + } + else + { + ll_aligned_free_16(mTexCoords) ; + mTexCoords = NULL ; + } if (src.mBinormals) diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index f2fe20b3e7..972f256076 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -260,7 +260,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector& fa if (!tc_source) { - ll_aligned_free_16(face.mTexCoords); + ll_aligned_free_16(new_face.mTexCoords); new_face.mTexCoords = NULL; } @@ -291,7 +291,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector& fa if (!tc_source) { - ll_aligned_free_16(face.mTexCoords); + ll_aligned_free_16(new_face.mTexCoords); new_face.mTexCoords = NULL; } } @@ -479,7 +479,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector& fac if (!tc_source) { - ll_aligned_free_16(face.mTexCoords); + ll_aligned_free_16(new_face.mTexCoords); new_face.mTexCoords = NULL; } @@ -513,7 +513,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector& fac if (!tc_source) { - ll_aligned_free_16(face.mTexCoords); + ll_aligned_free_16(new_face.mTexCoords); new_face.mTexCoords = NULL; } } @@ -713,7 +713,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac if (!t) { - ll_aligned_free_16(face.mTexCoords); + ll_aligned_free_16(new_face.mTexCoords); new_face.mTexCoords = NULL; } } diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 77713b6ebb..0006e3423b 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4500,16 +4500,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights) bool skinned = include_skin_weights && !mdl->mSkinWeights.empty(); - U32 mask = LLVertexBuffer::MAP_VERTEX; - - if (vf.mNormals) - { - mask |= LLVertexBuffer::MAP_NORMAL; - } - if (vf.mTexCoords) - { - mask |= LLVertexBuffer::MAP_TEXCOORD0; - } + U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0 ; if (skinned) { -- cgit v1.2.3 From d46d74dbea0cbf4a680cd4611ff99c356fcbc030 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 24 Jun 2011 17:42:34 -0600 Subject: fix for SH-1904: Medallion .dae makes viewer crash during upload --- indra/newview/llmeshrepository.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 2b340fc54d..97c64f7761 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1575,6 +1575,11 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) for (S32 face_num = 0; face_num < data.mBaseModel->getNumVolumeFaces(); face_num++) { + if(face_num >= instance.mMaterial.size()) + { + break ; + } + LLImportMaterial& material = instance.mMaterial[face_num]; LLSD face_entry = LLSD::emptyMap(); LLViewerFetchedTexture *texture = material.mDiffuseMap.get(); -- cgit v1.2.3 From d66545d17ff1aa30a3840928fa38a919ddec0a53 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 25 Jun 2011 11:08:36 -0400 Subject: STORM-1326 [ALL LANGS] (Spanish) [HARDCODED] Selling land, advice with "Anyone" in English. --- indra/newview/llfloaterauction.cpp | 3 ++- indra/newview/llfloatersellland.cpp | 3 ++- indra/newview/skins/default/xui/en/strings.xml | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index c95b046707..c6743ca13b 100644 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -55,6 +55,7 @@ #include "llrender.h" #include "llsdutil.h" #include "llsdutil_math.h" +#include "lltrans.h" ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs @@ -457,7 +458,7 @@ void LLFloaterAuction::onClickSellToAnyone(void* data) LLSD args; args["LAND_SIZE"] = llformat("%d", area); args["SALE_PRICE"] = llformat("%d", sale_price); - args["NAME"] = "Anyone"; + args["NAME"] = LLTrans::getString("Anyone"); LLNotification::Params params("ConfirmLandSaleChange"); // Re-use existing dialog params.substitutions(args) diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index 8558a1277c..3434841d09 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -41,6 +41,7 @@ #include "llviewerparcelmgr.h" #include "lluictrlfactory.h" #include "llviewerwindow.h" +#include "lltrans.h" class LLAvatarName; @@ -451,7 +452,7 @@ void LLFloaterSellLandUI::doSellLand(void *userdata) // Do a confirmation S32 sale_price = self->getChild("price")->getValue(); S32 area = parcel->getArea(); - std::string authorizedBuyerName = "Anyone"; + std::string authorizedBuyerName = LLTrans::getString("Anyone"); bool sell_to_anyone = true; if ("user" == self->getChild("sell_to")->getValue().asString()) { diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 71f48c833d..143a989d32 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2250,6 +2250,9 @@ Returns a string with the requested data about the region mainland teen + + anyone + error -- cgit v1.2.3 From 9a40b84beded2bb0d0d2adb062b1611bdeb756ed Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 25 Jun 2011 16:37:10 -0400 Subject: STORM-1302 (all langs) [TRANSLATED BUT IN ENG] (Spanish) Side Menu > Gente tab > MIS AMIGOS tab > buttons "Call", "Share" and "Teleport" and their tooltips --- indra/newview/skins/default/xui/da/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/de/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/en/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/es/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/fr/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/it/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/ja/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/pl/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/pt/panel_people.xml | 8 ++++---- indra/newview/skins/default/xui/zh/panel_people.xml | 8 ++++---- 10 files changed, 40 insertions(+), 40 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/da/panel_people.xml b/indra/newview/skins/default/xui/da/panel_people.xml index 925492b2d7..66a128cd13 100644 --- a/indra/newview/skins/default/xui/da/panel_people.xml +++ b/indra/newview/skins/default/xui/da/panel_people.xml @@ -66,16 +66,16 @@ Leder du efter nogen at være sammen med? Prøv [secondlife:///app/worldmap Verd - - þ: [COUNT] - - Physics weight [PHYS_WEIGHT], Display weight [DISP_WEIGHT]. + Physics weight [PHYS_WEIGHT], Render Cost [DISP_WEIGHT]. -- cgit v1.2.3 From 26be53aede499182252bb797e798611169ea0553 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 28 Jun 2011 16:01:16 -0400 Subject: CHOP-753: Introduce a sliding window of framerate samples. The trouble with remembering the slowest-ever framerate is that framerate drops dramatically on login, then typically bounces back to something reasonable during the session. So the session-normal framerate has to drop pretty dramatically before it falls below the original login framerate. To address this, only remember the last ~10 minutes of framerates, and log memory stats every time a new framerate is slower than the previous 10 minutes. --- indra/llcommon/llsys.cpp | 70 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 156c78b1e8..ccd6f261b7 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -44,6 +44,7 @@ #include "llevents.h" #include "lltimer.h" #include +#include #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN @@ -81,6 +82,11 @@ LLCPUInfo gSysCPU; // Don't log memory info any more often than this. It also serves as our // framerate sample size. static const F32 MEM_INFO_THROTTLE = 20; +// Sliding window of samples. We intentionally limit the length of time we +// remember "the slowest" framerate because framerate is very slow at login. +// If we only triggered FrameWatcher logging when the session framerate +// dropped below the login framerate, we'd have very little additional data. +static const F32 MEM_INFO_WINDOW = 10*60; #if LL_WINDOWS #ifndef DLLVERSIONINFO @@ -903,10 +909,13 @@ public: // as the completion of a sample window. mSampleEnd(0), mFrames(0), + // Both MEM_INFO_WINDOW and MEM_INFO_THROTTLE are in seconds. We need + // the number of integer MEM_INFO_THROTTLE sample slots that will fit + // in MEM_INFO_WINDOW. Round up. + mSamples(int((MEM_INFO_WINDOW / MEM_INFO_THROTTLE) + 0.7)), // Initializing to F32_MAX means that the first real frame will become // the slowest ever, which sounds like a good idea. - mSlowest(F32_MAX), - mDesc("startup") + mSlowest(F32_MAX) {} bool tick(const LLSD&) @@ -947,20 +956,54 @@ public: F32 elapsed(timestamp - sampleStart); F32 framerate(frames/elapsed); + // Remember previous slowest framerate because we're just about to + // update it. + F32 slowest(mSlowest); + // Remember previous number of samples. + boost::circular_buffer::size_type prevSize(mSamples.size()); + + // Capture new framerate in our samples buffer. Once the buffer is + // full (after MEM_INFO_WINDOW seconds), this will displace the oldest + // sample. ("So they all rolled over, and one fell out...") + mSamples.push_back(framerate); + + // Calculate the new minimum framerate. I know of no way to update a + // rolling minimum without ever rescanning the buffer. But since there + // are only a few tens of items in this buffer, rescanning it is + // probably cheaper (and certainly easier to reason about) than + // attempting to optimize away some of the scans. + mSlowest = framerate; // pick an arbitrary entry to start + for (boost::circular_buffer::const_iterator si(mSamples.begin()), send(mSamples.end()); + si != send; ++si) + { + if (*si < mSlowest) + { + mSlowest = *si; + } + } + // We're especially interested in memory as framerate drops. Only log - // when framerate is lower than ever before. (Should always be true - // for the end of the very first sample window.) - if (framerate >= mSlowest) + // when framerate drops below the slowest framerate we remember. + // (Should always be true for the end of the very first sample + // window.) + if (framerate >= slowest) { return false; } // Congratulations, we've hit a new low. :-P - mSlowest = framerate; - LL_INFOS("FrameWatcher") << mDesc << " framerate " - << std::fixed << std::setprecision(1) << framerate << '\n' - << LLMemoryInfo() << LL_ENDL; - mDesc = "new lowest"; + LL_INFOS("FrameWatcher") << ' '; + if (! prevSize) + { + LL_CONT << "initial framerate "; + } + else + { + LL_CONT << "slowest framerate for last " << int(prevSize * MEM_INFO_THROTTLE) + << " seconds "; + } + LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n' + << LLMemoryInfo() << LL_ENDL; return false; } @@ -979,12 +1022,13 @@ private: F32 mSampleStart, mSampleEnd; // Frames this sample window U32 mFrames; - // Slowest framerate EVAR + // Sliding window of framerate samples + boost::circular_buffer mSamples; + // Slowest framerate in mSamples F32 mSlowest; - // Description of next notable framerate - std::string mDesc; }; +// Need an instance of FrameWatcher before it does any good static FrameWatcher sFrameWatcher; BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile) -- cgit v1.2.3 From c998f21c5201a4c117ad601fbd23c116fd9faa04 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 28 Jun 2011 14:45:09 -0700 Subject: EXP-922 FIX Purchased Direct Delivery items do not appear in Recent Inventory tab switched to using filters to hide inbox and show it for recent items only --- indra/newview/llfolderviewitem.cpp | 8 ++++---- indra/newview/llinventoryfilter.cpp | 7 ++++--- indra/newview/llinventorypanel.cpp | 10 ++++++++++ indra/newview/llviewerfoldertype.cpp | 19 ++----------------- indra/newview/llviewerfoldertype.h | 1 - 5 files changed, 20 insertions(+), 25 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index f5e1aa005b..d3b204200a 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -1203,10 +1203,10 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) } else { - bool is_hidden = folderp->getListener() && LLViewerFolderType::lookupIsHiddenType(folderp->getListener()->getPreferredType()); - - folderp->setVisible( !is_hidden - && (folderp->getFiltered(filter_generation) || folderp->hasFilteredDescendants(filter_generation))); // passed filter or has descendants that passed filter + folderp->setVisible( folderp->getListener() + && ((folderp->getFilteredFolder(filter_generation) + && folderp->getFiltered(filter_generation)) + || folderp->hasFilteredDescendants(filter_generation))); // passed filter or has descendants that passed filter } if (folderp->getVisible()) diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 49e0ab33e5..d6278a5fda 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -125,7 +125,8 @@ bool LLInventoryFilter::checkFolder(const LLFolderViewFolder* folder) const LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id); if (!cat) return false; - if ((1LL << cat->getPreferredType() & mFilterOps.mFilterCategoryTypes) == U64(0)) + LLFolderType::EType cat_type = cat->getPreferredType(); + if (cat_type != LLFolderType::FT_NONE && (1LL << cat_type & mFilterOps.mFilterCategoryTypes) == U64(0)) return false; } @@ -298,8 +299,8 @@ void LLInventoryFilter::updateFilterTypes(U64 types, U64& current_types) if (current_types != types) { // keep current items only if no type bits getting turned off - BOOL fewer_bits_set = (current_types & ~types); - BOOL more_bits_set = (~current_types & types); + bool fewer_bits_set = (current_types & ~types) != 0; + bool more_bits_set = (~current_types & types) != 0; current_types = types; if (more_bits_set && fewer_bits_set) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 0af6451108..834da49c61 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -245,6 +245,9 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) } mFolderRoot->setSortOrder(getFilter()->getSortOrder()); + // hide inbox + getFilter()->setFilterCategoryTypes(getFilter()->getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_INBOX)); + // Initialize base class params. LLPanel::initFromParams(params); } @@ -1090,6 +1093,13 @@ public: struct Params : public LLInitParam::Block {}; + void initFromParams(const Params& p) + { + LLInventoryPanel::initFromParams(p); + // turn on inbox for recent items + getFilter()->setFilterCategoryTypes(getFilter()->getFilterCategoryTypes() | (1ULL << LLFolderType::FT_INBOX)); + } + protected: LLInventoryRecentItemsPanel (const Params&); friend class LLUICtrlFactory; diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index fbd25bc8b4..9101222393 100644 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -40,7 +40,6 @@ struct ViewerFolderEntry : public LLDictionaryEntry const std::string &icon_name_open, // name of the folder icon const std::string &icon_name_closed, BOOL is_quiet, // folder doesn't need a UI update when changed - bool is_hidden = false, const std::string &dictionary_name = empty_string // no reverse lookup needed on non-ensembles, so in most cases just leave this blank ) : @@ -48,8 +47,7 @@ struct ViewerFolderEntry : public LLDictionaryEntry mNewCategoryName(new_category_name), mIconNameOpen(icon_name_open), mIconNameClosed(icon_name_closed), - mIsQuiet(is_quiet), - mIsHidden(is_hidden) + mIsQuiet(is_quiet) { mAllowedNames.clear(); } @@ -68,8 +66,7 @@ struct ViewerFolderEntry : public LLDictionaryEntry */ mIconNameOpen("Inv_FolderOpen"), mIconNameClosed("Inv_FolderClosed"), mNewCategoryName(new_category_name), - mIsQuiet(FALSE), - mIsHidden(false) + mIsQuiet(FALSE) { const std::string delims (","); LLStringUtilBase::getTokens(allowed_names, mAllowedNames, delims); @@ -94,7 +91,6 @@ struct ViewerFolderEntry : public LLDictionaryEntry typedef std::vector name_vec_t; name_vec_t mAllowedNames; BOOL mIsQuiet; - bool mIsHidden; }; class LLViewerFolderDictionary : public LLSingleton, @@ -264,17 +260,6 @@ BOOL LLViewerFolderType::lookupIsQuietType(LLFolderType::EType folder_type) } -BOOL LLViewerFolderType::lookupIsHiddenType(LLFolderType::EType folder_type) -{ - const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type); - if (entry) - { - return entry->mIsHidden; - } - return FALSE; -} - - const std::string &LLViewerFolderType::lookupNewCategoryName(LLFolderType::EType folder_type) { const ViewerFolderEntry *entry = LLViewerFolderDictionary::getInstance()->lookup(folder_type); diff --git a/indra/newview/llviewerfoldertype.h b/indra/newview/llviewerfoldertype.h index a348274e8f..f5938de619 100644 --- a/indra/newview/llviewerfoldertype.h +++ b/indra/newview/llviewerfoldertype.h @@ -40,7 +40,6 @@ public: static const std::string& lookupIconName(EType folder_type, BOOL is_open = FALSE); // folder icon name static BOOL lookupIsQuietType(EType folder_type); // folder doesn't require UI update when changes have occured - static BOOL lookupIsHiddenType(EType folder_type); // folder doesn't require UI update when changes have occured static const std::string& lookupNewCategoryName(EType folder_type); // default name when creating new category static LLFolderType::EType lookupTypeFromNewCategoryName(const std::string& name); // default name when creating new category -- cgit v1.2.3 From a57a393bb9447778c5ea2baf969053cab8d06b68 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Tue, 28 Jun 2011 17:39:34 -0700 Subject: Crashfix for SEC-906 --- indra/llcharacter/llkeyframemotion.cpp | 73 ++++++++++++++++++++++++++++++---- indra/llcharacter/llkeyframemotion.h | 2 +- 2 files changed, 66 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index 9df033a4ca..c6f45bffa2 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -467,13 +467,15 @@ LLPointer& LLKeyframeMotion::getJointState(U32 index) } //----------------------------------------------------------------------------- -// getJoin() +// getJoint() //----------------------------------------------------------------------------- LLJoint* LLKeyframeMotion::getJoint(U32 index) { llassert_always (index < mJointStates.size()); LLJoint* joint = mJointStates[index]->getJoint(); - llassert_always (joint); + + //Commented out 06-28-11 by Aura. + //llassert_always (joint); return joint; } @@ -821,7 +823,11 @@ void LLKeyframeMotion::initializeConstraint(JointConstraint* constraint) S32 joint_num; LLVector3 source_pos = mCharacter->getVolumePos(shared_data->mSourceConstraintVolume, shared_data->mSourceConstraintOffset); LLJoint* cur_joint = getJoint(shared_data->mJointStateIndices[0]); - + if ( !cur_joint ) + { + return; + } + F32 source_pos_offset = dist_vec(source_pos, cur_joint->getWorldPosition()); constraint->mTotalLength = constraint->mJointLengths[0] = dist_vec(cur_joint->getParent()->getWorldPosition(), source_pos); @@ -872,6 +878,10 @@ void LLKeyframeMotion::activateConstraint(JointConstraint* constraint) for (joint_num = 1; joint_num < shared_data->mChainLength; joint_num++) { LLJoint* cur_joint = getJoint(shared_data->mJointStateIndices[joint_num]); + if ( !cur_joint ) + { + return; + } constraint->mPositions[joint_num] = (cur_joint->getWorldPosition() - mPelvisp->getWorldPosition()) * ~mPelvisp->getWorldRotation(); } @@ -932,6 +942,11 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 } LLJoint* root_joint = getJoint(shared_data->mJointStateIndices[shared_data->mChainLength]); + if (! root_joint) + { + return; + } + LLVector3 root_pos = root_joint->getWorldPosition(); // LLQuaternion root_rot = root_joint->getParent()->getWorldRotation(); @@ -943,6 +958,11 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 for (joint_num = 0; joint_num <= shared_data->mChainLength; joint_num++) { LLJoint* cur_joint = getJoint(shared_data->mJointStateIndices[joint_num]); + if (!cur_joint) + { + return; + } + if (joint_mask[cur_joint->getJointNum()] >= (0xff >> (7 - getPriority()))) { // skip constraint @@ -1033,7 +1053,14 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 if (shared_data->mChainLength) { - LLQuaternion end_rot = getJoint(shared_data->mJointStateIndices[0])->getWorldRotation(); + LLJoint* end_joint = getJoint(shared_data->mJointStateIndices[0]); + + if (!end_joint) + { + return; + } + + LLQuaternion end_rot = end_joint->getWorldRotation(); // slam start and end of chain to the proper positions (rest of chain stays put) positions[0] = lerp(keyframe_source_pos, target_pos, weight); @@ -1042,7 +1069,14 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 // grab keyframe-specified positions of joints for (joint_num = 1; joint_num < shared_data->mChainLength; joint_num++) { - LLVector3 kinematic_position = getJoint(shared_data->mJointStateIndices[joint_num])->getWorldPosition() + + LLJoint* cur_joint = getJoint(shared_data->mJointStateIndices[joint_num]); + + if (!cur_joint) + { + return; + } + + LLVector3 kinematic_position = cur_joint->getWorldPosition() + (source_to_target * constraint->mJointLengthFractions[joint_num]); // convert intermediate joint positions to world coordinates @@ -1088,7 +1122,17 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 for (joint_num = shared_data->mChainLength; joint_num > 0; joint_num--) { LLJoint* cur_joint = getJoint(shared_data->mJointStateIndices[joint_num]); + + if (!cur_joint) + { + return; + } LLJoint* child_joint = getJoint(shared_data->mJointStateIndices[joint_num - 1]); + if (!child_joint) + { + return; + } + LLQuaternion parent_rot = cur_joint->getParent()->getWorldRotation(); LLQuaternion cur_rot = cur_joint->getWorldRotation(); @@ -1122,7 +1166,6 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 cur_joint->setRotation(target_rot); } - LLJoint* end_joint = getJoint(shared_data->mJointStateIndices[0]); LLQuaternion end_local_rot = end_rot * ~end_joint->getParent()->getWorldRotation(); if (weight == 1.f) @@ -1150,7 +1193,13 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 //reset old joint rots for (joint_num = 0; joint_num <= shared_data->mChainLength; joint_num++) { - getJoint(shared_data->mJointStateIndices[joint_num])->setRotation(old_rots[joint_num]); + LLJoint* cur_joint = getJoint(shared_data->mJointStateIndices[joint_num]); + if (!cur_joint) + { + return; + } + + cur_joint->setRotation(old_rots[joint_num]); } } // simple positional constraint (pelvis only) @@ -1775,7 +1824,15 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) constraintp->mJointStateIndices[i] = -1; for (U32 j = 0; j < mJointMotionList->getNumJointMotions(); j++) { - if(getJoint(j) == joint) + LLJoint* constraint_joint = getJoint(j); + + if ( !constraint_joint ) + { + llwarns << "Invalid joint " << j << llendl; + return FALSE; + } + + if(constraint_joint == joint) { constraintp->mJointStateIndices[i] = (S32)j; break; diff --git a/indra/llcharacter/llkeyframemotion.h b/indra/llcharacter/llkeyframemotion.h index 1fe9af40b3..b1422b2b90 100644 --- a/indra/llcharacter/llkeyframemotion.h +++ b/indra/llcharacter/llkeyframemotion.h @@ -70,7 +70,7 @@ public: private: // private helper functions to wrap some asserts LLPointer& getJointState(U32 index); - LLJoint* getJoint(U32 index); + LLJoint* getJoint(U32 index ); public: //------------------------------------------------------------------------- -- cgit v1.2.3 From 1262f710b548100e4522866341febba3d7cf535d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 28 Jun 2011 23:09:00 -0400 Subject: CHOP-753: Report Linux memory stats 1/line, like other platforms. Previous code deliberately flowed the different lines from MEMINFO_FILE together on a single line, which seems pointless to me, since we want to be able to grep the viewer log to recognize individual stats. Also replace classic-C LLFILE* machinery used to read MEMINFO_FILE with std::ifstream and std::getline(). --- indra/llcommon/llsys.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index ccd6f261b7..f0f98f5bf6 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -853,17 +853,14 @@ void LLMemoryInfo::stream(std::ostream& s) const s << pfx << "Total Physical KB: " << phys << std::endl; #elif LL_LINUX - LLFILE* meminfo = LLFile::fopen(MEMINFO_FILE,"rb"); - if(meminfo) + std::ifstream meminfo(MEMINFO_FILE); + if (meminfo.is_open()) { - char line[MAX_STRING]; /* Flawfinder: ignore */ - memset(line, 0, sizeof(line)); - while(fgets(line, sizeof(line), meminfo)) + std::string line; + while (std::getline(meminfo, line)) { - line[strlen(line)-1] = ' '; /*Flawfinder: ignore*/ - s << pfx << line; + s << pfx << line << '\n'; } - fclose(meminfo); } else { -- cgit v1.2.3 From fc6f0f31be53d6adbc8e364ffdd4119943312578 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Wed, 29 Jun 2011 17:22:18 +0300 Subject: SH-1726 FIXED (Viewer modifications to advanced model upload to accommodate upload fee & prim equivalency) - Changed XUI according to the spec - Added requesting upload permission, physics weight and fee weight - Split requesting fee and uploading model steps in mesh repository --- indra/newview/CMakeLists.txt | 4 + indra/newview/llfloatermodelpreview.cpp | 118 ++++++++++++--- indra/newview/llfloatermodelpreview.h | 22 ++- indra/newview/llfloatermodeluploadbase.cpp | 56 +++++++ indra/newview/llfloatermodeluploadbase.h | 57 ++++++++ indra/newview/llfloatermodelwizard.cpp | 20 ++- indra/newview/llfloatermodelwizard.h | 13 +- indra/newview/llmeshrepository.cpp | 161 +++++++++++++-------- indra/newview/llmeshrepository.h | 15 +- indra/newview/lluploadfloaterobservers.cpp | 56 +++++++ indra/newview/lluploadfloaterobservers.h | 79 ++++++++++ .../skins/default/xui/en/floater_model_preview.xml | 75 +++++----- .../newview/skins/default/xui/en/notifications.xml | 14 ++ 13 files changed, 570 insertions(+), 120 deletions(-) create mode 100644 indra/newview/llfloatermodeluploadbase.cpp create mode 100644 indra/newview/llfloatermodeluploadbase.h create mode 100644 indra/newview/lluploadfloaterobservers.cpp create mode 100644 indra/newview/lluploadfloaterobservers.h (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 523ea8a394..c4018cd79c 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -204,6 +204,7 @@ set(viewer_SOURCE_FILES llfloatermediasettings.cpp llfloatermemleak.cpp llfloatermodelpreview.cpp + llfloatermodeluploadbase.cpp llfloatermodelwizard.cpp llfloaternamedesc.cpp llfloaternotificationsconsole.cpp @@ -496,6 +497,7 @@ set(viewer_SOURCE_FILES lltranslate.cpp lluilistener.cpp lluploaddialog.cpp + lluploadfloaterobservers.cpp llurl.cpp llurldispatcher.cpp llurldispatcherlistener.cpp @@ -758,6 +760,7 @@ set(viewer_HEADER_FILES llfloatermediasettings.h llfloatermemleak.h llfloatermodelpreview.h + llfloatermodeluploadbase.h llfloatermodelwizard.h llfloaternamedesc.h llfloaternotificationsconsole.h @@ -1047,6 +1050,7 @@ set(viewer_HEADER_FILES lluiconstants.h lluilistener.h lluploaddialog.h + lluploadfloaterobservers.h llurl.h llurldispatcher.h llurldispatcherlistener.h diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index d000248e8e..ea85dc0052 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -71,6 +71,7 @@ #include "llmatrix4a.h" #include "llmenubutton.h" #include "llmeshrepository.h" +#include "llnotificationsutil.h" #include "llsdutil_math.h" #include "lltextbox.h" #include "lltoolmgr.h" @@ -353,7 +354,9 @@ void LLMeshFilePicker::notify(const std::string& filename) // LLFloaterModelPreview() //----------------------------------------------------------------------------- LLFloaterModelPreview::LLFloaterModelPreview(const LLSD& key) : -LLFloater(key) +LLFloaterModelUploadBase(key), +mUploadBtn(NULL), +mCalculateBtn(NULL) { sInstance = this; mLastMouseX = 0; @@ -422,8 +425,6 @@ BOOL LLFloaterModelPreview::postBuild() childDisable("ok_btn"); - childSetCommitCallback("confirm_checkbox", refresh, this); - mViewOptionMenuButton = getChild("options_gear_btn"); mCommitCallbackRegistrar.add("ModelImport.ViewOption.Action", boost::bind(&LLFloaterModelPreview::onViewOptionChecked, this, _2)); @@ -473,6 +474,13 @@ BOOL LLFloaterModelPreview::postBuild() } } + mUploadBtn = getChild("ok_btn"); + mCalculateBtn = getChild("calculate_btn"); + + mCalculateBtn->setClickedCallback(boost::bind(&LLFloaterModelPreview::onClickCalculateBtn, this)); + + toggleCalculateButton(true); + return TRUE; } @@ -551,6 +559,26 @@ void LLFloaterModelPreview::loadModel(S32 lod, const std::string& file_name) mModelPreview->loadModel(file_name, lod); } +void LLFloaterModelPreview::onClickCalculateBtn() +{ + childSetTextArg("weights", "[EQ]", llformat("%d", mModelPreview->mResourceCost)); + + mModelPreview->rebuildUploadData(); + + bool upload_skinweights = childGetValue("upload_skin").asBoolean(); + bool upload_joint_positions = childGetValue("upload_joints").asBoolean(); + + mUploadModelUrl.clear(); + LLMeshUploadThread* thread = new LLMeshUploadThread(mModelPreview->mUploadData, mModelPreview->mPreviewScale, + childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions, mUploadModelUrl, false); + + thread->setObserverHandle(getWholeModelFeeObserverHandle()); + + gMeshRepo.mUploadWaitList.push_back(thread); + + toggleCalculateButton(false); +} + //static void LLFloaterModelPreview::onImportScaleCommit(LLUICtrl*,void* userdata) { @@ -561,7 +589,8 @@ void LLFloaterModelPreview::onImportScaleCommit(LLUICtrl*,void* userdata) return; } - fp->mModelPreview->calcResourceCost(); + fp->toggleCalculateButton(true); + fp->mModelPreview->refresh(); } //static @@ -573,7 +602,9 @@ void LLFloaterModelPreview::onPelvisOffsetCommit( LLUICtrl*, void* userdata ) { return; } - fp->mModelPreview->calcResourceCost(); + + fp->toggleCalculateButton(true); + fp->mModelPreview->refresh(); } @@ -623,7 +654,8 @@ void LLFloaterModelPreview::onUploadSkinCommit(LLUICtrl*,void* userdata) return; } - fp->mModelPreview->calcResourceCost(); + fp->toggleCalculateButton(true); + fp->mModelPreview->refresh(); fp->mModelPreview->resetPreviewTarget(); fp->mModelPreview->clearBuffers(); @@ -653,6 +685,7 @@ void LLFloaterModelPreview::onGenerateNormalsCommit(LLUICtrl* ctrl, void* userda { LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata; + fp->toggleCalculateButton(true); fp->mModelPreview->generateNormals(); } @@ -676,6 +709,8 @@ void LLFloaterModelPreview::onAutoFillCommit(LLUICtrl* ctrl, void* userdata) void LLFloaterModelPreview::onLODParamCommit(LLUICtrl* ctrl, void* userdata) { LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata; + + fp->toggleCalculateButton(true); fp->mModelPreview->onLODParamCommit(false); } @@ -683,6 +718,7 @@ void LLFloaterModelPreview::onLODParamCommit(LLUICtrl* ctrl, void* userdata) void LLFloaterModelPreview::onLODParamCommitTriangleLimit(LLUICtrl* ctrl, void* userdata) { LLFloaterModelPreview* fp = (LLFloaterModelPreview*) userdata; + fp->toggleCalculateButton(true); fp->mModelPreview->onLODParamCommit(true); } @@ -714,6 +750,8 @@ void LLFloaterModelPreview::draw() } } + childSetEnabled("ok_btn", mHasUploadPerm); + childSetTextArg("prim_cost", "[PRIM_COST]", llformat("%d", mModelPreview->mResourceCost)); childSetTextArg("description_label", "[TEXTURES]", llformat("%d", mModelPreview->mTextureSet.size())); @@ -871,6 +909,12 @@ BOOL LLFloaterModelPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) return TRUE; } +/*virtual*/ +void LLFloaterModelPreview::onOpen(const LLSD& key) +{ + requestAgentUploadPermissions(); +} + //static void LLFloaterModelPreview::onPhysicsParamCommit(LLUICtrl* ctrl, void* data) { @@ -2926,8 +2970,7 @@ U32 LLModelPreview::calcResourceCost() if (mFMP && mModelLoader) { - const BOOL confirmed_checkbox = mFMP->getChild("confirm_checkbox")->getValue().asBoolean(); - if ( getLoadState() < LLModelLoader::ERROR_PARSING && confirmed_checkbox ) + if ( getLoadState() < LLModelLoader::ERROR_PARSING) { mFMP->childEnable("ok_btn"); } @@ -3038,8 +3081,6 @@ void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, childSetTextArg("import_dimensions", "[X]", llformat("%.3f", x)); childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", y)); childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", z)); - childSetTextArg("streaming cost", "[COST]", llformat("%.3f", streaming_cost)); - childSetTextArg("physics cost", "[COST]", llformat("%.3f", physics_cost)); } @@ -3069,8 +3110,7 @@ void LLModelPreview::rebuildUploadData() F32 max_scale = 0.f; - const BOOL confirmed_checkbox = mFMP->getChild("confirm_checkbox")->getValue().asBoolean(); - if ( mBaseScene.size() > 0 && confirmed_checkbox ) + if ( mBaseScene.size() > 0) { mFMP->childEnable("ok_btn"); } @@ -3476,8 +3516,7 @@ void LLModelPreview::loadModelCallback(S32 lod) } mLoading = false; - if (mFMP) - mFMP->getChild("confirm_checkbox")->set(FALSE); + refresh(); mModelLoadedSignal(); @@ -4185,8 +4224,7 @@ void LLModelPreview::updateStatusMessages() } } - const BOOL confirmed_checkbox = mFMP->getChild("confirm_checkbox")->getValue().asBoolean(); - if ( upload_ok && !errorStateFromLoader && skinAndRigOk && !has_degenerate && confirmed_checkbox) + if ( upload_ok && !errorStateFromLoader && skinAndRigOk && !has_degenerate) { mFMP->childEnable("ok_btn"); } @@ -5314,7 +5352,7 @@ void LLFloaterModelPreview::onUpload(void* user_data) mp->mModelPreview->saveUploadData(upload_skinweights, upload_joint_positions); gMeshRepo.uploadModel(mp->mModelPreview->mUploadData, mp->mModelPreview->mPreviewScale, - mp->childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions); + mp->childGetValue("upload_textures").asBoolean(), upload_skinweights, upload_joint_positions, mp->mUploadModelUrl); mp->closeFloater(false); } @@ -5330,6 +5368,7 @@ void LLFloaterModelPreview::onClearMaterials(void* user_data) //static void LLFloaterModelPreview::refresh(LLUICtrl* ctrl, void* user_data) { + sInstance->toggleCalculateButton(true); sInstance->mModelPreview->mDirty = true; } @@ -5382,6 +5421,34 @@ void LLFloaterModelPreview::setStatusMessage(const std::string& msg) mStatusMessage = msg; } +void LLFloaterModelPreview::toggleCalculateButton(bool visible) +{ + mCalculateBtn->setVisible(visible); + mUploadBtn->setVisible(!visible); + mUploadBtn->setEnabled(mHasUploadPerm); + + if (visible) + { + std::string tbd = getString("tbd"); + childSetTextArg("weights", "[EQ]", tbd); + childSetTextArg("weights", "[PH]", tbd); + childSetTextArg("weights", "[FEE]", tbd); + } +} + +void LLFloaterModelPreview::onModelPhysicsFeeReceived(F64 physics, S32 fee, std::string upload_url) +{ + mUploadModelUrl = upload_url; + childSetTextArg("weights", "[PH]", llformat("%.3f", physics)); + childSetTextArg("weights", "[FEE]", llformat("%d", fee)); + childSetVisible("weights", true); +} + +void LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason) +{ + llwarns << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << llendl; +} + S32 LLFloaterModelPreview::DecompRequest::statusCallback(const char* status, S32 p1, S32 p2) { if (mContinue) @@ -5421,3 +5488,20 @@ void LLFloaterModelPreview::DecompRequest::completed() llassert(sInstance->mCurRequest.find(this) == sInstance->mCurRequest.end()); } } + +void LLFloaterModelPreview::onPermReceived(const LLSD& result) +{ + std::string upload_status = result["mesh_upload_status"].asString(); + mHasUploadPerm = "valid" == upload_status; + + mUploadBtn->setEnabled(mHasUploadPerm); + getChild("warning_title")->setVisible(mHasUploadPerm); + getChild("warning_message")->setVisible(mHasUploadPerm); +} + +void LLFloaterModelPreview::setPermErrorStatus(U32 status, const std::string& reason) +{ + llwarns << "LLFloaterModelPreview::setPermErrors(" << status << " : " << reason << ")" << llendl; + + LLNotificationsUtil::add("MeshUploadPermError"); +} diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index ab50890fb9..62878812c3 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -140,7 +140,7 @@ private: static bool isAlive(LLModelLoader* loader) ; }; -class LLFloaterModelPreview : public LLFloater +class LLFloaterModelPreview : public LLFloaterModelUploadBase { public: @@ -167,6 +167,8 @@ public: BOOL handleHover(S32 x, S32 y, MASK mask); BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + /*virtual*/ void onOpen(const LLSD& key); + static void onMouseCaptureLostModelPreview(LLMouseHandler*); static void setUploadAmount(S32 amount) { sUploadAmount = amount; } @@ -194,6 +196,16 @@ public: void enableViewOption(const std::string& option); void disableViewOption(const std::string& option); + // shows warning message if agent has no permissions to upload model + /*virtual*/ void onPermReceived(const LLSD& result); + + // called when error occurs during permissions request + /*virtual*/ void setPermErrorStatus(U32 status, const std::string& reason); + + /*virtual*/ void onModelPhysicsFeeReceived(F64 physics, S32 fee, std::string upload_url); + + /*virtual*/ void setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason); + protected: friend class LLModelPreview; friend class LLMeshFilePicker; @@ -259,6 +271,14 @@ protected: LLToggleableMenu* mViewOptionMenu; LLMutex* mStatusLock; +private: + void onClickCalculateBtn(); + + // Toggles between "Calculate weights & fee" and "Upload" buttons. + void toggleCalculateButton(bool visible); + + LLButton* mUploadBtn; + LLButton* mCalculateBtn; }; class LLMeshFilePicker : public LLFilePickerThread diff --git a/indra/newview/llfloatermodeluploadbase.cpp b/indra/newview/llfloatermodeluploadbase.cpp new file mode 100644 index 0000000000..56c6447792 --- /dev/null +++ b/indra/newview/llfloatermodeluploadbase.cpp @@ -0,0 +1,56 @@ +/** + * @file llfloatermodeluploadbase.cpp + * @brief LLFloaterUploadModelBase class definition + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloatermodeluploadbase.h" +#include "llagent.h" +#include "llviewerregion.h" +#include "llnotificationsutil.h" + +LLFloaterModelUploadBase::LLFloaterModelUploadBase(const LLSD& key) +:LLFloater(key), + mHasUploadPerm(false) +{ +} + +void LLFloaterModelUploadBase::requestAgentUploadPermissions() +{ + std::string capability = "MeshUploadFlag"; + std::string url = gAgent.getRegion()->getCapability(capability); + + if (!url.empty()) + { + llinfos<< typeid(*this).name() <<"::requestAgentUploadPermissions() requesting for upload model permissions from: "<< url <rebuildUploadData(); gMeshRepo.uploadModel(mModelPreview->mUploadData, mModelPreview->mPreviewScale, - true, false, false); + true, false, false, mUploadModelUrl, true); setState(UPLOAD); diff --git a/indra/newview/llfloatermodelwizard.h b/indra/newview/llfloatermodelwizard.h index 409451e1b6..9930e0c4e6 100644 --- a/indra/newview/llfloatermodelwizard.h +++ b/indra/newview/llfloatermodelwizard.h @@ -30,12 +30,13 @@ #include "llmeshrepository.h" #include "llmodel.h" #include "llthread.h" +#include "llfloatermodeluploadbase.h" class LLModelPreview; -class LLFloaterModelWizard : public LLFloater +class LLFloaterModelWizard : public LLFloaterModelUploadBase { public: @@ -62,12 +63,20 @@ public: BOOL handleMouseDown(S32 x, S32 y, MASK mask); BOOL handleMouseUp(S32 x, S32 y, MASK mask); BOOL handleHover(S32 x, S32 y, MASK mask); - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); + + /*virtual*/ void onOpen(const LLSD& key); void setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost); void modelLoadedCallback(); void initDecompControls(); + // shows warning message if agent has no permissions to upload model + void onPermReceived(const LLSD& result); + + // called when error occurs during permissions request + void setPermErrorStatus(U32 status, const std::string& reason); + const LLRect& getPreviewRect() const { return mPreviewRect; } LLPhysicsDecomp::decomp_params mDecompParams; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 4da5da9493..49bcbf860a 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -62,6 +62,7 @@ #include "llinventorymodel.h" #include "llfoldertype.h" #include "llviewerparcelmgr.h" +#include "lluploadfloaterobservers.h" #include "boost/lexical_cast.hpp" @@ -554,10 +555,12 @@ class LLWholeModelFeeResponder: public LLCurl::Responder { LLMeshUploadThread* mThread; LLSD mModelData; + LLHandle mObserverHandle; public: - LLWholeModelFeeResponder(LLMeshUploadThread* thread, LLSD& model_data): + LLWholeModelFeeResponder(LLMeshUploadThread* thread, LLSD& model_data, LLHandle observer_handle): mThread(thread), - mModelData(model_data) + mModelData(model_data), + mObserverHandle(observer_handle) { } virtual void completed(U32 status, @@ -573,11 +576,21 @@ public: llinfos << "completed" << llendl; mThread->mPendingUploads--; dump_llsd_to_file(cc,make_dump_name("whole_model_fee_response_",dump_num)); + if (isGoodStatus(status) && cc["state"].asString() == "upload") { llinfos << "fee request succeeded" << llendl; - mThread->mWholeModelUploadURL = cc["uploader"].asString(); + mThread->mWholeModelUploadURL = cc["uploader"].asString(); + + LLWholeModelFeeObserver* observer = mObserverHandle.get(); + if (observer) + { + S32 fee = cc["upload_price"].asInteger(); + F64 phys = cc["data"]["physics_cost"].asReal(); + + observer->onModelPhysicsFeeReceived(phys, fee, mThread->mWholeModelUploadURL); + } } else { @@ -1376,9 +1389,11 @@ bool LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32 } LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, LLVector3& scale, bool upload_textures, - bool upload_skin, bool upload_joints) + bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload) : LLThread("mesh upload"), - mDiscarded(FALSE) + mDiscarded(FALSE), + mDoUpload(do_upload), + mWholeModelUploadURL(upload_url) { mInstanceList = data; mUploadTextures = upload_textures; @@ -1456,7 +1471,14 @@ BOOL LLMeshUploadThread::isDiscarded() void LLMeshUploadThread::run() { - doWholeModelUpload(); + if (mDoUpload) + { + doWholeModelUpload(); + } + else + { + requestWholeModelFee(); + } } void dump_llsd_to_file(const LLSD& content, std::string filename) @@ -1650,69 +1672,54 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) dest = result; } -void LLMeshUploadThread::doWholeModelUpload() +void LLMeshUploadThread::queueUpModels() { - dump_num++; - - mCurlRequest = new LLCurlRequest(); - - // Queue up models for hull generation (viewer-side) for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter) - { - LLMeshUploadData data; - data.mBaseModel = iter->first; - - LLModelInstance& instance = *(iter->second.begin()); - - for (S32 i = 0; i < 5; i++) { - data.mModel[i] = instance.mLOD[i]; - } + LLMeshUploadData data; + data.mBaseModel = iter->first; - //queue up models for hull generation - LLModel* physics = NULL; + LLModelInstance& instance = *(iter->second.begin()); - if (data.mModel[LLModel::LOD_PHYSICS].notNull()) - { - physics = data.mModel[LLModel::LOD_PHYSICS]; - } - else if (data.mModel[LLModel::LOD_MEDIUM].notNull()) - { - physics = data.mModel[LLModel::LOD_MEDIUM]; - } - else - { - physics = data.mModel[LLModel::LOD_HIGH]; - } + for (S32 i = 0; i < 5; i++) + { + data.mModel[i] = instance.mLOD[i]; + } - llassert(physics != NULL); - - DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this); - if(request->isValid()) - { - gMeshRepo.mDecompThread->submitRequest(request); - } - } + //queue up models for hull generation + LLModel* physics = NULL; - while (!mPhysicsComplete) - { - apr_sleep(100); - } + if (data.mModel[LLModel::LOD_PHYSICS].notNull()) + { + physics = data.mModel[LLModel::LOD_PHYSICS]; + } + else if (data.mModel[LLModel::LOD_MEDIUM].notNull()) + { + physics = data.mModel[LLModel::LOD_MEDIUM]; + } + else + { + physics = data.mModel[LLModel::LOD_HIGH]; + } - LLSD model_data; - wholeModelToLLSD(model_data,false); - dump_llsd_to_file(model_data,make_dump_name("whole_model_fee_request_",dump_num)); + llassert(physics != NULL); - mPendingUploads++; - LLCurlRequest::headers_t headers; - mCurlRequest->post(mWholeModelFeeCapability, headers, model_data, - new LLWholeModelFeeResponder(this,model_data), mMeshUploadTimeOut); + DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this); + if(request->isValid()) + { + gMeshRepo.mDecompThread->submitRequest(request); + } + } - do - { - mCurlRequest->process(); - } while (mCurlRequest->getQueued() > 0); + while (!mPhysicsComplete) + { + apr_sleep(100); + } +} +void LLMeshUploadThread::doWholeModelUpload() +{ + mCurlRequest = new LLCurlRequest(); if (mWholeModelUploadURL.empty()) { @@ -1720,12 +1727,15 @@ void LLMeshUploadThread::doWholeModelUpload() } else { + queueUpModels(); + LLSD full_model_data; wholeModelToLLSD(full_model_data, true); LLSD body = full_model_data["asset_resources"]; dump_llsd_to_file(body,make_dump_name("whole_model_body_",dump_num)); + LLCurlRequest::headers_t headers; mCurlRequest->post(mWholeModelUploadURL, headers, body, - new LLWholeModelUploadResponder(this, model_data), mMeshUploadTimeOut); + new LLWholeModelUploadResponder(this, full_model_data), mMeshUploadTimeOut); do { mCurlRequest->process(); @@ -1739,6 +1749,35 @@ void LLMeshUploadThread::doWholeModelUpload() mFinished = true; } +void LLMeshUploadThread::requestWholeModelFee() +{ + dump_num++; + + mCurlRequest = new LLCurlRequest(); + + queueUpModels(); + + LLSD model_data; + wholeModelToLLSD(model_data,false); + dump_llsd_to_file(model_data,make_dump_name("whole_model_fee_request_",dump_num)); + + mPendingUploads++; + LLCurlRequest::headers_t headers; + mCurlRequest->post(mWholeModelFeeCapability, headers, model_data, + new LLWholeModelFeeResponder(this,model_data, mObserverHandle), mMeshUploadTimeOut); + + do + { + mCurlRequest->process(); + } while (mCurlRequest->getQueued() > 0); + + delete mCurlRequest; + mCurlRequest = NULL; + + // Currently a no-op. + mFinished = true; +} + void LLMeshUploadThread::uploadModel(LLMeshUploadData& data) { //called from arbitrary thread { @@ -2836,9 +2875,9 @@ LLSD& LLMeshRepoThread::getMeshHeader(const LLUUID& mesh_id) void LLMeshRepository::uploadModel(std::vector& data, LLVector3& scale, bool upload_textures, - bool upload_skin, bool upload_joints) + bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload) { - LLMeshUploadThread* thread = new LLMeshUploadThread(data, scale, upload_textures, upload_skin, upload_joints); + LLMeshUploadThread* thread = new LLMeshUploadThread(data, scale, upload_textures, upload_skin, upload_joints, upload_url, do_upload); mUploadWaitList.push_back(thread); } diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index f56734a7de..03993c6f2c 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -36,6 +36,7 @@ #define LLCONVEXDECOMPINTER_STATIC 1 #include "llconvexdecomposition.h" +#include "lluploadfloaterobservers.h" class LLVOVolume; class LLMeshResponder; @@ -412,7 +413,7 @@ public: std::map mTextureMap; LLMeshUploadThread(instance_list& data, LLVector3& scale, bool upload_textures, - bool upload_skin, bool upload_joints); + bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload = true); ~LLMeshUploadThread(); void uploadTexture(LLTextureUploadData& data); @@ -433,7 +434,11 @@ public: void discard() ; BOOL isDiscarded(); + // Queue up models for hull generation (viewer-side) + void queueUpModels(); + void doWholeModelUpload(); + void requestWholeModelFee(); void wholeModelToLLSD(LLSD& dest, bool include_textures); @@ -441,6 +446,12 @@ public: LLVector3& result_pos, LLQuaternion& result_rot, LLVector3& result_scale); + + void setObserverHandle(LLHandle observer_handle) { mObserverHandle = observer_handle; } + +private: + LLHandle mObserverHandle; + bool mDoUpload; // if FALSE only model data will be requested, otherwise the model will be uploaded }; class LLMeshRepository @@ -491,7 +502,7 @@ public: LLSD& getMeshHeader(const LLUUID& mesh_id); void uploadModel(std::vector& data, LLVector3& scale, bool upload_textures, - bool upload_skin, bool upload_joints); + bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload = true); S32 getMeshSize(const LLUUID& mesh_id, S32 lod); diff --git a/indra/newview/lluploadfloaterobservers.cpp b/indra/newview/lluploadfloaterobservers.cpp new file mode 100644 index 0000000000..2d418ee00d --- /dev/null +++ b/indra/newview/lluploadfloaterobservers.cpp @@ -0,0 +1,56 @@ +/** + * @file lluploadfloaterobservers.cpp + * @brief LLUploadModelPremissionsResponder definition + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "lluploadfloaterobservers.h" + +LLUploadModelPremissionsResponder::LLUploadModelPremissionsResponder(const LLHandle& observer) +:mObserverHandle(observer) +{ +} + +void LLUploadModelPremissionsResponder::error(U32 status, const std::string& reason) +{ + llwarns << "LLUploadModelPremissionsResponder::error("<< status << ": " << reason << ")" << llendl; + + LLUploadPermissionsObserver* observer = mObserverHandle.get(); + + if (observer) + { + observer->setPermErrorStatus(status, reason); + } +} + +void LLUploadModelPremissionsResponder::result(const LLSD& content) +{ + LLUploadPermissionsObserver* observer = mObserverHandle.get(); + + if (observer) + { + observer->onPermReceived(content); + } +} diff --git a/indra/newview/lluploadfloaterobservers.h b/indra/newview/lluploadfloaterobservers.h new file mode 100644 index 0000000000..f27687e12e --- /dev/null +++ b/indra/newview/lluploadfloaterobservers.h @@ -0,0 +1,79 @@ +/** + * @file lluploadfloaterobservers.h + * @brief LLUploadModelPremissionsResponder declaration + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LLUPLOADFLOATEROBSERVERS_H_ +#define LLUPLOADFLOATEROBSERVERS_H_ + +#include "llfloater.h" +#include "llhttpclient.h" +#include "llhandle.h" + +class LLUploadPermissionsObserver +{ +public: + + LLUploadPermissionsObserver(){mUploadPermObserverHandle.bind(this);} + virtual ~LLUploadPermissionsObserver() {} + + virtual void onPermReceived(const LLSD& result) = 0; + virtual void setPermErrorStatus(U32 status, const std::string& reason) = 0; + + LLHandle getPermObserverHandle() const {return mUploadPermObserverHandle;} + +protected: + LLRootHandle mUploadPermObserverHandle; +}; + +class LLWholeModelFeeObserver +{ +public: + LLWholeModelFeeObserver() { mWholeModelFeeObserverHandle.bind(this); } + virtual ~LLWholeModelFeeObserver() {} + + virtual void onModelPhysicsFeeReceived(F64 physics, S32 fee, std::string upload_url) = 0; + virtual void setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason) = 0; + + LLHandle getWholeModelFeeObserverHandle() const { return mWholeModelFeeObserverHandle; } + +protected: + LLRootHandle mWholeModelFeeObserverHandle; +}; + +class LLUploadModelPremissionsResponder : public LLHTTPClient::Responder +{ +public: + + LLUploadModelPremissionsResponder(const LLHandle& observer); + + void error(U32 status, const std::string& reason); + + void result(const LLSD& content); + +private: + LLHandle mObserverHandle; +}; + +#endif /* LLUPLOADFLOATEROBSERVERS_H_ */ diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index f58595b3c5..ab46a13098 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -23,6 +23,7 @@ All Analyzing... Simplifying... + TBD @@ -70,43 +71,29 @@ width="290" height="290" follows="all"/> - - Upload Details - - - Resource Cost: [COST] - - - Physics Cost: [COST] + + + WARNING: - - Upload Fee: N/A + + You will not be able to complete the final upload of this model to the Second Life servers. Find out how to get certifed for mesh model uploads. - - - - - I confirm that I have the appropriate rights to the material contained in this model. [secondlife:///app/floater/learn_more Learn more] - [STATUS] - - - -- cgit v1.2.3 From 90ceac118cc8f437587d33ba95b10aae84a5ecac Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 11 Jul 2011 14:17:57 -0600 Subject: more fix for STORM-1468: [crashhunters] pre-login crash at LLViewerWindow::LLViewerWindow(std::basic_string,std::allocator > const &,std::basic_string,std::allocator > const &,int,int,int,int,int,int) [secondlife-bin llviewerwindow.cpp] --- indra/newview/res/viewerRes.rc | 6 +++--- indra/newview/skins/default/xui/en/strings.xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc index fefeaa9d11..a53dece422 100644 --- a/indra/newview/res/viewerRes.rc +++ b/indra/newview/res/viewerRes.rc @@ -62,12 +62,12 @@ IDI_LCD_LL_ICON ICON "icon1.ico" // Dialog // -SPLASHSCREEN DIALOG 32, 32, 194, 34 +SPLASHSCREEN DIALOG 32, 32, 264, 34 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE FONT 8, "MS Sans Serif" BEGIN ICON IDI_LL_ICON,IDC_STATIC,7,7,20,20 - LTEXT "Loading Second Life...",666,36,13,141,8 + LTEXT "Loading Second Life...",666,36,13,211,8 END @@ -82,7 +82,7 @@ BEGIN "SPLASHSCREEN", DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 187 + RIGHTMARGIN, 257 VERTGUIDE, 36 TOPMARGIN, 7 BOTTOMMARGIN, 27 diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index c107aee4ec..a679e2e85d 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -18,7 +18,7 @@ Clearing cache... Initializing Texture Cache... Initializing VFS... - Error: Please Update Your Graphics Driver! + Graphics Initialization Failed. Please Update Your Graphics Driver! Restoring... -- cgit v1.2.3 From b8351e83e8a0354de743c5a4adbc52930b563a76 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 11 Jul 2011 17:51:16 -0600 Subject: fix for SH-2051: viewer crashes when try to disbable "Show Upload Cost" --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/skins/default/xui/en/menu_viewer.xml | 12 +++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b57657540c..6ddcec6232 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1968,6 +1968,17 @@ Value 0 + DebugShowUploadCost + + Comment + Show mesh upload cost + Persist + 1 + Type + Boolean + Value + 1 + DebugShowXUINames Comment diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 499cf47b6c..0fe6c09684 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2076,12 +2076,14 @@ - - + + @@ -2092,7 +2094,7 @@ function="ToggleControl" parameter="DebugShowRenderInfo" /> - Date: Tue, 12 Jul 2011 12:04:58 -0500 Subject: SH-2052 Fix for reported PE being too low when selecting more than 500 objects. --- indra/newview/llviewerobjectlist.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index f418a6137a..9d38954d8b 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1071,10 +1071,12 @@ void LLViewerObjectList::fetchObjectCosts() LLSD id_list; U32 object_index = 0; + U32 count = 0; + for ( std::set::iterator iter = mStaleObjectCost.begin(); iter != mStaleObjectCost.end(); - ++iter) + ) { // Check to see if a request for this object // has already been made. @@ -1084,13 +1086,15 @@ void LLViewerObjectList::fetchObjectCosts() mPendingObjectCost.insert(*iter); id_list[object_index++] = *iter; } - } - // id_list should now contain all - // requests in mStaleObjectCost before, so clear - // it now - mStaleObjectCost.clear(); + mStaleObjectCost.erase(iter++); + if (count++ >= 450) + { + break; + } + } + if ( id_list.size() > 0 ) { LLSD post_data = LLSD::emptyMap(); -- cgit v1.2.3 From 4e2355036358ed712dd7df2668ec705931ad13a1 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 12 Jul 2011 13:34:09 -0400 Subject: CHOP-753: make getAvailableMemoryKB() only load data on Windows. (per Monty code review) Other platforms return -1 anyway, so don't need to call load methods. --- indra/llcommon/llsys.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 9390fc170c..aa71590eae 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -755,11 +755,11 @@ U32 LLMemoryInfo::getPhysicalMemoryClamped() const //static void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) { +#if LL_WINDOWS // Sigh, this shouldn't be a static method, then we wouldn't have to // reload this data separately from refresh() LLSD statsMap(loadStatsMap(loadStatsArray())); -#if LL_WINDOWS avail_physical_mem_kb = statsMap["Avail Physical KB"].asInteger(); avail_virtual_mem_kb = statsMap["Avail Virtual KB"].asInteger(); -- cgit v1.2.3 From 922bc0aa6ac35175618c54d1e5649678f6b62417 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 12 Jul 2011 13:22:01 -0500 Subject: SH-2053 Don't poke the UI from a background thread -- it tends to get crashy. --- indra/newview/llfloatermodelpreview.cpp | 12 +++++++++++- indra/newview/llfloatermodelpreview.h | 4 +++- indra/newview/llmeshrepository.cpp | 11 ++++------- 3 files changed, 18 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 0939e7bbbf..abec392316 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -5482,7 +5482,17 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible) void LLFloaterModelPreview::onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url) { - mUploadModelUrl = upload_url; + mModelPhysicsFee = result; + mModelPhysicsFee["url"] = upload_url; + + doOnIdleOneTime(boost::bind(&LLFloaterModelPreview::handleModelPhysicsFeeReceived,this)); +} + +void LLFloaterModelPreview::handleModelPhysicsFeeReceived() +{ + const LLSD& result = mModelPhysicsFee; + mUploadModelUrl = result["url"].asString(); + childSetTextArg("weights", "[EQ]", llformat("%0.3f", result["resource_cost"].asReal())); childSetTextArg("weights", "[ST]", llformat("%0.3f", result["model_streaming_cost"].asReal())); childSetTextArg("weights", "[SIM]", llformat("%0.3f", result["simulation_cost"].asReal())); diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 29a61d6ed3..3a5f7602fe 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -201,7 +201,7 @@ public: /*virtual*/ void setPermissonsErrorStatus(U32 status, const std::string& reason); /*virtual*/ void onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url); - + void handleModelPhysicsFeeReceived(); /*virtual*/ void setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason); /*virtual*/ void onModelUploadSuccess(); @@ -273,6 +273,8 @@ protected: LLToggleableMenu* mViewOptionMenu; LLMutex* mStatusLock; + LLSD mModelPhysicsFee; + private: void onClickCalculateBtn(); void toggleCalculateButton(); diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index a1f8f64627..6e67e580b4 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -34,6 +34,7 @@ #include "llagent.h" #include "llappviewer.h" #include "llbufferstream.h" +#include "llcallbacklist.h" #include "llcurl.h" #include "lldatapacker.h" #include "llfloatermodelpreview.h" @@ -355,7 +356,6 @@ public: cc = llsd_from_file("fake_upload_error.xml"); } - llinfos << "completed" << llendl; mThread->mPendingUploads--; dump_llsd_to_file(cc,make_dump_name("whole_model_fee_response_",dump_num)); @@ -364,7 +364,6 @@ public: if (isGoodStatus(status) && cc["state"].asString() == "upload") { - llinfos << "fee request succeeded" << llendl; mThread->mWholeModelUploadURL = cc["uploader"].asString(); if (observer) @@ -414,8 +413,7 @@ public: //assert_main_thread(); mThread->mPendingUploads--; dump_llsd_to_file(cc,make_dump_name("whole_model_upload_response_",dump_num)); - llinfos << "LLWholeModelUploadResponder content: " << cc << llendl; - + LLWholeModelUploadObserver* observer = mObserverHandle.get(); // requested "mesh" asset type isn't actually the type @@ -423,13 +421,12 @@ public: if (isGoodStatus(status) && cc["state"].asString() == "complete") { - llinfos << "upload succeeded" << llendl; mModelData["asset_type"] = "object"; gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mModelData,cc)); if (observer) { - observer->onModelUploadSuccess(); + doOnIdleOneTime(boost::bind(&LLWholeModelUploadObserver::onModelUploadSuccess, observer)); } } else @@ -440,7 +437,7 @@ public: if (observer) { - observer->onModelUploadFailure(); + doOnIdleOneTime(boost::bind(&LLWholeModelUploadObserver::onModelUploadFailure, observer)); } } } -- cgit v1.2.3 From e58a0e9b26dc374155b90a8f42c3a5b09e8ed1f7 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 12 Jul 2011 14:34:31 -0400 Subject: CHOP-753: Defend against boost::regex exceptions. (per Monty code review) Explain why we intentionally don't suppress exceptions from boost::regex objects constructed with string literals. Catch std::runtime_error from boost::regex_search() and boost::regex_match(); log and return false. --- indra/llcommon/llsys.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index aa71590eae..ebdef56c2a 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -70,11 +70,13 @@ using namespace llsd; # include # include # include +# include #elif LL_LINUX # include # include # include # include +# include const char MEMINFO_FILE[] = "/proc/meminfo"; #elif LL_SOLARIS # include @@ -682,6 +684,38 @@ private: LLSD mStats; }; +// Wrap boost::regex_match() with a function that doesn't throw. +template +static bool regex_match_no_exc(const S& string, M& match, const R& regex) +{ + try + { + return boost::regex_match(string, match, regex); + } + catch (const std::runtime_error& e) + { + LL_WARNS("LLMemoryInfo") << "error matching with '" << regex.str() << "': " + << e.what() << ":\n'" << string << "'" << LL_ENDL; + return false; + } +} + +// Wrap boost::regex_search() with a function that doesn't throw. +template +static bool regex_search_no_exc(const S& string, M& match, const R& regex) +{ + try + { + return boost::regex_search(string, match, regex); + } + catch (const std::runtime_error& e) + { + LL_WARNS("LLMemoryInfo") << "error searching with '" << regex.str() << "': " + << e.what() << ":\n'" << string << "'" << LL_ENDL; + return false; + } +} + LLMemoryInfo::LLMemoryInfo() { refresh(); @@ -1012,6 +1046,10 @@ LLSD LLMemoryInfo::loadStatsArray() // Pageouts: 41759. // Object cache: 841598 hits of 7629869 lookups (11% hit rate) + // Intentionally don't pass the boost::no_except flag. These + // boost::regex objects are constructed with string literals, so they + // should be valid every time. If they become invalid, we WANT an + // exception, hopefully even before the dev checks in. boost::regex pagesize_rx("\\(page size of ([0-9]+) bytes\\)"); boost::regex stat_rx("(.+): +([0-9]+)\\."); boost::regex cache_rx("Object cache: ([0-9]+) hits of ([0-9]+) lookups " @@ -1031,7 +1069,7 @@ LLSD LLMemoryInfo::loadStatsArray() line[--linelen] = '\0'; } LL_DEBUGS("LLMemoryInfo") << line << LL_ENDL; - if (boost::regex_search(line, matched, pagesize_rx)) + if (regex_search_no_exc(line, matched, pagesize_rx)) { // "Mach Virtual Memory Statistics: (page size of 4096 bytes)" std::string pagesize_str(matched[1].first, matched[1].second); @@ -1049,7 +1087,7 @@ LLSD LLMemoryInfo::loadStatsArray() } stats.add("page size", pagesizekb); } - else if (boost::regex_match(line, matched, stat_rx)) + else if (regex_match_no_exc(line, matched, stat_rx)) { // e.g. "Pages free: 462078." // Strip double-quotes off certain statistic names @@ -1084,7 +1122,7 @@ LLSD LLMemoryInfo::loadStatsArray() stats.add(kbkey, value * pagesizekb); } } - else if (boost::regex_match(line, matched, cache_rx)) + else if (regex_match_no_exc(line, matched, cache_rx)) { // e.g. "Object cache: 841598 hits of 7629869 lookups (11% hit rate)" static const char* cache_keys[] = { "cache hits", "cache lookups", "cache hit%" }; @@ -1185,6 +1223,10 @@ LLSD LLMemoryInfo::loadStatsArray() // DirectMap4k: 434168 kB // DirectMap2M: 477184 kB + // Intentionally don't pass the boost::no_except flag. This + // boost::regex object is constructed with a string literal, so it + // should be valid every time. If it becomes invalid, we WANT an + // exception, hopefully even before the dev checks in. boost::regex stat_rx("(.+): +([0-9]+)( kB)?"); boost::smatch matched; @@ -1192,7 +1234,7 @@ LLSD LLMemoryInfo::loadStatsArray() while (std::getline(meminfo, line)) { LL_DEBUGS("LLMemoryInfo") << line << LL_ENDL; - if (boost::regex_match(line, matched, stat_rx)) + if (regex_match_no_exc(line, matched, stat_rx)) { // e.g. "MemTotal: 4108424 kB" LLSD::String key(matched[1].first, matched[1].second); -- cgit v1.2.3 From 77e2be798484e5a645e617e2bcf91e7b039dd96c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Jul 2011 14:35:32 -0400 Subject: SH-2043 FIX --- indra/newview/llfloatermodelpreview.cpp | 14 ++++++++++++++ .../newview/skins/default/xui/en/floater_model_preview.xml | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) mode change 100644 => 100755 indra/newview/skins/default/xui/en/floater_model_preview.xml (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 80a9b8f781..877f70efa9 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -101,7 +101,9 @@ #include "llcallbacklist.h" #include "llviewerobjectlist.h" #include "llanimationstates.h" +#include "llviewernetwork.h" #include "glod/glod.h" +#include const S32 SLM_SUPPORTED_VERSION = 2; @@ -476,6 +478,18 @@ BOOL LLFloaterModelPreview::postBuild() text->setMouseDownCallback(boost::bind(&LLModelPreview::setPreviewLOD, mModelPreview, i)); } } + std::string current_grid = LLGridManager::getInstance()->getGridLabel(); + std::transform(current_grid.begin(),current_grid.end(),current_grid.begin(),::tolower); + std::string validate_url; + if (current_grid == "agni") + { + validate_url = "http://secondlife.com/my/account/mesh.php"; + } + else + { + validate_url = llformat("http://secondlife.%s.lindenlab.com/my/account/mesh.php",current_grid.c_str()); + } + getChild("warning_message")->setTextArg("[VURL]", validate_url); mUploadBtn = getChild("ok_btn"); mCalculateBtn = getChild("calculate_btn"); diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml old mode 100644 new mode 100755 index 060ddec1f4..a0a95fafb8 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -92,7 +92,7 @@ parse_urls="true" wrap="true" visible="false"> - You will not be able to complete the final upload of this model to the Second Life servers. [secondlife:///app/floater/learn_more Find out how] to get enabled for mesh model uploads. + You will not be able to complete the final upload of this model to the Second Life servers. [[VURL] Find out how] to get enabled for mesh model uploads. Date: Tue, 12 Jul 2011 14:39:15 -0400 Subject: SH-2049 FIX --- indra/newview/skins/default/xui/en/floater_model_preview.xml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index a0a95fafb8..e75511e2b3 100755 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -168,7 +168,8 @@ L$ [MODEL] + name="lod_panel" + help_topic="upload_model_lod"> Select Level of Detail: @@ -291,7 +292,8 @@ L$ [MODEL] + name="physics_panel" + help_topic="upload_model_physics"> + name="modifiers_panel" + help_topic="upload_model_modifiers"> + Scale: -- cgit v1.2.3 From bb44da4613595f7bf03d4c21d053917ce2df2b00 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 12 Jul 2011 14:07:09 -0500 Subject: SH-2050 Hide UI that breaks down upload fee and rename some fields. --- indra/newview/skins/default/xui/en/floater_model_preview.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index 060ddec1f4..a8761e96b0 100644 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -102,9 +102,9 @@ width="80" word_wrap="true" > -Streaming: +Download: Physics: -Simulation: +Server: Prim equivs: @@ -123,7 +123,8 @@ Prim equivs: [EQ] - + + Date: Tue, 12 Jul 2011 14:42:56 -0600 Subject: fix for SH-2040: Missing '?: 0' and old style object/prim counts under Edit linked when Mesh disabled --- indra/newview/llfloatertools.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index dc71ade621..84fb8bd9e7 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -422,7 +422,7 @@ void LLFloaterTools::refresh() // Refresh object and prim count labels LLLocale locale(LLLocale::USER_LOCALE); - +#if 0 if (!gMeshRepo.meshRezEnabled()) { std::string obj_count_string; @@ -447,6 +447,7 @@ void LLFloaterTools::refresh() getChildView("RenderingCost")->setEnabled(have_selection && sShowObjectCost); } else +#endif { F32 link_phys_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetPhysicsCost(); F32 link_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetCost(); -- cgit v1.2.3 From 104748b59af2ff15b44c910340daffe9180e74f7 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 12 Jul 2011 17:31:25 -0500 Subject: SH-1125 Retry when failing to get seed capability. --- indra/newview/llviewerregion.cpp | 34 +++++++++++++++++++++++++--------- indra/newview/llviewerregion.h | 2 +- 2 files changed, 26 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 8bb38e3e46..9c6c62053b 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -186,8 +186,8 @@ class BaseCapabilitiesComplete : public LLHTTPClient::Responder { LOG_CLASS(BaseCapabilitiesComplete); public: - BaseCapabilitiesComplete(LLViewerRegion* region) - : mRegion(region) + BaseCapabilitiesComplete(LLViewerRegion* region, S32 retry = 0) + : mRegion(region), mRetry(retry) { } virtual ~BaseCapabilitiesComplete() { @@ -206,9 +206,24 @@ public: { LL_WARNS2("AppInit", "Capabilities") << statusNum << ": " << reason << LL_ENDL; - if (STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState()) + const S32 MAX_RETRIES = 5; + + if (mRetry < MAX_RETRIES) { - LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED ); + std::string url = mRegion->getCapability("Seed"); + + mRetry++; + + llinfos << "retry " << mRetry << " posting to seed " << url << llendl; + + mRegion->setSeedCapability(url, mRetry); + } + else + { + if (STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState()) + { + LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED ); + } } } @@ -242,14 +257,15 @@ public: } static boost::intrusive_ptr build( - LLViewerRegion* region) + LLViewerRegion* region, S32 retry) { return boost::intrusive_ptr( - new BaseCapabilitiesComplete(region)); + new BaseCapabilitiesComplete(region, retry)); } private: LLViewerRegion* mRegion; + S32 mRetry; }; @@ -1476,9 +1492,9 @@ void LLViewerRegion::unpackRegionHandshake() msg->sendReliable(host); } -void LLViewerRegion::setSeedCapability(const std::string& url) +void LLViewerRegion::setSeedCapability(const std::string& url, S32 retry) { - if (getCapability("Seed") == url) + if (retry == 0 && getCapability("Seed") == url) { // llwarns << "Ignoring duplicate seed capability" << llendl; return; @@ -1568,7 +1584,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) llinfos << "posting to seed " << url << llendl; - mImpl->mHttpResponderPtr = BaseCapabilitiesComplete::build(this) ; + mImpl->mHttpResponderPtr = BaseCapabilitiesComplete::build(this, retry) ; LLHTTPClient::post(url, capabilityNames, mImpl->mHttpResponderPtr); } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 00252b8897..0176969cea 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -230,7 +230,7 @@ public: const LLHTTPClient::ResponderPtr getHttpResponderPtr() const; // Get/set named capability URLs for this region. - void setSeedCapability(const std::string& url); + void setSeedCapability(const std::string& url, S32 retry = 0); void setCapability(const std::string& name, const std::string& url); // implements LLCapabilityProvider virtual std::string getCapability(const std::string& name) const; -- cgit v1.2.3 From 42daa3497b6626cbb5f32ba54162558cd025069b Mon Sep 17 00:00:00 2001 From: Aaron Stone Date: Tue, 12 Jul 2011 15:48:02 -0700 Subject: STORM-1482 The Viewer shouldn't overwrite the crash behavior settings, some cleanups to the crash reporters, and the ability to use --set GroupName.SettingName to set parameters outside of the (default) Global settings group. --- indra/linux_crash_logger/linux_crash_logger.cpp | 14 +++- indra/linux_crash_logger/llcrashloggerlinux.cpp | 2 - indra/llcommon/indra_constants.h | 2 - indra/llcrashlogger/llcrashlogger.cpp | 80 ++++++++++++--------- indra/llcrashlogger/llcrashlogger.h | 11 --- .../mac_crash_logger/CrashReporter.nib/objects.xib | 2 +- indra/mac_crash_logger/llcrashloggermac.cpp | 5 +- indra/mac_crash_logger/mac_crash_logger.cpp | 15 ++-- indra/newview/app_settings/cmd_line.xml | 13 +--- indra/newview/app_settings/settings_files.xml | 5 +- indra/newview/llappviewer.cpp | 81 ++++++++++------------ indra/newview/llappviewerlinux.cpp | 2 +- indra/newview/llappviewerwin32.cpp | 2 +- indra/newview/llfloaterpreference.cpp | 5 +- indra/newview/llviewercontrol.cpp | 4 +- .../default/xui/en/panel_preferences_setup.xml | 2 +- indra/win_crash_logger/llcrashloggerwindows.cpp | 5 +- indra/win_crash_logger/llcrashloggerwindows.h | 1 - indra/win_crash_logger/win_crash_logger.cpp | 35 ++-------- 19 files changed, 125 insertions(+), 161 deletions(-) (limited to 'indra') diff --git a/indra/linux_crash_logger/linux_crash_logger.cpp b/indra/linux_crash_logger/linux_crash_logger.cpp index 8beae555fb..99d0ad7e14 100644 --- a/indra/linux_crash_logger/linux_crash_logger.cpp +++ b/indra/linux_crash_logger/linux_crash_logger.cpp @@ -24,16 +24,24 @@ * $/LicenseInfo$ */ +#include "linden_common.h" #include "llcrashloggerlinux.h" int main(int argc, char **argv) { + llinfos << "Starting crash reporter." << llendl; + LLCrashLoggerLinux app; app.parseCommandOptions(argc, argv); - app.init(); + + if (! app.init()) + { + llwarns << "Unable to initialize application." << llendl; + return 1; + } + app.mainLoop(); app.cleanup(); + llinfos << "Crash reporter finished normally." << llendl; return 0; } - - diff --git a/indra/linux_crash_logger/llcrashloggerlinux.cpp b/indra/linux_crash_logger/llcrashloggerlinux.cpp index 7449c6426f..7316717193 100644 --- a/indra/linux_crash_logger/llcrashloggerlinux.cpp +++ b/indra/linux_crash_logger/llcrashloggerlinux.cpp @@ -30,8 +30,6 @@ #include "linden_common.h" -#include "boost/tokenizer.hpp" - #include "indra_constants.h" // CRASH_BEHAVIOR_ASK, CRASH_SETTING_NAME #include "llerror.h" #include "llfile.h" diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index d0f287657e..0745696ef3 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -387,8 +387,6 @@ const S32 MAP_SIM_RETURN_NULL_SIMS = 0x00010000; const S32 MAP_SIM_PRELUDE = 0x00020000; // Crash reporter behavior -const char* const CRASH_SETTINGS_FILE = "settings_crash_behavior.xml"; -const char* const CRASH_BEHAVIOR_SETTING = "CrashSubmitBehavior"; const S32 CRASH_BEHAVIOR_ASK = 0; const S32 CRASH_BEHAVIOR_ALWAYS_SEND = 1; const S32 CRASH_BEHAVIOR_NEVER_SEND = 2; diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 68e45f36e4..3fbaf61991 100644 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -31,10 +31,12 @@ #include "llcrashlogger.h" #include "linden_common.h" #include "llstring.h" -#include "indra_constants.h" // CRASH_BEHAVIOR_ASK, CRASH_SETTING_NAME +#include "indra_constants.h" // CRASH_BEHAVIOR_... #include "llerror.h" +#include "llerrorcontrol.h" #include "lltimer.h" #include "lldir.h" +#include "llfile.h" #include "llsdserialize.h" #include "lliopipe.h" #include "llpumpio.h" @@ -54,7 +56,7 @@ public: virtual void error(U32 status, const std::string& reason) { - gBreak = true; + gBreak = true; } virtual void result(const LLSD& content) @@ -64,19 +66,6 @@ public: } }; -bool LLCrashLoggerText::mainLoop() -{ - std::cout << "Entering main loop" << std::endl; - sendCrashLogs(); - return true; -} - -void LLCrashLoggerText::updateApplication(const std::string& message) -{ - LLCrashLogger::updateApplication(message); - std::cout << message << std::endl; -} - LLCrashLogger::LLCrashLogger() : mCrashBehavior(CRASH_BEHAVIOR_ASK), mCrashInPreviousExec(false), @@ -281,26 +270,41 @@ LLSD LLCrashLogger::constructPostData() return mCrashInfo; } +const char* const CRASH_SETTINGS_FILE = "settings_crash_behavior.xml"; + S32 LLCrashLogger::loadCrashBehaviorSetting() { std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); mCrashSettings.loadFromFile(filename); - - S32 value = mCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); - - if (value < CRASH_BEHAVIOR_ASK || CRASH_BEHAVIOR_NEVER_SEND < value) return CRASH_BEHAVIOR_ASK; - return value; + S32 value = mCrashSettings.getS32("CrashSubmitBehavior"); + + switch (value) + { + case CRASH_BEHAVIOR_NEVER_SEND: + return CRASH_BEHAVIOR_NEVER_SEND; + case CRASH_BEHAVIOR_ALWAYS_SEND: + return CRASH_BEHAVIOR_ALWAYS_SEND; + } + + return CRASH_BEHAVIOR_ASK; } bool LLCrashLogger::saveCrashBehaviorSetting(S32 crash_behavior) { - if (crash_behavior != CRASH_BEHAVIOR_ASK && crash_behavior != CRASH_BEHAVIOR_ALWAYS_SEND) return false; + switch (crash_behavior) + { + case CRASH_BEHAVIOR_ASK: + case CRASH_BEHAVIOR_NEVER_SEND: + case CRASH_BEHAVIOR_ALWAYS_SEND: + break; + default: + return false; + } - mCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, crash_behavior); + mCrashSettings.setS32("CrashSubmitBehavior", crash_behavior); std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); - mCrashSettings.saveToFile(filename, FALSE); return true; @@ -309,14 +313,13 @@ bool LLCrashLogger::saveCrashBehaviorSetting(S32 crash_behavior) bool LLCrashLogger::runCrashLogPost(std::string host, LLSD data, std::string msg, int retries, int timeout) { gBreak = false; - std::string status_message; for(int i = 0; i < retries; ++i) { - status_message = llformat("%s, try %d...", msg.c_str(), i+1); + updateApplication(llformat("%s, try %d...", msg.c_str(), i+1)); LLHTTPClient::post(host, data, new LLCrashLoggerResponder(), timeout); while(!gBreak) { - updateApplication(status_message); + updateApplication(); // No new message, just pump the IO } if(gSent) { @@ -336,7 +339,7 @@ bool LLCrashLogger::sendCrashLogs() updateApplication("Sending reports..."); std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, - "SecondLifeCrashReport"); + "SecondLifeCrashReport"); std::string report_file = dump_path + ".log"; std::ofstream out_file(report_file.c_str()); @@ -365,6 +368,7 @@ void LLCrashLogger::updateApplication(const std::string& message) { gServicePump->pump(); gServicePump->callback(); + if (!message.empty()) llinfos << message << llendl; } bool LLCrashLogger::init() @@ -374,11 +378,24 @@ bool LLCrashLogger::init() // We assume that all the logs we're looking for reside on the current drive gDirUtilp->initAppDirs("SecondLife"); + LLError::initForApplication(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "")); + // Default to the product name "Second Life" (this is overridden by the -name argument) mProductName = "Second Life"; + + // Rename current log file to ".old" + std::string old_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "crashreport.log.old"); + std::string log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "crashreport.log"); + LLFile::rename(log_file.c_str(), old_log_file.c_str()); + + // Set the log file to crashreport.log + LLError::logToFile(log_file); - mCrashSettings.declareS32(CRASH_BEHAVIOR_SETTING, CRASH_BEHAVIOR_ASK, "Controls behavior when viewer crashes " - "(0 = ask before sending crash report, 1 = always send crash report, 2 = never send crash report)"); + mCrashSettings.declareS32("CrashSubmitBehavior", CRASH_BEHAVIOR_ASK, + "Controls behavior when viewer crashes " + "(0 = ask before sending crash report, " + "1 = always send crash report, " + "2 = never send crash report)"); llinfos << "Loading crash behavior setting" << llendl; mCrashBehavior = loadCrashBehaviorSetting(); @@ -394,10 +411,11 @@ bool LLCrashLogger::init() gServicePump->prime(gAPRPoolp); LLHTTPClient::setPump(*gServicePump); - //If we've opened the crash logger, assume we can delete the marker file if it exists + //If we've opened the crash logger, assume we can delete the marker file if it exists if( gDirUtilp ) { - std::string marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"SecondLife.exec_marker"); + std::string marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, + "SecondLife.exec_marker"); LLAPRFile::remove( marker_file ); } diff --git a/indra/llcrashlogger/llcrashlogger.h b/indra/llcrashlogger/llcrashlogger.h index a5daa74247..5d0cb5931c 100644 --- a/indra/llcrashlogger/llcrashlogger.h +++ b/indra/llcrashlogger/llcrashlogger.h @@ -66,15 +66,4 @@ protected: bool mSentCrashLogs; }; -class LLCrashLoggerText : public LLCrashLogger -{ -public: - LLCrashLoggerText(void) {} - ~LLCrashLoggerText(void) {} - - virtual bool mainLoop(); - virtual void updateApplication(const std::string& message = LLStringUtil::null); -}; - - #endif //LLCRASHLOGGER_H diff --git a/indra/mac_crash_logger/CrashReporter.nib/objects.xib b/indra/mac_crash_logger/CrashReporter.nib/objects.xib index 634d1c5321..32647391b6 100644 --- a/indra/mac_crash_logger/CrashReporter.nib/objects.xib +++ b/indra/mac_crash_logger/CrashReporter.nib/objects.xib @@ -15,7 +15,7 @@ 414 390 434 487 - Second Life appears to have crashed or frozen the last time it ran. This crash reporter collects information about your computer's hardware configuration, operating system, and some Second Life logs, all of which are used for debugging purposes only. In the space below, please briefly describe what you were doing or trying to do just prior to the crash. Thank you for your help! This report is NOT read by Customer Support. If you have billing or other questions, please go to: http://www.secondlife.com/support/ If you don't wish to send Linden Lab a crash report, press Cancel. + Second Life appears to have crashed or frozen the last time it ran. This crash reporter collects information about your computer's hardware configuration, operating system, and some Second Life logs, all of which are used for debugging purposes only. In the space below, please briefly describe what you were doing or trying to do just prior to the crash. Thank you for your help! This report is NOT read by Customer Support. If you have billing or other questions, please go to: http://www.secondlife.com/support/ If you don't wish to send Linden Lab a crash report, press Don't Send. 20 20 231 487 diff --git a/indra/mac_crash_logger/llcrashloggermac.cpp b/indra/mac_crash_logger/llcrashloggermac.cpp index bec8cce04e..b555e92b96 100644 --- a/indra/mac_crash_logger/llcrashloggermac.cpp +++ b/indra/mac_crash_logger/llcrashloggermac.cpp @@ -29,9 +29,6 @@ #include #include -#include - -#include "boost/tokenizer.hpp" #include "indra_constants.h" // CRASH_BEHAVIOR_ASK, CRASH_SETTING_NAME #include "llerror.h" @@ -247,7 +244,7 @@ bool LLCrashLoggerMac::mainLoop() void LLCrashLoggerMac::updateApplication(const std::string& message) { - LLCrashLogger::updateApplication(); + LLCrashLogger::updateApplication(message); } bool LLCrashLoggerMac::cleanup() diff --git a/indra/mac_crash_logger/mac_crash_logger.cpp b/indra/mac_crash_logger/mac_crash_logger.cpp index 20b491c401..6571b35241 100644 --- a/indra/mac_crash_logger/mac_crash_logger.cpp +++ b/indra/mac_crash_logger/mac_crash_logger.cpp @@ -25,22 +25,23 @@ */ #include "linden_common.h" - #include "llcrashloggermac.h" int main(int argc, char **argv) { - //time(&gLaunchTime); - - llinfos << "Starting Second Life Viewer Crash Reporter" << llendl; + llinfos << "Starting crash reporter." << llendl; LLCrashLoggerMac app; app.parseCommandOptions(argc, argv); - if(!app.init()) + + if (! app.init()) { - return 0; + llwarns << "Unable to initialize application." << llendl; + return 1; } + app.mainLoop(); - + app.cleanup(); + llinfos << "Crash reporter finished normally." << llendl; return 0; } diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml index 89e5949fbe..15434f2b8f 100644 --- a/indra/newview/app_settings/cmd_line.xml +++ b/indra/newview/app_settings/cmd_line.xml @@ -220,8 +220,7 @@ desc Set the detail level. - 0 - low, 1 - medium, 2 - high, 3 - ultra - +0 - low, 1 - medium, 2 - high, 3 - ultra count 1 @@ -229,10 +228,7 @@ setdefault desc - specify the value of a particular - configuration variable which can be - overridden by settings.xml - + specify the value of a particular configuration variable which can be overridden by settings.xml. count 2 @@ -241,10 +237,7 @@ set desc - specify the value of a particular - configuration variable that - overrides all other settings - + specify the value of a particular configuration variable that overrides all other settings. count 2 compose diff --git a/indra/newview/app_settings/settings_files.xml b/indra/newview/app_settings/settings_files.xml index 079a54f957..bfc09286e3 100644 --- a/indra/newview/app_settings/settings_files.xml +++ b/indra/newview/app_settings/settings_files.xml @@ -20,7 +20,8 @@ file_name="settings.xml" file_name_setting="ClientSettingsFile"/> + file_name="settings_crash_behavior.xml" + file_name_setting="CrashSettingsFile"/> @@ -61,4 +62,4 @@ file_name="colors.xml" file_name_setting="SkinningSettingsFile"/> - \ No newline at end of file + diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 1d9519d675..1ce92c689d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -468,18 +468,6 @@ void request_initial_instant_messages() } } -// A settings system callback for CrashSubmitBehavior -bool handleCrashSubmitBehaviorChanged(const LLSD& newvalue) -{ - S32 cb = newvalue.asInteger(); - const S32 NEVER_SUBMIT_REPORT = 2; - if(cb == NEVER_SUBMIT_REPORT) - { - LLAppViewer::instance()->destroyMainloopTimeout(); - } - return true; -} - // Use these strictly for things that are constructed at startup, // or for things that are performance critical. JC static void settings_to_globals() @@ -611,9 +599,6 @@ bool LLAppViewer::sendURLToOtherInstance(const std::string& url) // Static members. // The single viewer app. LLAppViewer* LLAppViewer::sInstance = NULL; - -const std::string LLAppViewer::sGlobalSettingsName = "Global"; - LLTextureCache* LLAppViewer::sTextureCache = NULL; LLImageDecodeThread* LLAppViewer::sImageDecodeThread = NULL; LLTextureFetch* LLAppViewer::sTextureFetch = NULL; @@ -771,16 +756,6 @@ bool LLAppViewer::init() LL_INFOS("InitInfo") << "J2C Engine is: " << LLImageJ2C::getEngineInfo() << LL_ENDL; LL_INFOS("InitInfo") << "libcurl version is: " << LLCurl::getVersionString() << LL_ENDL; - // Get the single value from the crash settings file, if it exists - std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); - gCrashSettings.loadFromFile(crash_settings_filename); - if(gSavedSettings.getBOOL("IgnoreAllNotifications")) - { - gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, CRASH_BEHAVIOR_ALWAYS_SEND); - gCrashSettings.saveToFile(crash_settings_filename, FALSE); - } - LL_INFOS("InitInfo") << "Crash settings done." << LL_ENDL ; - ///////////////////////////////////////////////// // OS-specific login dialogs ///////////////////////////////////////////////// @@ -1055,7 +1030,7 @@ bool LLAppViewer::init() //EXT-7013 - On windows for some locale (Japanese) standard //datetime formatting functions didn't support some parameters such as "weekday". //Names for days and months localized in xml are also useful for Polish locale(STORM-107). - std::string language = LLControlGroup::getInstance(sGlobalSettingsName)->getString("Language"); + std::string language = gSavedSettings.getString("Language"); if(language == "ja" || language == "pl") { LLStringOps::setupWeekDaysNames(LLTrans::getString("dateTimeWeekdaysNames")); @@ -1706,10 +1681,6 @@ bool LLAppViewer::cleanup() llinfos << "Saved settings" << llendflush; } - std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); - // save all settings, even if equals defaults - gCrashSettings.saveToFile(crash_settings_filename, FALSE); - std::string warnings_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Warnings")); gWarningSettings.saveToFile(warnings_settings_filename, TRUE); @@ -1839,7 +1810,6 @@ bool LLAppViewer::cleanup() gSavedSettings.cleanup(); LLUIColorTable::instance().clear(); - gCrashSettings.cleanup(); LLWatchdog::getInstance()->cleanup(); @@ -1982,7 +1952,6 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, llerrs << "Invalid settings location list" << llendl; } - LLControlGroup* global_settings = LLControlGroup::getInstance(sGlobalSettingsName); for(LLInitParam::ParamIterator::const_iterator it = mSettingsLocationList->groups.begin(), end_it = mSettingsLocationList->groups.end(); it != end_it; ++it) @@ -2015,11 +1984,15 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, std::string full_settings_path; if (file_it->file_name_setting.isProvided() - && global_settings->controlExists(file_it->file_name_setting)) + && gSavedSettings.controlExists(file_it->file_name_setting)) { // try to find filename stored in file_name_setting control - full_settings_path = global_settings->getString(file_it->file_name_setting); - if (!gDirUtilp->fileExists(full_settings_path)) + full_settings_path = gSavedSettings.getString(file_it->file_name_setting); + if (full_settings_path.empty()) + { + continue; + } + else if (!gDirUtilp->fileExists(full_settings_path)) { // search in default path full_settings_path = gDirUtilp->getExpandedFilename((ELLPath)path_index, full_settings_path); @@ -2165,8 +2138,6 @@ bool LLAppViewer::initConfiguration() gSavedSettings.setS32("WatchdogEnabled", 0); #endif - gCrashSettings.getControl(CRASH_BEHAVIOR_SETTING)->getSignal()->connect(boost::bind(&handleCrashSubmitBehaviorChanged, _2)); - // These are warnings that appear on the first experience of that condition. // They are already set in the settings_default.xml file, but still need to be added to LLFirstUse // for disable/reset ability @@ -2297,15 +2268,33 @@ bool LLAppViewer::initConfiguration() { const std::string& name = *itr; const std::string& value = *(++itr); - LLControlVariable* c = LLControlGroup::getInstance(sGlobalSettingsName)->getControl(name); - if(c) + std::string name_part; + std::string group_part; + LLControlVariable* control = NULL; + + // Name can be further split into ControlGroup.Name, with the default control group being Global + size_t pos = name.find('.'); + if (pos != std::string::npos) + { + group_part = name.substr(0, pos); + name_part = name.substr(pos+1); + llinfos << "Setting " << group_part << "." << name_part << " to " << value << llendl; + LLControlGroup* g = LLControlGroup::getInstance(group_part); + if (g) control = g->getControl(name_part); + } + else + { + llinfos << "Setting Global." << name << " to " << value << llendl; + control = gSavedSettings.getControl(name); + } + + if (control) { - c->setValue(value, false); + control->setValue(value, false); } else { - llwarns << "'--set' specified with unknown setting: '" - << name << "'." << llendl; + llwarns << "Failed --set " << name << ": setting name unknown." << llendl; } } } @@ -2762,7 +2751,8 @@ void LLAppViewer::checkForCrash(void) // Pop up a freeze or crash warning dialog // S32 choice; - if(gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) == CRASH_BEHAVIOR_ASK) + const S32 cb = gCrashSettings.getS32("CrashSubmitBehavior"); + if(cb == CRASH_BEHAVIOR_ASK) { std::ostringstream msg; msg << LLTrans::getString("MBFrozenCrashed"); @@ -2771,7 +2761,7 @@ void LLAppViewer::checkForCrash(void) alert, OSMB_YESNO); } - else if(gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) == CRASH_BEHAVIOR_NEVER_SEND) + else if(cb == CRASH_BEHAVIOR_NEVER_SEND) { choice = OSBTN_NO; } @@ -2828,7 +2818,6 @@ bool LLAppViewer::initWindow() LL_INFOS("AppInit") << "gViewerwindow created." << LL_ENDL; // Need to load feature table before cheking to start watchdog. - const S32 NEVER_SUBMIT_REPORT = 2; bool use_watchdog = false; int watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled"); if(watchdog_enabled_setting == -1) @@ -2841,7 +2830,7 @@ bool LLAppViewer::initWindow() use_watchdog = bool(watchdog_enabled_setting); } - bool send_reports = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING) != NEVER_SUBMIT_REPORT; + bool send_reports = gCrashSettings.getS32("CrashSubmitBehavior") != CRASH_BEHAVIOR_NEVER_SEND; if(use_watchdog && send_reports) { LLWatchdog::getInstance()->init(watchdog_killer_callback); diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 714e0e6163..08d4f49147 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -361,7 +361,7 @@ void LLAppViewerLinux::handleCrashReporting(bool reportFreeze) } else { - const S32 cb = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); + const S32 cb = gCrashSettings.getS32("CrashSubmitBehavior"); // Always generate the report, have the logger do the asking, and // don't wait for the logger before exiting (-> total cleanup). diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 445bd208ef..9280234ac3 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -518,7 +518,7 @@ void LLAppViewerWin32::handleCrashReporting(bool reportFreeze) } else { - S32 cb = gCrashSettings.getS32(CRASH_BEHAVIOR_SETTING); + S32 cb = gCrashSettings.getS32("CrashSubmitBehavior"); if(cb != CRASH_BEHAVIOR_NEVER_SEND) { _spawnl(_P_NOWAIT, exe_path.c_str(), arg_str, NULL); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 7848484ac6..5fd262a720 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -751,10 +751,7 @@ void LLFloaterPreference::onBtnOK() closeFloater(false); LLUIColorTable::instance().saveUserSettings(); - gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); - std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); - // save all settings, even if equals defaults - gCrashSettings.saveToFile(crash_settings_filename, FALSE); + gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); } else { diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 87ca80260f..b87ca1eaec 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -566,7 +566,7 @@ bool toggle_show_object_render_cost(const LLSD& newvalue) return true; } -void toggle_updater_service_active(LLControlVariable* control, const LLSD& new_value) +void toggle_updater_service_active(const LLSD& new_value) { if(new_value.asInteger()) { @@ -735,7 +735,7 @@ void settings_setup_listeners() gSavedSettings.getControl("ShowNavbarFavoritesPanel")->getSignal()->connect(boost::bind(&toggle_show_favorites_panel, _2)); gSavedSettings.getControl("ShowMiniLocationPanel")->getSignal()->connect(boost::bind(&toggle_show_mini_location_panel, _2)); gSavedSettings.getControl("ShowObjectRenderingCost")->getSignal()->connect(boost::bind(&toggle_show_object_render_cost, _2)); - gSavedSettings.getControl("UpdaterServiceSetting")->getSignal()->connect(&toggle_updater_service_active); + gSavedSettings.getControl("UpdaterServiceSetting")->getSignal()->connect(boost::bind(&toggle_updater_service_active, _2)); gSavedSettings.getControl("ForceShowGrid")->getSignal()->connect(boost::bind(&handleForceShowGrid, _2)); gSavedSettings.getControl("RenderTransparentWater")->getSignal()->connect(boost::bind(&handleRenderTransparentWaterChanged, _2)); } diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index 1c22a5c02e..e639f0dc9d 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -268,7 +268,7 @@ height="23" layout="topleft" left_delta="50" - top_pad="5" + top_pad="5" name="updater_service_combobox" width="300"> - #include "llcrashloggerwindows.h" - - -// -// Implementation -// - int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { - llinfos << "Starting crash reporter" << llendl; + llinfos << "Starting crash reporter." << llendl; LLCrashLoggerWindows app; app.setHandle(hInstance); - bool ok = app.init(); - if(!ok) + app.parseCommandOptions(__argc, __argv); + + if (! app.init()) { llwarns << "Unable to initialize application." << llendl; return -1; } - // Run the application main loop - if(!LLApp::isQuitting()) app.mainLoop(); - - if (!app.isError()) - { - // - // We don't want to do cleanup here if the error handler got called - - // the assumption is that the error handler is responsible for doing - // app cleanup if there was a problem. - // - app.cleanup(); - } + app.mainLoop(); + app.cleanup(); + llinfos << "Crash reporter finished normally." << llendl; return 0; } -- cgit v1.2.3 From ed648b1f08a191250c5c37f831280c31950b502a Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 12 Jul 2011 20:14:39 -0400 Subject: CHOP-753: Eliminate redundant array-of-pair-arrays in LLMemoryInfo. (per Monty code review) The notion of storing LLMemoryInfo data both as an LLSD::Map and an LLSD::Array of pair arrays arose from a (possibly misguided) desire to continue producing stats output into the viewer log in the same order it always used to be produced. There is no evidence that anyone cares about the order of those stats in the log; there is no other use case for preserving order. At Monty's recommendation, eliminate generating and storing the array-of-pair-arrays form: directly store LLSD::Map. --- indra/llcommon/llsys.cpp | 72 ++++++++++++++++-------------------------------- indra/llcommon/llsys.h | 24 ++++------------ 2 files changed, 30 insertions(+), 66 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index ebdef56c2a..99e61433c6 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -647,13 +647,13 @@ void LLCPUInfo::stream(std::ostream& s) const s << "->mCPUString: " << mCPUString << std::endl; } -// Helper class for LLMemoryInfo: accumulate stats in the array-of-pair-arrays -// form we store for LLMemoryInfo::getStatsArray(). -class StatsArray +// Helper class for LLMemoryInfo: accumulate stats in the form we store for +// LLMemoryInfo::getStatsMap(). +class Stats { public: - StatsArray(): - mStats(LLSD::emptyArray()) + Stats(): + mStats(LLSD::emptyMap()) {} // Store every integer type as LLSD::Integer. @@ -661,7 +661,7 @@ public: void add(const LLSD::String& name, const T& value, typename boost::enable_if >::type* = 0) { - mStats.append(LLSDArray(name)(LLSD::Integer(value))); + mStats[name] = LLSD::Integer(value); } // Store every floating-point type as LLSD::Real. @@ -669,13 +669,13 @@ public: void add(const LLSD::String& name, const T& value, typename boost::enable_if >::type* = 0) { - mStats.append(LLSDArray(name)(LLSD::Real(value))); + mStats[name] = LLSD::Real(value); } // Hope that LLSD::Date values are sufficiently unambiguous. void add(const LLSD::String& name, const LLSD::Date& value) { - mStats.append(LLSDArray(name)(value)); + mStats[name] = value; } LLSD get() const { return mStats; } @@ -792,7 +792,7 @@ void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_v #if LL_WINDOWS // Sigh, this shouldn't be a static method, then we wouldn't have to // reload this data separately from refresh() - LLSD statsMap(loadStatsMap(loadStatsArray())); + LLSD statsMap(loadStatsMap()); avail_physical_mem_kb = statsMap["Avail Physical KB"].asInteger(); avail_virtual_mem_kb = statsMap["Avail Virtual KB"].asInteger(); @@ -884,16 +884,11 @@ void LLMemoryInfo::stream(std::ostream& s) const // introducer line, then read subsequent lines, etc... std::string pfx(LLError::utcTime() + " "); - // Most of the reason we even store mStatsArray is to preserve the - // original order in which we obtained these stats from the OS. So use - // mStatsArray in this method rather than mStatsMap, which should present - // the same information but in arbitrary order. - // Max key length size_t key_width(0); - BOOST_FOREACH(LLSD pair, inArray(mStatsArray)) + BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap)) { - size_t len(pair[0].asString().length()); + size_t len(pair.first.length()); if (len > key_width) { key_width = len; @@ -901,17 +896,18 @@ void LLMemoryInfo::stream(std::ostream& s) const } // Now stream stats - BOOST_FOREACH(LLSD pair, inArray(mStatsArray)) + BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap)) { - s << pfx << std::setw(key_width+1) << (pair[0].asString() + ':') << ' '; - if (pair[1].isInteger()) - s << std::setw(12) << pair[1].asInteger(); - else if (pair[1].isReal()) - s << std::fixed << std::setprecision(1) << pair[1].asReal(); - else if (pair[1].isDate()) - pair[1].asDate().toStream(s); + s << pfx << std::setw(key_width+1) << (pair.first + ':') << ' '; + LLSD value(pair.second); + if (value.isInteger()) + s << std::setw(12) << value.asInteger(); + else if (value.isReal()) + s << std::fixed << std::setprecision(1) << value.asReal(); + else if (value.isDate()) + value.asDate().toStream(s); else - s << pair[1]; // just use default LLSD formatting + s << value; // just use default LLSD formatting s << std::endl; } } @@ -921,16 +917,9 @@ LLSD LLMemoryInfo::getStatsMap() const return mStatsMap; } -LLSD LLMemoryInfo::getStatsArray() const -{ - return mStatsArray; -} - LLMemoryInfo& LLMemoryInfo::refresh() { - mStatsArray = loadStatsArray(); - // Recast same data as mStatsMap for easy access - mStatsMap = loadStatsMap(mStatsArray); + mStatsMap = loadStatsMap(); LL_DEBUGS("LLMemoryInfo") << "Populated mStatsMap:\n"; LLSDSerialize::toPrettyXML(mStatsMap, LL_CONT); @@ -939,10 +928,10 @@ LLMemoryInfo& LLMemoryInfo::refresh() return *this; } -LLSD LLMemoryInfo::loadStatsArray() +LLSD LLMemoryInfo::loadStatsMap() { // This implementation is derived from stream() code (as of 2011-06-29). - StatsArray stats; + Stats stats; // associate timestamp for analysis over time stats.add("timestamp", LLDate::now()); @@ -1274,19 +1263,6 @@ LLSD LLMemoryInfo::loadStatsArray() return stats.get(); } -LLSD LLMemoryInfo::loadStatsMap(const LLSD& statsArray) -{ - LLSD statsMap; - - BOOST_FOREACH(LLSD pair, inArray(statsArray)) - { - // Specify asString() to disambiguate map indexing from array - // subscripting. - statsMap[pair[0].asString()] = pair[1]; - } - return statsMap; -} - std::ostream& operator<<(std::ostream& s, const LLOSInfo& info) { info.stream(s); diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 7fcb050ed0..739e795d3a 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -120,35 +120,23 @@ public: static void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb); // Retrieve a map of memory statistics. The keys of the map are platform- - // dependent. The values are in kilobytes. + // dependent. The values are in kilobytes to try to avoid integer overflow. LLSD getStatsMap() const; - // Retrieve memory statistics: an array of pair arrays [name, value]. This - // is the same data as presented in getStatsMap(), but it preserves the - // order in which we retrieved it from the OS in case that's useful. The - // set of statistics names is platform-dependent. The values are in - // kilobytes to try to avoid integer overflow. - LLSD getStatsArray() const; - - // Re-fetch memory data (as reported by stream() and getStats*()) from the + // Re-fetch memory data (as reported by stream() and getStatsMap()) from the // system. Normally this is fetched at construction time. Return (*this) // to permit usage of the form: // @code // LLMemoryInfo info; // ... - // info.refresh().getStatsArray(); + // info.refresh().getStatsMap(); // @endcode LLMemoryInfo& refresh(); private: - // These methods are used to set mStatsArray and mStatsMap. - static LLSD loadStatsArray(); - static LLSD loadStatsMap(const LLSD&); - - // Memory stats for getStatsArray(). It's straightforward to convert that - // to getStatsMap() form, less so to reconstruct the original order when - // converting the other way. - LLSD mStatsArray; + // set mStatsMap + static LLSD loadStatsMap(); + // Memory stats for getStatsMap(). LLSD mStatsMap; }; -- cgit v1.2.3 From f015c073cdbf32d90ff443eec0b31bbd6a94c102 Mon Sep 17 00:00:00 2001 From: jenn Date: Wed, 13 Jul 2011 00:16:43 +0000 Subject: Watchdog timeout now set to 60 seconds for long-term use (instead of 20, used during crash pile-on). Updated setting description field to describe how setting the value of WatchdogEnabled will affect Viewer behavior. --- indra/newview/app_settings/settings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4b62e376b5..2bd106a42e 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12578,13 +12578,13 @@ WatchdogEnabled Comment - Controls whether the thread watchdog timer is activated. + Controls whether the thread watchdog timer is activated. Value is watchdog timeout in seconds. Set to -1 to disable. Persist 0 Type S32 Value - 20 + 60 WaterGLFogDensityScale -- cgit v1.2.3 From 4e16dc26ab3fd0506ba800f124649259aec46136 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 12 Jul 2011 18:10:17 -0700 Subject: Changes to support SH-1894: Textures uploaded with Mesh do not appear in inventory. Reviewed by Andrew --- indra/newview/llmeshrepository.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'indra') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index a1f8f64627..4d9c324936 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -48,6 +48,7 @@ #include "llthread.h" #include "llvfile.h" #include "llviewercontrol.h" +#include "llviewerinventory.h" #include "llviewermenufile.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" @@ -1304,6 +1305,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) LLSD res; result["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); + result["texture_folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE); result["asset_type"] = "mesh"; result["inventory_type"] = "object"; result["description"] = "(No Description)"; @@ -2223,6 +2225,38 @@ void LLMeshRepository::notifyLoadedMeshes() LLAssetType::EType asset_type = LLAssetType::lookup(data.mPostData["asset_type"].asString()); LLInventoryType::EType inventory_type = LLInventoryType::lookup(data.mPostData["inventory_type"].asString()); + // Handle addition of texture, if any. + if ( data.mResponse.has("new_texture_folder_id") ) + { + const LLUUID& folder_id = data.mResponse["new_texture_folder_id"].asUUID(); + + if ( folder_id.notNull() ) + { + LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE); + + std::string name; + // Check if the server built a different name for the texture folder + if ( data.mResponse.has("new_texture_folder_name") ) + { + name = data.mResponse["new_texture_folder_name"].asString(); + } + else + { + name = data.mPostData["name"].asString(); + } + + // Add the category to the internal representation + LLPointer cat = + new LLViewerInventoryCategory(folder_id, parent_id, + LLFolderType::FT_NONE, name, gAgent.getID()); + cat->setVersion(LLViewerInventoryCategory::VERSION_UNKNOWN); + + LLInventoryModel::LLCategoryUpdate update(cat->getParentUUID(), 1); + gInventory.accountForUpdate(update); + gInventory.updateCategory(cat); + } + } + on_new_single_inventory_upload_complete( asset_type, inventory_type, @@ -2232,6 +2266,7 @@ void LLMeshRepository::notifyLoadedMeshes() data.mPostData["description"], data.mResponse, data.mResponse["upload_price"]); + //} mInventoryQ.pop(); } -- cgit v1.2.3 From a6a0d5dda70de972ca1e386534284e2e93f29903 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Jul 2011 13:55:04 -0400 Subject: SH-1637 FIX, SH-1638 FIX - fixes jittery camera problems --- indra/newview/llagent.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) mode change 100644 => 100755 indra/newview/llagent.cpp (limited to 'indra') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp old mode 100644 new mode 100755 index 8954937f69..492cfe7c1b --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -577,7 +577,10 @@ void LLAgent::setFlying(BOOL fly) // static void LLAgent::toggleFlying() { - LLToolPie::instance().stopClickToWalk(); + if ( gAgent.mAutoPilot ) + { + LLToolPie::instance().stopClickToWalk(); + } BOOL fly = !gAgent.getFlying(); -- cgit v1.2.3 From 561d40d5c316b4879ea56965f6b320e8e1c70a88 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 14 Jul 2011 01:07:01 -0500 Subject: SH-715 Disable simplify/analyze button while counterpart is executing. --- indra/llprimitive/llmodel.cpp | 2 -- indra/newview/llfloatermodelpreview.cpp | 33 ++++++++++++++++++++------------- 2 files changed, 20 insertions(+), 15 deletions(-) (limited to 'indra') diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index ba7abd4c79..434fb7650b 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -2284,8 +2284,6 @@ LLSD LLModel::Decomposition::asLLSD() const for (U32 k = 0; k < 3; k++) { - llassert(src[k] <= 0.51f && src[k] >= -0.51f); - //convert to 16-bit normalized across domain U16 val = (U16) (((src[k]-min.mV[k])/range.mV[k])*65535); diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 0748ed8039..ef846ec42e 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -780,19 +780,6 @@ void LLFloaterModelPreview::draw() childSetTextArg("prim_cost", "[PRIM_COST]", llformat("%d", mModelPreview->mResourceCost)); childSetTextArg("description_label", "[TEXTURES]", llformat("%d", mModelPreview->mTextureSet.size())); - if (!mCurRequest.empty()) - { - LLMutexLock lock(mStatusLock); - childSetTextArg("status", "[STATUS]", mStatusMessage); - } - else - { - childSetVisible("Simplify", true); - childSetVisible("simplify_cancel", false); - childSetVisible("Decompose", true); - childSetVisible("decompose_cancel", false); - } - if (mModelPreview) { gGL.color3f(1.f, 1.f, 1.f); @@ -992,12 +979,14 @@ void LLFloaterModelPreview::onPhysicsStageExecute(LLUICtrl* ctrl, void* data) sInstance->setStatusMessage(sInstance->getString("decomposing")); sInstance->childSetVisible("Decompose", false); sInstance->childSetVisible("decompose_cancel", true); + sInstance->childDisable("Simplify"); } else if (stage == "Simplify") { sInstance->setStatusMessage(sInstance->getString("simplifying")); sInstance->childSetVisible("Simplify", false); sInstance->childSetVisible("simplify_cancel", true); + sInstance->childDisable("Decompose"); } } } @@ -4345,6 +4334,24 @@ void LLModelPreview::updateStatusMessages() child->setEnabled(enable); child = panel->findNextSibling(child); } + + if (fmp->mCurRequest.empty()) + { + fmp->childSetVisible("Simplify", true); + fmp->childSetVisible("simplify_cancel", false); + fmp->childSetVisible("Decompose", true); + fmp->childSetVisible("decompose_cancel", false); + + if (phys_hulls > 0) + { + fmp->childEnable("Simplify"); + } + + if (phys_tris || phys_hulls > 0) + { + fmp->childEnable("Decompose"); + } + } } const char* lod_controls[] = -- cgit v1.2.3 From 9b7165121acd3fc93ef9b17354cca515cd6849cf Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 14 Jul 2011 11:36:32 -0400 Subject: Fix for Sh-2047: Partial joint arrays are now able to upload --- indra/newview/llfloatermodelpreview.cpp | 41 ++++++++------------------------- indra/newview/llfloatermodelpreview.h | 3 --- 2 files changed, 10 insertions(+), 34 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 0748ed8039..9ef5c6022e 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -2196,15 +2196,11 @@ void LLModelPreview::critiqueRigForUploadApplicability( const std::vectorchildDisable("ok_btn"); - } - else - if ( !isLegacyRigValid() ) - { - mFMP->childDisable("ok_btn"); - } - //ok_btn should not have been changed unless something was wrong with joint list + } } std::set accounted; @@ -4224,12 +4209,7 @@ void LLModelPreview::updateStatusMessages() if ( uploadingJointPositions && !isRigValidForJointPositionUpload() ) { skinAndRigOk = false; - } - else - if ( !isLegacyRigValid() ) - { - skinAndRigOk = false; - } + } } if(upload_ok && mModelLoader) @@ -4807,8 +4787,12 @@ BOOL LLModelPreview::render() mFMP->childSetValue("upload_joints", false); upload_joints = false; } - - mFMP->childSetEnabled("upload_joints", upload_skin); + + //Only enable joint offsets if it passed the earlier critiquing + if ( isRigValidForJointPositionUpload() ) + { + mFMP->childSetEnabled("upload_joints", upload_skin); + } F32 explode = mFMP->childGetValue("physics_explode").asReal(); @@ -5468,11 +5452,6 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible) { mCalculateBtn->setVisible( false ); } - else - if ( !mModelPreview->isLegacyRigValid() ) - { - mCalculateBtn->setVisible( false ); - } } mUploadBtn->setVisible(!visible); diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 3a5f7602fe..c24e171024 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -365,9 +365,6 @@ public: void setLoadState( U32 state ) { mLoadState = state; } U32 getLoadState() { return mLoadState; } - //setRestJointFlag: If an asset comes through that changes the joints, we want the reset to persist - void setResetJointFlag( bool state ) { if ( !mResetJoints ) mResetJoints = state; } - const bool getResetJointFlag( void ) const { return mResetJoints; } void setRigWithSceneParity( bool state ) { mRigParityWithScene = state; } const bool getRigWithSceneParity( void ) const { return mRigParityWithScene; } -- cgit v1.2.3 From f3dd16ac47ba937a92c3050c087d36c50674b06d Mon Sep 17 00:00:00 2001 From: Aaron Stone Date: Thu, 14 Jul 2011 12:38:24 -0700 Subject: STORM-1482 Little bit of Windows crash report value logging. --- indra/win_crash_logger/llcrashloggerwindows.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/win_crash_logger/llcrashloggerwindows.cpp b/indra/win_crash_logger/llcrashloggerwindows.cpp index 5e8725989c..170babbb98 100644 --- a/indra/win_crash_logger/llcrashloggerwindows.cpp +++ b/indra/win_crash_logger/llcrashloggerwindows.cpp @@ -296,6 +296,7 @@ void LLCrashLoggerWindows::gatherPlatformSpecificFiles() bool LLCrashLoggerWindows::mainLoop() { + llinfos << "CrashSubmitBehavior is " << mCrashBehavior << llendl; // Note: parent hwnd is 0 (the desktop). No dlg proc. See Petzold (5th ed) HexCalc example, Chapter 11, p529 // win_crash_logger.rc has been edited by hand. @@ -308,6 +309,7 @@ bool LLCrashLoggerWindows::mainLoop() if (mCrashBehavior == CRASH_BEHAVIOR_ALWAYS_SEND) { + llinfos << "Showing crash report submit progress window." << llendl; ShowWindow(gHwndProgress, SW_SHOW ); sendCrashLogs(); } -- cgit v1.2.3 From a89c58f01bac2bc0bafc69dc31eb6071b6ef8829 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 14 Jul 2011 17:18:53 -0400 Subject: Fix for SH-2061 model crashes viewer - fixed an issue where a corrupted dae would not disable the calc button --- indra/newview/llfloatermodelpreview.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 9ef5c6022e..9237f3a198 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1396,6 +1396,8 @@ bool LLModelLoader::doLoadModel() if (!dom) { + llinfos<<" Error with dae - traditionally indicates a corrupt file."<= LLModelLoader::ERROR_PARSING ) { mFMP->childDisable("ok_btn"); + mFMP->childDisable( "calculate_btn" ); } if (lod == mPreviewLOD) -- cgit v1.2.3 From 143db44c9abd40131e7246a020f706301f75af83 Mon Sep 17 00:00:00 2001 From: eli Date: Thu, 14 Jul 2011 15:23:23 -0700 Subject: FIX STORM-1494 remove duplicate ID and xml snippet --- indra/newview/skins/default/xui/en/menu_viewer.xml | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index e00586811b..317c6fe9ac 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2931,18 +2931,6 @@ function="Floater.Toggle" parameter="region_debug_console" /> - - - - Date: Thu, 14 Jul 2011 18:43:49 -0700 Subject: Potential fix for SH-1854 and SH-1125 (caps issues) --- indra/newview/llstartup.cpp | 19 +++ indra/newview/llviewerregion.cpp | 223 +++++++++++++++---------- indra/newview/llviewerregion.h | 7 +- indra/newview/llvoavatar.cpp | 5 +- indra/newview/skins/default/xui/en/strings.xml | 2 + 5 files changed, 164 insertions(+), 92 deletions(-) (limited to 'indra') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 4dfcb85295..46ff3d808a 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1242,6 +1242,25 @@ bool idle_startup() //--------------------------------------------------------------------- if(STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState()) { + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(gFirstSimHandle); + if (regionp->capabilitiesReceived()) + { + LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED ); + } + else + { + U32 num_retries = regionp->getNumSeedCapRetries(); + if (num_retries > 0) + { + LLStringUtil::format_map_t args; + args["[NUMBER]"] = llformat("%d", num_retries + 1); + set_startup_status(0.4f, LLTrans::getString("LoginRetrySeedCapGrant", args), gAgent.mMOTD); + } + else + { + set_startup_status(0.4f, LLTrans::getString("LoginRequestSeedCapGrant"), gAgent.mMOTD); + } + } return FALSE; } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 5b7492b66f..5be2234ec2 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -77,6 +77,13 @@ const F32 WATER_TEXTURE_SCALE = 8.f; // Number of times to repeat the water texture across a region const S16 MAX_MAP_DIST = 10; +// The server only keeps our pending agent info for 60 seconds. +// We want to allow for seed cap retry, but its not useful after that 60 seconds. +// Give it 3 chances, each at 18 seconds to give ourselves a few seconds to connect anyways if we give up. +const S32 MAX_SEED_CAP_ATTEMPTS_BEFORE_LOGIN = 3; +const F32 CAP_REQUEST_TIMEOUT = 18; +// Even though we gave up on login, keep trying for caps after we are logged in: +const S32 MAX_CAP_REQUEST_ATTEMPTS = 30; typedef std::map CapabilityMap; @@ -86,6 +93,10 @@ public: : mHost(host), mCompositionp(NULL), mEventPoll(NULL), + mSeedCapMaxAttempts(MAX_CAP_REQUEST_ATTEMPTS), + mSeedCapMaxAttemptsBeforeLogin(MAX_SEED_CAP_ATTEMPTS_BEFORE_LOGIN), + mSeedCapAttempts(0), + mHttpResponderID(0), // I'd prefer to set the LLCapabilityListener name to match the region // name -- it's disappointing that's not available at construction time. // We could instead store an LLCapabilityListener*, making @@ -100,6 +111,8 @@ public: { } + void buildCapabilityNames(LLSD& capabilityNames); + // The surfaces and other layers LLSurface* mLandp; @@ -132,6 +145,12 @@ public: LLEventPoll* mEventPoll; + S32 mSeedCapMaxAttempts; + S32 mSeedCapMaxAttemptsBeforeLogin; + S32 mSeedCapAttempts; + + S32 mHttpResponderID; + /// Post an event to this LLCapabilityListener to invoke a capability message on /// this LLViewerRegion's server /// (https://wiki.lindenlab.com/wiki/Viewer:Messaging/Messaging_Notes#Capabilities) @@ -139,8 +158,6 @@ public: //spatial partitions for objects in this region std::vector mObjectPartition; - - LLHTTPClient::ResponderPtr mHttpResponderPtr ; }; // support for secondlife:///app/region/{REGION} SLapps @@ -186,69 +203,51 @@ class BaseCapabilitiesComplete : public LLHTTPClient::Responder { LOG_CLASS(BaseCapabilitiesComplete); public: - BaseCapabilitiesComplete(LLViewerRegion* region, S32 retry = 0) - : mRegion(region), mRetry(retry) + BaseCapabilitiesComplete(U64 region_handle, S32 id) + : mRegionHandle(region_handle), mID(id) { } virtual ~BaseCapabilitiesComplete() - { - if(mRegion) - { - mRegion->setHttpResponderPtrNULL() ; - } - } - - void setRegion(LLViewerRegion* region) - { - mRegion = region ; - } + { } void error(U32 statusNum, const std::string& reason) { LL_WARNS2("AppInit", "Capabilities") << statusNum << ": " << reason << LL_ENDL; - - const S32 MAX_RETRIES = 5; - - if (mRetry < MAX_RETRIES) - { - std::string url = mRegion->getCapability("Seed"); - - mRetry++; - - llinfos << "retry " << mRetry << " posting to seed " << url << llendl; - - mRegion->setSeedCapability(url, mRetry); - } - else + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); + if (regionp) { - if (STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState()) - { - LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED ); - } + regionp->failedSeedCapability(); } } void result(const LLSD& content) { - if(!mRegion || LLHTTPClient::ResponderPtr(this) != mRegion->getHttpResponderPtr()) //region is removed or responder is not created. + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); + if(!regionp) //region was removed + { + LL_WARNS2("AppInit", "Capabilities") << "Received results for region that no longer exists!" << LL_ENDL; + return ; + } + if( mID != regionp->getHttpResponderID() ) // region is no longer referring to this responder { + LL_WARNS2("AppInit", "Capabilities") << "Received results for a stale http responder!" << LL_ENDL; return ; } LLSD::map_const_iterator iter; for(iter = content.beginMap(); iter != content.endMap(); ++iter) { - mRegion->setCapability(iter->first, iter->second); + regionp->setCapability(iter->first, iter->second); LL_DEBUGS2("AppInit", "Capabilities") << "got capability for " << iter->first << LL_ENDL; /* HACK we're waiting for the ServerReleaseNotes */ - if (iter->first == "ServerReleaseNotes" && mRegion->getReleaseNotesRequested()) + if (iter->first == "ServerReleaseNotes" && regionp->getReleaseNotesRequested()) { - mRegion->showReleaseNotes(); + regionp->showReleaseNotes(); } } - mRegion->setCapabilitiesReceived(true); + regionp->setCapabilitiesReceived(true); if (STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState()) { @@ -256,16 +255,15 @@ public: } } - static boost::intrusive_ptr build( - LLViewerRegion* region, S32 retry) + static boost::intrusive_ptr build( U64 region_handle, S32 id ) { - return boost::intrusive_ptr( - new BaseCapabilitiesComplete(region, retry)); + return boost::intrusive_ptr( + new BaseCapabilitiesComplete(region_handle, id) ); } private: - LLViewerRegion* mRegion; - S32 mRetry; + U64 mRegionHandle; + S32 mID; }; @@ -356,11 +354,6 @@ void LLViewerRegion::initStats() LLViewerRegion::~LLViewerRegion() { - if(mImpl->mHttpResponderPtr) - { - (static_cast(mImpl->mHttpResponderPtr.get()))->setRegion(NULL) ; - } - gVLManager.cleanupData(this); // Can't do this on destruction, because the neighbor pointers might be invalid. // This should be reference counted... @@ -907,14 +900,9 @@ U32 LLViewerRegion::getPacketsLost() const } } -void LLViewerRegion::setHttpResponderPtrNULL() -{ - mImpl->mHttpResponderPtr = NULL; -} - -const LLHTTPClient::ResponderPtr LLViewerRegion::getHttpResponderPtr() const +S32 LLViewerRegion::getHttpResponderID() const { - return mImpl->mHttpResponderPtr; + return mImpl->mHttpResponderID; } BOOL LLViewerRegion::pointInRegionGlobal(const LLVector3d &point_global) const @@ -1493,22 +1481,9 @@ void LLViewerRegion::unpackRegionHandshake() msg->sendReliable(host); } -void LLViewerRegion::setSeedCapability(const std::string& url, S32 retry) -{ - if (retry == 0 && getCapability("Seed") == url) - { - // llwarns << "Ignoring duplicate seed capability" << llendl; - return; - } - - delete mImpl->mEventPoll; - mImpl->mEventPoll = NULL; - - mImpl->mCapabilities.clear(); - setCapability("Seed", url); - - LLSD capabilityNames = LLSD::emptyArray(); +void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) +{ capabilityNames.append("AccountingParcel"); capabilityNames.append("AccountingSelection"); capabilityNames.append("AttachmentResources"); @@ -1582,46 +1557,118 @@ void LLViewerRegion::setSeedCapability(const std::string& url, S32 retry) // Please add new capabilities alphabetically to reduce // merge conflicts. +} + +void LLViewerRegion::setSeedCapability(const std::string& url) +{ + if (getCapability("Seed") == url) + { + // llwarns << "Ignoring duplicate seed capability" << llendl; + return; + } + + delete mImpl->mEventPoll; + mImpl->mEventPoll = NULL; + + mImpl->mCapabilities.clear(); + setCapability("Seed", url); + + LLSD capabilityNames = LLSD::emptyArray(); + mImpl->buildCapabilityNames(capabilityNames); llinfos << "posting to seed " << url << llendl; - mImpl->mHttpResponderPtr = BaseCapabilitiesComplete::build(this, retry) ; - LLHTTPClient::post(url, capabilityNames, mImpl->mHttpResponderPtr); + S32 id = ++mImpl->mHttpResponderID; + LLHTTPClient::post(url, capabilityNames, + BaseCapabilitiesComplete::build(getHandle(), id), + LLSD(), CAP_REQUEST_TIMEOUT); +} + +S32 LLViewerRegion::getNumSeedCapRetries() +{ + return mImpl->mSeedCapAttempts; +} + +void LLViewerRegion::failedSeedCapability() +{ + // Should we retry asking for caps? + mImpl->mSeedCapAttempts++; + std::string url = getCapability("Seed"); + if ( url.empty() ) + { + LL_WARNS2("AppInit", "Capabilities") << "Failed to get seed capabilities, and can not determine url for retries!" << LL_ENDL; + return; + } + // After a few attempts, continue login. We will keep trying once in-world: + if ( mImpl->mSeedCapAttempts >= mImpl->mSeedCapMaxAttemptsBeforeLogin && + STATE_SEED_GRANTED_WAIT == LLStartUp::getStartupState() ) + { + LLStartUp::setStartupState( STATE_SEED_CAP_GRANTED ); + } + + if ( mImpl->mSeedCapAttempts < mImpl->mSeedCapMaxAttempts) + { + LLSD capabilityNames = LLSD::emptyArray(); + mImpl->buildCapabilityNames(capabilityNames); + + llinfos << "posting to seed " << url << " (retry " + << mImpl->mSeedCapAttempts << ")" << llendl; + + S32 id = ++mImpl->mHttpResponderID; + LLHTTPClient::post(url, capabilityNames, + BaseCapabilitiesComplete::build(getHandle(), id), + LLSD(), CAP_REQUEST_TIMEOUT); + } + else + { + // *TODO: Give a user pop-up about this error? + LL_WARNS2("AppInit", "Capabilities") << "Failed to get seed capabilities from '" << url << "' after " << mImpl->mSeedCapAttempts << " attempts. Giving up!" << LL_ENDL; + } } class SimulatorFeaturesReceived : public LLHTTPClient::Responder { LOG_CLASS(SimulatorFeaturesReceived); public: - SimulatorFeaturesReceived(LLViewerRegion* region) - : mRegion(region) + SimulatorFeaturesReceived(const std::string& retry_url, U64 region_handle, + S32 attempt = 0, S32 max_attempts = MAX_CAP_REQUEST_ATTEMPTS) + : mRetryURL(retry_url), mRegionHandle(region_handle), mAttempt(attempt), mMaxAttempts(max_attempts) { } void error(U32 statusNum, const std::string& reason) { LL_WARNS2("AppInit", "SimulatorFeatures") << statusNum << ": " << reason << LL_ENDL; + retry(); } - + void result(const LLSD& content) { - if(!mRegion) //region is removed or responder is not created. + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); + if(!regionp) //region is removed or responder is not created. { + LL_WARNS2("AppInit", "SimulatorFeatures") << "Received results for region that no longer exists!" << LL_ENDL; return ; } - mRegion->setSimulatorFeatures(content); + regionp->setSimulatorFeatures(content); } - - static boost::intrusive_ptr build( - LLViewerRegion* region) - { - return boost::intrusive_ptr( - new SimulatorFeaturesReceived(region)); - } - + private: - LLViewerRegion* mRegion; + void retry() + { + if (mAttempt < mMaxAttempts) + { + mAttempt++; + LL_WARNS2("AppInit", "SimulatorFeatures") << "Re-trying '" << mRetryURL << "'. Retry #" << mAttempt << LL_ENDL; + LLHTTPClient::get(mRetryURL, new SimulatorFeaturesReceived(*this), LLSD(), CAP_REQUEST_TIMEOUT); + } + } + + std::string mRetryURL; + U64 mRegionHandle; + S32 mAttempt; + S32 mMaxAttempts; }; @@ -1640,7 +1687,7 @@ void LLViewerRegion::setCapability(const std::string& name, const std::string& u else if (name == "SimulatorFeatures") { // kick off a request for simulator features - LLHTTPClient::get(url, new SimulatorFeaturesReceived(this)); + LLHTTPClient::get(url, new SimulatorFeaturesReceived(url, getHandle()), LLSD(), CAP_REQUEST_TIMEOUT); } else { diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 0176969cea..b3c19ea58d 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -226,11 +226,12 @@ public: U32 getPacketsLost() const; - void setHttpResponderPtrNULL(); - const LLHTTPClient::ResponderPtr getHttpResponderPtr() const; + S32 getHttpResponderID() const; // Get/set named capability URLs for this region. - void setSeedCapability(const std::string& url, S32 retry = 0); + void setSeedCapability(const std::string& url); + void failedSeedCapability(); + S32 getNumSeedCapRetries(); void setCapability(const std::string& name, const std::string& url); // implements LLCapabilityProvider virtual std::string getCapability(const std::string& name) const; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5c977492d8..b5be3cd552 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1133,7 +1133,10 @@ void LLVOAvatar::initClass() llerrs << "Error parsing skeleton XML file: " << skeleton_path << llendl; } // parse avatar_lad.xml - llassert(!sAvatarXmlInfo); + if (sAvatarXmlInfo) + { //this can happen if a login attempt failed + deleteAndClear(sAvatarXmlInfo); + } sAvatarXmlInfo = new LLVOAvatarXmlInfo; if (!sAvatarXmlInfo->parseXmlSkeletonNode(root)) { diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 022c97f341..cb371edacf 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -43,6 +43,8 @@ Initializing QuickTime... QuickTime not found - unable to initialize. QuickTime initialized successfully. + Requesting region capabilities... + Requesting region capabilities, attempt [NUMBER]... Waiting for region handshake... Connecting to region... Downloading clothing... -- cgit v1.2.3 From 187844d5fcc5c489a2112df464d2f5b9d1c28a33 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 15 Jul 2011 19:15:30 +0300 Subject: STORM-1506 FIXED Reset the estate to global sun when changing region environment settings. By the way, moved estate info storage from the REGION/ESTATE floater to a model class. --- indra/newview/CMakeLists.txt | 4 +- indra/newview/llestateinfomodel.cpp | 230 +++++++++++++++++++++++ indra/newview/llestateinfomodel.h | 103 +++++++++++ indra/newview/llfloaterauction.cpp | 15 +- indra/newview/llfloaterregioninfo.cpp | 336 ++++++++-------------------------- indra/newview/llfloaterregioninfo.h | 19 +- 6 files changed, 423 insertions(+), 284 deletions(-) create mode 100644 indra/newview/llestateinfomodel.cpp create mode 100644 indra/newview/llestateinfomodel.h (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index da9a145423..935dd2e887 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -150,8 +150,9 @@ set(viewer_SOURCE_FILES lldrawpoolwlsky.cpp lldriverparam.cpp lldynamictexture.cpp - llenvmanager.cpp llemote.cpp + llenvmanager.cpp + llestateinfomodel.cpp lleventnotifier.cpp lleventpoll.cpp llexpandabletextbox.cpp @@ -711,6 +712,7 @@ set(viewer_HEADER_FILES lldynamictexture.h llemote.h llenvmanager.h + llestateinfomodel.h lleventnotifier.h lleventpoll.h llexpandabletextbox.h diff --git a/indra/newview/llestateinfomodel.cpp b/indra/newview/llestateinfomodel.cpp new file mode 100644 index 0000000000..7ed22d68f6 --- /dev/null +++ b/indra/newview/llestateinfomodel.cpp @@ -0,0 +1,230 @@ +/** + * @file llestateinfomodel.cpp + * @brief Estate info model + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llestateinfomodel.h" + +// libs +#include "llhttpclient.h" +#include "llregionflags.h" +#include "message.h" + +// viewer +#include "llagent.h" +#include "llfloaterregioninfo.h" // for invoice id +#include "llviewerregion.h" + +LLEstateInfoModel::LLEstateInfoModel() +: mID(0) +, mFlags(0) +, mSunHour(0) +{ +} + +boost::signals2::connection LLEstateInfoModel::setUpdateCallback(const update_signal_t::slot_type& cb) +{ + return mUpdateSignal.connect(cb); +} + +boost::signals2::connection LLEstateInfoModel::setCommitCallback(const update_signal_t::slot_type& cb) +{ + return mCommitSignal.connect(cb); +} + +void LLEstateInfoModel::sendEstateInfo() +{ + if (!commitEstateInfoCaps()) + { + // the caps method failed, try the old way + LLFloaterRegionInfo::nextInvoice(); + commitEstateInfoDataserver(); + } +} + +bool LLEstateInfoModel::getUseFixedSun() const { return mFlags & REGION_FLAGS_SUN_FIXED; } +bool LLEstateInfoModel::getIsExternallyVisible() const { return mFlags & REGION_FLAGS_EXTERNALLY_VISIBLE; } +bool LLEstateInfoModel::getAllowDirectTeleport() const { return mFlags & REGION_FLAGS_ALLOW_DIRECT_TELEPORT; } +bool LLEstateInfoModel::getDenyAnonymous() const { return mFlags & REGION_FLAGS_DENY_ANONYMOUS; } +bool LLEstateInfoModel::getDenyAgeUnverified() const { return mFlags & REGION_FLAGS_DENY_AGEUNVERIFIED; } +bool LLEstateInfoModel::getAllowVoiceChat() const { return mFlags & REGION_FLAGS_ALLOW_VOICE; } + +void LLEstateInfoModel::setUseFixedSun(bool val) { setFlag(REGION_FLAGS_SUN_FIXED, val); } +void LLEstateInfoModel::setIsExternallyVisible(bool val) { setFlag(REGION_FLAGS_EXTERNALLY_VISIBLE, val); } +void LLEstateInfoModel::setAllowDirectTeleport(bool val) { setFlag(REGION_FLAGS_ALLOW_DIRECT_TELEPORT, val); } +void LLEstateInfoModel::setDenyAnonymous(bool val) { setFlag(REGION_FLAGS_DENY_ANONYMOUS, val); } +void LLEstateInfoModel::setDenyAgeUnverified(bool val) { setFlag(REGION_FLAGS_DENY_AGEUNVERIFIED, val); } +void LLEstateInfoModel::setAllowVoiceChat(bool val) { setFlag(REGION_FLAGS_ALLOW_VOICE, val); } + +void LLEstateInfoModel::update(const strings_t& strings) +{ + // NOTE: LLDispatcher extracts strings with an extra \0 at the + // end. If we pass the std::string direct to the UI/renderer + // it draws with a weird character at the end of the string. + mName = strings[0].c_str(); + mOwnerID = LLUUID(strings[1].c_str()); + mID = strtoul(strings[2].c_str(), NULL, 10); + mFlags = strtoul(strings[3].c_str(), NULL, 10); + mSunHour = ((F32)(strtod(strings[4].c_str(), NULL)))/1024.0f; + + LL_DEBUGS("Windlight Sync") << "Received estate info: " + << "is_sun_fixed = " << getUseFixedSun() + << ", sun_hour = " << getSunHour() << LL_ENDL; + lldebugs << getInfoDump() << llendl; + + // Update region owner. + LLViewerRegion* regionp = gAgent.getRegion(); + regionp->setOwner(mOwnerID); + + // Let interested parties know that estate info has been updated. + mUpdateSignal(); +} + +void LLEstateInfoModel::notifyCommit() +{ + mCommitSignal(); +} + +//== PRIVATE STUFF ============================================================ + +class LLEstateChangeInfoResponder : public LLHTTPClient::Responder +{ +public: + + // if we get a normal response, handle it here + virtual void result(const LLSD& content) + { + llinfos << "Committed estate info" << llendl; + LLEstateInfoModel::instance().notifyCommit(); + } + + // if we get an error response + virtual void error(U32 status, const std::string& reason) + { + llwarns << "Failed to commit estate info (" << status << "): " << reason << llendl; + } +}; + +// tries to send estate info using a cap; returns true if it succeeded +bool LLEstateInfoModel::commitEstateInfoCaps() +{ + std::string url = gAgent.getRegion()->getCapability("EstateChangeInfo"); + + if (url.empty()) + { + // whoops, couldn't find the cap, so bail out + return false; + } + + LLSD body; + body["estate_name" ] = getName(); + body["sun_hour" ] = getSunHour(); + + body["is_sun_fixed" ] = getUseFixedSun(); + body["is_externally_visible"] = getIsExternallyVisible(); + body["allow_direct_teleport"] = getAllowDirectTeleport(); + body["deny_anonymous" ] = getDenyAnonymous(); + body["deny_age_unverified" ] = getDenyAgeUnverified(); + body["allow_voice_chat" ] = getAllowVoiceChat(); + + body["invoice" ] = LLFloaterRegionInfo::getLastInvoice(); + + LL_DEBUGS("Windlight Sync") << "Sending estate caps: " + << "is_sun_fixed = " << getUseFixedSun() + << ", sun_hour = " << getSunHour() << LL_ENDL; + lldebugs << body << LL_ENDL; + + // we use a responder so that we can re-get the data after committing to the database + LLHTTPClient::post(url, body, new LLEstateChangeInfoResponder); + return true; +} + +/* This is the old way of doing things, is deprecated, and should be + deleted when the dataserver model can be removed */ +// key = "estatechangeinfo" +// strings[0] = str(estate_id) (added by simulator before relay - not here) +// strings[1] = estate_name +// strings[2] = str(estate_flags) +// strings[3] = str((S32)(sun_hour * 1024.f)) +void LLEstateInfoModel::commitEstateInfoDataserver() +{ + LL_DEBUGS("Windlight Sync") << "Sending estate info: " + << "is_sun_fixed = " << getUseFixedSun() + << ", sun_hour = " << getSunHour() << LL_ENDL; + lldebugs << getInfoDump() << LL_ENDL; + + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("EstateOwnerMessage"); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used + + msg->nextBlock("MethodData"); + msg->addString("Method", "estatechangeinfo"); + msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice()); + + msg->nextBlock("ParamList"); + msg->addString("Parameter", getName()); + + msg->nextBlock("ParamList"); + msg->addString("Parameter", llformat("%u", getFlags())); + + msg->nextBlock("ParamList"); + msg->addString("Parameter", llformat("%d", (S32) (getSunHour() * 1024.0f))); + + gAgent.sendMessage(); +} + +void LLEstateInfoModel::setFlag(U32 flag, bool val) +{ + if (val) + { + mFlags |= flag; + } + else + { + mFlags &= ~flag; + } +} + +std::string LLEstateInfoModel::getInfoDump() +{ + LLSD dump; + dump["estate_name" ] = getName(); + dump["sun_hour" ] = getSunHour(); + + dump["is_sun_fixed" ] = getUseFixedSun(); + dump["is_externally_visible"] = getIsExternallyVisible(); + dump["allow_direct_teleport"] = getAllowDirectTeleport(); + dump["deny_anonymous" ] = getDenyAnonymous(); + dump["deny_age_unverified" ] = getDenyAgeUnverified(); + dump["allow_voice_chat" ] = getAllowVoiceChat(); + + std::stringstream dump_str; + dump_str << dump; + return dump_str.str(); +} diff --git a/indra/newview/llestateinfomodel.h b/indra/newview/llestateinfomodel.h new file mode 100644 index 0000000000..56391eda91 --- /dev/null +++ b/indra/newview/llestateinfomodel.h @@ -0,0 +1,103 @@ +/** + * @file llestateinfomodel.h + * @brief Estate info model + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLESTATEINFOMODEL_H +#define LL_LLESTATEINFOMODEL_H + +class LLMessageSystem; + +#include "llsingleton.h" + +/** + * Contains estate info, notifies interested parties of its changes. + */ +class LLEstateInfoModel : public LLSingleton +{ + LOG_CLASS(LLEstateInfoModel); + +public: + typedef boost::signals2::signal update_signal_t; + boost::signals2::connection setUpdateCallback(const update_signal_t::slot_type& cb); /// the model has been externally updated + boost::signals2::connection setCommitCallback(const update_signal_t::slot_type& cb); /// our changes have been applied + + void sendEstateInfo(); /// send estate info to the simulator + + // getters + bool getUseFixedSun() const; + bool getIsExternallyVisible() const; + bool getAllowDirectTeleport() const; + bool getDenyAnonymous() const; + bool getDenyAgeUnverified() const; + bool getAllowVoiceChat() const; + + const std::string& getName() const { return mName; } + const LLUUID& getOwnerID() const { return mOwnerID; } + U32 getID() const { return mID; } + F32 getSunHour() const { return getUseFixedSun() ? mSunHour : 0.f; } + + // setters + void setUseFixedSun(bool val); + void setIsExternallyVisible(bool val); + void setAllowDirectTeleport(bool val); + void setDenyAnonymous(bool val); + void setDenyAgeUnverified(bool val); + void setAllowVoiceChat(bool val); + + void setSunHour(F32 sun_hour) { mSunHour = sun_hour; } + +protected: + typedef std::vector strings_t; + + friend class LLSingleton; + friend class LLDispatchEstateUpdateInfo; + friend class LLEstateChangeInfoResponder; + + LLEstateInfoModel(); + + /// refresh model with data from the incoming server message + void update(const strings_t& strings); + + void notifyCommit(); + +private: + bool commitEstateInfoCaps(); + void commitEstateInfoDataserver(); + U32 getFlags() const { return mFlags; } + void setFlag(U32 flag, bool val); + std::string getInfoDump(); + + // estate info + std::string mName; /// estate name + LLUUID mOwnerID; /// estate owner id + U32 mID; /// estate id + U32 mFlags; /// estate flags + F32 mSunHour; /// estate sun hour + + update_signal_t mUpdateSignal; /// emitted when we receive update from sim + update_signal_t mCommitSignal; /// emitted when our update gets applied to sim +}; + +#endif // LL_LLESTATEINFOMODEL_H diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index c6743ca13b..2939d31087 100644 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -27,7 +27,6 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterauction.h" -#include "llfloaterregioninfo.h" #include "llgl.h" #include "llimagej2c.h" @@ -40,6 +39,7 @@ #include "llagent.h" #include "llcombobox.h" +#include "llestateinfomodel.h" #include "llmimetypes.h" #include "llnotifications.h" #include "llnotificationsutil.h" @@ -114,16 +114,9 @@ void LLFloaterAuction::initialize() getChildView("reset_parcel_btn")->setEnabled(TRUE); getChildView("start_auction_btn")->setEnabled(TRUE); - LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); - if (panel) - { // Only enable "Sell to Anyone" on Teen grid or if we don't know the ID yet - U32 estate_id = panel->getEstateID(); - getChildView("sell_to_anyone_btn")->setEnabled((estate_id == ESTATE_TEEN || estate_id == 0)); - } - else - { // Don't have the panel up, so don't know if we're on the teen grid or not. Default to enabling it - getChildView("sell_to_anyone_btn")->setEnabled(TRUE); - } + U32 estate_id = LLEstateInfoModel::instance().getID(); + // Only enable "Sell to Anyone" on Teen grid or if we don't know the ID yet + getChildView("sell_to_anyone_btn")->setEnabled(estate_id == ESTATE_TEEN || estate_id == 0); } else { diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index bedc7ef704..538c5e3b88 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -54,6 +54,7 @@ #include "llcombobox.h" #include "lldaycyclemanager.h" #include "llenvmanager.h" +#include "llestateinfomodel.h" #include "llfilepicker.h" #include "llfloatergodtools.h" // for send_sim_wide_deletes() #include "llfloatertopobjects.h" // added to fix SL-32336 @@ -1363,6 +1364,9 @@ LLPanelEstateInfo::LLPanelEstateInfo() : LLPanelRegionInfo(), mEstateID(0) // invalid { + LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); + estate_info.setCommitCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this)); + estate_info.setUpdateCallback(boost::bind(&LLPanelEstateInfo::refreshFromEstate, this)); } // static @@ -1385,29 +1389,6 @@ void LLPanelEstateInfo::initDispatch(LLDispatcher& dispatch) estate_dispatch_initialized = true; } -#ifndef TMP_DISABLE_WLES -// Disables the sun-hour slider and the use fixed time check if the use global time is check -void LLPanelEstateInfo::onChangeUseGlobalTime() -{ - bool enabled = !getChild("use_global_time_check")->getValue().asBoolean(); - getChildView("sun_hour_slider")->setEnabled(enabled); - getChildView("fixed_sun_check")->setEnabled(enabled); - getChild("fixed_sun_check")->setValue(LLSD(FALSE)); - enableButton("apply_btn"); -} - -// Enables the sun-hour slider if the fixed-sun checkbox is set -void LLPanelEstateInfo::onChangeFixedSun() -{ - bool enabled = !getChild("fixed_sun_check")->getValue().asBoolean(); - getChildView("use_global_time_check")->setEnabled(enabled); - getChild("use_global_time_check")->setValue(LLSD(FALSE)); - enableButton("apply_btn"); -} -#endif // TMP_DISABLE_WLES - - - //--------------------------------------------------------------------------- // Add/Remove estate access button callbacks //--------------------------------------------------------------------------- @@ -1610,10 +1591,7 @@ std::string all_estates_text() // static bool LLPanelEstateInfo::isLindenEstate() { - LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); - if (!panel) return false; - - U32 estate_id = panel->getEstateID(); + U32 estate_id = LLEstateInfoModel::instance().getID(); return (estate_id <= ESTATE_LAST_LINDEN); } @@ -1975,7 +1953,7 @@ void LLPanelEstateInfo::updateControls(LLViewerRegion* region) // Can't ban people from mainland, orientation islands, etc. because this // creates much network traffic and server load. // Disable their accounts in CSR tool instead. - bool linden_estate = (getEstateID() <= ESTATE_LAST_LINDEN); + bool linden_estate = isLindenEstate(); bool enable_ban = (god || owner || manager) && !linden_estate; getChildView("add_banned_avatar_btn")->setEnabled(enable_ban); getChildView("remove_banned_avatar_btn")->setEnabled(enable_ban); @@ -1987,6 +1965,8 @@ void LLPanelEstateInfo::updateControls(LLViewerRegion* region) getChildView("add_estate_manager_btn")->setEnabled(god || owner); getChildView("remove_estate_manager_btn")->setEnabled(god || owner); getChildView("estate_manager_name_list")->setEnabled(god || owner); + + refresh(); } bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) @@ -2093,10 +2073,13 @@ BOOL LLPanelEstateInfo::postBuild() void LLPanelEstateInfo::refresh() { + // Disable access restriction controls if they make no sense. bool public_access = getChild("externally_visible_check")->getValue().asBoolean(); + getChildView("Only Allow")->setEnabled(public_access); getChildView("limit_payment")->setEnabled(public_access); getChildView("limit_age_verified")->setEnabled(public_access); + // if this is set to false, then the limit fields are meaningless and should be turned off if (public_access == false) { @@ -2105,6 +2088,39 @@ void LLPanelEstateInfo::refresh() } } +void LLPanelEstateInfo::refreshFromEstate() +{ + const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); + + getChild("estate_name")->setValue(estate_info.getName()); + setOwnerName(LLSLURL("agent", estate_info.getOwnerID(), "inspect").getSLURLString()); + + getChild("externally_visible_check")->setValue(estate_info.getIsExternallyVisible()); + getChild("voice_chat_check")->setValue(estate_info.getAllowVoiceChat()); + getChild("allow_direct_teleport")->setValue(estate_info.getAllowDirectTeleport()); + getChild("limit_payment")->setValue(estate_info.getDenyAnonymous()); + getChild("limit_age_verified")->setValue(estate_info.getDenyAgeUnverified()); + + // If visible from mainland, disable the access allowed + // UI, as anyone can teleport there. + // However, gods need to be able to edit the access list for + // linden estates, regardless of visibility, to allow object + // and L$ transfers. + { + bool visible_from_mainland = estate_info.getIsExternallyVisible(); + bool god = gAgent.isGodlike(); + bool linden_estate = isLindenEstate(); + + bool enable_agent = (!visible_from_mainland || (god && linden_estate)); + bool enable_group = enable_agent; + bool enable_ban = !linden_estate; + + setAccessAllowedEnabled(enable_agent, enable_group, enable_ban); + } + + refresh(); +} + BOOL LLPanelEstateInfo::sendUpdate() { llinfos << "LLPanelEsateInfo::sendUpdate()" << llendl; @@ -2112,7 +2128,7 @@ BOOL LLPanelEstateInfo::sendUpdate() LLNotification::Params params("ChangeLindenEstate"); params.functor.function(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2)); - if (getEstateID() <= ESTATE_LAST_LINDEN) + if (isLindenEstate()) { // trying to change reserved estate, warn LLNotifications::instance().add(params); @@ -2131,13 +2147,21 @@ bool LLPanelEstateInfo::callbackChangeLindenEstate(const LLSD& notification, con switch(option) { case 0: - // send the update - if (!commitEstateInfoCaps()) { - // the caps method failed, try the old way - LLFloaterRegionInfo::nextInvoice(); - commitEstateInfoDataserver(); + LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); + + // update model + estate_info.setUseFixedSun(false); // we don't support fixed sun estates anymore + estate_info.setIsExternallyVisible(getChild("externally_visible_check")->getValue().asBoolean()); + estate_info.setAllowDirectTeleport(getChild("allow_direct_teleport")->getValue().asBoolean()); + estate_info.setDenyAnonymous(getChild("limit_payment")->getValue().asBoolean()); + estate_info.setDenyAgeUnverified(getChild("limit_age_verified")->getValue().asBoolean()); + estate_info.setAllowVoiceChat(getChild("voice_chat_check")->getValue().asBoolean()); + + // send the update to sim + estate_info.sendEstateInfo(); } + // we don't want to do this because we'll get it automatically from the sim // after the spaceserver processes it // else @@ -2194,6 +2218,8 @@ public: // if we get a normal response, handle it here virtual void result(const LLSD& content) { + LL_INFOS("Windlight") << "Successfully committed estate info" << llendl; + // refresh the panel from the database LLPanelEstateInfo* panel = dynamic_cast(mpPanel.get()); if (panel) @@ -2210,178 +2236,6 @@ private: LLHandle mpPanel; }; -// tries to send estate info using a cap; returns true if it succeeded -bool LLPanelEstateInfo::commitEstateInfoCaps() -{ - std::string url = gAgent.getRegion()->getCapability("EstateChangeInfo"); - - if (url.empty()) - { - // whoops, couldn't find the cap, so bail out - return false; - } - - LLSD body; - body["estate_name"] = getEstateName(); - - body["is_externally_visible"] = getChild("externally_visible_check")->getValue().asBoolean(); - body["allow_direct_teleport"] = getChild("allow_direct_teleport")->getValue().asBoolean(); - body["deny_anonymous" ] = getChild("limit_payment")->getValue().asBoolean(); - body["deny_age_unverified" ] = getChild("limit_age_verified")->getValue().asBoolean(); - body["allow_voice_chat" ] = getChild("voice_chat_check")->getValue().asBoolean(); - body["invoice" ] = LLFloaterRegionInfo::getLastInvoice(); - - // block fly is in estate database but not in estate UI, so we're not supporting it - //body["block_fly" ] = getChild("")->getValue().asBoolean(); - - F32 sun_hour = getSunHour(); - if (getChild("use_global_time_check")->getValue().asBoolean()) - { - sun_hour = 0.f; // 0 = global time - } - body["sun_hour"] = sun_hour; - - // we use a responder so that we can re-get the data after committing to the database - LLHTTPClient::post(url, body, new LLEstateChangeInfoResponder(this)); - return true; -} - -/* This is the old way of doing things, is deprecated, and should be - deleted when the dataserver model can be removed */ -// key = "estatechangeinfo" -// strings[0] = str(estate_id) (added by simulator before relay - not here) -// strings[1] = estate_name -// strings[2] = str(estate_flags) -// strings[3] = str((S32)(sun_hour * 1024.f)) -void LLPanelEstateInfo::commitEstateInfoDataserver() -{ - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("EstateOwnerMessage"); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used - - msg->nextBlock("MethodData"); - msg->addString("Method", "estatechangeinfo"); - msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice()); - - msg->nextBlock("ParamList"); - msg->addString("Parameter", getEstateName()); - - std::string buffer; - buffer = llformat("%u", computeEstateFlags()); - msg->nextBlock("ParamList"); - msg->addString("Parameter", buffer); - - F32 sun_hour = getSunHour(); - if (getChild("use_global_time_check")->getValue().asBoolean()) - { - sun_hour = 0.f; // 0 = global time - } - - buffer = llformat("%d", (S32)(sun_hour*1024.0f)); - msg->nextBlock("ParamList"); - msg->addString("Parameter", buffer); - - gAgent.sendMessage(); -} - -void LLPanelEstateInfo::setEstateFlags(U32 flags) -{ - getChild("externally_visible_check")->setValue(LLSD(flags & REGION_FLAGS_EXTERNALLY_VISIBLE ? TRUE : FALSE) ); - getChild("voice_chat_check")->setValue( - LLSD(flags & REGION_FLAGS_ALLOW_VOICE ? TRUE : FALSE)); - getChild("allow_direct_teleport")->setValue(LLSD(flags & REGION_FLAGS_ALLOW_DIRECT_TELEPORT ? TRUE : FALSE) ); - getChild("limit_payment")->setValue(LLSD(flags & REGION_FLAGS_DENY_ANONYMOUS ? TRUE : FALSE) ); - getChild("limit_age_verified")->setValue(LLSD(flags & REGION_FLAGS_DENY_AGEUNVERIFIED ? TRUE : FALSE) ); - - refresh(); -} - -U32 LLPanelEstateInfo::computeEstateFlags() -{ - U32 flags = 0; - - if (getChild("externally_visible_check")->getValue().asBoolean()) - { - flags |= REGION_FLAGS_EXTERNALLY_VISIBLE; - } - - if ( getChild("voice_chat_check")->getValue().asBoolean() ) - { - flags |= REGION_FLAGS_ALLOW_VOICE; - } - - if (getChild("allow_direct_teleport")->getValue().asBoolean()) - { - flags |= REGION_FLAGS_ALLOW_DIRECT_TELEPORT; - } - - if (getChild("limit_payment")->getValue().asBoolean()) - { - flags |= REGION_FLAGS_DENY_ANONYMOUS; - } - - if (getChild("limit_age_verified")->getValue().asBoolean()) - { - flags |= REGION_FLAGS_DENY_AGEUNVERIFIED; - } - - - return flags; -} - -BOOL LLPanelEstateInfo::getGlobalTime() -{ - return getChild("use_global_time_check")->getValue().asBoolean(); -} - -void LLPanelEstateInfo::setGlobalTime(bool b) -{ - getChild("use_global_time_check")->setValue(LLSD(b)); - getChildView("fixed_sun_check")->setEnabled(LLSD(!b)); - getChildView("sun_hour_slider")->setEnabled(LLSD(!b)); - if (b) - { - getChild("sun_hour_slider")->setValue(LLSD(0.f)); - } -} - - -BOOL LLPanelEstateInfo::getFixedSun() -{ - return getChild("fixed_sun_check")->getValue().asBoolean(); -} - -void LLPanelEstateInfo::setSunHour(F32 sun_hour) -{ - if(sun_hour < 6.0f) - { - sun_hour = 24.0f + sun_hour; - } - getChild("sun_hour_slider")->setValue(LLSD(sun_hour)); -} - -F32 LLPanelEstateInfo::getSunHour() -{ - if (getChildView("sun_hour_slider")->getEnabled()) - { - return (F32)getChild("sun_hour_slider")->getValue().asReal(); - } - return 0.f; -} - -const std::string LLPanelEstateInfo::getEstateName() const -{ - return getChild("estate_name")->getValue().asString(); -} - -void LLPanelEstateInfo::setEstateName(const std::string& name) -{ - getChild("estate_name")->setValue(LLSD(name)); -} - const std::string LLPanelEstateInfo::getOwnerName() const { return getChild("estate_owner")->getValue().asString(); @@ -2884,55 +2738,10 @@ bool LLDispatchEstateUpdateInfo::operator()( { lldebugs << "Received estate update" << llendl; - LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); - if (!panel) return true; - - // NOTE: LLDispatcher extracts strings with an extra \0 at the - // end. If we pass the std::string direct to the UI/renderer - // it draws with a weird character at the end of the string. - std::string estate_name = strings[0].c_str(); // preserve c_str() call! - panel->setEstateName(estate_name); - - LLViewerRegion* regionp = gAgent.getRegion(); - - LLUUID owner_id(strings[1]); - regionp->setOwner(owner_id); - // Update estate owner name in UI - std::string owner_name = LLSLURL("agent", owner_id, "inspect").getSLURLString(); - panel->setOwnerName(owner_name); - - U32 estate_id = strtoul(strings[2].c_str(), NULL, 10); - panel->setEstateID(estate_id); - - U32 flags = strtoul(strings[3].c_str(), NULL, 10); - panel->setEstateFlags(flags); - - F32 sun_hour = ((F32)(strtod(strings[4].c_str(), NULL)))/1024.0f; - if(sun_hour == 0 && (flags & REGION_FLAGS_SUN_FIXED ? FALSE : TRUE)) - { - lldebugs << "Estate uses global time" << llendl; - panel->setGlobalTime(TRUE); - } - else - { - lldebugs << "Estate sun hour: " << sun_hour << llendl; - panel->setGlobalTime(FALSE); - panel->setSunHour(sun_hour); - } - - bool visible_from_mainland = (bool)(flags & REGION_FLAGS_EXTERNALLY_VISIBLE); - bool god = gAgent.isGodlike(); - bool linden_estate = (estate_id <= ESTATE_LAST_LINDEN); - - // If visible from mainland, disable the access allowed - // UI, as anyone can teleport there. - // However, gods need to be able to edit the access list for - // linden estates, regardless of visibility, to allow object - // and L$ transfers. - bool enable_agent = (!visible_from_mainland || (god && linden_estate)); - bool enable_group = enable_agent; - bool enable_ban = !linden_estate; - panel->setAccessAllowedEnabled(enable_agent, enable_group, enable_ban); + // Update estate info model. + // This will call LLPanelEstateInfo::refreshFromEstate(). + // *TODO: Move estate message handling stuff to llestateinfomodel.cpp. + LLEstateInfoModel::instance().update(strings); return true; } @@ -3275,6 +3084,20 @@ void LLPanelEnvironmentInfo::sendRegionSunUpdate() region_info.sendRegionTerrain(LLFloaterRegionInfo::getLastInvoice()); } +void LLPanelEnvironmentInfo::fixEstateSun() +{ + // We don't support fixed sun estates anymore and need to fix + // such estates for region day cycle to take effect. + // *NOTE: Assuming that current estate settings have arrived already. + LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); + if (estate_info.getUseFixedSun()) + { + llinfos << "Switching estate to global sun" << llendl; + estate_info.setUseFixedSun(false); + estate_info.sendEstateInfo(); + } +} + void LLPanelEnvironmentInfo::populateWaterPresetsList() { mWaterPresetCombo->removeall(); @@ -3668,6 +3491,9 @@ void LLPanelEnvironmentInfo::onRegionSettingsApplied(bool ok) // That is caused by the simulator re-sending the region info, which in turn makes us // re-request and display old region environment settings while the new ones haven't been applied yet. sendRegionSunUpdate(); + + // Switch estate to not using fixed sun for the region day cycle to work properly (STORM-1506). + fixEstateSun(); } else { diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index e7917c382c..c1fef57ac9 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -304,23 +304,9 @@ public: virtual BOOL postBuild(); virtual void updateChild(LLUICtrl* child_ctrl); virtual void refresh(); - - U32 computeEstateFlags(); - void setEstateFlags(U32 flags); - - BOOL getGlobalTime(); - void setGlobalTime(bool b); - - BOOL getFixedSun(); // *TODO: deprecated - F32 getSunHour(); // *TODO: deprecated - void setSunHour(F32 sun_hour); // *TODO: deprecated + void refreshFromEstate(); - const std::string getEstateName() const; - void setEstateName(const std::string& name); - - U32 getEstateID() const { return mEstateID; } - void setEstateID(U32 estate_id) { mEstateID = estate_id; } static bool isLindenEstate(); const std::string getOwnerName() const; @@ -334,8 +320,6 @@ protected: // confirmation dialog callback bool callbackChangeLindenEstate(const LLSD& notification, const LLSD& response); - void commitEstateInfoDataserver(); - bool commitEstateInfoCaps(); void commitEstateAccess(); void commitEstateManagers(); @@ -434,6 +418,7 @@ private: void setDirty(bool dirty); void sendRegionSunUpdate(); + void fixEstateSun(); void populateWaterPresetsList(); void populateSkyPresetsList(); -- cgit v1.2.3 From a517d32c4877aec79219cd346709c621c51c032b Mon Sep 17 00:00:00 2001 From: Aaron Stone Date: Fri, 15 Jul 2011 12:46:06 -0700 Subject: STORM-1482 Change the defaults, look in the app_settings dir for configs as well. --- indra/llcrashlogger/llcrashlogger.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 3fbaf61991..93f3c910bd 100644 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -67,7 +67,7 @@ public: }; LLCrashLogger::LLCrashLogger() : - mCrashBehavior(CRASH_BEHAVIOR_ASK), + mCrashBehavior(CRASH_BEHAVIOR_ALWAYS_SEND), mCrashInPreviousExec(false), mCrashSettings("CrashSettings"), mSentCrashLogs(false), @@ -274,12 +274,19 @@ const char* const CRASH_SETTINGS_FILE = "settings_crash_behavior.xml"; S32 LLCrashLogger::loadCrashBehaviorSetting() { + // First check user_settings (in the user's home dir) std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE); + if (! mCrashSettings.loadFromFile(filename)) + { + // Next check app_settings (in the SL program dir) + std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, CRASH_SETTINGS_FILE); + mCrashSettings.loadFromFile(filename); + } - mCrashSettings.loadFromFile(filename); - + // If we didn't load any files above, this will return the default S32 value = mCrashSettings.getS32("CrashSubmitBehavior"); + // Whatever value we got, make sure it's valid switch (value) { case CRASH_BEHAVIOR_NEVER_SEND: @@ -391,14 +398,14 @@ bool LLCrashLogger::init() // Set the log file to crashreport.log LLError::logToFile(log_file); - mCrashSettings.declareS32("CrashSubmitBehavior", CRASH_BEHAVIOR_ASK, + mCrashSettings.declareS32("CrashSubmitBehavior", CRASH_BEHAVIOR_ALWAYS_SEND, "Controls behavior when viewer crashes " "(0 = ask before sending crash report, " "1 = always send crash report, " "2 = never send crash report)"); - llinfos << "Loading crash behavior setting" << llendl; - mCrashBehavior = loadCrashBehaviorSetting(); + // llinfos << "Loading crash behavior setting" << llendl; + // mCrashBehavior = loadCrashBehaviorSetting(); // If user doesn't want to send, bail out if (mCrashBehavior == CRASH_BEHAVIOR_NEVER_SEND) -- cgit v1.2.3 From dba72d25659d2a83cefaf17738cc14e5e7eabe28 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 15 Jul 2011 17:10:36 -0400 Subject: storm-1510: update to new login display url --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llviewernetwork.cpp | 2 +- indra/newview/tests/llviewernetwork_test.cpp | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 91cbfde07f..5ad62d28c0 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4872,7 +4872,7 @@ Type String Value - + http://viewer-login.agni.lindenlab.com/ LosslessJ2CUpload diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index a59afdc28a..ef5c65eb87 100644 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -35,7 +35,7 @@ #include "llweb.h" -const char* DEFAULT_LOGIN_PAGE = "http://secondlife.com/app/login/"; +const char* DEFAULT_LOGIN_PAGE = "http://viewer-login.agni.lindenlab.com/"; const char* SYSTEM_GRID_SLURL_BASE = "secondlife://%s/secondlife/"; const char* MAIN_GRID_SLURL_BASE = "http://maps.secondlife.com/secondlife/"; diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index dd7761475e..3c89b64d52 100644 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -164,7 +164,7 @@ namespace tut std::string("https://secondlife.com/helpers/")); ensure_equals("Agni login page is correct", grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("http://secondlife.com/app/login/")); + std::string("http://viewer-login.agni.lindenlab.com/")); ensure("Agni is a favorite", grid.has(GRID_IS_FAVORITE_VALUE)); ensure("Agni is a system grid", @@ -208,7 +208,7 @@ namespace tut std::string("https://secondlife.com/helpers/")); ensure_equals("Agni login page the same after grid file", grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("http://secondlife.com/app/login/")); + std::string("http://viewer-login.agni.lindenlab.com/")); ensure("Agni still a favorite after grid file", grid.has(GRID_IS_FAVORITE_VALUE)); ensure("Agni system grid still set after grid file", @@ -310,7 +310,7 @@ namespace tut std::string("http://aditi-secondlife.webdev.lindenlab.com/helpers/")); ensure_equals("Override known grid login uri: login page is not set", grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("http://secondlife.com/app/login/")); + std::string("http://viewer-login.agni.lindenlab.com/")); // Override with loginuri // override custom grid @@ -359,7 +359,7 @@ namespace tut std::string("https://my.helper.uri/mycustomhelpers")); ensure_equals("Override known grid helper uri: login page is not changed", grid[GRID_LOGIN_PAGE_VALUE].asString(), - std::string("http://secondlife.com/app/login/")); + std::string("http://viewer-login.agni.lindenlab.com/")); // Override with helperuri // override custom grid @@ -451,9 +451,9 @@ namespace tut ensure_equals("getHelperURI", LLGridManager::getInstance()->getHelperURI(), std::string("https://secondlife.com/helpers/")); ensure_equals("getLoginPage", LLGridManager::getInstance()->getLoginPage(), - std::string("http://secondlife.com/app/login/")); + std::string("http://viewer-login.agni.lindenlab.com/")); ensure_equals("getLoginPage2", LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"), - std::string("http://secondlife.com/app/login/")); + std::string("http://viewer-login.agni.lindenlab.com/")); ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid()); std::vector uris; LLGridManager::getInstance()->getLoginURIs(uris); -- cgit v1.2.3 From 5267378577c6e1ca98cdaa6be601550b53b8692f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 15 Jul 2011 17:01:25 -0600 Subject: fix for SH-1786: [PUBLIC] Turning off Lights and Shadows disables Glow --- indra/newview/llviewercontrol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 87ca80260f..65da232f1c 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -404,7 +404,7 @@ static bool handleRenderDeferredChanged(const LLSD& newvalue) gPipeline.releaseGLBuffers(); gPipeline.createGLBuffers(); gPipeline.resetVertexBuffers(); - if (LLPipeline::sRenderDeferred && LLRenderTarget::sUseFBO) + if (LLPipeline::sRenderDeferred == (BOOL)LLRenderTarget::sUseFBO) { LLViewerShaderMgr::instance()->setShaders(); } -- cgit v1.2.3 From 5f99d30c20bd4e23d17bbf78d2112f21ee840169 Mon Sep 17 00:00:00 2001 From: Aaron Stone Date: Fri, 15 Jul 2011 16:25:32 -0700 Subject: STORM-1482 Always run the crash loggers, they will check what to do and how to clean up. --- indra/newview/llappviewer.cpp | 5 ++- indra/newview/llappviewerlinux.cpp | 63 ++++++++++++++++---------------------- indra/newview/llappviewerwin32.cpp | 6 +--- 3 files changed, 29 insertions(+), 45 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 6763881094..92e0513464 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2823,7 +2823,7 @@ bool LLAppViewer::initWindow() // Need to load feature table before cheking to start watchdog. bool use_watchdog = false; int watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled"); - if(watchdog_enabled_setting == -1) + if (watchdog_enabled_setting == -1) { use_watchdog = !LLFeatureManager::getInstance()->isFeatureAvailable("WatchdogDisabled"); } @@ -2833,8 +2833,7 @@ bool LLAppViewer::initWindow() use_watchdog = bool(watchdog_enabled_setting); } - bool send_reports = gCrashSettings.getS32("CrashSubmitBehavior") != CRASH_BEHAVIOR_NEVER_SEND; - if(use_watchdog && send_reports) + if (use_watchdog) { LLWatchdog::getInstance()->init(watchdog_killer_callback); } diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 08d4f49147..48d02dfeaa 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -361,46 +361,35 @@ void LLAppViewerLinux::handleCrashReporting(bool reportFreeze) } else { - const S32 cb = gCrashSettings.getS32("CrashSubmitBehavior"); - - // Always generate the report, have the logger do the asking, and - // don't wait for the logger before exiting (-> total cleanup). - if (CRASH_BEHAVIOR_NEVER_SEND != cb) - { - // launch the actual crash logger - const char* ask_dialog = "-dialog"; - if (CRASH_BEHAVIOR_ASK != cb) - ask_dialog = ""; // omit '-dialog' option - const char * cmdargv[] = - {cmd.c_str(), - ask_dialog, - "-user", - (char*)LLGridManager::getInstance()->getGridLabel().c_str(), - "-name", - LLAppViewer::instance()->getSecondLifeTitle().c_str(), - NULL}; - fflush(NULL); - pid_t pid = fork(); - if (pid == 0) - { // child - execv(cmd.c_str(), (char* const*) cmdargv); /* Flawfinder: ignore */ - llwarns << "execv failure when trying to start " << cmd << llendl; - _exit(1); // avoid atexit() + // launch the actual crash logger + const char * cmdargv[] = + {cmd.c_str(), + "-user", + (char*)LLGridManager::getInstance()->getGridLabel().c_str(), + "-name", + LLAppViewer::instance()->getSecondLifeTitle().c_str(), + NULL}; + fflush(NULL); + pid_t pid = fork(); + if (pid == 0) + { // child + execv(cmd.c_str(), (char* const*) cmdargv); /* Flawfinder: ignore */ + llwarns << "execv failure when trying to start " << cmd << llendl; + _exit(1); // avoid atexit() + } + else + { + if (pid > 0) + { + // DO NOT wait for child proc to die; we want + // the logger to outlive us while we quit to + // free up the screen/keyboard/etc. + ////int childExitStatus; + ////waitpid(pid, &childExitStatus, 0); } else { - if (pid > 0) - { - // DO NOT wait for child proc to die; we want - // the logger to outlive us while we quit to - // free up the screen/keyboard/etc. - ////int childExitStatus; - ////waitpid(pid, &childExitStatus, 0); - } - else - { - llwarns << "fork failure." << llendl; - } + llwarns << "fork failure." << llendl; } } // Sometimes signals don't seem to quit the viewer. Also, we may diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 9280234ac3..f94c843ad9 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -518,11 +518,7 @@ void LLAppViewerWin32::handleCrashReporting(bool reportFreeze) } else { - S32 cb = gCrashSettings.getS32("CrashSubmitBehavior"); - if(cb != CRASH_BEHAVIOR_NEVER_SEND) - { - _spawnl(_P_NOWAIT, exe_path.c_str(), arg_str, NULL); - } + _spawnl(_P_NOWAIT, exe_path.c_str(), arg_str, NULL); } } -- cgit v1.2.3 From 86a806137be05b4be812a121fb6dc91dfacd037f Mon Sep 17 00:00:00 2001 From: jenn Date: Fri, 15 Jul 2011 23:26:19 +0000 Subject: After review and testing, realized that 'WatchdogEnabled' is actually true to its name, and is a boolean, not a timeout value. 'MainloopTimeoutDefault' is the actual timeout value. Updated descriptions and values accordingly to set Watchdog timeout to 60 seconds. --- indra/newview/app_settings/settings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 2bd106a42e..1dfc84a4f7 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4894,7 +4894,7 @@ Type F32 Value - 20.0 + 60.0 MapOverlayIndex @@ -12578,13 +12578,13 @@ WatchdogEnabled Comment - Controls whether the thread watchdog timer is activated. Value is watchdog timeout in seconds. Set to -1 to disable. + Controls whether the thread watchdog timer is activated. Value is boolean. Set to -1 to defer to built-in default. Persist 0 Type S32 Value - 60 + 1 WaterGLFogDensityScale -- cgit v1.2.3 From ec2d528952b15eb7d74202246d4841867c6e3a60 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 18 Jul 2011 08:30:21 -0400 Subject: re-enable the watchdog --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 91cbfde07f..4b62e376b5 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12584,7 +12584,7 @@ Type S32 Value - -1 + 20 WaterGLFogDensityScale -- cgit v1.2.3 From 50d271a2ae28334b7dc1170d6222b3b4125fac6b Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 18 Jul 2011 08:31:32 -0400 Subject: increment viewer version to 2.8.2 --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 0018b8e844..6c1d233425 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 2; const S32 LL_VERSION_MINOR = 8; -const S32 LL_VERSION_PATCH = 1; +const S32 LL_VERSION_PATCH = 2; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3 From 5707ccf570f71eb8439af775b86d9520dd5862c9 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 18 Jul 2011 12:09:32 -0600 Subject: fix for SH-1904: Medallion .dae makes viewer crash during upload --- indra/newview/llmeshrepository.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 78e2716be2..7ddc0db20d 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1399,7 +1399,8 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) instance_entry["face_list"] = LLSD::emptyArray(); - for (S32 face_num = 0; face_num < data.mBaseModel->getNumVolumeFaces(); face_num++) + S32 end = llmin((S32)data.mBaseModel->mMaterialList.size(), data.mBaseModel->getNumVolumeFaces()) ; + for (S32 face_num = 0; face_num < end; face_num++) { LLImportMaterial& material = instance.mMaterial[data.mBaseModel->mMaterialList[face_num]]; LLSD face_entry = LLSD::emptyMap(); -- cgit v1.2.3 From 030b24188a290f63bec70cf4072f463e5dc6ee6a Mon Sep 17 00:00:00 2001 From: eli Date: Mon, 18 Jul 2011 11:09:58 -0700 Subject: sync with viewer-development --- indra/newview/skins/default/xui/en/panel_preferences_setup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index 1c22a5c02e..e639f0dc9d 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -268,7 +268,7 @@ height="23" layout="topleft" left_delta="50" - top_pad="5" + top_pad="5" name="updater_service_combobox" width="300"> Date: Mon, 18 Jul 2011 18:50:57 -0700 Subject: Adding support for viewer reading mesh params from an alternative param type. --- indra/llprimitive/llprimitive.h | 1 + indra/newview/llviewerobject.cpp | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'indra') diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 76faa1b8c5..8903d8e049 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -103,6 +103,7 @@ public: PARAMS_LIGHT = 0x20, PARAMS_SCULPT = 0x30, PARAMS_LIGHT_IMAGE = 0x40, + PARAMS_MESH = 0x50, }; public: diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index bbe929b7f7..b5fdca632b 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4877,6 +4877,10 @@ void LLViewerObject::adjustAudioGain(const F32 gain) bool LLViewerObject::unpackParameterEntry(U16 param_type, LLDataPacker *dp) { + if (LLNetworkData::PARAMS_MESH == param_type) + { + param_type = LLNetworkData::PARAMS_SCULPT; + } ExtraParameter* param = getExtraParameterEntryCreate(param_type); if (param) { -- cgit v1.2.3 From e8b71e0585ab126f9e77da93d6830a1a73a7aa92 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 18 Jul 2011 18:57:40 -0700 Subject: Changed mesh param type to not conflict with one in-use on server --- indra/llprimitive/llprimitive.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 8903d8e049..998016f8f6 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -103,7 +103,8 @@ public: PARAMS_LIGHT = 0x20, PARAMS_SCULPT = 0x30, PARAMS_LIGHT_IMAGE = 0x40, - PARAMS_MESH = 0x50, + PARAMS_RESERVED = 0x50, // Used on server-side + PARAMS_MESH = 0x60, }; public: -- cgit v1.2.3 From 41635a8dfda707d86acb6f38d39a699758d40a8e Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 19 Jul 2011 14:18:03 -0500 Subject: SH-2090 Make meshes that fail to load render as prim proxy. --- indra/newview/llvovolume.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 4723ec9bd1..a620244fab 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -966,7 +966,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo S32 lod = mLOD; BOOL is404 = FALSE; - + if (isSculpted()) { // if it's a mesh @@ -1017,6 +1017,8 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo if (is404) { setIcon(LLViewerTextureManager::getFetchedTextureFromFile("icons/Inv_Mesh.png", TRUE, LLViewerTexture::BOOST_UI)); + //render prim proxy when mesh loading attempts give up + volume_params.setSculptID(LLUUID::null, LL_SCULPT_TYPE_NONE); } if ((LLPrimitive::setVolume(volume_params, lod, (mVolumeImpl && mVolumeImpl->isVolumeUnique()))) || mSculptChanged) -- cgit v1.2.3 From c37603d9ce2be463b76f8f179177a79537bae399 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 20 Jul 2011 14:05:13 -0400 Subject: fix for sh-1847: Removed assert when a vert is outside [-5,5] domain --- indra/llprimitive/llmodel.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra') diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 434fb7650b..ea0ea931af 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -2329,8 +2329,6 @@ LLSD LLModel::Decomposition::asLLSD() const for (U32 k = 0; k < 3; k++) { - llassert(v[k] <= 0.51f && v[k] >= -0.51f); - //convert to 16-bit normalized across domain U16 val = (U16) (((v[k]-min.mV[k])/range.mV[k])*65535); -- cgit v1.2.3 From f45eb335df21bfacba3de679751627f219760283 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 20 Jul 2011 17:12:49 -0500 Subject: SH-715 Fix for bad "cancel" behavior in physics tab. --- indra/newview/llfloatermodelpreview.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 203be5bb1f..e045cf6729 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1032,6 +1032,11 @@ void LLFloaterModelPreview::onPhysicsStageCancel(LLUICtrl* ctrl, void*data) } sInstance->mCurRequest.clear(); + + if (sInstance->mModelPreview) + { + sInstance->mModelPreview->updateStatusMessages(); + } } } @@ -4296,7 +4301,7 @@ void LLModelPreview::updateStatusMessages() //fmp->childSetEnabled("physics_optimize", !use_hull); - bool enable = phys_tris > 0 || phys_hulls > 0; + bool enable = (phys_tris > 0 || phys_hulls > 0) && fmp->mCurRequest.empty(); //enable = enable && !use_hull && fmp->childGetValue("physics_optimize").asBoolean(); //enable/disable "analysis" UI @@ -4308,7 +4313,7 @@ void LLModelPreview::updateStatusMessages() child = panel->findNextSibling(child); } - enable = phys_hulls > 0; + enable = phys_hulls > 0 && fmp->mCurRequest.empty(); //enable/disable "simplification" UI panel = fmp->getChild("physics simplification"); child = panel->getFirstChild(); @@ -4335,6 +4340,11 @@ void LLModelPreview::updateStatusMessages() fmp->childEnable("Decompose"); } } + else + { + fmp->childEnable("simplify_cancel"); + fmp->childEnable("decompose_cancel"); + } } const char* lod_controls[] = -- cgit v1.2.3 From 4a04458ff560b139c9adf50092a531eb0729652b Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 25 Jul 2011 10:45:05 -0400 Subject: Partial fix for sh-1925. --- indra/newview/llfloatermodelpreview.cpp | 53 ++++++++++++++++++++++++--------- indra/newview/llfloatermodelpreview.h | 2 +- 2 files changed, 40 insertions(+), 15 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index e045cf6729..5ea8dd07ff 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -1543,8 +1543,7 @@ bool LLModelLoader::doLoadModel() LLMatrix4 trans = normalized_transformation; trans *= skin_info.mBindShapeMatrix; - skin_info.mBindShapeMatrix = trans; - + skin_info.mBindShapeMatrix = trans; } @@ -1747,15 +1746,15 @@ bool LLModelLoader::doLoadModel() } } - model->mSkinInfo.mInvBindMatrix.push_back(mat); + model->mSkinInfo.mInvBindMatrix.push_back(mat); } } } } } - //Now that we've parsed the joint array, let's determine if we have a full rig - //(which means we have all the joints that are required for an avatar versus + //Now that we've parsed the jointa werray, let's determine if we have a full rig + //(which means we have all the joint sthat are required for an avatar versus //a skinned asset attached to a node in a file that contains an entire skeleton, //but does not use the skeleton). buildJointToNodeMappingFromScene( root ); @@ -2159,15 +2158,29 @@ void LLModelLoader::processJointToNodeMapping( domNode* pNode ) mJointsFromNode.push_front( pNode->getName() ); } //2. Handle the kiddo's - daeTArray< daeSmartRef > childOfChild = pNode->getChildren(); - S32 childOfChildCount = childOfChild.getCount(); - for (S32 i = 0; i < childOfChildCount; ++i) + processChildJoints( pNode ); + } + else + { + //Determine if the're any children wrt to this failed node. + //This occurs when an armature is exported and ends up being what essentially amounts to + //as the root for the visual_scene + processChildJoints( pNode ); + } +} +//----------------------------------------------------------------------------- +// processChildJoint() +//----------------------------------------------------------------------------- +void LLModelLoader::processChildJoints( domNode* pParentNode ) +{ + daeTArray< daeSmartRef > childOfChild = pParentNode->getChildren(); + S32 childOfChildCount = childOfChild.getCount(); + for (S32 i = 0; i < childOfChildCount; ++i) + { + domNode* pChildNode = daeSafeCast( childOfChild[i] ); + if ( pChildNode ) { - domNode* pChildNode = daeSafeCast( childOfChild[i] ); - if ( pChildNode ) - { - processJointToNodeMapping( pChildNode ); - } + processJointToNodeMapping( pChildNode ); } } } @@ -2353,8 +2366,20 @@ void LLModelLoader::loadTextures() //----------------------------------------------------------------------------- bool LLModelLoader::isNodeAJoint( domNode* pNode ) { - if ( !pNode || pNode->getName() == NULL) + if ( !pNode ) { + llinfos<<"Created node is NULL"<getName() == NULL ) + { + llinfos<<"Parsed node has no name "<getId() ) + { + llinfos<<"Parsed node ID: "<getId()< mJointMap; -- cgit v1.2.3 From 9395bcee52a9786185d90c52a22564b1d975e4ea Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 25 Jul 2011 17:42:22 -0400 Subject: Fix for sh-2162 --- indra/newview/llfloatermodelpreview.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 5ea8dd07ff..62b8d03281 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4967,18 +4967,22 @@ BOOL LLModelPreview::render() if (textures) { - const std::string& binding = instance.mModel->mMaterialList[i]; - const LLImportMaterial& material = instance.mMaterial[binding]; + int materialCnt = instance.mModel->mMaterialList.size(); + if ( i < materialCnt ) + { + const std::string& binding = instance.mModel->mMaterialList[i]; + const LLImportMaterial& material = instance.mMaterial[binding]; - llassert(binding == model->mMaterialList[i]); + llassert(binding == model->mMaterialList[i]); - glColor4fv(material.mDiffuseColor.mV); - if (material.mDiffuseMap.notNull()) - { - if (material.mDiffuseMap->getDiscardLevel() > -1) + glColor4fv(material.mDiffuseColor.mV); + if (material.mDiffuseMap.notNull()) { - gGL.getTexUnit(0)->bind(material.mDiffuseMap, true); - mTextureSet.insert(material.mDiffuseMap.get()); + if (material.mDiffuseMap->getDiscardLevel() > -1) + { + gGL.getTexUnit(0)->bind(material.mDiffuseMap, true); + mTextureSet.insert(material.mDiffuseMap.get()); + } } } } -- cgit v1.2.3 From b27e860c1e7d3c8ec1b3f7f540a22175b160cea1 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 25 Jul 2011 21:09:40 -0500 Subject: SH-1856 Fix for shininess not working on rigged meshes when hardware skinning is disabled. --- indra/newview/llviewershadermgr.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index e473901609..5579473b8b 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -166,6 +166,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gWLCloudProgram); mShaderList.push_back(&gAvatarProgram); mShaderList.push_back(&gObjectShinyProgram); + mShaderList.push_back(&gObjectShinyNonIndexedProgram); mShaderList.push_back(&gWaterProgram); mShaderList.push_back(&gAvatarEyeballProgram); mShaderList.push_back(&gObjectSimpleProgram); @@ -190,6 +191,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() : mShaderList.push_back(&gObjectFullbrightWaterProgram); mShaderList.push_back(&gAvatarWaterProgram); mShaderList.push_back(&gObjectShinyWaterProgram); + mShaderList.push_back(&gObjectShinyNonIndexedWaterProgram); mShaderList.push_back(&gUnderWaterProgram); mShaderList.push_back(&gDeferredSunProgram); mShaderList.push_back(&gDeferredBlurLightProgram); -- cgit v1.2.3 From f79a058f3ce50361b732061ab30f4a1923fba445 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 25 Jul 2011 21:23:01 -0500 Subject: SH-1874 Make UI reflect that a mesh cannot be made flexible. --- indra/newview/llpanelvolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index bb87601d20..12eea7844d 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -351,7 +351,7 @@ void LLPanelVolume::getState( ) getChild("Flexible1D Checkbox Ctrl")->setValue(is_flexible); if (is_flexible || (volobjp && volobjp->canBeFlexible())) { - getChildView("Flexible1D Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp); + getChildView("Flexible1D Checkbox Ctrl")->setEnabled(editable && single_volume && volobjp && !volobjp->isMesh()); } else { -- cgit v1.2.3