Jump to content

Photo

LDR Importer


  • Please log in to reply
29 replies to this topic

#1
le717

LDR Importer

 
LDR Importer is an Blender 2.6 importer script for models created in the LDraw Model (.ldr, .dat) format. There are currently three developers working on this, with myself as the lead developer.
 

 

History

 

Spoiler

 

Downloads

 

Features

 

This list is by no means complete. There may be features I have forgotten to add.

  • General
  • Supports all versions of Blender 2.67 onward
  • Automatically preserves installation path to LDraw Brick Library through use of a configuration file
  • Attempts to detect installation path to LDraw Brick Library (Windows only, can be expanded to other platforms if data can be supplied)
  • Non-programmer understandable error messages are thrown for the majority of errors
  • Import on any scale (default: 0.05)
     
  • Library & Models
  • Fully supports library folder structure, including unofficial, p/48, and p/8 folders
  • Supports models in .dat and .ldr format; Multi-part DAT (.mpd) and Bricksmith models do not work properly.
  • Ability to choose between high-resolution, low-resolution, and normal-resolution primitives
  • Model optimization option available by default to clean up the mesh, in addition to using the original mesh
     
  • Colors
  • Uses LDConfig.ldr for color list rather than internal list, providing up-to-date and accurate colors
  • Supports most of the LDraw colors for Blender Internal, including transparent, chrome, pearlescent, rubber, and metal
  • Experimental support for Cycles Engine materials
  • Automatically detects render engine and uses the appropriate materials

Edited by le717, 18 January 2014 - 10:12 PM.


#2
JrMasterModelBuilder

JrMasterModelBuilder

    JAM Extractor Creator

  • Contributors
  • PipPipPipPip
  • 500 posts
Yay! Minifig head exports to ldr files now!

P.S. I can make OS X instrucitons if you want.

#3
le717

Yay! Minifig head exports to ldr files now!

P.S. I can make OS X instrucitons if you want.


Yes, the minifg head now exports.

Please do! I run Windows only, so I could not write OS X instructions myself. Just paste them here or PM me with it, and I'll add it to the Readme upon the next release of the scripts. ;)

EDIT: Perhaps now that's I've released it, someone might be able to figure out how to import alpha colors into Blender... ;P

Edited by le717, 20 October 2012 - 11:36 PM.


#4
JrMasterModelBuilder

JrMasterModelBuilder

    JAM Extractor Creator

  • Contributors
  • PipPipPipPip
  • 500 posts
Editing the path to LDraw works the same.


The easiest way to install scripts in Blender on OS X would be to place them here:

~/Library/Application Support/Blender/<BLENDER_VERSION_NUMBER>/scripts/addons/

The "/scripts/addons/" folders probably won't exist by default. Also, as a quick explaination of the "~", it means the home folder on Unix systems, so /Users/<USERNAME> is what it translates to. Also, ~/Library is a hidden folder as of OS X 10.7 so the easiest way to get to that folder would be to open finder and click Go > Go to Folder... and enter "~/Library/Application Support/Blender/"

The scripts will then appear in the addons menu.



To change the ldraw.xml file, go to the place "LEGO Digital Designer.app" was installed (probably /Applications/LEGO Digital Designer.app), right click "LEGO Digital Designer.app" (or control+click if you're don't have right click enabled :?: O_O ) and select "Show Package Contents". Then open "Contents/Resources/" and replace the "ldraw.xml" file.

#5
le717

Thanks JMMB! I've got it, and am currently adding it into the Readmes.

or control+click if you're don't have right click enabled


What? You have to enable right-click on OS X? Man, the more I hear about OS X, the less and less I'm happy Dad has aways bought Windows, and think that Windows 8 will actually be a nice OS...

O.T.
Nobody start a OS war here. I am just stating my view, and I do not wish to debate with you about which OS is better. ;)


#6
JrMasterModelBuilder

JrMasterModelBuilder

    JAM Extractor Creator

  • Contributors
  • PipPipPipPip
  • 500 posts

Thanks JMMB! I've got it, and am currently adding it into the Readmes.

or control+click if you're don't have right click enabled


What? You have to enable right-click on OS X?

Apple mice, yes. It varies with trackpads and third party mice. What confuses me is that some people like it that way. That and the "natural" (read "backwards") scroll wheel direction.

Complaints about default configuration aside, Apple's trackpads are really amazing devices. Their under-leveraged with the system software, but with the Better Touch Tool addon it's insane what gestures you can add to it.


Man, the more I hear about OS X, the less and less I'm happy Dad has aways bought Windows, and think that Windows 8 will actually be a nice OS...

O.T.
Nobody start a OS war here. I am just stating my view, and I do not wish to debate with you about which OS is better. ;)

I think you mean more and more happy?

#7
le717

I think you mean more and more happy?


Yea, that's what I meant. I typed that incorrectly. :P

Editing the path to LDraw works the same.


Yea, but what do OS X users use to edit plain text files? This is no Notepad++ port for Mac (and their won't be without a complete rewrite), so IDK what to tell them to open it with. I'm thinking more about built-in software than stuff you have to download (although I could mention one, just like I do for Windows...)

#8
le717

V0.7 of the Blender LDraw Import script is released! V0.6 was a bug fix release, but V0.7 is a feature release! I've added the ability to import bricks from every single folder, including Unofficial bricks! JMMB and ProfessorBrickkeeper also helped me write OS X installation instructions. Get V0.7 from on the Topic Post!

#9
JrMasterModelBuilder

JrMasterModelBuilder

    JAM Extractor Creator

  • Contributors
  • PipPipPipPip
  • 500 posts

I think you mean more and more happy?


Yea, that's what I meant. I typed that incorrectly. :P

Editing the path to LDraw works the same.


Yea, but what do OS X users use to edit plain text files? This is no Notepad++ port for Mac (and their won't be without a complete rewrite), so IDK what to tell them to open it with. I'm thinking more about built-in software than stuff you have to download (although I could mention one, just like I do for Windows...)

OS X comes with TextEdit, which is like a Wordpad/Notepad hybrid, so it would need to be open in text mode and not rich text mode. Personally, I rarely use the thing, TextWrangler is a much better OS X text editor.

#10
le717

Thanks for the OS X apps, JMMB. I'll add that to the readme. ;)

BUG REPORT

Blender 2.6 LDraw Importer V0.7 cannot be loaded in Blender 2.64. Why? IDK, I still have to look at the console messages. No planned bug-fix date has been set. In the mean time, if you have updated to Blender 2.64, download the ZIP archive of Blender 2.63 to import your LDraw models/bricks.

#11
le717

I've fixed the Blender 2.6 LDraw Import script. I don't have time to explain what I did, plus I did a bunch of other stuff. Just take a look at Readme.html for more info. Get it on the Topic post.

#12
JrMasterModelBuilder

JrMasterModelBuilder

    JAM Extractor Creator

  • Contributors
  • PipPipPipPip
  • 500 posts

I've fixed the Blender 2.6 LDraw Import script. I don't have time to explain what I did, plus I did a bunch of other stuff. Just take a look at Readme.html for more info. Get it on the Topic post.

That's cool that you were able to embed the add_utils in the script, that should make it easier to install.

#13
sinthetic

sinthetic

    Newbie

  • Members
  • Pip
  • 4 posts
Hi le717,

First of all, thank you very much for your time and effort. I am a long time 3D designer that just last week found Lego Digital Designer and couldn't figure out how I could export the files to a useable format (i.e. blender). I am using Blender 2.6.4 (aware of previous bug) and followed your instructions in the Read Me very closely. The only issue I am having is that in blender I can't actually check the box for your importer, it refuses to let me select it, so I am not sure what I did wrong as I thought I did it all right. I am using Mac OSX and the only little stumble I had was which part (how much) of line 29 needed to be replaced. I just replaced the parts you had in the " " with my newly created path which is LDRAWDIR = ~/Library/Application Support/Blender/2.64/scripts/addons does that look right? I didn't want to bother you, but after reading that you updated your script to work with 2.6.4 specifically, I can't figure out what I did wrong or why I can't check the box under User Preferences in blender for your script. Any help would be greatly appreciated, thanks and have a great weekend!

PS: I was using your 0.7.1 version that was uploaded 2 hours before I downloaded it so I am sure it was the latest.

#14
le717

Hi sinthetic! Welcome to RRU! Please stick around for a while!

Thanks for your interest in my Blender 2.6 LDraw Importer. It's always nice to hear from someone who has used my stuff!

First off, Line 29 (LDRAWDIR) should be the path to your LDraw Brick Library. You will need to download the LDraw Brick Library for Mac, and replace Line 29 (only the stuff in " ") with that path. For Windows, the default installation path is C:\LDraw. I do not own a Mac, so I'm not sure where LDraw is installed to by default. In the near future, I hope to fix this method of setting the LDraw path from editing the script to doing it from within Blender. The path you typed is where the script itself belongs. I need to get with JMMB (JrMasterModelBuilder) a bit more on making Mac instructions, as well as Linux ones.

Second, when was it exactly did you download V0.7.1? After the initial upload, I released I forgot to change bl_info to make it work with Blender 2.63 (it said 2.64), as well as to reset the LDrawPath line. I reuploaded it late yesterday, and the currently uploaded version is the corrected one.

As for the bug, I'm not exactly sure what is happening. Can you provide some more info? When you load the script into Blender files, and right after you open Blender itself, open the Console Window (Window>Toggle System Console) and the Addons menu. With the addons and console side by side, click the check box once to write text in the console. Click it only once, because clicking it more than once will reprint the info. Whatever prints, please copy that exactly and paste that here. The info basically says why the script cannot be loaded. I'll take a look at it, and see what I can do to fix it. I won't be able to take a look at it tonight or tomorrow, but I'll look as soon as I can. ;)

Thanks!

-le717

#15
sinthetic

sinthetic

    Newbie

  • Members
  • Pip
  • 4 posts
Hi le717,

Thanks for the reply. I do believe I have the latest version of your script (looking at creation date), but I am going to start all over from scratch to make sure I have it right. I think having JrMasterModelBuilder in the mix would be really helpful as I only use Windows at work at home I primarily run OS X, which has a "console" and the "terminal", but they aren't quite the same as Windows so I'm not sure how to get the text you were referring to. After reading your reply I saw something that stood out and may be my issue, the "LDraw Brick Library". I only have what LEGO Digital Designer installs, so I will first start there and then recreate my path. I am sure this is something I have done wrong, it's just a little foreign to me. Thanks again, I will definitely post a reply if I figure out what I did wrong so not to waste your time, and if I still can't get it right I will just wait for when you and JrMasterModelBuilder have time to help me out if you don't mind. Thanks again!

#16
JrMasterModelBuilder

JrMasterModelBuilder

    JAM Extractor Creator

  • Contributors
  • PipPipPipPip
  • 500 posts
Since the python script is now a single file, these instructions should be easier.

1. Download the LDraw complete.zip from here: http://www.ldraw.org.../downloads.html and extract it.
2. Take the ldraw folder inside and put it somewhere relatively permanent.
3. In Finder, select the Readme.txt file inside the ldraw folder and from the application bar click File, Get Info.
4. Under General, copy the folder path (ends in "ldraw") listed under Where.
5. Open "ldraw_import.py" in a text editor (TextWrangler, TextEdit, etc.) find the line starting with "ldraw_base" and paste the ldraw path copied in step 4 between the quotes after it.
6. Open Blender and open File > User Preferences > Addons > Install Addon...
7. Browse for "ldraw_import.py" and open it.
8. Find the LDraw imported under the Addons window and click the check mark.

When you load the script into Blender files, and right after you open Blender itself, open the Console Window (Window>Toggle System Console) and the Addons menu.

That feature actually doesn't exist in the OS X version (not sure about the Linux version). To do that, you would need to open Terminal and do the following:
cd "<the folder blender.app is in>"
cd blender.app/Contents/MacOS
./blender


#17
sinthetic

sinthetic

    Newbie

  • Members
  • Pip
  • 4 posts
JrMasterModelBuilder, thank you very much for the info I really appreciate it. I finally figured out what I had wrong. I had already made an Automator key command to copy the file path so I knew that was correct, but whenI pasted it where the original text was on line 28, there was an extra ' which I thought was supposed to be there since it is in the original. I looked at the syntax of other lines and it didn't make sense I tried removing it and BAM! I can now check the box! I could always see the box, it just wouldn't react with a check mark, just stayed blank. I just did a quick import test with blender and it works great!!!! Thank you so much JrMasterModelBuilder and le717!

#18
le717

JrMasterModelBuilder, thank you very much for the info I really appreciate it. I finally figured out what I had wrong. I had already made an Automator key command to copy the file path so I knew that was correct, but whenI pasted it where the original text was on line 28, there was an extra ' which I thought was supposed to be there since it is in the original. I looked at the syntax of other lines and it didn't make sense I tried removing it and BAM! I can now check the box! I could always see the box, it just wouldn't react with a check mark, just stayed blank. I just did a quick import test with blender and it works great!!!! Thank you so much JrMasterModelBuilder and le717!


You're welcome! You know, last night after I went to bed, I thought about the fact that there may be an extra ' added, I just didn't think about it being in the original script!

Glad to know you got it working. But keep checking back here! We are trying to continue to improve the script as much as we can! :D

P.S. I'll take a look at the script and remove that extra '. I don't want anyone to have any more errors!

EDIT: Fixed the upload. The extra ' has been removed.

#19
le717

I am happy to announce a new, special version of the SpBlender script, Blender 2.6 LDraw Importer Special BMesh Edition. I've taken the V0.7.1 code and changed it to import LDraw models using BMesh, which basically means you can import models use N-gons (up to a 150-gon, the highest I allowed). This is meant to be a research tool, not for general purpose use. Many programs do not support BMesh, and Blender itself supports it as of 2.63+. If you use the script for 3D work, please contine to use the normal release. Again, this is a research tool. I have no plans to make it part of the normal script.

Download Blender 2.6 LDraw Importer Special BMesh Edition from here. I've also upload sample Blender 2.64 BMesh models. And if that isn't enough, here is a large (1080p) clay render of a normal and BMesh LDraw 3001.dat

Spoiler


Enjoy the research.



#20
sinthetic

sinthetic

    Newbie

  • Members
  • Pip
  • 4 posts
Yes, everything is working very well right now, thanks again guys! I just need to learn blender more, I ordered their Blender Inside Out DVD, I know many applications, just not blender. It has so much power for a free app, I had to dedicate some time to it. I used your LDraw import to make a really crude LEGO rubber duck splashing into some water simulation in blender, so fun to play with!

I'll check back here more after i have learned blender better so I can utilize everything properly.

-sinthetic