Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 572 online users. » 0 Member(s) | 567 Guest(s) Applebot, Baidu, Bing, Google, Yandex
|
|
|
Call for votes: Add !DATA to MPD spec |
Posted by: Travis Cobbs - 2020-05-21, 4:32 - Forum: Standards Board
- Replies (10)
|
 |
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=
|
|
|
PFx Brick parts in the parts tracker |
Posted by: Lasse Deleuran - 2020-05-20, 7:58 - Forum: Parts Tracker Discussion
- No Replies
|
 |
We already have unofficial control bricks, such as the SBrick in the parts tracker: https://forums.ldraw.org/thread-15582.html
I would like to include PFx parts in the similar fashion. These parts have already been created: https://github.com/fx-bricks/pfx-ldraw-m...ster/ldraw
However. There are some issues:
- Some of the authored parts have been created using a conversion tool that makes way too many polygons and cause rendering issues due to polygon orientation and other artefacts. These will have to be rebuilt manually. I am fine with taking up this task, unless someone else has already done so.
- The license of the already-authored parts is not compatible with the one we use. Once the parts have been rebuilt, I think there should be a pull request raised to the original author, so that the new part files can be shared.
- In order to ensure backward-compatibility with the existing parts, the origin of those should be preserved. Will this be an issue in case they do not follow our standard?
- The naming of their parts do not follow our standard: The names are too long, causing issues in some of our older software, and they use CamelCase naming, which is information that isn't preserved when we ignore case.
- The studs and anti-studs are square. Do we have square studs and anti-studs in the library with connection information? Otherwise this might cause issues in LDCad, et. al.
EDIT
I have made som simplified files to start with as I have not made LDPartEditor work on my old machine yet.
The PFx Brick is 1.12MB+544KB for the top and lid, respectively. The simplified version is 14kB: PFx Brick (Simplified)
The Speakers have also shrunk a bit in the simplified versions:
The M Speaker went from 214kB to 3kB (Simplified).
The XL Speaker went from 343kB to 6kB (Simplified).
|
|
|
|