From 1716129fd23ff35e030808406af1a8f796dc4b01 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 17 Aug 2018 12:35:42 -0700 Subject: MAINT-8826, MAINT-8990, MAINT-9002, MAINT-7703: Rework for environment pannels in Region/Estate and Parcel. Enable/disable by permission. Edit the correct environment. Dirty flags for changes. Estate owner disallow switch. --- indra/newview/llenvironment.cpp | 2 +- indra/newview/llfloatereditextdaycycle.cpp | 175 ++++++++++++--------- indra/newview/llfloatereditextdaycycle.h | 22 ++- indra/newview/llfloaterregioninfo.cpp | 2 - indra/newview/llflyoutcombobtn.cpp | 5 + indra/newview/llflyoutcombobtn.h | 1 + indra/newview/llinventorybridge.cpp | 2 +- indra/newview/llpanelenvironment.cpp | 40 +++-- indra/newview/llpanelenvironment.h | 6 +- indra/newview/llviewermenu.cpp | 4 +- .../skins/default/xui/en/menu_save_settings.xml | 7 + 11 files changed, 164 insertions(+), 102 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index f33e5b864a..60e5b81f15 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -396,7 +396,7 @@ bool LLEnvironment::canAgentUpdateParcelEnvironment(LLParcel *parcel) const if (gAgent.isGodlike()) return true; - if (!LLEstateInfoModel::instance().getAllowEnvironmentOverride()) + if (!parcel->getRegionAllowEnvironmentOverride()) return false; return LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS); diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 9222bdbe9e..9fc4541c02 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -102,6 +102,7 @@ namespace { // From menu_save_settings.xml, consider moving into flyout since it should be supported by flyout either way const std::string ACTION_SAVE("save_settings"); const std::string ACTION_SAVEAS("save_as_new_settings"); + const std::string ACTION_COMMIT("commit_changes"); const std::string ACTION_APPLY_LOCAL("apply_local"); const std::string ACTION_APPLY_PARCEL("apply_parcel"); const std::string ACTION_APPLY_REGION("apply_region"); @@ -114,6 +115,10 @@ const std::string LLFloaterEditExtDayCycle::KEY_INVENTORY_ID("inventory_id"); const std::string LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT("edit_context"); const std::string LLFloaterEditExtDayCycle::KEY_DAY_LENGTH("day_length"); +const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_INVENTORY("inventory"); +const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_PARCEL("parcel"); +const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION("region"); + //========================================================================= LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) : LLFloater(key), @@ -192,21 +197,31 @@ BOOL LLFloaterEditExtDayCycle::postBuild() void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) { mEditDay.reset(); - - LLEnvironment::EnvSelection_t env = LLEnvironment::ENV_DEFAULT; - if (key.has(KEY_INVENTORY_ID)) + mEditContext = CONTEXT_UNKNOWN; + if (key.has(KEY_EDIT_CONTEXT)) { - loadInventoryItem(key[KEY_INVENTORY_ID].asUUID()); + std::string context = key[KEY_EDIT_CONTEXT].asString(); + + if (context == VALUE_CONTEXT_INVENTORY) + mEditContext = CONTEXT_INVENTORY; + else if (context == VALUE_CONTEXT_PARCEL) + mEditContext = CONTEXT_PARCEL; + else if (context == VALUE_CONTEXT_REGION) + mEditContext = CONTEXT_REGION; } - else if (key.has(KEY_EDIT_CONTEXT)) + + if (mEditContext == CONTEXT_UNKNOWN) { - env = static_cast(key[KEY_EDIT_CONTEXT].asInteger()); + LL_WARNS("ENVDAYEDIT") << "Unknown editing context!" << LL_ENDL; + } - loadLiveEnvironment(env); + if (key.has(KEY_INVENTORY_ID)) + { + loadInventoryItem(key[KEY_INVENTORY_ID].asUUID()); } else { - loadLiveEnvironment(env); + setEditDefaultDayCycle(); } mDayLength.value(0); @@ -255,7 +270,7 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) bool extended_env = LLEnvironment::instance().isExtendedEnvironmentEnabled(); bool use_altitudes = extended_env && altitudes.size() > 0 - && (env == LLEnvironment::ENV_REGION || env == LLEnvironment::ENV_PARCEL); + && ((mEditContext == CONTEXT_PARCEL) || (mEditContext == CONTEXT_REGION)); for (S32 idx = 1; idx < 4; ++idx) { std::ostringstream convert; @@ -275,6 +290,21 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) { getChild(track_tabs[i])->setEnabled(extended_env); } + + if (mEditContext == CONTEXT_INVENTORY) + { + mFlyoutControl->setShownBtnEnabled(true); + mFlyoutControl->setSelectedItem(ACTION_SAVE); + } + else if ((mEditContext == CONTEXT_REGION) || (mEditContext == CONTEXT_PARCEL)) + { + mFlyoutControl->setShownBtnEnabled(true); + mFlyoutControl->setSelectedItem(ACTION_COMMIT); + } + else + { + mFlyoutControl->setShownBtnEnabled(false); + } } void LLFloaterEditExtDayCycle::onClose(bool app_quitting) @@ -315,18 +345,48 @@ void LLFloaterEditExtDayCycle::refresh() bool is_inventory_avail = canUseInventory(); + bool show_commit = ((mEditContext == CONTEXT_PARCEL) || (mEditContext == CONTEXT_REGION)); + bool show_apply = (mEditContext == CONTEXT_INVENTORY); + + mFlyoutControl->setMenuItemVisible(ACTION_COMMIT, show_commit); + mFlyoutControl->setMenuItemVisible(ACTION_SAVE, is_inventory_avail); + mFlyoutControl->setMenuItemVisible(ACTION_SAVEAS, is_inventory_avail); + mFlyoutControl->setMenuItemVisible(ACTION_APPLY_LOCAL, true); + mFlyoutControl->setMenuItemVisible(ACTION_APPLY_PARCEL, show_apply); + mFlyoutControl->setMenuItemVisible(ACTION_APPLY_REGION, show_apply); + + mFlyoutControl->setMenuItemEnabled(ACTION_COMMIT, show_commit); mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail); mFlyoutControl->setMenuItemEnabled(ACTION_SAVEAS, is_inventory_avail); - mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_PARCEL, canApplyParcel()); - mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_REGION, canApplyRegion()); + mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_LOCAL, true); + mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_PARCEL, canApplyParcel() && show_apply); + mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_REGION, canApplyRegion() && show_apply); LLFloater::refresh(); } + +void LLFloaterEditExtDayCycle::setEditDayCycle(const LLSettingsDay::ptr_t &pday) +{ + mEditDay = pday->buildDeepCloneAndUncompress(); + updateEditEnvironment(); + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_INSTANT); + LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_INSTANT); + synchronizeTabs(); + updateTabs(); + refresh(); +} + + +void LLFloaterEditExtDayCycle::setEditDefaultDayCycle() +{ + LLSettingsVOBase::getSettingsAsset(LLSettingsDay::GetDefaultAssetId(), + [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); +} + /* virtual */ BOOL LLFloaterEditExtDayCycle::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) { - LL_DEBUGS("LAPRAS") << "Key: " << key << " mask: " << mask << LL_ENDL; if (mask == MASK_SHIFT && mShiftCopyEnabled) { mShiftCopyEnabled = false; @@ -338,7 +398,6 @@ BOOL LLFloaterEditExtDayCycle::handleKeyUp(KEY key, MASK mask, BOOL called_from_ keymap_t::iterator it = mSliderKeyMap.find(curslider); if (it != mSliderKeyMap.end()) { - LL_DEBUGS("LAPRAS") << "Moving frame from " << (*it).second.mFrame << " to " << sliderpos << LL_ENDL; if (mEditDay->moveTrackKeyframe(mCurrentTrack, (*it).second.mFrame, sliderpos)) { (*it).second.mFrame = sliderpos; @@ -350,7 +409,7 @@ BOOL LLFloaterEditExtDayCycle::handleKeyUp(KEY key, MASK mask, BOOL called_from_ } else { - LL_WARNS("LAPRAS") << "Failed to find frame " << sliderpos << " for slider " << curslider << LL_ENDL; + LL_WARNS("ENVDAYEDIT") << "Failed to find frame " << sliderpos << " for slider " << curslider << LL_ENDL; } } } @@ -376,9 +435,13 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data) { doApplyEnvironment(ctrl_action); } + else if (ctrl_action == ACTION_COMMIT) + { + doApplyCommit(); + } else { - LL_WARNS("ENVIRONMENT") << "Unknown settings action '" << ctrl_action << "'" << LL_ENDL; + LL_WARNS("ENVDAYEDIT") << "Unknown settings action '" << ctrl_action << "'" << LL_ENDL; } } @@ -410,7 +473,7 @@ void LLFloaterEditExtDayCycle::onAddTrack() LLSettingsBase::ptr_t setting; if ((mEditDay->getSettingsNearKeyframe(frame, mCurrentTrack, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)).second) { - LL_WARNS("ENVIRONMENT") << "Attempt to add new frame too close to existing frame." << LL_ENDL; + LL_WARNS("ENVDAYEDIT") << "Attempt to add new frame too close to existing frame." << LL_ENDL; return; } @@ -487,11 +550,8 @@ void LLFloaterEditExtDayCycle::onPlayActionCallback(const LLSD& user_data) void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data) { - //LL_WARNS("LAPRAS") << "LLFloaterEditExtDayCycle::onFrameSliderCallback(" << data << ")" << LL_ENDL; - std::string curslider = mFramesSlider->getCurSlider(); - LL_WARNS("LAPRAS") << "Current slider set to \"" << curslider << "\"" << LL_ENDL; F32 sliderpos(0.0); @@ -515,7 +575,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data) // handleKeyUp will do the move if user releases key too early. if (!(mEditDay->getSettingsNearKeyframe(sliderpos, mCurrentTrack, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)).second) { - LL_DEBUGS() << "Copying frame from " << it->second.mFrame << " to " << sliderpos << LL_ENDL; + LL_DEBUGS("ENVDAYEDIT") << "Copying frame from " << it->second.mFrame << " to " << sliderpos << LL_ENDL; LLSettingsBase::ptr_t new_settings; // mEditDay still remembers old position, add copy at new position @@ -543,7 +603,6 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data) } else { - LL_WARNS("LAPRAS") << "Moving frame from " << (*it).second.mFrame << " to " << sliderpos << LL_ENDL; if (mEditDay->moveTrackKeyframe(mCurrentTrack, (*it).second.mFrame, sliderpos)) { (*it).second.mFrame = sliderpos; @@ -583,21 +642,17 @@ void LLFloaterEditExtDayCycle::onFrameSliderMouseDown(S32 x, S32 y, MASK mask) { F32 sliderval = mFramesSlider->getSliderValue(slidername); - LL_WARNS("LAPRAS") << "Selected vs mouse delta = " << (sliderval - sliderpos) << LL_ENDL; - if (fabs(sliderval - sliderpos) > LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR) { mFramesSlider->resetCurSlider(); } } - LL_WARNS("LAPRAS") << "DOWN: X=" << x << " Y=" << y << " MASK=" << mask << " Position=" << sliderpos << LL_ENDL; } void LLFloaterEditExtDayCycle::onFrameSliderMouseUp(S32 x, S32 y, MASK mask) { F32 sliderpos = mFramesSlider->getSliderValueFromX(x); - LL_WARNS("LAPRAS") << " UP: X=" << x << " Y=" << y << " MASK=" << mask << " Position=" << sliderpos << LL_ENDL; mTimeSlider->setCurSliderValue(sliderpos); selectFrame(sliderpos, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR); } @@ -839,7 +894,7 @@ void LLFloaterEditExtDayCycle::removeCurrentSliderFrame() keymap_t::iterator iter = mSliderKeyMap.find(sldr); if (iter != mSliderKeyMap.end()) { - LL_DEBUGS() << "Removing frame from " << iter->second.mFrame << LL_ENDL; + LL_DEBUGS("ENVDAYEDIT") << "Removing frame from " << iter->second.mFrame << LL_ENDL; LLSettingsBase::Seconds seconds(iter->second.mFrame); mEditDay->removeTrackKeyframe(mCurrentTrack, seconds); mSliderKeyMap.erase(iter); @@ -861,19 +916,19 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId) { if (inventoryId.isNull()) { - LL_WARNS("ENVIRONMENT") << "Attempt to load NULL inventory ID" << LL_ENDL; + LL_WARNS("ENVDAYEDIT") << "Attempt to load NULL inventory ID" << LL_ENDL; mInventoryItem = nullptr; mInventoryId.setNull(); return; } mInventoryId = inventoryId; - LL_INFOS("ENVIRONMENT") << "Setting edit inventory item to " << mInventoryId << "." << LL_ENDL; + LL_INFOS("ENVDAYEDIT") << "Setting edit inventory item to " << mInventoryId << "." << LL_ENDL; mInventoryItem = gInventory.getItem(mInventoryId); if (!mInventoryItem) { - LL_WARNS("ENVIRONMENT") << "Could not find inventory item with Id = " << mInventoryId << LL_ENDL; + LL_WARNS("ENVDAYEDIT") << "Could not find inventory item with Id = " << mInventoryId << LL_ENDL; LLNotificationsUtil::add("CantFindInvItem"); closeFloater(); @@ -884,7 +939,7 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId) if (mInventoryItem->getAssetUUID().isNull()) { - LL_WARNS("ENVIRONMENT") << "Asset ID in inventory item is NULL (" << mInventoryId << ")" << LL_ENDL; + LL_WARNS("ENVDAYEDIT") << "Asset ID in inventory item is NULL (" << mInventoryId << ")" << LL_ENDL; LLNotificationsUtil::add("UnableEditItem"); closeFloater(); @@ -908,40 +963,8 @@ void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::pt closeFloater(); return; } - mEditDay = std::dynamic_pointer_cast(settings)->buildDeepCloneAndUncompress(); - updateEditEnvironment(); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_INSTANT); - LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_INSTANT); - synchronizeTabs(); - updateTabs(); - refresh(); -} - -void LLFloaterEditExtDayCycle::loadLiveEnvironment(LLEnvironment::EnvSelection_t env) -{ - for (S32 idx = static_cast(env); idx <= LLEnvironment::ENV_DEFAULT; ++idx) - { - LLSettingsDay::ptr_t day = LLEnvironment::instance().getEnvironmentDay(static_cast(idx)); - - if (day) - { - mEditDay = day->buildDeepCloneAndUncompress(); - break; - } - } - if (!mEditDay) - { - LL_WARNS("ENVIRONMENT") << "Unable to load environment " << env << " building default." << LL_ENDL; - mEditDay = LLSettingsVODay::buildDefaultDayCycle(); - } - - updateEditEnvironment(); - LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_INSTANT); - LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_INSTANT); - synchronizeTabs(); - updateTabs(); - refresh(); + setEditDayCycle(std::dynamic_pointer_cast(settings)); } void LLFloaterEditExtDayCycle::updateEditEnvironment(void) @@ -1103,7 +1126,7 @@ void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where) if ((!parcel) || (parcel->getLocalID() == INVALID_PARCEL_ID)) { - LL_WARNS("ENVIRONMENT") << "Can not identify parcel. Not applying." << LL_ENDL; + LL_WARNS("ENVDAYEDIT") << "Can not identify parcel. Not applying." << LL_ENDL; LLNotificationsUtil::add("WLParcelApplyFail"); return; } @@ -1116,15 +1139,25 @@ void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where) } else { - LL_WARNS("ENVIRONMENT") << "Unknown apply '" << where << "'" << LL_ENDL; + LL_WARNS("ENVDAYEDIT") << "Unknown apply '" << where << "'" << LL_ENDL; return; } } +void LLFloaterEditExtDayCycle::doApplyCommit() +{ + if (!mCommitSignal.empty()) + { + mCommitSignal(mEditDay->buildClone()); + + closeFloater(); + } +} + void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results) { - LL_INFOS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL; + LL_INFOS("ENVDAYEDIT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL; if (inventory_id.isNull() || !results["success"].asBoolean()) { @@ -1138,7 +1171,7 @@ void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID invent void LLFloaterEditExtDayCycle::onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results) { - LL_WARNS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been updated with asset " << asset_id << " results are:" << results << LL_ENDL; + LL_WARNS("ENVDAYEDIT") << "Inventory item " << inventory_id << " has been updated with asset " << asset_id << " results are:" << results << LL_ENDL; if (inventory_id != mInventoryId) { @@ -1164,12 +1197,8 @@ void LLFloaterEditExtDayCycle::doImportFromDisk() return; } - mEditDay = legacyday; mCurrentTrack = 1; - updateSlider(); - updateEditEnvironment(); - synchronizeTabs(); - refresh(); + setEditDayCycle(legacyday); } } @@ -1290,7 +1319,7 @@ void LLFloaterEditExtDayCycle::onAssetLoadedForFrame(LLUUID asset_id, LLSettings { if (!settings || status) { - LL_WARNS("ENVIRONMENT") << "Could not load asset " << asset_id << " into frame. status=" << status << LL_ENDL; + LL_WARNS("ENVDAYEDIT") << "Could not load asset " << asset_id << " into frame. status=" << status << LL_ENDL; return; } diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 084280063c..7d0489f0bc 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -54,11 +54,20 @@ class LLFloaterEditExtDayCycle : public LLFloater LOG_CLASS(LLFloaterEditExtDayCycle); public: - // **RIDER** static const std::string KEY_INVENTORY_ID; static const std::string KEY_EDIT_CONTEXT; static const std::string KEY_DAY_LENGTH; - // **RIDER** + + static const std::string VALUE_CONTEXT_INVENTORY; + static const std::string VALUE_CONTEXT_PARCEL; + static const std::string VALUE_CONTEXT_REGION; + + enum edit_context_t { + CONTEXT_UNKNOWN, + CONTEXT_INVENTORY, + CONTEXT_PARCEL, + CONTEXT_REGION + }; typedef boost::signals2::signal edit_commit_signal_t; typedef boost::signals2::connection connection_t; @@ -77,7 +86,10 @@ public: virtual void refresh() override; - BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override; + void setEditDayCycle(const LLSettingsDay::ptr_t &pday); + void setEditDefaultDayCycle(); + + BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override; private: @@ -117,12 +129,12 @@ private: void loadInventoryItem(const LLUUID &inventoryId); void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status); - void loadLiveEnvironment(LLEnvironment::EnvSelection_t env); void doImportFromDisk(); void doApplyCreateNewInventory(); void doApplyUpdateInventory(); void doApplyEnvironment(const std::string &where); + void doApplyCommit(); void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results); void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); @@ -181,6 +193,8 @@ private: edit_commit_signal_t mCommitSignal; + edit_context_t mEditContext; + // For map of sliders to parameters class FrameData { diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 1935984df9..11bbd2c6fa 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -198,8 +198,6 @@ protected: virtual void doApply() override; -// virtual void doEditCommited(LLSettingsDay::ptr_t &newday); -// BOOL sendUpdate(); bool doUpdateEstate(const LLSD& notification, const LLSD& response); void onChkAllowOverride(bool value); diff --git a/indra/newview/llflyoutcombobtn.cpp b/indra/newview/llflyoutcombobtn.cpp index a736fcafa3..d1a8b46c92 100644 --- a/indra/newview/llflyoutcombobtn.cpp +++ b/indra/newview/llflyoutcombobtn.cpp @@ -100,6 +100,11 @@ void LLFlyoutComboBtnCtrl::setShownBtnEnabled(bool enabled) mParent->getChildView(mActionButton)->setEnabled(enabled); } +void LLFlyoutComboBtnCtrl::setMenuItemVisible(const std::string &item, bool visible) +{ + mFlyoutMenu->setItemVisible(item, visible); +} + void LLFlyoutComboBtnCtrl::onFlyoutButton(LLUICtrl *ctrl, const LLSD &data) { S32 x, y; diff --git a/indra/newview/llflyoutcombobtn.h b/indra/newview/llflyoutcombobtn.h index 517752d8db..741ad03a37 100644 --- a/indra/newview/llflyoutcombobtn.h +++ b/indra/newview/llflyoutcombobtn.h @@ -41,6 +41,7 @@ public: void setMenuItemEnabled(const std::string &item, bool enabled); void setShownBtnEnabled(bool enabled); + void setMenuItemVisible(const std::string &item, bool visible); U32 getItemCount(); void setSelectedItem(S32 itemno); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 85e2974c1b..138ce9e1cf 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -7389,7 +7389,7 @@ public: LLFloaterReg::showInstance("env_fixed_environmentent_water", LLSDMap("inventory_id", item->getUUID()), TAKE_FOCUS_YES); break; case LLSettingsType::ST_DAYCYCLE: - LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("inventory_id", item->getUUID()), TAKE_FOCUS_YES); + LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("inventory_id", item->getUUID())("edit_context", "inventory"), TAKE_FOCUS_YES); break; default: break; diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 7d11f7c6e2..907118aa44 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -162,7 +162,7 @@ void LLPanelEnvironmentInfo::refresh() void LLPanelEnvironmentInfo::refreshFromSource() { LLEnvironment::instance().requestParcel(mCurrentParcelId, - [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); }); } std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) @@ -207,13 +207,14 @@ LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater() // Show the dialog if (!editor) { - LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, "parcel") + LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::CONTEXT_REGION : LLFloaterEditExtDayCycle::CONTEXT_PARCEL) (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, static_cast(mCurrentEnvironment->mDayLength.value()))); editor = (LLFloaterEditExtDayCycle *)LLFloaterReg::getInstance(FLOATER_DAY_CYCLE_EDIT, params); if (!editor) return nullptr; + editor->setEditCommitSignal([this](LLSettingsDay::ptr_t pday) { onEditCommited(pday); }); } return editor; @@ -313,7 +314,14 @@ void LLPanelEnvironmentInfo::onBtnEdit() { LLFloaterEditExtDayCycle *dayeditor = getEditFloater(); - dayeditor->openFloater(dayeditor->getKey()); + LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION: LLFloaterEditExtDayCycle::VALUE_CONTEXT_PARCEL) + (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, static_cast(mCurrentEnvironment->mDayLength.value()))); + + dayeditor->openFloater(params); + if (mCurrentEnvironment->mDayCycle) + dayeditor->setEditDayCycle(mCurrentEnvironment->mDayCycle); + else + dayeditor->setEditDefaultDayCycle(); } void LLPanelEnvironmentInfo::onBtnSelect() @@ -338,19 +346,19 @@ void LLPanelEnvironmentInfo::doApply() if (rdo_selection == 0) { LLEnvironment::instance().resetParcel(mCurrentParcelId, - [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); }); } else if (rdo_selection == 1) { LLEnvironment::instance().updateParcel(mCurrentParcelId, mCurrentEnvironment->mDayCycle->getAssetId(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), - [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); }); } else { LLEnvironment::instance().updateParcel(mCurrentParcelId, mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), - [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); }); } setControlsEnabled(false); @@ -366,9 +374,17 @@ void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id) }); } -void LLPanelEnvironmentInfo::onEditiCommited(LLSettingsDay::ptr_t newday) +void LLPanelEnvironmentInfo::onEditCommited(LLSettingsDay::ptr_t newday) { - doEditCommited(newday); + size_t newhash(newday->getHash()); + size_t oldhash((mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getHash() : 0); + + if (newhash != oldhash) + { + mCurrentEnvironment->mDayCycle = newday; + setDirtyFlag(DIRTY_FLAG_DAYCYCLE); + refresh(); + } } void LLPanelEnvironmentInfo::onPickerAssetDownloaded(LLSettingsBase::ptr_t settings) @@ -384,7 +400,7 @@ void LLPanelEnvironmentInfo::onPickerAssetDownloaded(LLSettingsBase::ptr_t setti }); } -void LLPanelEnvironmentInfo::handleEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) +void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { if (parcel_id != mCurrentParcelId) { @@ -395,9 +411,3 @@ void LLPanelEnvironmentInfo::handleEnvironmentReceived(S32 parcel_id, LLEnvironm clearDirtyFlag(DIRTY_FLAG_MASK); refresh(); } - -void LLPanelEnvironmentInfo::doEditCommited(LLSettingsDay::ptr_t &newday) -{ -// mEditingDayCycle = newday; - /*TODO pure virtual*/ -} diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index 9a7ce289f0..2fcfb725a1 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -105,11 +105,9 @@ protected: virtual void doApply(); void onPickerCommited(LLUUID asset_id); - void onEditiCommited(LLSettingsDay::ptr_t newday); + void onEditCommited(LLSettingsDay::ptr_t newday); void onPickerAssetDownloaded(LLSettingsBase::ptr_t settings); - void handleEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo); - - virtual void doEditCommited(LLSettingsDay::ptr_t &newday); + void onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo); void refreshFromSource(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index b08eee0ec4..b33da233f5 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8541,11 +8541,11 @@ class LLWorldEnvPreset : public view_listener_t } else if (item == "new_day_cycle") { - LLFloaterReg::showInstance("env_edit_extdaycycle", "new"); + LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("edit_context", "inventory")); } else if (item == "edit_day_cycle") { - LLFloaterReg::showInstance("env_edit_extdaycycle", "edit"); + LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("edit_context", "inventory")); } else { diff --git a/indra/newview/skins/default/xui/en/menu_save_settings.xml b/indra/newview/skins/default/xui/en/menu_save_settings.xml index a72b02c593..e3ed9a1741 100644 --- a/indra/newview/skins/default/xui/en/menu_save_settings.xml +++ b/indra/newview/skins/default/xui/en/menu_save_settings.xml @@ -19,6 +19,13 @@ function="FlyoutCombo.Button.Action" userdata="saveas" /> + + + -- cgit v1.2.3