Creating a Custom USD Schema and Extension

Hello,

I’m trying to define a custom USD Schema for use in Omniverse apps.

#usda 1.0
(
    subLayers = [
        @usd/schema.usda@
    ]
)

over "GLOBAL" (
    customData = {
        string libraryName   = "customTestSchema"
        string libraryPath   = "./"
        string libraryPrefix = "CTS"
        bool skipCodeGeneration = false
    }
)
{
}

class CustomTestPrim "CustomTestPrim" (
    inherits = </Typed>
    doc = """Custom Test Schema"""
)
{
    # test property as a string
    string custom:schema:test:testString = "default" (
        doc = """This is a test string property"""
        displayGroup = "Advanced"
        displayName = "Test String"
    )

    # test property as an int
    int custom:schema:test:testInt = 123 (
        doc = """This is a test int property"""
        displayGroup = "Advanced"
        displayName = "Test Int"
    )

    # test property as a float
    float custom:schema:test:testFloat = 12.3 (
        doc = """This is a test float property"""
        displayGroup = "Advanced"
        displayName = "Test Float"
    )
}

I’ve used the following sample repo/extension as reference:

When enabling the schema extension (or set to autoload), Omniverse Code 2022.3.3 throws an error that “extension class wrapper for base class pxrInternal_v0_23__pxrReserved__::UsdTyped has not been created yet”

2024-01-31 22:03:39  [Error] [omni.ext._impl._internal]   File "/home/username/Documents/Kit/shared/exts/custom.test.schema/custom/test/schema/__init__.py", line 10, in <module>
2024-01-31 22:03:39  [Error] [omni.ext._impl._internal]     from . import _customTestSchema
2024-01-31 22:03:39  [Error] [omni.ext._impl._internal] RuntimeError: extension class wrapper for base class pxrInternal_v0_23__pxrReserved__::UsdTyped has not been created yet

I’ve included a full tar/gz of the sample schema/extension (see bottom of post). The schema is built with the build.sh script and then moved from _install folder to respective extension locations. e.g. :

./exts/custom.test.schema/custom/test/schema:
__init__.py
_customTestSchema.so

./exts/custom.test.schema/include:
api.h
customTestPrim.h
tokens.h

./exts/custom.test.schema/lib:
ibcustomTestSchema.so

./exts/custom.test.schema/resources:
generatedSchema.usda
plugInfo.json
schema.usda

I’ve also built against OpenUSD’s libraries to roughly the same result:

2024-01-31 02:55:10 [34,907ms] [Error] [omni.ext._impl.custom_importer] Failed to import python module custom.test.schema. Error: /home/username/Documents/Kit/shared/exts/custom.test.schema/custom/test/schema/_customTestSchema.so: undefined symbol: _ZTIN32pxrInternal_v0_23__pxrReserved__8UsdTypedE. Traceback:

Platform:

  • Ubuntu LTS 22.04
  • Linux Computer 6.5.0-15-generic #15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
  • NVIDIA-SMI 535.154.05 Driver Version: 535.154.05 CUDA Version: 12.2
  • Omniverse Code 2022.3.3

Any tips on where I’m going wrong in building the schema/extension?

Here’s a full tar/gz of the sample schema/extension:

customtestschema.tar.gz (101.8 KB)

Thanks for the help!

Similar problem here. Please help.