Skip to content

Commit

Permalink
Updated for code review feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppt-adsk committed Jun 21, 2024
1 parent bfe06dc commit 5214878
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 9 deletions.
9 changes: 8 additions & 1 deletion lib/flowViewport/sceneIndex/fvpSelectionSceneIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,18 @@ PrimSelections SelectionSceneIndex::UfePathToPrimSelections(const Ufe::Path& app
// Try path mapper registry.
auto mapper = Fvp::PathMapperRegistry::Instance().GetMapper(appPath);

if (!mapper) {
auto warnEmptyPath = [](const Ufe::Path& appPath) {
TF_WARN("SelectionSceneIndex::UfePathToPrimSelections(%s) returned no path, Hydra selection will be incorrect", Ufe::PathString::string(appPath).c_str());
};

if (!mapper) {
warnEmptyPath(appPath);
}
else {
primSelections = mapper->UfePathToPrimSelections(appPath);
if (primSelections.empty()) {
warnEmptyPath(appPath);
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/flowViewport/selection/fvpPathMapperFwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef FVP_PATH_MAPPER_FWD_H
#define FVP_PATH_MAPPER_FWD_H
#ifndef FVP_SELECTION_PATH_MAPPER_FWD_H
#define FVP_SELECTION_PATH_MAPPER_FWD_H

#include <flowViewport/api.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <flowViewport/selection/fvpPathMapperRegistry.h>

//Maya Hydra headers
#include "mayaHydraLib/mixedUtils.h"
#include <mayaHydraLib/mixedUtils.h>
#include <mayaHydraLib/mayaUtils.h>
#include <mayaHydraLib/mayaHydraLibInterface.h>
#include <mayaHydraLib/pick/mhPickHandler.h>
Expand Down Expand Up @@ -130,7 +130,7 @@ class MhFlowViewportAPILocator : public MPxLocatorNode
// Get sparse list of hidden cubes.
HiddenCubes hiddenCubes() const;

// Set sparce list of hidden cubes.
// Set sparse list of hidden cubes.
void hideCubes(const HiddenCubes& hidden);

// Get sparse list of transformed cubes.
Expand Down
4 changes: 2 additions & 2 deletions lib/mayaHydra/hydraExtensions/pick/mhPickHandlerRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ PickHandlerRegistry& PickHandlerRegistry::Instance()

bool PickHandlerRegistry::Register(const SdfPath& prefix, const PickHandlerConstPtr& pickHandler)
{
// Can't register an empty path.
if (prefix.IsEmpty()) {
// Can't register an empty path, or an absolute root path prefix.
if (prefix.IsEmpty() || prefix.IsAbsoluteRootPath()) {
return false;
}

Expand Down
3 changes: 2 additions & 1 deletion lib/mayaHydra/hydraExtensions/pick/mhPickHandlerRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ class PickHandlerRegistry {
static PickHandlerRegistry& Instance();

//! Register a pick handler to deal with all Hydra scene index prims
//! under prefix.
//! under prefix. An empty prefix, or a prefix that is the absolute
//! root, are illegal.
/*!
\return False if an ancestor, descendant, or prefix itself is found in the registry, true otherwise.
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/mayaHydra/ufeExtensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ add_library(${TARGET_NAME} SHARED)
# -----------------------------------------------------------------------------
target_sources(${TARGET_NAME}
PRIVATE
cvtTypeUtils.h
cvtTypeUtils.cpp
Global.cpp
)

Expand Down
2 changes: 2 additions & 0 deletions lib/mayaHydra/ufeExtensions/cvtTypeUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include <cstring> // memcpy

// Type conversion utilities.

namespace UfeExtensions {

//! Copy the argument matrix into the return matrix.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ TEST(TestPickHandlerRegistry, testRegistry)
// Can't register for an empty prefix.
ASSERT_FALSE(r.Register(SdfPath(), dummy));

// Can't register for an absolute root prefix.
ASSERT_FALSE(r.Register(SdfPath::AbsoluteRootPath(), dummy));

std::vector<SdfPath> registered;
auto fooBarH = TestPickHandler::create();
SdfPath fooBarP("/foo/bar");
Expand Down

0 comments on commit 5214878

Please sign in to comment.