Jump to content

Photo

LEGO Digital Designer LIF Extractor


  • Please log in to reply
52 replies to this topic

#1
JrMasterModelBuilder

JrMasterModelBuilder

    LR, LR2, LDR, and LDD Extractor Creator

  • Crystal Members
  • PipPipPipPip
  • 544 posts
Game Extractor has had the ability to extract LEGO Digital Designer LIF files for a while, but since Game Extractor isn't very stable, I wrote my own LIF extractor in Python. The download contains the Python source file for use with a python interpreter, as well as Windows 32 bit, Windows 64 bit, and OS X 64 bit executables.

Download LIF Extractor

For those of you who will probably ignore the Readme.txt file entirely, here's the information on it:

You accept full responsibility for how you use this program.

This program is released under GNU GPLv3.

LIF Extractor is a command line utility for extracting the LIF files found in LEGO Digital Designer. It will extract all files contained inside the LIF archives, into folders adjacent to the archive it was called on. The LIFExtractor.py file requires a python installation to run. The executables found in the folders have no dependencies. Choose the proper folder for your operating system. The Python script has been tested to work on Python versions 2.7 through 3.2.

To extract LIF files, pass the path to the LIF files as command line arguments to the program. On Windows, this can be done by dragging and dropping the LIF files onto the LIFExtractor.exe icon in the explorer window.

This program was created to allow for interoperability with the LEGO Digital Designer formats. In order to properly read the LEGO Digital Designer formats, it is necessary to access the data contained with the LIF file archives.
  • jamesster, bartvbl, McJobless and 6 others thanked this

#2
jamesster

jamesster

  • Forum Moderators
  • PipPipPipPipPip
  • 2,741 posts
Yay! It was a bit of a pain having to use my laptop to mess with LDD files and such.

#3
Cyrem

Cyrem

    Founder

  • Administrators
  • PipPipPipPipPipPip
  • 3,945 posts

but since Game Extractor isn't very stable

Not only that, but if you need to build a program that uses the LIF files, command line is more appopriate.

I have no use for this as I don't use LDD, but I'm sure someone else might.

#4
le717

Yes! Thank you JMMB! This is so much better than Game Extractor! :D :D

#5
mumboking

Not that it's of any use, I created this php page that reads the Materials.xml and displays the colours.

#6
bartvbl

bartvbl

    g33k

  • Platinum Members
  • PipPipPipPip
  • 254 posts
I guess this is the best place to put it:
I used your extractor on the Assets.lif file. It gave the Assets directory.
I proceeded to move the assets.lif file somewhere else, and placed the extracted Assets directory in its place.
Turns out, LDD will run and read what it needs from the Assets directory.
Here is the result of me having a bit of fun with one of the fragment shaders (I added a little bit of green :P):
Posted Image

In other words: LDD is moddable. There were a bunch of shaders and LUA scripts in there. I wonder what kind of things we are able to do with it..
  • jamesster, le717 and LUModder thanked this

#7
le717

I guess this is the best place to put it:
I used your extractor on the Assets.lif file. It gave the Assets directory.
I proceeded to move the assets.lif file somewhere else, and placed the extracted Assets directory in its place.
Turns out, LDD will run and read what it needs from the Assets directory.
Here is the result of me having a bit of fun with one of the fragment shaders (I added a little bit of green :P):
-snip-

In other words: LDD is moddable. There were a bunch of shaders and LUA scripts in there. I wonder what kind of things we are able to do with it..


I've known this for a while; just ask JMMB and Cyrem. The only reason there is an LIF extractor is because I approached them with info about it. I have a bunch of texture modding research I've never published on LDD modding. The videos used to be public, but I hid them a while back.

EDIT: I've brought up a video.

http://www.youtube.com/watch?v=hilafcdOt6g

It was uploaded on Jun 21,2012, 3 months ago, about 5 days before this topic was created.

Edited by le717, 29 September 2012 - 10:04 AM.

  • LUModder thanked this

#8
jamesster

jamesster

  • Forum Moderators
  • PipPipPipPipPip
  • 2,741 posts
Even long before this LIF extractor was made and topic created, bartvbl extracted the LDD files with GameExtractor (we were talking about it on Skype and messing around with the extracted files together). No modding was attempted, we just looked at textures and stuff, specifically, textures showing a really early version of LEGO Universe Mode from 2008 or early 2009, with the original game logo (the one BEFORE the yellow minifig hand logo). :P

Posted Image

(According to Brickshelf, I uploaded that file in early January 2011, and I uploaded it a while after bartvbl initially found it if I remember right.)

Some folks over at Eurobricks have also been doing LDD tweaking for a while now, though I haven't looked at their tools that much (I think one of them is called "LDDManager"). But, AFAIK, nobody has done shader modding and such before.

#9
Alcom1

I'm recognizing the Assemblies and Primitives files from the .lif as being in the LEGO Universe Game files as well. db.lif in LDD, brickdb.zip in LU.

The .lxfml files in Assemblies are for parts that are an assembly, such as minifigures torsos and legs.

.g files are probably the files for the pieces themselves.

Am I noticing new things or just confirming what is already well known?

#10
bartvbl

bartvbl

    g33k

  • Platinum Members
  • PipPipPipPip
  • 254 posts

.g files are probably the files for the pieces themselves.


I have been trying to figure these out. I am at least certain that they contain the geometry data in some way.
The files seem to have some kind of binary format, but from what I can see they have small repeating patterns, which could be 3D coordinates.
The problem is that the files seem to be linked to each other in some way. For example, by far the smallest .g file is the one of the stormtrooper helmet,
which of course has by no means the smallest polycount of all brick models. So I think it gets its other geometry data from other .g files.
The directory name, "brickprimitives" seems to confirm this.

The LFXML and XML files that share the names of the .g files define all the properties of the bricks. Mostly their physics simulation properties (bounding boxes, center of mass, etc).
They have a link to a part number (a .g file)

Edit: figured out why parts are split into multiple files; textured objects require a different kind of rendering, so it looks like parts of the brick that have different textures than the rest are separated into their own files. I have verified it with a few bricks, and all bricks that contain textures seem to be split up.
  • jamesster and LUModder thanked this

#11
Tracker

Tracker

    AIV

  • Gold Members
  • PipPipPipPipPip
  • 1,250 posts
If this means what I think it means, then LDD has little excuse to be using so much memory.

#12
sirpaul

sirpaul

    Newbie

  • Members
  • Pip
  • 4 posts
This is awesome. How do I save the files back to LDD, If I have made some custom decals of the extracted files in the assets.lif?

By the way, how do I make custom bricks?

- Paul

#13
JrMasterModelBuilder

JrMasterModelBuilder

    LR, LR2, LDR, and LDD Extractor Creator

  • Crystal Members
  • PipPipPipPip
  • 544 posts

This is awesome. How do I save the files back to LDD, If I have made some custom decals of the extracted files in the assets.lif?

By the way, how do I make custom bricks?

- Paul


You can't recreate LIF files at the moment, there's still parts of the file format we don't understand, but you don't need to as you can just extract the LIF files, and rename (or otherwise remove the LIF file from the location) and LDD will use the extracted folder the same as it would use the LIF.

As for making custom bricks, all I know is that you would need to create your own .xml, and possibly .g, files. I don't know how exactly you would do that, but we would need to reverse engineer the parts formats first.
  • sirpaul thanked this

#14
sirpaul

sirpaul

    Newbie

  • Members
  • Pip
  • 4 posts


This is awesome. How do I save the files back to LDD, If I have made some custom decals of the extracted files in the assets.lif?

By the way, how do I make custom bricks?

- Paul


You can't recreate LIF files at the moment, there's still parts of the file format we don't understand, but you don't need to as you can just extract the LIF files, and rename (or otherwise remove the LIF file from the location) and LDD will use the extracted folder the same as it would use the LIF.

As for making custom bricks, all I know is that you would need to create your own .xml, and possibly .g, files. I don't know how exactly you would do that, but we would need to reverse engineer the parts formats first.


So what is the procedure for using a custom decal in LDD, when I don't have the ability yet to compress the extracted folders into .lif?
Using LIF Extractor, I have extracted the Assets.lif, then db.lif and created a custom decal and saved it among the other png's in the Decorations folder.

What's next?

#15
Alcom1

saved it among the other png's


I believe you should replace current decals with the new custom ones, not simply add them into the folder.