Hey Spiff,
Thanks for confirming, and a good question indeed, I think it would be ideal for at the API level to provide the same response which would happen inside USD when it is acting on the auto-apply schemas. Essentially I am trying to mimic behaviour done by USD when upconverting base types of Lights.
To expand further, I am looking at passing UsdLuxLights in a way render delegates, like hdPrman
, will understand which means updating shaderID’s from a non-USD data source to be the shaderID they would expect (and USD would be passing to them via the auto-apply schema workflow).
I have written a small python snippet (which arguably doesn’t fulfil the full API discussed above, but gets me a step further and might help others), which will provide a reversed auto-apply list. The inner loop could be updated to fulfil this behaviour if required, it’d likely require querying the schema’s parent schemas and searching for those again in a recursive manner.
One of those situation’s it appears that all the data is there, so not urgent on the list, it was more a query to see if I was missing some API call somewhere.
from pxr import Usd
# Reverse the schema registries auto-apply api schema map to make it
# easier to query later from the position of being provided a base type.
schema_registry = Usd.SchemaRegistry()
auto_apply_schemas = schema_registry.GetAutoApplyAPISchemas()
reverse_apply_schema_dict = {}
for auto_apply_schema, apply_to_list in auto_apply_schemas.items():
for apply_to in apply_to_list:
# store it as a list incase multiple auto apply's apply to
# a single Type Schema.
l = reverse_apply_schema_dict.get(apply_to, [])
l.append(auto_apply_schema)
reverse_apply_schema_dict[apply_to] = l
print(reverse_apply_schema_dict)
print(reverse_apply_schema_dict["DiskLight"])
With the RenderMan Discovery Plugin’s loaded I get the response of:
{'MeshLightAPI': ['PxrMeshLightAPI'], 'VolumeLightAPI': ['PxrMeshLightAPI'], 'RenderPass': ['RiRenderPassAPI'], 'Camera': ['PxrCameraAPI', 'PxrCameraProjectionAPI'], 'DistantLight': ['PxrDistantLightAPI'], 'RectLight': ['PxrRectLightAPI'], 'SphereLight': ['PxrSphereLightAPI'], 'RenderSettings': ['PxrOptionsAPI', 'PxrRenderTerminalsAPI'], 'CylinderLight': ['PxrCylinderLightAPI'], 'RenderVar': ['PxrDisplayChannelAPI'], 'PortalLight': ['PxrPortalLightAPI'], 'DomeLight': ['PxrDomeLightAPI'], 'DiskLight': ['PxrDiskLightAPI']}
['PxrDiskLightAPI']
Thanks again!
James