#!/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()

[((31022, 31037), 'unittest.main', 'unittest.main', ([], {}), '()\n', (31035, 31037), False, 'import sys, unittest\n'), ((1273, 1300), 'pxr.Sdf.Layer.CreateAnonymous', 'Sdf.Layer.CreateAnonymous', ([], {}), '()\n', (1298, 1300), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((1317, 1345), 'pxr.Usd.Stage.Open', 'Usd.Stage.Open', (['l.identifier'], {}), '(l.identifier)\n', (1331, 1345), False, 'from pxr import Usd, Tf\n'), ((1436, 1451), 'pxr.UsdGeom.Mesh', 'UsdGeom.Mesh', (['p'], {}), '(p)\n', (1448, 1451), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((3957, 3984), 'pxr.Sdf.Layer.CreateAnonymous', 'Sdf.Layer.CreateAnonymous', ([], {}), '()\n', (3982, 3984), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((4001, 4029), 'pxr.Usd.Stage.Open', 'Usd.Stage.Open', (['l.identifier'], {}), '(l.identifier)\n', (4015, 4029), False, 'from pxr import Usd, Tf\n'), ((4332, 4381), 'pxr.UsdGeom.BasisCurves.Define', 'UsdGeom.BasisCurves.Define', (['stage', '"""/BasisCurves"""'], {}), "(stage, '/BasisCurves')\n", (4358, 4381), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((4789, 4828), 'pxr.UsdGeom.Camera.Define', 'UsdGeom.Camera.Define', (['stage', '"""/Camera"""'], {}), "(stage, '/Camera')\n", (4810, 4828), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((5228, 5269), 'pxr.UsdGeom.Capsule.Define', 'UsdGeom.Capsule.Define', (['stage', '"""/Capsule"""'], {}), "(stage, '/Capsule')\n", (5250, 5269), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((5662, 5697), 'pxr.UsdGeom.Cone.Define', 'UsdGeom.Cone.Define', (['stage', '"""/Cone"""'], {}), "(stage, '/Cone')\n", (5681, 5697), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((6081, 6116), 'pxr.UsdGeom.Cube.Define', 'UsdGeom.Cube.Define', (['stage', '"""/Cube"""'], {}), "(stage, '/Cube')\n", (6100, 6116), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((6504, 6547), 'pxr.UsdGeom.Cylinder.Define', 'UsdGeom.Cylinder.Define', (['stage', '"""/Cylinder"""'], {}), "(stage, '/Cylinder')\n", (6527, 6547), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((6939, 6974), 'pxr.UsdGeom.Mesh.Define', 'UsdGeom.Mesh.Define', (['stage', '"""/Mesh"""'], {}), "(stage, '/Mesh')\n", (6958, 6974), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((7373, 7422), 'pxr.UsdGeom.NurbsCurves.Define', 'UsdGeom.NurbsCurves.Define', (['stage', '"""/NurbsCurves"""'], {}), "(stage, '/NurbsCurves')\n", (7399, 7422), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((7834, 7881), 'pxr.UsdGeom.NurbsPatch.Define', 'UsdGeom.NurbsPatch.Define', (['stage', '"""/NurbsPatch"""'], {}), "(stage, '/NurbsPatch')\n", (7859, 7881), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((8287, 8326), 'pxr.UsdGeom.Points.Define', 'UsdGeom.Points.Define', (['stage', '"""/Points"""'], {}), "(stage, '/Points')\n", (8308, 8326), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((8719, 8756), 'pxr.UsdGeom.Scope.Define', 'UsdGeom.Scope.Define', (['stage', '"""/Scope"""'], {}), "(stage, '/Scope')\n", (8739, 8756), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((9136, 9175), 'pxr.UsdGeom.Sphere.Define', 'UsdGeom.Sphere.Define', (['stage', '"""/Sphere"""'], {}), "(stage, '/Sphere')\n", (9157, 9175), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((9568, 9605), 'pxr.UsdGeom.Xform.Define', 'UsdGeom.Xform.Define', (['stage', '"""/Xform"""'], {}), "(stage, '/Xform')\n", (9588, 9605), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((10050, 10076), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ([], {}), '()\n', (10074, 10076), False, 'from pxr import Usd, Tf\n'), ((10124, 10138), 'pxr.Gf.Matrix4d', 'Gf.Matrix4d', (['(1)'], {}), '(1)\n', (10135, 10138), False, 'from pxr import Gf\n'), ((10156, 10173), 'pxr.Gf.Vec3f', 'Gf.Vec3f', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (10164, 10173), False, 'from pxr import Gf\n'), ((10191, 10228), 'pxr.UsdGeom.Xform.Define', 'UsdGeom.Xform.Define', (['stage', '"""/Xform"""'], {}), "(stage, '/Xform')\n", (10211, 10228), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((11198, 11233), 'pxr.UsdGeom.Mesh.Define', 'UsdGeom.Mesh.Define', (['stage', '"""/Mesh"""'], {}), "(stage, '/Mesh')\n", (11217, 11233), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((11310, 11354), 'pxr.UsdGeom.BasisCurves.Define', 'UsdGeom.BasisCurves.Define', (['stage', '"""/Curves"""'], {}), "(stage, '/Curves')\n", (11336, 11354), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((12468, 12507), 'pxr.UsdGeom.Mesh.Define', 'UsdGeom.Mesh.Define', (['stage', '"""/overMesh"""'], {}), "(stage, '/overMesh')\n", (12487, 12507), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((12639, 12678), 'pxr.UsdGeom.Sphere.Define', 'UsdGeom.Sphere.Define', (['stage', '"""/Sphere"""'], {}), "(stage, '/Sphere')\n", (12660, 12678), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((12793, 12819), 'pxr.Usd.AttributeQuery', 'Usd.AttributeQuery', (['radius'], {}), '(radius)\n', (12811, 12819), False, 'from pxr import Usd, Tf\n'), ((12922, 12948), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ([], {}), '()\n', (12946, 12948), False, 'from pxr import Usd, Tf\n'), ((13067, 13110), 'pxr.UsdGeom.Scope.Define', 'UsdGeom.Scope.Define', (['s', '"""/parent/subscope"""'], {}), "(s, '/parent/subscope')\n", (13087, 13110), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((13505, 13547), 'pxr.UsdGeom.Mesh.Define', 'UsdGeom.Mesh.Define', (['s', '"""/parent/subscope"""'], {}), "(s, '/parent/subscope')\n", (13524, 13547), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((13684, 13722), 'pxr.UsdGeom.Mesh.Define', 'UsdGeom.Mesh.Define', (['s', '"""/parent/mesh"""'], {}), "(s, '/parent/mesh')\n", (13703, 13722), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((13805, 13831), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ([], {}), '()\n', (13829, 13831), False, 'from pxr import Usd, Tf\n'), ((14652, 14779), 'pxr.Sdf.AttributeSpec', 'Sdf.AttributeSpec', (['sphereSpec', '"""radius"""', 'Sdf.ValueTypeNames.Double'], {'variability': 'Sdf.VariabilityUniform', 'declaresCustom': '(True)'}), "(sphereSpec, 'radius', Sdf.ValueTypeNames.Double,\n    variability=Sdf.VariabilityUniform, declaresCustom=True)\n", (14669, 14779), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((15922, 15948), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ([], {}), '()\n', (15946, 15948), False, 'from pxr import Usd, Tf\n'), ((15967, 16006), 'pxr.UsdGeom.Camera.Define', 'UsdGeom.Camera.Define', (['stage', '"""/Camera"""'], {}), "(stage, '/Camera')\n", (15988, 16006), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((17377, 17420), 'pxr.Vt.Vec4fArray', 'Vt.Vec4fArray', (['[(1, 2, 3, 4), (8, 7, 6, 5)]'], {}), '([(1, 2, 3, 4), (8, 7, 6, 5)])\n', (17390, 17420), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((17548, 17563), 'pxr.Vt.Vec4fArray', 'Vt.Vec4fArray', ([], {}), '()\n', (17561, 17563), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((18081, 18107), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ([], {}), '()\n', (18105, 18107), False, 'from pxr import Usd, Tf\n'), ((18150, 18189), 'pxr.UsdGeom.Points.Define', 'UsdGeom.Points.Define', (['stage', '"""/Points"""'], {}), "(stage, '/Points')\n", (18171, 18189), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((18762, 18788), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ([], {}), '()\n', (18786, 18788), False, 'from pxr import Usd, Tf\n'), ((21107, 21152), 'pxr.UsdGeom.PointBased.ComputeExtent', 'UsdGeom.PointBased.ComputeExtent', (['emptyPoints'], {}), '(emptyPoints)\n', (21139, 21152), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((26137, 26164), 'pxr.Vt.Vec3fArray', 'Vt.Vec3fArray', (['pointsAsList'], {}), '(pointsAsList)\n', (26150, 26164), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((26483, 26509), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ([], {}), '()\n', (26507, 26509), False, 'from pxr import Usd, Tf\n'), ((27264, 27298), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomXform"""'], {}), "('UsdGeomXform')\n", (27282, 27298), False, 'from pxr import Usd, Tf\n'), ((27319, 27357), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomImageable"""'], {}), "('UsdGeomImageable')\n", (27337, 27357), False, 'from pxr import Usd, Tf\n'), ((27381, 27418), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomModelAPI"""'], {}), "('UsdGeomModelAPI')\n", (27399, 27418), False, 'from pxr import Usd, Tf\n'), ((27694, 27728), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomXform"""'], {}), "('UsdGeomXform')\n", (27712, 27728), False, 'from pxr import Usd, Tf\n'), ((27749, 27787), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomImageable"""'], {}), "('UsdGeomImageable')\n", (27767, 27787), False, 'from pxr import Usd, Tf\n'), ((27811, 27848), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomModelAPI"""'], {}), "('UsdGeomModelAPI')\n", (27829, 27848), False, 'from pxr import Usd, Tf\n'), ((28094, 28140), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', (['"""AppliedSchemas.usd"""'], {}), "('AppliedSchemas.usd')\n", (28118, 28140), False, 'from pxr import Usd, Tf\n'), ((28270, 28299), 'pxr.UsdGeom.MotionAPI.Apply', 'UsdGeom.MotionAPI.Apply', (['root'], {}), '(root)\n', (28293, 28299), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((28374, 28403), 'pxr.UsdGeom.MotionAPI.Apply', 'UsdGeom.MotionAPI.Apply', (['root'], {}), '(root)\n', (28397, 28403), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((28532, 28560), 'pxr.UsdGeom.ModelAPI.Apply', 'UsdGeom.ModelAPI.Apply', (['root'], {}), '(root)\n', (28554, 28560), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((29053, 29079), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ([], {}), '()\n', (29077, 29079), False, 'from pxr import Usd, Tf\n'), ((29891, 29917), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ([], {}), '()\n', (29915, 29917), False, 'from pxr import Usd, Tf\n'), ((30240, 30268), 'pxr.UsdGeom.ModelAPI.Apply', 'UsdGeom.ModelAPI.Apply', (['prim'], {}), '(prim)\n', (30262, 30268), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((30277, 30306), 'pxr.UsdGeom.MotionAPI.Apply', 'UsdGeom.MotionAPI.Apply', (['prim'], {}), '(prim)\n', (30300, 30306), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((17069, 17089), 'pxr.Gf.Vec2f', 'Gf.Vec2f', (['(1)', '(1000000)'], {}), '(1, 1000000)\n', (17077, 17089), False, 'from pxr import Gf\n'), ((17133, 17148), 'pxr.Gf.Vec2f', 'Gf.Vec2f', (['(5)', '(10)'], {}), '(5, 10)\n', (17141, 17148), False, 'from pxr import Gf\n'), ((17346, 17361), 'pxr.Vt.Vec4fArray', 'Vt.Vec4fArray', ([], {}), '()\n', (17359, 17361), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((18870, 18903), 'pxr.UsdGeom.Sphere._GetStaticTfType', 'UsdGeom.Sphere._GetStaticTfType', ([], {}), '()\n', (18901, 18903), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((19069, 19091), 'pxr.UsdGeom.Sphere', 'UsdGeom.Sphere', (['sphere'], {}), '(sphere)\n', (19083, 19091), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((19201, 19230), 'pxr.UsdGeom.Sphere', 'UsdGeom.Sphere', (['usdGeomSphere'], {}), '(usdGeomSphere)\n', (19215, 19230), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((21786, 21830), 'pxr.UsdGeom.PointBased.ComputeExtent', 'UsdGeom.PointBased.ComputeExtent', (['pointsData'], {}), '(pointsData)\n', (21818, 21830), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((22159, 22211), 'pxr.UsdGeom.Points.ComputeExtent', 'UsdGeom.Points.ComputeExtent', (['pointsData', 'widthsData'], {}), '(pointsData, widthsData)\n', (22187, 22211), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((22487, 22513), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ([], {}), '()\n', (22511, 22513), False, 'from pxr import Usd, Tf\n'), ((22539, 22574), 'pxr.UsdGeom.Points.Define', 'UsdGeom.Points.Define', (['s', '"""/Points"""'], {}), "(s, '/Points')\n", (22560, 22574), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((23394, 23420), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ([], {}), '()\n', (23418, 23420), False, 'from pxr import Usd, Tf\n'), ((23444, 23475), 'pxr.UsdGeom.Mesh.Define', 'UsdGeom.Mesh.Define', (['s', '"""/Mesh"""'], {}), "(s, '/Mesh')\n", (23463, 23475), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((24832, 24880), 'pxr.UsdGeom.Curves.ComputeExtent', 'UsdGeom.Curves.ComputeExtent', (['pointsData', 'widths'], {}), '(pointsData, widths)\n', (24860, 24880), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((25077, 25103), 'pxr.Usd.Stage.CreateInMemory', 'Usd.Stage.CreateInMemory', ([], {}), '()\n', (25101, 25103), False, 'from pxr import Usd, Tf\n'), ((25134, 25179), 'pxr.UsdGeom.NurbsCurves.Define', 'UsdGeom.NurbsCurves.Define', (['s', '"""/NurbsCurves"""'], {}), "(s, '/NurbsCurves')\n", (25160, 25179), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((25566, 25611), 'pxr.UsdGeom.BasisCurves.Define', 'UsdGeom.BasisCurves.Define', (['s', '"""/BasisCurves"""'], {}), "(s, '/BasisCurves')\n", (25592, 25611), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((26773, 26790), 'pxr.Gf.Vec3f', 'Gf.Vec3f', (['(1)', '(2)', '(2)'], {}), '(1, 2, 2)\n', (26781, 26790), False, 'from pxr import Gf\n'), ((26859, 26877), 'pxr.Gf.Vec3f', 'Gf.Vec3f', (['(12)', '(3)', '(3)'], {}), '(12, 3, 3)\n', (26867, 26877), False, 'from pxr import Gf\n'), ((26920, 26937), 'pxr.Gf.Vec3f', 'Gf.Vec3f', (['(1)', '(2)', '(2)'], {}), '(1, 2, 2)\n', (26928, 26937), False, 'from pxr import Gf\n'), ((26937, 26954), 'pxr.Gf.Vec3f', 'Gf.Vec3f', (['(1)', '(1)', '(1)'], {}), '(1, 1, 1)\n', (26945, 26954), False, 'from pxr import Gf\n'), ((27091, 27108), 'pxr.Gf.Vec3f', 'Gf.Vec3f', (['(1)', '(2)', '(2)'], {}), '(1, 2, 2)\n', (27099, 27108), False, 'from pxr import Gf\n'), ((27177, 27194), 'pxr.Gf.Vec3f', 'Gf.Vec3f', (['(1)', '(1)', '(1)'], {}), '(1, 1, 1)\n', (27185, 27194), False, 'from pxr import Gf\n'), ((27444, 27477), 'pxr.Usd.SchemaRegistry.IsTyped', 'Usd.SchemaRegistry.IsTyped', (['xform'], {}), '(xform)\n', (27470, 27477), False, 'from pxr import Usd, Tf\n'), ((27503, 27540), 'pxr.Usd.SchemaRegistry.IsTyped', 'Usd.SchemaRegistry.IsTyped', (['imageable'], {}), '(imageable)\n', (27529, 27540), False, 'from pxr import Usd, Tf\n'), ((27567, 27607), 'pxr.Usd.SchemaRegistry.IsTyped', 'Usd.SchemaRegistry.IsTyped', (['geomModelAPI'], {}), '(geomModelAPI)\n', (27593, 27607), False, 'from pxr import Usd, Tf\n'), ((29210, 29245), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomSphere"""'], {}), "('UsdGeomSphere')\n", (29228, 29245), False, 'from pxr import Usd, Tf\n'), ((29264, 29298), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomGprim"""'], {}), "('UsdGeomGprim')\n", (29282, 29298), False, 'from pxr import Usd, Tf\n'), ((29317, 29355), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomBoundable"""'], {}), "('UsdGeomBoundable')\n", (29335, 29355), False, 'from pxr import Usd, Tf\n'), ((29374, 29412), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomXformable"""'], {}), "('UsdGeomXformable')\n", (29392, 29412), False, 'from pxr import Usd, Tf\n'), ((29431, 29469), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomImageable"""'], {}), "('UsdGeomImageable')\n", (29449, 29469), False, 'from pxr import Usd, Tf\n'), ((29488, 29518), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdTyped"""'], {}), "('UsdTyped')\n", (29506, 29518), False, 'from pxr import Usd, Tf\n'), ((29973, 30011), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomMotionAPI"""'], {}), "('UsdGeomMotionAPI')\n", (29991, 30011), False, 'from pxr import Usd, Tf\n'), ((30030, 30067), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomModelAPI"""'], {}), "('UsdGeomModelAPI')\n", (30048, 30067), False, 'from pxr import Usd, Tf\n'), ((13853, 13888), 'pxr.UsdGeom.Sphere.Define', 'UsdGeom.Sphere.Define', (['s', '"""/sphere"""'], {}), "(s, '/sphere')\n", (13874, 13888), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((17258, 17273), 'pxr.Gf.Vec2f', 'Gf.Vec2f', (['(5)', '(10)'], {}), '(5, 10)\n', (17266, 17273), False, 'from pxr import Gf\n'), ((22779, 22801), 'pxr.Usd.TimeCode.Default', 'Usd.TimeCode.Default', ([], {}), '()\n', (22799, 22801), False, 'from pxr import Usd, Tf\n'), ((23624, 23646), 'pxr.Usd.TimeCode.Default', 'Usd.TimeCode.Default', ([], {}), '()\n', (23644, 23646), False, 'from pxr import Usd, Tf\n'), ((25395, 25417), 'pxr.Usd.TimeCode.Default', 'Usd.TimeCode.Default', ([], {}), '()\n', (25415, 25417), False, 'from pxr import Usd, Tf\n'), ((25827, 25849), 'pxr.Usd.TimeCode.Default', 'Usd.TimeCode.Default', ([], {}), '()\n', (25847, 25849), False, 'from pxr import Usd, Tf\n'), ((26388, 26411), 'pxr.Gf.IsClose', 'Gf.IsClose', (['a', 'b', '(1e-05)'], {}), '(a, b, 1e-05)\n', (26398, 26411), False, 'from pxr import Gf\n'), ((30677, 30711), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomXform"""'], {}), "('UsdGeomXform')\n", (30695, 30711), False, 'from pxr import Usd, Tf\n'), ((30789, 30827), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdGeomImageable"""'], {}), "('UsdGeomImageable')\n", (30807, 30827), False, 'from pxr import Usd, Tf\n'), ((30955, 30988), 'pxr.Tf.Type.FindByName', 'Tf.Type.FindByName', (['"""UsdModelAPI"""'], {}), "('UsdModelAPI')\n", (30973, 30988), False, 'from pxr import Usd, Tf\n'), ((1634, 1654), 'pxr.Usd.SchemaRegistry', 'Usd.SchemaRegistry', ([], {}), '()\n', (1652, 1654), False, 'from pxr import Usd, Tf\n'), ((21923, 21946), 'pxr.Gf.IsClose', 'Gf.IsClose', (['a', 'b', '(1e-05)'], {}), '(a, b, 1e-05)\n', (21933, 21946), False, 'from pxr import Gf\n'), ((23740, 23763), 'pxr.Gf.IsClose', 'Gf.IsClose', (['a', 'b', '(1e-05)'], {}), '(a, b, 1e-05)\n', (23750, 23763), False, 'from pxr import Gf\n'), ((24973, 24996), 'pxr.Gf.IsClose', 'Gf.IsClose', (['a', 'b', '(1e-05)'], {}), '(a, b, 1e-05)\n', (24983, 24996), False, 'from pxr import Gf\n'), ((25511, 25534), 'pxr.Gf.IsClose', 'Gf.IsClose', (['a', 'b', '(1e-05)'], {}), '(a, b, 1e-05)\n', (25521, 25534), False, 'from pxr import Gf\n'), ((25943, 25966), 'pxr.Gf.IsClose', 'Gf.IsClose', (['a', 'b', '(1e-05)'], {}), '(a, b, 1e-05)\n', (25953, 25966), False, 'from pxr import Gf\n'), ((26660, 26682), 'pxr.UsdGeom.ModelAPI', 'UsdGeom.ModelAPI', (['prim'], {}), '(prim)\n', (26676, 26682), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((26978, 27000), 'pxr.UsdGeom.ModelAPI', 'UsdGeom.ModelAPI', (['prim'], {}), '(prim)\n', (26994, 27000), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((27874, 27894), 'pxr.Usd.SchemaRegistry', 'Usd.SchemaRegistry', ([], {}), '()\n', (27892, 27894), False, 'from pxr import Usd, Tf\n'), ((27939, 27959), 'pxr.Usd.SchemaRegistry', 'Usd.SchemaRegistry', ([], {}), '()\n', (27957, 27959), False, 'from pxr import Usd, Tf\n'), ((28008, 28028), 'pxr.Usd.SchemaRegistry', 'Usd.SchemaRegistry', ([], {}), '()\n', (28026, 28028), False, 'from pxr import Usd, Tf\n'), ((28847, 28857), 'pxr.Usd.Prim', 'Usd.Prim', ([], {}), '()\n', (28855, 28857), False, 'from pxr import Usd, Tf\n'), ((28963, 28973), 'pxr.Usd.Prim', 'Usd.Prim', ([], {}), '()\n', (28971, 28973), False, 'from pxr import Usd, Tf\n'), ((22383, 22406), 'pxr.Gf.IsClose', 'Gf.IsClose', (['a', 'b', '(1e-05)'], {}), '(a, b, 1e-05)\n', (22393, 22406), False, 'from pxr import Gf\n'), ((22993, 23016), 'pxr.Gf.IsClose', 'Gf.IsClose', (['a', 'b', '(1e-05)'], {}), '(a, b, 1e-05)\n', (23003, 23016), False, 'from pxr import Gf\n'), ((26729, 26751), 'pxr.UsdGeom.ModelAPI', 'UsdGeom.ModelAPI', (['prim'], {}), '(prim)\n', (26745, 26751), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((26815, 26837), 'pxr.UsdGeom.ModelAPI', 'UsdGeom.ModelAPI', (['prim'], {}), '(prim)\n', (26831, 26837), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((27047, 27069), 'pxr.UsdGeom.ModelAPI', 'UsdGeom.ModelAPI', (['prim'], {}), '(prim)\n', (27063, 27069), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n'), ((27133, 27155), 'pxr.UsdGeom.ModelAPI', 'UsdGeom.ModelAPI', (['prim'], {}), '(prim)\n', (27149, 27155), False, 'from pxr import Sdf, Usd, UsdGeom, Vt, Gf, Tf\n')]