diff options
| -rw-r--r-- | indra/newview/llenvironment.cpp | 30 | ||||
| -rw-r--r-- | indra/newview/llenvironment.h | 7 | ||||
| -rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/llfloaterenvironmentadjust.cpp | 5 | ||||
| -rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 17 | ||||
| -rw-r--r-- | indra/newview/llfloaterfixedenvironment.h | 5 | ||||
| -rw-r--r-- | indra/newview/llpaneleditsky.cpp | 21 | ||||
| -rw-r--r-- | indra/newview/llpaneleditwater.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llsettingsvo.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml | 2 | 
10 files changed, 80 insertions, 25 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index 57e6ab7159..3373c8c3a4 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -811,7 +811,10 @@ LLEnvironment::LLEnvironment():      mSelectedWater(),      mSelectedDay(),      mSelectedEnvironment(LLEnvironment::ENV_LOCAL), -    mCurrentTrack(1) +    mCurrentTrack(1), +    mEditorCounter(0), +    mShowSunBeacon(false), +    mShowMoonBeacon(false)  {  } @@ -2165,7 +2168,7 @@ LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extractLeg  //=========================================================================  LLSettingsWater::ptr_t LLEnvironment::createWaterFromLegacyPreset(const std::string filename, LLSD &messages)  { -    std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true)); +    std::string name(gDirUtilp->getBaseFileName(filename, true));      std::string path(gDirUtilp->getDirName(filename));      LLSettingsWater::ptr_t water = LLSettingsVOWater::buildFromLegacyPresetFile(name, path, messages); @@ -2180,7 +2183,7 @@ LLSettingsWater::ptr_t LLEnvironment::createWaterFromLegacyPreset(const std::str  LLSettingsSky::ptr_t LLEnvironment::createSkyFromLegacyPreset(const std::string filename, LLSD &messages)  { -    std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true)); +    std::string name(gDirUtilp->getBaseFileName(filename, true));      std::string path(gDirUtilp->getDirName(filename));      LLSettingsSky::ptr_t sky = LLSettingsVOSky::buildFromLegacyPresetFile(name, path, messages); @@ -2194,7 +2197,7 @@ LLSettingsSky::ptr_t LLEnvironment::createSkyFromLegacyPreset(const std::string  LLSettingsDay::ptr_t LLEnvironment::createDayCycleFromLegacyPreset(const std::string filename, LLSD &messages)  { -    std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(filename), true)); +    std::string name(gDirUtilp->getBaseFileName(filename, true));      std::string path(gDirUtilp->getDirName(filename));      LLSettingsDay::ptr_t day = LLSettingsVODay::buildFromLegacyPresetFile(name, path, messages); @@ -2692,6 +2695,25 @@ void LLEnvironment::DayTransition::animate()      });  } +void LLEnvironment::saveBeaconsState() +{ +    if (mEditorCounter == 0) +    { +        mShowSunBeacon = gSavedSettings.getBOOL("sunbeacon"); +        mShowMoonBeacon = gSavedSettings.getBOOL("moonbeacon"); +    } +    ++mEditorCounter; +} +void LLEnvironment::revertBeaconsState() +{ +    --mEditorCounter; +    if (mEditorCounter == 0) +    { +        gSavedSettings.setBOOL("sunbeacon", mShowSunBeacon && gSavedSettings.getBOOL("sunbeacon")); +        gSavedSettings.setBOOL("moonbeacon", mShowMoonBeacon && gSavedSettings.getBOOL("moonbeacon")); +    } +} +  //=========================================================================  LLTrackBlenderLoopingManual::LLTrackBlenderLoopingManual(const LLSettingsBase::ptr_t &target, const LLSettingsDay::ptr_t &day, S32 trackno) :          LLSettingsBlender(target, LLSettingsBase::ptr_t(), LLSettingsBase::ptr_t()), diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 327e34d856..0e23693c86 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -169,6 +169,9 @@ public:      bool                        getIsSunUp() const;      bool                        getIsMoonUp() const; +    void                        saveBeaconsState(); +    void                        revertBeaconsState(); +      // Returns either sun or moon direction (depending on which is up and stronger)      // Light direction in +x right, +z up, +y at internal coord sys      LLVector3                   getLightDirection() const; // returns sun or moon depending on which is up @@ -382,6 +385,10 @@ private:      void                        onRegionChange();      void                        onParcelChange(); +    bool                        mShowSunBeacon; +    bool                        mShowMoonBeacon; +    S32                         mEditorCounter; +      struct UpdateInfo      {          typedef std::shared_ptr<UpdateInfo> ptr_t; diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index bae901bd50..3870794c63 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -271,6 +271,10 @@ BOOL LLFloaterEditExtDayCycle::postBuild()  void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)  { +    if (!mEditDay) +    { +        LLEnvironment::instance().saveBeaconsState(); +    }      mEditDay.reset();      mEditContext = CONTEXT_UNKNOWN;      if (key.has(KEY_EDIT_CONTEXT)) @@ -410,10 +414,12 @@ void LLFloaterEditExtDayCycle::onClose(bool app_quitting)      // there's no point to change environment if we're quitting      // or if we already restored environment      stopPlay(); +    LLEnvironment::instance().revertBeaconsState();      if (!app_quitting)      {          LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL, LLEnvironment::TRANSITION_FAST);          LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); +        mEditDay.reset();      }  } @@ -1613,8 +1619,8 @@ void LLFloaterEditExtDayCycle::setTabsData(LLTabContainer * tabcontainer, const          LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tabcontainer->getPanelByIndex(idx));          if (panel)          { -            panel->setSettings(settings);              panel->setCanChangeSettings(editable & mCanMod); +            panel->setSettings(settings);          }      }  } diff --git a/indra/newview/llfloaterenvironmentadjust.cpp b/indra/newview/llfloaterenvironmentadjust.cpp index 3d19d560d6..4eb5e03603 100644 --- a/indra/newview/llfloaterenvironmentadjust.cpp +++ b/indra/newview/llfloaterenvironmentadjust.cpp @@ -115,6 +115,10 @@ BOOL LLFloaterEnvironmentAdjust::postBuild()  void LLFloaterEnvironmentAdjust::onOpen(const LLSD& key)  { +    if (!mLiveSky) +    { +        LLEnvironment::instance().saveBeaconsState(); +    }      captureCurrentEnvironment();      mEventConnection = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version){ onEnvironmentUpdated(env, version); }); @@ -125,6 +129,7 @@ void LLFloaterEnvironmentAdjust::onOpen(const LLSD& key)  void LLFloaterEnvironmentAdjust::onClose(bool app_quitting)  { +    LLEnvironment::instance().revertBeaconsState();      mEventConnection.disconnect();      mLiveSky.reset();      mLiveWater.reset(); diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index a94b7c219f..b1fdc2d2a5 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -214,8 +214,8 @@ void LLFloaterFixedEnvironment::refresh()          LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(mTab->getPanelByIndex(idx));          if (panel)          { -            panel->refresh();              panel->setCanChangeSettings(mCanMod); +            panel->refresh();          }      }  } @@ -814,13 +814,20 @@ void LLFloaterFixedEnvironmentSky::onOpen(const LLSD& key)          // Initialize the settings, take a snapshot of the current water.           mSettings = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_CURRENT)->buildClone();          mSettings->setName("Snapshot sky (new)"); - +        LLEnvironment::instance().saveBeaconsState();          // TODO: Should we grab water and keep it around for reference?      }      LLFloaterFixedEnvironment::onOpen(key);  } +void LLFloaterFixedEnvironmentSky::onClose(bool app_quitting) +{ +    LLEnvironment::instance().revertBeaconsState(); + +    LLFloaterFixedEnvironment::onClose(app_quitting); +} +  void LLFloaterFixedEnvironmentSky::doImportFromDisk()  {   // Load a a legacy Windlight XML from disk.      (new LLFilePickerReplyThread(boost::bind(&LLFloaterFixedEnvironmentSky::loadSkySettingFromFile, this, _1), LLFilePicker::FFLOAD_XML, false))->getFile(); @@ -851,9 +858,3 @@ void LLFloaterFixedEnvironmentSky::loadSkySettingFromFile(const std::vector<std:  }  //========================================================================= - -void LLSettingsEditPanel::setCanChangeSettings(bool enabled) -{ -    setEnabled(enabled); -    setAllChildrenEnabled(enabled); -} diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index 138f26cfd7..84feaa1a20 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -161,6 +161,7 @@ public:      BOOL	                postBuild()                 override;      virtual void            onOpen(const LLSD& key)     override; +    virtual void            onClose(bool app_quitting)  override;  protected:      virtual void            updateEditEnvironment()     override; @@ -183,7 +184,8 @@ public:      inline void         setIsDirty()            { mIsDirty = true; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); }      inline void         clearIsDirty()          { mIsDirty = false; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); } -    virtual void        setCanChangeSettings(bool flag); +    inline bool        getCanChangeSettings() const    { return mCanEdit; } +    inline void        setCanChangeSettings(bool flag) { mCanEdit = flag; }      inline connection_t setOnDirtyFlagChanged(on_dirty_charged_sg::slot_type cb)    { return mOnDirtyChanged.connect(cb); } @@ -197,6 +199,7 @@ protected:  private:      bool                mIsDirty; +    bool                mCanEdit;      on_dirty_charged_sg mOnDirtyChanged;  }; diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index fdd365cc92..aaa54ed2e9 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -71,11 +71,16 @@ namespace      const std::string   FIELD_SKY_SUN_ROTATION("sun_rotation");      const std::string   FIELD_SKY_SUN_IMAGE("sun_image");      const std::string   FIELD_SKY_SUN_SCALE("sun_scale"); +    const std::string   FIELD_SKY_SUN_BEACON("sunbeacon"); +    const std::string   FIELD_SKY_MOON_BEACON("moonbeacon");      const std::string   FIELD_SKY_MOON_ROTATION("moon_rotation");      const std::string   FIELD_SKY_MOON_IMAGE("moon_image");      const std::string   FIELD_SKY_MOON_SCALE("moon_scale");      const std::string   FIELD_SKY_MOON_BRIGHTNESS("moon_brightness"); +    const std::string   PANEL_SKY_SUN_LAYOUT("sun_layout"); +    const std::string   PANEL_SKY_MOON_LAYOUT("moon_layout"); +      const std::string   FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL("rayleigh_exponential");      const std::string   FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE("rayleigh_exponential_scale");      const std::string   FIELD_SKY_DENSITY_RAYLEIGH_LINEAR("rayleigh_linear"); @@ -168,7 +173,7 @@ void LLPanelSettingsSkyAtmosTab::setEnabled(BOOL enabled)  void LLPanelSettingsSkyAtmosTab::refresh()  { -    if (!mSkySettings) +    if (!mSkySettings || !getCanChangeSettings())      {          setAllChildrenEnabled(FALSE);          setEnabled(FALSE); @@ -342,7 +347,7 @@ void LLPanelSettingsSkyCloudTab::setEnabled(BOOL enabled)  void LLPanelSettingsSkyCloudTab::refresh()  { -    if (!mSkySettings) +    if (!mSkySettings || !getCanChangeSettings())      {          setAllChildrenEnabled(FALSE);          setEnabled(FALSE); @@ -480,15 +485,19 @@ void LLPanelSettingsSkySunMoonTab::setEnabled(BOOL enabled)          getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->setEnabled(enabled);          getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setEnabled(enabled);          getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setEnabled(enabled); +        getChildView(PANEL_SKY_SUN_LAYOUT)->setAllChildrenEnabled(TRUE); +        getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(TRUE);      }  }  void LLPanelSettingsSkySunMoonTab::refresh()  { -    if (!mSkySettings) +    if (!mSkySettings || !getCanChangeSettings())      { -        setAllChildrenEnabled(FALSE); -        setEnabled(FALSE); +        getChildView(PANEL_SKY_SUN_LAYOUT)->setAllChildrenEnabled(FALSE); +        getChildView(PANEL_SKY_MOON_LAYOUT)->setAllChildrenEnabled(FALSE); +        getChildView(FIELD_SKY_SUN_BEACON)->setEnabled(TRUE); +        getChildView(FIELD_SKY_MOON_BEACON)->setEnabled(TRUE);          return;      } @@ -654,7 +663,7 @@ void LLPanelSettingsSkyDensityTab::setEnabled(BOOL enabled)  void LLPanelSettingsSkyDensityTab::refresh()  { -    if (!mSkySettings) +    if (!mSkySettings || !getCanChangeSettings())      {          setAllChildrenEnabled(FALSE);          setEnabled(FALSE); diff --git a/indra/newview/llpaneleditwater.cpp b/indra/newview/llpaneleditwater.cpp index 1f9c79c9eb..d8b97b714b 100644 --- a/indra/newview/llpaneleditwater.cpp +++ b/indra/newview/llpaneleditwater.cpp @@ -130,7 +130,7 @@ void LLPanelSettingsWaterMainTab::setEnabled(BOOL enabled)  //==========================================================================  void LLPanelSettingsWaterMainTab::refresh()  { -    if (!mWaterSettings) +    if (!mWaterSettings || !getCanChangeSettings())      {          setAllChildrenEnabled(FALSE);          setEnabled(FALSE); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 00acb78c45..f4cd0eef6e 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -502,7 +502,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildFromLegacyPresetFile(const std::strin          return ptr_t();      } -    return buildFromLegacyPreset(name, legacy_data, messages); +    return buildFromLegacyPreset(LLURI::unescape(name), legacy_data, messages);  } @@ -831,7 +831,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildFromLegacyPresetFile(const std::s          return ptr_t();      } -    return buildFromLegacyPreset(name, legacy_data, messages); +    return buildFromLegacyPreset(LLURI::unescape(name), legacy_data, messages);  } @@ -1101,8 +1101,8 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPresetFile(const std::strin          LL_WARNS("SETTINGS") << "Could not load legacy Windlight \"" << name << "\" from " << path << LL_ENDL;          return ptr_t();      } - -    return buildFromLegacyPreset(name, path, legacy_data, messages); +    // Name for LLSettingsDay only, path to get related files from filesystem +    return buildFromLegacyPreset(LLURI::unescape(name), path, legacy_data, messages);  } diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml index bbba5ba729..0e3de821d1 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml @@ -21,6 +21,7 @@                  auto_resize="true"                  user_resize="false"                  visible="true" +                name="sun_layout"                  height="400">              <text                      follows="left|top" @@ -209,6 +210,7 @@                          auto_resize="true"                          user_resize="false"                          visible="true" +                        name="moon_layout"                          height="220">                      <text                              follows="left|top"  | 
