Write your Python scripts using your favorite text editor.
Poser expects strings to be encoded in Unicode. Scripts utilizing non-Unicode string methods might not work properly.
Avoid multithreading, most especially operations that call the PoserPython API from secondary threads.
wxPython allows you to create add-ons that integrate very well with Poser. You can also add your own palettes to the Poser GUI.
Refer to Runtime:Python:poserScripts: ScriptsMenu:Python Shell.py for implementation basics.
The most important rule: Retrieve managed window from Poser, don’t create your own main event loop.
This section provides a brief example of how a Python script might look. For this example, let’s say that you have an open Poser scene consisting of a figure with its left forearm already selected. The forearm is called an actor. An actor is any element of a Poser scene (body part, prop, etc.) and this manual uses the two terms interchangeably. Let’s say you want to set the x scale to 88 percent.
scene = Poser.Scene()
actor = Scene.CurrentActor()
parm = actor.ParameterByCode(Poser.ParmCodeXSCALE)
parm.SetValue(88)
Let’s look at the above script in detail:
The script begins by obtaining a variable called scene, which is a reference to the current Poser scene. That scene contains numerous actors. Recall that the left forearm is already selected, so all the script needs to do is request the scene’s current actor to define the variable actor. Next, the variable parm consists of a reference to the left forearm’s specified parameter, in this case the parameter XSCALE. A parameter code (ParmCode) designates an easy to remember word to signify the desired parameter. Lastly, the value of the parameter to which parm refers is reset to 88, which will cause the left forearm to shrink to 88% of its normal size along the X-axis.
© 2020-2021 Bondware, Inc. Last updated November 23, 2021