mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-21 07:33:45 +00:00
null handling
This commit is contained in:
parent
987ff90467
commit
6c2b4f8979
2 changed files with 6 additions and 3 deletions
|
|
@ -187,7 +187,8 @@ ImageAsset::ImageAsset() :
|
|||
mUseMips(true),
|
||||
mIsHDRImage(false),
|
||||
mImageType(Albedo),
|
||||
mTextureHandle(NULL)
|
||||
mTextureHandle(NULL),
|
||||
mIsNamedTarget(false)
|
||||
{
|
||||
mLoadedState = AssetErrCode::NotLoaded;
|
||||
}
|
||||
|
|
@ -384,6 +385,7 @@ void ImageAsset::setImageFile(StringTableEntry pImageFile)
|
|||
if (String(pImageFile).startsWith("#"))
|
||||
{
|
||||
mImageFile = StringTable->insert(pImageFile);
|
||||
mIsNamedTarget = true;
|
||||
refreshAsset();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ private:
|
|||
GFXTexHandle mTextureHandle;
|
||||
ImageTypes mImageType;
|
||||
HashMap<GFXTextureProfile*, GFXTexHandle> mResourceMap;
|
||||
bool mIsNamedTarget;
|
||||
void generateTexture(void);
|
||||
public:
|
||||
ImageAsset();
|
||||
|
|
@ -188,7 +189,7 @@ public:
|
|||
inline U32 getTextureBitmapDepth(void) const { return mTextureHandle->getBitmapDepth(); }
|
||||
bool isAssetValid(void) const override { return !mTextureHandle.isNull(); }
|
||||
|
||||
bool isNamedTarget(void) const { return String(getImageFile()).startsWith("#"); }
|
||||
bool isNamedTarget(void) const { return mIsNamedTarget; }
|
||||
NamedTexTargetRef getNamedTarget(void) const { return NamedTexTarget::find(mImageFile + 1); }
|
||||
|
||||
static U32 getAssetByFilename(StringTableEntry fileName, AssetPtr<ImageAsset>* imageAsset);
|
||||
|
|
@ -700,7 +701,7 @@ public:
|
|||
}; \
|
||||
\
|
||||
inline StringTableEntry _get##name(const U32& index) const { return m##name##Asset[index].getAssetId(); } \
|
||||
GFXTexHandle get##name(const U32& index) { return m##name##Asset[index].notNull() ? m##name##Asset[index]->getTexture(&profile) : NULL; } \
|
||||
GFXTexHandle get##name(const U32& index) { return get##name(&profile, index); } \
|
||||
GFXTexHandle get##name(GFXTextureProfile* requestedProfile, const U32& index) { return m##name##Asset[index].notNull() ? m##name##Asset[index]->getTexture(requestedProfile) : NULL; }\
|
||||
AssetPtr<ImageAsset> get##name##Asset(const U32& index) { return m##name##Asset[index]; } \
|
||||
static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast<className*>(obj)->_set##name(_getStringTable()->insert(data), dAtoi(index)); return false;}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue