c1rcle opened this issue on Sep 06, 2002 ยท 4 posts
c1rcle posted Fri, 06 September 2002 at 3:39 AM
yep I've been trying my hand at python at long last. I wrote a really simple script to load mike with a texture & hair then pose him. I know python is really good for manipulating the dials in poser, thanks bushi (faceshaper):) but can it be used to read a list of poser files or scan the directories? what I'm thinking is something like faceshaper but it has a lists of everything you have installed & allows you to pick say 1 character & texture, clothe & pose him with out having to do each step manually, just highlight the ones you want press a button & it runs a script in the background & it loads everything for you. Rob
ockham posted Fri, 06 September 2002 at 4:10 PM
can it be used to read a list of poser files or scan the directories? << Yes, certainly. But beware: there is something odd about the file-handling mechanism in Python. If you get everything just right, it works fine; but it often gives an "attribute error" for reasons that I've never figured out. Also, the file handling actions go by default into the same directory where Poser.exe lives, not in the Runtime.
ockham posted Fri, 06 September 2002 at 4:27 PM
Just to get you started, here's an extremely simple example of writing to a file. The Python documents are woefully short on such examples. # ------------------------------# import os Somefile = open('poo.txt','w') for i in range(10): ~PooString = "Index " + str(i) +"n" ~Somefile.write(PooString) Somefile.close() # -----------------------------# This will create a file named poo.txt in the same directory with Poser.exe, and write ten lines in the file: Index 0 Index 1 Index 2 Index 3 Index 4 Index 5 Index 6 Index 7 Index 8 Index 9 To read a file, you'd start with Somefile = open('poo.txt','r') and the loop might look something like: for i in range(10): ~Newstring[i] = Somefile.read()
c1rcle posted Sat, 07 September 2002 at 2:54 AM
wow thanks ockham, I've still got a lot of reading on python to do, & i'll have to upgrade it when P5 arrives too, I've got v1.5.2 installed right now to fit in with poser.