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.
master
Vadim ProductEngine 2011-03-31 18:24:01 +03:00
parent 5476999e9d
commit 79fb8e2ec2
18 changed files with 191 additions and 112 deletions

View File

@ -80,7 +80,7 @@ void LLEnvManager::changedRegion(bool interp)
mInterpNextChangeMessage = interp;
mPendingOutgoingMessage = false;
// TIGGGS LLFloaterEnvSettings::instance()->closeFloater();
LLFloaterReg::hideInstance("env_settings");
resetInternalsToDefault(LLEnvKey::SCOPE_REGION);
@ -93,6 +93,8 @@ void LLEnvManager::changedRegion(bool interp)
void LLEnvManager::startEditingScope(LLEnvKey::EScope scope)
{
LL_DEBUGS("Windlight") << "Starting editing scope " << scope << LL_ENDL;
if (mIsEditing)
{
LL_WARNS("Windlight") << "Tried to start editing windlight settings while already editing some settings (possibly others)! Ignoring..." << LL_ENDL;
@ -158,6 +160,8 @@ void LLEnvManager::maybeClearEditingScope(bool user_initiated, bool was_commit)
void LLEnvManager::clearEditingScope(const LLSD& notification, const LLSD& response)
{
LL_DEBUGS("Windlight") << "Clearing editing scope " << mCurNormalScope << LL_ENDL;
if(notification.isDefined() && response.isDefined() && LLNotification::getSelectedOption(notification, response) != 0)
{
// *TODO: select terrain panel here
@ -284,6 +288,8 @@ bool LLEnvManager::processIncomingMessage(const LLSD& unvalidated_content, const
if (valid)
{
LL_DEBUGS("Windlight Sync") << "windlight_llsd: " << windlight_llsd << LL_ENDL;
F32 sun_hour = LLPanelRegionTerrainInfo::instance()->getSunHour(); // this slider is kept up to date
LLWLParamManager::getInstance()->addAllSkies(scope, windlight_llsd[2]);
LLEnvironmentSettings newSettings(windlight_llsd[1], windlight_llsd[2], windlight_llsd[3], sun_hour);
@ -302,6 +308,10 @@ bool LLEnvManager::processIncomingMessage(const LLSD& unvalidated_content, const
{
loadSettingsIntoManagers(scope, mInterpNextChangeMessage);
}
else
{
LL_DEBUGS("Windlight Sync") << "Not loading settings (mCurNormalScope=" << mCurNormalScope << ", scope=" << scope << ", mIsEditing=" << mIsEditing << ")" << LL_ENDL;
}
mInterpNextChangeMessage = true; // reset flag
@ -315,6 +325,8 @@ bool LLEnvManager::processIncomingMessage(const LLSD& unvalidated_content, const
void LLEnvManager::commitSettings(LLEnvKey::EScope scope)
{
LL_DEBUGS("Windlight Sync") << "commitSettings(scope = " << scope << ")" << LL_ENDL;
bool success = true;
switch (scope)
{
@ -407,6 +419,8 @@ const LLEnvironmentSettings& LLEnvManager::lindenDefaults()
void LLEnvManager::loadSettingsIntoManagers(LLEnvKey::EScope scope, bool interpolate)
{
LL_DEBUGS("Windlight Sync") << "Loading settings (scope = " << scope << ")" << LL_ENDL;
LLEnvironmentSettings settings = mOrigSettingStore[scope];
if(interpolate)
@ -423,6 +437,7 @@ void LLEnvManager::loadSettingsIntoManagers(LLEnvKey::EScope scope, bool interpo
void LLEnvManager::saveSettingsFromManagers(LLEnvKey::EScope scope)
{
LL_DEBUGS("Windlight Sync") << "Saving settings (scope = " << scope << ")" << LL_ENDL;
switch (scope)
{
case LLEnvKey::SCOPE_LOCAL:
@ -437,6 +452,9 @@ void LLEnvManager::saveSettingsFromManagers(LLEnvKey::EScope scope)
// ensure only referenced region-scope skies are saved, resolve naming collisions, etc.
std::map<LLWLParamKey, LLWLParamSet> final_references = LLWLParamManager::getInstance()->finalizeFromDayCycle(scope);
LLSD referenced_skies = LLWLParamManager::getInstance()->createSkyMap(final_references);
LL_DEBUGS("Windlight Sync") << "Dumping referenced skies (" << final_references.size() << ") to LLSD: " << referenced_skies << LL_ENDL;
mOrigSettingStore[scope].saveParams(
LLWLParamManager::getInstance()->mDay.asLLSD(),
referenced_skies,
@ -461,11 +479,17 @@ void LLEnvManager::setNormallyDisplayedScope(LLEnvKey::EScope new_scope)
if (mCurNormalScope != new_scope)
{
LL_INFOS("Windlight") << "Switching to scope " << new_scope << LL_ENDL;
mCurNormalScope = new_scope;
notifyOptInChange();
}
}
LLEnvKey::EScope LLEnvManager::getNormallyDisplayedScope() const
{
return mCurNormalScope;
}
void LLEnvManager::notifyOptInChange()
{
bool opt_in = gSavedSettings.getBOOL("UseEnvironmentFromRegion");

View File

@ -174,6 +174,8 @@ public:
// sets which scope is to be displayed
// fix me if/when adding more levels of scope
void setNormallyDisplayedScope(LLEnvKey::EScope scope);
// gets normally displayed scope
LLEnvKey::EScope getNormallyDisplayedScope() const;
private:
// overriden initializer

View File

@ -48,6 +48,7 @@
#include "lllineeditor.h"
#include "llwlanimator.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "v4math.h"
#include "llviewerdisplay.h"
@ -70,6 +71,11 @@ std::string LLFloaterDayCycle::sOriginalTitle;
LLWLAnimator::ETime LLFloaterDayCycle::sPreviousTimeType = LLWLAnimator::TIME_LINDEN;
LLFloaterDayCycle::LLFloaterDayCycle(const LLSD &key) : LLFloater(key)
{
}
// virtual
BOOL LLFloaterDayCycle::postBuild()
{
sOriginalTitle = getTitle();
@ -84,6 +90,8 @@ LLFloaterDayCycle::LLFloaterDayCycle(const LLSD &key) : LLFloater(key)
// load it up
initCallbacks();
return TRUE;
}
LLFloaterDayCycle::~LLFloaterDayCycle()
@ -173,6 +181,9 @@ void LLFloaterDayCycle::syncSliderTrack()
sSliderToKey.clear();
// add sliders
lldebugs << "Adding " << LLWLParamManager::getInstance()->mDay.mTimeMap.size() << " keys to slider" << llendl;
std::map<F32, LLWLParamKey>::iterator mIt =
LLWLParamManager::getInstance()->mDay.mTimeMap.begin();
for(; mIt != LLWLParamManager::getInstance()->mDay.mTimeMap.end(); mIt++)
@ -183,9 +194,12 @@ void LLFloaterDayCycle::syncSliderTrack()
void LLFloaterDayCycle::syncTrack()
{
lldebugs << "Syncing track (" << sSliderToKey.size() << ")" << llendl;
// if no keys, do nothing
if(sSliderToKey.size() == 0)
{
lldebugs << "No keys, not syncing" << llendl;
return;
}
@ -244,7 +258,9 @@ LLFloaterDayCycle* LLFloaterDayCycle::instance()
{
if (!sDayCycle)
{
sDayCycle = new LLFloaterDayCycle("Day Cycle Floater");
lldebugs << "Instantiating Day Cycle floater" << llendl;
sDayCycle = LLFloaterReg::getTypedInstance<LLFloaterDayCycle>("env_day_cycle");
llassert(sDayCycle);
// sDayCycle->open();
// sDayCycle->setFocus(TRUE);
}
@ -294,7 +310,8 @@ void LLFloaterDayCycle::onClose(bool app_quitting)
{
if (sDayCycle)
{
sDayCycle->setVisible(FALSE);
lldebugs << "Destorying Day Cycle floater" << llendl;
sDayCycle = NULL;
}
}
@ -548,7 +565,7 @@ void LLFloaterDayCycle::onAddKey(void* userData)
LLSD args;
args["SCOPE"] = LLEnvManager::getScopeString(sScope);
args["MAX"] = max_sliders;
LLNotifications::instance().add("DayCycleTooManyKeyframes", LLSD(), args);
LLNotificationsUtil::add("DayCycleTooManyKeyframes", args);
return;
}

View File

@ -58,9 +58,11 @@ public:
/// Menuing system for adjusting the atmospheric settings of the world.
class LLFloaterDayCycle : public LLFloater
{
LOG_CLASS(LLFloaterDayCycle);
public:
LLFloaterDayCycle(const LLSD &key);
virtual ~LLFloaterDayCycle();
/*virtual*/ BOOL postBuild();
// map of sliders to parameters
static std::map<std::string, LLWLCycleSliderKey> sSliderToKey;

View File

@ -63,6 +63,7 @@
LLFloaterEnvSettings::LLFloaterEnvSettings(const LLSD &key) : LLFloater(key)
{
lldebugs << "Creating env settings floater" << llendl;
}
LLFloaterEnvSettings::~LLFloaterEnvSettings()
@ -75,6 +76,10 @@ BOOL LLFloaterEnvSettings::postBuild()
// load it up
initCallbacks();
syncMenu();
LLEnvKey::EScope cur_scope = LLEnvManager::getInstance()->getNormallyDisplayedScope();
childSetValue("RegionWLOptIn", cur_scope == LLEnvKey::SCOPE_REGION);
return TRUE;
}
@ -258,11 +263,13 @@ void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, void* userData)
void LLFloaterEnvSettings::onOpenAdvancedSky(void* userData1, void* userData2)
{
// *TODO: make sure title is displayed correctly.
LLFloaterReg::showInstance("env_windlight");
}
void LLFloaterEnvSettings::onOpenAdvancedWater(void* userData1, void* userData2)
{
// *TODO: make sure title is displayed correctly.
LLFloaterReg::showInstance("env_water");
}

View File

@ -43,6 +43,7 @@
/// Menuing system for all of windlight's functionality
class LLFloaterEnvSettings : public LLFloater
{
LOG_CLASS(LLFloaterEnvSettings);
public:
LLFloaterEnvSettings(const LLSD &key);

View File

@ -408,6 +408,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)
@ -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)

View File

@ -73,7 +73,7 @@ public:
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ BOOL postBuild();
/*virtual*/void closeFloater(bool app_quitting);
/*virtual*/ void onClose(bool app_quitting);
static void processEstateOwnerRequest(LLMessageSystem* msg, void**);
@ -87,6 +87,7 @@ public:
static LLPanelEstateInfo* getPanelEstate();
static LLPanelEstateCovenant* getPanelCovenant();
static LLPanelRegionTerrainInfo* getPanelRegionTerrain();
// from LLPanel
virtual void refresh();
@ -232,13 +233,15 @@ protected:
/////////////////////////////////////////////////////////////////////////////
class LLPanelRegionTerrainInfo : public LLPanelRegionInfo
{
LOG_CLASS(LLPanelRegionTerrainInfo);
public:
LLPanelRegionTerrainInfo() : LLPanelRegionInfo() {}
~LLPanelRegionTerrainInfo() {}
static LLPanelRegionTerrainInfo* instance();
virtual BOOL postBuild(); // LLPanel
static void closeFloater(bool app_quitting);
static void onFloaterClose(bool app_quitting);
F32 getSunHour();
virtual bool refreshFromRegion(LLViewerRegion* region); // refresh local settings from region update from simulator

View File

@ -59,8 +59,6 @@
#undef max
LLFloaterWater* LLFloaterWater::sWater = NULL;
std::set<std::string> LLFloaterWater::sDefaultPresets;
LLEnvKey::EScope LLFloaterWater::sScope;
std::string LLFloaterWater::sOriginalTitle;
@ -108,19 +106,11 @@ BOOL LLFloaterWater::postBuild()
return TRUE;
}
//static
LLFloaterWater* LLFloaterWater::instance()
{
if (!sWater)
{
sWater = new LLFloaterWater(LLSD());
}
return sWater;
}
// static
void LLFloaterWater::show(LLEnvKey::EScope scope)
{
LLFloaterWater* water = instance();
LLFloaterWater* water = LLFloaterReg::getTypedInstance<LLFloaterWater>("env_water");
llassert(water);
if(scope != sScope && ((LLView*)water)->getVisible())
{

View File

@ -33,8 +33,10 @@
#include "llfloater.h"
#if 0
#include <vector>
#include "llwlparamset.h"
#endif
#include "llenvmanager.h"
struct WaterVector2Control;
@ -54,10 +56,7 @@ public:
/// initialize all
void initCallbacks(void);
// one instance only
static LLFloaterWater* instance();
void show(LLEnvKey::EScope scope);
static void show(LLEnvKey::EScope scope = LLEnvKey::SCOPE_LOCAL);
bool newPromptCallback(const LLSD& notification, const LLSD& response);
@ -109,8 +108,6 @@ private:
static std::set<std::string> sDefaultPresets;
static LLEnvKey::EScope sScope;
static std::string sOriginalTitle;
static LLFloaterWater* sWater;
};

View File

@ -37,6 +37,7 @@
#include "pipeline.h"
#include "llsky.h"
#include "llfloaterreg.h"
#include "llsliderctrl.h"
#include "llmultislider.h"
#include "llmultisliderctrl.h"
@ -75,6 +76,7 @@ LLFloaterWindLight::LLFloaterWindLight(const LLSD &key) : LLFloater(key)
BOOL LLFloaterWindLight::postBuild()
{
sWindLight = this;
sOriginalTitle = getTitle();
// add the combo boxes
@ -211,21 +213,9 @@ void LLFloaterWindLight::initCallbacks(void)
childSetCommitCallback("WLStarAlpha", onStarAlphaMoved, NULL);
}
#if 0
void LLFloaterWindLight::onClickHelp(void* data)
{
const std::string xml_alert = *(std::string*)data;
LLNotifications::instance().add(xml_alert, LLSD(), LLSD());
}
void LLFloaterWindLight::initHelpBtn(const std::string& name, const std::string& xml_alert)
{
childSetAction(name, onClickHelp, new std::string(xml_alert));
}
#endif
bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& response)
{
llassert(sWindLight);
std::string text = response["message"].asString();
LLWLParamKey newKey(text, LLEnvKey::SCOPE_LOCAL);
S32 option = LLNotification::getSelectedOption(notification, response);
@ -420,17 +410,19 @@ void LLFloaterWindLight::syncMenu()
}
#if 0
// static
LLFloaterWindLight* LLFloaterWindLight::instance()
{
if (!sWindLight)
{
sWindLight = new LLFloaterWindLight("WindLight floater");
lldebugs << "Creating WL floater" << llendl;
sWindLight = LLFloaterReg::getTypedInstance<LLFloaterWindLight>("env_windlight");
llassert(sWindLight);
}
return sWindLight;
}
// static
void LLFloaterWindLight::show(LLEnvKey::EScope scope)
{
LLFloaterWindLight* windLight = instance();
@ -465,25 +457,20 @@ void LLFloaterWindLight::show(LLEnvKey::EScope scope)
bool LLFloaterWindLight::isOpen()
{
if (sWindLight != NULL) {
return true;
}
return false;
return LLFloater::isShown(sWindLight);
}
// virtual
void LLFloaterWindLight::onClose(bool app_quitting)
{
if (sWindLight)
{
sWindLight->setVisible(FALSE);
}
lldebugs << "Destroying WL floater" << llendl;
sWindLight = NULL;
}
#endif
// color control callbacks
void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, void* userData)
{
llassert(sWindLight);
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
@ -520,6 +507,7 @@ void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, void* userData)
{
llassert(sWindLight);
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
@ -592,6 +580,7 @@ void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData)
{
llassert(sWindLight);
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
@ -737,6 +726,7 @@ void LLFloaterWindLight::onBoolToggle(LLUICtrl* ctrl, void* userData)
// time of day
void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userData)
{
llassert(sWindLight);
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLSliderCtrl* sunSldr = sWindLight->getChild<LLSliderCtrl>("WLSunAngle");
@ -789,6 +779,7 @@ void LLFloaterWindLight::onNewPreset(void* userData)
void LLFloaterWindLight::onSavePreset(void* userData)
{
llassert(sWindLight);
// get the name
LLComboBox* comboBox = sWindLight->getChild<LLComboBox>(
"WLPresetsCombo");
@ -835,6 +826,7 @@ bool LLFloaterWindLight::saveAlertCallback(const LLSD& notification, const LLSD&
void LLFloaterWindLight::onDeletePreset(void* userData)
{
llassert(sWindLight);
LLComboBox* combo_box = sWindLight->getChild<LLComboBox>(
"WLPresetsCombo");
@ -911,6 +903,7 @@ bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLS
void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl, void * userData)
{
llassert(sWindLight);
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLComboBox * combo_box = static_cast<LLComboBox*>(ctrl);
@ -951,6 +944,7 @@ void LLFloaterWindLight::onCloudScrollYMoved(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl, void* userData)
{
llassert(sWindLight);
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl);
@ -974,6 +968,7 @@ void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl, void* userData)
void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl, void* userData)
{
llassert(sWindLight);
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl);

View File

@ -49,6 +49,7 @@ struct WLFloatControl;
/// Menuing system for all of windlight's functionality
class LLFloaterWindLight : public LLFloater
{
LOG_CLASS(LLFloaterWindLight);
public:
LLFloaterWindLight(const LLSD &key);
virtual ~LLFloaterWindLight();
@ -57,14 +58,9 @@ public:
/// initialize all
void initCallbacks(void);
#if 0
/// one and one instance only
static LLFloaterWindLight* instance();
// help button stuff
static void onClickHelp(void* data);
void initHelpBtn(const std::string& name, const std::string& xml_alert);
#endif
static bool newPromptCallback(const LLSD& notification, const LLSD& response);
/// general purpose callbacks for dealing with color controllers
@ -118,7 +114,6 @@ public:
//// menu management
#if 0
/// show off our menu
static void show(LLEnvKey::EScope scope = LLEnvKey::SCOPE_LOCAL);
@ -127,7 +122,7 @@ public:
/// stuff to do on exit
virtual void onClose(bool app_quitting);
#endif
/// sync up sliders with parameters
void syncMenu();

View File

@ -7625,70 +7625,62 @@ class LLWorldEnvSettings : public view_listener_t
if (tod == "editor")
{
// if not there or is hidden, show it
// *TODO replace with LLFloaterWindLight::show(LLEnvKey::SCOPE_LOCAL) to make sure we're using the right scope?
LLFloaterReg::toggleInstance("env_settings");
return true;
}
else if(gSavedSettings.getBOOL("UseEnvironmentFromRegion"))
if (gSavedSettings.getBOOL("UseEnvironmentFromRegion"))
{
LLNotifications::instance().add("EnvLockedUsingRegion", LLSD(), LLSD());
return true;
}
else
{
if (tod == "sunrise")
{
// set the value, turn off animation
LLWLParamManager::getInstance()->mAnimator.setDayTime(0.25);
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLWLParamManager::getInstance()->mAnimator.setDayTime(0.25);
LLWLParamManager::getInstance()->mAnimator.deactivate();
// then call update once
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
}
else if (tod == "noon")
{
// set the value, turn off animation
LLWLParamManager::getInstance()->mAnimator.setDayTime(0.567);
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLWLParamManager::getInstance()->mAnimator.setDayTime(0.567);
LLWLParamManager::getInstance()->mAnimator.deactivate();
// then call update once
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
}
else if (tod == "sunset")
{
// set the value, turn off animation
LLWLParamManager::getInstance()->mAnimator.setDayTime(0.75);
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLWLParamManager::getInstance()->mAnimator.setDayTime(0.75);
LLWLParamManager::getInstance()->mAnimator.deactivate();
// then call update once
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
}
else if (tod == "midnight")
{
// set the value, turn off animation
LLWLParamManager::getInstance()->mAnimator.setDayTime(0.0);
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLWLParamManager::getInstance()->mAnimator.setDayTime(0.0);
LLWLParamManager::getInstance()->mAnimator.deactivate();
// then call update once
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
}
else
{
LLWLParamManager::getInstance()->mAnimator.activate(LLWLAnimator::TIME_LINDEN);
}
LLWLParamManager::getInstance()->mAnimator.activate(LLWLAnimator::TIME_LINDEN);
}
return true;
}
};
/// Water Menu callbacks
class LLWorldWaterSettings : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
LLFloaterReg::toggleInstance("env_water");
return true;
}
};
@ -7926,7 +7918,6 @@ void initialize_menus()
view_listener_t::addMenu(new LLWorldCheckAlwaysRun(), "World.CheckAlwaysRun");
view_listener_t::addMenu(new LLWorldEnvSettings(), "World.EnvSettings");
view_listener_t::addMenu(new LLWorldWaterSettings(), "World.WaterSettings");
view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess");
view_listener_t::addMenu(new LLWorldDayCycle(), "World.DayCycle");

View File

@ -53,6 +53,7 @@ LLWLDayCycle::~LLWLDayCycle()
void LLWLDayCycle::loadDayCycle(const LLSD& day_data, LLWLParamKey::EScope scope)
{
lldebugs << "Loading day cycle (day_data.size() = " << day_data.size() << ", scope = " << scope << ")" << llendl;
mTimeMap.clear();
// add each key frame
@ -146,11 +147,14 @@ LLSD LLWLDayCycle::asLLSD()
key.append(mIt->second.name);
day_data.append(key);
}
LL_DEBUGS("Windlight Sync") << "Dumping day cycle (" << mTimeMap.size() << ") to LLSD: " << day_data << LL_ENDL;
return day_data;
}
void LLWLDayCycle::clearKeyframes()
{
lldebugs << "Clearing key frames" << llendl;
mTimeMap.clear();
}
@ -167,21 +171,26 @@ bool LLWLDayCycle::addKeyframe(F32 newTime, LLWLParamKey frame)
if(mTimeMap.find(newTime) == mTimeMap.end())
{
mTimeMap.insert(std::pair<F32, LLWLParamKey>(newTime, frame));
lldebugs << "Adding key frame (" << newTime << ", " << frame.toLLSD() << ")" << llendl;
return true;
}
// otherwise, don't add, and return error
llwarns << "Error adding key frame (" << newTime << ", " << frame.toLLSD() << ")" << llendl;
return false;
}
bool LLWLDayCycle::changeKeyframeTime(F32 oldTime, F32 newTime)
{
lldebugs << "Changing key frame time (" << oldTime << " => " << newTime << ")" << llendl;
// just remove and add back
LLWLParamKey frame = mTimeMap[oldTime];
bool stat = removeKeyframe(oldTime);
if(stat == false)
{
lldebugs << "Failed to change key frame time (" << oldTime << " => " << newTime << ")" << llendl;
return stat;
}
@ -190,12 +199,15 @@ bool LLWLDayCycle::changeKeyframeTime(F32 oldTime, F32 newTime)
bool LLWLDayCycle::changeKeyframeParam(F32 time, LLWLParamKey key)
{
lldebugs << "Changing key frame param (" << time << ", " << key.toLLSD() << ")" << llendl;
// just remove and add back
// make sure param exists
LLWLParamSet tmp;
bool stat = LLWLParamManager::getInstance()->getParamSet(key, tmp);
if(stat == false)
{
lldebugs << "Failed to change key frame param (" << time << ", " << key.toLLSD() << ")" << llendl;
return stat;
}
@ -206,6 +218,8 @@ bool LLWLDayCycle::changeKeyframeParam(F32 time, LLWLParamKey key)
bool LLWLDayCycle::removeKeyframe(F32 time)
{
lldebugs << "Removing key frame (" << time << ")" << llendl;
// look for the time. If there, erase it
std::map<F32, LLWLParamKey>::iterator mIt = mTimeMap.find(time);
if(mIt != mTimeMap.end())
@ -243,6 +257,7 @@ bool LLWLDayCycle::getKeyedParam(F32 time, LLWLParamSet& param)
}
// return error if not found
lldebugs << "Key " << time << " not found" << llendl;
return false;
}
@ -257,11 +272,13 @@ bool LLWLDayCycle::getKeyedParamName(F32 time, std::string & name)
}
// return error if not found
lldebugs << "Key " << time << " not found" << llendl;
return false;
}
void LLWLDayCycle::removeReferencesTo(const LLWLParamKey& keyframe)
{
lldebugs << "Removing references to key frame " << keyframe.toLLSD() << llendl;
F32 keytime;
bool might_exist;
do

View File

@ -39,6 +39,7 @@ struct LLWLParamKey;
class LLWLDayCycle
{
LOG_CLASS(LLWLDayCycle);
public:
// lists what param sets are used when during the day

View File

@ -37,7 +37,7 @@
#include "llagent.h"
#include "llviewerregion.h"
#include "llenvmanager.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
/****
* LLEnvironmentRequestResponder
@ -82,6 +82,7 @@ LLEnvironmentRequestResponder::LLEnvironmentRequestResponder()
return;
}
LL_DEBUGS("WindlightCaps") << "content: " << unvalidated_content << LL_ENDL;
LLEnvManager::getInstance()->processIncomingMessage(unvalidated_content, LLEnvKey::SCOPE_REGION);
}
/*virtual*/ void LLEnvironmentRequestResponder::error(U32 status, const std::string& reason)
@ -109,7 +110,7 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content)
{
LLSD args(LLSD::emptyMap());
args["WAIT"] = (F64)UPDATE_WAIT_SECONDS;
LLNotifications::instance().add("EnvUpdateRate", LLSD(), args);
LLNotificationsUtil::add("EnvUpdateRate", args);
return false;
}
@ -117,9 +118,14 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content)
if (!url.empty())
{
LL_INFOS("WindlightCaps") << "Sending windlight settings to " << url << LL_ENDL;
LL_DEBUGS("WindlightCaps") << "content: " << content << LL_ENDL;
LLHTTPClient::post(url, content, new LLEnvironmentApplyResponder());
return true;
}
else
{
LL_WARNS("WindlightCaps") << "Applying windlight settings not supported" << LL_ENDL;
}
return false;
}
/*virtual*/ void LLEnvironmentApplyResponder::result(const LLSD& content)
@ -140,7 +146,7 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content)
LL_WARNS("WindlightCaps") << "Region couldn't apply windlight settings! Reason from sim: " << content["fail_reason"].asString() << LL_ENDL;
LLSD args(LLSD::emptyMap());
args["FAIL_REASON"] = content["fail_reason"].asString();
LLNotifications::instance().add("WLRegionApplyFail", LLSD(), args);
LLNotificationsUtil::add("WLRegionApplyFail", args);
}
LLEnvManager::getInstance()->commitSettingsFinished(LLEnvKey::SCOPE_REGION);
@ -154,7 +160,7 @@ bool LLEnvironmentApplyResponder::initiateRequest(const LLSD& content)
LLSD args(LLSD::emptyMap());
args["FAIL_REASON"] = msg.str();
LLNotifications::instance().add("WLRegionApplyFail", LLSD(), args);
LLNotificationsUtil::add("WLRegionApplyFail", args);
LLEnvManager::getInstance()->commitSettingsFinished(LLEnvKey::SCOPE_REGION);
}

View File

@ -136,6 +136,15 @@ void LLWLParamManager::clearParamSetsOfScope(LLWLParamKey::EScope scope)
// side effect: applies changes to all internal structures!
std::map<LLWLParamKey, LLWLParamSet> LLWLParamManager::finalizeFromDayCycle(LLWLParamKey::EScope scope)
{
lldebugs << "mDay before finalizing:" << llendl;
{
for (std::map<F32, LLWLParamKey>::iterator iter = mDay.mTimeMap.begin(); iter != mDay.mTimeMap.end(); ++iter)
{
LLWLParamKey& key = iter->second;
lldebugs << iter->first << "->" << key.name << llendl;
}
}
std::map<LLWLParamKey, LLWLParamSet> final_references;
// Move all referenced to desired scope, renaming if necessary
@ -218,6 +227,15 @@ std::map<LLWLParamKey, LLWLParamSet> LLWLParamManager::finalizeFromDayCycle(LLWL
final_references[new_key] = iter->second;
}
lldebugs << "mDay after finalizing:" << llendl;
{
for (std::map<F32, LLWLParamKey>::iterator iter = mDay.mTimeMap.begin(); iter != mDay.mTimeMap.end(); ++iter)
{
LLWLParamKey& key = iter->second;
lldebugs << iter->first << "->" << key.name << llendl;
}
}
return final_references;
}

View File

@ -210,6 +210,7 @@ public:
/// WindLight parameter manager class - what controls all the wind light shaders
class LLWLParamManager : public LLSingleton<LLWLParamManager>
{
LOG_CLASS(LLWLParamManager);
public:
/// load a preset file
void loadPresets(const std::string & fileName);