mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
various cleanups and fixes
basicClouds refactored null dereference fixes in guiMenuBar
This commit is contained in:
parent
eb746a1142
commit
4d980e5406
6 changed files with 104 additions and 32 deletions
|
|
@ -618,7 +618,8 @@ public:
|
|||
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;}
|
||||
|
||||
#define DECLARE_IMAGEASSET_NET_REFACTOR(className, name, profile, mask) \
|
||||
|
||||
#define DECLARE_IMAGEASSET_NET_REFACTOR(className, name, profile, mask) \
|
||||
private: \
|
||||
AssetPtr<ImageAsset> m##name##Asset; \
|
||||
public: \
|
||||
|
|
@ -647,7 +648,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;}
|
||||
|
||||
|
||||
#define INITPERSISTFIELD_IMAGEASSET_REFACTOR(name, consoleClass, docs) \
|
||||
addProtectedField(assetText(name, Asset), TypeImageAssetPtrRefactor, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, assetDoc(name, asset docs.));
|
||||
|
|
@ -683,6 +685,39 @@ public:
|
|||
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;}
|
||||
|
||||
|
||||
#define DECLARE_IMAGEASSET_ARRAY_NET_REFACTOR(className, name, profile, max, mask) \
|
||||
private: \
|
||||
AssetPtr<ImageAsset> m##name##Asset[max]; \
|
||||
public: \
|
||||
void _set##name(StringTableEntry _in, const U32& index){ \
|
||||
if(m##name##Asset[index].getAssetId() == _in) \
|
||||
return; \
|
||||
\
|
||||
if(!AssetDatabase.isDeclaredAsset(_in)) \
|
||||
{ \
|
||||
StringTableEntry imageAssetId = ImageAsset::smNoImageAssetFallback; \
|
||||
AssetQuery query; \
|
||||
S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); \
|
||||
if (foundAssetcount != 0) \
|
||||
{ \
|
||||
imageAssetId = query.mAssetList[0]; \
|
||||
} \
|
||||
m##name##Asset[index] = imageAssetId; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
m##name##Asset[index] = _in; \
|
||||
} \
|
||||
setMaskBits(mask); \
|
||||
}; \
|
||||
\
|
||||
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; } \
|
||||
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;}
|
||||
|
||||
|
||||
#define INITPERSISTFIELD_IMAGEASSET_ARRAY_REFACTOR(name, arraySize, consoleClass, docs) \
|
||||
addProtectedField(assetText(name, Asset), TypeImageAssetPtrRefactor, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, asset docs.));
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ if (m##name##AssetId != StringTable->EmptyString())\
|
|||
|
||||
//network send - datablock
|
||||
#define PACKDATA_ASSET_ARRAY_REFACTOR(name, max)\
|
||||
for (i = 0; i < max; i++)\
|
||||
for (U32 i = 0; i < max; i++)\
|
||||
{\
|
||||
if (stream->writeFlag(m##name##Asset[i].notNull()))\
|
||||
{\
|
||||
|
|
@ -98,7 +98,7 @@ for (i = 0; i < max; i++)\
|
|||
|
||||
//network recieve - datablock
|
||||
#define UNPACKDATA_ASSET_ARRAY_REFACTOR(name, max)\
|
||||
for (i = 0; i < max; i++)\
|
||||
for (U32 i = 0; i < max; i++)\
|
||||
{\
|
||||
if (stream->readFlag())\
|
||||
{\
|
||||
|
|
@ -106,6 +106,27 @@ for (i = 0; i < max; i++)\
|
|||
}\
|
||||
}
|
||||
|
||||
//network send - object-instance
|
||||
#define PACK_ASSET_ARRAY_REFACTOR(netconn, name, max)\
|
||||
for (U32 i = 0; i < max; i++)\
|
||||
{\
|
||||
if (stream->writeFlag(m##name##Asset[i].notNull()))\
|
||||
{\
|
||||
NetStringHandle assetIdStr = m##name##Asset[i].getAssetId();\
|
||||
netconn->packNetStringHandleU(stream, assetIdStr);\
|
||||
}\
|
||||
}
|
||||
|
||||
//network recieve - object-instance
|
||||
#define UNPACK_ASSET_ARRAY_REFACTOR(netconn, name, max)\
|
||||
for (U32 i = 0; i < max; i++)\
|
||||
{\
|
||||
if (stream->readFlag())\
|
||||
{\
|
||||
m##name##Asset[i] = StringTable->insert(netconn->unpackNetStringHandleU(stream).getString());\
|
||||
}\
|
||||
}
|
||||
|
||||
#define DEF_ASSET_BINDS_REFACTOR(className,name)\
|
||||
DefineEngineMethod(className, get##name, StringTableEntry, (), , "get name")\
|
||||
{\
|
||||
|
|
|
|||
|
|
@ -183,6 +183,8 @@ void SplashData::packData(BitStream* stream)
|
|||
stream->writeRangedU32(explosion->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast);
|
||||
}
|
||||
|
||||
PACKDATA_ASSET_ARRAY_REFACTOR(Texture, NUM_TEX);
|
||||
|
||||
S32 i;
|
||||
for( i=0; i<NUM_EMITTERS; i++ )
|
||||
{
|
||||
|
|
@ -201,8 +203,6 @@ void SplashData::packData(BitStream* stream)
|
|||
{
|
||||
stream->write( times[i] );
|
||||
}
|
||||
|
||||
PACKDATA_ASSET_ARRAY_REFACTOR(Texture, NUM_TEX);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
@ -236,6 +236,8 @@ void SplashData::unpackData(BitStream* stream)
|
|||
explosionId = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
|
||||
}
|
||||
|
||||
UNPACKDATA_ASSET_ARRAY_REFACTOR(Texture, NUM_TEX);
|
||||
|
||||
U32 i;
|
||||
for( i=0; i<NUM_EMITTERS; i++ )
|
||||
{
|
||||
|
|
@ -254,8 +256,6 @@ void SplashData::unpackData(BitStream* stream)
|
|||
{
|
||||
stream->read( ×[i] );
|
||||
}
|
||||
|
||||
UNPACKDATA_ASSET_ARRAY_REFACTOR(Texture, NUM_TEX);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue