PoserPython 2.4.6
Compatible with P3dO 2.4 and above

PoserPython is composed of:
PoserPython plugin 2.4.6 by Seno Software.
PoserPython Python script 2.4.6 by Seno Software.
Poser Remote Procedure Call 1.34.39 (Prpc) Python script by Kenneth R. Mort, aka Tromnek.

For Daz Studio we also recommend Pontari Productions Prpc plugin, which is not available with this package and has to be downloaded separately on Pontari's website. See weblinks at the bottom of this page.


Purpose

PoserPython is a P3dO Poser plugin.

PoserPython can load and save Poser files directly from P3dO without the need of Poser Library Palette.


Features
  • Open file: you can directly open one file into Poser, even with files that are not in Poser runtimes.
  • Open file from ZIP: (pro) in the same way as above, Poses, Hands, Faces, Lights and Cameras may be opened in Poser directly from a ZIP file.
  • Open partial Pose: (pro) same as the above except you may select a subset of actors and other options. Read more
  • Save file: you can also save Poser files, even to locations that are not in Poser runtimes.
  • Run script: you can also able to run Python scripts in Poser. The Poser Python Scripts Palette is duplicated in P3dO, and PoserPython has a convenient Run Python Script command that can be used to pick a script elsewhere.

Menu & Toolbar

PoserPython will add the following menus items to your P3dO File menu and InDepth toolbar:

Open as a Poser Library Preset Open one or severall Poser file(s) directly into Poser. PoserPython filters Poser only files for this command.
Note that the plugin has the ability to resolve windows shortcuts, thus you can also send links to Poser files instead of the file itself.
(pro) The plugin may also open Poses, Hands, Faces, Lights and Cameras from ZIP files. That is standalone parameter files, as opposed to Mesh files (Figures and Props) which may not be oppened from ZIPs because they are compound files. For the same reason MAT Poses or INJ will only work if the related textures or morphs have been previously unzipped to a Poser Runtime.

Open Partial Pose (pro) Select a subset of actors before opening into Poser. Open partial Pose is only valid for Poses and MAT files. Read more
Note that it also works with Zipped Poses.

Save to Poser Library Allow to save selected content (Camera, Face, Figure,...) from currently opened Poser scene and to save it in a chosen folder (defaulting to P3dO's currently selected folder).

And to P3dO's Tools menu:

Python Scripts Duplicates the Poser Python Scripts Palette and also offers a convenient Run Python Script command that can be used to pick a script elsewhere.
Although launched from P3dO the Python scripts apply in Poser, as if they were ran in Poser.

Options
(Plugins options are available from P3dO's Options dialog, Plugins tab).
Double-click open in Poser By popular request emulates Windows double-click behavior by opening in Poser (shortcut to Open with Poser, see above) instead of P3dO's default (open in P3dO). Other than Poser files (including OBJs) are not affected by this parameter.
Use with Poser Remote Procedure Call daemon (Prpc) Check this option if you are using PoserPythonPrpc.py or any Prpc script as a permanent daemon in Poser.
See How to Use with Prpc below for Prpc installation and further details.
Note that this option is only for Poser, Daz Studio openings are still done with Prpc. See Prpc for Daz Studio below.
Poser Pro Pack compatible Poser Pro Pack was the first Poser with Python enabled. The embedded Python in PPP lacks some key module to communicate with PoserPython. This option will bypass that limit, however keep in mind this is a workaround. As such:
  . It is not recommended to set the option with other versions of Poser.
  . It is not recommended to set the option with Windows Vista and above.
Setting the option will do nothing if you are using Prpc.
Prpc Port This is the Port number used by Prpc (default being: 49160).
The Port in Prpc (PoserPythonPrpc.py line #194) should be the same value. You must edit Prpc script if you modify this value.
It is not recommended to modify the Port. The only reason why you should do this is when some Windows Services is using Port 49160, preventing Prpc to connect to Poser. In that case connection is established with the other application/service (there is no visible error) and the call never reaches Poser.

Limits
- Unlike regular Windows file association PoserPython is not able to open Poser. Poser must be running and - in Prpc case - the listener script active before using PoserPython. Failure to do so will prompt an error message.
- Needles to say you also need Poser Python engine. Poser Python engine is included with latest Poser release, starting from Poser Pro Pack (i.e Poser 4 doesn't have a Python engine).

Using PoserPython with or without Prpc helper
With Prpc Without
(-) Copy PoserPythonPrpc.py into Poser scripts directory (optional) (+) no setup
(-) Run PoserPythonPrpc.py in Poser before Opening from P3dO (+) PoserPython opens automatically in Poser
(-) PoserPythonPrpc.py is showing permanently over Poser (+) PoserPython.py script close itself at the end of load process. No window is showing, except a flashing one when the script starts.
(+) PoserPythonPrpc.py has client script extensions (-) PoserPython.py only purpose is to open/save files, you may still run external scripts but without any control from PoserPython
(-) Prpc communicates with PoserPython through network interface. This has some limited security risks (read the security note below). (+) PoserPython.py isn't using the network to communicate with PoserPython.
As you can see from the table above, our advice is: use Prpc if, and only if, you want to do more than just loading/saving files and running scripts.

If you are not using Prpc daemon you do not have to read further
Unless you are using Daz Studio :)




Prpc for Poser & Prpc for Daz Studio
There are actually 2 different Prpc (links at the bottom of this page).
  • Prpc for Poser by Tromnek which is now obsolete as said above.
  • Pontari Productions Prpc plugin for Daz Studio which I highly recommend

Pontari Productions Prpc plugin for Daz Studio
You cannot open files in Daz Studio from P3dO without that plugin.
Since it is a Daz Studio plugin, Daz Studio will deal with it and you don't have anything to do except installing it.

PoserPython deals with both Poser and Daz Studio, the above parameter "Use with Poser Remote Procedure Call daemon" is only taken into account for Poser usage. PoserPython will always treat Daz Studio openings as Prpc calls.


How to use with Prpc

Prpc or Poser Remote Procedure Call is a python script which offers more features than PoserPython own script (PoserPython.py).
See "Credits and Links" below to visit Prpc web page and have more details.

Setting up Prpc
See "Prpc Setup & Prerequisite" below for where to copy scripts.
The main thing is: the Use with Poser Remote Procedure Call daemon option must be checked in P3dO's Options dialog (Plugins tab).

Calling Prpc from PoserPython

  • From Poser : Activate listener script (PoserPythonPrpc.py) by runing the script from Poser Python scripts menu or Poser Python palette (Files | Run Python Script).
  • From P3dO : same commands as described in "Menu & Toolbar" above.
    Note that P3dO "Stay on top" function (see P3dO Help file) is well suited to PoserPython use, since it gives P3dO the ability to permanently stay on top of Poser.


Prpc Setup & Prerequisite

The Prpc script for PoserPython is:
- PoserPythonPrpc.py : listener script. It is the Poser library loader script with support for running python scripts.
- PoserPythonPrpcEx.py : is installed for backward compatibility only, ignore this one.
You may use any other Prpc script instead of PoserPythonPrpc.py.

Location in P3dO
Setup is automatic and copies all components in P3dO's plugins folder. In this folder you will find the Prpc scripts PoserPythonPrpc.py in its default installation.


Copy to Poser
The default P3dO Plugins directory is not convenient to run the script in Poser (you have to Run the script in Poser before using it, see "How to Use" above).
So it is more convenient to copy it in a Poser Python scripts directory.
Best location being your Poser scripts folder as shown below (you have to copy manually):
warning: in Poser 7 and above the script has to be copied under: poserScripts/ScriptsMenu.



tip: you may add a shortcut to the plugin in Poser and thus run it with a simple keystroke. In order to do this rename it like this:
PoserPythonPrpc.py to PoserPythonPrpc###Ctrl+Alt+P.py. Then striking Ctrl Alt P will run the script in Poser.

Alternatively you may edit "mainButtons.py" so that PoserPython appears in your Python palette (from Poser:Window | Python Scripts).
Add the following to an empty slot (PoserPythonPrpc.py is supposed to be in the above folder, 8 is the index of the slot):

poser.DefineScriptButton(8, ":Runtime:Python:PoserScripts:PoserPythonPrpc.py", "Poser Python")


important: Please read the security note below



PoserPython & PoserPython extended

Only one of the listener scripts is run in Poser at any given time.
PoserPythonPrpc.py or PoserPythonPrpcEx.py.

PoserPythonPrpc interface:
PoserPythonPrpc features
Enable multi-tasking python script mode The default mode (option box unchecked) will allow most python scripts to run while the listening script is running. However, when a new script is run, it will block execution of the previously running scripts (including the listening script). Once you exit the new script, the last previously running script will begin executing again. With the option checked, all scripts run simultaneously, but there are a lot of scripts that won't run in this mode (although there are some that need this mode to run properly).
Enable remote python script execution Enabling this option will allow python scripts to be run in Poser using P3dO. See "How to Use with Prpc" below for further details.
With confirmation If checked, you will be asked to confirm the running of any python script that was asked to be run by P3dO.
? About Poser Remote Procedure Call


Prpc Security note

Python script execution has inherent security risks.

Explanation
The listener script opens a tcp/ip socket on the loopback (lo) network interface. Then it listens for a connection that will deliver a file name to be loaded. It will only accept a connection from the loopback interface so it is pretty safe from attacks that may come from the internet or your local network. However, if a virus or trojan infects your computer, it could send data over your local loopback interface to this script. If the listener script supports the execution of other python scripts a virus or trojan that targets this feature can present a security risk.


Prpc Known issues
  • When closing a scene with the Poser "Close" command (File menu | Close), Poser tries to close all running python scripts. This will cause Poser to hang until you manually exit the python script.
    Since Poser will prompt you for saving your changes you don't need to close a scene before opening a new one. So a workaround for this problem is to use the "New" (File menu | New) or "Open" (File menu | Open) commands to switch to another scene. Another solution is to close PoserPythonPrpc.py before closing your Poser scene.
  • Since P3dO/Poser communication is done through your computer's network interface, that connection may be blocked by your firewall.
    2 solutions : enable P3dO on your firewall, use P3dO/Poser offline. The best being using them offline.
  • Poser 7 limits the number of Python process to just one. Thus when Prpc is running you can execute any other script. By using scripts from P3dO's Tools | Python Scripts menu you can bypass this limit because the script will actually run within Prpc process.


Credits and Links

PoserPython plugin by Seno Software, see main help file copyright for detailed copyright notice.

Poser Remote Procedure Call for Poser by Kenneth R. Mort. Python scripts and PoserPythonSender.exe are copyrighted by Kenneth R. Mort which owns all credits for these.
You can contact TromNek through the Renderosity forum (TromNek at http://www.renderosity.com/members.ez)

Poser Remote Procedure Call has a web page where you can find more information, download latest version of the script (*) and get Prpc extensions: Prpc home page

(*) PoserPythonPrpc.py is just a slightly modified prpcd.py script, you may use any newer version of the latter with PoserPython.

Pontari Productions Prpc plugin for Daz Studio by Pontari Productions
You must use that plugin to open files into Daz Studio from P3dO:
Available here: Prpc for Daz Studio