The ‘glasses’ asset catalog#
!pip install datagen-tech -q
Accessing the catalog#
- class datagen.api.catalog.glasses#
The “glasses” object gives you access to the catalog of glasses assets. The Assets provided by this catalog are of type datagen.api.assets.Glasses
.
You can query the glasses catalog using these functions:
- datagen.api.catalog.glasses.get(self, id: str = None, limit: int = None, **attributes) Union[Asset, List[Asset]]: #
Gets glasses 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 glasses asset in the list).
attributes (Any) – Optional. A dictionary of attributes that you can use to filter the catalog. For details see Glasses 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 full set of glasses assets:
from datagen.api import catalog catalog.glasses.get()
<AssetInstancesList(9)>
Getting a specific glasses asset by id:
from datagen.api import catalog catalog.glasses.get(id="3d81b060-ace3-48d5-b17d-6446335043af")
Glasses(
id=’3d81b060-ace3-48d5-b17d-6446335043af’,
frame_color=FrameColor.BLACK,
frame_metalness=0.0,
lens_color=LensColor.BLACK,
lens_reflectivity=0.0,
lens_transparency=0.0,
position=GlassesPosition.ON_NOSE,
attributes=GlassesAttributes(
supported_position=[AccessoryPosition.ON_NOSE],
gender=[Gender.MALE, Gender.FEMALE],
style=GlassesStyle.OVAL
)
)
Using the limit parameter to cap the number of glasses assets:
from datagen.api import catalog catalog.glasses.get(limit=4)
<AssetInstancesList(4)>
Using the limit parameter to get a single glasses asset:
from datagen.api import catalog catalog.glasses.get(limit=1)
Glasses(
id=’03e5ffc9-7670-46d9-a27f-c06a4c821b3a’,
frame_color=FrameColor.BLACK,
frame_metalness=0.0,
lens_color=LensColor.BLACK,
lens_reflectivity=0.0,
lens_transparency=0.0,
position=GlassesPosition.ON_NOSE,
attributes=GlassesAttributes(
supported_position=[AccessoryPosition.ON_NOSE],
gender=[Gender.MALE, Gender.FEMALE],
style=GlassesStyle.READING_FULL_FRAME
)
)
Using attributes to filter the catalog:
from datagen.api import catalog from datagen.api.catalog import attributes catalog.glasses.get(style=attributes.GlassesStyle.AVIATOR)
<AssetInstancesList(10)>
- datagen.api.catalog.glasses.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 Glasses attributes below.
- Returns:
The number of assets in the catalog matching your query.
- Return type:
int
Sample usage
Counting the full set of glasses assets:
from datagen.api import catalog catalog.glasses.count()
9
Using attributes to filter the catalog:
from datagen.api import catalog from datagen.api.catalog import attributes catalog.glasses.count(style=attributes.GlassesStyle.ROUND)
1
Glasses attributes#
- class datagen.api.catalog.attributes.GlassesAttributes
Each glasses asset contains the following read-only attributes.
When you call the
datagen.api.catalog.glasses.get()
ordatagen.api.catalog.glasses.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 pair of glasses. Uses the
GlassesStyle
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.glasses.get(gender=attributes.Gender.MALE, style=attributes.GlassesStyle.AVIATOR, supported_position=attributes.AccessoryPosition.ON_NOSE)<AssetInstancesList(1)>
Here is the complete list of valid values for these attributes:
- class datagen.api.catalog.attributes.GlassesStyle
The list of valid glasses styles.
This enum is valid for use in the following attributes:
Values:
- AVIATOR = 'aviator'
- BROWLINE = 'browline'
- CAT_EYE = 'cat_eye'
- GEOMETRIC = 'geometric'
- OVAL = 'oval'
- OVERSIZED = 'oversized'
- READING_FULL_FRAME = 'reading_full_frame'
- READING_RIMLESS = 'reading_rimless'
- ROUND = 'round'
- class datagen.api.catalog.attributes.Gender
The list of available genders.
This enum is valid for use in the following attributes:
Values:
- FEMALE = 'female'
- MALE = 'male'
- class datagen.api.catalog.attributes.AccessoryPosition
The list of available positions where an accessory can be worn.
This enum is valid for use in the following attributes:
Values:
- ON_CHIN = 'chin'
- ON_MOUTH = 'mouth'
- ON_NOSE = 'nose'
Properties of glasses objects#
These are the editable properties of glasses objects:
id
string
The
id
property defines the specific pair of glasses that the actor should wear, chosen from Datagen’s asset library. This property defines the shape of the glasses - not its color, reflectivity, or other attributes.
![]()
id
=
"484f76b7-9ca0-476f-9c03-578b3ba0ecb6"
#![]()
id
=
"518467ba-b067-4aae-ad73-107acd0c3583"
#![]()
id
=
"aefa9fa1-01be-48fd-b6ac-00f4649efd5d"
#![]()
id
=
"3d81b060-ace3-48d5-b17d-6446335043af"
#![]()
id
=
"a1a2faf7-b1c7-4d92-82a2-a6bccc074ffd"
#![]()
id
=
"bfbc06fe-f72e-44ed-8ed4-3f715d849aff"
#Tip
To download a CSV with a complete list of UUIDs that identify individual glasses shapes, click here
frame_color
Enum
The
frame_color
property defines the base color of the frame of the actor’s glasses. This color will be further affected by the value of the frame_metalness property property.Valid values are as follows:
![]()
frame_color=assets.FrameColor.BLACK
#![]()
frame_color=assets.FrameColor.BLUE
#![]()
frame_color=assets.FrameColor.GOLD
#![]()
frame_color=assets.FrameColor.GRAY
#![]()
frame_color=assets.FrameColor.GREEN
#![]()
frame_color=assets.FrameColor.RED
#![]()
frame_color=assets.FrameColor.SILVER
#![]()
frame_color=assets.FrameColor.WHITE
#This code takes a glasses asset from the catalog and changes the default frame color:
from datagen.api import catalog from datagen.api import assets glasses=catalog.glasses.get(limit=1) glasses.frame_color=assets.FrameColor.GOLD
lens_color
Enum
The
lens_color
property determines the base color of the lenses of the actor’s glasses. This base color will be further affected by the values of the lens transparency and reflectivity properties.Valid values are:
![]()
lens_color=assets.LensColor.BLACK
#![]()
lens_color=assets.LensColor.BLUE
#![]()
lens_color=assets.LensColor.GREEN
#![]()
lens_color=assets.LensColor.RED
#![]()
lens_color=assets.LensColor.YELLOW
#This code takes a glasses asset from the catalog and changes the default lens color:
from datagen.api import catalog from datagen.api import assets glasses=catalog.glasses.get(limit=1) glasses.lens_color=assets.LensColor.RED
lens_reflectivity and lens_transparency
64-bit floats
The
lens_reflectivity
andlens_transparency
properties define how light behaves as it hits the glasses lens.
lens_reflectivity
defines how much light is reflected off of the lens. The higher the reflectivity, the more you will see the actor’s surroundings in the glasses lens.lens_reflectivity
accepts floating-point values from 0 to 1.
lens_transparency
defines how much light is able to pass directly through the lens. The higher the transparency, the more you can see of the actor’s eyes.lens_transparency
accepts floating-point values from 0 to 1.This code takes a glasses asset from the catalog and changes the default lens reflectivity and transparency:
from datagen.api import catalog from datagen.api import assets glasses=catalog.glasses.get(limit=1) glasses.lens_reflectivity=0.9 glasses.lens_transparency=0.6
position
Enum
The
position
property defines where the actor is wearing his or her glasses. Currently we support glasses being worn only in the default position, on the nose.This code takes a glasses asset from the catalog and resets the default position:
from datagen.api import catalog from datagen.api import assets glasses=catalog.glasses.get(limit=1) glasses.position=assets.GlassesPosition.ON_NOSE