NeurayLib

class omni.mdl.neuraylib.NeurayLib

Bases: pybind11_object

Access to the MDL Material back-end in Omniverse.

Methods

ResolveTiledResourceUri(self, arg0)

Collect the matching file URIs for a given resolved URI that contains a mask.

__init__(*args, **kwargs)

createEditingTransaction(self[, dbScopeName])

Creates a write access transaction for a given database scope with short term usage in mind.

createMdlEntity(self, uniquePrimPath[, ...])

Creates an MdlEnity for a selected scope.

createMdlEntitySnapshot(self, arg0)

Creates an MDL material instance or function call in the neuray DB scope provided.

createMdlModule(self, usdIdentifier[, ...])

Loads an MDL module and stores the loaded definitions in the neuray DB scope provided.

createMdlModuleFromDbName(self, usdIdentifier)

Get a loaded module and increase its ref count.

createReadingTransaction(self[, dbScopeName])

Creates a read-only transaction for a given database scope with short term usage in mind.

createScope(self, arg0)

Create a database scope with a given alphanumeric name if not yet existing.

destroyMdlEntity(self, arg0)

Releases a previously created entity.

destroyMdlEntitySnapshot(self, arg0)

Releases a previously created entity snapshot.

destroyMdlModule(self, arg0)

Releases a previously loaded module.

destroyScope(self, arg0)

Removes a database scope with a given alphanumeric name and all of its child scopes if existing.

getCurrentDefaultScope(self)

Returns the current default database scope name depending on the active renderer.

getNeurayAPI(self)

Returns a handle to the neuray API.

setScopeOption(self, arg0, arg1, arg2)

Configures the loading on a per scope base.

__init__(*args, **kwargs)
ResolveTiledResourceUri(self: omni.mdl.neuraylib._neuraylib.NeurayLib, arg0: str) List[str]

Collect the matching file URIs for a given resolved URI that contains a mask.

Parameters

resolvedFileNameMask – A resolved URI that contains the a tiling marker like ``%3CUDIM%3E`` which is the uri encoding for ``<UDIM>``.

createEditingTransaction(self: omni.mdl.neuraylib._neuraylib.NeurayLib, dbScopeName: str = '') int

Creates a write access transaction for a given database scope with short term usage in mind.

This transaction should be used for write access e.g. for editing a material instance code. Use the transaction on a per task level and from one thread only. When done, call `commit` in case you made changes or `abort` in case you only read information. However, keep in mind that the this new transaction can only see DB state that was already committed. The function returns a handle hat has to be attached to the MDL SDK API using `omni.mdl.pymdlsdk.attach_itransaction`.

Parameters

dbScopeName (optional) – Name of the DB scope to edit.

Returns

The created transaction or `None` if the creation failed, e.g. because of an invalid scope.

createMdlEntity(self: omni.mdl.neuraylib._neuraylib.NeurayLib, uniquePrimPath: str, dbScopeName: str = '') omni.mdl.neuraylib._neuraylib.MdlEntity

Creates an MdlEnity for a selected scope. It maps an MDL representation to a particular USD shade graph node.

If there already is an MdlEntity the same object is returned again with an increased reference count. This allows multiple components to access the same data based on the USD Prim Path.

Parameters
  • uniquePrimPath – USD path of the shade node this entity will belong to. Allows to identify the node from different kit components.

  • scopeName (optional) – Name of the DB scope to later store snapshots in (default: ‘’).

Returns

The handle that represents the shade USD graph node. Needs to be released using `destroyMdlEntity` when not required anymore.

createMdlEntitySnapshot(self: omni.mdl.neuraylib._neuraylib.NeurayLib, arg0: omni.mdl.neuraylib._neuraylib.MdlEntity) omni.mdl.neuraylib._neuraylib.MdlEntitySnapshot

Creates an MDL material instance or function call in the neuray DB scope provided.

This snapshot is used for editing and creating material representations specific to the renderer. If there already is a valid snapshot for this MdlEntity and if the selected function name did not change, the same snapshot is returned again with an increased reference count.

Parameters

mdlEntity – An MdlEntityId with a valid function name set (currently only from C++).

Returns

A snapshot that represents a MDL material instance or function call present in the neuray database. Needs to be released using `destroyMdlEntity` when not required anymore.

createMdlModule(self: omni.mdl.neuraylib._neuraylib.NeurayLib, usdIdentifier: str, dbScopeName: str = '') omni.mdl.neuraylib._neuraylib.MdlModule

Loads an MDL module and stores the loaded definitions in the neuray DB scope provided.

Parameters
  • usdIdentifier – The USD asset identifier of the module to load.

  • scopeName (optional) – Name of the DB scope to load the definitions to (default: ‘’).

Returns

The handle that contains the database name of the created module. Needs to be released using `destroyMdlModule` when not required anymore.

createMdlModuleFromDbName(self: omni.mdl.neuraylib._neuraylib.NeurayLib, usdIdentifier: str, dbScopeName: str = '') omni.mdl.neuraylib._neuraylib.MdlModule

Get a loaded module and increase its ref count.

Parameters
  • scopeName (optional) – Name of the DB scope to load the definitions to (default: ‘’).

  • moduleDbName – The DB name of the module.

Returns

The handle that contains the database name of the created module. Needs to be released using `destroyMdlModule` when not required anymore.

createReadingTransaction(self: omni.mdl.neuraylib._neuraylib.NeurayLib, dbScopeName: str = '') int

Creates a read-only transaction for a given database scope with short term usage in mind.

This transaction can only be used for read access e.g. for generating shader code. Use the transaction on a per task level and from one thread only. This transaction can not be committed as it is not allowed to make changes to the database. However, keep in mind that the this new transaction can only see DB state that was already committed. The function returns a handle hat has to be attached to the MDL SDK API using `omni.mdl.pymdlsdk.attach_itransaction`.

Parameters

dbScopeName (optional) – Name of the DB scope to read from.

Returns

The created transaction handle or `None` if the creation failed, e.g. because of an invalid scope.

createScope(self: omni.mdl.neuraylib._neuraylib.NeurayLib, arg0: str) bool

Create a database scope with a given alphanumeric name if not yet existing.

Scopes are hierarchical and this hierarchy is mapped to scope names by using dots. The global scope with the empty name is reserved. Parent scopes have to exist before creating child scopes.

Parameters

scopeName (str) – Name of the DB scope to create.

Returns

True if the scope was created, False if the scope existed before or the name referenced a none existing parent scope.

destroyMdlEntity(self: omni.mdl.neuraylib._neuraylib.NeurayLib, arg0: omni.mdl.neuraylib._neuraylib.MdlEntity) None

Releases a previously created entity.

Parameters

mdlEntity – An MdlEntity that was created using`createMdlEntity`.

destroyMdlEntitySnapshot(self: omni.mdl.neuraylib._neuraylib.NeurayLib, arg0: omni.mdl.neuraylib._neuraylib.MdlEntitySnapshot) None

Releases a previously created entity snapshot.

Parameters

mdlEntitySnapshot – An MdlEntitySnapshot that was created using`createMdlEntitySnapshot`.

destroyMdlModule(self: omni.mdl.neuraylib._neuraylib.NeurayLib, arg0: omni.mdl.neuraylib._neuraylib.MdlModule) None

Releases a previously loaded module.

Parameters

mdlModule – A module that was created using`createMdlModule`.

destroyScope(self: omni.mdl.neuraylib._neuraylib.NeurayLib, arg0: str) bool

Removes a database scope with a given alphanumeric name and all of its child scopes if existing.

Parameters

scopeName (str) – Name of the DB scope to remove.

Returns

True if the scopes were removed, False if the scope does not existed.

getCurrentDefaultScope(self: omni.mdl.neuraylib._neuraylib.NeurayLib) str

Returns the current default database scope name depending on the active renderer.

If there is no active scene renderer with a corresponding, properly initialized scope, the ‘default_scope’ with default settings is returned.

getNeurayAPI(self: omni.mdl.neuraylib._neuraylib.NeurayLib) int

Returns a handle to the neuray API.

This handle has to be attached to the MDL SDK Python binding using `omni.mdl.pymdlsdk.attach_ineuray`.

setScopeOption(self: omni.mdl.neuraylib._neuraylib.NeurayLib, arg0: str, arg1: str, arg2: str) bool

Configures the loading on a per scope base.

Parameters
  • scopeName (str) – Name of the DB scope to set the option.

  • option (str) – Name of the option to set.

  • value (str) – The value of the option to set, “on” or “off” for booleans.

Returns

True in case of success, false if the scope does not exist or the provided option/value is invalid.