-
Notifications
You must be signed in to change notification settings - Fork 202
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
Add UFE path handling and utilities to support paths that identify point instances of a PointInstancer #1027
Add UFE path handling and utilities to support paths that identify point instances of a PointInstancer #1027
Conversation
b458b52
to
5d6e227
Compare
5d6e227
to
7aebebd
Compare
Just rebased to resolve conflicts from the merge of #1039. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks simple enough! There are most likely some things where I don't completely understand the UFE parenting model for point instancer instances (pointed out in code comments), but otherwise seems like a good data model place to start!
7aebebd
to
32299f7
Compare
32299f7
to
9c50995
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one change where you can add a point instancer and point instance UFE data model section to UsdSceneItem, and I think we're done!
…nd accessor for retrieving it Additional class documentation was added to describe the handling of point instances generated by PointInstancer prims, and how their semantics differ between USD and UFE.
…for a USD path If an instanceIndex is provided, the path segment for a point instance with that USD path and index is returned.
Because of the conflicting Python bindings between USD and UFE, we cannot return an instance of Ufe::PathSegment and instead must return the path segment as a string.
…ce index tail component from a Ufe::Path
…ePathToPrim() This will become relevant when the Viewport 2.0 render delegate appends an instance index path component to the UFE paths of PointInstancer prims in order to uniquely identify point instances. Trying to get the PointInstancer prim using the full path would fail, since the path includes the instance index component.
…epresenting point instances
For UFE versions before version 2, the work that was previously local to ufePathToPrim() to turn a std::string into a Ufe::Path was broken out into a helper function so that it could be shared between ufePathToPrim() and ufePathToInstanceIndex().
Because of the conflicting Python bindings between USD and UFE, we cannot receive or return instances of Ufe::Path and instead must use strings.
When a scene item represents a point instance, its Ufe::Path will end with a path component that is all digits representing the instance index (e.g. ".../PointInstancer/12345"). Point instances are generated by a PointInstancer prim based on data members on the PointInstancer and the prototype being instanced. There is otherwise no direct mapping of a point instance to any location in USD namespace. As a result, we treat point instances as child-less in UFE. For the same reason, point instances don't really have a "parent" in USD either, but in UFE we consider the PointInstancer prim the "parent" of a point instance it generated. This allows pick-walking from a point instance up to the PointInstancer prim that generated it. Note that the reverse is *not* true. The point instances generated by a PointInstancer cannot be retrieved by querying the PointInstancer for its children.
…ndling of point instances
9c50995
to
e9de85a
Compare
This PR represents all of the plumbing necessary to work with UFE paths that identify individual instances of a
PointInstancer
prim. It was distilled from #936 as well as some offline discussion. This PR stops short of making the Viewport 2.0 render delegate point instance selection-aware. That and manipulation will be added in subsequent PRs.The path to a point instance is constructed by simply appending the instance's
instanceIndex
as a final component of the USDUfe::PathSegment
, for example:/PointInstancer/12345
. This is a valid path in UFE, but it is not a validSdfPath
, since all elements of anSdfPath
need to be C identifiers and cannot start with a digit. We take advantage of this fact to quickly identifyUfe::Paths
to point instances and avoid having to do too much string manipulation. Utilities were added and wrapped to Python to handle adding or stripping theinstanceIndex
component when necessary. All of the path manipulation specifics about how point instance paths are constructed or parsed should be consolidated inlib/mayaUsd/ufe/Utils.cpp
, so if we choose to change the path representation or apply a similar pattern to other prim component types (e.g. individual points/edges/faces of aMesh
prim), we should hopefully only have one place we'll need to change it.Test USD files and Maya scenes with proxies that use them were added at three different scales: 14 instances, 7,000 instances, and 70,000 instances. The test added in this PR only makes use of the 14 instance sample, but the imaging and manipulation tests to be added in subsequent PRs will also use the large scale samples.