Skip to content

Blender plugin for League of Legends asset import/export

Notifications You must be signed in to change notification settings

alanpq/lol-blender

Repository files navigation

lol-blender

Blender plugin for League of Legends asset import/export, using league-toolkit.

NOTE: This plugin is extremely early in development, see io_scene_lol for a more developed importer/exporter.

Features

⚠️ 🚨 🛠️
Supported Partial support Broken Planned

Scene I/O

Import Export
Skinned Mesh (.skn) 1 ⚠️
Skeleton (.skl) ⚠️
Animation (.anm) 🛠️ 🛠️
Static mesh (.sco/.scb) 🛠️ 🛠️
Map geometry (.mapgeo) 🛠️ 🛠️

Development

Requirements

Setup

  • Clone the repository:

    git clone git@github.com:alanpq/lol-blender.git
    cd lol-blender
  • Compile the rust_wrap crate:

    cd crates/rust_wrap
    maturin build --release --out ../../addon/wheels/
  • Take note of the output from your maturin command (it might differ in your case!):

    <...>
    📦 Built wheel for CPython 3.11 to ../../addon/wheels/rust_wrap-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
    

    Make sure it's listed in the blender_manifest.toml:

    wheels = [
        "./wheels/rust_wrap-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl",
        "<...>",
        "<...>",
    ]
  • Compile the rust_hot crate (this is the step you'll typically repeat later):

    cd crates/rust_hot
    cargo build --release
  • Open the repository in VSCode, open the Command Palette (Ctrl+Shift+P), search for "Blender: Start", and select your Blender executable (mean the one you've installed prior).

Important

Verify that the VSCode terminal shows: creating new rust context

Hot Reloading

Python

For the Python parts of the extension (UI and such), use the VSCode addon: "Blender: Reload Addons" in the Command Palette.

Rust (Core)

Recompile the rust_hot crate for changes in the rust_core crate:

cd crates/rust_hot/
cargo build --release

Note

We're editing rust_core but recompiling rust_hot.

Rust (API)

For changes in the rust_api or rust_hot crates themselves, hot reloading isn’t possible with this approach.

You'll need to:

  1. Rebuild rust_wrap with maturin as before.
  2. Recompile rust_hot.
  3. Unload the extension and restart Blender.

Building Without Hot Reloading

When preparing for distribution, do not use hot reloading.

  • Compile the rust_wrap crate without default features:

    cd crates/rust_wrap/
    maturin build --release --no-default-features --out ../../addon/wheels/
  • No additional Rust steps apply in this case.

  • Build the extension via Blender directly:

    cd addon/
    blender --command extension build

Troubleshooting

Missing Wheel

RuntimeError: Error: No module named 'rust_wrap'

Indicates a missing or incorrect path to the wheel.


Missing Dynamic Library

pyo3_runtime.PanicException: failed to create hot reload loader: LibraryLoadError(DlOpen { desc: "<...> (no such file)" })

or

pyo3_runtime.PanicException: failed to create hot reload loader: LibraryCopyError(Custom { kind: NotFound, error: "file <...>" does not exist" })

Indicates the dynamic library for hot reloading is missing.

Make sure rust_hot is built with:

cargo build [--release]

(Release/debug builds of the wrap and core crates must match.)


Poisoned

pyo3_runtime.PanicException: Once instance has previously been poisoned

Means the reloader thread has failed.

Disable the extension and restart Blender.

Credits

Thanks to Algebraic UG for their work on Blender extensions with hot reloadable Rust parts, from which this project heavily takes from.

Footnotes

  1. Automatic texture import not yet implemented. (Materials/UV's are imported though, so textures can be manually hooked up)

About

Blender plugin for League of Legends asset import/export

Resources

Stars

Watchers

Forks

Packages

No packages published