Datasets:
Download export.py from duckduckplz/Mobjaverse: direct link, hf CLI and curl.
- Browser
- Download file 602 Bytes
-
https://huggingface.co/datasets/duckduckplz/Mobjaverse/resolve/main/export.py
- Command line
-
hf download hf://datasets/duckduckplz/Mobjaverse/export.py
-
curl -L -o export.py https://huggingface.co/datasets/duckduckplz/Mobjaverse/resolve/main/export.py
602 Bytes
| from numpy import ndarray | |
| import numpy as np | |
| from src.rig_package.info.asset import Asset | |
| from src.rig_package.parser.bpy import BpyParser | |
| data = np.load("mobjaverse/004444/raw_data.npz", allow_pickle=True) | |
| # unwrap None object to None | |
| def unwrap(x): | |
| if isinstance(x, ndarray) and x.shape==() and x.dtype==object: | |
| return x.item() | |
| return x | |
| data = {k: unwrap(v) for k, v in data.items()} | |
| asset = Asset(**data) | |
| assert asset.matrix_basis is not None | |
| asset.matrix_basis[:, 0, :3, 3] = 0 # remove root translation | |
| asset.normalize_vertices((-1.0, 1.0)) | |
| BpyParser.export(asset, "res.glb") |