Installation
需要Python 3.6.0或更高版本
pip install u3d-studio
或下载/克隆git并使用
python setup.py install
使用说明
来一个简单的示例
import os
from u3dunpack import AssetsManager
SAMPLES = os.path.join(os.path.dirname(os.path.abspath(__file__)), "samples")
IMG = os.path.join(os.path.dirname(os.path.abspath(__file__)), "images")
KTX = os.path.join(os.path.dirname(os.path.abspath(__file__)), "ktx")
def testTexture2d():
for f in os.listdir(SAMPLES):
am = AssetsManager(os.path.join(SAMPLES, f))
for asset in am.assets.values():
for obj in asset.objects.values():
if obj.type == "Texture2D":
# 解析对象数据
data = obj.read()
# 确保扩展名正确
# 您可能只想使用图像/纹理
dest, ext = os.path.splitext(data.name)
destImg = dest + ".png"
destImg = os.path.join(IMG, destImg)
img = data.image.save(destImg)
destKtx = os.path.join(KTX, dest) + ".ktx"
if os.path.exists(destKtx):
os.remove(destKtx)
with open(destKtx, mode='wb') as w:
w.write(data.saveKtx)
with open(destKtx, mode='rb') as r:
ktxData = r.read()
data.writeData(ktxData)
with open("assets/test", mode='wb') as w:
data = asset.bundleFile.save()
w.write(data)
if __name__ == '__main__':
testTexture2d()
Metadata
Release files for u3d-studio 1.0.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| u3d-studio-1.0.16.tar.gz | 28.3 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| u3d_studio-1.0.16-py3.8.egg | Legacy Egg format | - | - | Details |
| u3d_studio-1.0.16-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 166.6 kB
Release files / u3d-studio-1.0.16.tar.gz
| Download URL | u3d-studio-1.0.16.tar.gz |
|---|---|
| Size | 28.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8dbb589bc6f052029d0bcaf7b0812708e98e252e3c97b8249a9f8848760c7d91
|
|
BLAKE2b-256 checksum How to use checksums |
10637be156eae4ac21c985e63504a374cb845f91610de1c1cf28c3bbcdfd85ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0
|
Release files / u3d_studio-1.0.16-py3.8.egg
| Download URL | u3d_studio-1.0.16-py3.8.egg |
|---|---|
| Size | 97.2 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
3266c693bf7c26bc67321543578e9380f23cd0371eb0fe8867bdadb2b75a20ae
|
|
BLAKE2b-256 checksum How to use checksums |
b036a1ebc9fe3b47d08206d56d45a8f5c9b3c7fb580962efad0009bd402a9db6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0
|
Release files / u3d_studio-1.0.16-py3-none-any.whl
| Download URL | u3d_studio-1.0.16-py3-none-any.whl |
|---|---|
| Size | 41.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41fd99c7b1c7ecbc3cd8fb5be97538a515ee330315819ee8e513d5ff2e4de87d
|
|
BLAKE2b-256 checksum How to use checksums |
f9582062d5f14f9c53453a97831bc917400b653c282a8b56d6994ece3e3a793b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0
|