Work to make edit floaters respect no mod and no trans. Importing no-trans frame will cause day cycle to become no trans.

master
Rider Linden 2018-09-07 16:09:32 -07:00
parent e539236a75
commit 114e358aae
10 changed files with 211 additions and 62 deletions

View File

@ -58,6 +58,7 @@ const std::string LLSettingsBase::SETTING_FLAGS("flags");
const U32 LLSettingsBase::FLAG_NOCOPY(0x01 << 0);
const U32 LLSettingsBase::FLAG_NOMOD(0x01 << 1);
const U32 LLSettingsBase::FLAG_NOTRANS(0x01 << 2);
//=========================================================================
LLSettingsBase::LLSettingsBase():

View File

@ -74,6 +74,7 @@ public:
static const U32 FLAG_NOCOPY;
static const U32 FLAG_NOMOD;
static const U32 FLAG_NOTRANS;
typedef std::map<std::string, S32> parammapping_t;

View File

@ -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<LLLineEditor>(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&notif, const LLSD&resp)
[cb](const LLSD&notif, 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<LLView>(TABS_WATER); //can't extract panels directly, since it is in 'tuple'
LLPanelSettingsWaterMainTab* panel = dynamic_cast<LLPanelSettingsWaterMainTab*>(tab_container->getChildView("water_panel"));
if (panel)
{
panel->setEnabled(enable);
panel->setAllChildrenEnabled(enable);
}
}
void LLFloaterEditExtDayCycle::setSkyTabsEnabled(BOOL enable)
{
LLView* tab_container = mSkyTabLayoutContainer->getChild<LLView>(TABS_SKYS); //can't extract panels directly, since they are in 'tuple'
LLPanelSettingsSky* panel;
panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("atmosphere_panel"));
if (panel)
{
panel->setEnabled(enable);
panel->setAllChildrenEnabled(enable);
}
panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("clouds_panel"));
if (panel)
{
panel->setEnabled(enable);
panel->setAllChildrenEnabled(enable);
}
panel = dynamic_cast<LLPanelSettingsSky*>(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<bool>(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<LLSettingsDay>(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<void()> 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<LLFloaterSettingsPicker *>(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&notif, const LLSD&resp)
{
S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
if (opt == 0)
{
mMakeNoTrans = true;
mEditDay->setFlag(LLSettingsBase::FLAG_NOTRANS);
cb();
}
});
return;
}
}
}
cb();
}

View File

@ -125,8 +125,6 @@ private:
void updateTabs();
void updateWaterTabs(const LLSettingsWaterPtr_t &p_water);
void updateSkyTabs(const LLSettingsSkyPtr_t &p_sky);
void setWaterTabsEnabled(BOOL enable);
void setSkyTabsEnabled(BOOL enable);
void updateButtons();
void updateSlider(); //generate sliders from current track
void updateTimeAndLabel();
@ -201,6 +199,9 @@ private:
F32 mPlayStartFrame; // an env frame
bool mIsPlaying;
bool mIsDirty;
bool mCanCopy;
bool mCanMod;
bool mMakeNoTrans;
edit_commit_signal_t mCommitSignal;

View File

@ -87,7 +87,9 @@ LLFloaterFixedEnvironment::LLFloaterFixedEnvironment(const LLSD &key) :
mFlyoutControl(nullptr),
mInventoryId(),
mInventoryItem(nullptr),
mIsDirty(false)
mIsDirty(false),
mCanCopy(false),
mCanMod(false)
{
}
@ -168,12 +170,13 @@ void LLFloaterFixedEnvironment::refresh()
bool is_inventory_avail = canUseInventory();
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_PARCEL, canApplyParcel());
mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_REGION, canApplyRegion());
mTxtName->setValue(mSettings->getName());
mTxtName->setEnabled(mCanMod);
S32 count = mTab->getTabCount();
@ -181,7 +184,10 @@ void LLFloaterFixedEnvironment::refresh()
{
LLSettingsEditPanel *panel = static_cast<LLSettingsEditPanel *>(mTab->getPanelByIndex(idx));
if (panel)
{
panel->refresh();
panel->setCanChangeSettings(mCanMod);
}
}
}
@ -221,6 +227,8 @@ void LLFloaterFixedEnvironment::loadInventoryItem(const LLUUID &inventoryId)
{
mInventoryItem = nullptr;
mInventoryId.setNull();
mCanMod = true;
mCanCopy = true;
return;
}
@ -250,9 +258,11 @@ void LLFloaterFixedEnvironment::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 settins, S32 status, LLExtStat) { onAssetLoaded(asset_id, settins, status); });
[this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); });
}
@ -265,7 +275,7 @@ void LLFloaterFixedEnvironment::checkAndConfirmSettingsLoss(LLFloaterFixedEnviro
// create and show confirmation textbox
LLNotificationsUtil::add("SettingsConfirmLoss", args, LLSD(),
[this, cb](const LLSD&notif, const LLSD&resp)
[cb](const LLSD&notif, const LLSD&resp)
{
S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
if (opt == 0)
@ -296,6 +306,9 @@ void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::p
}
mSettings = settings;
if (mInventoryItem)
mSettings->setName(mInventoryItem->getName());
updateEditEnvironment();
syncronizeTabs();
refresh();
@ -359,12 +372,19 @@ void LLFloaterFixedEnvironment::doApplyCreateNewInventory()
void LLFloaterFixedEnvironment::doApplyUpdateInventory()
{
LL_WARNS("LAPRAS") << "Update inventory for " << mInventoryId << LL_ENDL;
if (mInventoryId.isNull())
LLSettingsVOBase::createInventoryItem(mSettings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS),
[this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); });
{
LL_WARNS("LAPRAS") << "Inventory ID is NULL. Creating New!!!" << LL_ENDL;
LLSettingsVOBase::createInventoryItem(mSettings, gInventory.findCategoryUUIDForType(LLFolderType::FT_SETTINGS),
[this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryCreated(asset_id, inventory_id, results); });
}
else
LLSettingsVOBase::updateInventoryItem(mSettings, mInventoryId,
[this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); });
{
LL_WARNS("LAPRAS") << "Updating inventory ID " << mInventoryId << LL_ENDL;
LLSettingsVOBase::updateInventoryItem(mSettings, mInventoryId,
[this](LLUUID asset_id, LLUUID inventory_id, LLUUID, LLSD results) { onInventoryUpdated(asset_id, inventory_id, results); });
}
}
void LLFloaterFixedEnvironment::doApplyEnvironment(const std::string &where)
@ -430,6 +450,18 @@ void LLFloaterFixedEnvironment::onInventoryCreated(LLUUID asset_id, LLUUID inven
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);
@ -563,10 +595,13 @@ void LLFloaterFixedEnvironmentWater::doImportFromDisk()
return;
}
loadInventoryItem(LLUUID::null);
setDirtyFlag();
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, legacywater);
setEditSettings(legacywater);
LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_FAST, true);
}
}
@ -641,6 +676,8 @@ void LLFloaterFixedEnvironmentSky::doImportFromDisk()
return;
}
loadInventoryItem(LLUUID::null);
clearDirtyFlag();
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, legacysky);
setEditSettings(legacysky);
@ -650,3 +687,8 @@ void LLFloaterFixedEnvironmentSky::doImportFromDisk()
//=========================================================================
void LLSettingsEditPanel::setCanChangeSettings(bool enabled)
{
setEnabled(enabled);
setAllChildrenEnabled(enabled);
}

View File

@ -97,6 +97,8 @@ protected:
LLUUID mInventoryId;
LLInventoryItem * mInventoryItem;
LLHandle<LLFloater> mInventoryFloater;
bool mCanCopy;
bool mCanMod;
void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results);
void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results);
@ -173,8 +175,11 @@ public:
inline void setIsDirty() { mIsDirty = true; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); }
inline void clearIsDirty() { mIsDirty = false; if (!mOnDirtyChanged.empty()) mOnDirtyChanged(this, mIsDirty); }
virtual void setCanChangeSettings(bool flag);
inline connection_t setOnDirtyFlagChanged(on_dirty_charged_sg::slot_type cb) { return mOnDirtyChanged.connect(cb); }
protected:
LLSettingsEditPanel() :
LLPanel(),

View File

@ -60,6 +60,8 @@
#include "lldrawpoolwater.h"
#include <boost/algorithm/string/replace.hpp>
#include "llinventoryobserver.h"
#include "llinventorydefines.h"
#undef VERIFY_LEGACY_CONVERSION
@ -177,6 +179,34 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings
return;
}
LLViewerInventoryItem *inv_item = gInventory.getItem(inv_item_id);
if (inv_item)
{
bool need_update(false);
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item);
if (settings->getFlag(LLSettingsBase::FLAG_NOTRANS) && new_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
{
LLPermissions perm(inv_item->getPermissions());
perm.setBaseBits(LLUUID::null, FALSE, PERM_TRANSFER);
perm.setOwnerBits(LLUUID::null, FALSE, PERM_TRANSFER);
new_item->setPermissions(perm);
need_update |= true;
}
if (settings->getName() != new_item->getName())
{
new_item->rename(settings->getName());
settings->setName(new_item->getName()); // account for corrections
need_update |= true;
}
if (need_update)
{
new_item->updateServer(FALSE);
gInventory.updateItem(new_item);
gInventory.notifyObservers();
}
}
std::stringstream buffer;
LLSD settingdata(settings->getSettings());
LLSDSerialize::serialize(settingdata, buffer, LLSDSerialize::LLSD_NOTATION);
@ -210,7 +240,6 @@ void LLSettingsVOBase::updateInventoryItem(const LLSettingsBase::ptr_t &settings
std::stringstream buffer;
LLSD settingdata(settings->getSettings());
LLSDSerialize::serialize(settingdata, buffer, LLSDSerialize::LLSD_NOTATION);
LLResourceUploadInfo::ptr_t uploadInfo = std::make_shared<LLBufferedAssetUploadInfo>(object_id, inv_item_id, LLAssetType::AT_SETTINGS, buffer.str(),
@ -293,6 +322,10 @@ void LLSettingsVOBase::onAssetDownloadComplete(LLVFS *vfs, const LLUUID &asset_i
callback(asset_id, settings, status, ext_status);
}
void LLSettingsVOBase::getSettingsInventory(const LLUUID &inventoryId, inventory_download_fn callback)
{
}
bool LLSettingsVOBase::exportFile(const LLSettingsBase::ptr_t &settings, const std::string &filename, LLSDSerialize::ELLSD_Serialize format)
{
@ -1105,6 +1138,10 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone() const
LLSettingsDay::ptr_t dayp = std::make_shared<LLSettingsVODay>(settings);
U32 flags = getFlags();
if (flags)
dayp->setFlags(flags);
dayp->initialize();
return dayp;
}

View File

@ -39,12 +39,14 @@
#include <boost/signals2.hpp>
class LLVFS;
class LLInventoryItem;
//=========================================================================
class LLSettingsVOBase : public LLSettingsBase
{
public:
typedef std::function<void(LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status, LLExtStat extstat)> asset_download_fn;
typedef std::function<void(LLInventoryItem *inv_item, LLSettingsBase::ptr_t settings, S32 status, LLExtStat extstat)> inventory_download_fn;
typedef std::function<void(LLUUID asset_id, LLUUID inventory_id, LLUUID object_id, LLSD results)> inventory_result_fn;
static void createNewInventoryItem(LLSettingsType::type_e stype, const LLUUID &parent_id, inventory_result_fn callback = inventory_result_fn());
@ -54,6 +56,7 @@ public:
static void updateInventoryItem(const LLSettingsBase::ptr_t &settings, LLUUID object_id, LLUUID inv_item_id, inventory_result_fn callback = inventory_result_fn());
static void getSettingsAsset(const LLUUID &assetId, asset_download_fn callback);
static void getSettingsInventory(const LLUUID &inventoryId, inventory_download_fn callback = inventory_download_fn());
static bool exportFile(const LLSettingsBase::ptr_t &settings, const std::string &filename, LLSDSerialize::ELLSD_Serialize format = LLSDSerialize::LLSD_NOTATION);
static LLSettingsBase::ptr_t importFile(const std::string &filename);

View File

@ -15,6 +15,8 @@
help_topic="fixed_environment"
single_instance="true"
width="750">
<string name="edit_sky">Edit Sky:</string>
<string name="edit_water">Edit Water:</string>
<layout_stack name="floater_stack"
left="5"
top="5"

View File

@ -11197,5 +11197,22 @@ Are you sure you want to continue?
notext="No"
yestext="Yes"/>
</notification>
<notification
icon="alertmodal.tga"
name="SettingsMakeNoTrans"
type="alertmodal">
You are about to import non-transferable settings into this daycycle. Continuing will cause the settings you are editing to become non-transferable also.
This change can not be undone.
Are you sure you want to continue?
<tag>confirm</tag>
<usetemplate
ignoretext="Are you sure you want to make settings non-transferable?"
name="okcancelignore"
notext="No"
yestext="Yes"/>
</notification>
</notifications>