From b08742d0b3e0000430b8ae772c7c4d25cfe084fa Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 28 Apr 2022 11:53:43 -0600 Subject: Add a (broken) material upload handler fxn --- indra/llinventory/llfoldertype.h | 4 ++++ indra/llinventory/llinventorytype.cpp | 1 + indra/llinventory/llinventorytype.h | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llfoldertype.h b/indra/llinventory/llfoldertype.h index 1f174520da..19f4d61b5b 100644 --- a/indra/llinventory/llfoldertype.h +++ b/indra/llinventory/llfoldertype.h @@ -93,9 +93,13 @@ public: FT_SETTINGS = 56, + FT_MATERIAL = 57, + FT_COUNT, FT_NONE = -1 + + // When adding, see note at bottom of LLAssetType::Etype }; static EType lookup(const std::string& type_name); diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index 853ed655f5..71223d65b9 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -154,6 +154,7 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] = LLInventoryType::IT_NONE, // 54 AT_RESERVED_5 LLInventoryType::IT_SETTINGS, // 55 AT_SETTINGS + LLInventoryType::IT_MATERIAL, // 56 AT_MATERIAL }; // static diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index b6e7fb047f..e1aac054f6 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -65,7 +65,8 @@ public: IT_WIDGET = 23, IT_PERSON = 24, IT_SETTINGS = 25, - IT_COUNT = 26, + IT_MATERIAL = 26, + IT_COUNT = 27, IT_UNKNOWN = 255, IT_NONE = -1 -- cgit v1.2.3 From c9ef206e39063c46c1fbab355c1a015e3e8b022e Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Thu, 28 Apr 2022 13:08:37 -0700 Subject: Beginning viewer side work for SL-17198 new asset and inventory types for Materials --- indra/llinventory/llinventorytype.cpp | 3 ++- indra/llinventory/llinventorytype.h | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index 853ed655f5..57d521429c 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -153,7 +153,8 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] = LLInventoryType::IT_NONE, // 53 AT_RESERVED_4 LLInventoryType::IT_NONE, // 54 AT_RESERVED_5 - LLInventoryType::IT_SETTINGS, // 55 AT_SETTINGS + LLInventoryType::IT_SETTINGS, // 55 AT_SETTINGS <- why doesnt this match the value in llassettype.h? -brad + LLInventoryType::IT_MATERIAL, // 57 AT_MATERIAL }; // static diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index b6e7fb047f..a5543814d8 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -65,7 +65,8 @@ public: IT_WIDGET = 23, IT_PERSON = 24, IT_SETTINGS = 25, - IT_COUNT = 26, + IT_MATERIAL = 26, + IT_COUNT = 27, IT_UNKNOWN = 255, IT_NONE = -1 @@ -118,6 +119,8 @@ public: ICONNAME_SETTINGS_WATER, ICONNAME_SETTINGS_DAY, + ICONNAME_MATERIAL, + ICONNAME_INVALID, ICONNAME_UNKNOWN, ICONNAME_COUNT, -- cgit v1.2.3 From 929abcd296199ab4ed7a0b08166e284502f7b8df Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 10 Jun 2022 16:36:38 -0500 Subject: SL-17523 Add reflection probe ambiance to windlight settings and integrate with UI and ReflectionMapManager --- indra/llinventory/llsettingssky.cpp | 17 +++++++++++++++++ indra/llinventory/llsettingssky.h | 6 ++++++ 2 files changed, 23 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 83a92f08d0..d4e616abc2 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -131,6 +131,8 @@ const std::string LLSettingsSky::SETTING_SKY_MOISTURE_LEVEL("moisture_level"); const std::string LLSettingsSky::SETTING_SKY_DROPLET_RADIUS("droplet_radius"); const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); +const std::string LLSettingsSky::SETTING_REFLECTION_PROBE_AMBIANCE("reflection_probe_ambiance"); + const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("3ae23978-ac82-bcf3-a9cb-ba6e52dcb9ad"); static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver @@ -630,6 +632,9 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() validation.push_back(Validator(SETTING_SKY_ICE_LEVEL, false, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_REFLECTION_PROBE_AMBIANCE, false, LLSD::TypeReal, + boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); validation.push_back(Validator(SETTING_MIE_CONFIG, true, LLSD::TypeArray, &validateMieLayers)); @@ -755,6 +760,8 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_SKY_DROPLET_RADIUS] = 800.0f; dfltsetting[SETTING_SKY_ICE_LEVEL] = 0.0f; + dfltsetting[SETTING_REFLECTION_PROBE_AMBIANCE] = 0.0f; + dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault(); dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault(); dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault(); @@ -1132,6 +1139,11 @@ void LLSettingsSky::setSkyIceLevel(F32 ice_level) setValue(SETTING_SKY_ICE_LEVEL, ice_level); } +void LLSettingsSky::setReflectionProbeAmbiance(F32 ambiance) +{ + setValue(SETTING_REFLECTION_PROBE_AMBIANCE, ambiance); +} + void LLSettingsSky::setAmbientColor(const LLColor3 &val) { mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT] = val.getValue(); @@ -1420,6 +1432,11 @@ F32 LLSettingsSky::getSkyIceLevel() const return mSettings[SETTING_SKY_ICE_LEVEL].asReal(); } +F32 LLSettingsSky::getReflectionProbeAmbiance() const +{ + return mSettings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal(); +} + F32 LLSettingsSky::getSkyBottomRadius() const { return mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index fa9326f006..715d31518b 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -97,6 +97,8 @@ public: static const std::string SETTING_SKY_DROPLET_RADIUS; static const std::string SETTING_SKY_ICE_LEVEL; + static const std::string SETTING_REFLECTION_PROBE_AMBIANCE; + static const std::string SETTING_LEGACY_HAZE; static const LLUUID DEFAULT_ASSET_ID; @@ -131,6 +133,8 @@ public: F32 getSkyDropletRadius() const; F32 getSkyIceLevel() const; + F32 getReflectionProbeAmbiance() const; + // Return first (only) profile layer represented in LLSD LLSD getRayleighConfig() const; LLSD getMieConfig() const; @@ -159,6 +163,8 @@ public: void setSkyDropletRadius(F32 radius); void setSkyIceLevel(F32 ice_level); + void setReflectionProbeAmbiance(F32 ambiance); + //--------------------------------------------------------------------- LLColor3 getAmbientColor() const; void setAmbientColor(const LLColor3 &val); -- cgit v1.2.3 From 1559ad47924711f64ecd540bc605d9aa1f7221e6 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 24 Jun 2022 13:09:24 +0300 Subject: SL-17649 Icon for Material type in Inventory --- indra/llinventory/llinventorytype.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index 57d521429c..ceda2f3caf 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -86,6 +86,7 @@ LLInventoryDictionary::LLInventoryDictionary() addEntry(LLInventoryType::IT_WIDGET, new InventoryEntry("widget", "widget", 1, LLAssetType::AT_WIDGET)); addEntry(LLInventoryType::IT_PERSON, new InventoryEntry("person", "person", 1, LLAssetType::AT_PERSON)); addEntry(LLInventoryType::IT_SETTINGS, new InventoryEntry("settings", "settings", 1, LLAssetType::AT_SETTINGS)); + addEntry(LLInventoryType::IT_MATERIAL, new InventoryEntry("material", "render material", 1, LLAssetType::AT_MATERIAL)); } -- cgit v1.2.3 From 189723fd469c50c67f1e6cd51996adeb26ded637 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 15 Sep 2022 21:35:50 +0300 Subject: SL-18161 Properly list pbr material folder --- indra/llinventory/llfoldertype.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llfoldertype.cpp b/indra/llinventory/llfoldertype.cpp index 675da65af2..d2c3b419ab 100644 --- a/indra/llinventory/llfoldertype.cpp +++ b/indra/llinventory/llfoldertype.cpp @@ -122,6 +122,7 @@ LLFolderDictionary::LLFolderDictionary() addEntry(LLFolderType::FT_MARKETPLACE_VERSION, new FolderEntry("version", FALSE, FALSE, FALSE)); addEntry(LLFolderType::FT_SETTINGS, new FolderEntry("settings", TRUE, FALSE, TRUE)); + addEntry(LLFolderType::FT_MATERIAL, new FolderEntry("material", TRUE, FALSE, TRUE)); addEntry(LLFolderType::FT_NONE, new FolderEntry("-1", FALSE, FALSE, FALSE)); }; -- cgit v1.2.3 From d0af1ca7cb2174c479139692ed764ccaca92a8d5 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 16 Dec 2022 13:35:16 -0600 Subject: SL-18780 Feedback cloud coverage into reflection probe ambiance to recover legacy behavior of cloud coverage brightening ambient lighting without destroying the ability to have good probe driven ambiance. --- indra/llinventory/llsettingssky.cpp | 10 ++++++++++ indra/llinventory/llsettingssky.h | 4 ++++ 2 files changed, 14 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index d4e616abc2..4004793ffd 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1437,6 +1437,16 @@ F32 LLSettingsSky::getReflectionProbeAmbiance() const return mSettings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal(); } +F32 LLSettingsSky::getTotalReflectionProbeAmbiance() const +{ + // feed cloud shadow back into reflection probe ambiance to mimic pre-reflection-probe behavior + // without brightening dark/interior spaces + F32 probe_ambiance = getReflectionProbeAmbiance(); + probe_ambiance += (1.f - probe_ambiance) * getCloudShadow()*0.5f; + + return probe_ambiance; +} + F32 LLSettingsSky::getSkyBottomRadius() const { return mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 715d31518b..b17b32ebb1 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -133,8 +133,12 @@ public: F32 getSkyDropletRadius() const; F32 getSkyIceLevel() const; + // get the probe ambiance setting as stored in the sky settings asset F32 getReflectionProbeAmbiance() const; + // get the probe ambiance setting to use for rendering (adjusted by cloud shadow, aka cloud coverage) + F32 getTotalReflectionProbeAmbiance() const; + // Return first (only) profile layer represented in LLSD LLSD getRayleighConfig() const; LLSD getMieConfig() const; -- cgit v1.2.3 From 055883beb5709dfb4814c8c5e90ea326abc07724 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 7 Feb 2023 12:59:38 -0600 Subject: SL-18780 Turn down contribution of cloud shadow to reflection probe ambiance and make the value a debug setting. --- indra/llinventory/llsettingssky.cpp | 5 +++-- indra/llinventory/llsettingssky.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 4004793ffd..c976307936 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1437,12 +1437,13 @@ F32 LLSettingsSky::getReflectionProbeAmbiance() const return mSettings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal(); } -F32 LLSettingsSky::getTotalReflectionProbeAmbiance() const +F32 LLSettingsSky::getTotalReflectionProbeAmbiance(F32 cloud_shadow_scale) const { // feed cloud shadow back into reflection probe ambiance to mimic pre-reflection-probe behavior // without brightening dark/interior spaces F32 probe_ambiance = getReflectionProbeAmbiance(); - probe_ambiance += (1.f - probe_ambiance) * getCloudShadow()*0.5f; + + probe_ambiance += (1.f - probe_ambiance) * getCloudShadow()*cloud_shadow_scale; return probe_ambiance; } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index b17b32ebb1..7ae569dd4c 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -137,7 +137,7 @@ public: F32 getReflectionProbeAmbiance() const; // get the probe ambiance setting to use for rendering (adjusted by cloud shadow, aka cloud coverage) - F32 getTotalReflectionProbeAmbiance() const; + F32 getTotalReflectionProbeAmbiance(F32 cloud_shadow_scale) const; // Return first (only) profile layer represented in LLSD LLSD getRayleighConfig() const; -- cgit v1.2.3 From b127e1bd12442953801eb6b53f052aa69d8ee580 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 6 Apr 2023 18:58:24 -0500 Subject: SL-19538 Nudge sun brightness and replace "gamma" with an exposure scaler approximation --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index c976307936..46a48e601f 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -633,7 +633,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); validation.push_back(Validator(SETTING_REFLECTION_PROBE_AMBIANCE, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(10.0f))))); validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); -- cgit v1.2.3 From d6b99cff8ab7550b5e0316c831087050f19c91c6 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Wed, 12 Apr 2023 14:51:56 -0500 Subject: SL-19390 Make "Cloud Coverage" feedback into ambient when probe ambiance is zero and feedback into probe ambiance when probe ambiance is not zero. --- indra/llinventory/llsettingssky.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 46a48e601f..8e801db2dc 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1443,7 +1443,10 @@ F32 LLSettingsSky::getTotalReflectionProbeAmbiance(F32 cloud_shadow_scale) const // without brightening dark/interior spaces F32 probe_ambiance = getReflectionProbeAmbiance(); - probe_ambiance += (1.f - probe_ambiance) * getCloudShadow()*cloud_shadow_scale; + if (probe_ambiance > 0.f) + { + probe_ambiance += (1.f - probe_ambiance) * getCloudShadow() * cloud_shadow_scale; + } return probe_ambiance; } -- cgit v1.2.3 From 572d313bcfb7d80748f66aac38d62eff5960ac15 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 4 May 2023 23:06:00 +0300 Subject: DRTVWR-559 LLSD array build fix --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index e07858697e..eb8385281c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -630,7 +630,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); validation.push_back(Validator(SETTING_REFLECTION_PROBE_AMBIANCE, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(10.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(llsd::array(0.0f, 10.0f))))); validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); -- cgit v1.2.3 From 8d20d61b4d305b985de4837bb0ed3ddaedb208d1 Mon Sep 17 00:00:00 2001 From: Brad Linden Date: Wed, 31 May 2023 10:33:03 -0700 Subject: Fix divide by zero causing NaN with certain day cycles in DRTVWR-559 --- indra/llinventory/llsettingsbase.cpp | 1 + indra/llinventory/llsettingsbase.h | 1 + 2 files changed, 2 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 936b166409..bcf8bf6264 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -693,6 +693,7 @@ void LLSettingsBlender::update(const LLSettingsBase::BlendFactor& blendf) F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_in) { LLSettingsBase::TrackPosition blendf = blendf_in; + llassert(!isnan(blendf)); if (blendf >= 1.0) { triggerComplete(); diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h index 1f0589f571..50276b801a 100644 --- a/indra/llinventory/llsettingsbase.h +++ b/indra/llinventory/llsettingsbase.h @@ -467,6 +467,7 @@ protected: class LLSettingsBlenderTimeDelta : public LLSettingsBlender { +protected: LOG_CLASS(LLSettingsBlenderTimeDelta); public: static const LLSettingsBase::BlendFactor MIN_BLEND_DELTA; -- cgit v1.2.3 From 50ec54831de88926ca13c9a72d89006ceda6c355 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Thu, 1 Jun 2023 19:49:23 -0500 Subject: DRTVWR-559 Revert skies to be very close to release and disable tone mapping when probe ambiance is zero. Hack for desaturating legacy materials has been removed for performance and quality reasons. Adds a new setting for auto adjusting legacy skies. This is the PBR "opt out" button. If disabled, legacy skies will disable tonemapping, automatic probe ambiance, and HDR/exposure. If enabled, legacy skies will behave as if probe ambiance and HDR scale are 1.0, and ambient will be cut in half. HDR scale will act as a sky brightener, but will automatically adjust dynamic exposure so the sky will be properly exposed. If you want relatively even exposure all the time, set HDR Scale to 1.0. If you want a high range of exposures between indoor/dark areas and outdoor/bright areas, increase HDR Scale. Also tuned up SSAO (thanks Rye!). Reviewed with Brad. --- indra/llinventory/llsettingssky.cpp | 17 +++++++++++++---- indra/llinventory/llsettingssky.h | 13 +++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index eb8385281c..6521ec8b43 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -403,6 +403,7 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) : mNextRainbowTextureId(), mNextHaloTextureId() { + mCanAutoAdjust = !data.has(SETTING_REFLECTION_PROBE_AMBIANCE); } LLSettingsSky::LLSettingsSky(): @@ -425,6 +426,8 @@ void LLSettingsSky::replaceSettings(LLSD settings) mNextBloomTextureId.setNull(); mNextRainbowTextureId.setNull(); mNextHaloTextureId.setNull(); + + mCanAutoAdjust = !settings.has(SETTING_REFLECTION_PROBE_AMBIANCE); } void LLSettingsSky::replaceWithSky(LLSettingsSky::ptr_t pother) @@ -437,6 +440,7 @@ void LLSettingsSky::replaceWithSky(LLSettingsSky::ptr_t pother) mNextBloomTextureId = pother->mNextBloomTextureId; mNextRainbowTextureId = pother->mNextRainbowTextureId; mNextHaloTextureId = pother->mNextHaloTextureId; + mCanAutoAdjust = pother->mCanAutoAdjust; } void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) @@ -1429,18 +1433,23 @@ F32 LLSettingsSky::getSkyIceLevel() const return mSettings[SETTING_SKY_ICE_LEVEL].asReal(); } -F32 LLSettingsSky::getReflectionProbeAmbiance() const +F32 LLSettingsSky::getReflectionProbeAmbiance(bool auto_adjust) const { + if (auto_adjust && canAutoAdjust()) + { + return 1.f; + } + return mSettings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal(); } -F32 LLSettingsSky::getTotalReflectionProbeAmbiance(F32 cloud_shadow_scale) const +F32 LLSettingsSky::getTotalReflectionProbeAmbiance(F32 cloud_shadow_scale, bool auto_adjust) const { // feed cloud shadow back into reflection probe ambiance to mimic pre-reflection-probe behavior // without brightening dark/interior spaces - F32 probe_ambiance = getReflectionProbeAmbiance(); + F32 probe_ambiance = getReflectionProbeAmbiance(auto_adjust); - if (probe_ambiance > 0.f) + if (probe_ambiance > 0.f && probe_ambiance < 1.f) { probe_ambiance += (1.f - probe_ambiance) * getCloudShadow() * cloud_shadow_scale; } diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 7ae569dd4c..f55e9f0631 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -134,10 +134,12 @@ public: F32 getSkyIceLevel() const; // get the probe ambiance setting as stored in the sky settings asset - F32 getReflectionProbeAmbiance() const; + // auto_adjust - if true and canAutoAdjust() is true, return 1.0 + F32 getReflectionProbeAmbiance(bool auto_adjust = false) const; // get the probe ambiance setting to use for rendering (adjusted by cloud shadow, aka cloud coverage) - F32 getTotalReflectionProbeAmbiance(F32 cloud_shadow_scale) const; + // auto_adjust - if true and canAutoAdjust() is true, return 1.0 + F32 getTotalReflectionProbeAmbiance(F32 cloud_shadow_scale, bool auto_adjust = false) const; // Return first (only) profile layer represented in LLSD LLSD getRayleighConfig() const; @@ -334,6 +336,10 @@ public: F32 aniso_factor = 0.0f); virtual void updateSettings() SETTINGS_OVERRIDE; + + // if true, this sky is a candidate for auto-adjustment + bool canAutoAdjust() const { return mCanAutoAdjust; } + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; @@ -377,6 +383,9 @@ private: mutable LLColor4 mTotalAmbient; mutable LLColor4 mHazeColor; + // if true, this sky is a candidate for auto adjustment + bool mCanAutoAdjust = true; + typedef std::map mapNameToUniformId_t; static mapNameToUniformId_t sNameToUniformMapping; -- cgit v1.2.3 From 6d2d0c8ee59eed641937b19cf19a1ff08762cbfa Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 2 Jun 2023 17:27:57 -0400 Subject: SL-18837: Boost.Bind _1, _2 placeholders are no longer global. This was a longstanding complaint: that Boost shouldn't dump the (somewhat mysterious) _1, _2 et al. names into the global namespace. Recent Boost has fixed that, requiring 'using namespace boost::placeholders;' if you want to use them unqualified. --- indra/llinventory/llsettingsbase.cpp | 4 ++++ indra/llinventory/llsettingssky.cpp | 4 ++++ indra/llinventory/llsettingswater.cpp | 4 ++++ 3 files changed, 12 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 936b166409..ba338dbbee 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -31,6 +31,10 @@ #include #include "llsdserialize.h" +#include + +// allow unqualified _1, _2 et al. to mean boost::bind placeholders +using namespace boost::placeholders; //========================================================================= namespace diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index a129f0a6f0..0244b2585e 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -31,6 +31,10 @@ #include "lltrace.h" #include "llfasttimer.h" #include "v3colorutil.h" +#include + +// allow unqualified _1, _2 et al. to mean boost::bind placeholders +using namespace boost::placeholders; //========================================================================= namespace diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index d732032a6c..bc53a46255 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -32,6 +32,10 @@ #include "llfasttimer.h" #include "v3colorutil.h" #include "indra_constants.h" +#include + +// allow unqualified _1, _2 et al. to mean boost::bind placeholders +using namespace boost::placeholders; const std::string LLSettingsWater::SETTING_BLUR_MULTIPLIER("blur_multiplier"); const std::string LLSettingsWater::SETTING_FOG_COLOR("water_fog_color"); -- cgit v1.2.3 From ddc6d219585251ea6246f56bfa5aba6b3e2fd4f0 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 5 Jun 2023 21:47:52 -0400 Subject: SL-18837: Followup to 19e9e8c: global Boost.Bind placeholders do not need 'using' directive, given BOOST_BIND_GLOBAL_PLACEHOLDERS. --- indra/llinventory/llsettingsbase.cpp | 3 --- indra/llinventory/llsettingssky.cpp | 3 --- indra/llinventory/llsettingswater.cpp | 3 --- 3 files changed, 9 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index ba338dbbee..6ea93e045d 100644 --- a/indra/llinventory/llsettingsbase.cpp +++ b/indra/llinventory/llsettingsbase.cpp @@ -33,9 +33,6 @@ #include "llsdserialize.h" #include -// allow unqualified _1, _2 et al. to mean boost::bind placeholders -using namespace boost::placeholders; - //========================================================================= namespace { diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 0244b2585e..51fca76518 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -33,9 +33,6 @@ #include "v3colorutil.h" #include -// allow unqualified _1, _2 et al. to mean boost::bind placeholders -using namespace boost::placeholders; - //========================================================================= namespace { diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index bc53a46255..89156000b0 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -34,9 +34,6 @@ #include "indra_constants.h" #include -// allow unqualified _1, _2 et al. to mean boost::bind placeholders -using namespace boost::placeholders; - const std::string LLSettingsWater::SETTING_BLUR_MULTIPLIER("blur_multiplier"); const std::string LLSettingsWater::SETTING_FOG_COLOR("water_fog_color"); const std::string LLSettingsWater::SETTING_FOG_DENSITY("water_fog_density"); -- cgit v1.2.3 From c96a00f12f868b9260f517a6a8552bce0b564099 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Mon, 12 Jun 2023 10:08:27 -0500 Subject: SL-19856 Adjust water fog density range. Incidental decruft. --- indra/llinventory/llsettingswater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index d732032a6c..348848b29a 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -230,7 +230,7 @@ LLSettingsWater::validation_list_t LLSettingsWater::validationList() llsd::array(0.0f, 0.0f, 0.0f, 1.0f), llsd::array(1.0f, 1.0f, 1.0f, 1.0f)))); validation.push_back(Validator(SETTING_FOG_DENSITY, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(-10.0f, 10.0f)))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.001f, 100.0f)))); validation.push_back(Validator(SETTING_FOG_MOD, true, LLSD::TypeReal, boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 20.0f)))); validation.push_back(Validator(SETTING_FRESNEL_OFFSET, true, LLSD::TypeReal, -- cgit v1.2.3 From 3a1b60b2baa80218a79bf33cf983bd28df4f2343 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Thu, 22 Jun 2023 17:10:24 -0500 Subject: SL-19785 Fix for blown out skies from Glow Focus. Add notification when editing legacy skies. --- indra/llinventory/llsettingssky.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 6521ec8b43..8338245897 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1142,6 +1142,7 @@ void LLSettingsSky::setSkyIceLevel(F32 ice_level) void LLSettingsSky::setReflectionProbeAmbiance(F32 ambiance) { + mCanAutoAdjust = false; // we've now touched this sky in a "new" way, it can no longer auto adjust setValue(SETTING_REFLECTION_PROBE_AMBIANCE, ambiance); } -- cgit v1.2.3 From 7a4b8edf9c02818651efad7b277bbb08d18e22f5 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Fri, 28 Jul 2023 18:10:40 -0500 Subject: SL-20067 Make new default midday the new default sky setting --- indra/llinventory/llsettingssky.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 8338245897..3f4b15b8b1 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -133,7 +133,7 @@ const std::string LLSettingsSky::SETTING_SKY_ICE_LEVEL("ice_level"); const std::string LLSettingsSky::SETTING_REFLECTION_PROBE_AMBIANCE("reflection_probe_ambiance"); -const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("3ae23978-ac82-bcf3-a9cb-ba6e52dcb9ad"); +const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("651510b8-5f4d-8991-1592-e7eeab2a5a06"); static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver -- cgit v1.2.3 From 894c9e0417e7b29aaf31c673ca040dff93eb36ef Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 22 Aug 2023 13:17:58 -0500 Subject: SL-19842 WIP -- Move sky auto adjustment magic numbers to debug settings. --- indra/llinventory/llsettingssky.cpp | 5 ++++- indra/llinventory/llsettingssky.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 3f4b15b8b1..976a61fb69 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,6 +32,7 @@ #include "llfasttimer.h" #include "v3colorutil.h" + //========================================================================= namespace { @@ -135,6 +136,8 @@ const std::string LLSettingsSky::SETTING_REFLECTION_PROBE_AMBIANCE("reflection_p const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("651510b8-5f4d-8991-1592-e7eeab2a5a06"); +F32 LLSettingsSky::sAutoAdjustProbeAmbiance = 1.f; + static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b"); @@ -1438,7 +1441,7 @@ F32 LLSettingsSky::getReflectionProbeAmbiance(bool auto_adjust) const { if (auto_adjust && canAutoAdjust()) { - return 1.f; + return sAutoAdjustProbeAmbiance; } return mSettings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index f55e9f0631..7ba7a9ba06 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -103,6 +103,8 @@ public: static const LLUUID DEFAULT_ASSET_ID; + static F32 sAutoAdjustProbeAmbiance; + typedef PTR_NAMESPACE::shared_ptr ptr_t; //--------------------------------------------------------------------- -- cgit v1.2.3 From 1514ade10dc0f64c476ff405256b86fb6a1d9b57 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Mon, 11 Sep 2023 09:20:00 -0500 Subject: SL-19842 WIP -- Now that probes can override ambient, unroll ambient darkening hacks. --- indra/llinventory/llsettingssky.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 976a61fb69..fedbed2990 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1449,6 +1449,7 @@ F32 LLSettingsSky::getReflectionProbeAmbiance(bool auto_adjust) const F32 LLSettingsSky::getTotalReflectionProbeAmbiance(F32 cloud_shadow_scale, bool auto_adjust) const { +#if 0 // feed cloud shadow back into reflection probe ambiance to mimic pre-reflection-probe behavior // without brightening dark/interior spaces F32 probe_ambiance = getReflectionProbeAmbiance(auto_adjust); @@ -1459,6 +1460,9 @@ F32 LLSettingsSky::getTotalReflectionProbeAmbiance(F32 cloud_shadow_scale, bool } return probe_ambiance; +#else + return getReflectionProbeAmbiance(auto_adjust); +#endif } F32 LLSettingsSky::getSkyBottomRadius() const -- cgit v1.2.3 From b9b38db5678556e1aa2710a86004dc5a14f97242 Mon Sep 17 00:00:00 2001 From: "Brad Kittenbrink (Brad Linden)" Date: Fri, 28 Jul 2023 16:52:06 -0700 Subject: Fix for SL-19968 objects missing timing bug due to stall during login ensure inventory skeleton loading doesn't block the message system from processing packets. --- indra/llinventory/llinventory.cpp | 128 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 5adf1fa0e6..8b7a93a066 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -904,6 +904,8 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) mInventoryType = LLInventoryType::IT_NONE; mAssetUUID.setNull(); } + +#if 0 // old implementation. makes a LOT of temporary copies and LLSD::safe(impl) calls std::string w; w = INV_ITEM_ID_LABEL; @@ -1050,6 +1052,132 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) { mCreationDate = sd[w].asInteger(); } +#else // if 0 - new implementation follows + + // iterate as map to avoid making unnecessary temp copies of everything + LLSD::map_const_iterator i, end; + end = sd.endMap(); + for (i = sd.beginMap(); i != end; ++i) + { + if (i->first == INV_ITEM_ID_LABEL) + { + mUUID = i->second; + } + + if (i->first == INV_PARENT_ID_LABEL) + { + mParentUUID = i->second; + } + + if (i->first == INV_PERMISSIONS_LABEL) + { + mPermissions = ll_permissions_from_sd(i->second); + } + + if (i->first == INV_SALE_INFO_LABEL) + { + // Sale info used to contain next owner perm. It is now in + // the permissions. Thus, we read that out, and fix legacy + // objects. It's possible this op would fail, but it + // should pick up the vast majority of the tasks. + BOOL has_perm_mask = FALSE; + U32 perm_mask = 0; + if (!mSaleInfo.fromLLSD(i->second, has_perm_mask, perm_mask)) + { + goto fail; + } + if (has_perm_mask) + { + if (perm_mask == PERM_NONE) + { + perm_mask = mPermissions.getMaskOwner(); + } + // fair use fix. + if (!(perm_mask & PERM_COPY)) + { + perm_mask |= PERM_TRANSFER; + } + mPermissions.setMaskNext(perm_mask); + } + } + + if (i->first == INV_SHADOW_ID_LABEL) + { + mAssetUUID = i->second; + LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); + cipher.decrypt(mAssetUUID.mData, UUID_BYTES); + } + + if (i->first == INV_ASSET_ID_LABEL) + { + mAssetUUID = i->second; + } + + if (i->first == INV_LINKED_ID_LABEL) + { + mAssetUUID = i->second; + } + + if (i->first == INV_ASSET_TYPE_LABEL) + { + LLSD const &label = i->second; + if (label.isString()) + { + mType = LLAssetType::lookup(label.asString().c_str()); + } + else if (label.isInteger()) + { + S8 type = (U8) label.asInteger(); + mType = static_cast(type); + } + } + + if (i->first == INV_INVENTORY_TYPE_LABEL) + { + LLSD const &label = i->second; + if (label.isString()) + { + mInventoryType = LLInventoryType::lookup(label.asString().c_str()); + } + else if (label.isInteger()) + { + S8 type = (U8) label.asInteger(); + mInventoryType = static_cast(type); + } + } + + if (i->first == INV_FLAGS_LABEL) + { + LLSD const &label = i->second; + if (label.isBinary()) + { + mFlags = ll_U32_from_sd(label); + } + else if (label.isInteger()) + { + mFlags = label.asInteger(); + } + } + + if (i->first == INV_NAME_LABEL) + { + mName = i->second.asString(); + LLStringUtil::replaceNonstandardASCII(mName, ' '); + LLStringUtil::replaceChar(mName, '|', ' '); + } + + if (i->first == INV_DESC_LABEL) + { + mDescription = i->second.asString(); + LLStringUtil::replaceNonstandardASCII(mDescription, ' '); + } + + if (i->first == INV_CREATION_DATE_LABEL) + { + mCreationDate = i->second.asInteger(); + } + } +#endif // new version // Need to convert 1.0 simstate files to a useful inventory type // and potentially deal with bad inventory tyes eg, a landmark -- cgit v1.2.3 From 826310bcab9df0ae79d805ca1f4d1842cbeb2ed2 Mon Sep 17 00:00:00 2001 From: Brad Linden Date: Thu, 2 Nov 2023 16:35:39 -0700 Subject: Fixed INV_THUMBNAIL_LABEL handling missed in rebase for SL-19968 work --- indra/llinventory/llinventory.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 8b7a93a066..2de5af94a3 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -1054,6 +1054,8 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) } #else // if 0 - new implementation follows + mThumbnailUUID.setNull(); + // iterate as map to avoid making unnecessary temp copies of everything LLSD::map_const_iterator i, end; end = sd.endMap(); @@ -1069,6 +1071,31 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) mParentUUID = i->second; } + if (i->first == INV_THUMBNAIL_LABEL) + { + const LLSD &thumbnail_map = i->second; + const std::string w = INV_ASSET_ID_LABEL; + if (thumbnail_map.has(w)) + { + mThumbnailUUID = thumbnail_map[w]; + } + /* Example: + asset_id + acc0ec86 - 17f2 - 4b92 - ab41 - 6718b1f755f7 + perms + 8 + service + 3 + version + 1 + */ + } + + if (i->first == INV_THUMBNAIL_ID_LABEL) + { + mThumbnailUUID = i->second.asUUID(); + } + if (i->first == INV_PERMISSIONS_LABEL) { mPermissions = ll_permissions_from_sd(i->second); -- cgit v1.2.3 From afa45530f745af8c9d595948ac957b12664cca2c Mon Sep 17 00:00:00 2001 From: Brad Linden Date: Fri, 3 Nov 2023 13:09:54 -0700 Subject: SL-19968 disabled pump_idle_network for now due to it causing several failures during login also added suggested continue statements, and removed obsolete LLInventoryItem::fromLLSD deserialization codepath. --- indra/llinventory/llinventory.cpp | 173 ++++---------------------------------- 1 file changed, 18 insertions(+), 155 deletions(-) (limited to 'indra/llinventory') diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 2de5af94a3..55bcc7c5b2 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -905,155 +905,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) mAssetUUID.setNull(); } -#if 0 // old implementation. makes a LOT of temporary copies and LLSD::safe(impl) calls - std::string w; - - w = INV_ITEM_ID_LABEL; - if (sd.has(w)) - { - mUUID = sd[w]; - } - w = INV_PARENT_ID_LABEL; - if (sd.has(w)) - { - mParentUUID = sd[w]; - } - mThumbnailUUID.setNull(); - w = INV_THUMBNAIL_LABEL; - if (sd.has(w)) - { - const LLSD &thumbnail_map = sd[w]; - w = INV_ASSET_ID_LABEL; - if (thumbnail_map.has(w)) - { - mThumbnailUUID = thumbnail_map[w]; - } - /* Example: - asset_id - acc0ec86 - 17f2 - 4b92 - ab41 - 6718b1f755f7 - perms - 8 - service - 3 - version - 1 - */ - } - else - { - w = INV_THUMBNAIL_ID_LABEL; - if (sd.has(w)) - { - mThumbnailUUID = sd[w].asUUID(); - } - } - w = INV_PERMISSIONS_LABEL; - if (sd.has(w)) - { - mPermissions = ll_permissions_from_sd(sd[w]); - } - w = INV_SALE_INFO_LABEL; - if (sd.has(w)) - { - // Sale info used to contain next owner perm. It is now in - // the permissions. Thus, we read that out, and fix legacy - // objects. It's possible this op would fail, but it - // should pick up the vast majority of the tasks. - BOOL has_perm_mask = FALSE; - U32 perm_mask = 0; - if (!mSaleInfo.fromLLSD(sd[w], has_perm_mask, perm_mask)) - { - goto fail; - } - if (has_perm_mask) - { - if(perm_mask == PERM_NONE) - { - perm_mask = mPermissions.getMaskOwner(); - } - // fair use fix. - if(!(perm_mask & PERM_COPY)) - { - perm_mask |= PERM_TRANSFER; - } - mPermissions.setMaskNext(perm_mask); - } - } - w = INV_SHADOW_ID_LABEL; - if (sd.has(w)) - { - mAssetUUID = sd[w]; - LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); - cipher.decrypt(mAssetUUID.mData, UUID_BYTES); - } - w = INV_ASSET_ID_LABEL; - if (sd.has(w)) - { - mAssetUUID = sd[w]; - } - w = INV_LINKED_ID_LABEL; - if (sd.has(w)) - { - mAssetUUID = sd[w]; - } - w = INV_ASSET_TYPE_LABEL; - if (sd.has(w)) - { - if (sd[w].isString()) - { - mType = LLAssetType::lookup(sd[w].asString().c_str()); - } - else if (sd[w].isInteger()) - { - S8 type = (U8)sd[w].asInteger(); - mType = static_cast(type); - } - } - w = INV_INVENTORY_TYPE_LABEL; - if (sd.has(w)) - { - if (sd[w].isString()) - { - mInventoryType = LLInventoryType::lookup(sd[w].asString().c_str()); - } - else if (sd[w].isInteger()) - { - S8 type = (U8)sd[w].asInteger(); - mInventoryType = static_cast(type); - } - } - w = INV_FLAGS_LABEL; - if (sd.has(w)) - { - if (sd[w].isBinary()) - { - mFlags = ll_U32_from_sd(sd[w]); - } - else if(sd[w].isInteger()) - { - mFlags = sd[w].asInteger(); - } - } - w = INV_NAME_LABEL; - if (sd.has(w)) - { - mName = sd[w].asString(); - LLStringUtil::replaceNonstandardASCII(mName, ' '); - LLStringUtil::replaceChar(mName, '|', ' '); - } - w = INV_DESC_LABEL; - if (sd.has(w)) - { - mDescription = sd[w].asString(); - LLStringUtil::replaceNonstandardASCII(mDescription, ' '); - } - w = INV_CREATION_DATE_LABEL; - if (sd.has(w)) - { - mCreationDate = sd[w].asInteger(); - } -#else // if 0 - new implementation follows - + // TODO - figure out if this should be moved into the noclobber fields above mThumbnailUUID.setNull(); // iterate as map to avoid making unnecessary temp copies of everything @@ -1064,11 +916,13 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) if (i->first == INV_ITEM_ID_LABEL) { mUUID = i->second; + continue; } if (i->first == INV_PARENT_ID_LABEL) { mParentUUID = i->second; + continue; } if (i->first == INV_THUMBNAIL_LABEL) @@ -1089,16 +943,19 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) version 1 */ - } + continue; + } if (i->first == INV_THUMBNAIL_ID_LABEL) { mThumbnailUUID = i->second.asUUID(); + continue; } if (i->first == INV_PERMISSIONS_LABEL) { mPermissions = ll_permissions_from_sd(i->second); + continue; } if (i->first == INV_SALE_INFO_LABEL) @@ -1111,7 +968,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) U32 perm_mask = 0; if (!mSaleInfo.fromLLSD(i->second, has_perm_mask, perm_mask)) { - goto fail; + return false; } if (has_perm_mask) { @@ -1126,6 +983,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) } mPermissions.setMaskNext(perm_mask); } + continue; } if (i->first == INV_SHADOW_ID_LABEL) @@ -1133,16 +991,19 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) mAssetUUID = i->second; LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); cipher.decrypt(mAssetUUID.mData, UUID_BYTES); + continue; } if (i->first == INV_ASSET_ID_LABEL) { mAssetUUID = i->second; + continue; } if (i->first == INV_LINKED_ID_LABEL) { mAssetUUID = i->second; + continue; } if (i->first == INV_ASSET_TYPE_LABEL) @@ -1157,6 +1018,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) S8 type = (U8) label.asInteger(); mType = static_cast(type); } + continue; } if (i->first == INV_INVENTORY_TYPE_LABEL) @@ -1171,6 +1033,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) S8 type = (U8) label.asInteger(); mInventoryType = static_cast(type); } + continue; } if (i->first == INV_FLAGS_LABEL) @@ -1184,6 +1047,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) { mFlags = label.asInteger(); } + continue; } if (i->first == INV_NAME_LABEL) @@ -1191,20 +1055,22 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) mName = i->second.asString(); LLStringUtil::replaceNonstandardASCII(mName, ' '); LLStringUtil::replaceChar(mName, '|', ' '); + continue; } if (i->first == INV_DESC_LABEL) { mDescription = i->second.asString(); LLStringUtil::replaceNonstandardASCII(mDescription, ' '); + continue; } if (i->first == INV_CREATION_DATE_LABEL) { mCreationDate = i->second.asInteger(); + continue; } } -#endif // new version // Need to convert 1.0 simstate files to a useful inventory type // and potentially deal with bad inventory tyes eg, a landmark @@ -1219,9 +1085,6 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) mPermissions.initMasks(mInventoryType); return true; -fail: - return false; - } ///---------------------------------------------------------------------------- -- cgit v1.2.3