Jump to content

LEGO Digital Designer LIF Extractor


JrMasterModelBuilder
 Share

Recommended Posts

JrMasterModelBuilder

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 and Windows 64 bit executables.

Download LIF Extractor

 

GitHub

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 months later...

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):

sxew2.png

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..

  • Like 3
Link to comment
Share on other sites

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.

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

Edited by le717
Link to comment
Share on other sites

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

getstartedwindow_lu.png

(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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

.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.

  • Like 2
Link to comment
Share on other sites

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

Link to comment
Share on other sites

JrMasterModelBuilder

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

JrMasterModelBuilder

If it doesn't load them after placing them inside the folder with the PNG's (and you have also removed the original LIF files, so it will use the folder instead), there is probably also a list of all the png textures inside one of the XML files. You could try looking for that list and adding them to it.

Replacing the existing textures would also work, but that's less-than ideal.

Link to comment
Share on other sites

I don't know If it's me who's slow, but since you can't compress the folders back to .LIF, should I just extract the Decorations folder with my custom decals into the main directory of LDD?

Paul.

Link to comment
Share on other sites

JrMasterModelBuilder

I don't know If it's me who's slow, but since you can't compress the folders back to .LIF, should I just extract the Decorations folder with my custom decals into the main directory of LDD?

Paul.

I'm not sure I follow, but here's how you can modify LDD (I'll use db.lif in this example).

Go to the folder db.lif is located, and run LIFExtractor on it. You will get a folder named "db".

Rename "db.lif" to "db_BACKUP.lif" or anything else you prefer to remove it.

Modify anything you want in the "db" folder and LDD should use the modified files.

Link to comment
Share on other sites

I don't know If it's me who's slow, but since you can't compress the folders back to .LIF, should I just extract the Decorations folder with my custom decals into the main directory of LDD?

Paul.

I'm not sure I follow, but here's how you can modify LDD (I'll use db.lif in this example).

Go to the folder db.lif is located, and run LIFExtractor on it. You will get a folder named "db".

Rename "db.lif" to "db_BACKUP.lif" or anything else you prefer to remove it.

Modify anything you want in the "db" folder and LDD should use the modified files.

I only have the "Assets.lif" in my ldd folder, the "db" is in the assets file. I have tried to extract both files and deleted the lifs, but LDD doesn't show any round test circle I made on one of the existing decals in the decoration folder.

AHAAaaa, it's the db.lif file in "AppDataRoamingLEGO CompanyLEGO Digital Designer" that I have to extract.

Now it works. :)

Link to comment
Share on other sites

I made Rocket Racer's face as a decal.

ID:31337

How to change:

Edit DecorationMapping.xml

Add this line:


<Mapping decorationID="31337" designID="3626" surfaceID="1"/>

Save this image into the Decorations folder

https://www.dropbox....ctrrv/31337.png

Launch LDD!

(Im'a do the other decals soon, thanks jamesster for the texture. :D )

That's exactly what I did here. :P But, nobody cared to ask me how I did it, so I never said... ;P

Link to comment
Share on other sites

I made Rocket Racer's face as a decal.

ID:31337

How to change:

Edit DecorationMapping.xml

Add this line:


<Mapping decorationID="31337" designID="3626" surfaceID="1"/>

Save this image into the Decorations folder https://www.dropbox....ctrrv/31337.png Launch LDD! (Im'a do the other decals soon, thanks jamesster for the texture. :D )
That's exactly what I did here. :P But, nobody cared to ask me how I did it, so I never said... ;P
So I figured it out mahself :P BTW, Got the torso done. Image:https://www.dropbox.com/s/gl7bf75yizadrnr/31338.png Line to add

<Mapping decorationID="31338" designID="3817" surfaceID="1"/>

Legs: Images: https://www.dropbox.com/s/fj12inhlob8038x/31339.png https://www.dropbox.com/s/zwhxsuufvmfbrlr/31340.png Lines:

<Mapping decorationID="31339" designID="3816" surfaceID="1"/>

<Mapping decorationID="31340" designID="3817" surfaceID="1"/>

Pre-set models

https://dl.dropbox.com/u/67402346/Rocket%20Racer%20Car.lxf

https://dl.dropbox.com/u/67402346/Rocket%20Racer%20Minifig%20CUSTOM%20DECALS.lxf

Link to comment
Share on other sites

Incidentally, any idea what decorationID numbers are based off of?

Most likely random number generator. The design ID is the brick. Surface ID is which side it's on.

Link to comment
Share on other sites

LDD_Modded.png

Modded_Ninja_%28x2%29.png

Incidentally, any idea what decorationID numbers are based off of?

Most likely random number generator. The design ID is the brick. Surface ID is which side it's on.

I take that back, it's based on the brick's decoration ID from sets.

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.