diff options
author | cosmic-linden <111533034+cosmic-linden@users.noreply.github.com> | 2024-02-09 07:16:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-09 09:16:01 -0600 |
commit | d6048bfcb2442ca7ec278864b9827d74873efa3a (patch) | |
tree | 9a76192342b7ca42ae754d9518606b2545109ca3 /indra | |
parent | e24f631110c4fb3ca135b6d6dfaa448062e2f9bd (diff) |
Put PBR material swatch behind feature flag (#775)
* secondlife/viewer#771: Put PBR material swatch behind feature flag
* secondlife/viewer#771: Make viewer respect PBRMaterialSwatchEnabled from SimulatorFeatures
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/llgltfmaterialpreviewmgr.cpp | 8 | ||||
-rw-r--r-- | indra/newview/lltexturectrl.cpp | 21 | ||||
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 10 |
4 files changed, 39 insertions, 11 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6ec9a9acc5..1a614062d9 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13829,6 +13829,17 @@ <key>Value</key> <integer>2</integer> </map> + <key>UIPreviewMaterial</key> + <map> + <key>Comment</key> + <string>Whether or not PBR material swatch is enabled</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <real>0</real> + </map> <key>UIResizeBarHeight</key> <map> <key>Comment</key> diff --git a/indra/newview/llgltfmaterialpreviewmgr.cpp b/indra/newview/llgltfmaterialpreviewmgr.cpp index 53d9d7d0ba..901db87eed 100644 --- a/indra/newview/llgltfmaterialpreviewmgr.cpp +++ b/indra/newview/llgltfmaterialpreviewmgr.cpp @@ -543,7 +543,6 @@ void LLGLTFPreviewTexture::postRender(BOOL success) LLViewerDynamicTexture::postRender(success); } -// static LLPointer<LLViewerTexture> LLGLTFMaterialPreviewMgr::getPreview(LLPointer<LLFetchedGLTFMaterial> &material) { if (!material) @@ -551,6 +550,13 @@ LLPointer<LLViewerTexture> LLGLTFMaterialPreviewMgr::getPreview(LLPointer<LLFetc return nullptr; } + static LLCachedControl<bool> sUIPreviewMaterial(gSavedSettings, "UIPreviewMaterial", false); + if (!sUIPreviewMaterial) + { + fetch_texture_for_ui(material->mBaseColorTexture, material->mTextureId[LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR]); + return material->mBaseColorTexture; + } + if (!is_material_loaded_enough_for_ui(*material)) { return nullptr; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 0439b0b115..5415f9bd9a 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -680,6 +680,10 @@ void LLFloaterTexturePicker::draw() mGLTFPreview = gGLTFMaterialPreviewMgr.getPreview(mGLTFMaterial); } } + if (mGLTFPreview) + { + mGLTFPreview->setBoostLevel(LLGLTexture::BOOST_PREVIEW); + } } else { @@ -735,7 +739,7 @@ void LLFloaterTexturePicker::draw() // If the floater is focused, don't apply its alpha to the texture (STORM-677). const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); - LLViewerTexture* preview = nullptr; + LLViewerTexture* preview; if (mGLTFMaterial) { preview = mGLTFPreview.get(); @@ -743,15 +747,11 @@ void LLFloaterTexturePicker::draw() else { preview = mTexturep.get(); - if (mTexturep) - { - // Pump the priority - mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); - } } if( preview ) { + preview->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); if( preview->getComponents() == 4 ) { gl_rect_2d_checkerboard( interior, alpha ); @@ -2219,6 +2219,10 @@ void LLTextureCtrl::draw() mGLTFPreview = gGLTFMaterialPreviewMgr.getPreview(mGLTFMaterial); } } + if (mGLTFPreview) + { + mGLTFPreview->setBoostLevel(LLGLTexture::BOOST_PREVIEW); + } preview = mGLTFPreview; } @@ -2257,10 +2261,7 @@ void LLTextureCtrl::draw() } gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), preview, UI_VERTEX_COLOR % alpha); - if (mTexturep) - { - mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); - } + preview->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); } else if (!mFallbackImage.isNull()) { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index cea083e07d..5b51267cbe 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2459,6 +2459,16 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) } gSavedSettings.setBOOL("RenderMirrors", mirrors_enabled); + + if (mSimulatorFeatures.has("PBRMaterialSwatchEnabled")) + { + bool enabled = mSimulatorFeatures["PBRMaterialSwatchEnabled"]; + gSavedSettings.setBOOL("UIPreviewMaterial", enabled); + } + else + { + gSavedSettings.setBOOL("UIPreviewMaterial", false); + } } //this is called when the parent is not cacheable. |