Open 3D Engine GraphCanvas Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
GraphCanvas::TranslationAssetHandler Class Reference

#include <TranslationAsset.h>

Inherits AZ::Data::AssetHandler, and AZ::AssetTypeInfoBus::MultiHandler.

Public Member Functions

 AZ_CLASS_ALLOCATOR (TranslationAssetHandler, AZ::SystemAllocator)
 
 AZ_RTTI (TranslationAssetHandler, "{C161AB3B-86F6-4CB1-9DAE-83F2DE084CF4}", AZ::Data::AssetHandler)
 
AZ::Data::AssetPtr CreateAsset (const AZ::Data::AssetId &id, const AZ::Data::AssetType &type) override
 
AZ::Data::AssetHandler::LoadResult LoadAssetData (const AZ::Data::Asset< AZ::Data::AssetData > &asset, AZStd::shared_ptr< AZ::Data::AssetDataStream > stream, const AZ::Data::AssetFilterCB &assetLoadFilterCB) override
 
void DestroyAsset (AZ::Data::AssetPtr ptr) override
 
void GetHandledAssetTypes (AZStd::vector< AZ::Data::AssetType > &assetTypes) override
 
bool CanHandleAsset (const AZ::Data::AssetId &id) const override
 
AZ::Data::AssetType GetAssetType () const override
 
const char * GetAssetTypeDisplayName () const override
 
const char * GetGroup () const override
 
const char * GetBrowserIcon () const override
 
AZ::Uuid GetComponentTypeId () const override
 
void GetAssetTypeExtensions (AZStd::vector< AZStd::string > &extensions) override
 
void Register ()
 
void Unregister ()
 

Detailed Description

TranslationAssetHandler will process JSON based files that provide a mapping from string, string the key will be generated using the JSON file structure, but does have some requirements.

Requirements:

  • Must have a top level array called "entries"
  • Must provide a "base" element for any entry added

Example:

{ "entries": [ { "base": "Globals", "details": { "name": "My Name", "tooltip": "My Tooltip" } ] }

The example JSON will produce the following database:

[Globals.details.name, "My Name"] [Globals.details.tooltip", "My Tooltip"] Arrays Arrays are supported and will contain an index value encoded into the key, for an array called "somearray" these may look like this: "somearray": [ { "name": "First one" }, { "name": "Second one" } ] Globals.details.somearray.0.name Globals.details.somearray.1.name There is one important aspect however, if an element in an array has a "base" value, the value of this key will replace the index. This is useful when the index and/or ordering of an entry is not relevant or may change. "somearray": [ { "name": "First one" "base": "a_key" }, { "name": "Second one", "base": "b_key" } ] Globals.details.somearray.0.base == "a_key" Globals.details.somearray.0.name == "First one" Globals.details.somearray.1.base == "b_key" Globals.details.somearray.1.name == "Second one"


The documentation for this class was generated from the following file: