From dfe9a02a9bfe101d4aef39d2d4d156a944747bbc Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 20 Dec 2018 16:09:10 +0200 Subject: SL-10274 FIXED [EEP] Settings object created by Save As cannot be copied from an object --- indra/newview/llsettingsvo.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 0def17b32d..6b1a0a2b77 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -154,23 +154,24 @@ void LLSettingsVOBase::createInventoryItem(const LLSettingsBase::ptr_t &settings void LLSettingsVOBase::onInventoryItemCreated(const LLUUID &inventoryId, LLSettingsBase::ptr_t settings, inventory_result_fn callback) { + LLViewerInventoryItem *pitem = gInventory.getItem(inventoryId); + if (pitem) + { + LLPermissions perm = pitem->getPermissions(); + if (perm.getMaskEveryone() != PERM_COPY) + { + perm.setMaskEveryone(PERM_COPY); + pitem->setPermissions(perm); + pitem->updateServer(FALSE); + } + } if (!settings) { // The item was created as new with no settings passed in. Simulator should have given it the default for the type... check ID, // no need to upload asset. LLUUID asset_id; - LLViewerInventoryItem *pitem = gInventory.getItem(inventoryId); - if (pitem) { asset_id = pitem->getAssetUUID(); - - LLPermissions perm = pitem->getPermissions(); - if (perm.getMaskEveryone() != PERM_COPY) - { - perm.setMaskEveryone(PERM_COPY); - pitem->setPermissions(perm); - pitem->updateServer(FALSE); - } } if (callback) callback(asset_id, inventoryId, LLUUID::null, LLSD()); -- cgit v1.2.3 From 91952ec0a5343cd60f09e8bd5779fd0d49d0a886 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 21 Dec 2018 17:45:06 +0200 Subject: SL-10275 FIXED [EEP] Pressing Enter while setting "Settings From Inventory" opens the Day Cycle --- indra/newview/llinventorypanel.cpp | 28 +++++++++++++--------------- indra/newview/llinventorypanel.h | 3 +++ indra/newview/llsettingspicker.cpp | 19 +++++++++++++++++++ indra/newview/llsettingspicker.h | 1 + 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 7fea502c0f..5f244ec6a2 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -152,6 +152,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : mShowItemLinkOverlays(p.show_item_link_overlays), mShowEmptyMessage(p.show_empty_message), mSuppressFolderMenu(p.suppress_folder_menu), + mSuppressOpenItemAction(false), mViewsInitialized(false), mInvFVBridgeBuilder(NULL), mInventoryViewModel(p.name), @@ -1658,21 +1659,18 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) // Open selected items if enter key hit on the inventory panel if (mask == MASK_NONE) { - -// @TODO$: Rider: This code is dead with Outbox, however should something similar be -// done for VMM? -// -// //Don't allow attaching or opening items from Merchant Outbox -// LLFolderViewItem* folder_item = mFolderRoot.get()->getCurSelectedItem(); -// if(folder_item) -// { -// LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem(); -// if(bridge && bridge->is() && (bridge->getInventoryType() != LLInventoryType::IT_CATEGORY)) -// { -// return handled; -// } -// } - + if (mSuppressOpenItemAction) + { + LLFolderViewItem* folder_item = mFolderRoot.get()->getCurSelectedItem(); + if(folder_item) + { + LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem(); + if(bridge && (bridge->getInventoryType() != LLInventoryType::IT_CATEGORY)) + { + return handled; + } + } + } LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "open"); handled = TRUE; } diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 97e1c37a31..b2a60543af 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -243,6 +243,8 @@ public: void setSelectionByID(const LLUUID& obj_id, BOOL take_keyboard_focus); void updateSelection(); + void setSuppressOpenItemAction(bool supress_open_item) { mSuppressOpenItemAction = supress_open_item; } + LLFolderViewModelInventory* getFolderViewModel() { return &mInventoryViewModel; } const LLFolderViewModelInventory* getFolderViewModel() const { return &mInventoryViewModel; } @@ -264,6 +266,7 @@ protected: bool mShowItemLinkOverlays; // Shows link graphic over inventory item icons bool mShowEmptyMessage; bool mSuppressFolderMenu; + bool mSuppressOpenItemAction; LLHandle mFolderRoot; LLScrollContainer* mScroller; diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp index b82be3a23e..d115f6fa4f 100644 --- a/indra/newview/llsettingspicker.cpp +++ b/indra/newview/llsettingspicker.cpp @@ -105,6 +105,7 @@ BOOL LLFloaterSettingsPicker::postBuild() mInventoryPanel->setSelectCallback([this](const LLFloaterSettingsPicker::itemlist_t &items, bool useraction){ onSelectionChange(items, useraction); }); mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); + mInventoryPanel->setSuppressOpenItemAction(true); // Disable auto selecting first filtered item because it takes away // selection from the item set by LLTextureCtrl owning this floater. @@ -336,6 +337,24 @@ BOOL LLFloaterSettingsPicker::handleDoubleClick(S32 x, S32 y, MASK mask) return result; } +BOOL LLFloaterSettingsPicker::handleKeyHere(KEY key, MASK mask) +{ + if ((key == KEY_RETURN) && (mask == MASK_NONE)) + { + LLFolderViewItem* item_viewp = mInventoryPanel->getItemByID(mSettingItemID); + if (item_viewp && item_viewp->getIsCurSelection()) + { + // Quick-apply + if (mCommitSignal) + (*mCommitSignal)(this, LLSD(mSettingItemID)); + closeFloater(); + return TRUE; + } + } + + return LLFloater::handleKeyHere(key, mask); +} + //========================================================================= void LLFloaterSettingsPicker::setActive(bool active) { diff --git a/indra/newview/llsettingspicker.h b/indra/newview/llsettingspicker.h index 434eb04c61..5acc562fe5 100644 --- a/indra/newview/llsettingspicker.h +++ b/indra/newview/llsettingspicker.h @@ -94,6 +94,7 @@ private: void onButtonCancel(); void onButtonSelect(); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; + BOOL handleKeyHere(KEY key, MASK mask) override; LLHandle mOwnerHandle; -- cgit v1.2.3 From 8227a0b270f6e7cc521adeb7b97ad2d5fb646973 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 21 Dec 2018 15:30:57 -0800 Subject: SL-10279: Rework the environment pannel. Still in progress. --- indra/llui/llmultislider.cpp | 9 + indra/llui/llmultislider.h | 1 + indra/llui/llmultisliderctrl.h | 3 +- indra/newview/llenvironment.cpp | 11 + indra/newview/llenvironment.h | 5 +- indra/newview/llfloatereditextdaycycle.cpp | 14 + indra/newview/llfloatereditextdaycycle.h | 2 + indra/newview/llfloaterland.cpp | 5 +- indra/newview/llfloaterregioninfo.cpp | 2 +- indra/newview/llpanelenvironment.cpp | 337 ++++++++----- indra/newview/llpanelenvironment.h | 17 +- .../default/xui/en/panel_region_environment.xml | 543 ++++++++++++++++++--- 12 files changed, 770 insertions(+), 179 deletions(-) diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index ed93b3d44c..f30ce28b9d 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -306,6 +306,15 @@ F32 LLMultiSlider::getSliderValueFromPos(S32 xpos, S32 ypos) const return((t * (mMaxValue - mMinValue)) + mMinValue); } + +LLRect LLMultiSlider::getSliderThumbRect(const std::string& name) const +{ + auto it = mThumbRects.find(name); + if (it != mThumbRects.end()) + return (*it).second; + return LLRect(); +} + void LLMultiSlider::resetCurSlider() { mCurSlider = LLStringUtil::null; diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 50cf62e9c5..b4331e11c0 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -80,6 +80,7 @@ public: void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE); F32 getSliderValue(const std::string& name) const; F32 getSliderValueFromPos(S32 xpos, S32 ypos) const; + LLRect getSliderThumbRect(const std::string& name) const; const std::string& getCurSlider() const { return mCurSlider; } F32 getCurSliderValue() const { return getSliderValue(mCurSlider); } diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index 75715d6043..20d204a6dc 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -107,7 +107,8 @@ public: void setMaxValue(F32 max_value) {mMultiSlider->setMaxValue(max_value);} void setIncrement(F32 increment) {mMultiSlider->setIncrement(increment);} - F32 getSliderValueFromPos(S32 x, S32 y) const { return mMultiSlider->getSliderValueFromPos(x, y); } + F32 getSliderValueFromPos(S32 x, S32 y) const { return mMultiSlider->getSliderValueFromPos(x, y); } + LLRect getSliderThumbRect(const std::string &name) const { return mMultiSlider->getSliderThumbRect(name); } /// for adding and deleting sliders const std::string& addSlider(); diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index a8a386edee..3541eb40fa 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -1600,6 +1600,7 @@ LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extract(LL LLSD daynames = environment[KEY_DAYNAMES]; if (daynames.isArray()) { + pinfo->mDayCycleName.clear(); for (S32 index = 0; index < pinfo->mNameList.size(); ++index) { pinfo->mNameList[index] = daynames[index].asString(); @@ -1607,9 +1608,19 @@ LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extract(LL } else if (daynames.isString()) { + for (std::string &name: pinfo->mNameList) + { + name.clear(); + } + pinfo->mDayCycleName = daynames.asString(); } } + else if (pinfo->mDayCycle) + { + pinfo->mDayCycleName = pinfo->mDayCycle->getName(); + } + if (environment.has(KEY_ENVVERSION)) { diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index 47e0f0208b..1dd7496b02 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -380,7 +380,10 @@ private: mDayOffset(day_offset), mAltitudes(altitudes), mDayName() - {} + { + if (mDayp) + mDayName = mDayp->getName(); + } UpdateInfo(LLUUID settings_asset, std::string name, S32 day_length, S32 day_offset, altitudes_vect_t altitudes) : mDayp(), diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 7184d07ee3..c768823dc0 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -495,6 +495,20 @@ void LLFloaterEditExtDayCycle::setEditDefaultDayCycle() [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); }); } +std::string LLFloaterEditExtDayCycle::getEditName() const +{ + if (mEditDay) + return mEditDay->getName(); + return "new"; +} + +void LLFloaterEditExtDayCycle::setEditName(const std::string &name) +{ + if (mEditDay) + mEditDay->setName(name); + getChild(TXT_DAY_NAME)->setText(name); +} + /* virtual */ BOOL LLFloaterEditExtDayCycle::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) { diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 1dea77571f..1967f5a470 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -92,6 +92,8 @@ public: void setEditDayCycle(const LLSettingsDay::ptr_t &pday); void setEditDefaultDayCycle(); + std::string getEditName() const; + void setEditName(const std::string &name); LLUUID getEditingAssetId() { return mEditDay ? mEditDay->getAssetId() : LLUUID::null; } LLUUID getEditingInventoryId() { return mInventoryId; } diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index b20911edc5..21a062184c 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -3265,9 +3265,10 @@ BOOL LLPanelLandEnvironment::postBuild() if (!LLPanelEnvironmentInfo::postBuild()) return FALSE; - getChild(RDO_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION)); + getChild(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION)); getChild(CHK_ALLOWOVERRIDE)->setVisible(FALSE); - getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); + getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(TRUE); + return TRUE; } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index fcaa7d2bf9..e52ba38080 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3416,7 +3416,7 @@ BOOL LLPanelRegionEnvironment::postBuild() if (!LLPanelEnvironmentInfo::postBuild()) return FALSE; - getChild(RDO_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT)); + getChild(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT)); getChild(CHK_ALLOWOVERRIDE)->setVisible(TRUE); getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(TRUE); diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index e3be46f1af..6465c25716 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -54,16 +54,20 @@ namespace { const std::string FLOATER_DAY_CYCLE_EDIT("env_edit_extdaycycle"); + + inline bool ends_with(std::string const & value, std::string const & ending) + { + if (ending.size() > value.size()) + return false; + return std::equal(ending.rbegin(), ending.rend(), value.rbegin()); + } + } //========================================================================= -const std::string LLPanelEnvironmentInfo::RDG_ENVIRONMENT_SELECT("rdg_environment_select"); -const std::string LLPanelEnvironmentInfo::RDO_USEDEFAULT("rdo_use_xxx_setting"); -const std::string LLPanelEnvironmentInfo::RDO_USEINV("rdo_use_inv_setting"); -const std::string LLPanelEnvironmentInfo::RDO_USECUSTOM("rdo_use_custom_setting"); -const std::string LLPanelEnvironmentInfo::EDT_INVNAME("edt_inventory_name"); const std::string LLPanelEnvironmentInfo::BTN_SELECTINV("btn_select_inventory"); const std::string LLPanelEnvironmentInfo::BTN_EDIT("btn_edit"); +const std::string LLPanelEnvironmentInfo::BTN_USEDEFAULT("btn_usedefault"); const std::string LLPanelEnvironmentInfo::SLD_DAYLENGTH("sld_day_length"); const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset"); const std::string LLPanelEnvironmentInfo::SLD_ALTITUDES("sld_altitudes"); @@ -111,9 +115,9 @@ const std::string alt_labels[] = { "alt2", "alt3", "ground", + "water", }; - static LLDefaultChildRegistry::Register r("settings_drop_target"); //========================================================================= @@ -140,16 +144,19 @@ LLPanelEnvironmentInfo::~LLPanelEnvironmentInfo() BOOL LLPanelEnvironmentInfo::postBuild() { - getChild(RDG_ENVIRONMENT_SELECT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onSwitchDefaultSelection(); }); + getChild(BTN_USEDEFAULT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnDefault(); }); getChild(BTN_SELECTINV)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnSelect(); }); getChild(BTN_EDIT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnEdit(); }); getChild(BTN_APPLY)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnApply(); }); getChild(BTN_CANCEL)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnReset(); }); getChild(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged(value.asReal()); }); + getChild(SLD_DAYLENGTH)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); getChild(SLD_DAYOFFSET)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged(value.asReal()); }); + getChild(SLD_DAYOFFSET)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); getChild(SLD_ALTITUDES)->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); }); + getChild(SLD_ALTITUDES)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onAltSliderMouseUp(); }); mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version) { onEnvironmentChanged(env, version); }); @@ -211,31 +218,31 @@ void LLPanelEnvironmentInfo::refresh() return; } - S32 rdo_selection = 0; - if ((!mCurrentEnvironment->mDayCycle) || - ((mCurrentEnvironment->mParcelId == INVALID_PARCEL_ID) && (mCurrentEnvironment->mDayCycle->getAssetId() == LLSettingsDay::GetDefaultAssetId() ))) - { - getChild(EDT_INVNAME)->setValue(""); - } - else if (!mCurrentEnvironment->mDayCycle->getAssetId().isNull()) - { - rdo_selection = 1; - - LLUUID asset_id = mCurrentEnvironment->mDayCycle->getAssetId(); - - std::string inventoryname = getInventoryNameForAssetId(asset_id); - - if (inventoryname.empty()) - inventoryname = "(" + mCurrentEnvironment->mDayCycle->getName() + ")"; - - getChild(EDT_INVNAME)->setValue(inventoryname); - } - else - { // asset id is null so this is a custom environment - rdo_selection = 2; - getChild(EDT_INVNAME)->setValue(""); - } - getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(rdo_selection); +// S32 rdo_selection = 0; +// if ((!mCurrentEnvironment->mDayCycle) || +// ((mCurrentEnvironment->mParcelId == INVALID_PARCEL_ID) && (mCurrentEnvironment->mDayCycle->getAssetId() == LLSettingsDay::GetDefaultAssetId() ))) +// { +// getChild(EDT_INVNAME)->setValue(""); +// } +// else if (!mCurrentEnvironment->mDayCycle->getAssetId().isNull()) +// { +// rdo_selection = 1; +// +// LLUUID asset_id = mCurrentEnvironment->mDayCycle->getAssetId(); +// +// std::string inventoryname = getInventoryNameForAssetId(asset_id); +// +// if (inventoryname.empty()) +// inventoryname = "(" + mCurrentEnvironment->mDayCycle->getName() + ")"; +// +// getChild(EDT_INVNAME)->setValue(inventoryname); +// } +// else +// { // asset id is null so this is a custom environment +// rdo_selection = 2; +// getChild(EDT_INVNAME)->setValue(""); +// } +// getChild(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(rdo_selection); F32Hours daylength(mCurrentEnvironment->mDayLength); F32Hours dayoffset(mCurrentEnvironment->mDayOffset); @@ -245,8 +252,8 @@ void LLPanelEnvironmentInfo::refresh() getChild(SLD_DAYLENGTH)->setValue(daylength.value()); getChild(SLD_DAYOFFSET)->setValue(dayoffset.value()); - getChild(SLD_DAYLENGTH)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); - getChild(SLD_DAYOFFSET)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); +// getChild(SLD_DAYLENGTH)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); +// getChild(SLD_DAYOFFSET)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); udpateApparentTimeOfDay(); @@ -271,6 +278,9 @@ void LLPanelEnvironmentInfo::refresh() readjustAltLabels(); } + updateAltLabel(alt_labels[3], 1, 0); // ground + updateAltLabel(alt_labels[4], 0, 0); // water + } std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) @@ -282,6 +292,27 @@ std::string LLPanelEnvironmentInfo::getInventoryNameForAssetId(LLUUID asset_id) return name; } + +std::string LLPanelEnvironmentInfo::getNameForTrackIndex(S32 index) +{ + std::string invname; + + LL_WARNS("LAPRAS") << "mDayCycleName='" << mCurrentEnvironment->mDayCycleName << "'" << LL_ENDL; + if (mCurrentEnvironment->mDayCycleName.empty()) + { + invname = mCurrentEnvironment->mNameList[index]; + } + else if (!mCurrentEnvironment->mDayCycle->isTrackEmpty(index)) + { + invname = mCurrentEnvironment->mDayCycleName; + } + + if (invname.empty()) + invname = getString("str_empty"); + + return invname; +} + LLFloaterSettingsPicker * LLPanelEnvironmentInfo::getSettingsPicker(bool create) { LLFloaterSettingsPicker *picker = static_cast(mSettingsFloater.get()); @@ -391,20 +422,13 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(PNL_BUTTONS)->setVisible(true); getChild(PNL_DISABLED)->setVisible(false); - getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(isRegion() && LLEnvironment::instance().isExtendedEnvironmentEnabled()); - - S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + getChild(PNL_ENVIRONMENT_ALTITUDES)->setVisible(LLEnvironment::instance().isExtendedEnvironmentEnabled()); - bool can_enable = enabled && mCurrentEnvironment && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION; - getChild(RDG_ENVIRONMENT_SELECT)->setEnabled(can_enable); - getChild(RDO_USEDEFAULT)->setEnabled(can_enable && !is_legacy); - getChild(RDO_USEINV)->setEnabled(false); // these two are selected automatically based on - getChild(RDO_USECUSTOM)->setEnabled(false); - getChild(EDT_INVNAME)->setEnabled(FALSE); + bool can_enable = enabled && mCurrentEnvironment && (mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION); getChild(BTN_SELECTINV)->setEnabled(can_enable && !is_legacy); getChild(BTN_EDIT)->setEnabled(can_enable); - getChild(SLD_DAYLENGTH)->setEnabled(can_enable && (rdo_selection != 0) && !is_legacy); - getChild(SLD_DAYOFFSET)->setEnabled(can_enable && (rdo_selection != 0) && !is_legacy); + getChild(SLD_DAYLENGTH)->setEnabled(can_enable && !is_legacy); + getChild(SLD_DAYOFFSET)->setEnabled(can_enable && !is_legacy); getChild(SLD_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild(ICN_GROUND)->setColor((can_enable && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f); getChild(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); @@ -460,7 +484,10 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky // get related text box LLTextBox* text = getChild(alt_name); - if (text) + LLLineEditor *field = getChild("edt_invname_" + alt_name); + LLSettingsDropTarget *dt = getChild("sdt_" + alt_name); + + if (text && (sky_index > 1)) { // move related text box LLRect rect = text->getRect(); @@ -468,7 +495,6 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky rect.mBottom = sld_bottom + (sld_offset / 2 + 1) + pos - (height / 2); rect.mTop = rect.mBottom + height; text->setRect(rect); - // update text std::ostringstream convert; convert << alt_value; @@ -477,7 +503,26 @@ void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky convert.clear(); convert << sky_index; text->setTextArg("[INDEX]", convert.str()); + + if (field) + { + LLRect rect_name = field->getRect(); + S32 name_height = rect_name.getHeight(); + S32 center = rect.mBottom + (height / 2); + rect_name.mBottom = center - (name_height / 2); + rect_name.mTop = rect_name.mBottom + name_height; + + field->setRect(rect_name); + if (dt) + dt->setRect(rect_name); + } } + + if (field) + { + field->setText(getNameForTrackIndex(sky_index)); + } + } void LLPanelEnvironmentInfo::readjustAltLabels() @@ -492,10 +537,22 @@ void LLPanelEnvironmentInfo::readjustAltLabels() ground_text_rect.mTop = ground_text_rect.mBottom + height; text->setRect(ground_text_rect); +// LLMultiSliderCtrl *sld = getChild(SLD_ALTITUDES); +// for (U32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx) +// { +// LLRect rect_sld = sld->getSliderThumbRect(alt_sliders[idx]); +// LLTextBox* text_cmp = getChild(alt_labels[i]); +// +// LLRect rect_text = text_cmp->getRect(); +// +// LL_WARNS("LAPRAS") << "slider[" << alt_sliders[idx] << "] -> " << rect_sld << " value=" << sld->getSliderValue(alt_sliders[idx]) LL_ENDL; +// } + + +#if 0 // Re-adjust all labels // Very simple "adjust after the fact" method // Note: labels are unordered, labels are 1 above sliders due to 'ground' - for (U32 i = 0; i < ALTITUDE_SLIDER_COUNT; i++) { LLTextBox* text_cmp = getChild(alt_labels[i]); @@ -531,17 +588,20 @@ void LLPanelEnvironmentInfo::readjustAltLabels() } } } +#endif } +#if 0 void LLPanelEnvironmentInfo::onSwitchDefaultSelection() { - bool can_edit = canEdit(); +// bool can_edit = canEdit(); setDirtyFlag(DIRTY_FLAG_DAYCYCLE); - S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); - getChild(SLD_DAYLENGTH)->setEnabled(can_edit && (rdo_selection != 0)); - getChild(SLD_DAYOFFSET)->setEnabled(can_edit && (rdo_selection != 0)); +// S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); +// getChild(SLD_DAYLENGTH)->setEnabled(can_edit && (rdo_selection != 0)); +// getChild(SLD_DAYOFFSET)->setEnabled(can_edit && (rdo_selection != 0)); } +#endif void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) { @@ -566,6 +626,22 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) udpateApparentTimeOfDay(); } +void LLPanelEnvironmentInfo::onDayLenOffsetMouseUp() +{ + if (getDirtyFlag() & (DIRTY_FLAG_DAYLENGTH | DIRTY_FLAG_DAYOFFSET)) + { + clearDirtyFlag(DIRTY_FLAG_DAYOFFSET); + clearDirtyFlag(DIRTY_FLAG_DAYLENGTH); + + LLHandle that_h = getHandle(); + + LLEnvironment::instance().updateParcel(getParcelId(), LLSettingsDay::ptr_t(), + mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), LLEnvironment::altitudes_vect_t(), + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); + + } +} + void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &data) { LLMultiSliderCtrl *sld = (LLMultiSliderCtrl *)cntrl; @@ -593,6 +669,7 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da iter2++; } iter->second.mAltitudeIndex = new_index; + updateAltLabel(alt_labels[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude); iter++; } @@ -601,6 +678,27 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da setDirtyFlag(DIRTY_FLAG_ALTITUDES); } +void LLPanelEnvironmentInfo::onAltSliderMouseUp() +{ + if (isRegion() && (getDirtyFlag() & DIRTY_FLAG_ALTITUDES)) + { + clearDirtyFlag(DIRTY_FLAG_ALTITUDES); + + LLHandle that_h = getHandle(); + LLEnvironment::altitudes_vect_t alts; + + for (auto alt : mAltitudes) + { + alts.push_back(alt.second.mAltitude); + } + + LLEnvironment::instance().updateParcel(getParcelId(), LLSettingsDay::ptr_t(), + -1, -1, alts, + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); + + } +} + void LLPanelEnvironmentInfo::onBtnApply() { doApply(); @@ -612,6 +710,14 @@ void LLPanelEnvironmentInfo::onBtnReset() refreshFromSource(); } +void LLPanelEnvironmentInfo::onBtnDefault() +{ + LLHandle that_h = getHandle(); + + LLEnvironment::instance().resetParcel(getParcelId(), + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); +} + void LLPanelEnvironmentInfo::onBtnEdit() { static const S32 FOURHOURS(4 * 60 * 60); @@ -624,7 +730,13 @@ void LLPanelEnvironmentInfo::onBtnEdit() dayeditor->openFloater(params); if (mCurrentEnvironment && mCurrentEnvironment->mDayCycle) + { dayeditor->setEditDayCycle(mCurrentEnvironment->mDayCycle); + if (!ends_with(mCurrentEnvironment->mDayCycle->getName(), "(customized)")) + { + dayeditor->setEditName(mCurrentEnvironment->mDayCycle->getName() + "(customized)"); + } + } else dayeditor->setEditDefaultDayCycle(); } @@ -649,57 +761,57 @@ void LLPanelEnvironmentInfo::onBtnSelect() void LLPanelEnvironmentInfo::doApply() { - S32 parcel_id = getParcelId(); - - if (getIsDirtyFlag(DIRTY_FLAG_MASK)) - { - LLHandle that_h = getHandle(); - LLEnvironment::altitudes_vect_t alts; - - S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); - - if (isRegion() && getIsDirtyFlag(DIRTY_FLAG_ALTITUDES)) - { - altitudes_data_t::iterator it; - for (auto alt : mAltitudes) - { - alts.push_back(alt.second.mAltitude); - } - } +// S32 parcel_id = getParcelId(); - if (rdo_selection == 0) - { - LLEnvironment::instance().resetParcel(parcel_id, - [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); - } - else if (rdo_selection == 1) - { - if (!mCurrentEnvironment) - { - // Attempting to save mid update? - LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; - return; - } - LLEnvironment::instance().updateParcel(parcel_id, - mCurrentEnvironment->mDayCycle->getAssetId(), std::string(), mCurrentEnvironment->mDayLength.value(), - mCurrentEnvironment->mDayOffset.value(), alts, - [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); - } - else - { - if (!mCurrentEnvironment) - { - // Attempting to save mid update? - LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; - return; - } - LLEnvironment::instance().updateParcel(parcel_id, - mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, - [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); - } - - setControlsEnabled(false); - } +// if (getIsDirtyFlag(DIRTY_FLAG_MASK)) +// { +// LLHandle that_h = getHandle(); +// LLEnvironment::altitudes_vect_t alts; +// +// // S32 rdo_selection = getChild(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); +// +// if (isRegion() && getIsDirtyFlag(DIRTY_FLAG_ALTITUDES)) +// { +// altitudes_data_t::iterator it; +// for (auto alt : mAltitudes) +// { +// alts.push_back(alt.second.mAltitude); +// } +// } + +// if (rdo_selection == 0) +// { +// LLEnvironment::instance().resetParcel(parcel_id, +// [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); +// } +// else if (rdo_selection == 1) +// { +// if (!mCurrentEnvironment) +// { +// // Attempting to save mid update? +// LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; +// return; +// } +// LLEnvironment::instance().updateParcel(parcel_id, +// mCurrentEnvironment->mDayCycle->getAssetId(), std::string(), mCurrentEnvironment->mDayLength.value(), +// mCurrentEnvironment->mDayOffset.value(), alts, +// [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); +// } +// else +// { +// if (!mCurrentEnvironment) +// { +// // Attempting to save mid update? +// LL_WARNS("ENVPANEL") << "Failed to apply changes from editor! Dirty state: " << mDirtyFlag << " update state: " << mCurEnvVersion << LL_ENDL; +// return; +// } +// LLEnvironment::instance().updateParcel(parcel_id, +// mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), alts, +// [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); +// } + +// setControlsEnabled(false); +// } } @@ -751,16 +863,19 @@ void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id) 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); - }); + LLHandle that_h = getHandle(); + + LLEnvironment::instance().updateParcel(getParcelId(), itemp->getAssetUUID(), + itemp->getName(), + -1, -1, LLEnvironment::altitudes_vect_t(), + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } } void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday) { + LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); + LLEnvironment::instance().updateEnvironment(); if (!newday) { LL_WARNS("ENVPANEL") << "Editor committed an empty day. Do nothing." << LL_ENDL; @@ -777,9 +892,11 @@ void LLPanelEnvironmentInfo::onEditCommitted(LLSettingsDay::ptr_t newday) if (newhash != oldhash) { - mCurrentEnvironment->mDayCycle = newday; - setDirtyFlag(DIRTY_FLAG_DAYCYCLE); - refresh(); + LLHandle that_h = getHandle(); + + LLEnvironment::instance().updateParcel(getParcelId(), newday, + -1, -1, LLEnvironment::altitudes_vect_t(), + [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } } diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index 05f25fa78f..a0a60a2bf9 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -62,13 +62,9 @@ public: protected: LOG_CLASS(LLPanelEnvironmentInfo); - static const std::string RDG_ENVIRONMENT_SELECT; - static const std::string RDO_USEDEFAULT; - static const std::string RDO_USEINV; - static const std::string RDO_USECUSTOM; - static const std::string EDT_INVNAME; static const std::string BTN_SELECTINV; static const std::string BTN_EDIT; + static const std::string BTN_USEDEFAULT; static const std::string SLD_DAYLENGTH; static const std::string SLD_DAYOFFSET; static const std::string SLD_ALTITUDES; @@ -106,17 +102,19 @@ protected: bool getIsDirty() const { return (mDirtyFlag != 0); } bool getIsDirtyFlag(U32 flag) const { return ((mDirtyFlag & flag) != 0); } U32 getDirtyFlag() const { return mDirtyFlag; } - void updateAltLabel(const std::string &alt_name, U32 sky_index, F32 alt_value); + void updateAltLabel(const std::string &alt_name, U32 sky_index, F32 alt_value); void readjustAltLabels(); - void onSwitchDefaultSelection(); void onSldDayLengthChanged(F32 value); void onSldDayOffsetChanged(F32 value); void onAltSliderCallback(LLUICtrl *cntrl, const LLSD &data); + void onAltSliderMouseUp(); + void onBtnApply(); void onBtnReset(); void onBtnEdit(); void onBtnSelect(); + void onBtnDefault(); virtual void doApply(); @@ -124,14 +122,19 @@ protected: void onPickerCommitted(LLUUID item_id); void onEditCommitted(LLSettingsDay::ptr_t newday); + void onDayLenOffsetMouseUp(); + void onPickerAssetDownloaded(LLSettingsBase::ptr_t settings); void onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo); static void _onEnvironmentReceived(LLHandle that_h, S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo); + virtual void refreshFromSource() = 0; std::string getInventoryNameForAssetId(LLUUID asset_id); + std::string getNameForTrackIndex(S32 index); + LLFloaterSettingsPicker * getSettingsPicker(bool create = true); LLFloaterEditExtDayCycle * getEditFloater(bool create = true); void updateEditFloater(const LLEnvironment::EnvironmentInfo::ptr_t &nextenv, bool enable); diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml index 2f91252d9b..1c2657ea60 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -16,6 +16,7 @@ No parcel is selected. Environmental settings are disabled. Environmental settings are not available across region boundries. Environmental settings are not available on this region. + (empty) - ... + halign="center" + valign="top" + top_pad="40" + name="txt_environment_disabled" + text_color="white"> + ... + + + + Sky Altitudes + + + + + + + + Ground + + + Unknown + + + + + + Water + + + Unknown + + + + + Sky [INDEX]([ALTITUDE]m) + + + Unknown + + + + + Sky [INDEX]([ALTITUDE]m) + + + Unknown + + + + + Sky [INDEX]([ALTITUDE]m) + + + Unknown + + + + + + + + Select Environment +