示例#1
0
    def test_Repr(self):
        ia = Vt.IntArray()
        self.assertEqual(ia, eval(repr(ia)))

        sa = Vt.UInt64Array((0, 18446744073709551615))
        self.assertEqual(sa, eval(repr(sa)))

        sa = Vt.StringArray(('\\', ))
        self.assertEqual(sa, eval(repr(sa)))

        ba = Vt.BoolArray((True, False))
        self.assertEqual(ba, eval(repr(ba)))

        fa = Vt.FloatArray((1.0000001, 1e39, float('-inf')))
        self.assertGreater(fa[0], 1.0)
        self.assertEqual(fa, eval(repr(fa)))

        da = Vt.DoubleArray((1.0000000000000002, 1e39, 1e309, float('-inf')))
        self.assertGreater(da[0], 1.0)
        self.assertEqual(da, eval(repr(da)))
示例#2
0
import os
from pxr import Usd, UsdGeom, Tf, Sdf, Vt, Gf

# Helper script to generate a USD file with a single sphere primitive with all the primvar types on it
# both array and scalar
# just for reference in case we need to generate ./data/primVars.usda again

usdTypes = {
    "Bool": [Vt.Bool(False), Vt.BoolArray([False, True])],
    "UChar": [Vt.UChar(0), Vt.UCharArray([0, 1, 2])],
    "Int": [Vt.Int(-1), Vt.IntArray([0, -1, -2])],
    "UInt":
    [Vt.UInt(4294967295),
     Vt.UIntArray([4294967293, 4294967294, 4294967295])],
    "UInt64": [
        Vt.UInt64(18446744073709551615),
        Vt.UInt64Array(
            [18446744073709551613, 18446744073709551614, 18446744073709551615])
    ],
    "Int64": [
        Vt.Int64(-9223372036854775808),
        Vt.Int64Array(
            [9223372036854775805, 9223372036854775806, 9223372036854775807])
    ],
    "Half": [Vt.Half(0.5), Vt.HalfArray([0.1, 0.2, 0.3])],
    "Float": [Vt.Float(0.6), Vt.FloatArray([0.7, 0.8, 0.9])],
    "Double": [Vt.Double(1.1), Vt.DoubleArray([1.2, 1.3, 1.4])],
    "String": ["this", ["is", "a", "test"]],
    "Token": ["t-this", ["t-is", "t-a", "t-test"]],
    "Int2": [Gf.Vec2i(1, 2), [Gf.Vec2i(3, 4),
                              Gf.Vec2i(5, 6),