Metadata-Version: 2.4
Name: lightusd
Version: 1.0.0rc4
Summary: Lightweight, dependency-free USD/USDA/USDC/USDZ loader + Tydra render-scene access, with NumPy-friendly zero-copy arrays (CPython abi3 + free-threaded wheels).
Author-email: Syoyo Fujita <syoyo@lighttransport.com>, "Light Transport Entertainment, Inc." <syoyo@lighttransport.com>
License: Apache 2.0 License 
        
        Copyright (c) 2020-2023 Syoyo Fujita
        Copyright (c) 2024-Present Light Transport Entertainment Inc.
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
        
Project-URL: Homepage, https://github.com/lighttransport/LightUSD
Project-URL: Repository, https://github.com/lighttransport/LightUSD
Project-URL: Issues, https://github.com/lighttransport/LightUSD/issues
Keywords: usd,usda,usdc,usdz,pixar,3d,scene
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: LICENSE.3rdparty
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Requires-Dist: numpy<3,>=2.2; extra == "test"
Dynamic: license-file

# lightusd

Lightweight, dependency-free **USD** (Universal Scene Description) library for
Python: load and author USDA / USDC / USDZ, resolve composition, and extract
GPU-ready render data — with **zero-copy NumPy interop**.

Built on the LightUSD *next* core + *tydra-next* (no pxrUSD install required,
no legacy core in the wheel; native `cmake -S .` and WASM still
provide the legacy path via `web/binding.cc`). **v1.0.0**, npm `preview`
dist-tag. Wheels:

- `cp310-abi3` — one stable-ABI wheel covers CPython **3.10+**
- `cp314t` — native **free-threaded** (GIL-less) CPython 3.14 wheel

```bash
pip install lightusd
```

## Reading

```python
import numpy as np
import lightusd

stage = lightusd.load("scene.usdz")          # usda / usdc / usdz, composed
for prim in stage:                            # depth-first traversal
    print(prim.path, prim.type_name)

mesh = stage.prim_at("/World/Mesh")
points = np.asarray(mesh["points"])           # zero-copy (N, 3) float32
attr = mesh.attribute("xformOp:translate")
if attr.has_timesamples:
    value = attr.get(time=12.0)               # linear interpolation
print(mesh.relationship("material:binding").targets)
```

## Authoring

```python
st = lightusd.Stage.create()
st.up_axis = "Y"
grid = st.define_prim("/World/Grid", "Mesh")
grid.set("points", np.zeros((64, 3), np.float32), type="point3f[]")
grid.set("purpose", "render", uniform=True)
grid.set("xformOp:translate", (0.0, 1.0, 0.0), time=0.0)
st.set_default_prim("World")
st.save("out.usdc")                           # or .usda / .usdz
```

## Render extraction (tydra)

```python
from lightusd import tydra

scene = tydra.to_render_scene(stage)          # triangulated, GPU-friendly
for mesh in scene.meshes:
    vertices = np.asarray(mesh.points)                # (N, 3) float32
    indices = np.asarray(mesh.triangulated_indices)   # (T,) uint32
    material = scene.materials[mesh.material_id]
    base_color = material.param("diffuse_color")      # tuple or RenderTexture
```

## Notes

- NumPy is optional (interop only, not a dependency).
- `lightusd.flatten_file(src, dst)` runs a low-memory compose+flatten
  pipeline that streams large arrays through without decoding them.
- Free-threaded CPython: concurrent reads of one `Stage` are safe; do not
  author to a stage while other threads read it.

Apache 2.0. Part of [LightUSD](https://github.com/lighttransport/LightUSD).
