summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-05-22 10:49:55 -0700
committerRider Linden <rider@lindenlab.com>2018-05-22 10:49:55 -0700
commit044b80e4e1a7b55f46e6f3b52c9cae6d9c6df3eb (patch)
tree3505ebdff373a1c32117cddd42700776d8f051d3
parent9dc8df35c0ae24ed8a1d8329c7b0ac0f71d239bf (diff)
Manual blender for use in day editing dialog.
-rw-r--r--indra/llinventory/llsettingsbase.cpp2
-rw-r--r--indra/llinventory/llsettingsbase.h7
-rw-r--r--indra/llinventory/llsettingsdaycycle.cpp46
-rw-r--r--indra/llinventory/llsettingsdaycycle.h10
-rw-r--r--indra/newview/llenvironment.cpp77
-rw-r--r--indra/newview/llenvironment.h22
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp252
-rw-r--r--indra/newview/llfloatereditextdaycycle.h23
-rw-r--r--indra/newview/llfloaterfixedenvironment.h2
-rw-r--r--indra/newview/llpaneleditsky.h2
-rw-r--r--indra/newview/llpaneleditwater.h2
-rw-r--r--indra/newview/llpanelenvironment.cpp10
-rw-r--r--indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml2
-rw-r--r--indra/newview/skins/default/xui/en/floater_fixedenvironment.xml4
14 files changed, 328 insertions, 133 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index a6a7a9acf9..f870ec8904 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -535,7 +535,7 @@ bool LLSettingsBase::Validator::verifyIntegerRange(LLSD &value, LLSD range)
//=========================================================================
void LLSettingsBlender::update(F64 blendf)
{
-
+ setPosition(blendf);
}
F64 LLSettingsBlender::setPosition(F64 blendf)
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index 6ab3032a3d..d00e340b4b 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -265,7 +265,7 @@ public:
typedef boost::signals2::connection connection_t;
LLSettingsBlender(const LLSettingsBase::ptr_t &target,
- const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 span = 1.0) :
+ const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting) :
mOnFinished(),
mTarget(target),
mInitial(initsetting),
@@ -277,8 +277,9 @@ public:
virtual ~LLSettingsBlender() {}
- virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 span = 1.0)
+ virtual void reset( LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64 /*span*/ = 1.0)
{
+ // note: the 'span' reset parameter is unused by the base class.
mInitial = initsetting;
mFinal = endsetting;
mTarget->replaceSettings(mInitial->getSettings());
@@ -322,7 +323,7 @@ class LLSettingsBlenderTimeDelta : public LLSettingsBlender
public:
LLSettingsBlenderTimeDelta(const LLSettingsBase::ptr_t &target,
const LLSettingsBase::ptr_t &initsetting, const LLSettingsBase::ptr_t &endsetting, F64Seconds seconds) :
- LLSettingsBlender(target, initsetting, endsetting, seconds.value()),
+ LLSettingsBlender(target, initsetting, endsetting),
mBlendSpan(seconds),
mLastUpdate(0.0f),
mTimeSpent(0.0f)
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp
index 5a6280884d..aa3fd4e0e6 100644
--- a/indra/llinventory/llsettingsdaycycle.cpp
+++ b/indra/llinventory/llsettingsdaycycle.cpp
@@ -551,23 +551,15 @@ bool LLSettingsDay::removeTrackKeyframe(S32 trackno, F32 frame)
void LLSettingsDay::setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe)
{
- mDayTracks[TRACK_WATER][llclamp(keyframe, 0.0f, 1.0f)] = water;
- setDirtyFlag(true);
+ setSettingsAtKeyframe(water, keyframe, TRACK_WATER);
}
-const LLSettingsWaterPtr_t LLSettingsDay::getWaterAtKeyframe(F32 keyframe)
+LLSettingsWater::ptr_t LLSettingsDay::getWaterAtKeyframe(F32 keyframe) const
{
- // todo: better way to identify keyframes?
- CycleTrack_t::iterator iter = mDayTracks[TRACK_WATER].find(keyframe);
- if (iter != mDayTracks[TRACK_WATER].end())
- {
- return std::dynamic_pointer_cast<LLSettingsWater>(iter->second);
- }
-
- return LLSettingsWaterPtr_t(NULL);
+ return std::dynamic_pointer_cast<LLSettingsWater>(getSettingsAtKeyframe(keyframe, TRACK_WATER));
}
-void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track)
+void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSky::ptr_t &sky, F32 keyframe, S32 track)
{
if ((track < 1) || (track >= TRACK_MAX))
{
@@ -575,44 +567,48 @@ void LLSettingsDay::setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe
return;
}
- mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = sky;
- setDirtyFlag(true);
+ setSettingsAtKeyframe(sky, keyframe, track);
}
-const LLSettingsSkyPtr_t LLSettingsDay::getSkyAtKeyframe(F32 keyframe, S32 track)
+LLSettingsSky::ptr_t LLSettingsDay::getSkyAtKeyframe(F32 keyframe, S32 track) const
{
if ((track < 1) || (track >= TRACK_MAX))
{
LL_WARNS("DAYCYCLE") << "Attempt to set sky track (#" << track << ") out of range!" << LL_ENDL;
- return LLSettingsSkyPtr_t(NULL);
+ return LLSettingsSky::ptr_t();
}
- // todo: better way to identify keyframes?
- CycleTrack_t::iterator iter = mDayTracks[track].find(keyframe);
- if (iter != mDayTracks[track].end())
+ return std::dynamic_pointer_cast<LLSettingsSky>(getSettingsAtKeyframe(keyframe, track));
+}
+
+void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, F32 keyframe, S32 track)
+{
+ if ((track < 0) || (track >= TRACK_MAX))
{
- return std::dynamic_pointer_cast<LLSettingsSky>(iter->second);
+ LL_WARNS("DAYCYCLE") << "Attempt to set track (#" << track << ") out of range!" << LL_ENDL;
+ return;
}
- return LLSettingsSkyPtr_t(NULL);
+ mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = settings;
+ setDirtyFlag(true);
}
-const LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(F32 keyframe, S32 track)
+LLSettingsBase::ptr_t LLSettingsDay::getSettingsAtKeyframe(F32 keyframe, S32 track) const
{
if ((track < 0) || (track >= TRACK_MAX))
{
LL_WARNS("DAYCYCLE") << "Attempt to set sky track (#" << track << ") out of range!" << LL_ENDL;
- return LLSettingsBase::ptr_t(NULL);
+ return LLSettingsBase::ptr_t();
}
// todo: better way to identify keyframes?
- CycleTrack_t::iterator iter = mDayTracks[track].find(keyframe);
+ CycleTrack_t::const_iterator iter = mDayTracks[track].find(keyframe);
if (iter != mDayTracks[track].end())
{
return iter->second;
}
- return LLSettingsSkyPtr_t(NULL);
+ return LLSettingsBase::ptr_t();
}
LLSettingsDay::TrackBound_t LLSettingsDay::getBoundingEntries(LLSettingsDay::CycleTrack_t &track, F32 keyframe)
diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h
index 15a5b29f9f..9a89031aed 100644
--- a/indra/llinventory/llsettingsdaycycle.h
+++ b/indra/llinventory/llsettingsdaycycle.h
@@ -33,6 +33,8 @@
class LLSettingsWater;
class LLSettingsSky;
+// These are alias for LLSettingsWater::ptr_t and LLSettingsSky::ptr_t respectively.
+// Here for definitions only.
typedef std::shared_ptr<LLSettingsWater> LLSettingsWaterPtr_t;
typedef std::shared_ptr<LLSettingsSky> LLSettingsSkyPtr_t;
@@ -84,16 +86,16 @@ public:
static LLSD defaults();
//---------------------------------------------------------------------
-
KeyframeList_t getTrackKeyframes(S32 track);
bool moveTrackKeyframe(S32 track, F32 old_frame, F32 new_frame);
bool removeTrackKeyframe(S32 track, F32 frame);
void setWaterAtKeyframe(const LLSettingsWaterPtr_t &water, F32 keyframe);
- const LLSettingsWaterPtr_t getWaterAtKeyframe(F32 keyframe);
+ LLSettingsWaterPtr_t getWaterAtKeyframe(F32 keyframe) const;
void setSkyAtKeyframe(const LLSettingsSkyPtr_t &sky, F32 keyframe, S32 track);
- const LLSettingsSkyPtr_t getSkyAtKeyframe(F32 keyframe, S32 track);
- const LLSettingsBase::ptr_t getSettingsAtKeyframe(F32 keyframe, S32 track);
+ LLSettingsSkyPtr_t getSkyAtKeyframe(F32 keyframe, S32 track) const;
+ void setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings, F32 keyframe, S32 track);
+ LLSettingsBase::ptr_t getSettingsAtKeyframe(F32 keyframe, S32 track) const;
//---------------------------------------------------------------------
void startDayCycle();
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 76192d1fe9..cfea83c788 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -400,6 +400,18 @@ void LLEnvironment::setEnvironment(LLEnvironment::EnvSelection_t env, const LLSe
{
DayInstance::ptr_t environment = getEnvironmentInstance(env);
+ if (env == ENV_DEFAULT)
+ {
+ LL_WARNS("ENVIRONMENT") << "Attempt to set default environment. Not allowed." << LL_ENDL;
+ return;
+ }
+
+ if (!settings)
+ {
+ clearEnvironment(env);
+ return;
+ }
+
if (settings->getSettingType() == "daycycle")
{
S64Seconds daylength(LLSettingsDay::DEFAULT_DAYLENGTH);
@@ -1624,3 +1636,68 @@ void LLEnvironment::DayTransition::animate()
LLEnvironment::instance().mCurrentEnvironment = mNextInstance;
});
}
+
+//=========================================================================
+LLTrackBlenderLoopingManual::LLTrackBlenderLoopingManual(const LLSettingsBase::ptr_t &target, const LLSettingsDay::ptr_t &day, S32 trackno) :
+ LLSettingsBlender(target, LLSettingsBase::ptr_t(), LLSettingsBase::ptr_t()),
+ mDay(day),
+ mTrackNo(trackno),
+ mPosition(0.0)
+{
+ LLSettingsDay::TrackBound_t initial = getBoundingEntries(mPosition);
+
+ if (initial.first != mEndMarker)
+ { // No frames in track
+ mInitial = (*initial.first).second;
+ mFinal = (*initial.second).second;
+
+ LLSD initSettings = mInitial->getSettings();
+ mTarget->replaceSettings(initSettings);
+ }
+}
+
+F64 LLTrackBlenderLoopingManual::setPosition(F64 position)
+{
+ mPosition = llclamp(position, 0.0, 1.0);
+
+ LLSettingsDay::TrackBound_t bounds = getBoundingEntries(mPosition);
+
+ if (bounds.first == mEndMarker)
+ { // No frames in track.
+ return 0.0;
+ }
+
+ mInitial = (*bounds.first).second;
+ mFinal = (*bounds.second).second;
+
+ F64 spanLength = getSpanLength(bounds);
+
+ F64 spanPos = ((mPosition < (*bounds.first).first) ? (mPosition + 1.0) : mPosition) - (*bounds.first).first;
+
+ F64 blendf = fmod(spanPos, spanLength) / spanLength;
+ return LLSettingsBlender::setPosition(blendf);
+}
+
+void LLTrackBlenderLoopingManual::switchTrack(S32 trackno, F64 position)
+{
+ mTrackNo = trackno;
+
+ F64 useposition = (position < 0.0) ? mPosition : position;
+
+ setPosition(useposition);
+}
+
+LLSettingsDay::TrackBound_t LLTrackBlenderLoopingManual::getBoundingEntries(F64 position)
+{
+ LLSettingsDay::CycleTrack_t &wtrack = mDay->getCycleTrack(mTrackNo);
+
+ mEndMarker = wtrack.end();
+
+ LLSettingsDay::TrackBound_t bounds = get_bounding_entries(wtrack, position);
+ return bounds;
+}
+
+F64 LLTrackBlenderLoopingManual::getSpanLength(const LLSettingsDay::TrackBound_t &bounds) const
+{
+ return get_wrapping_distance((*bounds.first).first, (*bounds.second).first);
+}
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index fb3bb9f051..9f9eb614a4 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -155,6 +155,7 @@ public:
void setEnvironment(EnvSelection_t env, const LLSettingsBase::ptr_t &fixed);
void setEnvironment(EnvSelection_t env, const LLSettingsSky::ptr_t & fixed) { setEnvironment(env, fixedEnvironment_t(fixed, LLSettingsWater::ptr_t())); }
void setEnvironment(EnvSelection_t env, const LLSettingsWater::ptr_t & fixed) { setEnvironment(env, fixedEnvironment_t(LLSettingsSky::ptr_t(), fixed)); }
+ void setEnvironment(EnvSelection_t env, const LLSettingsSky::ptr_t & fixeds, const LLSettingsWater::ptr_t & fixedw) { setEnvironment(env, fixedEnvironment_t(fixeds, fixedw)); }
void clearEnvironment(EnvSelection_t env);
LLSettingsDay::ptr_t getEnvironmentDay(EnvSelection_t env);
S64Seconds getEnvironmentDayLength(EnvSelection_t env);
@@ -370,6 +371,27 @@ private:
};
+class LLTrackBlenderLoopingManual : public LLSettingsBlender
+{
+public:
+ LLTrackBlenderLoopingManual(const LLSettingsBase::ptr_t &target, const LLSettingsDay::ptr_t &day, S32 trackno);
+
+ F64 setPosition(F64 position) override;
+ void switchTrack(S32 trackno, F64 position = -1.0);
+ S32 getTrack() const { return mTrackNo; }
+
+ typedef std::shared_ptr<LLTrackBlenderLoopingManual> ptr_t;
+protected:
+ LLSettingsDay::TrackBound_t getBoundingEntries(F64 position);
+ F64 getSpanLength(const LLSettingsDay::TrackBound_t &bounds) const;
+
+private:
+ LLSettingsDay::ptr_t mDay;
+ S32 mTrackNo;
+ F64 mPosition;
+
+ LLSettingsDay::CycleTrack_t::iterator mEndMarker;
+};
#endif // LL_ENVIRONMENT_H
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 74cde2b0f7..1c9b42d03f 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -38,10 +38,10 @@
#include "llnotificationsutil.h"
#include "llspinctrl.h"
#include "lltimectrl.h"
+#include "lltabcontainer.h"
#include "llsettingsvo.h"
#include "llinventorymodel.h"
-
// newview
#include "llagent.h"
//#include "llflyoutcombobtnctrl.h" //Todo: get rid of this and LLSaveOutfitComboBtn, make a proper UI element/button/pannel instead
@@ -75,10 +75,9 @@ const std::string XML_FLYOUTMENU_FILE("menu_save_settings.xml");*/
//=========================================================================
// **RIDER**
-const std::string LLFloaterFixedEnvironment::KEY_INVENTORY_ID("inventory_id");
-const std::string LLFloaterFixedEnvironment::KEY_LIVE_ENVIRONMENT("live_environment");
-const std::string LLFloaterFixedEnvironment::KEY_DAY_LENGTH("day_length");
-const std::string LLFloaterFixedEnvironment::KEY_DAY_OFFSET("day_offset");
+const std::string LLFloaterEditExtDayCycle::KEY_INVENTORY_ID("inventory_id");
+const std::string LLFloaterEditExtDayCycle::KEY_LIVE_ENVIRONMENT("live_environment");
+const std::string LLFloaterEditExtDayCycle::KEY_DAY_LENGTH("day_length");
// **RIDER**
@@ -88,7 +87,6 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key):
mCancelButton(NULL),
mUploadButton(NULL),
mDayLength(0),
- mDayOffset(0),
mCurrentTrack(4),
mTimeSlider(NULL),
mFramesSlider(NULL),
@@ -96,10 +94,17 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key):
mCurrentTimeLabel(NULL),
// **RIDER**
mInventoryId(),
- mInventoryItem(nullptr)
+ mInventoryItem(nullptr),
+ mSkyBlender(),
+ mWaterBlender(),
+ mScratchSky(),
+ mScratchWater()
// **RIDER**
{
mCommitCallbackRegistrar.add("DayCycle.Track", boost::bind(&LLFloaterEditExtDayCycle::onTrackSelectionCallback, this, _2));
+
+ mScratchSky = LLSettingsVOSky::buildDefaultSky();
+ mScratchWater = LLSettingsVOWater::buildDefaultWater();
}
LLFloaterEditExtDayCycle::~LLFloaterEditExtDayCycle()
@@ -110,14 +115,13 @@ LLFloaterEditExtDayCycle::~LLFloaterEditExtDayCycle()
//delete mFlyoutControl;
}
-void LLFloaterEditExtDayCycle::openFloater(LLSettingsDay::ptr_t settings, S64Seconds daylength, S64Seconds dayoffset)
-{
- mSavedDay = settings;
- mEditDay = settings->buildClone();
- mDayLength = daylength;
- mDayOffset = dayoffset;
- LLFloater::openFloater();
-}
+// void LLFloaterEditExtDayCycle::openFloater(LLSettingsDay::ptr_t settings, S64Seconds daylength, S64Seconds dayoffset)
+// {
+// mEditDay = settings->buildClone();
+// mDayLength = daylength;
+// mDayOffset = dayoffset;
+// LLFloater::openFloater();
+// }
// virtual
BOOL LLFloaterEditExtDayCycle::postBuild()
@@ -173,13 +177,15 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)
loadLiveEnvironment(env);
}
+ else
+ {
+ loadLiveEnvironment(LLEnvironment::ENV_DEFAULT);
+ }
mDayLength.value(0);
- mDayOffset.value(0);
if (key.has(KEY_DAY_LENGTH))
{
mDayLength.value(key[KEY_DAY_LENGTH].asReal());
- mDayOffset.value(key[KEY_DAY_OFFSET].asReal());
}
// **RIDER**
@@ -201,7 +207,7 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)
LLUIString formatted_label = getString("time_label");
for (int i = 0; i < max_elm; i++)
{
- total = ((mDayLength / (max_elm - 1)) * i) + mDayOffset;
+ total = ((mDayLength / (max_elm - 1)) * i);
hrs = total;
minutes = total - hrs;
@@ -213,8 +219,8 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)
formatted_label.setArg("[MM]", llformat("%d", abs(minutes.value())));
getChild<LLTextBox>("p" + llformat("%d", i), true)->setTextArg("[DSC]", formatted_label.getString());
}
- hrs = mDayOffset;
- minutes = mDayOffset - hrs;
+ hrs = mDayLength;
+ minutes = mDayLength - hrs;
//formatted_label.setArg("[TIME]", llformat("%.1f", hrs.value()));
//date = LLDate(mDayOffset);
//formatted_label.setArg("[TIME]", date.toHTTPDateString(std::string("%H:%M")));
@@ -246,7 +252,7 @@ void LLFloaterEditExtDayCycle::onVisibilityChange(BOOL new_visibility)
{
if (new_visibility)
{
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mEditDay, LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET);
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mScratchSky, mScratchWater);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT);
}
else
@@ -289,8 +295,6 @@ void LLFloaterEditExtDayCycle::onVisibilityChange(BOOL new_visibility)
void LLFloaterEditExtDayCycle::onBtnSave()
{
- mSavedDay = mEditDay;
-
//no longer needed?
if (!mCommitSignal.empty())
mCommitSignal(mEditDay);
@@ -322,41 +326,49 @@ void LLFloaterEditExtDayCycle::onAddTrack()
if (mCurrentTrack == LLSettingsDay::TRACK_WATER)
{
- if (mSliderKeyMap.empty())
- {
- // No existing points, use defaults
- setting = LLSettingsVOWater::buildDefaultWater();
- }
- else
- {
- // clone existing element, since we are intentionally dropping slider on time selection, copy from tab panels
- LLView* tab_container = mWaterTabLayoutContainer->getChild<LLView>("water_tabs"); //can't extract panels directly, since it is in 'tuple'
- LLPanelSettingsWaterMainTab* panel = dynamic_cast<LLPanelSettingsWaterMainTab*>(tab_container->getChildView("water_panel"));
- if (panel)
- {
- setting = panel->getWater()->buildClone();
- }
- }
+ // **RIDER**
+ // scratch water should always have the current water settings.
+ setting = mScratchWater->buildClone();
+// if (mSliderKeyMap.empty())
+// {
+// // No existing points, use defaults
+// setting = LLSettingsVOWater::buildDefaultWater();
+// }
+// else
+// {
+// // clone existing element, since we are intentionally dropping slider on time selection, copy from tab panels
+// LLView* tab_container = mWaterTabLayoutContainer->getChild<LLView>("water_tabs"); //can't extract panels directly, since it is in 'tuple'
+// LLPanelSettingsWaterMainTab* panel = dynamic_cast<LLPanelSettingsWaterMainTab*>(tab_container->getChildView("water_panel"));
+// if (panel)
+// {
+// setting = panel->getWater()->buildClone();
+// }
+// }
+ // **RIDER**
mEditDay->setWaterAtKeyframe(std::dynamic_pointer_cast<LLSettingsWater>(setting), frame);
}
else
{
- if (mSliderKeyMap.empty())
- {
- // No existing points, use defaults
- setting = LLSettingsVOSky::buildDefaultSky();
- }
- else
- {
- // clone existing element, since we are intentionally dropping slider on time selection, copy from tab panels
- LLView* tab_container = mSkyTabLayoutContainer->getChild<LLView>("sky_tabs"); //can't extract panels directly, since they are in 'tuple'
-
- LLPanelSettingsSky* panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("atmosphere_panel"));
- if (panel)
- {
- setting = panel->getSky()->buildClone();
- }
- }
+ // **RIDER**
+ // scratch sky should always have the current sky settings.
+ setting = mScratchSky->buildClone();
+// if (mSliderKeyMap.empty())
+// {
+// // No existing points, use defaults
+// setting = LLSettingsVOSky::buildDefaultSky();
+// }
+// else
+// {
+// // clone existing element, since we are intentionally dropping slider on time selection, copy from tab panels
+// LLView* tab_container = mSkyTabLayoutContainer->getChild<LLView>("sky_tabs"); //can't extract panels directly, since they are in 'tuple'
+//
+// LLPanelSettingsSky* panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("atmosphere_panel"));
+// if (panel)
+// {
+// setting = panel->getSky()->buildClone();
+// }
+// }
+ // **RIDER**
mEditDay->setSkyAtKeyframe(std::dynamic_pointer_cast<LLSettingsSky>(setting), frame, mCurrentTrack);
}
@@ -493,23 +505,27 @@ void LLFloaterEditExtDayCycle::clearTabs()
void LLFloaterEditExtDayCycle::updateTabs()
{
- // TODO: either prevent user from editing existing settings or clone them to not affect saved frames
- std::string sldr = mFramesSlider->getCurSlider();
- if (sldr.empty())
- {
- // keep old settings for duplicating if there are any
- // TODO: disable tabs to prevent editing without nulling settings
- }
- else if (mCurrentTrack == LLSettingsDay::TRACK_WATER)
- {
- const LLSettingsWaterPtr_t p_water = sldr.empty() ? LLSettingsWaterPtr_t(NULL) : mEditDay->getWaterAtKeyframe(mFramesSlider->getCurSliderValue());
- updateWaterTabs(p_water);
- }
- else
- {
- const LLSettingsSkyPtr_t p_sky = sldr.empty() ? LLSettingsSkyPtr_t(NULL) : mEditDay->getSkyAtKeyframe(mFramesSlider->getCurSliderValue(), mCurrentTrack);
- updateSkyTabs(p_sky);
- }
+// // TODO: either prevent user from editing existing settings or clone them to not affect saved frames
+// std::string sldr = mFramesSlider->getCurSlider();
+// if (sldr.empty())
+// {
+// // keep old settings for duplicating if there are any
+// // TODO: disable tabs to prevent editing without nulling settings
+// }
+// else if (mCurrentTrack == LLSettingsDay::TRACK_WATER)
+// {
+// const LLSettingsWaterPtr_t p_water = sldr.empty() ? LLSettingsWaterPtr_t(NULL) : mEditDay->getWaterAtKeyframe(mFramesSlider->getCurSliderValue());
+// updateWaterTabs(p_water);
+// }
+// else
+// {
+// const LLSettingsSkyPtr_t p_sky = sldr.empty() ? LLSettingsSkyPtr_t(NULL) : mEditDay->getSkyAtKeyframe(mFramesSlider->getCurSliderValue(), mCurrentTrack);
+// updateSkyTabs(p_sky);
+// }
+
+ reblendSettings();
+ syncronizeTabs();
+
updateButtons();
updateTimeAndLabel();
}
@@ -598,7 +614,7 @@ void LLFloaterEditExtDayCycle::updateTimeAndLabel()
//formatted_label.setArg("[TIME]", llformat("%.1f", hrs.value()));
//formatted_label.setArg("[TIME]", date.toHTTPDateString(std::string("%H:%M")));
- S64Seconds total = (mDayLength * time) + mDayOffset;
+ S64Seconds total = (mDayLength * time);
S32Hours hrs = total;
S32Minutes minutes = total - hrs;
@@ -682,7 +698,7 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId)
void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status)
{
- mEditDay = settings;
+ mEditDay = std::dynamic_pointer_cast<LLSettingsDay>(settings);
updateEditEnvironment();
syncronizeTabs();
refresh();
@@ -697,7 +713,7 @@ void LLFloaterEditExtDayCycle::loadLiveEnvironment(LLEnvironment::EnvSelection_t
if (day)
{
- mEditDay = day;
+ mEditDay = day->buildClone();
break;
}
}
@@ -709,21 +725,97 @@ void LLFloaterEditExtDayCycle::loadLiveEnvironment(LLEnvironment::EnvSelection_t
void LLFloaterEditExtDayCycle::updateEditEnvironment(void)
{
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mEditDay);
+ S32 skytrack = (mCurrentTrack) ? mCurrentTrack : 1;
+ mSkyBlender = std::make_shared<LLTrackBlenderLoopingManual>(mScratchSky, mEditDay, skytrack);
+ mWaterBlender = std::make_shared<LLTrackBlenderLoopingManual>(mScratchWater, mEditDay, LLSettingsDay::TRACK_WATER);
+
+ reblendSettings();
+
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mScratchSky, mScratchWater);
}
-void LLFloaterFixedEnvironment::syncronizeTabs()
+void LLFloaterEditExtDayCycle::syncronizeTabs()
{
- LLView* tab_container = mWaterTabLayoutContainer->getChild<LLView>("water_tabs"); //can't extract panels directly, since they are in 'tuple'
+ // This should probably get moved into "updateTabs"
- S32 count = mTab->getTabCount();
+ F32 frame = mTimeSlider->getCurSliderValue();
+ bool canedit(false);
+ LLSettingsWater::ptr_t psettingWater;
+ LLTabContainer * tabs = mWaterTabLayoutContainer->getChild<LLTabContainer>("water_tabs");
+ if (mCurrentTrack == LLSettingsDay::TRACK_WATER)
+ {
+ canedit = true;
+ psettingWater = std::static_pointer_cast<LLSettingsWater>(mEditDay->getSettingsAtKeyframe(frame, LLSettingsDay::TRACK_WATER));
+ if (!psettingWater)
+ {
+ canedit = false;
+ psettingWater = mScratchWater;
+ }
+ }
+ else
+ {
+ psettingWater = mScratchWater;
+ }
+
+ S32 count = tabs->getTabCount();
for (S32 idx = 0; idx < count; ++idx)
{
- LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(mTab->getPanelByIndex(idx));
+ LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tabs->getPanelByIndex(idx));
if (panel)
- panel->setSettings(mSettings);
+ {
+ panel->setAllChildrenEnabled(canedit);
+ panel->setSettings(psettingWater);
+ panel->refresh();
+ }
+ }
+
+ LLSettingsSky::ptr_t psettingSky;
+
+ canedit = false;
+ tabs = mSkyTabLayoutContainer->getChild<LLTabContainer>("sky_tabs");
+ if (mCurrentTrack != LLSettingsDay::TRACK_WATER)
+ {
+ canedit = true;
+ psettingSky = std::static_pointer_cast<LLSettingsSky>(mEditDay->getSettingsAtKeyframe(frame, mCurrentTrack));
+ if (!psettingSky)
+ {
+ canedit = false;
+ psettingSky = mScratchSky;
+ }
+ }
+ else
+ {
+ psettingSky = mScratchSky;
}
+
+ count = tabs->getTabCount();
+ for (S32 idx = 0; idx < count; ++idx)
+ {
+ LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(tabs->getPanelByIndex(idx));
+ if (panel)
+ {
+ panel->setAllChildrenEnabled(canedit);
+ panel->setSettings(psettingSky);
+ panel->refresh();
+ }
+ }
+
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, psettingSky, psettingWater);
+}
+
+void LLFloaterEditExtDayCycle::reblendSettings()
+{
+ F64 position = mTimeSlider->getCurSliderValue();
+
+ if ((mSkyBlender->getTrack() != mCurrentTrack) && (mCurrentTrack != LLSettingsDay::TRACK_WATER))
+ {
+ mSkyBlender->switchTrack(mCurrentTrack, position);
+ }
+ else
+ mSkyBlender->setPosition(position);
+
+ mWaterBlender->setPosition(position);
}
// **RIDER**
diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h
index 3cc41e6248..80e5850558 100644
--- a/indra/newview/llfloatereditextdaycycle.h
+++ b/indra/newview/llfloatereditextdaycycle.h
@@ -31,6 +31,8 @@
#include "llsettingsdaycycle.h"
#include <boost/signals2.hpp>
+#include "llenvironment.h"
+
class LLCheckBoxCtrl;
class LLComboBox;
class LLLineEditor;
@@ -39,6 +41,8 @@ class LLTextBox;
class LLTimeCtrl;
//class LLFlyoutComboBtnCtrl;
+class LLInventoryItem;
+
typedef std::shared_ptr<LLSettingsBase> LLSettingsBasePtr_t;
/**
@@ -50,10 +54,9 @@ class LLFloaterEditExtDayCycle : public LLFloater
public:
// **RIDER**
- static const std::string KEY_INVENTORY_ID;
- static const std::string KEY_LIVE_ENVIRONMENT;
- static const std::string KEY_DAY_LENGTH;
- static const std::string KEY_DAY_OFFSET;
+ static const std::string KEY_INVENTORY_ID;
+ static const std::string KEY_LIVE_ENVIRONMENT;
+ static const std::string KEY_DAY_LENGTH;
// **RIDER**
typedef boost::signals2::signal<void(LLSettingsDay::ptr_t)> edit_commit_signal_t;
@@ -62,7 +65,7 @@ public:
LLFloaterEditExtDayCycle(const LLSD &key);
~LLFloaterEditExtDayCycle();
- void openFloater(LLSettingsDay::ptr_t settings, S64Seconds daylength = S64Seconds(0), S64Seconds dayoffset = S64Seconds(0));
+ //void openFloater(LLSettingsDay::ptr_t settings, S64Seconds daylength = S64Seconds(0), S64Seconds dayoffset = S64Seconds(0));
BOOL postBuild();
void onOpen(const LLSD& key);
@@ -115,13 +118,11 @@ private:
void updateEditEnvironment();
void syncronizeTabs();
+ void reblendSettings();
// **RIDER**
-
-
LLSettingsDay::ptr_t mEditDay;
S64Seconds mDayLength;
- S64Seconds mDayOffset;
U32 mCurrentTrack;
std::string mLastFrameSlider;
@@ -140,7 +141,11 @@ private:
// **RIDER**
LLUUID mInventoryId;
LLInventoryItem * mInventoryItem;
- LLEnvironment::EnvSelection_t mEditingEnv;
+ LLEnvironment::EnvSelection_t mEditingEnv;
+ LLTrackBlenderLoopingManual::ptr_t mSkyBlender;
+ LLTrackBlenderLoopingManual::ptr_t mWaterBlender;
+ LLSettingsSky::ptr_t mScratchSky;
+ LLSettingsWater::ptr_t mScratchWater;
// **RIDER**
// LLFlyoutComboBtnCtrl * mFlyoutControl; // not a View!
diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h
index 782dc9e61c..6f1030e6ed 100644
--- a/indra/newview/llfloaterfixedenvironment.h
+++ b/indra/newview/llfloaterfixedenvironment.h
@@ -141,7 +141,7 @@ private:
class LLSettingsEditPanel : public LLPanel
{
public:
- virtual void setSettings(LLSettingsBase::ptr_t &) = 0;
+ virtual void setSettings(const LLSettingsBase::ptr_t &) = 0;
// virtual void refresh() override;
diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h
index 497c98af1f..56ae9dc7bb 100644
--- a/indra/newview/llpaneleditsky.h
+++ b/indra/newview/llpaneleditsky.h
@@ -45,7 +45,7 @@ class LLPanelSettingsSky : public LLSettingsEditPanel
public:
LLPanelSettingsSky();
- virtual void setSettings(LLSettingsBase::ptr_t &settings) override { setSky(std::static_pointer_cast<LLSettingsSky>(settings)); }
+ virtual void setSettings(const LLSettingsBase::ptr_t &settings) override { setSky(std::static_pointer_cast<LLSettingsSky>(settings)); }
LLSettingsSky::ptr_t getSky() const { return mSkySettings; }
void setSky(const LLSettingsSky::ptr_t &sky) { mSkySettings = sky; refresh(); }
diff --git a/indra/newview/llpaneleditwater.h b/indra/newview/llpaneleditwater.h
index 72ffa05767..3b41a1bb24 100644
--- a/indra/newview/llpaneleditwater.h
+++ b/indra/newview/llpaneleditwater.h
@@ -45,7 +45,7 @@ class LLPanelSettingsWater : public LLSettingsEditPanel
public:
LLPanelSettingsWater();
- virtual void setSettings(LLSettingsBase::ptr_t &settings) override { setWater(std::static_pointer_cast<LLSettingsWater>(settings)); }
+ virtual void setSettings(const LLSettingsBase::ptr_t &settings) override { setWater(std::static_pointer_cast<LLSettingsWater>(settings)); }
LLSettingsWater::ptr_t getWater() const { return mWaterSettings; }
void setWater(const LLSettingsWater::ptr_t &water) { mWaterSettings = water; refresh(); }
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index afbbbd424e..ebe3da79f2 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -359,9 +359,13 @@ void LLPanelEnvironmentInfo::onBtnEdit()
LLFloaterEditExtDayCycle *dayeditor = (LLFloaterEditExtDayCycle *)LLFloaterReg::getInstance("env_edit_extdaycycle");
if (dayeditor)
- {
- dayeditor->setEditCommitSignal(boost::bind(&LLPanelEnvironmentInfo::onEditiCommited, this, _1)); //Not needed?
- dayeditor->openFloater(mEditingDayCycle, F32Hours(mDayLengthSlider->getValue().asReal()), F32Hours(mDayOffsetSlider->getValue().asReal()));
+ { //*TODO Determine if region or parcel.
+ LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_LIVE_ENVIRONMENT, "parcel")
+ (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mDayLengthSlider->getValueF32() * (60.0 * 60.0)));
+
+ LLFloaterReg::showInstance("env_edit_extdaycycle", params, TAKE_FOCUS_YES);
+
+// dayeditor->openFloater(mEditingDayCycle, F32Hours(mDayLengthSlider->getValue().asReal()), F32Hours(mDayOffsetSlider->getValue().asReal()));
}
}
diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
index bab902001f..3a3779e753 100644
--- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
+++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
@@ -437,7 +437,7 @@
name="atmosphere_panel" />
<panel
border="true"
- class="panel_settings_clouds"
+ class="panel_settings_cloud"
filename="panel_settings_sky_clouds.xml"
label="Clouds"
layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml b/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml
index 38ce131dc2..f88618fb71 100644
--- a/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml
+++ b/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml
@@ -81,10 +81,6 @@
tab_width="120"
tab_padding_right="3">
<!-- Tabs inserted here in code -->
- <!-- -->
- <!-- -->
-
- <!-- -->
</tab_container>
</layout_panel>
<layout_panel name="button_panel"