RegisterExtensionContent
- omni.mdl.neuraylib.scripts.RegisterExtensionContent(extensionName: str, contentPath: str) list[str]
Register a folder of your extension data in the root of the MDL extension search path.
Since content is registered in a search path root you need to be cautious to not conflict with other content. The MDL module space is similar to package names in Python and Java. Module paths have to be unique. If not, the module from the higher priority search path will be used.
The MDL search path system adds some save guards for extension content. For instance you can’t override `nvidia/core_definitions.mdl` or other modules that required by the renderer because they life in a higher priority search path. The conflicting extension content will not be accessible.
This kind of save does not prevent collisions between content of different extensions. Therefore you are urged to follow some basic guideline when authoring your MDL content:
Put your content into packages! A common pattern is to put the company in front, followed by a project or product name. The content of the `contentPath` folder could look like this:
>>> nvidia/ProjectABC/main.mdl >>> nvidia/ProjectABC/sub1/A.mdl
Then, the paths above, can be used as USD source asset paths for USD Shader nodes in the ‘mdl’ context. When addressing these Modules from other MDL content, you can import them like this:
>>> import ::nvidia::ProjectABC::main::*; >>> import ::nvidia::ProjectABC::sub1::A::*;
For more information please refer the MDL specification or reach out to the MDL team.
- Parameters
extensionName – The name of your extension, e.g., ``omni.foo.bar``. This allows to improve the messaging about conflict cases.
contentPath – The absolute path of the content you want to register. If the path points to a folder, the entire content of the folder is registered while the folder itself is not represented as package.
- Returns
A list of the absolute path links created or an empty list in case of failure. Keep this list to unregister content on shutdown of your extension.