a python library for u3d unpacking
Project description
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()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
u3d-studio-1.0.16.tar.gz
(28.3 kB
view details)
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
u3d_studio-1.0.16-py3.8.egg
(97.2 kB
view details)
File details
Details for the file u3d-studio-1.0.16.tar.gz.
File metadata
- Download URL: u3d-studio-1.0.16.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dbb589bc6f052029d0bcaf7b0812708e98e252e3c97b8249a9f8848760c7d91
|
|
| MD5 |
a4c595ddf53e021ee056ea0d88bdce99
|
|
| BLAKE2b-256 |
10637be156eae4ac21c985e63504a374cb845f91610de1c1cf28c3bbcdfd85ca
|
File details
Details for the file u3d_studio-1.0.16-py3.8.egg.
File metadata
- Download URL: u3d_studio-1.0.16-py3.8.egg
- Upload date:
- Size: 97.2 kB
- Tags: Egg
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3266c693bf7c26bc67321543578e9380f23cd0371eb0fe8867bdadb2b75a20ae
|
|
| MD5 |
501952c34f652cd30caa9f78a509a5dc
|
|
| BLAKE2b-256 |
b036a1ebc9fe3b47d08206d56d45a8f5c9b3c7fb580962efad0009bd402a9db6
|
File details
Details for the file u3d_studio-1.0.16-py3-none-any.whl.
File metadata
- Download URL: u3d_studio-1.0.16-py3-none-any.whl
- Upload date:
- Size: 41.2 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41fd99c7b1c7ecbc3cd8fb5be97538a515ee330315819ee8e513d5ff2e4de87d
|
|
| MD5 |
b810a9f96f31a5053e5ee3aba0080636
|
|
| BLAKE2b-256 |
f9582062d5f14f9c53453a97831bc917400b653c282a8b56d6994ece3e3a793b
|