Thu, Nov 28, 5:07 PM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Sep 18 2:50 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: Generic Poser Python questions.


tromnek ( ) posted Sun, 09 January 2005 at 12:30 PM · edited Thu, 28 November 2024 at 3:53 PM

(Sorry for top-posting)
GWeb wrote:
Tromnek, I still wonder how you were able to write code in PY.
Now you just said you need Python.DLL from Poser PP.
Would you please tell us how you were able to get external DLL to work with standalone Python.

I thought your first question was answered on a previous post of yours
http://www.renderosity.com/messages.ez?ForumID=12390&Form.ShowMessage=2067516
Please re-phrase your question. Also, do you have Poser 5 or Poser Pro-Pack installed?

I would like the python.dll and the support libraries from Poser Pro-Pack so I can test my scripts under the version of python that comes with Pro-Pack.

I execute the python.dll that ships with Poser5 and Pro-Pack by using a utility written by Fredrik Lundh( http://effbot.org/zone/exemaker.htm )

Message edited on: 01/09/2005 12:32


GWeb ( ) posted Sun, 09 January 2005 at 1:51 PM

Some of us have to write script with blindfold on. Some of us wondered how you were able to use Python.DLL with PY standalone. Were you able to get the Poser's code references in standalone?


tromnek ( ) posted Sun, 09 January 2005 at 2:30 PM

I run python.dll instead of py standalone. The poser code references are not available. I think the poser object model that we get when we: import poser comes from the 'running' poser environment. Even if you could import the methods somehow (write a dummy class that mimics poser's), you wouldn't have a valid 'poser.Scene' to deliver anything of use. It's just not really worth it to write a 'dummy' class since it really won't help much. That's why we will comment out the poser specific code when we debug outside of poser. I take it that you don't have Poser 5 or Poser Pro Pack. Are you developing scripts for someone else?


GWeb ( ) posted Sun, 09 January 2005 at 3:14 PM

No I own Poser 5 and want to write script. In my opinion Python is bad programming applicance because it lack intellisense like in VB. I have to tolerate PY to make scripts I want. Thank you for pointing me to use Poser to run the script. Do you think it will help if Poser have PY text editor built in with intellisense and object browser?


tromnek ( ) posted Sun, 09 January 2005 at 4:07 PM

Python is a language not a programming appliance. Just like VB and C++ are languages (Visual Studio is the programming appliance or IDE). I the standard python distribution ships with a basic editor and IDE (called idle). The editor should work fine in poser-python, but I don't know about the rest (and it's 'intellesense' is somewhat limited). I think there also are some object browsers around, again I don't know if they will work in poser-python. I'm very partial to my programming editor so I'm not looking for another programming environment. I use this programming editor for most of my work when programming any language. I burned it on to a credit-card CD-rom and carry it around with me in my wallet everywhere. Most often I use an IDE just for compiling and debugging.


GWeb ( ) posted Mon, 10 January 2005 at 2:14 AM

Intellisense is very helpful for beginners to put right syntax in script and easy to choose to put in lines. It is very understandable that you do not want to look for other programming environment. I dont like a change either. When I want something for example Poser with my hobby project and I have to learn Python. If I was president of Curious Labs I would provide SDK for VB and NET. Alot of programmers would want to develop plug ins with Poser, providing more functions for customers to play with.


tromnek ( ) posted Mon, 10 January 2005 at 7:14 AM

Yes, intellisense is useful for beginners (and veterans). Yes, like you, I'm learning python specifically for poser. Although now I have come to appreciate many of it's features as a general purpose programming language. Curious Labs probably decided on python (instead of vb, vba and .net) because they wanted one solution for both the windows and macintosh environments.


trobbins2 ( ) posted Tue, 11 January 2005 at 2:32 AM

Actually I currently have a project in the works to address all of this. It's a fairly simply script in poser python that simply acts as a server to get and send information back to the client application.

You run the poser script and it starts the server, which listens for commands from the client application. The client application can send a variety of commands (pretty much every special command and variable that poser python handles), it can send a command to get the value of a variable, set the value of a variable, or to run an internal poser python command.

Once it's finished (it may take a while, but the initial coding is going well, the server is working great, just working on teaching it all the poser commands now) I'll upload it here for beta testing.

For the initial release it will be the server in python for poser and the python source code needed to interact with the server. That way you can use any version of python and any add ons for it (like PythonWin or wxPython) to code your applications. When you need to get or update data from poser, or get it to perform an internal command, you just use a code snippet and pass it a few parameters to perform that operation.

The first release will be a bit basic, of course, but I'll test it and document it as best I can before uploading it. Later on after I get the server working just the way I want it I'll work on adding support for other programming languages, such as Visual Basic or C++. Shouldn't be all that difficult, just a matter of coding a small client application for them that can connect and interact with the server.

I don't have a firm release date yet, but with a bit of luck I might have something ready to alpha or perhaps even beta test in a few weeks.


tromnek ( ) posted Tue, 11 January 2005 at 6:40 PM

I wrote something like that for external apps to pass data into Poser. I have a server running on a tcp/ip socket bound to the loopback (lo) interface.
http://www.renderosity.com/messages.ez?ForumID=12390&Form.ShowMessage=2022288

Currently it accepts filenames, then it loads (or executes .py files) them. Seno Software (P3dO) has a plug in comming out for it soon.

Next step is for it to accept a input stream so we can do RPC or accept arbitrary data (need to define a protocol).

My main problem is how to run my server daemon in the background, Poser's python doesn't have threads. I have to run a Tkinter instance.
Did you find a way around this using the python that ships with Poser?


trobbins2 ( ) posted Wed, 12 January 2005 at 9:13 AM

Nope.. hit a brick wall there I'm afraid. My own server works great - but poser won't respond while the server is in operation, it requires the script to exit first.

I'll take a look at your TKinter workaround, see if I can't get some ideas there. I've only been coding python for about a week now so I'm still learning, admittedly I'm digging through some docs to find all the code references you used.. lol..

I was also thinking of "reversing" the flow a bit, but I'm not sure how feasible that will be. Rather than having the server "listening" for incoming sockets see if I can't use a keyboard interrupt or some other message handler to queue the server and let it know an update is needed, then have the server make the connection to the client software and send the appropriate info.

Not sure how feasible that will be, but it was a thought that occurred to me at about 3 am after a few 2 litres of Moutain Dew.. lol..

Well, back to the drawing board... lol..


tromnek ( ) posted Wed, 12 January 2005 at 8:19 PM

oh well. I just started serious on the python recently also. It has some really good stuff. Unfortunately some of my favorites are not supported under Poser Pro-Pack which is running python 1.5.2 . There is some other minor yet annoying differences also, so you might want to pick up a 1.5.2 distribution for testing compatibility if you only have Poser 5. Let us know how it turns out.


an0malaus ( ) posted Sun, 16 January 2005 at 12:25 AM

[bookmark]



My ShareCG Stuff

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


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.