Hello,
I’m trying to debug why the variant selection of an asset in one of our production scenes isn’t composing quite as we would expect. What we’re seeing is that when using AddVariant on one of our variant sets, another variant set is actually switching it’s variant selection. I suspect this has to do with the fact that our variant sets are nested and we’re hitting a strange subtlety with composition, but I can’t figure out how it’s happening. I wish I could share a scene, but I haven’t been able to reproduce with a simpler non-production case yet. For context, we have a variant set foo (which has a few variants A, B, C) which is currently set to variant B. Inside variant foo, we have a nested variant set bar which has a few variants (X, Y). We make a VariantEditContext for foo, and add variant Z to variant set bar. When this happens foo somehow switches to have A selected. (Note: that I’ve simplified this a bit since foo is actually nested within another variant set above it).
What I’ve tried so far is looping over the prim specs in the PrimStack and finding out which ones are setting a variant selection for variant set foo. What’s odd is the strongest spec is setting the variant selection for variant set foo to B, so shouldn’t that mean that B should be the composed selection?
The other thing I’ve tried is to examine the variant selections in the PcpPrimIndex. What I get seems a bit strange:
>> primIndex = prim.GetPrimIndex()
>> primIndex.ComposeAuthoredVariantSelections()
{}
>> primIndex.GetSelectionAppliedForVariantSet('foo')
'A'
>> expandedPrimIndex = prim.ComputeExpandedPrimIndex()
>> expandedPrimIndex.ComposeAuthoredVariantSelections()
{'foo': 'B'
'bar': 'Y'}
>> expandedPrimIndex.GetSelectionAppliedForVariantSet('foo')
'A'
>> prim.GetVariantSet('foo').GetVariantNames()
['A', 'B']
What could I be missing here? I feel like potentially the strongest spec with the B variant selection isn’t being applied. Is there something else I can try to debug the variant selection composition in more detail to figure out how the A is getting applied?
Thanks,
Cameron