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/llfloaterregioninfo.cpp | 148 +++++++++++++++++++++++++++++++++- 1 file changed, 146 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') 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())) -- 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/llfloaterregioninfo.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') 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) -- cgit v1.2.3 From 758fdbfe125d75bd2253a69337eab7fec7406ecf Mon Sep 17 00:00:00 2001 From: "tiggs@lindenlab.com" Date: Wed, 23 Feb 2011 17:44:18 -0500 Subject: STORM-1126 WIP Windlight Estate Settings port from 1.23: baseline: read only windlight works (resubmitted by Vadim ProductEngine) --- indra/newview/llfloaterregioninfo.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 7617b98f20..1f42b483d7 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1403,17 +1403,18 @@ bool LLPanelRegionTerrainInfo::callbackBakeTerrain(const LLSD& notification, con void LLPanelRegionTerrainInfo::onOpenAdvancedSky(void* userData) { - LLFloaterWindLight::show(LLEnvKey::SCOPE_REGION); +// LLFloaterWindLight::show(LLEnvKey::SCOPE_REGION); } void LLPanelRegionTerrainInfo::onOpenAdvancedWater(void* userData) { - LLFloaterWater::instance()->show(LLEnvKey::SCOPE_REGION); +// LLFloaterWater::instance()->show(LLEnvKey::SCOPE_REGION); } void LLPanelRegionTerrainInfo::onUseEstateTime(void* userData) { +#if 0 if(LLFloaterWindLight::isOpen()) { // select the blank value in @@ -1423,6 +1424,7 @@ void LLPanelRegionTerrainInfo::onUseEstateTime(void* userData) } LLWLParamManager::getInstance()->mAnimator.activate(LLWLAnimator::TIME_LINDEN); +#endif } /////////////////////////////////////////////////////// @@ -1431,29 +1433,36 @@ void LLPanelRegionTerrainInfo::onUseEstateTime(void* userData) // Handle commit of WL settings to region void LLPanelRegionTerrainInfo::onCommitRegionWL(void* userData) { +#if 0 LLEnvManager::getInstance()->commitSettings(LLEnvKey::SCOPE_REGION); LLEnvManager::getInstance()->maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false); +#endif } // Handle cancel of WL settings for region void LLPanelRegionTerrainInfo::onCancelRegionWL(void* userData) { +#if 0 LLEnvManager::getInstance()->maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false); +#endif } // Handle reversion of region WL settings to default void LLPanelRegionTerrainInfo::onSetRegionToDefaultWL(void* userData) { +#if 0 LLEnvManager::instance().resetInternalsToDefault(LLEnvKey::SCOPE_REGION); LLEnvManager::instance().startEditingScope(LLEnvKey::SCOPE_REGION); +#endif } void LLPanelRegionTerrainInfo::cancelChanges() { - LLFloaterWindLight::instance()->closeFloater(); - LLFloaterWater::instance()->closeFloater(); - LLFloaterDayCycle::instance()->closeFloater(); - +#if 0 + LLFloaterWindLight::instance().closeFloater(); + LLFloaterWater::instance().closeFloater(); + LLFloaterDayCycle::instance().closeFloater(); +#endif // disable commmit and cancel LLPanelRegionTerrainInfo::instance()->setCommitControls(false); } -- cgit v1.2.3 From 79fb8e2ec26dc2c5a42ef1ee48ebaaa39183c67b Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 31 Mar 2011 18:24:01 +0300 Subject: STORM-1126 WIP Windlight Estate Settings integration: pass 4 Changes: * Fixed incorrect way to pass parameters to notifications. * Fixed crashes in the Advanced Sky floater and the Region Terrain panel. * Fixed initialization and multiple instantiation of the Day Cycle floater (that might lead to incorrect behavior). * Fixed and re-enabled committing env. settings changes to region. * Fixed day cycle and sky settings being sent as empty arrays and therefore not passing validation on server. It is now possible to change region environment settings. * Added debug messages. --- indra/newview/llfloaterregioninfo.cpp | 54 +++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 21 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 1f42b483d7..874cc1a030 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -408,6 +408,23 @@ LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant() return panel; } +// static +LLPanelRegionTerrainInfo* LLFloaterRegionInfo::getPanelRegionTerrain() +{ + LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance("region_info"); + if (!floater) + { + llassert(floater); + return NULL; + } + + LLTabContainer* tab_container = floater->getChild("region_panels"); + LLPanelRegionTerrainInfo* panel = + dynamic_cast(tab_container->getChild("Terrain")); + llassert(panel); + return panel; +} + void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region) { if (!region) @@ -1158,20 +1175,23 @@ void LLPanelRegionTextureInfo::onClickDump(void* data) // Initialize statics LLPanelRegionTerrainInfo* LLPanelRegionTerrainInfo::sPanelRegionTerrainInfo = NULL; +// static LLPanelRegionTerrainInfo* LLPanelRegionTerrainInfo::instance() { if (!sPanelRegionTerrainInfo) { - sPanelRegionTerrainInfo = new LLPanelRegionTerrainInfo(); + sPanelRegionTerrainInfo = LLFloaterRegionInfo::getPanelRegionTerrain(); + lldebugs << llformat("Instantiating sPanelRegionTerrainInfo: %p", sPanelRegionTerrainInfo) << llendl; } return sPanelRegionTerrainInfo; } -// virtual -void LLPanelRegionTerrainInfo::closeFloater(bool app_quitting) +// static +void LLPanelRegionTerrainInfo::onFloaterClose(bool app_quitting) { if (sPanelRegionTerrainInfo) { + lldebugs << "Setting LLPanelRegionTerrainInfo to NULL" << llendl; sPanelRegionTerrainInfo = NULL; } } @@ -1181,6 +1201,7 @@ BOOL LLPanelRegionTerrainInfo::postBuild() LLPanelRegionInfo::postBuild(); sPanelRegionTerrainInfo = this; // singleton instance pointer + lldebugs << llformat("Setting sPanelRegionTerrainInfo to: %p", sPanelRegionTerrainInfo) << llendl; initCtrl("water_height_spin"); initCtrl("terrain_raise_spin"); @@ -1403,18 +1424,17 @@ bool LLPanelRegionTerrainInfo::callbackBakeTerrain(const LLSD& notification, con void LLPanelRegionTerrainInfo::onOpenAdvancedSky(void* userData) { -// LLFloaterWindLight::show(LLEnvKey::SCOPE_REGION); + LLFloaterWindLight::show(LLEnvKey::SCOPE_REGION); } void LLPanelRegionTerrainInfo::onOpenAdvancedWater(void* userData) { -// LLFloaterWater::instance()->show(LLEnvKey::SCOPE_REGION); + LLFloaterWater::show(LLEnvKey::SCOPE_REGION); } void LLPanelRegionTerrainInfo::onUseEstateTime(void* userData) { -#if 0 if(LLFloaterWindLight::isOpen()) { // select the blank value in @@ -1424,7 +1444,6 @@ void LLPanelRegionTerrainInfo::onUseEstateTime(void* userData) } LLWLParamManager::getInstance()->mAnimator.activate(LLWLAnimator::TIME_LINDEN); -#endif } /////////////////////////////////////////////////////// @@ -1433,36 +1452,29 @@ void LLPanelRegionTerrainInfo::onUseEstateTime(void* userData) // Handle commit of WL settings to region void LLPanelRegionTerrainInfo::onCommitRegionWL(void* userData) { -#if 0 LLEnvManager::getInstance()->commitSettings(LLEnvKey::SCOPE_REGION); LLEnvManager::getInstance()->maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false); -#endif } // Handle cancel of WL settings for region void LLPanelRegionTerrainInfo::onCancelRegionWL(void* userData) { -#if 0 LLEnvManager::getInstance()->maybeClearEditingScope(LLEnvKey::SCOPE_REGION, true, false); -#endif } // Handle reversion of region WL settings to default void LLPanelRegionTerrainInfo::onSetRegionToDefaultWL(void* userData) { -#if 0 LLEnvManager::instance().resetInternalsToDefault(LLEnvKey::SCOPE_REGION); LLEnvManager::instance().startEditingScope(LLEnvKey::SCOPE_REGION); -#endif } void LLPanelRegionTerrainInfo::cancelChanges() { -#if 0 - LLFloaterWindLight::instance().closeFloater(); - LLFloaterWater::instance().closeFloater(); - LLFloaterDayCycle::instance().closeFloater(); -#endif + LLFloaterReg::hideInstance("env_windlight"); + LLFloaterReg::hideInstance("env_water"); + LLFloaterReg::hideInstance("env_day_cycle"); + // disable commmit and cancel LLPanelRegionTerrainInfo::instance()->setCommitControls(false); } @@ -2140,14 +2152,14 @@ bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) return rv; } -void LLFloaterRegionInfo::closeFloater(bool app_quitting) +// virtual +void LLFloaterRegionInfo::onClose(bool app_quitting) { if(!app_quitting) { LLEnvManager::getInstance()->maybeClearEditingScope(true, false); - LLPanelRegionTerrainInfo::closeFloater(app_quitting); + LLPanelRegionTerrainInfo::onFloaterClose(app_quitting); } - LLFloater::closeFloater(app_quitting); } void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl) -- cgit v1.2.3 From 7419abc12ba07380593fa3c0571155b248b8c8a6 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 31 Mar 2011 18:24:01 +0300 Subject: STORM-1126 WIP Windlight Estate Settings integration: pass 5 * Added "Apply Local to Region" button to the region terrain setttings panel. * Fixed previewing presets via a combomox in the Advanced Sky Editor floater. --- indra/newview/llfloaterregioninfo.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 874cc1a030..c09baf1e09 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1225,6 +1225,7 @@ BOOL LLPanelRegionTerrainInfo::postBuild() childSetAction("WLRegionApply", onCommitRegionWL, this); childSetAction("WLRegionCancel", onCancelRegionWL, this); childSetAction("WLRegionDefault", onSetRegionToDefaultWL, this); + childSetAction("WLCurrentApply", onApplyCurrentWL, this); return TRUE; } @@ -1469,6 +1470,13 @@ void LLPanelRegionTerrainInfo::onSetRegionToDefaultWL(void* userData) LLEnvManager::instance().startEditingScope(LLEnvKey::SCOPE_REGION); } +// static +void LLPanelRegionTerrainInfo::onApplyCurrentWL(void* userData) +{ + // Immediately apply current environment settings to region. + LLEnvManager::instance().applyLocalSettingsToRegion(); +} + void LLPanelRegionTerrainInfo::cancelChanges() { LLFloaterReg::hideInstance("env_windlight"); -- cgit v1.2.3 From fc71ae3e69e78a2e34832418c6c120c9e633bbb6 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 18 Apr 2011 22:13:49 +0300 Subject: STORM-1180 FIX Temporarily disabled region environment controls. Besides, adding a workaround for a crash on exit I've experienced. --- indra/newview/llfloaterregioninfo.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 085d118c52..2acb0936dc 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -92,6 +92,8 @@ const S32 TERRAIN_TEXTURE_COUNT = 4; const S32 CORNER_COUNT = 4; +#define TMP_DISABLE_WLES // STORM-1180 + ///---------------------------------------------------------------------------- /// Local class declaration ///---------------------------------------------------------------------------- @@ -1217,6 +1219,7 @@ BOOL LLPanelRegionTerrainInfo::postBuild() childSetAction("upload_raw_btn", onClickUploadRaw, this); childSetAction("bake_terrain_btn", onClickBakeTerrain, this); +#ifdef TMP_DISABLE_WLES // WL advanced buttons childSetAction("EnvAdvancedSkyButton", onOpenAdvancedSky, this); childSetAction("EnvAdvancedWaterButton", onOpenAdvancedWater, this); @@ -1227,6 +1230,7 @@ BOOL LLPanelRegionTerrainInfo::postBuild() childSetAction("WLRegionCancel", onCancelRegionWL, this); childSetAction("WLRegionDefault", onSetRegionToDefaultWL, this); childSetAction("WLCurrentApply", onApplyCurrentWL, this); +#endif return TRUE; } @@ -1264,17 +1268,27 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) void LLPanelRegionTerrainInfo::setEnvControls(bool available) { +#ifdef TMP_DISABLE_WLES + available = false; + getChild("wl_settings_unavailable")->setValue("Temporarily disabled."); +#endif + 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("WLCurrentApply")->setVisible(available); getChildView("wl_settings_unavailable")->setVisible(!available); } void LLPanelRegionTerrainInfo::setCommitControls(bool available) { +#ifdef TMP_DISABLE_WLES + available = false; +#endif + getChildView("WLRegionApply")->setEnabled(available); getChildView("WLRegionCancel")->setEnabled(available); refresh(); -- cgit v1.2.3 From 3d0688da9461766d783383d68a990fcf8711228e Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Tue, 17 May 2011 16:27:09 +0300 Subject: STORM-1205 ADDITIONAL FIX Add "Environment" tab to the "Region/Estate" floater - Set tab Environment to the right place (tab order) in the Region\Estate floater - Updated Environment tab content according the spec --- indra/newview/llfloaterregioninfo.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 2acb0936dc..5bf6140f02 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -201,6 +201,11 @@ BOOL LLFloaterRegionInfo::postBuild() panel->buildFromFile("panel_region_terrain.xml"); mTab->addTabPanel(panel); + panel = new LLPanelEnvironmentInfo; + mInfoPanels.push_back(panel); + panel->buildFromFile("panel_region_environment.xml"); + mTab->addTabPanel(panel); + panel = new LLPanelEstateInfo; mInfoPanels.push_back(panel); panel->buildFromFile("panel_region_estate.xml"); -- cgit v1.2.3 From 5fbd88568be9647ecb2a7d0e15bd61379dab196e Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 19 May 2011 22:50:02 -0400 Subject: STORM-1265: code changes for merging the Terrain and Ground Textures tabs --- indra/newview/llfloaterregioninfo.cpp | 362 ++++++++++------------------------ 1 file changed, 101 insertions(+), 261 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 5bf6140f02..1457ec245b 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -93,6 +93,7 @@ const S32 TERRAIN_TEXTURE_COUNT = 4; const S32 CORNER_COUNT = 4; #define TMP_DISABLE_WLES // STORM-1180 +#define TMP_REGION_TERRAIN_REMOVE // STORM-1265 ///---------------------------------------------------------------------------- /// Local class declaration @@ -191,11 +192,6 @@ BOOL LLFloaterRegionInfo::postBuild() panel->buildFromFile("panel_region_debug.xml"); mTab->addTabPanel(panel); - panel = new LLPanelRegionTextureInfo; - mInfoPanels.push_back(panel); - panel->buildFromFile("panel_region_texture.xml"); - mTab->addTabPanel(panel); - panel = new LLPanelRegionTerrainInfo; mInfoPanels.push_back(panel); panel->buildFromFile("panel_region_terrain.xml"); @@ -385,12 +381,16 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel->getChild("water_height_spin")->setValue(LLSD(water_height)); panel->getChild("terrain_raise_spin")->setValue(LLSD(terrain_raise_limit)); panel->getChild("terrain_lower_spin")->setValue(LLSD(terrain_lower_limit)); + +#ifndef TMP_REGION_TERRAIN_REMOVE panel->getChild("use_estate_sun_check")->setValue(LLSD(use_estate_sun)); panel->getChild("fixed_sun_check")->setValue(LLSD((BOOL)(region_flags & REGION_FLAGS_SUN_FIXED))); panel->getChildView("fixed_sun_check")->setEnabled(allow_modify && !use_estate_sun); panel->getChild("sun_hour_slider")->setValue(LLSD(sun_hour)); panel->getChildView("sun_hour_slider")->setEnabled(allow_modify && !use_estate_sun); +#endif TMP_REGION_TERRAIN_REMOVE + panel->setCtrlsEnabled(allow_modify); floater->refreshFromRegion( gAgent.getRegion() ); @@ -1002,131 +1002,7 @@ void LLPanelRegionDebugInfo::onClickCancelRestart(void* data) } -///////////////////////////////////////////////////////////////////////////// -// LLPanelRegionTextureInfo -// -LLPanelRegionTextureInfo::LLPanelRegionTextureInfo() : LLPanelRegionInfo() -{ - // nothing. -} - -bool LLPanelRegionTextureInfo::refreshFromRegion(LLViewerRegion* region) -{ - BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); - setCtrlsEnabled(allow_modify); - getChildView("apply_btn")->setEnabled(FALSE); - - if (region) - { - getChild("region_text")->setValue(LLSD(region->getName())); - } - else - { - getChild("region_text")->setValue(LLSD("")); - } - - if (!region) return LLPanelRegionInfo::refreshFromRegion(region); - - LLVLComposition* compp = region->getComposition(); - LLTextureCtrl* texture_ctrl; - std::string buffer; - for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) - { - buffer = llformat("texture_detail_%d", i); - texture_ctrl = getChild(buffer); - if(texture_ctrl) - { - lldebugs << "Detail Texture " << i << ": " - << compp->getDetailTextureID(i) << llendl; - LLUUID tmp_id(compp->getDetailTextureID(i)); - texture_ctrl->setImageAssetID(tmp_id); - } - } - - for(S32 i = 0; i < CORNER_COUNT; ++i) - { - buffer = llformat("height_start_spin_%d", i); - getChild(buffer)->setValue(LLSD(compp->getStartHeight(i))); - buffer = llformat("height_range_spin_%d", i); - getChild(buffer)->setValue(LLSD(compp->getHeightRange(i))); - } - - // Call the parent for common book-keeping - return LLPanelRegionInfo::refreshFromRegion(region); -} - - -BOOL LLPanelRegionTextureInfo::postBuild() -{ - LLPanelRegionInfo::postBuild(); - std::string buffer; - for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) - { - buffer = llformat("texture_detail_%d", i); - initCtrl(buffer); - } - - for(S32 i = 0; i < CORNER_COUNT; ++i) - { - buffer = llformat("height_start_spin_%d", i); - initCtrl(buffer); - buffer = llformat("height_range_spin_%d", i); - initCtrl(buffer); - } - -// LLButton* btn = ("dump", LLRect(0, 20, 100, 0), "", onClickDump, this); -// btn->setFollows(FOLLOWS_TOP|FOLLOWS_LEFT); -// addChild(btn); - - return LLPanelRegionInfo::postBuild(); -} - -BOOL LLPanelRegionTextureInfo::sendUpdate() -{ - llinfos << "LLPanelRegionTextureInfo::sendUpdate()" << llendl; - - // Make sure user hasn't chosen wacky textures. - if (!validateTextureSizes()) - { - return FALSE; - } - - LLTextureCtrl* texture_ctrl; - std::string buffer; - std::string id_str; - LLMessageSystem* msg = gMessageSystem; - strings_t strings; - - LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); - - for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) - { - buffer = llformat("texture_detail_%d", i); - texture_ctrl = getChild(buffer); - if(texture_ctrl) - { - LLUUID tmp_id(texture_ctrl->getImageAssetID()); - tmp_id.toString(id_str); - buffer = llformat("%d %s", i, id_str.c_str()); - strings.push_back(buffer); - } - } - sendEstateOwnerMessage(msg, "texturedetail", invoice, strings); - strings.clear(); - for(S32 i = 0; i < CORNER_COUNT; ++i) - { - buffer = llformat("height_start_spin_%d", i); - std::string buffer2 = llformat("height_range_spin_%d", i); - std::string buffer3 = llformat("%d %f %f", i, (F32)getChild(buffer)->getValue().asReal(), (F32)getChild(buffer2)->getValue().asReal()); - strings.push_back(buffer3); - } - sendEstateOwnerMessage(msg, "textureheights", invoice, strings); - strings.clear(); - sendEstateOwnerMessage(msg, "texturecommit", invoice, strings); - return TRUE; -} - -BOOL LLPanelRegionTextureInfo::validateTextureSizes() +BOOL LLPanelRegionTerrainInfo::validateTextureSizes() { for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { @@ -1169,14 +1045,6 @@ BOOL LLPanelRegionTextureInfo::validateTextureSizes() return TRUE; } - -// static -void LLPanelRegionTextureInfo::onClickDump(void* data) -{ - llinfos << "LLPanelRegionTextureInfo::onClickDump()" << llendl; -} - - ///////////////////////////////////////////////////////////////////////////// // LLPanelRegionTerrainInfo ///////////////////////////////////////////////////////////////////////////// @@ -1215,16 +1083,26 @@ BOOL LLPanelRegionTerrainInfo::postBuild() initCtrl("terrain_raise_spin"); initCtrl("terrain_lower_spin"); - initCtrl("fixed_sun_check"); - getChild("fixed_sun_check")->setCommitCallback(boost::bind(&LLPanelRegionTerrainInfo::onChangeFixedSun, this)); - getChild("use_estate_sun_check")->setCommitCallback(boost::bind(&LLPanelRegionTerrainInfo::onChangeUseEstateTime, this)); - getChild("sun_hour_slider")->setCommitCallback(boost::bind(&LLPanelRegionTerrainInfo::onChangeSunHour, this)); + std::string buffer; + for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) + { + buffer = llformat("texture_detail_%d", i); + initCtrl(buffer); + } + + for(S32 i = 0; i < CORNER_COUNT; ++i) + { + buffer = llformat("height_start_spin_%d", i); + initCtrl(buffer); + buffer = llformat("height_range_spin_%d", i); + initCtrl(buffer); + } childSetAction("download_raw_btn", onClickDownloadRaw, this); childSetAction("upload_raw_btn", onClickUploadRaw, this); childSetAction("bake_terrain_btn", onClickBakeTerrain, this); -#ifdef TMP_DISABLE_WLES +#ifndef TMP_REGION_TERRAIN_REMOVE // WL advanced buttons childSetAction("EnvAdvancedSkyButton", onOpenAdvancedSky, this); childSetAction("EnvAdvancedWaterButton", onOpenAdvancedWater, this); @@ -1235,9 +1113,9 @@ BOOL LLPanelRegionTerrainInfo::postBuild() childSetAction("WLRegionCancel", onCancelRegionWL, this); childSetAction("WLRegionDefault", onSetRegionToDefaultWL, this); childSetAction("WLCurrentApply", onApplyCurrentWL, this); -#endif +#endif TMP_REGION_TERRAIN_REMOVE - return TRUE; + return LLPanelRegionInfo::postBuild(); } F32 LLPanelRegionTerrainInfo::getSunHour() @@ -1252,17 +1130,49 @@ F32 LLPanelRegionTerrainInfo::getSunHour() // virtual bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) { + LLEnvManager::instance().maybeClearEditingScope(LLEnvKey::SCOPE_REGION, false, false); + 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); + + if (region) + { + getChild("region_text")->setValue(LLSD(region->getName())); + + LLVLComposition* compp = region->getComposition(); + LLTextureCtrl* texture_ctrl; + std::string buffer; + for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) + { + buffer = llformat("texture_detail_%d", i); + texture_ctrl = getChild(buffer); + if(texture_ctrl) + { + lldebugs << "Detail Texture " << i << ": " + << compp->getDetailTextureID(i) << llendl; + LLUUID tmp_id(compp->getDetailTextureID(i)); + texture_ctrl->setImageAssetID(tmp_id); + } + } + + for(S32 i = 0; i < CORNER_COUNT; ++i) + { + buffer = llformat("height_start_spin_%d", i); + getChild(buffer)->setValue(LLSD(compp->getStartHeight(i))); + buffer = llformat("height_range_spin_%d", i); + getChild(buffer)->setValue(LLSD(compp->getHeightRange(i))); + } + } + else + { + lldebugs << "no region set" << llendl; + getChild("region_text")->setValue(LLSD("")); + } getChildView("download_raw_btn")->setEnabled(owner_or_god); getChildView("upload_raw_btn")->setEnabled(owner_or_god); @@ -1271,31 +1181,15 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) return LLPanelRegionInfo::refreshFromRegion(region); } -void LLPanelRegionTerrainInfo::setEnvControls(bool available) -{ -#ifdef TMP_DISABLE_WLES - available = false; - getChild("wl_settings_unavailable")->setValue("Temporarily disabled."); -#endif - - 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("WLCurrentApply")->setVisible(available); - getChildView("wl_settings_unavailable")->setVisible(!available); -} void LLPanelRegionTerrainInfo::setCommitControls(bool available) { #ifdef TMP_DISABLE_WLES available = false; -#endif getChildView("WLRegionApply")->setEnabled(available); getChildView("WLRegionCancel")->setEnabled(available); +#endif refresh(); } @@ -1313,72 +1207,47 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() strings.push_back(buffer); buffer = llformat("%f", (F32)getChild("terrain_lower_spin")->getValue().asReal()); strings.push_back(buffer); - buffer = llformat("%s", (getChild("use_estate_sun_check")->getValue().asBoolean() ? "Y" : "N")); - strings.push_back(buffer); - buffer = llformat("%s", (getChild("fixed_sun_check")->getValue().asBoolean() ? "Y" : "N")); - strings.push_back(buffer); - buffer = llformat("%f", (F32)getChild("sun_hour_slider")->getValue().asReal() ); - strings.push_back(buffer); - // Grab estate information in case the user decided to set the - // region back to estate time. JC - LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance("region_info"); - if (!floater) return true; + sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings); - LLTabContainer* tab = floater->getChild("region_panels"); - if (!tab) return true; + // Make sure user hasn't chosen wacky textures. + if (!validateTextureSizes()) + { + return FALSE; + } - LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild("Estate"); - if (!panel) return true; + LLTextureCtrl* texture_ctrl; + std::string id_str; + LLMessageSystem* msg = gMessageSystem; - BOOL estate_global_time = panel->getGlobalTime(); - BOOL estate_fixed_sun = panel->getFixedSun(); - F32 estate_sun_hour; - if (estate_global_time) + for(S32 i = 0; i < TERRAIN_TEXTURE_COUNT; ++i) { - estate_sun_hour = 0.f; + buffer = llformat("texture_detail_%d", i); + texture_ctrl = getChild(buffer); + if(texture_ctrl) + { + LLUUID tmp_id(texture_ctrl->getImageAssetID()); + tmp_id.toString(id_str); + buffer = llformat("%d %s", i, id_str.c_str()); + strings.push_back(buffer); + } } - else + sendEstateOwnerMessage(msg, "texturedetail", invoice, strings); + strings.clear(); + for(S32 i = 0; i < CORNER_COUNT; ++i) { - estate_sun_hour = panel->getSunHour(); + buffer = llformat("height_start_spin_%d", i); + std::string buffer2 = llformat("height_range_spin_%d", i); + std::string buffer3 = llformat("%d %f %f", i, (F32)getChild(buffer)->getValue().asReal(), (F32)getChild(buffer2)->getValue().asReal()); + strings.push_back(buffer3); } + sendEstateOwnerMessage(msg, "textureheights", invoice, strings); + strings.clear(); + sendEstateOwnerMessage(msg, "texturecommit", invoice, strings); - buffer = llformat("%s", (estate_global_time ? "Y" : "N") ); - strings.push_back(buffer); - buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") ); - strings.push_back(buffer); - buffer = llformat("%f", estate_sun_hour); - strings.push_back(buffer); - - sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings); return TRUE; } -void LLPanelRegionTerrainInfo::onChangeUseEstateTime() -{ - BOOL use_estate_sun = getChild("use_estate_sun_check")->getValue().asBoolean(); - getChildView("fixed_sun_check")->setEnabled(!use_estate_sun); - getChildView("sun_hour_slider")->setEnabled(!use_estate_sun); - if (use_estate_sun) - { - getChild("fixed_sun_check")->setValue(LLSD(FALSE)); - getChild("sun_hour_slider")->setValue(LLSD(0.f)); - } - getChildView("apply_btn")->setEnabled(TRUE); -} - -void LLPanelRegionTerrainInfo::onChangeFixedSun() -{ - // Just enable the apply button. We let the sun-hour slider be enabled - // for both fixed-sun and non-fixed-sun. JC - getChildView("apply_btn")->setEnabled(TRUE); -} - -void LLPanelRegionTerrainInfo::onChangeSunHour() -{ - getChildView("apply_btn")->setEnabled(TRUE); -} - // static void LLPanelRegionTerrainInfo::onClickDownloadRaw(void* data) { @@ -1440,6 +1309,7 @@ bool LLPanelRegionTerrainInfo::callbackBakeTerrain(const LLSD& notification, con return false; } +#ifndef TMP_DISABLE_WLES /////////////////////////////////////////////////////////////// // Callbacks for WindLight additions to Region terrain panel @@ -1496,12 +1366,15 @@ void LLPanelRegionTerrainInfo::onApplyCurrentWL(void* userData) // Immediately apply current environment settings to region. LLEnvManager::instance().applyLocalSettingsToRegion(); } +#endif TMP_DISABLE_WLES void LLPanelRegionTerrainInfo::cancelChanges() { +#ifndef TMP_REGION_TERRAIN_REMOVE LLFloaterReg::hideInstance("env_windlight"); LLFloaterReg::hideInstance("env_water"); LLFloaterReg::hideInstance("env_day_cycle"); +#endif TMP_REGION_TERRAIN_REMOVE // disable commmit and cancel LLPanelRegionTerrainInfo::instance()->setCommitControls(false); @@ -1537,6 +1410,7 @@ void LLPanelEstateInfo::initDispatch(LLDispatcher& dispatch) estate_dispatch_initialized = true; } +#ifndef TMP_REGION_TERRAIN_REMOVE // Disables the sun-hour slider and the use fixed time check if the use global time is check void LLPanelEstateInfo::onChangeUseGlobalTime() { @@ -1555,23 +1429,13 @@ void LLPanelEstateInfo::onChangeFixedSun() getChild("use_global_time_check")->setValue(LLSD(FALSE)); enableButton("apply_btn"); } - +#endif TMP_REGION_TERRAIN_REMOVE //--------------------------------------------------------------------------- // Add/Remove estate access button callbacks //--------------------------------------------------------------------------- -void LLPanelEstateInfo::onClickEditSky() -{ - LLFloaterReg::showInstance("env_windlight"); -} - -void LLPanelEstateInfo::onClickEditDayCycle() -{ - LLFloaterReg::showInstance("env_day_cycle"); -} - void LLPanelEstateInfo::onClickAddAllowedAgent() { LLCtrlListInterface *list = childGetListInterface("allowed_avatar_name_list"); @@ -2196,10 +2060,6 @@ void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl) { // do nothing } - else if (checkSunHourSlider(child_ctrl)) - { - // do nothing - } } bool LLPanelEstateInfo::estateUpdate(LLMessageSystem* msg) @@ -2213,18 +2073,11 @@ BOOL LLPanelEstateInfo::postBuild() { // set up the callbacks for the generic controls initCtrl("externally_visible_check"); - initCtrl("use_global_time_check"); - initCtrl("fixed_sun_check"); initCtrl("allow_direct_teleport"); initCtrl("limit_payment"); initCtrl("limit_age_verified"); initCtrl("voice_chat_check"); - // set up the use global time checkbox - getChild("use_global_time_check")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeUseGlobalTime, this)); - getChild("fixed_sun_check")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeFixedSun, this)); - getChild("sun_hour_slider")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1)); - getChild("allowed_avatar_name_list")->setCommitCallback(boost::bind(&LLPanelEstateInfo::onChangeChildCtrl, this, _1)); LLNameListCtrl *avatar_name_list = getChild("allowed_avatar_name_list"); if (avatar_name_list) @@ -2271,9 +2124,6 @@ BOOL LLPanelEstateInfo::postBuild() childSetAction("message_estate_btn", boost::bind(&LLPanelEstateInfo::onClickMessageEstate, this)); childSetAction("kick_user_from_estate_btn", boost::bind(&LLPanelEstateInfo::onClickKickUser, this)); - childSetAction("WLEditSky", boost::bind(&LLPanelEstateInfo::onClickEditSky, this)); - childSetAction("WLEditDayCycle", boost::bind(&LLPanelEstateInfo::onClickEditDayCycle, this)); - return LLPanelRegionInfo::postBuild(); } @@ -2412,7 +2262,11 @@ bool LLPanelEstateInfo::commitEstateInfoCaps() body["is_externally_visible"] = getChild("externally_visible_check")->getValue().asBoolean(); body["allow_direct_teleport"] = getChild("allow_direct_teleport")->getValue().asBoolean(); +#ifndef TMP_REGION_TERRAIN_REMOVE body["is_sun_fixed" ] = getChild("fixed_sun_check")->getValue().asBoolean(); +#else ! TMP_REGION_TERRAIN_REMOVE + body["is_sun_fixed" ] = false; +#endif 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(); @@ -2477,7 +2331,9 @@ void LLPanelEstateInfo::commitEstateInfoDataserver() void LLPanelEstateInfo::setEstateFlags(U32 flags) { getChild("externally_visible_check")->setValue(LLSD(flags & REGION_FLAGS_EXTERNALLY_VISIBLE ? TRUE : FALSE) ); +#ifndef TMP_REGION_TERRAIN_REMOVE getChild("fixed_sun_check")->setValue(LLSD(flags & REGION_FLAGS_SUN_FIXED ? TRUE : FALSE) ); +#endif TMP_REGION_TERRAIN_REMOVE 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) ); @@ -2506,11 +2362,6 @@ U32 LLPanelEstateInfo::computeEstateFlags() flags |= REGION_FLAGS_ALLOW_DIRECT_TELEPORT; } - if (getChild("fixed_sun_check")->getValue().asBoolean()) - { - flags |= REGION_FLAGS_SUN_FIXED; - } - if (getChild("limit_payment")->getValue().asBoolean()) { flags |= REGION_FLAGS_DENY_ANONYMOUS; @@ -2674,17 +2525,6 @@ BOOL LLPanelEstateInfo::checkRemovalButton(std::string name) return (btn_name != ""); } -BOOL LLPanelEstateInfo::checkSunHourSlider(LLUICtrl* child_ctrl) -{ - BOOL found_child_ctrl = FALSE; - if (child_ctrl->getName() == "sun_hour_slider") - { - enableButton("apply_btn"); - found_child_ctrl = TRUE; - } - return found_child_ctrl; -} - // static void LLPanelEstateInfo::onClickMessageEstate(void* userdata) { -- cgit v1.2.3 From 60f54abb33a8a0f4f3bd0fa23aee84d695486f92 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 20 May 2011 09:48:19 -0400 Subject: STORM-1265: partial fix for region updates; further integration with new dialogs needed. --- indra/newview/llfloaterregioninfo.cpp | 128 +++++++++++++++++++--------------- 1 file changed, 71 insertions(+), 57 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 1457ec245b..2c128bdacf 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -93,7 +93,6 @@ const S32 TERRAIN_TEXTURE_COUNT = 4; const S32 CORNER_COUNT = 4; #define TMP_DISABLE_WLES // STORM-1180 -#define TMP_REGION_TERRAIN_REMOVE // STORM-1265 ///---------------------------------------------------------------------------- /// Local class declaration @@ -382,15 +381,6 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel->getChild("terrain_raise_spin")->setValue(LLSD(terrain_raise_limit)); panel->getChild("terrain_lower_spin")->setValue(LLSD(terrain_lower_limit)); -#ifndef TMP_REGION_TERRAIN_REMOVE - panel->getChild("use_estate_sun_check")->setValue(LLSD(use_estate_sun)); - - panel->getChild("fixed_sun_check")->setValue(LLSD((BOOL)(region_flags & REGION_FLAGS_SUN_FIXED))); - panel->getChildView("fixed_sun_check")->setEnabled(allow_modify && !use_estate_sun); - panel->getChild("sun_hour_slider")->setValue(LLSD(sun_hour)); - panel->getChildView("sun_hour_slider")->setEnabled(allow_modify && !use_estate_sun); -#endif TMP_REGION_TERRAIN_REMOVE - panel->setCtrlsEnabled(allow_modify); floater->refreshFromRegion( gAgent.getRegion() ); @@ -1102,19 +1092,6 @@ BOOL LLPanelRegionTerrainInfo::postBuild() childSetAction("upload_raw_btn", onClickUploadRaw, this); childSetAction("bake_terrain_btn", onClickBakeTerrain, this); -#ifndef TMP_REGION_TERRAIN_REMOVE - // 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); - childSetAction("WLCurrentApply", onApplyCurrentWL, this); -#endif TMP_REGION_TERRAIN_REMOVE - return LLPanelRegionInfo::postBuild(); } @@ -1182,17 +1159,6 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) } -void LLPanelRegionTerrainInfo::setCommitControls(bool available) -{ -#ifdef TMP_DISABLE_WLES - available = false; - - getChildView("WLRegionApply")->setEnabled(available); - getChildView("WLRegionCancel")->setEnabled(available); -#endif - refresh(); -} - // virtual BOOL LLPanelRegionTerrainInfo::sendUpdate() { @@ -1201,6 +1167,19 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() strings_t strings; LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); + // ========================================== + // Assemble and send setregionterrain message + // "setregionterrain" + // strings[0] = float water height + // strings[1] = float terrain raise + // strings[2] = float terrain lower + // strings[3] = 'Y' use estate time + // strings[4] = 'Y' fixed sun + // strings[5] = float sun_hour + // strings[6] = from estate, 'Y' use global time + // strings[7] = from estate, 'Y' fixed sun + // strings[8] = from estate, float sun_hour + buffer = llformat("%f", (F32)getChild("water_height_spin")->getValue().asReal()); strings.push_back(buffer); buffer = llformat("%f", (F32)getChild("terrain_raise_spin")->getValue().asReal()); @@ -1208,7 +1187,54 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() buffer = llformat("%f", (F32)getChild("terrain_lower_spin")->getValue().asReal()); strings.push_back(buffer); +#ifndef TMP_DISABLE_WLES + /* + * This message is failing + * We need to fix how the following values are obtained + */ + buffer = llformat("%s", (getChild("use_estate_sun_check")->getValue().asBoolean() ? "Y" : "N")); + strings.push_back(buffer); + buffer = llformat("%s", (getChild("fixed_sun_check")->getValue().asBoolean() ? "Y" : "N")); + strings.push_back(buffer); + buffer = llformat("%f", (F32)getChild("sun_hour_slider")->getValue().asReal() ); + strings.push_back(buffer); + + // Grab estate information in case the user decided to set the + // region back to estate time. + LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance("region_info"); + if (!floater) return true; + + LLTabContainer* tab = floater->getChild("region_panels"); + if (!tab) return true; + + LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild("Estate"); + if (!panel) return true; + + BOOL estate_global_time = panel->getGlobalTime(); + BOOL estate_fixed_sun = panel->getFixedSun(); + F32 estate_sun_hour; + if (estate_global_time) + { + estate_sun_hour = 0.f; + } + else + { + estate_sun_hour = panel->getSunHour(); + } + + buffer = llformat("%s", (estate_global_time ? "Y" : "N") ); + strings.push_back(buffer); + buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") ); + strings.push_back(buffer); + buffer = llformat("%f", estate_sun_hour); + strings.push_back(buffer); +#endif TMP_DISABLE_WLES + sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings); + strings.clear(); + + // ======================================= + // Assemble and send texturedetail message // Make sure user hasn't chosen wacky textures. if (!validateTextureSizes()) @@ -1234,6 +1260,10 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() } sendEstateOwnerMessage(msg, "texturedetail", invoice, strings); strings.clear(); + + // ======================================== + // Assemble and send textureheights message + for(S32 i = 0; i < CORNER_COUNT; ++i) { buffer = llformat("height_start_spin_%d", i); @@ -1243,6 +1273,10 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() } sendEstateOwnerMessage(msg, "textureheights", invoice, strings); strings.clear(); + + // ======================================== + // Send texturecommit message + sendEstateOwnerMessage(msg, "texturecommit", invoice, strings); return TRUE; @@ -1311,7 +1345,7 @@ bool LLPanelRegionTerrainInfo::callbackBakeTerrain(const LLSD& notification, con #ifndef TMP_DISABLE_WLES /////////////////////////////////////////////////////////////// -// Callbacks for WindLight additions to Region terrain panel +// Callbacks for Environment tab of Region panel void LLPanelRegionTerrainInfo::onOpenAdvancedSky(void* userData) { @@ -1368,18 +1402,6 @@ void LLPanelRegionTerrainInfo::onApplyCurrentWL(void* userData) } #endif TMP_DISABLE_WLES -void LLPanelRegionTerrainInfo::cancelChanges() -{ -#ifndef TMP_REGION_TERRAIN_REMOVE - LLFloaterReg::hideInstance("env_windlight"); - LLFloaterReg::hideInstance("env_water"); - LLFloaterReg::hideInstance("env_day_cycle"); -#endif TMP_REGION_TERRAIN_REMOVE - - // disable commmit and cancel - LLPanelRegionTerrainInfo::instance()->setCommitControls(false); -} - ///////////////////////////////////////////////////////////////////////////// // LLPanelEstateInfo // @@ -1410,7 +1432,7 @@ void LLPanelEstateInfo::initDispatch(LLDispatcher& dispatch) estate_dispatch_initialized = true; } -#ifndef TMP_REGION_TERRAIN_REMOVE +#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() { @@ -1429,7 +1451,7 @@ void LLPanelEstateInfo::onChangeFixedSun() getChild("use_global_time_check")->setValue(LLSD(FALSE)); enableButton("apply_btn"); } -#endif TMP_REGION_TERRAIN_REMOVE +#endif TMP_DISABLE_WLES @@ -2262,11 +2284,6 @@ bool LLPanelEstateInfo::commitEstateInfoCaps() body["is_externally_visible"] = getChild("externally_visible_check")->getValue().asBoolean(); body["allow_direct_teleport"] = getChild("allow_direct_teleport")->getValue().asBoolean(); -#ifndef TMP_REGION_TERRAIN_REMOVE - body["is_sun_fixed" ] = getChild("fixed_sun_check")->getValue().asBoolean(); -#else ! TMP_REGION_TERRAIN_REMOVE - body["is_sun_fixed" ] = false; -#endif 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(); @@ -2331,9 +2348,6 @@ void LLPanelEstateInfo::commitEstateInfoDataserver() void LLPanelEstateInfo::setEstateFlags(U32 flags) { getChild("externally_visible_check")->setValue(LLSD(flags & REGION_FLAGS_EXTERNALLY_VISIBLE ? TRUE : FALSE) ); -#ifndef TMP_REGION_TERRAIN_REMOVE - getChild("fixed_sun_check")->setValue(LLSD(flags & REGION_FLAGS_SUN_FIXED ? TRUE : FALSE) ); -#endif TMP_REGION_TERRAIN_REMOVE 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) ); -- cgit v1.2.3 From 99fe1004a6cb4406bcac790420a5be6269e02723 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Sat, 21 May 2011 07:22:18 -0400 Subject: fix oops when cleaning up temporary ifndefs --- indra/newview/llfloaterregioninfo.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 2c128bdacf..de959f83e0 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1228,7 +1228,7 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() strings.push_back(buffer); buffer = llformat("%f", estate_sun_hour); strings.push_back(buffer); -#endif TMP_DISABLE_WLES +#endif // TMP_DISABLE_WLES sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings); strings.clear(); @@ -1400,7 +1400,7 @@ void LLPanelRegionTerrainInfo::onApplyCurrentWL(void* userData) // Immediately apply current environment settings to region. LLEnvManager::instance().applyLocalSettingsToRegion(); } -#endif TMP_DISABLE_WLES +#endif // TMP_DISABLE_WLES ///////////////////////////////////////////////////////////////////////////// // LLPanelEstateInfo @@ -1451,7 +1451,7 @@ void LLPanelEstateInfo::onChangeFixedSun() getChild("use_global_time_check")->setValue(LLSD(FALSE)); enableButton("apply_btn"); } -#endif TMP_DISABLE_WLES +#endif // TMP_DISABLE_WLES -- cgit v1.2.3 From b60c63bf075a92084ba94459a840decba846a916 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 23 May 2011 19:26:17 +0300 Subject: STORM-1256 WIP Implemented editing region environment settings via the Region/Estate floater. --- indra/newview/llfloaterregioninfo.cpp | 262 ++++++++++++++++++++++++++++++++++ 1 file changed, 262 insertions(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index de959f83e0..56025c3143 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -40,6 +40,7 @@ #include "llxfermanager.h" #include "indra_constants.h" #include "message.h" +#include "llradiogroup.h" #include "llsd.h" #include "llsdserialize.h" @@ -83,6 +84,7 @@ #include "llviewertexteditor.h" #include "llviewerwindow.h" #include "llvlcomposition.h" +#include "llwaterparammanager.h" #include "lltrans.h" #include "llagentui.h" @@ -176,6 +178,7 @@ LLFloaterRegionInfo::LLFloaterRegionInfo(const LLSD& seed) BOOL LLFloaterRegionInfo::postBuild() { mTab = getChild("region_panels"); + mTab->setCommitCallback(boost::bind(&LLFloaterRegionInfo::onTabSelected, this, _2)); // contruct the panels LLPanelRegionInfo* panel; @@ -423,6 +426,12 @@ LLPanelRegionTerrainInfo* LLFloaterRegionInfo::getPanelRegionTerrain() return panel; } +void LLFloaterRegionInfo::onTabSelected(const LLSD& param) +{ + LLPanel* active_panel = getChild(param.asString()); + active_panel->onOpen(LLSD()); +} + void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region) { if (!region) @@ -3160,3 +3169,256 @@ bool LLDispatchSetEstateAccess::operator()( return true; } + +LLPanelEnvironmentInfo::LLPanelEnvironmentInfo() +: mRegionSettingsRadioGroup(NULL), + mDayCycleSettingsRadioGroup(NULL), + mWaterPresetCombo(NULL), + mSkyPresetCombo(NULL), + mDayCyclePresetCombo(NULL) +{ +} + +// virtual +BOOL LLPanelEnvironmentInfo::postBuild() +{ + mRegionSettingsRadioGroup = getChild("region_settings_radio_group"); + mRegionSettingsRadioGroup->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSwitchRegionSettings, this)); + + mDayCycleSettingsRadioGroup = getChild("sky_dayc_settings_radio_group"); + mDayCycleSettingsRadioGroup->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSwitchDayCycle, this)); + + mWaterPresetCombo = getChild("water_settings_preset_combo"); + mSkyPresetCombo = getChild("sky_settings_preset_combo"); + mDayCyclePresetCombo = getChild("dayc_settings_preset_combo"); + + childSetCommitCallback("save_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnSave, this), NULL); + childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL); + + return TRUE; +} + +// virtual +void LLPanelEnvironmentInfo::onOpen(const LLSD& key) +{ + refresh(); +} + +void LLPanelEnvironmentInfo::refresh() +{ + populateWaterPresetsList(); + populateSkyPresetsList(); + populateDayCyclesList(); + + // Init radio groups. + const LLEnvironmentSettings& settings = LLEnvManagerNew::instance().getRegionSettings(); + const LLSD& dc = settings.getWLDayCycle(); + LLSD::Real first_frame_time = dc.size() > 0 ? dc[0][0].asReal() : 0.0f; + const bool use_fixed_sky = dc.size() == 1 && first_frame_time < 0; + mRegionSettingsRadioGroup->setSelectedIndex(settings.getSkyMap().size() == 0 ? 0 : 1); + mDayCycleSettingsRadioGroup->setSelectedIndex(use_fixed_sky ? 0 : 1); + + LLPanelEnvironmentInfo::onSwitchRegionSettings(); + LLPanelEnvironmentInfo::onSwitchDayCycle(); +} + +void LLPanelEnvironmentInfo::populateWaterPresetsList() +{ + mWaterPresetCombo->removeall(); + + // If the region already has water params, add them to the list. + const LLEnvironmentSettings& region_settings = LLEnvManagerNew::instance().getRegionSettings(); + if (region_settings.getWaterParams().size() != 0) + { + const std::string& region_name = gAgent.getRegion()->getName(); + mWaterPresetCombo->add(region_name, LLWLParamKey(region_name, LLEnvKey::SCOPE_REGION).toLLSD()); + mWaterPresetCombo->addSeparator(); + } + + // Add local water presets. + const std::map &water_params_map = LLWaterParamManager::instance().mParamList; + for (std::map::const_iterator it = water_params_map.begin(); it != water_params_map.end(); it++) + { + mWaterPresetCombo->add(it->first, LLWLParamKey(it->first, LLEnvKey::SCOPE_LOCAL).toLLSD()); + } + + // There's no way to select current preset because its name is not stored on server. +} + +void LLPanelEnvironmentInfo::populateSkyPresetsList() +{ + mSkyPresetCombo->removeall(); + + 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++) + { + std::string preset_name = it->first.name; + std::string item_title; + + if (it->first.scope == LLEnvKey::SCOPE_LOCAL) // local preset + { + item_title = preset_name; + } + else // region preset + { + item_title = preset_name + " (" + gAgent.getRegion()->getName() + ")"; + } + + // Saving as string instead of LLSD() for selectByValue() to work, as it doesn't support non-scalar values. + mSkyPresetCombo->add(item_title, it->first.toStringVal()); + } + + // Select current preset. + LLSD sky_map = LLEnvManagerNew::instance().getRegionSettings().getSkyMap(); + if (sky_map.size() == 1) // if the region is set to fixed sky + { + std::string preset_name = sky_map.beginMap()->first; + mSkyPresetCombo->selectByValue(LLWLParamKey(preset_name, LLEnvKey::SCOPE_REGION).toStringVal()); + } +} + +void LLPanelEnvironmentInfo::populateDayCyclesList() +{ + mDayCyclePresetCombo->removeall(); + + // If the region already has env. settings, add its day cycle to the list. + const LLSD& cur_region_dc = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle(); + if (cur_region_dc.size() != 0) + { + LLViewerRegion* region = gAgent.getRegion(); + llassert(region != NULL); + + LLWLParamKey key(region->getName(), LLEnvKey::SCOPE_REGION); + mDayCyclePresetCombo->add(region->getName(), key.toLLSD()); + mDayCyclePresetCombo->addSeparator(); + } + + // Add local day cycles. + // *TODO: multiple local day cycles support + LLWLParamKey key("Default", LLEnvKey::SCOPE_LOCAL); + mDayCyclePresetCombo->add("Default", key.toLLSD()); + + // Current day cycle is already selected. +} + +void LLPanelEnvironmentInfo::onSwitchRegionSettings() +{ + getChild("user_environment_settings")->setEnabled(mRegionSettingsRadioGroup->getSelectedIndex() != 0); +} + +void LLPanelEnvironmentInfo::onSwitchDayCycle() +{ + bool is_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0; + + mSkyPresetCombo->setEnabled(is_fixed_sky); + mDayCyclePresetCombo->setEnabled(!is_fixed_sky); +} + +void LLPanelEnvironmentInfo::onBtnSave() +{ + LL_DEBUGS("Windlight") << "About to save region settings" << LL_ENDL; + + const LLEnvironmentSettings& old_region_settings = LLEnvManagerNew::instance().getRegionSettings(); + const bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; + const bool use_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0; + + LLSD day_cycle; + LLSD sky_map; + LLSD water_params; + + if (use_defaults) + { + // settings will be empty + LL_DEBUGS("Windlight") << "Defaults" << LL_ENDL; + } + else // use custom region settings + { + if (use_fixed_sky) + { + LL_DEBUGS("Windlight") << "Use fixed sky" << LL_ENDL; + std::string preset_key(mSkyPresetCombo->getValue().asString()); + LLWLParamKey preset(preset_key); + + // Get the preset sky params. + LLWLParamSet params; + if (!LLWLParamManager::instance().getParamSet(preset, params)) + { + llwarns << "Error getting sky params: " << preset.toLLSD() << llendl; + return; + } + + // Create a day cycle consisting of a single sky preset. + LLSD key(LLSD::emptyArray()); + key.append(-1.0f); // indicate that user preference is actually fixed sky, not a day cycle + key.append(preset.name); + day_cycle.append(key); + + // Create a sky map consisting of only the sky preset. + std::map refs; + refs[preset] = params; + sky_map = LLWLParamManager::createSkyMap(refs); + } + else // use day cycle + { + LLWLParamKey dc(mDayCyclePresetCombo->getValue()); + LL_DEBUGS("Windlight") << "Use day cycle: " << dc.toLLSD() << LL_ENDL; + + if (dc.scope == LLEnvKey::SCOPE_REGION) // current region day cycle + { + day_cycle = old_region_settings.getWLDayCycle(); + sky_map = old_region_settings.getSkyMap(); + } + else // a local day cycle + { + // *TODO: multiple local day cycles support + day_cycle = LLEnvManagerNew::instance().getDayCycleByName("Default"); + + // Create sky map from the day cycle. + { + std::map refs; + LLWLDayCycle tmp_day; + + tmp_day.loadDayCycle(day_cycle, dc.scope); + tmp_day.getSkyRefs(refs); + + sky_map = LLWLParamManager::createSkyMap(refs); + } + + LL_DEBUGS("Windlight") << "day_cycle: " << day_cycle << LL_ENDL; + LL_DEBUGS("Windlight") << "sky_map: " << sky_map << LL_ENDL; + } + } + + // Get water params. + LLWLParamKey water_key(mWaterPresetCombo->getSelectedValue()); + if (water_key.scope == LLEnvKey::SCOPE_REGION) + { + water_params = old_region_settings.getWaterParams(); + } + else + { + LLWaterParamSet param_set; + if (!LLWaterParamManager::instance().getParamSet(water_key.name, param_set)) + { + llwarns << "Error getting water preset: " << water_key.name << llendl; + return; + } + + water_params = param_set.getAll(); + } + } + + // Send settings apply request. + LLEnvironmentSettings new_region_settings; + new_region_settings.saveParams(day_cycle, sky_map, water_params, 0.0f); + if (!LLEnvManagerNew::instance().sendRegionSettings(new_region_settings)) + { + llwarns << "Error applying region environment settings" << llendl; + } +} + +void LLPanelEnvironmentInfo::onBtnCancel() +{ + // Reload current region settings. + refresh(); +} -- cgit v1.2.3 From 9c2c6c7a6c48753e722748a7ae5cd4e2174f5630 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 24 May 2011 15:28:20 +0300 Subject: STORM-1256 WIP Improvements to region enviroment settings editing. * Enable/disable controls according to the region permissions. * Update controls when region settings update comes. --- indra/newview/llfloaterregioninfo.cpp | 63 +++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 56025c3143..657dd67035 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -218,6 +218,9 @@ BOOL LLFloaterRegionInfo::postBuild() "EstateOwnerMessage", &processEstateOwnerRequest); + // Request region info when agent region changes. + LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterRegionInfo::requestRegionInfo, this)); + return TRUE; } @@ -292,6 +295,8 @@ void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**) // static void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) { + LL_DEBUGS("Windlight") << "Processing region info" << LL_ENDL; + LLPanel* panel; LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance("region_info"); llinfos << "LLFloaterRegionInfo::processRegionInfo" << llendl; @@ -299,11 +304,12 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) { return; } - - - // currently, region can send this message when its windlight settings change - LLEnvManager::instance().refreshFromStorage(LLEnvKey::SCOPE_REGION); + // We need to re-request environment setting here, + // otherwise after we apply (send) updated region settings we won't get them back, + // so our environment won't be updated. + LLEnvManagerNew::instance().requestRegionSettings(); + LLTabContainer* tab = floater->getChild("region_panels"); LLViewerRegion* region = gAgent.getRegion(); @@ -3171,7 +3177,8 @@ bool LLDispatchSetEstateAccess::operator()( } LLPanelEnvironmentInfo::LLPanelEnvironmentInfo() -: mRegionSettingsRadioGroup(NULL), +: mEnableEditing(false), + mRegionSettingsRadioGroup(NULL), mDayCycleSettingsRadioGroup(NULL), mWaterPresetCombo(NULL), mSkyPresetCombo(NULL), @@ -3195,15 +3202,32 @@ BOOL LLPanelEnvironmentInfo::postBuild() childSetCommitCallback("save_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnSave, this), NULL); childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL); + LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingschange, this)); + return TRUE; } // virtual void LLPanelEnvironmentInfo::onOpen(const LLSD& key) { + LL_DEBUGS("Windlight") << "Panel opened, refreshing" << LL_ENDL; refresh(); } +// virtual +bool LLPanelEnvironmentInfo::refreshFromRegion(LLViewerRegion* region) +{ + LL_DEBUGS("Windlight") << "Region updated, enabling/disabling controls" << LL_ENDL; + BOOL owner_or_god = gAgent.isGodlike() || (region && (region->getOwner() == gAgent.getID())); + BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); + + // Don't refresh from region settings to avoid flicker after applying new region settings. + mEnableEditing = owner_or_god_or_manager; + setControlsEnabled(mEnableEditing); + + return LLPanelRegionInfo::refreshFromRegion(region); +} + void LLPanelEnvironmentInfo::refresh() { populateWaterPresetsList(); @@ -3218,8 +3242,27 @@ void LLPanelEnvironmentInfo::refresh() mRegionSettingsRadioGroup->setSelectedIndex(settings.getSkyMap().size() == 0 ? 0 : 1); mDayCycleSettingsRadioGroup->setSelectedIndex(use_fixed_sky ? 0 : 1); - LLPanelEnvironmentInfo::onSwitchRegionSettings(); - LLPanelEnvironmentInfo::onSwitchDayCycle(); + setControlsEnabled(mEnableEditing); +} + +void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) +{ + mRegionSettingsRadioGroup->setEnabled(enabled); + mDayCycleSettingsRadioGroup->setEnabled(enabled); + + mWaterPresetCombo->setEnabled(enabled); + mSkyPresetCombo->setEnabled(enabled); + mDayCyclePresetCombo->setEnabled(enabled); + + getChildView("save_btn")->setEnabled(enabled); + getChildView("cancel_btn")->setEnabled(enabled); + + if (enabled) + { + // Enable/disable some controls based on currently selected radio buttons. + LLPanelEnvironmentInfo::onSwitchRegionSettings(); + LLPanelEnvironmentInfo::onSwitchDayCycle(); + } } void LLPanelEnvironmentInfo::populateWaterPresetsList() @@ -3422,3 +3465,9 @@ void LLPanelEnvironmentInfo::onBtnCancel() // Reload current region settings. refresh(); } + +void LLPanelEnvironmentInfo::onRegionSettingschange() +{ + LL_DEBUGS("Windlight") << "Region settings changed, refreshing" << LL_ENDL; + refresh(); +} -- cgit v1.2.3 From d755605f8dc5bba0abdb87f075db2b6a5ed4ecad Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 24 May 2011 20:21:23 +0300 Subject: STORM-1256 WIP Added perpetual indicator for progress of applying changes. --- indra/newview/llfloaterregioninfo.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 657dd67035..d47fb00060 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -40,6 +40,7 @@ #include "llxfermanager.h" #include "indra_constants.h" #include "message.h" +#include "llloadingindicator.h" #include "llradiogroup.h" #include "llsd.h" #include "llsdserialize.h" @@ -3203,6 +3204,7 @@ BOOL LLPanelEnvironmentInfo::postBuild() childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL); LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingschange, this)); + LLEnvManagerNew::instance().setRegionSettingsAppliedCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingsApplied, this, _1)); return TRUE; } @@ -3265,6 +3267,22 @@ void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) } } +void LLPanelEnvironmentInfo::setApplyProgress(bool started) +{ + LLLoadingIndicator* indicator = getChild("progress_indicator"); + + indicator->setVisible(started); + + if (started) + { + indicator->start(); + } + else + { + indicator->stop(); + } +} + void LLPanelEnvironmentInfo::populateWaterPresetsList() { mWaterPresetCombo->removeall(); @@ -3457,7 +3475,10 @@ void LLPanelEnvironmentInfo::onBtnSave() if (!LLEnvManagerNew::instance().sendRegionSettings(new_region_settings)) { llwarns << "Error applying region environment settings" << llendl; + return; } + + setApplyProgress(true); } void LLPanelEnvironmentInfo::onBtnCancel() @@ -3470,4 +3491,18 @@ void LLPanelEnvironmentInfo::onRegionSettingschange() { LL_DEBUGS("Windlight") << "Region settings changed, refreshing" << LL_ENDL; refresh(); + + // Stop applying progress indicator (it may be running if it's us who initiated settings update). + setApplyProgress(false); +} + +void LLPanelEnvironmentInfo::onRegionSettingsApplied(bool ok) +{ + LL_DEBUGS("Windlight") << "Applying region settings finished, stopping indicator" << LL_ENDL; + // If applying new settings has failed, stop the indicator right away. + // Otherwise it will be stopped when we receive the updated settings from server. + if (!ok) + { + setApplyProgress(false); + } } -- cgit v1.2.3 From 72d1efb1529ad0863d35b219a461f353a4b19353 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 24 May 2011 20:29:46 +0300 Subject: STORM-1256 WIP Re-request region settings if our attempt to change them has failed. --- indra/newview/llfloaterregioninfo.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index d47fb00060..ff34e21c2f 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3504,5 +3504,12 @@ void LLPanelEnvironmentInfo::onRegionSettingsApplied(bool ok) if (!ok) { setApplyProgress(false); + + // We need to re-request environment setting here, + // otherwise our subsequent attempts to change region settings will fail with the following error: + // "Unable to update environment settings because the last update your viewer saw was not the same + // as the last update sent from the simulator. Try sending your update again, and if this + // does not work, try leaving and returning to the region." + LLEnvManagerNew::instance().requestRegionSettings(); } } -- cgit v1.2.3 From 8690fa472bdece537be0392517633bc48b4aa903 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 25 May 2011 13:55:58 -0400 Subject: storm-1282: reorder tabs on the region/estate floater --- indra/newview/llfloaterregioninfo.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index f789a761eb..7c26b3e29d 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -212,9 +212,14 @@ BOOL LLFloaterRegionInfo::postBuild() panel->buildFromFile("panel_region_general.xml"); mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true)); - panel = new LLPanelRegionDebugInfo; + panel = new LLPanelEstateInfo; mInfoPanels.push_back(panel); - panel->buildFromFile("panel_region_debug.xml"); + panel->buildFromFile("panel_region_estate.xml"); + mTab->addTabPanel(panel); + + panel = new LLPanelEstateCovenant; + mInfoPanels.push_back(panel); + panel->buildFromFile("panel_region_covenant.xml"); mTab->addTabPanel(panel); panel = new LLPanelRegionTerrainInfo; @@ -227,14 +232,9 @@ BOOL LLFloaterRegionInfo::postBuild() panel->buildFromFile("panel_region_environment.xml"); mTab->addTabPanel(panel); - panel = new LLPanelEstateInfo; - mInfoPanels.push_back(panel); - panel->buildFromFile("panel_region_estate.xml"); - mTab->addTabPanel(panel); - - panel = new LLPanelEstateCovenant; + panel = new LLPanelRegionDebugInfo; mInfoPanels.push_back(panel); - panel->buildFromFile("panel_region_covenant.xml"); + panel->buildFromFile("panel_region_debug.xml"); mTab->addTabPanel(panel); gMessageSystem->setHandlerFunc( -- cgit v1.2.3 From c32b19f31d4d5d0b32fcf64cce1cebd7d79b9b05 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 26 May 2011 15:11:01 +0300 Subject: STORM-1253 WIP Implemented switching between multiple day cycles (locally and region-wide). --- indra/newview/llfloaterregioninfo.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index ff34e21c2f..6a5b577396 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -52,6 +52,7 @@ #include "llbutton.h" #include "llcheckboxctrl.h" #include "llcombobox.h" +#include "lldaycyclemanager.h" #include "llenvmanager.h" #include "llfilepicker.h" #include "llfloaterdaycycle.h" @@ -3350,14 +3351,18 @@ void LLPanelEnvironmentInfo::populateDayCyclesList() llassert(region != NULL); LLWLParamKey key(region->getName(), LLEnvKey::SCOPE_REGION); - mDayCyclePresetCombo->add(region->getName(), key.toLLSD()); + mDayCyclePresetCombo->add(region->getName(), key.toStringVal()); mDayCyclePresetCombo->addSeparator(); } // Add local day cycles. - // *TODO: multiple local day cycles support - LLWLParamKey key("Default", LLEnvKey::SCOPE_LOCAL); - mDayCyclePresetCombo->add("Default", key.toLLSD()); + const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); + for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) + { + std::string name = it->first; + LLWLParamKey key(name, LLEnvKey::SCOPE_LOCAL); + mDayCyclePresetCombo->add(name, key.toStringVal()); + } // Current day cycle is already selected. } @@ -3421,7 +3426,8 @@ void LLPanelEnvironmentInfo::onBtnSave() } else // use day cycle { - LLWLParamKey dc(mDayCyclePresetCombo->getValue()); + std::string preset_key(mDayCyclePresetCombo->getValue().asString()); + LLWLParamKey dc(preset_key); LL_DEBUGS("Windlight") << "Use day cycle: " << dc.toLLSD() << LL_ENDL; if (dc.scope == LLEnvKey::SCOPE_REGION) // current region day cycle @@ -3431,8 +3437,11 @@ void LLPanelEnvironmentInfo::onBtnSave() } else // a local day cycle { - // *TODO: multiple local day cycles support - day_cycle = LLEnvManagerNew::instance().getDayCycleByName("Default"); + if (!LLDayCycleManager::instance().getPreset(dc.name, day_cycle)) + { + llwarns << "Error getting day cycle " << dc.name << llendl; + return; + } // Create sky map from the day cycle. { -- cgit v1.2.3 From c0037909d576fc4922b92dfcc83d865d61ac43cb Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 26 May 2011 19:32:20 +0300 Subject: STORM-1284 FIXED Changes to region environment are now visible immediately. Pressing "Apply" sends the settings update to server. Pressing "Cancel" reverts to current region settings. --- indra/newview/llfloaterregioninfo.cpp | 242 +++++++++++++++++++++++++--------- 1 file changed, 181 insertions(+), 61 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 6a5b577396..ee3d00206f 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1124,7 +1124,7 @@ F32 LLPanelRegionTerrainInfo::getSunHour() // virtual bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) { - LLEnvManager::instance().maybeClearEditingScope(LLEnvKey::SCOPE_REGION, false, false); + //LLEnvManager::instance().maybeClearEditingScope(LLEnvKey::SCOPE_REGION, false, false); BOOL owner_or_god = gAgent.isGodlike() || (region && (region->getOwner() == gAgent.getID())); @@ -2088,7 +2088,7 @@ void LLFloaterRegionInfo::onClose(bool app_quitting) { if(!app_quitting) { - LLEnvManager::getInstance()->maybeClearEditingScope(true, false); + //LLEnvManager::getInstance()->maybeClearEditingScope(true, false); LLPanelRegionTerrainInfo::onFloaterClose(app_quitting); } } @@ -3198,10 +3198,15 @@ BOOL LLPanelEnvironmentInfo::postBuild() mDayCycleSettingsRadioGroup->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSwitchDayCycle, this)); mWaterPresetCombo = getChild("water_settings_preset_combo"); + mWaterPresetCombo->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSelectWaterPreset, this)); + mSkyPresetCombo = getChild("sky_settings_preset_combo"); + mSkyPresetCombo->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSelectSkyPreset, this)); + mDayCyclePresetCombo = getChild("dayc_settings_preset_combo"); + mDayCyclePresetCombo->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSelectDayCycle, this)); - childSetCommitCallback("save_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnSave, this), NULL); + childSetCommitCallback("apply_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnApply, this), NULL); childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL); LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingschange, this)); @@ -3217,6 +3222,17 @@ void LLPanelEnvironmentInfo::onOpen(const LLSD& key) refresh(); } +// virtual +void LLPanelEnvironmentInfo::handleVisibilityChange(BOOL new_visibility) +{ + // If hiding (user switched to another tab or closed the floater), + // display user's preferred environment. + if (!new_visibility) + { + LLEnvManagerNew::instance().usePrefs(); + } +} + // virtual bool LLPanelEnvironmentInfo::refreshFromRegion(LLViewerRegion* region) { @@ -3257,14 +3273,18 @@ void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) mSkyPresetCombo->setEnabled(enabled); mDayCyclePresetCombo->setEnabled(enabled); - getChildView("save_btn")->setEnabled(enabled); + getChildView("apply_btn")->setEnabled(enabled); getChildView("cancel_btn")->setEnabled(enabled); if (enabled) { // Enable/disable some controls based on currently selected radio buttons. - LLPanelEnvironmentInfo::onSwitchRegionSettings(); - LLPanelEnvironmentInfo::onSwitchDayCycle(); + bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; + getChild("user_environment_settings")->setEnabled(!use_defaults); + + bool is_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0; + mSkyPresetCombo->setEnabled(is_fixed_sky); + mDayCyclePresetCombo->setEnabled(!is_fixed_sky); } } @@ -3367,9 +3387,97 @@ void LLPanelEnvironmentInfo::populateDayCyclesList() // Current day cycle is already selected. } +bool LLPanelEnvironmentInfo::getSelectedWaterParams(LLSD& water_params) +{ + LLWLParamKey water_key(mWaterPresetCombo->getSelectedValue()); + + if (water_key.scope == LLEnvKey::SCOPE_REGION) + { + water_params = LLEnvManagerNew::instance().getRegionSettings().getWaterParams(); + } + else + { + LLWaterParamSet param_set; + if (!LLWaterParamManager::instance().getParamSet(water_key.name, param_set)) + { + llwarns << "Error getting water preset: " << water_key.name << llendl; + return false; + } + + water_params = param_set.getAll(); + } + + return true; +} + +bool LLPanelEnvironmentInfo::getSelectedSkyParams(LLSD& sky_params, std::string& preset_name) +{ + std::string preset_key(mSkyPresetCombo->getValue().asString()); + LLWLParamKey preset(preset_key); + + // Get the preset sky params. + LLWLParamSet param_set; + if (!LLWLParamManager::instance().getParamSet(preset, param_set)) + { + llwarns << "Error getting sky params: " << preset.toLLSD() << llendl; + return false; + } + + sky_params = param_set.getAll(); + preset_name = preset.name; + return true; +} + +bool LLPanelEnvironmentInfo::getSelectedDayCycleParams(LLSD& day_cycle, LLSD& sky_map, short& scope) +{ + std::string preset_key(mDayCyclePresetCombo->getValue().asString()); + LLWLParamKey dc(preset_key); + LL_DEBUGS("Windlight") << "Use day cycle: " << dc.toLLSD() << LL_ENDL; + + if (dc.scope == LLEnvKey::SCOPE_REGION) // current region day cycle + { + const LLEnvironmentSettings& cur_region_settings = LLEnvManagerNew::instance().getRegionSettings(); + day_cycle = cur_region_settings.getWLDayCycle(); + sky_map = cur_region_settings.getSkyMap(); + } + else // a local day cycle + { + if (!LLDayCycleManager::instance().getPreset(dc.name, day_cycle)) + { + llwarns << "Error getting day cycle " << dc.name << llendl; + return false; + } + + // Create sky map from the day cycle. + { + std::map refs; + LLWLDayCycle tmp_day; + + tmp_day.loadDayCycle(day_cycle, dc.scope); + tmp_day.getSkyRefs(refs); + + sky_map = LLWLParamManager::createSkyMap(refs); + } + } + + scope = dc.scope; + + return true; +} void LLPanelEnvironmentInfo::onSwitchRegionSettings() { - getChild("user_environment_settings")->setEnabled(mRegionSettingsRadioGroup->getSelectedIndex() != 0); + bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; + getChild("user_environment_settings")->setEnabled(!use_defaults); + + if (use_defaults) + { + LLEnvManagerNew::instance().useDefaults(); + } + else + { + onSelectWaterPreset(); + onSwitchDayCycle(); + } } void LLPanelEnvironmentInfo::onSwitchDayCycle() @@ -3378,13 +3486,52 @@ void LLPanelEnvironmentInfo::onSwitchDayCycle() mSkyPresetCombo->setEnabled(is_fixed_sky); mDayCyclePresetCombo->setEnabled(!is_fixed_sky); + + if (is_fixed_sky) + { + onSelectSkyPreset(); + } + else + { + onSelectDayCycle(); + } +} + +void LLPanelEnvironmentInfo::onSelectWaterPreset() +{ + LLSD water_params; + + if (getSelectedWaterParams(water_params)) + { + LLEnvManagerNew::instance().useWaterParams(water_params); + } } -void LLPanelEnvironmentInfo::onBtnSave() +void LLPanelEnvironmentInfo::onSelectSkyPreset() { - LL_DEBUGS("Windlight") << "About to save region settings" << LL_ENDL; + LLSD params; + std::string dummy; + + if (getSelectedSkyParams(params, dummy)) + { + LLEnvManagerNew::instance().useSkyParams(params); + } +} + +void LLPanelEnvironmentInfo::onSelectDayCycle() +{ + LLSD day_cycle; + LLSD sky_map; // unused + short scope; - const LLEnvironmentSettings& old_region_settings = LLEnvManagerNew::instance().getRegionSettings(); + if (getSelectedDayCycleParams(day_cycle, sky_map, scope)) + { + LLEnvManagerNew::instance().useDayCycleParams(day_cycle, (LLEnvKey::EScope) scope); + } +} + +void LLPanelEnvironmentInfo::onBtnApply() +{ const bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; const bool use_fixed_sky = mDayCycleSettingsRadioGroup->getSelectedIndex() == 0; @@ -3402,79 +3549,44 @@ void LLPanelEnvironmentInfo::onBtnSave() if (use_fixed_sky) { LL_DEBUGS("Windlight") << "Use fixed sky" << LL_ENDL; - std::string preset_key(mSkyPresetCombo->getValue().asString()); - LLWLParamKey preset(preset_key); - // Get the preset sky params. - LLWLParamSet params; - if (!LLWLParamManager::instance().getParamSet(preset, params)) + // Get selected sky params. + LLSD params; + std::string preset_name; + if (!getSelectedSkyParams(params, preset_name)) { - llwarns << "Error getting sky params: " << preset.toLLSD() << llendl; return; } // Create a day cycle consisting of a single sky preset. LLSD key(LLSD::emptyArray()); key.append(-1.0f); // indicate that user preference is actually fixed sky, not a day cycle - key.append(preset.name); + key.append(preset_name); day_cycle.append(key); // Create a sky map consisting of only the sky preset. std::map refs; - refs[preset] = params; + LLWLParamSet param_set; + param_set.setAll(params); + refs[LLWLParamKey(preset_name, LLEnvKey::SCOPE_LOCAL)] = param_set; // scope doesn't matter here sky_map = LLWLParamManager::createSkyMap(refs); } else // use day cycle { - std::string preset_key(mDayCyclePresetCombo->getValue().asString()); - LLWLParamKey dc(preset_key); - LL_DEBUGS("Windlight") << "Use day cycle: " << dc.toLLSD() << LL_ENDL; + LL_DEBUGS("Windlight") << "Use day cycle" << LL_ENDL; - if (dc.scope == LLEnvKey::SCOPE_REGION) // current region day cycle - { - day_cycle = old_region_settings.getWLDayCycle(); - sky_map = old_region_settings.getSkyMap(); - } - else // a local day cycle + short scope; // unused + if (!getSelectedDayCycleParams(day_cycle, sky_map, scope)) { - if (!LLDayCycleManager::instance().getPreset(dc.name, day_cycle)) - { - llwarns << "Error getting day cycle " << dc.name << llendl; - return; - } - - // Create sky map from the day cycle. - { - std::map refs; - LLWLDayCycle tmp_day; - - tmp_day.loadDayCycle(day_cycle, dc.scope); - tmp_day.getSkyRefs(refs); - - sky_map = LLWLParamManager::createSkyMap(refs); - } - - LL_DEBUGS("Windlight") << "day_cycle: " << day_cycle << LL_ENDL; - LL_DEBUGS("Windlight") << "sky_map: " << sky_map << LL_ENDL; + return; } } // Get water params. - LLWLParamKey water_key(mWaterPresetCombo->getSelectedValue()); - if (water_key.scope == LLEnvKey::SCOPE_REGION) - { - water_params = old_region_settings.getWaterParams(); - } - else + if (!getSelectedWaterParams(water_params)) { - LLWaterParamSet param_set; - if (!LLWaterParamManager::instance().getParamSet(water_key.name, param_set)) - { - llwarns << "Error getting water preset: " << water_key.name << llendl; - return; - } - - water_params = param_set.getAll(); + // *TODO: show a notification? + return; } } @@ -3492,8 +3604,16 @@ void LLPanelEnvironmentInfo::onBtnSave() void LLPanelEnvironmentInfo::onBtnCancel() { - // Reload current region settings. + // Reload last saved region settings. refresh(); + + // Apply them. + LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); + const LLEnvironmentSettings& cur_settings = env_mgr.getRegionSettings(); + const LLSD& region_day_cycle = cur_settings.getWLDayCycle(); + const LLSD& region_water = cur_settings.getWaterParams(); + env_mgr.useWaterParams(region_water); + env_mgr.useDayCycleParams(region_day_cycle, LLEnvKey::SCOPE_REGION); } void LLPanelEnvironmentInfo::onRegionSettingschange() -- cgit v1.2.3 From c5bf566b2fae1688d9639b4e9e846d70a8c43e83 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 26 May 2011 16:55:59 -0400 Subject: storm-1281: remove estate time from region/estate floater, storm-1282: fix reordering of region/estate tabs --- indra/newview/llfloaterregioninfo.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 7c26b3e29d..a1d311e395 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -205,23 +205,22 @@ BOOL LLFloaterRegionInfo::postBuild() // contruct the panels LLPanelRegionInfo* panel; - panel = new LLPanelRegionGeneralInfo; - mInfoPanels.push_back(panel); - panel->getCommitCallbackRegistrar().add("RegionInfo.ManageTelehub", boost::bind(&LLPanelRegionInfo::onClickManageTelehub, panel)); - - panel->buildFromFile("panel_region_general.xml"); - mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true)); - panel = new LLPanelEstateInfo; mInfoPanels.push_back(panel); panel->buildFromFile("panel_region_estate.xml"); - mTab->addTabPanel(panel); + mTab->addTabPanel(LLTabContainer::TabPanelParams().panel(panel).select_tab(true)); panel = new LLPanelEstateCovenant; mInfoPanels.push_back(panel); panel->buildFromFile("panel_region_covenant.xml"); mTab->addTabPanel(panel); + panel = new LLPanelRegionGeneralInfo; + mInfoPanels.push_back(panel); + panel->getCommitCallbackRegistrar().add("RegionInfo.ManageTelehub", boost::bind(&LLPanelRegionInfo::onClickManageTelehub, panel)); + panel->buildFromFile("panel_region_general.xml"); + mTab->addTabPanel(panel); + panel = new LLPanelRegionTerrainInfo; mInfoPanels.push_back(panel); panel->buildFromFile("panel_region_terrain.xml"); -- cgit v1.2.3 From 327c0401e650aa9d3674ef438b9e0599e26ef3a6 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 27 May 2011 02:43:36 +0300 Subject: STORM-1289 PARTIAL_FIX Re-applying the current region day cycle now doesn't revert region setting to fixed sky. --- indra/newview/llfloaterregioninfo.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index ee3d00206f..712cf921d2 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3580,6 +3580,15 @@ void LLPanelEnvironmentInfo::onBtnApply() { return; } + + // If it's a single-preset day cycle, reset the frame time to a non-negative value + // so that the region setting is displayed in the floater as + // a day cycle, not a preset. (STORM-1289) + if (day_cycle.size() == 1 && day_cycle[0][0].asReal() < 0.0f) + { + LL_DEBUGS("Windlight") << "Fixing negative time" << LL_ENDL; + day_cycle[0][0] = 0.0f; + } } // Get water params. -- cgit v1.2.3 From 6bc23e1be7e055b4f80f5c5de9dcd186a92a21a4 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 27 May 2011 03:00:22 +0300 Subject: STORM-1289 ADDITIONAL_FIX Updated a comment. --- indra/newview/llfloaterregioninfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 712cf921d2..9d1cbb47ee 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3581,7 +3581,8 @@ void LLPanelEnvironmentInfo::onBtnApply() return; } - // If it's a single-preset day cycle, reset the frame time to a non-negative value + // If it's a special single-preset day cycle meaning using a fixed sky, + // reset the frame time to a non-negative value, // so that the region setting is displayed in the floater as // a day cycle, not a preset. (STORM-1289) if (day_cycle.size() == 1 && day_cycle[0][0].asReal() < 0.0f) -- cgit v1.2.3 From 1dd6d3f43e465b29a9ed3a672db13db4f6654435 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 30 May 2011 22:47:17 +0300 Subject: STORM-1256 WIP Grey out Apply/Cancel buttons when no local change made. --- indra/newview/llfloaterregioninfo.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 90b6ba0a43..2778671e24 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3342,6 +3342,8 @@ void LLPanelEnvironmentInfo::refresh() mDayCycleSettingsRadioGroup->setSelectedIndex(use_fixed_sky ? 0 : 1); setControlsEnabled(mEnableEditing); + + setDirty(false); } void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) @@ -3384,6 +3386,12 @@ void LLPanelEnvironmentInfo::setApplyProgress(bool started) } } +void LLPanelEnvironmentInfo::setDirty(bool dirty) +{ + getChildView("apply_btn")->setEnabled(dirty); + getChildView("cancel_btn")->setEnabled(dirty); +} + void LLPanelEnvironmentInfo::populateWaterPresetsList() { mWaterPresetCombo->removeall(); @@ -3558,6 +3566,8 @@ void LLPanelEnvironmentInfo::onSwitchRegionSettings() onSelectWaterPreset(); onSwitchDayCycle(); } + + setDirty(true); } void LLPanelEnvironmentInfo::onSwitchDayCycle() @@ -3575,6 +3585,8 @@ void LLPanelEnvironmentInfo::onSwitchDayCycle() { onSelectDayCycle(); } + + setDirty(true); } void LLPanelEnvironmentInfo::onSelectWaterPreset() @@ -3585,6 +3597,8 @@ void LLPanelEnvironmentInfo::onSelectWaterPreset() { LLEnvManagerNew::instance().useWaterParams(water_params); } + + setDirty(true); } void LLPanelEnvironmentInfo::onSelectSkyPreset() @@ -3596,6 +3610,8 @@ void LLPanelEnvironmentInfo::onSelectSkyPreset() { LLEnvManagerNew::instance().useSkyParams(params); } + + setDirty(true); } void LLPanelEnvironmentInfo::onSelectDayCycle() @@ -3608,6 +3624,8 @@ void LLPanelEnvironmentInfo::onSelectDayCycle() { LLEnvManagerNew::instance().useDayCycleParams(day_cycle, (LLEnvKey::EScope) scope); } + + setDirty(true); } void LLPanelEnvironmentInfo::onBtnApply() -- cgit v1.2.3 From 778088b74c19773646a50b5c0aa40015f2b242f3 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 31 May 2011 22:36:26 +0300 Subject: STORM-1253 WIP Implemented editing region day cycle. --- indra/newview/llfloaterregioninfo.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 2778671e24..39ed2534b2 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3538,13 +3538,9 @@ bool LLPanelEnvironmentInfo::getSelectedDayCycleParams(LLSD& day_cycle, LLSD& sk // Create sky map from the day cycle. { - std::map refs; LLWLDayCycle tmp_day; - tmp_day.loadDayCycle(day_cycle, dc.scope); - tmp_day.getSkyRefs(refs); - - sky_map = LLWLParamManager::createSkyMap(refs); + tmp_day.getSkyMap(sky_map); } } -- cgit v1.2.3 From 6d4198b89a3edf28e208391bbdde90a7a000d936 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 31 May 2011 23:03:59 +0300 Subject: STORM-1244 WIP Fixed modifying user preferences when the Environment Settings floater is opened. --- indra/newview/llfloaterregioninfo.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 39ed2534b2..414695d40f 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3287,6 +3287,7 @@ BOOL LLPanelEnvironmentInfo::postBuild() mDayCyclePresetCombo->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSelectDayCycle, this)); childSetCommitCallback("apply_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnApply, this), NULL); + getChild("apply_btn")->setRightMouseDownCallback(boost::bind(&LLEnvManagerNew::dumpUserPrefs, LLEnvManagerNew::getInstance())); childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL); LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingschange, this)); -- cgit v1.2.3 From 995a006b58f2be1d7236b32be3570b6d7250013b Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 1 Jun 2011 18:26:36 +0300 Subject: STORM-1253 WIP Update UI when a day cycle gets added or deleted. --- indra/newview/llfloaterregioninfo.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 414695d40f..db1eae5835 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3293,6 +3293,8 @@ BOOL LLPanelEnvironmentInfo::postBuild() LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingschange, this)); LLEnvManagerNew::instance().setRegionSettingsAppliedCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingsApplied, this, _1)); + LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLPanelEnvironmentInfo::onDayCycleListChange, this)); + return TRUE; } @@ -3747,3 +3749,8 @@ void LLPanelEnvironmentInfo::onRegionSettingsApplied(bool ok) LLEnvManagerNew::instance().requestRegionSettings(); } } + +void LLPanelEnvironmentInfo::onDayCycleListChange() +{ + populateDayCyclesList(); +} -- cgit v1.2.3 From dda7df4ac94d1e269aa0ce9eff6c6078f756cbd9 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 2 Jun 2011 18:35:23 +0300 Subject: STORM-1253 WIP Debugging stuff. --- indra/newview/llfloaterregioninfo.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index ad63300259..ab164e7db0 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3295,6 +3295,7 @@ BOOL LLPanelEnvironmentInfo::postBuild() childSetCommitCallback("apply_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnApply, this), NULL); getChild("apply_btn")->setRightMouseDownCallback(boost::bind(&LLEnvManagerNew::dumpUserPrefs, LLEnvManagerNew::getInstance())); childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL); + getChild("cancel_btn")->setRightMouseDownCallback(boost::bind(&LLEnvManagerNew::dumpPresets, LLEnvManagerNew::getInstance())); LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingschange, this)); LLEnvManagerNew::instance().setRegionSettingsAppliedCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingsApplied, this, _1)); -- cgit v1.2.3 From 7151a4e6b02f02155387fc595034a42aebd7ec9c Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 7 Jun 2011 17:41:26 +0300 Subject: STORM-1255 WIP Consistency pass on sky presets removal. * Update all related floaters when a sky preset gets removed. * Don't allow removing skies referenced by (local) day cycles. * Other minor fixes. --- indra/newview/llfloaterregioninfo.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index ab164e7db0..567183b955 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3300,7 +3300,8 @@ BOOL LLPanelEnvironmentInfo::postBuild() LLEnvManagerNew::instance().setRegionSettingsChangeCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingschange, this)); LLEnvManagerNew::instance().setRegionSettingsAppliedCallback(boost::bind(&LLPanelEnvironmentInfo::onRegionSettingsApplied, this, _1)); - LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLPanelEnvironmentInfo::onDayCycleListChange, this)); + LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLPanelEnvironmentInfo::populateDayCyclesList, this)); + LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelEnvironmentInfo::populateSkyPresetsList, this)); return TRUE; } @@ -3756,8 +3757,3 @@ void LLPanelEnvironmentInfo::onRegionSettingsApplied(bool ok) LLEnvManagerNew::instance().requestRegionSettings(); } } - -void LLPanelEnvironmentInfo::onDayCycleListChange() -{ - populateDayCyclesList(); -} -- cgit v1.2.3 From ebdb41e5d630cad91dab5372ffc0b4f461a85426 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 9 Jun 2011 18:48:24 +0300 Subject: STORM-1254 WIP Implemented deleting local water presets. --- indra/newview/llfloaterregioninfo.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 567183b955..cb84eaed34 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3302,6 +3302,7 @@ BOOL LLPanelEnvironmentInfo::postBuild() LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLPanelEnvironmentInfo::populateDayCyclesList, this)); LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelEnvironmentInfo::populateSkyPresetsList, this)); + LLWaterParamManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelEnvironmentInfo::populateWaterPresetsList, this)); return TRUE; } -- cgit v1.2.3 From 150c18169de8b7155658e676b86014716f62aeed Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 10 Jun 2011 19:55:30 +0300 Subject: STORM-1305 WIP Made LLWaterParamManager::mParamList private and typedef'ed its type. --- indra/newview/llfloaterregioninfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index cb84eaed34..a7ab75a85e 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3418,8 +3418,8 @@ void LLPanelEnvironmentInfo::populateWaterPresetsList() } // Add local water presets. - const std::map &water_params_map = LLWaterParamManager::instance().mParamList; - for (std::map::const_iterator it = water_params_map.begin(); it != water_params_map.end(); it++) + const LLWaterParamManager::preset_map_t &water_params_map = LLWaterParamManager::instance().getPresets(); + for (LLWaterParamManager::preset_map_t::const_iterator it = water_params_map.begin(); it != water_params_map.end(); it++) { mWaterPresetCombo->add(it->first, LLWLParamKey(it->first, LLEnvKey::SCOPE_LOCAL).toLLSD()); } -- cgit v1.2.3 From 23d8fb9750afc158d97fdf51633ed59b1b36f223 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 10 Jun 2011 21:21:04 +0300 Subject: STORM-1305 WIP User water presets now go first in all lists. Besides, removed all cases of direct access to the water presets map in preparation for future lazy loading. --- indra/newview/llfloaterregioninfo.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index a7ab75a85e..01070fe3e1 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3417,11 +3417,24 @@ void LLPanelEnvironmentInfo::populateWaterPresetsList() mWaterPresetCombo->addSeparator(); } - // Add local water presets. - const LLWaterParamManager::preset_map_t &water_params_map = LLWaterParamManager::instance().getPresets(); - for (LLWaterParamManager::preset_map_t::const_iterator it = water_params_map.begin(); it != water_params_map.end(); it++) + std::list user_presets, system_presets; + LLWaterParamManager::instance().getPresetNames(user_presets, system_presets); + + // Add local user presets first. + for (std::list::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it) + { + mWaterPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD()); + } + + if (user_presets.size() > 0) + { + mWaterPresetCombo->addSeparator(); + } + + // Add local system presets. + for (std::list::const_iterator it = system_presets.begin(); it != system_presets.end(); ++it) { - mWaterPresetCombo->add(it->first, LLWLParamKey(it->first, LLEnvKey::SCOPE_LOCAL).toLLSD()); + mWaterPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD()); } // There's no way to select current preset because its name is not stored on server. -- cgit v1.2.3 From 4fd946fa3e5217b8f64e0fcd91d268c7eaf1bbf5 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 10 Jun 2011 23:44:13 +0300 Subject: STORM-1305 WIP User sky presets now go first in all lists. --- indra/newview/llfloaterregioninfo.cpp | 44 ++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 14 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 01070fe3e1..3734e5e280 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3444,23 +3444,39 @@ void LLPanelEnvironmentInfo::populateSkyPresetsList() { mSkyPresetCombo->removeall(); - 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++) + LLWLParamManager::preset_name_list_t region_presets; + LLWLParamManager::preset_name_list_t user_presets, sys_presets; + LLWLParamManager::instance().getPresetNames(region_presets, user_presets, sys_presets); + + // Add region presets. + std::string region_name = gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown"); + for (LLWLParamManager::preset_name_list_t::const_iterator it = region_presets.begin(); it != region_presets.end(); ++it) { - std::string preset_name = it->first.name; - std::string item_title; + std::string preset_name = *it; + std::string item_title = preset_name + " (" + region_name + ")"; + mSkyPresetCombo->add(item_title, LLWLParamKey(preset_name, LLEnvKey::SCOPE_REGION).toStringVal()); + } - if (it->first.scope == LLEnvKey::SCOPE_LOCAL) // local preset - { - item_title = preset_name; - } - else // region preset - { - item_title = preset_name + " (" + gAgent.getRegion()->getName() + ")"; - } + if (!region_presets.empty()) + { + mSkyPresetCombo->addSeparator(); + } - // Saving as string instead of LLSD() for selectByValue() to work, as it doesn't support non-scalar values. - mSkyPresetCombo->add(item_title, it->first.toStringVal()); + // Add user presets. + for (LLWLParamManager::preset_name_list_t::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it) + { + mSkyPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); + } + + if (!user_presets.empty()) + { + mSkyPresetCombo->addSeparator(); + } + + // Add system presets. + for (LLWLParamManager::preset_name_list_t::const_iterator it = sys_presets.begin(); it != sys_presets.end(); ++it) + { + mSkyPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); } // Select current preset. -- cgit v1.2.3 From ab431d1774d5b282836a3327dd0bfa8b3b91632b Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 14 Jun 2011 18:04:29 +0300 Subject: STORM-1305 WIP User day cycles now go first in all lists. --- indra/newview/llfloaterregioninfo.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 3734e5e280..4535ad0240 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3504,13 +3504,23 @@ void LLPanelEnvironmentInfo::populateDayCyclesList() mDayCyclePresetCombo->addSeparator(); } - // Add local day cycles. - const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); - for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) + // Add local user day cycles. + LLDayCycleManager::preset_name_list_t user_days, sys_days; + LLDayCycleManager::instance().getPresetNames(user_days, sys_days); + for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it) { - std::string name = it->first; - LLWLParamKey key(name, LLEnvKey::SCOPE_LOCAL); - mDayCyclePresetCombo->add(name, key.toStringVal()); + mDayCyclePresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); + } + + if (user_days.size() > 0) + { + mDayCyclePresetCombo->addSeparator(); + } + + // Add local system day cycles. + for (LLDayCycleManager::preset_name_list_t::const_iterator it = sys_days.begin(); it != sys_days.end(); ++it) + { + mDayCyclePresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); } // Current day cycle is already selected. -- cgit v1.2.3 From 3a552f5b8bdd425cad666d828d35199cb9b8a85d Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 1 Jul 2011 17:33:57 +0300 Subject: STORM-1464 WIP Removed references to a nonexistent Apply button from the Region/Estate floater. --- indra/newview/llfloaterregioninfo.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index b13233d684..0b66b05350 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -544,8 +544,13 @@ void LLPanelRegionInfo::onChangeText(LLLineEditor* caller, void* user_data) // virtual BOOL LLPanelRegionInfo::postBuild() { - getChild("apply_btn")->setCommitCallback(boost::bind(&LLPanelRegionInfo::onBtnSet, this)); - getChildView("apply_btn")->setEnabled(FALSE); + // If the panel has an Apply button, set a callback for it. + LLUICtrl* apply_btn = findChild("apply_btn"); + if (apply_btn) + { + apply_btn->setCommitCallback(boost::bind(&LLPanelRegionInfo::onBtnSet, this)); + } + refresh(); return TRUE; } @@ -597,12 +602,14 @@ void LLPanelRegionInfo::sendEstateOwnerMessage( void LLPanelRegionInfo::enableButton(const std::string& btn_name, BOOL enable) { - getChildView(btn_name)->setEnabled(enable); + LLView* button = findChildView(btn_name); + if (button) button->setEnabled(enable); } void LLPanelRegionInfo::disableButton(const std::string& btn_name) { - getChildView(btn_name)->setEnabled(FALSE); + LLView* button = findChildView(btn_name); + if (button) button->setEnabled(FALSE); } void LLPanelRegionInfo::initCtrl(const std::string& name) @@ -2115,7 +2122,6 @@ void LLPanelEstateInfo::updateControls(LLViewerRegion* region) BOOL manager = (region && region->isEstateManager()); setCtrlsEnabled(god || owner || manager); - getChildView("apply_btn")->setEnabled(FALSE); getChildView("add_allowed_avatar_btn")->setEnabled(god || owner || manager); getChildView("remove_allowed_avatar_btn")->setEnabled(god || owner || manager); getChildView("add_allowed_group_btn")->setEnabled(god || owner || manager); -- cgit v1.2.3 From 2fc65cae7b073077c29133dc4cfc438880163746 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 1 Jul 2011 20:05:49 +0300 Subject: STORM-1464 FIXED Fixed inability to change terrain settings. Reason: The "setregionterrain" message missed estate/region sun info and thus was incomplete. Fix: Added missing fields back. Note: The fields' values are fake. --- indra/newview/llfloaterregioninfo.cpp | 48 ++++++++++------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 0b66b05350..dfc5d1ec04 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -68,6 +68,7 @@ #include "llnamelistctrl.h" #include "llnotifications.h" #include "llnotificationsutil.h" +#include "llregioninfomodel.h" #include "llscrolllistitem.h" #include "llsliderctrl.h" #include "llslurl.h" @@ -1288,55 +1289,34 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() // strings[7] = from estate, 'Y' fixed sun // strings[8] = from estate, float sun_hour + LLRegionInfoModel& region_info = LLRegionInfoModel::instance(); + bool region_use_estate_sun = region_info.mUseEstateSun; + bool region_use_fixed_sun = region_info.getUseFixedSun(); // *TODO: take into account region environment settings + F32 region_sun_hour = region_info.mSunHour; + + // *NOTE: this resets estate sun info. + BOOL estate_global_time = true; + BOOL estate_fixed_sun = false; + F32 estate_sun_hour = 0.f; + buffer = llformat("%f", (F32)getChild("water_height_spin")->getValue().asReal()); strings.push_back(buffer); buffer = llformat("%f", (F32)getChild("terrain_raise_spin")->getValue().asReal()); strings.push_back(buffer); buffer = llformat("%f", (F32)getChild("terrain_lower_spin")->getValue().asReal()); strings.push_back(buffer); - -#ifndef TMP_DISABLE_WLES - /* - * This message is failing - * We need to fix how the following values are obtained - */ - buffer = llformat("%s", (getChild("use_estate_sun_check")->getValue().asBoolean() ? "Y" : "N")); + buffer = llformat("%s", (region_use_estate_sun ? "Y" : "N")); strings.push_back(buffer); - buffer = llformat("%s", (getChild("fixed_sun_check")->getValue().asBoolean() ? "Y" : "N")); + buffer = llformat("%s", (region_use_fixed_sun ? "Y" : "N")); strings.push_back(buffer); - buffer = llformat("%f", (F32)getChild("sun_hour_slider")->getValue().asReal() ); + buffer = llformat("%f", region_sun_hour); strings.push_back(buffer); - - // Grab estate information in case the user decided to set the - // region back to estate time. - LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance("region_info"); - if (!floater) return true; - - LLTabContainer* tab = floater->getChild("region_panels"); - if (!tab) return true; - - LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild("Estate"); - if (!panel) return true; - - BOOL estate_global_time = panel->getGlobalTime(); - BOOL estate_fixed_sun = panel->getFixedSun(); - F32 estate_sun_hour; - if (estate_global_time) - { - estate_sun_hour = 0.f; - } - else - { - estate_sun_hour = panel->getSunHour(); - } - buffer = llformat("%s", (estate_global_time ? "Y" : "N") ); strings.push_back(buffer); buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") ); strings.push_back(buffer); buffer = llformat("%f", estate_sun_hour); strings.push_back(buffer); -#endif // TMP_DISABLE_WLES sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings); strings.clear(); -- cgit v1.2.3 From 7aa7ee68387bf9393db023f6961340e8fa247bfb Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 5 Jul 2011 17:51:22 +0300 Subject: STORM-1330 WIP Switched the Terrain tab of the Region/Estate floater to using the region info model. --- indra/newview/llfloaterregioninfo.cpp | 57 ++++++++--------------------------- 1 file changed, 12 insertions(+), 45 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index dfc5d1ec04..b6339387a9 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -342,6 +342,9 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) LLViewerRegion* region = gAgent.getRegion(); BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); + // *TODO: Replace parcing msg with accessing the region info model. + LLRegionInfoModel& region_info = LLRegionInfoModel::instance(); + // extract message std::string sim_name; std::string sim_type = LLTrans::getString("land_type_unknown"); @@ -413,9 +416,9 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel = tab->getChild("Terrain"); panel->getChild("region_text")->setValue(LLSD(sim_name)); - panel->getChild("water_height_spin")->setValue(LLSD(water_height)); - panel->getChild("terrain_raise_spin")->setValue(LLSD(terrain_raise_limit)); - panel->getChild("terrain_lower_spin")->setValue(LLSD(terrain_lower_limit)); + panel->getChild("water_height_spin")->setValue(region_info.mWaterHeight); + panel->getChild("terrain_raise_spin")->setValue(region_info.mTerrainRaiseLimit); + panel->getChild("terrain_lower_spin")->setValue(region_info.mTerrainLowerLimit); panel->setCtrlsEnabled(allow_modify); @@ -1276,50 +1279,14 @@ BOOL LLPanelRegionTerrainInfo::sendUpdate() strings_t strings; LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); - // ========================================== - // Assemble and send setregionterrain message - // "setregionterrain" - // strings[0] = float water height - // strings[1] = float terrain raise - // strings[2] = float terrain lower - // strings[3] = 'Y' use estate time - // strings[4] = 'Y' fixed sun - // strings[5] = float sun_hour - // strings[6] = from estate, 'Y' use global time - // strings[7] = from estate, 'Y' fixed sun - // strings[8] = from estate, float sun_hour - + // update the model LLRegionInfoModel& region_info = LLRegionInfoModel::instance(); - bool region_use_estate_sun = region_info.mUseEstateSun; - bool region_use_fixed_sun = region_info.getUseFixedSun(); // *TODO: take into account region environment settings - F32 region_sun_hour = region_info.mSunHour; - - // *NOTE: this resets estate sun info. - BOOL estate_global_time = true; - BOOL estate_fixed_sun = false; - F32 estate_sun_hour = 0.f; + region_info.mWaterHeight = (F32) getChild("water_height_spin")->getValue().asReal(); + region_info.mTerrainRaiseLimit = (F32) getChild("terrain_raise_spin")->getValue().asReal(); + region_info.mTerrainLowerLimit = (F32) getChild("terrain_lower_spin")->getValue().asReal(); - buffer = llformat("%f", (F32)getChild("water_height_spin")->getValue().asReal()); - strings.push_back(buffer); - buffer = llformat("%f", (F32)getChild("terrain_raise_spin")->getValue().asReal()); - strings.push_back(buffer); - buffer = llformat("%f", (F32)getChild("terrain_lower_spin")->getValue().asReal()); - strings.push_back(buffer); - buffer = llformat("%s", (region_use_estate_sun ? "Y" : "N")); - strings.push_back(buffer); - buffer = llformat("%s", (region_use_fixed_sun ? "Y" : "N")); - strings.push_back(buffer); - buffer = llformat("%f", region_sun_hour); - strings.push_back(buffer); - buffer = llformat("%s", (estate_global_time ? "Y" : "N") ); - strings.push_back(buffer); - buffer = llformat("%s", (estate_fixed_sun ? "Y" : "N") ); - strings.push_back(buffer); - buffer = llformat("%f", estate_sun_hour); - strings.push_back(buffer); - - sendEstateOwnerMessage(gMessageSystem, "setregionterrain", invoice, strings); - strings.clear(); + // and sync the region with it + region_info.sendRegionTerrain(invoice); // ======================================= // Assemble and send texturedetail message -- cgit v1.2.3 From 02c9c49788c6677a4332246a8d748d3e002c712f Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 5 Jul 2011 22:52:31 +0300 Subject: STORM-1330 WIP Override region sun position when switching the region to fixed sky. --- indra/newview/llfloaterregioninfo.cpp | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index b6339387a9..59a996b2ed 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -2994,6 +2994,8 @@ bool LLDispatchEstateUpdateInfo::operator()( const LLUUID& invoice, const sparam_t& strings) { + lldebugs << "Received estate update" << llendl; + LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); if (!panel) return true; @@ -3020,10 +3022,13 @@ bool LLDispatchEstateUpdateInfo::operator()( F32 sun_hour = ((F32)(strtod(strings[4].c_str(), NULL)))/1024.0f; if(sun_hour == 0 && (flags & REGION_FLAGS_SUN_FIXED ? FALSE : TRUE)) { + // no need to overwrite region sun phase? + lldebugs << "Estate uses global time" << llendl; panel->setGlobalTime(TRUE); } else { + lldebugs << "Estate sun hour: " << sun_hour << llendl; panel->setGlobalTime(FALSE); panel->setSunHour(sun_hour); } @@ -3355,6 +3360,33 @@ void LLPanelEnvironmentInfo::setDirty(bool dirty) getChildView("cancel_btn")->setEnabled(dirty); } +void LLPanelEnvironmentInfo::sendRegionSunUpdate(F32 sun_angle) +{ + LLRegionInfoModel& region_info = LLRegionInfoModel::instance(); + bool region_use_fixed_sky = sun_angle >= 0.f; + + // Set sun hour. + if (region_use_fixed_sky) + { + LLWLParamSet param_set; + LLSD params; + std::string unused; + if (!getSelectedSkyParams(params, unused)) + { + return; + } + param_set.setAll(params); + + // convert value range from 0..2pi to 6..30 + region_info.mSunHour = fmodf((sun_angle / F_TWO_PI) * 24.f, 24.f) + 6.f; + } + + region_info.setUseFixedSun(region_use_fixed_sky); + region_info.mUseEstateSun = !region_use_fixed_sky; + + region_info.sendRegionTerrain(LLFloaterRegionInfo::getLastInvoice()); +} + void LLPanelEnvironmentInfo::populateWaterPresetsList() { mWaterPresetCombo->removeall(); @@ -3634,6 +3666,7 @@ void LLPanelEnvironmentInfo::onBtnApply() LLSD day_cycle; LLSD sky_map; LLSD water_params; + F32 sun_angle = -1.f; // invalid value meaning no fixed sky if (use_defaults) { @@ -3666,6 +3699,9 @@ void LLPanelEnvironmentInfo::onBtnApply() param_set.setAll(params); refs[LLWLParamKey(preset_name, LLEnvKey::SCOPE_LOCAL)] = param_set; // scope doesn't matter here sky_map = LLWLParamManager::createSkyMap(refs); + + // Remember the sun angle to set fixed region sun hour below. + sun_angle = param_set.getSunAngle(); } else // use day cycle { @@ -3686,6 +3722,16 @@ void LLPanelEnvironmentInfo::onBtnApply() LL_DEBUGS("Windlight") << "Fixing negative time" << LL_ENDL; day_cycle[0][0] = 0.0f; } + + // If the day cycle contains exactly one preset (i.e it's effectively a fixed sky), + // remember the preset's sun angle to set fixed region sun hour below. + if (sky_map.size() == 1) + { + LLWLParamSet param_set; + llassert(sky_map.isMap()); + param_set.setAll(sky_map.beginMap()->second); + sun_angle = param_set.getSunAngle(); + } } // Get water params. @@ -3705,6 +3751,10 @@ void LLPanelEnvironmentInfo::onBtnApply() return; } + // Set the region sun phase/flags according to the chosen new preferences. + sendRegionSunUpdate(sun_angle); + + // Start spinning the progress indicator. setApplyProgress(true); } -- cgit v1.2.3 From d3493527401756a87ba3ab1ac05223ef2e214906 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 5 Jul 2011 23:25:08 +0300 Subject: STORM-1330 WIP Removing a comment that was added by mistake. --- indra/newview/llfloaterregioninfo.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 59a996b2ed..d84f4c26c4 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3022,7 +3022,6 @@ bool LLDispatchEstateUpdateInfo::operator()( F32 sun_hour = ((F32)(strtod(strings[4].c_str(), NULL)))/1024.0f; if(sun_hour == 0 && (flags & REGION_FLAGS_SUN_FIXED ? FALSE : TRUE)) { - // no need to overwrite region sun phase? lldebugs << "Estate uses global time" << llendl; panel->setGlobalTime(TRUE); } -- cgit v1.2.3 From 31c1cff64fe6e963722e580c8779d69cef4b14ba Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 6 Jul 2011 00:42:28 +0300 Subject: STORM-1262 FIXED Removed the original Windlight Region Settings implementation. --- indra/newview/llfloaterregioninfo.cpp | 110 ---------------------------------- 1 file changed, 110 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index d84f4c26c4..07c0878877 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -55,14 +55,12 @@ #include "lldaycyclemanager.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" #include "llfloaterreg.h" #include "llfloaterregiondebugconsole.h" #include "llfloatertelehub.h" -#include "llfloaterwindlight.h" #include "llinventorymodel.h" #include "lllineeditor.h" #include "llnamelistctrl.h" @@ -93,9 +91,6 @@ #include "llagentui.h" #include "llmeshrepository.h" -// contains includes needed for WL estate settings -#include "llfloaterwater.h" - const S32 TERRAIN_TEXTURE_COUNT = 4; const S32 CORNER_COUNT = 4; @@ -1151,36 +1146,11 @@ BOOL LLPanelRegionTerrainInfo::validateTextureSizes() // LLPanelRegionTerrainInfo ///////////////////////////////////////////////////////////////////////////// // Initialize statics -LLPanelRegionTerrainInfo* LLPanelRegionTerrainInfo::sPanelRegionTerrainInfo = NULL; - -// static -LLPanelRegionTerrainInfo* LLPanelRegionTerrainInfo::instance() -{ - if (!sPanelRegionTerrainInfo) - { - sPanelRegionTerrainInfo = LLFloaterRegionInfo::getPanelRegionTerrain(); - lldebugs << llformat("Instantiating sPanelRegionTerrainInfo: %p", sPanelRegionTerrainInfo) << llendl; - } - return sPanelRegionTerrainInfo; -} - -// static -void LLPanelRegionTerrainInfo::onFloaterClose(bool app_quitting) -{ - if (sPanelRegionTerrainInfo) - { - lldebugs << "Setting LLPanelRegionTerrainInfo to NULL" << llendl; - sPanelRegionTerrainInfo = NULL; - } -} BOOL LLPanelRegionTerrainInfo::postBuild() { LLPanelRegionInfo::postBuild(); - sPanelRegionTerrainInfo = this; // singleton instance pointer - lldebugs << llformat("Setting sPanelRegionTerrainInfo to: %p", sPanelRegionTerrainInfo) << llendl; - initCtrl("water_height_spin"); initCtrl("terrain_raise_spin"); initCtrl("terrain_lower_spin"); @@ -1207,20 +1177,9 @@ BOOL LLPanelRegionTerrainInfo::postBuild() return LLPanelRegionInfo::postBuild(); } -F32 LLPanelRegionTerrainInfo::getSunHour() -{ - if (childIsEnabled("sun_hour_slider")) - { - return (F32)childGetValue("sun_hour_slider").asReal(); - } - return 0.f; -} - // virtual bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) { - //LLEnvManager::instance().maybeClearEditingScope(LLEnvKey::SCOPE_REGION, false, false); - BOOL owner_or_god = gAgent.isGodlike() || (region && (region->getOwner() == gAgent.getID())); BOOL owner_or_god_or_manager = owner_or_god @@ -1398,65 +1357,6 @@ bool LLPanelRegionTerrainInfo::callbackBakeTerrain(const LLSD& notification, con return false; } -#ifndef TMP_DISABLE_WLES -/////////////////////////////////////////////////////////////// -// Callbacks for Environment tab of Region 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); -} - -// static -void LLPanelRegionTerrainInfo::onApplyCurrentWL(void* userData) -{ - // Immediately apply current environment settings to region. - LLEnvManager::instance().applyLocalSettingsToRegion(); -} -#endif // TMP_DISABLE_WLES - ///////////////////////////////////////////////////////////////////////////// // LLPanelEstateInfo // @@ -2120,16 +2020,6 @@ bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) return rv; } -// virtual -void LLFloaterRegionInfo::onClose(bool app_quitting) -{ - if(!app_quitting) - { - //LLEnvManager::getInstance()->maybeClearEditingScope(true, false); - LLPanelRegionTerrainInfo::onFloaterClose(app_quitting); - } -} - void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl) { if (checkRemovalButton(child_ctrl->getName())) -- cgit v1.2.3 From 99691e6a139a1b0f8d52c030d8dd4494a92e071a Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Thu, 7 Jul 2011 03:17:35 +0300 Subject: STORM-1481 FIXED Fixed jerky transition when switching region from fixed sky to a day cycle. --- indra/newview/llfloaterregioninfo.cpp | 56 ++++++++++++++++------------------- 1 file changed, 25 insertions(+), 31 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 07c0878877..bedc7ef704 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -317,11 +317,8 @@ void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**) // static void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) { - LL_DEBUGS("Windlight") << "Processing region info" << LL_ENDL; - LLPanel* panel; LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance("region_info"); - llinfos << "LLFloaterRegionInfo::processRegionInfo" << llendl; if(!floater) { return; @@ -330,6 +327,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) // We need to re-request environment setting here, // otherwise after we apply (send) updated region settings we won't get them back, // so our environment won't be updated. + // This is also the way to know about externally changed region environment. LLEnvManagerNew::instance().requestRegionSettings(); LLTabContainer* tab = floater->getChild("region_panels"); @@ -3249,29 +3247,30 @@ void LLPanelEnvironmentInfo::setDirty(bool dirty) getChildView("cancel_btn")->setEnabled(dirty); } -void LLPanelEnvironmentInfo::sendRegionSunUpdate(F32 sun_angle) +void LLPanelEnvironmentInfo::sendRegionSunUpdate() { LLRegionInfoModel& region_info = LLRegionInfoModel::instance(); - bool region_use_fixed_sky = sun_angle >= 0.f; - // Set sun hour. + // If the region is being switched to fixed sky, + // change the region's sun hour according to the (fixed) sun position. + // This is needed for llGetSunDirection() LSL function to work properly (STORM-1330). + const LLSD& sky_map = mNewRegionSettings.getSkyMap(); + bool region_use_fixed_sky = sky_map.size() == 1; if (region_use_fixed_sky) { LLWLParamSet param_set; - LLSD params; - std::string unused; - if (!getSelectedSkyParams(params, unused)) - { - return; - } - param_set.setAll(params); + llassert(sky_map.isMap()); + param_set.setAll(sky_map.beginMap()->second); + F32 sun_angle = param_set.getSunAngle(); + LL_DEBUGS("Windlight Sync") << "Old sun hour: " << region_info.mSunHour << LL_ENDL; // convert value range from 0..2pi to 6..30 region_info.mSunHour = fmodf((sun_angle / F_TWO_PI) * 24.f, 24.f) + 6.f; } region_info.setUseFixedSun(region_use_fixed_sky); region_info.mUseEstateSun = !region_use_fixed_sky; + LL_DEBUGS("Windlight Sync") << "Sun hour: " << region_info.mSunHour << LL_ENDL; region_info.sendRegionTerrain(LLFloaterRegionInfo::getLastInvoice()); } @@ -3555,7 +3554,6 @@ void LLPanelEnvironmentInfo::onBtnApply() LLSD day_cycle; LLSD sky_map; LLSD water_params; - F32 sun_angle = -1.f; // invalid value meaning no fixed sky if (use_defaults) { @@ -3588,9 +3586,6 @@ void LLPanelEnvironmentInfo::onBtnApply() param_set.setAll(params); refs[LLWLParamKey(preset_name, LLEnvKey::SCOPE_LOCAL)] = param_set; // scope doesn't matter here sky_map = LLWLParamManager::createSkyMap(refs); - - // Remember the sun angle to set fixed region sun hour below. - sun_angle = param_set.getSunAngle(); } else // use day cycle { @@ -3611,16 +3606,6 @@ void LLPanelEnvironmentInfo::onBtnApply() LL_DEBUGS("Windlight") << "Fixing negative time" << LL_ENDL; day_cycle[0][0] = 0.0f; } - - // If the day cycle contains exactly one preset (i.e it's effectively a fixed sky), - // remember the preset's sun angle to set fixed region sun hour below. - if (sky_map.size() == 1) - { - LLWLParamSet param_set; - llassert(sky_map.isMap()); - param_set.setAll(sky_map.beginMap()->second); - sun_angle = param_set.getSunAngle(); - } } // Get water params. @@ -3640,8 +3625,9 @@ void LLPanelEnvironmentInfo::onBtnApply() return; } - // Set the region sun phase/flags according to the chosen new preferences. - sendRegionSunUpdate(sun_angle); + // When the settings get applied, we'll also send the region sun position update. + // To determine the sun angle we're going to need the new settings. + mNewRegionSettings = new_region_settings; // Start spinning the progress indicator. setApplyProgress(true); @@ -3672,10 +3658,18 @@ void LLPanelEnvironmentInfo::onRegionSettingschange() void LLPanelEnvironmentInfo::onRegionSettingsApplied(bool ok) { - LL_DEBUGS("Windlight") << "Applying region settings finished, stopping indicator" << LL_ENDL; // If applying new settings has failed, stop the indicator right away. // Otherwise it will be stopped when we receive the updated settings from server. - if (!ok) + if (ok) + { + // Set the region sun phase/flags according to the chosen new preferences. + // + // If we do this earlier we may get jerky transition from fixed sky to a day cycle (STORM-1481). + // 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(); + } + else { setApplyProgress(false); -- 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/llfloaterregioninfo.cpp | 336 ++++++++-------------------------- 1 file changed, 81 insertions(+), 255 deletions(-) (limited to 'indra/newview/llfloaterregioninfo.cpp') 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 { -- cgit v1.2.3