diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llenvironment.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llenvironment.h | 5 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.h | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterland.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.cpp | 337 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.h | 17 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_region_environment.xml | 543 |
9 files changed, 758 insertions, 178 deletions
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<LLLineEditor>(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<LLUICtrl>(RDO_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION)); + getChild<LLUICtrl>(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION)); getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(FALSE); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE); + getChild<LLUICtrl>(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<LLUICtrl>(RDO_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT)); + getChild<LLUICtrl>(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT)); getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(TRUE); getChild<LLUICtrl>(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<LLSettingsDropTarget> r("settings_drop_target"); //========================================================================= @@ -140,16 +144,19 @@ LLPanelEnvironmentInfo::~LLPanelEnvironmentInfo() BOOL LLPanelEnvironmentInfo::postBuild() { - getChild<LLUICtrl>(RDG_ENVIRONMENT_SELECT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onSwitchDefaultSelection(); }); + getChild<LLUICtrl>(BTN_USEDEFAULT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnDefault(); }); getChild<LLUICtrl>(BTN_SELECTINV)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnSelect(); }); getChild<LLUICtrl>(BTN_EDIT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnEdit(); }); getChild<LLUICtrl>(BTN_APPLY)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnApply(); }); getChild<LLUICtrl>(BTN_CANCEL)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnReset(); }); getChild<LLUICtrl>(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged(value.asReal()); }); + getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); getChild<LLUICtrl>(SLD_DAYOFFSET)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged(value.asReal()); }); + getChild<LLSliderCtrl>(SLD_DAYOFFSET)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); }); getChild<LLMultiSliderCtrl>(SLD_ALTITUDES)->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); }); + getChild<LLMultiSliderCtrl>(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<LLUICtrl>(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<LLUICtrl>(EDT_INVNAME)->setValue(inventoryname); - } - else - { // asset id is null so this is a custom environment - rdo_selection = 2; - getChild<LLUICtrl>(EDT_INVNAME)->setValue(""); - } - getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(rdo_selection); +// S32 rdo_selection = 0; +// if ((!mCurrentEnvironment->mDayCycle) || +// ((mCurrentEnvironment->mParcelId == INVALID_PARCEL_ID) && (mCurrentEnvironment->mDayCycle->getAssetId() == LLSettingsDay::GetDefaultAssetId() ))) +// { +// getChild<LLUICtrl>(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<LLUICtrl>(EDT_INVNAME)->setValue(inventoryname); +// } +// else +// { // asset id is null so this is a custom environment +// rdo_selection = 2; +// getChild<LLUICtrl>(EDT_INVNAME)->setValue(""); +// } +// getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(rdo_selection); F32Hours daylength(mCurrentEnvironment->mDayLength); F32Hours dayoffset(mCurrentEnvironment->mDayOffset); @@ -245,8 +252,8 @@ void LLPanelEnvironmentInfo::refresh() getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setValue(daylength.value()); getChild<LLSliderCtrl>(SLD_DAYOFFSET)->setValue(dayoffset.value()); - getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); - getChild<LLSliderCtrl>(SLD_DAYOFFSET)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); +// getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setEnabled(canEdit() && (rdo_selection != 0) && !mCurrentEnvironment->mIsLegacy); +// getChild<LLSliderCtrl>(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<LLFloaterSettingsPicker *>(mSettingsFloater.get()); @@ -391,20 +422,13 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild<LLUICtrl>(PNL_BUTTONS)->setVisible(true); getChild<LLUICtrl>(PNL_DISABLED)->setVisible(false); - getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(isRegion() && LLEnvironment::instance().isExtendedEnvironmentEnabled()); - - S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(LLEnvironment::instance().isExtendedEnvironmentEnabled()); - bool can_enable = enabled && mCurrentEnvironment && mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION; - getChild<LLUICtrl>(RDG_ENVIRONMENT_SELECT)->setEnabled(can_enable); - getChild<LLUICtrl>(RDO_USEDEFAULT)->setEnabled(can_enable && !is_legacy); - getChild<LLUICtrl>(RDO_USEINV)->setEnabled(false); // these two are selected automatically based on - getChild<LLUICtrl>(RDO_USECUSTOM)->setEnabled(false); - getChild<LLUICtrl>(EDT_INVNAME)->setEnabled(FALSE); + bool can_enable = enabled && mCurrentEnvironment && (mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION); getChild<LLUICtrl>(BTN_SELECTINV)->setEnabled(can_enable && !is_legacy); getChild<LLUICtrl>(BTN_EDIT)->setEnabled(can_enable); - getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(can_enable && (rdo_selection != 0) && !is_legacy); - getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(can_enable && (rdo_selection != 0) && !is_legacy); + getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(can_enable && !is_legacy); + getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(can_enable && !is_legacy); getChild<LLUICtrl>(SLD_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild<LLUICtrl>(ICN_GROUND)->setColor((can_enable && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f); getChild<LLUICtrl>(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<LLTextBox>(alt_name); - if (text) + LLLineEditor *field = getChild<LLLineEditor>("edt_invname_" + alt_name); + LLSettingsDropTarget *dt = getChild<LLSettingsDropTarget>("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<LLMultiSliderCtrl>(SLD_ALTITUDES); +// for (U32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx) +// { +// LLRect rect_sld = sld->getSliderThumbRect(alt_sliders[idx]); +// LLTextBox* text_cmp = getChild<LLTextBox>(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<LLTextBox>(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<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); - getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(can_edit && (rdo_selection != 0)); - getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(can_edit && (rdo_selection != 0)); +// S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); +// getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(can_edit && (rdo_selection != 0)); +// getChild<LLUICtrl>(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<LLPanel> 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<LLPanel> 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<LLPanel> 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<LLPanel> that_h = getHandle(); - LLEnvironment::altitudes_vect_t alts; - - S32 rdo_selection = getChild<LLRadioGroup>(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<LLPanel> that_h = getHandle(); +// LLEnvironment::altitudes_vect_t alts; +// +// // S32 rdo_selection = getChild<LLRadioGroup>(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<LLPanel> 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<LLPanel> 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<LLPanel> 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 @@ <string name="str_no_parcel">No parcel is selected. Environmental settings are disabled.</string> <string name="str_cross_region">Environmental settings are not available across region boundries.</string> <string name="str_legacy">Environmental settings are not available on this region.</string> + <string name="str_empty">(empty)</string> <layout_stack width="530" height="367" @@ -29,14 +30,438 @@ name="pnl_environment_disabled" visible="false"> <text follows="top|left|bottom|right" - halign="center" - valign="top" - top_pad="40" - name="txt_environment_disabled" - text_color="white"> - ... + halign="center" + valign="top" + top_pad="40" + name="txt_environment_disabled" + text_color="white"> + ... </text> </layout_panel> + <layout_panel + auto_resize="true" + user_resize="false" + min_height="0" + name="pnl_environment_config" + visible="true"> + <layout_stack + xxxwidth="530" + xxxheight="367" + follows="all" + layout="topleft" + animate="false" + orientation="horizontal"> + <layout_panel + auto_resize="true" + user_resize="false" + min_height="0" + top="5" + name="pnl_environment_altitudes" + visible="true"> + <text follows="top|left" + font="SansSerif" + halign="left" + text_color="white" + left="5" + top="2">Sky Altitudes</text> + <multi_slider + height="270" + follows="top|left" + orientation="vertical" + increment="25" + min_val="100" + max_val="4000" + thumb_image="Inv_SettingsSky" + thumb_width="17" + thumb_highlight_color="white" + decimal_digits="0" + draw_track="true" + overlap_threshold="100" + initial_value="0" + layout="topleft" + left="10" + max_sliders="3" + name="sld_altitudes" + show_text="false" + top_pad="20" + use_triangle="false" + width="17"> + <slider name="sld1" + value="1000"/> + <slider name="sld2" + value="2000"/> + <slider name="sld3" + value="3000"/> + </multi_slider> + <icon + follows="top|left" + height="17" + width="17" + image_name="Inv_SettingsSky" + layout="topleft" + name="icon_ground" + mouse_opaque="false" + visible="true" + left="10" + xxxleft_delta="0" + top_pad="10"/> + <text + type="string" + length="1" + follows="left|top" + height="12" + layout="topleft" + left_pad="8" + top_delta="2" + width="50" + name="ground_name"> + Ground + </text> + <line_editor + follows="top|right" + enabled="false" + top_delta="-3" + right="-5" + xxxleft="-160" + height="20" + layout="topleft" + name="edt_invname_ground" + width="155"> + Unknown + </line_editor> + <settings_drop_target + height="20" + top_delta="0" + left_delta="0" + follows="top|left" + layout="topleft" + name="sdt_ground" + tool_tip="Drag a setting from Inventory onto this target box to select it as the ground level sky." + width="155" /> + + <icon + follows="left|top" + height="17" + width="17" + image_name="Inv_SettingsWater" + layout="topleft" + name="icon_water" + mouse_opaque="false" + visible="true" + left="10" + top_pad="10"/> + <text + type="string" + length="1" + follows="left|top" + height="12" + layout="topleft" + left_pad="8" + top_delta="2" + width="200" + name="water_name"> + Water + </text> + <line_editor + follows="top|right" + enabled="false" + top_delta="-3" + right="-5" + xxxleft="-160" + height="20" + layout="topleft" + name="edt_invname_water" + width="155"> + Unknown + </line_editor> + <settings_drop_target + height="20" + top_delta="0" + left_delta="0" + follows="top|left" + layout="topleft" + name="sdt_water" + tool_tip="Drag a setting from Inventory onto this target box to select it as current water." + width="155" /> + + <text + type="string" + length="1" + follows="left" + height="12" + layout="topleft" + left="35" + top="30" + width="200" + name="alt1"> + Sky [INDEX]([ALTITUDE]m) + </text> + <line_editor + follows="top|right" + enabled="false" + top_delta="-3" + right="-5" + xxxleft="-160" + height="20" + layout="topleft" + name="edt_invname_alt1" + width="155"> + Unknown + </line_editor> + <settings_drop_target + height="20" + top_delta="0" + left_delta="0" + follows="top|left" + layout="topleft" + name="sdt_alt2" + tool_tip="Drag a setting from Inventory onto this target box to select it as current water." + width="155" /> + + <text + type="string" + length="1" + follows="left|top" + height="12" + layout="topleft" + left="35" + top="40" + width="200" + name="alt2"> + Sky [INDEX]([ALTITUDE]m) + </text> + <line_editor + follows="top|right" + enabled="false" + top_delta="-3" + right="-5" + xxxleft="-160" + height="20" + layout="topleft" + name="edt_invname_alt2" + width="155"> + Unknown + </line_editor> + <settings_drop_target + height="20" + top_delta="0" + left_delta="0" + follows="top|left" + layout="topleft" + name="sdt_alt2" + tool_tip="Drag a setting from Inventory onto this target box to select it as current water." + width="155" /> + + <text + type="string" + length="1" + follows="left|top" + height="12" + layout="topleft" + left="35" + top="50" + width="200" + name="alt3"> + Sky [INDEX]([ALTITUDE]m) + </text> + <line_editor + follows="top|right" + enabled="false" + top_delta="-3" + right="-5" + xxxleft="-160" + height="20" + layout="topleft" + name="edt_invname_alt3" + width="155"> + Unknown + </line_editor> + <settings_drop_target + height="20" + top_delta="0" + left_delta="0" + follows="top|left" + layout="topleft" + name="sdt_alt3" + tool_tip="Drag a setting from Inventory onto this target box to select it as current water." + width="155" /> + + </layout_panel> + <layout_panel + auto_resize="true" + user_resize="false" + min_height="0" + top="5" + name="pnl_environment_config" + visible="true"> + <layout_stack + follows="all" + layout="topleft" + animate="false" + orientation="vertical"> + <layout_panel + min_height="140" + follows="all" + border="true" + bevel_style="in" + name="pnl_environment_current"> + <text follows="top|left" + font="SansSerif" + halign="left" + text_color="white" + top="2">Select Environment</text> + <button + follows="top|left" + top_pad="20" + left_delta="10" + layout="topleft" + height="23" + label="[USEDEFAULT]" + width="120" + name="btn_usedefault"/> + <button + follows="top|left" + top_pad="5" + left_delta="0" + layout="topleft" + height="23" + label="Use Inventory" + width="120" + name="btn_select_inventory"/> + <button + follows="top|left" + top_pad="5" + left_delta="0" + layout="topleft" + height="23" + label="Customize" + width="120" + name="btn_edit"/> + <check_box + height="20" + label="Parcel Owners May Override Environment" + layout="topleft" + left_delta="0" + top_pad="10" + name="chk_allow_override" + width="200" /> + </layout_panel> + <layout_panel + min_height="130" + follows="all" + border="true" + bevel_style="in" + name="pnl_environment_length"> + <text + font="SansSerif" + follows="top|left|right" + halign="left" + text_color="white" + top="2">Day Settings</text> + <text + type="string" + length="1" + follows="left|top" + height="12" + layout="topleft" + left_delta="10" + top_pad="16" + width="200"> + Day Length (hours) + </text> + <slider + can_edit_text="true" + decimal_digits="1" + follows="left|top" + height="20" + increment="0.5" + initial_value="4" + layout="topleft" + left_delta="0" + xxxright="-10" + top_pad="0" + name="sld_day_length" + min_val="4" + max_val="168" + width="240" /> + <text + type="string" + length="1" + follows="left|top" + height="12" + layout="topleft" + left_delta="0" + top_pad="5" + width="200"> + Day Offset (hours) + </text> + <slider + can_edit_text="true" + decimal_digits="1" + follows="left|top" + height="20" + increment="0.5" + initial_value="-8" + layout="topleft" + left_delta="0" + top_pad="0" + name="sld_day_offset" + min_val="-11.5" + max_val="12" + width="240" /> + <text + type="string" + length="1" + follows="left|top" + height="12" + layout="topleft" + left_delta="0" + top_pad="5" + width="200"> + Apparent Time of Day: + </text> + <text + name="lbl_apparent_time" + type="string" + length="1" + follows="left|top" + height="12" + layout="topleft" + left_delta="10" + top_pad="5" + width="200"> + [HH]:[MM][AP] ([PRC]%) + </text> + + </layout_panel> + <layout_panel + follows="bottom" + border="true" + bevel_style="in" + name="pnl_environment_buttons"> + <button + follows="bottom|right" + height="23" + label="Apply" + top="-60" + left="-220" + name="btn_apply" + width="100" /> + <button + follows="bottom|right" + height="23" + label="Reset" + layout="topleft" + left_pad="10" + top_delta="0" + name="btn_cancel" + width="100" /> + </layout_panel> + </layout_stack> + </layout_panel> + </layout_stack> + </layout_panel> + <!-- <layout_panel auto_resize="false" user_resize="false" @@ -103,13 +528,13 @@ Unknown </line_editor> <settings_drop_target - height="20" - top_pad="-20" - follows="top|left" - layout="topleft" - name="sdt_drop_target" - tool_tip="Drag a setting from Inventory onto this target box to select it as current evironment." - width="200" /> + height="20" + top_pad="-20" + follows="top|left" + layout="topleft" + name="sdt_drop_target" + tool_tip="Drag a setting from Inventory onto this target box to select it as current evironment." + width="200" /> <button name="btn_select_inventory" follows="top|left" @@ -231,54 +656,57 @@ name="pnl_environment_altitudes" visible="true"> <panel - left="5" - top="0" - bottom="-1" - width="260" - follows="left|top|bottom" - background_visible="true" - border="true" - bevel_style="in" - name="cnt_panel"> + left="5" + top="0" + bottom="-1" + width="260" + follows="left|top|bottom" + background_visible="true" + border="true" + bevel_style="in" + name="cnt_panel"> <text follows="top|left" - font="SansSerif" - halign="left" - text_color="white" - top="2">Sky Altitudes</text> + font="SansSerif" + halign="left" + text_color="white" + top="2">Sky Altitudes</text> <multi_slider - decimal_digits="0" - follows="bottom" - height="123" - width="17" - orientation="vertical" - increment="10" - overlap_threshold="100" - min_val="100" - max_val="4000" - layout="topleft" - left="15" - top="20" - max_sliders="20" - name="sld_altitudes" - show_text="false" - thumb_image="Inv_SettingsSky" - thumb_width="17" - thumb_highlight_color="white"> - <slider name="sld1" value="200"/> - <slider name="sld2" value="400"/> - <slider name="sld3" value="600"/> + decimal_digits="0" + follows="bottom" + height="123" + width="17" + orientation="vertical" + increment="10" + overlap_threshold="100" + min_val="100" + max_val="4000" + layout="topleft" + left="15" + top="20" + max_sliders="20" + name="sld_altitudes" + show_text="false" + thumb_image="Inv_SettingsSky" + thumb_width="17" + thumb_highlight_color="white"> + <slider name="sld1" + value="200"/> + <slider name="sld2" + value="400"/> + <slider name="sld3" + value="600"/> </multi_slider> <icon - follows="left|top" - height="17" - width="17" - image_name="Inv_SettingsSky" - layout="topleft" - name="icon_ground" - mouse_opaque="false" - visible="true" - left_delta="0" - top_pad="-9"/> + follows="left|top" + height="17" + width="17" + image_name="Inv_SettingsSky" + layout="topleft" + name="icon_ground" + mouse_opaque="false" + visible="true" + left_delta="0" + top_pad="-9"/> <text type="string" length="1" @@ -368,5 +796,6 @@ width="100" /> </layout_panel> +--> </layout_stack> </panel> |