mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +00:00
Expands ScriptAsset behavior to operate as a generic type-settable asset
This commit is contained in:
parent
b6f3c25fea
commit
167f98b767
6 changed files with 50 additions and 4 deletions
|
|
@ -50,6 +50,7 @@ StringTableEntry assetCategoryField = StringTable->insert("AssetCategory");
|
|||
StringTableEntry assetAutoUnloadField = StringTable->insert("AssetAutoUnload");
|
||||
StringTableEntry assetInternalField = StringTable->insert("AssetInternal");
|
||||
StringTableEntry assetPrivateField = StringTable->insert("AssetPrivate");
|
||||
StringTableEntry assetTypeField = StringTable->insert("AssetType");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const String AssetBase::mErrCodeStrings[] =
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ extern StringTableEntry assetCategoryField;
|
|||
extern StringTableEntry assetInternalField;
|
||||
extern StringTableEntry assetPrivateField;
|
||||
extern StringTableEntry assetAutoUnloadField;
|
||||
extern StringTableEntry assetTypeField;
|
||||
|
||||
//#define ASSET_BASE_ASSETNAME_FIELD "AssetName"
|
||||
//#define ASSET_BASE_ASSETDESCRIPTION_FIELD "AssetDescription"
|
||||
|
|
@ -137,6 +138,7 @@ public:
|
|||
protected:
|
||||
virtual void initializeAsset(void) {}
|
||||
virtual void onAssetRefresh(void) {}
|
||||
virtual void unloadAsset(void) {}
|
||||
|
||||
protected:
|
||||
static bool setAssetName(void *obj, const char *array, const char *data) { static_cast<AssetBase*>(obj)->setAssetName(data); return false; }
|
||||
|
|
|
|||
|
|
@ -2988,6 +2988,8 @@ void AssetManager::unloadAsset( AssetDefinition* pAssetDefinition )
|
|||
// Debug Profiling.
|
||||
PROFILE_SCOPE(AssetManager_UnloadAsset);
|
||||
|
||||
pAssetDefinition->mpAssetBase->unloadAsset();
|
||||
|
||||
// Destroy the asset.
|
||||
if(pAssetDefinition->mpAssetBase->isProperlyAdded())
|
||||
pAssetDefinition->mpAssetBase->deleteObject();
|
||||
|
|
|
|||
|
|
@ -129,6 +129,17 @@ public:
|
|||
mAssetDefinition.mAssetInternal = dAtob( pPropertyValue );
|
||||
return true;
|
||||
}
|
||||
else if (propertyName == assetTypeField)
|
||||
{
|
||||
if (mAssetDefinition.mAssetType == StringTable->insert("ScriptAsset"))
|
||||
{
|
||||
//We're gunna special-casehere.
|
||||
//If it's a ScriptAsset and it defines an AssetType property, we presume
|
||||
//that's the ScriptAsset's special asset type, so we set it here
|
||||
mAssetDefinition.mAssetType = StringTable->insert(pPropertyValue);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch property word count.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue