To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 10440
10439  |  10441
Subject: 
Re: MPD file loading search order
Newsgroups: 
lugnet.cad.dev
Date: 
Tue, 25 Jul 2006 19:26:51 GMT
Viewed: 
2237 times
  
In lugnet.cad.dev, Roland Melkert wrote:

[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.

I mentioned in my other (long) post that I don't think that MPD files should be
required to have a .mpd extension.  However, I'd like to add more here in answer
to your specific question.

I could be wrong, but I'm almost positive that it is impossible to load an MPD
file in one pass.  The reason for this is that files defined inside the MPD are
guaranteed to come after lines in the file that reference those files.
Remember, the main model of an MPD is always the first thing in the file.  Since
it's presumably going to reference wrapped files, those wrapped files are
guaranteed to show up after the lines in the main model that reference the
wrapped files.  I don't see how this can be handled in one pass.

(Oh, and you can't be cute and load the file backwards, because there's nothing
in the MPD spec that specifies any inherent order in the contained files.  So
references can go either direction.)

Mind you, you don't have to actually read the file twice.  LDView stores the
entire contents of the file in an array of strings (each of which represents one
line in the file) on its first pass, and then parses those lines on the second
pass.  But I really don't see any way of avoiding two passes through the data.

--Travis



Message has 2 Replies:
  Re: MPD file loading search order
 
(...) You can do it in one pass (if you don't count the loading of the file to a stringlist). Wile walking through the file you build you're objectlist with subparts. Afterwards you go recursively through the list of subparts. This way all mpd (...) (18 years ago, 25-Jul-06, to lugnet.cad.dev)
  Re: MPD file loading search order
 
(...) What about the following algorithm (assuming everything is cached): - whenever a file reference is read, search for the file in the cache. if not found, add it as an empty file and flag it as 'incomplete' - whenever a 'file' is seen, search (...) (18 years ago, 26-Jul-06, to lugnet.cad.dev)

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

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR