Thu, Feb 6, 4:03 PM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2025 Feb 06 11:58 am)



Subject: Poser Python


Nebula ( ) posted Tue, 12 April 2005 at 4:27 PM · edited Tue, 20 August 2024 at 10:07 PM

Been programming for years but have never messed with Python. In the process of looking at others code, I see that they all 'import poser'. I understand that 'poser' is an include file but where is it? Is it only available during runtime or what? Is there something special I'm missing? Also, do the scripts have to be executed from a particular directory? Thanks, Nebula


ockham ( ) posted Tue, 12 April 2005 at 4:39 PM

It's a bit of a trick. All other 'imports' do refer to real files, usually in the runtime/python/lib or runtime/python/dlls folder. But 'import poser' tells Python to use the function definitions that are actually contained in Poser.exe itself. (This won't work if you're running a script in the external non-Poser environment, but Poser somehow makes it happen.) Sometimes a script seems to work without this statement, but I always put it there for insurance. Second question: Poser can execute a script from anywhere, but practically they need to be in runtime/python, or some folder under that, if they're going to find all those imports.

My python page
My ShareCG freebies


Nebula ( ) posted Tue, 12 April 2005 at 4:43 PM

I see. Do you use any kind of IDE when writing Pythons? Is there an editor or app that you would recommend for writing python scripts? I know that it can be done in Notepad but what about debugging and things like that? I'm used to VB and Java and stuff. I use IDE's mostly. I'd prefer something free if it exists. Thanks,


nruddock ( ) posted Tue, 12 April 2005 at 4:43 PM

poser in Python speak, is a module.
It is built-in to the Poser executable, so you can only use the Classes and Objects defined by from within Poser.

Scripts can go anywhere you like, but must be run from within Poser if they use anything from the poser module.
If a script refers to other modules (script or compiled) they must be in a directory on the PYTHONPATH, or in an appropriate directory in the Python library.


ockham ( ) posted Tue, 12 April 2005 at 4:47 PM

Most of the 'programmers editors' handle Python syntax. I use Kedit, which is a leftover from the Pre-Cambrian Era, but Codewright, Con-Text and others are good. Using an IDE is probably not a good idea, because so much of the Poser action wouldn't be available from the IDE. It's best to just test the scripts in Poser itself.

My python page
My ShareCG freebies


nruddock ( ) posted Tue, 12 April 2005 at 4:48 PM

The full Python (2.2 or later) distribution comes with an editor called "idle". There is also an IDE called DRPython, and Netbeans has a scripting module that supports jython.


Nebula ( ) posted Tue, 12 April 2005 at 5:02 PM

Well, I see that ConText is free and it has the code templates for Python. Looks about right too. So all I need to do is create the script and reference the import poser and basically run it from within Poser? The question I had that started me in this direction was a forum message asking for a Python script that would allow you to "gather" all the necessary files for a particular PZ3 file and put them all in one place so that it could be transfered to another system. It seems you had something like that a while ago but it's no longer available. I was thinking it would be nice to gather the files into a standard runtime folder. The one I'm looking at currently does similar. It copies the actual directories that contain the items in the PZ3 to a seperate folder in the same format as the runtime. Then you just copy this new "runtime" to the new system. I'd like to try to do the same since the one I'm looking at seems to be having trouble working. Plus... I just like to program.... Thanks for all your input guys!! Nebula


Nebula ( ) posted Tue, 12 April 2005 at 5:05 PM

Sorry, I got off track and forgot what my question was.... I SO HATE HELPDESK JOBS!!! Anyway, my question above was, this app tries to copy the directories that contain the items. It relies on the PZ3 being open. But it seems to fail to copy the actual files.... it just makes the dir structure. When a PZ3 is open, are the files locked so they can't be copied? Or did I just not wait long enough for the script to finish? Thanks.... again, Nebula


ockham ( ) posted Tue, 12 April 2005 at 5:42 PM · edited Tue, 12 April 2005 at 5:43 PM

If you're talking about my Roundup, it does
take a LOOOOONNNNNGGGGG time for some files!
I tried to improve that but couldn't do it
without essentially rewriting the whole thing
in C. The latter is probably the best solution
anyway.
In other words, it's a job that doesn't really need to be done inside Poser; any compiled language will do it faster than Python.

Message edited on: 04/12/2005 17:43

My python page
My ShareCG freebies


layingback ( ) posted Wed, 13 April 2005 at 12:35 AM

vim (Vi IMproved) from www.vim.org also has a poser syntax file from _dodger


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.