Skip to main content

No project description provided

Project description

ssbh_data_py PyPI

Python bindings to the ssbh_data Rust library. ssbh_data_py provides a higher level abstraction over the binary data stored in SSBH files such as a "model.numshb". SSBH files can be created from scratch or modified from existing files entirely in Python.

Report bugs and request new features in issues. Check the requirements before reporting on any installation issues.

Supported Formats

Format Supported Versions (major.minor) Read Save
Modl (.numdlb, .nusrcmdlb) 1.7 :heavy_check_mark: :heavy_check_mark:
Mesh (.numshb) 1.8, 1.9, 1.10 :heavy_check_mark: :heavy_check_mark:
Skel (.nusktb) 1.0 :heavy_check_mark: :heavy_check_mark:
Anim (.nuanmb) 2.0, 2.1 :heavy_check_mark: :heavy_check_mark: (2.0 only)
Matl (.numatb) 1.5, 1.6 :heavy_check_mark: :heavy_check_mark:
Hlpb (.nuhlpb) 1.1 :heavy_check_mark: :heavy_check_mark:
Adj (.adjb) :heavy_check_mark: :heavy_check_mark:
MeshEx (.numshexb) :heavy_check_mark: :heavy_check_mark:

Installing

The package can be installed for a supported python version using pip on the latest version of Windows, Linux, or MacOS. The prebuilt wheels (.whl files) are included only for situations where pip might not be available such as for plugin development for applications.

Installing: pip install ssbh_data_py
Updating: pip install ssbh_data_py --upgrade

The minimum supported pip version is 20.3.

Requirements

The package is available on PyPi for Python 3.9, 3.10, 3.11, 3.12, and 3.13 for newer versions of Windows, Linux, and Mac OS. For other Python versions, build ssbh_data_py from source. ssbh_data_py requires the numpy package for transforms and attribute data.

Getting Started

Each supported SSBH type has an associated data struct that can be created reading from a file.

import ssbh_data_py

mesh = ssbh_data_py.mesh_data.read_mesh("model.numshb")
modl = ssbh_data_py.modl_data.read_modl("model.numdlb")
skel = ssbh_data_py.skel_data.read_skel("model.nusktb")

It's also possible to construct new objects. Specify the major and minor version to use a particular file format revision. Note that this only impacts the binary output when calling the save method. Not all versions are supported, so it's recommended to use the default values.

mesh = ssbh_data_py.mesh_data.MeshData(major_version=1, minor_version=8)
modl = ssbh_data_py.modl_data.ModlData()
skel = ssbh_data_py.skel_data.SkelData()

ssbh_data_py uses standard Python types whenever possible. Conversion to the appropriate binary format is handled automatically on saving. For example, the 4x4 transformation matrix for bone data is simply a numpy array.

[!IMPORTANT] Specify dtype=numpy.float32 for float arrays and dtype=numpy.uint32 for integer arrays to prevent conversion errors.

import numpy

# Assign the identity transform to each bone.
for bone in skel.bones:
    bone.transform = numpy.eye((4), dtype=numpy.float32)

# Assign the X coordinate for positions
for o in mesh.objects:
    o.positions[0].data[:, 0] += 1.0

After making any changes, the results can be saved back to a file. Using the same path used to read the files will overwrite the file. Even if no edits are made, the resulting file will likely not be binary identical with the original due to floating point rounding errors or the use of different algorithms.

mesh.save("model_new.numshb")
modl.save("model_new.numdlb")
skel.save("model_new.nusktb")

Documentation

The Python API is best summarized by the type stub (.pyi) files, which can be found here. The Python API matches the underlying Rust types and functions as closely as possible. The Rust documentation has much more detailed documentation and can be found at https://docs.rs/ssbh_data. For more advanced sample Python scripts, see the examples.

Building

Requires a recent version of Rust. The builds published to PyPi are built using Maturin. Aftering succesfully installing Maturin, running maturin develop --release in the ssbh_data_py directory will build and install the module into the current virtual environment.

maturin build --release builds the ssbh_data_py module that can be imported into Python. The resulting binary can only be used with the current Python version, processor type, and operating system. Rename the .dll to .pyd on Windows and the .dylib to .so on Linux or MacOS.

If the import fails, check that the .pyd or .so file exists in the appropriate location. Importing may also fail if ssbh_data_py was built from source for an operating system or Python interpreter version that isn't compatible with the current Python environment.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ssbh_data_py-0.9.1-cp313-cp313-win_amd64.whl (890.0 kB view details)

Uploaded CPython 3.13Windows x86-64

ssbh_data_py-0.9.1-cp313-cp313-manylinux_2_34_x86_64.whl (958.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

ssbh_data_py-0.9.1-cp313-cp313-macosx_11_0_arm64.whl (854.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ssbh_data_py-0.9.1-cp313-cp313-macosx_10_12_x86_64.whl (927.1 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

ssbh_data_py-0.9.1-cp312-cp312-win_amd64.whl (890.1 kB view details)

Uploaded CPython 3.12Windows x86-64

ssbh_data_py-0.9.1-cp312-cp312-manylinux_2_34_x86_64.whl (958.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

ssbh_data_py-0.9.1-cp312-cp312-macosx_11_0_arm64.whl (854.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ssbh_data_py-0.9.1-cp312-cp312-macosx_10_12_x86_64.whl (927.6 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

ssbh_data_py-0.9.1-cp311-cp311-win_amd64.whl (886.5 kB view details)

Uploaded CPython 3.11Windows x86-64

ssbh_data_py-0.9.1-cp311-cp311-manylinux_2_34_x86_64.whl (958.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

ssbh_data_py-0.9.1-cp311-cp311-macosx_11_0_arm64.whl (867.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ssbh_data_py-0.9.1-cp311-cp311-macosx_10_12_x86_64.whl (940.4 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

ssbh_data_py-0.9.1-cp310-cp310-win_amd64.whl (886.5 kB view details)

Uploaded CPython 3.10Windows x86-64

ssbh_data_py-0.9.1-cp310-cp310-manylinux_2_34_x86_64.whl (958.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

ssbh_data_py-0.9.1-cp310-cp310-macosx_11_0_arm64.whl (867.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

ssbh_data_py-0.9.1-cp310-cp310-macosx_10_12_x86_64.whl (940.7 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

ssbh_data_py-0.9.1-cp39-cp39-win_amd64.whl (888.9 kB view details)

Uploaded CPython 3.9Windows x86-64

ssbh_data_py-0.9.1-cp39-cp39-manylinux_2_34_x86_64.whl (960.8 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

ssbh_data_py-0.9.1-cp39-cp39-macosx_11_0_arm64.whl (869.2 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

ssbh_data_py-0.9.1-cp39-cp39-macosx_10_12_x86_64.whl (943.1 kB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

File details

Details for the file ssbh_data_py-0.9.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a784cc555a674caa985659b302ab9cb7a5fa508b2b3b141e38027e235b456349
MD5 b4dc66ec3fa52483be5a16f97ca74c61
BLAKE2b-256 4e6690564282a76e3082d50acc159b1bed4d4081830e374db0dbbc67bff2678c

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1abfaba6fb372454bc9f0100dd62a1e81fba2380fee148d9a477adb18dae525b
MD5 478cb672bb9d536fbef9f1ba7d281af6
BLAKE2b-256 0340e717dff864014c9f35d3b4a1e4af4df63fa2c595c89c651667111949721e

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 25d83efc00a247b8d88e13ce5e0ec22e6bfc2c2a174339956bdd070f25498856
MD5 8be41809d2ec3d59c2e8a30dbee76075
BLAKE2b-256 92a5ddce534982ad81549f7da2494ae8526aeefa99f16fcb85c8917b7981e24d

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4ac97efa7795026fcf9bfec83909c049ae831198af08afccff25f1471391f9f1
MD5 c7d69973f25af80f978d08c2a6b80a23
BLAKE2b-256 65419d7996bd72fcf2dabaf7c4d9ed3e51c22a870b5386a61f2a6e47c6ce3369

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ed7e1afaaf0fe5af20a7edb76a4378a273994aa0031d8c136073d1999588c72d
MD5 3d8f31d6c975b99053f47ba1d22b1ca6
BLAKE2b-256 5189c81e2610257c227deedb47983946bd41bc6fbb950bb3728d47e22e97bca6

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 880394bb21b70c75e6565de973147e66645f1fc9347770a7fd741e862bac476e
MD5 f7fa64ba237e9e84e58858babdd395c1
BLAKE2b-256 07bf45b11fcd34a9ae882ce3d30df0c95cce0cdc6c3113f6460ad2742080d7a4

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8afcf2f0ae34a204fef010ad34af5f60e8a6543f1272f1da59b939fe7ce9c7e2
MD5 1a8aa7f1c8c49c63f34616172f0af569
BLAKE2b-256 178444be5ebe4cbd81c91f6aa26871bfb883e47511b78635ee806c13c942b2cd

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 24753ec54ad9fe0d4423a5f1d7f2df335ff87d1e3a21cac33d3d85d695ce7151
MD5 c27693f3bab396ff0e6f7fc8d005c458
BLAKE2b-256 81446b2fe1ef27caafbf1dba71429f6c9bf90878b7647ead7e4e297ba9a4ddc5

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 07a7b0a81a40d26799cd598f98135a40ebed8881b8ee01cd015433cba1ffd801
MD5 fa64e849a3750631de6e9659f884c1be
BLAKE2b-256 1e14e7e8abb44c875bbe31d98a490ae90edab0dfdbc83963ce59284e3f34d714

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 faf08e6e59c856aa9aafdce8b23c878587e784bced549b3255e75e7412379819
MD5 efd518d3dbc4c3a2b2dbcba609e18955
BLAKE2b-256 03f124b388058841b9f003d517ce23416ae4bce1b6e6d6b8896643d3e5f8a13d

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48196ffd2ee8ca78b92e24647d09896ee555c8ac7c62b052a8ad7acd2a27dad2
MD5 b3b0e0e3b47f27714daf3d15afbc39b1
BLAKE2b-256 37e28efe365d30efbe17673897738d0f89725667bc2cf33758e49c8a01017266

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0c2855d32aee060c7546f9a07fe6679516378f807ab472330fc34331485a03bb
MD5 65d722c38827c13601b88ed403ef5058
BLAKE2b-256 259d0289fa16a1f46febf58ccdc419aaa68f381685b9d6a06cf55066addefb2b

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 dd446989c71fc8d61556827f7d516487b7267b13afd0739e8c382585d6bc0afc
MD5 42d9524d2f7ff1acab9723b514a6d803
BLAKE2b-256 cbf292f2e425d8a9586694569a8c5daafb9b6ae19fa49b8934d156d491a0362d

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6bb52fc539455a620d866c4f4aaa3aca42df89426f0aa71b1cc1d2abaa4bc915
MD5 f0df210dff40f673cede8a20c483f867
BLAKE2b-256 855bd29504aa0cd5a48e50b965583427a8d22b2390dada63ec2ab3922b77847e

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a4311259b040556fbb6ceeb58391a297554d41728950098a893218b6d6f4487
MD5 f195c921e64c4332a08704cb4e4772bb
BLAKE2b-256 5262dd605b573e4a84f25763e684d54466d80fbcc43f76a1a8591e10c616d98b

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 763f66d50bed6afe252cc065a61966385403d253b4379c0f02d08327721f7467
MD5 8b79f3a4defbc39b3e19e5936e82ebf3
BLAKE2b-256 ef42c3dbe3071fef28967878dd33485df4249f0517384a229a02f0ae57391cc4

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 563091035ba527bce69c05ae158b394d94ad222cddcdbf4cb547beb056dad08e
MD5 6b3096fb6cd174b6d608e23af50ef841
BLAKE2b-256 2db42ef4ccc5d4145e35fc2a310908f5abad6079de6a0fa31745f670a7fca4c9

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6867e6bf8f10e11fa3b3c634dfd603fcb0c8995af8c456ae6857a293b15e56ee
MD5 25b11ced9067380357a3dd17a8263bf2
BLAKE2b-256 07d3b17fff4e3a284d58f5afd4f6d188d399f36fe1cf58fead4760ccaaa2cfa2

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e6e823570209e44e2a6162d9d972d490482c897b45bbf74e2bd3d17a77a66fa0
MD5 68b2e37a970fa6dc0e5618ec53749e83
BLAKE2b-256 d5004443e2e3a768bb283d812115a619286ed873413979724c73bcde37d12e4e

See more details on using hashes here.

File details

Details for the file ssbh_data_py-0.9.1-cp39-cp39-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ssbh_data_py-0.9.1-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 359ab264b7b9aa473879b68e3583680fe4f48554a700933b1fff74b9df630d95
MD5 205c3a36e654eb827b2758a1bf5f351c
BLAKE2b-256 b0c877a803c6d2cbbba446c326324a01abbd4fd0179cf5f4da1c6838014e3cb4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page