The ‘masks’ asset catalog#
!pip install datagen-tech -q
Accessing the catalog#
- class datagen.api.catalog.masks#
The “masks” object gives you access to the catalog of mask assets. The Assets provided by this catalog are of type datagen.api.assets.Mask
.
Currently only one mask asset is available.
You can query the masks catalog using these functions:
- datagen.api.catalog.masks.get(self, id: str = None, limit: int = None, **attributes) Union[Asset, List[Asset]]: #
Gets mask assets from the asset catalog.
- 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 mask asset in the list).
attributes (Any) – Optional. A dictionary of attributes that you can use to filter the catalog. For details see Mask attributes below.
- 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
Sample usage
Getting the mask asset in a list:
from datagen.api import catalog catalog.masks.get()
<AssetInstancesList(1)>
Getting the mask asset individually:
from datagen.api import catalog catalog.masks.get(id="7e701bf2-91ef-4729-91f7-cb039e49b085")
Mask(
id=’7e701bf2-91ef-4729-91f7-cb039e49b085’,
color=MaskColor.BLUE,
texture=MaskTexture.CLOTH,
roughness=0.5,
position=MaskPosition.ON_NOSE,
attributes=MaskAttributes(
supported_position=[
AccessoryPosition.ON_MOUTH,
AccessoryPosition.ON_NOSE,
AccessoryPosition.ON_CHIN
],
gender=[Gender.MALE, Gender.FEMALE],
style=MaskStyle.CLOTH
)
)
- datagen.api.catalog.masks.count(self, **attributes) int: #
Queries the catalog for the number of assets matching a certain request
- Parameters:
attributes (Any) – Optional. A dictionary of attributes that you can use to filter the catalog. For details see Mask attributes below.
- Returns:
The number of assets in the catalog matching your query.
- Return type:
int
Sample usage
Counting the full set of masks assets:
from datagen.api import catalog catalog.masks.count()
1
Mask attributes#
- class datagen.api.catalog.attributes.MaskAttributes
Each mask asset contains the following read-only attributes.
When you call the
datagen.api.catalog.masks.get()
ordatagen.api.catalog.masks.count()
functions, you can use this attribute to filter the catalog.- gender: List[Enum]
Matches the requested accessory(s) with a desired gender. Uses the
Gender
enum.An accessory may match with either or both genders.
NOTE: Gender matches are recommendations only and are not mandatory.
- style: Enum
The general shape and style of the mask. Uses the
MaskStyle
enum.
- supported_position: List[Enum]
The list of positions on the body where this accessory can be worn. Uses the
AccessoryPosition
enum.
Sample usage:
from datagen.api import catalog from datagen.api.catalog import attributes catalog.masks.get(style=attributes.MaskStyle.CLOTH)<AssetInstancesList(1)>
Properties of masks objects#
These are the editable properties of mask objects:
id
string
The
id
property defines the specific mask that the actor will wear. This property defines the shape and style of the mask - not its color, reflectivity, or other attributes.Currently, Datagen offers only one type of mask, with the UUID
7e701bf2-91ef-4729-91f7-cb039e49b085
.
color
Enum
The
color
property defines the base color of the mask. This color will be further influenced by the roughness and texture properties.
![]()
mask_color=assets.MaskColor.BLACK
#![]()
mask_color=assets.MaskColor.BLUE
#![]()
mask_color=assets.MaskColor.GREEN
#![]()
mask_color=assets.MaskColor.RED
#![]()
mask_color=assets.MaskColor.YELLOW
#This code takes a mask asset from the catalog and changes the default color:
from datagen.api import catalog from datagen.api import assets mask=catalog.masks.get(limit=1) mask.color=assets.MaskColor.BLUE
roughness
64-bit float
The
roughness
property defines the reflectivity of the mask: whether or not light is reflected before it is absorbed by the mask. The higher the reflectivity, the more shiny the mask surface; at lower levels of reflectivity, the mask has a duller surface more appropriate to cloth-like materials.This code takes a mask asset from the catalog and changes the default roughness:
from datagen.api import catalog from datagen.api import assets mask=catalog.masks.get(limit=1) mask.roughness=0.7
texture
Enum
The
texture
property defines the pattern of the fabric in the mask that the actor is wearing. Valid values arecloth
,diamond_pattern
, andwoven
.This code takes a mask asset from the catalog and changes the default texture:
from datagen.api import catalog from datagen.api import assets mask=catalog.masks.get(limit=1) mask.texture=assets.MaskTexture.DIAMOND_PATTERN
position
Enum
The
position
property defines where the actor will wear his or her mask.This code takes a masks asset from the catalog and changes the default position:
from datagen.api import catalog from datagen.api import assets masks=catalog.masks.get(limit=1) masks.position=assets.MaskPosition.ON_CHIN