New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multi-part document (MPD) support #26
Comments
Thanks for the details. I've read the specification and my reactions are as follow. General remarks
Library 📦
|
After giving this some more thought, I noticed that all the official parts use the extension
Yeah I misinterpreted it at first. I should be able to just handle this using the SourceMap like you mentioned. |
Support added in #27, closing this. |
Ldraw has an MPD extension for embedding multiple files in the same file. The extension is documented here: https://www.ldraw.org/article/47.html.
While files using the MPD extension typically use the .mpd extension, it's also common to see .ldr files containing multiple embedded files. This seems to be the standard way to define submodels in a single ldraw file or embed custom parts.
The current parsing implementation assumes all subfile commands come from the resolver like
DiskResolver
, which won't be the case for embedded files. This causes resolve errors. The spec doesn't make any requirements on how to handle embedded filenames "masking" the filenames of actual parts on disk. This could theoretically be handled by just parsing and adding all the embedded files to the source map before recursing into the subfiles themselves. This would ensure the embeddedsubmodel
file gets loaded before we try and resolve the command1 ... submodel
.This may also require changes to the return type of the parse commands. Returning a single
SourceFile
may not adequately capture that the file could have embedded files. This depends on whether aSourceFile
should represent the list of commands in a single ldraw file or the file "blocks" as represented in the MPD extension. It still makes sense forparse_raw
to return theSourceFile
. The recursive versionparse
could return all commands in a singleSourceFile
, return a collection ofSourceFile
, or not return aSourceFile
at all.I'm currently working on reworking the file loading to try and support this extension as described above. Let me know if you have any suggestions or concerns.
The text was updated successfully, but these errors were encountered: