From 114e358aae80e9e3ca70de093d51e4700c46df37 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 7 Sep 2018 16:09:32 -0700 Subject: Work to make edit floaters respect no mod and no trans. Importing no-trans frame will cause day cycle to become no trans. --- indra/newview/llfloatereditextdaycycle.cpp | 140 ++++++++++++++++++----------- 1 file changed, 90 insertions(+), 50 deletions(-) (limited to 'indra/newview/llfloatereditextdaycycle.cpp') diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 01c1bf3d1a..f1dbb32016 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -138,7 +138,10 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) : mScratchSky(), mScratchWater(), mIsPlaying(false), - mIsDirty(false) + mIsDirty(false), + mCanCopy(false), + mCanMod(false), + mMakeNoTrans(false) { mCommitCallbackRegistrar.add(EVNT_DAYTRACK, [this](LLUICtrl *ctrl, const LLSD &data) { onTrackSelectionCallback(data); }); @@ -365,8 +368,10 @@ void LLFloaterEditExtDayCycle::refresh() { LLLineEditor* name_field = getChild(TXT_DAY_NAME); name_field->setText(mEditDay->getName()); + name_field->setEnabled(mCanMod); } + bool is_inventory_avail = canUseInventory(); bool show_commit = ((mEditContext == CONTEXT_PARCEL) || (mEditContext == CONTEXT_REGION)); @@ -380,12 +385,15 @@ void LLFloaterEditExtDayCycle::refresh() mFlyoutControl->setMenuItemVisible(ACTION_APPLY_REGION, show_apply); mFlyoutControl->setMenuItemEnabled(ACTION_COMMIT, show_commit && !mCommitSignal.empty()); - mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail); - mFlyoutControl->setMenuItemEnabled(ACTION_SAVEAS, is_inventory_avail); + mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail && mCanMod && !mInventoryId.isNull()); + mFlyoutControl->setMenuItemEnabled(ACTION_SAVEAS, is_inventory_avail && mCanCopy); mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_LOCAL, true); mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_PARCEL, canApplyParcel() && show_apply); mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_REGION, canApplyRegion() && show_apply); + mImportButton->setEnabled(mCanMod); + mLoadFrame->setEnabled(mCanMod); + LLFloater::refresh(); } @@ -597,7 +605,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data) keymap_t::iterator it = mSliderKeyMap.find(curslider); if (it != mSliderKeyMap.end()) { - if (gKeyboard->currentMask(TRUE) == MASK_SHIFT && mShiftCopyEnabled) + if (gKeyboard->currentMask(TRUE) == MASK_SHIFT && mShiftCopyEnabled && mCanMod) { // don't move the point/frame as long as shift is pressed and user is attempting to copy // handleKeyUp will do the move if user releases key too early. @@ -631,7 +639,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data) } else { - if (mEditDay->moveTrackKeyframe(mCurrentTrack, (*it).second.mFrame, sliderpos)) + if (mEditDay->moveTrackKeyframe(mCurrentTrack, (*it).second.mFrame, sliderpos) && mCanMod) { (*it).second.mFrame = sliderpos; } @@ -701,7 +709,7 @@ void LLFloaterEditExtDayCycle::checkAndConfirmSettingsLoss(on_confirm_fn cb) // create and show confirmation textbox LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(), - [this, cb](const LLSD¬if, const LLSD&resp) + [cb](const LLSD¬if, const LLSD&resp) { S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); if (opt == 0) @@ -823,42 +831,6 @@ void LLFloaterEditExtDayCycle::updateSkyTabs(const LLSettingsSkyPtr_t &p_sky) } } -void LLFloaterEditExtDayCycle::setWaterTabsEnabled(BOOL enable) -{ - LLView* tab_container = mWaterTabLayoutContainer->getChild(TABS_WATER); //can't extract panels directly, since it is in 'tuple' - LLPanelSettingsWaterMainTab* panel = dynamic_cast(tab_container->getChildView("water_panel")); - if (panel) - { - panel->setEnabled(enable); - panel->setAllChildrenEnabled(enable); - } -} - -void LLFloaterEditExtDayCycle::setSkyTabsEnabled(BOOL enable) -{ - LLView* tab_container = mSkyTabLayoutContainer->getChild(TABS_SKYS); //can't extract panels directly, since they are in 'tuple' - - LLPanelSettingsSky* panel; - panel = dynamic_cast(tab_container->getChildView("atmosphere_panel")); - if (panel) - { - panel->setEnabled(enable); - panel->setAllChildrenEnabled(enable); - } - panel = dynamic_cast(tab_container->getChildView("clouds_panel")); - if (panel) - { - panel->setEnabled(enable); - panel->setAllChildrenEnabled(enable); - } - panel = dynamic_cast(tab_container->getChildView("moon_panel")); - if (panel) - { - panel->setEnabled(enable); - panel->setAllChildrenEnabled(enable); - } -} - void LLFloaterEditExtDayCycle::updateButtons() { // This logic appears to work in reverse, the add frame button @@ -869,8 +841,8 @@ void LLFloaterEditExtDayCycle::updateButtons() //bool can_add = static_cast(settings); //mAddFrameButton->setEnabled(can_add); //mDeleteFrameButton->setEnabled(!can_add); - mAddFrameButton->setEnabled(true); - mDeleteFrameButton->setEnabled(true); + mAddFrameButton->setEnabled(true && mCanMod); + mDeleteFrameButton->setEnabled(true && mCanMod); } void LLFloaterEditExtDayCycle::updateSlider() @@ -973,9 +945,11 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId) { if (inventoryId.isNull()) { - LL_WARNS("ENVDAYEDIT") << "Attempt to load NULL inventory ID" << LL_ENDL; mInventoryItem = nullptr; mInventoryId.setNull(); + mCanCopy = true; + mCanMod = true; + mMakeNoTrans = false; return; } @@ -1006,6 +980,9 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId) return; } + mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID()); + mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID()); + LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); } @@ -1021,6 +998,16 @@ void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::pt return; } + if (mCanCopy) + settings->clearFlag(LLSettingsBase::FLAG_NOCOPY); + else + settings->setFlag(LLSettingsBase::FLAG_NOCOPY); + + if (mCanMod) + settings->clearFlag(LLSettingsBase::FLAG_NOMOD); + else + settings->setFlag(LLSettingsBase::FLAG_NOMOD); + setEditDayCycle(std::dynamic_pointer_cast(settings)); } @@ -1124,8 +1111,7 @@ void LLFloaterEditExtDayCycle::setTabsData(LLTabContainer * tabcontainer, const if (panel) { panel->setSettings(settings); - panel->setEnabled(editable); - panel->setAllChildrenEnabled(editable); + panel->setCanChangeSettings(editable & mCanMod); } } } @@ -1222,6 +1208,19 @@ void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID invent return; } + if (mInventoryItem) + { + LLPermissions perms = mInventoryItem->getPermissions(); + + LLInventoryItem *created_item = gInventory.getItem(mInventoryId); + + if (created_item) + { + created_item->setPermissions(perms); + created_item->updateServer(false); + } + } + clearDirtyFlag(); setFocus(TRUE); // Call back the focus... loadInventoryItem(inventory_id); @@ -1256,6 +1255,8 @@ void LLFloaterEditExtDayCycle::doImportFromDisk() return; } + loadInventoryItem(LLUUID::null); + mCurrentTrack = 1; setDirtyFlag(); setEditDayCycle(legacyday); @@ -1404,13 +1405,52 @@ void LLFloaterEditExtDayCycle::onPickerCommitSetting(LLUUID asset_id) void LLFloaterEditExtDayCycle::onAssetLoadedForFrame(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 track, LLSettingsBase::TrackPosition frame) { + std::function cb = [this, settings, frame, track]() + { + mEditDay->setSettingsAtKeyframe(settings, frame, track); + reblendSettings(); + synchronizeTabs(); + }; + if (!settings || status) { LL_WARNS("ENVDAYEDIT") << "Could not load asset " << asset_id << " into frame. status=" << status << LL_ENDL; return; } - mEditDay->setSettingsAtKeyframe(settings, frame, track); - reblendSettings(); - synchronizeTabs(); + LLFloaterSettingsPicker *picker = static_cast(mInventoryFloater.get()); + LLInventoryItem *inv_item(nullptr); + + if (picker) + { + inv_item = picker->findItem(asset_id, false, false); + } + + if (inv_item) + { + if (mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + { + if (!inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID())) + { + LLSD args; + + // create and show confirmation textbox + LLNotificationsUtil::add("SettingsMakeNoTrans", args, LLSD(), + [this, cb](const LLSD¬if, const LLSD&resp) + { + S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); + if (opt == 0) + { + mMakeNoTrans = true; + mEditDay->setFlag(LLSettingsBase::FLAG_NOTRANS); + cb(); + } + }); + return; + } + } + + } + + cb(); } -- cgit v1.2.3 From 8c9d758e3a5de9e11b2e33753e61a5359dbff8de Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 7 Sep 2018 17:10:27 -0700 Subject: Get rid of (void)this... (this should not have been captured in the first place.) --- indra/newview/llfloatereditextdaycycle.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llfloatereditextdaycycle.cpp') diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 53deb8dadb..f1dbb32016 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -711,7 +711,6 @@ void LLFloaterEditExtDayCycle::checkAndConfirmSettingsLoss(on_confirm_fn cb) LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(), [cb](const LLSD¬if, const LLSD&resp) { - (void)this; S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp); if (opt == 0) cb(); -- cgit v1.2.3