Skip to content

Commit

Permalink
[usdImagingGL] Preserve UsdImagingGLEngine root xform/visibility acro…
Browse files Browse the repository at this point in the history
…ss renderer change.

(Internal change: 2289099)
  • Loading branch information
tcauchois authored and pixar-oss committed Aug 3, 2023
1 parent cacd722 commit 55a02f3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
12 changes: 12 additions & 0 deletions pxr/usdImaging/usdImaging/rootOverridesSceneIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ UsdImagingRootOverridesSceneIndex::SetRootTransform(
_SendPrimsDirtied(entries);
}

const GfMatrix4d&
UsdImagingRootOverridesSceneIndex::GetRootTransform() const
{
return _rootOverlayInfo->transform;
}

void
UsdImagingRootOverridesSceneIndex::SetRootVisibility(
const bool visibility)
Expand All @@ -164,6 +170,12 @@ UsdImagingRootOverridesSceneIndex::SetRootVisibility(
_SendPrimsDirtied(entries);
}

const bool
UsdImagingRootOverridesSceneIndex::GetRootVisibility() const
{
return _rootOverlayInfo->visibility;
}

HdSceneIndexPrim
UsdImagingRootOverridesSceneIndex::GetPrim(
const SdfPath &primPath) const
Expand Down
6 changes: 6 additions & 0 deletions pxr/usdImaging/usdImaging/rootOverridesSceneIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,15 @@ class UsdImagingRootOverridesSceneIndex
USDIMAGING_API
void SetRootTransform(const GfMatrix4d &);

USDIMAGING_API
const GfMatrix4d& GetRootTransform() const;

USDIMAGING_API
void SetRootVisibility(bool);

USDIMAGING_API
const bool GetRootVisibility() const;

protected:
void _PrimsAdded(
const HdSceneIndexBase&,
Expand Down
10 changes: 7 additions & 3 deletions pxr/usdImaging/usdImagingGL/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,10 @@ UsdImagingGLEngine::_SetRenderDelegateAndRestoreState(
bool rootVisibility = true;

if (_GetUseSceneIndices()) {
// XXX(USD-7115): root transform, visibility...
if (_rootOverridesSceneIndex) {
rootTransform = _rootOverridesSceneIndex->GetRootTransform();
rootVisibility = _rootOverridesSceneIndex->GetRootVisibility();
}
} else {
if (_sceneDelegate) {
rootTransform = _sceneDelegate->GetRootTransform();
Expand All @@ -1014,10 +1017,11 @@ UsdImagingGLEngine::_SetRenderDelegateAndRestoreState(

// Reload saved state.
if (_GetUseSceneIndices()) {
// XXX(USD-7115): root transform, visibility...
_rootOverridesSceneIndex->SetRootTransform(rootTransform);
_rootOverridesSceneIndex->SetRootVisibility(rootVisibility);
} else {
_sceneDelegate->SetRootVisibility(rootVisibility);
_sceneDelegate->SetRootTransform(rootTransform);
_sceneDelegate->SetRootVisibility(rootVisibility);
}
_selTracker->SetSelection(selection);
_taskController->SetSelectionColor(_selectionColor);
Expand Down

0 comments on commit 55a02f3

Please sign in to comment.