Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved MAYA_PXR_PLUGINPATH_NAME to handle more checks #949

Merged
merged 6 commits into from
Dec 1, 2020

Conversation

kxl-adsk
Copy link

Plug registry plugins (either pure USD, like render delegates or MayaUsd ones like translators) should never be used with a mismatched version of shared libraries.

When all components are compiled together, there is no chance for version mismatch and PXR_PLUGINPATH_NAME is the proper way to discover and register such plugins.

Plugins distributed separately from MayaUSD should use the MAYA_PXR_PLUGINPATH_NAME env variable to point to a folder with the mayaUsdPlugInfo.json file. The JSON file is used to discover plugin paths to register after running requested version checks at runtime. Here is an example file:

    {
       "MayaUsdIncludes":[
          {
             "PlugPath":"testPlugModule1",
             "VersionCheck":{
                "Python":"3",
                "USD":"0.20.8"
             }
          },
          {
             "PlugPath":"testPlugModule2",
             "VersionCheck":{
                "MayaUsd":"0.6.0"
             }
          },
          {
             "PlugPath":"testPlugModule3"
          },
          {
             "PlugPath":"testPlugModule4",
             "VersionCheck":{
                "MayaUsd":"0.0.0"
             }
          },
          {
             "PlugPath":"testPlugModule5",
             "VersionCheck":{
                "Python":"1"
             }
          },
          {
             "PlugPath":"testPlugModule6",
             "VersionCheck":{
                "USD":"0.0.0"
             }
          }
       ]
    }

The plugin must decide which validation checks are needed by listing them in the VersionCheck object. Supported checks are:

  • "Python"
  • "USD"
  • "MayaUsd"

Every plugin passing version check will get registered in plug registry via PlugRegistry::GetInstance().RegisterPlugins method.

@kxl-adsk kxl-adsk added the core Related to core library label Nov 30, 2020
Copy link
Collaborator

@seando-adsk seando-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It all looks good to me.

Comment on lines 150 to 156
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${plugName}.py"
RENAME __init__.py
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/TestMayaUsdPlug/${plugName}")

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${plugName}_plugInfo.json"
"${CMAKE_CURRENT_BINARY_DIR}/TestMayaUsdPlug/${plugName}/plugInfo.json"
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor - these lines should be indented.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx. Fixed now with 892515b

@@ -0,0 +1,30 @@
#
# Copyright 2016 Pixar
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason these test files have this copyright?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I took this test plugin from the Pixar repository.

@kxl-adsk kxl-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Dec 1, 2020
@kxl-adsk kxl-adsk merged commit 2700caf into dev Dec 1, 2020
@kxl-adsk kxl-adsk deleted the kxl-adsk/better_version_check_control_for_plugins branch December 1, 2020 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to core library ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants