Gorilla.AssetsManager Unit Reference

Overview

The Gorilla.AssetsManager unit provides the asset management system for Gorilla3D. Assets (models, textures, audio, etc.) are organized in groups within ZIP-based packages. The system supports 10 built-in asset types, subgroups, JSON metadata, and caching for fast access.

Constants

Asset Type IDs

Constant Value Description
GORILLA_ASSETS_MODEL 0 3D models
GORILLA_ASSETS_TEXTURE 1 Textures/images
GORILLA_ASSETS_AUDIO 2 Audio files
GORILLA_ASSETS_VIDEO 3 Video files
GORILLA_ASSETS_MISC 4 Miscellaneous
GORILLA_ASSETS_DIALOGUE 5 Dialogue data
GORILLA_ASSETS_INVENTORY 6 Inventory data
GORILLA_ASSETS_SCRIPT 7 Script files
GORILLA_ASSETS_PREFAB 8 Prefab data
GORILLA_ASSETS_SKILLS 9 Skill system data

Package Version

GORILLA_PACKAGE_VERSION = '1.3' — Current package format version.

Enumerations

TGorillaLevelOfDetail

Value Description
LowQuality Low quality assets
MediumQuality Medium quality assets
HighQuality High quality assets
ExcellentQuality Excellent quality assets

Note: Currently reserved for future use.

TAssetImportFlag

Value Description
StrictFileName Match full filename (not just extension)
Cached Cache asset data in memory

TAssetState

Value Description
asUndef Undefined state
asLoading Currently loading
asLoaded Loaded successfully
asStoring Currently storing
asStored Stored successfully

Class Hierarchy

TPersistent
  └── TGorillaAsset
        ├── TGorillaTextureAsset
        ├── TGorillaModelAsset
        ├── TGorillaAudioAsset
        └── ... (other asset types)

TOwnedCollection
  └── TGorillaAssetsGroupCollection

TComponent
  └── TGorillaAssetsManager

TGorillaAsset

Base class for all assets.

Public Properties

Property Type Description
Group TGorillaAssetsGroup Parent asset group
Id TGorillaGUID Unique identifier
Filename String Original filename
Extension String File extension
Cached Boolean Whether data is buffered in memory
IsStandalone Boolean Asset without group reference
State TAssetState Current loading/storing state

Published Properties

Property Type Description
SubGroups TGorillaAssetsGroupCollection Nested asset groups (e.g., textures within a model)

Public Methods

Method Description
GetGroupId() Returns the group ID (abstract, per asset type)
GetGroupDescr() Returns the group description (abstract)
GetSupportedExtensions() Returns supported file extensions (abstract)
IsExtensionSupported(AExt) Check if extension is supported
GetSupportedAssetClass(AExt) Find asset class by extension
ImportFromFile(AGroup, AFilename, AFlags) Import asset from file into group
ImportFromStream(AGroup, AFilename, AStream, AFlags) Import asset from stream (abstract)
UpdateInArchive() Re-store asset in ZIP archive
GetSize() Returns asset size in bytes
ToJSON() Serialize to JSON
FromJSON(AValue) Deserialize from JSON
AddSubGroup(AClass) Add or get sub-group by asset class
RemoveSubGroup(AIdx/ADescr) Remove sub-group
GetSubGroup(AIdx/ADescr) Get sub-group
FindSubAsset(AFilename, AStrictFilename) Find asset in sub-groups
AddSubAssetFromFile(AFilename) Add or find asset from file

TGorillaTextureAsset

Stores texture/image data as TBitmap. Supports BMP, JPG, JPEG, DDS, GIF, PNG, TIF, TIFF, TGA.

Public Properties

Property Type Description
Bitmap TBitmap Buffered bitmap image
CachedBitmap TGorillaTextureBitmap Cached GPU texture bitmap
OriginalFilename String Original file path before import

TGorillaModelAsset

Stores 3D model data as TModelDef. Supports OBJ, G3D, DAE, FBX, GLTF, STL, X3D, Babylon, PLY, SKP, and more. Models are saved as G3D inside packages.

TGorillaAssetsManager

Main component for managing asset packages.

Key Methods

Method Description
AddPackage(AName) Create a new asset package
RemovePackage(AName) Remove a package
GetPackage(AName) Get package by name
LoadFromFile(AFilename) Load package from ZIP file
SaveToFile(AFilename) Save package to ZIP file

See Also