Interesting idea, I don't know of a tool that can do this in a single step (maybe MPDCenter?) but it shouldn't be to hard to do yourself especially when you already set something up.
The trick is to recursively scan for type 1 lines while keeping a 'parent' matrix in mind. Then based on how these type 1 lines resolve (part or model) do one of two things:
If it's a part (resolved to LDraw location) copy the line to the output ldr while using the line's matrix multiplied with the parent matrix (order is important -> newLineMat = LineMat * parentMat, then go on with the next line.
If it's a non part (outside ldraw location) multiply the parent matrix with the line's matrix (newParentMat = LineMat * parentMat (keep the org parent matrix for the next line) and go recursively inside the referenced (sub)model using the resulting matrix as it's parent matrix.
While doing this you should handle submodels in the mpd like any other 'standalone' model. So don't go recursivly into them unless they are referenced from the main mpd model.
Hope this is somewhat clear/helps
ps I'm asuming the mpd only holds references to official parts and model only custom files. If not so you need to do more work to preserve non type 1 lines and exclude unofficial parts etc.
The trick is to recursively scan for type 1 lines while keeping a 'parent' matrix in mind. Then based on how these type 1 lines resolve (part or model) do one of two things:
If it's a part (resolved to LDraw location) copy the line to the output ldr while using the line's matrix multiplied with the parent matrix (order is important -> newLineMat = LineMat * parentMat, then go on with the next line.
If it's a non part (outside ldraw location) multiply the parent matrix with the line's matrix (newParentMat = LineMat * parentMat (keep the org parent matrix for the next line) and go recursively inside the referenced (sub)model using the resulting matrix as it's parent matrix.
While doing this you should handle submodels in the mpd like any other 'standalone' model. So don't go recursivly into them unless they are referenced from the main mpd model.
Hope this is somewhat clear/helps
ps I'm asuming the mpd only holds references to official parts and model only custom files. If not so you need to do more work to preserve non type 1 lines and exclude unofficial parts etc.