The ‘masks’ asset catalog#
You can access the catalog of mask assets using the datagen.api.catalog.masks
class. It contains two important functions:
!pip install datagen-tech -q
get()#
The datagen.api.catalog.masks.get()
function gets one or more mask assets from the asset catalog. These assets come in the form of objects of the datagen.api.assets.Mask
class.
Currently only one mask asset is available.
To get the mask asset inside a list:
from datagen.api import catalog
catalog.masks.get()
<AssetInstancesList(1)>
To get the mask asset directly:
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
)
)
count()#
The datagen.api.catalog.masks.count()
function tells you how many mask assets match your query.
To count the full set of human 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#
When you get a mask object from the catalog, you can edit that mask object in certain ways. 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