Browse Source

- Added missing "isAssetPrivate()" script-binding.

MelvMay-GG 12 years ago
parent
commit
264fb1a

+ 18 - 0
engine/source/assets/assetManager.cc

@@ -561,6 +561,24 @@ bool AssetManager::isAssetInternal( const char* pAssetId )
 
 //-----------------------------------------------------------------------------
 
+bool AssetManager::isAssetPrivate( const char* pAssetId )
+{
+    // Find asset definition.
+    AssetDefinition* pAssetDefinition = findAsset( pAssetId );
+
+    // Did we find the asset?
+    if ( pAssetDefinition == NULL )
+    {
+        // No, so warn.
+        Con::warnf( "Asset Manager: Cannot find asset Id '%s'.", pAssetId );
+        return false;
+    }
+
+    return pAssetDefinition->mAssetPrivate;
+}
+
+//-----------------------------------------------------------------------------
+
 bool AssetManager::isAssetAutoUnload( const char* pAssetId )
 {
     // Find asset definition.

+ 1 - 0
engine/source/assets/assetManager.h

@@ -139,6 +139,7 @@ public:
     StringTableEntry getAssetPath( const char* pAssetId );
     ModuleDefinition* getAssetModuleDefinition( const char* pAssetId );
     bool isAssetInternal( const char* pAssetId );
+    bool isAssetPrivate( const char* pAssetId );
     bool isAssetAutoUnload( const char* pAssetId );
     bool isAssetLoaded( const char* pAssetId );
     bool isDeclaredAsset( const char* pAssetId );

+ 9 - 0
engine/source/assets/assetManager_ScriptBinding.h

@@ -213,6 +213,15 @@ ConsoleMethod( AssetManager, isAssetInternal, bool, 3, 3,       "(assetId) - Che
 
 //-----------------------------------------------------------------------------
 
+ConsoleMethod( AssetManager, isAssetPrivate, bool, 3, 3,       "(assetId) - Check whether the specified asset Id is private or not.\n"
+                                                                "@param assetId The selected asset Id.\n"
+                                                                "@return Whether the specified asset Id is private or not.")
+{
+    return object->isAssetPrivate( argv[2] );
+}
+
+//-----------------------------------------------------------------------------
+
 ConsoleMethod( AssetManager, isAssetAutoUnload, bool, 3, 3,    "(assetId) - Check whether the specified asset Id is auto-unload or not.\n"
                                                                 "@param assetId The selected asset Id.\n"
                                                                 "@return Whether the specified asset Id is auto-unload or not.")