Datasets:
| 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") |