summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelenvironment.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelenvironment.cpp')
-rw-r--r--indra/newview/llpanelenvironment.cpp44
1 files changed, 27 insertions, 17 deletions
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index 4ab09e7118..5abef949e1 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
{
@@ -114,6 +116,7 @@ const std::string alt_labels[] = {
LLPanelEnvironmentInfo::LLPanelEnvironmentInfo():
mCurrentEnvironment(),
mDirtyFlag(0),
+ mEditorLastParcelId(INVALID_PARCEL_ID),
mCrossRegion(false),
mNoSelection(false),
mNoEnvironment(false),
@@ -256,15 +259,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);
@@ -331,11 +326,15 @@ void LLPanelEnvironmentInfo::updateEditFloater(const LLEnvironment::EnvironmentI
else
dayeditor->closeFloater();
}
- else
+ else if (dayeditor->getEditingAssetId() != nextenv->mDayCycle->getAssetId()
+ || mEditorLastParcelId != nextenv->mParcelId
+ || mEditorLastRegionId != nextenv->mRegionId)
{
// Ignore dirty
// If parcel selection changed whatever we do except saving to inventory with
// old settings will be invalid.
+ mEditorLastParcelId = nextenv->mParcelId;
+ mEditorLastRegionId = nextenv->mRegionId;
dayeditor->setEditDayCycle(nextenv->mDayCycle);
}
}
@@ -389,6 +388,8 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
getChild<LLUICtrl>(BTN_EDIT)->setEnabled(enabled);
getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy);
getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0) && !is_legacy);
+ getChild<LLUICtrl>(SLD_ALTITUDES)->setEnabled(enabled && isRegion() && !is_legacy);
+ getChild<LLUICtrl>(ICN_GROUND)->setColor((enabled && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f);
getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(enabled && isRegion() && !is_legacy);
getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(enabled && isRegion() && !is_legacy);
getChild<LLUICtrl>(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0));
@@ -614,8 +615,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 +716,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)