#!/pxrpythonsubst
#
# Copyright 2017 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
# 6. Trademarks. This License does not grant permission to use the trade
#    names, trademarks, service marks, or product names of the Licensor
#    and its affiliates, except as required to comply with Section 4(c) of
#    the License and to reproduce the content of the NOTICE file.
#
# You may obtain a copy of the Apache License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Apache License with the above modification is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the Apache License for the specific
# language governing permissions and limitations under the Apache License.

# pylint: disable=map-builtin-not-iterating

import sys, unittest
from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf

class TestUsdGeomSchemata(unittest.TestCase):
    def test_Basic(self):
        l = Sdf.Layer.CreateAnonymous()
        stage = Usd.Stage.Open(l.identifier)

        p = stage.DefinePrim("/Mesh", "Mesh")
        self.assertTrue(p)

        mesh = UsdGeom.Mesh(p)
        self.assertTrue(mesh)
        self.assertTrue(mesh.GetPrim())
        self.assertTrue(not mesh.GetPointsAttr().Get(1))
        self.assertEqual(p.GetTypeName(), 
            Usd.SchemaRegistry().GetSchemaTypeName(mesh._GetStaticTfType()))

        #
        # Make sure uniform access behaves as expected.
        #
        ori = p.GetAttribute("orientation")

        # The generic orientation attribute should be automatically defined because
        # it is a registered attribute of a well known schema.  However, it's not
        # yet authored at the current edit target.
        self.assertTrue(ori.IsDefined())
        self.assertTrue(not ori.IsAuthoredAt(ori.GetStage().GetEditTarget()))
        # Author a value, and check that it's still defined, and now is in fact
        # authored at the current edit target.
        ori.Set(UsdGeom.Tokens.leftHanded)
        self.assertTrue(ori.IsDefined())
        self.assertTrue(ori.IsAuthoredAt(ori.GetStage().GetEditTarget()))
        mesh.GetOrientationAttr().Set(UsdGeom.Tokens.rightHanded, 10)

        # "leftHanded" should have been authored at Usd.TimeCode.Default, so reading the
        # attribute at Default should return lh, not rh.
        self.assertEqual(ori.Get(), UsdGeom.Tokens.leftHanded)

        # The value "rightHanded" was set at t=10, so reading *any* time should
        # return "rightHanded"
        self.assertEqual(ori.Get(9.9),  UsdGeom.Tokens.rightHanded)
        self.assertEqual(ori.Get(10),   UsdGeom.Tokens.rightHanded)
        self.assertEqual(ori.Get(10.1), UsdGeom.Tokens.rightHanded)
        self.assertEqual(ori.Get(11),   UsdGeom.Tokens.rightHanded)

        #
        # Attribute name sanity check. We expect the names returned by the schema
        # to match the names returned via the generic API.
        #
        self.assertTrue(len(mesh.GetSchemaAttributeNames()) > 0)
        self.assertNotEqual(mesh.GetSchemaAttributeNames(True), mesh.GetSchemaAttributeNames(False))

        for n in mesh.GetSchemaAttributeNames():
            # apiName overrides
            if n == "primvars:displayColor":
                n = "displayColor"
            elif n == "primvars:displayOpacity":
                n = "displayOpacity"

            name = n[0].upper() + n[1:]
            self.assertTrue(("Get" + name + "Attr") in dir(mesh), 
                            ("Get" + name + "Attr() not found in: " + str(dir(mesh))))

    def test_IsA(self):

        # Author Scene and Compose Stage

        l = Sdf.Layer.CreateAnonymous()
        stage = Usd.Stage.Open(l.identifier)

        # For every prim schema type in this module, validate that:
        # 1. We can define a prim of its type
        # 2. Its type and inheritance matches our expectations
        # 3. At least one of its builtin properties is available and defined

        # BasisCurves Tests

        schema = UsdGeom.BasisCurves.Define(stage, "/BasisCurves")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertFalse(prim.IsA(UsdGeom.Mesh))       # BasisCurves is not a Mesh
        self.assertTrue(prim.IsA(UsdGeom.Xformable))   # BasisCurves is a Xformable
        self.assertFalse(prim.IsA(UsdGeom.Cylinder))   # BasisCurves is not a Cylinder
        self.assertTrue(schema.GetBasisAttr())

        # Camera Tests

        schema = UsdGeom.Camera.Define(stage, "/Camera")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertFalse(prim.IsA(UsdGeom.Mesh))       # Camera is not a Mesh
        self.assertTrue(prim.IsA(UsdGeom.Xformable))   # Camera is a Xformable
        self.assertFalse(prim.IsA(UsdGeom.Cylinder))   # Camera is not a Cylinder
        self.assertTrue(schema.GetFocalLengthAttr())

        # Capsule Tests

        schema = UsdGeom.Capsule.Define(stage, "/Capsule")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertFalse(prim.IsA(UsdGeom.Mesh))       # Capsule is not a Mesh
        self.assertTrue(prim.IsA(UsdGeom.Xformable))   # Capsule is a Xformable
        self.assertFalse(prim.IsA(UsdGeom.Cylinder))   # Capsule is not a Cylinder
        self.assertTrue(schema.GetAxisAttr())

        # Cone Tests

        schema = UsdGeom.Cone.Define(stage, "/Cone")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertFalse(prim.IsA(UsdGeom.Mesh))       # Cone is not a Mesh
        self.assertTrue(prim.IsA(UsdGeom.Xformable))   # Cone is a Xformable
        self.assertFalse(prim.IsA(UsdGeom.Cylinder))   # Cone is not a Cylinder
        self.assertTrue(schema.GetAxisAttr())

        # Cube Tests

        schema = UsdGeom.Cube.Define(stage, "/Cube")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertFalse(prim.IsA(UsdGeom.Mesh))       # Cube is not a Mesh
        self.assertTrue(prim.IsA(UsdGeom.Xformable))   # Cube is a Xformable
        self.assertFalse(prim.IsA(UsdGeom.Cylinder))   # Cube is not a Cylinder
        self.assertTrue(schema.GetSizeAttr())

        # Cylinder Tests

        schema = UsdGeom.Cylinder.Define(stage, "/Cylinder")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertFalse(prim.IsA(UsdGeom.Mesh))       # Cylinder is not a Mesh
        self.assertTrue(prim.IsA(UsdGeom.Xformable))   # Cylinder is a Xformable
        self.assertTrue(prim.IsA(UsdGeom.Cylinder))    # Cylinder is a Cylinder
        self.assertTrue(schema.GetAxisAttr())

        # Mesh Tests

        schema = UsdGeom.Mesh.Define(stage, "/Mesh")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertTrue(prim.IsA(UsdGeom.Mesh))        # Mesh is a Mesh
        self.assertTrue(prim.IsA(UsdGeom.Xformable))   # Mesh is a XFormable
        self.assertFalse(prim.IsA(UsdGeom.Cylinder))   # Mesh is not a Cylinder
        self.assertTrue(schema.GetFaceVertexCountsAttr())

        # NurbsCurves Tests

        schema = UsdGeom.NurbsCurves.Define(stage, "/NurbsCurves")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertFalse(prim.IsA(UsdGeom.Mesh))       # NurbsCurves is not a Mesh
        self.assertTrue(prim.IsA(UsdGeom.Xformable))   # NurbsCurves is a Xformable
        self.assertFalse(prim.IsA(UsdGeom.Cylinder))   # NurbsCurves is not a Cylinder
        self.assertTrue(schema.GetKnotsAttr())

        # NurbsPatch Tests

        schema = UsdGeom.NurbsPatch.Define(stage, "/NurbsPatch")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertFalse(prim.IsA(UsdGeom.Mesh))       # NurbsPatch is not a Mesh
        self.assertTrue(prim.IsA(UsdGeom.Xformable))   # NurbsPatch is a Xformable
        self.assertFalse(prim.IsA(UsdGeom.Cylinder))   # NurbsPatch is not a Cylinder
        self.assertTrue(schema.GetUKnotsAttr())

        # Points Tests

        schema = UsdGeom.Points.Define(stage, "/Points")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertFalse(prim.IsA(UsdGeom.Mesh))       # Points is not a Mesh
        self.assertTrue(prim.IsA(UsdGeom.Xformable))   # Points is a Xformable
        self.assertFalse(prim.IsA(UsdGeom.Cylinder))   # Points is not a Cylinder
        self.assertTrue(schema.GetWidthsAttr())

        # Scope Tests

        schema = UsdGeom.Scope.Define(stage, "/Scope")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertFalse(prim.IsA(UsdGeom.Mesh))       # Scope is not a Mesh
        self.assertFalse(prim.IsA(UsdGeom.Xformable))  # Scope is not a Xformable
        self.assertFalse(prim.IsA(UsdGeom.Cylinder))   # Scope is not a Cylinder
        # Scope has no builtins!

        # Sphere Tests

        schema = UsdGeom.Sphere.Define(stage, "/Sphere")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertFalse(prim.IsA(UsdGeom.Mesh))       # Sphere is not a Mesh
        self.assertTrue(prim.IsA(UsdGeom.Xformable))   # Sphere is a Xformable
        self.assertFalse(prim.IsA(UsdGeom.Cylinder))   # Sphere is not a Cylinder
        self.assertTrue(schema.GetRadiusAttr())

        # Xform Tests

        schema = UsdGeom.Xform.Define(stage, "/Xform")
        self.assertTrue(schema)
        prim = schema.GetPrim()
        self.assertFalse(prim.IsA(UsdGeom.Mesh))       # Xform is not a Mesh
        self.assertTrue(prim.IsA(UsdGeom.Xformable))   # Xform is a Xformable
        self.assertFalse(prim.IsA(UsdGeom.Cylinder))   # Xform is not a Cylinder
        self.assertTrue(schema.GetXformOpOrderAttr())


    def test_Fallbacks(self):
        # Author Scene and Compose Stage

        stage = Usd.Stage.CreateInMemory()

        # Xformable Tests

        identity = Gf.Matrix4d(1)
        origin = Gf.Vec3f(0, 0, 0)

        xform = UsdGeom.Xform.Define(stage, "/Xform")  # direct subclass
        xformOpOrder = xform.GetXformOpOrderAttr()
        self.assertFalse(xformOpOrder.HasAuthoredValue())
        # xformOpOrder has no fallback value
        self.assertEqual(xformOpOrder.Get(), None)
        self.assertFalse(xformOpOrder.HasFallbackValue())

        # Try authoring and reverting...
        xformOpOrderAttr = xform.GetPrim().GetAttribute(UsdGeom.Tokens.xformOpOrder)
        self.assertTrue(xformOpOrderAttr)
        self.assertEqual(xformOpOrderAttr.Get(), None)

        opOrderVal = ["xformOp:transform"]
        self.assertTrue(xformOpOrderAttr.Set(opOrderVal))
        self.assertTrue(xformOpOrderAttr.HasAuthoredValue())

        self.assertNotEqual(xformOpOrderAttr.Get(), None)
        self.assertTrue(xformOpOrderAttr.Clear())
        self.assertFalse(xformOpOrderAttr.HasAuthoredValue())
        self.assertEqual(xformOpOrderAttr.Get(), None)
        self.assertFalse(xformOpOrder.HasFallbackValue())

        mesh = UsdGeom.Mesh.Define(stage, "/Mesh")  # multiple ancestor hops

        # PointBased and Curves
        curves = UsdGeom.BasisCurves.Define(stage, "/Curves")
        self.assertEqual(curves.GetNormalsInterpolation(), UsdGeom.Tokens.vertex)
        self.assertEqual(curves.GetWidthsInterpolation(), UsdGeom.Tokens.vertex)

        # Before we go, test that CreateXXXAttr performs as we expect in various
        # scenarios
        # Number 1: Sparse and non-sparse authoring on def'd prim
        mesh.CreateDoubleSidedAttr(False, True)
        self.assertFalse(mesh.GetDoubleSidedAttr().HasAuthoredValue())
        mesh.CreateDoubleSidedAttr(False, False)
        self.assertTrue(mesh.GetDoubleSidedAttr().HasAuthoredValue())

        # Number 2: Sparse authoring demotes to dense for non-defed prim
        overMesh = UsdGeom.Mesh(stage.OverridePrim('/overMesh'))
        overMesh.CreateDoubleSidedAttr(False, True)
        self.assertTrue(overMesh.GetDoubleSidedAttr().HasAuthoredValue())
        self.assertEqual(overMesh.GetDoubleSidedAttr().Get(), False)
        overMesh.CreateDoubleSidedAttr(True, True)
        self.assertEqual(overMesh.GetDoubleSidedAttr().Get(), True)
        # make it a defined mesh, and sanity check it still evals the same
        mesh2 = UsdGeom.Mesh.Define(stage, "/overMesh")
        self.assertEqual(overMesh.GetDoubleSidedAttr().Get(), True)

        # Check querying of fallback values.
        sphere = UsdGeom.Sphere.Define(stage, "/Sphere")
        radius = sphere.GetRadiusAttr()
        self.assertTrue(radius.HasFallbackValue())

        radiusQuery = Usd.AttributeQuery(radius)
        self.assertTrue(radiusQuery.HasFallbackValue())

    def test_DefineSchema(self):
        s = Usd.Stage.CreateInMemory()
        parent = s.OverridePrim('/parent')
        self.assertTrue(parent)
        # Make a subscope.
        scope = UsdGeom.Scope.Define(s, '/parent/subscope')
        self.assertTrue(scope)
        # Assert that a simple find or create gives us the scope back.
        self.assertTrue(s.OverridePrim('/parent/subscope'))
        self.assertEqual(s.OverridePrim('/parent/subscope'), scope.GetPrim())
        # Try to make a mesh at subscope's path.  This transforms the scope into a
        # mesh, since Define() always authors typeName.
        mesh = UsdGeom.Mesh.Define(s, '/parent/subscope')
        self.assertTrue(mesh)
        self.assertTrue(not scope)
        # Make a mesh at a different path, should work.
        mesh = UsdGeom.Mesh.Define(s, '/parent/mesh')
        self.assertTrue(mesh)

    def test_BasicMetadataCases(self):
        s = Usd.Stage.CreateInMemory()
        spherePrim = UsdGeom.Sphere.Define(s, '/sphere').GetPrim()
        radius = spherePrim.GetAttribute('radius')
        self.assertTrue(radius.HasMetadata('custom'))
        self.assertTrue(radius.HasMetadata('typeName'))
        self.assertTrue(radius.HasMetadata('variability'))
        self.assertTrue(radius.IsDefined())
        self.assertTrue(not radius.IsCustom())
        self.assertEqual(radius.GetTypeName(), 'double')
        allMetadata = radius.GetAllMetadata()
        self.assertEqual(allMetadata['typeName'], 'double')
        self.assertEqual(allMetadata['variability'], Sdf.VariabilityVarying)
        self.assertEqual(allMetadata['custom'], False)
        # Author a custom property spec.
        layer = s.GetRootLayer()
        sphereSpec = layer.GetPrimAtPath('/sphere')
        radiusSpec = Sdf.AttributeSpec(
            sphereSpec, 'radius', Sdf.ValueTypeNames.Double,
            variability=Sdf.VariabilityUniform, declaresCustom=True)
        self.assertTrue(radiusSpec.custom)
        self.assertEqual(radiusSpec.variability, Sdf.VariabilityUniform)
        # Definition should win.
        self.assertTrue(not radius.IsCustom())
        self.assertEqual(radius.GetVariability(), Sdf.VariabilityVarying)
        allMetadata = radius.GetAllMetadata()
        self.assertEqual(allMetadata['typeName'], 'double')
        self.assertEqual(allMetadata['variability'], Sdf.VariabilityVarying)
        self.assertEqual(allMetadata['custom'], False)
        # List fields on 'visibility' attribute -- should include 'allowedTokens',
        # provided by the property definition.
        visibility = spherePrim.GetAttribute('visibility')
        self.assertTrue(visibility.IsDefined())
        self.assertTrue('allowedTokens' in visibility.GetAllMetadata())

        # Assert that attribute fallback values are returned for builtin attributes.
        do = spherePrim.GetAttribute('primvars:displayOpacity')
        self.assertTrue(do.IsDefined())
        self.assertTrue(do.Get() is None)

    def test_Camera(self):
        from pxr import Gf

        stage = Usd.Stage.CreateInMemory()

        camera = UsdGeom.Camera.Define(stage, "/Camera")

        self.assertTrue(camera.GetPrim().IsA(UsdGeom.Xformable)) # Camera is Xformable

        self.assertEqual(camera.GetProjectionAttr().Get(), 'perspective')
        camera.GetProjectionAttr().Set('orthographic')
        self.assertEqual(camera.GetProjectionAttr().Get(), 'orthographic')

        self.assertTrue(Gf.IsClose(camera.GetHorizontalApertureAttr().Get(),
                                   0.825 * 25.4, 1e-5))
        camera.GetHorizontalApertureAttr().Set(3.0)
        self.assertEqual(camera.GetHorizontalApertureAttr().Get(), 3.0)

        self.assertTrue(Gf.IsClose(camera.GetVerticalApertureAttr().Get(),
                                   0.602 * 25.4, 1e-5))
        camera.GetVerticalApertureAttr().Set(2.0)
        self.assertEqual(camera.GetVerticalApertureAttr().Get(), 2.0)

        self.assertEqual(camera.GetFocalLengthAttr().Get(), 50.0)
        camera.GetFocalLengthAttr().Set(35.0)
        self.assertTrue(Gf.IsClose(camera.GetFocalLengthAttr().Get(), 35.0, 1e-5))

        self.assertEqual(camera.GetClippingRangeAttr().Get(), Gf.Vec2f(1, 1000000))
        camera.GetClippingRangeAttr().Set(Gf.Vec2f(5, 10))
        self.assertTrue(Gf.IsClose(camera.GetClippingRangeAttr().Get(), 
                                   Gf.Vec2f(5, 10), 1e-5))

        self.assertEqual(camera.GetClippingPlanesAttr().Get(), Vt.Vec4fArray())

        cp = Vt.Vec4fArray([(1, 2, 3, 4), (8, 7, 6, 5)])
        camera.GetClippingPlanesAttr().Set(cp)
        self.assertEqual(camera.GetClippingPlanesAttr().Get(), cp)
        cp = Vt.Vec4fArray()
        camera.GetClippingPlanesAttr().Set(cp)
        self.assertEqual(camera.GetClippingPlanesAttr().Get(), cp)

        self.assertEqual(camera.GetFStopAttr().Get(), 0.0)
        camera.GetFStopAttr().Set(2.8)
        self.assertTrue(Gf.IsClose(camera.GetFStopAttr().Get(), 2.8, 1e-5))

        self.assertEqual(camera.GetFocusDistanceAttr().Get(), 0.0)
        camera.GetFocusDistanceAttr().Set(10.0)
        self.assertEqual(camera.GetFocusDistanceAttr().Get(), 10.0)

    def test_Points(self):
        stage = Usd.Stage.CreateInMemory()

        # Points Tests

        schema = UsdGeom.Points.Define(stage, "/Points")
        self.assertTrue(schema)
        
        # Test that id's roundtrip properly, for big numbers, and negative numbers
        ids = [8589934592, 1099511627776, 0, -42]
        schema.CreateIdsAttr(ids)
        resolvedIds = list(schema.GetIdsAttr().Get()) # convert VtArray to list
        self.assertEqual(ids, resolvedIds)
     

    def test_Revert_Bug111239(self):
        # This used to test a change for Bug111239, but now tests that this
        # fix has been reverted. We no longer allow the C++ typename be used as
        # a prim's typename.
        s = Usd.Stage.CreateInMemory()
        sphere = s.DefinePrim('/sphere', typeName='Sphere')
        tfTypeName = UsdGeom.Sphere._GetStaticTfType().typeName
        self.assertEqual(tfTypeName, 'UsdGeomSphere')
        usdGeomSphere = s.DefinePrim('/usdGeomSphere', typeName='tfTypeName')
        self.assertTrue(UsdGeom.Sphere(sphere))
        self.assertTrue('radius' in [a.GetName() for a in sphere.GetAttributes()])
        self.assertFalse(UsdGeom.Sphere(usdGeomSphere))
        self.assertFalse('radius' in [a.GetName() for a in usdGeomSphere.GetAttributes()])

    def test_ComputeExtent(self):

        from pxr import Gf

        # Create some simple test cases
        allPoints = [
            [(1, 1, 0)],    # Zero-Volume Extent Test
            [(0, 0, 0)],    # Simple Width Test
            [(-1, -1, -1), (1, 1, 1)],  # Multiple Width Test
            [(-1, -1, -1), (1, 1, 1)],  # Erroneous Widths/Points Test
            # Complex Test, Many Points/Widths
            [(3, -1, 5), (-1.5, 0, 3), (1, 3, -2), (2, 2, -4)],
        ]

        allWidths = [
            [0],            # Zero-Volume Extent Test
            [2],            # Simple Width Test
            [2, 4],         # Multiple Width Test
            [2, 4, 5],      # Erroneous Widths/Points Test
            [1, 2, 2, 1]    # Complex Test, Many Points/Widths
        ]

        pointBasedSolutions = [
            [(1, 1, 0), (1, 1, 0)],         # Zero-Volume Extent Test
            [(0, 0, 0), (0, 0, 0)],         # Simple Width Test
            [(-1, -1, -1), (1, 1, 1)],      # Multiple Width Test
            # Erroneous Widths/Points Test -> Ok For Point-Based
            [(-1, -1, -1), (1, 1, 1)],
            [(-1.5, -1, -4), (3, 3, 5)]     # Complex Test, Many Points/Widths
        ]

        pointsSolutions = [
            [(1, 1, 0), (1, 1, 0)],             # Zero-Volume Extent Test
            [(-1, -1, -1), (1, 1, 1)],          # Simple Width Test
            [(-2, -2, -2), (3, 3, 3)],          # Multiple Width Test
            # Erroneous Widths/Points Test -> Returns None
            None,
            [(-2.5, -1.5, -4.5), (3.5, 4, 5.5)] # Complex Test, Many Points/Widths
        ]

        # Perform the correctness tests for PointBased and Points

        # Test for empty points prims
        emptyPoints = []
        extremeExtentArr = UsdGeom.PointBased.ComputeExtent(emptyPoints)

        # We need to map the contents of extremeExtentArr to floats from
        # num.float32s due to the way Gf.Vec3f is wrapped out
        # XXX: This is awful, it'd be nice to not do it
        extremeExtentRange = Gf.Range3f(Gf.Vec3f(*map(float, extremeExtentArr[0])),
                                        Gf.Vec3f(*map(float, extremeExtentArr[1])))
        self.assertTrue(extremeExtentRange.IsEmpty())

        # PointBased Test
        numDataSets = len(allPoints)
        for i in range(numDataSets):
            pointsData = allPoints[i]

            expectedExtent = pointBasedSolutions[i]
            actualExtent = UsdGeom.PointBased.ComputeExtent(pointsData)

            for a, b in zip(expectedExtent, actualExtent):
                self.assertTrue(Gf.IsClose(a, b, 1e-5))

        # Points Test
        for i in range(numDataSets):
            pointsData = allPoints[i]
            widthsData = allWidths[i]

            expectedExtent = pointsSolutions[i]
            actualExtent = UsdGeom.Points.ComputeExtent(pointsData, widthsData)
            if actualExtent is not None and expectedExtent is not None:
                for a, b in zip(expectedExtent, actualExtent):
                    self.assertTrue(Gf.IsClose(a, b, 1e-5))

            # Compute extent via generic UsdGeom.Boundable API
            s = Usd.Stage.CreateInMemory()
            pointsPrim = UsdGeom.Points.Define(s, "/Points")
            pointsPrim.CreatePointsAttr(pointsData)
            pointsPrim.CreateWidthsAttr(widthsData)

            actualExtent = UsdGeom.Boundable.ComputeExtentFromPlugins(
                pointsPrim, Usd.TimeCode.Default())
            
            if actualExtent is not None and expectedExtent is not None:
                for a, b in zip(expectedExtent, list(actualExtent)):
                    self.assertTrue(Gf.IsClose(a, b, 1e-5))

        # Mesh Test
        for i in range(numDataSets):
            pointsData = allPoints[i]

            expectedExtent = pointBasedSolutions[i]

            # Compute extent via generic UsdGeom.Boundable API.
            # UsdGeom.Mesh does not have its own compute extent function, so
            # it should fall back to the extent for PointBased prims.
            s = Usd.Stage.CreateInMemory()
            meshPrim = UsdGeom.Mesh.Define(s, "/Mesh")
            meshPrim.CreatePointsAttr(pointsData)

            actualExtent = UsdGeom.Boundable.ComputeExtentFromPlugins(
                meshPrim, Usd.TimeCode.Default())

            for a, b in zip(expectedExtent, actualExtent):
                self.assertTrue(Gf.IsClose(a, b, 1e-5))



        # Test UsdGeomCurves
        curvesPoints = [
            [(0,0,0), (1,1,1), (2,1,1), (3,0,0)],   # Test Curve with 1 width
            [(0,0,0), (1,1,1), (2,1,1), (3,0,0)],   # Test Curve with 2 widths
            [(0,0,0), (1,1,1), (2,1,1), (3,0,0)]    # Test Curve with no width
        ]

        curvesWidths = [
            [1],            # Test Curve with 1 width
            [.5, .1],       # Test Curve with 2 widths
            []              # Test Curve with no width
        ]

        curvesSolutions = [
            [(-.5,-.5,-.5), (3.5,1.5,1.5)],         # Test Curve with 1 width
            [(-.25,-.25,-.25), (3.25,1.25,1.25)],   # Test Curve with 2 widths (MAX)
            [(0,0,0), (3,1,1)],                     # Test Curve with no width
        ]

        # Perform the actual v. expected comparison
        numDataSets = len(curvesPoints)
        for i in range(numDataSets):
            pointsData = curvesPoints[i]
            widths = curvesWidths[i]

            expectedExtent = curvesSolutions[i]
            actualExtent = UsdGeom.Curves.ComputeExtent(pointsData, widths)

            for a, b in zip(expectedExtent, actualExtent):
                self.assertTrue(Gf.IsClose(a, b, 1e-5))

            # Compute extent via generic UsdGeom.Boundable API
            s = Usd.Stage.CreateInMemory()
            nurbsCurvesPrim = UsdGeom.NurbsCurves.Define(s, "/NurbsCurves")
            nurbsCurvesPrim.CreatePointsAttr(pointsData)
            nurbsCurvesPrim.CreateWidthsAttr(widths)

            actualExtent = UsdGeom.Boundable.ComputeExtentFromPlugins(
                nurbsCurvesPrim, Usd.TimeCode.Default())

            for a, b in zip(expectedExtent, actualExtent):
                self.assertTrue(Gf.IsClose(a, b, 1e-5))

            basisCurvesPrim = UsdGeom.BasisCurves.Define(s, "/BasisCurves")
            basisCurvesPrim.CreatePointsAttr(pointsData)
            basisCurvesPrim.CreateWidthsAttr(widths)

            actualExtent = UsdGeom.Boundable.ComputeExtentFromPlugins(
                basisCurvesPrim, Usd.TimeCode.Default())

            for a, b in zip(expectedExtent, actualExtent):
                self.assertTrue(Gf.IsClose(a, b, 1e-5))

    def test_TypeUsage(self):
        # Perform Type-Ness Checking for ComputeExtent
        pointsAsList = [(0, 0, 0), (1, 1, 1), (2, 2, 2)]
        pointsAsVec3fArr = Vt.Vec3fArray(pointsAsList)

        comp = UsdGeom.PointBased.ComputeExtent
        expectedExtent = comp(pointsAsVec3fArr)
        actualExtent = comp(pointsAsList)

        for a, b in zip(expectedExtent, actualExtent):
            self.assertTrue(Gf.IsClose(a, b, 1e-5))

    def test_Bug116593(self):
        from pxr import Gf

        s = Usd.Stage.CreateInMemory()
        prim = s.DefinePrim('/sphere', typeName='Sphere')

        # set with list of tuples
        vec = [(1,2,2),(12,3,3)]
        self.assertTrue(UsdGeom.ModelAPI(prim).SetExtentsHint(vec))
        self.assertEqual(UsdGeom.ModelAPI(prim).GetExtentsHint()[0], Gf.Vec3f(1,2,2))
        self.assertEqual(UsdGeom.ModelAPI(prim).GetExtentsHint()[1], Gf.Vec3f(12,3,3))

        # set with Gf vecs
        vec = [Gf.Vec3f(1,2,2), Gf.Vec3f(1,1,1)]
        self.assertTrue(UsdGeom.ModelAPI(prim).SetExtentsHint(vec))
        self.assertEqual(UsdGeom.ModelAPI(prim).GetExtentsHint()[0], Gf.Vec3f(1,2,2))
        self.assertEqual(UsdGeom.ModelAPI(prim).GetExtentsHint()[1], Gf.Vec3f(1,1,1))

    def test_Typed(self):
        from pxr import Tf
        xform = Tf.Type.FindByName("UsdGeomXform")
        imageable = Tf.Type.FindByName("UsdGeomImageable")
        geomModelAPI = Tf.Type.FindByName("UsdGeomModelAPI")

        self.assertTrue(Usd.SchemaRegistry.IsTyped(xform))
        self.assertTrue(Usd.SchemaRegistry.IsTyped(imageable))
        self.assertFalse(Usd.SchemaRegistry.IsTyped(geomModelAPI))    
        
    def test_Concrete(self):
        from pxr import Tf
        xform = Tf.Type.FindByName("UsdGeomXform")
        imageable = Tf.Type.FindByName("UsdGeomImageable")
        geomModelAPI = Tf.Type.FindByName("UsdGeomModelAPI")

        self.assertTrue(Usd.SchemaRegistry().IsConcrete(xform))
        self.assertFalse(Usd.SchemaRegistry().IsConcrete(imageable))
        self.assertFalse(Usd.SchemaRegistry().IsConcrete(geomModelAPI))

    def test_Apply(self):
        s = Usd.Stage.CreateInMemory('AppliedSchemas.usd')
        root = s.DefinePrim('/hello')
        self.assertEqual([], root.GetAppliedSchemas())

        # Check duplicates
        UsdGeom.MotionAPI.Apply(root)
        self.assertEqual(['MotionAPI'], root.GetAppliedSchemas())
        UsdGeom.MotionAPI.Apply(root)
        self.assertEqual(['MotionAPI'], root.GetAppliedSchemas())
        
        # Ensure duplicates aren't picked up
        UsdGeom.ModelAPI.Apply(root)
        self.assertEqual(['MotionAPI', 'GeomModelAPI'], root.GetAppliedSchemas())

        # Verify that we get exceptions but don't crash when applying to the 
        # null prim.
        with self.assertRaises(Tf.ErrorException):
            self.assertFalse(UsdGeom.MotionAPI.Apply(Usd.Prim()))
        with self.assertRaises(Tf.ErrorException):
            self.assertFalse(UsdGeom.ModelAPI.Apply(Usd.Prim()))

    def test_IsATypeless(self):
        from pxr import Usd, Tf
        s = Usd.Stage.CreateInMemory()
        spherePrim = s.DefinePrim('/sphere', typeName='Sphere')
        typelessPrim = s.DefinePrim('/regular')

        types = [Tf.Type.FindByName('UsdGeomSphere'),
                 Tf.Type.FindByName('UsdGeomGprim'),
                 Tf.Type.FindByName('UsdGeomBoundable'),
                 Tf.Type.FindByName('UsdGeomXformable'),
                 Tf.Type.FindByName('UsdGeomImageable'),
                 Tf.Type.FindByName('UsdTyped')]

        # Our sphere prim should return true on IsA queries for Sphere
        # and everything it inherits from. Our plain prim should return false 
        # for all of them.
        for t in types:
            self.assertTrue(spherePrim.IsA(t))
            self.assertFalse(typelessPrim.IsA(t))

    def test_HasAPI(self):
        from pxr import Usd, Tf
        s = Usd.Stage.CreateInMemory()
        prim = s.DefinePrim('/prim')

        types = [Tf.Type.FindByName('UsdGeomMotionAPI'),
                 Tf.Type.FindByName('UsdGeomModelAPI')]

        # Check that no APIs have yet been applied
        for t in types:
            self.assertFalse(prim.HasAPI(t))

        # Apply our schemas to this prim
        UsdGeom.ModelAPI.Apply(prim)
        UsdGeom.MotionAPI.Apply(prim)

        # Check that all our applied schemas show up
        for t in types:
            self.assertTrue(prim.HasAPI(t))

        # Check that we get an exception for unknown and non-API types
        with self.assertRaises(Tf.ErrorException):
            prim.HasAPI(Tf.Type.Unknown)
        
        with self.assertRaises(Tf.ErrorException):
            prim.HasAPI(Tf.Type.FindByName('UsdGeomXform'))

        with self.assertRaises(Tf.ErrorException):
            prim.HasAPI(Tf.Type.FindByName('UsdGeomImageable'))

        with self.assertRaises(Tf.ErrorException):
            # Test with a non-applied API schema.
            prim.HasAPI(Tf.Type.FindByName('UsdModelAPI'))

if __name__ == "__main__":
    unittest.main()

[((726, 4, 726, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import sys, unittest\n'), ((32, 12, 32, 39), 'pxr.Sdf.Layer.CreateAnonymous', 'Sdf.Layer.CreateAnonymous', ({}, {}), '()', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((33, 16, 33, 44), 'pxr.Usd.Stage.Open', 'Usd.Stage.Open', ({(33, 31, 33, 43): 'l.identifier'}, {}), '(l.identifier)', False, 'from pxr import Usd, Tf\n'), ((38, 15, 38, 30), 'pxr.UsdGeom.Mesh', 'UsdGeom.Mesh', ({(38, 28, 38, 29): 'p'}, {}), '(p)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((95, 12, 95, 39), 'pxr.Sdf.Layer.CreateAnonymous', 'Sdf.Layer.CreateAnonymous', ({}, {}), '()', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((96, 16, 96, 44), 'pxr.Usd.Stage.Open', 'Usd.Stage.Open', ({(96, 31, 96, 43): 'l.identifier'}, {}), '(l.identifier)', False, 'from pxr import Usd, Tf\n'), ((105, 17, 105, 66), 'pxr.UsdGeom.BasisCurves.Define', 'UsdGeom.BasisCurves.Define', ({(105, 44, 105, 49): 'stage', (105, 51, 105, 65): '"""/BasisCurves"""'}, {}), "(stage, '/BasisCurves')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((115, 17, 115, 56), 'pxr.UsdGeom.Camera.Define', 'UsdGeom.Camera.Define', ({(115, 39, 115, 44): 'stage', (115, 46, 115, 55): '"""/Camera"""'}, {}), "(stage, '/Camera')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((125, 17, 125, 58), 'pxr.UsdGeom.Capsule.Define', 'UsdGeom.Capsule.Define', ({(125, 40, 125, 45): 'stage', (125, 47, 125, 57): '"""/Capsule"""'}, {}), "(stage, '/Capsule')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((135, 17, 135, 52), 'pxr.UsdGeom.Cone.Define', 'UsdGeom.Cone.Define', ({(135, 37, 135, 42): 'stage', (135, 44, 135, 51): '"""/Cone"""'}, {}), "(stage, '/Cone')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((145, 17, 145, 52), 'pxr.UsdGeom.Cube.Define', 'UsdGeom.Cube.Define', ({(145, 37, 145, 42): 'stage', (145, 44, 145, 51): '"""/Cube"""'}, {}), "(stage, '/Cube')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((155, 17, 155, 60), 'pxr.UsdGeom.Cylinder.Define', 'UsdGeom.Cylinder.Define', ({(155, 41, 155, 46): 'stage', (155, 48, 155, 59): '"""/Cylinder"""'}, {}), "(stage, '/Cylinder')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((165, 17, 165, 52), 'pxr.UsdGeom.Mesh.Define', 'UsdGeom.Mesh.Define', ({(165, 37, 165, 42): 'stage', (165, 44, 165, 51): '"""/Mesh"""'}, {}), "(stage, '/Mesh')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((175, 17, 175, 66), 'pxr.UsdGeom.NurbsCurves.Define', 'UsdGeom.NurbsCurves.Define', ({(175, 44, 175, 49): 'stage', (175, 51, 175, 65): '"""/NurbsCurves"""'}, {}), "(stage, '/NurbsCurves')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((185, 17, 185, 64), 'pxr.UsdGeom.NurbsPatch.Define', 'UsdGeom.NurbsPatch.Define', ({(185, 43, 185, 48): 'stage', (185, 50, 185, 63): '"""/NurbsPatch"""'}, {}), "(stage, '/NurbsPatch')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((195, 17, 195, 56), 'pxr.UsdGeom.Points.Define', 'UsdGeom.Points.Define', ({(195, 39, 195, 44): 'stage', (195, 46, 195, 55): '"""/Points"""'}, {}), "(stage, '/Points')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((205, 17, 205, 54), 'pxr.UsdGeom.Scope.Define', 'UsdGeom.Scope.Define', ({(205, 38, 205, 43): 'stage', (205, 45, 205, 53): '"""/Scope"""'}, {}), "(stage, '/Scope')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((215, 17, 215, 56), 'pxr.UsdGeom.Sphere.Define', 'UsdGeom.Sphere.Define', ({(215, 39, 215, 44): 'stage', (215, 46, 215, 55): '"""/Sphere"""'}, {}), "(stage, '/Sphere')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((225, 17, 225, 54), 'pxr.UsdGeom.Xform.Define', 'UsdGeom.Xform.Define', ({(225, 38, 225, 43): 'stage', (225, 45, 225, 53): '"""/Xform"""'}, {}), "(stage, '/Xform')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((237, 16, 237, 42), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((241, 19, 241, 33), 'pxr.Gf.Matrix4d', 'Gf.Matrix4d', ({(241, 31, 241, 32): '1'}, {}), '(1)', False, 'from pxr import Gf\n'), ((242, 17, 242, 34), 'pxr.Gf.Vec3f', 'Gf.Vec3f', ({(242, 26, 242, 27): '0', (242, 29, 242, 30): '0', (242, 32, 242, 33): '0'}, {}), '(0, 0, 0)', False, 'from pxr import Gf\n'), ((244, 16, 244, 53), 'pxr.UsdGeom.Xform.Define', 'UsdGeom.Xform.Define', ({(244, 37, 244, 42): 'stage', (244, 44, 244, 52): '"""/Xform"""'}, {}), "(stage, '/Xform')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((266, 15, 266, 50), 'pxr.UsdGeom.Mesh.Define', 'UsdGeom.Mesh.Define', ({(266, 35, 266, 40): 'stage', (266, 42, 266, 49): '"""/Mesh"""'}, {}), "(stage, '/Mesh')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((269, 17, 269, 61), 'pxr.UsdGeom.BasisCurves.Define', 'UsdGeom.BasisCurves.Define', ({(269, 44, 269, 49): 'stage', (269, 51, 269, 60): '"""/Curves"""'}, {}), "(stage, '/Curves')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((289, 16, 289, 55), 'pxr.UsdGeom.Mesh.Define', 'UsdGeom.Mesh.Define', ({(289, 36, 289, 41): 'stage', (289, 43, 289, 54): '"""/overMesh"""'}, {}), "(stage, '/overMesh')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((293, 17, 293, 56), 'pxr.UsdGeom.Sphere.Define', 'UsdGeom.Sphere.Define', ({(293, 39, 293, 44): 'stage', (293, 46, 293, 55): '"""/Sphere"""'}, {}), "(stage, '/Sphere')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((297, 22, 297, 48), 'pxr.Usd.AttributeQuery', 'Usd.AttributeQuery', ({(297, 41, 297, 47): 'radius'}, {}), '(radius)', False, 'from pxr import Usd, Tf\n'), ((301, 12, 301, 38), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((305, 16, 305, 59), 'pxr.UsdGeom.Scope.Define', 'UsdGeom.Scope.Define', ({(305, 37, 305, 38): 's', (305, 40, 305, 58): '"""/parent/subscope"""'}, {}), "(s, '/parent/subscope')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((312, 15, 312, 57), 'pxr.UsdGeom.Mesh.Define', 'UsdGeom.Mesh.Define', ({(312, 35, 312, 36): 's', (312, 38, 312, 56): '"""/parent/subscope"""'}, {}), "(s, '/parent/subscope')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((316, 15, 316, 53), 'pxr.UsdGeom.Mesh.Define', 'UsdGeom.Mesh.Define', ({(316, 35, 316, 36): 's', (316, 38, 316, 52): '"""/parent/mesh"""'}, {}), "(s, '/parent/mesh')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((320, 12, 320, 38), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((336, 21, 338, 68), 'pxr.Sdf.AttributeSpec', 'Sdf.AttributeSpec', (), '', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((362, 16, 362, 42), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((364, 17, 364, 56), 'pxr.UsdGeom.Camera.Define', 'UsdGeom.Camera.Define', ({(364, 39, 364, 44): 'stage', (364, 46, 364, 55): '"""/Camera"""'}, {}), "(stage, '/Camera')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((393, 13, 393, 56), 'pxr.Vt.Vec4fArray', 'Vt.Vec4fArray', ({(393, 27, 393, 55): '[(1, 2, 3, 4), (8, 7, 6, 5)]'}, {}), '([(1, 2, 3, 4), (8, 7, 6, 5)])', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((396, 13, 396, 28), 'pxr.Vt.Vec4fArray', 'Vt.Vec4fArray', ({}, {}), '()', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((409, 16, 409, 42), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((413, 17, 413, 56), 'pxr.UsdGeom.Points.Define', 'UsdGeom.Points.Define', ({(413, 39, 413, 44): 'stage', (413, 46, 413, 55): '"""/Points"""'}, {}), "(stage, '/Points')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((427, 12, 427, 38), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((481, 27, 481, 72), 'pxr.UsdGeom.PointBased.ComputeExtent', 'UsdGeom.PointBased.ComputeExtent', ({(481, 60, 481, 71): 'emptyPoints'}, {}), '(emptyPoints)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((602, 27, 602, 54), 'pxr.Vt.Vec3fArray', 'Vt.Vec3fArray', ({(602, 41, 602, 53): 'pointsAsList'}, {}), '(pointsAsList)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((614, 12, 614, 38), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((631, 16, 631, 50), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(631, 35, 631, 49): '"""UsdGeomXform"""'}, {}), "('UsdGeomXform')", False, 'from pxr import Usd, Tf\n'), ((632, 20, 632, 58), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(632, 39, 632, 57): '"""UsdGeomImageable"""'}, {}), "('UsdGeomImageable')", False, 'from pxr import Usd, Tf\n'), ((633, 23, 633, 60), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(633, 42, 633, 59): '"""UsdGeomModelAPI"""'}, {}), "('UsdGeomModelAPI')", False, 'from pxr import Usd, Tf\n'), ((641, 16, 641, 50), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(641, 35, 641, 49): '"""UsdGeomXform"""'}, {}), "('UsdGeomXform')", False, 'from pxr import Usd, Tf\n'), ((642, 20, 642, 58), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(642, 39, 642, 57): '"""UsdGeomImageable"""'}, {}), "('UsdGeomImageable')", False, 'from pxr import Usd, Tf\n'), ((643, 23, 643, 60), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(643, 42, 643, 59): '"""UsdGeomModelAPI"""'}, {}), "('UsdGeomModelAPI')", False, 'from pxr import Usd, Tf\n'), ((650, 12, 650, 58), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({(650, 37, 650, 57): '"""AppliedSchemas.usd"""'}, {}), "('AppliedSchemas.usd')", False, 'from pxr import Usd, Tf\n'), ((655, 8, 655, 37), 'pxr.UsdGeom.MotionAPI.Apply', 'UsdGeom.MotionAPI.Apply', ({(655, 32, 655, 36): 'root'}, {}), '(root)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((657, 8, 657, 37), 'pxr.UsdGeom.MotionAPI.Apply', 'UsdGeom.MotionAPI.Apply', ({(657, 32, 657, 36): 'root'}, {}), '(root)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((661, 8, 661, 36), 'pxr.UsdGeom.ModelAPI.Apply', 'UsdGeom.ModelAPI.Apply', ({(661, 31, 661, 35): 'root'}, {}), '(root)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((673, 12, 673, 38), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((693, 12, 693, 38), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((704, 8, 704, 36), 'pxr.UsdGeom.ModelAPI.Apply', 'UsdGeom.ModelAPI.Apply', ({(704, 31, 704, 35): 'prim'}, {}), '(prim)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((705, 8, 705, 37), 'pxr.UsdGeom.MotionAPI.Apply', 'UsdGeom.MotionAPI.Apply', ({(705, 32, 705, 36): 'prim'}, {}), '(prim)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((386, 62, 386, 82), 'pxr.Gf.Vec2f', 'Gf.Vec2f', ({(386, 71, 386, 72): '(1)', (386, 74, 386, 81): '(1000000)'}, {}), '(1, 1000000)', False, 'from pxr import Gf\n'), ((387, 42, 387, 57), 'pxr.Gf.Vec2f', 'Gf.Vec2f', ({(387, 51, 387, 52): '(5)', (387, 54, 387, 56): '(10)'}, {}), '(5, 10)', False, 'from pxr import Gf\n'), ((391, 63, 391, 78), 'pxr.Vt.Vec4fArray', 'Vt.Vec4fArray', ({}, {}), '()', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((429, 21, 429, 54), 'pxr.UsdGeom.Sphere._GetStaticTfType', 'UsdGeom.Sphere._GetStaticTfType', ({}, {}), '()', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((432, 24, 432, 46), 'pxr.UsdGeom.Sphere', 'UsdGeom.Sphere', ({(432, 39, 432, 45): 'sphere'}, {}), '(sphere)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((434, 25, 434, 54), 'pxr.UsdGeom.Sphere', 'UsdGeom.Sphere', ({(434, 40, 434, 53): 'usdGeomSphere'}, {}), '(usdGeomSphere)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((496, 27, 496, 71), 'pxr.UsdGeom.PointBased.ComputeExtent', 'UsdGeom.PointBased.ComputeExtent', ({(496, 60, 496, 70): 'pointsData'}, {}), '(pointsData)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((507, 27, 507, 79), 'pxr.UsdGeom.Points.ComputeExtent', 'UsdGeom.Points.ComputeExtent', ({(507, 56, 507, 66): 'pointsData', (507, 68, 507, 78): 'widthsData'}, {}), '(pointsData, widthsData)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((513, 16, 513, 42), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((514, 25, 514, 60), 'pxr.UsdGeom.Points.Define', 'UsdGeom.Points.Define', ({(514, 47, 514, 48): 's', (514, 50, 514, 59): '"""/Points"""'}, {}), "(s, '/Points')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((534, 16, 534, 42), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((535, 23, 535, 54), 'pxr.UsdGeom.Mesh.Define', 'UsdGeom.Mesh.Define', ({(535, 43, 535, 44): 's', (535, 46, 535, 53): '"""/Mesh"""'}, {}), "(s, '/Mesh')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((572, 27, 572, 75), 'pxr.UsdGeom.Curves.ComputeExtent', 'UsdGeom.Curves.ComputeExtent', ({(572, 56, 572, 66): 'pointsData', (572, 68, 572, 74): 'widths'}, {}), '(pointsData, widths)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((578, 16, 578, 42), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((579, 30, 579, 75), 'pxr.UsdGeom.NurbsCurves.Define', 'UsdGeom.NurbsCurves.Define', ({(579, 57, 579, 58): 's', (579, 60, 579, 74): '"""/NurbsCurves"""'}, {}), "(s, '/NurbsCurves')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((589, 30, 589, 75), 'pxr.UsdGeom.BasisCurves.Define', 'UsdGeom.BasisCurves.Define', ({(589, 57, 589, 58): 's', (589, 60, 589, 74): '"""/BasisCurves"""'}, {}), "(s, '/BasisCurves')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((620, 69, 620, 84), 'pxr.Gf.Vec3f', 'Gf.Vec3f', ({(620, 78, 620, 79): '(1)', (620, 80, 620, 81): '(2)', (620, 82, 620, 83): '(2)'}, {}), '(1, 2, 2)', False, 'from pxr import Gf\n'), ((621, 69, 621, 85), 'pxr.Gf.Vec3f', 'Gf.Vec3f', ({(621, 78, 621, 80): '(12)', (621, 81, 621, 82): '(3)', (621, 83, 621, 84): '(3)'}, {}), '(12, 3, 3)', False, 'from pxr import Gf\n'), ((624, 15, 624, 30), 'pxr.Gf.Vec3f', 'Gf.Vec3f', ({(624, 24, 624, 25): '(1)', (624, 26, 624, 27): '(2)', (624, 28, 624, 29): '(2)'}, {}), '(1, 2, 2)', False, 'from pxr import Gf\n'), ((624, 32, 624, 47), 'pxr.Gf.Vec3f', 'Gf.Vec3f', ({(624, 41, 624, 42): '(1)', (624, 43, 624, 44): '(1)', (624, 45, 624, 46): '(1)'}, {}), '(1, 1, 1)', False, 'from pxr import Gf\n'), ((626, 69, 626, 84), 'pxr.Gf.Vec3f', 'Gf.Vec3f', ({(626, 78, 626, 79): '(1)', (626, 80, 626, 81): '(2)', (626, 82, 626, 83): '(2)'}, {}), '(1, 2, 2)', False, 'from pxr import Gf\n'), ((627, 69, 627, 84), 'pxr.Gf.Vec3f', 'Gf.Vec3f', ({(627, 78, 627, 79): '(1)', (627, 80, 627, 81): '(1)', (627, 82, 627, 83): '(1)'}, {}), '(1, 1, 1)', False, 'from pxr import Gf\n'), ((635, 24, 635, 57), 'pxr.Usd.SchemaRegistry.IsTyped', 'Usd.SchemaRegistry.IsTyped', ({(635, 51, 635, 56): 'xform'}, {}), '(xform)', False, 'from pxr import Usd, Tf\n'), ((636, 24, 636, 61), 'pxr.Usd.SchemaRegistry.IsTyped', 'Usd.SchemaRegistry.IsTyped', ({(636, 51, 636, 60): 'imageable'}, {}), '(imageable)', False, 'from pxr import Usd, Tf\n'), ((637, 25, 637, 65), 'pxr.Usd.SchemaRegistry.IsTyped', 'Usd.SchemaRegistry.IsTyped', ({(637, 52, 637, 64): 'geomModelAPI'}, {}), '(geomModelAPI)', False, 'from pxr import Usd, Tf\n'), ((677, 17, 677, 52), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(677, 36, 677, 51): '"""UsdGeomSphere"""'}, {}), "('UsdGeomSphere')", False, 'from pxr import Usd, Tf\n'), ((678, 17, 678, 51), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(678, 36, 678, 50): '"""UsdGeomGprim"""'}, {}), "('UsdGeomGprim')", False, 'from pxr import Usd, Tf\n'), ((679, 17, 679, 55), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(679, 36, 679, 54): '"""UsdGeomBoundable"""'}, {}), "('UsdGeomBoundable')", False, 'from pxr import Usd, Tf\n'), ((680, 17, 680, 55), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(680, 36, 680, 54): '"""UsdGeomXformable"""'}, {}), "('UsdGeomXformable')", False, 'from pxr import Usd, Tf\n'), ((681, 17, 681, 55), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(681, 36, 681, 54): '"""UsdGeomImageable"""'}, {}), "('UsdGeomImageable')", False, 'from pxr import Usd, Tf\n'), ((682, 17, 682, 47), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(682, 36, 682, 46): '"""UsdTyped"""'}, {}), "('UsdTyped')", False, 'from pxr import Usd, Tf\n'), ((696, 17, 696, 55), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(696, 36, 696, 54): '"""UsdGeomMotionAPI"""'}, {}), "('UsdGeomMotionAPI')", False, 'from pxr import Usd, Tf\n'), ((697, 17, 697, 54), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(697, 36, 697, 53): '"""UsdGeomModelAPI"""'}, {}), "('UsdGeomModelAPI')", False, 'from pxr import Usd, Tf\n'), ((321, 21, 321, 56), 'pxr.UsdGeom.Sphere.Define', 'UsdGeom.Sphere.Define', ({(321, 43, 321, 44): 's', (321, 46, 321, 55): '"""/sphere"""'}, {}), "(s, '/sphere')", False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((389, 35, 389, 50), 'pxr.Gf.Vec2f', 'Gf.Vec2f', ({(389, 44, 389, 45): '(5)', (389, 47, 389, 49): '(10)'}, {}), '(5, 10)', False, 'from pxr import Gf\n'), ((519, 28, 519, 50), 'pxr.Usd.TimeCode.Default', 'Usd.TimeCode.Default', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((539, 26, 539, 48), 'pxr.Usd.TimeCode.Default', 'Usd.TimeCode.Default', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((584, 33, 584, 55), 'pxr.Usd.TimeCode.Default', 'Usd.TimeCode.Default', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((594, 33, 594, 55), 'pxr.Usd.TimeCode.Default', 'Usd.TimeCode.Default', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((609, 28, 609, 50), 'pxr.Gf.IsClose', 'Gf.IsClose', ({(609, 39, 609, 40): 'a', (609, 42, 609, 43): 'b', (609, 45, 609, 49): '(1e-05)'}, {}), '(a, b, 1e-05)', False, 'from pxr import Gf\n'), ((716, 24, 716, 58), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(716, 43, 716, 57): '"""UsdGeomXform"""'}, {}), "('UsdGeomXform')", False, 'from pxr import Usd, Tf\n'), ((719, 24, 719, 62), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(719, 43, 719, 61): '"""UsdGeomImageable"""'}, {}), "('UsdGeomImageable')", False, 'from pxr import Usd, Tf\n'), ((723, 24, 723, 57), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', ({(723, 43, 723, 56): '"""UsdModelAPI"""'}, {}), "('UsdModelAPI')", False, 'from pxr import Usd, Tf\n'), ((43, 12, 43, 32), 'pxr.Usd.SchemaRegistry', 'Usd.SchemaRegistry', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((499, 32, 499, 54), 'pxr.Gf.IsClose', 'Gf.IsClose', ({(499, 43, 499, 44): 'a', (499, 46, 499, 47): 'b', (499, 49, 499, 53): '(1e-05)'}, {}), '(a, b, 1e-05)', False, 'from pxr import Gf\n'), ((542, 32, 542, 54), 'pxr.Gf.IsClose', 'Gf.IsClose', ({(542, 43, 542, 44): 'a', (542, 46, 542, 47): 'b', (542, 49, 542, 53): '(1e-05)'}, {}), '(a, b, 1e-05)', False, 'from pxr import Gf\n'), ((575, 32, 575, 54), 'pxr.Gf.IsClose', 'Gf.IsClose', ({(575, 43, 575, 44): 'a', (575, 46, 575, 47): 'b', (575, 49, 575, 53): '(1e-05)'}, {}), '(a, b, 1e-05)', False, 'from pxr import Gf\n'), ((587, 32, 587, 54), 'pxr.Gf.IsClose', 'Gf.IsClose', ({(587, 43, 587, 44): 'a', (587, 46, 587, 47): 'b', (587, 49, 587, 53): '(1e-05)'}, {}), '(a, b, 1e-05)', False, 'from pxr import Gf\n'), ((597, 32, 597, 54), 'pxr.Gf.IsClose', 'Gf.IsClose', ({(597, 43, 597, 44): 'a', (597, 46, 597, 47): 'b', (597, 49, 597, 53): '(1e-05)'}, {}), '(a, b, 1e-05)', False, 'from pxr import Gf\n'), ((619, 24, 619, 46), 'pxr.UsdGeom.ModelAPI', 'UsdGeom.ModelAPI', ({(619, 41, 619, 45): 'prim'}, {}), '(prim)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((625, 24, 625, 46), 'pxr.UsdGeom.ModelAPI', 'UsdGeom.ModelAPI', ({(625, 41, 625, 45): 'prim'}, {}), '(prim)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((645, 24, 645, 44), 'pxr.Usd.SchemaRegistry', 'Usd.SchemaRegistry', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((646, 25, 646, 45), 'pxr.Usd.SchemaRegistry', 'Usd.SchemaRegistry', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((647, 25, 647, 45), 'pxr.Usd.SchemaRegistry', 'Usd.SchemaRegistry', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((667, 53, 667, 63), 'pxr.Usd.Prim', 'Usd.Prim', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((669, 52, 669, 62), 'pxr.Usd.Prim', 'Usd.Prim', ({}, {}), '()', False, 'from pxr import Usd, Tf\n'), ((510, 36, 510, 58), 'pxr.Gf.IsClose', 'Gf.IsClose', ({(510, 47, 510, 48): 'a', (510, 50, 510, 51): 'b', (510, 53, 510, 57): '(1e-05)'}, {}), '(a, b, 1e-05)', False, 'from pxr import Gf\n'), ((523, 36, 523, 58), 'pxr.Gf.IsClose', 'Gf.IsClose', ({(523, 47, 523, 48): 'a', (523, 50, 523, 51): 'b', (523, 53, 523, 57): '(1e-05)'}, {}), '(a, b, 1e-05)', False, 'from pxr import Gf\n'), ((620, 25, 620, 47), 'pxr.UsdGeom.ModelAPI', 'UsdGeom.ModelAPI', ({(620, 42, 620, 46): 'prim'}, {}), '(prim)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((621, 25, 621, 47), 'pxr.UsdGeom.ModelAPI', 'UsdGeom.ModelAPI', ({(621, 42, 621, 46): 'prim'}, {}), '(prim)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((626, 25, 626, 47), 'pxr.UsdGeom.ModelAPI', 'UsdGeom.ModelAPI', ({(626, 42, 626, 46): 'prim'}, {}), '(prim)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((627, 25, 627, 47), 'pxr.UsdGeom.ModelAPI', 'UsdGeom.ModelAPI', ({(627, 42, 627, 46): 'prim'}, {}), '(prim)', False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n')]