From 869712e273caa0a655f7b6a1f189a8bc6399f51d Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Wed, 17 Jan 2024 20:06:56 +0200
Subject: [PATCH] SL-20669 Move constants out of settings.xml

UIImgInvisibleUUID doesn't exist
Default normal for material is 'null'
---
 indra/llcommon/indra_constants.cpp           |  6 +++
 indra/llcommon/indra_constants.h             |  5 ++
 indra/newview/app_settings/settings.xml      | 55 --------------------
 indra/newview/llfloaterenvironmentadjust.cpp |  2 +-
 indra/newview/llmaterialeditor.cpp           |  4 +-
 indra/newview/llpaneleditwater.cpp           |  2 +-
 indra/newview/llpanelface.cpp                | 10 ++--
 indra/newview/lltexturectrl.cpp              | 11 ++--
 8 files changed, 25 insertions(+), 70 deletions(-)

diff --git a/indra/llcommon/indra_constants.cpp b/indra/llcommon/indra_constants.cpp
index 1b48e4daf3a..473b3ebdc90 100644
--- a/indra/llcommon/indra_constants.cpp
+++ b/indra/llcommon/indra_constants.cpp
@@ -50,6 +50,7 @@ const LLUUID IMG_FIRE			("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver
 const LLUUID IMG_FACE_SELECT    ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector
 const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver
 const LLUUID IMG_INVISIBLE		("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver
+const LLUUID IMG_WHITE          ("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver
 
 const LLUUID IMG_EXPLOSION				("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver
 const LLUUID IMG_EXPLOSION_2			("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver
@@ -71,6 +72,11 @@ const LLUUID TERRAIN_ROCK_DETAIL		("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // V
 
 const LLUUID DEFAULT_WATER_NORMAL		("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER
 
+const LLUUID DEFAULT_OBJECT_TEXTURE     ("89556747-24cb-43ed-920b-47caed15465f"); // On dataserver
+const LLUUID DEFAULT_OBJECT_SPECULAR    ("87e0e8f7-8729-1ea8-cfc9-8915773009db"); // On dataserver
+const LLUUID DEFAULT_OBJECT_NORMAL      ("85f28839-7a1c-b4e3-d71d-967792970a7b"); // On dataserver
+const LLUUID BLANK_OBJECT_NORMAL        ("5b53359e-59dd-d8a2-04c3-9e65134da47a"); // VIEWER (has a verion on dataserver, but with compression artifacts)
+
 const LLUUID IMG_USE_BAKED_HEAD  ("5a9f4a74-30f2-821c-b88d-70499d3e7183");
 const LLUUID IMG_USE_BAKED_UPPER ("ae2de45c-d252-50b8-5c6e-19f39ce79317");
 const LLUUID IMG_USE_BAKED_LOWER ("24daea5f-0539-cfcf-047f-fbc40b2786ba");
diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h
index 679f79039bd..a16cfac2b92 100644
--- a/indra/llcommon/indra_constants.h
+++ b/indra/llcommon/indra_constants.h
@@ -197,6 +197,7 @@ LL_COMMON_API extern const LLUUID IMG_FIRE;
 LL_COMMON_API extern const LLUUID IMG_FACE_SELECT;
 LL_COMMON_API extern const LLUUID IMG_DEFAULT_AVATAR;
 LL_COMMON_API extern const LLUUID IMG_INVISIBLE;
+LL_COMMON_API extern const LLUUID IMG_WHITE;
 
 LL_COMMON_API extern const LLUUID IMG_EXPLOSION;
 LL_COMMON_API extern const LLUUID IMG_EXPLOSION_2;
@@ -230,6 +231,10 @@ LL_COMMON_API extern const LLUUID IMG_USE_BAKED_AUX3;
 
 LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL;
 
+LL_COMMON_API extern const LLUUID DEFAULT_OBJECT_TEXTURE;
+LL_COMMON_API extern const LLUUID DEFAULT_OBJECT_SPECULAR;
+LL_COMMON_API extern const LLUUID DEFAULT_OBJECT_NORMAL;
+LL_COMMON_API extern const LLUUID BLANK_OBJECT_NORMAL;
 
 // radius within which a chat message is fully audible
 const F32 CHAT_NORMAL_RADIUS = 20.f;
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 77ca52a7f7d..3d43a20c21b 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -3244,17 +3244,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-  <key>DefaultBlankNormalTexture</key>
-  <map>
-    <key>Comment</key>
-    <string>Texture used as 'Blank' in texture picker for normal maps. (UUID texture reference)</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>String</string>
-    <key>Value</key>
-    <string>5b53359e-59dd-d8a2-04c3-9e65134da47a</string>
-  </map>
 	<key>DefaultFemaleAvatar</key>
 	<map>
 	  <key>Comment</key>
@@ -3288,39 +3277,6 @@
 	  <key>Value</key>
 	  <string>Male Shape &amp; Outfit</string>
 	</map>
-  <key>DefaultObjectNormalTexture</key>
-  <map>
-    <key>Comment</key>
-    <string>Texture used as 'Default' in texture picker for normal map. (UUID texture reference)</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>String</string>
-    <key>Value</key>
-    <string>85f28839-7a1c-b4e3-d71d-967792970a7b</string>
-  </map>
-  <key>DefaultObjectSpecularTexture</key>
-  <map>
-    <key>Comment</key>
-    <string>Texture used as 'Default' in texture picker for specular map. (UUID texture reference)</string>
-    <key>Persist</key>
-    <integer>1</integer>
-    <key>Type</key>
-    <string>String</string>
-    <key>Value</key>
-    <string>87e0e8f7-8729-1ea8-cfc9-8915773009db</string>
-  </map>
-  <key>DefaultObjectTexture</key>
-    <map>
-      <key>Comment</key>
-      <string>Texture used as 'Default' in texture picker. (UUID texture reference)</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>89556747-24cb-43ed-920b-47caed15465f</string>
-    </map>
     <key>DefaultUploadCost</key>
     <map>
       <key>Comment</key>
@@ -13620,17 +13576,6 @@
       <key>Value</key>
       <string>F3E07BC8-A973-476D-8C7F-F3B7293975D1</string>
     </map>
-    <key>UIImgWhiteUUID</key>
-    <map>
-      <key>Comment</key>
-      <string />
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>5748decc-f629-461c-9a36-a35a221fe21f</string>
-    </map>
     <key>UILineEditorCursorThickness</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llfloaterenvironmentadjust.cpp b/indra/newview/llfloaterenvironmentadjust.cpp
index c64ee5a69ce..c98afefa65f 100644
--- a/indra/newview/llfloaterenvironmentadjust.cpp
+++ b/indra/newview/llfloaterenvironmentadjust.cpp
@@ -116,7 +116,7 @@ BOOL LLFloaterEnvironmentAdjust::postBuild()
     getChild<LLTextureCtrl>(FIELD_SKY_CLOUD_MAP)->setAllowNoTexture(TRUE);
 
     getChild<LLTextureCtrl>(FIELD_WATER_NORMAL_MAP)->setDefaultImageAssetID(LLSettingsWater::GetDefaultWaterNormalAssetId());
-    getChild<LLTextureCtrl>(FIELD_WATER_NORMAL_MAP)->setBlankImageAssetID(LLUUID(gSavedSettings.getString("DefaultBlankNormalTexture")));
+    getChild<LLTextureCtrl>(FIELD_WATER_NORMAL_MAP)->setBlankImageAssetID(BLANK_OBJECT_NORMAL);
     getChild<LLTextureCtrl>(FIELD_WATER_NORMAL_MAP)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onWaterMapChanged(); });
 
     getChild<LLUICtrl>(FIELD_REFLECTION_PROBE_AMBIANCE)->setCommitCallback([this](LLUICtrl*, const LLSD&) { onReflectionProbeAmbianceChanged(); });
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 34f2f77d259..b7828db3a9b 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -449,9 +449,7 @@ BOOL LLMaterialEditor::postBuild()
     mEmissiveTextureCtrl->setCommitCallback(boost::bind(&LLMaterialEditor::onCommitTexture, this, _1, _2, MATERIAL_EMISIVE_TEX_DIRTY));
     mNormalTextureCtrl->setCommitCallback(boost::bind(&LLMaterialEditor::onCommitTexture, this, _1, _2, MATERIAL_NORMAL_TEX_DIRTY));
 
-    // should match normal textures from mBumpyTextureCtrl
-    mNormalTextureCtrl->setDefaultImageAssetID(LLUUID(gSavedSettings.getString("DefaultObjectNormalTexture")));
-    mNormalTextureCtrl->setBlankImageAssetID(LLUUID(gSavedSettings.getString("DefaultBlankNormalTexture")));
+    mNormalTextureCtrl->setBlankImageAssetID(BLANK_OBJECT_NORMAL);
 
     if (mIsOverride)
     {
diff --git a/indra/newview/llpaneleditwater.cpp b/indra/newview/llpaneleditwater.cpp
index a09964e17dc..cf536dd87e3 100644
--- a/indra/newview/llpaneleditwater.cpp
+++ b/indra/newview/llpaneleditwater.cpp
@@ -89,7 +89,7 @@ BOOL LLPanelSettingsWaterMainTab::postBuild()
     getChild<LLUICtrl>(FIELD_WATER_UNDERWATER_MOD)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onFogUnderWaterChanged(); });
 
     mTxtNormalMap->setDefaultImageAssetID(LLSettingsWater::GetDefaultWaterNormalAssetId());
-    mTxtNormalMap->setBlankImageAssetID(LLUUID( gSavedSettings.getString( "DefaultBlankNormalTexture" )));
+    mTxtNormalMap->setBlankImageAssetID(BLANK_OBJECT_NORMAL);
     mTxtNormalMap->setCommitCallback([this](LLUICtrl *, const LLSD &) { onNormalMapChanged(); });
 
     getChild<LLUICtrl>(FIELD_WATER_WAVE2_XY)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onSmallWaveChanged(); });
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 269ae23eb85..7979261bae4 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -353,7 +353,7 @@ BOOL	LLPanelFace::postBuild()
 	mShinyTextureCtrl = getChild<LLTextureCtrl>("shinytexture control");
 	if(mShinyTextureCtrl)
 	{
-		mShinyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectSpecularTexture" )));
+		mShinyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_SPECULAR);
 		mShinyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitSpecularTexture, this, _2) );
 		mShinyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelSpecularTexture, this, _2) );
 		mShinyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectSpecularTexture, this, _2) );
@@ -370,8 +370,8 @@ BOOL	LLPanelFace::postBuild()
 	mBumpyTextureCtrl = getChild<LLTextureCtrl>("bumpytexture control");
 	if(mBumpyTextureCtrl)
 	{
-		mBumpyTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectNormalTexture" )));
-		mBumpyTextureCtrl->setBlankImageAssetID(LLUUID( gSavedSettings.getString( "DefaultBlankNormalTexture" )));
+		mBumpyTextureCtrl->setDefaultImageAssetID(DEFAULT_OBJECT_NORMAL);
+		mBumpyTextureCtrl->setBlankImageAssetID(BLANK_OBJECT_NORMAL);
 		mBumpyTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitNormalTexture, this, _2) );
 		mBumpyTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelNormalTexture, this, _2) );
 		mBumpyTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectNormalTexture, this, _2) );
@@ -4413,7 +4413,7 @@ void LLPanelFace::onCopyTexture()
                         LLUUID id = mat_data["NormMap"].asUUID();
                         if (id.notNull() && !get_can_copy_texture(id))
                         {
-                            mat_data["NormMap"] = LLUUID(gSavedSettings.getString("DefaultObjectTexture"));
+                            mat_data["NormMap"] = DEFAULT_OBJECT_TEXTURE;
                             mat_data["NormMapNoCopy"] = true;
                         }
 
@@ -4423,7 +4423,7 @@ void LLPanelFace::onCopyTexture()
                         LLUUID id = mat_data["SpecMap"].asUUID();
                         if (id.notNull() && !get_can_copy_texture(id))
                         {
-                            mat_data["SpecMap"] = LLUUID(gSavedSettings.getString("DefaultObjectTexture"));
+                            mat_data["SpecMap"] = DEFAULT_OBJECT_TEXTURE;
                             mat_data["SpecMapNoCopy"] = true;
                         }
 
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 233b864fbac..62d3fa28bf1 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -82,9 +82,11 @@
 //static
 bool get_is_predefined_texture(LLUUID asset_id)
 {
-    if (asset_id == LLUUID(gSavedSettings.getString("DefaultObjectTexture"))
-        || asset_id == LLUUID(gSavedSettings.getString("UIImgWhiteUUID"))
-        || asset_id == LLUUID(gSavedSettings.getString("UIImgInvisibleUUID"))
+    if (asset_id == DEFAULT_OBJECT_TEXTURE
+        || asset_id == DEFAULT_OBJECT_SPECULAR
+        || asset_id == DEFAULT_OBJECT_NORMAL
+        || asset_id == BLANK_OBJECT_NORMAL
+        || asset_id == IMG_WHITE
         || asset_id == LLUUID(SCULPT_DEFAULT_TEXTURE))
     {
         return true;
@@ -1646,8 +1648,7 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
 
 	// Default of defaults is white image for diff tex
 	//
-	LLUUID whiteImage( gSavedSettings.getString( "UIImgWhiteUUID" ) );
-	setBlankImageAssetID( whiteImage );
+	setBlankImageAssetID(IMG_WHITE);
 
 	setAllowNoTexture(p.allow_no_texture);
 	setCanApplyImmediately(p.can_apply_immediately);
-- 
GitLab