Thu, Nov 14, 9:42 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: Parameters


Dana_CH_AZ ( ) posted Mon, 29 June 2009 at 1:38 AM · edited Thu, 14 November 2024 at 9:26 PM

Content Advisory! This message contains profanity

Working on a script to "bake" Victoria 4 animation so Interposer can bring it into Cinema 4D (Cinema4D doesn't do Victoria 4 magnets deformers).

Is there a way for me to SetParameter with a value based on a variable?

For example, say if I spawned a morph target based on BreastNatural. Is it possible to set the parameter on the original morph target to the spawned? The reason I want to do this (if possible) is copy the Magnet base morph values and import it into the spawn morph target throughout the animation.


markschum ( ) posted Mon, 29 June 2009 at 10:33 AM

You want to cycle through an animation , and set one morph dial to the same value as another morph dial ?   YES  its certainly possible.  

its parameter.Value to get the current value  and parameter.SetValue() to set it  where parameter is the parameter that you get from the actor which comes from the figure.  

like this
p1 = scn.CurrentFigure().Actor("Hip").Parameter("Xtran").Value()
p2 = scn.CurrentFigure().Actor("Body").Parameter("Xtran").SetValue(p1)


Dana_CH_AZ ( ) posted Mon, 29 June 2009 at 12:42 PM

Thank you. I will give it a try .:)


Dana_CH_AZ ( ) posted Mon, 29 June 2009 at 4:48 PM · edited Mon, 29 June 2009 at 4:51 PM

Ok. Got that almost done. Redoing the code break it up a bit.;)

Got one additional question in relation to this python script.

Since I may have to write different .py files for figure, clothing, etc..how would I got about making a menu inside Poser 7 with those choices?

And also, is there a way to have an If statement to see if a Pose file exist? For instance, I have Elite, Creature Morph..but if someone didn't, I can see a whole bunch of debugging menu. But is there a way to

If Pose File Exists
   load library pose
?


markschum ( ) posted Mon, 06 July 2009 at 4:57 PM · edited Mon, 06 July 2009 at 5:04 PM

tkinter lets youu make a graphic interface , Poser 7 has some dialogs that can be used for specific things , like select from a list, yes/no buttons or input fields for numbers or text. The dialogs are a lot easier than tkinter.

for the file thing you build up a file path as a python string and use os.path.exists(path) to test. It returns a true/false value.
you need to add import os.path to your script.

mypath = runtime path + "/myfile.pz2"
if os.path.exists(mypath):
      loadlibrarypath(mypath)

You can use poser.Libraries to get the runtimes or poser.AppLocation()  to get the poser program folder.

Get the python documentation from www.python.org for python 2.4

** Now for a commercial **

Philc has a document on Poser Python thats pretty good , it includes code examples. 
Very nice examples for tkinter
Its a bit pricey for me but its worth a look. 

** fade to black **** 


Dana_CH_AZ ( ) posted Mon, 06 July 2009 at 5:25 PM · edited Mon, 06 July 2009 at 5:34 PM

Thank you. I will take a look at PhilC book (once I got my bills paid >.> ) :) I have more scripts to write for a tool set for my next movie.:) Going to modify my script to reflect the ospath and stuff.

Also, I looked at a preview of PhilC book (he is so cool), it looks like it is laid out better then Poser Python Manual.:)


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.