Skip to content

Commit

Permalink
Further debugging (notifications)
Browse files Browse the repository at this point in the history
  • Loading branch information
debloip-adsk committed Jul 17, 2024
1 parent 2d9fedf commit 89bc0eb
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
38 changes: 38 additions & 0 deletions test/lib/mayaUsd/render/mayaToHydra/cpp/testHydraPrim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ PXR_NAMESPACE_USING_DIRECTIVE

using namespace MayaHydra;

namespace {
SceneIndexNotificationsAccumulator* notifsAccum = nullptr;
}

TEST(TestHydraPrim, fromAppPath)
{
const auto& sceneIndices = GetTerminalSceneIndices();
Expand Down Expand Up @@ -54,3 +58,37 @@ TEST(TestHydraPrim, printSceneIndex)

HdUtils::PrintSceneIndex(std::cout, siRoot);
}

TEST(TestHydraPrim, startAccum)
{
const auto& sceneIndices = GetTerminalSceneIndices();
ASSERT_GT(sceneIndices.size(), 0u);
auto siRoot = sceneIndices.front();

notifsAccum = new SceneIndexNotificationsAccumulator(siRoot);
}

TEST(TestHydraPrim, endAccum)
{
std::cout << "---------- AddedPrimEntries" << std::endl;
for (const auto& addedPrimEntry : notifsAccum->GetAddedPrimEntries()) {
std::cout << addedPrimEntry.primPath.GetString() << " (" << addedPrimEntry.primType.GetString() << ")" << std::endl;
}
std::cout << "---------- DirtiedPrimEntries" << std::endl;
for (const auto& dirtiedPrimEntry : notifsAccum->GetDirtiedPrimEntries()) {
std::cout << dirtiedPrimEntry.primPath << std::endl;
for (const auto& locator : dirtiedPrimEntry.dirtyLocators) {
std::cout << "\t" << locator.GetString() << std::endl;
}
}
std::cout << "---------- RemovedPrimEntries" << std::endl;
for (const auto& removedPrimEntry : notifsAccum->GetRemovedPrimEntries()) {
std::cout << removedPrimEntry.primPath.GetString() << std::endl;
}
std::cout << "---------- RenamedPrimEntries" << std::endl;
for (const auto& renamedPrimEntry : notifsAccum->GetRenamedPrimEntries()) {
std::cout << renamedPrimEntry.oldPrimPath.GetString() << " to " << renamedPrimEntry.newPrimPath.GetString() << std::endl;
}
delete notifsAccum;
notifsAccum = nullptr;
}
4 changes: 3 additions & 1 deletion test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ def test_UsdStageVariants(self):
self.assertIsNotNone(cubesItems)
ufeGlobalSel = ufe.GlobalSelection.get()
ufeGlobalSel.clear()
cmds.loadPlugin('mayaHydraCppTests')
cmds.mayaHydraCppTest(f="TestHydraPrim.startAccum")
ufeGlobalSel.append(cubesItems)
cmds.refresh(force=True)
cmds.loadPlugin('mayaHydraCppTests')
cmds.mayaHydraCppTest(f="TestHydraPrim.printSceneIndex")
cmds.mayaHydraCppTest(f="TestHydraPrim.endAccum")
self.assertSnapshotClose("oneCube.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT)
ufeGlobalSel.clear()

Expand Down

0 comments on commit 89bc0eb

Please sign in to comment.