diff options
author | Rider Linden <rider@lindenlab.com> | 2018-10-04 23:10:30 +0000 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-10-04 23:10:30 +0000 |
commit | 107994a68ff556d0ab7213795fe31bf724bc599c (patch) | |
tree | 019a6bae50457a40183117c09283a51b5ab108fb /indra/newview | |
parent | f6b2f4574411af09445db9b78af809f4eb22830f (diff) | |
parent | 57ff71c915727abe09e794da4aa1615eb43f0abf (diff) |
Merged in andreykproductengine/maint-eep2 (pull request #129)
SL-9654 [EEP] Settings Picker reliability
Approved-by: Andrey Lihatskiy <andreylproductengine@lindenlab.com>
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 38 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.h | 8 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.h | 2 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.cpp | 35 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.h | 2 | ||||
-rw-r--r-- | indra/newview/llsettingspicker.cpp | 76 | ||||
-rw-r--r-- | indra/newview/llsettingspicker.h | 22 |
8 files changed, 98 insertions, 102 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 1d209fe230..840b392f5d 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -565,14 +565,14 @@ void LLFloaterEditExtDayCycle::onButtonImport() void LLFloaterEditExtDayCycle::onButtonLoadFrame() { - LLUUID curassetId; + LLUUID curitemId = mInventoryId; - if (mCurrentEdit) + if (mCurrentEdit && curitemId.notNull()) { - curassetId = mCurrentEdit->getAssetId(); + curitemId = LLFloaterSettingsPicker::findItemID(mCurrentEdit->getAssetId(), false, false); } - doOpenInventoryFloater((mCurrentTrack == LLSettingsDay::TRACK_WATER) ? LLSettingsType::ST_WATER : LLSettingsType::ST_SKY, curassetId); + doOpenInventoryFloater((mCurrentTrack == LLSettingsDay::TRACK_WATER) ? LLSettingsType::ST_WATER : LLSettingsType::ST_SKY, curitemId); } void LLFloaterEditExtDayCycle::onAddTrack() @@ -999,7 +999,7 @@ void LLFloaterEditExtDayCycle::updateTimeAndLabel() // Update blender here: } -void LLFloaterEditExtDayCycle::addSliderFrame(const F32 frame, LLSettingsBase::ptr_t &setting, bool update_ui) +void LLFloaterEditExtDayCycle::addSliderFrame(const F32 frame, const LLSettingsBase::ptr_t &setting, bool update_ui) { // multi slider distinguishes elements by key/name in string format // store names to map to be able to recall dependencies @@ -1485,7 +1485,7 @@ void LLFloaterEditExtDayCycle::clearDirtyFlag() } -void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID currasset) +void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID curritem) { // LLUI::sWindow->setCursor(UI_CURSOR_WAIT); LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(mInventoryFloater.get()); @@ -1502,7 +1502,7 @@ void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e typ } picker->setSettingsFilter(type); - picker->setSettingsAssetId(currasset); + picker->setSettingsItemId(curritem); picker->openFloater(); picker->setFocus(TRUE); } @@ -1517,16 +1517,21 @@ void LLFloaterEditExtDayCycle::doCloseInventoryFloater(bool quitting) } } -void LLFloaterEditExtDayCycle::onPickerCommitSetting(LLUUID asset_id) +void LLFloaterEditExtDayCycle::onPickerCommitSetting(LLUUID item_id) { LLSettingsBase::TrackPosition frame(mTimeSlider->getCurSliderValue()); S32 track = mCurrentTrack; - - LLSettingsVOBase::getSettingsAsset(asset_id, - [this, track, frame](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoadedForFrame(asset_id, settings, status, track, frame); }); + LLViewerInventoryItem *itemp = gInventory.getItem(item_id); + if (itemp) + { + mInventoryId = item_id; + mInventoryItem = itemp; + LLSettingsVOBase::getSettingsAsset(itemp->getAssetUUID(), + [this, track, frame, item_id](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoadedForFrame(item_id, asset_id, settings, status, track, frame); }); + } } -void LLFloaterEditExtDayCycle::onAssetLoadedForFrame(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 track, LLSettingsBase::TrackPosition frame) +void LLFloaterEditExtDayCycle::onAssetLoadedForFrame(LLUUID item_id, LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 track, LLSettingsBase::TrackPosition frame) { std::function<void()> cb = [this, settings, frame, track]() { @@ -1541,6 +1546,7 @@ void LLFloaterEditExtDayCycle::onAssetLoadedForFrame(LLUUID asset_id, LLSettings return; } mEditDay->setSettingsAtKeyframe(settings, frame, track); + addSliderFrame(frame, settings, false); reblendSettings(); synchronizeTabs(); }; @@ -1551,13 +1557,7 @@ void LLFloaterEditExtDayCycle::onAssetLoadedForFrame(LLUUID asset_id, LLSettings return; } - LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(mInventoryFloater.get()); - LLInventoryItem *inv_item(nullptr); - - if (picker) - { - inv_item = picker->findItem(asset_id, false, false); - } + LLInventoryItem *inv_item = gInventory.getItem(item_id); if (inv_item && mInventoryItem diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 0d306961df..0f2c572ccf 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -130,7 +130,7 @@ private: void updateButtons(); void updateSlider(); //generate sliders from current track void updateTimeAndLabel(); - void addSliderFrame(const F32 frame, LLSettingsBase::ptr_t &setting, bool update_ui = true); + void addSliderFrame(const F32 frame, const LLSettingsBase::ptr_t &setting, bool update_ui = true); void removeCurrentSliderFrame(); void loadInventoryItem(const LLUUID &inventoryId); @@ -145,10 +145,10 @@ private: void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results); void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results); - void doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID currasset); + void doOpenInventoryFloater(LLSettingsType::type_e type, LLUUID curritem); void doCloseInventoryFloater(bool quitting = false); - void onPickerCommitSetting(LLUUID asset_id); - void onAssetLoadedForFrame(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 track, LLSettingsBase::TrackPosition frame); + void onPickerCommitSetting(LLUUID item_id); + void onAssetLoadedForFrame(LLUUID item_id, LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 track, LLSettingsBase::TrackPosition frame); bool canUseInventory() const; bool canApplyRegion() const; diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 216556cf89..5cd99e6ad2 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -290,21 +290,12 @@ void LLFloaterFixedEnvironment::checkAndConfirmSettingsLoss(LLFloaterFixedEnviro } } -void LLFloaterFixedEnvironment::onPickerCommitSetting(LLUUID asset_id) +void LLFloaterFixedEnvironment::onPickerCommitSetting(LLUUID item_id) { - mInventoryItem = NULL; - mInventoryId.setNull(); - if (!mInventoryFloater.isDead()) - { - LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(mInventoryFloater.get()); - if (picker) - { - mInventoryId = picker->findItemID(asset_id, false); - mInventoryItem = gInventory.getItem(mInventoryId); - } - } + mInventoryId = item_id; + mInventoryItem = gInventory.getItem(mInventoryId); - LLSettingsVOBase::getSettingsAsset(asset_id, + LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(), [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); } diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index d235491fd9..afab75b4ba 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -120,7 +120,7 @@ private: void onButtonApply(LLUICtrl *ctrl, const LLSD &data); void onButtonLoad(); - void onPickerCommitSetting(LLUUID asset_id); + void onPickerCommitSetting(LLUUID item_id); void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settins, S32 status); bool mIsDirty; diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 4ab09e7118..1c12677355 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -48,6 +48,8 @@ #include "llcallbacklist.h" #include "llviewerparcelmgr.h" +#include "llinventorymodel.h" + //========================================================================= namespace { @@ -256,15 +258,7 @@ void LLPanelEnvironmentInfo::refresh() std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) { - LLFloaterSettingsPicker *picker = getSettingsPicker(); - - if (!picker) - { - LL_WARNS("ENVPANEL") << "Couldn't instantiate picker." << LL_ENDL; - return std::string(); - } - - std::string name(picker->findItemName(asset_id, false, false)); + std::string name(LLFloaterSettingsPicker::findItemName(asset_id, false, false)); if (name.empty()) return getString(STR_LABEL_UNKNOWNINV); @@ -614,8 +608,13 @@ void LLPanelEnvironmentInfo::onBtnSelect() LLFloaterSettingsPicker *picker = getSettingsPicker(); if (picker) { + LLUUID item_id; + if (mCurrentEnvironment && mCurrentEnvironment->mDayCycle) + { + item_id = LLFloaterSettingsPicker::findItemID(mCurrentEnvironment->mDayCycle->getAssetId(), false, false); + } picker->setSettingsFilter(LLSettingsType::ST_NONE); - picker->setSettingsAssetId((mCurrentEnvironment && mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getAssetId() : LLUUID::null); + picker->setSettingsItemId(item_id); picker->openFloater(); picker->setFocus(TRUE); } @@ -710,13 +709,17 @@ void LLPanelEnvironmentInfo::onIdlePlay(void *data) ((LLPanelEnvironmentInfo *)data)->udpateApparentTimeOfDay(); } -void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID asset_id) +void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id) { - LLSettingsVOBase::getSettingsAsset(asset_id, [this](LLUUID, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { - if (status) - return; - onPickerAssetDownloaded(settings); - }); + LLInventoryItem *itemp = gInventory.getItem(item_id); + if (itemp) + { + LLSettingsVOBase::getSettingsAsset(itemp->getAssetUUID(), [this](LLUUID, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { + if (status) + return; + onPickerAssetDownloaded(settings); + }); + } } void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday) diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index 9bc0b9df9c..01b9b9c562 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -120,7 +120,7 @@ protected: void udpateApparentTimeOfDay(); - void onPickerCommitted(LLUUID asset_id); + void onPickerCommitted(LLUUID item_id); void onEditCommitted(LLSettingsDay::ptr_t newday); void onPickerAssetDownloaded(LLSettingsBase::ptr_t settings); void onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo); diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp index f72c7c5dcf..6b1254ae9e 100644 --- a/indra/newview/llsettingspicker.cpp +++ b/indra/newview/llsettingspicker.cpp @@ -31,6 +31,7 @@ #include "llfiltereditor.h" #include "llfolderviewmodel.h" #include "llinventory.h" +#include "llinventorybridge.h" #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" #include "llinventoryobserver.h" @@ -57,13 +58,13 @@ namespace } //========================================================================= -LLFloaterSettingsPicker::LLFloaterSettingsPicker(LLView * owner, LLUUID initial_asset_id, const std::string &label, const LLSD ¶ms): +LLFloaterSettingsPicker::LLFloaterSettingsPicker(LLView * owner, LLUUID initial_item_id, const std::string &label, const LLSD ¶ms): LLFloater(params), mOwnerHandle(), mLabel(label), mActive(true), mContextConeOpacity(0.0f), - mSettingAssetID(initial_asset_id), + mSettingItemID(initial_item_id), mImmediateFilterPermMask(PERM_NONE) { mOwnerHandle = owner->getHandle(); @@ -115,9 +116,10 @@ BOOL LLFloaterSettingsPicker::postBuild() // don't put keyboard focus on selected item, because the selection callback // will assume that this was user input - if (!mSettingAssetID.isNull()) + if (!mSettingItemID.isNull()) { - mInventoryPanel->setSelection(findItemID(mSettingAssetID, false), TAKE_FOCUS_NO); + //todo: this is bad idea + mInventoryPanel->setSelection(mSettingItemID, TAKE_FOCUS_NO); } } @@ -147,12 +149,12 @@ void LLFloaterSettingsPicker::onClose(bool app_quitting) void LLFloaterSettingsPicker::setValue(const LLSD& value) { - mSettingAssetID = value.asUUID(); + mSettingItemID = value.asUUID(); } LLSD LLFloaterSettingsPicker::getValue() const { - return LLSD(mSettingAssetID); + return LLSD(mSettingItemID); } void LLFloaterSettingsPicker::setSettingsFilter(LLSettingsType::type_e type) @@ -267,24 +269,24 @@ void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::i if (items.size()) { LLFolderViewItem* first_item = items.front(); - LLInventoryItem* itemp = gInventory.getItem(static_cast<LLFolderViewModelItemInventory*>(first_item->getViewModelItem())->getUUID()); + mNoCopySettingsSelected = false; - if (itemp) + if (first_item) { -// if (!mChangeIDSignal.empty()) -// { -// mChangeIDSignal(itemp); -// } - if (!itemp->getPermissions().allowCopyBy(gAgent.getID())) + LLItemBridge *bridge_model = dynamic_cast<LLItemBridge *>(first_item->getViewModelItem()); + if (bridge_model && bridge_model->getItem()) { - mNoCopySettingsSelected = true; - } - setSettingsAssetId(itemp->getAssetUUID(), false); - mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? + if (!bridge_model->isItemCopyable()) + { + mNoCopySettingsSelected = true; + } + setSettingsItemId(bridge_model->getItem()->getUUID(), false); + mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? - if (user_action) - { - mChangeIDSignal(mSettingAssetID); + if (user_action) + { + mChangeIDSignal(mSettingItemID); + } } } } @@ -298,24 +300,23 @@ void LLFloaterSettingsPicker::onButtonCancel() void LLFloaterSettingsPicker::onButtonSelect() { if (mCommitSignal) - (*mCommitSignal)(this, LLSD(mSettingAssetID)); + (*mCommitSignal)(this, LLSD(mSettingItemID)); closeFloater(); } BOOL LLFloaterSettingsPicker::handleDoubleClick(S32 x, S32 y, MASK mask) { - if (mSettingAssetID.notNull() + BOOL result = FALSE; + if (mSettingItemID.notNull() && mInventoryPanel) { - LLUUID item_id = findItemID(mSettingAssetID, FALSE); S32 inventory_x = x - mInventoryPanel->getRect().mLeft; S32 inventory_y = y - mInventoryPanel->getRect().mBottom; - if (item_id.notNull() - && mInventoryPanel->parentPointInView(inventory_x, inventory_y)) + if (mInventoryPanel->parentPointInView(inventory_x, inventory_y)) { // make sure item (not folder) is selected - LLFolderViewItem* item_viewp = mInventoryPanel->getItemByID(item_id); - if (item_viewp && item_viewp->isSelected()) + LLFolderViewItem* item_viewp = mInventoryPanel->getItemByID(mSettingItemID); + if (item_viewp && item_viewp->getIsCurSelection()) { LLRect target_rect; item_viewp->localRectToOtherView(item_viewp->getLocalRect(), &target_rect, this); @@ -323,14 +324,20 @@ BOOL LLFloaterSettingsPicker::handleDoubleClick(S32 x, S32 y, MASK mask) { // Quick-apply if (mCommitSignal) - (*mCommitSignal)(this, LLSD(mSettingAssetID)); + (*mCommitSignal)(this, LLSD(mSettingItemID)); closeFloater(); - return TRUE; } } + // hit inside panel on free place or (de)unselected item, double click should do nothing + result = TRUE; } } - return LLFloater::handleDoubleClick(x, y, mask); + + if (!result) + { + result = LLFloater::handleDoubleClick(x, y, mask); + } + return result; } //========================================================================= @@ -339,15 +346,14 @@ void LLFloaterSettingsPicker::setActive(bool active) mActive = active; } -void LLFloaterSettingsPicker::setSettingsAssetId(const LLUUID &settings_id, bool set_selection) +void LLFloaterSettingsPicker::setSettingsItemId(const LLUUID &settings_id, bool set_selection) { - if (mSettingAssetID != settings_id && mActive) + if (mSettingItemID != settings_id && mActive) { mNoCopySettingsSelected = false; mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? - mSettingAssetID = settings_id; - LLUUID item_id = findItemID(mSettingAssetID, FALSE); - if (item_id.isNull()) + mSettingItemID = settings_id; + if (mSettingItemID.isNull()) { mInventoryPanel->getRootFolder()->clearSelection(); } diff --git a/indra/newview/llsettingspicker.h b/indra/newview/llsettingspicker.h index 7fcc7fd4a7..434eb04c61 100644 --- a/indra/newview/llsettingspicker.h +++ b/indra/newview/llsettingspicker.h @@ -46,9 +46,9 @@ class LLFloaterSettingsPicker : public LLFloater public: typedef std::function<void (LLUUID id)> commit_callback_t; typedef std::function<void()> close_callback_t; - typedef std::function<void(const LLUUID& asset_id)> id_changed_callback_t; + typedef std::function<void(const LLUUID& item_id)> id_changed_callback_t; - LLFloaterSettingsPicker(LLView * owner, LLUUID setting_asset_id, const std::string &label, const LLSD ¶ms = LLSD()); + LLFloaterSettingsPicker(LLView * owner, LLUUID setting_item_id, const std::string &label, const LLSD ¶ms = LLSD()); virtual ~LLFloaterSettingsPicker() override; @@ -58,11 +58,8 @@ public: virtual void onClose(bool app_quitting) override; virtual void draw() override; - void setSettingsAssetId(const LLUUID &settings_id, bool set_selection = true); - LLUUID getSettingsAssetId() const { return mSettingAssetID; } - - void setDefaultSettingsAssetID(LLUUID id) { mDefaultSettingsAssetID = id; } - LLUUID getDefaultSettingsAssetID() const { return mDefaultSettingsAssetID; } + void setSettingsItemId(const LLUUID &settings_id, bool set_selection = true); + LLUUID getSettingsItemId() const { return mSettingItemID; } void setSettingsFilter(LLSettingsType::type_e type); LLSettingsType::type_e getSettingsFilter() const { return mSettingsType; } @@ -71,7 +68,7 @@ public: virtual void setValue(const LLSD& value) override; virtual LLSD getValue() const override; - LLUUID findItemID(const LLUUID& asset_id, bool copyable_only, bool ignore_library = false) + static LLUUID findItemID(const LLUUID& asset_id, bool copyable_only, bool ignore_library = false) { LLInventoryItem *pitem = findItem(asset_id, copyable_only, ignore_library); if (pitem) @@ -79,7 +76,7 @@ public: return LLUUID::null; } - std::string findItemName(const LLUUID& asset_id, bool copyable_only, bool ignore_library = false) + static std::string findItemName(const LLUUID& asset_id, bool copyable_only, bool ignore_library = false) { LLInventoryItem *pitem = findItem(asset_id, copyable_only, ignore_library); if (pitem) @@ -87,7 +84,7 @@ public: return std::string(); } - LLInventoryItem * findItem(const LLUUID& asset_id, bool copyable_only, bool ignore_library); + static LLInventoryItem * findItem(const LLUUID& asset_id, bool copyable_only, bool ignore_library); private: typedef std::deque<LLFolderViewItem *> itemlist_t; @@ -101,8 +98,7 @@ private: LLHandle<LLView> mOwnerHandle; std::string mLabel; - LLUUID mSettingAssetID; - LLUUID mDefaultSettingsAssetID; + LLUUID mSettingItemID; LLFilterEditor * mFilterEdit; LLInventoryPanel * mInventoryPanel; @@ -120,7 +116,7 @@ private: // boost::signals2::signal<void(LLUUID id)> mCommitSignal; boost::signals2::signal<void()> mCloseSignal; - boost::signals2::signal<void(const LLUUID& asset_id)> mChangeIDSignal; + boost::signals2::signal<void(const LLUUID& item_id)> mChangeIDSignal; }; #endif // LL_LLTEXTURECTRL_H |