pcp: Add/update museum tests for upcoming ancestral variant fix
authorsunyab <sunyab@users.noreply.github.com>
Sat, 3 Feb 2024 03:24:57 +0000 (19:24 -0800)
committerpixar-oss <pixar-oss@users.noreply.github.com>
Sat, 3 Feb 2024 03:24:57 +0000 (19:24 -0800)
The new test cases capture the current behavior in a variety of
corner-ish cases that caused internal tests to fail during
development of the fix mentioned above. Checking these in
first helps verify that these behaviors do not change after
that fix lands.

(Internal change: 2313409)

27 files changed:
pxr/usd/pcp/CMakeLists.txt
pxr/usd/pcp/testenv/testPcpMuseum_ErrorOpinionAtRelocationSource.testenv/ErrorOpinionAtRelocationSource/ref.sdf [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_ErrorOpinionAtRelocationSource.testenv/ErrorOpinionAtRelocationSource/root.sdf
pxr/usd/pcp/testenv/testPcpMuseum_ErrorOpinionAtRelocationSource.testenv/baseline/compositionErrors_ErrorOpinionAtRelocationSource.txt
pxr/usd/pcp/testenv/testPcpMuseum_ErrorOpinionAtRelocationSource.testenv/baseline/compositionResults_ErrorOpinionAtRelocationSource.txt
pxr/usd/pcp/testenv/testPcpMuseum_ErrorPermissionDenied.testenv/ErrorPermissionDenied/baseline/compositionErrors_ErrorPermissionDenied.txt
pxr/usd/pcp/testenv/testPcpMuseum_ErrorPermissionDenied.testenv/ErrorPermissionDenied/baseline/compositionResults_ErrorPermissionDenied.txt
pxr/usd/pcp/testenv/testPcpMuseum_ErrorPermissionDenied.testenv/ErrorPermissionDenied/ref.sdf [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_ErrorPermissionDenied.testenv/ErrorPermissionDenied/root.sdf
pxr/usd/pcp/testenv/testPcpMuseum_SubrootReferenceAndVariants2.testenv/SubrootReferenceAndVariants2/CharGroup.sdf [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_SubrootReferenceAndVariants2.testenv/SubrootReferenceAndVariants2/root.sdf [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_SubrootReferenceAndVariants2.testenv/baseline/compositionResults_SubrootReferenceAndVariants2.txt [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/TrickyMultipleRelocations5/chargroup.sdf [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/TrickyMultipleRelocations5/relocates.sdf [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/TrickyMultipleRelocations5/root.sdf [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/TrickyMultipleRelocations5/variant.sdf [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/baseline/compositionResults_TrickyMultipleRelocations5.txt [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantFallbackDrivingAuthoredVariant.testenv/TrickyVariantFallbackDrivingAuthoredVariant/root.sdf
pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantFallbackDrivingAuthoredVariant.testenv/baseline/compositionResults_TrickyVariantFallbackDrivingAuthoredVariant.txt
pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantOverrideOfFallback.testenv/TrickyVariantOverrideOfFallback/root.sdf
pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantOverrideOfFallback.testenv/baseline/compositionResults_TrickyVariantOverrideOfFallback.txt
pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantSelectionInVariant.testenv/TrickyVariantSelectionInVariant/root.sdf
pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantSelectionInVariant2.testenv/TrickyVariantSelectionInVariant2/root.sdf [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantSelectionInVariant2.testenv/baseline/compositionResults_TrickyVariantSelectionInVariant2.txt [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantWeakerSelection4.testenv/TrickyVariantWeakerSelection4/geo.sdf [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantWeakerSelection4.testenv/TrickyVariantWeakerSelection4/root.sdf [new file with mode: 0644]
pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantWeakerSelection4.testenv/baseline/compositionResults_TrickyVariantWeakerSelection4.txt [new file with mode: 0644]

index c5479b47f1e4f35189c74eb85290c3bf93d9458d..9a0a9f11d738b001f8c72042af2ad88a30c269ad 100644 (file)
@@ -563,6 +563,11 @@ pxr_install_test_dir(
     DEST testPcpMuseum_SubrootReferenceAndVariants
 )
 
+pxr_install_test_dir(
+    SRC testenv/testPcpMuseum_SubrootReferenceAndVariants2.testenv
+    DEST testPcpMuseum_SubrootReferenceAndVariants2
+)
+
 pxr_install_test_dir(
     SRC testenv/testPcpMuseum_TimeCodesPerSecond.testenv
     DEST testPcpMuseum_TimeCodesPerSecond1
@@ -728,6 +733,11 @@ pxr_install_test_dir(
     DEST testPcpMuseum_TrickyVariantSelectionInVariant
 )
 
+pxr_install_test_dir(
+    SRC testenv/testPcpMuseum_TrickyVariantSelectionInVariant2.testenv
+    DEST testPcpMuseum_TrickyVariantSelectionInVariant2
+)
+
 pxr_install_test_dir(
     SRC testenv/testPcpMuseum_TrickyVariantWeakerSelection.testenv
     DEST testPcpMuseum_TrickyVariantWeakerSelection
@@ -743,6 +753,11 @@ pxr_install_test_dir(
     DEST testPcpMuseum_TrickyVariantWeakerSelection3
 )
 
+pxr_install_test_dir(
+    SRC testenv/testPcpMuseum_TrickyVariantWeakerSelection4.testenv
+    DEST testPcpMuseum_TrickyVariantWeakerSelection4
+)
+
 pxr_install_test_dir(
     SRC testenv/testPcpMuseum_TrickyClassHierarchy.testenv
     DEST testPcpMuseum_TrickyClassHierarchy
@@ -863,6 +878,11 @@ pxr_install_test_dir(
     DEST testPcpMuseum_TrickyMultipleRelocations4
 )
 
+pxr_install_test_dir(
+    SRC testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv
+    DEST testPcpMuseum_TrickyMultipleRelocations5
+)
+
 pxr_install_test_dir(
     SRC testenv/testPcpMuseum_TrickyMultipleRelocationsAndClasses.testenv
     DEST testPcpMuseum_TrickyMultipleRelocationsAndClasses
@@ -1304,6 +1324,13 @@ pxr_register_test(testPcpMuseum_SubrootReferenceAndVariants
         SDF_SCHEMA_PROHIBIT_INVALID_VARIANT_SELECTIONS=0
 )
 
+pxr_register_test(testPcpMuseum_SubrootReferenceAndVariants2
+    PYTHON
+    COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults SubrootReferenceAndVariants2/root.sdf" 
+    STDOUT_REDIRECT compositionResults_SubrootReferenceAndVariants2.txt
+    DIFF_COMPARE compositionResults_SubrootReferenceAndVariants2.txt
+)
+
 pxr_register_test(testPcpMuseum_TimeCodesPerSecond1
     PYTHON
     COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults TimeCodesPerSecond/root.sdf" 
@@ -1552,6 +1579,13 @@ pxr_register_test(testPcpMuseum_TrickyVariantSelectionInVariant
     DIFF_COMPARE compositionResults_TrickyVariantSelectionInVariant.txt 
 )
 
+pxr_register_test(testPcpMuseum_TrickyVariantSelectionInVariant2
+    PYTHON
+    COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults TrickyVariantSelectionInVariant2/root.sdf" 
+    STDOUT_REDIRECT compositionResults_TrickyVariantSelectionInVariant2.txt
+    DIFF_COMPARE compositionResults_TrickyVariantSelectionInVariant2.txt 
+)
+
 pxr_register_test(testPcpMuseum_TrickyVariantWeakerSelection
     PYTHON
     COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults TrickyVariantWeakerSelection/root.sdf" 
@@ -1573,6 +1607,13 @@ pxr_register_test(testPcpMuseum_TrickyVariantWeakerSelection3
     DIFF_COMPARE compositionResults_TrickyVariantWeakerSelection3.txt 
 )
 
+pxr_register_test(testPcpMuseum_TrickyVariantWeakerSelection4
+    PYTHON
+    COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults TrickyVariantWeakerSelection4/root.sdf" 
+    STDOUT_REDIRECT compositionResults_TrickyVariantWeakerSelection4.txt
+    DIFF_COMPARE compositionResults_TrickyVariantWeakerSelection4.txt 
+)
+
 pxr_register_test(testPcpMuseum_TrickyClassHierarchy
     PYTHON
     COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults TrickyClassHierarchy/root.sdf" 
@@ -1744,6 +1785,13 @@ pxr_register_test(testPcpMuseum_TrickyMultipleRelocations4
     DIFF_COMPARE compositionResults_TrickyMultipleRelocations4.txt compositionErrors_TrickyMultipleRelocations4.txt 
 )
 
+pxr_register_test(testPcpMuseum_TrickyMultipleRelocations5
+    PYTHON
+    COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults TrickyMultipleRelocations5/root.sdf" 
+    STDOUT_REDIRECT compositionResults_TrickyMultipleRelocations5.txt
+    DIFF_COMPARE compositionResults_TrickyMultipleRelocations5.txt
+)
+
 pxr_register_test(testPcpMuseum_TrickyMultipleRelocationsAndClasses
     PYTHON
     COMMAND "${CMAKE_INSTALL_PREFIX}/tests/testPcpCompositionResults TrickyMultipleRelocationsAndClasses/root.sdf" 
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_ErrorOpinionAtRelocationSource.testenv/ErrorOpinionAtRelocationSource/ref.sdf b/pxr/usd/pcp/testenv/testPcpMuseum_ErrorOpinionAtRelocationSource.testenv/ErrorOpinionAtRelocationSource/ref.sdf
new file mode 100644 (file)
index 0000000..6f4ce22
--- /dev/null
@@ -0,0 +1,14 @@
+#sdf 1.4.32
+
+def "Ref"
+{
+    def "Child"
+    {
+        def "Child2"
+        {
+            def "Class"
+            {
+            }
+        }
+    }
+}
index 72aa29048cfeb0dfbe1e4a571e9b4639c78daaf7..53a39e5261327c9b643e531c0f42da6e50ba0154 100644 (file)
@@ -1,14 +1,18 @@
 #sdf 1.4.32
 (
     """
-    This file has a CharRig with a reference to a nested PathRig.
-    The Path prim under the PathRig is relocated to the anim scope,
-    but there is also an illegal override at the old location.
-    This should be reported as an error and ignored.
+    This file has several examples of invalid opinions at
+    relocation source locations.
     """
 )
 
 def "CharRig" (
+    """
+    CharRig has a reference to a nested PathRig.
+    The Path prim under the PathRig is relocated to the anim scope,
+    but there is also an illegal override at the old location.
+    This should be reported as an error and ignored.
+    """
     relocates = {
         </CharRig/Rig/PathRig/Path>: </CharRig/Anim/Path>
     }
@@ -33,3 +37,69 @@ def "CharRig" (
         }
     }
 }
+
+def "VariantAtRelocateSource" (
+    """
+    The child prim Inherit inherits from the prim Sibling/Class,
+    and the prim Sibling was relocated from Child/Child2.
+
+    During composition, the ancestral variant set and selection authored on
+    Child should contribute opinions, but the variant on Child/Child2 should
+    not. This is because composition prohibits opinions over the source of a
+    relocated prim, and Child/Child2 is the source for the relocated prim
+    Sibling.
+    """
+    references = @./ref.sdf@</Ref>
+    relocates = {
+        <Child/Child2> : <Sibling>
+    }
+)
+{
+    over "Child" (
+        variantSets = "child"
+        variants = {
+            string child = "a"
+        }
+    )
+    {
+        variantSet "child" = {
+            "a" {
+                over "Child2"
+                {
+                    over "Class"
+                    {
+                    }
+                }
+            }
+        }
+
+        over "Child2" (
+            variantSets = "child2"
+            variants = {
+                string child2 = "a"
+            }
+        )
+        {
+            variantSet "child2" = {
+                "a" {
+                    over "Class"
+                    {
+                    }
+                }
+            }
+        }
+    }
+
+    over "Sibling"
+    {
+        over "Class"
+        {
+        }
+    }
+    
+    def "Inherit" (
+        inherits = </VariantAtRelocateSource/Sibling/Class>
+    )
+    {
+    }
+}
index 652e55208330b13376196dd531f29f112be1363e..44d401b782229cb5d5d8cd4bc7d866147ffe81e8 100644 (file)
@@ -3,3 +3,13 @@ Errors while composing </CharRig/Anim/Path>
 
 The layer @ErrorOpinionAtRelocationSource/root.sdf@ has an invalid opinion at the relocation source path </CharRig/Rig/PathRig/Path>, which will be ignored.
 
+------------------------------------------------------------------------
+Errors while composing </VariantAtRelocateSource/Sibling>
+
+The layer @ErrorOpinionAtRelocationSource/root.sdf@ has an invalid opinion at the relocation source path </VariantAtRelocateSource/Child/Child2>, which will be ignored.
+
+------------------------------------------------------------------------
+Errors while composing </VariantAtRelocateSource/Inherit>
+
+The layer @ErrorOpinionAtRelocationSource/root.sdf@ has an invalid opinion at the relocation source path </VariantAtRelocateSource/Child/Child2>, which will be ignored.
+
index f6280a854d1dd1444872a655bc4733c2a6f99575..31604adf788933f5b177c1fb1b7ec013462cb558 100644 (file)
@@ -47,3 +47,55 @@ Prim Stack:
 Prohibited child names:
      ['Path']
 
+------------------------------------------------------------------------
+Results for composing </VariantAtRelocateSource>
+
+Prim Stack:
+    root.sdf             /VariantAtRelocateSource
+    ref.sdf              /Ref
+
+Child names:
+     ['Child', 'Sibling', 'Inherit']
+
+------------------------------------------------------------------------
+Results for composing </VariantAtRelocateSource/Child>
+
+Prim Stack:
+    root.sdf             /VariantAtRelocateSource/Child
+    root.sdf             /VariantAtRelocateSource/Child{child=a}
+    ref.sdf              /Ref/Child
+
+Variant Selections:
+    {child = a}
+
+Prohibited child names:
+     ['Child2']
+
+------------------------------------------------------------------------
+Results for composing </VariantAtRelocateSource/Sibling>
+
+Prim Stack:
+    root.sdf             /VariantAtRelocateSource/Sibling
+    root.sdf             /VariantAtRelocateSource/Child{child=a}Child2
+    ref.sdf              /Ref/Child/Child2
+
+Child names:
+     ['Class']
+
+------------------------------------------------------------------------
+Results for composing </VariantAtRelocateSource/Sibling/Class>
+
+Prim Stack:
+    root.sdf             /VariantAtRelocateSource/Sibling/Class
+    root.sdf             /VariantAtRelocateSource/Child{child=a}Child2/Class
+    ref.sdf              /Ref/Child/Child2/Class
+
+------------------------------------------------------------------------
+Results for composing </VariantAtRelocateSource/Inherit>
+
+Prim Stack:
+    root.sdf             /VariantAtRelocateSource/Inherit
+    root.sdf             /VariantAtRelocateSource/Sibling/Class
+    root.sdf             /VariantAtRelocateSource/Child{child=a}Child2/Class
+    ref.sdf              /Ref/Child/Child2/Class
+
index 92666ef37deae3416d7a243aed62e69a61fdd26c..50b848cdb547aaf433d5b7c9eb168dfb25d9893c 100644 (file)
@@ -20,3 +20,19 @@ CANNOT inherit from:
 @ErrorPermissionDenied/root.sdf@</_PrivateClass>
 which is private.
 
+------------------------------------------------------------------------
+Errors while composing </VariantsOpinionsOnRestrictedPrim/Child/Child2>
+
+@ErrorPermissionDenied/root.sdf@</VariantsOpinionsOnRestrictedPrim/Child{child=a}Child2>
+will be ignored because:
+@ErrorPermissionDenied/ref.sdf@</Ref/Child/Child2>
+is private and overrides its opinions.
+@ErrorPermissionDenied/root.sdf@</VariantsOpinionsOnRestrictedPrim/Child/Child2{child2=a}>
+will be ignored because:
+@ErrorPermissionDenied/ref.sdf@</Ref/Child/Child2>
+is private and overrides its opinions.
+@ErrorPermissionDenied/root.sdf@</VariantsOpinionsOnRestrictedPrim/Child/Child2>
+will be ignored because:
+@ErrorPermissionDenied/ref.sdf@</Ref/Child/Child2>
+is private and overrides its opinions.
+
index 7eaa75c6f1a9d24fae811b29852b74789941ece4..e67538e7b5982f13d807040b9caa219fe85c6c87 100644 (file)
@@ -75,3 +75,36 @@ Property stacks:
 /Model.attr:
     root.sdf             /Model.attr
 
+------------------------------------------------------------------------
+Results for composing </VariantsOpinionsOnRestrictedPrim>
+
+Prim Stack:
+    root.sdf             /VariantsOpinionsOnRestrictedPrim
+    ref.sdf              /Ref
+
+Child names:
+     ['Child']
+
+------------------------------------------------------------------------
+Results for composing </VariantsOpinionsOnRestrictedPrim/Child>
+
+Prim Stack:
+    root.sdf             /VariantsOpinionsOnRestrictedPrim/Child
+    root.sdf             /VariantsOpinionsOnRestrictedPrim/Child{child=a}
+    ref.sdf              /Ref/Child
+
+Variant Selections:
+    {child = a}
+
+Child names:
+     ['Child2']
+
+------------------------------------------------------------------------
+Results for composing </VariantsOpinionsOnRestrictedPrim/Child/Child2>
+
+Prim Stack:
+    ref.sdf              /Ref/Child/Child2
+
+Variant Selections:
+    {child2 = a}
+
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_ErrorPermissionDenied.testenv/ErrorPermissionDenied/ref.sdf b/pxr/usd/pcp/testenv/testPcpMuseum_ErrorPermissionDenied.testenv/ErrorPermissionDenied/ref.sdf
new file mode 100644 (file)
index 0000000..297564e
--- /dev/null
@@ -0,0 +1,13 @@
+#sdf 1.4.32
+
+def "Ref"
+{
+    def "Child"
+    {
+        def "Child2" (
+            permission = private
+        )
+        {
+        }
+    }
+}
index 0ba71e1594da08c47e5d5a49e5be4ade6a07f6a0..058b0f7654e10a4844d5dd7eed100283c72dc227 100644 (file)
@@ -1,25 +1,21 @@
 #sdf 1.4.32
 (
     """
-    This example has a prim, Root, with a reference to
-    A.sdf. Root has an opinion about attr, which is
+    This file has examples of prims with invalid opinions
+    due to prim and property permission restrictions.
+    """
+)
+
+def "Root" (
+    """
+    Root has a reference to A.sdf.
+    Root has an opinion about attr, which is
     private in A.sdf. This results in a property
     permission error. In addition, Root has opinions about
     a relationship and relational attribute that has been 
     marked private in A.sdf. This should also result in 
     permission errors, and the opinions should be ignored.
-
-    There is another prim, Parent, with a child prim, Child.
-    Parent has a reference to A.sdf, where Child is
-    private. This results in a prim permission error.
-
-    There is also a prim, Model, which inherits from
-    _PrivateClass. Since _PrivateClass is private, this
-    will result in an arc permission error.
     """
-)
-
-def "Root" (
     add references = @./A.sdf@</A>
 )
 {
@@ -29,7 +25,12 @@ def "Root" (
     add rel privateRel = </Root.localAttr>
     add rel publicRel = </Root.A_attr>
 }
+
 def "Parent" (
+    """
+    Parent has a reference to A.sdf, where Child is
+    private. This results in a prim permission error.
+    """
     add references = @./A.sdf@</Parent>
 )
 {
@@ -37,15 +38,62 @@ def "Parent" (
     {
     }
 }
+
 def "_PrivateClass" (
     permission = private
 )
 {
     custom double attr = -1
 }
+
 def "Model" (
+    """
+    Model inherits from _PrivateClass. Since _PrivateClass is
+    private, this will result in an arc permission error.
+    """
     add inherits = </_PrivateClass>
 )
 {
     custom double attr = 0
 }
+
+def "VariantsOpinionsOnRestrictedPrim" (
+    """
+    This prim has child prims Child and Child/Child2 that
+    come from across the reference. Child/Child2 has also
+    been marked as private across the reference. The opinions
+    on Child/Child2 in this layer stack defined in the
+    different variants should all be ignored.
+    """
+    references = @./ref.sdf@</Ref>
+)
+{
+    over "Child" (
+        variantSets = "child"
+        variants = {
+            string child = "a"
+        }
+    )
+    {
+        variantSet "child" = {
+            "a" {
+                over "Child2"
+                {
+                }
+            }
+        }
+
+        over "Child2" (
+            variantSets = "child2"
+            variants = {
+                string child2 = "a"
+            }
+        )
+        {
+            variantSet "child2" = {
+                "a" {
+                }
+            }
+        }
+    }
+}
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_SubrootReferenceAndVariants2.testenv/SubrootReferenceAndVariants2/CharGroup.sdf b/pxr/usd/pcp/testenv/testPcpMuseum_SubrootReferenceAndVariants2.testenv/SubrootReferenceAndVariants2/CharGroup.sdf
new file mode 100644 (file)
index 0000000..de9d421
--- /dev/null
@@ -0,0 +1,41 @@
+#sdf 1.4.32
+
+def "Inherit"
+{
+    def "CHARACTER"
+    {
+    }
+}
+
+def "Ref" (
+    inherits = </Inherit>
+)
+{
+    def "CHARACTER"
+    {
+    }
+}
+
+def "CHARGROUP" (
+    variantSets = "v"
+    variants = {
+        string v = "x"
+    }
+)
+{
+    over "CHARACTER"
+    {
+    }
+
+    variantSet "v" = {
+        "x" (
+            references = </Ref>
+        ) {
+            over "CHARACTER"
+            {
+            }
+        }
+    }
+}
+
+
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_SubrootReferenceAndVariants2.testenv/SubrootReferenceAndVariants2/root.sdf b/pxr/usd/pcp/testenv/testPcpMuseum_SubrootReferenceAndVariants2.testenv/SubrootReferenceAndVariants2/root.sdf
new file mode 100644 (file)
index 0000000..f46cabe
--- /dev/null
@@ -0,0 +1,27 @@
+#sdf 1.4.32
+(
+    """
+    This museum test exercises behavior with subroot references,
+    ancestral variant selections, and inherit arcs.
+    """
+)
+
+def "Inherit"
+{
+    def "CHARACTER"
+    {
+    }
+}
+
+def "Character" (
+    """
+    The ancestral /CHARGROUP prim in the reference has a variant
+    that brings in another reference, which inherits /Inherit.
+    The inherit arc should be implied back to the root layer
+    stack and cause the /Inherit/CHARACTER opinion authored in
+    this layer to be included.
+    """
+    references = @./CharGroup.sdf@</CHARGROUP/CHARACTER>
+)
+{
+}
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_SubrootReferenceAndVariants2.testenv/baseline/compositionResults_SubrootReferenceAndVariants2.txt b/pxr/usd/pcp/testenv/testPcpMuseum_SubrootReferenceAndVariants2.testenv/baseline/compositionResults_SubrootReferenceAndVariants2.txt
new file mode 100644 (file)
index 0000000..57b081d
--- /dev/null
@@ -0,0 +1,32 @@
+Loading @SubrootReferenceAndVariants2/root.sdf@
+
+------------------------------------------------------------------------
+Layer Stack:
+     root.sdf
+
+------------------------------------------------------------------------
+Results for composing </Inherit>
+
+Prim Stack:
+    root.sdf             /Inherit
+
+Child names:
+     ['CHARACTER']
+
+------------------------------------------------------------------------
+Results for composing </Inherit/CHARACTER>
+
+Prim Stack:
+    root.sdf             /Inherit/CHARACTER
+
+------------------------------------------------------------------------
+Results for composing </Character>
+
+Prim Stack:
+    root.sdf             /Character
+    root.sdf             /Inherit/CHARACTER
+    CharGroup.sdf        /CHARGROUP/CHARACTER
+    CharGroup.sdf        /CHARGROUP{v=x}CHARACTER
+    CharGroup.sdf        /Ref/CHARACTER
+    CharGroup.sdf        /Inherit/CHARACTER
+
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/TrickyMultipleRelocations5/chargroup.sdf b/pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/TrickyMultipleRelocations5/chargroup.sdf
new file mode 100644 (file)
index 0000000..294ab3c
--- /dev/null
@@ -0,0 +1,9 @@
+#sdf 1.4.32
+
+def "CHARGROUP"
+{
+    def "CHARACTER"
+    {
+    }
+}
+
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/TrickyMultipleRelocations5/relocates.sdf b/pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/TrickyMultipleRelocations5/relocates.sdf
new file mode 100644 (file)
index 0000000..91c6dc6
--- /dev/null
@@ -0,0 +1,14 @@
+#sdf 1.4.32
+
+over "Group" (
+    references = @./chargroup.sdf@</CHARGROUP>
+    relocates = {
+        <CHARACTER>: <Character>, 
+    }
+)
+{
+    over "Character"
+    {
+    }
+}
+
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/TrickyMultipleRelocations5/root.sdf b/pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/TrickyMultipleRelocations5/root.sdf
new file mode 100644 (file)
index 0000000..47908b6
--- /dev/null
@@ -0,0 +1,20 @@
+#sdf 1.4.32
+(
+    """
+    This museum test uses multiple relocations, one here in the
+    root layer and one in a variant further down a chain of
+    references.
+    """
+)
+
+def "Group" (
+    references = @./variant.sdf@</Group>
+    relocates = {
+        <Character>: <Model>,
+    }
+)
+{
+    over "Model"
+    {
+    }
+}
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/TrickyMultipleRelocations5/variant.sdf b/pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/TrickyMultipleRelocations5/variant.sdf
new file mode 100644 (file)
index 0000000..c9ee45c
--- /dev/null
@@ -0,0 +1,24 @@
+#sdf 1.4.32
+
+def "Group" (
+    variantSets = "v"
+    variants = {
+        string v = "x"
+    }
+)
+{
+    variantSet "v" = {
+        "x" (
+            references = @./relocates.sdf@</Group>
+        ) {
+            over "Character"
+            {
+            }
+        }
+    }
+
+    over "Character"
+    {
+    }
+}
+
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/baseline/compositionResults_TrickyMultipleRelocations5.txt b/pxr/usd/pcp/testenv/testPcpMuseum_TrickyMultipleRelocations5.testenv/baseline/compositionResults_TrickyMultipleRelocations5.txt
new file mode 100644 (file)
index 0000000..b91108e
--- /dev/null
@@ -0,0 +1,35 @@
+Loading @TrickyMultipleRelocations5/root.sdf@
+
+------------------------------------------------------------------------
+Layer Stack:
+     root.sdf
+
+------------------------------------------------------------------------
+Results for composing </Group>
+
+Prim Stack:
+    root.sdf             /Group
+    variant.sdf          /Group
+    variant.sdf          /Group{v=x}
+    relocates.sdf        /Group
+    chargroup.sdf        /CHARGROUP
+
+Variant Selections:
+    {v = x}
+
+Child names:
+     ['Model']
+
+Prohibited child names:
+     ['CHARACTER', 'Character']
+
+------------------------------------------------------------------------
+Results for composing </Group/Model>
+
+Prim Stack:
+    root.sdf             /Group/Model
+    variant.sdf          /Group/Character
+    variant.sdf          /Group{v=x}Character
+    relocates.sdf        /Group/Character
+    chargroup.sdf        /CHARGROUP/CHARACTER
+
index d6730eeff4faea95565a68c214fddbd1c63c9b46..94cdfcdf8ab4bc8fb4e37840d2c1cdd39699e7a9 100644 (file)
@@ -8,7 +8,7 @@
     """
 )
 
-def Scope "A" (
+def "A" (
     add variantSets = ["vset1", "vset2"]
 )
 {
@@ -23,14 +23,20 @@ def Scope "A" (
     variantSet "vset2" = {
         "authored" (
         ) {
-            def Scope "vset2_authored_child"
+            def "vset2_authored_child"
             {
             }
         }
     }
 }
 
-def Scope "B" (
+def "A_Ancestral" (
+    references = </A/vset2_authored_child>
+)
+{
+}
+
+def "B" (
     add variantSets = ["vset2", "vset1"]
 )
 {
@@ -45,9 +51,15 @@ def Scope "B" (
     variantSet "vset2" = {
         "authored" (
         ) {
-            def Scope "vset2_authored_child"
+            def "vset2_authored_child"
             {
             }
         }
     }
 }
+
+def "B_Ancestral" (
+    references = </B/vset2_authored_child>
+)
+{
+}
index 07ff656026510322e2929da3c17c2559511de68e..eadecfdd5d7ae5deff39097782b4e7374125da1e 100644 (file)
@@ -25,6 +25,13 @@ Results for composing </A/vset2_authored_child>
 Prim Stack:
     root.sdf             /A{vset2=authored}vset2_authored_child
 
+------------------------------------------------------------------------
+Results for composing </A_Ancestral>
+
+Prim Stack:
+    root.sdf             /A_Ancestral
+    root.sdf             /A{vset2=authored}vset2_authored_child
+
 ------------------------------------------------------------------------
 Results for composing </B>
 
@@ -46,3 +53,10 @@ Results for composing </B/vset2_authored_child>
 Prim Stack:
     root.sdf             /B{vset2=authored}vset2_authored_child
 
+------------------------------------------------------------------------
+Results for composing </B_Ancestral>
+
+Prim Stack:
+    root.sdf             /B_Ancestral
+    root.sdf             /B{vset2=authored}vset2_authored_child
+
index f01203ad13ada5e73a39358c1b8f6e9f7cbc21df..def45920b5e2aa89a65f449e51dc998f806fb2ad 100644 (file)
@@ -7,11 +7,15 @@
     """
 )
 
-def Scope "A" (
+def "A" (
     add variantSets = ["vset1"]
     references = [ </B> ]
 )
 {
+    def "Child"
+    {
+    }
+
     variantSet "vset1" = {
         "fallback" (
             # This selection will not apply, because we
@@ -31,17 +35,25 @@ def Scope "A" (
             }
         ) {
             string result = "used_selection";
+
+            def "Child"
+            {
+            }
         }
     }
 }
 
-def scope "B" (
+def "B" (
     add variantSets = ["vset2"]
     variants = {
         string vset2 = "selection"
     }
 )
 {
+    def "Child"
+    {
+    }
+
     variantSet "vset2" = {
         "fallback" {
         }
@@ -50,8 +62,17 @@ def scope "B" (
                 string vset1 = "selection"
             }
         ) {
+            def "Child"
+            {
+            }
         }
         "ignored_selection" {
         }
     }
 }
+
+def "C" (
+    references = </A/Child>
+)
+{
+}
index d7e1679ed4182e635d92a6785557d29929228029..5ce1e0190937a708616e1cc8ad19bba894afb214 100644 (file)
@@ -17,6 +17,9 @@ Variant Selections:
     {vset1 = selection}
     {vset2 = selection}
 
+Child names:
+     ['Child']
+
 Property names:
      ['result']
 
@@ -24,6 +27,15 @@ Property stacks:
 /A.result:
     root.sdf             /A{vset1=selection}.result
 
+------------------------------------------------------------------------
+Results for composing </A/Child>
+
+Prim Stack:
+    root.sdf             /A/Child
+    root.sdf             /A{vset1=selection}Child
+    root.sdf             /B/Child
+    root.sdf             /B{vset2=selection}Child
+
 ------------------------------------------------------------------------
 Results for composing </B>
 
@@ -34,3 +46,23 @@ Prim Stack:
 Variant Selections:
     {vset2 = selection}
 
+Child names:
+     ['Child']
+
+------------------------------------------------------------------------
+Results for composing </B/Child>
+
+Prim Stack:
+    root.sdf             /B/Child
+    root.sdf             /B{vset2=selection}Child
+
+------------------------------------------------------------------------
+Results for composing </C>
+
+Prim Stack:
+    root.sdf             /C
+    root.sdf             /A/Child
+    root.sdf             /A{vset1=selection}Child
+    root.sdf             /B/Child
+    root.sdf             /B{vset2=selection}Child
+
index fbdf2428c9abbd459ecef4f1fc45ead17f74d26c..f18a2cedde917ae7b26a09d607a1974b3cccaa1d 100644 (file)
@@ -2,16 +2,12 @@
 (
     """
     This museum exhibit exercises the ability for variants to select other
-    variants. This is a stripped down version of the repro case for bug 
-    68105.
+    variants.
 
     Within SlugJ_modelInterface.gen.sdf, the selection {shadingVariant=Axel}
     is authored. In that variant, the selection {shaderBindingVariant=Wet} is
     authored. This selection should be carried over when evaluating the
     reference to /ShaderBindingVariants in SlugJ_shaderDisplayDefs.sdf.
-
-    This relies on new variant selection behavior introduced in Pcp.
-    This test case does not work as desired in Csd mode.
     """
 )
 
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantSelectionInVariant2.testenv/TrickyVariantSelectionInVariant2/root.sdf b/pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantSelectionInVariant2.testenv/TrickyVariantSelectionInVariant2/root.sdf
new file mode 100644 (file)
index 0000000..ed99ede
--- /dev/null
@@ -0,0 +1,44 @@
+#sdf 1.4.32
+(
+    """
+    This museum case demonstrates the ability for a stronger
+    variant set to provide a variant selection for a weaker
+    variant set.
+    """
+)
+
+def "Ref" (
+    variantSets = ["v1", "v2"]
+    variants = {
+        string v1 = "a"
+    }
+)
+{
+    variantSet "v1" = {
+        "a" (
+            variants = {
+                string v2 = "b"
+            }
+        ) {
+        }
+    }
+
+    variantSet "v2" = {
+        "b" {
+            def "Model"
+            {
+            }
+        }
+    }
+}
+
+def "Root" (
+    """
+    Composition should pick up the variant {v2 = b} on /Ref when
+    composing ancestral opinions. The variant selection for v2
+    comes from stronger variant {v1 = a}, also authored on /Ref.
+    """
+    references = </Ref/Model>
+)
+{
+}
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantSelectionInVariant2.testenv/baseline/compositionResults_TrickyVariantSelectionInVariant2.txt b/pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantSelectionInVariant2.testenv/baseline/compositionResults_TrickyVariantSelectionInVariant2.txt
new file mode 100644 (file)
index 0000000..500b23c
--- /dev/null
@@ -0,0 +1,34 @@
+Loading @TrickyVariantSelectionInVariant2/root.sdf@
+
+------------------------------------------------------------------------
+Layer Stack:
+     root.sdf
+
+------------------------------------------------------------------------
+Results for composing </Ref>
+
+Prim Stack:
+    root.sdf             /Ref
+    root.sdf             /Ref{v1=a}
+    root.sdf             /Ref{v2=b}
+
+Variant Selections:
+    {v1 = a}
+    {v2 = b}
+
+Child names:
+     ['Model']
+
+------------------------------------------------------------------------
+Results for composing </Ref/Model>
+
+Prim Stack:
+    root.sdf             /Ref{v2=b}Model
+
+------------------------------------------------------------------------
+Results for composing </Root>
+
+Prim Stack:
+    root.sdf             /Root
+    root.sdf             /Ref{v2=b}Model
+
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantWeakerSelection4.testenv/TrickyVariantWeakerSelection4/geo.sdf b/pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantWeakerSelection4.testenv/TrickyVariantWeakerSelection4/geo.sdf
new file mode 100644 (file)
index 0000000..0313ec6
--- /dev/null
@@ -0,0 +1,15 @@
+#sdf 1.4.32
+
+def Xform "bob_root_sphere"(
+){
+  def Sphere "bob_body"(
+  ){
+  }
+}
+
+def Xform "bob_root_cube"(
+){
+  def Cube "bob_body"(
+  ){
+  }
+}
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantWeakerSelection4.testenv/TrickyVariantWeakerSelection4/root.sdf b/pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantWeakerSelection4.testenv/TrickyVariantWeakerSelection4/root.sdf
new file mode 100644 (file)
index 0000000..e7f0432
--- /dev/null
@@ -0,0 +1,63 @@
+#sdf 1.4.32
+(
+    """
+    This museum case exercises a variant in a class which selects
+    a variant for the root node.  This requires us to defer evaluation
+    of the root node variant until the weaker variant has been
+    evaluated.
+    """
+)
+
+class "_class_geotype" (
+    add variantSets = ["geotype_selector", "geotype"]
+)
+{
+    variantSet "geotype_selector" = {
+        "select_cube" (
+            variants = {
+                string geotype = "cube"
+            }
+        ) {
+
+        }
+        "select_sphere" (
+            variants = {
+                string geotype = "sphere"
+            }
+        ) {
+
+        }
+    }
+}
+
+def "bob" (
+    add inherits = </_class_geotype>
+    variants = {
+        string geotype_selector = "select_cube"
+    }
+    add variantSets = "geotype"
+)
+{
+    variantSet "geotype" = {
+        "cube" {
+            def "geom" (
+                references = @./geo.sdf@</bob_root_cube>
+            )
+            {
+            }
+        }
+        "sphere" {
+            def "geom" (
+                references = @./geo.sdf@</bob_root_sphere>
+            )
+            {
+            }
+        }
+    }
+}
+
+def "shape" (
+    references = </bob/geom>
+)
+{
+}
diff --git a/pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantWeakerSelection4.testenv/baseline/compositionResults_TrickyVariantWeakerSelection4.txt b/pxr/usd/pcp/testenv/testPcpMuseum_TrickyVariantWeakerSelection4.testenv/baseline/compositionResults_TrickyVariantWeakerSelection4.txt
new file mode 100644 (file)
index 0000000..3e56d2c
--- /dev/null
@@ -0,0 +1,61 @@
+Loading @TrickyVariantWeakerSelection4/root.sdf@
+
+------------------------------------------------------------------------
+Layer Stack:
+     root.sdf
+
+------------------------------------------------------------------------
+Results for composing </_class_geotype>
+
+Prim Stack:
+    root.sdf             /_class_geotype
+
+------------------------------------------------------------------------
+Results for composing </bob>
+
+Prim Stack:
+    root.sdf             /bob
+    root.sdf             /_class_geotype
+    root.sdf             /_class_geotype{geotype_selector=select_cube}
+    root.sdf             /bob{geotype=cube}
+
+Variant Selections:
+    {geotype = cube}
+    {geotype_selector = select_cube}
+
+Child names:
+     ['geom']
+
+------------------------------------------------------------------------
+Results for composing </bob/geom>
+
+Prim Stack:
+    root.sdf             /bob{geotype=cube}geom
+    geo.sdf              /bob_root_cube
+
+Child names:
+     ['bob_body']
+
+------------------------------------------------------------------------
+Results for composing </bob/geom/bob_body>
+
+Prim Stack:
+    geo.sdf              /bob_root_cube/bob_body
+
+------------------------------------------------------------------------
+Results for composing </shape>
+
+Prim Stack:
+    root.sdf             /shape
+    root.sdf             /bob{geotype=cube}geom
+    geo.sdf              /bob_root_cube
+
+Child names:
+     ['bob_body']
+
+------------------------------------------------------------------------
+Results for composing </shape/bob_body>
+
+Prim Stack:
+    geo.sdf              /bob_root_cube/bob_body
+