partio
partio copied to clipboard
Writing then reading PDB files under windows x64
Hello,
I know there is a closed issue related to reading 64bits pdb file and that a fix has been provided, here is the log for the fix :
"Now we support .pdb32 .pdb64 and .pdb extensions. .pdb32 forces 32-bit write, .pdb64 forces 64-bit write, and .pdb writes 64 bit. .pdb reads will try to detect 32 bit or 64 bit (which seemed to work on my demo files)."
With a win x64, when I write a pdb file using partio and then when I want to read it, I get the Partio: Attribute 'xxx' cannot map type error. I think the problem comes from the writing process : Partio always writes 32 bit pdb files using the call
bool writePDB(const char* filename,const ParticlesData& p,const bool compressed) {return writePDBHelper<32>(filename,p,compressed);}
On the reading side, partio will detect 64 bit and then will call readPDBHelper<64>(filename,...) And I get the reading error...
I think that a test on the OS for the writing process would fix this issue. Thanks.
Sorry, some characters are missing in my previous post, seems they have been interpreted...
bool writePDB(const char* filename,const ParticlesData& p,const bool compressed) {return writePDBHelper < 32 > (filename,...);}
and readPDBHelper < 64 > (filename,...)
The detection is error prone at best, because there is really no reliable way to tell which format it is. This stems from the struct definition that Autodesk uses to write files was based on a pointer type instead of a stable sized type, so when they went 64-bit the pdb format changed. Unfortunately, this makes a cross 32bit/64bit compatibility really hard. In the interim it probably makes sense to always write what the native platform is. I'll do some testing and check in a fix. If a user wants to override they can always rename the extension to pdb32 or pdb64.