diff options
Diffstat (limited to 'indra/newview/llfloaterregioninfo.cpp')
-rw-r--r-- | indra/newview/llfloaterregioninfo.cpp | 192 |
1 files changed, 190 insertions, 2 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 7792b3fb40..2acb0936dc 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" @@ -48,7 +50,9 @@ #include "llbutton.h" #include "llcheckboxctrl.h" #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" @@ -82,9 +86,14 @@ #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; +#define TMP_DISABLE_WLES // STORM-1180 + ///---------------------------------------------------------------------------- /// Local class declaration ///---------------------------------------------------------------------------- @@ -288,6 +297,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<LLTabContainer>("region_panels"); LLViewerRegion* region = gAgent.getRegion(); @@ -398,6 +411,23 @@ LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant() return panel; } +// static +LLPanelRegionTerrainInfo* LLFloaterRegionInfo::getPanelRegionTerrain() +{ + LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info"); + if (!floater) + { + llassert(floater); + return NULL; + } + + LLTabContainer* tab_container = floater->getChild<LLTabContainer>("region_panels"); + LLPanelRegionTerrainInfo* panel = + dynamic_cast<LLPanelRegionTerrainInfo*>(tab_container->getChild<LLPanel>("Terrain")); + llassert(panel); + return panel; +} + void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region) { if (!region) @@ -1145,9 +1175,36 @@ void LLPanelRegionTextureInfo::onClickDump(void* data) ///////////////////////////////////////////////////////////////////////////// // 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"); @@ -1162,20 +1219,45 @@ 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); + 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 + 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); @@ -1184,6 +1266,34 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) return LLPanelRegionInfo::refreshFromRegion(region); } +void LLPanelRegionTerrainInfo::setEnvControls(bool available) +{ +#ifdef TMP_DISABLE_WLES + available = false; + getChild<LLUICtrl>("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(); +} + // virtual BOOL LLPanelRegionTerrainInfo::sendUpdate() { @@ -1321,9 +1431,77 @@ 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<LLComboBox>("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(); +} + +void LLPanelRegionTerrainInfo::cancelChanges() +{ + LLFloaterReg::hideInstance("env_windlight"); + LLFloaterReg::hideInstance("env_water"); + LLFloaterReg::hideInstance("env_day_cycle"); + + // disable commmit and cancel + LLPanelRegionTerrainInfo::instance()->setCommitControls(false); +} + ///////////////////////////////////////////////////////////////////////////// // LLPanelEstateInfo // @@ -1997,6 +2175,16 @@ 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())) |