Tue, Jan 7, 9:32 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: 2024 Dec 02 3:16 pm)

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: Pre-populate save dialog with current filename/path


3doutlaw ( ) posted Tue, 11 December 2012 at 10:28 AM · edited Wed, 25 December 2024 at 4:48 AM

Is there a way to do this?  I got a copy of Philc's Save PZ3 with Thumb, which is cool....but it defaults to no filename and a default path (no where near my desired location) for any PZ3 I have opened.

I'd like to enhance it, and open that file save dialog with the current filename and path

Didn't see anything re: this, in the Poser Python reference manual.


markschum ( ) posted Tue, 11 December 2012 at 10:58 AM

Is it a free script ?   If not Phil would have to answer the question.

 

The save command in Poser python does not  run a dialog, it just uses whetever name is supplied. The original document name is not available unless you load it via script and save the name somewhere. (to Poser 7)


3doutlaw ( ) posted Tue, 11 December 2012 at 11:11 AM

Yes, it appears to be, from header:

Script to save a thumbnail along with a PZ3 file

by PhilC http://www.philc.net

Use for whatever you like but at your own risk.


markschum ( ) posted Tue, 11 December 2012 at 11:18 AM

ok, can you post where you got it ?  I have my own version but would like  a copy of Phils.


3doutlaw ( ) posted Tue, 11 December 2012 at 11:28 AM

Sure, Primorge posted it over in another thread in Poser forum... 

(thats why i checked out the contents before moving ahead...)

I'll PM Philc to be sure...but I was going under the impression from the header its fine, since its pretty clear.  I guess someone could have altered that though?


markschum ( ) posted Tue, 11 December 2012 at 11:42 AM

the line

find the full path to the Poser folder

pathname = os.path.split(poser.AppLocation())[0]

sets the poser application folder as the start of the path for the file choos3er dialog.

you can simply change that line to point to whatever folder you want like

 

pathname = "c:documents and settingsownermy documentsposer_scenes"

the double slashes are required by python since the is a control character.

 

 


PhilC ( ) posted Tue, 11 December 2012 at 11:49 AM

Yes it is a freebie, the original post with the script may be found here:-

http://www.philc.net/forum/viewtopic.php?t=2572


PhilC ( ) posted Tue, 11 December 2012 at 12:27 PM

If you want a default file name simply include in the startDir path

startDir = os.path.join(pathname, "default.pz3")


3doutlaw ( ) posted Tue, 11 December 2012 at 1:24 PM

I was actually trying to get the "current" filename, not a default.  So if I opened an already existing  (not new) pz3, it would use its existing name and path as the starting point in the file chooser.

...on another unrelated note, I notice that if you hit "Cancel", it crashes Poser9 (or at least my Poser9).

I added the below before the Return in getpath (basically just checks to see if you left the default filename with asterisk in it):

if PZ3path.find("*") != -1:
    doIt = 0


markschum ( ) posted Tue, 11 December 2012 at 4:42 PM

You can add some information using the CreateValueParameter  in the scene to let you store things for Poser later. Poser itself does not keep the scene filename anywhere. Its a common request.

If you write a loader script to  get the filename of the pz3, load that scene , and save the scene filename in a ValueParameter its a bit easier. However if you save the scene using Posers menu your parameter will be wrong. 

I dont know if they added something in Poser later than 7 but it would be in the Poser Methods manual if it exists.


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.