Skip to content

Commit

Permalink
Addressed code review feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppt-adsk committed Nov 28, 2024
1 parent 8861311 commit 112ae53
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
3 changes: 3 additions & 0 deletions lib/flowViewport/selection/fvpPathMapperRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ PrimSelections PathMapperRegistry::UfePathToPrimSelections(

bool PathMapperRegistry::HasMapper(const Ufe::Path& path) const
{
if (path.empty()) {
return false;
}
return _GetMapper(path) != nullptr;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
#include <pxr/imaging/hd/rprim.h>
#include <pxr/usdImaging/usdImaging/tokens.h>

#include <iostream>

namespace
{
// Pick handler for the Maya scene index. As the Maya pick handler and the
Expand Down Expand Up @@ -477,8 +475,6 @@ class MayaPathMapper : public Fvp::PathMapper

Fvp::PrimSelections
UfePathToPrimSelections(const Ufe::Path& appPath) const override {
std::cout << "PPT: in MayaPathMapper::UfePathToPrimSelections("
<< Ufe::PathString::string(appPath) << ")" << std::endl;
auto litPaths = _piSi.UfePathToPrimSelectionsLit(appPath);
auto unlitPaths = _piSi.UfePathToPrimSelections(appPath);
unlitPaths.insert(unlitPaths.end(), litPaths.begin(), litPaths.end());
Expand Down Expand Up @@ -806,14 +802,9 @@ Fvp::PrimSelections MayaHydraSceneIndex::UfePathToPrimSelections(const Ufe::Path
TF_DEBUG(MAYAHYDRALIB_SCENE_INDEX)
.Msg("MayaHydraSceneIndex::UfePathToPrimSelections(const Ufe::Path& %s) called.\n", Ufe::PathString::string(appPath).c_str());

std::cout << "PPT: in MayaHydraSceneIndex::UfePathToPrimSelections("
<< Ufe::PathString::string(appPath) << ")" << std::endl;

// We only handle Maya objects, so if the UFE path is not a Maya object,
// early out with failure.
if (appPath.runTimeId() != UfeExtensions::getMayaRunTimeId()) {
std::cout << "PPT: early out, not a Maya run-time UFE path."
<< std::endl;
return {};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ TEST(TestPathMapperRegistry, testRegistry)
// Exercise the path mapper registry.
auto& r = Fvp::PathMapperRegistry::Instance();

// For the duration of this test set a null fallback mapper.
auto fbm = r.GetFallbackMapper();
r.SetFallbackMapper(nullptr);

auto dummy = TestPathMapper::create();

// Can't register for an empty path.
Expand Down Expand Up @@ -106,10 +102,15 @@ TEST(TestPathMapperRegistry, testRegistry)
ASSERT_TRUE(r.HasMapper(Ufe::PathString::path("|apple|pear")));
ASSERT_TRUE(r.HasMapper(Ufe::PathString::path("|wizard|sorcerer")));

// Update the path for an entry.
auto potatoP = Ufe::PathString::path("|potato");
ASSERT_TRUE(r.Update(appleP, potatoP));
ASSERT_FALSE(r.HasMapper(Ufe::PathString::path("|apple|pear")));
ASSERT_TRUE(r.HasMapper(Ufe::PathString::path("|potato|baked")));
ASSERT_TRUE(r.Update(potatoP, appleP));

// Clean up.
for (const auto& h : registered) {
ASSERT_TRUE(r.Unregister(h));
}
r.SetFallbackMapper(fbm);
ASSERT_EQ(r.GetFallbackMapper(), fbm);
}
2 changes: 1 addition & 1 deletion test/lib/mayaUsd/render/mayaToHydra/cpp/testUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ bool visibility(const HdSceneIndexBasePtr& sceneIndex, const SdfPath& primPath)

bool contains(const PXR_NS::SdfPathVector& paths, const PXR_NS::SdfPath& path)
{
return std::count(paths.begin(), paths.end(), path) > 0;
return std::find(paths.begin(), paths.end(), path) != paths.end();
}

} // namespace MAYAHYDRA_NS_DEF

0 comments on commit 112ae53

Please sign in to comment.