From 9055a011418be4c15c50702fcb0f54536dcc9ca3 Mon Sep 17 00:00:00 2001 From: Yui <50331474+SirYodaJedi@users.noreply.github.com> Date: Mon, 24 Mar 2025 17:15:38 -0400 Subject: [PATCH 1/2] Replicate %alphatexture from Gmod --- sp/src/utils/vrad/vradstaticprops.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sp/src/utils/vrad/vradstaticprops.cpp b/sp/src/utils/vrad/vradstaticprops.cpp index f4f04a69..ebd77326 100644 --- a/sp/src/utils/vrad/vradstaticprops.cpp +++ b/sp/src/utils/vrad/vradstaticprops.cpp @@ -528,9 +528,17 @@ public: if ( pVMT->LoadFromBuffer( pMaterialName, buf ) ) { bFound = true; - if ( pVMT->FindKey("$translucent") || pVMT->FindKey("$alphatest") ) + if ( pVMT->FindKey("$alphatest") || pVMT->FindKey("$translucent") || pVMT->FindKey("%alphatexture") ) { - KeyValues *pBaseTexture = pVMT->FindKey("$basetexture"); + KeyValues *pBaseTexture = NULL; + if ( pVMT->FindKey("%alphatexture") ) + { + pBaseTexture = pVMT->FindKey("%alphatexture"); + } + else + { + pBaseTexture = pVMT->FindKey("$basetexture"); + } if ( pBaseTexture ) { const char *pBaseTextureName = pBaseTexture->GetString(); From bb209357c2606a912d29ed41e0305ff60318ac7f Mon Sep 17 00:00:00 2001 From: Yui <50331474+SirYodaJedi@users.noreply.github.com> Date: Mon, 24 Mar 2025 20:19:30 -0400 Subject: [PATCH 2/2] VRAD - reduce duplicate %alphatexture searches Per comment on https://github.com/ValveSoftware/source-sdk-2013/pull/1150 by @ficool2 --- sp/src/utils/vrad/vradstaticprops.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sp/src/utils/vrad/vradstaticprops.cpp b/sp/src/utils/vrad/vradstaticprops.cpp index ebd77326..3a812da6 100644 --- a/sp/src/utils/vrad/vradstaticprops.cpp +++ b/sp/src/utils/vrad/vradstaticprops.cpp @@ -528,14 +528,10 @@ public: if ( pVMT->LoadFromBuffer( pMaterialName, buf ) ) { bFound = true; - if ( pVMT->FindKey("$alphatest") || pVMT->FindKey("$translucent") || pVMT->FindKey("%alphatexture") ) + KeyValues *pBaseTexture = pVMT->FindKey("%alphatexture"); + if ( pBaseTexture || pVMT->FindKey("$alphatest") || pVMT->FindKey("$translucent") ) { - KeyValues *pBaseTexture = NULL; - if ( pVMT->FindKey("%alphatexture") ) - { - pBaseTexture = pVMT->FindKey("%alphatexture"); - } - else + if ( !pBaseTexture ) { pBaseTexture = pVMT->FindKey("$basetexture"); }