From 8bd145d54feeff5b4d3d78006b86c96d4f5495c8 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Wed, 28 May 2025 17:45:02 -0500 Subject: [PATCH] use of get methods that already return nulls/false when attempting to load in contexts where we would want to try first (pt2) --- Engine/source/T3D/fx/groundCover.cpp | 2 -- Engine/source/T3D/levelInfo.cpp | 2 +- Engine/source/afx/ce/afxZodiac.cpp | 10 ++-------- Engine/source/gui/buttons/guiIconButtonCtrl.cpp | 4 ++-- .../source/materials/processedShaderMaterial.cpp | 2 +- Engine/source/terrain/terrRender.cpp | 14 +++++++------- Engine/source/ts/collada/colladaUtils.cpp | 8 ++++---- 7 files changed, 17 insertions(+), 25 deletions(-) diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index 3f4343184..9352deabf 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -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()) { diff --git a/Engine/source/T3D/levelInfo.cpp b/Engine/source/T3D/levelInfo.cpp index 82d3b55c5..884fd7d17 100644 --- a/Engine/source/T3D/levelInfo.cpp +++ b/Engine/source/T3D/levelInfo.cpp @@ -367,7 +367,7 @@ void LevelInfo::_onLMActivate(const char *lm, bool enable) void LevelInfo::setLevelAccuTexture() { - if (isClientObject() && mAccuTextureAsset.notNull()) + if (isClientObject() && getAccuTexture()) { gLevelAccuMap = getAccuTexture(); } diff --git a/Engine/source/afx/ce/afxZodiac.cpp b/Engine/source/afx/ce/afxZodiac.cpp index 2df200230..e0d338c57 100644 --- a/Engine/source/afx/ce/afxZodiac.cpp +++ b/Engine/source/afx/ce/afxZodiac.cpp @@ -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) diff --git a/Engine/source/gui/buttons/guiIconButtonCtrl.cpp b/Engine/source/gui/buttons/guiIconButtonCtrl.cpp index 79571f096..44cb8e2b5 100644 --- a/Engine/source/gui/buttons/guiIconButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiIconButtonCtrl.cpp @@ -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 ); diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index 605e9dc6c..5c543ee5f 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -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; diff --git a/Engine/source/terrain/terrRender.cpp b/Engine/source/terrain/terrRender.cpp index 0fc77aafc..15848fefe 100644 --- a/Engine/source/terrain/terrRender.cpp +++ b/Engine/source/terrain/terrRender.cpp @@ -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); } diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index dc91b26f8..92b142ffb 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -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";