MCPcopy Index your code
hub / github.com/ScanMountGoat/ldr_tools_blender

github.com/ScanMountGoat/ldr_tools_blender @0.5.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.5.1 ↗ · + Follow
333 symbols 739 edges 18 files 37 documented · 11%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ldr_tools_blender GitHub release (latest by date including pre-releases)

falcon render

Cycles render of 10179-1 Millennium Falcon UCS (LDraw OMR)

An addon for importing LDraw and Studio files into Blender 4.1 or later. Check out discussions for reading announcements, asking questions, or discussing new features. Report bugs or request new features in issues. Download the latest version from releases.

Features

The goal of this project is to provided a reliable and performant way to import digital LEGO models into modern versions of Blender for rendering. This includes importing and rendering Bricklink Studio models or models built with LDraw editing programs.

  • Compatible with LDR and MPD files. If you have a file that doesn't open correctly or an LDraw extension you'd like supported, please report it in issues.
  • Compatible with newer versions of Bricklink Studio .io files.
  • Easily load LEGO models with hundreds of thousands of parts. For extremely large scenes, see performance.
  • Create photorealistic renders taking full advantage of Blender Cycles with generated materials with accurate colors and procedurally generated surface detail.

Bricklink Studio Compatibility

Bricklink Studio models from newer versions of the program can be imported directly from .io files. Older Studio models that fail to import as .io files should be resaved with a newer version of Studio. This avoids an issue with password protection on older .io files. Studio can also export files as LDraw under File > Export As before importing into Blender.

Getting Started

  1. Install the LDraw parts library if you haven't already. Bricklink Studio bundles its own LDraw library and should be detected automatically by the addon.
  2. Download the appropriate version of the addon for your system from releases. For older Blender versions, download one of the previous releases.
  3. In Blender, navigate to Edit > Preferences > Addon and click Install. Select the zip downloaded in step 2. Do not extract the zip file!
  4. The addons menu should now allow you to check the ldr_tools_blender addon to enable it.
  5. Import an LDraw model into Blender by clicking File > Import > LDraw and selecting a .mpd, .ldr, or .io file.

Uninstalling/Upgrading

Upgrading the addon requires uninstalling the addon, downloading the latest version from releases, and then reinstalling the addon. Windows users will need to disable the addon, restart Blender, and then uninstall the addon to properly remove the previous version.

Performance

This project is built from the ground up with performance in mind. The ldr_tools_blender addon can easily handle very large models with hundreds of thousands of parts. The addon will always instance geometry by part name and color to reduce memory usage and improve import times. Memory usage will be similar for both methods.

Blender itself does not scale well with the number of objects created in the scene. For large scenes with more than 10000 parts, it's recommended to use "Geometry Nodes" as the instance type before importing. Geometry nodes make the individual objects harder to edit but avoids most of the Blender overhead for scenes with high object counts.

For scenes that don't need to be rendered up close, setting the resolution to "Normal" and stud type to "Normal" to remove stud logos can greatly reduce the number of vertices.

Projects

ldr_tools

A Rust library for working with LDraw files. This performs all the parsing and geometry handling. This project can be used in other Rust projects by adding the following line to the Cargo.toml. ldr_tools is used for loading models in the ldr_wgpu renderer.

ldr_tools = { git = "https://github.com/ScanMountGoat/ldr_tools_blender" }

ldr_tools_py

Python bindings to ldr_tools using PyO3. This enables ldr_tools to be usable in Blender. ldr_tools_py makes heavy use of numpy arrays to reduce the overhead for converting data from Rust to Python to Blender.

ldr_tools_blender

The Blender addon for importing LDraw files making use of ldr_tools_py. This is not a pure Python project. See the building instructions for details on how to build this from source.

Building

The easiest way to see the steps used to create a new release is to check the release.yaml script that runs using Github actions. See development for working on your personal machine. See contributing for contributing to this project.

Copyrights

LDraw™ is a trademark owned and licensed by the Jessiman Estate, which does not sponsor, endorse, or authorize this project.

LEGO® is a registered trademark of the LEGO Group, which does not sponsor, endorse, or authorize this project.

Extension points exported contracts — how you extend this code

FileRefResolver (Interface)
Resolver trait for sub-file references ([Line Type 1](https://www.ldraw.org/article/218.html#lt1) LDraw command). An im [3 …
ldr_tools/src/ldraw.rs

Core symbols most depended-on inside this repo

sp
called by 43
ldr_tools/src/ldraw/parse.rs
node
called by 42
ldr_tools_blender/node_dsl.py
join
called by 23
ldr_tools/src/ldraw.rs
get
called by 20
ldr_tools/src/ldraw.rs
new
called by 18
ldr_tools_py/src/lib.rs
insert
called by 16
ldr_tools/src/ldraw.rs
get
called by 10
ldr_tools/src/geometry.rs
group_node
called by 9
ldr_tools_blender/node_dsl.py

Shape

Function 216
Class 61
Method 47
Enum 8
Interface 1

Languages

Rust83%
Python17%

Modules by API surface

ldr_tools/src/ldraw/parse.rs104 symbols
ldr_tools/src/ldraw.rs48 symbols
ldr_tools/src/lib.rs31 symbols
ldr_tools/src/geometry.rs28 symbols
ldr_tools/src/edge_split.rs22 symbols
ldr_tools_blender/operator.py20 symbols
ldr_tools_py/src/lib.rs18 symbols
ldr_tools_blender/node_dsl.py14 symbols
ldr_tools_blender/importldr.py12 symbols
ldr_tools/src/pe_tex_info.rs12 symbols
ldr_tools/src/color.rs8 symbols
ldr_tools_blender/material.py7 symbols

For agents

$ claude mcp add ldr_tools_blender \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact