Skip to content

Commit

Permalink
Merge pull request #2509 from Autodesk/vlasovi/MAYA-124578
Browse files Browse the repository at this point in the history
MAYA-124578 - Hide on playback option doesn't work on re-open
  • Loading branch information
seando-adsk authored Jul 28, 2022
2 parents f24795c + 83a5648 commit 4afa144
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 49 deletions.
8 changes: 1 addition & 7 deletions lib/mayaUsd/render/vp2RenderDelegate/basisCurves.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1475,11 +1475,7 @@ MHWRender::MRenderItem* HdVP2BasisCurves::_CreatePatchRenderItem(const MString&
renderItem->castsShadows(false);
renderItem->receivesShadows(false);
renderItem->setShader(_delegate->Get3dSolidShader(kOpaqueGray));
#ifdef MAYA_MRENDERITEM_UFE_IDENTIFIER_SUPPORT
auto* const param = static_cast<HdVP2RenderParam*>(_delegate->GetRenderParam());
ProxyRenderDelegate& drawScene = param->GetDrawScene();
drawScene.setUfeIdentifiers(*renderItem, _PrimSegmentString);
#endif
_InitRenderItemCommon(renderItem);

#ifdef MAYA_NEW_POINT_SNAPPING_SUPPORT
MSelectionMask selectionMask(MSelectionMask::kSelectNurbsCurves);
Expand All @@ -1493,8 +1489,6 @@ MHWRender::MRenderItem* HdVP2BasisCurves::_CreatePatchRenderItem(const MString&
renderItem->setObjectTypeExclusionFlag(MHWRender::MFrameContext::kExcludeNurbsCurves);
#endif

_SetWantConsolidation(*renderItem, true);

return renderItem;
}

Expand Down
39 changes: 18 additions & 21 deletions lib/mayaUsd/render/vp2RenderDelegate/mayaPrimCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,21 @@ void MayaUsdRPrim::_PropagateDirtyBitsCommon(HdDirtyBits& bits, const ReprVector
}
}

void MayaUsdRPrim::_InitRenderItemCommon(MHWRender::MRenderItem* renderItem) const
{
#ifdef MAYA_MRENDERITEM_UFE_IDENTIFIER_SUPPORT
auto* const param = static_cast<HdVP2RenderParam*>(_delegate->GetRenderParam());
ProxyRenderDelegate& drawScene = param->GetDrawScene();
drawScene.setUfeIdentifiers(*renderItem, _PrimSegmentString);
#endif

_SetWantConsolidation(*renderItem, true);

#ifdef MAYA_HAS_RENDER_ITEM_HIDE_ON_PLAYBACK_API
renderItem->setHideOnPlayback(_hideOnPlayback);
#endif
}

/*! \brief Create render item for bbox repr.
*/
MHWRender::MRenderItem* MayaUsdRPrim::_CreateBoundingBoxRenderItem(
Expand All @@ -336,18 +351,12 @@ MHWRender::MRenderItem* MayaUsdRPrim::_CreateBoundingBoxRenderItem(
renderItem->receivesShadows(false);
renderItem->setShader(_delegate->Get3dSolidShader(color));
renderItem->setSelectionMask(selectionMask);
#ifdef MAYA_MRENDERITEM_UFE_IDENTIFIER_SUPPORT
auto* const param = static_cast<HdVP2RenderParam*>(_delegate->GetRenderParam());
ProxyRenderDelegate& drawScene = param->GetDrawScene();
drawScene.setUfeIdentifiers(*renderItem, _PrimSegmentString);
#endif
_InitRenderItemCommon(renderItem);

#if MAYA_API_VERSION >= 20220000
renderItem->setObjectTypeExclusionFlag(exclusionFlag);
#endif

_SetWantConsolidation(*renderItem, true);

return renderItem;
}

Expand Down Expand Up @@ -375,18 +384,12 @@ MHWRender::MRenderItem* MayaUsdRPrim::_CreateWireframeRenderItem(
#else
renderItem->setSelectionMask(selectionMask);
#endif
#ifdef MAYA_MRENDERITEM_UFE_IDENTIFIER_SUPPORT
auto* const param = static_cast<HdVP2RenderParam*>(_delegate->GetRenderParam());
ProxyRenderDelegate& drawScene = param->GetDrawScene();
drawScene.setUfeIdentifiers(*renderItem, _PrimSegmentString);
#endif
_InitRenderItemCommon(renderItem);

#if MAYA_API_VERSION >= 20220000
renderItem->setObjectTypeExclusionFlag(exclusionFlag);
#endif

_SetWantConsolidation(*renderItem, true);

return renderItem;
}

Expand All @@ -410,18 +413,12 @@ MHWRender::MRenderItem* MayaUsdRPrim::_CreatePointsRenderItem(
MSelectionMask selectionMasks(selectionMask);
selectionMasks.addMask(MSelectionMask::kSelectPointsForGravity);
renderItem->setSelectionMask(selectionMasks);
#ifdef MAYA_MRENDERITEM_UFE_IDENTIFIER_SUPPORT
auto* const param = static_cast<HdVP2RenderParam*>(_delegate->GetRenderParam());
ProxyRenderDelegate& drawScene = param->GetDrawScene();
drawScene.setUfeIdentifiers(*renderItem, _PrimSegmentString);
#endif
_InitRenderItemCommon(renderItem);

#if MAYA_API_VERSION >= 20220000
renderItem->setObjectTypeExclusionFlag(exclusionFlag);
#endif

_SetWantConsolidation(*renderItem, true);

return renderItem;
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions lib/mayaUsd/render/vp2RenderDelegate/mayaPrimCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ class MayaUsdRPrim
//! Helper utility function to adapt Maya API changes.
static void _SetWantConsolidation(MHWRender::MRenderItem& renderItem, bool state);

void _InitRenderItemCommon(MHWRender::MRenderItem* renderItem) const;

MHWRender::MRenderItem* _CreateWireframeRenderItem(
const MString& name,
const MColor& color,
Expand Down
16 changes: 2 additions & 14 deletions lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2535,11 +2535,7 @@ HdVP2DrawItem::RenderItemData& HdVP2Mesh::_CreateSmoothHullRenderItem(
renderItem->castsShadows(true);
renderItem->receivesShadows(true);
renderItem->setShader(_delegate->GetFallbackShader(kOpaqueGray));
#ifdef MAYA_MRENDERITEM_UFE_IDENTIFIER_SUPPORT
auto* const param = static_cast<HdVP2RenderParam*>(_delegate->GetRenderParam());
ProxyRenderDelegate& drawScene = param->GetDrawScene();
drawScene.setUfeIdentifiers(*renderItem, _PrimSegmentString);
#endif
_InitRenderItemCommon(renderItem);

#ifdef MAYA_NEW_POINT_SNAPPING_SUPPORT
MSelectionMask selectionMask(MSelectionMask::kSelectMeshes);
Expand All @@ -2557,8 +2553,6 @@ HdVP2DrawItem::RenderItemData& HdVP2Mesh::_CreateSmoothHullRenderItem(
renderItem->setDefaultMaterialHandling(MRenderItem::SkipWhenDefaultMaterialActive);
#endif

_SetWantConsolidation(*renderItem, true);

_delegate->GetVP2ResourceRegistry().EnqueueCommit(
[&subSceneContainer, renderItem]() { subSceneContainer.add(renderItem); });

Expand All @@ -2580,18 +2574,12 @@ MHWRender::MRenderItem* HdVP2Mesh::_CreateSelectionHighlightRenderItem(const MSt
renderItem->receivesShadows(false);
renderItem->setShader(_delegate->Get3dSolidShader(kOpaqueBlue));
renderItem->setSelectionMask(MSelectionMask());
#ifdef MAYA_MRENDERITEM_UFE_IDENTIFIER_SUPPORT
auto* const param = static_cast<HdVP2RenderParam*>(_delegate->GetRenderParam());
ProxyRenderDelegate& drawScene = param->GetDrawScene();
drawScene.setUfeIdentifiers(*renderItem, _PrimSegmentString);
#endif
_InitRenderItemCommon(renderItem);

#if MAYA_API_VERSION >= 20220000
renderItem->setObjectTypeExclusionFlag(MHWRender::MFrameContext::kExcludeMeshes);
#endif

_SetWantConsolidation(*renderItem, true);

return renderItem;
}

Expand Down
8 changes: 1 addition & 7 deletions lib/mayaUsd/render/vp2RenderDelegate/points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1091,11 +1091,7 @@ MHWRender::MRenderItem* HdVP2Points::_CreateFatPointsRenderItem(const MString& n
renderItem->castsShadows(false);
renderItem->receivesShadows(false);
renderItem->setShader(_delegate->GetPointsFallbackShader(MColor()));
#ifdef MAYA_MRENDERITEM_UFE_IDENTIFIER_SUPPORT
auto* const param = static_cast<HdVP2RenderParam*>(_delegate->GetRenderParam());
ProxyRenderDelegate& drawScene = param->GetDrawScene();
drawScene.setUfeIdentifiers(*renderItem, _PrimSegmentString);
#endif
_InitRenderItemCommon(renderItem);

#ifdef MAYA_NEW_POINT_SNAPPING_SUPPORT
MSelectionMask selectionMask(MSelectionMask::kSelectParticleShapes);
Expand All @@ -1109,8 +1105,6 @@ MHWRender::MRenderItem* HdVP2Points::_CreateFatPointsRenderItem(const MString& n
renderItem->setObjectTypeExclusionFlag(MHWRender::MFrameContext::kExcludeNParticles);
#endif

_SetWantConsolidation(*renderItem, true);

return renderItem;
}

Expand Down

0 comments on commit 4afa144

Please sign in to comment.