Fix subdivision when primvars are set in parent primitives #1983
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request
The test done by
HasAuthoredAttribute
that is used to properly set subdivision attributes, is not seeing the primvars authored in parent primitives. I replaced these calls with a new functionHasConstantPrimvar
that looks for this primvar name in the context list of primvars.I considered different approaches, for example extending
HasAuthoredAttribute
to invoke itself recursively on parent primitives.However, it would be a bit expensive to search for an attribute based on its name (i.e. with a map search) through the whole hierarchy and for each node.
Here, even though we're doing a linear search over the list of primvars, it should be more efficient as TfTokens are fast to compare.
I also saw a few occurrences of
HasAuthoredValue
on attributesmoothing
to enable it by default. This shouldn't be needed anymore since smoothing is now enabled by default in arnold polymeshesIssues fixed in this pull request
Fixes #1982