[IButton,CompareVertCountMDD,"Check if the MDD file verts count is the same as selected mesh",
[VarSet,fileVerts,0]
[VarSet,meshVerts,0]
//load the file 5th - 8th bytes into memory
[MemCreateFromFile,MC_VertTestMem,"boxing.mdd",4,4]
[MemCreate,MC_VertsLEMem,4,0]
//convert big endian to little endian:
[MemCopy,MC_VertTestMem,3,MC_VertsLEMem,0]
[MemCopy,MC_VertTestMem,2,MC_VertsLEMem,1]
[MemCopy,MC_VertTestMem,1,MC_VertsLEMem,2]
[MemCopy,MC_VertTestMem,0,MC_VertsLEMem,3]
//get the file verts number - unsigned long
[MemRead,MC_VertsLEMem,fileVerts,6,0]
//done with memblocks - delete
[MemDelete,MC_VertTestMem]
[MemDelete,MC_VertsLEMem]
//get the mesh verts number:
[Mesh3DGet,0,,,meshVerts]
[If,(fileVerts == meshVerts),
[Note,"OK, the verts number is the same"]
,//else they are different
[Note,"WARNING! the verts number is different"]
]
]
[IButton,CompareVertCountOBJ,"Check if the OBJ file verts count is the same as selected mesh",
[VarSet,fileVerts,0]
[VarSet,meshVerts,0]
[VarSet,vertsStr,""]
[VarSet,offset,0]
[VarSet,bytes,0]
//load first part of OBJ file into memory
[MemCreateFromFile,MC_VertTestMem,"boxing.obj",0,512]
//check the comment lines for ZBrush vertex count entry
[Loop,5,
[VarSet,bytes,[MemReadString,MC_VertTestMem,vertsStr,offset,1]]
[If,([StrFind,"#Vertex Count ",vertsStr]==0),//if entry is there
[VarSet,vertsStr,[StrExtract,vertsStr,14,256]]
[VarSet,fileVerts,vertsStr]
]
//get the mesh verts number:
[Mesh3DGet,0,,,meshVerts]
[If,(fileVerts == meshVerts),
[Note,"OK, the verts number is the same"]
,//else they are different
[Note,"WARNING! the verts number is different"]
]
]