mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +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
|
|
@ -285,7 +285,8 @@ public:
|
|||
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; } \
|
||||
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) \
|
||||
|
|
@ -331,7 +332,8 @@ public:
|
|||
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; } \
|
||||
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) \
|
||||
|
|
@ -381,7 +383,8 @@ public:
|
|||
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;}
|
||||
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) \
|
||||
|
|
@ -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(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;}
|
||||
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) \
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ for (U32 i = 0; i < max; i++)\
|
|||
#define DEF_ASSET_BINDS_REFACTOR(className,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))\
|
||||
{\
|
||||
|
|
|
|||
|
|
@ -138,6 +138,8 @@ private: AssetPtr<ImageAsset> mBitmapAsset; public: void _setBitmap(StringTableE
|
|||
} static bool _setBitmapData(void* obj, const char* index, const char* data) {
|
||||
static_cast<GuiBitmapButtonCtrl*>(obj)->_setBitmap(_getStringTable()->insert(data)); return false;
|
||||
}
|
||||
StringTableEntry getBitmapFile() { return mBitmapAsset.notNull() ? mBitmapAsset->getImageFile() : ""; }
|
||||
|
||||
protected:
|
||||
|
||||
void onAssetRefreshed(AssetPtrBase* pAssetPtrBase) override
|
||||
|
|
|
|||
|
|
@ -701,7 +701,7 @@ DefineEngineMethod( GuiControlProfile, getStringWidth, S32, (const char* string)
|
|||
|
||||
DefineEngineMethod(GuiControlProfile, getBitmap, const char*, (), , "get name")
|
||||
{
|
||||
return object->getBitmapAsset()->getImageFile();
|
||||
return object->getBitmapFile();
|
||||
}
|
||||
DefineEngineMethod(GuiControlProfile, getBitmapAsset, const char*, (), , "")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -478,9 +478,7 @@ void ProcessedMaterial::_setStageData()
|
|||
inputKey[2] = mMaterial->mMetalChan[i];
|
||||
inputKey[3] = 0;
|
||||
mStages[i].setTex(MFT_OrmMap,
|
||||
_createCompositeTexture(mMaterial->getAOMapAsset(i).notNull() ? mMaterial->getAOMapAsset(i)->getImageFile() : "",
|
||||
mMaterial->getRoughMapAsset(i).notNull() ? mMaterial->getRoughMapAsset(i)->getImageFile() : "",
|
||||
mMaterial->getMetalMapAsset(i).notNull() ? mMaterial->getMetalMapAsset(i)->getImageFile() : "",
|
||||
_createCompositeTexture(mMaterial->getAOMapFile(i), mMaterial->getRoughMapFile(i), mMaterial->getMetalMapFile(i),
|
||||
"", inputKey, profile));
|
||||
if (!mStages[i].getTex(MFT_OrmMap))
|
||||
mMaterial->logError("Failed to dynamically create ORM Config map for stage %i", i);
|
||||
|
|
|
|||
Loading…
Reference in a new issue