tinyusd 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. {tinyusd-0.1.0 → tinyusd-0.2.0}/Cargo.lock +4 -3
  2. {tinyusd-0.1.0 → tinyusd-0.2.0}/Cargo.toml +1 -1
  3. {tinyusd-0.1.0 → tinyusd-0.2.0}/PKG-INFO +1 -1
  4. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/Cargo.toml +8 -2
  5. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/examples/dump.rs +10 -1
  6. tinyusd-0.2.0/crates/tinyusd-core/examples/write_bench.rs +70 -0
  7. tinyusd-0.2.0/crates/tinyusd-core/src/author.rs +1028 -0
  8. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/src/helpers/mod.rs +3 -1
  9. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/src/helpers/physics.rs +518 -1
  10. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/src/host.rs +8 -0
  11. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/src/lib.rs +14 -0
  12. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/src/stage.rs +40 -13
  13. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/src/value.rs +247 -1
  14. tinyusd-0.2.0/crates/tinyusd-core/tests/physics.rs +474 -0
  15. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/tests/query.rs +3 -3
  16. tinyusd-0.2.0/crates/tinyusd-core/tests/write.rs +615 -0
  17. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-py/Cargo.toml +1 -1
  18. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-py/python/tinyusd/__init__.py +6 -0
  19. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-py/python/tinyusd/__init__.pyi +98 -1
  20. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-py/src/lib.rs +866 -9
  21. tinyusd-0.2.0/crates/tinyusd-py/tests/test_write.py +294 -0
  22. tinyusd-0.1.0/crates/tinyusd-core/tests/physics.rs +0 -179
  23. {tinyusd-0.1.0 → tinyusd-0.2.0}/LICENSE +0 -0
  24. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/src/helpers/instancer.rs +0 -0
  25. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/src/helpers/material.rs +0 -0
  26. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/src/helpers/primvar.rs +0 -0
  27. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/src/helpers/skel.rs +0 -0
  28. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/src/helpers/xform.rs +0 -0
  29. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/src/schemas.rs +0 -0
  30. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/tests/host.rs +0 -0
  31. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/tests/resolve.rs +0 -0
  32. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/tests/schemas.rs +0 -0
  33. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-core/tests/skel_instancer.rs +0 -0
  34. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-py/python/tinyusd/py.typed +0 -0
  35. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-py/tests/test_examples.py +0 -0
  36. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-py/tests/test_host.py +0 -0
  37. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-py/tests/test_physics.py +0 -0
  38. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-py/tests/test_query.py +0 -0
  39. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-py/tests/test_resolve.py +0 -0
  40. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-py/tests/test_schemas.py +0 -0
  41. {tinyusd-0.1.0 → tinyusd-0.2.0}/crates/tinyusd-py/tests/test_skel_instancer.py +0 -0
  42. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/INDEX.txt +0 -0
  43. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/bitflags/LICENSE-APACHE +0 -0
  44. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/bitflags/LICENSE-MIT +0 -0
  45. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/bumpalo/LICENSE-APACHE +0 -0
  46. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/bumpalo/LICENSE-MIT +0 -0
  47. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/bytemuck/LICENSE-APACHE +0 -0
  48. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/bytemuck/LICENSE-MIT +0 -0
  49. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/bytemuck/LICENSE-ZLIB +0 -0
  50. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/cfg-if/LICENSE-APACHE +0 -0
  51. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/cfg-if/LICENSE-MIT +0 -0
  52. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/crc32fast/LICENSE-APACHE +0 -0
  53. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/crc32fast/LICENSE-MIT +0 -0
  54. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/derive_more/LICENSE +0 -0
  55. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/equivalent/LICENSE-APACHE +0 -0
  56. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/equivalent/LICENSE-MIT +0 -0
  57. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/flate2/LICENSE-APACHE +0 -0
  58. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/flate2/LICENSE-MIT +0 -0
  59. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/getrandom/LICENSE-APACHE +0 -0
  60. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/getrandom/LICENSE-MIT +0 -0
  61. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/half/LICENSE-APACHE +0 -0
  62. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/half/LICENSE-MIT +0 -0
  63. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/hashbrown/LICENSE-APACHE +0 -0
  64. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/hashbrown/LICENSE-MIT +0 -0
  65. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/indexmap/LICENSE-APACHE +0 -0
  66. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/indexmap/LICENSE-MIT +0 -0
  67. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/itoa/LICENSE-APACHE +0 -0
  68. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/itoa/LICENSE-MIT +0 -0
  69. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/libc/LICENSE-APACHE +0 -0
  70. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/libc/LICENSE-MIT +0 -0
  71. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/libm/LICENSE.txt +0 -0
  72. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/log/LICENSE-APACHE +0 -0
  73. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/log/LICENSE-MIT +0 -0
  74. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/logos/LICENSE-APACHE +0 -0
  75. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/logos/LICENSE-MIT +0 -0
  76. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/lz4_flex/LICENSE +0 -0
  77. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/matrixmultiply/LICENSE-APACHE +0 -0
  78. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/matrixmultiply/LICENSE-MIT +0 -0
  79. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/memchr/COPYING +0 -0
  80. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/memchr/LICENSE-MIT +0 -0
  81. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/memchr/UNLICENSE +0 -0
  82. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/memmap2/LICENSE-APACHE +0 -0
  83. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/memmap2/LICENSE-MIT +0 -0
  84. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/ndarray/LICENSE-APACHE +0 -0
  85. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/ndarray/LICENSE-MIT +0 -0
  86. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/nix/LICENSE +0 -0
  87. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/num-complex/LICENSE-APACHE +0 -0
  88. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/num-complex/LICENSE-MIT +0 -0
  89. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/num-integer/LICENSE-APACHE +0 -0
  90. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/num-integer/LICENSE-MIT +0 -0
  91. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/num-traits/LICENSE-APACHE +0 -0
  92. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/num-traits/LICENSE-MIT +0 -0
  93. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/numpy/LICENSE +0 -0
  94. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/once_cell/LICENSE-APACHE +0 -0
  95. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/once_cell/LICENSE-MIT +0 -0
  96. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/openusd/LICENSE +0 -0
  97. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/openusd/OpenUSD-LICENSE +0 -0
  98. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/openusd/OpenUSD-NOTICE.txt +0 -0
  99. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/openusd-schemas/LICENSE +0 -0
  100. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/openusd-schemas/OpenUSD-LICENSE +0 -0
  101. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/openusd-schemas/OpenUSD-NOTICE.txt +0 -0
  102. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/pyo3/LICENSE-APACHE +0 -0
  103. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/pyo3/LICENSE-MIT +0 -0
  104. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/pyo3-ffi/LICENSE-APACHE +0 -0
  105. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/pyo3-ffi/LICENSE-MIT +0 -0
  106. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/rawpointer/LICENSE-APACHE +0 -0
  107. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/rawpointer/LICENSE-MIT +0 -0
  108. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/regex-lite/LICENSE-APACHE +0 -0
  109. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/regex-lite/LICENSE-MIT +0 -0
  110. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/rustc-hash/LICENSE-APACHE +0 -0
  111. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/rustc-hash/LICENSE-MIT +0 -0
  112. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/serde_core/LICENSE-APACHE +0 -0
  113. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/serde_core/LICENSE-MIT +0 -0
  114. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/serde_json/LICENSE-APACHE +0 -0
  115. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/serde_json/LICENSE-MIT +0 -0
  116. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/simd-adler32/LICENSE.md +0 -0
  117. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/strum/LICENSE +0 -0
  118. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/thiserror/LICENSE-APACHE +0 -0
  119. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/thiserror/LICENSE-MIT +0 -0
  120. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/twox-hash/LICENSE.txt +0 -0
  121. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/typed-path/LICENSE-APACHE +0 -0
  122. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/typed-path/LICENSE-MIT +0 -0
  123. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/windows-link/license-apache-2.0 +0 -0
  124. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/windows-link/license-mit +0 -0
  125. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/windows-sys/license-apache-2.0 +0 -0
  126. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/windows-sys/license-mit +0 -0
  127. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/zerocopy/LICENSE-APACHE +0 -0
  128. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/zerocopy/LICENSE-BSD +0 -0
  129. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/zerocopy/LICENSE-MIT +0 -0
  130. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/zip/LICENSE +0 -0
  131. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/zlib-rs/LICENSE +0 -0
  132. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/zmij/LICENSE-MIT +0 -0
  133. {tinyusd-0.1.0 → tinyusd-0.2.0}/licenses/zopfli/COPYING +0 -0
  134. {tinyusd-0.1.0 → tinyusd-0.2.0}/pyproject.toml +0 -0
@@ -766,7 +766,7 @@ dependencies = [
766
766
 
767
767
  [[package]]
768
768
  name = "tinyusd-capi"
769
- version = "0.1.0"
769
+ version = "0.2.0"
770
770
  dependencies = [
771
771
  "cbindgen",
772
772
  "serde_json",
@@ -775,19 +775,20 @@ dependencies = [
775
775
 
776
776
  [[package]]
777
777
  name = "tinyusd-core"
778
- version = "0.1.0"
778
+ version = "0.2.0"
779
779
  dependencies = [
780
780
  "bytemuck",
781
781
  "half",
782
782
  "openusd",
783
783
  "openusd-schemas",
784
784
  "serde_json",
785
+ "tempfile",
785
786
  "thiserror",
786
787
  ]
787
788
 
788
789
  [[package]]
789
790
  name = "tinyusd-py"
790
- version = "0.1.0"
791
+ version = "0.2.0"
791
792
  dependencies = [
792
793
  "bytemuck",
793
794
  "half",
@@ -3,7 +3,7 @@ resolver = "3"
3
3
  members = ["crates/tinyusd-core", "crates/tinyusd-py"]
4
4
 
5
5
  [workspace.package]
6
- version = "0.1.0"
6
+ version = "0.2.0"
7
7
  edition = "2024"
8
8
  rust-version = "1.96"
9
9
  license = "BSD-3-Clause"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinyusd
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
@@ -6,7 +6,7 @@ rust-version.workspace = true
6
6
  license.workspace = true
7
7
 
8
8
  [features]
9
- default = ["shade", "lux", "skel", "physics", "vol", "media", "semantics"]
9
+ default = ["shade", "lux", "skel", "physics", "vol", "media", "semantics", "write"]
10
10
  shade = ["openusd-schemas/shade"]
11
11
  lux = ["openusd-schemas/lux"]
12
12
  skel = ["openusd-schemas/skel"]
@@ -14,14 +14,20 @@ physics = ["openusd-schemas/physics"]
14
14
  vol = ["openusd-schemas/vol"]
15
15
  media = ["openusd-schemas/media"]
16
16
  semantics = ["openusd-schemas/semantics"]
17
+ write = []
17
18
 
18
19
  [dependencies]
19
20
  openusd.workspace = true
20
21
  openusd-schemas = { workspace = true, features = ["geom"] }
21
22
  thiserror.workspace = true
22
- bytemuck = "1"
23
+ bytemuck = { version = "1", features = ["extern_crate_alloc"] }
23
24
  serde_json = "1"
24
25
 
25
26
  [dev-dependencies]
27
+ tempfile = "3"
26
28
  serde_json = "1"
27
29
  half = "2"
30
+
31
+ [[example]]
32
+ name = "write_bench"
33
+ required-features = ["write"]
@@ -30,7 +30,16 @@ fn encode(v: &Value) -> Json {
30
30
  BaseType::Unsupported => json!("<unsupported>"),
31
31
  BaseType::Asset => json!({ "authored": v.strings(), "resolved": v.resolved_paths() }),
32
32
  b if b.is_string_like() => json!(v.strings()),
33
- _ => json!(numbers(v)),
33
+ _ => json!(numbers(v).map(|n| n.into_iter().map(number).collect::<Vec<_>>())),
34
+ }
35
+ }
36
+
37
+ fn number(x: f64) -> Json {
38
+ match x {
39
+ x if x.is_nan() => json!("nan"),
40
+ f64::INFINITY => json!("inf"),
41
+ f64::NEG_INFINITY => json!("-inf"),
42
+ x => json!(x),
34
43
  }
35
44
  }
36
45
 
@@ -0,0 +1,70 @@
1
+ use std::time::Instant;
2
+
3
+ use tinyusd_core::{BaseType, OpenOptions, Prim, Stage, Value};
4
+
5
+ fn setup(bodies: usize) -> (Stage, Vec<Prim>) {
6
+ let mut stage = Stage::create_in_memory(&OpenOptions::default()).unwrap();
7
+ let prims = stage
8
+ .edit(|s| {
9
+ let mut prims = Vec::new();
10
+ for i in 0..bodies {
11
+ let p = s.define_prim(&format!("/World/Body{i}"), "Xform")?;
12
+ s.create_attribute(p, "xformOp:translate", "double3", false)?;
13
+ prims.push(p);
14
+ }
15
+ Ok(prims)
16
+ })
17
+ .unwrap();
18
+ (stage, prims)
19
+ }
20
+
21
+ fn frame(stage: &mut Stage, prims: &[Prim], f: usize) {
22
+ for (i, &p) in prims.iter().enumerate() {
23
+ let v = Value::from_slice(BaseType::Double3, false, &[[i as f64, 0.0, f as f64]]).unwrap();
24
+ stage.set(p, "xformOp:translate", &v, Some(f as f64)).unwrap();
25
+ }
26
+ }
27
+
28
+ fn main() {
29
+ let mut args = std::env::args().skip(1).map(|a| a.parse::<usize>().unwrap());
30
+ let bodies = args.next().unwrap_or(1000);
31
+ let frames = args.next().unwrap_or(10);
32
+
33
+ let (mut stage, prims) = setup(bodies);
34
+ let start = Instant::now();
35
+ for f in 0..frames {
36
+ frame(&mut stage, &prims, f);
37
+ }
38
+ let immediate = start.elapsed();
39
+
40
+ let (mut stage, prims) = setup(bodies);
41
+ let start = Instant::now();
42
+ for f in 0..frames {
43
+ stage.begin_edit().unwrap();
44
+ frame(&mut stage, &prims, f);
45
+ stage.commit_edit().unwrap();
46
+ }
47
+ let per_frame = start.elapsed();
48
+
49
+ let (mut stage, prims) = setup(bodies);
50
+ let start = Instant::now();
51
+ stage.begin_edit().unwrap();
52
+ for f in 0..frames {
53
+ frame(&mut stage, &prims, f);
54
+ }
55
+ stage.commit_edit().unwrap();
56
+ let whole = start.elapsed();
57
+
58
+ let writes = (bodies * frames) as f64;
59
+ for (name, t) in [
60
+ ("immediate", immediate),
61
+ ("batch per frame", per_frame),
62
+ ("one batch", whole),
63
+ ] {
64
+ println!(
65
+ "{name:>16}: {:>9.1} ms, {:>7.2} us per value",
66
+ t.as_secs_f64() * 1e3,
67
+ t.as_secs_f64() * 1e6 / writes
68
+ );
69
+ }
70
+ }