MaterialLibraryExtension

class omni.kit.material.library.MaterialLibraryExtension

Bases: IExt

Material extension class.

Methods

__init__(self)

get_subidentifier_from_material(prim, ...[, ...])

get sub-identifier list from material prim asynchronously.

get_subidentifier_from_mdl(mdl_file[, ...])

get sub-identifier list from mdl file asynchronously.

on_shutdown()

Shutdown function

on_startup(ext_id)

Startup function

remove_mdl_from_cache(shader_prim_path)

Remove material from cache.

__init__(self: omni.ext._extensions.IExt) None
class SubIDEntry(name: str, annotations: dict, is_material: bool)

Bases: object

SubIDEntry is helper class to assist with neuraylib data and name string.

replace(oldvalue, newvalue)

String replace on material name.

Parameters
  • oldvalue (str) – The string to search for.

  • newvalue (str) – The string to replace the `oldvalue` with.

Returns

new string.

Return type

(str)

async get_subidentifier_from_material(prim, on_complete_fn: callable, use_functions: bool = False, show_alert: bool = False)

get sub-identifier list from material prim asynchronously.

Parameters
  • prim (Usd.Prim) – prim to get material & material sub-identifiers from.

  • on_complete_fn (callable) – function to call with list of sub-identifier when completed.

  • use_functions (bool) – if True only list materials and not functions otherwise return all sub-identifiers.

  • show_alert (bool) – show alert if bad material.

Returns

list of sub-identifier

Return type

(list)

async get_subidentifier_from_mdl(mdl_file: str, on_complete_fn: Optional[callable] = None, use_functions: bool = False, show_alert: bool = False)

get sub-identifier list from mdl file asynchronously.

Parameters
  • mdl_file (str) – mdl_file to get material sub-identifiers from.

  • on_complete_fn (callable) – function to call with list of sub-identifier when completed.

  • use_functions (bool) – if True only list materials and not functions otherwise return all sub-identifiers.

  • show_alert (bool) – show alert if bad material.

Returns

list of sub-identifier

Return type

(list)

on_shutdown()

Shutdown function

on_startup(ext_id)

Startup function

Parameters

ext_id (str) – Extension id.

remove_mdl_from_cache(shader_prim_path: str)

Remove material from cache. Call by Material Watcher when re-loading modified mdl files.

Parameters

shader_prim_path (str) – material prim path to remove from cache.