mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +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),
|
mUseMips(true),
|
||||||
mIsHDRImage(false),
|
mIsHDRImage(false),
|
||||||
mImageType(Albedo),
|
mImageType(Albedo),
|
||||||
mTextureHandle(NULL)
|
mTextureHandle(NULL),
|
||||||
|
mIsNamedTarget(false)
|
||||||
{
|
{
|
||||||
mLoadedState = AssetErrCode::NotLoaded;
|
mLoadedState = AssetErrCode::NotLoaded;
|
||||||
}
|
}
|
||||||
|
|
@ -384,6 +385,7 @@ void ImageAsset::setImageFile(StringTableEntry pImageFile)
|
||||||
if (String(pImageFile).startsWith("#"))
|
if (String(pImageFile).startsWith("#"))
|
||||||
{
|
{
|
||||||
mImageFile = StringTable->insert(pImageFile);
|
mImageFile = StringTable->insert(pImageFile);
|
||||||
|
mIsNamedTarget = true;
|
||||||
refreshAsset();
|
refreshAsset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ private:
|
||||||
GFXTexHandle mTextureHandle;
|
GFXTexHandle mTextureHandle;
|
||||||
ImageTypes mImageType;
|
ImageTypes mImageType;
|
||||||
HashMap<GFXTextureProfile*, GFXTexHandle> mResourceMap;
|
HashMap<GFXTextureProfile*, GFXTexHandle> mResourceMap;
|
||||||
|
bool mIsNamedTarget;
|
||||||
void generateTexture(void);
|
void generateTexture(void);
|
||||||
public:
|
public:
|
||||||
ImageAsset();
|
ImageAsset();
|
||||||
|
|
@ -188,7 +189,7 @@ public:
|
||||||
inline U32 getTextureBitmapDepth(void) const { return mTextureHandle->getBitmapDepth(); }
|
inline U32 getTextureBitmapDepth(void) const { return mTextureHandle->getBitmapDepth(); }
|
||||||
bool isAssetValid(void) const override { return !mTextureHandle.isNull(); }
|
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); }
|
NamedTexTargetRef getNamedTarget(void) const { return NamedTexTarget::find(mImageFile + 1); }
|
||||||
|
|
||||||
static U32 getAssetByFilename(StringTableEntry fileName, AssetPtr<ImageAsset>* imageAsset);
|
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(); } \
|
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; }\
|
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]; } \
|
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;}
|
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