use of get<some name> methods that already return nulls/false when attempting to load

in contexts where we would want to try first
This commit is contained in:
AzaezelX 2025-05-27 17:07:08 -05:00
parent a43458677a
commit 40974dd14b
11 changed files with 31 additions and 31 deletions

View file

@ -332,7 +332,7 @@ void BasicClouds::_initTexture()
{ {
for ( U32 i = 0; i < TEX_COUNT; i++ ) for ( U32 i = 0; i < TEX_COUNT; i++ )
{ {
if ( mLayerEnabled[i] && mTextureAsset[i].notNull()) if ( mLayerEnabled[i])
{ {
// load the resource. // load the resource.
getTexture(i); getTexture(i);

View file

@ -239,7 +239,7 @@ U32 CloudLayer::packUpdate( NetConnection *conn, U32 mask, BitStream *stream )
{ {
U32 retMask = Parent::packUpdate( conn, mask, stream ); U32 retMask = Parent::packUpdate( conn, mask, stream );
if (stream->writeFlag(mTextureAsset.notNull())) { if (stream->writeFlag(getTexture())) {
NetStringHandle assetIdStr = mTextureAsset.getAssetId(); conn->packNetStringHandleU(stream, assetIdStr); NetStringHandle assetIdStr = mTextureAsset.getAssetId(); conn->packNetStringHandleU(stream, assetIdStr);
} }

View file

@ -296,7 +296,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
RectI iconRect( 0, 0, 0, 0 ); RectI iconRect( 0, 0, 0, 0 );
// Render the icon // Render the icon
if ( mBitmapAsset.notNull() && mIconLocation != GuiIconButtonCtrl::IconLocNone) if ( getBitmap() && mIconLocation != GuiIconButtonCtrl::IconLocNone)
{ {
// Render the normal bitmap // Render the normal bitmap
drawer->clearBitmapModulation(); drawer->clearBitmapModulation();

View file

@ -88,7 +88,7 @@ void GuiToolboxButtonCtrl::inspectPostApply()
// set it's extent to be exactly the size of the normal bitmap (if present) // set it's extent to be exactly the size of the normal bitmap (if present)
Parent::inspectPostApply(); Parent::inspectPostApply();
if ((getWidth() == 0) && (getHeight() == 0) && mNormalBitmapAsset.notNull()) if ((getWidth() == 0) && (getHeight() == 0) && getNormalBitmap())
{ {
setExtent(getNormalBitmap()->getWidth(), getNormalBitmap()->getHeight()); setExtent(getNormalBitmap()->getWidth(), getNormalBitmap()->getHeight());
} }
@ -142,7 +142,7 @@ void GuiToolboxButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
} }
// Now render the image // Now render the image
if( mNormalBitmapAsset.notNull() ) if(getNormalBitmap())
{ {
renderButton(getNormalBitmap(), offset, updateRect ); renderButton(getNormalBitmap(), offset, updateRect );
return; return;

View file

@ -101,7 +101,7 @@ void GuiBitmapCtrl::inspectPostApply()
// set it's extent to be exactly the size of the bitmap (if present) // set it's extent to be exactly the size of the bitmap (if present)
Parent::inspectPostApply(); Parent::inspectPostApply();
if (!mWrap && (getExtent().x == 0) && (getExtent().y == 0) && mBitmapAsset.notNull()) if (!mWrap && (getExtent().x == 0) && (getExtent().y == 0) && getBitmap())
{ {
setExtent(mBitmap->getWidth(), mBitmap->getHeight()); setExtent(mBitmap->getWidth(), mBitmap->getHeight());
} }
@ -126,7 +126,7 @@ void GuiBitmapCtrl::setBitmap(const char* name, bool resize)
mBitmap = mBitmapAsset->getTexture(&GFXDefaultGUIProfile); mBitmap = mBitmapAsset->getTexture(&GFXDefaultGUIProfile);
if (mBitmapAsset.notNull() && resize) if (getBitmap() && resize)
{ {
setExtent(mBitmap->getWidth(), mBitmap->getHeight()); setExtent(mBitmap->getWidth(), mBitmap->getHeight());
@ -212,7 +212,7 @@ void GuiBitmapCtrl::onRender(Point2I offset, const RectI& updateRect)
void GuiBitmapCtrl::setValue(S32 x, S32 y) void GuiBitmapCtrl::setValue(S32 x, S32 y)
{ {
if (mBitmapAsset.notNull()) if (getBitmap())
{ {
x += mBitmapAsset->getTextureBitmapWidth() / 2; x += mBitmapAsset->getTextureBitmapWidth() / 2;
y += mBitmapAsset->getTextureBitmapHeight() / 2; y += mBitmapAsset->getTextureBitmapHeight() / 2;

View file

@ -184,7 +184,7 @@ void GuiGameSettingsCtrl::onRenderListOption(Point2I currentOffset)
bool arrowOnR = (isSelected() || isHighlighted()) && (mWrapOptions || (mSelectedOption < mOptions.size() - 1)); bool arrowOnR = (isSelected() || isHighlighted()) && (mWrapOptions || (mSelectedOption < mOptions.size() - 1));
if (arrowOnL) if (arrowOnL)
{ {
if (mPreviousBitmapAsset.notNull()) if (getPreviousBitmap())
{ {
arrowOffset.x = currentOffset.x + mColumnSplit; arrowOffset.x = currentOffset.x + mColumnSplit;
arrowOffset.y = currentOffset.y + arrowOffsetY; arrowOffset.y = currentOffset.y + arrowOffsetY;
@ -205,7 +205,7 @@ void GuiGameSettingsCtrl::onRenderListOption(Point2I currentOffset)
} }
if (arrowOnR) if (arrowOnR)
{ {
if (mNextBitmapAsset.notNull()) if (getNextBitmap())
{ {
arrowOffset.x = currentOffset.x + getWidth() - mRightPad - mArrowSize; arrowOffset.x = currentOffset.x + getWidth() - mRightPad - mArrowSize;
arrowOffset.y = currentOffset.y + arrowOffsetY; arrowOffset.y = currentOffset.y + arrowOffsetY;
@ -369,7 +369,7 @@ void GuiGameSettingsCtrl::onRenderKeybindOption(Point2I currentOffset)
buttonSize.x = height; buttonSize.x = height;
buttonSize.y = height; buttonSize.y = height;
if (mKeybindBitmapAsset.notNull()) if (getKeybindBitmap())
{ {
RectI rect(button, buttonSize); RectI rect(button, buttonSize);
drawer->clearBitmapModulation(); drawer->clearBitmapModulation();

View file

@ -891,13 +891,13 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
} }
// Draw a bitmap over the background? // Draw a bitmap over the background?
if ( mBitmapAsset[Depressed].notNull() ) if (getBitmap(Depressed))
{ {
RectI rect(offset, mBitmapBounds); RectI rect(offset, mBitmapBounds);
drawUtil->clearBitmapModulation(); drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( getBitmap(Depressed), rect ); drawUtil->drawBitmapStretch( getBitmap(Depressed), rect );
} }
else if ( mBitmapAsset[Normal].notNull() ) else if (getBitmap(Normal))
{ {
RectI rect(offset, mBitmapBounds); RectI rect(offset, mBitmapBounds);
drawUtil->clearBitmapModulation(); drawUtil->clearBitmapModulation();
@ -941,7 +941,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
} }
// Draw a bitmap over the background? // Draw a bitmap over the background?
if ( mBitmapAsset[Normal].notNull() ) if (getBitmap(Normal))
{ {
RectI rect( offset, mBitmapBounds ); RectI rect( offset, mBitmapBounds );
drawUtil->clearBitmapModulation(); drawUtil->clearBitmapModulation();
@ -977,7 +977,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
} }
// Draw a bitmap over the background? // Draw a bitmap over the background?
if (mBitmapAsset[Normal].notNull()) if (getBitmap(Normal))
{ {
RectI rect(offset, mBitmapBounds); RectI rect(offset, mBitmapBounds);
drawUtil->clearBitmapModulation(); drawUtil->clearBitmapModulation();

View file

@ -1090,13 +1090,13 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
} }
// Draw a bitmap over the background? // Draw a bitmap over the background?
if ( mBitmapAsset[Depressed].notNull() ) if (getBitmap(Depressed))
{ {
RectI rect(offset, mBitmapBounds); RectI rect(offset, mBitmapBounds);
drawUtil->clearBitmapModulation(); drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch(getBitmap(Depressed), rect ); drawUtil->drawBitmapStretch(getBitmap(Depressed), rect );
} }
else if (mBitmapAsset[Normal].notNull()) else if (getBitmap(Normal))
{ {
RectI rect(offset, mBitmapBounds); RectI rect(offset, mBitmapBounds);
drawUtil->clearBitmapModulation(); drawUtil->clearBitmapModulation();
@ -1134,7 +1134,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
} }
// Draw a bitmap over the background? // Draw a bitmap over the background?
if (mBitmapAsset[Normal].notNull()) if (getBitmap(Normal))
{ {
RectI rect( offset, mBitmapBounds ); RectI rect( offset, mBitmapBounds );
drawUtil->clearBitmapModulation(); drawUtil->clearBitmapModulation();
@ -1164,7 +1164,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
} }
// Draw a bitmap over the background? // Draw a bitmap over the background?
if (mBitmapAsset[Normal].notNull()) if (getBitmap(Normal))
{ {
RectI rect(offset, mBitmapBounds); RectI rect(offset, mBitmapBounds);
drawUtil->clearBitmapModulation(); drawUtil->clearBitmapModulation();

View file

@ -112,7 +112,7 @@ void GuiCursor::onRemove()
void GuiCursor::render(const Point2I &pos) void GuiCursor::render(const Point2I &pos)
{ {
if (mBitmapAsset.notNull()) if (getBitmap())
{ {
mExtent.set(getBitmap()->getWidth(), getBitmap()->getHeight()); mExtent.set(getBitmap()->getWidth(), getBitmap()->getHeight());
} }

View file

@ -155,7 +155,7 @@ void GuiChunkedBitmapCtrl::renderRegion(const Point2I &offset, const Point2I &ex
void GuiChunkedBitmapCtrl::onRender(Point2I offset, const RectI &updateRect) void GuiChunkedBitmapCtrl::onRender(Point2I offset, const RectI &updateRect)
{ {
if( mBitmapAsset.notNull() ) if(getBitmap())
{ {
RectI boundsRect( offset, getExtent()); RectI boundsRect( offset, getExtent());
GFX->getDrawUtil()->drawBitmapStretch(getBitmap(), boundsRect, GFXBitmapFlip_None, GFXTextureFilterLinear); GFX->getDrawUtil()->drawBitmapStretch(getBitmap(), boundsRect, GFXBitmapFlip_None, GFXTextureFilterLinear);

View file

@ -393,7 +393,7 @@ void ProcessedMaterial::_setStageData()
for (i = 0; i < Material::MAX_STAGES; i++) for (i = 0; i < Material::MAX_STAGES; i++)
{ {
// DiffuseMap // DiffuseMap
if (mMaterial->getDiffuseMapAsset(i).notNull()) if (mMaterial->getDiffuseMap(i))
{ {
mStages[i].setTex(MFT_DiffuseMap, mMaterial->getDiffuseMap(i)); mStages[i].setTex(MFT_DiffuseMap, mMaterial->getDiffuseMap(i));
if (!mStages[i].getTex(MFT_DiffuseMap)) if (!mStages[i].getTex(MFT_DiffuseMap))
@ -406,7 +406,7 @@ void ProcessedMaterial::_setStageData()
} }
} }
// OverlayMap // OverlayMap
if (mMaterial->getOverlayMapAsset(i).notNull()) if (mMaterial->getOverlayMap(i))
{ {
mStages[i].setTex(MFT_OverlayMap, mMaterial->getOverlayMap(i)); mStages[i].setTex(MFT_OverlayMap, mMaterial->getOverlayMap(i));
if (!mStages[i].getTex(MFT_OverlayMap)) if (!mStages[i].getTex(MFT_OverlayMap))
@ -414,7 +414,7 @@ void ProcessedMaterial::_setStageData()
} }
// LightMap // LightMap
if (mMaterial->getLightMapAsset(i).notNull()) if (mMaterial->getLightMap(i))
{ {
mStages[i].setTex(MFT_LightMap, mMaterial->getLightMap(i)); mStages[i].setTex(MFT_LightMap, mMaterial->getLightMap(i));
if (!mStages[i].getTex(MFT_LightMap)) if (!mStages[i].getTex(MFT_LightMap))
@ -422,7 +422,7 @@ void ProcessedMaterial::_setStageData()
} }
// ToneMap // ToneMap
if (mMaterial->getToneMapAsset(i).notNull()) if (mMaterial->getToneMap(i))
{ {
mStages[i].setTex(MFT_ToneMap, mMaterial->getToneMap(i)); mStages[i].setTex(MFT_ToneMap, mMaterial->getToneMap(i));
if (!mStages[i].getTex(MFT_ToneMap)) if (!mStages[i].getTex(MFT_ToneMap))
@ -430,7 +430,7 @@ void ProcessedMaterial::_setStageData()
} }
// DetailMap // DetailMap
if (mMaterial->getDetailMapAsset(i).notNull()) if (mMaterial->getDetailMap(i))
{ {
mStages[i].setTex(MFT_DetailMap, mMaterial->getDetailMap(i)); mStages[i].setTex(MFT_DetailMap, mMaterial->getDetailMap(i));
if (!mStages[i].getTex(MFT_DetailMap)) if (!mStages[i].getTex(MFT_DetailMap))
@ -438,7 +438,7 @@ void ProcessedMaterial::_setStageData()
} }
// NormalMap // NormalMap
if (mMaterial->getNormalMapAsset(i).notNull()) if (mMaterial->getNormalMap(i))
{ {
mStages[i].setTex(MFT_NormalMap, mMaterial->getNormalMap(i)); mStages[i].setTex(MFT_NormalMap, mMaterial->getNormalMap(i));
if (!mStages[i].getTex(MFT_NormalMap)) if (!mStages[i].getTex(MFT_NormalMap))
@ -450,7 +450,7 @@ void ProcessedMaterial::_setStageData()
} }
// Detail Normal Map // Detail Normal Map
if (mMaterial->getDetailNormalMapAsset(i).notNull()) if (mMaterial->getDetailNormalMap(i))
{ {
mStages[i].setTex(MFT_DetailNormalMap, mMaterial->getDetailNormalMap(i)); mStages[i].setTex(MFT_DetailNormalMap, mMaterial->getDetailNormalMap(i));
if (!mStages[i].getTex(MFT_DetailNormalMap)) if (!mStages[i].getTex(MFT_DetailNormalMap))
@ -463,7 +463,7 @@ void ProcessedMaterial::_setStageData()
profile = &GFXStaticTextureSRGBProfile; profile = &GFXStaticTextureSRGBProfile;
// ORMConfig // ORMConfig
if (mMaterial->getORMConfigMapAsset(i).notNull()) if (mMaterial->getORMConfigMap(i))
{ {
mStages[i].setTex(MFT_OrmMap, mMaterial->getORMConfigMap(profile, i)); mStages[i].setTex(MFT_OrmMap, mMaterial->getORMConfigMap(profile, i));
if (!mStages[i].getTex(MFT_OrmMap)) if (!mStages[i].getTex(MFT_OrmMap))
@ -471,7 +471,7 @@ void ProcessedMaterial::_setStageData()
} }
else else
{ {
if ((mMaterial->getAOMapAsset(i).notNull()) || (mMaterial->getRoughMapAsset(i).notNull()) || (mMaterial->getMetalMapAsset(i).notNull())) if ((mMaterial->getAOMap(i)) || (mMaterial->getRoughMap(i)) || (mMaterial->getMetalMap(i)))
{ {
U32 inputKey[4]; U32 inputKey[4];
inputKey[0] = mMaterial->mAOChan[i]; inputKey[0] = mMaterial->mAOChan[i];
@ -485,7 +485,7 @@ void ProcessedMaterial::_setStageData()
mMaterial->logError("Failed to dynamically create ORM Config map for stage %i", i); mMaterial->logError("Failed to dynamically create ORM Config map for stage %i", i);
} }
} }
if (mMaterial->getGlowMapAsset(i).notNull()) if (mMaterial->getGlowMap(i))
{ {
mStages[i].setTex(MFT_GlowMap, mMaterial->getGlowMap(i)); mStages[i].setTex(MFT_GlowMap, mMaterial->getGlowMap(i));
if (!mStages[i].getTex(MFT_GlowMap)) if (!mStages[i].getTex(MFT_GlowMap))