Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HYDRA-845 : Selection highlighting for point instancing of meshes #132

Merged

Conversation

debloip-adsk
Copy link
Collaborator

@debloip-adsk debloip-adsk commented Jun 4, 2024

This PR implements point instance selection highlighting of meshes for point instancer, instance & prototype selections.

Note that as part of this PR, the Fvp::PathInterface::SceneIndexPath method was renamed to ConvertUfePathToHydraSelections, and now requires returning a vector of a new struct PrimSelectionInfo, each containing an SdfPath and a selection data source.

Following this, the lead object path tracker now also supports multiple lead prim paths.

@debloip-adsk debloip-adsk marked this pull request as ready for review June 5, 2024 17:40
@debloip-adsk debloip-adsk self-assigned this Jun 5, 2024
Copy link
Collaborator Author

@debloip-adsk debloip-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not much to add that isn't already in the Markdown doc or in code comments, except for the following two questions :

  • I've renamed SceneIndexPath to ConvertUfePathToHydraSelections, but would we prefer keeping both? Since sometimes we may not really care about the selections themselves. Note that different Ufe::Paths could end up mapping to the same SdfPaths though, for example in the case of point instancer vs. instance selection, where the Ufe::Paths would differ but the SdfPaths would both end up pointing to the instancer.
  • Should we rename Fvp::PathInterface, since it's not strictly about paths anymore? I would think how we name it also depends on if we keep SceneIndexPath or not, and what other functionality we could end up putting in it.

Copy link
Collaborator

@ppt-adsk ppt-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic work, pretty impressive how much additional complexity all this tracking requires... Minor comments from me in this pull request.

As for the path interface, I'm still uncertain as to whether it's a selection-centric class, or a path mapper class? Is there another application besides selection that we don't yet know about? In the end though, this kind of fundamental questioning is outside the scope of this pull request, so we have time to ponder this.

lib/mayaHydra/hydraExtensions/mhLeadObjectPathTracker.cpp Outdated Show resolved Hide resolved
doc/selectionHighlightingArchitecture.md Outdated Show resolved Hide resolved
lib/mayaHydra/hydraExtensions/sceneIndex/registration.cpp Outdated Show resolved Hide resolved
Comment on lines +90 to +94
#if HD_API_VERSION < 66
const_cast<HdInstancerTopologySchema&>(originalInstancerTopology).GetMask()->GetTypedValue(0);
#else
originalInstancerTopology.GetMask()->GetTypedValue(0);
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe factor this out in an unnamed namespace function?

Suggested change
#if HD_API_VERSION < 66
const_cast<HdInstancerTopologySchema&>(originalInstancerTopology).GetMask()->GetTypedValue(0);
#else
originalInstancerTopology.GetMask()->GetTypedValue(0);
#endif
inline HdInstancerTopologySchema& topologySchema(HdInstancerTopologySchema& t)
#if HD_API_VERSION < 66
return const_cast<HdInstancerTopologySchema&>(t);
#else
return t;
#endif

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I see what value this brings. If the method takes in a const reference, and does whatever treatment it needs to return a non-const reference, isn't that just a more complicated way of doing a flat-out const_cast? And if it takes in a non-const reference, then there would be no need to use const_cast in the first place? To me this preprocessor bit is mostly to confine the const_casting to the old Hydra versions, and use the new ones for the current & future (which would also allow us to remove the old API usage at a future point should we wish to do so)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was just a suggestion for readability and being closer to Don't Repeat Yourself. You have the const_cast ifdef twice, and inside the ifdef you're repeating code. No big deal though.

doc/selectionHighlightingArchitecture.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@ppt-adsk ppt-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!

doc/selectionHighlightingArchitecture.md Outdated Show resolved Hide resolved
Comment on lines +90 to +94
#if HD_API_VERSION < 66
const_cast<HdInstancerTopologySchema&>(originalInstancerTopology).GetMask()->GetTypedValue(0);
#else
originalInstancerTopology.GetMask()->GetTypedValue(0);
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was just a suggestion for readability and being closer to Don't Repeat Yourself. You have the const_cast ifdef twice, and inside the ifdef you're repeating code. No big deal though.

@debloip-adsk
Copy link
Collaborator Author

@debloip-adsk debloip-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Jun 12, 2024
@lilike-adsk lilike-adsk merged commit a9d0fea into dev Jun 13, 2024
10 checks passed
@lilike-adsk lilike-adsk deleted the debloip/HYDRA-845/mesh-point-instancing-selection-highlight branch June 13, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants