Consider the following layer– The goal of this workflow is to support assets made up of “refineable parts”.
#usda 1.0
def "asset"
{
class "parts"
{
def "metapart" {
def "subpart_1" (specializes = </asset/parts/subpart>) {
}
def "subpart_2" (specializes = </asset/parts/subpart>) {
}
}
def "subpart" {
def "sphere" {
double radius = 0.1234
}
}
}
def "geometry" {
def "part_0" (specializes=</asset/parts/subpart>){}
def "part_1" (specializes=</asset/parts/metapart>){}
def "part_2" (specializes=</asset/parts/metapart>){}
}
}
def "set"
{
def "asset_1" (references = </asset>)
{
over "parts" {
over "subpart" {
over "sphere" {
double radius = 100.0
}
}
}
}
def "asset_2" (references = </asset>)
{
over "parts" {
over "subpart" {
over "sphere" {
double radius = 200.0
}
}
}
}
}
The set contains to references to asset. asset_1 has refined its parts/subpart/sphere‘s radius to 100 and asset_2 has refined its radius to 200.0.
part_0 directly specializes subpart and respects the refinement. Curiously, part_1 and part_2 specialize a metapart which contains two specializations of subpart. These specializations do not respect the specialization.
Querying the property stacks of each part’s spheres–
"/set/asset_2/geometry/part_1/subpart_1/sphere.radius"
"/set/asset_2/geometry/part_2/subpart_1/sphere.radius"
"/set/asset_2/geometry/part_0/sphere.radius"
you will see both the originating opinion in /asset/parts/subpart/sphere and the intended refinement, but you will see them appear in opposite orders. part_0 prefers the refinement residing at /set/asset_2/geometry/parts/subpart/sphere.radiuswhile part_1/subpart_1 and part_2/subpart_2 prefer /asset/parts/subpart/sphere.radius.
I can’t quite reason about why nesting the specialization makes the refinement weaker. Interestingly, changing the subpart_1 and subpart_2 to use inherits makes the refinements stronger in all cases. (This isn’t necessarily a solution though, as you lose the ability to prefer metapart refinements to the subpart.)
I’m curious if anyone has found success nesting specializes or if there’s a simple explanation for the behavior.