From 0e4b08ead1b1f36593a85ce039e12c2c219285ac Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 25 Dec 2025 18:59:03 -0600 Subject: [PATCH] roll back _setitmap macro-mirroring. seems there was somethin off there --- .../gui/buttons/guiBitmapButtonCtrl.cpp | 45 ------------------- .../source/gui/buttons/guiBitmapButtonCtrl.h | 20 ++++++++- 2 files changed, 18 insertions(+), 47 deletions(-) diff --git a/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp b/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp index d0af7da32..46e4e69c1 100644 --- a/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp @@ -262,51 +262,6 @@ void GuiBitmapButtonCtrl::setAutoFitExtents( bool state ) } //----------------------------------------------------------------------------- -void GuiBitmapButtonCtrl::_setBitmap(StringTableEntry _in) -{ - if (mBitmapAsset.getAssetId() == _in) - return; - - if (getBitmapFile() == _in) - return; - - if (_in == 0 || !String::compare(_in, _getStringTable()->EmptyString())) - { - mBitmapAsset = 0; - mBitmapFile = ""; - return; - } - if (!AssetDatabase.isDeclaredAsset(_in)) - { - StringTableEntry imageAssetId = _getStringTable()->EmptyString(); - AssetQuery query; - S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); - if (foundAssetcount != 0) - { - imageAssetId = query.mAssetList[0]; - } - else if (Torque::FS::IsFile(_in) || (_in[0] == '$' || _in[0] == '#')) - { - imageAssetId = ImageAsset::getAssetIdByFilename(_in); - if (imageAssetId == ImageAsset::smNoImageAssetFallback) - { - ImageAsset* privateImage = new ImageAsset(); - privateImage->setImageFile(_in); - imageAssetId = AssetDatabase.addPrivateAsset(privateImage); - } - } - else { - Con::warnf("%s::%s: Could not find asset for: %s using fallback", "GuiBitmapButtonCtrl", "Bitmap", _in); - imageAssetId = ImageAsset::smNoImageAssetFallback; - } mBitmapAsset = imageAssetId; - mBitmapFile = _in; - } - else - { - mBitmapAsset = _in; - mBitmapFile = getBitmapFile(); - } -} void GuiBitmapButtonCtrl::setBitmap( StringTableEntry name ) { diff --git a/Engine/source/gui/buttons/guiBitmapButtonCtrl.h b/Engine/source/gui/buttons/guiBitmapButtonCtrl.h index 8fb3792d0..ec96e9344 100644 --- a/Engine/source/gui/buttons/guiBitmapButtonCtrl.h +++ b/Engine/source/gui/buttons/guiBitmapButtonCtrl.h @@ -122,8 +122,24 @@ private: AssetPtr mBitmapAsset; String mBitmapFile; public: - void _setBitmap(StringTableEntry _in); -inline StringTableEntry _getBitmap(void) const { + void _setBitmap(StringTableEntry _in) { + if (_in == NULL || _in == StringTable->EmptyString() || _in == "") + { + mBitmapAsset = NULL; + mBitmapFile = ""; + return; + } + if (mBitmapAsset.getAssetId() == _in) return; if (!AssetDatabase.isDeclaredAsset(_in)) { + StringTableEntry imageAssetId = ImageAsset::smNoImageAssetFallback; AssetQuery query; S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); if (foundAssetcount != 0) { + imageAssetId = query.mAssetList[0]; + } mBitmapAsset = imageAssetId; + } + else { + mBitmapAsset = _in; + mBitmapName = _in; + mBitmap = getBitmap(); + } +}; inline StringTableEntry _getBitmap(void) const { return mBitmapAsset.getAssetId(); } GFXTexHandle getBitmap() { return mBitmapAsset.notNull() ? mBitmapAsset->getTexture(&GFXDefaultGUIProfile) : 0;