AssetFactory

class omni.simready.explorer.AssetFactory

Bases: object

A factory of SimReady asset objects.

Allows to register asset classes and create instances of them.

Note

Currently only one asset class can be registered per asset type. The last registered asset class of a given type will be used.

Asset classes created and registered by 3rd party developers are not fully supported yet.

Methods

create_asset(raw_asset_data)

Creates an asset based on a dictionary of data with content specific to the asset type.

dump_asset_types()

Prints the list of registered asset types

num_asset_types()

Returns the number of registered asset types

register(asset_type)

Decorator.

Attributes

registry

The registry of asset types.

__init__()
classmethod create_asset(raw_asset_data: Dict) Optional[omni.simready.explorer.asset.SimreadyAsset]

Creates an asset based on a dictionary of data with content specific to the asset type.

classmethod dump_asset_types()

Prints the list of registered asset types

classmethod num_asset_types() int

Returns the number of registered asset types

classmethod register(asset_type: omni.simready.explorer.asset.AssetType) Callable

Decorator. Registers a new asset class as asset_type with the AssetFactory.

Example

Register MyAsset as AssetTypePROP with the AssetFactory

@AssetFactory.register(AssetType.PROP)
class MyMyAsset(BaseAsset):
    pass
registry: Dict[omni.simready.explorer.asset.AssetType, omni.simready.explorer.asset.SimreadyAsset] = {AssetType.PROP: <class 'omni.simready.explorer.asset.PropAsset'>}

The registry of asset types. Maps asset types to asset classes.