Parts search paths - Printable Version +- LDraw.org Discussion Forums (https://forums.ldraw.org) +-- Forum: General (https://forums.ldraw.org/forum-12.html) +--- Forum: Official File Specifications/Standards (https://forums.ldraw.org/forum-32.html) +--- Thread: Parts search paths (/thread-23765.html) |
Parts search paths - Leonardo Zide - 2019-11-25 I was wondering if there is an official specification for parts folder priorities and limitations, I looked at the LDraw file format spec and it is somewhat vague in this area. When loading an MPD file I search folders in this order: - MPD subfiles - unofficial parts folder - unofficial p folder - parts folder - p folder - MPD folder And as for restrictions, should a file inside the MPD take priority over another file in the library (including primitives)? For example, if the MPD has a file called stud.dat, should it replace the studs in a part in the library? It would be great to have some clarity on this to ensure consistency between applications. RE: Parts search paths - Orion Pobursky - 2019-11-25 (2019-11-25, 22:29)Leonardo Zide Wrote: And as for restrictions, should a file inside the MPD take priority over another file in the library (including primitives)? For example, if the MPD has a file called stud.dat, should it replace the studs in a part in the library? Yes. RE: Parts search paths - Leonardo Zide - 2019-11-26 (2019-11-25, 22:36)Orion Pobursky Wrote: Yes. What about if there's a file called stud.dat in the same folder as the mpd, should it be loaded instead of the one inside the mpd? And if you're loading a plain ldr file and there's a file called stud.dat in the same folder as the ldr, does this stud.dat take priority over the one in the library as well? RE: Parts search paths - Philippe Hurbain - 2019-11-26 (2019-11-26, 19:25)Leonardo Zide Wrote: What about if there's a file called stud.dat in the same folder as the mpd, should it be loaded instead of the one inside the mpd?I would expect the embedded file to have priority. If the person who prepared the mpd embedded the file, it's to use that file and not another. Quote:And if you're loading a plain ldr file and there's a file called stud.dat in the same folder as the ldr, does this stud.dat take priority over the one in the library as well?That's the default behaviour I think. RE: Parts search paths - Leonardo Zide - 2019-11-26 (2019-11-26, 19:31)Philippe Hurbain Wrote: That's the default behaviour I think. Would it be possible to remove this uncertainty (even you said "I think") by having the official spec state the correct search order? From what you're saying it should be: MPD subfiles Model folder Unoficial/P Unoficial/Parts P Parts Does P come before Parts or the other way? RE: Parts search paths - Travis Cobbs - 2019-11-27 (2019-11-26, 23:13)Leonardo Zide Wrote: Would it be possible to remove this uncertainty (even you said "I think") by having the official spec state the correct search order? In LDView, P comes before Parts. Furthermore, <LDrawDir>/Models is also at the end of the list (due to original LDRAW.EXE having that in its search path). Whether that's a good thing or a bad thing is debatable. I think it would be reasonable to codify the list in a spec. RE: Parts search paths - Philippe Hurbain - 2019-11-27 (2019-11-26, 23:13)Leonardo Zide Wrote: Would it be possible to remove this uncertainty (even you said "I think") by having the official spec state the correct search order?My restriction was more on a functional side: I have been caught many times by loading a model on the web and open it directly while it is in my temp folder... and then old weird part files sitting there may appear in the model and somehow break it!!! As Travis said it would be a nice thing to clarify (and write) these rules. RE: Parts search paths - Leonardo Zide - 2021-03-13 (2019-11-27, 4:35)Travis Cobbs Wrote: In LDView, P comes before Parts. Furthermore, <LDrawDir>/Models is also at the end of the list (due to original LDRAW.EXE having that in its search path). Whether that's a good thing or a bad thing is debatable. I was having a conversation with Trevor about a bug in LPub3D related to this and looks like both LDView and LDCad search the official folders before unofficial so the search order I posted is wrong. I'll be changing LeoCAD to follow the other tools but this is really something that should be in the standard. What's the procedure to proposing an update to the spec? RE: Parts search paths - Roland Melkert - 2021-03-13 (2021-03-13, 18:02)Leonardo Zide Wrote: and looks like both LDView and LDCad search the official folders before unofficial LDCad has no hardcoded order except the 'p' and 'parts' one. Libraries them selves are searched in the order the user puts them in the configuration dialog. RE: Parts search paths - Travis Cobbs - 2021-03-14 (2021-03-13, 18:02)Leonardo Zide Wrote: I was having a conversation with Trevor about a bug in LPub3D related to this and looks like both LDView and LDCad search the official folders before unofficial so the search order I posted is wrong. I'll be changing LeoCAD to follow the other tools but this is really something that should be in the standard. Apparently I was misremembering when I originally posted that. I just looked at the source code, and LDView's default search path is like this: [color=rgba(255, 255, 255, 0.85)] return "<MODELDIR>"[/color] [color=rgba(255, 255, 255, 0.85)] "|<HIDE><DEFPRIM><LDRAWDIR>\\P"[/color] [color=rgba(255, 255, 255, 0.85)] "|<DEFPART><LDRAWDIR>\\PARTS"[/color] [color=rgba(255, 255, 255, 0.85)] "|<LDRAWDIR>\\MODELS"[/color] [color=rgba(255, 255, 255, 0.85)] "|<UNOFFIC><HIDE><DEFPRIM><LDRAWDIR>\\Unofficial\\P"[/color] [color=rgba(255, 255, 255, 0.85)] "|<UNOFFIC><DEFPART><LDRAWDIR>\\Unofficial\\PARTS"[color=rgba(255, 255, 255, 0.85)];[/color][/color] The above comes from Lars C. Hassing's LDrawIni (which LDView uses). Before looking for a file on the disk (using LDrawIni), LDView first checks if the file has been loaded from an MPD. So files in MPD files always come first. As for updating the spec, I'll get that process started. |