Wed, Jan 8, 5:13 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 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: Is it OK to take code from 2 scrripts and mix for personal use?


grichter ( ) posted Wed, 22 August 2007 at 8:14 PM · edited Tue, 07 January 2025 at 12:19 PM

I really like the script that allows you to select various body parts and create you own partial poses. Not at my poser cpu I think it is called Save Pose. Draw back is in the os check scheme it looks for mac vs posix (edited that correction as I am on OSX mac). Plus wants to save the pose to the default P7 runtime. In the netherworks Thumber script, they provide an routine where you select the folder-directory where the generated thumbnail is deposited. I have many many different runtimes and it would be nice if I could select the runtime I wanted the partial pose to be deposited in vs the default P7 runtime. The question is for personal use only, I assume I am allowed to lift code that selects the directory from thumber and edit it into the partial pose script. Granted if I did it and never said a word, no one would ever know. But if I run into problems and need help, the last thing I want is somebody screaming, hey wait a minute that looks like the thumber routine or the partial (pose save) rountine. What the heck are you doing? Again as long as this is for personal use only is this consider legal and morally OK to do by the standards of you all live by? Thanks PS: I have prior Apple script and computer programming experiecne. But that was ages ago. In looking at the two scripts I think I can pretty much figure it out on my own. But one never knows until they try.

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


PhilC ( ) posted Wed, 22 August 2007 at 8:46 PM

If its not being redistributed I can not see any problem. Or put another was if they were both my scripts I'd not have any problem at all.


svdl ( ) posted Wed, 22 August 2007 at 9:00 PM

I agree with PhilC - as long as it's personal use only, it's OK. Just don't redistribute the script.

The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter

My gallery   My freestuff


grichter ( ) posted Thu, 23 August 2007 at 10:29 AM

Thanks guys. Rest assured for personal use only. Just want to speed up my work flow. Using the trick of making a Pose at frame one and a pose at say frame 40 and running it and then grabbing the poses I like and saving them for stills. Trying to make a series of V3, slip and fall poses, with her hands and arms on various positions (the partial poses are bracing and unbracing her fall with her hands and arms). It is so cobvienent that you can save the thumbnail exactly where you want it with Thumber, and the reverse with the Save pose script.

Hold several copyrights and patents, and am very sensative to issues of copyrights, plagerism, intellectual law and fair use, etc. Hence the reason I asked in the first place.

Two more questions related to something else I want to try to do...You can make a call to a prefs file. I assume I can place that prefs file anywhere (in some other runtime other then the default p7 runtiime is the goal)  and it does not need to be in the python folder. Or alternatively and simplier for what I want to try to do, can you pass a user declared variable to a script using the runPythonScript command?

In another scripting language I use for webstore creation, you can make a hyperlink href=somepage.html?Var1="One",Var2="Two". Where you pass the values by declaring variables in the command to load the desired page. I read thru the python readme that came with P7, and didn't see any reference to this type of action. I'd like to use write once, use many vs write many if possible.

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


ockham ( ) posted Thu, 23 August 2007 at 9:06 PM

For passing a command to an external script, a file is simplest.   The
file could be anywhere, as long as both sides know the absolute
filepath.

In P7, the new function ScriptLocation() gives the full path of
where the script is actually running, and you can base the
filename on that location.  In earlier versions you have to use
a more complicated trick to get the actual location.

Free-standing scripts can use arguments just like the argv
setup in C, but I don't think that works well inside the Poser system.
I remember trying it once and abandoning it quickly.  Might be
a way to do it in newer versions, though ... and there's undoubtedly
a way to pass using sockets, but that requires more overhead
than a file.

Also, look at the Pickle module in Python ... it gives you a way to write
any combination of structures (lists, arrays, etc) into a file,
then read the file directly out into the same combination.
Much easier than setting up your own text format when you need 
to pass a complicated set of variables from one script to another.

My python page
My ShareCG freebies


grichter ( ) posted Thu, 23 August 2007 at 9:44 PM

Thanks. I did a search on this forum on books and ordered both Mark Lutz books. On the python main site or what I think is the main site it makes reference to the argv in free standing, yet searching this forum brings up nothing useful relative to poser as you say.

 Regarding sockets I did find a poser example that uses that method.

The concept is do runPythonScript and try to pass a variable that is the filepath+filename of a pz2 file and deal with the passed variable inside the script

If push comes to shove I assume I can use scriptlocation() and I assume I can get the script name and parse it down and remove the .py and add.pz2. Just name the script the same as the target pz2 file name. If that can be done then I have the data I need.

When I knew what I was doing programing wise about 2 decades ago, I used to have a motto, "There is more then one way to skin a cat" . Meaning where there is a will there is a way. Might not be the way the code was intended to be used, but you can always figure someway around to make it work.

Gary

"Those who lose themselves in a passion lose less than those who lose their passion"


ockham ( ) posted Thu, 23 August 2007 at 9:57 PM

" I assume I can get the script name and parse it down and remove the .py and add.pz2. Just name the script the same as the target pz2 file name. If that can be done then I have the data I need."

Yup, sort of like this:

import os
import string
import poser

ScriptHere = poser.ScriptLocation()  # full name
front,ext = os.path.splitext(os.path.normpath(ScriptHere)) # Split the extension from the rest
FileToPass=front + ".PZ2" # Add pz2 to the rest
fp=open(FileToPass,"wt") # Then write what you want in the file.
fp.write("bunch of other stuff")
fp.close()

My python page
My ShareCG freebies


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.