mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 23:54:35 +00:00
update macro
Added get##name##File to macro that will check to make sure the asset is not null before getting the image file.
This commit is contained in:
parent
a52069bbc5
commit
aa3f07e339
5 changed files with 13 additions and 9 deletions
|
|
@ -285,7 +285,8 @@ public:
|
||||||
inline StringTableEntry _get##name(void) const { return m##name##Asset.getAssetId(); } \
|
inline StringTableEntry _get##name(void) const { return m##name##Asset.getAssetId(); } \
|
||||||
GFXTexHandle get##name() { return m##name##Asset.notNull() ? m##name##Asset->getTexture(&profile) : NULL; } \
|
GFXTexHandle get##name() { return m##name##Asset.notNull() ? m##name##Asset->getTexture(&profile) : NULL; } \
|
||||||
AssetPtr<ImageAsset> get##name##Asset(void) { return m##name##Asset; } \
|
AssetPtr<ImageAsset> get##name##Asset(void) { return m##name##Asset; } \
|
||||||
static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast<className*>(obj)->_set##name(_getStringTable()->insert(data)); return false;}
|
static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast<className*>(obj)->_set##name(_getStringTable()->insert(data)); return false;} \
|
||||||
|
StringTableEntry get##name##File(){ return m##name##Asset.notNull() ? m##name##Asset->getImageFile() : ""; }
|
||||||
|
|
||||||
|
|
||||||
#define DECLARE_IMAGEASSET_NET(className, name, profile, mask) \
|
#define DECLARE_IMAGEASSET_NET(className, name, profile, mask) \
|
||||||
|
|
@ -331,7 +332,8 @@ public:
|
||||||
inline StringTableEntry _get##name(void) const { return m##name##Asset.getAssetId(); } \
|
inline StringTableEntry _get##name(void) const { return m##name##Asset.getAssetId(); } \
|
||||||
GFXTexHandle get##name() { return m##name##Asset.notNull() ? m##name##Asset->getTexture(&profile) : NULL; } \
|
GFXTexHandle get##name() { return m##name##Asset.notNull() ? m##name##Asset->getTexture(&profile) : NULL; } \
|
||||||
AssetPtr<ImageAsset> get##name##Asset(void) { return m##name##Asset; } \
|
AssetPtr<ImageAsset> get##name##Asset(void) { return m##name##Asset; } \
|
||||||
static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast<className*>(obj)->_set##name(_getStringTable()->insert(data)); return false;}
|
static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast<className*>(obj)->_set##name(_getStringTable()->insert(data)); return false;} \
|
||||||
|
StringTableEntry get##name##File(){ return m##name##Asset.notNull() ? m##name##Asset->getImageFile() : ""; }
|
||||||
|
|
||||||
|
|
||||||
#define INITPERSISTFIELD_IMAGEASSET(name, consoleClass, docs) \
|
#define INITPERSISTFIELD_IMAGEASSET(name, consoleClass, docs) \
|
||||||
|
|
@ -381,7 +383,8 @@ public:
|
||||||
GFXTexHandle get##name(const U32& index) { return get##name(&profile, index); } \
|
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;}\
|
||||||
|
StringTableEntry get##name##File(const U32& idx){ return m##name##Asset[idx].notNull() ? m##name##Asset[idx]->getImageFile() : ""; }
|
||||||
|
|
||||||
|
|
||||||
#define DECLARE_IMAGEASSET_ARRAY_NET(className, name, profile, max, mask) \
|
#define DECLARE_IMAGEASSET_ARRAY_NET(className, name, profile, max, mask) \
|
||||||
|
|
@ -428,7 +431,8 @@ public:
|
||||||
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 m##name##Asset[index].notNull() ? m##name##Asset[index]->getTexture(&profile) : NULL; } \
|
||||||
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;}\
|
||||||
|
StringTableEntry get##name##File(const U32& idx){ return m##name##Asset[idx].notNull() ? m##name##Asset[idx]->getImageFile() : ""; }
|
||||||
|
|
||||||
|
|
||||||
#define INITPERSISTFIELD_IMAGEASSET_ARRAY(name, arraySize, consoleClass, docs) \
|
#define INITPERSISTFIELD_IMAGEASSET_ARRAY(name, arraySize, consoleClass, docs) \
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ for (U32 i = 0; i < max; i++)\
|
||||||
#define DEF_ASSET_BINDS_REFACTOR(className,name)\
|
#define DEF_ASSET_BINDS_REFACTOR(className,name)\
|
||||||
DefineEngineMethod(className, get##name, StringTableEntry, (), , "get name")\
|
DefineEngineMethod(className, get##name, StringTableEntry, (), , "get name")\
|
||||||
{\
|
{\
|
||||||
return object->get##name##Asset().notNull() ? object->get##name##Asset()->getImageFile() : ""; \
|
return object->get##name##File(); \
|
||||||
}\
|
}\
|
||||||
DefineEngineMethod(className, get##name##Asset, StringTableEntry, (), , assetText(name, asset reference))\
|
DefineEngineMethod(className, get##name##Asset, StringTableEntry, (), , assetText(name, asset reference))\
|
||||||
{\
|
{\
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,8 @@ private: AssetPtr<ImageAsset> mBitmapAsset; public: void _setBitmap(StringTableE
|
||||||
} static bool _setBitmapData(void* obj, const char* index, const char* data) {
|
} static bool _setBitmapData(void* obj, const char* index, const char* data) {
|
||||||
static_cast<GuiBitmapButtonCtrl*>(obj)->_setBitmap(_getStringTable()->insert(data)); return false;
|
static_cast<GuiBitmapButtonCtrl*>(obj)->_setBitmap(_getStringTable()->insert(data)); return false;
|
||||||
}
|
}
|
||||||
|
StringTableEntry getBitmapFile() { return mBitmapAsset.notNull() ? mBitmapAsset->getImageFile() : ""; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void onAssetRefreshed(AssetPtrBase* pAssetPtrBase) override
|
void onAssetRefreshed(AssetPtrBase* pAssetPtrBase) override
|
||||||
|
|
|
||||||
|
|
@ -701,7 +701,7 @@ DefineEngineMethod( GuiControlProfile, getStringWidth, S32, (const char* string)
|
||||||
|
|
||||||
DefineEngineMethod(GuiControlProfile, getBitmap, const char*, (), , "get name")
|
DefineEngineMethod(GuiControlProfile, getBitmap, const char*, (), , "get name")
|
||||||
{
|
{
|
||||||
return object->getBitmapAsset()->getImageFile();
|
return object->getBitmapFile();
|
||||||
}
|
}
|
||||||
DefineEngineMethod(GuiControlProfile, getBitmapAsset, const char*, (), , "")
|
DefineEngineMethod(GuiControlProfile, getBitmapAsset, const char*, (), , "")
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -478,9 +478,7 @@ void ProcessedMaterial::_setStageData()
|
||||||
inputKey[2] = mMaterial->mMetalChan[i];
|
inputKey[2] = mMaterial->mMetalChan[i];
|
||||||
inputKey[3] = 0;
|
inputKey[3] = 0;
|
||||||
mStages[i].setTex(MFT_OrmMap,
|
mStages[i].setTex(MFT_OrmMap,
|
||||||
_createCompositeTexture(mMaterial->getAOMapAsset(i).notNull() ? mMaterial->getAOMapAsset(i)->getImageFile() : "",
|
_createCompositeTexture(mMaterial->getAOMapFile(i), mMaterial->getRoughMapFile(i), mMaterial->getMetalMapFile(i),
|
||||||
mMaterial->getRoughMapAsset(i).notNull() ? mMaterial->getRoughMapAsset(i)->getImageFile() : "",
|
|
||||||
mMaterial->getMetalMapAsset(i).notNull() ? mMaterial->getMetalMapAsset(i)->getImageFile() : "",
|
|
||||||
"", inputKey, profile));
|
"", inputKey, profile));
|
||||||
if (!mStages[i].getTex(MFT_OrmMap))
|
if (!mStages[i].getTex(MFT_OrmMap))
|
||||||
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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue