Asset Browser initial implementation - Asset updates.

Script execution on certain existing assets, new asset types and some tweaks to the managers.
This commit is contained in:
Areloch 2018-01-28 14:48:02 -06:00
parent 3b0b3c1f56
commit ae5a43de70
41 changed files with 3173 additions and 96 deletions

View file

@ -69,7 +69,7 @@ AssetBase::~AssetBase()
// If the asset manager does not own the asset then we own the
// asset definition so delete it.
if (!getOwned())
delete mpAssetDefinition;
SAFE_DELETE(mpAssetDefinition);
}
//-----------------------------------------------------------------------------

View file

@ -62,6 +62,7 @@ class AssetBase : public SimObject
typedef SimObject Parent;
protected:
AssetManager* mpOwningAssetManager;
bool mAssetInitialized;
AssetDefinition* mpAssetDefinition;

View file

@ -61,6 +61,15 @@
#ifndef COMPONENTASSET_H
#include "T3D/assets/ComponentAsset.h"
#endif
#ifndef GUI_ASSET_H
#include "T3D/assets/GUIAsset.h"
#endif
#ifndef SCRIPT_ASSET_H
#include "T3D/assets/ScriptAsset.h"
#endif
#ifndef MATERIALASSET_H
#include "T3D/assets/MaterialAsset.h"
#endif
// Script bindings.
#include "assetManager_ScriptBinding.h"
@ -251,6 +260,18 @@ bool AssetManager::loadModuleAutoLoadAssets(ModuleDefinition* pModuleDefinition)
{
assetBase = mTaml.read<ComponentAsset>(assetDef->mAssetBaseFilePath);
}
else if (assetDef->mAssetType == StringTable->insert("GUIAsset"))
{
assetBase = mTaml.read<GUIAsset>(assetDef->mAssetBaseFilePath);
}
else if (assetDef->mAssetType == StringTable->insert("ScriptAsset"))
{
assetBase = mTaml.read<ScriptAsset>(assetDef->mAssetBaseFilePath);
}
else if (assetDef->mAssetType == StringTable->insert("MaterialAsset"))
{
assetBase = mTaml.read<MaterialAsset>(assetDef->mAssetBaseFilePath);
}
//load the asset now if valid
if (assetBase)
@ -2369,6 +2390,13 @@ S32 AssetManager::findAssetLooseFile( AssetQuery* pAssetQuery, const char* pLoos
//-----------------------------------------------------------------------------
AssetManager::typeAssetDependsOnHash* AssetManager::getDependedOnAssets()
{
// Find any asset dependencies.
return &mAssetDependsOn;
}
//-----------------------------------------------------------------------------
bool AssetManager::scanDeclaredAssets( const char* pPath, const char* pExtension, const bool recurse, ModuleDefinition* pModuleDefinition )
{
// Debug Profiling.

View file

@ -73,15 +73,18 @@ class AssetManager : public SimObject, public ModuleCallbacks
{
private:
typedef SimObject Parent;
typedef StringTableEntry typeAssetId;
typedef StringTableEntry typeAssetName;
typedef StringTableEntry typeReferenceFilePath;
typedef HashMap<typeAssetId, AssetDefinition*> typeDeclaredAssetsHash;
typedef HashTable<typeAssetId, typeReferenceFilePath> typeReferencedAssetsHash;
typedef HashTable<typeAssetId, typeAssetId> typeAssetDependsOnHash;
typedef HashTable<typeAssetId, typeAssetId> typeAssetIsDependedOnHash;
typedef HashMap<AssetPtrBase*, AssetPtrCallback*> typeAssetPtrRefreshHash;
public:
typedef StringTableEntry typeAssetId;
typedef StringTableEntry typeAssetName;
typedef StringTableEntry typeReferenceFilePath;
typedef HashMap<typeAssetId, AssetDefinition*> typeDeclaredAssetsHash;
typedef HashTable<typeAssetId, typeReferenceFilePath> typeReferencedAssetsHash;
typedef HashTable<typeAssetId, typeAssetId> typeAssetDependsOnHash;
typedef HashTable<typeAssetId, typeAssetId> typeAssetIsDependedOnHash;
typedef HashMap<AssetPtrBase*, AssetPtrCallback*> typeAssetPtrRefreshHash;
private:
/// Declared assets.
typeDeclaredAssetsHash mDeclaredAssets;
@ -368,6 +371,8 @@ public:
S32 findTaggedAssets( AssetQuery* pAssetQuery, const char* pAssetTagNames, const bool assetQueryAsSource = false );
S32 findAssetLooseFile( AssetQuery* pAssetQuery, const char* pLooseFile, const bool assetQueryAsSource = false );
typeAssetDependsOnHash* getDependedOnAssets();
/// Declare Console Object.
DECLARE_CONOBJECT( AssetManager );