summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-08-21 19:25:06 +0100
committerGraham Linden <graham@lindenlab.com>2018-08-21 19:25:06 +0100
commit67d880781ee2463522edd11f9286635414aa46eb (patch)
tree3146816bbc9f0f1db1c9dc6eff2c6e22713bcd5c
parente3c2d3fd5138fa79946734e61b34d38e98c6a493 (diff)
parent163ae605be8871f37f19d94b71ec4370aadf9a49 (diff)
Merge
-rw-r--r--indra/llinventory/llsettingsbase.h10
-rw-r--r--indra/llinventory/llsettingsdaycycle.cpp29
-rw-r--r--indra/llinventory/llsettingsdaycycle.h7
-rw-r--r--indra/llinventory/llsettingssky.h9
-rw-r--r--indra/llinventory/llsettingswater.h4
-rw-r--r--indra/newview/llenvironment.cpp195
-rw-r--r--indra/newview/llenvironment.h33
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp178
-rw-r--r--indra/newview/llfloatereditextdaycycle.h24
-rw-r--r--indra/newview/llfloaterland.cpp101
-rw-r--r--indra/newview/llfloaterregioninfo.cpp158
-rw-r--r--indra/newview/llflyoutcombobtn.cpp5
-rw-r--r--indra/newview/llflyoutcombobtn.h1
-rw-r--r--indra/newview/llinventorybridge.cpp2
-rw-r--r--indra/newview/llpanelenvironment.cpp614
-rw-r--r--indra/newview/llpanelenvironment.h97
-rw-r--r--indra/newview/llsettingspicker.cpp1404
-rw-r--r--indra/newview/llsettingspicker.h372
-rw-r--r--indra/newview/llsettingsvo.cpp51
-rw-r--r--indra/newview/llsettingsvo.h14
-rw-r--r--indra/newview/llviewermenu.cpp4
-rw-r--r--indra/newview/llwlhandlers.cpp32
-rw-r--r--indra/newview/llwlhandlers.h13
-rw-r--r--indra/newview/skins/default/xui/en/floater_about_land.xml4
-rw-r--r--indra/newview/skins/default/xui/en/menu_save_settings.xml7
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml12
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_environment.xml209
27 files changed, 1085 insertions, 2504 deletions
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index beaeac2d04..9757092794 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -87,7 +87,7 @@ public:
inline bool hasSetting(const std::string &param) const { return mSettings.has(param); }
inline bool isDirty() const { return mDirty; }
inline bool isVeryDirty() const { return mReplaced; }
- inline void setDirtyFlag(bool dirty) { mDirty = dirty; }
+ inline void setDirtyFlag(bool dirty) { mDirty = dirty; clearAssetId(); }
size_t getHash() const; // Hash will not include Name, ID or a previously stored Hash
@@ -116,10 +116,10 @@ public:
virtual void replaceSettings(LLSD settings)
{
- mSettings = settings;
mBlendedFactor = 0.0;
setDirtyFlag(true);
mReplaced = true;
+ mSettings = settings;
}
virtual LLSD getSettings() const;
@@ -130,8 +130,8 @@ public:
{
mSettings[name] = value;
mDirty = true;
- if (mSettings.has(SETTING_ASSETID))
- mSettings.erase(SETTING_ASSETID);
+ if (name != SETTING_ASSETID)
+ clearAssetId();
}
inline void setValue(const std::string &name, const LLSD &value)
@@ -200,7 +200,7 @@ public:
virtual bool validate();
- virtual ptr_t buildDerivedClone() = 0;
+ virtual ptr_t buildDerivedClone() const = 0;
class Validator
{
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp
index 4a99be0c4b..25cd99b997 100644
--- a/indra/llinventory/llsettingsdaycycle.cpp
+++ b/indra/llinventory/llsettingsdaycycle.cpp
@@ -120,7 +120,7 @@ const S32 LLSettingsDay::FRAME_MAX(56);
const F32 LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR(0.02501f);
-const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("283a26a3-b147-47b7-8057-cfff0302ec0e");
+const LLUUID LLSettingsDay::DEFAULT_ASSET_ID("94d296c2-6e05-963c-6b62-671199121dbb");
// Minimum value to prevent multislider in edit floaters from eating up frames that 'encroach' on one another's space
static const F32 DEFAULT_MULTISLIDER_INCREMENT(0.005f);
@@ -150,6 +150,9 @@ LLSD LLSettingsDay::getSettings() const
if (mSettings.has(SETTING_ID))
settings[SETTING_ID] = mSettings[SETTING_ID];
+ if (mSettings.has(SETTING_ASSETID))
+ settings[SETTING_ASSETID] = mSettings[SETTING_ASSETID];
+
settings[SETTING_TYPE] = getSettingsType();
std::map<std::string, LLSettingsBase::ptr_t> in_use;
@@ -194,6 +197,14 @@ bool LLSettingsDay::initialize(bool validate_frames)
LLSD tracks = mSettings[SETTING_TRACKS];
LLSD frames = mSettings[SETTING_FRAMES];
+ // save for later...
+ LLUUID assetid;
+ if (mSettings.has(SETTING_ASSETID))
+ {
+ assetid = mSettings[SETTING_ASSETID].asUUID();
+ LL_WARNS("LAPRAS") << "initializing daycycle with asset id " << assetid << LL_ENDL;
+ }
+
std::map<std::string, LLSettingsBase::ptr_t> used;
for (LLSD::map_const_iterator itFrame = frames.beginMap(); itFrame != frames.endMap(); ++itFrame)
@@ -380,6 +391,11 @@ bool LLSettingsDay::initialize(bool validate_frames)
mSettings.erase(SETTING_TRACKS);
mSettings.erase(SETTING_FRAMES);
+ if (!assetid.isNull())
+ {
+ mSettings[SETTING_ASSETID] = assetid;
+ }
+
mInitialized = true;
return true;
}
@@ -593,7 +609,16 @@ LLSettingsDay::validation_list_t LLSettingsDay::validationList()
return validation;
}
-LLSettingsDay::CycleTrack_t &LLSettingsDay::getCycleTrack(S32 track)
+LLSettingsDay::CycleTrack_t& LLSettingsDay::getCycleTrack(S32 track)
+{
+ static CycleTrack_t emptyTrack;
+ if (mDayTracks.size() <= track)
+ return emptyTrack;
+
+ return mDayTracks[track];
+}
+
+const LLSettingsDay::CycleTrack_t& LLSettingsDay::getCycleTrackConst(S32 track) const
{
static CycleTrack_t emptyTrack;
if (mDayTracks.size() <= track)
diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h
index 0ee5ce3e0b..46dc0cec74 100644
--- a/indra/llinventory/llsettingsdaycycle.h
+++ b/indra/llinventory/llsettingsdaycycle.h
@@ -80,8 +80,8 @@ public:
bool initialize(bool validate_frames = false);
- virtual ptr_t buildClone() = 0;
- virtual ptr_t buildDeepCloneAndUncompress() = 0;
+ virtual ptr_t buildClone() const = 0;
+ virtual ptr_t buildDeepCloneAndUncompress() const = 0;
virtual LLSD getSettings() const SETTINGS_OVERRIDE;
virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_DAYCYCLE; }
@@ -118,6 +118,7 @@ public:
void setInitialized(bool value = true) { mInitialized = value; }
CycleTrack_t & getCycleTrack(S32 track);
+ const CycleTrack_t & getCycleTrackConst(S32 track) const;
bool clearCycleTrack(S32 track);
bool replaceCycleTrack(S32 track, const CycleTrack_t &source);
bool isTrackEmpty(S32 track) const;
@@ -125,7 +126,7 @@ public:
virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE;
static validation_list_t validationList();
- virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
+ virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); }
LLSettingsBase::TrackPosition getUpperBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe);
LLSettingsBase::TrackPosition getLowerBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe);
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index a9e708487f..14caca36a7 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -96,7 +96,7 @@ public:
LLSettingsSky(const LLSD &data);
virtual ~LLSettingsSky() { };
- virtual ptr_t buildClone() = 0;
+ virtual ptr_t buildClone() const = 0;
//---------------------------------------------------------------------
virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("sky"); }
@@ -116,13 +116,10 @@ public:
F32 getMieAnisotropy() const;
LLSD getRayleighConfigs() const;
LLSD getMieConfigs() const;
+
LLSD getAbsorptionConfigs() const;
LLUUID getBloomTextureId() const;
- void setRayleighConfigs(const LLSD& rayleighConfig);
- void setMieConfigs(const LLSD& mieConfig);
- void setAbsorptionConfigs(const LLSD& absorptionConfig);
-
//---------------------------------------------------------------------
LLColor3 getAmbientColor() const;
void setAmbientColor(const LLColor3 &val);
@@ -234,7 +231,7 @@ public:
LLColor3 getSunDiffuse() const;
LLColor4 getTotalAmbient() const;
- virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
+ virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); }
static LLUUID GetDefaultAssetId();
static LLUUID GetDefaultSunTextureId();
diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h
index b525912898..b33b082bbf 100644
--- a/indra/llinventory/llsettingswater.h
+++ b/indra/llinventory/llsettingswater.h
@@ -55,7 +55,7 @@ public:
LLSettingsWater(const LLSD &data);
virtual ~LLSettingsWater() { };
- virtual ptr_t buildClone() = 0;
+ virtual ptr_t buildClone() const = 0;
//---------------------------------------------------------------------
virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("water"); }
@@ -226,7 +226,7 @@ public:
static LLSD translateLegacySettings(LLSD legacy);
- virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
+ virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); }
static LLUUID GetDefaultAssetId();
static LLUUID GetDefaultWaterNormalAssetId();
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index de3cb4982d..be0c763e25 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -57,6 +57,9 @@
#include <boost/make_shared.hpp>
#include "llatmosphere.h"
+#include "llagent.h"
+#include "roles_constants.h"
+#include "llestateinfomodel.h"
//=========================================================================
namespace
@@ -189,9 +192,6 @@ namespace
LLSettingsBase::BlendFactor blendf = calculateBlend(targetpos, targetspan);
pendsetting->blend((*bounds.second).second, blendf);
-// pstartsetting->setValue(LLSettingsSky::SETTING_AMBIENT, LLColor3(0.0, 1.0, 0.0));
-// pendsetting->setValue(LLSettingsSky::SETTING_AMBIENT, LLColor3(1.0, 0.0, 0.0));
-
setIgnoreTimeDeltaThreshold(true); // for the next span ignore the time delta threshold.
reset(pstartsetting, pendsetting, LLEnvironment::TRANSITION_ALTITUDE);
}
@@ -374,23 +374,36 @@ void LLEnvironment::getAtmosphericModelSettings(AtmosphericModelSettings& settin
}
}
-bool LLEnvironment::canAgentUpdateParcelEnvironment(bool useselected) const
+bool LLEnvironment::canAgentUpdateParcelEnvironment() const
{
+ LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel());
+
+ return canAgentUpdateParcelEnvironment(parcel);
+}
+
+
+bool LLEnvironment::canAgentUpdateParcelEnvironment(LLParcel *parcel) const
+{
+ if (!parcel)
+ return false;
+
if (!LLEnvironment::instance().isExtendedEnvironmentEnabled())
return false;
- LLParcel *parcel(LLViewerParcelMgr::instance().getAgentOrSelectedParcel());
+ if (gAgent.isGodlike())
+ return true;
- if (parcel)
- {
- return parcel->allowTerraformBy(gAgent.getID());
- }
+ if (!parcel->getRegionAllowEnvironmentOverride())
+ return false;
- return false;
+ return LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS);
}
bool LLEnvironment::canAgentUpdateRegionEnvironment() const
{
+ if (gAgent.isGodlike())
+ return true;
+
return gAgent.getRegion()->canManageEstate();
}
@@ -418,26 +431,6 @@ void LLEnvironment::onParcelChange()
requestParcel(parcel_id);
}
-void LLEnvironment::onLegacyRegionSettings(LLSD data)
-{
- LLUUID regionId = data[0]["regionID"].asUUID();
-
- LLSettingsDay::ptr_t regionday;
- if (!data[1].isUndefined())
- regionday = LLSettingsVODay::buildFromLegacyMessage(regionId, data[1], data[2], data[3]);
-
- clearEnvironment(ENV_PARCEL);
- if (!regionday)
- {
- LL_WARNS("ENVIRONMENT") << "Unable to create day from legacy. Using default day cycle." << LL_ENDL;
- setEnvironment(LLEnvironment::ENV_REGION, LLSettingsDay::GetDefaultAssetId(), LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET);
- }
- else
- setEnvironment(ENV_REGION, regionday, LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET);
-
- updateEnvironment();
-}
-
//-------------------------------------------------------------------------
F32 LLEnvironment::getCamHeight() const
{
@@ -1002,29 +995,17 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI
}
//=========================================================================
-void LLEnvironment::requestRegion()
+void LLEnvironment::requestRegion(environment_apply_fn cb)
{
- if (!isExtendedEnvironmentEnabled())
- { /*TODO: When EEP is live on the entire grid, this can go away. */
- LLEnvironmentRequest::initiate();
- return;
- }
-
- requestParcel(INVALID_PARCEL_ID);
+ requestParcel(INVALID_PARCEL_ID, cb);
}
-void LLEnvironment::updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset)
+void LLEnvironment::updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, environment_apply_fn cb)
{
- if (!isExtendedEnvironmentEnabled())
- {
- LLEnvironmentApply::initiateRequest( LLSettingsVODay::convertToLegacy(pday) );
- return;
- }
-
- updateParcel(INVALID_PARCEL_ID, pday, day_length, day_offset);
+ updateParcel(INVALID_PARCEL_ID, pday, day_length, day_offset, cb);
}
-void LLEnvironment::updateRegion(const LLUUID &asset_id, S32 day_length, S32 day_offset)
+void LLEnvironment::updateRegion(const LLUUID &asset_id, S32 day_length, S32 day_offset, environment_apply_fn cb)
{
if (!isExtendedEnvironmentEnabled())
{
@@ -1033,43 +1014,64 @@ void LLEnvironment::updateRegion(const LLUUID &asset_id, S32 day_length, S32 day
return;
}
- updateParcel(INVALID_PARCEL_ID, asset_id, day_length, day_offset);
+ updateParcel(INVALID_PARCEL_ID, asset_id, day_length, day_offset, cb);
}
-void LLEnvironment::updateRegion(const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset)
+void LLEnvironment::updateRegion(const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, environment_apply_fn cb)
{
- updateParcel(INVALID_PARCEL_ID, psky, day_length, day_offset);
+ updateParcel(INVALID_PARCEL_ID, psky, day_length, day_offset, cb);
}
-void LLEnvironment::updateRegion(const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset)
+void LLEnvironment::updateRegion(const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, environment_apply_fn cb)
{
- updateParcel(INVALID_PARCEL_ID, pwater, day_length, day_offset);
+ updateParcel(INVALID_PARCEL_ID, pwater, day_length, day_offset, cb);
}
-void LLEnvironment::resetRegion()
+void LLEnvironment::resetRegion(environment_apply_fn cb)
{
- resetParcel(INVALID_PARCEL_ID);
+ resetParcel(INVALID_PARCEL_ID, cb);
}
-void LLEnvironment::requestParcel(S32 parcel_id)
+void LLEnvironment::requestParcel(S32 parcel_id, environment_apply_fn cb)
{
+ if (!isExtendedEnvironmentEnabled())
+ { /*TODO: When EEP is live on the entire grid, this can go away. */
+ if (!cb)
+ {
+ cb = [this](S32 pid, EnvironmentInfo::ptr_t envinfo)
+ {
+ if (envinfo->mDayCycle) recordEnvironment(pid, envinfo);
+ else
+ {
+ clearEnvironment(ENV_PARCEL);
+ setEnvironment(ENV_REGION, LLSettingsDay::GetDefaultAssetId(), LLSettingsDay::DEFAULT_DAYLENGTH, LLSettingsDay::DEFAULT_DAYOFFSET);
+ updateEnvironment();
+ }
+ };
+ }
+
+ if (parcel_id == INVALID_PARCEL_ID)
+ LLEnvironmentRequest::initiate(cb);
+ return;
+ }
+
+ if (!cb)
+ {
+ cb = [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); };
+ }
+
std::string coroname =
LLCoros::instance().launch("LLEnvironment::coroRequestEnvironment",
- boost::bind(&LLEnvironment::coroRequestEnvironment, this, parcel_id,
- [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); }));
+ [this, parcel_id, cb]() { coroRequestEnvironment(parcel_id, cb); });
}
-void LLEnvironment::updateParcel(S32 parcel_id, const LLUUID &asset_id, S32 day_length, S32 day_offset)
+void LLEnvironment::updateParcel(S32 parcel_id, const LLUUID &asset_id, S32 day_length, S32 day_offset, environment_apply_fn cb)
{
std::string coroname =
LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment",
- [this, parcel_id, asset_id, day_length, day_offset]() { coroUpdateEnvironment(parcel_id, NO_TRACK,
- LLSettingsDay::ptr_t(), asset_id, day_length, day_offset, environment_apply_fn()); });
-// [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); }); });
-
-// LLSettingsVOBase::getSettingsAsset(asset_id,
-// [this, parcel_id, day_length, day_offset](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onUpdateParcelAssetLoaded(asset_id, settings, status, parcel_id, day_length, day_offset); });
+ [this, parcel_id, asset_id, day_length, day_offset, cb]() { coroUpdateEnvironment(parcel_id, NO_TRACK,
+ LLSettingsDay::ptr_t(), asset_id, day_length, day_offset, cb); });
}
void LLEnvironment::onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 parcel_id, S32 day_length, S32 day_offset)
@@ -1100,35 +1102,33 @@ void LLEnvironment::onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::p
updateParcel(parcel_id, pday, day_length, day_offset);
}
-void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset)
+void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, environment_apply_fn cb)
{
LLSettingsDay::ptr_t pday = createDayCycleFromEnvironment((parcel_id == INVALID_PARCEL_ID) ? ENV_REGION : ENV_PARCEL, psky);
- updateParcel(parcel_id, pday, day_length, day_offset);
+ updateParcel(parcel_id, pday, day_length, day_offset, cb);
}
-void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset)
+void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, environment_apply_fn cb)
{
LLSettingsDay::ptr_t pday = createDayCycleFromEnvironment((parcel_id == INVALID_PARCEL_ID) ? ENV_REGION : ENV_PARCEL, pwater);
- updateParcel(parcel_id, pday, day_length, day_offset);
+ updateParcel(parcel_id, pday, day_length, day_offset, cb);
}
-void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset)
+void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, environment_apply_fn cb)
{
std::string coroname =
LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment",
- [this, parcel_id, pday, day_length, day_offset]() { coroUpdateEnvironment(parcel_id, NO_TRACK,
- pday, LLUUID::null, day_length, day_offset, environment_apply_fn()); });
-// [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); }); });
+ [this, parcel_id, pday, day_length, day_offset, cb]() { coroUpdateEnvironment(parcel_id, NO_TRACK,
+ pday, LLUUID::null, day_length, day_offset, cb); });
}
-void LLEnvironment::resetParcel(S32 parcel_id)
+void LLEnvironment::resetParcel(S32 parcel_id, environment_apply_fn cb)
{
std::string coroname =
LLCoros::instance().launch("LLEnvironment::coroResetEnvironment",
- [this, parcel_id]() { coroResetEnvironment(parcel_id, NO_TRACK, environment_apply_fn()); });
-// [this](S32 pid, EnvironmentInfo::ptr_t envinfo) { recordEnvironment(pid, envinfo); }); });
+ [this, parcel_id, cb]() { coroResetEnvironment(parcel_id, NO_TRACK, cb); });
}
void LLEnvironment::coroRequestEnvironment(S32 parcel_id, LLEnvironment::environment_apply_fn apply)
@@ -1347,7 +1347,7 @@ void LLEnvironment::coroResetEnvironment(S32 parcel_id, S32 track_no, environmen
//=========================================================================
-LLEnvironment::UserPrefs::UserPrefs():
+LLEnvironment::UserPrefs::UserPrefs() :
mUseRegionSettings(true),
mUseDayCycle(true),
mPersistEnvironment(false),
@@ -1391,7 +1391,8 @@ LLEnvironment::EnvironmentInfo::EnvironmentInfo():
mDayHash(0),
mDayCycle(),
mAltitudes({ { 0.0, 0.0, 0.0, 0.0 } }),
- mIsDefault(false)
+ mIsDefault(false),
+ mIsLegacy(false)
{
}
@@ -1402,6 +1403,7 @@ LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extract(LL
pinfo->mIsDefault = environment.has(KEY_ISDEFAULT) ? environment[KEY_ISDEFAULT].asBoolean() : true;
pinfo->mParcelId = environment.has(KEY_PARCELID) ? environment[KEY_PARCELID].asInteger() : INVALID_PARCEL_ID;
pinfo->mRegionId = environment.has(KEY_REGIONID) ? environment[KEY_REGIONID].asUUID() : LLUUID::null;
+ pinfo->mIsLegacy = false;
if (environment.has(KEY_TRACKALTS))
{
@@ -1419,7 +1421,46 @@ LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extract(LL
pinfo->mDayOffset = LLSettingsDay::Seconds(environment.has(KEY_DAYOFFSET) ? environment[KEY_DAYOFFSET].asInteger() : -1);
pinfo->mDayHash = environment.has(KEY_DAYHASH) ? environment[KEY_DAYHASH].asInteger() : 0;
}
+ else
+ {
+ pinfo->mDayLength = LLEnvironment::instance().getEnvironmentDayLength(ENV_REGION);
+ pinfo->mDayOffset = LLEnvironment::instance().getEnvironmentDayOffset(ENV_REGION);
+ }
+
+ if (environment.has(KEY_DAYASSET))
+ {
+ pinfo->mAssetId = environment[KEY_DAYASSET].asUUID();
+ }
+
+ return pinfo;
+}
+
+
+LLEnvironment::EnvironmentInfo::ptr_t LLEnvironment::EnvironmentInfo::extractLegacy(LLSD legacy)
+{
+ if (!legacy.isArray() || !legacy[0].has("regionID"))
+ {
+ LL_WARNS("ENVIRONMENT") << "Invalid legacy settings for environment: " << legacy << LL_ENDL;
+ return ptr_t();
+ }
+
+ ptr_t pinfo = std::make_shared<EnvironmentInfo>();
+ pinfo->mIsDefault = false;
+ pinfo->mParcelId = INVALID_PARCEL_ID;
+ pinfo->mRegionId = legacy[0]["regionID"].asUUID();
+ pinfo->mIsLegacy = true;
+
+ pinfo->mDayLength = LLSettingsDay::DEFAULT_DAYLENGTH;
+ pinfo->mDayOffset = LLSettingsDay::DEFAULT_DAYOFFSET;
+ pinfo->mDayCycle = LLSettingsVODay::buildFromLegacyMessage(pinfo->mRegionId, legacy[1], legacy[2], legacy[3]);
+ if (pinfo->mDayCycle)
+ pinfo->mDayHash = pinfo->mDayCycle->getHash();
+
+ pinfo->mAltitudes[0] = 0;
+ pinfo->mAltitudes[2] = 10001;
+ pinfo->mAltitudes[3] = 10002;
+ pinfo->mAltitudes[4] = 10003;
return pinfo;
}
diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h
index eba1b737c8..b5bd353066 100644
--- a/indra/newview/llenvironment.h
+++ b/indra/newview/llenvironment.h
@@ -43,6 +43,7 @@
//-------------------------------------------------------------------------
class LLViewerCamera;
class LLGLSLShader;
+class LLParcel;
//-------------------------------------------------------------------------
class LLEnvironment : public LLSingleton<LLEnvironment>
@@ -81,8 +82,11 @@ public:
LLSettingsDay::ptr_t mDayCycle;
std::array<F32, 4> mAltitudes;
bool mIsDefault;
+ LLUUID mAssetId;
+ bool mIsLegacy;
static ptr_t extract(LLSD);
+ static ptr_t extractLegacy(LLSD);
};
enum EnvSelection_t
@@ -148,7 +152,8 @@ public:
bool canEdit() const;
bool isExtendedEnvironmentEnabled() const;
bool isInventoryEnabled() const;
- bool canAgentUpdateParcelEnvironment(bool useselected = true) const;
+ bool canAgentUpdateParcelEnvironment() const;
+ bool canAgentUpdateParcelEnvironment(LLParcel *parcel) const;
bool canAgentUpdateRegionEnvironment() const;
LLSettingsDay::ptr_t getCurrentDay() const { return mCurrentEnvironment->getDayCycle(); }
@@ -226,20 +231,18 @@ public:
//-------------------------------------------
connection_t setEnvironmentChanged(environment_changed_fn cb);
- void onLegacyRegionSettings(LLSD data);
-
- void requestRegion();
- void updateRegion(const LLUUID &asset_id, S32 day_length, S32 day_offset);
- void updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset);
- void updateRegion(const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset);
- void updateRegion(const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset);
- void resetRegion();
- void requestParcel(S32 parcel_id);
- void updateParcel(S32 parcel_id, const LLUUID &asset_id, S32 day_length, S32 day_offset);
- void updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset);
- void updateParcel(S32 parcel_id, const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset);
- void updateParcel(S32 parcel_id, const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset);
- void resetParcel(S32 parcel_id);
+ void requestRegion(environment_apply_fn cb = environment_apply_fn());
+ void updateRegion(const LLUUID &asset_id, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn());
+ void updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn());
+ void updateRegion(const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn());
+ void updateRegion(const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn());
+ void resetRegion(environment_apply_fn cb = environment_apply_fn());
+ void requestParcel(S32 parcel_id, environment_apply_fn cb = environment_apply_fn());
+ void updateParcel(S32 parcel_id, const LLUUID &asset_id, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn());
+ void updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn());
+ void updateParcel(S32 parcel_id, const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn());
+ void updateParcel(S32 parcel_id, const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, environment_apply_fn cb = environment_apply_fn());
+ void resetParcel(S32 parcel_id, environment_apply_fn cb = environment_apply_fn());
void selectAgentEnvironment();
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 3eec6b18d0..dd224474fc 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -102,6 +102,7 @@ namespace {
// From menu_save_settings.xml, consider moving into flyout since it should be supported by flyout either way
const std::string ACTION_SAVE("save_settings");
const std::string ACTION_SAVEAS("save_as_new_settings");
+ const std::string ACTION_COMMIT("commit_changes");
const std::string ACTION_APPLY_LOCAL("apply_local");
const std::string ACTION_APPLY_PARCEL("apply_parcel");
const std::string ACTION_APPLY_REGION("apply_region");
@@ -111,9 +112,13 @@ namespace {
//=========================================================================
const std::string LLFloaterEditExtDayCycle::KEY_INVENTORY_ID("inventory_id");
-const std::string LLFloaterEditExtDayCycle::KEY_LIVE_ENVIRONMENT("live_environment");
+const std::string LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT("edit_context");
const std::string LLFloaterEditExtDayCycle::KEY_DAY_LENGTH("day_length");
+const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_INVENTORY("inventory");
+const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_PARCEL("parcel");
+const std::string LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION("region");
+
//=========================================================================
LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) :
LLFloater(key),
@@ -192,21 +197,31 @@ BOOL LLFloaterEditExtDayCycle::postBuild()
void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)
{
mEditDay.reset();
-
- LLEnvironment::EnvSelection_t env = LLEnvironment::ENV_DEFAULT;
- if (key.has(KEY_INVENTORY_ID))
+ mEditContext = CONTEXT_UNKNOWN;
+ if (key.has(KEY_EDIT_CONTEXT))
{
- loadInventoryItem(key[KEY_INVENTORY_ID].asUUID());
+ std::string context = key[KEY_EDIT_CONTEXT].asString();
+
+ if (context == VALUE_CONTEXT_INVENTORY)
+ mEditContext = CONTEXT_INVENTORY;
+ else if (context == VALUE_CONTEXT_PARCEL)
+ mEditContext = CONTEXT_PARCEL;
+ else if (context == VALUE_CONTEXT_REGION)
+ mEditContext = CONTEXT_REGION;
}
- else if (key.has(KEY_LIVE_ENVIRONMENT))
+
+ if (mEditContext == CONTEXT_UNKNOWN)
{
- env = static_cast<LLEnvironment::EnvSelection_t>(key[KEY_LIVE_ENVIRONMENT].asInteger());
+ LL_WARNS("ENVDAYEDIT") << "Unknown editing context!" << LL_ENDL;
+ }
- loadLiveEnvironment(env);
+ if (key.has(KEY_INVENTORY_ID))
+ {
+ loadInventoryItem(key[KEY_INVENTORY_ID].asUUID());
}
else
{
- loadLiveEnvironment(env);
+ setEditDefaultDayCycle();
}
mDayLength.value(0);
@@ -255,7 +270,7 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)
bool extended_env = LLEnvironment::instance().isExtendedEnvironmentEnabled();
bool use_altitudes = extended_env
&& altitudes.size() > 0
- && (env == LLEnvironment::ENV_REGION || env == LLEnvironment::ENV_PARCEL);
+ && ((mEditContext == CONTEXT_PARCEL) || (mEditContext == CONTEXT_REGION));
for (S32 idx = 1; idx < 4; ++idx)
{
std::ostringstream convert;
@@ -275,6 +290,21 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)
{
getChild<LLButton>(track_tabs[i])->setEnabled(extended_env);
}
+
+ if (mEditContext == CONTEXT_INVENTORY)
+ {
+ mFlyoutControl->setShownBtnEnabled(true);
+ mFlyoutControl->setSelectedItem(ACTION_SAVE);
+ }
+ else if ((mEditContext == CONTEXT_REGION) || (mEditContext == CONTEXT_PARCEL))
+ {
+ mFlyoutControl->setShownBtnEnabled(true);
+ mFlyoutControl->setSelectedItem(ACTION_COMMIT);
+ }
+ else
+ {
+ mFlyoutControl->setShownBtnEnabled(false);
+ }
}
void LLFloaterEditExtDayCycle::onClose(bool app_quitting)
@@ -315,18 +345,48 @@ void LLFloaterEditExtDayCycle::refresh()
bool is_inventory_avail = canUseInventory();
+ bool show_commit = ((mEditContext == CONTEXT_PARCEL) || (mEditContext == CONTEXT_REGION));
+ bool show_apply = (mEditContext == CONTEXT_INVENTORY);
+
+ mFlyoutControl->setMenuItemVisible(ACTION_COMMIT, show_commit);
+ mFlyoutControl->setMenuItemVisible(ACTION_SAVE, is_inventory_avail);
+ mFlyoutControl->setMenuItemVisible(ACTION_SAVEAS, is_inventory_avail);
+ mFlyoutControl->setMenuItemVisible(ACTION_APPLY_LOCAL, true);
+ mFlyoutControl->setMenuItemVisible(ACTION_APPLY_PARCEL, show_apply);
+ mFlyoutControl->setMenuItemVisible(ACTION_APPLY_REGION, show_apply);
+
+ mFlyoutControl->setMenuItemEnabled(ACTION_COMMIT, show_commit);
mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail);
mFlyoutControl->setMenuItemEnabled(ACTION_SAVEAS, is_inventory_avail);
- mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_PARCEL, canApplyParcel());
- mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_REGION, canApplyRegion());
+ mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_LOCAL, true);
+ mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_PARCEL, canApplyParcel() && show_apply);
+ mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_REGION, canApplyRegion() && show_apply);
LLFloater::refresh();
}
+
+void LLFloaterEditExtDayCycle::setEditDayCycle(const LLSettingsDay::ptr_t &pday)
+{
+ mEditDay = pday->buildDeepCloneAndUncompress();
+ updateEditEnvironment();
+ LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_INSTANT);
+ LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_INSTANT);
+ synchronizeTabs();
+ updateTabs();
+ refresh();
+}
+
+
+void LLFloaterEditExtDayCycle::setEditDefaultDayCycle()
+{
+ LLSettingsVOBase::getSettingsAsset(LLSettingsDay::GetDefaultAssetId(),
+ [this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); });
+}
+
/* virtual */
BOOL LLFloaterEditExtDayCycle::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent)
{
- LL_DEBUGS("LAPRAS") << "Key: " << key << " mask: " << mask << LL_ENDL;
if (mask == MASK_SHIFT && mShiftCopyEnabled)
{
mShiftCopyEnabled = false;
@@ -338,7 +398,6 @@ BOOL LLFloaterEditExtDayCycle::handleKeyUp(KEY key, MASK mask, BOOL called_from_
keymap_t::iterator it = mSliderKeyMap.find(curslider);
if (it != mSliderKeyMap.end())
{
- LL_DEBUGS("LAPRAS") << "Moving frame from " << (*it).second.mFrame << " to " << sliderpos << LL_ENDL;
if (mEditDay->moveTrackKeyframe(mCurrentTrack, (*it).second.mFrame, sliderpos))
{
(*it).second.mFrame = sliderpos;
@@ -350,7 +409,7 @@ BOOL LLFloaterEditExtDayCycle::handleKeyUp(KEY key, MASK mask, BOOL called_from_
}
else
{
- LL_WARNS("LAPRAS") << "Failed to find frame " << sliderpos << " for slider " << curslider << LL_ENDL;
+ LL_WARNS("ENVDAYEDIT") << "Failed to find frame " << sliderpos << " for slider " << curslider << LL_ENDL;
}
}
}
@@ -376,9 +435,13 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data)
{
doApplyEnvironment(ctrl_action);
}
+ else if (ctrl_action == ACTION_COMMIT)
+ {
+ doApplyCommit();
+ }
else
{
- LL_WARNS("ENVIRONMENT") << "Unknown settings action '" << ctrl_action << "'" << LL_ENDL;
+ LL_WARNS("ENVDAYEDIT") << "Unknown settings action '" << ctrl_action << "'" << LL_ENDL;
}
}
@@ -410,7 +473,7 @@ void LLFloaterEditExtDayCycle::onAddTrack()
LLSettingsBase::ptr_t setting;
if ((mEditDay->getSettingsNearKeyframe(frame, mCurrentTrack, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)).second)
{
- LL_WARNS("ENVIRONMENT") << "Attempt to add new frame too close to existing frame." << LL_ENDL;
+ LL_WARNS("ENVDAYEDIT") << "Attempt to add new frame too close to existing frame." << LL_ENDL;
return;
}
@@ -487,11 +550,8 @@ void LLFloaterEditExtDayCycle::onPlayActionCallback(const LLSD& user_data)
void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data)
{
- //LL_WARNS("LAPRAS") << "LLFloaterEditExtDayCycle::onFrameSliderCallback(" << data << ")" << LL_ENDL;
-
std::string curslider = mFramesSlider->getCurSlider();
- LL_WARNS("LAPRAS") << "Current slider set to \"" << curslider << "\"" << LL_ENDL;
F32 sliderpos(0.0);
@@ -515,7 +575,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data)
// handleKeyUp will do the move if user releases key too early.
if (!(mEditDay->getSettingsNearKeyframe(sliderpos, mCurrentTrack, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)).second)
{
- LL_DEBUGS() << "Copying frame from " << it->second.mFrame << " to " << sliderpos << LL_ENDL;
+ LL_DEBUGS("ENVDAYEDIT") << "Copying frame from " << it->second.mFrame << " to " << sliderpos << LL_ENDL;
LLSettingsBase::ptr_t new_settings;
// mEditDay still remembers old position, add copy at new position
@@ -543,7 +603,6 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data)
}
else
{
- LL_WARNS("LAPRAS") << "Moving frame from " << (*it).second.mFrame << " to " << sliderpos << LL_ENDL;
if (mEditDay->moveTrackKeyframe(mCurrentTrack, (*it).second.mFrame, sliderpos))
{
(*it).second.mFrame = sliderpos;
@@ -583,21 +642,17 @@ void LLFloaterEditExtDayCycle::onFrameSliderMouseDown(S32 x, S32 y, MASK mask)
{
F32 sliderval = mFramesSlider->getSliderValue(slidername);
- LL_WARNS("LAPRAS") << "Selected vs mouse delta = " << (sliderval - sliderpos) << LL_ENDL;
-
if (fabs(sliderval - sliderpos) > LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR)
{
mFramesSlider->resetCurSlider();
}
}
- LL_WARNS("LAPRAS") << "DOWN: X=" << x << " Y=" << y << " MASK=" << mask << " Position=" << sliderpos << LL_ENDL;
}
void LLFloaterEditExtDayCycle::onFrameSliderMouseUp(S32 x, S32 y, MASK mask)
{
F32 sliderpos = mFramesSlider->getSliderValueFromX(x);
- LL_WARNS("LAPRAS") << " UP: X=" << x << " Y=" << y << " MASK=" << mask << " Position=" << sliderpos << LL_ENDL;
mTimeSlider->setCurSliderValue(sliderpos);
selectFrame(sliderpos, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR);
}
@@ -850,7 +905,7 @@ void LLFloaterEditExtDayCycle::removeCurrentSliderFrame()
keymap_t::iterator iter = mSliderKeyMap.find(sldr);
if (iter != mSliderKeyMap.end())
{
- LL_DEBUGS() << "Removing frame from " << iter->second.mFrame << LL_ENDL;
+ LL_DEBUGS("ENVDAYEDIT") << "Removing frame from " << iter->second.mFrame << LL_ENDL;
LLSettingsBase::Seconds seconds(iter->second.mFrame);
mEditDay->removeTrackKeyframe(mCurrentTrack, seconds);
mSliderKeyMap.erase(iter);
@@ -872,19 +927,19 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId)
{
if (inventoryId.isNull())
{
- LL_WARNS("ENVIRONMENT") << "Attempt to load NULL inventory ID" << LL_ENDL;
+ LL_WARNS("ENVDAYEDIT") << "Attempt to load NULL inventory ID" << LL_ENDL;
mInventoryItem = nullptr;
mInventoryId.setNull();
return;
}
mInventoryId = inventoryId;
- LL_INFOS("ENVIRONMENT") << "Setting edit inventory item to " << mInventoryId << "." << LL_ENDL;
+ LL_INFOS("ENVDAYEDIT") << "Setting edit inventory item to " << mInventoryId << "." << LL_ENDL;
mInventoryItem = gInventory.getItem(mInventoryId);
if (!mInventoryItem)
{
- LL_WARNS("ENVIRONMENT") << "Could not find inventory item with Id = " << mInventoryId << LL_ENDL;
+ LL_WARNS("ENVDAYEDIT") << "Could not find inventory item with Id = " << mInventoryId << LL_ENDL;
LLNotificationsUtil::add("CantFindInvItem");
closeFloater();
@@ -895,7 +950,7 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId)
if (mInventoryItem->getAssetUUID().isNull())
{
- LL_WARNS("ENVIRONMENT") << "Asset ID in inventory item is NULL (" << mInventoryId << ")" << LL_ENDL;
+ LL_WARNS("ENVDAYEDIT") << "Asset ID in inventory item is NULL (" << mInventoryId << ")" << LL_ENDL;
LLNotificationsUtil::add("UnableEditItem");
closeFloater();
@@ -919,40 +974,8 @@ void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::pt
closeFloater();
return;
}
- mEditDay = std::dynamic_pointer_cast<LLSettingsDay>(settings)->buildDeepCloneAndUncompress();
- updateEditEnvironment();
- LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_INSTANT);
- LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_INSTANT);
- synchronizeTabs();
- updateTabs();
- refresh();
-}
-
-void LLFloaterEditExtDayCycle::loadLiveEnvironment(LLEnvironment::EnvSelection_t env)
-{
- for (S32 idx = static_cast<S32>(env); idx <= LLEnvironment::ENV_DEFAULT; ++idx)
- {
- LLSettingsDay::ptr_t day = LLEnvironment::instance().getEnvironmentDay(static_cast<LLEnvironment::EnvSelection_t>(idx));
-
- if (day)
- {
- mEditDay = day->buildDeepCloneAndUncompress();
- break;
- }
- }
- if (!mEditDay)
- {
- LL_WARNS("ENVIRONMENT") << "Unable to load environment " << env << " building default." << LL_ENDL;
- mEditDay = LLSettingsVODay::buildDefaultDayCycle();
- }
-
- updateEditEnvironment();
- LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT, LLEnvironment::TRANSITION_INSTANT);
- LLEnvironment::instance().updateEnvironment(LLEnvironment::TRANSITION_INSTANT);
- synchronizeTabs();
- updateTabs();
- refresh();
+ setEditDayCycle(std::dynamic_pointer_cast<LLSettingsDay>(settings));
}
void LLFloaterEditExtDayCycle::updateEditEnvironment(void)
@@ -1114,7 +1137,7 @@ void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where)
if ((!parcel) || (parcel->getLocalID() == INVALID_PARCEL_ID))
{
- LL_WARNS("ENVIRONMENT") << "Can not identify parcel. Not applying." << LL_ENDL;
+ LL_WARNS("ENVDAYEDIT") << "Can not identify parcel. Not applying." << LL_ENDL;
LLNotificationsUtil::add("WLParcelApplyFail");
return;
}
@@ -1127,15 +1150,25 @@ void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where)
}
else
{
- LL_WARNS("ENVIRONMENT") << "Unknown apply '" << where << "'" << LL_ENDL;
+ LL_WARNS("ENVDAYEDIT") << "Unknown apply '" << where << "'" << LL_ENDL;
return;
}
}
+void LLFloaterEditExtDayCycle::doApplyCommit()
+{
+ if (!mCommitSignal.empty())
+ {
+ mCommitSignal(mEditDay->buildClone());
+
+ closeFloater();
+ }
+}
+
void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results)
{
- LL_INFOS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL;
+ LL_INFOS("ENVDAYEDIT") << "Inventory item " << inventory_id << " has been created with asset " << asset_id << " results are:" << results << LL_ENDL;
if (inventory_id.isNull() || !results["success"].asBoolean())
{
@@ -1149,7 +1182,7 @@ void LLFloaterEditExtDayCycle::onInventoryCreated(LLUUID asset_id, LLUUID invent
void LLFloaterEditExtDayCycle::onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results)
{
- LL_WARNS("ENVIRONMENT") << "Inventory item " << inventory_id << " has been updated with asset " << asset_id << " results are:" << results << LL_ENDL;
+ LL_WARNS("ENVDAYEDIT") << "Inventory item " << inventory_id << " has been updated with asset " << asset_id << " results are:" << results << LL_ENDL;
if (inventory_id != mInventoryId)
{
@@ -1175,12 +1208,8 @@ void LLFloaterEditExtDayCycle::doImportFromDisk()
return;
}
- mEditDay = legacyday;
mCurrentTrack = 1;
- updateSlider();
- updateEditEnvironment();
- synchronizeTabs();
- refresh();
+ setEditDayCycle(legacyday);
}
}
@@ -1273,6 +1302,7 @@ void LLFloaterEditExtDayCycle::doOpenInventoryFloater(LLSettingsType::type_e typ
}
picker->setSettingsFilter(type);
+ picker->setSettingsAssetId(currasset);
picker->openFloater();
picker->setFocus(TRUE);
}
@@ -1300,7 +1330,7 @@ void LLFloaterEditExtDayCycle::onAssetLoadedForFrame(LLUUID asset_id, LLSettings
{
if (!settings || status)
{
- LL_WARNS("ENVIRONMENT") << "Could not load asset " << asset_id << " into frame. status=" << status << LL_ENDL;
+ LL_WARNS("ENVDAYEDIT") << "Could not load asset " << asset_id << " into frame. status=" << status << LL_ENDL;
return;
}
diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h
index 83506ba85f..7d0489f0bc 100644
--- a/indra/newview/llfloatereditextdaycycle.h
+++ b/indra/newview/llfloatereditextdaycycle.h
@@ -54,11 +54,20 @@ class LLFloaterEditExtDayCycle : public LLFloater
LOG_CLASS(LLFloaterEditExtDayCycle);
public:
- // **RIDER**
static const std::string KEY_INVENTORY_ID;
- static const std::string KEY_LIVE_ENVIRONMENT;
+ static const std::string KEY_EDIT_CONTEXT;
static const std::string KEY_DAY_LENGTH;
- // **RIDER**
+
+ static const std::string VALUE_CONTEXT_INVENTORY;
+ static const std::string VALUE_CONTEXT_PARCEL;
+ static const std::string VALUE_CONTEXT_REGION;
+
+ enum edit_context_t {
+ CONTEXT_UNKNOWN,
+ CONTEXT_INVENTORY,
+ CONTEXT_PARCEL,
+ CONTEXT_REGION
+ };
typedef boost::signals2::signal<void(LLSettingsDay::ptr_t)> edit_commit_signal_t;
typedef boost::signals2::connection connection_t;
@@ -77,7 +86,10 @@ public:
virtual void refresh() override;
- BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override;
+ void setEditDayCycle(const LLSettingsDay::ptr_t &pday);
+ void setEditDefaultDayCycle();
+
+ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override;
private:
@@ -117,12 +129,12 @@ private:
void loadInventoryItem(const LLUUID &inventoryId);
void onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status);
- void loadLiveEnvironment(LLEnvironment::EnvSelection_t env);
void doImportFromDisk();
void doApplyCreateNewInventory();
void doApplyUpdateInventory();
void doApplyEnvironment(const std::string &where);
+ void doApplyCommit();
void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results);
void onInventoryUpdated(LLUUID asset_id, LLUUID inventory_id, LLSD results);
@@ -181,6 +193,8 @@ private:
edit_commit_signal_t mCommitSignal;
+ edit_context_t mEditContext;
+
// For map of sliders to parameters
class FrameData
{
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 995b5aaffc..91f755e71b 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -145,15 +145,17 @@ class LLPanelLandEnvironment
: public LLPanelEnvironmentInfo
{
public:
- LLPanelLandEnvironment(LLSafeHandle<LLParcelSelection>& parcelp);
+ LLPanelLandEnvironment(LLSafeHandle<LLParcelSelection>& parcelp);
- virtual BOOL postBuild();
- virtual void refresh();
+ virtual bool isRegion() const override { return false; }
-protected:
+ virtual BOOL postBuild() override;
+ virtual void refresh() override;
- virtual void doApply();
+ virtual LLParcel * getParcel() override;
+ virtual bool canEdit() override;
+protected:
LLSafeHandle<LLParcelSelection>& mParcel;
@@ -3257,88 +3259,47 @@ BOOL LLPanelLandEnvironment::postBuild()
if (!LLPanelEnvironmentInfo::postBuild())
return FALSE;
- mAllowOverRide->setVisible(FALSE);
+ getChild<LLUICtrl>(RDO_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION));
+ getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(FALSE);
return TRUE;
}
void LLPanelLandEnvironment::refresh()
{
- /*TODO: if legacy don't do any of this.*/
+ if (gDisconnected)
+ return;
- LLParcel* parcel = mParcel->getParcel();
+ LLParcel *parcel = getParcel();
if (!parcel)
{
- mRegionSettingsRadioGroup->setEnabled(FALSE);
- mDayLengthSlider->setEnabled(FALSE);
- mDayOffsetSlider->setEnabled(FALSE);
- mAllowOverRide->setEnabled(FALSE);
-
+ LL_INFOS("ENVPANEL") << "No parcel selected." << LL_ENDL;
+ mCurrentEnvironment.reset();
+ mCurrentParcelId = INVALID_PARCEL_ID;
+ setControlsEnabled(false);
return;
}
- //BOOL owner_or_god = gAgent.isGodlike() || (parcel owner or group)
- BOOL owner_or_god = true;
- //BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager());
-
- F64Hours daylength;
- F64Hours dayoffset;
-
- LLEnvironment::EnvSelection_t env = LLEnvironment::ENV_PARCEL;
-
- if (!LLEnvironment::instance().hasEnvironment(env))
- env = LLEnvironment::ENV_REGION;
-
- daylength = LLEnvironment::instance().getEnvironmentDayLength(env);
- dayoffset = LLEnvironment::instance().getEnvironmentDayOffset(env);
-
- LLSettingsDay::ptr_t pday = LLEnvironment::instance().getEnvironmentDay(env);
-
- mEditingDayCycle = pday->buildClone();
-
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mEditingDayCycle, daylength, dayoffset);
-
- if (dayoffset.value() > 12.0)
- dayoffset = dayoffset - F32Hours(24.0f);
-
- mDayLengthSlider->setValue(daylength.value());
- mDayOffsetSlider->setValue(dayoffset.value());
-
- //mRegionSettingsRadioGroup->setSelectedIndex(parcel->getUsesDefaultDayCycle() ? 0 : 1);
- mRegionSettingsRadioGroup->setSelectedIndex(1);
-
- setControlsEnabled(owner_or_god);
-
-}
-
-void LLPanelLandEnvironment::doApply()
-{
- LLParcel* parcel = mParcel->getParcel();
- if (!parcel)
+ if ((!mCurrentEnvironment) || (mCurrentEnvironment->mParcelId != parcel->getLocalID()))
{
- LL_WARNS("PARCEL") << "Could not get parcel." << LL_ENDL;
+ mCurrentParcelId = parcel->getLocalID();
+ refreshFromSource();
return;
}
- S32 parcel_id = parcel->getLocalID();
- if (mRegionSettingsRadioGroup->getSelectedIndex() == 0)
- {
- LLEnvironment::instance().resetParcel(parcel_id);
- }
- else
- {
- LLSettingsDay::Seconds daylength;
- F32Hours dayoffset_h;
+ LLPanelEnvironmentInfo::refresh();
- daylength = F32Hours(mDayLengthSlider->getValueF32());
- dayoffset_h = F32Hours(mDayOffsetSlider->getValueF32());
+}
- if (dayoffset_h.value() < 0)
- {
- dayoffset_h = F32Hours(24.0f) + dayoffset_h;
- }
+LLParcel *LLPanelLandEnvironment::getParcel()
+{
+ return mParcel->getParcel();
+}
- LLSettingsDay::Seconds dayoffset_s = dayoffset_h;
- LLEnvironment::instance().updateParcel(parcel_id, mEditingDayCycle, daylength.value(), dayoffset_s.value());
- }
+bool LLPanelLandEnvironment::canEdit()
+{
+ LLParcel *parcel = getParcel();
+ if (!parcel)
+ return false;
+ return LLEnvironment::instance().canAgentUpdateParcelEnvironment(parcel);
}
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 5112ff11bf..11bbd2c6fa 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -179,23 +179,32 @@ void unpack_request_params(
class LLPanelRegionEnvironment : public LLPanelEnvironmentInfo
{
public:
- LLPanelRegionEnvironment();
+ LLPanelRegionEnvironment();
- void refresh();
+ virtual void refresh() override;
- bool refreshFromRegion(LLViewerRegion* region);
- void refreshFromEstate();
+ virtual bool isRegion() const override { return true; }
+ virtual LLParcel * getParcel() override { return nullptr; }
+ virtual bool canEdit() override { return LLEnvironment::instance().canAgentUpdateRegionEnvironment(); }
- virtual BOOL postBuild();
+ bool refreshFromRegion(LLViewerRegion* region);
+ void refreshFromEstate();
+
+ virtual BOOL postBuild() override;
protected:
- virtual void doApply();
+ static const U32 DIRTY_FLAG_OVERRIDE;
+
+ virtual void doApply() override;
+
- virtual void doEditCommited(LLSettingsDay::ptr_t &newday);
- BOOL sendUpdate();
+ bool doUpdateEstate(const LLSD& notification, const LLSD& response);
+
+ void onChkAllowOverride(bool value);
private:
- LLViewerRegion * mLastRegion;
+ bool mAllowOverride;
+
};
@@ -246,6 +255,7 @@ BOOL LLFloaterRegionInfo::postBuild()
mEnvironmentPanel = new LLPanelRegionEnvironment;
mEnvironmentPanel->buildFromFile("panel_region_environment.xml");
+// mEnvironmentPanel->configureForRegion();
mTab->addTabPanel(mEnvironmentPanel);
panel = new LLPanelRegionDebugInfo;
@@ -3366,9 +3376,11 @@ void LLPanelRegionExperiences::itemChanged( U32 event_type, const LLUUID& id )
}
//=========================================================================
+const U32 LLPanelRegionEnvironment::DIRTY_FLAG_OVERRIDE(0x01 << 3);
+
LLPanelRegionEnvironment::LLPanelRegionEnvironment():
LLPanelEnvironmentInfo(),
- mLastRegion(NULL)
+ mAllowOverride(false)
{
LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
estate_info.setCommitCallback(boost::bind(&LLPanelRegionEnvironment::refreshFromEstate, this));
@@ -3381,48 +3393,31 @@ BOOL LLPanelRegionEnvironment::postBuild()
if (!LLPanelEnvironmentInfo::postBuild())
return FALSE;
+ getChild<LLUICtrl>(RDO_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT));
+ getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(TRUE);
+
+ getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setCommitCallback([this](LLUICtrl *, const LLSD &value){ onChkAllowOverride(value.asBoolean()); });
return TRUE;
}
void LLPanelRegionEnvironment::refresh()
{
- refreshFromRegion(mLastRegion);
+ if (!mCurrentEnvironment)
+ {
+ refreshFromSource();
+ return;
+ }
+
refreshFromEstate();
+ LLPanelEnvironmentInfo::refresh();
+
+ getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setValue(mAllowOverride);
}
bool LLPanelRegionEnvironment::refreshFromRegion(LLViewerRegion* region)
{
- BOOL owner_or_god = gAgent.isGodlike() || (region && (region->getOwner() == gAgent.getID()));
- BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager());
-
- F64Hours daylength;
- F64Hours dayoffset;
-
- daylength = LLEnvironment::instance().getEnvironmentDayLength(LLEnvironment::ENV_REGION);
- dayoffset = LLEnvironment::instance().getEnvironmentDayOffset(LLEnvironment::ENV_REGION);
-
- if (dayoffset.value() > 12.0)
- dayoffset = dayoffset - F64Hours(24.0f);
-
- mDayLengthSlider->setValue(daylength.value());
- mDayOffsetSlider->setValue(dayoffset.value());
-
- setControlsEnabled(owner_or_god_or_manager);
- mLastRegion = region;
-
- LLSettingsDay::ptr_t pday = LLEnvironment::instance().getEnvironmentDay(LLEnvironment::ENV_REGION);
-
- if (pday)
- {
- mRegionSettingsRadioGroup->setSelectedIndex((pday->getAssetId() == LLSettingsDay::GetDefaultAssetId()) ? 0 : 1);
- mEditingDayCycle = std::static_pointer_cast<LLSettingsDay>(pday->buildDerivedClone());
- }
- else
- {
- mRegionSettingsRadioGroup->setSelectedIndex(1);
- }
-
+ refreshFromSource();
return true;
}
@@ -3430,56 +3425,65 @@ void LLPanelRegionEnvironment::refreshFromEstate()
{
const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
- getChild<LLUICtrl>("allow_override_chk")->setValue(estate_info.getAllowEnvironmentOverride());
-
+ mAllowOverride = estate_info.getAllowEnvironmentOverride();
}
void LLPanelRegionEnvironment::doApply()
{
- if (mRegionSettingsRadioGroup->getSelectedIndex() == 0)
- {
- LLEnvironment::instance().resetRegion();
- }
- else
- {
- LLSettingsDay::Seconds daylength;
- F32Hours dayoffset_h;
+ LLPanelEnvironmentInfo::doApply();
- daylength = F32Hours(mDayLengthSlider->getValueF32());
- dayoffset_h = F32Hours(mDayOffsetSlider->getValueF32());
+ if (getIsDirtyFlag(DIRTY_FLAG_OVERRIDE))
+ {
+ LLNotification::Params params("ChangeLindenEstate");
+ //params.functor.function(boost::bind(&LLPanelEstateInfo::doUpdateEstate, this, _1, _2));
+ params.functor.function([this](const LLSD& notification, const LLSD& response) { doUpdateEstate(notification, response); });
- if (dayoffset_h.value() < 0)
+ if (LLPanelEstateInfo::isLindenEstate())
{
- dayoffset_h = F32Hours(24.0f) + dayoffset_h;
+ // trying to change reserved estate, warn
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ // for normal estates, just make the change
+ LLNotifications::instance().forceResponse(params, 0);
}
- LLSettingsDay::Seconds dayoffset_s = dayoffset_h;
-
- LLEnvironment::instance().updateRegion(mEditingDayCycle, daylength.value(), dayoffset_s.value());
}
}
-void LLPanelRegionEnvironment::doEditCommited(LLSettingsDay::ptr_t &newday)
+bool LLPanelRegionEnvironment::doUpdateEstate(const LLSD& notification, const LLSD& response)
{
- mEditingDayCycle = newday;
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ switch (option)
+ {
+ case 0:
+ {
+ LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
+
+ // update model
+ estate_info.setAllowEnvironmentOverride(mAllowOverride);
+ // send the update to sim
+ estate_info.sendEstateInfo();
+ clearDirtyFlag(DIRTY_FLAG_OVERRIDE);
+ }
+ break;
+
+ case 1:
+ default:
+ break;
+ }
+ return false;
}
-BOOL LLPanelRegionEnvironment::sendUpdate()
+void LLPanelRegionEnvironment::onChkAllowOverride(bool value)
{
-// LL_INFOS() << "LLPanelEsateInfo::sendUpdate()" << LL_ENDL;
-//
-// LLNotification::Params params("ChangeLindenEstate");
-// params.functor.function(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2));
-//
-// if (isLindenEstate())
-// {
-// // trying to change reserved estate, warn
-// LLNotifications::instance().add(params);
-// }
-// else
-// {
-// // for normal estates, just make the change
-// LLNotifications::instance().forceResponse(params, 0);
-// }
- return TRUE;
+ if (!value)
+ {
+ LLNotificationsUtil::add("EstateParcelEnvironmentOverride");
+ }
+
+ setDirtyFlag(DIRTY_FLAG_OVERRIDE);
+ mAllowOverride = value;
}
diff --git a/indra/newview/llflyoutcombobtn.cpp b/indra/newview/llflyoutcombobtn.cpp
index a736fcafa3..d1a8b46c92 100644
--- a/indra/newview/llflyoutcombobtn.cpp
+++ b/indra/newview/llflyoutcombobtn.cpp
@@ -100,6 +100,11 @@ void LLFlyoutComboBtnCtrl::setShownBtnEnabled(bool enabled)
mParent->getChildView(mActionButton)->setEnabled(enabled);
}
+void LLFlyoutComboBtnCtrl::setMenuItemVisible(const std::string &item, bool visible)
+{
+ mFlyoutMenu->setItemVisible(item, visible);
+}
+
void LLFlyoutComboBtnCtrl::onFlyoutButton(LLUICtrl *ctrl, const LLSD &data)
{
S32 x, y;
diff --git a/indra/newview/llflyoutcombobtn.h b/indra/newview/llflyoutcombobtn.h
index 517752d8db..741ad03a37 100644
--- a/indra/newview/llflyoutcombobtn.h
+++ b/indra/newview/llflyoutcombobtn.h
@@ -41,6 +41,7 @@ public:
void setMenuItemEnabled(const std::string &item, bool enabled);
void setShownBtnEnabled(bool enabled);
+ void setMenuItemVisible(const std::string &item, bool visible);
U32 getItemCount();
void setSelectedItem(S32 itemno);
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 85e2974c1b..138ce9e1cf 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -7389,7 +7389,7 @@ public:
LLFloaterReg::showInstance("env_fixed_environmentent_water", LLSDMap("inventory_id", item->getUUID()), TAKE_FOCUS_YES);
break;
case LLSettingsType::ST_DAYCYCLE:
- LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("inventory_id", item->getUUID()), TAKE_FOCUS_YES);
+ LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("inventory_id", item->getUUID())("edit_context", "inventory"), TAKE_FOCUS_YES);
break;
default:
break;
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index ebe3da79f2..6de17cbee9 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -31,6 +31,7 @@
#include "lluictrlfactory.h"
#include "llexperiencecache.h"
#include "llagent.h"
+#include "llparcel.h"
#include "llviewerregion.h"
#include "llpanelenvironment.h"
@@ -40,31 +41,65 @@
#include "llfloater.h"
#include "llfloaterreg.h"
#include "llfloatereditextdaycycle.h"
+#include "llsettingsvo.h"
-//static LLPanelInjector<LLPanelEnvironmentInfo> register_environment_panel("environment_panel");
+#include "llappviewer.h"
+#include "llcallbacklist.h"
+//=========================================================================
+namespace
+{
+ const std::string FLOATER_DAY_CYCLE_EDIT("env_edit_extdaycycle");
+}
+
+//=========================================================================
+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::SLD_DAYLENGTH("sld_day_length");
+const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset");
+const std::string LLPanelEnvironmentInfo::CHK_ALLOWOVERRIDE("chk_allow_override");
+const std::string LLPanelEnvironmentInfo::BTN_APPLY("btn_apply");
+const std::string LLPanelEnvironmentInfo::BTN_CANCEL("btn_cancel");
+const std::string LLPanelEnvironmentInfo::LBL_TIMEOFDAY("lbl_apparent_time");
+
+const std::string LLPanelEnvironmentInfo::STR_LABEL_USEDEFAULT("str_label_use_default");
+const std::string LLPanelEnvironmentInfo::STR_LABEL_USEREGION("str_label_use_region");
+const std::string LLPanelEnvironmentInfo::STR_LABEL_UNKNOWNINV("str_unknow_inventory");
+
+const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE(0x01 << 0);
+const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH(0x01 << 1);
+const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET(0x01 << 2);
+
+const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK(
+ LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE |
+ LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH |
+ LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET );
+
+//=========================================================================
LLPanelEnvironmentInfo::LLPanelEnvironmentInfo():
- mEnableEditing(false),
- mRegionSettingsRadioGroup(NULL),
- mDayLengthSlider(NULL),
- mDayOffsetSlider(NULL),
- mAllowOverRide(NULL)
+ mCurrentEnvironment(),
+ mCurrentParcelId(INVALID_PARCEL_ID),
+ mDirtyFlag(0),
+ mSettingsFloater(),
+ mEditFloater()
{
}
-// virtual
BOOL LLPanelEnvironmentInfo::postBuild()
{
- mRegionSettingsRadioGroup = getChild<LLRadioGroup>("environment_select_radio_group");
- mRegionSettingsRadioGroup->setCommitCallback(boost::bind(&LLPanelEnvironmentInfo::onSwitchDefaultSelection, this));
-
- mDayLengthSlider = getChild<LLSliderCtrl>("day_length_sld");
- mDayOffsetSlider = getChild<LLSliderCtrl>("day_offset_sld");
- mAllowOverRide = getChild<LLCheckBoxCtrl>("allow_override_chk");
+ getChild<LLUICtrl>(RDG_ENVIRONMENT_SELECT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onSwitchDefaultSelection(); });
+ 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(); });
- childSetCommitCallback("edit_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnEdit, this), NULL);
- childSetCommitCallback("apply_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnApply, this), NULL);
- childSetCommitCallback("cancel_btn", boost::bind(&LLPanelEnvironmentInfo::onBtnCancel, this), NULL);
+ getChild<LLUICtrl>(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged(value.asReal()); });
+ getChild<LLUICtrl>(SLD_DAYOFFSET)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged(value.asReal()); });
return TRUE;
}
@@ -72,68 +107,141 @@ BOOL LLPanelEnvironmentInfo::postBuild()
// virtual
void LLPanelEnvironmentInfo::onOpen(const LLSD& key)
{
- LL_DEBUGS("Windlight") << "Panel opened, refreshing" << LL_ENDL;
- refresh();
+ refreshFromSource();
}
// virtual
void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility)
{
- // If hiding (user switched to another tab or closed the floater),
- // display user's preferred environment.
- // switching back and forth between agent's environment and the one being edited.
- //
+ if (new_visibility)
+ gIdleCallbacks.addFunction(onIdlePlay, this);
+ else
+ gIdleCallbacks.deleteFunction(onIdlePlay, this);
+
}
void LLPanelEnvironmentInfo::refresh()
{
-#if 0
if (gDisconnected)
- {
return;
+
+ if ((!mCurrentEnvironment->mDayCycle) ||
+ ((mCurrentEnvironment->mParcelId == INVALID_PARCEL_ID) && (mCurrentEnvironment->mDayCycle->getAssetId() == LLSettingsDay::GetDefaultAssetId() )))
+ {
+ getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(0);
+ getChild<LLUICtrl>(EDT_INVNAME)->setValue("");
+ }
+ else if (!mCurrentEnvironment->mDayCycle->getAssetId().isNull())
+ {
+ getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(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
+ getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->setSelectedIndex(2);
+ getChild<LLUICtrl>(EDT_INVNAME)->setValue("");
}
- populateWaterPresetsList();
- populateSkyPresetsList();
- populateDayCyclesList();
+ F32Hours daylength(mCurrentEnvironment->mDayLength);
+ F32Hours dayoffset(mCurrentEnvironment->mDayOffset);
- // Init radio groups.
- const LLEnvironmentSettings& settings = LLEnvManagerNew::instance().getRegionSettings();
- const LLSD& dc = settings.getWLDayCycle();
- LLSD::Real first_frame_time = dc.size() > 0 ? dc[0][0].asReal() : 0.0f;
- const bool use_fixed_sky = dc.size() == 1 && first_frame_time < 0;
- mRegionSettingsRadioGroup->setSelectedIndex(settings.getSkyMap().size() == 0 ? 0 : 1);
- mDayCycleSettingsRadioGroup->setSelectedIndex(use_fixed_sky ? 0 : 1);
+ if (dayoffset.value() > 8.0f)
+ dayoffset -= F32Hours(24.0);
- setControlsEnabled(mEnableEditing);
+ getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setValue(daylength.value());
+ getChild<LLSliderCtrl>(SLD_DAYOFFSET)->setValue(dayoffset.value());
+
+ udpateApparentTimeOfDay();
- setDirty(false);
-#endif
+ setControlsEnabled(canEdit());
}
-void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
+void LLPanelEnvironmentInfo::refreshFromSource()
+{
+ LLEnvironment::instance().requestParcel(mCurrentParcelId,
+ [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
+}
+
+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));
+
+ if (name.empty())
+ return getString(STR_LABEL_UNKNOWNINV);
+ return name;
+}
+
+LLFloaterSettingsPicker *LLPanelEnvironmentInfo::getSettingsPicker()
{
- mRegionSettingsRadioGroup->setEnabled(enabled);
+ LLFloaterSettingsPicker *picker = static_cast<LLFloaterSettingsPicker *>(mSettingsFloater.get());
+
+ // Show the dialog
+ if (!picker)
+ {
+ picker = new LLFloaterSettingsPicker(this,
+ LLUUID::null, "SELECT SETTINGS");
- mDayLengthSlider->setEnabled(false);
- mDayOffsetSlider->setEnabled(false);
- mAllowOverRide->setEnabled(enabled);
+ mSettingsFloater = picker->getHandle();
- getChildView("edit_btn")->setEnabled(false);
+ picker->setCommitCallback([this](LLUICtrl *, const LLSD &data){ onPickerCommited(data.asUUID()); });
+ }
- getChildView("apply_btn")->setEnabled(enabled);
- getChildView("cancel_btn")->setEnabled(enabled);
+ return picker;
+}
- if (enabled)
+LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater()
+{
+ static const S32 FOURHOURS(4 * 60 * 60);
+ LLFloaterEditExtDayCycle *editor = static_cast<LLFloaterEditExtDayCycle *>(mEditFloater.get());
+
+ // Show the dialog
+ if (!editor)
{
- // Enable/disable some controls based on currently selected radio buttons.
- bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
- getChild<LLView>("edit_btn")->setEnabled(!use_defaults);
+ LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::CONTEXT_REGION : LLFloaterEditExtDayCycle::CONTEXT_PARCEL)
+ (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mCurrentEnvironment ? (S32)(mCurrentEnvironment->mDayLength.value()) : FOURHOURS));
- mDayLengthSlider->setEnabled(!use_defaults);
- mDayOffsetSlider->setEnabled(!use_defaults);
+ editor = (LLFloaterEditExtDayCycle *)LLFloaterReg::getInstance(FLOATER_DAY_CYCLE_EDIT, params);
+ if (!editor)
+ return nullptr;
+ editor->setEditCommitSignal([this](LLSettingsDay::ptr_t pday) { onEditCommited(pday); });
}
+
+ return editor;
+}
+
+void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
+{
+ S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex();
+
+ getChild<LLUICtrl>(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled);
+ getChild<LLUICtrl>(RDO_USEDEFAULT)->setEnabled(enabled);
+ getChild<LLUICtrl>(RDO_USEINV)->setEnabled(enabled);
+ getChild<LLUICtrl>(RDO_USECUSTOM)->setEnabled(enabled);
+ getChild<LLUICtrl>(EDT_INVNAME)->setEnabled(FALSE);
+ getChild<LLUICtrl>(BTN_SELECTINV)->setEnabled(enabled);
+ getChild<LLUICtrl>(BTN_EDIT)->setEnabled(enabled);
+ getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0));
+ getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0));
+ getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(enabled && (mCurrentParcelId == INVALID_PARCEL_ID));
+ getChild<LLUICtrl>(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0));
+ getChild<LLUICtrl>(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0));
}
void LLPanelEnvironmentInfo::setApplyProgress(bool started)
@@ -152,270 +260,210 @@ void LLPanelEnvironmentInfo::setApplyProgress(bool started)
// }
}
-void LLPanelEnvironmentInfo::setDirty(bool dirty)
+void LLPanelEnvironmentInfo::setDirtyFlag(U32 flag)
{
- getChildView("apply_btn")->setEnabled(dirty);
- getChildView("cancel_btn")->setEnabled(dirty);
+ bool can_edit = canEdit();
+ mDirtyFlag |= flag;
+ getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && can_edit);
+ getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit);
}
-// void LLPanelEnvironmentInfo::sendRegionSunUpdate()
-// {
-// #if 0
-// LLRegionInfoModel& region_info = LLRegionInfoModel::instance();
-//
-// // If the region is being switched to fixed sky,
-// // change the region's sun hour according to the (fixed) sun position.
-// // This is needed for llGetSunDirection() LSL function to work properly (STORM-1330).
-// const LLSD& sky_map = mNewRegionSettings.getSkyMap();
-// bool region_use_fixed_sky = sky_map.size() == 1;
-// if (region_use_fixed_sky)
-// {
-// LLWLParamSet param_set;
-// llassert(sky_map.isMap());
-// param_set.setAll(sky_map.beginMap()->second);
-// F32 sun_angle = param_set.getSunAngle();
-//
-// LL_DEBUGS("Windlight Sync") << "Old sun hour: " << region_info.mSunHour << LL_ENDL;
-// // convert value range from 0..2pi to 6..30
-// region_info.mSunHour = fmodf((sun_angle / F_TWO_PI) * 24.f, 24.f) + 6.f;
-// }
-//
-// region_info.setUseFixedSun(region_use_fixed_sky);
-// region_info.mUseEstateSun = !region_use_fixed_sky;
-// LL_DEBUGS("Windlight Sync") << "Sun hour: " << region_info.mSunHour << LL_ENDL;
-//
-// region_info.sendRegionTerrain(LLFloaterRegionInfo::getLastInvoice());
-// #endif
-// }
-
-// void LLPanelEnvironmentInfo::fixEstateSun()
-// {
-// // We don't support fixed sun estates anymore and need to fix
-// // such estates for region day cycle to take effect.
-// // *NOTE: Assuming that current estate settings have arrived already.
-// LLEstateInfoModel& estate_info = LLEstateInfoModel::instance();
-// if (estate_info.getUseFixedSun())
-// {
-// LL_INFOS() << "Switching estate to global sun" << LL_ENDL;
-// estate_info.setUseFixedSun(false);
-// estate_info.sendEstateInfo();
-// }
-// }
-
-// void LLPanelEnvironmentInfo::populateWaterPresetsList()
-// {
-// #if 0
-// mWaterPresetCombo->removeall();
-//
-// // If the region already has water params, add them to the list.
-// const LLEnvironmentSettings& region_settings = LLEnvManagerNew::instance().getRegionSettings();
-// if (region_settings.getWaterParams().size() != 0)
-// {
-// const std::string& region_name = gAgent.getRegion()->getName();
-// mWaterPresetCombo->add(region_name, LLWLParamKey(region_name, LLEnvKey::SCOPE_REGION).toLLSD());
-// mWaterPresetCombo->addSeparator();
-// }
-//
-// std::list<std::string> user_presets, system_presets;
-// LLWaterParamManager::instance().getPresetNames(user_presets, system_presets);
-//
-// // Add local user presets first.
-// for (std::list<std::string>::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it)
-// {
-// mWaterPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD());
-// }
-//
-// if (user_presets.size() > 0)
-// {
-// mWaterPresetCombo->addSeparator();
-// }
-//
-// // Add local system presets.
-// for (std::list<std::string>::const_iterator it = system_presets.begin(); it != system_presets.end(); ++it)
-// {
-// mWaterPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD());
-// }
-//
-// // There's no way to select current preset because its name is not stored on server.
-// #endif
-// }
-//
-// void LLPanelEnvironmentInfo::populateSkyPresetsList()
-// {
-// #if 0
-// mSkyPresetCombo->removeall();
-//
-// LLWLParamManager::preset_name_list_t region_presets;
-// LLWLParamManager::preset_name_list_t user_presets, sys_presets;
-// LLWLParamManager::instance().getPresetNames(region_presets, user_presets, sys_presets);
-//
-// // Add region presets.
-// std::string region_name = gAgent.getRegion() ? gAgent.getRegion()->getName() : LLTrans::getString("Unknown");
-// for (LLWLParamManager::preset_name_list_t::const_iterator it = region_presets.begin(); it != region_presets.end(); ++it)
-// {
-// std::string preset_name = *it;
-// std::string item_title = preset_name + " (" + region_name + ")";
-// mSkyPresetCombo->add(item_title, LLWLParamKey(preset_name, LLEnvKey::SCOPE_REGION).toStringVal());
-// }
-//
-// if (!region_presets.empty())
-// {
-// mSkyPresetCombo->addSeparator();
-// }
-//
-// // Add user presets.
-// for (LLWLParamManager::preset_name_list_t::const_iterator it = user_presets.begin(); it != user_presets.end(); ++it)
-// {
-// mSkyPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal());
-// }
-//
-// if (!user_presets.empty())
-// {
-// mSkyPresetCombo->addSeparator();
-// }
-//
-// // Add system presets.
-// for (LLWLParamManager::preset_name_list_t::const_iterator it = sys_presets.begin(); it != sys_presets.end(); ++it)
-// {
-// mSkyPresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal());
-// }
-//
-// // Select current preset.
-// LLSD sky_map = LLEnvManagerNew::instance().getRegionSettings().getSkyMap();
-// if (sky_map.size() == 1) // if the region is set to fixed sky
-// {
-// std::string preset_name = sky_map.beginMap()->first;
-// mSkyPresetCombo->selectByValue(LLWLParamKey(preset_name, LLEnvKey::SCOPE_REGION).toStringVal());
-// }
-// #endif
-// }
-//
-// void LLPanelEnvironmentInfo::populateDayCyclesList()
-// {
-// #if 0
-// mDayCyclePresetCombo->removeall();
-//
-// // If the region already has env. settings, add its day cycle to the list.
-// const LLSD& cur_region_dc = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle();
-// if (cur_region_dc.size() != 0)
-// {
-// LLViewerRegion* region = gAgent.getRegion();
-// llassert(region != NULL);
-//
-// LLWLParamKey key(region->getName(), LLEnvKey::SCOPE_REGION);
-// mDayCyclePresetCombo->add(region->getName(), key.toStringVal());
-// mDayCyclePresetCombo->addSeparator();
-// }
-//
-// // Add local user day cycles.
-// LLDayCycleManager::preset_name_list_t user_days, sys_days;
-// LLDayCycleManager::instance().getPresetNames(user_days, sys_days);
-// for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it)
-// {
-// mDayCyclePresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal());
-// }
-//
-// if (user_days.size() > 0)
-// {
-// mDayCyclePresetCombo->addSeparator();
-// }
-//
-// // Add local system day cycles.
-// for (LLDayCycleManager::preset_name_list_t::const_iterator it = sys_days.begin(); it != sys_days.end(); ++it)
-// {
-// mDayCyclePresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal());
-// }
-//
-// // Current day cycle is already selected.
-// #endif
-// }
+void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag)
+{
+ bool can_edit = canEdit();
+ mDirtyFlag &= ~flag;
+ getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && can_edit);
+ getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit);
+}
void LLPanelEnvironmentInfo::onSwitchDefaultSelection()
{
- bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0;
-
- getChild<LLView>("edit_btn")->setEnabled(!use_defaults);
+ bool can_edit = canEdit();
+ setDirtyFlag(DIRTY_FLAG_DAYCYCLE);
- mDayLengthSlider->setEnabled(!use_defaults);
- mDayOffsetSlider->setEnabled(!use_defaults);
+ 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));
+}
+
+void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value)
+{
+ F32Hours daylength(value);
- setDirty(true);
+ mCurrentEnvironment->mDayLength = daylength;
+ setDirtyFlag(DIRTY_FLAG_DAYLENGTH);
+
+ udpateApparentTimeOfDay();
}
+void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value)
+{
+ F32Hours dayoffset(value);
+
+ if (dayoffset.value() < 0.0f)
+ dayoffset += F32Hours(24.0);
+
+ mCurrentEnvironment->mDayOffset = dayoffset;
+ setDirtyFlag(DIRTY_FLAG_DAYOFFSET);
+
+ udpateApparentTimeOfDay();
+}
void LLPanelEnvironmentInfo::onBtnApply()
{
doApply();
}
-void LLPanelEnvironmentInfo::onBtnCancel()
+void LLPanelEnvironmentInfo::onBtnReset()
{
- // Reload last saved region settings.
- refresh();
+ mCurrentEnvironment.reset();
+ refreshFromSource();
}
void LLPanelEnvironmentInfo::onBtnEdit()
{
- LLFloaterEditExtDayCycle *dayeditor = (LLFloaterEditExtDayCycle *)LLFloaterReg::getInstance("env_edit_extdaycycle");
+ static const S32 FOURHOURS(4 * 60 * 60);
+
+ LLFloaterEditExtDayCycle *dayeditor = getEditFloater();
+
+ LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_EDIT_CONTEXT, (mCurrentParcelId == INVALID_PARCEL_ID) ? LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION : LLFloaterEditExtDayCycle::VALUE_CONTEXT_REGION)
+ (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mCurrentEnvironment ? (S32)(mCurrentEnvironment->mDayLength.value()) : FOURHOURS));
+
+ dayeditor->openFloater(params);
+ if (mCurrentEnvironment->mDayCycle)
+ dayeditor->setEditDayCycle(mCurrentEnvironment->mDayCycle);
+ else
+ dayeditor->setEditDefaultDayCycle();
+}
+
+void LLPanelEnvironmentInfo::onBtnSelect()
+{
+ LLFloaterSettingsPicker *picker = getSettingsPicker();
+ if (picker)
+ {
+ picker->setSettingsFilter(LLSettingsType::ST_NONE);
+ picker->setSettingsAssetId((mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getAssetId() : LLUUID::null);
+ picker->openFloater();
+ picker->setFocus(TRUE);
+ }
+}
+
+
+void LLPanelEnvironmentInfo::doApply()
+{
+ if (getIsDirtyFlag(DIRTY_FLAG_MASK))
+ {
+ S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex();
+
+ if (rdo_selection == 0)
+ {
+ LLEnvironment::instance().resetParcel(mCurrentParcelId,
+ [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
+ }
+ else if (rdo_selection == 1)
+ {
+ LLEnvironment::instance().updateParcel(mCurrentParcelId,
+ mCurrentEnvironment->mDayCycle->getAssetId(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(),
+ [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
+ }
+ else
+ {
+ LLEnvironment::instance().updateParcel(mCurrentParcelId,
+ mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(),
+ [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
+ }
+
+ setControlsEnabled(false);
+ }
+}
- if (dayeditor)
- { //*TODO Determine if region or parcel.
- LLSD params(LLSDMap(LLFloaterEditExtDayCycle::KEY_LIVE_ENVIRONMENT, "parcel")
- (LLFloaterEditExtDayCycle::KEY_DAY_LENGTH, mDayLengthSlider->getValueF32() * (60.0 * 60.0)));
- LLFloaterReg::showInstance("env_edit_extdaycycle", params, TAKE_FOCUS_YES);
+void LLPanelEnvironmentInfo::udpateApparentTimeOfDay()
+{
+ static const F32 SECONDSINDAY(24.0 * 60.0 * 60.0);
-// dayeditor->openFloater(mEditingDayCycle, F32Hours(mDayLengthSlider->getValue().asReal()), F32Hours(mDayOffsetSlider->getValue().asReal()));
+ if ((!mCurrentEnvironment) || (mCurrentEnvironment->mDayLength.value() < 1.0) || (mCurrentEnvironment->mDayOffset.value() < 1.0))
+ {
+ getChild<LLUICtrl>(LBL_TIMEOFDAY)->setVisible(false);
+ return;
}
+ getChild<LLUICtrl>(LBL_TIMEOFDAY)->setVisible(true);
+
+ S32Seconds now(LLDate::now().secondsSinceEpoch());
+
+ now += mCurrentEnvironment->mDayOffset;
+
+ F32 perc = (F32)(now.value() % mCurrentEnvironment->mDayLength.value()) / (F32)(mCurrentEnvironment->mDayLength.value());
+
+ S32Seconds secondofday((S32)(perc * SECONDSINDAY));
+ S32Hours hourofday(secondofday);
+ S32Seconds secondofhour(secondofday - hourofday);
+ S32Minutes minutesofhour(secondofhour);
+ bool am_pm(hourofday.value() >= 12);
+
+ if (hourofday.value() < 1)
+ hourofday = S32Hours(12);
+ if (hourofday.value() > 12)
+ hourofday -= S32Hours(12);
+
+ std::string lblminute(((minutesofhour.value() < 10) ? "0" : "") + LLSD(minutesofhour.value()).asString());
+
+
+ getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[HH]", LLSD(hourofday.value()).asString());
+ getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[MM]", lblminute);
+ getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[AP]", std::string(am_pm ? "PM" : "AM"));
+ getChild<LLUICtrl>(LBL_TIMEOFDAY)->setTextArg("[PRC]", LLSD((S32)(100 * perc)).asString());
+
}
-void LLPanelEnvironmentInfo::onEditiCommited(LLSettingsDay::ptr_t newday)
+void LLPanelEnvironmentInfo::onIdlePlay(void *data)
{
- doEditCommited(newday);
+ ((LLPanelEnvironmentInfo *)data)->udpateApparentTimeOfDay();
}
-void LLPanelEnvironmentInfo::doEditCommited(LLSettingsDay::ptr_t &newday)
+void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id)
{
- mEditingDayCycle = newday;
- /*TODO pure virtual*/
+ LLSettingsVOBase::getSettingsAsset(asset_id, [this](LLUUID, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) {
+ if (status)
+ return;
+ onPickerAssetDownloaded(settings);
+ });
}
-// void LLPanelEnvironmentInfo::onRegionSettingschange()
-// {
-// LL_DEBUGS("Windlight") << "Region settings changed, refreshing" << LL_ENDL;
-// refresh();
-//
-// // Stop applying progress indicator (it may be running if it's us who initiated settings update).
-// setApplyProgress(false);
-// }
-//
-// void LLPanelEnvironmentInfo::onRegionSettingsApplied(bool ok)
-// {
-// // If applying new settings has failed, stop the indicator right away.
-// // Otherwise it will be stopped when we receive the updated settings from server.
-// if (ok)
-// {
-// // Set the region sun phase/flags according to the chosen new preferences.
-// //
-// // If we do this earlier we may get jerky transition from fixed sky to a day cycle (STORM-1481).
-// // That is caused by the simulator re-sending the region info, which in turn makes us
-// // re-request and display old region environment settings while the new ones haven't been applied yet.
-// sendRegionSunUpdate();
-//
-// // Switch estate to not using fixed sun for the region day cycle to work properly (STORM-1506).
-// fixEstateSun();
-// }
-// else
-// {
-// setApplyProgress(false);
-//
-// // We need to re-request environment setting here,
-// // otherwise our subsequent attempts to change region settings will fail with the following error:
-// // "Unable to update environment settings because the last update your viewer saw was not the same
-// // as the last update sent from the simulator. Try sending your update again, and if this
-// // does not work, try leaving and returning to the region."
-// // LLEnvManagerNew::instance().requestRegionSettings();
-// }
-// }
+void LLPanelEnvironmentInfo::onEditCommited(LLSettingsDay::ptr_t newday)
+{
+ size_t newhash(newday->getHash());
+ size_t oldhash((mCurrentEnvironment->mDayCycle) ? mCurrentEnvironment->mDayCycle->getHash() : 0);
+ if (newhash != oldhash)
+ {
+ mCurrentEnvironment->mDayCycle = newday;
+ setDirtyFlag(DIRTY_FLAG_DAYCYCLE);
+ refresh();
+ }
+}
+void LLPanelEnvironmentInfo::onPickerAssetDownloaded(LLSettingsBase::ptr_t settings)
+{
+ LLSettingsVODay::buildFromOtherSetting(settings, [this](LLSettingsDay::ptr_t pday)
+ {
+ if (pday)
+ {
+ mCurrentEnvironment->mDayCycle = pday;
+ setDirtyFlag(DIRTY_FLAG_DAYCYCLE);
+ }
+ refresh();
+ });
+}
+
+void LLPanelEnvironmentInfo::onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo)
+{
+ if (parcel_id != mCurrentParcelId)
+ {
+ LL_WARNS("ENVPANEL") << "Have environment for parcel " << parcel_id << " expecting " << mCurrentParcelId << ". Discarding." << LL_ENDL;
+ return;
+ }
+ mCurrentEnvironment = envifo;
+ clearDirtyFlag(DIRTY_FLAG_MASK);
+ refresh();
+}
diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h
index 7cc7ddae6f..44e3c11a82 100644
--- a/indra/newview/llpanelenvironment.h
+++ b/indra/newview/llpanelenvironment.h
@@ -32,52 +32,103 @@
#include "llcheckboxctrl.h"
#include "llsliderctrl.h"
#include "llsettingsdaycycle.h"
+#include "llenvironment.h"
+#include "llparcel.h"
+#include "llsettingspicker.h"
+#include "llfloatereditextdaycycle.h"
class LLViewerRegion;
class LLPanelEnvironmentInfo : public LLPanel
{
public:
- LLPanelEnvironmentInfo();
+ LLPanelEnvironmentInfo();
// LLPanel
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onOpen(const LLSD& key);
+ virtual BOOL postBuild() override;
+ virtual void onOpen(const LLSD& key) override;
// LLView
- /*virtual*/ void onVisibilityChange(BOOL new_visibility);
+ virtual void onVisibilityChange(BOOL new_visibility) override;
+ virtual void refresh() override;
- virtual void refresh();
+ S32 getCurrentParcelId() const { return mCurrentParcelId; }
+ void setCurrentParcelId(S32 parcel_id) { mCurrentParcelId = parcel_id; }
+
+ virtual bool isRegion() const = 0;
+ virtual LLParcel * getParcel() = 0;
+ virtual bool canEdit() = 0;
protected:
LOG_CLASS(LLPanelEnvironmentInfo);
- void setControlsEnabled(bool enabled);
- void setApplyProgress(bool started);
- void setDirty(bool dirty);
+ 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 SLD_DAYLENGTH;
+ static const std::string SLD_DAYOFFSET;
+ static const std::string CHK_ALLOWOVERRIDE;
+ static const std::string BTN_APPLY;
+ static const std::string BTN_CANCEL;
+ static const std::string LBL_TIMEOFDAY;
+
+
+ static const std::string STR_LABEL_USEDEFAULT;
+ static const std::string STR_LABEL_USEREGION;
+ static const std::string STR_LABEL_UNKNOWNINV;
+
+ static const U32 DIRTY_FLAG_DAYCYCLE;
+ static const U32 DIRTY_FLAG_DAYLENGTH;
+ static const U32 DIRTY_FLAG_DAYOFFSET;
+
+ static const U32 DIRTY_FLAG_MASK;
+
+ void setControlsEnabled(bool enabled);
+ void setApplyProgress(bool started);
+ void setDirtyFlag(U32 flag);
+ void clearDirtyFlag(U32 flag);
+ bool getIsDirty() const { return (mDirtyFlag != 0); }
+ bool getIsDirtyFlag(U32 flag) const { return ((mDirtyFlag & flag) != 0); }
+ U32 getDirtyFlag() const { return mDirtyFlag; }
+
+ void onSwitchDefaultSelection();
+ void onSldDayLengthChanged(F32 value);
+ void onSldDayOffsetChanged(F32 value);
+ void onBtnApply();
+ void onBtnReset();
+ void onBtnEdit();
+ void onBtnSelect();
+
+ virtual void doApply();
+
+ void udpateApparentTimeOfDay();
- void onSwitchDefaultSelection();
+ void onPickerCommited(LLUUID asset_id);
+ void onEditCommited(LLSettingsDay::ptr_t newday);
+ void onPickerAssetDownloaded(LLSettingsBase::ptr_t settings);
+ void onEnvironmentReceived(S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo);
- void onBtnApply();
- void onBtnCancel();
- void onBtnEdit();
+ void refreshFromSource();
- void onEditiCommited(LLSettingsDay::ptr_t newday);
+ std::string getInventoryNameForAssetId(LLUUID asset_id);
- virtual void doApply() = 0;
- virtual void doEditCommited(LLSettingsDay::ptr_t &newday);
+ LLFloaterSettingsPicker * getSettingsPicker();
+ LLFloaterEditExtDayCycle * getEditFloater();
- /// New environment settings that are being applied to the region.
- // LLEnvironmentSettings mNewRegionSettings;
+ LLEnvironment::EnvironmentInfo::ptr_t mCurrentEnvironment;
+ S32 mCurrentParcelId;
- bool mEnableEditing;
- LLRadioGroup* mRegionSettingsRadioGroup;
- LLSliderCtrl* mDayLengthSlider;
- LLSliderCtrl* mDayOffsetSlider;
- LLCheckBoxCtrl* mAllowOverRide;
+private:
+ static void onIdlePlay(void *);
- LLSettingsDay::ptr_t mEditingDayCycle;
+ LLHandle<LLFloater> mSettingsFloater;
+ LLHandle<LLFloater> mEditFloater;
+ S32 mDirtyFlag;
};
#endif // LL_LLPANELEXPERIENCES_H
diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp
index e1a3269c5d..c882e7dbbb 100644
--- a/indra/newview/llsettingspicker.cpp
+++ b/indra/newview/llsettingspicker.cpp
@@ -132,6 +132,9 @@ BOOL LLFloaterSettingsPicker::postBuild()
void LLFloaterSettingsPicker::onClose(bool app_quitting)
{
+ if (app_quitting)
+ return;
+
mCloseSignal();
if (mOwner)
{
@@ -219,6 +222,7 @@ void LLFloaterSettingsPicker::draw()
LLFloater::draw();
}
+
//=========================================================================
void LLFloaterSettingsPicker::onFilterEdit(const std::string& search_string)
{
@@ -271,7 +275,7 @@ void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::i
{
mNoCopySettingsSelected = true;
}
- setSettingsID(itemp->getAssetUUID(), false);
+ setSettingsAssetId(itemp->getAssetUUID(), false);
mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
if (user_action)
@@ -300,7 +304,7 @@ void LLFloaterSettingsPicker::setActive(bool active)
mActive = active;
}
-void LLFloaterSettingsPicker::setSettingsID(const LLUUID &settings_id, bool set_selection)
+void LLFloaterSettingsPicker::setSettingsAssetId(const LLUUID &settings_id, bool set_selection)
{
if (mSettingAssetID != settings_id && mActive)
{
@@ -328,7 +332,7 @@ void LLFloaterSettingsPicker::setSettingsID(const LLUUID &settings_id, bool set_
}
}
-LLUUID LLFloaterSettingsPicker::findItemID(const LLUUID& asset_id, bool copyable_only, bool ignore_library)
+LLInventoryItem* LLFloaterSettingsPicker::findItem(const LLUUID& asset_id, bool copyable_only, bool ignore_library)
{
LLViewerInventoryCategory::cat_array_t cats;
LLViewerInventoryItem::item_array_t items;
@@ -351,1409 +355,23 @@ LLUUID LLFloaterSettingsPicker::findItemID(const LLUUID& asset_id, bool copyable
{
if(!ignore_library || !gInventory.isObjectDescendentOf(itemp->getUUID(),gInventory.getLibraryRootFolderID()))
{
- return itemp->getUUID();
+ return itemp;
}
}
}
// otherwise just return first instance, unless copyable requested
if (copyable_only)
{
- return LLUUID::null;
+ return nullptr;
}
else
{
if(!ignore_library || !gInventory.isObjectDescendentOf(items[0]->getUUID(),gInventory.getLibraryRootFolderID()))
{
- return items[0]->getUUID();
+ return items[0];
}
}
}
- return LLUUID::null;
-}
-
-
-#if 0
-#include "llrender.h"
-#include "llagent.h"
-#include "llviewertexturelist.h"
-#include "llcheckboxctrl.h"
-#include "llcombobox.h"
-#include "llbutton.h"
-#include "lldraghandle.h"
-#include "llfocusmgr.h"
-#include "llfolderviewmodel.h"
-#include "llinventory.h"
-#include "llinventoryfunctions.h"
-#include "llinventorymodelbackgroundfetch.h"
-#include "llinventoryobserver.h"
-#include "llinventorypanel.h"
-#include "lllineeditor.h"
-#include "llui.h"
-#include "llviewerinventory.h"
-#include "llpermissions.h"
-#include "llsaleinfo.h"
-#include "llassetstorage.h"
-#include "lltextbox.h"
-#include "llresizehandle.h"
-#include "llscrollcontainer.h"
-#include "lltoolmgr.h"
-#include "lltoolpipette.h"
-#include "llwindow.h"
-
-#include "lltool.h"
-#include "llviewerwindow.h"
-#include "llviewerobject.h"
-#include "llviewercontrol.h"
-#include "llglheaders.h"
-#include "lluictrlfactory.h"
-#include "lltrans.h"
-
-#include "llradiogroup.h"
-#include "llfloaterreg.h"
-#include "lllocalbitmaps.h"
-#include "llerror.h"
-
-static const S32 LOCAL_TRACKING_ID_COLUMN = 1;
-
-//static const char CURRENT_IMAGE_NAME[] = "Current Texture";
-//static const char WHITE_IMAGE_NAME[] = "Blank Texture";
-//static const char NO_IMAGE_NAME[] = "None";
-
-LLFloaterTexturePicker::LLFloaterTexturePicker(
- LLView* owner,
- LLUUID image_asset_id,
- LLUUID default_image_asset_id,
- LLUUID blank_image_asset_id,
- BOOL tentative,
- BOOL allow_no_texture,
- const std::string& label,
- PermissionMask immediate_filter_perm_mask,
- PermissionMask dnd_filter_perm_mask,
- PermissionMask non_immediate_filter_perm_mask,
- BOOL can_apply_immediately,
- LLUIImagePtr fallback_image)
-: LLFloater(LLSD()),
- mOwner( owner ),
- mImageAssetID( image_asset_id ),
- mOriginalImageAssetID(image_asset_id),
- mFallbackImage(fallback_image),
- mDefaultImageAssetID(default_image_asset_id),
- mBlankImageAssetID(blank_image_asset_id),
- mTentative(tentative),
- mAllowNoTexture(allow_no_texture),
- mLabel(label),
- mTentativeLabel(NULL),
- mResolutionLabel(NULL),
- mActive( TRUE ),
- mFilterEdit(NULL),
- mImmediateFilterPermMask(immediate_filter_perm_mask),
- mDnDFilterPermMask(dnd_filter_perm_mask),
- mNonImmediateFilterPermMask(non_immediate_filter_perm_mask),
- mContextConeOpacity(0.f),
- mSelectedItemPinned( FALSE ),
- mCanApply(true),
- mCanPreview(true),
- mPreviewSettingChanged(false),
- mOnFloaterCommitCallback(NULL),
- mOnFloaterCloseCallback(NULL),
- mSetImageAssetIDCallback(NULL),
- mOnUpdateImageStatsCallback(NULL)
-{
- buildFromFile("floater_texture_ctrl.xml");
- mCanApplyImmediately = can_apply_immediately;
- setCanMinimize(FALSE);
-}
-
-LLFloaterTexturePicker::~LLFloaterTexturePicker()
-{
-}
-
-void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b)
-{
- mCanApplyImmediately = b;
- if (!mCanApplyImmediately)
- {
- getChild<LLUICtrl>("apply_immediate_check")->setValue(FALSE);
- }
- updateFilterPermMask();
-}
-
-void LLFloaterTexturePicker::stopUsingPipette()
-{
- if (LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance())
- {
- LLToolMgr::getInstance()->clearTransientTool();
- }
-}
-
-void LLFloaterTexturePicker::updateImageStats()
-{
- if (mTexturep.notNull())
- {
- //RN: have we received header data for this image?
- if (mTexturep->getFullWidth() > 0 && mTexturep->getFullHeight() > 0)
- {
- std::string formatted_dims = llformat("%d x %d", mTexturep->getFullWidth(),mTexturep->getFullHeight());
- mResolutionLabel->setTextArg("[DIMENSIONS]", formatted_dims);
- if (mOnUpdateImageStatsCallback)
- {
- mOnUpdateImageStatsCallback(mTexturep);
- }
- }
- else
- {
- mResolutionLabel->setTextArg("[DIMENSIONS]", std::string("[? x ?]"));
- }
- }
- else
- {
- mResolutionLabel->setTextArg("[DIMENSIONS]", std::string(""));
- }
-}
-
-// virtual
-BOOL LLFloaterTexturePicker::handleDragAndDrop(
- S32 x, S32 y, MASK mask,
- BOOL drop,
- EDragAndDropType cargo_type, void *cargo_data,
- EAcceptance *accept,
- std::string& tooltip_msg)
-{
- BOOL handled = FALSE;
-
- bool is_mesh = cargo_type == DAD_MESH;
-
- if ((cargo_type == DAD_TEXTURE) || is_mesh)
- {
- LLInventoryItem *item = (LLInventoryItem *)cargo_data;
-
- BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
- BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
- BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
- gAgent.getID());
-
- PermissionMask item_perm_mask = 0;
- if (copy) item_perm_mask |= PERM_COPY;
- if (mod) item_perm_mask |= PERM_MODIFY;
- if (xfer) item_perm_mask |= PERM_TRANSFER;
-
- //PermissionMask filter_perm_mask = getFilterPermMask(); Commented out due to no-copy texture loss.
- PermissionMask filter_perm_mask = mDnDFilterPermMask;
- if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask )
- {
- if (drop)
- {
- setImageID( item->getAssetUUID() );
- commitIfImmediateSet();
- }
-
- *accept = ACCEPT_YES_SINGLE;
- }
- else
- {
- *accept = ACCEPT_NO;
- }
- }
- else
- {
- *accept = ACCEPT_NO;
- }
-
- handled = TRUE;
- LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFloaterTexturePicker " << getName() << LL_ENDL;
-
- return handled;
-}
-
-BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask)
-{
- LLFolderView* root_folder = mInventoryPanel->getRootFolder();
-
- if (root_folder && mFilterEdit)
- {
- if (mFilterEdit->hasFocus()
- && (key == KEY_RETURN || key == KEY_DOWN)
- && mask == MASK_NONE)
- {
- if (!root_folder->getCurSelectedItem())
- {
- LLFolderViewItem* itemp = mInventoryPanel->getItemByID(gInventory.getRootFolderID());
- if (itemp)
- {
- root_folder->setSelection(itemp, FALSE, FALSE);
- }
- }
- root_folder->scrollToShowSelection();
-
- // move focus to inventory proper
- mInventoryPanel->setFocus(TRUE);
-
- // treat this as a user selection of the first filtered result
- commitIfImmediateSet();
-
- return TRUE;
- }
-
- if (mInventoryPanel->hasFocus() && key == KEY_UP)
- {
- mFilterEdit->focusFirstItem(TRUE);
- }
- }
-
- return LLFloater::handleKeyHere(key, mask);
-}
-
-void LLFloaterTexturePicker::onClose(bool app_quitting)
-{
- if (mOwner && mOnFloaterCloseCallback)
- {
- mOnFloaterCloseCallback();
- }
- stopUsingPipette();
-}
-
-// virtual
-BOOL LLFloaterTexturePicker::postBuild()
-{
- LLFloater::postBuild();
-
- if (!mLabel.empty())
- {
- std::string pick = getString("pick title");
-
- setTitle(pick + mLabel);
- }
- mTentativeLabel = getChild<LLTextBox>("Multiple");
-
- mResolutionLabel = getChild<LLTextBox>("unknown");
-
-
- childSetAction("Default",LLFloaterTexturePicker::onBtnSetToDefault,this);
- childSetAction("None", LLFloaterTexturePicker::onBtnNone,this);
- childSetAction("Blank", LLFloaterTexturePicker::onBtnBlank,this);
-
-
- childSetCommitCallback("show_folders_check", onShowFolders, this);
- getChildView("show_folders_check")->setVisible( FALSE);
-
- mFilterEdit = getChild<LLFilterEditor>("inventory search editor");
- mFilterEdit->setCommitCallback(boost::bind(&LLFloaterTexturePicker::onFilterEdit, this, _2));
-
- mInventoryPanel = getChild<LLInventoryPanel>("inventory panel");
-
- if(mInventoryPanel)
- {
- U32 filter_types = 0x0;
- filter_types |= 0x1 << LLInventoryType::IT_TEXTURE;
- filter_types |= 0x1 << LLInventoryType::IT_SNAPSHOT;
-
- mInventoryPanel->setFilterTypes(filter_types);
- //mInventoryPanel->setFilterPermMask(getFilterPermMask()); //Commented out due to no-copy texture loss.
- mInventoryPanel->setFilterPermMask(mImmediateFilterPermMask);
- mInventoryPanel->setSelectCallback(boost::bind(&LLFloaterTexturePicker::onSelectionChange, this, _1, _2));
- mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
-
- // Disable auto selecting first filtered item because it takes away
- // selection from the item set by LLTextureCtrl owning this floater.
- mInventoryPanel->getRootFolder()->setAutoSelectOverride(TRUE);
-
- // Commented out to scroll to currently selected texture. See EXT-5403.
- // // store this filter as the default one
- // mInventoryPanel->getRootFolder()->getFilter().markDefault();
-
- // Commented out to stop opening all folders with textures
- // mInventoryPanel->openDefaultFolderForType(LLFolderType::FT_TEXTURE);
-
- // don't put keyboard focus on selected item, because the selection callback
- // will assume that this was user input
- if(!mImageAssetID.isNull())
- {
- mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO);
- }
- }
-
- mModeSelector = getChild<LLRadioGroup>("mode_selection");
- mModeSelector->setCommitCallback(onModeSelect, this);
- mModeSelector->setSelectedIndex(0, 0);
-
- childSetAction("l_add_btn", LLFloaterTexturePicker::onBtnAdd, this);
- childSetAction("l_rem_btn", LLFloaterTexturePicker::onBtnRemove, this);
- childSetAction("l_upl_btn", LLFloaterTexturePicker::onBtnUpload, this);
-
- mLocalScrollCtrl = getChild<LLScrollListCtrl>("l_name_list");
- mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit, this);
- LLLocalBitmapMgr::feedScrollList(mLocalScrollCtrl);
-
- mNoCopyTextureSelected = FALSE;
-
- getChild<LLUICtrl>("apply_immediate_check")->setValue(gSavedSettings.getBOOL("TextureLivePreview"));
- childSetCommitCallback("apply_immediate_check", onApplyImmediateCheck, this);
-
- if (!mCanApplyImmediately)
- {
- getChildView("show_folders_check")->setEnabled(FALSE);
- }
-
- getChild<LLUICtrl>("Pipette")->setCommitCallback( boost::bind(&LLFloaterTexturePicker::onBtnPipette, this));
- childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this);
- childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this);
-
- // update permission filter once UI is fully initialized
- updateFilterPermMask();
- mSavedFolderState.setApply(FALSE);
-
- LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1));
-
- return TRUE;
-}
-
-// virtual
-void LLFloaterTexturePicker::draw()
-{
- if (mOwner)
- {
- // draw cone of context pointing back to texture swatch
- LLRect owner_rect;
- mOwner->localRectToOtherView(mOwner->getLocalRect(), &owner_rect, this);
- LLRect local_rect = getLocalRect();
- if (gFocusMgr.childHasKeyboardFocus(this) && mOwner->isInVisibleChain() && mContextConeOpacity > 0.001f)
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLEnable(GL_CULL_FACE);
- gGL.begin(LLRender::QUADS);
- {
- gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity);
- gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop);
- gGL.vertex2i(owner_rect.mRight, owner_rect.mTop);
- gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity);
- gGL.vertex2i(local_rect.mRight, local_rect.mTop);
- gGL.vertex2i(local_rect.mLeft, local_rect.mTop);
-
- gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity);
- gGL.vertex2i(local_rect.mLeft, local_rect.mTop);
- gGL.vertex2i(local_rect.mLeft, local_rect.mBottom);
- gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity);
- gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom);
- gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop);
-
- gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity);
- gGL.vertex2i(local_rect.mRight, local_rect.mBottom);
- gGL.vertex2i(local_rect.mRight, local_rect.mTop);
- gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity);
- gGL.vertex2i(owner_rect.mRight, owner_rect.mTop);
- gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom);
-
-
- gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity);
- gGL.vertex2i(local_rect.mLeft, local_rect.mBottom);
- gGL.vertex2i(local_rect.mRight, local_rect.mBottom);
- gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity);
- gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom);
- gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom);
- }
- gGL.end();
- }
- }
-
- if (gFocusMgr.childHasMouseCapture(getDragHandle()))
- {
- mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME));
- }
- else
- {
- mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME));
- }
-
- updateImageStats();
-
- // if we're inactive, gray out "apply immediate" checkbox
- getChildView("show_folders_check")->setEnabled(mActive && mCanApplyImmediately && !mNoCopyTextureSelected);
- getChildView("Select")->setEnabled(mActive && mCanApply);
- getChildView("Pipette")->setEnabled(mActive);
- getChild<LLUICtrl>("Pipette")->setValue(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance());
-
- //BOOL allow_copy = FALSE;
- if( mOwner )
- {
- mTexturep = NULL;
- if(mImageAssetID.notNull())
- {
- mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID);
- mTexturep->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
- }
-
- if (mTentativeLabel)
- {
- mTentativeLabel->setVisible( FALSE );
- }
-
- getChildView("Default")->setEnabled(mImageAssetID != mDefaultImageAssetID || mTentative);
- getChildView("Blank")->setEnabled(mImageAssetID != mBlankImageAssetID || mTentative);
- getChildView("None")->setEnabled(mAllowNoTexture && (!mImageAssetID.isNull() || mTentative));
-
- LLFloater::draw();
-
- if( isMinimized() )
- {
- return;
- }
-
- // Border
- LLRect border = getChildView("preview_widget")->getRect();
- gl_rect_2d( border, LLColor4::black, FALSE );
-
-
- // Interior
- LLRect interior = border;
- interior.stretch( -1 );
-
- // If the floater is focused, don't apply its alpha to the texture (STORM-677).
- const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
- if( mTexturep )
- {
- if( mTexturep->getComponents() == 4 )
- {
- gl_rect_2d_checkerboard( interior, alpha );
- }
-
- gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha );
-
- // Pump the priority
- mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
- }
- else if (!mFallbackImage.isNull())
- {
- mFallbackImage->draw(interior, UI_VERTEX_COLOR % alpha);
- }
- else
- {
- gl_rect_2d( interior, LLColor4::grey % alpha, TRUE );
-
- // Draw X
- gl_draw_x(interior, LLColor4::black );
- }
-
- // Draw Tentative Label over the image
- if( mTentative && !mViewModel->isDirty() )
- {
- mTentativeLabel->setVisible( TRUE );
- drawChild(mTentativeLabel);
- }
-
- if (mSelectedItemPinned) return;
-
- LLFolderView* folder_view = mInventoryPanel->getRootFolder();
- if (!folder_view) return;
-
- LLFolderViewFilter& filter = static_cast<LLFolderViewModelInventory*>(folder_view->getFolderViewModel())->getFilter();
-
- bool is_filter_active = folder_view->getViewModelItem()->getLastFilterGeneration() < filter.getCurrentGeneration() &&
- filter.isNotDefault();
-
- // After inventory panel filter is applied we have to update
- // constraint rect for the selected item because of folder view
- // AutoSelectOverride set to TRUE. We force PinningSelectedItem
- // flag to FALSE state and setting filter "dirty" to update
- // scroll container to show selected item (see LLFolderView::doIdle()).
- if (!is_filter_active && !mSelectedItemPinned)
- {
- folder_view->setPinningSelectedItem(mSelectedItemPinned);
- folder_view->getViewModelItem()->dirtyFilter();
- mSelectedItemPinned = TRUE;
- }
- }
-}
-
-PermissionMask LLFloaterTexturePicker::getFilterPermMask()
-{
- bool apply_immediate = getChild<LLUICtrl>("apply_immediate_check")->getValue().asBoolean();
- return apply_immediate ? mImmediateFilterPermMask : mNonImmediateFilterPermMask;
-}
-
-void LLFloaterTexturePicker::commitCancel()
-{
- if (!mNoCopyTextureSelected && mOnFloaterCommitCallback && mCanApply)
- {
- mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, LLUUID::null);
- }
-}
-
-// static
-void LLFloaterTexturePicker::onBtnSetToDefault(void* userdata)
-{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- self->setCanApply(true, true);
- if (self->mOwner)
- {
- self->setImageID( self->getDefaultImageAssetID() );
- }
- self->commitIfImmediateSet();
-}
-
-// static
-void LLFloaterTexturePicker::onBtnBlank(void* userdata)
-{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- self->setCanApply(true, true);
- self->setImageID( self->getBlankImageAssetID() );
- self->commitIfImmediateSet();
-}
-
-
-// static
-void LLFloaterTexturePicker::onBtnNone(void* userdata)
-{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- self->setImageID( LLUUID::null );
- self->commitCancel();
-}
-
-/*
-// static
-void LLFloaterTexturePicker::onBtnRevert(void* userdata)
-{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- self->setImageID( self->mOriginalImageAssetID );
- // TODO: Change this to tell the owner to cancel. It needs to be
- // smart enough to restore multi-texture selections.
- self->mOwner->onFloaterCommit();
- self->mViewModel->resetDirty();
-}*/
-
-// static
-void LLFloaterTexturePicker::onBtnCancel(void* userdata)
-{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- self->setImageID( self->mOriginalImageAssetID );
- if (self->mOnFloaterCommitCallback)
- {
- self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CANCEL, LLUUID::null);
- }
- self->mViewModel->resetDirty();
- self->closeFloater();
-}
-
-// static
-void LLFloaterTexturePicker::onBtnSelect(void* userdata)
-{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- LLUUID local_id = LLUUID::null;
- if (self->mOwner)
- {
- if (self->mLocalScrollCtrl->getVisible() && !self->mLocalScrollCtrl->getAllSelected().empty())
- {
- LLUUID temp_id = self->mLocalScrollCtrl->getFirstSelected()->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID();
- local_id = LLLocalBitmapMgr::getWorldID(temp_id);
- }
- }
- if (self->mOnFloaterCommitCallback)
- {
- self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_SELECT, local_id);
- }
- self->closeFloater();
-}
-
-void LLFloaterTexturePicker::onBtnPipette()
-{
- BOOL pipette_active = getChild<LLUICtrl>("Pipette")->getValue().asBoolean();
- pipette_active = !pipette_active;
- if (pipette_active)
- {
- LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance());
- }
- else
- {
- LLToolMgr::getInstance()->clearTransientTool();
- }
-}
-
-// static
-void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata)
-{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- bool mode = (self->mModeSelector->getSelectedIndex() == 0);
-
- self->getChild<LLButton>("Default")->setVisible(mode);
- self->getChild<LLButton>("Blank")->setVisible(mode);
- self->getChild<LLButton>("None")->setVisible(mode);
- self->getChild<LLButton>("Pipette")->setVisible(mode);
- self->getChild<LLFilterEditor>("inventory search editor")->setVisible(mode);
- self->getChild<LLInventoryPanel>("inventory panel")->setVisible(mode);
-
- /*self->getChild<LLCheckBox>("show_folders_check")->setVisible(mode);
- no idea under which conditions the above is even shown, needs testing. */
-
- self->getChild<LLButton>("l_add_btn")->setVisible(!mode);
- self->getChild<LLButton>("l_rem_btn")->setVisible(!mode);
- self->getChild<LLButton>("l_upl_btn")->setVisible(!mode);
- self->getChild<LLScrollListCtrl>("l_name_list")->setVisible(!mode);
-}
-
-// static
-void LLFloaterTexturePicker::onBtnAdd(void* userdata)
-{
- if (LLLocalBitmapMgr::addUnit() == true)
- {
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- LLLocalBitmapMgr::feedScrollList(self->mLocalScrollCtrl);
- }
-}
-
-// static
-void LLFloaterTexturePicker::onBtnRemove(void* userdata)
-{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- std::vector<LLScrollListItem*> selected_items = self->mLocalScrollCtrl->getAllSelected();
-
- if (!selected_items.empty())
- {
- for(std::vector<LLScrollListItem*>::iterator iter = selected_items.begin();
- iter != selected_items.end(); iter++)
- {
- LLScrollListItem* list_item = *iter;
- if (list_item)
- {
- LLUUID tracking_id = list_item->getColumn(LOCAL_TRACKING_ID_COLUMN)->getValue().asUUID();
- LLLocalBitmapMgr::delUnit(tracking_id);
- }
- }
-
- self->getChild<LLButton>("l_rem_btn")->setEnabled(false);
- self->getChild<LLButton>("l_upl_btn")->setEnabled(false);
- LLLocalBitmapMgr::feedScrollList(self->mLocalScrollCtrl);
- }
-
-}
-
-// static
-void LLFloaterTexturePicker::onBtnUpload(void* userdata)
-{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- std::vector<LLScrollListItem*> selected_items = self->mLocalScrollCtrl->getAllSelected();
-
- if (selected_items.empty())
- {
- return;
- }
-
- /* currently only allows uploading one by one, picks the first item from the selection list. (not the vector!)
- in the future, it might be a good idea to check the vector size and if more than one units is selected - opt for multi-image upload. */
-
- LLUUID tracking_id = (LLUUID)self->mLocalScrollCtrl->getSelectedItemLabel(LOCAL_TRACKING_ID_COLUMN);
- std::string filename = LLLocalBitmapMgr::getFilename(tracking_id);
-
- if (!filename.empty())
- {
- LLFloaterReg::showInstance("upload_image", LLSD(filename));
- }
-
-}
-
-//static
-void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl* ctrl, void* userdata)
-{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- std::vector<LLScrollListItem*> selected_items = self->mLocalScrollCtrl->getAllSelected();
- bool has_selection = !selected_items.empty();
-
- self->getChild<LLButton>("l_rem_btn")->setEnabled(has_selection);
- self->getChild<LLButton>("l_upl_btn")->setEnabled(has_selection && (selected_items.size() < 2));
- /* since multiple-localbitmap upload is not implemented, upl button gets disabled if more than one is selected. */
-
- if (has_selection)
- {
- LLUUID tracking_id = (LLUUID)self->mLocalScrollCtrl->getSelectedItemLabel(LOCAL_TRACKING_ID_COLUMN);
- LLUUID inworld_id = LLLocalBitmapMgr::getWorldID(tracking_id);
- if (self->mSetImageAssetIDCallback)
- {
- self->mSetImageAssetIDCallback(inworld_id);
- }
-
- if (self->childGetValue("apply_immediate_check").asBoolean())
- {
- if (self->mOnFloaterCommitCallback)
- {
- self->mOnFloaterCommitCallback(LLTextureCtrl::TEXTURE_CHANGE, inworld_id);
- }
- }
- }
-}
-
-// static
-void LLFloaterTexturePicker::onShowFolders(LLUICtrl* ctrl, void *user_data)
-{
- LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl;
- LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data;
-
- if (check_box->get())
- {
- picker->mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
- }
- else
- {
- picker->mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NO_FOLDERS);
- }
-}
-
-// static
-void LLFloaterTexturePicker::onApplyImmediateCheck(LLUICtrl* ctrl, void *user_data)
-{
- LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data;
-
- LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl;
- gSavedSettings.setBOOL("TextureLivePreview", check_box->get());
-
- picker->updateFilterPermMask();
- picker->commitIfImmediateSet();
-}
-
-void LLFloaterTexturePicker::updateFilterPermMask()
-{
- //mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss.
-}
-
-void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply)
-{
- getChildRef<LLUICtrl>("Select").setEnabled(can_apply);
- getChildRef<LLUICtrl>("preview_disabled").setVisible(!can_preview);
- getChildRef<LLUICtrl>("apply_immediate_check").setVisible(can_preview);
-
- mCanApply = can_apply;
- mCanPreview = can_preview ? gSavedSettings.getBOOL("TextureLivePreview") : false;
- mPreviewSettingChanged = true;
-}
-
-void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled)
-{
- mModeSelector->setIndexEnabled(1,enabled);
-}
-
-void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
-{
- LLUUID inventory_item_id = findItemID(te.getID(), TRUE);
- if (inventory_item_id.notNull())
- {
- LLToolPipette::getInstance()->setResult(TRUE, "");
- setImageID(te.getID());
-
- mNoCopyTextureSelected = FALSE;
- LLInventoryItem* itemp = gInventory.getItem(inventory_item_id);
-
- if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
- {
- // no copy texture
- mNoCopyTextureSelected = TRUE;
- }
-
- commitIfImmediateSet();
- }
- else
- {
- LLToolPipette::getInstance()->setResult(FALSE, LLTrans::getString("InventoryNoTexture"));
- }
-}
-
-///////////////////////////////////////////////////////////////////////
-// LLTextureCtrl
-
-static LLDefaultChildRegistry::Register<LLTextureCtrl> r("texture_picker");
-
-LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
-: LLUICtrl(p),
- mDragCallback(NULL),
- mDropCallback(NULL),
- mOnCancelCallback(NULL),
- mOnCloseCallback(NULL),
- mOnSelectCallback(NULL),
- mBorderColor( p.border_color() ),
- mAllowNoTexture( FALSE ),
- mImmediateFilterPermMask( PERM_NONE ),
- mNonImmediateFilterPermMask( PERM_NONE ),
- mCanApplyImmediately( FALSE ),
- mNeedsRawImageData( FALSE ),
- mValid( TRUE ),
- mShowLoadingPlaceholder( TRUE ),
- mImageAssetID(p.image_id),
- mDefaultImageAssetID(p.default_image_id),
- mDefaultImageName(p.default_image_name),
- mFallbackImage(p.fallback_image)
-{
-
- // Default of defaults is white image for diff tex
- //
- LLUUID whiteImage( gSavedSettings.getString( "UIImgWhiteUUID" ) );
- setBlankImageAssetID( whiteImage );
-
- setAllowNoTexture(p.allow_no_texture);
- setCanApplyImmediately(p.can_apply_immediately);
- mCommitOnSelection = !p.no_commit_on_selection;
-
- LLTextBox::Params params(p.caption_text);
- params.name(p.label);
- params.rect(LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ));
- params.initial_value(p.label());
- params.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM);
- mCaption = LLUICtrlFactory::create<LLTextBox> (params);
- addChild( mCaption );
-
- S32 image_top = getRect().getHeight();
- S32 image_bottom = BTN_HEIGHT_SMALL;
- S32 image_middle = (image_top + image_bottom) / 2;
- S32 line_height = LLFontGL::getFontSansSerifSmall()->getLineHeight();
-
- LLTextBox::Params tentative_label_p(p.multiselect_text);
- tentative_label_p.name("Multiple");
- tentative_label_p.rect(LLRect (0, image_middle + line_height / 2, getRect().getWidth(), image_middle - line_height / 2 ));
- tentative_label_p.follows.flags(FOLLOWS_ALL);
- mTentativeLabel = LLUICtrlFactory::create<LLTextBox> (tentative_label_p);
-
- // It is no longer possible to associate a style with a textbox, so it has to be done in this fashion
- LLStyle::Params style_params;
- style_params.color = LLColor4::white;
-
- mTentativeLabel->setText(LLTrans::getString("multiple_textures"), style_params);
- mTentativeLabel->setHAlign(LLFontGL::HCENTER);
- addChild( mTentativeLabel );
-
- LLRect border_rect = getLocalRect();
- border_rect.mBottom += BTN_HEIGHT_SMALL;
- LLViewBorder::Params vbparams(p.border);
- vbparams.name("border");
- vbparams.rect(border_rect);
- mBorder = LLUICtrlFactory::create<LLViewBorder> (vbparams);
- addChild(mBorder);
-
- mLoadingPlaceholderString = LLTrans::getString("texture_loading");
-}
-
-LLTextureCtrl::~LLTextureCtrl()
-{
- closeDependentFloater();
-}
-
-void LLTextureCtrl::setShowLoadingPlaceholder(BOOL showLoadingPlaceholder)
-{
- mShowLoadingPlaceholder = showLoadingPlaceholder;
-}
-
-void LLTextureCtrl::setCaption(const std::string& caption)
-{
- mCaption->setText( caption );
-}
-
-void LLTextureCtrl::setCanApplyImmediately(BOOL b)
-{
- mCanApplyImmediately = b;
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if( floaterp )
- {
- floaterp->setCanApplyImmediately(b);
- }
-}
-
-void LLTextureCtrl::setCanApply(bool can_preview, bool can_apply)
-{
- LLFloaterTexturePicker* floaterp = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get());
- if( floaterp )
- {
- floaterp->setCanApply(can_preview, can_apply);
- }
-}
-
-void LLTextureCtrl::setVisible( BOOL visible )
-{
- if( !visible )
- {
- closeDependentFloater();
- }
- LLUICtrl::setVisible( visible );
-}
-
-void LLTextureCtrl::setEnabled( BOOL enabled )
-{
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if( enabled )
- {
- std::string tooltip;
- if (floaterp) tooltip = floaterp->getString("choose_picture");
- setToolTip( tooltip );
- }
- else
- {
- setToolTip( std::string() );
- // *TODO: would be better to keep floater open and show
- // disabled state.
- closeDependentFloater();
- }
-
- if( floaterp )
- {
- floaterp->setActive(enabled);
- }
-
- mCaption->setEnabled( enabled );
-
- LLView::setEnabled( enabled );
-}
-
-void LLTextureCtrl::setValid(BOOL valid )
-{
- mValid = valid;
- if (!valid)
- {
- LLFloaterTexturePicker* pickerp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if (pickerp)
- {
- pickerp->setActive(FALSE);
- }
- }
-}
-
-
-// virtual
-void LLTextureCtrl::clear()
-{
- setImageAssetID(LLUUID::null);
-}
-
-void LLTextureCtrl::setLabel(const std::string& label)
-{
- mLabel = label;
- mCaption->setText(label);
-}
-
-void LLTextureCtrl::showPicker(BOOL take_focus)
-{
- // show hourglass cursor when loading inventory window
- // because inventory construction is slooow
- getWindow()->setCursor(UI_CURSOR_WAIT);
- LLFloater* floaterp = mFloaterHandle.get();
-
- // Show the dialog
- if( floaterp )
- {
- floaterp->openFloater();
- }
- else
- {
- floaterp = new LLFloaterTexturePicker(
- this,
- getImageAssetID(),
- getDefaultImageAssetID(),
- getBlankImageAssetID(),
- getTentative(),
- getAllowNoTexture(),
- mLabel,
- mImmediateFilterPermMask,
- mDnDFilterPermMask,
- mNonImmediateFilterPermMask,
- mCanApplyImmediately,
- mFallbackImage);
- mFloaterHandle = floaterp->getHandle();
-
- LLFloaterTexturePicker* texture_floaterp = dynamic_cast<LLFloaterTexturePicker*>(floaterp);
- if (texture_floaterp && mOnTextureSelectedCallback)
- {
- texture_floaterp->setTextureSelectedCallback(mOnTextureSelectedCallback);
- }
- if (texture_floaterp && mOnCloseCallback)
- {
- texture_floaterp->setOnFloaterCloseCallback(boost::bind(&LLTextureCtrl::onFloaterClose, this));
- }
- if (texture_floaterp)
- {
- texture_floaterp->setOnFloaterCommitCallback(boost::bind(&LLTextureCtrl::onFloaterCommit, this, _1, _2));
- }
- if (texture_floaterp)
- {
- texture_floaterp->setSetImageAssetIDCallback(boost::bind(&LLTextureCtrl::setImageAssetID, this, _1));
- }
-
- LLFloater* root_floater = gFloaterView->getParentFloater(this);
- if (root_floater)
- root_floater->addDependentFloater(floaterp);
- floaterp->openFloater();
- }
-
- if (take_focus)
- {
- floaterp->setFocus(TRUE);
- }
-}
-
-
-void LLTextureCtrl::closeDependentFloater()
-{
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if( floaterp )
- {
- floaterp->setOwner(NULL);
- floaterp->closeFloater();
- }
-}
-
-// Allow us to download textures quickly when floater is shown
-class LLTextureFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver
-{
-public:
- virtual void done()
- {
- // We need to find textures in all folders, so get the main
- // background download going.
- LLInventoryModelBackgroundFetch::instance().start();
- gInventory.removeObserver(this);
- delete this;
- }
-};
-
-BOOL LLTextureCtrl::handleHover(S32 x, S32 y, MASK mask)
-{
- getWindow()->setCursor(mBorder->parentPointInView(x,y) ? UI_CURSOR_HAND : UI_CURSOR_ARROW);
- return TRUE;
-}
-
-
-BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
-{
- BOOL handled = LLUICtrl::handleMouseDown( x, y , mask );
-
- if (!handled && mBorder->parentPointInView(x, y))
- {
- showPicker(FALSE);
- //grab textures first...
- LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE));
- //...then start full inventory fetch.
- LLInventoryModelBackgroundFetch::instance().start();
- handled = TRUE;
- }
-
- return handled;
-}
-
-void LLTextureCtrl::onFloaterClose()
-{
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
-
- if (floaterp)
- {
- if (mOnCloseCallback)
- {
- mOnCloseCallback(this,LLSD());
- }
- floaterp->setOwner(NULL);
- }
-
- mFloaterHandle.markDead();
-}
-
-void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id)
-{
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
-
- if( floaterp && getEnabled())
- {
- if (op == TEXTURE_CANCEL)
- mViewModel->resetDirty();
- // If the "no_commit_on_selection" parameter is set
- // we get dirty only when user presses OK in the picker
- // (i.e. op == TEXTURE_SELECT) or texture changes via DnD.
- else if (mCommitOnSelection || op == TEXTURE_SELECT)
- mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
-
- if(floaterp->isDirty() || id.notNull()) // mModelView->setDirty does not work.
- {
- setTentative( FALSE );
-
- if (id.notNull())
- {
- mImageItemID = id;
- mImageAssetID = id;
- }
- else
- {
- mImageItemID = floaterp->findItemID(floaterp->getAssetID(), FALSE);
- LL_DEBUGS() << "mImageItemID: " << mImageItemID << LL_ENDL;
- mImageAssetID = floaterp->getAssetID();
- LL_DEBUGS() << "mImageAssetID: " << mImageAssetID << LL_ENDL;
- }
-
- if (op == TEXTURE_SELECT && mOnSelectCallback)
- {
- mOnSelectCallback( this, LLSD() );
- }
- else if (op == TEXTURE_CANCEL && mOnCancelCallback)
- {
- mOnCancelCallback( this, LLSD() );
- }
- else
- {
- // If the "no_commit_on_selection" parameter is set
- // we commit only when user presses OK in the picker
- // (i.e. op == TEXTURE_SELECT) or texture changes via DnD.
- if (mCommitOnSelection || op == TEXTURE_SELECT)
- onCommit();
- }
- }
- }
-}
-
-void LLTextureCtrl::setOnTextureSelectedCallback(texture_selected_callback cb)
-{
- mOnTextureSelectedCallback = cb;
- LLFloaterTexturePicker* floaterp = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get());
- if (floaterp)
- {
- floaterp->setTextureSelectedCallback(cb);
- }
+ return nullptr;
}
-
-void LLTextureCtrl::setImageAssetName(const std::string& name)
-{
- LLPointer<LLUIImage> imagep = LLUI::getUIImage(name);
- if(imagep)
- {
- LLViewerFetchedTexture* pTexture = dynamic_cast<LLViewerFetchedTexture*>(imagep->getImage().get());
- if(pTexture)
- {
- LLUUID id = pTexture->getID();
- setImageAssetID(id);
- }
- }
-}
-
-void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id )
-{
- if( mImageAssetID != asset_id )
- {
- mImageItemID.setNull();
- mImageAssetID = asset_id;
- LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
- if( floaterp && getEnabled() )
- {
- floaterp->setImageID( asset_id );
- floaterp->resetDirty();
- }
- }
-}
-
-BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
- EAcceptance *accept,
- std::string& tooltip_msg)
-{
- BOOL handled = FALSE;
-
- // this downcast may be invalid - but if the second test below
- // returns true, then the cast was valid, and we can perform
- // the third test without problems.
- LLInventoryItem* item = (LLInventoryItem*)cargo_data;
- bool is_mesh = cargo_type == DAD_MESH;
-
- if (getEnabled() &&
- ((cargo_type == DAD_TEXTURE) || is_mesh) &&
- allowDrop(item))
- {
- if (drop)
- {
- if(doDrop(item))
- {
- if (!mCommitOnSelection)
- mViewModel->setDirty();
-
- // This removes the 'Multiple' overlay, since
- // there is now only one texture selected.
- setTentative( FALSE );
- onCommit();
- }
- }
-
- *accept = ACCEPT_YES_SINGLE;
- }
- else
- {
- *accept = ACCEPT_NO;
- }
-
- handled = TRUE;
- LL_DEBUGS("UserInput") << "dragAndDrop handled by LLTextureCtrl " << getName() << LL_ENDL;
-
- return handled;
-}
-
-void LLTextureCtrl::draw()
-{
- mBorder->setKeyboardFocusHighlight(hasFocus());
-
- if (!mValid)
- {
- mTexturep = NULL;
- }
- else if (!mImageAssetID.isNull())
- {
- LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES,LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
-
- texture->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
- texture->forceToSaveRawImage(0) ;
-
- mTexturep = texture;
- }
- else//mImageAssetID == LLUUID::null
- {
- mTexturep = NULL;
- }
-
- // Border
- LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL );
- gl_rect_2d( border, mBorderColor.get(), FALSE );
-
- // Interior
- LLRect interior = border;
- interior.stretch( -1 );
-
- // If we're in a focused floater, don't apply the floater's alpha to the texture (STORM-677).
- const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
- if( mTexturep )
- {
- if( mTexturep->getComponents() == 4 )
- {
- gl_rect_2d_checkerboard( interior, alpha );
- }
-
- gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha);
- mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) );
- }
- else if (!mFallbackImage.isNull())
- {
- mFallbackImage->draw(interior, UI_VERTEX_COLOR % alpha);
- }
- else
- {
- gl_rect_2d( interior, LLColor4::grey % alpha, TRUE );
-
- // Draw X
- gl_draw_x( interior, LLColor4::black );
- }
-
- mTentativeLabel->setVisible( getTentative() );
-
- // Show "Loading..." string on the top left corner while this texture is loading.
- // Using the discard level, do not show the string if the texture is almost but not
- // fully loaded.
- if (mTexturep.notNull() &&
- (!mTexturep->isFullyLoaded()) &&
- (mShowLoadingPlaceholder == TRUE))
- {
- U32 v_offset = 25;
- LLFontGL* font = LLFontGL::getFontSansSerif();
-
- // Don't show as loaded if the texture is almost fully loaded (i.e. discard1) unless god
- if ((mTexturep->getDiscardLevel() > 1) || gAgent.isGodlike())
- {
- font->renderUTF8(
- mLoadingPlaceholderString,
- 0,
- llfloor(interior.mLeft+3),
- llfloor(interior.mTop-v_offset),
- LLColor4::white,
- LLFontGL::LEFT,
- LLFontGL::BASELINE,
- LLFontGL::DROP_SHADOW);
- }
-
- // Optionally show more detailed information.
- if (gSavedSettings.getBOOL("DebugAvatarRezTime"))
- {
- LLFontGL* font = LLFontGL::getFontSansSerif();
- std::string tdesc;
- // Show what % the texture has loaded (0 to 100%, 100 is highest), and what level of detail (5 to 0, 0 is best).
-
- v_offset += 12;
- tdesc = llformat(" PK : %d%%", U32(mTexturep->getDownloadProgress()*100.0));
- font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
- LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
-
- v_offset += 12;
- tdesc = llformat(" LVL: %d", mTexturep->getDiscardLevel());
- font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
- LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
-
- v_offset += 12;
- tdesc = llformat(" ID : %s...", (mImageAssetID.asString().substr(0,7)).c_str());
- font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
- LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
- }
- }
-
- LLUICtrl::draw();
-}
-
-BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item)
-{
- BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
- BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
- BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
- gAgent.getID());
-
- PermissionMask item_perm_mask = 0;
- if (copy) item_perm_mask |= PERM_COPY;
- if (mod) item_perm_mask |= PERM_MODIFY;
- if (xfer) item_perm_mask |= PERM_TRANSFER;
-
-// PermissionMask filter_perm_mask = mCanApplyImmediately ? commented out due to no-copy texture loss.
-// mImmediateFilterPermMask : mNonImmediateFilterPermMask;
- PermissionMask filter_perm_mask = mImmediateFilterPermMask;
- if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask )
- {
- if(mDragCallback)
- {
- return mDragCallback(this, item);
- }
- else
- {
- return TRUE;
- }
- }
- else
- {
- return FALSE;
- }
-}
-
-BOOL LLTextureCtrl::doDrop(LLInventoryItem* item)
-{
- // call the callback if it exists.
- if(mDropCallback)
- {
- // if it returns TRUE, we return TRUE, and therefore the
- // commit is called above.
- return mDropCallback(this, item);
- }
-
- // no callback installed, so just set the image ids and carry on.
- setImageAssetID( item->getAssetUUID() );
- mImageItemID = item->getUUID();
- return TRUE;
-}
-
-BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char)
-{
- if( ' ' == uni_char )
- {
- showPicker(TRUE);
- return TRUE;
- }
- return LLUICtrl::handleUnicodeCharHere(uni_char);
-}
-
-void LLTextureCtrl::setValue( const LLSD& value )
-{
- setImageAssetID(value.asUUID());
-}
-
-LLSD LLTextureCtrl::getValue() const
-{
- return LLSD(getImageAssetID());
-}
-
-#endif
diff --git a/indra/newview/llsettingspicker.h b/indra/newview/llsettingspicker.h
index 968bcaa692..b3637fd59a 100644
--- a/indra/newview/llsettingspicker.h
+++ b/indra/newview/llsettingspicker.h
@@ -32,6 +32,7 @@
#include "llfloater.h"
#include "llpermissionsflags.h"
#include "llfolderview.h"
+#include "llinventory.h"
#include <boost/signals2.hpp>
@@ -52,14 +53,13 @@ public:
virtual ~LLFloaterSettingsPicker() override;
void setActive(bool active);
- void setSettingsID(const LLUUID &settings_id, bool set_selection = true);
virtual BOOL postBuild() override;
virtual void onClose(bool app_quitting) override;
virtual void draw() override;
- void setSettingsAssetID(LLUUID setting_asset_id);
- LLUUID getSettingsAssetID() const { return mSettingAssetID; }
+ 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; }
@@ -71,6 +71,24 @@ 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)
+ {
+ LLInventoryItem *pitem = findItem(asset_id, copyable_only, ignore_library);
+ if (pitem)
+ return pitem->getUUID();
+ return LLUUID::null;
+ }
+
+ 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)
+ return pitem->getName();
+ return std::string();
+ }
+
+ LLInventoryItem * findItem(const LLUUID& asset_id, bool copyable_only, bool ignore_library);
+
private:
typedef std::deque<LLFolderViewItem *> itemlist_t;
@@ -79,7 +97,6 @@ private:
void onButtonCancel();
void onButtonSelect();
- LLUUID findItemID(const LLUUID& asset_id, bool copyable_only, bool ignore_library = false);
LLView* mOwner;
std::string mLabel;
@@ -92,8 +109,8 @@ private:
F32 mContextConeOpacity;
PermissionMask mImmediateFilterPermMask;
- PermissionMask mDnDFilterPermMask;
- PermissionMask mNonImmediateFilterPermMask;
+// PermissionMask mDnDFilterPermMask;
+// PermissionMask mNonImmediateFilterPermMask;
bool mActive;
bool mNoCopySettingsSelected;
@@ -105,347 +122,4 @@ private:
boost::signals2::signal<void(const LLUUID& asset_id)> mChangeIDSignal;
};
-#if 0
-#include "llcoord.h"
-#include "llfiltereditor.h"
-#include "llfolderview.h"
-#include "lllocalbitmaps.h"
-#include "llstring.h"
-#include "lluictrl.h"
-#include "llradiogroup.h"
-#include "lltextbox.h" // for params
-#include "llviewerinventory.h"
-#include "llviewborder.h" // for params
-#include "llviewerobject.h"
-#include "llviewertexture.h"
-#include "llwindow.h"
-
-class LLButton;
-class LLFloaterTexturePicker;
-class LLInventoryItem;
-class LLViewerFetchedTexture;
-
-// used for setting drag & drop callbacks.
-typedef boost::function<BOOL (LLUICtrl*, LLInventoryItem*)> drag_n_drop_callback;
-typedef boost::function<void (LLInventoryItem*)> texture_selected_callback;
-
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// LLTextureCtrl
-
-
-class LLTextureCtrl
-: public LLUICtrl
-{
-public:
- typedef enum e_texture_pick_op
- {
- TEXTURE_CHANGE,
- TEXTURE_SELECT,
- TEXTURE_CANCEL
- } ETexturePickOp;
-
-public:
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
- Optional<LLUUID> image_id;
- Optional<LLUUID> default_image_id;
- Optional<std::string> default_image_name;
- Optional<bool> allow_no_texture;
- Optional<bool> can_apply_immediately;
- Optional<bool> no_commit_on_selection; // alternative mode: commit occurs and the widget gets dirty
- // only on DnD or when OK is pressed in the picker
- Optional<S32> label_width;
- Optional<LLUIColor> border_color;
- Optional<LLUIImage*> fallback_image;
-
- Optional<LLTextBox::Params> multiselect_text,
- caption_text;
-
- Optional<LLViewBorder::Params> border;
-
- Params()
- : image_id("image"),
- default_image_id("default_image_id"),
- default_image_name("default_image_name"),
- allow_no_texture("allow_no_texture"),
- can_apply_immediately("can_apply_immediately"),
- no_commit_on_selection("no_commit_on_selection", false),
- label_width("label_width", -1),
- border_color("border_color"),
- fallback_image("fallback_image"),
- multiselect_text("multiselect_text"),
- caption_text("caption_text"),
- border("border")
- {}
- };
-protected:
- LLTextureCtrl(const Params&);
- friend class LLUICtrlFactory;
-public:
- virtual ~LLTextureCtrl();
-
- // LLView interface
-
- virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
- EAcceptance *accept,
- std::string& tooltip_msg);
- virtual BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual BOOL handleUnicodeCharHere(llwchar uni_char);
-
- virtual void draw();
- virtual void setVisible( BOOL visible );
- virtual void setEnabled( BOOL enabled );
-
- void setValid(BOOL valid);
-
- // LLUICtrl interface
- virtual void clear();
-
- // Takes a UUID, wraps get/setImageAssetID
- virtual void setValue(const LLSD& value);
- virtual LLSD getValue() const;
-
- // LLTextureCtrl interface
- void showPicker(BOOL take_focus);
- bool isPickerShown() { return !mFloaterHandle.isDead(); }
- void setLabel(const std::string& label);
- void setLabelWidth(S32 label_width) {mLabelWidth =label_width;}
- const std::string& getLabel() const { return mLabel; }
-
- void setAllowNoTexture( BOOL b ) { mAllowNoTexture = b; }
- bool getAllowNoTexture() const { return mAllowNoTexture; }
-
- const LLUUID& getImageItemID() { return mImageItemID; }
-
- virtual void setImageAssetName(const std::string& name);
-
- void setImageAssetID(const LLUUID &image_asset_id);
- const LLUUID& getImageAssetID() const { return mImageAssetID; }
-
- void setDefaultImageAssetID( const LLUUID& id ) { mDefaultImageAssetID = id; }
- const LLUUID& getDefaultImageAssetID() const { return mDefaultImageAssetID; }
-
- const std::string& getDefaultImageName() const { return mDefaultImageName; }
-
- void setBlankImageAssetID( const LLUUID& id ) { mBlankImageAssetID = id; }
- const LLUUID& getBlankImageAssetID() const { return mBlankImageAssetID; }
-
- void setCaption(const std::string& caption);
- void setCanApplyImmediately(BOOL b);
-
- void setCanApply(bool can_preview, bool can_apply);
-
- void setImmediateFilterPermMask(PermissionMask mask)
- { mImmediateFilterPermMask = mask; }
- void setDnDFilterPermMask(PermissionMask mask)
- { mDnDFilterPermMask = mask; }
- void setNonImmediateFilterPermMask(PermissionMask mask)
- { mNonImmediateFilterPermMask = mask; }
- PermissionMask getImmediateFilterPermMask() { return mImmediateFilterPermMask; }
- PermissionMask getNonImmediateFilterPermMask() { return mNonImmediateFilterPermMask; }
-
- void closeDependentFloater();
-
- void onFloaterClose();
- void onFloaterCommit(ETexturePickOp op, LLUUID id);
-
- // This call is returned when a drag is detected. Your callback
- // should return TRUE if the drag is acceptable.
- void setDragCallback(drag_n_drop_callback cb) { mDragCallback = cb; }
-
- // This callback is called when the drop happens. Return TRUE if
- // the drop happened - resulting in an on commit callback, but not
- // necessariliy any other change.
- void setDropCallback(drag_n_drop_callback cb) { mDropCallback = cb; }
-
- void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; }
- void setOnCloseCallback(commit_callback_t cb) { mOnCloseCallback = cb; }
- void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; }
-
- /*
- * callback for changing texture selection in inventory list of texture floater
- */
- void setOnTextureSelectedCallback(texture_selected_callback cb);
-
- void setShowLoadingPlaceholder(BOOL showLoadingPlaceholder);
-
- LLViewerFetchedTexture* getTexture() { return mTexturep; }
-
-private:
- BOOL allowDrop(LLInventoryItem* item);
- BOOL doDrop(LLInventoryItem* item);
-
-private:
- drag_n_drop_callback mDragCallback;
- drag_n_drop_callback mDropCallback;
- commit_callback_t mOnCancelCallback;
- commit_callback_t mOnSelectCallback;
- commit_callback_t mOnCloseCallback;
- texture_selected_callback mOnTextureSelectedCallback;
- LLPointer<LLViewerFetchedTexture> mTexturep;
- LLUIColor mBorderColor;
- LLUUID mImageItemID;
- LLUUID mImageAssetID;
- LLUUID mDefaultImageAssetID;
- LLUUID mBlankImageAssetID;
- LLUIImagePtr mFallbackImage;
- std::string mDefaultImageName;
- LLHandle<LLFloater> mFloaterHandle;
- LLTextBox* mTentativeLabel;
- LLTextBox* mCaption;
- std::string mLabel;
- BOOL mAllowNoTexture; // If true, the user can select "none" as an option
- PermissionMask mImmediateFilterPermMask;
- PermissionMask mDnDFilterPermMask;
- PermissionMask mNonImmediateFilterPermMask;
- BOOL mCanApplyImmediately;
- BOOL mCommitOnSelection;
- BOOL mNeedsRawImageData;
- LLViewBorder* mBorder;
- BOOL mValid;
- BOOL mShowLoadingPlaceholder;
- std::string mLoadingPlaceholderString;
- S32 mLabelWidth;
-};
-
-//////////////////////////////////////////////////////////////////////////////////////////
-// LLFloaterTexturePicker
-typedef boost::function<void(LLTextureCtrl::ETexturePickOp op, LLUUID id)> floater_commit_callback;
-typedef boost::function<void()> floater_close_callback;
-typedef boost::function<void(const LLUUID& asset_id)> set_image_asset_id_callback;
-typedef boost::function<void(LLPointer<LLViewerTexture> texture)> set_on_update_image_stats_callback;
-
-class LLFloaterTexturePicker : public LLFloater
-{
-public:
- LLFloaterTexturePicker(
- LLView* owner,
- LLUUID image_asset_id,
- LLUUID default_image_asset_id,
- LLUUID blank_image_asset_id,
- BOOL tentative,
- BOOL allow_no_texture,
- const std::string& label,
- PermissionMask immediate_filter_perm_mask,
- PermissionMask dnd_filter_perm_mask,
- PermissionMask non_immediate_filter_perm_mask,
- BOOL can_apply_immediately,
- LLUIImagePtr fallback_image_name
- );
-
- virtual ~LLFloaterTexturePicker();
-
- // LLView overrides
- /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
- EAcceptance *accept,
- std::string& tooltip_msg);
- /*virtual*/ void draw();
- /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
-
- // LLFloater overrides
- /*virtual*/ BOOL postBuild();
- /*virtual*/ void onClose(bool app_settings);
-
- // New functions
- void setImageID(const LLUUID& image_asset_id, bool set_selection = true);
- void updateImageStats();
- const LLUUID& getAssetID() { return mImageAssetID; }
- const LLUUID& findItemID(const LLUUID& asset_id, BOOL copyable_only, BOOL ignore_library = FALSE);
- void setCanApplyImmediately(BOOL b);
-
- void setActive(BOOL active);
-
- LLView* getOwner() const { return mOwner; }
- void setOwner(LLView* owner) { mOwner = owner; }
- void stopUsingPipette();
- PermissionMask getFilterPermMask();
-
- void updateFilterPermMask();
- void commitIfImmediateSet();
- void commitCancel();
-
- void onFilterEdit(const std::string& search_string);
-
- void setCanApply(bool can_preview, bool can_apply);
- void setTextureSelectedCallback(const texture_selected_callback& cb) { mTextureSelectedCallback = cb; }
- void setOnFloaterCloseCallback(const floater_close_callback& cb) { mOnFloaterCloseCallback = cb; }
- void setOnFloaterCommitCallback(const floater_commit_callback& cb) { mOnFloaterCommitCallback = cb; }
- void setSetImageAssetIDCallback(const set_image_asset_id_callback& cb) { mSetImageAssetIDCallback = cb; }
- void setOnUpdateImageStatsCallback(const set_on_update_image_stats_callback& cb) { mOnUpdateImageStatsCallback = cb; }
- const LLUUID& getDefaultImageAssetID() { return mDefaultImageAssetID; }
- const LLUUID& getBlankImageAssetID() { return mBlankImageAssetID; }
-
- static void onBtnSetToDefault(void* userdata);
- static void onBtnSelect(void* userdata);
- static void onBtnCancel(void* userdata);
- void onBtnPipette();
- //static void onBtnRevert( void* userdata );
- static void onBtnBlank(void* userdata);
- static void onBtnNone(void* userdata);
- static void onBtnClear(void* userdata);
- void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
- static void onShowFolders(LLUICtrl* ctrl, void* userdata);
- static void onApplyImmediateCheck(LLUICtrl* ctrl, void* userdata);
- void onTextureSelect(const LLTextureEntry& te);
-
- static void onModeSelect(LLUICtrl* ctrl, void *userdata);
- static void onBtnAdd(void* userdata);
- static void onBtnRemove(void* userdata);
- static void onBtnUpload(void* userdata);
- static void onLocalScrollCommit(LLUICtrl* ctrl, void* userdata);
-
- void setLocalTextureEnabled(BOOL enabled);
-
-protected:
- LLPointer<LLViewerTexture> mTexturep;
- LLView* mOwner;
-
- LLUUID mImageAssetID; // Currently selected texture
- LLUIImagePtr mFallbackImage; // What to show if currently selected texture is null.
- LLUUID mDefaultImageAssetID;
- LLUUID mBlankImageAssetID;
- BOOL mTentative;
- BOOL mAllowNoTexture;
- LLUUID mSpecialCurrentImageAssetID; // Used when the asset id has no corresponding texture in the user's inventory.
- LLUUID mOriginalImageAssetID;
-
- std::string mLabel;
-
- LLTextBox* mTentativeLabel;
- LLTextBox* mResolutionLabel;
-
- std::string mPendingName;
- BOOL mActive;
-
- LLFilterEditor* mFilterEdit;
- LLInventoryPanel* mInventoryPanel;
- PermissionMask mImmediateFilterPermMask;
- PermissionMask mDnDFilterPermMask;
- PermissionMask mNonImmediateFilterPermMask;
- BOOL mCanApplyImmediately;
- BOOL mNoCopyTextureSelected;
- F32 mContextConeOpacity;
- LLSaveFolderState mSavedFolderState;
- BOOL mSelectedItemPinned;
-
- LLRadioGroup* mModeSelector;
- LLScrollListCtrl* mLocalScrollCtrl;
-
-private:
- bool mCanApply;
- bool mCanPreview;
- bool mPreviewSettingChanged;
-
- texture_selected_callback mTextureSelectedCallback;
- floater_close_callback mOnFloaterCloseCallback;
- floater_commit_callback mOnFloaterCommitCallback;
- set_image_asset_id_callback mSetImageAssetIDCallback;
- set_on_update_image_stats_callback mOnUpdateImageStatsCallback;
-};
-
-#endif
#endif // LL_LLTEXTURECTRL_H
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index b9eb1fd5c6..c56b5df74d 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -273,6 +273,7 @@ void LLSettingsVOBase::onAssetDownloadComplete(LLVFS *vfs, const LLUUID &asset_i
}
else
{
+ LL_WARNS("LAPRAS") << "Setting asset ID to " << asset_id << LL_ENDL;
settings->setAssetId(asset_id);
}
}
@@ -485,7 +486,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky()
return skyp;
}
-LLSettingsSky::ptr_t LLSettingsVOSky::buildClone()
+LLSettingsSky::ptr_t LLSettingsVOSky::buildClone() const
{
LLSD settings = cloneSettings();
@@ -736,7 +737,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater()
return waterp;
}
-LLSettingsWater::ptr_t LLSettingsVOWater::buildClone()
+LLSettingsWater::ptr_t LLSettingsVOWater::buildClone() const
{
LLSD settings = cloneSettings();
LLSettingsWater::validation_list_t validations = LLSettingsWater::validationList();
@@ -1074,7 +1075,45 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromEnvironmentMessage(LLSD settings)
}
-LLSettingsDay::ptr_t LLSettingsVODay::buildClone()
+void LLSettingsVODay::buildFromOtherSetting(LLSettingsBase::ptr_t settings, LLSettingsVODay::asset_built_fn cb)
+{
+ if (settings->getSettingsType() == "daycycle")
+ {
+ if (cb)
+ cb(std::static_pointer_cast<LLSettingsDay>(settings));
+ }
+ else
+ {
+ LLSettingsVOBase::getSettingsAsset(LLSettingsDay::GetDefaultAssetId(),
+ [settings, cb](LLUUID, LLSettingsBase::ptr_t pday, S32, LLExtStat){ combineIntoDayCycle(std::static_pointer_cast<LLSettingsDay>(pday), settings, cb); });
+ }
+}
+
+void LLSettingsVODay::combineIntoDayCycle(LLSettingsDay::ptr_t pday, LLSettingsBase::ptr_t settings, asset_built_fn cb)
+{
+ if (settings->getSettingsType() == "sky")
+ {
+ pday->setName("sky: " + settings->getName());
+ pday->clearCycleTrack(1);
+ pday->setSettingsAtKeyframe(settings, 0.0, 1);
+ }
+ else if (settings->getSettingsType() == "water")
+ {
+ pday->setName("water: " + settings->getName());
+ pday->clearCycleTrack(0);
+ pday->setSettingsAtKeyframe(settings, 0.0, 0);
+ }
+ else
+ {
+ pday.reset();
+ }
+
+ if (cb)
+ cb(pday);
+}
+
+
+LLSettingsDay::ptr_t LLSettingsVODay::buildClone() const
{
LLSD settings = cloneSettings();
@@ -1092,7 +1131,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone()
return dayp;
}
-LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress()
+LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress() const
{
// no need for SETTING_TRACKS or SETTING_FRAMES, so take base LLSD
LLSD settings = llsd_clone(mSettings);
@@ -1101,8 +1140,8 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress()
for (S32 i = 0; i < LLSettingsDay::TRACK_MAX; ++i)
{
- LLSettingsDay::CycleTrack_t track = getCycleTrack(i);
- LLSettingsDay::CycleTrack_t::iterator iter = track.begin();
+ const LLSettingsDay::CycleTrack_t& track = getCycleTrackConst(i);
+ LLSettingsDay::CycleTrack_t::const_iterator iter = track.begin();
while (iter != track.end())
{
// 'Unpack', usually for editing
diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h
index fedb758b48..d314eed24e 100644
--- a/indra/newview/llsettingsvo.h
+++ b/indra/newview/llsettingsvo.h
@@ -89,7 +89,7 @@ public:
static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings);
static ptr_t buildDefaultSky();
- virtual ptr_t buildClone() override;
+ virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path);
@@ -123,7 +123,7 @@ public:
static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings);
static ptr_t buildDefaultWater();
- virtual ptr_t buildClone() override;
+ virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path);
@@ -146,6 +146,8 @@ private:
class LLSettingsVODay : public LLSettingsDay
{
public:
+ typedef std::function<void(LLSettingsDay::ptr_t day)> asset_built_fn;
+
LLSettingsVODay(const LLSD &data);
static ptr_t buildDay(LLSD settings);
@@ -155,8 +157,9 @@ public:
static ptr_t buildFromLegacyMessage(const LLUUID &regionId, LLSD daycycle, LLSD skys, LLSD water);
static ptr_t buildDefaultDayCycle();
static ptr_t buildFromEnvironmentMessage(LLSD settings);
- virtual ptr_t buildClone() override;
- virtual ptr_t buildDeepCloneAndUncompress();
+ static void buildFromOtherSetting(LLSettingsBase::ptr_t settings, asset_built_fn cb);
+ virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
+ virtual ptr_t buildDeepCloneAndUncompress() const SETTINGS_OVERRIDE;
static LLSD convertToLegacy(const ptr_t &);
@@ -167,6 +170,9 @@ public:
protected:
LLSettingsVODay();
+
+private:
+ static void combineIntoDayCycle(LLSettingsDay::ptr_t, LLSettingsBase::ptr_t, asset_built_fn);
};
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index b08eee0ec4..b33da233f5 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -8541,11 +8541,11 @@ class LLWorldEnvPreset : public view_listener_t
}
else if (item == "new_day_cycle")
{
- LLFloaterReg::showInstance("env_edit_extdaycycle", "new");
+ LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("edit_context", "inventory"));
}
else if (item == "edit_day_cycle")
{
- LLFloaterReg::showInstance("env_edit_extdaycycle", "edit");
+ LLFloaterReg::showInstance("env_edit_extdaycycle", LLSDMap("edit_context", "inventory"));
}
else
{
diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp
index f0453b4d6d..6b8374fd48 100644
--- a/indra/newview/llwlhandlers.cpp
+++ b/indra/newview/llwlhandlers.cpp
@@ -33,13 +33,12 @@
#include "llnotificationsutil.h"
#include "llcorehttputil.h"
-#include "llenvironment.h"
-
+#include "llparcel.h"
/****
* LLEnvironmentRequest
****/
// static
-bool LLEnvironmentRequest::initiate()
+bool LLEnvironmentRequest::initiate(LLEnvironment::environment_apply_fn cb)
{
LLViewerRegion* cur_region = gAgent.getRegion();
@@ -52,15 +51,15 @@ bool LLEnvironmentRequest::initiate()
if (!cur_region->capabilitiesReceived())
{
LL_INFOS("WindlightCaps") << "Deferring windlight settings request until we've got region caps" << LL_ENDL;
- cur_region->setCapabilitiesReceivedCallback([](LLUUID region_id) { LLEnvironmentRequest::onRegionCapsReceived(region_id); });
+ cur_region->setCapabilitiesReceivedCallback([cb](LLUUID region_id) { LLEnvironmentRequest::onRegionCapsReceived(region_id, cb); });
return false;
}
- return doRequest();
+ return doRequest(cb);
}
// static
-void LLEnvironmentRequest::onRegionCapsReceived(const LLUUID& region_id)
+void LLEnvironmentRequest::onRegionCapsReceived(const LLUUID& region_id, LLEnvironment::environment_apply_fn cb)
{
if (region_id != gAgent.getRegion()->getRegionID())
{
@@ -69,11 +68,11 @@ void LLEnvironmentRequest::onRegionCapsReceived(const LLUUID& region_id)
}
LL_DEBUGS("WindlightCaps") << "Received region capabilities" << LL_ENDL;
- doRequest();
+ doRequest(cb);
}
// static
-bool LLEnvironmentRequest::doRequest()
+bool LLEnvironmentRequest::doRequest(LLEnvironment::environment_apply_fn cb)
{
std::string url = gAgent.getRegionCapability("EnvironmentSettings");
if (url.empty())
@@ -88,7 +87,7 @@ bool LLEnvironmentRequest::doRequest()
std::string coroname =
LLCoros::instance().launch("LLEnvironmentRequest::environmentRequestCoro",
- [url]() { LLEnvironmentRequest::environmentRequestCoro(url); });
+ [url, cb]() { LLEnvironmentRequest::environmentRequestCoro(url, cb); });
LL_INFOS("WindlightCaps") << "Requesting region windlight settings via " << url << LL_ENDL;
return true;
@@ -97,7 +96,7 @@ bool LLEnvironmentRequest::doRequest()
S32 LLEnvironmentRequest::sLastRequest = 0;
//static
-void LLEnvironmentRequest::environmentRequestCoro(std::string url)
+void LLEnvironmentRequest::environmentRequestCoro(std::string url, LLEnvironment::environment_apply_fn cb)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
S32 requestId = ++LLEnvironmentRequest::sLastRequest;
@@ -141,7 +140,12 @@ void LLEnvironmentRequest::environmentRequestCoro(std::string url)
return;
}
- LLEnvironment::instance().onLegacyRegionSettings(result);
+ if (cb)
+ {
+ LLEnvironment::EnvironmentInfo::ptr_t pinfo = LLEnvironment::EnvironmentInfo::extractLegacy(result);
+
+ cb(INVALID_PARCEL_ID, pinfo);
+ }
}
@@ -153,7 +157,7 @@ clock_t LLEnvironmentApply::UPDATE_WAIT_SECONDS = clock_t(3.f);
clock_t LLEnvironmentApply::sLastUpdate = clock_t(0.f);
// static
-bool LLEnvironmentApply::initiateRequest(const LLSD& content)
+bool LLEnvironmentApply::initiateRequest(const LLSD& content, LLEnvironment::environment_apply_fn cb)
{
clock_t current = clock();
@@ -181,11 +185,11 @@ bool LLEnvironmentApply::initiateRequest(const LLSD& content)
std::string coroname =
LLCoros::instance().launch("LLEnvironmentApply::environmentApplyCoro",
- [url, content]() { LLEnvironmentApply::environmentApplyCoro(url, content); });
+ [url, content, cb]() { LLEnvironmentApply::environmentApplyCoro(url, content, cb); });
return true;
}
-void LLEnvironmentApply::environmentApplyCoro(std::string url, LLSD content)
+void LLEnvironmentApply::environmentApplyCoro(std::string url, LLSD content, LLEnvironment::environment_apply_fn cb)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
diff --git a/indra/newview/llwlhandlers.h b/indra/newview/llwlhandlers.h
index 857ffa9bd3..b09d2df60f 100644
--- a/indra/newview/llwlhandlers.h
+++ b/indra/newview/llwlhandlers.h
@@ -29,19 +29,20 @@
#include "llviewerprecompiledheaders.h"
#include "llcoros.h"
+#include "llenvironment.h"
class LLEnvironmentRequest
{
LOG_CLASS(LLEnvironmentRequest);
public:
/// @return true if request was successfully sent
- static bool initiate();
+ static bool initiate(LLEnvironment::environment_apply_fn cb);
private:
- static void onRegionCapsReceived(const LLUUID& region_id);
- static bool doRequest();
+ static void onRegionCapsReceived(const LLUUID& region_id, LLEnvironment::environment_apply_fn cb);
+ static bool doRequest(LLEnvironment::environment_apply_fn cb);
- static void environmentRequestCoro(std::string url);
+ static void environmentRequestCoro(std::string url, LLEnvironment::environment_apply_fn cb);
static S32 sLastRequest;
};
@@ -51,13 +52,13 @@ class LLEnvironmentApply
LOG_CLASS(LLEnvironmentApply);
public:
/// @return true if request was successfully sent
- static bool initiateRequest(const LLSD& content);
+ static bool initiateRequest(const LLSD& content, LLEnvironment::environment_apply_fn cb);
private:
static clock_t sLastUpdate;
static clock_t UPDATE_WAIT_SECONDS;
- static void environmentApplyCoro(std::string url, LLSD content);
+ static void environmentApplyCoro(std::string url, LLSD content, LLEnvironment::environment_apply_fn cb);
};
diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml
index 334de8e3db..37c4e3ff8d 100644
--- a/indra/newview/skins/default/xui/en/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/en/floater_about_land.xml
@@ -2106,7 +2106,7 @@ Only large parcels can be listed in search.
top="0"
help_topic="land_experiences_tab"
name="land_experiences_panel"
- class="land_experiences_panel"
+ class="land_experiences_panel"
filename="panel_region_experiences.xml">
</panel>
<panel
@@ -2118,7 +2118,7 @@ Only large parcels can be listed in search.
top="0"
help_topic="land_environment_tab"
name="land_environment_panel"
- class="land_environment_panel"
+ class="land_environment_panel"
filename="panel_region_environment.xml">
</panel>
</tab_container>
diff --git a/indra/newview/skins/default/xui/en/menu_save_settings.xml b/indra/newview/skins/default/xui/en/menu_save_settings.xml
index a72b02c593..e3ed9a1741 100644
--- a/indra/newview/skins/default/xui/en/menu_save_settings.xml
+++ b/indra/newview/skins/default/xui/en/menu_save_settings.xml
@@ -20,6 +20,13 @@
userdata="saveas" />
</menu_item_call>
<menu_item_call
+ name="commit_changes"
+ label="Commit">
+ <menu_item_call.on_click
+ function="FlyoutCombo.Button.Action"
+ userdata="commit" />
+ </menu_item_call>
+ <menu_item_call
name="apply_local"
label="Apply Only To Myself">
<menu_item_call.on_click
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 9d406a14e1..f011fe0aaa 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -4799,6 +4799,18 @@ Unchecking this option may remove restrictions that parcel owners have added to
<notification
icon="alertmodal.tga"
+ name="EstateParcelEnvironmentOverride"
+ type="alertmodal">
+Unchecking this option may remove any custom environments that parcel owners have added to their parcels. Please discuss with your parcel owners as needed.
+ <tag>confirm</tag>
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
+
+ <notification
+ icon="alertmodal.tga"
name="RegionEntryAccessBlocked"
type="alertmodal">
<tag>fail</tag>
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 41f58eef01..bb10e0c69e 100644
--- a/indra/newview/skins/default/xui/en/panel_region_environment.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml
@@ -1,82 +1,109 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
- border="true"
- follows="top|left"
- height="300"
- label="Environment"
- layout="topleft"
- help_topic="panel_region_environment_tab"
- name="panel_env_info"
- width="530">
+ border="true"
+ follows="top|left"
+ height="300"
+ label="Environment"
+ layout="topleft"
+ help_topic="panel_region_environment_tab"
+ name="panel_env_info"
+ width="420">
+ <string name="str_label_use_default">Use Default Settings</string>
+ <string name="str_label_use_region">Use Region Settings</string>
+ <string name="str_unknow_inventory">Unknown</string>
+
<layout_stack
- left_offset="0"
- top_offset="0"
width="420"
- height="250"
+ height="450"
follows="left|right|top|bottom"
orientation="vertical">
<layout_panel
- auto_resize="false"
- user_resize="true"
- bg_alpha_color="red"
- min_height="130"
- background_visible="false">
+ auto_resize="true"
+ user_resize="false">
<layout_stack
- left_offset="5"
- top_offset="5"
- right_offset="-5"
+ left="5"
+ top="5"
+ right="-5"
follows="left|right|top|bottom"
orientation="horizontal">
<layout_panel
+ background_visible="true"
border="true"
bevel_style="in"
- auto_resize="false"
+ auto_resize="true"
user_resize="false"
- width="160"
- background_visible="true">
+ width="260"
+ min_width="260">
<text follows="top|left"
+ font="SansSerif"
halign="left"
- text_color="white">Environment Source</text>
+ text_color="white">Current Environment</text>
<radio_group
- follows="top|left"
- height="45"
+ height="90"
layout="topleft"
+ top_pad="5"
left_delta="10"
- name="environment_select_radio_group"
- bottom_delta="50"
- max_width="200"
- width="200">
+ name="rdg_environment_select">
+ <radio_item
+ label="[USEDEFAULT]"
+ layout="topleft"
+ name="rdo_use_xxx_setting"
+ height="20"/>
<radio_item
- label="Use Region Settings"
+ label="Settings From Inventory"
layout="topleft"
- name="use_region_setting"
+ valign="top"
+ name="rdo_use_inv_setting"
height="20"/>
<radio_item
+ top_pad="25"
label="Custom Environment"
layout="topleft"
height="20"
- name="use_custom_setting"/>
+ name="rdo_use_custom_setting"/>
</radio_group>
+ <line_editor
+ follows="top|left"
+ enabled="false"
+ left_delta="20"
+ top_delta="50"
+ height="20"
+ layout="topleft"
+ name="edt_inventory_name"
+ width="200">
+ Unknown
+ </line_editor>
+ <button
+ name="btn_select_inventory"
+ follows="top|left"
+ image_overlay="Command_Inventory_Icon"
+ auto_resize="false"
+ layout="topleft"
+ height="20"
+ width="20"
+ left_delta="205"
+ top_delta="0"/>
<button
- follows="top|right"
+ follows="top|left"
+ top_pad="25"
+ left_delta="-205"
+ layout="topleft"
height="23"
- label="Edit Custom"
- right_offset="30"
- bottom_offset="30"
- width="100"
- name="edit_btn"/>
+ label="Edit Environment"
+ width="120"
+ name="btn_edit"/>
</layout_panel>
<layout_panel
border="true"
bevel_style="in"
- auto_resize="false"
- user_resize="true"
- height="11"
- width="220"
+ auto_resize="true"
+ user_resize="false"
background_visible="true">
- <text follows="top|left|right"
+ <text
+ font="SansSerif"
+ follows="top|left|right"
halign="left"
text_color="white">Day Settings</text>
<text
@@ -92,7 +119,6 @@
</text>
<slider
can_edit_text="true"
- control_name="DayLengthSLD"
decimal_digits="1"
follows="left|top"
height="20"
@@ -101,10 +127,10 @@
layout="topleft"
left_delta="0"
top_pad="6"
- name="day_length_sld"
+ name="sld_day_length"
min_val="4"
max_val="178"
- width="200" />
+ width="180" />
<text
type="string"
length="1"
@@ -118,7 +144,6 @@
</text>
<slider
can_edit_text="true"
- control_name="DayOffsetSLD"
decimal_digits="1"
follows="left|top"
height="20"
@@ -127,53 +152,67 @@
layout="topleft"
left_delta="0"
top_pad="6"
- name="day_offset_sld"
+ name="sld_day_offset"
min_val="-12"
max_val="12"
- width="200" />
+ width="180" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="12"
+ layout="topleft"
+ left_delta="0"
+ top_pad="20"
+ width="200">
+ Apparent Time of Day Would Be:
+ </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 name="flex"
- auto_resize="true"
- user_resize="true"
- visible="false"
- bg_alpha_color="blue"
- height="100"
- background_visible="true">
- </layout_panel>
</layout_stack>
</layout_panel>
<layout_panel
auto_resize="true"
- user_resize="true"
+ user_resize="false"
height="21"
- min_height="0"
- background_visible="false">
- <check_box
- height="16"
- label="Parcel Owners May Override"
- layout="topleft"
- left_offset="10"
- top_offset="10"
- name="allow_override_chk"
- width="200" />
- <button
- follows="top|left"
- height="23"
- label="Apply"
- left_offset="160"
- top_offset="60"
- name="apply_btn"
- width="100" />
- <button
- follows="top|left"
- height="23"
- label="Cancel"
- layout="topleft"
- left_pad="10"
- name="cancel_btn"
- width="100" />
-
+ min_height="0">
+ <check_box
+ height="20"
+ label="Parcel Owners May Override Environment"
+ layout="topleft"
+ left="10"
+ top="10"
+ name="chk_allow_override"
+ width="200" />
+ <button
+ follows="top|left"
+ height="23"
+ label="Apply"
+ top_pad="10"
+ name="btn_apply"
+ width="100" />
+ <button
+ follows="top|left"
+ height="23"
+ label="Reset"
+ layout="topleft"
+ left_pad="10"
+ top_delta="0"
+ name="btn_cancel"
+ width="100" />
+
</layout_panel>
</layout_stack>
</panel>