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

MAYA-105284 Track changes to render tags more carefully to avoid setting the tags #587

Merged
merged 5 commits into from
Jun 13, 2020
Merged
Changes from 1 commit
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
46 changes: 25 additions & 21 deletions lib/mayaUsd/render/vp2RenderDelegate/proxyRenderDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,24 +823,11 @@ void ProxyRenderDelegate::_UpdateRenderTags()
}
}

// When the render tag on an rprim changes we do a pass over all rprims to update
// their visibility. The frame after we do the pass over all the tags, set the tags back to
// the minimum set of tags.
if (!_taskRenderTagsValid) {
TfTokenVector renderTags
= { HdRenderTagTokens->geometry }; // always draw geometry render tag purpose.
if (_proxyShapeData->DrawRenderPurpose()) {
renderTags.push_back(HdRenderTagTokens->render);
}
if (_proxyShapeData->DrawProxyPurpose()) {
renderTags.push_back(HdRenderTagTokens->proxy);
}
if (_proxyShapeData->DrawGuidePurpose()) {
renderTags.push_back(HdRenderTagTokens->guide);
}
_taskController->SetRenderTags(renderTags);
_taskRenderTagsValid = true;
}
// The renderTagsVersion increments when the render tags on an rprim changes, or when the
// global render tags are set. Check to see if the render tags version has changed since
// the last time we set the render tags so we know if there is a change to an individual
// rprim or not.
bool rprimRenderTagChanged = (_renderTagVersion == changeTracker.GetRenderTagVersion());

// Vp2RenderDelegate implements render tags as a per-render item setting.
// To handle cases when an rprim changes from a displayed tag to a hidden tag
Expand All @@ -849,16 +836,33 @@ void ProxyRenderDelegate::_UpdateRenderTags()
// render tags to be all the tags.
// When an rprim has it's renderTag changed the global render tag version
// id will change.
const int renderTagVersion = changeTracker.GetRenderTagVersion();
if (renderTagVersion != _renderTagVersion) {
if (rprimRenderTagChanged)
{
TfTokenVector renderTags = { HdRenderTagTokens->geometry,
HdRenderTagTokens->render,
HdRenderTagTokens->proxy,
HdRenderTagTokens->guide };
_taskController->SetRenderTags(renderTags);
_taskRenderTagsValid = false;
_renderTagVersion = renderTagVersion;
}
// When the render tag on an rprim changes we do a pass over all rprims to update
// their visibility. The frame after we do the pass over all the tags, set the tags back to
// the minimum set of tags.
else if (!_taskRenderTagsValid) {
TfTokenVector renderTags = { HdRenderTagTokens->geometry }; // always draw geometry render tag purpose.
if (_proxyShapeData->DrawRenderPurpose()) {
renderTags.push_back(HdRenderTagTokens->render);
}
if (_proxyShapeData->DrawProxyPurpose()) {
renderTags.push_back(HdRenderTagTokens->proxy);
}
if (_proxyShapeData->DrawGuidePurpose()) {
renderTags.push_back(HdRenderTagTokens->guide);
}
_taskController->SetRenderTags(renderTags);
_taskRenderTagsValid = true;
}
_renderTagVersion = changeTracker.GetRenderTagVersion();
}

//! \brief List the rprims in collection that match renderTags
Expand Down