Call for votes: Add !DATA to MPD spec


Call for votes: Add !DATA to MPD spec
#1
Note: I directly copied this from Roland's post.

Please vote for the following update to the MPD spec that allows for binary data to be included in an MPD file.

----------------------

Purpose
MPD files or "Multi-Part Documents" are a way to combine several LDraw and encoded binary files into one consolidated source. This allows for ease in posting or emailing a model made up of many subparts.

Structure
A MPD file consists out of blocks of LDraw code separated by 0 FILE or 0 !DATA statements. Each block is considered a separate file and can be referenced by the other ones as needed.

Blocks starting with the 0 FILE statement are normal type 0..5 line LDraw code.

Blocks starting with the 0 !DATA statement contain binary data encoded using a multitude of 0 !: lines. Each of those lines contain a chunk of base64 encoded data which a parser must combine before decoding. No other LDraw statements may be used inside a !DATA block.

The end of each block, or just the last block in the MPD, may be marked with a 0 NOFILE line. The 0 NOFILE command is only required if the file's contents are followed by non-LDraw content (such as the poster's signature lines). LDraw parsers must then ignore all content until a new 0 FILE or 0 !DATA is found.

In order to support the inclusion of MPD files in message systems (like email), any text lines before the first 0 FILE or 0 !DATA statement will be discarded. It is considered to be an error for any LDraw code (other than comment lines) to appear before the first 0 FILE or 0 !DATA statement.

The first block in the MPD is treated as the 'main model' -- all other files in the MPD will only be rendered if they are referenced by the main model, directly or indirectly. For this reason it is recommended (but not required) to always use a 0 FILE block as the first entry in the MPD.

So far, there are no clear scoping or namespace rules on MPD files. If you put a file named stud.dat in your MPD file, don't be surprised to see your stud.dat file appear on the top of every single brick in your scene.

MPD META Statements

FILE
Format: 0 FILE <filename>
Where:
<filename> is the name of the following LDraw file.

!DATA
Format: 0 !DATA <filename>
Where:
<filename> is the filename of the following encoded data.

!:
Format: 0 !: <base64 string>
Where:
<base64 string> is a chunk of the base64 encoded data (A-Za-z0-9+/) with a maximum length of 80 characters (60 bytes of data). Each line except the last should use the same length and be a multiple of 4 characters. Padding the last line with '=' characters to complete its last group of 4 is optional.

NOFILE
Format: 0 NOFILE
There are no options or parameters.

Example
Code:
0 FILE main.ldr
1 7 0 0 0 1 0 0 0 1 0 0 0 1 819.dat
1 4 80 -8 70 1 0 0 0 1 0 0 0 1 house.ldr
1 4 -70 -8 20 0 0 -1 0 1 0 1 0 0 house.ldr
1 4 50 -8 -20 0 0 -1 0 1 0 1 0 0 house.ldr
1 4 0 -8 -30 1 0 0 0 1 0 0 0 1 house.ldr
1 4 -20 -8 70 1 0 0 0 1 0 0 0 1 house.ldr

0 FILE house.ldr
1 16 0 0 0 1 0 0 0 1 0 0 0 1 3023.dat
1 16 0 -24 0 1 0 0 0 1 0 0 0 1 3065.dat
1 16 0 -48 0 1 0 0 0 1 0 0 0 1 3065.dat
1 16 0 -72 0 0 0 -1 0 1 0 1 0 0 3044b.dat
1 4 0 -22 -10 1 0 0 0 0 -1 0 1 0 sticker.ldr

0 FILE sticker.ldr
0 UNOFFICIAL PART
0 BFC CERTIFY CCW
1 16   0 -0.25 0   20 0 0   0 0.25 0   0 0 30   box5.dat
0 !TEXMAP START PLANAR   -20 -0.25 30   20 -0.25 30   -20 -0.25 -30   sticker.png
4 16   -20 -0.25 30   -20 -0.25 -30   20 -0.25 -30   20 -0.25 30
0 !TEXMAP END

0 !DATA sticker.png
0 !: iVBORw0KGgoAAAANSUhEUgAAAFAAAAB4CAIAAADqjOKhAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
0 !: jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEUSURBVHhe7du9DcIwFABhk5WgQLSsQM0UjMEU
0 !: 1BQsQIsoYAt6NkAYxQV/JQ7WvfuKkFTR6UmOFJzR9bJLkXTlNwyD6QymM5ju5Tl8m67KGUt3XJcz
0 !: J/yY8HZ/6C8BFvNZPoaesMF0BtMZTGcwncF0BtMZTGcwncF0BtMZTGcwnf8t0bmLh85gOoPpDKYz
0 !: mM5gOoPpDKYzmM5gunDBf3tN+/zqNKt367cbOeGUTstxf1nJZHPOx68T/u3XB5/7/zMXLTqD6Qym
0 !: M5jOYDqD6QymM5jOYDqD6QymM5jOYDqD6QymM5jOYLpwwW3t8ajBXTxtTHgwLlp0BtMZTGcwncF0
0 !: BtMZTNfKZzyDiT3hCFy06IIFp3QH/CBMh66aBy4AAAAASUVORK5CYII=
Reply
RE: Call for votes: Add !DATA to MPD spec
#2
I vote yes.
Reply
RE: Call for votes: Add !DATA to MPD spec
#3
The draft can be found here:
https://www.ldraw.org/data-language-extension.html

I think I'll clean it up and link out to the MPD extension for the MPD meta commands.
Reply
RE: Call for votes: Add !DATA to MPD spec
#4
(2020-05-21, 15:40)Orion Pobursky Wrote: The draft can be found here:
https://www.ldraw.org/data-language-extension.html

I think I'll clean it up and link out to the MPD extension for the MPD meta commands.

Just to be clear here, the intent (and what I called for votes on) is to add !DATA to the existing MPD spec, not create a new spec. Roland proposed (and I agreed) that it made more sense as an extension to MPD than as an independent thing. Since it is fundamentally tied to MPD, having it be separate would be bad.
Reply
RE: Call for votes: Add !DATA to MPD spec
#5
(2020-05-21, 19:20)Travis Cobbs Wrote: Just to be clear here, the intent (and what I called for votes on) is to add !DATA to the existing MPD spec, not create a new spec. Roland proposed (and I agreed) that it made more sense as an extension to MPD than as an independent thing. Since it is fundamentally tied to MPD, having it be separate would be bad.

Gotcha. I'll make new draft reflecting that shortly.
Reply
RE: Call for votes: Add !DATA to MPD spec
#6
(2020-05-21, 19:35)Orion Pobursky Wrote: Gotcha. I'll make new draft reflecting that shortly.

Here the new draft:
https://www.ldraw.org/hidden-content/dra...nsion.html
Reply
RE: Call for votes: Add !DATA to MPD spec
#7
(2020-05-21, 20:07)Orion Pobursky Wrote: Here the new draft:
https://www.ldraw.org/hidden-content/dra...nsion.html

Thanks. I just noticed a typo in the original post. Where it said "multitude", it should have said "multiple". Since nobody other than me has cast their vote on this proposal, I simply edited my original post in-place.
Reply
RE: Call for votes: Add !DATA to MPD spec
#8
I vote yes.
Reply
RE: Call for votes: Add !DATA to MPD spec
#9
(2020-05-22, 18:14)Roland Melkert Wrote: I vote yes.

A 'yes' from me.
Chris (LDraw Parts Library Admin)
Reply
RE: Call for votes: Add !DATA to MPD spec
#10
(2020-05-26, 5:38)Chris Dee Wrote: A 'yes' from me.

Awesome. That's a yes from everyone. I'll officialize the draft later today. I'm going to proofread it and add TOC links so I may make some minor admin changes.
Reply
RE: Call for votes: Add !DATA to MPD spec
#11
(2020-05-26, 12:36)Orion Pobursky Wrote: Awesome. That's a yes from everyone. I'll officialize the draft later today. I'm going to proofread it and add TOC links so I may make some minor admin changes.

Revision is now live.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 3 Guest(s)