Wed, Feb 19, 2:16 AM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2025 Feb 05 6:41 am)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: python for import/export Obm motion camera data (Electric Image Universe)


andygraph ( ) posted Sun, 27 February 2005 at 6:02 AM ยท edited Wed, 19 February 2025 at 1:55 AM

It's possible create a python script for import/export a obm file ? (The obm file is a camera motiona data format of Electric Image.) thx for feedback ;-) this is a example of the structure: --------------------------------------------------------------------------------------------------- MOTION SECTION Object: "Camera 1" Frames: 4 Frame Time: 0.040000 Channels: 7 XTRAN YTRAN ZTRAN XROT YROT ZROT FOV INCHES INCHES INCHES DEGREES DEGREES DEGREES DEGREES 5.767436 4.020914 -18.196330 7.893003 -2.009235 -0.167604 62.241633 5.765903 4.019576 -18.132818 7.888657 -1.999127 -0.179130 62.241620 5.765213 4.021562 -18.067537 7.888798 -1.999150 -0.176237 62.241614 5.763929 4.020183 -18.005863 7.876129 -1.995005 -0.176884 62.241606 ---------------------------------------------------------------------------------------------------


ockham ( ) posted Sun, 27 February 2005 at 11:29 AM

Writing the file is easy; determining the field of view is the hard part. Here's a formula that seems to work, based on some Googled info + some experimentation. FOV (deg) = (180/pi) * 2 * atan (1000 / (focal*2)) where 1000 mm is a guesstimate of Poser's "film size" based on some experiments. I'm writing the PY now, based on this formula; if you know a better one, I can change it easily.

My python page
My ShareCG freebies


andygraph ( ) posted Sun, 27 February 2005 at 11:40 AM

Sorry i don't experience about it:-( anyway will be usefull to have a python script for import/export camera data from not only ElectricImage, but too .. Maya, 3D studio, Lw, C4D ... ;-)


ockham ( ) posted Sun, 27 February 2005 at 12:44 PM

file_191468.jpg

For your testing, here's a first try of the script. CAUTION: The FOV figure is NOT right yet. I'm asking a question about frame size in the main Poser forum, and should get an answer soon. In the meantime, tell me if the file format and other numbers are right.

My python page
My ShareCG freebies


andygraph ( ) posted Sun, 27 February 2005 at 5:16 PM

file_191469.jpg

I have just give a name to this script: OBM writer ;-) When i try to load OBM writer i see that .. and if i try to click on botton no happen nothing


ockham ( ) posted Mon, 28 February 2005 at 3:02 AM

file_191470.jpg

Here's a version with a better formula. I think it's close to correct. On the file part: I remember that your Mac system was different. We did find a method that worked, but I can't find it in my notes. Can you refer to a script with the file-open box that does work?

My python page
My ShareCG freebies


andygraph ( ) posted Mon, 28 February 2005 at 8:56 AM

Can you refer to a script with the file-open box that does work? nope :-( .but will be useful create one ;-)


andygraph ( ) posted Mon, 28 February 2005 at 9:01 AM

i have try the second version of Obm Writer .. but it's the same :-( Load the py but don't happen nothing when click on botton "Pick name and go"


ockham ( ) posted Mon, 28 February 2005 at 10:44 AM

file_191471.jpg

I looked back a few months. Wasn't it BVH mixer that we were working on? BVH mixer did show one difference in the relevant line. I made the same change in OBM writer. Try this one....

My python page
My ShareCG freebies


andygraph ( ) posted Mon, 28 February 2005 at 11:05 AM ยท edited Mon, 28 February 2005 at 11:08 AM

file_191472.jpg

now i see this message .. P.S. Just i don't remember the fuction of your BVH mixer, ockham. It's based of my old idea ?

Message edited on: 02/28/2005 11:08


ockham ( ) posted Mon, 28 February 2005 at 11:23 AM

file_191473.jpg

Here's another small variation, based on some tips about TKinter for Mac that I found on the web.

My python page
My ShareCG freebies


andygraph ( ) posted Mon, 28 February 2005 at 11:51 AM ยท edited Mon, 28 February 2005 at 11:55 AM

file_191474.jpg

this is the message now .. the same ? P.S. please wrote a little tutorial if it work fine ..

Message edited on: 02/28/2005 11:55


ockham ( ) posted Mon, 28 February 2005 at 3:40 PM

file_191475.jpg

Here's a version that SKIPS the whole file-open dialog. It just writes the file as :runtime:test.obm See if this works!

My python page
My ShareCG freebies


andygraph ( ) posted Mon, 28 February 2005 at 3:48 PM

Click on botton but its don't wrote nothing :-(


ockham ( ) posted Mon, 28 February 2005 at 4:00 PM

Try changing runtime to Runtime in the script. ??????

My python page
My ShareCG freebies


andygraph ( ) posted Mon, 28 February 2005 at 5:22 PM

file_191476.jpg

now, i see this message ..


ockham ( ) posted Mon, 28 February 2005 at 5:28 PM

Ok, try changing the line with MyPath from: MyPath=os.path.normpath(os.path.joinBasePath,'runtime/test.OBM')) to: MyPath=':Runtime:Test.OBM' We'll get there one way or another!

My python page
My ShareCG freebies


andygraph ( ) posted Mon, 28 February 2005 at 5:36 PM

now see wrote this: File "", line 115 MyPath=':Runtime:Test.OBM')) ^ SyntaxError: invalid syntax


ockham ( ) posted Mon, 28 February 2005 at 5:40 PM

file_191477.jpg

You're not editing the line properly. Try this file.

My python page
My ShareCG freebies


nruddock ( ) posted Mon, 28 February 2005 at 5:48 PM

Hope you don't mind me chipping in.
I suspect that the executable isn't called poser.exe on Macs.
Printing out BasePathUncut, BasePath, and MyPath should help work out what's going on.


ockham ( ) posted Mon, 28 February 2005 at 5:52 PM

I'm glad you popped in. I really wish somebody would put together a list of Mac peculiarities as they relate to Poser and Python. I'm frustrated with constant 'blind' debugging.

My python page
My ShareCG freebies


nruddock ( ) posted Mon, 28 February 2005 at 6:04 PM

I know very little about Macs, I'm just trusting my Unix instinct, which went off when I saw the "2524" in the traceback.


andygraph ( ) posted Mon, 28 February 2005 at 6:19 PM

So .. now the "obm writer" wrote the obm file test.OBM ;-) just is better test.obm no test.OBM and inside is better change the "Main Camera" with "Camera 1" Anyway when i try to import the obm file in Electricimage the camera don't have any motion .. but i have create a motion from poser file.


ockham ( ) posted Mon, 28 February 2005 at 6:25 PM

file_191478.jpg

Finally we got some action!!! Here's the file with "Camera 1". Do you want the camera name to always be "Camera 1", regardless of Poser's camera name?

My python page
My ShareCG freebies


andygraph ( ) posted Mon, 28 February 2005 at 6:31 PM

yes in Electric image the first camera is named "camera 1" just is need in export data give this name in obm file poser have a camera name i believe .... or not ? just is need give to poser's camera the data of "camera 1" in obm file when i import the obm file in poser


andygraph ( ) posted Mon, 28 February 2005 at 6:57 PM

now i see this message .. Exception in Tkinter callback Traceback (innermost last): File "HD:program:Poser4:Runtime:Python:Lib:lib-tk:Tkinter.py", line 764, in call return apply(self.func, args) File "", line 126, in HandleName File "", line 54, in WriteOBM TypeError: not all arguments converted P.S. 2:00 am here, i need sleep now, SYT. Thx again for your aid, ockham ;-)


andygraph ( ) posted Fri, 04 March 2005 at 5:52 AM

any progress ?


an0malaus ( ) posted Wed, 09 March 2005 at 8:55 PM

file_191479.jpg

@andygraph & @ockham Guys, I had previously posted elsewhere a script for writing out Full Body Morph value parms and scale parameters to a PZ2 file which made use of my discoveries on how to get Python on the Mac to call the actual Mac OS X File Save Dialog. I have integrated your WriteOBM function into a script which calls the Mac File Save Dialog (I have not idea whether this will work on a PC, but it could be worth trying) without using tkInter at all. I have tested this, but let me know if it works for you or if you have any difficulties. The initial directory is :Runtime:libraries:camera and it will append .obm extensions if left out. File name defaults to the Camera Name. Cheers, GeoffIX



My ShareCG Stuff

Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.


andygraph ( ) posted Thu, 10 March 2005 at 5:12 AM ยท edited Thu, 10 March 2005 at 5:13 AM

thx for your aid gwhicks ;-)

i have try your WriteOBM version
but it don't work

just i have this message: File "", line 117 raise "Dialog Error." SyntaxError: invalid syntax

Message edited on: 03/10/2005 05:13


an0malaus ( ) posted Thu, 10 March 2005 at 9:21 AM

OK. I think I know what that means... Can you add an extra blank line to the end of the file in a text editor and try running it again. If you have no success, I'll probably have to add some debugging statements to try and track this down. I'm guessing that the file save from your browser may have truncated the carriage return from the last line of the file. I have also seen cases where that kind of error arises from multiple people editing a file. E.g. ockham's scripts usually have only spaces for indentation, but I like to use tabs. I saw the same error on an earlier version of the script before I found the errant tab and replaced it with spaces. However, I have just downloaded the script I uploaded and tried it myself without a problem. Save As dialog comes up and everything works. Hmmm. andygraph, can you let me know what OS and poser versions you are running? I'm on OS X 10.3.8 and P5.0.4.335 I did at one point install MacPython and played with adding some of its definition files to the Poser Python folders trying to get tkInter to work, but without success. I do hope I haven't added something that makes this run on my system alone. :-(



My ShareCG Stuff

Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.


an0malaus ( ) posted Thu, 10 March 2005 at 9:27 AM

Damn. I've just looked back at some of your earlier posts andygraph and it looks like your running P4 Pro Pack, if I'm reading the Runtime path correctly. I don't have Pro Pack, but IIRC there are substantial differences between it and P5 Python. I wouldn't be at all surprised if the SimpleDialogs in my script were only included with Poser 5 and therefore won't work at all for you, I'm afraid.



My ShareCG Stuff

Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.


andygraph ( ) posted Thu, 10 March 2005 at 5:46 PM

Yes i have poser 4 pro pack on mac OS 9.2 :-(


an0malaus ( ) posted Thu, 10 March 2005 at 10:00 PM

file_191480.jpg

andygraph, I've attached another version with a little bit of debugging. Just a couple of print statements. The thing I'm worried about is that you may not have a Pro Pack equivalent to the P5 poser.DialogFileChooser function. In the P5 directory ...:Poser 5:Runtime:Python:poserScripts:Utility:, there is a file called uncompressPoserFiles.py. this is one of the sample utility scripts supplied with P5. It has an equivalent poser.DialogDirChooser function call within it. It was this example which led me (as well as doing a binary string search in the Poser 5 executable) to the appropriate syntax for the DialogFileChooser function. If you can find this python script, or any equivalent (and working) example in your Pro Pack Python directories, there may be enough to give me a clue how to proceed. Otherwise, I think we'll be stumped.



My ShareCG Stuff

Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.


andygraph ( ) posted Fri, 11 March 2005 at 3:05 AM

Yes, i have there a file named "compressPoserFiles.py" now your script give this message: File "", line 120 raise "Dialog Error." SyntaxError: invalid syntax


an0malaus ( ) posted Sun, 13 March 2005 at 6:06 PM

@andygraph, sorry for the delay. Since you have that compressPoserFiles.py file, can you run it successfully? I don't mean to compress any files, just to see if it pops up a Mac OS style dialog, rather than one of the XML type dialogs.



My ShareCG Stuff

Verbosity: Profusely promulgating Graham's number epics of complete and utter verbiage by the metric monkey barrel.


andygraph ( ) posted Mon, 14 March 2005 at 2:17 PM

Yes, the compressPoserFiles.py run fine but your script don't work :- (


Privacy Notice

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.