diff options
| -rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 16 | ||||
| -rw-r--r-- | indra/llinventory/llsettingsbase.h | 46 | ||||
| -rw-r--r-- | indra/llinventory/llsettingsdaycycle.cpp | 15 | ||||
| -rw-r--r-- | indra/llinventory/llsettingssky.cpp | 81 | ||||
| -rw-r--r-- | indra/llinventory/llsettingssky.h | 7 | ||||
| -rw-r--r-- | indra/newview/llenvironment.cpp | 14 | ||||
| -rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 105 | ||||
| -rw-r--r-- | indra/newview/llfloatereditextdaycycle.h | 7 | ||||
| -rw-r--r-- | indra/newview/llsettingsvo.cpp | 5 | 
9 files changed, 213 insertions, 83 deletions
| diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 1b3b5d2576..f28d90cb62 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -53,6 +53,7 @@ const std::string LLSettingsBase::SETTING_ID("id");  const std::string LLSettingsBase::SETTING_NAME("name");  const std::string LLSettingsBase::SETTING_HASH("hash");  const std::string LLSettingsBase::SETTING_TYPE("type"); +const std::string LLSettingsBase::SETTING_ASSETID("asset_id");  //=========================================================================  LLSettingsBase::LLSettingsBase(): @@ -307,6 +308,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida      static Validator  validateId(SETTING_ID, false, LLSD::TypeUUID);      static Validator  validateHash(SETTING_HASH, false, LLSD::TypeInteger);      static Validator  validateType(SETTING_TYPE, false, LLSD::TypeString); +    static Validator  validateAssetId(SETTING_ASSETID, false, LLSD::TypeUUID);      stringset_t       validated;      stringset_t       strip;      bool              isValid(true); @@ -335,6 +337,13 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida      }      validated.insert(validateHash.getName()); +    if (!validateAssetId.verify(settings)) +    { +        errors.append(LLSD::String("Invalid asset Id")); +        isValid = false; +    } +    validated.insert(validateAssetId.getName()); +      if (!validateType.verify(settings))      {          errors.append( LLSD::String("Unable to validate 'type'.") ); @@ -595,12 +604,19 @@ LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLS  void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta)  {      mTimeSpent += timedelta; +    mTimeDeltaPassed += timedelta;      if (mTimeSpent > mBlendSpan)      {          triggerComplete();          return;      } +    if (mTimeDeltaPassed < mTimeDeltaThreshold) +    { +        return; +    } + +    mTimeDeltaPassed = LLSettingsBase::Seconds(0.0);      LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan); diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 5e40d185a1..f0d104ff53 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -67,6 +67,7 @@ public:      static const std::string SETTING_NAME;      static const std::string SETTING_HASH;      static const std::string SETTING_TYPE; +    static const std::string SETTING_ASSETID;      typedef std::map<std::string, S32>  parammapping_t; @@ -83,6 +84,7 @@ public:      // Settings status       inline bool hasSetting(const std::string ¶m) const { return mSettings.has(param); }      inline bool isDirty() const { return mDirty; } +    inline bool isVeryDirty() const { return mReplaced; }      inline void setDirtyFlag(bool dirty) { mDirty = dirty; }      size_t getHash() const; // Hash will not include Name, ID or a previously stored Hash @@ -102,11 +104,20 @@ public:          setValue(SETTING_NAME, val);      } +    inline LLUUID getAssetId() const +    { +        if (mSettings.has(SETTING_ASSETID)) +            return mSettings[SETTING_ASSETID].asUUID(); +        return LLUUID(); +    } + +      inline void replaceSettings(LLSD settings)      {          mSettings = settings;          mBlendedFactor = 0.0;          setDirtyFlag(true); +        mReplaced = true;      }      virtual LLSD getSettings() const; @@ -117,6 +128,8 @@ public:      {          mSettings[name] = value;          mDirty = true; +        if (mSettings.has(SETTING_ASSETID)) +            mSettings.erase(SETTING_ASSETID);      }      inline void setValue(const std::string &name, const LLSD &value) @@ -176,7 +189,7 @@ public:      // special consideration from getters.      inline void     update() const      { -        if (!mDirty) +        if ((!mDirty) && (!mReplaced))              return;          (const_cast<LLSettingsBase *>(this))->updateSettings();      } @@ -226,6 +239,12 @@ public:      typedef std::vector<Validator> validation_list_t;      static LLSD settingValidation(LLSD &settings, validation_list_t &validations); + +    inline void setAssetId(LLUUID value) +    {   // note that this skips setLLSD +        mSettings[SETTING_ASSETID] = value; +    } +  protected:      LLSettingsBase(); @@ -249,7 +268,7 @@ protected:      virtual stringset_t getSlerpKeys() const { return stringset_t(); }      // Calculate any custom settings that may need to be cached. -    virtual void updateSettings() { mDirty = false; }; +    virtual void updateSettings() { mDirty = false; mReplaced = false; };      virtual validation_list_t getValidationList() const = 0; @@ -269,10 +288,9 @@ protected:          mBlendedFactor = blendfactor;      } -    void markDirty() { mDirty = true; } -  private:      bool        mDirty; +    bool        mReplaced; // super dirty!      LLSD        combineSDMaps(const LLSD &first, const LLSD &other) const; @@ -367,7 +385,9 @@ public:          LLSettingsBlender(target, initsetting, endsetting),          mBlendSpan(blend_span),          mLastUpdate(0.0f), -        mTimeSpent(0.0f) +        mTimeSpent(0.0f), +        mTimeDeltaThreshold(0.0f), +        mTimeDeltaPassed(0.0f)      {          mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch());          mLastUpdate = mTimeStart; @@ -384,11 +404,23 @@ public:          mBlendSpan  = blend_span;          mTimeStart  = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch());          mLastUpdate = mTimeStart; -        mTimeSpent  = LLSettingsBase::Seconds(0.0); +        mTimeSpent  = LLSettingsBase::Seconds(0.0f); +        mTimeDeltaPassed = LLSettingsBase::Seconds(0.0f);      }      virtual void applyTimeDelta(const LLSettingsBase::Seconds& timedelta) SETTINGS_OVERRIDE; +    inline void setTimeDeltaThreshold(const LLSettingsBase::Seconds time) +    { +        mTimeDeltaThreshold = time; +        mTimeDeltaPassed = time + LLSettingsBase::Seconds(1.0);  // take the next update call. +    } + +    inline LLSettingsBase::Seconds getTimeDeltaThreshold() const +    { +        return mTimeDeltaThreshold; +    } +  protected:      LLSettingsBase::BlendFactor calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const; @@ -396,6 +428,8 @@ protected:      LLSettingsBase::Seconds mLastUpdate;      LLSettingsBase::Seconds mTimeSpent;      LLSettingsBase::Seconds mTimeStart; +    LLSettingsBase::Seconds mTimeDeltaThreshold; +    LLSettingsBase::Seconds mTimeDeltaPassed;  }; diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp index 54cf5302fa..87233e18c3 100644 --- a/indra/llinventory/llsettingsdaycycle.cpp +++ b/indra/llinventory/llsettingsdaycycle.cpp @@ -26,6 +26,7 @@  */  #include "llsettingsdaycycle.h" +#include "llerror.h"  #include <algorithm>  #include <boost/make_shared.hpp>  #include "lltrace.h" @@ -610,6 +611,20 @@ void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings,          return;      } +    std::string type = settings->getSettingsType(); +    if ((track == TRACK_WATER) && (type != "water")) +    { +        LL_WARNS("DAYCYCLE") << "Attempt to add frame of type '" << type << "' to water track!" << LL_ENDL; +        llassert(type == "water"); +        return; +    } +    else if ((track != TRACK_WATER) && (type != "sky")) +    { +        LL_WARNS("DAYCYCLE") << "Attempt to add frame of type '" << type << "' to sky track!" << LL_ENDL; +        llassert(type == "sky"); +        return; +    } +      mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = settings;      setDirtyFlag(true);  } diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 38574c4ef8..87581e813b 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,25 +32,24 @@  #include "llfasttimer.h"  #include "v3colorutil.h" -static const F32 NIGHTTIME_ELEVATION     = -8.0f; // degrees -static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); -static const LLVector3 DUE_EAST = LLVector3::x_axis;  //=========================================================================  namespace  {      LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment");      LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment");     -} -static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) -{ -    LLQuaternion quat; -    quat.setEulerAngles(0.0f, -altitude, azimuth); -    return quat; -} +    const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees +    const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); +    const LLVector3 DUE_EAST = LLVector3::x_axis; -const F32 LLSettingsSky::DOME_OFFSET(0.96f); -const F32 LLSettingsSky::DOME_RADIUS(15000.f); +    LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude) +    { +        LLQuaternion quat; +        quat.setEulerAngles(0.0f, -altitude, azimuth); +        return quat; +    } + +}  //=========================================================================  const std::string LLSettingsSky::SETTING_AMBIENT("ambient"); @@ -114,6 +113,9 @@ static const LLUUID DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749");  const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze"); +const F32 LLSettingsSky::DOME_OFFSET(0.96f); +const F32 LLSettingsSky::DOME_RADIUS(15000.f); +  namespace  { @@ -771,11 +773,14 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy)  void LLSettingsSky::updateSettings()  { -    mPositionsDirty = isDirty(); -    mLightingDirty  = isDirty(); +    mPositionsDirty |= isVeryDirty(); +    mLightingDirty  |= isVeryDirty();      // base class clears dirty flag so as to not trigger recursive update      LLSettingsBase::updateSettings(); + +    calculateHeavenlyBodyPositions(); +    calculateLightSettings();  }  bool LLSettingsSky::getIsSunUp() const @@ -798,6 +803,7 @@ void LLSettingsSky::calculateHeavenlyBodyPositions()  const      }      mPositionsDirty = false; +    mLightingDirty = true;  // changes light direction      LLQuaternion sunq  = getSunRotation();      LLQuaternion moonq = getMoonRotation(); @@ -807,21 +813,27 @@ void LLSettingsSky::calculateHeavenlyBodyPositions()  const      mSunDirection.normalize();      mMoonDirection.normalize(); + +    LL_WARNS("LAPRAS") << "Sun info:  Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL; +    LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL; + +    llassert(mSunDirection.lengthSquared() > 0.0); +    llassert(mMoonDirection.lengthSquared() > 0.0);  }  LLVector3 LLSettingsSky::getLightDirection() const  { -    calculateHeavenlyBodyPositions(); +    update();      // is the normal from the sun or the moon      if (getIsSunUp())      { -        llassert(mSunDirection.length() > 0.01f); +        llassert(mSunDirection.lengthSquared() > 0.01f);          return mSunDirection;      }      else if (getIsMoonUp())      { -        llassert(mMoonDirection.length() > 0.01f); +        llassert(mMoonDirection.lengthSquared() > 0.01f);          return mMoonDirection;      } @@ -885,36 +897,43 @@ F32 LLSettingsSky::getDistanceMultiplier() const  void LLSettingsSky::setBlueDensity(const LLColor3 &val)  {      mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY] = val.getValue(); -    markDirty(); +    setDirtyFlag(true); +    mLightingDirty = true;  }  void LLSettingsSky::setBlueHorizon(const LLColor3 &val)  {      mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON] = val.getValue(); -    markDirty(); +    setDirtyFlag(true); +    mLightingDirty = true;  }  void LLSettingsSky::setDensityMultiplier(F32 val)  {      mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER] = val; -    markDirty(); +    setDirtyFlag(true); +    mLightingDirty = true;  }  void LLSettingsSky::setDistanceMultiplier(F32 val)  {      mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER] = val; -    markDirty(); +    setDirtyFlag(true); +    mLightingDirty = true;  }  void LLSettingsSky::setHazeDensity(F32 val)  {      mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY] = val; -    markDirty(); +    setDirtyFlag(true); +    mLightingDirty = true;  } +  void LLSettingsSky::setHazeHorizon(F32 val)  {      mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON] = val; -    markDirty(); +    setDirtyFlag(true); +    mLightingDirty = true;  }  // Sunlight attenuation effect (hue and brightness) due to atmosphere @@ -955,49 +974,49 @@ LLColor3 LLSettingsSky::gammaCorrect(const LLColor3& in) const  LLVector3 LLSettingsSky::getSunDirection() const  { -    calculateHeavenlyBodyPositions(); +    update();      return mSunDirection;  }  LLVector3 LLSettingsSky::getMoonDirection() const  { -    calculateHeavenlyBodyPositions(); +    update();      return mMoonDirection;  }  LLColor4U LLSettingsSky::getFadeColor() const  { -    calculateLightSettings(); +    update();      return mFadeColor;  }  LLColor4 LLSettingsSky::getMoonAmbient() const  { -    calculateLightSettings(); +    update();      return mMoonAmbient;  }  LLColor3 LLSettingsSky::getMoonDiffuse() const  { -    calculateLightSettings(); +    update();      return mMoonDiffuse;  }  LLColor4 LLSettingsSky::getSunAmbient() const  { -    calculateLightSettings(); +    update();      return mSunAmbient;  }  LLColor3 LLSettingsSky::getSunDiffuse() const  { -    calculateLightSettings(); +    update();      return mSunDiffuse;  }  LLColor4 LLSettingsSky::getTotalAmbient() const  { -    calculateLightSettings(); +    update();      return mTotalAmbient;  } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index c30efe0781..a206106945 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -159,6 +159,7 @@ public:      void setAmbientColor(const LLColor3 &val)      {          setValue(SETTING_AMBIENT, val); +        mLightingDirty = true;      }      LLColor3 getCloudColor() const @@ -241,6 +242,7 @@ public:      void setCloudShadow(F32 val)      {          setValue(SETTING_CLOUD_SHADOW, val); +        mLightingDirty = true;      } @@ -265,6 +267,7 @@ public:      {          mSettings[SETTING_GAMMA] = LLSD::Real(val);          setDirtyFlag(true); +        mLightingDirty = true;      }      LLColor3 getGlow() const @@ -285,6 +288,7 @@ public:      void setMaxY(F32 val)       {          setValue(SETTING_MAX_Y, val); +        mLightingDirty = true;      }      LLQuaternion getMoonRotation() const @@ -295,6 +299,7 @@ public:      void setMoonRotation(const LLQuaternion &val)      {          setValue(SETTING_MOON_ROTATION, val); +        mPositionsDirty = true;      }      LLUUID getMoonTextureId() const @@ -325,6 +330,7 @@ public:      void setSunlightColor(const LLColor3 &val)      {          setValue(SETTING_SUNLIGHT_COLOR, val); +        mLightingDirty = true;      }      LLQuaternion getSunRotation() const @@ -335,6 +341,7 @@ public:      void setSunRotation(const LLQuaternion &val)       {          setValue(SETTING_SUN_ROTATION, val); +        mPositionsDirty = true;      }      LLUUID getSunTextureId() const diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index a5ee7d0737..632f16c7fa 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -65,6 +65,8 @@ namespace      LLTrace::BlockTimerStatHandle   FTM_ENVIRONMENT_UPDATE("Update Environment Tick");      LLTrace::BlockTimerStatHandle   FTM_SHADER_PARAM_UPDATE("Update Shader Parameters"); +    LLSettingsBase::Seconds         DEFAULT_UPDATE_THRESHOLD(10.0); +      //---------------------------------------------------------------------      inline LLSettingsBase::TrackPosition get_wrapping_distance(LLSettingsBase::TrackPosition begin, LLSettingsBase::TrackPosition end)      { @@ -132,13 +134,15 @@ namespace      class LLTrackBlenderLoopingTime : public LLSettingsBlenderTimeDelta      {      public: -        LLTrackBlenderLoopingTime(const LLSettingsBase::ptr_t &target, const LLSettingsDay::ptr_t &day, S32 trackno, LLSettingsBase::Seconds cyclelength, LLSettingsBase::Seconds cycleoffset) : +        LLTrackBlenderLoopingTime(const LLSettingsBase::ptr_t &target, const LLSettingsDay::ptr_t &day, S32 trackno,  +                LLSettingsBase::Seconds cyclelength, LLSettingsBase::Seconds cycleoffset, LLSettingsBase::Seconds updateThreshold) :              LLSettingsBlenderTimeDelta(target, LLSettingsBase::ptr_t(), LLSettingsBase::ptr_t(), LLSettingsBase::Seconds(1.0)),              mDay(day),              mTrackNo(0),              mCycleLength(cyclelength),              mCycleOffset(cycleoffset)          { +            setTimeDeltaThreshold(updateThreshold);              // must happen prior to getBoundingEntries call...              mTrackNo = selectTrackNumber(trackno); @@ -1556,10 +1560,11 @@ void LLEnvironment::DayInstance::animate()      else      {          mWater = LLSettingsVOWater::buildDefaultWater(); -        mBlenderWater = std::make_shared<LLTrackBlenderLoopingTime>(mWater, mDayCycle, 0, mDayLength, mDayOffset); +        mBlenderWater = std::make_shared<LLTrackBlenderLoopingTime>(mWater, mDayCycle, 0,  +            mDayLength, mDayOffset, DEFAULT_UPDATE_THRESHOLD);      } -    // sky, initalize to track 1 +    // sky, initialize to track 1      LLSettingsDay::CycleTrack_t &track = mDayCycle->getCycleTrack(1);      if (track.empty()) @@ -1570,7 +1575,8 @@ void LLEnvironment::DayInstance::animate()      else      {          mSky = LLSettingsVOSky::buildDefaultSky(); -        mBlenderSky = std::make_shared<LLTrackBlenderLoopingTime>(mSky, mDayCycle, 1, mDayLength, mDayOffset); +        mBlenderSky = std::make_shared<LLTrackBlenderLoopingTime>(mSky, mDayCycle, 1,  +            mDayLength, mDayOffset, DEFAULT_UPDATE_THRESHOLD);          mBlenderSky->switchTrack(mSkyTrack, 0.0);      }  } diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 5a6af85334..131ce31187 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -121,7 +121,7 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) :      LLFloater(key),      mFlyoutControl(nullptr),      mDayLength(0), -    mCurrentTrack(4), +    mCurrentTrack(1),      mTimeSlider(nullptr),      mFramesSlider(nullptr),      mCurrentTimeLabel(nullptr), @@ -261,6 +261,7 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)  void LLFloaterEditExtDayCycle::onClose(bool app_quitting)  { +    doCloseInventoryFloater(app_quitting);      // there's no point to change environment if we're quitting      // or if we already restored environment      if (!app_quitting && LLEnvironment::instance().getSelectedEnvironment() == LLEnvironment::ENV_EDIT) @@ -284,16 +285,6 @@ void LLFloaterEditExtDayCycle::onFocusLost()  void LLFloaterEditExtDayCycle::onVisibilityChange(BOOL new_visibility)  { -//     if (new_visibility) -//     { -//         LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mScratchSky, mScratchWater); -//         LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT); -//     } -//     else -//     { -//         LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); -//         stopPlay(); -//     }  }  void LLFloaterEditExtDayCycle::refresh() @@ -351,7 +342,14 @@ void LLFloaterEditExtDayCycle::onButtonImport()  void LLFloaterEditExtDayCycle::onButtonLoadFrame()  { -    doOpenInventoryFloater((mCurrentTrack == LLSettingsDay::TRACK_WATER) ? LLSettingsType::ST_WATER : LLSettingsType::ST_SKY); +    LLUUID curassetId; + +    if (mCurrentEdit) +    {  +        curassetId = mCurrentEdit->getAssetId(); +    } +     +    doOpenInventoryFloater((mCurrentTrack == LLSettingsDay::TRACK_WATER) ? LLSettingsType::ST_WATER : LLSettingsType::ST_SKY, curassetId);  }  void LLFloaterEditExtDayCycle::onAddTrack() @@ -382,6 +380,7 @@ void LLFloaterEditExtDayCycle::onAddTrack()      }      addSliderFrame(frame, setting); +    reblendSettings();      updateTabs();  } @@ -548,8 +547,10 @@ void LLFloaterEditExtDayCycle::onTimeSliderMoved()  void LLFloaterEditExtDayCycle::selectTrack(U32 track_index, bool force )  { -    mCurrentTrack = track_index; -    LLButton* button = getChild<LLButton>(track_tabs[track_index], true); +    if (track_index < LLSettingsDay::TRACK_MAX) +        mCurrentTrack = track_index; + +    LLButton* button = getChild<LLButton>(track_tabs[mCurrentTrack], true);      if (button->getToggleState() && !force)      {          return; @@ -557,7 +558,7 @@ void LLFloaterEditExtDayCycle::selectTrack(U32 track_index, bool force )      for (int i = 0; i < LLSettingsDay::TRACK_MAX; i++) // use max value      { -        getChild<LLButton>(track_tabs[i], true)->setToggleState(i == track_index); +        getChild<LLButton>(track_tabs[i], true)->setToggleState(i == mCurrentTrack);      }      bool show_water = (mCurrentTrack == LLSettingsDay::TRACK_WATER); @@ -609,7 +610,7 @@ void LLFloaterEditExtDayCycle::clearTabs()  void LLFloaterEditExtDayCycle::updateTabs()  {      reblendSettings(); -    syncronizeTabs(); +    synchronizeTabs();      updateButtons();      updateTimeAndLabel(); @@ -819,7 +820,7 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID  &inventoryId)      }      LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), -        [this](LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status, LLExtStat) { onAssetLoaded(asset_id, settins, status); }); +        [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); });  }  void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status) @@ -835,7 +836,7 @@ void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::pt      mEditDay = std::dynamic_pointer_cast<LLSettingsDay>(settings);      updateEditEnvironment();      LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT); -    syncronizeTabs(); +    synchronizeTabs();      refresh();  } @@ -859,7 +860,7 @@ void LLFloaterEditExtDayCycle::loadLiveEnvironment(LLEnvironment::EnvSelection_t      }      updateEditEnvironment(); -    syncronizeTabs(); +    synchronizeTabs();      refresh();  } @@ -871,17 +872,17 @@ void LLFloaterEditExtDayCycle::updateEditEnvironment(void)      mSkyBlender = std::make_shared<LLTrackBlenderLoopingManual>(mScratchSky, mEditDay, skytrack);      mWaterBlender = std::make_shared<LLTrackBlenderLoopingManual>(mScratchWater, mEditDay, LLSettingsDay::TRACK_WATER); -    selectTrack(1, true); +    selectTrack(LLSettingsDay::TRACK_MAX, true);      reblendSettings();      LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mScratchSky, mScratchWater);  } -void LLFloaterEditExtDayCycle::syncronizeTabs() +void LLFloaterEditExtDayCycle::synchronizeTabs()  {      // This should probably get moved into "updateTabs" -    LLSettingsBase::Seconds frame(mTimeSlider->getCurSliderValue()); +    LLSettingsBase::TrackPosition frame(mTimeSlider->getCurSliderValue());      bool canedit(false);      LLSettingsWater::ptr_t psettingW; @@ -891,6 +892,7 @@ void LLFloaterEditExtDayCycle::syncronizeTabs()          canedit = !mIsPlaying;          LLSettingsDay::CycleTrack_t::value_type found = mEditDay->getSettingsNearKeyfarme(frame, LLSettingsDay::TRACK_WATER, FRAME_SLOP_FACTOR);          psettingW = std::static_pointer_cast<LLSettingsWater>(found.second); +        mCurrentEdit = psettingW;          if (!psettingW)          {              canedit = false; @@ -914,6 +916,7 @@ void LLFloaterEditExtDayCycle::syncronizeTabs()          canedit = !mIsPlaying;          LLSettingsDay::CycleTrack_t::value_type found = mEditDay->getSettingsNearKeyfarme(frame, mCurrentTrack, FRAME_SLOP_FACTOR);          psettingS = std::static_pointer_cast<LLSettingsSky>(found.second); +        mCurrentEdit = psettingS;          if (!psettingS)          {              canedit = false; @@ -927,6 +930,8 @@ void LLFloaterEditExtDayCycle::syncronizeTabs()          psettingS = mScratchSky;      } +    doCloseInventoryFloater(); +      setTabsData(tabs, psettingS, canedit);      LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, psettingS, psettingW);  } @@ -1047,7 +1052,7 @@ void LLFloaterEditExtDayCycle::doImportFromDisk()          mCurrentTrack = 1;          updateSlider();          updateEditEnvironment(); -        syncronizeTabs(); +        synchronizeTabs();          refresh();      }  } @@ -1081,6 +1086,8 @@ bool LLFloaterEditExtDayCycle::canApplyParcel() const  void LLFloaterEditExtDayCycle::startPlay()  { +    doCloseInventoryFloater(); +      mIsPlaying = true;      mFramesSlider->resetCurSlider();      mPlayTimer.reset(); @@ -1118,39 +1125,59 @@ void LLFloaterEditExtDayCycle::onIdlePlay(void* user_data)      self->mTimeSlider->setCurSliderValue(new_frame); // will do the rounding      self->mSkyBlender->setPosition(new_frame);      self->mWaterBlender->setPosition(new_frame); -    self->syncronizeTabs(); +    self->synchronizeTabs();  } -void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e type) +void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID currasset)  {  //  LLUI::sWindow->setCursor(UI_CURSOR_WAIT); -    LLFloater* floaterp = mInventoryFloater.get(); +    LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(mInventoryFloater.get());      // Show the dialog -    if (!floaterp) +    if (!picker)      { -        LLFloaterSettingsPicker *picker = new LLFloaterSettingsPicker( -            this, +        picker = new LLFloaterSettingsPicker(this,              LLUUID::null, "SELECT SETTINGS");          mInventoryFloater = picker->getHandle();          picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommitSetting(data.asUUID()); }); -//                 texture_floaterp->setTextureSelectedCallback(boost::bind(&LLOutfitGallery::onTextureSelectionChanged, this, _1)); -//                 texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLOutfitGallery::onTexturePickerCommit, this, _1, _2)); -//                 texture_floaterp->setOnUpdateImageStatsCallback(boost::bind(&LLOutfitGallery::onTexturePickerUpdateImageStats, this, _1)); -//                 texture_floaterp->setLocalTextureEnabled(FALSE); - -        floaterp = picker;      } -    ((LLFloaterSettingsPicker *)floaterp)->setSettingsFilter(type); -    floaterp->openFloater(); -    floaterp->setFocus(TRUE); +    picker->setSettingsFilter(type); +    picker->openFloater(); +    picker->setFocus(TRUE); +} + +void LLFloaterEditExtDayCycle::doCloseInventoryFloater(bool quitting) +{ +    LLFloater* floaterp = mInventoryFloater.get(); + +    if (floaterp) +    { +        floaterp->closeFloater(quitting); +    }  }  void LLFloaterEditExtDayCycle::onPickerCommitSetting(LLUUID asset_id)  { -    LL_WARNS("LAPRAS") << "Got asset ID=" << asset_id << LL_ENDL; +    LLSettingsBase::TrackPosition frame(mTimeSlider->getCurSliderValue()); +    S32 track = mCurrentTrack; + +    LLSettingsVOBase::getSettingsAsset(asset_id, +        [this, track, frame](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoadedForFrame(asset_id, settings, status, track, frame); }); +} + +void LLFloaterEditExtDayCycle::onAssetLoadedForFrame(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 track, LLSettingsBase::TrackPosition frame) +{ +    if (!settings || status) +    { +        LL_WARNS("SETTINGS") << "Could not load asset " << asset_id << " into frame. status=" << status << LL_ENDL; +        return; +    } + +    mEditDay->setSettingsAtKeyframe(settings, frame, track); +    reblendSettings(); +    synchronizeTabs();  } diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 0ec5e91b4d..0c2cf3922e 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -122,15 +122,17 @@ private:      void                        onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results);      void                        onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); -    void                        doOpenInventoryFloater(LLSettingsType::type_e type); +    void                        doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID currasset); +    void                        doCloseInventoryFloater(bool quitting = false);      void                        onPickerCommitSetting(LLUUID asset_id); +    void                        onAssetLoadedForFrame(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 track, LLSettingsBase::TrackPosition frame);      bool                        canUseInventory() const;      bool                        canApplyRegion() const;      bool                        canApplyParcel() const;      void                        updateEditEnvironment(); -    void                        syncronizeTabs(); +    void                        synchronizeTabs();      void                        reblendSettings();      void                        setTabsData(LLTabContainer * tabcontainer, const LLSettingsBase::ptr_t &settings, bool editable); @@ -164,6 +166,7 @@ private:      LLTrackBlenderLoopingManual::ptr_t  mWaterBlender;      LLSettingsSky::ptr_t        mScratchSky;      LLSettingsWater::ptr_t      mScratchWater; +    LLSettingsBase::ptr_t       mCurrentEdit;      LLFrameTimer                mPlayTimer;      F32                         mPlayStartFrame; // an env frame diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 0ec7db2ed7..fba62e1ce9 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -222,7 +222,10 @@ void LLSettingsVOBase::onAssetDownloadComplete(LLVFS *vfs, const LLUUID &asset_i              status = 1;              LL_WARNS("SETTINGS") << "Unable to creat settings object." << LL_ENDL;          } - +        else +        { +            settings->setAssetId(asset_id); +        }      }      else      { | 
