summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llenvironment.h5
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp122
-rw-r--r--indra/newview/llfloatereditextdaycycle.h40
-rw-r--r--indra/newview/llfloaterfixedenvironment.cpp4
4 files changed, 148 insertions, 23 deletions
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index e21f46d5b0..fb3bb9f051 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -77,13 +77,14 @@ public:
enum EnvSelection_t
{
- ENV_EDIT,
+ ENV_EDIT = 0,
ENV_LOCAL,
ENV_PARCEL,
ENV_REGION,
ENV_DEFAULT,
ENV_END,
- ENV_CURRENT = -1
+ ENV_CURRENT = -1,
+ ENV_NONE = -2
};
typedef boost::signals2::connection connection_t;
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index c57add32fe..222b530155 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -40,6 +40,7 @@
#include "lltimectrl.h"
#include "llsettingsvo.h"
+#include "llinventorymodel.h"
// newview
#include "llagent.h"
@@ -60,6 +61,16 @@ static const std::string track_tabs[] = {
};
+//=========================================================================
+// **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");
+
+// **RIDER**
+
LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key):
LLFloater(key),
mSaveButton(NULL),
@@ -69,7 +80,11 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key):
mCurrentTrack(4),
mTimeSlider(NULL),
mFramesSlider(NULL),
- mCurrentTimeLabel(NULL)
+ mCurrentTimeLabel(NULL),
+ // **RIDER**
+ mInventoryId(),
+ mInventoryItem(nullptr)
+ // **RIDER**
// , mTimeCtrl(NULL)
// , mMakeDefaultCheckBox(NULL)
// ,
@@ -114,19 +129,31 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT);
LLEnvironment::instance().updateEnvironment();
+ // **RIDER**
+
+ mEditingEnv = LLEnvironment::ENV_NONE;
+ mEditDay.reset();
+ if (key.has(KEY_INVENTORY_ID))
+ {
+ loadInventoryItem(key[KEY_INVENTORY_ID].asUUID());
+ }
+ else if (key.has(KEY_LIVE_ENVIRONMENT))
+ {
+ LLEnvironment::EnvSelection_t env = static_cast<LLEnvironment::EnvSelection_t>(key[KEY_LIVE_ENVIRONMENT].asInteger());
+
+ loadLiveEnvironment(env);
+ }
+ mDayLength.value(0);
+ mDayOffset.value(0);
+ if (key.has(KEY_DAY_LENGTH))
{
- // TODO/TEMP
- LLEnvironment::EnvSelection_t env = LLEnvironment::ENV_REGION; // should not be used
- LLSettingsDay::ptr_t pday = LLEnvironment::instance().getEnvironmentDay(env);
- mEditDay = pday->buildClone(); // pday should be passed as parameter
-
- S64Seconds daylength = LLEnvironment::instance().getEnvironmentDayLength(env);
- S64Seconds dayoffset = LLEnvironment::instance().getEnvironmentDayOffset(env);
- mDayLength = daylength; // should be passed as parameter
- mDayOffset = dayoffset; // should be passed as parameter
+ mDayLength.value(key[KEY_DAY_LENGTH].asReal());
+ mDayOffset.value(key[KEY_DAY_OFFSET].asReal());
}
+ // **RIDER**
+
LLLineEditor* name_field = getChild<LLLineEditor>("day_cycle_name");
name_field->setText(mEditDay->getName());
@@ -492,6 +519,81 @@ LLFloaterEditExtDayCycle::connection_t LLFloaterEditExtDayCycle::setEditCommitSi
return mCommitSignal.connect(cb);
}
+// **RIDER**
+void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId)
+{
+ if (inventoryId.isNull())
+ {
+ mInventoryItem = nullptr;
+ mInventoryId.setNull();
+ return;
+ }
+
+ mInventoryId = inventoryId;
+ LL_INFOS("SETTINGS") << "Setting edit inventory item to " << mInventoryId << "." << LL_ENDL;
+ mInventoryItem = gInventory.getItem(mInventoryId);
+
+ if (!mInventoryItem)
+ {
+ LL_WARNS("SETTINGS") << "Could not find inventory item with Id = " << mInventoryId << LL_ENDL;
+ mInventoryId.setNull();
+ mInventoryItem = nullptr;
+ return;
+ }
+
+ LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(),
+ [this](LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status, LLExtStat) { onAssetLoaded(asset_id, settins, status); });
+}
+
+void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status)
+{
+ mEditDay = settings;
+ updateEditEnvironment();
+ syncronizeTabs();
+ refresh();
+}
+
+void LLFloaterEditExtDayCycle::loadLiveEnvironment(LLEnvironment::EnvSelection_t env)
+{
+ mEditingEnv = env;
+ for (S32 idx = static_cast<S32>(env); idx <= LLEnvironment::ENV_DEFAULT; ++idx)
+ {
+ LLSettingsDay::ptr_t day = LLEnvironment::instance().getEnvironmentDay(static_cast<LLEnvironment::EnvSelection_t>(idx));
+
+ if (day)
+ {
+ mEditDay = day;
+ break;
+ }
+ }
+
+ updateEditEnvironment();
+ syncronizeTabs();
+ refresh();
+}
+
+void LLFloaterEditExtDayCycle::updateEditEnvironment(void)
+{
+ LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mEditDay);
+}
+
+void LLFloaterFixedEnvironment::syncronizeTabs()
+{
+ LLView* tab_container = mWaterTabLayoutContainer->getChild<LLView>("water_tabs"); //can't extract panels directly, since they are in 'tuple'
+
+ S32 count = mTab->getTabCount();
+
+ for (S32 idx = 0; idx < count; ++idx)
+ {
+ LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(mTab->getPanelByIndex(idx));
+ if (panel)
+ panel->setSettings(mSettings);
+ }
+}
+
+// **RIDER**
+
+
//
// virtual
// void LLFloaterEditExtDayCycle::draw()
diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h
index c67cfdd274..3185644df9 100644
--- a/indra/newview/llfloatereditextdaycycle.h
+++ b/indra/newview/llfloatereditextdaycycle.h
@@ -48,6 +48,13 @@ class LLFloaterEditExtDayCycle : public LLFloater
LOG_CLASS(LLFloaterEditExtDayCycle);
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;
+ // **RIDER**
+
typedef boost::signals2::signal<void(LLSettingsDay::ptr_t)> edit_commit_signal_t;
typedef boost::signals2::connection connection_t;
@@ -97,6 +104,16 @@ private:
void removeCurrentSliderFrame();
//void updateTrack(); // slider->track, todo: better name
+ // **RIDER**
+ void loadInventoryItem(const LLUUID &inventoryId);
+ void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status);
+ void loadLiveEnvironment(LLEnvironment::EnvSelection_t env);
+
+ void updateEditEnvironment();
+ void syncronizeTabs();
+ // **RIDER**
+
+
// /// refresh the day cycle combobox
// void refreshDayCyclesList();
//
@@ -133,24 +150,29 @@ private:
//
// static std::string getRegionName();
- LLSettingsDay::ptr_t mSavedDay;
LLSettingsDay::ptr_t mEditDay;
S64Seconds mDayLength;
S64Seconds mDayOffset;
U32 mCurrentTrack;
std::string mLastFrameSlider;
- LLButton* mSaveButton;
- LLButton* mCancelButton;
- LLButton* mUploadButton;
+ LLButton* mSaveButton;
+ LLButton* mCancelButton;
+ LLButton* mUploadButton;
edit_commit_signal_t mCommitSignal;
- LLMultiSliderCtrl* mTimeSlider;
- LLMultiSliderCtrl* mFramesSlider;
- LLView* mSkyTabLayoutContainer;
- LLView* mWaterTabLayoutContainer;
- LLTextBox* mCurrentTimeLabel;
+ LLMultiSliderCtrl* mTimeSlider;
+ LLMultiSliderCtrl* mFramesSlider;
+ LLView* mSkyTabLayoutContainer;
+ LLView* mWaterTabLayoutContainer;
+ LLTextBox* mCurrentTimeLabel;
+
+ // **RIDER**
+ LLUUID mInventoryId;
+ LLInventoryItem * mInventoryItem;
+ LLEnvironment::EnvSelection_t mEditingEnv;
+ // **RIDER**
// map of sliders to parameters
typedef std::pair<F32, LLSettingsBase::ptr_t> framedata_t;
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index f03c8ba7d1..8365311179 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -210,9 +210,9 @@ void LLFloaterFixedEnvironment::loadInventoryItem(const LLUUID &inventoryId)
[this](LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status, LLExtStat) { onAssetLoaded(asset_id, settins, status); });
}
-void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status)
+void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status)
{
- mSettings = settins;
+ mSettings = settings;
updateEditEnvironment();
syncronizeTabs();
refresh();