UsdMayaAdaptor::RegisterTypedSchemaConversion is lacking a way to overwrite the exiting registration.
- Dominant language
- Wolfram Language
- Stars
- 905
- Forks
- 223
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 17
Description
Hi, we have been using an internal feature to **maya-usd** to allow us to overwrite the [default camera prim writer](https://github.com/Autodesk/maya-usd/blob/971d75000064d721dbb59f3dfb47ac1c21af55c8/lib/usd/translators/cameraWriter.h#L34), but recently we wanted to try the new prim writer override feature https://github.com/Autodesk/maya-usd/pull/3189 to register our internal **ALCamera** prim writer so that we can remove our internal patch. After trying, I found we could register our ALCamera prim writer successfully with the new [UsdMayaPrimWriterRegistry::Register](https://github.com/Autodesk/maya-usd/blob/2725e962d48560e5ea76ee820161d024cdc32d61/lib/mayaUsd/fileio/primWriterRegistry.cpp#L87) function to overwrite the [existing default camera registration](https://github.com/Autodesk/maya-usd/blob/971d75000064d721dbb59f3dfb47ac1c21af55c8/lib/usd/translators/cameraWriter.cpp#L39), but I found I couldn't register my custom prim writer to **UsdMayaAdaptor** via [UsdMayaAdaptor::RegisterTypedSchemaConversion](https://github.com/Autodesk/maya-usd/blob/971d75000064d721dbb59f3dfb47ac1c21af55c8/lib/mayaUsd/fileio/utils/adaptor.h#L674-L679), like many default prim writers do: https://github.com/search?q=repo%3AAutodesk%2Fmaya-usd%20PXRUSDMAYA_REGISTER_ADAPTOR_SCHEMA&type=code.
I found this is because [UsdMayaAdaptor::RegisterTypedSchemaConversion](https://github.com/Autodesk/maya-usd/blob/971d75000064d721dbb59f3dfb47ac1c21af55c8/lib/mayaUsd/fileio/utils/adaptor.cpp#L639-L654) doesn't support overriding existing registration (in our internal path, we have updated it to support overriding). The function description says ["re-registering the same Maya type again will overwrite the previous registration."](https://github.com/Autodesk/maya-usd/blob/971d75000064d721dbb59f3dfb47ac1c21af55c8/lib/mayaUsd/fileio/utils/adaptor.h#L605-L608), but it's not true.
**Describe the solution you'd like**
I'd like [UsdMayaAdaptor::RegisterTypedSchemaConversion](https://github.com/Autodesk/maya-usd/blob/971d75000064d721dbb59f3dfb47ac1c21af55c8/lib/mayaUsd/fileio/utils/adaptor.cpp#L639-L654) to be updated to support overwriting so that we can use it along with the new [UsdMayaPrimWriterRegistry::Register](https://github.com/Autodesk/maya-usd/blob/2725e962d48560e5ea76ee820161d024cdc32d61/lib/mayaUsd/fileio/primWriterRegistry.cpp#L87) to take full advantage of custom prim writers.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in lib/mayaUsd/fileio/utils/adaptor.cpp at UsdMayaAdaptor::RegisterTypedSchemaConversion and compare its behavior with the contract in adaptor.h and the overwrite behavior of UsdMayaPrimWriterRegistry::Register. Verify how repeated Maya-type registrations are stored, then confirm that a later registration replaces the earlier one without changing unrelated adaptor registrations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100