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.0-cp313-cp313-win_amd64.whl (854.2 kB view details)

Uploaded CPython 3.13Windows x86-64

ssbh_data_py-0.9.0-cp313-cp313-manylinux_2_34_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

ssbh_data_py-0.9.0-cp313-cp313-macosx_11_0_arm64.whl (981.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ssbh_data_py-0.9.0-cp313-cp313-macosx_10_12_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

ssbh_data_py-0.9.0-cp312-cp312-win_amd64.whl (854.4 kB view details)

Uploaded CPython 3.12Windows x86-64

ssbh_data_py-0.9.0-cp312-cp312-manylinux_2_34_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

ssbh_data_py-0.9.0-cp312-cp312-macosx_11_0_arm64.whl (981.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ssbh_data_py-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

ssbh_data_py-0.9.0-cp311-cp311-win_amd64.whl (852.8 kB view details)

Uploaded CPython 3.11Windows x86-64

ssbh_data_py-0.9.0-cp311-cp311-manylinux_2_34_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

ssbh_data_py-0.9.0-cp311-cp311-macosx_11_0_arm64.whl (991.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ssbh_data_py-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

ssbh_data_py-0.9.0-cp310-cp310-win_amd64.whl (852.7 kB view details)

Uploaded CPython 3.10Windows x86-64

ssbh_data_py-0.9.0-cp310-cp310-manylinux_2_34_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

ssbh_data_py-0.9.0-cp310-cp310-macosx_11_0_arm64.whl (990.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

ssbh_data_py-0.9.0-cp310-cp310-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

ssbh_data_py-0.9.0-cp39-cp39-win_amd64.whl (853.7 kB view details)

Uploaded CPython 3.9Windows x86-64

ssbh_data_py-0.9.0-cp39-cp39-manylinux_2_34_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

ssbh_data_py-0.9.0-cp39-cp39-macosx_11_0_arm64.whl (991.5 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

ssbh_data_py-0.9.0-cp39-cp39-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d4020d1a9b29b4dda6683106bea0cce216c5a58cf4b77deb02f9f8f90b7eecd5
MD5 e188798c6640386674e14ea566bac808
BLAKE2b-256 a989c78893b7117c8f9c65b0c7be5f20e0ab4c26969f6203dad2462be5fbd3c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 40c7c90556e45a3650e94dbe72875ec4b8bb07c6db6b7c8e9b6bf340b56917b7
MD5 e6cbaa5b46865692a3977bd74d40c345
BLAKE2b-256 e80e8e373f1913e6bd799b14cedd55013267e081426b27baf9f53cde2cecfc7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d1e1b6a115af0c72781aad95aa3443828f38ab9dd5cadf119498b737c0ed8db3
MD5 f1a3185eb4ff7bf9df936b981693540f
BLAKE2b-256 a1419f87ef8024e10e515ec5f89dcfadca4f28d53b616288af0db0ff3906775d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3043944f0e318df2e106e2a119b89787190276cf0cdd7c28b0c2acb90001ec1b
MD5 c201dad4b4411223f54c16a28316a5d9
BLAKE2b-256 e3595e72bfe1d569e7b471dde8e370a608946b9231af0e1fbee13b476df97adf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 db76a7bb8adc7dc5bb9fe3fb8cc9d39fabda77cec2529b9b2d3ce49ed1c250b3
MD5 a1099665180143ee048d1f6af278907f
BLAKE2b-256 248001fd6aba360f397ca8cf15858901b949540c351e3b94b4512ff19c517742

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2d42dbb91150154ad5bea9b59aba09041286cf6d1bde5d35825847ff28569531
MD5 775597a5b92f0478530efaa18807dfd1
BLAKE2b-256 92cd9eae560bafe8dd22476fcd869bd51209c32e7fbb21012880d9786df4c9d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 18f82b99435393c981cedf71c98dfa680b1c21d1b47122afc69e15e75362d00d
MD5 949bd0873c688f230f30fbb960478f77
BLAKE2b-256 a85188fe4a3a705e40fc2446e212f6db0f10cf3550b8959cede79de0ac61d979

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 60b9d36b4b0bfdf0183ad950bc94e596b52640cc678160767024743ff8456ff0
MD5 df586866675cdf5f3b7722340b9148b5
BLAKE2b-256 41a7557a24155a7c4ab96a521ceb8c26961f4b1807a22b6c268df381934bf25a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9a724b3305a498ca0a25dce6a56f2a8dc7522df97cd24b2c6a047d058ee44dc0
MD5 9a2f7e614e30110a3d3e6f6b91ea5dec
BLAKE2b-256 4919085c53dd0e068a6568c080d7acd6e3ab83f3c0d6f764ab9d2bf8b69ef4c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 2fd6a1cd07070080d0374dfcc37756928440142b417c4aae78950dd86dd73ce8
MD5 db0d6630c36ad2a08c40ed9b5183befd
BLAKE2b-256 ca86c537078b7b2f3d6cea4c0536d6b85f476f76a5f70059c8b4d1db6deca8cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 210a74d81314a60c9fdcadf3e539873039c7f257e54c41ec78f8bc682f04d6bb
MD5 bdd9e54021a20bedae40b9ddae179b8f
BLAKE2b-256 76059f9d2dfe36528975feed7a5b074cfb7184796ebaaa3f91387215fd09770e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3e928835c80fca8dba7fdb25fc528021c8585dae9947732ee641810f899d0967
MD5 0b1cdc11152037215bd64fef2a8141fb
BLAKE2b-256 c9344a3f057dabad185dd4805e247a62cd6a89e1d81a3767d3712418c6ed2459

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 502bb6c078de5518f681a94f946a14bf4927ac139023d855dbba56e967a70b54
MD5 7bc8411eb823052ca875b7ceebf60249
BLAKE2b-256 622f1dcc70b845c098b16d2ed33478f8a26b72318a54d37feacd609ab89cb819

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7390277b4780a24df0b31ecfe8b3c5d29622e0a20a3611e80574b21ea51ce1f6
MD5 3acc9ee822d622ccf0ebd88f970e9e84
BLAKE2b-256 a4c4d3aa20971bfe82872032089d535656e52113e19031c3ab749eaa26040521

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c4e64f49d0b156740721efef3affa2ca3b04083526479ea6ac3caa5a6e26f816
MD5 940775902c02077261ff1bea9ed4f65c
BLAKE2b-256 87cbec89706d6dd7eb3cd09c76ebd57e73c8db554124be42427960a443cdba26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6dd46cd03bdb82f43b5a5cf368dc9908a67594ecf14d3f18110ed9a3751eb601
MD5 8ca1b4150fe9cb89ee4b0355d5f8dd0f
BLAKE2b-256 493a3b0b9b83dacac49d6d71edee3f098836a8966fed6d2110bd8fc1b41fe8d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b807068d948a8390ba5322fd323420e12681e9b306d1b94e3fb80d13ba0eb828
MD5 11f0723552e17f4562e7b1f5922ef7ae
BLAKE2b-256 59076b7fdd4716648f2e02b5eba4cb99cd3267e474eab80f5af54b313c8c5bff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c97814c01b3de59b8e811fec0cdd7ff1b0efb415f4b12f15b607f7f3a87dde62
MD5 1585b46f150d8990f3eb8820e1e5de5b
BLAKE2b-256 77ea2ef2cd3dfee8f1194f0bec636e47d3aab466205ecb2bf7dc2f31a7571229

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d0f22ce692d7f6b44793f4f903c2154e967c7e6b388baef552e40a9bfd73e0c7
MD5 641cdfd342b9140c21e6910f737b7c70
BLAKE2b-256 2931672907af5422e07b66dd7ecfa4f1d50219b47b6f1761b12b27cfa869a52f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ssbh_data_py-0.9.0-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f6fa0bda005b3bc1d9065eef7c3fca82c1a707864f926b0bcdfb3a914b7604b1
MD5 f5f3b8cd641363a7e4aa81885ce6cada
BLAKE2b-256 0b51f4f6506b90110a9456dc1875583456c4841392131d8207eeac3c3c1292d9

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