package asset_info
Constants
InfoExtension
".adi"
ProjectCache
".cache"
Variables
ImageMetaOptions
map[string]any{
ErrNoInfo
errors.New("asset database does not have info for this file")
Functions
Exists
Exists checks to see if a given path has a generated ADI file. The file it searches for will be path/to/file.ext.adi
ID
ID returns the ID of the asset within it's ADI file, if the ADI file is not found, the read error is returned
InitForCurrentProject
Move
RegisterMetadataStructure
Write
Types
AssetDatabaseInfo
struct
type AssetDatabaseInfo struct {
ID string
Path string
Type string
ParentID string
Tags []string
Children []AssetDatabaseInfo
Metadata AssetMetadata
}
Lookup
Lookup will find any asset given it's id (path). This has no information for importers, so it will populate the metadata with a non-castable interface
New
Read
Read will read the ADI file for the given path and return the AssetDatabaseInfo struct. Possible errors are:
- ErrNoInfo: if the file does not exist
- json.Unmarshal error: if the file is corrupted
- filesystem.ReadTextFile error: if the file cannot be read
AssetDatabaseInfo.MetadataStructure
AssetDatabaseInfo.SpawnChild
AssetMetadata
struct
type AssetMetadata struct {
HTML HtmlMetadata
Image ImageMetadata
Material MaterialMetadata
Mesh MeshMetadata
RenderPass RenderPassMetadata
Shader ShaderMetadata
ShaderPipeline ShaderPipelineMetadata
Stage StageMetadata
}
Rather than using interfaces, doing casting, and all that nonsense, we're just going to have a flat structure for asset metadata that is easy to access, easy to fill out, and easy to write. Since this is offline from the game, there is no need to try and abstract this out.
HtmlMetadata
struct
ImageMetadata
struct
type ImageMetadata struct {
Filter string `options:"imageFilterOptions"`
Pivot string `options:"imagePivot"`
PixelsPerUnit int32
Mipmaps int32
// TODO: This needs to be used for packaging the content
MaxSize string `options:"imageMaxSize"`
}
NewDefaultImageMetadata
ImageMetadata.ImageFilterMeta
ImageMetadata.ImagePivotMeta
ImageMetadata.MaxSizeMeta
MaterialMetadata
struct
MeshMetadata
struct
RenderPassMetadata
struct
ShaderMetadata
struct
ShaderPipelineMetadata
struct
StageMetadata
struct