From 6bb496625f4492fabd44bd0e86acb8b599df8c43 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 8 Oct 2018 20:27:10 +0300 Subject: SL-9746 [EEP] Local Texture options should work with EEP --- indra/newview/llfloatereditextdaycycle.cpp | 80 +++++++++++++++++++++- indra/newview/llfloaterfixedenvironment.cpp | 58 ++++++++++++++++ indra/newview/lllocalbitmaps.cpp | 13 ++++ indra/newview/lllocalbitmaps.h | 1 + indra/newview/llpaneleditsky.cpp | 6 +- .../newview/skins/default/xui/en/notifications.xml | 16 +++++ indra/newview/skins/default/xui/en/strings.xml | 7 ++ 7 files changed, 175 insertions(+), 6 deletions(-) diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 840b392f5d..e1220e5592 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -34,6 +34,7 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" #include "llloadingindicator.h" +#include "lllocalbitmaps.h" #include "llmultisliderctrl.h" #include "llnotifications.h" #include "llnotificationsutil.h" @@ -346,7 +347,7 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) getChild(track_tabs[idx + 1], true)->setLabel(formatted_label.getString()); } - for (int i = 2; i < LLSettingsDay::TRACK_MAX; i++) //skies #2 through #4 + for (U32 i = 2; i < LLSettingsDay::TRACK_MAX; i++) //skies #2 through #4 { getChild(track_tabs[i])->setEnabled(extended_env); } @@ -513,6 +514,81 @@ void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data) return; } + // brute-force local texture scan + for (U32 i = 0; i <= LLSettingsDay::TRACK_MAX; i++) + { + LLSettingsDay::CycleTrack_t &day_track = dayclone->getCycleTrack(i); + + LLSettingsDay::CycleTrack_t::iterator iter = day_track.begin(); + LLSettingsDay::CycleTrack_t::iterator end = day_track.end(); + S32 frame_num = 0; + + while (iter != end) + { + frame_num++; + std::string desc; + bool is_local = false; // because getString can be empty + if (i == LLSettingsDay::TRACK_WATER) + { + LLSettingsWater::ptr_t water = std::static_pointer_cast(iter->second); + if (water) + { + // LLViewerFetchedTexture and check for FTT_LOCAL_FILE or check LLLocalBitmapMgr + if (LLLocalBitmapMgr::isLocal(water->getNormalMapID())) + { + desc = LLTrans::getString("EnvironmentNormalMap"); + is_local = true; + } + else if (LLLocalBitmapMgr::isLocal(water->getTransparentTextureID())) + { + desc = LLTrans::getString("EnvironmentTransparent"); + is_local = true; + } + } + } + else + { + LLSettingsSky::ptr_t sky = std::static_pointer_cast(iter->second); + if (sky) + { + if (LLLocalBitmapMgr::isLocal(sky->getSunTextureId())) + { + desc = LLTrans::getString("EnvironmentSun"); + is_local = true; + } + else if (LLLocalBitmapMgr::isLocal(sky->getMoonTextureId())) + { + desc = LLTrans::getString("EnvironmentMoon"); + is_local = true; + } + else if (LLLocalBitmapMgr::isLocal(sky->getCloudNoiseTextureId())) + { + desc = LLTrans::getString("EnvironmentCloudNoise"); + is_local = true; + } + else if (LLLocalBitmapMgr::isLocal(sky->getBloomTextureId())) + { + desc = LLTrans::getString("EnvironmentBloom"); + is_local = true; + } + } + } + + if (is_local) + { + LLSD args; + LLButton* button = getChild(track_tabs[i], true); + args["TRACK"] = button->getCurrentLabel(); + args["FRAME"] = iter->first * 100; // % + args["FIELD"] = desc; + args["FRAMENO"] = frame_num; + LLNotificationsUtil::add("WLLocalTextureDayBlock", args); + return; + } + iter++; + } + } + if (ctrl_action == ACTION_SAVE) { doApplyUpdateInventory(dayclone); @@ -817,7 +893,7 @@ void LLFloaterEditExtDayCycle::selectTrack(U32 track_index, bool force ) return; } - for (int i = 0; i < LLSettingsDay::TRACK_MAX; i++) // use max value + for (U32 i = 0; i < LLSettingsDay::TRACK_MAX; i++) // use max value { getChild(track_tabs[i], true)->setToggleState(i == mCurrentTrack); } diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 5cd99e6ad2..201c6679b3 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -37,6 +37,7 @@ #include "llsliderctrl.h" #include "lltabcontainer.h" #include "llfilepicker.h" +#include "lllocalbitmaps.h" #include "llsettingspicker.h" #include "llviewermenufile.h" // LLFilePickerReplyThread #include "llviewerparcelmgr.h" @@ -51,6 +52,7 @@ #include "llenvironment.h" #include "llagent.h" #include "llparcel.h" +#include "lltrans.h" #include "llsettingsvo.h" #include "llinventorymodel.h" @@ -340,6 +342,62 @@ void LLFloaterFixedEnvironment::onButtonApply(LLUICtrl *ctrl, const LLSD &data) { std::string ctrl_action = ctrl->getName(); + std::string local_desc; + bool is_local = false; // because getString can be empty + if (mSettings->getSettingsType() == "water") + { + LLSettingsWater::ptr_t water = std::static_pointer_cast(mSettings); + if (water) + { + // LLViewerFetchedTexture and check for FTT_LOCAL_FILE or check LLLocalBitmapMgr + if (LLLocalBitmapMgr::isLocal(water->getNormalMapID())) + { + local_desc = LLTrans::getString("EnvironmentNormalMap"); + is_local = true; + } + else if (LLLocalBitmapMgr::isLocal(water->getTransparentTextureID())) + { + local_desc = LLTrans::getString("EnvironmentTransparent"); + is_local = true; + } + } + } + else if (mSettings->getSettingsType() == "sky") + { + LLSettingsSky::ptr_t sky = std::static_pointer_cast(mSettings); + if (sky) + { + if (LLLocalBitmapMgr::isLocal(sky->getSunTextureId())) + { + local_desc = LLTrans::getString("EnvironmentSun"); + is_local = true; + } + else if (LLLocalBitmapMgr::isLocal(sky->getMoonTextureId())) + { + local_desc = LLTrans::getString("EnvironmentMoon"); + is_local = true; + } + else if (LLLocalBitmapMgr::isLocal(sky->getCloudNoiseTextureId())) + { + local_desc = LLTrans::getString("EnvironmentCloudNoise"); + is_local = true; + } + else if (LLLocalBitmapMgr::isLocal(sky->getBloomTextureId())) + { + local_desc = LLTrans::getString("EnvironmentBloom"); + is_local = true; + } + } + } + + if (is_local) + { + LLSD args; + args["FIELD"] = local_desc; + LLNotificationsUtil::add("WLLocalTextureFixedBlock", args); + return; + } + if (ctrl_action == ACTION_SAVE) { doApplyUpdateInventory(); diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 760325b652..47b6da708c 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -976,6 +976,19 @@ LLUUID LLLocalBitmapMgr::getWorldID(LLUUID tracking_id) return world_id; } +bool LLLocalBitmapMgr::isLocal(const LLUUID world_id) +{ + for (local_list_iter iter = sBitmapList.begin(); iter != sBitmapList.end(); iter++) + { + LLLocalBitmap* unit = *iter; + if (unit->getWorldID() == world_id) + { + return true; + } + } + return false; +} + std::string LLLocalBitmapMgr::getFilename(LLUUID tracking_id) { std::string filename = ""; diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h index ee4161fb45..3b33091fdb 100644 --- a/indra/newview/lllocalbitmaps.h +++ b/indra/newview/lllocalbitmaps.h @@ -123,6 +123,7 @@ class LLLocalBitmapMgr static bool checkTextureDimensions(std::string filename); static LLUUID getWorldID(LLUUID tracking_id); + static bool isLocal(const LLUUID world_id); static std::string getFilename(LLUUID tracking_id); static void feedScrollList(LLScrollListCtrl* ctrl); diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index 0d8c9a988a..972b849510 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -258,7 +258,6 @@ BOOL LLPanelSettingsSkyCloudTab::postBuild() getChild(FIELD_SKY_CLOUD_MAP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudMapChanged(); }); getChild(FIELD_SKY_CLOUD_MAP)->setDefaultImageAssetID(LLSettingsSky::GetDefaultCloudNoiseTextureId()); getChild(FIELD_SKY_CLOUD_MAP)->setAllowNoTexture(TRUE); - getChild(FIELD_SKY_CLOUD_MAP)->setAllowLocalTexture(FALSE); getChild(FIELD_SKY_CLOUD_DENSITY_X)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDensityChanged(); }); getChild(FIELD_SKY_CLOUD_DENSITY_Y)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onCloudDensityChanged(); }); @@ -348,7 +347,8 @@ void LLPanelSettingsSkyCloudTab::onCloudScrollChanged() void LLPanelSettingsSkyCloudTab::onCloudMapChanged() { - mSkySettings->setCloudNoiseTextureId(getChild(FIELD_SKY_CLOUD_MAP)->getValue().asUUID()); + LLTextureCtrl* ctrl = getChild(FIELD_SKY_CLOUD_MAP); + mSkySettings->setCloudNoiseTextureId(ctrl->getValue().asUUID()); setIsDirty(); } @@ -391,13 +391,11 @@ BOOL LLPanelSettingsSkySunMoonTab::postBuild() getChild(FIELD_SKY_SUN_IMAGE)->setBlankImageAssetID(LLSettingsSky::GetBlankSunTextureId()); getChild(FIELD_SKY_SUN_IMAGE)->setDefaultImageAssetID(LLSettingsSky::GetBlankSunTextureId()); getChild(FIELD_SKY_SUN_IMAGE)->setAllowNoTexture(TRUE); - getChild(FIELD_SKY_SUN_IMAGE)->setAllowLocalTexture(FALSE); getChild(FIELD_SKY_MOON_ROTATION)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonRotationChanged(); }); getChild(FIELD_SKY_MOON_IMAGE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonImageChanged(); }); getChild(FIELD_SKY_MOON_IMAGE)->setDefaultImageAssetID(LLSettingsSky::GetDefaultMoonTextureId()); getChild(FIELD_SKY_MOON_IMAGE)->setBlankImageAssetID(LLSettingsSky::GetBlankSunTextureId()); getChild(FIELD_SKY_MOON_IMAGE)->setAllowNoTexture(TRUE); - getChild(FIELD_SKY_MOON_IMAGE)->setAllowLocalTexture(FALSE); getChild(FIELD_SKY_MOON_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonScaleChanged(); }); getChild(FIELD_SKY_MOON_BRIGHTNESS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonBrightnessChanged(); }); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 69503cdbf2..23e1701dc6 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6071,6 +6071,22 @@ This day cycle file references a missing sky file: [SKY]. Sorry, the settings couldn't be applied to the region. Reason: [FAIL_REASON] + +A Local texture is in use on track [TRACK], frame #[FRAMENO] ([FRAME]%) in field [FIELD]. +Settings may not be saved using local textures. + + + +A local texture is in use in field [FIELD]. +Settings may not be saved using local textures. + + Region Settings This Region does not support environmental settings. + Sun + Moon + Bloom + Cloud Noise + Normal Map + Transparent + Clicks: [TELEPORT] teleport, [MAP] map, [PROFILE] profile (will update after publish) -- cgit v1.2.3