summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterregioninfo.cpp
diff options
context:
space:
mode:
authorNyx (Neal Orman) <nyx@lindenlab.com>2010-09-27 22:56:08 -0400
committerNyx (Neal Orman) <nyx@lindenlab.com>2010-09-27 22:56:08 -0400
commite045d212d35354d679c2d2e05c6d4689f9f8ac95 (patch)
tree20ba9f542316816d82dbc092d52a63fccde3d7e7 /indra/newview/llfloaterregioninfo.cpp
parente6688f993f82d2683e3eadce96c893959c94be2d (diff)
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)
Diffstat (limited to 'indra/newview/llfloaterregioninfo.cpp')
-rw-r--r--indra/newview/llfloaterregioninfo.cpp148
1 files changed, 146 insertions, 2 deletions
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<LLTabContainer>("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<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);
+}
+
+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()))