Skip to content

Commit

Permalink
HYDRA-1058 : Debug OSX #1
Browse files Browse the repository at this point in the history
  • Loading branch information
debloip-adsk committed Jul 5, 2024
1 parent eb9ef75 commit 829244b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/lib/mayaUsd/render/mayaToHydra/cpp/testGeomSubsetsPicking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ const std::string kSphereInstancerUfePathSegment = "/Root/SphereInstancer";
const std::string kCubeUpperHalfName = "CubeUpperHalf";
const std::string kSphereUpperHalfName = "SphereUpperHalf";

void debugPrintUfePath(const std::string varName, const Ufe::Path& path) {
std::cout << "Printing " << varName << std::endl;
std::cout << "\t" << "Path : " << path.string() << std::endl;
for (const auto& seg : path.getSegments()) {
std::cout << "\t\t" << "Segment Rtid : " << seg.runTimeId() << std::endl;
std::cout << "\t\t" << "Segment separator : " << seg.separator() << std::endl;
for (const auto& comp : seg.components()) {
std::cout << "\t\t\t" << "Component : " << comp.string() << std::endl;
}
}
}

void assertUnselected(const SceneIndexInspector& inspector, const FindPrimPredicate& primPredicate)
{
PrimEntriesVector primEntries = inspector.FindPrims(primPredicate);
Expand Down Expand Up @@ -80,23 +92,30 @@ void testPrimPicking(const Ufe::Path& clickObjectUfePath, const QPoint& clickOff
const auto selectionSceneIndex = findSelectionSceneIndexInTree(inspector.GetSceneIndex());
ASSERT_TRUE(selectionSceneIndex);

debugPrintUfePath("selectedObjectUfePath", selectedObjectUfePath);
const auto selectedObjectSceneIndexPath = selectionSceneIndex->SceneIndexPath(selectedObjectUfePath);
std::cout << "selectedObjectSceneIndexPath : " << selectedObjectSceneIndexPath.GetString() << std::endl;

HdSceneIndexPrim selectedObjectSceneIndexPrim = inspector.GetSceneIndex()->GetPrim(selectedObjectSceneIndexPath);
HdSelectionsSchema selectionsSchema = HdSelectionsSchema::GetFromParent(selectedObjectSceneIndexPrim.dataSource);
ASSERT_EQ(selectionsSchema.IsDefined(), false);

// Picking
M3dView active3dView = M3dView::active3dView();
debugPrintUfePath("clickObjectUfePath", clickObjectUfePath);
const auto clickObjectSceneIndexPath = selectionSceneIndex->SceneIndexPath(clickObjectUfePath);
std::cout << "clickObjectSceneIndexPath : " << clickObjectSceneIndexPath.GetString() << std::endl;
auto primMouseCoords = getPrimMouseCoords(inspector.GetSceneIndex()->GetPrim(clickObjectSceneIndexPath), active3dView);
primMouseCoords += clickOffset;

std::cout << "primMouseCoords : " << primMouseCoords.x() << ", " << primMouseCoords.y() << std::endl;
std::cout << "viewportSize : " << active3dView.portWidth() << ", " << active3dView.portHeight() << std::endl;
mouseClick(Qt::MouseButton::LeftButton, active3dView.widget(), primMouseCoords);
active3dView.refresh();

// Postconditions
ASSERT_EQ(ufeSelection->size(), 1u);
debugPrintUfePath("ufeSelection->front()->path()", ufeSelection->front()->path());
ASSERT_TRUE(ufeSelection->contains(selectedObjectUfePath));

selectedObjectSceneIndexPrim = inspector.GetSceneIndex()->GetPrim(selectedObjectSceneIndexPath);
Expand Down

0 comments on commit 829244b

Please sign in to comment.