From 4154563d8397fade35d674c7a4f12a39870281c6 Mon Sep 17 00:00:00 2001 From: Pierre Tremblay Date: Tue, 26 Mar 2024 11:52:06 -0400 Subject: [PATCH] Avoid Maya Hydra registration for mayaUsdPlugin if not loaded. --- .../hydraExtensions/sceneIndex/registration.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp b/lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp index 85c17a2a4d..db61074e41 100644 --- a/lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp +++ b/lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include @@ -201,10 +203,16 @@ PXR_NAMESPACE_OPEN_SCOPE // Remove this once the code has been moved to the MayaHydra namespace. using namespace MayaHydra; -// MayaHydraSceneIndexRegistration is used to register a scene index for a given dag node type. +// MayaHydraSceneIndexRegistration is used to register a scene index for +// mayaUsdPlugin proxy shape nodes. MayaHydraSceneIndexRegistry::MayaHydraSceneIndexRegistry(const std::shared_ptr& renderIndexProxy) : _renderIndexProxy(renderIndexProxy) { + if (!MFnPlugin::isNodeRegistered(kMayaUsdProxyShapeNode)) { + MGlobal::displayWarning("mayaUsdPlugin not loaded, cannot be registered to Maya Hydra. Please load mayaUsdPlugin, then switch back to a Maya Hydra viewport renderer."); + return; + } + MCallbackId id; MStatus status; id = MDGMessage::addNodeAddedCallback(