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

in contexts where we would want to try first (pt2)
This commit is contained in:
AzaezelX 2025-05-28 17:45:02 -05:00
parent 40974dd14b
commit 8bd145d54f
7 changed files with 17 additions and 25 deletions

View file

@ -974,8 +974,6 @@ void GroundCover::_initialize( U32 cellCount, U32 cellPlacementCount )
GFXTexHandle tex;
if (mat->getDiffuseMap(0))
tex = mat->getDiffuseMap(0);
else if (mat->getDiffuseMapAsset(0).notNull())
tex = mat->getDiffuseMap(0);
if(tex.isValid())
{

View file

@ -367,7 +367,7 @@ void LevelInfo::_onLMActivate(const char *lm, bool enable)
void LevelInfo::setLevelAccuTexture()
{
if (isClientObject() && mAccuTextureAsset.notNull())
if (isClientObject() && getAccuTexture())
{
gLevelAccuMap = getAccuTexture();
}

View file

@ -324,10 +324,7 @@ bool afxZodiacData::preload(bool server, String &errorStr)
if (vert_range.x == 0.0f && vert_range.y == 0.0f)
vert_range.x = vert_range.y = radius_xy;
if (mTextureAsset.notNull())
{
getTexture();
}
getTexture();
return true;
}
@ -345,10 +342,7 @@ void afxZodiacData::onStaticModified(const char* slot, const char* newValue)
void afxZodiacData::onPerformSubstitutions()
{
if (mTextureAsset.notNull())
{
getTexture();
}
getTexture();
}
F32 afxZodiacData::calcRotationAngle(F32 elapsed, F32 rate_factor)

View file

@ -380,7 +380,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
if ( mTextLocation == TextLocRight )
{
Point2I start( mTextMargin, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
if (mBitmapAsset.notNull() && mIconLocation != IconLocNone)
if (getBitmap() && mIconLocation != IconLocNone)
{
start.x = getWidth() - (iconRect.extent.x + mButtonMargin.x + textWidth);
}
@ -400,7 +400,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
if ( mTextLocation == TextLocCenter )
{
Point2I start;
if (mBitmapAsset.notNull() && mIconLocation == IconLocLeft )
if (getBitmap() && mIconLocation == IconLocLeft )
{
start.set( ( getWidth() - textWidth - iconRect.extent.x ) / 2 + iconRect.extent.x,
( getHeight() - mProfile->mFont->getHeight() ) / 2 );

View file

@ -875,7 +875,7 @@ void ProcessedShaderMaterial::setTextureStages( SceneRenderState *state, const S
case Material::TexTarget:
{
texTarget = rpd->mTexSlot[i].texTarget;
if (!mMaterial->getDiffuseMapAsset(0).notNull())
if (!mMaterial->getDiffuseMap(0))
{
GFX->setTexture(i, NULL);
break;

View file

@ -96,7 +96,7 @@ void TerrainBlock::_updateMaterials()
{
TerrainMaterial *mat = mFile->mMaterials[i];
if (mat->getDiffuseMapAsset().notNull())
if (mat->getDiffuseMap())
{
mBaseTextures[i] = mat->getDiffuseMap();
}
@ -104,11 +104,11 @@ void TerrainBlock::_updateMaterials()
mBaseTextures[ i ] = GFXTexHandle();
// Find the maximum detail distance.
if ( mat->getDetailMapAsset().notNull() &&
if ( mat->getDetailMap() &&
mat->getDetailDistance() > mMaxDetailDistance )
mMaxDetailDistance = mat->getDetailDistance();
if ( mat->getMacroMapAsset().notNull() &&
if ( mat->getMacroMap() &&
mat->getMacroDistance() > mMaxDetailDistance )
mMaxDetailDistance = mat->getMacroDistance();
}
@ -126,18 +126,18 @@ void TerrainBlock::_updateMaterials()
{
TerrainMaterial* mat = mFile->mMaterials[i];
if (mat->getDetailMapAsset().notNull())
if (mat->getDetailMap())
detailTexArray[i] = mat->getDetailMap();
if (mat->getMacroMapAsset().notNull())
if (mat->getMacroMap())
macroTexArray[i] = mat->getMacroMap();
if (mat->getNormalMapAsset().notNull())
if (mat->getNormalMap())
normalTexArray[i] = mat->getNormalMap();
//depending on creation method this may or may not have been shoved into srgb space eroneously
GFXTextureProfile* profile = &GFXStaticTextureProfile;
if (mat->getIsSRGB())
profile = &GFXStaticTextureSRGBProfile;
if (mat->getORMConfigMapAsset().notNull())
if (mat->getORMConfigMap())
ormTexArray[i] = mat->getORMConfigMapAsset()->getTexture(profile);
}

View file

@ -1030,7 +1030,7 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
{
Torque::Path diffusePath;
if (mat->getDiffuseMapAsset(0).notNull())
if (mat->getDiffuseMap(0))
diffusePath = Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
else
diffusePath = String("warningMat");
@ -1040,7 +1040,7 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
}
else
{
if (mat->getDiffuseMapAsset(0).notNull())
if (mat->getDiffuseMap(0))
diffuseMap += Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
else
diffuseMap += "warningMat";
@ -1316,7 +1316,7 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
{
Torque::Path diffusePath;
if (mat->getDiffuseMapAsset(0).notNull())
if (mat->getDiffuseMap(0))
diffusePath = Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
else
diffusePath = String("warningMat");
@ -1326,7 +1326,7 @@ void ColladaUtils::exportColladaMaterials(tinyxml2::XMLElement* rootNode, const
}
else
{
if (mat->getDiffuseMapAsset(0).notNull())
if (mat->getDiffuseMap(0))
diffuseMap += Torque::Path(mat->getDiffuseMapAsset(0)->getImageFile());
else
diffuseMap += "warningMat";