Forum: Poser Python Scripting


Subject: Parameters

Dana_CH_AZ opened this issue on Jun 29, 2009 · 6 posts


Dana_CH_AZ posted Mon, 29 June 2009 at 1:38 AM

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

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

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

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.:)