Subject:
|
Re: MPD file loading search order
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Tue, 25 Jul 2006 17:19:38 GMT
|
Viewed:
|
2235 times
|
| |
| |
In lugnet.cad.dev, Roland Melkert wrote:
> I'm implementing a LDraw file loader and was wondering about some
> details concerning mpd. I could not found enough info about this
> elsewhere, or I may overlooked it.
Tim pointed you at the actual MPD spec. You may notice that is is vague on a
lot of points -- it basically leaves it up to the program authors. My comments
below are what makes sense to me, thinking as someone who might create complex
MPDs.
> [1]
>
> When loading a MPD file should I keep checking the first level of
> subparts when some nested part references a part with an name present in
> the top level mpd.
>
> Example a mpd contains, a.dat, b.dat, c.dat and d.dat.
>
> a.dat references b.dat, c.dat, d.dat and hello.dat
>
> Hello.dat is searched in the same directory as the mpd, if found it's
> opened and is something like:
>
> 1 x x x x x...... b.dat
> 1 x x x x x...... foo.dat
>
> Should b.dat be loaded from the parent mpd or should I check directories
> as if it's the first opened dat file, so:
>
> 1: same dir as part
> 2: ldraw directories.
> 3: not found error
I can see advantages to working both ways.
I think, in general terms, it makes the most sense to limit the scope/visibility
of files inside an mpd to just that mpd. So in this case, you would load b.dat
from the file system for the reference in Hello.dat. The reference in the main
mpd would use the b.dat specified in the mpd.
> [2]
>
> Second point I'm unclear of what to do with nested MPD's, is this
> allowed at all?
If you mean a reference from one MPD to another, this should be allowed.
If you mean having an MPD as a FILE inside another physical MPD, that's not
allowed.
> [3]
>
> Last point, Are all dat's potential MPD files or must they be named
> .MPD. I read somewhere about two pass loading, but this is not needed if
> only .MPD files are multi part.
It's really up to you whether or not to require all MPD's to carry the .mpd file
type. But it is fairly easy to check -- if the first line of the file starts
with '0 FILE ', then it's an MPD. Otherwise, it's just a regular LDR.
Steve
|
|
Message is in Reply To:
| | MPD file loading search order
|
| Hello All, I'm implementing a LDraw file loader and was wondering about some details concerning mpd. I could not found enough info about this elsewhere, or I may overlooked it. [1] When loading a MPD file should I keep checking the first level of (...) (18 years ago, 25-Jul-06, to lugnet.cad.dev)
|
29 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|