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

Allow loading pure-USD shading mode plugins #923

Merged
merged 6 commits into from
Nov 18, 2020
Merged

Conversation

JGamache-autodesk
Copy link
Collaborator

Previous code expected to load a Maya plugin. This change allows loading shading modes, importers, and exporters as a USD plugin.

Previous code expected to load a Maya plugin. This change allows loading shading modes, importers, and exporters as a USD plugin.
}

return false;
return true;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Return true as soon as we found the Info:UsdMaya:ShadingModePlugin. The mayaPlugin resolution becomes optional.

Choose a reason for hiding this comment

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

Documentation would be very welcome here. Things that will let developers know that mayaPluginName is a return argument, that it may not be initialized (if someone forgot to do so), and that shading mode plugin doesn't have to be associated with maya plugin.

.Msg(
"Found shading mode plugin %s: Loading via USD API.\n",
plug->GetName().c_str());
plug->Load();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Load shading modes that are not in a Maya plugin.

@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
set(TARGET_NAME usdTestPlugin)
set(TARGET_NAME usdTestMayaPlugin)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We now create 2 test plugins. One is Maya-style, the other one is pure USD.

mayaUsd
usdShade
)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note the absence of maya_set_plugin_properties. This plugin is USD only.

set(PLUGIN_TYPES
Maya
USD
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add unit tests for USD-style plugin loading.

@@ -189,7 +189,6 @@ void UsdMaya_RegistryHelper::FindAndLoadMayaPlug(
// already loaded.
plug->Load();
}
break;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This code would stop at the first usdPreviewSurface translator found. Since we can export to multiple rendering contexts, we need to continue until all usdPreviewSurface translators are found.

Copy link
Contributor

@mattyjams mattyjams left a comment

Choose a reason for hiding this comment

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

Looks good to me!

# In case tests are run in parallel, make sure we export to separate
# directories:
pluginPath = os.getenv("PXR_PLUGINPATH_NAME")
if "../plugin/Maya" in pluginPath or "..\\plugin\\Maya" in pluginPath:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a platform-dependent thing, I'm assuming? Maybe this?:

if os.path.join(os.path.pardir, 'plugin', 'Maya') in pluginPath:
    ....

# In case tests are run in parallel, make sure we export to separate
# directories:
pluginPath = os.getenv("PXR_PLUGINPATH_NAME")
if "../plugin/Maya" in pluginPath or "..\\plugin\\Maya" in pluginPath:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same os.path.join() incantation here?

@JGamache-autodesk JGamache-autodesk added the ready-for-merge Development process is finished, PR is ready for merge label Nov 18, 2020
@kxl-adsk kxl-adsk merged commit b62dfe6 into dev Nov 18, 2020
@kxl-adsk kxl-adsk deleted the t_gamaj/allow_usd_plugins branch November 18, 2020 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
import-export Related to Import and/or Export 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.

4 participants