mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-18 06:03:48 +00:00
Merge branch 'Standardized_AB_AssetManagement' of https://github.com/Areloch/Torque3D into development
This commit is contained in:
commit
c2af4e578b
39 changed files with 1921 additions and 3659 deletions
|
|
@ -178,3 +178,17 @@ void CppAsset::onAssetRefresh(void)
|
|||
|
||||
mHeaderPath = getOwned() ? expandAssetFilePath(mHeaderFile) : mHeaderPath;
|
||||
}
|
||||
|
||||
DefineEngineMethod(CppAsset, getCodePath, const char*, (), ,
|
||||
"Gets the code file filepath of this asset.\n"
|
||||
"@return File path of the code file.")
|
||||
{
|
||||
return object->getCppFilePath();
|
||||
}
|
||||
|
||||
DefineEngineMethod(CppAsset, getHeaderPath, const char*, (), ,
|
||||
"Gets the header file filepath of this asset.\n"
|
||||
"@return File path of the header file.")
|
||||
{
|
||||
return object->getHeaderFilePath();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ public:
|
|||
void setHeaderFile(const char* pHeaderFile);
|
||||
inline StringTableEntry getHeaderFile(void) const { return mHeaderFile; };
|
||||
|
||||
inline StringTableEntry getCppFilePath(void) const { return mCodePath; };
|
||||
inline StringTableEntry getHeaderFilePath(void) const { return mHeaderPath; };
|
||||
|
||||
protected:
|
||||
void initializeAsset(void) override;
|
||||
void onAssetRefresh(void) override;
|
||||
|
|
@ -73,9 +76,6 @@ protected:
|
|||
static bool setCppFile(void *obj, const char *index, const char *data) { static_cast<CppAsset*>(obj)->setCppFile(data); return false; }
|
||||
static const char* getCppFile(void* obj, const char* data) { return static_cast<CppAsset*>(obj)->getCppFile(); }
|
||||
|
||||
inline StringTableEntry getCppFilePath(void) const { return mCodePath; };
|
||||
inline StringTableEntry getHeaderFilePath(void) const { return mHeaderPath; };
|
||||
|
||||
static bool setHeaderFile(void *obj, const char *index, const char *data) { static_cast<CppAsset*>(obj)->setHeaderFile(data); return false; }
|
||||
static const char* getHeaderFile(void* obj, const char* data) { return static_cast<CppAsset*>(obj)->getHeaderFile(); }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1563,6 +1563,53 @@ bool AssetManager::restoreAssetTags( void )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const char* AssetManager::getAssetLooseFiles(const char* pAssetId)
|
||||
{
|
||||
// Debug Profiling.
|
||||
PROFILE_SCOPE(AssetManager_getAssetLooseFIles);
|
||||
|
||||
// Sanity!
|
||||
AssertFatal(pAssetId != NULL, "Cannot look up NULL asset Id.");
|
||||
|
||||
// Find asset.
|
||||
AssetDefinition* pAssetDefinition = findAsset(pAssetId);
|
||||
|
||||
// Did we find the asset?
|
||||
if (pAssetDefinition == NULL)
|
||||
{
|
||||
// No, so warn.
|
||||
Con::warnf("Asset Manager: Failed to find asset Id '%s' as it does not exist.", pAssetId);
|
||||
return String::EmptyString;
|
||||
}
|
||||
|
||||
// Info.
|
||||
if (mEchoInfo)
|
||||
{
|
||||
Con::printSeparator();
|
||||
Con::printf("Asset Manager: Started getting loose files of Asset Id '%s'...", pAssetId);
|
||||
}
|
||||
|
||||
String looseFileList = "";
|
||||
Vector<StringTableEntry>& assetLooseFiles = pAssetDefinition->mAssetLooseFiles;
|
||||
for (Vector<StringTableEntry>::iterator looseFileItr = assetLooseFiles.begin(); looseFileItr != assetLooseFiles.end(); ++looseFileItr)
|
||||
{
|
||||
// Fetch loose file.
|
||||
StringTableEntry looseFile = *looseFileItr;
|
||||
|
||||
looseFileList += looseFile;
|
||||
|
||||
if (looseFileItr != assetLooseFiles.end())
|
||||
looseFileList += "\t";
|
||||
}
|
||||
|
||||
char* ret = Con::getReturnBuffer(1024);
|
||||
dSprintf(ret, 1024, "%s", looseFileList.c_str());
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
S32 QSORT_CALLBACK descendingAssetDefinitionLoadCount(const void* a, const void* b)
|
||||
{
|
||||
// Debug Profiling.
|
||||
|
|
|
|||
|
|
@ -341,6 +341,9 @@ public:
|
|||
bool restoreAssetTags( void );
|
||||
inline AssetTagsManifest* getAssetTags( void ) const { return mAssetTagsManifest; }
|
||||
|
||||
/// Loose File management
|
||||
const char* getAssetLooseFiles(const char* pAssetId);
|
||||
|
||||
/// Info.
|
||||
inline U32 getDeclaredAssetCount( void ) const { return (U32)mDeclaredAssets.size(); }
|
||||
inline U32 getReferencedAssetCount( void ) const { return (U32)mReferencedAssets.size(); }
|
||||
|
|
|
|||
|
|
@ -432,6 +432,20 @@ DefineEngineMethod(AssetManager, getAssetTags, S32, (), ,
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod(AssetManager, getAssetLooseFiles, const char*, (const char* assetId), (""),
|
||||
"Finds the specified asset Id and gets a list of its loose files.\n"
|
||||
"@param assetId The selected asset Id.\n"
|
||||
"@return A tab-delinated list of loose files associated to the assetId.\n")
|
||||
{
|
||||
// Fetch asset Id.
|
||||
const char* pAssetId = assetId;
|
||||
|
||||
// Delete asset.
|
||||
return object->getAssetLooseFiles(pAssetId);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineMethod(AssetManager, findAllAssets, S32, (const char* assetQuery, bool ignoreInternal, bool ignorePrivate), ("", true, true),
|
||||
"Performs an asset query searching for all assets optionally ignoring internal assets.\n"
|
||||
"@param assetQuery The asset query object that will be populated with the results.\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue