diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llenvironment.h | 5 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 121 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.h | 40 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 4 |
4 files changed, 151 insertions, 19 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 ad759d13ff..74cde2b0f7 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" @@ -71,6 +72,15 @@ const std::string ACTION_APPLY_REGION("apply_region"); 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"); + +// **RIDER** LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key): LLFloater(key), @@ -83,7 +93,11 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key): mTimeSlider(NULL), mFramesSlider(NULL), //mFlyoutControl(NULL), - mCurrentTimeLabel(NULL) + mCurrentTimeLabel(NULL), + // **RIDER** + mInventoryId(), + mInventoryItem(nullptr) + // **RIDER** { mCommitCallbackRegistrar.add("DayCycle.Track", boost::bind(&LLFloaterEditExtDayCycle::onTrackSelectionCallback, this, _2)); } @@ -142,14 +156,34 @@ BOOL LLFloaterEditExtDayCycle::postBuild() void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) { - if (mEditDay.get() == NULL) - { - LL_WARNS() << "Uninitialized day settings, closing floater" << LL_ENDL; - closeFloater(); - } 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)) + { + 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()); @@ -620,3 +654,78 @@ 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** + + diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 46b34de5c7..3cc41e6248 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -49,6 +49,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; @@ -101,25 +108,40 @@ private: void addSliderFrame(const F32 frame, LLSettingsBase::ptr_t setting); void removeCurrentSliderFrame(); + // **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** + + - 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; LLButton* mAddFrameButton; LLButton* mDeleteFrameButton; - 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** // LLFlyoutComboBtnCtrl * mFlyoutControl; // not a View! 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(); |