diff --git a/pxr/usd/pcp/testenv/testPcpLayerMuting.py b/pxr/usd/pcp/testenv/testPcpLayerMuting.py index a140ae1e37..7c42cd1685 100644 --- a/pxr/usd/pcp/testenv/testPcpLayerMuting.py +++ b/pxr/usd/pcp/testenv/testPcpLayerMuting.py @@ -57,6 +57,7 @@ def test_MutingSublayers(self): [layer.GetPrimAtPath('/Root'), sublayer.GetPrimAtPath('/Root'), anonymousSublayer.GetPrimAtPath('/Root')]) + self.assertEqual(pi.rootNode.layerStack.mutedLayers, []) (pi2, err2) = pcp2.ComputePrimIndex('/Root') self.assertTrue(not err2) @@ -64,6 +65,7 @@ def test_MutingSublayers(self): [layer.GetPrimAtPath('/Root'), sublayer.GetPrimAtPath('/Root'), anonymousSublayer.GetPrimAtPath('/Root')]) + self.assertEqual(pi2.rootNode.layerStack.mutedLayers, []) # Muting the cache's root layer is explicitly disallowed. with self.assertRaises(Tf.ErrorException): @@ -77,6 +79,8 @@ def test_MutingSublayers(self): self.assertEqual(pi.primStack, [layer.GetPrimAtPath('/Root'), anonymousSublayer.GetPrimAtPath('/Root')]) + self.assertEqual(pi.rootNode.layerStack.mutedLayers, + [sublayer.identifier]) (pi2, err2) = pcp2.ComputePrimIndex('/Root') self.assertTrue(not err2) @@ -84,6 +88,7 @@ def test_MutingSublayers(self): [layer.GetPrimAtPath('/Root'), sublayer.GetPrimAtPath('/Root'), anonymousSublayer.GetPrimAtPath('/Root')]) + self.assertEqual(pi2.rootNode.layerStack.mutedLayers, []) # Unmute sublayer and verify that it comes back into /Root's # prim stack. @@ -94,6 +99,7 @@ def test_MutingSublayers(self): [layer.GetPrimAtPath('/Root'), sublayer.GetPrimAtPath('/Root'), anonymousSublayer.GetPrimAtPath('/Root')]) + self.assertEqual(pi.rootNode.layerStack.mutedLayers, []) (pi2, err2) = pcp2.ComputePrimIndex('/Root') self.assertTrue(not err2) @@ -101,6 +107,7 @@ def test_MutingSublayers(self): [layer.GetPrimAtPath('/Root'), sublayer.GetPrimAtPath('/Root'), anonymousSublayer.GetPrimAtPath('/Root')]) + self.assertEqual(pi2.rootNode.layerStack.mutedLayers, []) # Mute sublayer and verify that change processing has occurred # and that it no longer appears in /Root's prim stack. @@ -111,6 +118,8 @@ def test_MutingSublayers(self): [layer.GetPrimAtPath('/Root'), sublayer.GetPrimAtPath('/Root')]) self.assertTrue(anonymousSublayer) + self.assertEqual(pi.rootNode.layerStack.mutedLayers, + [anonymousSublayer.identifier]) (pi2, err2) = pcp2.ComputePrimIndex('/Root') self.assertTrue(not err2) @@ -118,6 +127,7 @@ def test_MutingSublayers(self): [layer.GetPrimAtPath('/Root'), sublayer.GetPrimAtPath('/Root'), anonymousSublayer.GetPrimAtPath('/Root')]) + self.assertEqual(pi2.rootNode.layerStack.mutedLayers, []) # Unmute sublayer and verify that it comes back into /Root's # prim stack. @@ -128,6 +138,7 @@ def test_MutingSublayers(self): [layer.GetPrimAtPath('/Root'), sublayer.GetPrimAtPath('/Root'), anonymousSublayer.GetPrimAtPath('/Root')]) + self.assertEqual(pi.rootNode.layerStack.mutedLayers, []) (pi2, err2) = pcp2.ComputePrimIndex('/Root') self.assertTrue(not err2) @@ -135,6 +146,7 @@ def test_MutingSublayers(self): [layer.GetPrimAtPath('/Root'), sublayer.GetPrimAtPath('/Root'), anonymousSublayer.GetPrimAtPath('/Root')]) + self.assertEqual(pi2.rootNode.layerStack.mutedLayers, []) def test_MutingSessionLayer(self): """Tests ability to mute a cache's session layer.""" @@ -149,6 +161,7 @@ def test_MutingSessionLayer(self): self.assertEqual(pi.primStack, [sessionLayer.GetPrimAtPath('/Root'), layer.GetPrimAtPath('/Root')]) + self.assertEqual(pi.rootNode.layerStack.mutedLayers, []) pcp.RequestLayerMuting([sessionLayer.identifier], []) @@ -156,6 +169,8 @@ def test_MutingSessionLayer(self): self.assertTrue(not err) self.assertEqual(pi.primStack, [layer.GetPrimAtPath('/Root')]) + self.assertEqual(pi.rootNode.layerStack.mutedLayers, + [sessionLayer.identifier]) pcp.RequestLayerMuting([], [sessionLayer.identifier]) @@ -164,6 +179,7 @@ def test_MutingSessionLayer(self): self.assertEqual(pi.primStack, [sessionLayer.GetPrimAtPath('/Root'), layer.GetPrimAtPath('/Root')]) + self.assertEqual(pi.rootNode.layerStack.mutedLayers, []) def test_MutingReferencedLayers(self): """Tests behavior when muting and unmuting the root layer of diff --git a/pxr/usd/pcp/wrapLayerStack.cpp b/pxr/usd/pcp/wrapLayerStack.cpp index 593ee3d584..c416ea3056 100644 --- a/pxr/usd/pcp/wrapLayerStack.cpp +++ b/pxr/usd/pcp/wrapLayerStack.cpp @@ -78,6 +78,9 @@ void wrapLayerStack() .add_property("layerTree", make_function(&PcpLayerStack::GetLayerTree, return_value_policy())) + .add_property("mutedLayers", + make_function(&PcpLayerStack::GetMutedLayers, + return_value_policy())) .add_property("relocatesSourceToTarget", make_function(&PcpLayerStack::GetRelocatesSourceToTarget, return_value_policy()))