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

always register and de-register the PxrMayaHdImagingShape and its draw override #810

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 29 additions & 25 deletions lib/mayaUsd/nodes/proxyShapePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,28 @@ MayaUsdProxyShapePlugin::initialize(MFnPlugin& plugin)
MayaUsdProxyShapeBase::displayFilterLabel,
UsdMayaProxyDrawOverride::drawDbClassification);
CHECK_MSTATUS(status);
}

// Hybrid Hydra / VP2 rendering uses the PxrMayaHdImagingShape for draw
// aggregation of all proxy shapes.
status = plugin.registerShape(
PxrMayaHdImagingShape::typeName,
PxrMayaHdImagingShape::typeId,
PxrMayaHdImagingShape::creator,
PxrMayaHdImagingShape::initialize,
PxrMayaHdImagingShapeUI::creator,
&PxrMayaHdImagingShapeDrawOverride::drawDbClassification);
CHECK_MSTATUS(status);
// We register the PxrMayaHdImagingShape regardless of whether the Viewport
// 2.0 render delegate is enabled for the USD proxy shape node types. There
// may be other non-proxy shape node types in use that still want to
// leverage Hydra and aggregated drawing. Those shapes should call
// PxrMayaHdImagingShape::GetOrCreateInstance() in their postConstructor()
// override to create a Hydra imaging shape for drawing.
status = plugin.registerShape(
PxrMayaHdImagingShape::typeName,
PxrMayaHdImagingShape::typeId,
PxrMayaHdImagingShape::creator,
PxrMayaHdImagingShape::initialize,
PxrMayaHdImagingShapeUI::creator,
&PxrMayaHdImagingShapeDrawOverride::drawDbClassification);
CHECK_MSTATUS(status);

status = MHWRender::MDrawRegistry::registerDrawOverrideCreator(
PxrMayaHdImagingShapeDrawOverride::drawDbClassification,
_RegistrantId,
PxrMayaHdImagingShapeDrawOverride::creator);
CHECK_MSTATUS(status);
}
status = MHWRender::MDrawRegistry::registerDrawOverrideCreator(
PxrMayaHdImagingShapeDrawOverride::drawDbClassification,
_RegistrantId,
PxrMayaHdImagingShapeDrawOverride::creator);
CHECK_MSTATUS(status);

return status;
}
Expand All @@ -145,7 +149,15 @@ MayaUsdProxyShapePlugin::finalize(MFnPlugin& plugin)

MStatus status = HdVP2ShaderFragments::deregisterFragments();
CHECK_MSTATUS(status);


status = MHWRender::MDrawRegistry::deregisterDrawOverrideCreator(
PxrMayaHdImagingShapeDrawOverride::drawDbClassification,
_RegistrantId);
CHECK_MSTATUS(status);

status = plugin.deregisterNode(PxrMayaHdImagingShape::typeId);
CHECK_MSTATUS(status);

if (_useVP2RenderDelegate) {
status = MHWRender::MDrawRegistry::deregisterSubSceneOverrideCreator(
ProxyRenderDelegate::drawDbClassification,
Expand All @@ -162,14 +174,6 @@ MayaUsdProxyShapePlugin::finalize(MFnPlugin& plugin)
UsdMayaProxyDrawOverride::drawDbClassification,
_RegistrantId);
CHECK_MSTATUS(status);

status = MHWRender::MDrawRegistry::deregisterDrawOverrideCreator(
PxrMayaHdImagingShapeDrawOverride::drawDbClassification,
_RegistrantId);
CHECK_MSTATUS(status);

status = plugin.deregisterNode(PxrMayaHdImagingShape::typeId);
CHECK_MSTATUS(status);
}

status = plugin.deregisterNode(MayaUsdProxyShapeBase::typeId);
Expand Down