Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
Attached Link: Binary Morph Editor
As I understand it, Pmd files are Binary and not compressed. I noticed that if the file is opened in a text editor, the first few words are the morph name and which group the morph affects. I know D3D has a few scripts that work with Pmds and has a Pmd Editor found here in the marketplace.Hope it helps.
Yes they are binary files, thanks.
Was trying something along these lines but I'm not quite there yet.
try:
import binascii
except:
print "binascii not found"
def main():
filepath = "C:test.pmd"
f = open(filepath,"rb")
data = f.readlines()
f.close()
i = 0
while i < len(data):
text = data[i]
#print binascii.a2b_hex(text)
#print binascii.a2b_hqx(text)
#print binascii.a2b_base64(text)
#print binascii.a2b_uu(text)
print binascii.a2b_qp(text)
i = i + 1
main()
print "done"
Just throwing stuff at the wall here. As above but with:-
import struct
struct.unpack('<4b',text)
http://docs.python.org/library/struct.html
Also:-
import xdrlib
xdrlib.Unpacker.unpack_list(text)
Not there but a little more structured.
def main():
import struct
filepath = "C:test ball.pmd"
f = open(filepath,"rb")
data = f.readlines()
print data
print
print"-----------------------"
print
f = open(filepath,"rb")
while 1:
chunk = f.read(4)
if chunk == "":
break
print struct.unpack('<4b',chunk)
f.close()
main()
Quote - I'm also interested of this because...
saving a figure with python scripts and Binary morph deltas enabled creates a pmd... but not usable for injecting using a pose file. It works if you load it with the figure but cannot be used to load morphs on a figure with a pose (pz2) file.
I assume you do not know the old Miki2.0 exapnsion morphs (Ultimate Body Morphs) from RDNA where injected pmd's. Granted what you are trying to do and how that file was created might be as different as night and day. When it comes to morph creations, injections and or advanced python scripts, I am a complete rookie.
Hopefully without violating the copyright, the first line in the pz2 file reads. It is edited from the original location by me.
injectPMDFileMorphs :Runtime:libraries:Morphs:Miki2:M2UBM.pmd
Gary
"Those who lose themselves in a passion lose less than those who lose their passion"
are you looking at the file with a hex editor ? from when I worked with bigger systems the numbers were stored in several formats according to size and type. For example an integer might be stored as two byte binary as &H0255 which the language decodes to 255.
Just ignore this if it makes no sense. :)
Quote - > Quote - I'm also interested of this because...
saving a figure with python scripts and Binary morph deltas enabled creates a pmd... but not usable for injecting using a pose file. It works if you load it with the figure but cannot be used to load morphs on a figure with a pose (pz2) file.
I assume you do not know the old Miki2.0 exapnsion morphs (Ultimate Body Morphs) from RDNA where injected pmd's. Granted what you are trying to do and how that file was created might be as different as night and day. When it comes to morph creations, injections and or advanced python scripts, I am a complete rookie.
Hopefully without violating the copyright, the first line in the pz2 file reads. It is edited from the original location by me.
injectPMDFileMorphs :Runtime:libraries:Morphs:Miki2:M2UBM.pmd
There's a very little difference: the pmd from Ultimate Body Morphs were created using the default Poser library (the + sign). But when you save a figure using a python script, it seems that it does not save exactly the same pmd! It's a Poser Python bug.
As markschum says, it's best to look at bniary files in a hex editor (I use emacs in hexl-mode).
In the case of PMD files, the organisation looks to be quite simple.
Magic (4 bytes) = "PZMD"
Unknown (12 bytes)
Figure count ? (4 bytes)
Figure number ? (4 bytes)
Figure morph header length ? (4 bytes)
Figure morph header
Morph count (2 bytes)
Morph name (1 byte) name length, (length bytes) name
Group name (1 byte) name length, (length bytes) name
Num deltas (2 bytes)
Offset to data (2 bytes) relative to beginning of file
Morph data
Index count (4 bytes
2 doubles ? (16 bytes) X index count
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
What is the encoding/decoding for PMD files? Tried gzip .. no go.
Thanks