api.catalog#
- class datagen.api.catalog.impl.AssetCatalog(asset_type: Type[Asset], asset_attributes_type: Type[AssetAttributes], asset_id_to_asset_attrs: dict, hooks: List[AssetCreationHook[Asset]] = [])#
Do not access this class directly!
Access this class only through one of the instances listed in
DatagenAssetsCatalog.__init__()
.- count(**attributes) int #
Queries the catalog for the number of assets matching a certain request.
The category of assets that are counted is determined by the catalog you are accessing, which is determined by the AssetCatalog instance that you used when accessing this function. For example:
datagen.api.catalog.humans.count()
counts assets from the humans catalog.datagen.api.catalog.hair.count()
counts assets from the hair catalog.datagen.api.catalog.eyebrows.count()
counts assets from the eyebrows catalog.
For the list of available asset catalogs, see
DatagenAssetsCatalog.__init__()
.- Parameters:
attributes (Any) – Optional. A dictionary of attributes that you can use to filter the catalog.
- Returns:
The number of assets in the catalog matching your query.
- Return type:
int
- get(id: Optional[str] = None, limit: Optional[int] = None, **attributes) Union[Asset, List[Asset], Dict[str, AssetAttributes], AssetAttributes] #
Gets assets from the asset catalog.
The type of Asset object you get is determined by the instance of AssetCatalog that you used when accessing this function. For example:
datagen.api.catalog.humans.get()
gets assets from the humans catalog, in objects of typedatagen.api.assets.Human
.datagen.api.catalog.hair.get()
gets assets from the hair catalog, in objects of typedatagen.api.assets.Hair
.datagen.api.catalog.eyebrows.get()
gets assets from the eyebrows catalog, also in objects of typedatagen.api.assets.Hair
.
For a reference table of available asset catalogs and their relevant types, see
DatagenAssetsCatalog.__init__
.- Parameters:
id (str) – Optional. Returns a single Asset matching the chosen UUID.
limit (int) –
Optional. Caps the number of Assets that will be included in the response.
If limit=1, returns a single Asset object.
If limit>1, returns an object of type List[Asset] (even if there is only one matching asset in the list).
attributes (Any) – Optional. A dictionary of attributes that you can use to filter the catalog.
- Returns:
The asset or assets that match your search query
- Return type:
List[Asset] in the form of a lazy list
Asset when limit=1 or when an id is provided
The list of asset catalogs#
- datagen.api.catalog.impl.DatagenAssetsCatalog.__init__()#
This function is run automatically on import and defines the list of catalog types that you can use in conjunction with the
datagen.api.catalog.impl.AssetCatalog.get()
anddatagen.api.catalog.impl.AssetCatalog.count()
functions.- Parameters:
humans – The
datagen.api.catalog.humans
catalog, which contains objects of typedatagen.api.assets.Human
.hair – The
datagen.api.catalog.hair
catalog, which contains objects of typedatagen.api.assets.Hair
.eyes – The
datagen.api.catalog.eyes
catalog, which contains objects of typedatagen.api.assets.Eyes
.eyebrows – The
datagen.api.catalog.eyebrows
catalog, which contains objects of typedatagen.api.assets.Hair
.beards – The
datagen.api.catalog.beards
catalog, which contains objects of typedatagen.api.assets.Hair
.glasses – The
datagen.api.catalog.glasses
catalog, which contains objects of typedatagen.api.assets.Glasses
.masks – The
datagen.api.catalog.masks
catalog, which contains objects of typedatagen.api.assets.Mask
.backgrounds – The
datagen.api.catalog.backgrounds
catalog, which contains objects of typedatagen.api.assets.Background
.